dr. c. constantinides - github pages · introduction /cont. definition: a propositional function...

49
Predicate logic Dr. C. Constantinides Department of Computer Science and Software Engineering Concordia University Montreal, Canada January 10, 2017 1 / 49

Upload: others

Post on 22-Aug-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Dr. C. Constantinides - GitHub Pages · Introduction /cont. Definition: A propositional function is a statement containing one or more free variables. The statement becomes a proposition

Predicate logic

Dr. C. Constantinides

Department of Computer Science and Software EngineeringConcordia University Montreal, Canada

January 10, 2017

1 / 49

Page 2: Dr. C. Constantinides - GitHub Pages · Introduction /cont. Definition: A propositional function is a statement containing one or more free variables. The statement becomes a proposition

Introduction

◮ Much like propositional logic, predicate logic uses symbols to representknowledge.

◮ Propositional logic does not allow us to say things like “All objects ofthis class have this particular property”, or “Some objects of this classhave this property”, etc.

◮ Let P(x) denote the statement “x is an odd number.”

◮ The statement cannot be given a truth value since the value for x is notyet specified. We say that variable x is a free variable and it constitutesthe subject of the statement, whereas “is an odd number” refers to aproperty of the subject and is called the predicate.

◮ P(x) is called a propositional function, as each choice of x produces aproposition.

2 / 49

Page 3: Dr. C. Constantinides - GitHub Pages · Introduction /cont. Definition: A propositional function is a statement containing one or more free variables. The statement becomes a proposition

Introduction /cont.

◮ Definition: A propositional function is a statement containing one ormore free variables. The statement becomes a proposition once valuesare assigned to all its free variables.

◮ In P(x) : “x is an odd number.”, P(5) becomes a proposition by settingx = 5 and its value is true, whereas the proposition P(6) is false.

◮ Sometimes, the entire P(x) is referred to as a predicate.

3 / 49

Page 4: Dr. C. Constantinides - GitHub Pages · Introduction /cont. Definition: A propositional function is a statement containing one or more free variables. The statement becomes a proposition

Quantifiers

◮ As its name suggests, a quantifier is an operator that states that apredicate is true for a given quantity of objects.

◮ The expression “for all”, denoted by the symbol ∀, is called the universalquantifier.

◮ The expression “there exists”, denoted by the symbol ∃ is called theexistential quantifier.

4 / 49

Page 5: Dr. C. Constantinides - GitHub Pages · Introduction /cont. Definition: A propositional function is a statement containing one or more free variables. The statement becomes a proposition

Universal quantification

◮ Definition: The universal quantification of P(x) is the statement “P(x)is true for all values of x.” Symbolically this is expressed as ∀xP(x).

◮ The statement ∀xP(x) is true when P(x) is true for all x . It is falsewhen there is at least one x for which P(x) is false.

◮ Its negation becomes ¬∀xP(x) and it is true when there is an x forwhich P(x) is false, or ∃x¬P(x).

5 / 49

Page 6: Dr. C. Constantinides - GitHub Pages · Introduction /cont. Definition: A propositional function is a statement containing one or more free variables. The statement becomes a proposition

Existential quantification

◮ Definition: The existential quantification of P(x) is the statement“There exists an element x such that P(x) is true.” Symbolically this isexpressed as ∃xP(x).

◮ The statement ∃xP(x) is true when there is at least one x for whichP(x) is true.

◮ It is false when P(x) is false for all x . Its negation becomes ¬∃xP(x)and it is true when for every x , P(x) is false, or ∀x¬P(x).

◮ In existential quantification we can make a distinction between “thereexists at least one” (as defined above) and “there exists exactly one”,symbolically expressed as ∃!.

6 / 49

Page 7: Dr. C. Constantinides - GitHub Pages · Introduction /cont. Definition: A propositional function is a statement containing one or more free variables. The statement becomes a proposition

An initial example of a predicate

◮ Consider the following statement: “For every integer number x , there isa successor integer number y .”

◮ We can denote the successor property with the predicateP(x , y) : y = x + 1 and write the statement symbolically as

∀x∃yP(x , y)

7 / 49

