Presentation is loading. Please wait.

Presentation is loading. Please wait.

Model-based vs. Functional Program Specification and Correctness

Similar presentations


Presentation on theme: "Model-based vs. Functional Program Specification and Correctness"— Presentation transcript:

1 Model-based vs. Functional Program Specification and Correctness
Software Testing and Verification Bonus Review Material Prepared by Stephen M. Thebaut, Ph.D. University of Florida

2 Model-based vs. Functional Specification
{true} temp := x x := y y := temp {x=y’ Л y=x’ Л temp=x’} Comparable specified function (f): f = (x,y,temp := y,x,x) Function computed by the program ([S]): [S] = (x,y,temp := y,x,x) Is the program “correct”? {P} S {Q} ? {P} S {Q} strongly ? f = [S] ? f  [S] ?

3 Weakened Post-Condition
{true} temp := x x := y y := temp {x=y’ Л y=x’} Comparable specified function (f): f = (x,y := y,x) Function computed by the program ([S]): [S] = (x,y,temp := y,x,x) Is the program “correct”? {P} S {Q} ? {P} S {Q} strongly ? f = [S] ? f  [S] ?

4 Strengthened Pre-Condition
{x>0 Л y>0} temp := x x := y y := temp {x=y’ Л y=x’} Comparable specified function (f): (x>0 Л y>0  x,y := y,x) Function computed by the program ([S]): [S] = (x,y,temp := y,x,x) Is the program “correct”? {P} S {Q} ? {P} S {Q} strongly ? f = [S] ? f  [S] ?

5 A different program… {x>0 Л y>0} if (x>0 & y>0) then
temp := x x := y y := temp end_if {x=y’ Л y=x’} Comparable specified function (f): (x>0 Л y>0  x,y := y,x) Function computed by the program ([S]): (x>0 Л y>0  x,y,temp := y,x,x | true  I) Is the program “correct”? {P} S {Q} ? {P} S {Q} strongly ? f = [S] ? f  [S] ?

6 A really different program…
{x>0 Л y>0} if (x>0 & y>0) then temp := x x := y y := temp else while (1=1) do no-op end_while end_if_else {x=y’ Л y=x’} Comparable specified function (f): (x>0 Л y>0  x,y := y,x) Function computed by the program ([S]): (x>0 Л y>0  x,y,temp := y,x,x) Is the program “correct”? {P} S {Q} ? {P} S {Q} strongly ? f = [S] ? f  [S] ?

7 Pre-condition weakened again
{true} if (x>0 & y>0) then temp := x x := y y := temp else while (1=1) do no-op end_while end_if_else {x=y’ Л y=x’} Comparable specified function (f): f = (x,y := y,x) Function computed by the program ([S]): (x>0 Л y>0  x,y,temp := y,x,x) Is the program “correct”? {P} S {Q} ? {P} S {Q} strongly ? f = [S] ? f  [S] ?

8 Model-based vs. Functional Program Specification and Correctness
Software Testing and Verification Bonus Review Material Prepared by Stephen M. Thebaut, Ph.D. University of Florida


Download ppt "Model-based vs. Functional Program Specification and Correctness"

Similar presentations


Ads by Google