Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 17

Predicate Logic and Quantifiers

Lecture 04
Instructor: Engr. Iqra Saleem
Predicates

• A propositional function or predicate is a sentence that contains one or more


variables.
• A predicate is neither true nor false.
• A predicate becomes a proposition when the variables are substituted with
specific values.
Examples
• P(x,y) x+1=y
• P(x,y) 2x=y
• The cat is sleeping in the sun.”
• X>3
Predicate Notation
Predicates to propositions

• There are two methods to obtain propositions from predicates.


1. Assign specific values to variables
2. Add quantifiers
Example 1

• P(x) : x>3.
• What are the truth value of P(4) and P(2)?
Solution
• Set variable x=4 P(4): 4>3 True
• x=2 P(2): 2>3 False
Example 2

• Q(x,y) : x = y+3.
• What are the truth value of Q(1,2) and Q(3,0)?
Solution:
• Set variables x and y
• x=1, y=2 Q(1,2): 1=2+3 False
• x=3, y=0 Q(3,0): 3=0+3 True
What are quantifiers?

• Quantifiers are words that refer to quantities such as “all” or “some” and they tell
for how many elements a given predicate is true
• Two types of quantifiers:
• 1. Universal quantifier (∀)
• 2. Existential quantifier (∃)
Universal quantifier

• The universal quantification of a predicate P(x) is the proposition “P(x) is true for
all values of x in the universe of discourse”
• We use the notation
∀xP(x)
• which can be read “for all x “
Universal quantifier (∀)
• Let p(x) be a predicate and D be the domain of x
• A universal statement is a statement of the form
∀x ∈ D, p(x)
• Forms:
• “p(x) is true for all values of x”
• “For all x, p(x)”
• “For each x, p(x)”
• “For every x, p(x)”
• “Given any x, p(x)”
• It is true if p(x) is true for each x in D;
• It is false if p(x) is false for at least one x in D
Existential quantifier (∃)

• Let p(x) be a predicate and D be the domain of x


• An existential statement is a statement of the form
• ∃x ∈ D, p(x)
Forms:
• “There exists an x such that p(x)”
• “For some x, p(x)”
• “We can find an x, such that p(x)”
• “There is some x such that p(x)”
• “There is at least one x such that p(x)”
• It is true if p(x) is true for at least one x in D;
• It is false if p(x) is false for all x in D
Example

• Let Q(x, y, z) denote the statement “x 2 + y 2 = z 2”. What is the truth value of
Q(3, 4, 5)? What is the truth value of Q(2, 2, 3)? How many values of (x, y, z) make
the predicate true?
Solution

• Since 32+ 42 = 25 = 52 , Q(3, 4, 5) is true.


• Since 22+ 22 = 8 ≠ 32 = 9, Q(2, 2, 3) is false.
• There are infinitely many values for (x, y, z) that make this propositional function
true
Nested Quantifiers

• Two quantifiers are nested if one is within the scope of the other.
• Example-1:
• ∀x ∃y (x+y=5)
• Here ‘∃’ (read as-there exists) and ‘∀’ (read as-for all) are quantifiers for variables
x and y.
Example 2

• ∀x ∀y ((x> 0)∧(y< 0) → (xy< 0))


For every real number x and y, if x is positive and y is negative, implies xy is
negative.
Example 3

Express the statement “for every x and for every y, x + y > 10”
• Let P(x, y) be the statement x + y > 10 where the universe of discourse for x, y is
the set of integers.
• Answer: ∀x∀yP(x, y)
• we can also use the shorthand ∀x, yP(x, y)
Example 4

• Express the statement “there is a number x such that when it is added to any
number, the result is that number, and if it is multiplied by any number, the result
is x” as a logical expression.
Solution:
• Let P(x, y) be the expression “x + y = y”.
• Let Q(x, y) be the expression “xy = x”.
• Then the expression is ∃x∀y (P(x, y) ∧ Q(x, y))

You might also like