# Section 1.3: Predicates and Quantifiers

## Presentation on theme: "Section 1.3: Predicates and Quantifiers"— Presentation transcript:

Section 1.3: Predicates and Quantifiers
We will now discuss the area of predicate logic. Predicate logic builds on propositional logic by introducing quantifiers to handle special types of “variables” in a mathematical statement. With quantifiers and predicates, we can express a great deal more than we could using propositional logic.

Predicates Consider the statement “x > 3” read as “x is greater than 3”. Recall that this is not a proposition, since it isn’t either true or false but not both. We can break this statement into two parts. First of all, we have the variable “x”. The second part of the statement, “is greater than 3”, is a property that the variable x may or may not possess. We call such a property a predicate. We could denote the predicate “is greater than 3” by the symbol P. Then we will use P(x) to denote the statement “x is greater than 3”. In this way, we can consider P(x) to be a propositional function and if we give the variable x a value then P(x) will take on a truth value and hence become a proposition.

Ex: P(4) is the proposition “4 is greater than 3” which is true.
P(0) is the proposition “0 is greater than 3” which is false. We can also consider statements that have more than one variable, such as “x + y = 7”. We can use Q(x, y) to denote this predicate. If we assign values to the variables x and y, then this statement now becomes a proposition with a truth value. Ex: Q(3, 4) is the proposition “3 + 4 = 7” which is true. Ex: Let R(x, y, z) denote “x + y = z”. Then R(2, 3, 4) is the proposition “2 + 3 = 4” which is false.

Quantifiers As we have seen, if we assign values to all of the variables in a propositional function, the resulting statement becomes a proposition. We will now discuss a technique, called quantification, whereby we stipulate how we want a variable to be treated which will also result in a proposition if we do this for all variables.

Universal Quantification
Some mathematical statements assert that a property is true for all values that a variable can take on (called the universe of discourse). We use universal quantification to denote this. Def: The universal quantification of P(x) is the proposition “P(x) is true for all values of x in the universe of discourse.” This is denoted xP(x) and read as “for all x, P(x)”.

Ex: Let P(x) denote the statement “x + 1 > x”
Ex: Let P(x) denote the statement “x + 1 > x”. What is the truth value of xP(x) where the universe of discourse is all integers? The proposition xP(x) is “x + 1 > x for all integers x”. This proposition is true. If you take x to be any integer value, then x + 1 is always going to turn out to be greater than x. Ex: Let Q(x) denote the statement “x > 5”. What is the truth value of xQ(x) where the universe of discourse is all integers? The proposition xQ(x) is “x > 5 for all integers x”. This proposition is false. “x > 5” is not true for all integers x. If you take x to be 4, for example, “4 > 5” is false. Note that if all elements in the universe of discourse could be listed, say el1, el2, el3, …, eln, then xP(x) is logically equivalent to “P(el1)  P(el2)  P(el3)  …  P(eln)”.

Ex: Let P(x) denote “x2 < 10”
Ex: Let P(x) denote “x2 < 10”. What is the truth value of the proposition xP(x) where the universe of discourse for x is the integers 1, 2, 3, and 4? The proposition is false since P(4), which is “x2 < 10” is false. Note that since P(x) is true for x = 1, x = 2, and x = 3, then the proposition would have been true if 4 weren’t in the universe of d. Realize that to show that a universally quantified statement, xP(x), is false, we need only find one value from the universe of discourse that x can take on which makes P(x) false. Such a value of x is called a counterexample. However to show that xP(x) is true, we have to show that P(x) is true for every possible value in the universe of discourse that x can take on.

Existential Quantification
Some mathematical statements assert that there is some value (from the universe of discourse) that a variable can take on for which a property is true. We use existential quantification to denote this. Def: The existential quantification of P(x) is the proposition “There exists an element x in the universe of discourse for which P(x) is true.” This is denoted xP(x) and read as “for some x, P(x)”.

Ex: Let P(x) denote the statement “x + 1 > x”
Ex: Let P(x) denote the statement “x + 1 > x”. What is the truth value of xP(x) where the universe of discourse is all integers? The proposition xP(x) is “x + 1 > x for some integer x”. This proposition is true. If you take x to be 5, for example, then x + 1 = 6 which is greater than 5. So 5 is a satisfying value. Ex: Let Q(x) denote the statement “x > 5”. What is the truth value of xQ(x) where the universe of discourse is all integers? The proposition xQ(x) is “x > 5 for some integer x”. This proposition is true. “x > 5” is true for x = 10, for example. Note that if all elements in the universe of discourse could be listed, say el1, el2, el3, …, eln, then xP(x) is logically equivalent to “P(el1)  P(el2)  P(el3)  …  P(eln)”.

