This preview shows pages 1–6. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: CS2603 Applied Logic for Hardware and Software Rex Page University of Oklahoma 1 Lecture 11 CS 2603 Applied Logic for Hardware and Software What .. more rules? Reasoning with Predicates CS2603 Applied Logic for Hardware and Software Rex Page University of Oklahoma 2 What is a Predicate? Predicate Parameterized collection of propositions P(x) 9 Typically a different proposition for each x 9 Universe of discourse Values that x may take Universe of discourse Must be specified 9 Otherwise, all bets off muchas contradiccines Nonempty 9 Empty universe calls for special handling 9 Default assumption: nonempty universe r e v i e w the Universal Quantifier, Forall x.P(x) This formula is a WFF of predicate calculus whenever P(x) is a WFF of predicate calculus True if the proposition P(x) is True for every value of x in the universe of discourse False if there is some value x in the universe of discourse for which P(x) is False Equivalent to forming the Logical And of all P(x)s Example S predicate about sum S(n) sum[x 1 , x 2 , , x n ] = x 1 + x 2 + + x n n.S(n) 9 Universe of discourse: natural numbers N = {0, 1, 2, } 9 n.S(n) means S(0) S(1) S(2) 9 So, provides a way to write formulas that would contain an infinite number of symbols if written in propositional calculus notation (but infinitely long formulas arent WFFs) r e v i e w CS2603 Applied Logic for Hardware and Software Rex Page University of Oklahoma 3 CS2603 Applied Logic for Hardware and Software Rex Page University of Oklahoma 4 the Existential Quantifier, There Exists x.P(x) This formula is a WFF of predicate calculus whenever P(x) is a WFF of predicate calculus True if there is at least one x in the universe of discourse for which the proposition P(x) is True False if x. P(x) is True Equivalent to forming the Logical Or of all P(x)s Example E predicate about maximum E(n, k) maximum[s 1 , s 2 , , s n ] = s k 9 Note: E(n, k) is an equation (a True/False proposition) k.E(23, k) 9 Universe of discourse for k in k.E(23, k): U = {1, 2, , 23} 9 k.E(23, k) means E(23,1) E(23,2) E(23,23) 9 Do you think k.E(23, k) is True? 9 Note: When U is finite , quantifiers not required Clumsy to write big formulas without quantifiers, though Without quantifiers, reasoning can be more complex, too CS2603 Applied Logic for Hardware and Software Rex Page University of Oklahoma 5 qsort preserves keys qsort conserves keys Another Example with 9 What about...
View
Full
Document
 Spring '08
 RexPage

Click to edit the document details