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

02 Predicate Logic 4p

This document covers Predicate Logic, including predicates, quantifiers, and their applications in logical expressions. It explains the differences between universal and existential quantifiers, their negation, and how to translate English statements into predicate logic. Additionally, it discusses logical equivalences and the importance of quantifiers in expressing relationships between objects.

Uploaded by

mvrxyz000
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)
2 views

02 Predicate Logic 4p

This document covers Predicate Logic, including predicates, quantifiers, and their applications in logical expressions. It explains the differences between universal and existential quantifiers, their negation, and how to translate English statements into predicate logic. Additionally, it discusses logical equivalences and the importance of quantifiers in expressing relationships between objects.

Uploaded by

mvrxyz000
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/ 12

The Foundations: Logic and

Proofs
Chapter 1, Part II: Predicate Logic
Predicates and Quantifiers
Section 1.4

Summary Section Summary 1

Predicate Logic (First-Order Logic (FOL), Predicates


Predicate Calculus) Variables
• The Language of Quantifiers Quantifiers
• Logical Equivalences • Universal Quantifier
• Nested Quantifiers • Existential Quantifier
Negating Quantifiers
• Translation from Predicate Logic to English
• De Morgan’s Laws for Quantifiers
• Translation from English to Predicate Logic
Translating English to Logic
Logic Programming (optional)
Propositional Logic Not Enough Propositional Functions
If we have: Propositional functions become propositions (and have truth
values) when their variables are each replaced by a value from
“All men are mortal.” the domain (or bound by a quantifier, as we will see later).
The statement P(x) is said to be the value of the propositional
“Socrates is a man.”
function P at x.
Does it follow that “Socrates is mortal?” For example, let P(x) denote “x > 0” and the domain be the
integers. Then:
Can’t be represented in propositional logic. P(-3) is false.
Need a language that talks about objects, their P(0) is false.
properties, and their relations. P(3) is true.

Later we’ll see how to draw inferences. Often the domain is denoted by U. So in this example U is the
integers.

Introducing Predicate Logic Examples of Propositional Functions


Predicate logic uses the following new features: Let “x + y = z” be denoted by R(x, y, z) and U (for all three
variables) be the integers. Find these truth values:
• Variables: x, y, z R(2,-1,5)
Solution: F
• Predicates: P(x), M(x) R(3,4,7)
Solution: T
• Quantifiers (to be covered in a few slides): R(x, 3, z)
Solution: Not a Proposition

Propositional functions are a generalization of Now let “x - y = z” be denoted by Q(x, y, z), with U as the
integers. Find these truth values:
propositions. Q(2,-1,3)
Solution: T
• They contain variables and a predicate, e.g., P(x) Q(3,4,7)
Solution: F
• Variables can be replaced by elements from their Q(x, 3, z)
Solution: Not a Proposition
domain.
Compound Expressions Universal Quantifier
Connectives from propositional logic carry over to predicate logic. x P(x) is read as “For all x, P(x)” or “For every x, P(x)”
If P(x) denotes “x > 0,” find these truth values:
Examples:
P(3) ∨ P(-1) Solution: T
P(3) ∧ P(-1) Solution: F 1) If P(x) denotes “x > 0” and U is the integers, then x
P(3) → P(-1) Solution: F P(x) is false.
P(3) → ¬P(-1) Solution: T 2) If P(x) denotes “x > 0” and U is the positive integers,
Expressions with variables are not propositions and therefore do then x P(x) is true.
not have truth values. For example,
3) If P(x) denotes “x is even” and U is the integers, then 
P(3) ∧ P(y)
x P(x) is false.
P(x) → P(y)
When used with quantifiers (to be introduced next), these
expressions (propositional functions) become propositions.

Charles
Quantifiers Peirce Existential Quantifier
(1839-1914)

