1 Predicates and Quantifiers CS/APMA 202, Spring 2005 Rosen, section 1.3 Aaron Bloomfield.

Slides:



Advertisements
Similar presentations
Nested Quantifiers Section 1.4.
Advertisements

1.3 Predicates and Quantifiers
Chapter 1, Part II: Predicate Logic With Question/Answer Animations.
Section 1.3. More Logical Equivalences Constructing New Logical Equivalences We can show that two expressions are logically equivalent by developing.
Chapter 1: The Foundations: Logic and Proofs 1.1 Propositional Logic 1.2 Propositional Equivalences 1.3 Predicates and Quantifiers 1.4 Nested Quantifiers.
Predicates and Quantifiers
22C:19 Discrete Structures Logic and Proof Spring 2014 Sukumar Ghosh.
CSE 311 Foundations of Computing I Lecture 6 Predicate Logic Autumn 2011 CSE 3111.
Discrete Mathematics Math 6A Instructor: M. Welling.
1 The Pigeonhole Principle CS/APMA 202 Rosen section 4.2 Aaron Bloomfield.
1 Predicates and Quantifiers CS 202, Spring 2007 Epp, Sections 2.1 and 2.2 Aaron Bloomfield.
Predicates and Quantifiers
Section 1.3: Predicates and Quantifiers
Lecture 8 Introduction to Logic CSCI – 1900 Mathematics for Computer Science Fall 2014 Bill Pine.
Predicates and Quantifiers
Chapter 1: The Foundations: Logic and Proofs
Discrete Mathematics Goals of a Discrete Mathematics Learn how to think mathematically 1. Mathematical Reasoning Foundation for discussions of methods.
CSci 2011 Discrete Mathematics Lecture 3 CSci 2011.
The Foundations: Logic and Proofs
Discrete Maths Objective to introduce predicate logic (also called the predicate calculus) , Semester 2, Predicate Logic 1.
Recursive Definitions and Structural Induction
Logical Equivalence & Predicate Logic
1 Partial Orderings Aaron Bloomfield CS 202 Rosen, section 7.6.
1 Permutations and Combinations CS/APMA 202 Rosen section 4.3 Aaron Bloomfield.
CS 103 Discrete Structures Lecture 05
Nested Quantifiers. 2 Nested Iteration Let the domain be {1, 2, …, 10}. Let P(x, y) denote x > y.  x,  y, P(x, y) means  x, (  y, P(x, y) ) Is the.
Predicates and Quantified Statements M , 3.2.
Chapter 1, Part II: Predicate Logic With Question/Answer Animations.
Chapter 1, Part II With Question/Answer Animations Copyright © McGraw-Hill Education. All rights reserved. No reproduction or distribution without the.
Chapter 1, Part II: Predicate Logic With Question/Answer Animations.
Chapter 1, Part II: Predicate Logic With Question/Answer Animations 1.
Lecture 1.2: Equivalences, and Predicate Logic* CS 250, Discrete Structures, Fall 2011 Nitesh Saxena *Adopted from previous lectures by Cinda Heeren, Zeph.
1 Relations and Their Properties Rosen, section 7.1 CS/APMA 202 Aaron Bloomfield.
Section Predicates & Quantifiers. Open Statement 2 x > 8 p < q -5 x = y + 6 Neither true nor false.
Representing Relations
(CSC 102) Lecture 8 Discrete Structures. Previous Lectures Summary Predicates Set Notation Universal and Existential Statement Translating between formal.
Nested Quantifiers Section 1.5.
1 Introduction to Abstract Mathematics Predicate Logic Instructor: Hayk Melikya Purpose of Section: To introduce predicate logic (or.
Chapter 1, Part II: Predicate Logic With Question/Answer Animations 1.
1 Georgia Tech, IIC, GVU, 2006 MAGIC Lab Rossignac Lecture 02: QUANTIFIERS Sections 1.3 and 1.4 Jarek Rossignac CS1050:
Lecture Predicates and Quantifiers 1.4 Nested Quantifiers.
Lecture 1.3: Predicate Logic CS 250, Discrete Structures, Fall 2012 Nitesh Saxena Adopted from previous lectures by Cinda Heeren.
Fall 2008/2009 I. Arwa Linjawi & I. Asma’a Ashenkity 1 The Foundations: Logic and Proofs Predicates and Quantifiers.
Discrete Structures – CNS 2300
Chapter 2 Symbolic Logic. Section 2-1 Truth, Equivalence and Implication.
CS 285- Discrete Mathematics Lecture 4. Section 1.3 Predicate logic Predicate logic is an extension of propositional logic that permits concisely reasoning.
Discrete Structures Predicate Logic 1 Dr. Muhammad Humayoun Assistant Professor COMSATS Institute of Computer Science, Lahore.
1 CMSC 250 Chapter 2, Predicate Logic. 2 CMSC 250 Definitions l Subject / predicate John / went to the store. The sky / is blue. l Propositional logic-
CSci 2011 Recap ^Propositional operation summary not andorconditionalBi-conditional pq ppqqpqpqpqpqpqpqpqpq TTFFTTTT TFFTFTFF FTTFFTTF FFTTFFTT.
Predicate Logic One step stronger than propositional logic Copyright © Curt Hill.
Lecture 1.2: Equivalences, and Predicate Logic CS 250, Discrete Structures, Fall 2015 Nitesh Saxena Adopted from previous lectures by Cinda Heeren, Zeph.
Discrete Mathematics Mathematical reasoning: think logically; know how to prove Combinatorial analysis: know how to count Discrete structures: represent.
321 Section, Week 2 Natalie Linnell. Extra Credit problem.
Mathematics for Comter I Lecture 3: Logic (2) Propositional Equivalences Predicates and Quantifiers.
1 Introduction to Abstract Mathematics Chapter 3: The Logic of Quantified Statements. Predicate Calculus Instructor: Hayk Melikya 3.1.
Section 1.4. Propositional Functions Propositional functions become propositions (and have truth values) when their variables are each replaced by a value.
Section 1.5. Section Summary Nested Quantifiers Order of Quantifiers Translating from Nested Quantifiers into English Translating Mathematical Statements.
Introduction to Discrete Mathematics Discrete Mathematics: is the part of mathematics devoted to the study of discrete objects. Discrete Mathematics is.
رياضيات متقطعة لعلوم الحاسب MATH 226. Chapter 1 Predicates and Quantifiers 1.4.
Lecture 1.2: Equivalences, and Predicate Logic
Aaron Bloomfield CS 202 Rosen, section 7.4
Proof methods We will discuss ten proof methods: Direct proofs
Permutations and Combinations
Chapter 1 The Foundations: Logic and Proofs
The Foundations: Logic and Proofs
CS 220: Discrete Structures and their Applications
Discrete Mathematics Lecture 4 & 5: Predicate and Quantifier
Lecture 1.3: Predicate Logic
Predicates and Quantifiers
Lecture 1.3: Predicate Logic
Presentation transcript:

1 Predicates and Quantifiers CS/APMA 202, Spring 2005 Rosen, section 1.3 Aaron Bloomfield

2 Terminology review Proposition: a statement that is either true or false Must always be one or the other! Must always be one or the other! Example: “The sky is red” Example: “The sky is red” Not a proposition: x + 3 > 4 Not a proposition: x + 3 > 4 Boolean variable: A variable (usually p, q, r, etc.) that represents a proposition

3 Propositional functions Consider P(x) = x < 5 P(x) has no truth values (x is not given a value) P(x) has no truth values (x is not given a value) P(1) is true P(1) is true The proposition 1<5 is true P(10) is false P(10) is false The proposition 10<5 is false Thus, P(x) will create a proposition when given a value

4 Propositional functions 2 Let P(x) = “x is a multiple of 5” For what values of x is P(x) true? For what values of x is P(x) true? Let P(x) = x+1 > x For what values of x is P(x) true? For what values of x is P(x) true? Let P(x) = x + 3 For what values of x is P(x) true? For what values of x is P(x) true?

5 Anatomy of a propositional function P(x) = x + 5 > x variablepredicate

6 Propositional functions 3 Functions with multiple variables: P(x,y) = x + y == 0 P(x,y) = x + y == 0 P(1,2) is false, P(1,-1) is true P(x,y,z) = x + y == z P(x,y,z) = x + y == z P(3,4,5) is false, P(1,2,3) is true P(x 1,x 2,x 3 … x n ) = … P(x 1,x 2,x 3 … x n ) = …

7 End of lecture on 3 February 2005

8 So, why do we care about quantifiers? Many things (in this course and beyond) are specified using quantifiers In some cases, it’s a more accurate way to describe things than Boolean propositions In some cases, it’s a more accurate way to describe things than Boolean propositions

9 Quantifiers A quantifier is “an operator that limits the variables of a proposition” Two types: Universal Universal Existential Existential

10 Universal quantifiers 1 Represented by an upside-down A:  It means “for all” It means “for all” Let P(x) = x+1 > x Let P(x) = x+1 > x We can state the following:  x P(x)  x P(x) English translation: “for all values of x, P(x) is true” English translation: “for all values of x, P(x) is true” English translation: “for all values of x, x+1>x is true” English translation: “for all values of x, x+1>x is true”

11 Universal quantifiers 2 But is that always true?  x P(x)  x P(x) Let x = the character ‘a’ Is ‘a’+1 > ‘a’? Is ‘a’+1 > ‘a’? Let x = the state of Virginia Is Virginia+1 > Virginia? Is Virginia+1 > Virginia? You need to specify your universe! What values x can represent What values x can represent Called the “domain” or “universe of discourse” by the textbook Called the “domain” or “universe of discourse” by the textbook

12 Universal quantifiers 3 Let the universe be the real numbers. Then,  x P(x) is true Then,  x P(x) is true Let P(x) = x/2 < x Not true for the negative numbers! Not true for the negative numbers! Thus,  x P(x) is false Thus,  x P(x) is false When the domain is all the real numbers In order to prove that a universal quantification is true, it must be shown for ALL cases In order to prove that a universal quantification is false, it must be shown to be false for only ONE case

13 Universal quantification 4 Given some propositional function P(x) And values in the universe x 1.. x n The universal quantification  x P(x) implies: P(x 1 )  P(x 2 )  …  P(x n )

14 Universal quantification 5 Think of  as a for loop:  x P(x), where 1 ≤ x ≤ 10 … can be translated as … for ( x = 1; x <= 10; x++ ) is P(x) true? If P(x) is true for all parts of the for loop, then  x P(x) Consequently, if P(x) is false for any one value of the for loop, then  x P(x) is false Consequently, if P(x) is false for any one value of the for loop, then  x P(x) is false

15 Quick survey I understand universal quantification I understand universal quantification a) Very well b) With some review, I’ll be good c) Not really d) Not at all

