Week 3
Week 3
Lec # 03
1
Predicate Logic
• Predicate Logic, First-Order Logic or Quantified
Logic is a formal language in which propositions
are expressed in terms of predicates, variables and
quantifiers.
2
Predicate Logic
3
Predicate Logic
• Predicates represent properties or relations
among objects
• A predicate P(x) assigns a value true or false to
each x depending on whether the property holds
or not for x.
• The assignment is best viewed as a big table with
the variable x substituted for objects from the
universe of discourse
4
Universe of Discourse
• The collection of values that a variable x can take is
called x’s universe of discourse.
e.g., let P(x)=“x+1>x”.
we could define the course of universe as the set
of integers.
5
Predicate Logic
Example:
• Assume Student(x) where the universe of
discourse are people
6
Predicate Logic
Example:
Assume a predicate P(x) that represents the statement:
• x is a prime number
What are the truth values of:
• P(2) T
• P(3) T
• P(4) F
• P(5) T
• P(6) F
• P(7) T
Is P(x) a proposition?
No. Many possible substitutions are possible. 7
Predicate Logic
• Predicates can have more arguments which represent
the relations between objects
• Example:
• Let Q(x,y) denote ‘x+5 >y’
–Is Q(x,y) a proposition? No!
–Is Q(3,7) a proposition? Yes. It is true.
–What is the truth value of:
• – Q(3,7) T
• – Q(1,6) F
• – Q(2,2) T
–Is Q(3,y) a proposition? No! We cannot say it is true
or false. 8
Applications of Predicate Logic
• It is the formal notation for writing perfectly clear,
concise, and unambiguous mathematical
definitions, axioms, and theorems for any branch of
mathematics.
• Supported by some of the more sophisticated
database query engines.
• Basis for automatic theorem provers and many
other Artificial Intelligence systems.
9
Subjects and Predicates
• The proposition
“The dog is
sleeping” has two parts:
• “the dog” denotes the subject - the object or entity that
the sentence is about.
• “is sleeping” denotes the predicate- a property that the
subject can have.
10
Quantifier Expressions
Quantifiers allow us to quantify (count) how many
objects in the universe of discourse satisfy a given
predicate.
Two types of quantifiers
• Universal
Example: ‘ all BZU CS graduates have to pass CS441”
– the statement is true for all graduates
• Existential
Example: ‘Some BZU CS students graduate with honor.’
– the statement is true for some people
11
Universal Quantifier
Def. The universal quantification of P(x) is the
proposition:
"P(x) is true for all values of x in the domain of
discourse." The notation x P(x) denotes the
universal quantification of P(x), and is expressed
as for every x, P(x).
12
Universal Quantifier : Example
• Let P(x) be the predicate “x is full.”
• Let the u.d. of x be parking spaces at Mall.
• The universal quantification of P(x),
x P(x), is the proposition:
• “All parking spaces at Mall are full.” or
• “Every parking space at Mall is full.” or
• “For each parking space at Mall, that space is full.”
13
Universal Quantifier : Example
• Let P(x) denote x > x - 1.
• What is the truth value of x P(x)?
• Assume the universe of discourse of x is all real
numbers.
14
Existential Quantifier
Def. The existential quantification of P(x) is the
proposition:
"There exists an element in the domain (universe) of
discourse such that P(x) is true." The notation x
P(x) denotes the existential quantification of P(x),
and is expressed as there is an x such that P(x) is
true.
- “” is the XISTS or existential quantifier.
x P(x) means there exists an x in the u.d. (that
is, one or more) such that P(x) is true.
15
Existential Quantifier Example
• Let P(x) be the predicate “x is full.”
• Let the u.d. of x be parking spaces at Mall.
• The universal quantification of P(x),
x P(x), is the proposition:
• “Some parking space at Mall is full.” or
• “There is a parking space at Mall that is full.” or
• “At least one parking space at Mall is full.”
16
Existential Quantifier Example
• Let A(x) denote x > 5 and
• Assume the universe of discourse of x is from Real
numbers.
• What is the truth value of x T(x)?
Answer:
• Since 10 > 5 is true.
• Therefore, it is true that x T(x).
17
Nested Quantifiers
• Two quantifiers are nested if one is within scope of other,
such as
∀x∃y(x + y = 0).
• xy P(x,y)
• There exists an x such that for all y P(x,y) is true”
• xy (x*y == 0)
Predicates - the meaning of multiple quantifiers
• Solution:
The quantification ∃y∀xQ(x, y) denotes the
proposition
“There is a real number y such that for every real number
x, Q(x, y).”
• No matter what value of y is chosen, there is only one
value of x for which x + y = 0. Because there is no real
number y such that x + y = 0 for all real numbers x, the
statement ∃y∀xQ(x, y) is false.
Example
• The quantification ∀x∃yQ(x, y) denotes the proposition
“For every real number x there is a real number y such
that Q(x, y).”
• xy P(x,y)
• P(x,y) = (x+y == 0) is true
Translating between English and Quantifiers
• Translate the statement “The sum of two positive integers
is always positive” into a logical expression.
• Solution:
• First rewrite it so that the implied quantifiers and a domain
are shown: “For every two integers, if these integers are
both positive, then the sum of these integers is positive.”
• Next, introduce the variables x and y to obtain “For all
positive integers x and y, x + y is positive.”
• Statement is ∀x∀y((x > 0) 𝖠 (y > 0) → (x +y > 0)),
• where the domain for both variables consists positive
integers.
Translating between English and Quantifiers
• Translate the statement
∀x(C(x) ∨ ∃y(C(y) 𝖠 F(x, y)))
into English, where C(x) is “x has a computer,” F(x, y) is “x
and y are friends,” and the domain for both x and y consists
of all students in your school.
• Solution:
• The statement says that for every student x in your
school, x has a computer or there is a student y such that
y has a computer and x and y are friends.
• In other words, every student in your school has a
computer or has a friend who has a computer.
Negating Multiple Quantifiers
• Recall negation rules for single quantifiers:
• ¬x P(x) = x ¬P(x)
• ¬x P(x) = x ¬P(x)
• Essentially, you change the quantifier(s), and negate
what it’s quantifying
• Examples:
• ¬(xy P(x,y)) = x ¬y P(x,y) = xy ¬P(x,y)
• ¬(xyz P(x,y,z)) = x¬yz P(x,y,z)
= xy ¬ z P(x,y,z) = xyz ¬P(x,y,z)
Negating Multiple Quantifiers
29