# Module06 - a string over the program alphabet Σ P ={a …...

This preview shows pages 1–8. Sign up to view the full content.

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

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
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 G 1 and G 2 • Yes/No question: Is G 1 a subgraph of G 2 ?

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
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 P 1 and P 2
5 Program Representation Program variables Abstractly, we define the type “program” graph G, program P More concretely, we define type program to be

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: a string over the program alphabet Σ P = {a, …, z, A, …, Z, 0, …, 9, punctuation, white space} • Note, many strings over Σ P 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 Program P Test Inputs x 1 x 2 x 3 ... Outputs P(x 1 ) P(x 2 ) P(x 3 ) ... Analyzer Program P Analysis of 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 P 1 , P 2 – Yes/No Question • Is program P 1 functionally equivalent to program P 2...
View Full Document

## This note was uploaded on 07/25/2008 for the course CSE 460 taught by Professor Torng during the Fall '07 term at Michigan State University.

### Page1 / 8

Module06 - a string over the program alphabet Σ P ={a …...

This preview shows document pages 1 - 8. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online