This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: {true} x:=1 {x=2} i. {x>x} x:=5 {x=6} j. {y=5} x:=5 {y=5 ^ x>y} 3. Compute following (8 points) a. wp( x:=2x+3, x=13) b. wp (x:=x+y, x < 2y) c. wp (x:=y*c, x*y = c) d. wp( x:= (xy)*(x+y) , x+y*y ≠0) 4. For the following assignment programs prove correctness or show incorrect. ( 20 points) a. { z = 3 } x:=1 ; y:=2 { x + y ≤ z } b. { z < 3 } x:=1 ; y:=2 { x + y < z } c. { x ≠ y } x:=y ; y:=x{ x = y } d. { x = 0 } x:=5 ; x:=5 { x ≤ y } e. { y = z } x:=z; y:= z+2 { x = z } f. { true } x:=x+1; y:=x+1 { x = y } g. { x = 1 ^ y = 1 } x:=2y ; y:= 2x { x = y } h. {false} x:=2 ; y:=3 {y>x} i. {true} x:=2 ; y:=3 {y>x} j. {false} x:=1 ; x:=2 {false} 5. Compute following (12 pts) a. wp (x:=y;y:=x , x=y) b. wp (x:=x+1;y:=y+1 , x>y) c. wp (x:=y+1;y:=x+1 , x<y) d. wp( x := 2x+y 5;y:= 2x , y<100) e. wp ( x:=y; y:=z;z:=y;x:=z, even(x) ) f. wp ( x:=2y; x:= x+3k, x<z) 6. prove P => wp (S.R) {P} S {R}...
View
Full Document
 Spring '08
 cs536
 Correctness, Formal verification, formal methods, Hoare logic, a. b. c., following assignment programs

Click to edit the document details