Functional Verification II

Slides:



Advertisements
Similar presentations
Functional Verification III Prepared by Stephen M. Thebaut, Ph.D. University of Florida Software Testing and Verification Lecture Notes 23.
Advertisements

White-Box Testing Techniques IV
Axiomatic Verification I Prepared by Stephen M. Thebaut, Ph.D. University of Florida Software Testing and Verification Lecture 17.
1 Discrete Structures Lecture 29 Predicates and Programming Read Ch
So far we have learned about:
October 1, 2009Theory of Computation Lecture 8: Primitive Recursive Functions IV 1 Primitive Recursive Predicates Theorem 6.1: Let C be a PRC class. If.
Proving Program Correctness The Axiomatic Approach.
Axioms and Algorithms for Inferences Involving Probabilistic Independence Dan Geiger, Azaria Paz, and Judea Pearl, Information and Computation 91(1), March.
Proving Program Correctness The Axiomatic Approach.
Introduction to Proofs
Reading and Writing Mathematical Proofs
Copyright © Peter Cappello Mathematical Induction Goals Explain & illustrate construction of proofs of a variety of theorems using mathematical induction.
Exam 2 Help Session Prepared by Stephen M. Thebaut, Ph.D. University of Florida Software Testing and Verification.
Proofs of Correctness: An Introduction to Axiomatic Verification Prepared by Stephen M. Thebaut, Ph.D. University of Florida CEN 5035 Software Engineering.
CSI 3125, Axiomatic Semantics, page 1 Axiomatic semantics The assignment statement Statement composition The "if-then-else" statement The "while" statement.
Chap 3 –A theorem is a statement that can be shown to be true –A proof is a sequence of statements to show that a theorem is true –Axioms: statements which.
Logical Reasoning:Proof Prove the theorem using the basic axioms of algebra.
Dr. Naveed Riaz Design and Analysis of Algorithms 1 1 Formal Methods in Software Engineering Lecture # 26.
1 Section 8.2 Program Correctness (for imperative programs) A theory of program correctness needs wffs, axioms, and inference rules. Wffs (called Hoare.
Direct Proof and Counterexample I Lecture 11 Section 3.1 Fri, Jan 28, 2005.
Functional Verification I Prepared by Stephen M. Thebaut, Ph.D. University of Florida Software Testing and Verification Lecture Notes 21.
White-Box Testing Techniques I Prepared by Stephen M. Thebaut, Ph.D. University of Florida Software Testing and Verification Lecture 7.
Foundations of Discrete Mathematics Chapter 1 By Dr. Dalia M. Gil, Ph.D.
Section 2.3 Mathematical Induction. First Example Investigate the sum of the first n positive odd integers. 1= ____ 1 + 3= ____ = ____
CS344 : Introduction to Artificial Intelligence Pushpak Bhattacharyya CSE Dept., IIT Bombay Lecture 5- Deduction Theorem.
Axiomatic Verification II Prepared by Stephen M. Thebaut, Ph.D. University of Florida Software Testing and Verification Lecture Notes 18.
Functional Verification III
White-Box Testing Techniques IV
White-Box Testing Techniques IV
EQUATION IN TWO VARIABLES:
Formal Methods in Software Engineering 1
Prepared by Stephen M. Thebaut, Ph.D. University of Florida
Functional Verification IV: Revisiting Loop Invariants
Predicate Transforms II
Functional Verification IV: Revisiting Loop Invariants
Functional Verification III
White-Box Testing Techniques III
Formal Program Specification
Predicate Transforms I
Functional Verification I
Axiomatic semantics Points to discuss: The assignment statement
Exercise Solutions: Functional Verification
Formal Program Specification
Prepared by Stephen M. Thebaut, Ph.D. University of Florida
Exercise Solutions: Functional Verification
Axiomatic Verification II
White-Box Testing Techniques III
Functional Verification I
White-Box Testing Techniques I
Axiomatic Verification II
Axiomatic Verification I
Predicate Transformers
Formal Methods in software development
Proofs of Correctness: An Introduction to Axiomatic Verification
Functional Verification IV: Revisiting Loop Invariants
Axiomatic Verification I
Predicate Transforms I
Prepared by Stephen M. Thebaut, Ph.D. University of Florida
Functional Verification III
Predicate Transforms II
Functional Verification III
Algebraic Specification Software Specification Lecture 34
Problem Set 7: Functional Verification
Primitive Recursive Predicates
Functional Verification IV: Revisiting Loop Invariants
Predicate Transforms I
Prepared by Stephen M. Thebaut, Ph.D. University of Florida
Model-based vs. Functional Program Specification and Correctness
Formal Program Specification
Presentation transcript:

Functional Verification II Software Testing and Verification Lecture Notes 22 Prepared by Stephen M. Thebaut, Ph.D. University of Florida

Previously Verifying correctness in program reading, writing, and validation Complete and sufficient correctness Compound programs and the Axiom of Replacement

Topics: Correctness conditions and working correctness questions: sequencing decision statements

Sequencing Correctness Conditions Suppose we wish to show f = [G; H] First, hypothesize functions g, h and prove: g = [G] and h = [H] By the Axiom of Replacement, the problem then reduces to proving f = [g; h]

Sequencing Correctness Conditions Complete correctness condition for f = [g; h]: Prove: f = h o g Working correctness question: Does f equal h composed with g? Note: h o g(x) = h(g(x))

Sequencing Example Prove f = [P] where f = (x,y := y+2,y) and P is: x := y+2; y := x-2 Proof: Let G be x := y+2 and H be y := x-2. Then, by observation, g = (x,y := y+2,y) and h = (x,y := x,x-2).

Sequencing Example (cont’d) Therefore, by the Axiom of Replacement, it is sufficient to show: f = (x,y := y+2,y) = [g; h] Does f equal h composed with g? h o g = (x,y := x,x-2) o (x,y := y+2,y) = (x,y := y+2,(y+2)-2) = (x,y := y+2,y) = f √

Conditional Function Composition Suppose g = (x,y := 3,x-1) and h = (y>0  x,y := x+1,-y | y≤0  x,y := x,y). What is h o g... ? = (y>0  x,y := x+1,-y | y≤0  x,y := x,y) o (x,y := 3,x-1) = (x-1>0  x,y := 3+1,-(x-1) | x-1≤0  x,y := 3,x-1) = (x>1  x,y := 4,1-x | x≤1  x,y := 3,x-1)

Conditional Function Composition Suppose g = (x,y := 3,x-1) and h = (y>0  x,y := x+1,-y | y≤0  x,y := x,y). What is g o h... ? = (x,y := 3,x-1) o (y>0  x,y := x+1,-y | y≤0  x,y := x,y) = (x,y := (y>0  3,(x+1)-1) | (y≤0  3,x-1)) = (y>0  x,y := 3,(x+1)-1) | y≤0  x,y := 3,x-1)) = (y>0  x,y := 3,x | y≤0  x,y := 3,x-1))