16 Chapter 2: Computer bugs

17 Existential quantification 1 Represented by an bacwards E:  It means “there exists” It means “there exists” Let P(x) = x+1 > x Let P(x) = x+1 > x We can state the following:  x P(x)  x P(x) English translation: “there exists (a value of) x such that P(x) is true” English translation: “there exists (a value of) x such that P(x) is true” English translation: “for at least one value of x, x+1>x is true” English translation: “for at least one value of x, x+1>x is true”

18 Existential quantification 2 Note that you still have to specify your universe If the universe we are talking about is all the states in the US, then  x P(x) is not true If the universe we are talking about is all the states in the US, then  x P(x) is not true Let P(x) = x+1 < x There is no numerical value x for which x+1<x There is no numerical value x for which x+1<x Thus,  x P(x) is false Thus,  x P(x) is false

19 Existential quantification 3 Let P(x) = x+1 > x There is a numerical value for which x+1>x There is a numerical value for which x+1>x In fact, it’s true for all of the values of x! Thus,  x P(x) is true Thus,  x P(x) is true In order to show an existential quantification is true, you only have to find ONE value In order to show an existential quantification is false, you have to show it’s false for ALL values

20 Existential quantification 4 Given some propositional function P(x) And values in the universe x 1.. x n The existential quantification  x P(x) implies: P(x 1 )  P(x 2 )  …  P(x n )

