Module 6 - PowerPoint PPT Presentation

1 / 8
About This Presentation
Title:

Module 6

Description:

Definition of type program. Program correctness. Testing versus Proving. 2. Number Theory Problems ... Testing versus Analyzing. Program. P. Test Inputs. x1. x2 ... – PowerPoint PPT presentation

Number of Views:19
Avg rating:3.0/5.0
Slides: 9
Provided by: erict9
Learn more at: http://www.cse.msu.edu
Category:
Tags: module | testing

less

Transcript and Presenter's Notes

Title: Module 6


1
Module 6
  • Topics
  • Program behavior problems
  • Input of problem is a program/algorithm
  • Definition of type program
  • Program correctness
  • Testing versus Proving

2
Number Theory Problems
  • These are problems where we investigate
    properties of numbers
  • Primality
  • Input Positive integer n
  • Yes/No Question Is n a prime number?
  • Divisor
  • Input Integers m,n
  • Yes/No question Is m a divisor of n?

3
Graph Theory Problems
  • These are problems where we investigate
    properties of graphs
  • Connected
  • Input Graph G
  • Yes/No Question Is G a connected graph?
  • Subgraph
  • Input Graphs G1 and G2
  • Yes/No question Is G1 a subgraph of G2?

4
Program Behavior Problems
  • These are problems where we investigate
    properties of programs and how they behave
  • Give an example problem with one input program P
  • Give an example problem with two input programs
    P1 and P2

5
Program Representation
  • Program variables
  • Abstractly, we define the type program
  • graph G, program P
  • More concretely, we define type program to be a
    string over the program alphabet SP a, , z,
    A, , Z, 0, , 9, punctuation, white space
  • Note, many strings over SP are not legal programs
  • We consider them to be programs that always crash
  • Possible declaration of main procedure
  • bool main(program P)

6
Program correctness
  • How do we determine whether or not a program P we
    have written is correct?
  • What are some weaknesses of this approach?
  • What might be a better approach?

7
Testing versus Analyzing
Test Inputs x1 x2 x3 ...
Outputs P(x1) P(x2) P(x3) ...
Analysis of Program P
Program P
8
2 Program Behavior Problems
  • Correctness
  • Input
  • Program P
  • Yes/No Question
  • Does P correctly solve the primality problem?
  • Functional Equivalence
  • Input
  • Programs P1, P2
  • Yes/No Question
  • Is program P1 functionally equivalent to program
    P2
Write a Comment
User Comments (0)
About PowerShow.com