Ex: Let P(x) denote “x2 > 16”
Ex: Let P(x) denote “x2 > 16”. What is the truth value of the proposition xP(x) where the universe of discourse for x is the integers 1, 2, 3, and 4? The proposition is false since P(x), which is “x2 > 16” is false for x = 1, x =2, x =3, and x =4 (all values from the universe of discourse). Note that to show that an existentially quantified statement, xP(x), is true, we need only find one value from the universe of discourse that x can take on which makes P(x) true. However to show that xP(x) is false, we have to show that P(x) is false for every possible value in the universe of discourse that x can take on. If we know that xP(x) is true for some predicate P(x), what can we say about xP(x)? xP(x)  xP(x) [but not conversely].

Binding Variables Def: When a quantifier is used on a variable or when we assign it a value in a propositional function, we say that this variable is bound. An occurrence of a variable that is not bound is said to be free. All of the variables that appear in a propositional function must be bound to turn it into a proposition.

Ex: Let R(x, y, z) denote “x + y = z”
Ex: Let R(x, y, z) denote “x + y = z”. Let the universe of discourse for x, y, and z be all integers. Consider xyR(x,y,z). In this statement, the variables x and y are bound, but z is left free. Consequently, this is not a proposition. Ex: Now consider xyR(x,y,10). Now all three variables are bound so this is a proposition. What is it’s truth value? The statement is “for all x, there exists some y, such that x + y = 10”. This is true. For any x, there does exist some y (namely 10 - x) such that x + y = 10.

I like to think of determining the truth value of a quantified statement as an adversarial game. The quantifiers are read from left to right. When a universal quantifier is encountered (), my adversary gets to choose the value of that variable. My adversary is trying to force the statement to be false. When an existential quantifier is encountered (), I get to choose the value of the variable. I am trying to force the statement to be true. If I can win this game (that is, force the statement to be true) no matter how my adversary chooses, then the quantified statement is true. However, if my adversary can win this game (that is, force the statement to be false) no matter how I choose, then the quantified statement is false. The order that the quantifiers occur is very important.

