You are on page 1of 7

# Math 1019 B, Lecture 06, Last printed on 10/4/06

## 1.3 Predicates and Quantifiers

Other Quantifiers Universal and existential quantifiers are the most important quantifiers. However many other quantifiers can be defined such as the uniqueness quantifier, quantifiers with restricted domains. Actually using two essential quantifiers and propositional logic we can express the other quantifiers. Precedence of Quantifiers The quantifiers and have higher precedence than all logical operators of logical calculus. Binding Variables When a quantifier is used on the variable x, we say that this occurrence of the variables is bound. An occurrence of a variable that is not bound to particular value is said to be free. To turn a propositional function into a proposition, all variables in a proposition must be bound or a particular value must be assigned to them. This can be done using a combination of quantifiers (universal, existential) and value assignments. The part of a logical expression to which a quantifier is applied is called the scope of this quantifier. Thus a variable is free if it is outside the scope of all quantifiers. Example: In x(x+y=1), the variable x is bound by existential quantification, but y is free, because it is not bound by a quantifier and no value is assigned. Logical Equivalences Involving Quantifiers We have seen the notion of logical equivalences of compound propositions. We can extend this notion to expressions involving predicate and quantifiers. Definition 3 Statements involving predicates and quantifiers are logically equivalent if and only if they have the same truth value independent of predicates and the domain. Example19. Show that x(P(x)Q(x)) and x P(x) x Q(x) are logically equivalent.
1 PDF created with pdfFactory Pro trial version www.pdffactory.com

## Math 1019 B, Lecture 06, Last printed on

10/4/06

Solution: If x(P(x)Q(x)) is true, then for every a in the domain P(a)Q(a) is true. Then of course P(a) is true and Q(a) is true. Since P(a) is true and Q(a) is true for every element in the domain, x P(x) and x Q(x) are both true. This means x P(x) x Q(x) is true. If x P(x) x Q(x) is true, then x P(x) is true and x Q(x) is true. So if a is in the domain, then P(a) is true and Q(a) is true. This means then P(a)Q(a) is true for all a in the domain. This is x(P(x)Q(x)) is true. So x(P(x)Q(x)) x P(x)x Q(x). Negating Quantified Expressions Some times we need to negate a quantified expression. Negation of universal quantifier: Every student in your class has taken a course in calculus. Let P(x) be x has taken a course in calculus and the domain be all students in the class. So the statement is x P(x). Negation: Not every student in your class has taken a course in calculus. This means There is at least one student in the class who has not taken a class in calculus. This is simply the existential quantification of the negation of the original propositional function: x P(x). Therefore x P(x) x P(x). Verification: x P(x) is true if and only if x P(x) is false. This can happen if and only if there is an x in the domain for which P(x) is false. This happens if and only if there is an x in the domain for which P(x) is true. Therefore there is an x in the domain for which P(x) is true if and only if x P(x) is true. Thus x P(x) and x P(x) are logically equivalent. Negation of existential quantifier: There is a student in the class who has taken a course in calculus.
Math 1019 B, Lecture 06, Last printed on 10/4/06

The statement is the existential quantification x Q(x), where Q(x) is the statement x has taken a course in calculus. So negation is It is not the case that there is a student in the class who has taken a course in calculus.
2 PDF created with pdfFactory Pro trial version www.pdffactory.com

## Math 1019 B, Lecture 06, Last printed on

10/4/06

This is equivalent to Every student in this class has not taken a course in calculus. This is just the universal quantification of the negation of the original propositional function: x Q(x) x Q(x). Proof: Let Q(x)=T(x). Since x T(x) x T(x) we get x T(x) x T(x) and so x T(x) x T(x). Thus x Q(x) x Q(x). Example 20 What are the negations of the statements There is an honest politician And All Americans eat cheeseburgers? Solution: Let H(x) be x is honest. So the statement There is an honest politician is represented by x H(x), where the domain consists of all politicians. The negations is x H(x) x H(x) and expressed as Every politician is dishonest. Let C(x) be x eats cheeseburgers. Then All Americans eat cheeseburgers is represented by x C(x), where the domain consists of all Americans. The negation is x C(x) x C(x) and means There is an American who does not eat cheeseburgers. Example 21 What are the negations of the statements x (x 2 >x) and x(x 2 =2) ? Solution: x (x 2 >x)= x(x 2 >x)= x(x 2 =<x), x(x 2 =2)= x (x 2 =2)= x (x 2 2). Example 22 Show that x (P(x) Q(x)) x(P(x) Q(x)). Solution: By De Morgans Law for quantifiers, x (P(x) Q(x))= x(P(x) Q(x))= x(P(x)Q(x))= x(P(x)Q(x)).

Translating from English into logical expressions Translating sentences in English into logical expressions is a crucial task in: Mathematics, Logic programming, Artificial intelligence, Software engineering, Many other disciplines.
3 PDF created with pdfFactory Pro trial version www.pdffactory.com

