













Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!














Predicate logic is used to express the meaning of a wide range of statements in mathematics and computer science in ways that permit us to reason and explore relationships between objects. To understand predicate logic, we first need to introduce the concept of a predicate. Afterward, we will introduce the notion of quantifiers, which enable us to reason with statements that assert that a certain property holds for all objects of a certain type and with statements that assert the existence of an object with a particular property.
CONSIDER The statement "x is greater than 3" This statement is neither true nor false as the value of variable x is not specified) This statement has two parts: The first part, the variable x, is the subject of the statement. The second part- the predicate, "is greater than 3"-refers to a property that the subject of the statement can have. We can denote the statement "x is greater than 3" by P (x), Where: P denotes the predicate "is greater than 3" and x is the variable. The statement P(x) is also said to be the value of the propositional function P at x. Once a value has been assigned to the variable x , the statement P (x) becomes a proposition and has a truth value Propositional Functions ( 1 ) Consider P(x) = x < 5 What is the truth value of: P(x)? has no truth values (x is not given a value) P(1)? is true: The proposition 1<5 is true P(10)? is false: The proposition 10<5 is false P(x) will create a proposition when given a value Example: Let P(x) = “x is a multiple of 5” For what values of x, P(x) is true?
Quantifiers When the variables in a propositional function are assigned values, the resulting statement becomes a proposition with a certain truth value. However, there is another important way, called quantification, to create a proposition from a propositional function. Quantification expresses the extent to which a predicate is true over a range of elements We’ll study two types of quantification :
**1. The universal quantification
Universal Quantifiers 2 But is that always true? x P(x) You need to specify the universe! What values x can represent Called the “ domain ” or “ universe of discourse ” Universal Quantifiers 3 Let P(x) = x/2 < x what’s the truth value of x P(x) when the universe is the real numbers (R). Remember: The real numbers include all the whole numbers, rational numbers, irrational numbers such as √2 (1.41421356...) Not true for the negative numbers (All the negative numbers are counterexample)! Thus, x P(x) is false In order to prove that a universal quantification is true, it must be shown true for ALL cases (for ALL elements of the domain) In order to prove that a universal quantification is false, it must be shown to be false for only ONE case (for only ONE element of the domain)
Existential Quantification 2 Note that you still have to specify your universe Let P(x) = x+1 < x, where the universe is R. What is the truth value of x P(x)? There is no numerical value x for which x+1<x, Thus, x P(x) is false Existential Quantification 3 Let P(x) = x+1 > x, where the universe is R. What is the truth value of x P(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 4 Given some propositional function P(x) And values in the universe x 1 .. xn The existential quantification x P(x) implies: P(x 1 ) P(x 2 ) … P(xn) The meaning of the universal and Existential quantifiers
Binding Variables 1 When a quantifier is used on the variable x, we say that this occurrence of the variable is bound. An occurrence of a variable that is not bound by a quantifier or set equal to a particular value is said to be free The part of a logical expression to which a quantifier is applied is called the scope of this quantifier. Eg.: In the statement ∃x (P(x) ∧ Q(x)) ∨ ∀x R(x), all variables are bound. The scope of the first quantifier, ∃x, is the expression P(x) ∧ Q(x) because ∃x is applied only to P(x) ∧ Q(x), and not to the rest of the statement. In other words, the existential quantifier binds the variable x in P(x)∧Q(x) Binding Variables 2 Let P(x,y) be x > y Consider: x P(x,y) Is this a proposition (assuming the universe of X is defined)? NO. What is y? Note that y is free (not “bound” by a quantifier). Therefore, x P(x, y) discussed in the above example is not a proposition.
Binding Variables 3 EXAMPLE: Which of the following statements is a proposition, assuming that the domains of x and y are defined? ( x P(x)) Q(x) The x in Q(x) is not bound; thus not a proposition ( x P(x)) ( x Q(x)) Both x values are bound; thus it is a proposition ( x (P(x) Q(x))) ( y R(y)) All variables are bound; thus it is a proposition ( x P(x) Q(y)) ( y R(y)) The y in Q(y) is not bound; this not a proposition Translating from English_ Translate (express) the following statement as a logical expression if the universe of discourse is all people. Every student in this class has studied calculus. Let: S(x) be “x is a student in this class” C(x) be “x has studied calculus” x (S(x)C(x)) Wrong! Why? because this way the statement says that all people are students in this class and have studied calculus Right way: x (S(x)→C(x))
Translating from English_ S(x) be “x is a student” M(x) be “x has visited Mexico” C(x) be “x has visited Canada”
Negating Quantifications The rules for negating quantifiers are called the De Morgan’s laws for quantifiers. To negate a universal quantification: Change it to an existential quantification AND negate the propositional function ¬ x P(x) = x ¬P(x) To negate an existential quantification: Change it to a universal quantification AND negate the propositional function ¬ x P(x) = x ¬P(x)
Let P(x) be the statement “x^2 − 1 = 0”, where the domain is the set of real numbers (R) What’s the truth value of x P(x) False What’s the truth value of x P(x) True What’s the truth value of x P(x) x P(x) ≡ x P(x) ≡ x (x 2 − 1 ≠ 0). True What’s the truth value of x P(x) x P(x) ≡ x P(x) ≡ x (x 2 − 1 ≠ 0). False Negating Quantifications_Example 1 Negating Quantifications_Example 2
Solution : Let S (x) denote "x is excellent student" Then the statement "There is an excellent student “ is represented by x S(x) The negation of this statement is ¬ x S(x) , which is equivalent to x ¬S(x). Thus the negation can be expressed in many ways including "Every student is not excellent“ “All students are not excellent"
Negating Quantifications_Example 5 Show that ¬x [P(x) → Q(x)] and x [P(x) ¬Q(x)] are logically equivalent Solution ¬x [P(x) → Q(x)] x (¬[P(x) → Q(x)]) De Morgan's x (¬[¬P(x) Q(x)]) De Morgan's x [P(x) ¬Q(x)] Nested Quantifiers You can have multiple quantifiers on a statement: 1) x y P(x,y) “For all x, there exists a y such that P(x,y) is true” In other words: “For every x, there exists it is own y such that P(x,y) is true” Example: xy (x+y == 0) Also this is similar to: x Q(x) where Q(x) is y P(x, y) 2) x y P(x,y) “There exists an x such that for all y P(x,y) is true” xy (x*y == 0) In working with quantifications of more than one variable, it is sometimes helpful to think in terms of nested loops.
Order of Quantifiers (1) Note that x y and x y are NOT equivalent!
Order of Quantifiers (2)
x y z Q(x, y, z) means "For all x and for all y, there is a z such that x + y = z" and is true z x y Q(x, y, z) means "There is a z such that for all x and for all y it is true that x + y = z" It is false because
Translating English Nested Quantifiers (1) The product of two negative integers is positive
The average of two positive integers is positive
The difference of two negative integers can be non- negative
The absolute value of the sum of two integers does not exceed the sum of the absolute values of these integers
Translating English Nested Quantifiers (2) Express (translate) the following statement as a logical expression involving predicates, quantifiers and logical connectives. The domain consists of all people. "If a person is female and is a parent, then this person is someone's mother" Solution :
"For every person x, if person x is female and person x is a parent, then there exists a person y such that person x is the mother of person y."
P(x) represent "x is a parent," M (x, y) represent "x is the mother of y."
x (( F(x) P(x)) → y M(x, y))
is applied) of universal quantifier then we can move y to the left after x. We obtain the logically equivalent expression x y (( F(x) P(x)) → M(x, y))
Translating English Nested Quantifiers (3) Express (translate) the following statement as a logical expression involving predicates, quantifiers and logical connectives. The domain consists of all people. "Everyone has exactly one best friend" Solution This statement can be rephrased as "For every person x, person x has exactly one best friend y”. This means that “there is a person y who is the best friend of x, and furthermore, that for every person z, if person z is not the person y, then z is not the best friend of x. Let B(x, y) be the statement "y is the best friend of x" Then our original statement can be expressed as: x y(B (x , y) z (( z ≠ y) → ¬B(x, z))). Translating Nested Quantifiers English (1) x y (((x≥0) (y<0)) → (x-y > 0)) A non-negative number minus a negative number is greater than zero x y (((x≤0) (y≤0)) (x-y > 0)) The difference between two non-positive numbers can be positive x y (((x≠0) (y≠0)) ↔ (xy ≠ 0)) The product of two non-zero numbers is non-zero if and only if both factors are non-zero