Nested Quantifiers. Predicates and. Quantifiers. Agenda. Limitation of Propositional Logic. Try to represent them using propositional.

Similar documents
Predicates and Quantifiers. Nested Quantifiers Discrete Mathematic. Chapter 1: Logic and Proof

Section Summary. Section 1.5 9/9/2014

Section Summary. Predicate logic Quantifiers. Negating Quantifiers. Translating English to Logic. Universal Quantifier Existential Quantifier

Discrete Mathematics and Its Applications

ICS141: Discrete Mathematics for Computer Science I

Section Summary. Predicate logic Quantifiers. Negating Quantifiers. Translating English to Logic. Universal Quantifier Existential Quantifier

Thinking of Nested Quantification

! Predicates! Variables! Quantifiers. ! Universal Quantifier! Existential Quantifier. ! Negating Quantifiers. ! De Morgan s Laws for Quantifiers

Logical Operators. Conjunction Disjunction Negation Exclusive Or Implication Biconditional

Section Summary. Predicates Variables Quantifiers. Negating Quantifiers. Translating English to Logic Logic Programming (optional)

1.3 Predicates and Quantifiers

2/2/2018. CS 103 Discrete Structures. Chapter 1. Propositional Logic. Chapter 1.1. Propositional Logic

Propositional Logic Not Enough

CSI30. Chapter 1. The Foundations: Logic and Proofs Nested Quantifiers

Predicate Logic. CSE 191, Class Note 02: Predicate Logic Computer Sci & Eng Dept SUNY Buffalo

CS 220: Discrete Structures and their Applications. Predicate Logic Section in zybooks

Proposi'onal Logic Not Enough

Lecture Predicates and Quantifiers 1.5 Nested Quantifiers

Lecture 4. Predicate logic

Predicate Logic & Quantification

Introduction to first-order logic:

Predicate Calculus lecture 1

Chapter 1, Part II: Predicate Logic

Predicate Logic. Example. Statements in Predicate Logic. Some statements cannot be expressed in propositional logic, such as: Predicate Logic

Predicate Logic Thursday, January 17, 2013 Chittu Tripathy Lecture 04

Introduction to Sets and Logic (MATH 1190)

Mat 243 Exam 1 Review

Topic #3 Predicate Logic. Predicate Logic

Formal Logic: Quantifiers, Predicates, and Validity. CS 130 Discrete Structures

First order Logic ( Predicate Logic) and Methods of Proof

Predicate Calculus - Syntax

Propositional Functions. Quantifiers. Assignment of values. Existential Quantification of P(x) Universal Quantification of P(x)

Logical equivalences 12/8/2015. S T: Two statements S and T involving predicates and quantifiers are logically equivalent

Recall that the expression x > 3 is not a proposition. Why?

Discrete Structures Lecture 5

Transparencies to accompany Rosen, Discrete Mathematics and Its Applications Section 1.3. Section 1.3 Predicates and Quantifiers

Math.3336: Discrete Mathematics. Nested Quantifiers

Today s Lecture. ICS 6B Boolean Algebra & Logic. Predicates. Chapter 1: Section 1.3. Propositions. For Example. Socrates is Mortal

PREDICATE LOGIC. Schaum's outline chapter 4 Rosen chapter 1. September 11, ioc.pdf

Predicates, Quantifiers and Nested Quantifiers

Denote John by j and Smith by s, is a bachelor by predicate letter B. The statements (1) and (2) may be written as B(j) and B(s).

Before you get started, make sure you ve read Chapter 1, which sets the tone for the work we will begin doing here.

ECOM Discrete Mathematics

Predicates and Quantifiers. CS 231 Dianna Xu

Discrete Structures Lecture Predicates and Quantifiers