Ex: Let us consider our previous example, xyR(x,y,10).
Since the first quantifier I encounter is the universal quantification of x, my adversary must choose a value for x first. He may choose any integer value that he wants. Let us say he chooses the integer c. Now x = c (c may be 6, or –100, or any possible integer, but I need to think of it in arbitrary terms because I must be able to counter my adversary for any possible choice he could make. The important point is that x is now fixed to some integer c that he has chosen. Next I encounter the existential quantification of y. Now I must choose a value for y, but I do know what my adversary chose for x since he had to choose first. I want to make this statement true so I choose y to be equal to 10 – c. Now the statement “x + y = 10” becomes “c + 10 – c = 10” which is true. Since I left c as an arbitrary choice then I know that no matter what move my adversary makes, I can force the statement to be true. So the proposition xyR(x,y,10) is true.

Ex: What if the order were reversed, yxR(x,y,10)?
Now I must choose y first. I can choose anything, so let’s represent my choice as c. Then my adversary must choose. He can choose to make x any integer other than 10 – c and he will force the statement to be false. So the proposition yxR(x,y,10) is false. Ex: What about xy(xy = 0)? This proposition is true. First my adversary chooses an integer value for x. Say he chooses the value c. Then I must choose a value for y that will force the statement to be true. I choose y = 0. Then c0 = 0. Ex: What about yx(xy = 0)? Now I must choose first but in this case it doesn’t matter. I choose y = 0. Then when my adversary chooses x, no matter what he chooses x0 = 0. So this proposition is true as well.

Note that yxP(x,y)  xyP(x,y)
Note that yxP(x,y)  xyP(x,y). That is, if I can choose first and thwart my adversary no matter what value he chooses (even taking my choice into account), then surely if he has to choose first, I can still thwart him. I simply choose the same value that I would have chosen to thwart him if I had had to choose first. Ex: y(y > 5). In this case, my adversary has no moves at all. I choose a value for y that makes y > 5 (I could choose 6). So this proposition is true. Ex: x(x + 1 > x). In this case, I have no moves. My adversary must try to choose a value for x which would make this statement false. However, there is no possible value for x that makes this statement false. So the proposition is true.

Negations Sometimes we will want to consider the negation of a quantified statement. Recall that the negation of a statement is true if the original statement is false and the negation is false if the original statement is true. This will be helpful to us in determining the truth value of a quantified statement.

Ex: Consider the statement “Every apple is red”
Ex: Consider the statement “Every apple is red”. We can express this universally quantified statement as aR(a), where R(a) is the predicate “a is red” and the universe of discourse for a is all apples. The negation of this statement is “It is not the case that Every apple is red”. This statement says that there is some apple that is not red. This could be expressed as an existentially quantified statement, a¬R(a). The above example illustrates the equivalence: ¬xP(x)  xP(x) Ex: Consider the statement “Some apple is red”. We can express this existentially quantified statement as aR(a), where R(a) is the predicate “a is red” and the universe of discourse for a is all apples. The negation of this statement is “It is not the case that Some apple is red”. This statement says that every apple is not red. This could be expressed as a universally quantified statement, a¬R(a). This example illustrates the equivalence: xP(x)  x¬P(x)

Recall De Morgan’s laws:
(p  q)  p  q (p  q)  p  q Remember that we said we could generalize these laws to an arbitrary number of propositions: (p1  p2  …  pn)  p1  p2  …  ¬pn (p1  p2  …  pn)  p1  p2  …  ¬pn These previous two equivalences are simply the generalization of De Morgan’s laws to an infinite number of props: ¬xP(x)  xP(x) is (P(x1)  P(x2)  P(x3)  … )  P(x1)  P(x2)  ¬P(x3)  … xP(x)  x¬P(x) is (P(x1)  P(x2)  P(x3)  … )  P(x1)  P(x2)  ¬P(x3)  …

Ex: What is the negation of x(x2 = 2)?
We are looking for ¬x(x2 = 2) so by applying the rule we have x¬(x2 = 2) which is the same as x(x2  2). What is the truth value of x(x2 = 2)? Sort of a trick question. I never specified the universe of discourse for x. If it is the integers, then the statement is false. There is no integer x for which x2 = 2. However, if our universe of discourse were all real numbers then the statement is true since for x = 2 then x2 = 2. Ex: What is the negation of xy(x + y = 0)? This requires two applications of our formulas. We are looking for ¬xy(x + y = 0)  xy(x + y = 0)  xy(x + y = 0)  xy(x + y  0). It turns out that the original statement is true, for any x, I can find a y (namely –x) such that the sum of x and y is 0. Hence the negation is false. This is the case for reals or integers.

Translating from English
Once again, we have introduced all of this machinery in order to be able to express a mathematical statement in precise terms. So once again, it will be a very important task to be able to take a statement made in English and translate it into an appropriate statement in predicate logic using quantifiers.

Ex: “Every student in this class has studied calculus.”
There are multiple levels of detail that we could choose to go to when translating this statement but first of all we will need a predicate C(x): “x has studied calculus”. 1. xC(x) where the universe of discourse for x is all students in this class. 2. x(S(x)C(x)) where the universe of discourse for x is all people and C(x) is “x is a student in this class”. The level of detail that you choose to go to is highly dependent on what you will be using the quantified statement for. In some instances, you may need to consider all people and use a predicate such as S(x) to indicate people who are students in this class. In other situations, you may only need to consider students in this class and so the introduction of an S(x) predicate is unnecessary. It is acceptable to simply restrict the universe of discourse to students in this class. [Precedence discussion; p  q  r; p:T, q:F, r:T; p  q  r; F,T,F]

Ex: “Everyone has a mother.”
xyM(y, x) [notice the order] where the universe of discourse for x and y is all people and M(m, c) is “m is the mother of c”. Once again, if we didn’t want this level of detail the statement could have been simply represented as a universally quantified P(x) where P(x) is “x has a mother”. Ex: “There are at least two people who play both soccer and tennis.” Let’s use a predicate P(p, s): “p plays s”. One way to express it is xy(P(x, soccer)  P(x, tennis)  P(y, soccer)  P(y, tennis)  (x  y)) The last part x  y is important. Notice that I want to express that there are at least two people. The two existential quantifications (of x and y) give me some x and some y, but the last part is necessary to ensure that x and y are different people. This sort of subtle issue (where a variable may become instantiated to the same value) often arises in programs.

Quantified logic statements will provide the foundation for the mathematical reasoning that we will do throughout the class. Consequently, the ability to form quantified logical statements is very important. Because we can express a desired English statement in predicate logic in a large number of ways (the best of which is dependent on the subsequent reasoning that will be done) there are no good guidelines or rules of thumb. But though there are an enormous number of ways to correctly translate an English statement into a quantified logic statement, there is an even larger number of ways to incorrectly express the statement with quantified logic. This is a highly intuitive and very creative sort of task so the best way to learn this material is to work examples. There are a great deal of examples in section 1.3 of the text that we did not go through in lecture. I strongly suggest that you spend the time to read through and understand these examples. When you work the exercises given in the coming homework, for each attempted translation you should ask yourself whether the translation has the intended meaning of the stmt.

Homework problems from Section 1.3
Problems 2, 5, 8, 10, 12, 13, 15, 21, 23, 31, 33, 48 from this section will be included on the next homework assignment. Homework 2 is now posted to the toolkit.