Page 8: Dr. C. Constantinides - GitHub Pages · Introduction /cont. Definition: A propositional function is a statement containing one or more free variables. The statement becomes a proposition

Bound variables

◮ When we assign a value to a free variable, then the variable becomes abound variable.

◮ Another way for a free variable to become bound is when we can apply aquantifier to it, such as “There exists an x such that x > 0.”

◮ We say that the variable x is bound by the quantifier “there exists.”

8 / 49

Page 9: Dr. C. Constantinides - GitHub Pages · Introduction /cont. Definition: A propositional function is a statement containing one or more free variables. The statement becomes a proposition

Negation

◮ Consider the statement “All birds are white” or

∀xP(x)

where the predicate P(x) stands for “bird is white.”

◮ To negate the statament we can say “It is not true (or: not the case)that all birds are white” or “Not all birds are white.”

9 / 49

Page 10: Dr. C. Constantinides - GitHub Pages · Introduction /cont. Definition: A propositional function is a statement containing one or more free variables. The statement becomes a proposition

Negation /cont.

◮ Note that it would be incorrent to say “All birds are not white” as thiswould claim that there are no white birds which is clearly false.

◮ The negated statement can be written symbolically as

¬[∀xP(x)]

◮ An alternative way to express the negated statement is to say “There isat least one bird that is not white”, written symbolically as

∃x [¬P(x)]

10 / 49

Page 11: Dr. C. Constantinides - GitHub Pages · Introduction /cont. Definition: A propositional function is a statement containing one or more free variables. The statement becomes a proposition

Negation /cont.

◮ Note that the process of negating the statement corresponds to negatingthe predicate and changing the quantifier. In other words

¬[∀xP(x)] ≡ ∃x [¬P(x)]

◮ Similarly, to negate a predicate with the existential quantifier, we canwrite

¬[∃xP(x)] ≡ ∀x [¬P(x)]

11 / 49

Page 12: Dr. C. Constantinides - GitHub Pages · Introduction /cont. Definition: A propositional function is a statement containing one or more free variables. The statement becomes a proposition

Negation - Summary

Negated Equivalent When is it true? When is it false?statement statement

¬[∀xP(x)] ∃x [¬P(x)] There is an x for which P(x) is true for every x .P(x) is false.

¬[∃x P(x)] ∀x [¬P(x)] For every x , P(x) is false. There is an x for whichP(x) is true.

12 / 49

Page 13: Dr. C. Constantinides - GitHub Pages · Introduction /cont. Definition: A propositional function is a statement containing one or more free variables. The statement becomes a proposition

Equivalences

∀x∀y P(x , y) ≡ ∀y∀x P(x , y)

∃x∃y P(x , y) ≡ ∃y∃x P(x , y)

∃x (P(x) → Q(x)) ≡ ∀x P(x) → ∃x Q(x)

∃x (P(x) ∨ Q(x)) ≡ ∃x P(x) ∨ ∃x Q(x)

∀x (P(x) ∧ Q(x))) ≡ ∀x P(x) ∧ ∀x Q(x)

13 / 49

Page 14: Dr. C. Constantinides - GitHub Pages · Introduction /cont. Definition: A propositional function is a statement containing one or more free variables. The statement becomes a proposition

Categorical syllogisms

◮ Recall from propositional logic that a syllogism is an inference in whichone proposition necessarily follows from two others.

◮ A categorical syllogism consists of three parts (major premise, minorpremise, and conclusion) all of which are categorical propositions.

◮ A categorical proposition contains two terms, namely the subject and thepredicate, and affirms or denies one or the other.

◮ For example, in the categorical proposition All birds are white, thesubject is birds and refers to what the proposition is about, whereas thepredicate is being white and it refers to what the proposition affirms ordenies about the subject.

14 / 49

Page 15: Dr. C. Constantinides - GitHub Pages · Introduction /cont. Definition: A propositional function is a statement containing one or more free variables. The statement becomes a proposition

Categorical syllogisms /cont.

Letting “S” and “P” stand for subject and predicate respectively, we havefour forms of categorical propositions as shown below:

NAME FORM TITLE

A All S are P Universal affirmative ∀xP(x)