if_then Correctness Conditions Complete correctness conditions for f = [if p then G] (where g = [G] has already been shown): Prove: p  (f = g) Л ¬p  (f = I) Working correctness questions: When p is true, does f equal g? When p is false, does f equal Identity?

if_then Example Prove f = [K] where f = (x := -|x|) and K is: if x>0 then x := x-2*x Proof: Let G be x := x-2*x Then, by observation, g = (x := x-2x)

if_then Example (cont’d) Therefore, by the Axiom of Replacement, it is sufficient to show: f = (x := -|x|) = [if x>0 then x := x-2x] When p is true does f equal g? (x>0)  (f = (x := -x)) (x>0)  (g = (x := x-2x) √ = (x := -x)) When p is false does f equal identity? (x≤0)  (f = (x := x)) = I √

if_then_else Correctness Conditions Complete correctness conditions for f = [if p then G else H] (where g = [G] and h = [H] have already been shown): Prove: p  (f = g) Л ¬p  (f = h) Working correctness questions: When p is true, does f equal g? When p is false, does f equal h?

Exercise Prove f = [A] where f = (x=17  x,y := 17,20 | true  x,y := x,-x) and A is: if x= 17 then y := x+3 else y := -x end_if_else

Coming up next… Iteration Recursion Lemma (!) Termination predicate: term(f,P) Correctness conditions for while_do statement Correctness conditions for repeat_until statement

Functional Verification II Software Testing and Verification Lecture Notes 22 Prepared by Stephen M. Thebaut, Ph.D. University of Florida