21 Quick survey I understand existential quantification I understand existential quantification a) Very well b) With some review, I’ll be good c) Not really d) Not at all

22 A note on quantifiers Recall that P(x) is a propositional function Let P(x) be “x == 0” Let P(x) be “x == 0” Recall that a proposition is a statement that is either true or false P(x) is not a proposition P(x) is not a proposition There are two ways to make a propositional function into a proposition: Supply it with a value Supply it with a value For example, P(5) is false, P(0) is true Provide a quantifiaction Provide a quantifiaction For example,  x P(x) is false and  x P(x) is true Let the universe of discourse be the real numbers Let the universe of discourse be the real numbers

23 Binding variables Let P(x,y) be x > y Consider:  x P(x,y) This is not a proposition! This is not a proposition! What is y? What is y? If it’s 5, then  x P(x,y) is false If it’s x-1, then  x P(x,y) is true Note that y is not “bound” by a quantifier

24 Binding variables 2 (  x P(x))  Q(x) The x in Q(x) is not bound; thus not a proposition The x in Q(x) is not bound; thus not a proposition (  x P(x))  (  x Q(x)) Both x values are bound; thus it is a proposition Both x values are bound; thus it is a proposition (  x P(x)  Q(x))  (  y R(y)) All variables are bound; thus it is a proposition All variables are bound; thus it is a proposition (  x P(x)  Q(y))  (  y R(y)) The y in Q(y) is not bound; this not a proposition The y in Q(y) is not bound; this not a proposition