E No S are P Universal negative ∀x [¬P(x)]

I Some S are P Particular affirmative ∃xP(x)

O Some S are not P Particular negative ∃x [¬P(x)]

15 / 49

Page 16: Dr. C. Constantinides - GitHub Pages · Introduction /cont. Definition: A propositional function is a statement containing one or more free variables. The statement becomes a proposition

Categorical syllogisms /cont.

◮ Propositions A and I have an affirmative quality as they affirm classmembership, whereas propositions E and O have negative quality as theydeny class membership.

◮ Furthermore, categorial propositions A and E have a universal quantityas they make a claim about all members of the subject class, whereaspropositions I and O have a particular quantity as they make a claimabout some (at least one) member of the subject class.

16 / 49

Page 17: Dr. C. Constantinides - GitHub Pages · Introduction /cont. Definition: A propositional function is a statement containing one or more free variables. The statement becomes a proposition

Categorical syllogisms /cont.

Some valid forms of categorical syllogisms are shown below:

All M are P. All S are M. Therefore, All S are P.

All P are M. Some S are not M. Therefore, Some S are not P.

Some M are not P. All M are S. Therefore, Some S are not P.

All P are M. No M are S. Therefore, No S are P.

All M are P. Some S are M. Therefore, Some S are P.

No M are P. Some S are M. Therefore, Some S are not P.

17 / 49

Page 18: Dr. C. Constantinides - GitHub Pages · Introduction /cont. Definition: A propositional function is a statement containing one or more free variables. The statement becomes a proposition

Contradictory and contrary categorical propositions

◮ Definition: A pair of statements are called contradictories if theycannot both be true and cannot both be false. It is always the case thatone is true and the other is false.

◮ Consider the A statement “Every person owns a house.” It is universal innature as it is a statement about all people. Its contradictory statement“Not every person owns a house” can be rephrased as an O statement“Some people do not own a house.”

◮ The latter statement is particular in nature. Universal affirmations andparticular denials are contradictory statements.

18 / 49

Page 19: Dr. C. Constantinides - GitHub Pages · Introduction /cont. Definition: A propositional function is a statement containing one or more free variables. The statement becomes a proposition

Contradictory and contrary categorical propositions /cont.

◮ Consider the E statement “No people suffer from hunger.”

◮ It is a universal denial. Its contradiction is the I statement “Some peoplesuffer from hunger” which is a particular affirmation.

◮ Thus, universal denials and particular affirmations are contradictorystatements.

19 / 49

Page 20: Dr. C. Constantinides - GitHub Pages · Introduction /cont. Definition: A propositional function is a statement containing one or more free variables. The statement becomes a proposition

Contradictory and contrary categorical propositions /cont.

◮ Definition: A pair of an affirmative and a negative statement is calledcontraries if they are both universal or both particular in nature.

◮ For example, “All people are rich” (A) and “No people are rich” (E) arecontraries.

◮ They are both universal, the former being affirmative and the latterbeing negative. Both cannot be true.

◮ However, it is possible that both are false.

20 / 49

Page 21: Dr. C. Constantinides - GitHub Pages · Introduction /cont. Definition: A propositional function is a statement containing one or more free variables. The statement becomes a proposition

Subcontrary and superaltern-subaltern categoricalpropositions

◮ Definition: Two propositions are subcontraries iff they cannot both befalse but can both be true. Propositions I and O are subcontraries.

◮ Definition: A proposition is a subaltern of another iff it must be true ifits superaltern is true, and the superaltern must be false if the subalternis false.

◮ For example, I is a subaltern of A and O is a subaltern of E.

21 / 49

Page 22: Dr. C. Constantinides - GitHub Pages · Introduction /cont. Definition: A propositional function is a statement containing one or more free variables. The statement becomes a proposition

Example: Categorical propositions

◮ In the episode “Fidelity” of House M. D., Dr. Gregory House said: “Idon’t ask why patients lie, I just assume they all do.” Consider thefollowing list of categorical propositions for the statements “x is aperson” and “x lies”:

◮ “Some patient lies.”

◮ “No patient lies.”

◮ “All patients lie.”

◮ “Not all patients lie.”

