➢ The statements “x > 3”, “x = y + 3”, and “computer x
is functioning properly” are not propositions ➢ This section discusses how proposition can be produced from such statements ➢ The statement “x > 3” has two parts – ➢ the variables x, the subject of the statement ➢ is greater than 3, the predicate, the property that the subject of the statement can have ➢ We denote P(x) = “x > 3”, where P denotes the predicate “is greater than 3” and x is the variable ➢ Once we assign a value to x, it becomes proposition 10/3/2022 Tahir Iqbal, Bahria University Lahore 2 Predicates and Quantifiers - Predicates
➢ Def: A predicate, or propositional function, is a
function that takes some variable(s) as arguments and returns True or False. ➢ Example: Let P(x) = “x > 3”, what are the truth values of P(2) and P(4)? ➢ Sol: P(2) = “2 > 3” is false and P(4) = “4 > 3” is true ➢ Example: Let Q(x, y) = “x = y + 3”, what are the truth values of Q(1, 2) and Q(3, 0)? ➢ Sol: Q(1,2)= “1=2+3” is false, Q(3,0)= “3=0+3” is true ➢ Def: A statement of the form P(x1, x2, …., xn) is the value of the propositional function P at the n-tuple (x1, x2, …., xn), and P is called n-ary predicate 10/3/2022 Tahir Iqbal, Bahria University Lahore 3 Predicates and Quantifiers- Predicates
➢ Example: Consider the statement
if x > 0 then x := x + 1. Here P(x) = “x > 0”. If P(x) is true for the value of x, then the assignment statement x := x + 1 is executed, x is increased by 1. If P(x) is false for the value of x, then the assignment statement is not executed, x remains same ➢ The statements that describe valid input are known as preconditions, and the conditions that the output should satisfy when it has run are known as postconditions ➢ Q7: Let R(x, y, z) = “x + y = z”, what are the truth values of R(1, 2, 3) and R(0, 0, 1)? 10/3/2022 Tahir Iqbal, Bahria University Lahore 4 Predicates and Quantifiers - Quantifiers ➢ Another way of changing a predicate into a proposition is called quantification ➢ In English, the words all, some, many, none, and few are used in quantifications ➢ Two types of quantifications: ➢ Universal quantifications – a predicate is true for every element under consideration ➢ Existential quantifications – there is one or more element under consideration for which predicate is true ➢ The area of logic that deals with predicates and quantifiers is called predicate calculus 10/3/2022 Tahir Iqbal, Bahria University Lahore 5 Predicates and Quantifiers – Universal Quantifiers ➢ Def: The universal quantification of P(x) is the statement “P(x) for all values of x in the domain”. The notation x P(x) denotes the universal quantification of P(x). Here is called universal quantifier. An element for which P(x) is false is called a counterexample of x P(x). ➢ Quantifiers: Statement When True? When False? x P(x) P(x) is true for every x There is an x for which P(x) is false x P(x) There is an x for which P(x) is false for P(x) is true every x 10/3/2022 Tahir Iqbal, Bahria University Lahore 6 Predicates and Quantifiers – Universal Quantifiers ➢ Example: Let P(x) = “x+1 > x”. What is the truth value of the quantification x P(x), where the domain consists of all real numbers? ➢ Sol: Because P(x) is true for all real numbers x, the quantification x P(x) is true. ➢ Example: Let Q(x) = “x < 2”. What is the truth value of the quantification x Q(x), where the domain consists of all real numbers? ➢ Sol: Because Q(x) is not true for every real number x, because, for instance, Q(3) is false. That is, x=3 is a counterexample for the statement x Q(x).
10/3/2022 Tahir Iqbal, Bahria University Lahore 7
Predicates and Quantifiers – Universal Quantifiers ➢ Q8: Let P(x) = “x2 > 0”. What is the truth value of the quantification x P(x), where the domain consists of all real numbers? ➢ Q9: Let Q(x) = “x2 < 10”. What is the truth value of the quantification x Q(x), where the domain consists of positive integers less than 4? ➢ Q10: Let R(x) = “x2 ≥ x”. What is the truth value of the quantification x R(x), where the domain consists of all real numbers? What is the truth value of the quantification if the domain consists of all integers?
10/3/2022 Tahir Iqbal, Bahria University Lahore 8
Predicates and Quantifiers – Existential Quantifiers ➢ Def: The existential quantification of P(x) is the statement “There exists an element x in the domain such that P(x)”. The notation x P(x) denotes the existential quantification of P(x). Here is called existential quantifier. ➢ Example: Let P(x) = “x > 3”. What is the truth value of the quantification x P(x), where the domain consists of all real numbers? ➢ Sol: Because P(x) is sometimes true - for instance, when x=4 – the existential quantification of P(x), which is x P(x), is true.
10/3/2022 Tahir Iqbal, Bahria University Lahore 9
Predicates and Quantifiers – Existential Quantifiers ➢ Example: Let P(x) = “x = x+1”. What is the truth value of the quantification x P(x), where the domain consists of all real numbers? ➢ Sol: Because P(x) is false for every real number x, the quantification x P(x) is false. ➢ Q11: Let Q(x) = “x2 > 10”. What is the truth value of the quantification x Q(x), where the domain consists of positive integers not exceeding 4? ➢ Q12: Let R(x) = “x2 ≥ x”. What is the truth value of the quantification x R(x), where the domain consists of all real numbers? What is the truth value of the quantification if the domain consists of all integers? 10/3/2022 Tahir Iqbal, Bahria University Lahore 10 Predicates and Quantifiers – Translating English into Logical Expression ➢ Example: Express the statement “Every student in this class has studied calculus” using predicates and quantifiers. ➢ Sol: We rewrite as “For every student in this class, the student has studied calculus”. => “For every student x in this class, x has studied calculus”. Let P(x) = “x has studied calculus”, then our statement is represented by xP(x). ➢ Q13: Express the statements “Some students in this class visited Dubai” and “Every student in this class has visited either Makkah or Madina” using predicates and quantifiers. 10/3/2022 Tahir Iqbal, Bahria University Lahore 11 Predicates and Quantifiers – Quantifiers with Restricted Domain ➢ Example: What do the statements x < 0(x2 > 0), y≠0(y3 ≠ 0), and z > 0(z2 = 2) mean, where the domain in each case consists of all real numbers? ➢ Sol: The statement x < 0(x2 > 0) states that for every number x with x < 0, x2 > 0. That is, it states “The square of a negative real number is positive”. The statement is the same as x (x < 0 → x2 > 0). The statement y ≠ 0(y3 ≠ 0) states that for every real number y with y ≠ 0, we have y3 ≠ 0. That is, it states “The cube of every nonzero real is nonzero”. The statement is the same as y (y ≠ 0 → y3 ≠ 0). Finally, the statement z > 0(z2 = 2) states that there exist a real number z with z > 0 such that z2=2. That is, it states “There is positive square root of 2”. The statement is the same as z (z > 0 ⌃z2 = 2). 10/3/2022 Tahir Iqbal, Bahria University Lahore 12 Predicates and Quantifiers – Quantifiers with Restricted Domain ➢ Note: The restriction of a universal quantification is the same as the universal quantification of a conditional statement. For instance, x < 0(x2 > 0) is another way of expressing x (x < 0 → x2 > 0). ➢ On the other hand, the restriction of an existential quantification is the same as the existential quantification of a conjunction. For instance, z>0(z2=2) can be expressed as z (z > 0 ⌃ z2 = 2). ➢ Precedence of Quantifiers: The quantifiers and have higher precedence then all logical operators from propositional calculus. For example, xP(x) v Q(x) is the disjunction of xP(x) and Q(x). In other words, it means (xP(x)) v Q(x) rather than x (P(x) v Q(x)) 10/3/2022 Tahir Iqbal, Bahria University Lahore 13 Predicates and Quantifiers – Negating Quantified Expression ➢ Example: x P(x) means “P(x) is true for every x”. What about x P(x) ? ➢ Sol: x P(x) = Not [“P(x) is true for every x.”] => “There is an x for which P(x) is not true.” => x P(x) So, x P(x) is logically equivalent to x P(x). ➢ Example: x P(x) means “P(x) is true for some x”. What about x P(x) ? ➢ Sol: x P(x) = Not [“P(x) is true for some x.”] => “P(x) is not true for all x.” => x P(x) So, x P(x) is logically equivalent to x P(x). 10/3/2022 Tahir Iqbal, Bahria University Lahore 14 Predicates and Quantifiers – Negating Quantified Expression ➢ De Morgan’s laws for quantifiers:
Negation Equivalent When is When False?
Statement Negation True? x P(x) x P(x) For every x, There is an x P(x) is false for which P(x) is true x P(x) x P(x) There is an x for which P(x) is P(x) is true false for every x
10/3/2022 Tahir Iqbal, Bahria University Lahore 15
Predicates and Quantifiers – Negating Quantified Expression ➢ Example: What are the negations of the statements “There is a religious man” and “All Saudi eat Rice”? ➢ Sol: Let P(x) = “x is a religious”, => “There is a religious man”= xP(x), where the domain consists of all men Now, xP(x) = xP(x) =“Every man is nonreligious”. Next, let Q(x) = “x eats Rice” => “All Saudi eat Rice” = xQ(x), where the domain consists of all Saudi Now, xQ(x) = xQ(x) = “Some Saudi does not eat rice”. ➢ Q14: What are the negations of the statements x (x2 > x) and x (x2 = 2)”? 10/3/2022 Tahir Iqbal, Bahria University Lahore 16 Predicates and Quantifiers – Negating Quantified Expression ➢ Example: Let L(x) = “x is a lion”, F(x) = “x is fierce”, and C(x) = “x drinks coffee”. Show the quantifiers for the statements (i) All lions are fierce, (ii) Some lions don’t drink coffee, (iii) Some fierce creatures don’t drink coffee. ➢ Sol: (i) x (L(x) → F(x)), ii) x (L(x) C(x)), and (iii) x (F(x) C(x)) ➢ Q15: Let B(x) = “x is a hummingbird”, L(x) = “x is a large bird”, H(x) = “x lives on honey”, and R(x) = “x is richly colored”. Show the quantifiers for the statements (i) All hummingbirds are richly colored, (ii) No large birds live on honey, (iii) Birds that do not live on honey are dully colored, and (iv) Not all large birds live on honey. 10/3/2022 Tahir Iqbal, Bahria University Lahore 17 Predicates and Quantifiers – Logical Equivalences ➢ Example: Show that x (P(x) Q(x)) and xP(x) x Q(x) are logically equivalent. ➢ Sol: Let x (P(x) Q(x)) is true => if a is in the domain, then P(a) Q(a) is true => P(a) and Q(a) are true, for all a in the domain => xP(x) and xQ(x) are true => xP(x) xQ(x) is true So, they are logically equivalent. ➢ Q16: Show that x(P(x)→Q(x)) and x(P(x) Q(x)) are logically equivalent.
10/3/2022 Tahir Iqbal, Bahria University Lahore 18