Predicate and Quantifiers zarnab.azam@umt.edu.pk Predicate logic ⚫ Statements involving variables such as “x > 3”, “x =y+3” and “x + y = z” are often found in mathematical assertions and in computer programs. ⚫ These statements are neither TRUE nor FALSE when the values are not specified. ⚫ For example In the sentence “The cat is sleeping”: ⚪ The phrase “the cat” denotes the subject – the object or entity that the sentence is about. ⚪ The phrase “is sleeping” denotes the predicate – a property that the subject of the statement can have. ⚫ For example “x > 3”, here the statement has two parts ⚪ The first part is the variable “x” is the subject of the statement. ⚪ The second part “is greater than 3” refers to a property that the subject of statement have. Predicate logic ⚫ ⚫ ⚫ ⚫ ⚫ ⚫ ⚫ ⚫ ⚫ ⚫ The statement “x is greater than 3” is denoted by P(x) where P represents the predicate “is greater than 3” and “x” is the variable. The statements P(x) is also said to be the value of the proposition function P at x. Once a values has been assigned to the variable x, the statement P(x) becomes a proposition. Example: Let P(x) denotes the statement “x >3”, then, P(10) is true: The proposition 10 > 3 is true. P(1) is false: The proposition 1 > 3 is false. Replacing x the values of 10 or 1 is a way to quantify the propositional function P(x) Quantifiers: Express the extent to which a predicate is TRUE. In English, all, some, many, none, few values are used to express quantifiers. Quantification expresses the extent to which a predicate is true over a range of elements. Two types: Universal and Existential Why predicate logic? ⚫ Propositional Logic is not expressive enough ⚪ It cannot adequately express the meaning of statements in mathematics and in natural language Example 1: ⚫ “Every computer connected to the university network is functioning properly.” ⚫ No rules of propositional logic allow us to conclude the truth of the statement. Why predicate logic? Example 2: ⚫ “There is a computer on the university network that is under attack by an intruder.” Predicate Logic is more expressive and powerful we introduce a more powerful type of logic called predicate logic Predicate logic ⚫ Proposition, YES or NO? ⚪ ⚪ ⚪ ⚪ ⚪ Yes 3+2=5 X+2=5 No X + 2 = 5 for any choice of X in {1, 2, 3} Yes X + 4 = 5 for some X in {1, 2, 3} Yes Computer X is under attack by an intruder No Propositional Functions(Example) ⚫ “x is greater than 3” or (x > 3) ⚫ The variable x: subject of the statement ⚫ “is greater than 3”: predicate ⚫ P(x): propositional function P at x ⚫ Let P(x) = x > 3 ⚪ ⚪ ⚪ ⚪ P(x) has no truth values (x is not given a value) P(10) is true: The proposition 10 > 3 is true. P(1) is false: The proposition 1 > 3 is false. P(x) will create a proposition when given a value Propositional Functions(Example) ⚫ Let A(x) = “Computer x is under attack by an intruder.” ⚫ Suppose computers on campus, only CS2 and MATH1 are currently under attack by intruders. ⚫ What are truth values of A(CS1), A(CS2), and A(MATH1)? ⚪ ⚪ The statement A(CS1) by setting x = CS1 in the statement “Computer x is under attack by an intruder.” CS1 is not on the list of computers currently under attack, A(CS1) is false. CS2 and MATH1 are on the list of computers under attack, A(CS2) and A(MATH1) are true. Propositional Functions ⚫ Functions with multiple variables: ⚪ P(x,y) = x + y == 0 ⯍ ⚪ P(x,y,z) = x + y == z ⯍ ⚪ P(1,2) is false, P(1,-1) is true P(3,4,5) is false, P(1,2,3) is true P(x1,x2,x3 … xn) = … Predicates ⚫ A predicate is a declarative statement with at least one variable (i.e. unknown value). ⚫ A predicate, or propositional function, is a function that takes some variable(s) as arguments and returns True or False. Predicates ⚫ Suppose Q(x, y) = “x > y” Proposition, YES or NO? ⚫ Q(x, y) No ⚫ Q(3, 4) Yes ⚫ Q(x, 9) No Predicate, YES or NO? Q(x, y) Yes Q(3, 4) No Q(x, 9) Yes Universe of Discourse (U.D.) - Domain ⚫ The power of distinguishing subjects from predicates is that it lets you state things about many objects at once. e.g., let P(x) = “x + 1 > x”. We can then say, “For any number x, P(x) is true” instead of (0 + 1 > 0) ∧ (1 + 1 > 1) ∧ (2 + 1 > 2) ∧ ... The collection of values that a variable x can take is called x’s universe of discourse or the domain of discourse (often just referred to as the domain). Quantifier Expressions ⚫ Quantification expresses the extent to which a predicate is true over a range of elements. ⚫ In English, the words all, some, many, none, and few are used in quantifications. ⚫ Quantifiers provide a notation that allows us to quantify (count) how many objects in the universe of discourse satisfy the given predicate. ⚫ “∀” is the FOR∀LL or universal quantifier. ⚫ ∀x P(x) means for all x in the domain, P(x). ⚫ “∃” is the ∃XISTS or existential quantifier. ⚫ ∃x P(x) means there exists an x in the domain (that is, 1 or more) such that P(x). ⚫ Types of Quantifiers ⚫ A quantifier is “an operator that limits the variables of a proposition”. ⚫ Two types: ⚪ ⚪ The Universal Quantifier ∀ The Existential Quantifier ∃ The Universal Quantifier ∀ ⚫ ∀x P(x): For all x in the domain, P(x). ⚫ ∀x P(x) is ⚪ ⚪ true if P(x) is true for every x in D (D: domain of discourse) false if P(x) is false for at least one x in D For every real number x, x2 ≥ 0 TRUE ⯍ For every real number x, x2 – 1 > 0 FALSE ⯍ ⚫ A counter example to the statement ∀x P(x) is a value x in the domain D that makes P(x) false ⚫ What is the truth value of ∀x P(x) when the domain is empty? The Universal Quantifier ∀ ⚫ If all the elements in the domain can be listed as x1, x2,…, xn then, ∀x P(x) is the same as the conjunction: ⚫ P(x1) ∧ P(x2) ∧ ··· ∧ P(xn) ⚫ Example: Let the domain of x be parking spaces at UH. Let P(x) be the statement “x is full.” Then the universal quantification of P(x), ∀x P(x), is the proposition: ⚪ “All parking spaces at UH are full.” ⚪ or “Every parking space at UH is full.” ⚪ or “For each parking space at UH, that space is full.” Universal Quantifiers ⚫ Represented by an upside-down A: ∀ ⚪ ⚪ ⚫ It means “for all” Let P(x) = x+1 > x We can state the following: ⚪ ⚪ ⚪ ∀x P(x) English translation: “for all values of x, P(x) is true” English translation: “for all values of x, x+1>x is true” ⚫ Besides “for all”, universal quantification can be expressed in many other ways: “for every”, “all of”, “for each”, “given any”, “for arbitrary”, “for each” and “for any” Universal Quantifiers Universal Quantifiers ⚫ Let the universe of discourse be the real numbers. ⚫ Let P(x) = x/2 < x ⚪ ⚪ Not true for the negative numbers! 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 Universal Quantifiers Question Question The Existential Quantifier ∃ ⚫ ∃x P(x): There exists an x in the domain (that is, 1 or more) such that P(x). ⚫ ∃x P(x) is ⚪ true if P(x) is true for at least one x in the domain ⚪ false if P(x) is false for every x in the domain ⚫ What is the truth value of ∃x P(x) when the domain is empty? FALSE ⚫ If all the elements in the domain can be listed as x1, x2,…, xn then, ∃x P(x) is the same as the disjunction: ⚫ P(x1) ∨ P(x2) ∨ ··· ∨ P(xn) Existential Quantification ⚫ Represented by an backwards E: ∃ ⚪ ⚪ It means “there exists”, there is”, “for some”, etc. Let P(x) = x+1 > x ⚫ We can state the following: ⚪ ⚪ ⚪ ⚪ ∃x P(x) 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 some x, P(x)” The Existential Quantifier ∃ ⚫ Example: ⚫ Let the domain of x be parking spaces at UH. Let P(x) be the statement “x is full.” ⚫ Then the existential quantification of P(x), ⚫ ∃x P(x), is the proposition: ⚫ “Some parking spaces at UH are full.” ⚫ or “There is a parking space at UH that is full.” ⚫ or “At least one parking space at UH is full.” Existential Quantification ⚫ The existential quantifier of P(x) is the proposition: ⚪ “P(x) is true for some x in the universe of discourse.” ⚫ ∃x P(x) is TRUE if there is an x for which P(x) is true. ⚫ ∃x P(x) is FALSE if P(x) is false for every single x. ⚫ Existential Quantification ⚫ Note that you still have to specify your universe ⚫ Let P(x) = x+1 < x ⚪ ⚪ There is no numerical value x for which x+1<x Thus, ∃x P(x) is false Existential Quantification ⚫ Let P(x) = 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 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 Existential Quantification ⚫ Example: Let P(x) denote the statement “x > 3.” What is the truth value of the quantification ∃xP(x), where the domain consists of all real numbers? ⚫ Solution: Because “x > 3” is sometimes true—for instance, when x = 4 the existential quantification of P(x), which is ∃xP(x), is true. Existential Quantification ⚫ Example: Let Q(x) denote the statement “x ==x + 1.”What is the truth value of the quantification ∃xQ(x), where the domain consists of all real numbers? ⚫ Solution: Because Q(x) is false for every real number x, the existential quantification of Q(x), which is ∃xQ(x), is false. ⚫ Existential Quantification ⚫ Given some propositional function P(x) And values in the universe x1 .. xn ⚫ The existential quantification ∃x P(x) implies: ⚫ P(x1) ∨ P(x2) ∨ … ∨ P(xn) Summary