◮ “Every patient lies.”

◮ “There is an honest patient.”

◮ “No patient is honest.”

◮ “All patients are honest.”

22 / 49

Page 23: Dr. C. Constantinides - GitHub Pages · Introduction /cont. Definition: A propositional function is a statement containing one or more free variables. The statement becomes a proposition

Example: Categorical propositions /cont.

◮ Let us identify pairs of contradictory propositions. Recall that a pair ofcategorical propositions are contradictories if they cannot both be trueand cannot both be false. Pairs of categorical propositions of types A-Oand E-I are contradictories. It is always the case that one is true and theother is false.

◮ “All patients lie” (A) and “There is an honest patient” (or there is somepatient who does not lie) (O) is a pair of contradictory propositions.

◮ “No patient lies” (E) and “Some patient lies” (I) is a pair ofcontradictory categorical propositions.

23 / 49

Page 24: Dr. C. Constantinides - GitHub Pages · Introduction /cont. Definition: A propositional function is a statement containing one or more free variables. The statement becomes a proposition

Example: Categorical propositions /cont.

◮ Let us identify pairs of contrary propositions. Recall that a pair ofcategorical propositions are called contraries if they cannot both be true,but it is possible that they are both false.

◮ The A-E pair of categorical propositions are contraries.

◮ “All patients lie” (A) and “No patient lies” (E) are contrary categoricalpropositions.

24 / 49

Page 25: Dr. C. Constantinides - GitHub Pages · Introduction /cont. Definition: A propositional function is a statement containing one or more free variables. The statement becomes a proposition

Example: Categorical propositions /cont.

◮ Let us identify pairs of subcontrary propositions. Recall that a pair ofcategorical propositions are subcontraries if they can both be true, butcannot both be false.

◮ The I-O pair of categorical propositions are subcontraries.

◮ “Some patient lies” (I) and “There is an honest patient” (or there issome patient who does not lie) (O) are subcontrary categoricalpropositions.

25 / 49

Page 26: Dr. C. Constantinides - GitHub Pages · Introduction /cont. Definition: A propositional function is a statement containing one or more free variables. The statement becomes a proposition

Example: Categorical propositions /cont.

◮ Let us identify pairs of subaltern-superaltern propositions. Recall that acategorical proposition is a subaltern of another iff it must be true if itssuperaltern is true, as well as the superaltern must be false if thesubaltern is false.

◮ Type I is a subaltern of A and type O is a subaltern of E.

◮ “Some patient lies” (I) is a subaltern of “All patients lie” (A).

◮ “There is an honest patient” (or there is some patient who does not lie)(O) is a subaltern of “No patient lies” (E).

26 / 49

Page 27: Dr. C. Constantinides - GitHub Pages · Introduction /cont. Definition: A propositional function is a statement containing one or more free variables. The statement becomes a proposition

Universal conditional statements

◮ A universal conditional statement has the form ∀x if P(x) then Q(x), or∀x(P(x) → Q(x)).

◮ It can be proven that its negation has the form ∃x(P(x) ∧ ¬Q(x)).

◮ For the universal conditional statement above,

◮ its contrapositive statement is

∀x(¬Q(x) → ¬P(x))

◮ its converse statement is

∀x(Q(x) → P(x))

◮ and its inverse is∀x(¬P(x) → ¬Q(x))

27 / 49

Page 28: Dr. C. Constantinides - GitHub Pages · Introduction /cont. Definition: A propositional function is a statement containing one or more free variables. The statement becomes a proposition

Formalizing sentences from a natural language

◮ Let P(x) denote the statement “x is a patient” and Q(x) denote thestatement “x lies.”

◮ “Some patient lies.” ∃x (P(x) ∧ Q(x))

◮ “No patient lies.” ∀x (P(x) → ¬Q(x))

◮ “All patients lie.” ∀x (P(x) → Q(x))

◮ “Not all patients lie.” ∃x (P(x) ∧ ¬Q(x))

28 / 49

Page 29: Dr. C. Constantinides - GitHub Pages · Introduction /cont. Definition: A propositional function is a statement containing one or more free variables. The statement becomes a proposition

