This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: CS 536 Activities for Lecture 2 Activity 1: Predicate Calculus A. Why? • We’ll be using predicates to write specifications for programs. B. Outcomes At the end of this activity you should: • Be able to read and write predicates. • Be able to logically negate predicates. • Be able to translate informal descriptions of properties on integers and arrays into formal predicates and predicate functions. C. Questions 1. What do we get if we add the redundant parentheses back to ( ∀ x . ∀ y . ∃ z . x ≠ y → x ≤ z ∧ z ≤ y ∨ x > z ∧ z ≥ y ) ? 2. (a) Are there any redundant parentheses in ( ∀ x . ( ∃ y . x > y ) ∧ ( ∃ y . x < y ))? [What’s interesting is to ask if the ones around the first existential are redundant.] (b) If we replace the y ’s in ( ∃ y . x < y ) with z ’s, do we change the meaning of the predicate? 3. Let P(x,y) be a predicate function (i.e., given values for x and y , it yields true or false). Are the predicates ( ∀ x . ∀ y . P(x,y) ) and ( ∀ y . ∀ x . P(x,y) ) equivalent? (I.e., the regardless of how P(x,y) is defined, the first universal is true iff the second universal is true.) 4. Again, assume P(x,y) is a predicate function. Are the predicates ( ∃ x . ∃ y . P(x,y) ) and ( ∃ y . ∃ x . P(x,y) ) equivalent?...
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.
- Fall '08