2/18/14. What is logic? Proposi0onal Logic. Logic? Propositional Logic, Truth Tables, and Predicate Logic (Rosen, Sections 1.1, 1.2, 1.

2. Use quantifiers to express the associative law for multiplication of real numbers.

Lecture 3 : Predicates and Sets DRAFT

Logic and Proof. Aiichiro Nakano

Propositional and First-Order Logic

MAT2345 Discrete Math

Predicate in English. Predicates and Quantifiers. Predicate in Logic. Propositional Functions: Prelude. Propositional Function

DISCRETE MATHEMATICS BA202

Review: Potential stumbling blocks

Discrete Mathematics & Mathematical Reasoning Predicates, Quantifiers and Proof Techniques

Review. Propositional Logic. Propositions atomic and compound. Operators: negation, and, or, xor, implies, biconditional.

Quantifiers Here is a (true) statement about real numbers: Every real number is either rational or irrational.

Chapter 2: The Logic of Quantified Statements. January 22, 2010

Logic and Modelling. Introduction to Predicate Logic. Jörg Endrullis. VU University Amsterdam

Predicate Calculus. Lila Kari. University of Waterloo. Predicate Calculus CS245, Logic and Computation 1 / 59

Formal (Natural) Deduction for Predicate Calculus

ITS336 Lecture 6 First-Order Logic

Packet #2: Set Theory & Predicate Calculus. Applied Discrete Mathematics

Solutions to Exercises (Sections )

3/29/2017. Logic. Propositions and logical operations. Main concepts: propositions truth values propositional variables logical operations

Rosen, Discrete Mathematics and Its Applications, 6th edition Extra Examples

2-4: The Use of Quantifiers

Department of Mathematics and Statistics Math B: Discrete Mathematics and Its Applications Test 1: October 19, 2006

Logic and Propositional Calculus

Announcements CompSci 102 Discrete Math for Computer Science

Math Fundamentals of Higher Math

Predicate Calculus. Formal Methods in Verification of Computer Systems Jeremy Johnson

CSCE 222 Discrete Structures for Computing. Predicate Logic. Dr. Hyunyoung Lee. !!!!! Based on slides by Andreas Klappenecker

MACM 101 Discrete Mathematics I. Exercises on Predicates and Quantifiers. Due: Tuesday, October 13th (at the beginning of the class)

Logic Overview, I. and T T T T F F F T F F F F

1 Predicates and Quantifiers

Reasoning. Inference. Knowledge Representation 4/6/2018. User

CS 1571 Introduction to AI Lecture 14. First-order logic. CS 1571 Intro to AI. Midterm

Logic and Propositional Calculus

STRATEGIES OF PROBLEM SOLVING

MATH 22 INFERENCE & QUANTIFICATION. Lecture F: 9/18/2003

For all For every For each For any There exists at least one There exists There is Some

III. Elementary Logic

Today. Proof using contrapositive. Compound Propositions. Manipulating Propositions. Tautology

Announcement. Homework 1

Chapter 2: The Logic of Quantified Statements

Logic. Logic is a discipline that studies the principles and methods used in correct reasoning. It includes:

Predicate Calculus. CS 270 Math Foundations of Computer Science Jeremy Johnson

Discrete Structures for Computer Science

Why Learning Logic? Logic. Propositional Logic. Compound Propositions

Discrete Mathematics and Probability Theory Spring 2014 Anant Sahai Note 1

Introduction to Predicate Logic Part 1. Professor Anita Wasilewska Lecture Notes (1)

Exercise Set 1 Solutions Math 2020 Due: January 30, Find the truth tables of each of the following compound statements.

Announcements. CS311H: Discrete Mathematics. Introduction to First-Order Logic. A Motivating Example. Why First-Order Logic?

Variable Names. Some Ques(ons about Quan(fiers (but answers are not proven just stated here!) x ( z Q(z) y P(x,y) )

Conjunction: p q is true if both p, q are true, and false if at least one of p, q is false. The truth table for conjunction is as follows.

Bits and Bit Operations. Today s topics

3. The Logic of Quantified Statements Summary. Aaron Tan August 2017

Introduction. Predicates and Quantifiers. Discrete Mathematics Andrei Bulatov

1 The Foundation: Logic and Proofs

Transcription:

Disc rete M athema tic Chapter 1: Logic and Proof 1.3 Predicates and Quantifiers 1.4 Nested Quantifiers Dr Patrick Chan School of Computer Science and Engineering South China Univers ity of Technology Agenda Ch1.3 Predicates and Quantifiers Predicates Quantifiers Quantifiers with Restricted Domains Precedence of Quantifiers Logical Equivalences Involving Quantifiers Translation Ch1.4 Nested Quantifiers Nested Quantifiers 3 2 Limitation of Propositional Logic Limitation 1: p : John is a SCUT student q : Peter is a SCUT student r : Mary is a SCUT student Try to represent them using propositional variable However, these propositions are very sim ilar A more powerful type of logic named Predicate Logic will be introduced 4

Predicates Predicate logic is an extension of propositional logic that permits concisely reasoning about whole classes of entities John Pet er Ma ry Propositional Logic treats simple propositions as atomic entities???? Predicate Logic distinguishes the subject of a sentence from its predicate Predicates Example: P(x) : x > 3 What is P(4)? What is P(2)? P(x) : x is a singer P(M ichael Jackson)? P(Bruce Lee)? 7 Predicates Predicate is a function of proposition Example: Propos itiona l Function / Pre dica te Co nven tion: lower case v ariables denot e objects UPPER CASE v ariables denot e predicat es Variable Pre dica te P(x) : x is greater than 3 Refer to The truth value of proposition function can only be determined when the values of variables are known 6 Predicates Propositional function can have more than one variables Example: P(x, y): x + y = 7 P(2, 5) Q(x, y, z): x = y + z Q(5, 2, 8) 8 5

Predicates General case A statement involving the n variables x 1, x 2,, x n can be denoted by P(x 1, x 2,, x n ) A statement of the form P(x 1, x 2,, x n ) is the value of the propositional function P at the n-tuple (x 1, x 2,, x n ) P is also called a n-place predicate or a n-ary predicate Limitation of Propositional Logic Propositional Logic does not adequately express the following meanings Every, all, some, partial, at least one, one, etc A more powerful tool, Quantifiers, will be introduced 11 Limitation of Propositional Logic Limitation 2: Given P: Every student in SCUT is clever Q: Peter is SCUT student What can we conclude? Peter is clever Given P: Peter cannot pass this Discrete Maths subject Q: Peter is a SCUT student What can we conclude? At least one student in SCUT cannot pass this Discrete Maths subject No rules of propositional logic can conclude the truth of this statement 10 Quantifiers Quantification expresses the extent to which a predicate is true over a range of elements For example Using Propositional Logic p: Peter has iphone q: Paul has iphone r: Mary has iphone Using Predicate P(x) : x has iphone P(Peter) P(Paul) P(Mary) Peter Paul i Phone Our class Using Qua ntifier P(x) : x has iphone For all x, P(x) is true Domain consists of all student in this class Mary Assume our class only contains three students 12 9

Quantifiers Four aspects should be mentioned in Quantificati on 1. Quantifier (e.g. all, some ) 2. Variable 3. Predicat e 4. Domain P(x) : x has iphone For all x, P(x) is true Peter Paul Ma ry Our class Domain co nsists of all student in this class The area of logic that deals with predicates and quantifiers is called the Predicate Calculus 13 Quantifiers Three types of quantification will be focused: Universal Quantification i.e. all, none Existential Quant ification i.e. some, few, many Unique Quantification i.e. exactly one 15 Quantifiers Universes of Discourse (U.D.s) Also called the domain of discourse Refers to the collection of objects being discussed in a specific discourse Example: P(x) : x breaths oxygen Domain consists of humans P(x) is true for all x? Domain consists of creatures P(x) is true for all x? Alien I do not need O 2 Creature s Hu ma n 14 Quantifier s Universal Quantifiers (ALL) Definition Universal quantification of P(x) is the statement P(x) is true for all values of x in the domain Notation: x P(x) LL, reversed A Read as "for all x P(x)" "for every x P(x)" Truth value True when P(x) is true for all x False otherwise An element for which P(x) is false is called a counterexample 16

Quantifier s Universal Quantifiers When all of the elements in the universe of discourse can be listed one by one (discrete) (e.g. x 1,x 2,,x n ), x P(x) P(x 1 ) P(x 2 )... P(x n ) For example Our class has three students: John, Peter and Mary Every student in our class has attended the class I am here~ I am here~ I am here~ and and Our class John Peter Ma ry 17 Quantifier s Existential Quantifiers When all of the elements in the universe of discourse can be listed one by one (discrete) (e.g. x 1,x 2,,x n ), x P(x) P(x 1 ) P(x 2 )... P(x n ) For example Our class has three students: John, Peter and Mary Any student in our class has attended the class Our class John Peter Ma ry 19 Quantifier s Existential Quantifiers (SOME) Definition Existential quantification of P(x) is the proposition There exists an element x in the domain such that P(x) is true Notation: x P(x) XIST, reversed E Read as There is an x such that P(x) There is at least one x such that P(x) "For some x P(x)" Truth value True when P(x) is false for all x False otherwise 18 I am here~ I am here~ I am here~ or or Quantifiers Examples: P(x): x+1>x, U.D.s: the set of real number x P(x)? x P(x)? True True P(x) is always true Q(x): x<2, U.D.s: the set of real number x Q(x)? x Q(x)? False True Q(y) is false when y 3 Q(y) is true whe n y < 2 (co untere xamp le s) S(x): 2x<x, U.D.s: the set of real positive number x S(x)? x S(x)? False False S(x) is always false 20

Universal Quantifiers Examples: P(x): x 2 <10, U.D.s. the positive integer not e xceeding 4 x P(x)? x P(x) P(1) P(2) P(3) P(4) F x P(x)? x P(x) P(1) P(2) P(3) P(4) T countere xa mple P(1) P(2) P(3) P(4) 21 Precedence of Quantifiers Recall, Precedence 1 2 3 4 5 Operator NOT AND OR XOR Imply Equivalent and have higher precedence than all logical operators from proposition calculus Example x P(x) Q(x) ( xp(x)) Q(x) x (P(x) Q(x)) 23 Quantifiers How can we prove the followings: Universal quantification is true Universal quantification is false Existential quantification is true Existential quantification is fals e Attend the class? John Pet er Ma ry Finding one is ok (c ountere xample ) Need to consider ALL Statement When true? When false? x P(x) P(x) is true for every x There i s an x for which P(x) is false. x P(x) There i s an x for which P(x) is true. P(x) is false for every x. 22 How to interpret the following expression: x (P(x) z Q(x,z) y R(x,y)) Q(x,y) x ( P(x) ( z Q(x,z)) ( y R(x,y)) ) Q(x,y) x ( (P(x) ( z Q(x,z))) ( y R(x,y)) ) Q(x,y) 24

Bound and Free Variable Free Variable: No any restriction Bound Variable: Some restrictions (quantifier or condition) Example: P(x) : x > 3 P(x) : x > 3 and x = 4 x P(x, y) Free Variable Bound Variable Not Proposition Proposition x:bound Variable y:free Variable Not Proposition All the variables that occur in a quantifier must be bounded to turn it into a proposition i.e. the truth value can be determined Giving restrictions on a free variable is called blinding 25 x ( (P(x) ( z Q(x,z))) ( y R(x,y)) ) Q(x,y) Scope of z: Q(x,z) Scope of y: R(x,y ) Scope of x: P(x) z Q(x,z) y R(x,y) Free Variable: x, y in Q(x,y) Bound Variable: x, y, z in the first component 27 Scope The part of a logical expression to which a quantifier is applied is called the scope of this quantifier For example Scope of y x (P(x) ( y Q(y)) ) R(z) Scope of x 26 x x P(x) Any problem? Not a free v ariable x is not a free variable in x P(x), therefore the x binding is not used x P(x) Q(x) Is x a free variable? The variable x in Q(x) is outside of the scope of the x quant ifier, and is therefore free ( x P(x)) ( x Q(x)) Are x the same? 1 st x is Bounded v ariable Diffe rent v aria bles This is legal, because there are 2 different x 2 nd x is Free v ariable 28

Recall. x (x 2 >1) Domain of x is real number Domain of x is between -1 and 1 x (x 2 1) Domain of x is integer Domain of x is positive integer Quantifiers: Logical Implication & Equivalence Universal Quantification x (P(x) Q(x)) x P(x) x Q(x) x (P(x) Q(x)) x P(x) x Q(x) P(x): x is la zy Q(x): x likes beer Peter Joh n Mar y Jessica x P(x) x Q(x) x (P(x) Q(x)) P(x): x is la zy Q(x): x likes beer Peter Joh n Mar y Jessica 29 31 Recall, the Equivalences Two propositions P and Q are logically equivalent if P Q is a tautology P Q means (P Q) (Q P) (P Q) : Given P, Q is true (Q P) : Given Q, P is true Therefore, if we want to show P Q, we can show P Q and Q P Quantifiers: Logical Implication & Equivalence Universal Quantification x (P(x) Q(x)) x P(x) x Q(x) x (P(x) Q(x)) x P(x) x Q(x) P(x): x is la zy Q(x): x likes beer Peter Joh n Mar y Jessica Peter Joh n Mar y Jessica x P(x) x Q(x) x (P(x) Q(x)) P(x): x is la zy Q(x): x likes beer 30 32

Quantifiers: Logical Implication & Equivalence Existential Quantification x (P(x) Q(x)) x P(x) x Q(x) Peter Joh n Mar y Jessica x (P(x) Q(x)) x P(x) x Q(x) P(x): x is la zy Q(x): x like beer x P(x) x Q(x) x (P(x) Q(x)) P(x): x is la zy Q(x): x like beer Peter Joh n Mar y Jessica 33 Quantifier s Logical Implication & Equivalence For Universal Quantifiers, x (P(x) Q(x)) x P(x) x Q(x) x P(x) x Q(x) x (P(x) Q(x)) For Existential Quantifiers, x (P(x) Q(x)) x P(x) x Q(x) x (P(x) Q(x)) x P(x) x Q(x) 35 Quantifiers: Logical Implication & Equivalence Existential Quantification x (P(x) Q(x)) x P(x) x Q(x) Peter Joh n Mar y Jessica x (P(x) Q(x)) x P(x) x Q(x) P(x): x is la zy Q(x): x like beer x P(x) x Q(x) x (P(x) Q(x)) P(x): x is la zy Q(x): x like beer Peter Joh n Mar y Jessica 34 Quantifiers: Logical Equivalence x (A P(x)) A x P(x) x (A P(x)) A x P(x) x (A P(x)) A xp(x) x (A P(x)) A xp(x) x P(x) A x (P(x) A) A x P(x) x (A P(x)) x P(x) A x (P(x) A) A x P(x) x (A P(x)) * A does not consist of free variable x xp(x) A ( xp(x)) A x ( P(x)) A x ( P(x) A) x (P(x) A) A xp(x) (A) xp(x) x( (A) P(x)) x(a P(x)) 36

Negating Quantif iers Universal Quantification De Morgan s Laws for Quantifiers x P(x) x P(x)? Not all students are good There is a student is bad????? Yes No P(x): x is a good student 37 What are the negation of the following statem ents? x (x 2 >x) x(x 2 >x) x (x 2 >x) x (x 2 x) x (x 2 =2) x(x 2 =2) x (x 2 =2) x (x 2 2) 39 Negating Quantif iers Existential Quantification De Morgan s Laws for Quantifiers x P(x) x? P(x) There is not exist a good student All students are bad????? Yes No P(x): x is a good student Show that x(p(x) Q(x)) x(p(x) Q(x)) x (P(x) Q(x)) x ( P(x) Q(x)) x ( P(x) Q(x)) x (P(x) Q(x)) 38 40

Translation Using Quantifiers Translating from English to Logical Expressions with quantifiers 41 Translation Using Quantifiers Universal Quantification Another way to express the statement: The universal quantifier connects with a implication Quantifier: Variable: Every student in this class is lazy Universe of discourse: Propositional Function: x Pred icate (Q) Predica te (P) Universal Q uantifier x Answer: x (Q(x) P(x)) For every person, if he/she is in this class, he/she is lazy Any person P(x): x is lazy Q(x): x is a student in this class x (Q(x) P(x)) For every perso n, he/she is in this class and lazy 43 Translation Using Quantifiers Universal Quantification Using predicates and quantifiers, express the statement Every student in this class is lazy x Universe of Predi cate Di sco urse Quantifier: Universal Quantifier Variable: x Universe of discourse: the students in the class Propositional Function: P(x) : x is lazy Answer: x P(x) Translation Using Quantifiers Existential Quantification Using predicates and quantifiers, express the statement Some students in this class are lazy x Universe of Predi cate Di sco urse Quantifier: Existential Quantifier Variable: x Universe of discourse: the students in the class Propositional Function: P(x) : x is lazy Answer: x P(x) 42 44

Translation Using Quantifiers Existential Quantification Another way to express the statement: Quantifier: Variable: Some students in this class are lazy Universe of discourse: Propositional Function: The existential quantifier connects with a conjunction x Pred icate (Q) Predica te (P) Existential Quantifier x Any person P(x): x is lazy Q(x): x is a student in this class Answer: Include the case which contains x (Q(x) P(x)) no person in this class For some persons, if he/she is in this class, he/she is lazy x (Q(x) P(x)) For some persons, he/she is in this class and lazy 45 Every staff in IBM company has visited Mexico Solution 1: Universal Quantifier Variable: x U.D.: Staffs in IBM company Let P(x): x has visited Mexico x P(x) Solution 2: Universal Quantifier Variable: x U.D.: Any person Let Q(x): x is a staff in IBM company Let P(x): x has visited Mexico x (Q(x) P(x)) 47 Using predicates and quantifiers, set the domain as 1. Staff in IBM company 2. An y persons express the following statements: Every staff in IBM company has visited Mexico Some staff in IBM company has visited Canada or Mexico 46 Some staff in IBM company has visited Canada or Mexico Solution 1: Existential Quantifier Variable: x U.D.: Staffs in IBM company Let P(x): x has visited Mexi co Let Q(x): x has visited Canada x (P(x) Q(x)) Solution 2: Existential Quantifier Variable: x U.D.: Any person Let S(x): x is a staff in IBM company Let P(x): x has visited Mexi co Let Q(x): x has visited Canada x (S(x) (P(x) Q(x))) 48

Some students in this class has visited Canada or Mexico Better Solution: Existential Quantifier Variable: x U.D.: Any person Let S(x): x is a student in this class Let P(x, loc): x has visited loc x (S(x) (P(x, Canada) P(x, Mexico))) Solution 2: Existential Quantifier Variable: x U.D.: Any person Let S(x): x is a student in this class Let P(x): x has visited Mexi co Let Q(x): x has visited Canada x (S(x) (P(x) Q(x))) Quantifiers with Restricted Domains Example Given that the domain in each case consists of the real number, what do the following statements mean? x<0 (x 2 >0) x (x<0 x 2 >0) The square of negative real number is positive y 0 (y 3 0) y (y 0 y 3 0) The cube of nonzero real number is nonzero z>0 (z 2 =2) z (z > 0 z 2 =2) There is a positive square root of 2 49 51 Quantifiers with Restricted Domains An abbreviated notation is often used to restrict the domain of a quantifier Example the square of any real number which greater than 10 is greater than 100 Using Domain x (x 2 >100), U.D.s: the set of real number which is bigger than 10 Using Predicate x (x>10 x 2 >0), U.D.s: the set of real number Using Abbreviated Notation x >10 (x 2 >100), U.D.s: the set of real number 50 Using predicates and quantifiers, express the following statements: Every mail message larger than one megabyte will be compressed If a user is active, at least one network link will be a vailable. 52

Every mail message larger than one megabyte will be compressed Solution: Let S(m, y) be "Mail message m is larger than y megabytes" Domain of m : all mail messages Domain of y : positive real number Let C(m) denote "Mail message m will be compressed" m (S(m, 1) C(m)) 53 Nested Quantifiers Two quantifiers are nested if one is within the scope of the other How to interpret it? If quantifiers are same type, the order is not a matter x y x+y=0 y x x+y=0 If quantifiers are different types, read from left to right x y x+y=0 y x x+y=0 Same meaning Different meaning 55 If a user is active, at least one network link will be available. Solution Let A(u) be "User u is active" Domain of u : all users Let S(n, x) be "Network link n is in state x" Domain of n : all network links Domain of x : all possible states for a network link u A(u) n S(n, available) Nested Quantifiers Different Type If quantifiers are different types, read from left to right Example 1: P(x, y) = x loves y x y P(x, y) VS y x P(x, y) x y x loves y For all x, there is at least one y, to make P(x,y) happe ns For all persons, there is a person they lo ve ALL people lo ves some people y x x loves y At least one y, all x, to make P(x,y) happe ns There is a person who is l o ved by all perso ns Some peop le are loved by ALL people 54 56

Nested Quantifiers Different Type Example 2: P(x, y) = x+y=0 x y P(x, y) VS y x P(x, y) x y (x+y=0) For all x, there is at least one y, to make P(x,y) happe ns Every real number has an additive inverse y x (x+y=0) At least one y, all x, to make P(x,y) happens There is a real number which all real number are its inverse addition 57 Nested Quantifiers: Example 1 Let domain be the real numbers, P(x,y): xy = 0 Which one(s) is correct? x y P(x, y) x y P(x, y) x y P(x, y) x y P(x, y) e.g. y = 0 e.g. x = 0 59 Nested Quantifiers Same Type If quantifiers are the same type, the order is not a matter Example: Given Parent(x,y) : x is a parent of y Child(x,y) : x is a child of y x y (Parent(x,y) Child(y,x)) y x (Parent(x,y) Child(y,x)) Two equivalent ways to represent the statement: For all x and y, if x is a parent of y, y is a child of x 58 Nested Quantifiers: Example 2 Translate the statement x (C(x) y (C(y) F(x,y))) into English, where C(x) is x has a computer, F(x,y) is x and y are friends and the universe of discourse for both x and y is the set of all students in your school Every student in your school has a computer and has a friend who has a computer. 60

Nested Quantifiers: Example 3 Translate the statement If a person is female and is a parent, then this person is someone s mother as a logical expression Let F(x): x is female P(x): x is a parent (F(x) P(x)) M(x, y) M(x,y): x is y s mother All x The domain is the set of all people x ( (F(x) P(x)) y M(x, y) ), or x y ( (F(x) P(x)) M(x, y) ) At least one y 61 Q(x, y, z) be the statement "x + y = z" The domain of all variables consists of all real What are the meaning of the following statements? x y z Q(x,y,z) For all real numbers x and for all real numbers y there is a real number z such that x + y = z z x y Q(x,y,z) There is a real number z such that for all real numbers x and for all real numbers y it is true that x + y = z 63 Translating the following statement into logic expression: The sum of the two positive integers is always positive x y (x+y > 0) The domain for two variables consists of all positive integers x y ((x>0) (y>0) (x+y > 0)) The domain for two variables consists of all integers Translate the statement x y z ( (F(x,y) F(x,z) (y z)) F(y,z) ) into English, where F(a,b) means a and b are friends and the universe of discourse for x, y and z is the set of all students in your school There is a student none of whose friends are also friends each other 62 64

Nested Qua ntifiers Exactly One It also called uniqueness quantification of P(x) is the proposition There exists a unique x such that the predicate is true In the book, you will see the notation:! xp(x), 1 xp(x) But we will try to express the concept of exactly one using the Universal and Existential quantifiers In next few slides, we assume L(x, y) be the statement x loves y Four cases will be discussed Nested Qua ntifiers Exactly One: Case 1 (v2) Mary loves exactly one person L(x, y) : "x loves y 65 It means x L(Mary, x) Mary loves one person (x) If Mary must love any person, he/she must be x z ( L(Mary, z) (z = x) ) x ( L(Mary, x) z ( L(Mary, z) (z = x) ) ) 67 Nested Qua ntifiers Exactly One: Case 1 Mary loves exactly one person L(x, y) : "x loves y It means Mary loves one person (x) x L(Mary, x) If any people who is not x, Mary must not love him/her z ( (z x) L(Mary, z) ) x ( L(Mary, x) z ((z x) L(Mary, z)) ) Nested Qua ntifiers Exactly One: Case 1 Mary loves exactly one person Version 1 Version 2 p q x ( L(Mary, x) z ((z x) L(Mary, z)) ) x ( L(Mary, x) z ( L(Mary, z) (z = x) ) ) q 66 L(x, y) : "x loves y p As p q and its Contrapositive are equivalent, Version 1 and 2 are the same 68

Nested Qua ntifiers Exactly One: Case 2 Exactly one person loves Mary L(x, y) : "x loves y It means x L(x, Mary) One person (x) loves Mary If anyone loves Mary, he/she must be x z ( L(z, Mary) (z = x) ) x ( L(x, Mary) z ( L(z, Mary) (z = x) ) ) Nested Qua ntifiers Exactly One: Case 4 Exactly one person loves all people L(x, y) : "x loves y 69 It means A person (x) loves everyone (y) x y L(x, y) If anyone loves y, it must be x If anyone loves all people, it must be x z ( w L(z, w) (z = x) ) x y ( L(x, y) z ( w L(z, w) (z = x) ) ) 71 Nested Qua ntifiers Exactly One: Case 3 All people love exactly one person L(x, y) : "x loves y It means Everyone (y) loves a person (x) If y loves anyone, it must be x y x L(y, x) z ( L(y, z) (z = x) ) y x ( L(y, x) z ( L(y, z) (z = x) ) ) 70 L(x, y) : "x loves y Nested Qua ntifiers Exactly One: Case 1 VS Case 3 Case 1: Mary loves exactly one person x ( L(Mary, x) z ( L(Mary, z) (z = x) ) ) Case 3: All people love exactly one person y x ( L(y, x) z ( L(y, z) (z = x) ) ) 72

L(x, y) : "x loves y Nested Qua ntifiers Exactly One: Case 2 VS Case 4 Case 2: Exactly one person loves Mary x ( L(x, Mary) z ( L(z, Mary) (z = x) ) ) Case 4: Exactly one person loves all people x y ( L(x, y) z ( w L(z, w) (z = x) ) ) 73 L(x, y) : "x loves y Exactly two people love Mary It means x y ( L(x, Mary) L(y, Mary) (x y) ) At least two persons love Mary At most two persons love Mary If anyone loves Mary, he/she must be x or y z ( L(z, Mary) ( (z = x) (z = y) ) ) x y ( L(x, Mary) L(y, Mary) (x y) z ( L(z, Mary) ( (z = x) (z = y) ) ) ) 75 L(x, y) : "x loves y There is exactly one person whom everybody loves It means x y L(y, x) At least one person is loved by everyone At most one person is loved by everyone If anyone is loved by everyone, it must be x z ( w L(w, z) (z = x) ) x y ( L(y, x) z ( w L(w, z) (z = x) ) ) 74 Nested Quantifiers Recall, When all of the elements in the universe of discourse can be listed one by one (discrete) (e.g. x 1,x 2,,x n ), x P(x) P(x 1 ) P(x 2 )... P(x n ) x P(x) P(x 1 ) P(x 2 )... P(x n ) 76

Nested Quantifiers Example Find an expression equivalent to x y P(x, y) where the universe of discourse consists of the positive integer not exceeding 3? x yp(x, y) = = = x P(x) P(x 1 ) P(x 2 )... P(x n ) x P(x) P(x 1 ) P(x 2 )... P(x n ) x ( yp(x, y)) yp(1, y) yp(2, y) yp(3, y) [P(1,1) P(1,2) P(1,3)] [P(2,1) P(2,2) P(2,3)] [P(3,1) P(3,2) P(3,3)] 77 Negating Nested Quantifiers Example: What is the negation of x y (xy = 1)? x y (xy = 1) = x ( y (xy = 1)) Not every x, there are some y, can make xy=1 succe ss = x ( y (xy = 1)) = x ( y (xy = 1)) Some x, for all y, cannot make xy = 1 succe ss = x ( y (xy 1)) = x y (xy 1) 79 Negating Nested Quantifiers Recall, De Morgan s Laws for Quantifiers x P(x) x P(x) x P(x) x P(x) They also can be applied in Nested Quantifiers Can you understand it now? 78 80