Formalizing sentences from a natural language /cont.

◮ “Every patient lies.” ∀x (P(x) → Q(x))

◮ “There is an honest patient.” ∃x (P(x) ∧ ¬Q(x))

◮ “No patient is honest.” ∀x (P(x) → Q(x))

◮ “All patients are honest.” ∀x (P(x) → ¬Q(x))

29 / 49

Page 30: Dr. C. Constantinides - GitHub Pages · Introduction /cont. Definition: A propositional function is a statement containing one or more free variables. The statement becomes a proposition

Formalizing sentences from a natural language /cont.

◮ We notice that each formalization satisfies one of the following twoproperties:

◮ The universal quantifier ∀x quantifies an implication.

◮ The existential quantifier ∃x quantifies a conjunction.

30 / 49

Page 31: Dr. C. Constantinides - GitHub Pages · Introduction /cont. Definition: A propositional function is a statement containing one or more free variables. The statement becomes a proposition

Formalizing sentences from a natural language /cont.

◮ Consider the statement “Some patient lies” which was formalized as∃x (P(x) ∧ Q(x)).

◮ Can we argue that the sentence can also be formalized as∃x (P(x) → Q(x))?

◮ This would be equivalent to ∀x P(x) → ∃xQ(x) which means “Ifeveryone is a patient then someone lies” which does not convey themeaning of the original sentence.

31 / 49

Page 32: Dr. C. Constantinides - GitHub Pages · Introduction /cont. Definition: A propositional function is a statement containing one or more free variables. The statement becomes a proposition

Example: Formalizing sentences from a natural languagewith Tarski’s world

� �

32 / 49

Page 33: Dr. C. Constantinides - GitHub Pages · Introduction /cont. Definition: A propositional function is a statement containing one or more free variables. The statement becomes a proposition

Example: Formalizing sentences from a natural languagewith Tarski’s world /cont.

We adopt the following predicates:

◮ square (x) indicates that x is a square.

◮ circle (x) indicates that x is a circle.

◮ triangle (x) indicates that x is a triangle.

◮ black (x) indicates that x is a black.

◮ gray (x) indicates that x is a gray.

◮ white (x) indicates that x is a white.

◮ aboveOf (x , y) indicates that x is above y , perhaps in a differentcolumn.

◮ rightOf (x , y) indicates that x is to the right of y , perhaps in a differentrow.

◮ sameColor (x , y) indicates that x and y have the same color.

33 / 49

Page 34: Dr. C. Constantinides - GitHub Pages · Introduction /cont. Definition: A propositional function is a statement containing one or more free variables. The statement becomes a proposition

Example: Formalizing sentences from a natural languagewith Tarski’s world /cont.

Re-write each of the following statements in formal logic and determinewhether they are true or false.

◮ All squares are black: ∀x (square(x) → black(x)).False, since e and k are both squares and non-black. Note that to provefalse one counter-example would be enough.

◮ Everything white is a triangle. ∀x (white(x) → triangle(x)).False, since e and f are both white and not triangles.

◮ There is a square that lies to the left of d .∃x (square(x) ∧ rightOf (d , x)).True: h and k both lie to the left of d .

34 / 49

Page 35: Dr. C. Constantinides - GitHub Pages · Introduction /cont. Definition: A propositional function is a statement containing one or more free variables. The statement becomes a proposition

Example: Formalizing sentences from a natural languagewith Tarski’s world /cont.

◮ There is a black circle. ∃x (circle(x) ∧ black(x)). True: b.

◮ All circles are above g . ∀x (circle(x) → aboveOf (x , g)).False, since i is a circle and it is not above g .

◮ For every square, there exists a circle of the same color.

∀x (square(x) → ∃y(circle(y) ∧ sameColour(x , y)))

This is true.

35 / 49

Page 36: Dr. C. Constantinides - GitHub Pages · Introduction /cont. Definition: A propositional function is a statement containing one or more free variables. The statement becomes a proposition

Nested quantifiers

◮ A quantifier is called nested if it occurs within the scope of another. Forquantifiers of the same type, the order does not matter.

◮ However, the order in which quantifiers of different types are placed isimportant, and we will illustrate this with the examples that follow.