25 Negating quantifications Consider the statement: All students in this class have red hair All students in this class have red hair What is required to show the statement is false? There exists a student in this class that does NOT have red hair There exists a student in this class that does NOT have red hair To negate a universal quantification: You negate the propositional function You negate the propositional function AND you change to an existential quantification AND you change to an existential quantification ¬  x P(x) =  x ¬P(x) ¬  x P(x) =  x ¬P(x)

26 Negating quantifications 2 Consider the statement: There is a student in this class with red hair There is a student in this class with red hair What is required to show the statement is false? All students in this class do not have red hair All students in this class do not have red hair Thus, to negate an existential quantification: Tou negate the propositional function Tou negate the propositional function AND you change to a universal quantification AND you change to a universal quantification ¬  x P(x) =  x ¬P(x) ¬  x P(x) =  x ¬P(x)

27 Quick survey I understand about bound variables and negating quantifiers I understand about bound variables and negating quantifiers a) Very well b) With some review, I’ll be good c) Not really d) Not at all

28 Translating from English This is example 17, page 36 Consider “For every student in this class, that student has studied calculus” Rephrased: “For every student x in this class, x has studied calculus” Let C(x) be “x has studied calculus” Let C(x) be “x has studied calculus” Let S(x) be “x is a student” Let S(x) be “x is a student”  x C(x) True if the universe of discourse is all students in this class True if the universe of discourse is all students in this class

29 Translating from English 2 What about if the unvierse of discourse is all students (or all people?)  x (S(x)  C(x))  x (S(x)  C(x)) This is wrong! Why?  x (S(x)→C(x))  x (S(x)→C(x)) Another option: Let Q(x,y) be “x has stuided y” Let Q(x,y) be “x has stuided y”  x (S(x)→Q(x, calculus))  x (S(x)→Q(x, calculus))

30 Translating from English 3 This is example 18, page 36 Consider: “Some students have visited Mexico” “Some students have visited Mexico” “Every student in this class has visited Canada or Mexico” “Every student in this class has visited Canada or Mexico”Let: S(x) be “x is a student in this class” S(x) be “x is a student in this class” M(x) be “x has visited Mexico” M(x) be “x has visited Mexico” C(x) be “x has visited Canada” C(x) be “x has visited Canada”