We need quantifiers to express the meaning of English words x P(x) is read as “For some x, P(x)”, or as “There
including all and some:
is an x such that P(x),” or “For at least one x, P(x).”
• “All men are Mortal.”
• “Some cats do not have fur.” Examples:
The two most important quantifiers are:
1. If P(x) denotes “x > 0” and U is the integers, then x
• Universal Quantifier, “For all,” symbol:  P(x) is true. It is also true if U is the positive integers.
• Existential Quantifier, “There exists,” symbol: 
2. If P(x) denotes “x < 0” and U is the positive integers,
We write as in x P(x) and x P(x).
then x P(x) is false.
x P(x) asserts P(x) is true for every x in the domain.
3. If P(x) denotes “x is even” and U is the integers, then
x P(x) asserts P(x) is true for some x in the domain.
x P(x) is true.
The quantifiers are said to bind the variable x in these
expressions.
Uniqueness Quantifier (optional) Properties of Quantifiers
!x P(x) means that P(x) is true for one and only one x in the The truth value of x P(x) and  x P(x) depend on both
universe of discourse. the propositional function P(x) and on the domain U.
This is commonly expressed in English in the following equivalent
ways: Examples:
• “There is a unique x such that P(x).” 1. If U is the positive integers and P(x) is the statement “x < 2”,
• “There is one and only one x such that P(x)” then x P(x) is true, but  x P(x) is false.
Examples:
2. If U is the negative integers and P(x) is the statement “x < 2”,
1. If P(x) denotes “x + 1 = 0” and U is the integers, then !x P(x) is true. then both x P(x) and x P(x) are true.
2. But if P(x) denotes “x > 0,” then !x P(x) is false.
3. If U consists of 3, 4, and 5, and P(x) is the statement “x < 2”,
The uniqueness quantifier is not really needed as the restriction
then both x P(x) and x P(x) are true. But if P(x) is the
that there is a unique x such that P(x) can be expressed as:
statement “x <2”, then both x P(x) and x P(x) are false.
x (P(x) ∧y (P(y) → y =x)

Thinking about Quantifiers Precedence of Quantifiers


When the domain of discourse is finite, we can think of The quantifiers  and  have higher precedence than all
quantification as looping through the elements of the domain. the logical operators.
To evaluate x P(x) loop through all x in the domain.
For example,x P(x)∨ Q(x) means (x P(x))∨ Q(x)
• If at every step P(x) is true, then x P(x) is true.
• If at a step P(x) is false, then x P(x) is false and the loop terminates. x (P(x)∨ Q(x)) means something different.
To evaluate x P(x) loop through all x in the domain. Unfortunately, often people writex P(x)∨ Q(x) when
• If at some step, P(x) is true, then x P(x) is true and the loop terminates. they mean x (P(x) ∨ Q(x)).
• If the loop ends without finding an x for which P(x) is true, then x P(x) is
false.
Even if the domains are infinite, we can still think of the
quantifiers this fashion, but the loops will not terminate in some
cases.
Translating from English to Logic 1 Returning to the Socrates Example
Example 1: Translate the following sentence into Introduce the propositional functions Man(x) denoting
predicate logic: “Every student in this class has taken a “x is a man” and Mortal(x) denoting “x is mortal.”
course in Java.” Specify the domain as all people.
Solution: The two premises are: x ( Man ( x ) → Mortal ( x ) )
First decide on the domain U.
Man ( Socrates )
Solution 1: If U is all students in this class, define a propositional
function J(x) denoting “x has taken a course in Java” and
translate asx J(x).
The conclusion is: Mortal ( Socrates )
Solution 2: But if U is all people, also define a propositional
function S(x) denoting “x is a student in this class” and translate
asx (S(x)→ J(x)). Later we will show how to prove that the conclusion
x (S(x) ∧ J(x)) is not correct. What does it mean? follows from the premises.

Translating from English to Logic 2 Equivalences in Predicate Logic


Example 2: Translate the following sentence into Statements involving predicates and quantifiers
predicate logic: “Some student in this class has taken a are logically equivalent if and only if they have
course in Java.” the same truth value
Solution: • for every predicate substituted into these
First decide on the domain U. statements and
Solution 1: If U is all students in this class, translate as • for every domain of discourse used for the variables
in the expressions.
x J(x)
The notation S ≡T indicates that S and T are
Solution 2: But if U is all people, then translate as
x (S(x) ∧ J(x)) logically equivalent.
x (S(x)→ J(x)) is not correct. What does it mean? Example: x ¬¬S(x) ≡x S(x)
Thinking about Quantifiers as
Negating Quantified Expressions 2
Conjunctions and Disjunctions
If the domain is finite, a universally quantified proposition is Now Consider  x J(x)
equivalent to a conjunction of propositions without
quantifiers and an existentially quantified proposition is “There is a student in this class who has taken a course in
equivalent to a disjunction of propositions without quantifiers. Java.”

If U consists of the integers 1,2, and 3: Where J(x) is “x has taken a course in Java.”
Negating the original statement gives “It is not the
xP ( x )  P (1)  P ( 2 )  P ( 3)
case that there is a student in this class who has
xP ( x )  P (1)  P ( 2 )  P ( 3) taken Java.” This implies that “Every student in this
class has not taken Java”
Even if the domains are infinite, you can still think of the
quantifiers in this fashion, but the equivalent expressions Symbolically¬ x J(x) and x ¬ J(x) are equivalent
without quantifiers will be infinitely long.

Negating Quantified Expressions 1 De Morgan’s Laws for Quantifiers


Considerx J(x) The rules for negating quantifiers are:
“Every student in your class has taken a course in Java.” TABLE 2 De Morgan’s Laws for Quantifiers.
Negation Equivalent Statement When Is Negation True? When False?
Here J(x) is “x has taken a course in Java” and
xP ( x ) x P ( x )
For every x, P(x) is false. There is x for
which P(x) is true.
the domain is students in your class.
xP ( x ) xP ( x ) There is an x for which P
(x) is false.
P(x) is true for
every x.
Negating the original statement gives “It is not the case
that every student in your class has taken Java.” This The reasoning in the table shows that:
implies that “There is a student in your class who has not xP ( x )  xP ( x )
taken Java.”
xP ( x )  xP ( x )
Symbolically¬x J(x) and x¬ J(x) are equivalent
These are important. You will use these.
Some Fun with Translating from English
Translation from English to Logic
into Logical Expressions 2

Examples: U = {fleegles, snurds, thingamabobs}


1. “Some student in this class has visited Mexico.” F(x): x is a fleegle
Solution: Let M(x) denote “x has visited Mexico” and S(x) S(x): x is a snurd
denote “x is a student in this class,” and U be all people.
T(x): x is a thingamabob
X ( S ( X )  M ( X ) )

1. “Every student in this class has visited Canada or “Nothing is a snurd.”


Mexico.”
Solution: ¬x S(x) What is this equivalent to?
Solution: Add C(x) denoting “x has visited Canada.”
Solution: x¬S(x)
 X ( S ( X ) → ( M ( X )VC ( X ) ) )

Some Fun with Translating from English Some Fun with Translating from English
into Logical Expressions 1 into Logical Expressions 3

U = {fleegles, snurds, thingamabobs} U = {fleegles, snurds, thingamabobs}


F(x): x is a fleegle F(x): x is a fleegle
S(x): x is a snurd S(x): x is a snurd
T(x): x is a thingamabob T(x): x is a thingamabob
Translate “Everything is a fleegle” “All fleegles are snurds.”

Solution: x F(x) Solution:  X ( F ( X ) → S ( X ) )


Some Fun with Translating from English Charles Lutwidge
Lewis Carroll Example Dodgson (AKA Lewis
into Logical Expressions 4 Caroll) (1832-1898)

U = {fleegles, snurds, thingamabobs} The first two are called premises and the third is called the
conclusion.
F(x): x is a fleegle 1. “All lions are fierce.”
2. “Some lions do not drink coffee.”
S(x): x is a snurd
3. “Some fierce creatures do not drink coffee.”
T(x): x is a thingamabob Here is one way to translate these statements to predicate logic.
Let P(x), Q(x), and R(x) be the propositional functions “x is a lion,”
“Some fleegles are thingamabobs.” “x is fierce,” and “x drinks coffee,” respectively.
1.  X ( P ( X ) → Q ( X ) )
Solution: X ( F ( X )  T ( X ) ) 2. X ( P ( X )  R ( X ) )
3. X ( Q ( X )  R ( X ) )
Later we will see how to prove that the conclusion follows from
the premises

System Specification Example


Predicate logic is used for specifying properties that systems must satisfy.
For example, translate into predicate logic:
• “Every mail message larger than one megabyte will be compressed.”
• “If a user is active, at least one network link will be available.” Nested Quantifiers
Decide on predicates and domains (left implicit here) for the variables:
• Let L(m, y) be “Mail message m is larger than y megabytes.”
• Let C(m) denote “Mail message m will be compressed.” Section 1.4
• Let A(u) represent “User u is active.”
• Let S(n, x) represent “Network link n is state x.
Now we have: m ( L ( m,1) → C ( m ) )
u A ( u ) → n S ( n, available )
Section Summary 2 Thinking of Nested Quantification
Nested Quantifiers Nested Loops
• To see if xyP (x,y) is true, loop through the values of x :
Order of Quantifiers • At each step, loop through the values for y.
• If for some pair of x andy, P(x,y) is false, then x yP(x,y) is false and both
Translating from Nested Quantifiers into English the outer and inner loop terminate.
x y P(x,y) is true if the outer loop ends after stepping through each x.
Translating Mathematical Statements into • To see if x yP(x,y) is true, loop through the values of x:
• At each step, loop through the values for y.
Statements involving Nested Quantifiers.
• The inner loop ends when a pair x and y is found such that P(x, y) is true.
• If no y is found such that P(x, y) is true the outer loop terminates as x
Translated English Sentences into Logical yP(x,y) has been shown to be false.
Expressions. x y P(x,y) is true if the outer loop ends after stepping through each x.
If the domains of the variables are infinite, then this process can
Negating Nested Quantifiers. not actually be carried out.

Nested Quantifiers Order of Quantifiers


Nested quantifiers are often necessary to express the Examples:
meaning of sentences in English as well as important
concepts in computer science and mathematics. 1. Let P(x,y) be the statement “x + y = y + x.” Assume
that U is the real numbers. Then x yP(x,y) and
Example: “Every real number has an inverse” is y xP(x,y) have the same truth value.
x y(x + y = 0) 2. Let Q(x,y) be the statement “x + y = 0.” Assume that U
where the domains of x and y are the real numbers. is the real numbers. Then x yQ(x,y) is true, but
y xQ(x,y) is false.
We can also think of nested propositional functions:
x y(x + y = 0) can be viewed as x Q(x) where Q(x) is
y P(x, y) where P(x, y) is (x + y = 0)
Questions on Order of Quantifiers 1 Quantifications of Two Variables
Example 1: Let U be the real numbers,
Statement When True? When False
Define P(x,y) : x ∙ y = 0
xyP ( x, y ) P(x,y) is true for every There is a pair x, y for
What is the truth value of the following: pair x,y. which P(x,y) is false.
1.  x yP( x, y ) yxP ( x, y )

xyP ( x, y )
Answer:False 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.
2.  x yP( x, y )
xyP ( x, y )
There is an x for which For every x there is a y
Answer:True P(x,y) is true for every y. for which P(x,y) is false.
3.  x yP( x, y )
xyP ( x, y ) There is a pair x, y for P(x,y) is false for every
Answer:True which P(x,y) is true. pair x,y
yxP ( x, y )
4.  x yP ( x, y )
Answer:True

Translating Nested Quantifiers into


Questions on Order of Quantifiers 2
English
Example 2: Let U be the real numbers, Example 1: Translate the statement
Define P(x,y) : x / y = 1  x ( C ( X )  y ( C ( y )  F ( X , y ) ) )
What is the truth value of the following: where C(x) is “x has a computer,” and F(x,y) is “x and y are
1.  x yP( x, y ) friends,” and the domain for both x and y consists of all
Answer:False students in your school.
2.  x yP( x, y ) Solution: Every student in your school has a computer or has a
friend who has a computer.
Answer:False
Example 2: Translate the statement
3.  x yP( x, y )
Answer:False (
xyz ( F ( x, y )  F ( x, z )  ( y  z ) ) → F ( y , z ) )
4.  x yP ( x, y ) Solution: There is a student none of whose friends are also
Answer:True friends with each other.
Translating Mathematical Statements
Questions on Translation from English
into Predicate Logic
Example : Translate “The sum of two positive integers is always Choose the obvious predicates and express in predicate logic.
positive” into a logical expression. Example 1: “Brothers are siblings.”
Solution: Solution: x y (B(x,y) → S(x,y))

1. Rewrite the statement to make the implied quantifiers and domains Example 2: “Siblinghood is symmetric.”
explicit: Solution: x y (S(x,y) → S(y,x))
“For every two integers, if these integers are both positive, then the Example 3: “Everybody loves somebody.”
sum of these integers is positive.”
Solution: x y L(x,y)
2. Introduce the variables x and y, and specify the domain, to obtain:
“For all positive integers x and y, x + y is positive.” Example 4: “There is someone who is loved by everyone.”
Solution: y x L(x,y)
3. The result is:
Example 5: “There is someone who loves someone.”
xy ( ( x  0 )  ( y  0 ) ) → ( x + y  0 ) Solution: x y L(x,y)
Example 6: “Everyone loves himself”
where the domain of both variables consists of all integers
Solution: x L(x,x)

Translating English into Logical


Negating Nested Quantifiers
Expressions Example
Example 1: Recall the logical expression developed three slides back:
Example: Use quantifiers to express the statement waf ( P ( w, f )  Q ( f , a ) )
“There is a woman who has taken a flight on every airline Part 1: Use quantifiers to express the statement that “There does not exist a woman who has
taken a flight on every airline in the world.”
in the world.” Solution: waf ( P ( w, f )  Q ( f , a ) )
Part 2: Now use De Morgan’s Laws to move the negation as far inwards as possible.
Solution: Solution:a
1. waf ( P ( w, f )  Q ( f , a ) )
1. Let P(w,f) be “w has taken f ” and Q(f,a) be “f is a flight on
2. waf ( P ( w, f )  Q ( f , a ) ) by De Morgan’s for 
a .”
3. waf ( P ( w, f )  Q ( f , a ) ) by De Morgan’s for 
2. The domain of w is all women, the domain of f is all flights, 4. waf  ( P ( w, f )  Q ( f , a ) ) by De Morgan’s for 
and the domain of a is all airlines. 5. waf ( P ( w, f )  Q ( f , a ) ) by De Morgan’s for ∧.

3. Then the statement can be expressed as: Part 3: Can you translate the result back into English?
Solution:
waf ( P ( w, f )  Q ( f , a ) ) “For every woman there is an airline such that for all flights, this woman has not taken
that flight or that flight is not on this airline”
Some Questions about Quantifiers
(optional)
Can you switch the order of quantifiers?
• Is this a valid equivalence? xyP ( x, y )  yxP ( x, y )
Solution: Yes! The left and the right side will always have the same truth value. The
order in which x and y are picked does not matter.
• Is this a valid equivalence? xyP ( x, y )  yxP ( x, y )
Solution: No! The left and the right side may have different truth values for some
propositional functions for P. Try “x + y = 0” for P(x,y) with U being the integers. The
order in which the values of x and y are picked does matter.
Can you distribute quantifiers over logical connectives?
• Is this a valid equivalence? x ( P ( x )  Q ( x ) )  xP ( x )  xQ ( x )
Solution: Yes! The left and the right side will always have the same truth value no
matter what propositional functions are denoted by P(x) and Q(x).
• Is this a valid equivalence? x ( P ( x ) → Q ( x ) )  xP ( x ) → xQ ( x )
Solution: No! The left and the right side may have different truth values. Pick “x is a
fish” for P(x) and “x has scales” for Q(x) with the domain of discourse being all
animals. Then the left side is false, because there are some fish that do not have
scales. But the right side is true since not all animals are fish.

You might also like