36 / 49

Page 37: Dr. C. Constantinides - GitHub Pages · Introduction /cont. Definition: A propositional function is a statement containing one or more free variables. The statement becomes a proposition

Example 1: Nested quantifiers

◮ In these examples we will look into the importance of the ordering ofdifferent nested quantifiers.

◮ Case 1: ∀x∃yP(x , y)

◮ ∀x∃yP(x , y) reads “For every x there is a y for which P(x , y) is

true.”

◮ In other words, no matter which x we choose, there must be a value of y(possibly depending on the choice of x) for which P(x , y) is true. Forexample, if we consider the predicate loves(x , y) denoting “x loves y”,then

◮ ∀x∃y loves(x , y) reads “Everyone loves someone”, i.e. no matter whichx we choose, there must always be some y that makes loves(x , y) true.

37 / 49

Page 38: Dr. C. Constantinides - GitHub Pages · Introduction /cont. Definition: A propositional function is a statement containing one or more free variables. The statement becomes a proposition

Example 1: Nested quantifiers /cont.

◮ Case 2: ∃y∀xP(x , y)

◮ ∃y∀xP(x , y) reads ”There in an y that makes P(x , y) true for every

x .”

◮ In the example ∃y∀x loves(x , y) reads “There is someone who is lovedby everybody”, i.e. there is some particular y for which loves(x , y) istrue, regardless of the choice of x .

38 / 49

Page 39: Dr. C. Constantinides - GitHub Pages · Introduction /cont. Definition: A propositional function is a statement containing one or more free variables. The statement becomes a proposition

Example 1: Nested quantifiers /cont.

◮ If ∃y∀xP(x , y) is true, then ∀x∃yP(x , y) is also true, e.g. if “There issomeone who is loved by everybody”, then we can safely conclude that“Everyone loves someone.”

◮ However, if ∀x∃yP(x , y) is true, e.g. “Everyone loves someone”, then itis not necessary that ∃y∀x loves(x , y) is true, e.g. it is not necessarythat “There is someone who is loved by everybody.”

39 / 49

Page 40: Dr. C. Constantinides - GitHub Pages · Introduction /cont. Definition: A propositional function is a statement containing one or more free variables. The statement becomes a proposition

Example 2: Nested quantifiers

◮ Consider the predicate loves(x , y) denoting “x loves y”. We can expressthe following predicates using nested quantifiers:

◮ “Someone loves someone.” ∃x∃y loves(x , y), or ∃y∃x loves(x , y)

◮ “Everyone loves someone.” ∀x∃y loves(x , y)

◮ “Everyone is loved by someone.” ∀y∃x loves(x , y)

◮ “There is someone who loves everyone.” ∃x∀y loves(x , y)

◮ “There is someone who is loved by everybody.” ∃y∀x loves(x , y)

◮ “Everyone loves everyone.” ∀x∀y loves(x , y), or ∀y∀x loves(x , y)

40 / 49

Page 41: Dr. C. Constantinides - GitHub Pages · Introduction /cont. Definition: A propositional function is a statement containing one or more free variables. The statement becomes a proposition

Example 3: Nested quantifiers

◮ Consider the predicate B(p, r) denoting the predicate “Person p hasbooked room r.” and the sentence “No room is booked by more thanone person.”

◮ If no room is booked by more than one person, then the predicatesB(p, r) and B(q, r) cannot both be true unless p and q denote the sameperson.

◮ Symbolically this can be expressed as

∀p∀q∀r [(B(p, r) ∧ B(q, r)) → (p = q)]

41 / 49

Page 42: Dr. C. Constantinides - GitHub Pages · Introduction /cont. Definition: A propositional function is a statement containing one or more free variables. The statement becomes a proposition

Example 4: Nested quantifiers

◮ Consider the following: “Every airline x flies to exactly one city y.” Thiscan be formulated as:

∀x∃!y(airline(x) ∧ city(y) ∧ flies(x , y))

42 / 49

Page 43: Dr. C. Constantinides - GitHub Pages · Introduction /cont. Definition: A propositional function is a statement containing one or more free variables. The statement becomes a proposition

