This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: Select even (x+y) => (x,y) := (0,0) or odd(x+y) => (x,y) := (x1,y+1) or odd(x) => (x,y) := (y,x) or odd(y) => (x,y := x+1 , y1) end select { even(x) ^ odd(y)} 6. Prove following (8 points) {Nzeros = N i 1=< i <k : a[ i ] = 0} select a[k] = 0 => (Nzeros ,k := Nzeros +1 , k+1) or a[k] =! 0 => (Nzeros , k := Nzeros , k+1) end select {Nzeros = N i 1=< i <k : a[i] = 0} 7. Prove partial correctness of the following program M. {x 0} M {SQR 2 x < (SQR + 1) 2 } (12 points) {x 0} (y1, y2, y3) := (0,1,1) While y2 < = x loop (y1,y2, y3) := (y1+1,y2+y3+2, y3+2); End loop; SQR:= y1 {SQR 2 x < (SQR + 1) 2 } Hint: (a+b) 2 = a 2 +2ab+b 2 1+3+5+ (2n+1) =(n+1) 2 If you can not find the invariant email Dr. Elrad...
View
Full
Document
This note was uploaded on 05/04/2011 for the course CS 536 taught by Professor Cs536 during the Spring '08 term at Illinois Tech.
 Spring '08
 cs536

Click to edit the document details