Unformatted text preview: b. wp(“y:= x  y; x:= x + y”, x ≤ y) = c. wp(“y:= x  y; x:= x + y”, x ≤ y) ∧ wp(“y:= x  y; x:= x + y”, x > y) = d. wp( “i,m:= 0, b[0]”, 0 ≤ i ≤ n ∧ ( ∃ j 0 ≤ j<i: m=b[j])) = e. wp( “t ′ :=ni; if b[i]=0 → z:=z+1 & b[i] ≠ 0 → skip fi”, t ′ > ni1) 4. For the following: {n>0} i,y:= n, a n {0 ≤ i ≤ n ∧ y= ( Σ j i ≤ j ≤ n: a j x ji )} do i>0 → i:= i1; y:= y*x+a i od {y= ( Σ j 0 ≤ j ≤ n: a j x j )} a. Give a bound function for this loop. b. Prove that the invariant holds before the loop begins. c. Prove that the invariant holds after an iteration given it hold before....
View
Full Document
 Fall '08
 Myers
 formal methods, following program segment, invariant holds, a. wp, c. wp

Click to edit the document details