Quiz3_Review_Solution

# Quiz3_Review_Solution - Solution to Questions from Quiz 3...

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
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Solution to Questions from Quiz 3 Review (Fix bugs in 1e and 1f) Sample Problems 1. Try expanding the following proof outlines. If you nd any predicate logic obligations, list them. a. {} y := 0; x := f ( y ) { x ! f ( y )} { f (0) ! f (0)} y := 0; { f ( y ) ! f ( y )} x := f ( y ) { x ! f ( y )} b. {} x := 0; y := f (0) { x ! f ( y )} {0 ! f ( f (0))} {0 ! f ( f (0))} x := 0; { x ! f ( f (0))} y := f (0) { x ! f ( y )} I think in practice wed leave out the 0 ! f ( f (0)) condition and 0 ! f ( f (0)) ! f ( f (0)) obligation. c. {} z := z + e ; y := y +1 { y = z } {( y +1) = z + e } z := z + e ; {( y +1) = z } y := y +1 { y = z } d. {} z := z + e ; y := y +1 { y > z } {( y +1) > z + e } z := z + e ; {( y +1) > z } y := y +1 { y > z } [Sorry, I forgot to make (c) and (d) more di erent as problems!] e. {} if x > 0 then x := y { y > 0} [Dont forget to add the else skip clause] { x ! 0 y > 0} [Simpli es the condition that follows] {( x > 0 " x > 0) # ( x ! 0 ! y...
View Full Document

## This note was uploaded on 04/17/2011 for the course CS 536 taught by Professor Cs536 during the Fall '08 term at Illinois Tech.

### Page1 / 3

Quiz3_Review_Solution - Solution to Questions from Quiz 3...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online