Example 5: Nested quantifiers

◮ Let sentMessage(x , y) be the statement “x has sent a message to y”where the domain is all students in class. Note that x and y can be thesame person.

◮ ∃x∃yP(x , y): The is some student who has sent a message to somestudent.

◮ ∀x∀yP(x , y): Every student in the class has sent a message to everystudent in the class.

43 / 49

Page 44: Dr. C. Constantinides - GitHub Pages · Introduction /cont. Definition: A propositional function is a statement containing one or more free variables. The statement becomes a proposition

Example 5: Nested quantifiers /cont.

◮ ∃y∀xP(x , y): Recall that this reads ”There in a y that makes P(x , y)true for every x .” There is a student in class who has been sent amessage by every student in class.

◮ ∃x∀yP(x , y): This is similar to the above, only the roles have beenchanged: There is some student who has sent a message to everystudent in the class.

44 / 49

Page 45: Dr. C. Constantinides - GitHub Pages · Introduction /cont. Definition: A propositional function is a statement containing one or more free variables. The statement becomes a proposition

Example 5: Nested quantifiers /cont.

◮ ∀x∃yP(x , y): Recall that this reads “For every x there is a y for

which P(x , y) is true.” Every student in class has sent a message tosome (at least one) student in class.

◮ ∀y∃xP(x , y): This is similar to the above, only the roles have beenchanged: Every student in class has been sent a message from some (atleast one) student in class.

45 / 49

Page 46: Dr. C. Constantinides - GitHub Pages · Introduction /cont. Definition: A propositional function is a statement containing one or more free variables. The statement becomes a proposition

Example 6: Nested quantifiers

◮ Consider the statement “Everyone has exactly one movie that he or shelikes.”

◮ Let us express the statement in formal logic by introducing the predicatelikes(x , y) to represent the statement “x likes movie y.”

◮ Let us start with ∀x∃y likes(x , y) which reads “For every x there is a

y for which likes(x , y) is true”, or “Everyone likes some movie.”

◮ This does not fully capture the original statement because it does notexclude the possibility that there may be more than one movie that aperson likes.

46 / 49

Page 47: Dr. C. Constantinides - GitHub Pages · Introduction /cont. Definition: A propositional function is a statement containing one or more free variables. The statement becomes a proposition

Example 6: Nested quantifiers /cont.

◮ To complete the statement we need to add that no other movie (i.e. nomovie which is not y) is liked by x , or ∀z((z 6= y) → ¬likes(x , z)).

◮ Putting everything together we have

∀x∃y(likes(x , y) ∧ ∀z((z 6= y) → ¬likes(x , z)))

47 / 49

Page 48: Dr. C. Constantinides - GitHub Pages · Introduction /cont. Definition: A propositional function is a statement containing one or more free variables. The statement becomes a proposition

Negating nested quantifiers

The negation of nested quantifiers follows the same rules are with singlequantifiers. The statement

∀x∃yP(x , y)

reads “For every x , there is a y for which P(x , y) is true.” The negatedstatement would read “There is an x such that P(x , y) is false for every y”, or

∃x∀y¬P(x , y)

The statement∃x∀yP(x , y)

reads “There is an x for which P(x , y) is true fo every y .” The negatedstatement would read “For every x there is a y for which P(x , y) is false”, or

∀x∃y¬P(x , y)

48 / 49

Page 49: Dr. C. Constantinides - GitHub Pages · Introduction /cont. Definition: A propositional function is a statement containing one or more free variables. The statement becomes a proposition

Summary of quantifications of two variables

Statement When is it true When is it false

∀x∀yP(x , y) P(x , y) is true for There is a pair (x , y)∀y∀xP(x , y) every pair (x , y). for which P(x , y) is false.

∀x∃yP(x , y) For every x there is a y There is an x such thatfor which P(x , y) is true. P(x , y) is false for every y .

∃x∀yP(x , y) There in an x for which For every x there is a y

P(x , y) is true for every y . for which P(x , y) is false.

∃x∃yP(x , y) There is a pair (x , y), P(x , y) is false∃y∃xP(x , y) for which P(x , y) is true. for every pair (x , y).

49 / 49