31 Translating from English 4 Consider: “Some students have visited Mexico” Rephrasing: “There exists a student who has visited Mexico” Rephrasing: “There exists a student who has visited Mexico”  x M(x) True if the universe of discourse is all students True if the universe of discourse is all students What about if the unvierse of discourse is all people?  x (S(x) → M(x))  x (S(x) → M(x)) This is wrong! Why?  x (S(x)  M(x))  x (S(x)  M(x))

32 Translating from English 5 Consider: “Every student in this class has visited Canada or Mexico”  x (M(x)  C(x) When the universe of discourse is all students When the universe of discourse is all students  x (S(x)→(M(x)  C(x)) When the universe of discourse is all people When the universe of discourse is all people Why isn’t  x (S(x)  (M(x)  C(x))) correct?

33 Translating from English 6 Note that it would be easier to define V(x, y) as “x has visited y”  x (S(x)  V(x,Mexico))  x (S(x)  V(x,Mexico))  x (S(x)→(V(x,Mexico)  V(x,Canada))  x (S(x)→(V(x,Mexico)  V(x,Canada))

34 Translating from English 7 Translate the statements: “All hummingbirds are richly colored” “All hummingbirds are richly colored” “No large birds live on honey” “No large birds live on honey” “Birds that do not live on honey are dull in color” “Birds that do not live on honey are dull in color” “Hummingbirds are small” “Hummingbirds are small” Assign our propositional functions Let P(x) be “x is a hummingbird” Let P(x) be “x is a hummingbird” Let Q(x) be “x is large” Let Q(x) be “x is large” Let R(x) be “x lives on honey” Let R(x) be “x lives on honey” Let S(x) be “x is richly colored” Let S(x) be “x is richly colored” Let our universe of discourse be all birds

35 Translating from English 8 Our propositional functions Let P(x) be “x is a hummingbird” Let P(x) be “x is a hummingbird” Let Q(x) be “x is large” Let Q(x) be “x is large” Let R(x) be “x lives on honey” Let R(x) be “x lives on honey” Let S(x) be “x is richly colored” Let S(x) be “x is richly colored” Translate the statements: “All hummingbirds are richly colored” “All hummingbirds are richly colored”  x (P(x)→S(x)) “No large birds live on honey” “No large birds live on honey” ¬  x (Q(x)  R(x)) Alternatively:  x (¬Q(x)  ¬R(x)) “Birds that do not live on honey are dull in color” “Birds that do not live on honey are dull in color”  x (¬R(x) → ¬S(x)) “Hummingbirds are small” “Hummingbirds are small”  x (P(x) → ¬Q(x))

36 Quick survey I understand how to translate between English and quantified statements I understand how to translate between English and quantified statements a) Very well b) With some review, I’ll be good c) Not really d) Not at all

37 Today’s demotivators

38 Prolog A programming language using logic! Entering facts: instructor (bloomfield, cs202) enrolled (alice, cs202) enrolled (bob, cs202) enrolled (claire, cs202) Entering predicates: teaches (P,S) :- instructor (P,C), enrolled (S,C) Extracting data ?enrolled (alice, cs202) Result:yes

39 Prolog 2 Extracting data ?enrolled (X, cs202) Result:alicebobclaire Extracting data ?teaches (X, alice) Result:bloomfield

40 Quick survey I felt I understood the material in this slide set… I felt I understood the material in this slide set… a) Very well b) With some review, I’ll be good c) Not really d) Not at all

41 Quick survey The pace of the lecture for this slide set was… The pace of the lecture for this slide set was… a) Fast b) About right c) A little slow d) Too slow

42 Quick survey How interesting was the material in this slide set? Be honest! How interesting was the material in this slide set? Be honest! a) Wow! That was SOOOOOO cool! b) Somewhat interesting c) Rather borting d) Zzzzzzzzzzz