## Math 1019 B, Lecture 06-07, Last printed on 10/4/06

We used propositions and logical operators to translate English sentences to logical expressions. With quantifiers involving, translation is more complex and there might be many ways of translating a particular sentence. Example 23 Express Every student in this class has studied calculus using predicates and quantifiers. Solution: Every: ; student in this class: x; x has studied calculus: C(x). So the statement is x C(x). If we change the domain to consist of all people, then the statement is expressed as For every person x, if person x is student in this class, then x has studied calculus. Denoting person x is student in this class with S(x), the statement is then x (S(x)C(x)). Simplest way is the best way! Example 24 Express Some student in this class has studied calculus and Every student in this class has studied calculus or music using predicates and quantifiers. Solution: (I) Some student: there is/exists a student -- x; students in this class: domain; x has studied calculusC(x). So the statement is x C(x). (II) Students in this class: domain; every student: x; x studied calculus: C(x); x studied music: M(x). So x(C(x) or M(x))= x(C(x) M(x)). If we are also interested in people who is not student, then (III) All person: domain; person x is student in this class: S(x); every person: x; x has studied calculus: C(x); x has studied music: M(x). So the statement is x(S(x) (C(x) M(x)), in words For every x, if x is in this class, x has studied calculus or x has studied music. Using Quantifiers in System Specifications To represent system specifications not only propositions are used, but also predicates and quantifications can be used.
4 PDF created with pdfFactory Pro trial version www.pdffactory.com

## Math 1019 B, Lecture 06-07, Last printed on 10/4/06

Example 25. Use predicates and quantifiers to express the system specifications Every mail message larger than one megabyte will be compressed and If a user is active, at least one network link will be available. Solution: Let S(m, y) be Mail message m is larger than y megabyte, where the variable m has the domain of all mail messages and the variable y is a positive real number, and let C(m) denote Mail message m will be compressed. So the first message can be expressed as x(S(m,1) C(m)). Let A(u) represent User u is active, where the variable u has the domain of all users, let N(n, s) be Network link n is in state s, where the variable n has the domain of all network links and s has the domain of all possible states for a network link. Then the expression is: x A(u) n N(n, available). Examples by Lewis Carroll Example 26 Consider these statements. The first two are premises and the third is the conclusion. All lions are fierce. Some lions do not drink coffee. Some fierce creatures do not drink coffee. Solution: Let P(x),Q(x) and R(x) be the statements x is a lion, x is fierce and x drinks coffee. respectively. Let the domain consists of all creatures. Now the statements are: x (P(x)Q(x)). x (P(x)R(x)). x (Q(x) R(x)). Not okay: x (P(x) R(x)). x (Q(x) R(x)). Not exact -- both are true even if P(x) and Q(x) both are not true! Example 27 Consider these statements. The first three are premises and the fourth is a valid conclusion. All hummingbirds are richly colored. No large birds live on honey.
5 PDF created with pdfFactory Pro trial version www.pdffactory.com

## Math 1019 B, Lecture 06-07, Last printed on 10/4/06

Birds that do not live on honey are dull in color. Hummingbirds are small. Solution: Let P(x): x is a hummingbird , Q(x): x is large, R(x): x lives on honey, S(x) : x is richly colored. Let the domain consists of all birds. So the statements are: x (P(x)S(x)). x (Q(x)R(x)). x (R(x) S(x)). x (P(x) Q(x)). Logic Programming An important type of programming language is designed to reason using the rules of predicate logic. Prolog. Prolog programs include a set of declarations consisting of two types of statements, Prolog facts and Prolog rules. Prolog facts define predicates by specifying the elements that satisfy these predicates. Prolog rules are used to define new predicates using those already defined by Prolog facts. Example 28 Consider a Prolog program given facts telling it the instructor of each class and in which classes students are enrolled. The program uses these facts to answer queries concerning the professors who teach particular students. Such a programs could use the predicates instructor(p, c) and enrolled(s, c) to represent that professor p is the instructor of course c and that the student s is enrolled in course c , respectively. For example, the Prolog facts in such a program might include:
instructor(chan, math273) instructor(patel, ee222) instructor(grossman, cs301) enrolled(kevin, math273) enrolled(juana, ee222) enrolled(juana, cs301) enrolled(kiko, math273) enrolled(kiko, cs301)

## Math 1019 B, Lecture 06-07, Last printed on 10/4/06

A new predicate teaches(p, s), representing that professor p teaches student s, can be defined using the prolog rule
teaches (P, S): - instructor(P, C), enrolled(S, C)

which means that teaches(p, s) is true if there exists a class c such that professor p is the instructor of class c and student s is enrolled in class c. Remark: , is and; ; is or, ? is query. The query Is Kevin enrolled in math273 ?, ? enrolled(kevin, math273) the answer: yes. The query who is enrolled in math273 ?, ? enrolled(X, math273) the answer: kevin kiko The query who are the instructors of classes taken Juana ?, ? teaches(X, juana) the answer: patel grossman