0% found this document useful (0 votes)
3 views

Week 3

The document discusses Predicate Logic, which extends propositional logic to reason about classes of entities using predicates, variables, and quantifiers. It explains the concepts of universal and existential quantifiers, their applications, and how to translate statements between English and logical expressions. Additionally, it covers negation of quantifiers and provides examples to illustrate these concepts.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Week 3

The document discusses Predicate Logic, which extends propositional logic to reason about classes of entities using predicates, variables, and quantifiers. It explains the concepts of universal and existential quantifiers, their applications, and how to translate statements between English and logical expressions. Additionally, it covers negation of quantifiers and provides examples to illustrate these concepts.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 29

Discrete Structures

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

• Predicate logic is an extension of propositional


logic that permits concisely reasoning about whole
classes of entities.
E.g., “x>1”, “x+y=10”
• Such statements are neither true or false when the
values of the variables are not specified.

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

• Student(Ali) …. T (if Ali is a student)


• Student(Bilal) …. T (if Bilal is a student)
• Student(Saba) ….. F (if Saba is not a student)

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).

- “” is the FORLL or universal quantifier.


x P(x) means for all x in the u.d., P holds.

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.

Answer: Since every number x is greater than itself


minus 1. Therefore, x P(x) is true.

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).

• Everything within the scope of a quantifier can be thought


of as a propositional function.
• For example,
∀x∃y(x + y = 0)
is the same thing as ∀xQ(x), where Q(x) is ∃yP(x, y),
where P(x, y) is x + y = 0.
Multiple Quantifiers
• xy P(x, y)
• “For all x, there exists a y such that P(x,y) is true”
• Example: xy (x+y == 0)

• xy P(x,y)
• There exists an x such that for all y P(x,y) is true”
• xy (x*y == 0)
Predicates - the meaning of multiple quantifiers

Statement When True? When False?


∀x∀yP(x, y) P(x, y) is true for every There is a pair x, y for
∀y∀xP(x, y) pair x, y. which P(x, y) is false.
∀x∃yP(x, y) For every x there is a y There is an x such that
for which P(x, y) is true. P(x, y) is false for every
y.
∃x∀yP(x, y) There is an x for which For every x there is a y
P(x, y) is true for every y. for which P(x, y) is false.
∃x∃yP(x, y) There is a pair x, y for P(x, y) is false for every
∃y∃xP(x, y) which P(x, y) is true. pair x, y.
Example
• Let Q(x, y) denote “x + y = 0.” What are the truth values of
the quantifications ∃y∀xQ(x, y) and ∀x∃yQ(x, y), where
the domain for all variables consists of all real numbers?

• 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).”

• Given a real number x, there is a real number y such that


x + y = 0; namely, y = −x.
• Hence, the statement ∀x∃yQ(x, y) is true.
Order of Quantifiers

• xy and xy are not equivalent!


• xy P(x,y)
• P(x,y) = (x+y == 0) is false

• xy 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:
• ¬(xy P(x,y)) = x ¬y P(x,y) = xy ¬P(x,y)
• ¬(xyz P(x,y,z)) = x¬yz P(x,y,z)
= xy ¬ z P(x,y,z) = xyz ¬P(x,y,z)
Negating Multiple Quantifiers

• Consider ¬(xy P(x,y)) = xy ¬P(x,y)


• The left side is saying “for all x, there exists a y such
that P is true”
• To negate it, you need to show that “there exists an x
such that for all y, P is false”
• Consider ¬(xy P(x,y)) = xy ¬P(x,y)
• The left side is saying “there exists an x such that for all
y, P is true”
• To negate it, you need to show that “for all x, there
exists a y such that P is false”
Nested Quantifiers Example
• Let 𝑆 = Set of Students
C = Set of Courses
𝑄 𝑥, 𝑦 = “𝑥 takes course 𝑦” true when 𝑥 takes course
𝑦 otherwise false.
Translate the following logical expression:
• ∀𝑥∀𝑦𝑄 𝑥, 𝑦
• ∃𝑥∃𝑦𝑄(𝑥, 𝑦)
• ∀𝑥∃𝑦𝑄 𝑥, 𝑦
• ∃𝑥∀𝑦𝑄(𝑥, 𝑦)
Summery of Quantifier Statements
When x P(x) and x P(x) are true and false?

Suppose the elements in the universe of discourse


can be enumerated as x1, x2, ..., xN then:
• x P(x) is true whenever P(x1)  P(x2)  ...  P(xN) is true
• x P(x) is true whenever P(x1)  P(x2)  ...  P(xN) is true.

29

You might also like