PREDICATE LOGIC
Schaum's outline chapter 4
Rosen chapter 1
September 11, 2018
ioc.pdf
margarita.spitsakova@ttu.ee ICY0001: Lecture 2 September 11, 2018 1 / 25
Contents
1 Predicates and quantiers
2 Logical equivalences for quantiers
3 Validity and satisability
4 Examples
ioc.pdf
margarita.spitsakova@ttu.ee ICY0001: Lecture 2 September 11, 2018 2 / 25
Next section
1 Predicates and quantiers
2 Logical equivalences for quantiers
3 Validity and satisability
4 Examples
ioc.pdf
margarita.spitsakova@ttu.ee ICY0001: Lecture 2 September 11, 2018 3 / 25
Motivation
Propositional logic cannot adequately express the meaning of all
statements in mathematics and in natural language.
Example
Having assumptions:
Every computer connected to the school network is functioning properly.
ELVIS is one of the computers connected to the school network.
No rules of propositional logic allow us to conclude the truth of the statement
ELVIS is functioning properly
Classical example
From the propositions
All men are mortal.
Socrates is a man.
we cannot derive that
Socrates is mortal.
ioc.pdf
margarita.spitsakova@ttu.ee ICY0001: Lecture 2 September 11, 2018 4 / 25
Motivation
Propositional logic cannot adequately express the meaning of all
statements in mathematics and in natural language.
Example
Having assumptions:
Every computer connected to the school network is functioning properly.
ELVIS is one of the computers connected to the school network.
No rules of propositional logic allow us to conclude the truth of the statement
ELVIS is functioning properly
Classical example
From the propositions
All men are mortal.
Socrates is a man.
we cannot derive that
Socrates is mortal.
ioc.pdf
margarita.spitsakova@ttu.ee ICY0001: Lecture 2 September 11, 2018 4 / 25
Predicate logic
Extends propositional logic by
Individuals a, b, ... , ELVIS, ...
(Individual) variables x, y , ...
Predicates (= propositional functions) P(x), Q(x), R(x, y ), ...
Quantiers ∀, ∃
A propositional function is a generalization of proposition:
its argument stands for en element from its domain;
its value is T or F depending on the property of its argument(s).
ioc.pdf
margarita.spitsakova@ttu.ee ICY0001: Lecture 2 September 11, 2018 5 / 25
Predicate logic
Extends propositional logic by
Individuals a, b, ... , ELVIS, ...
(Individual) variables x, y , ...
Predicates (= propositional functions) P(x), Q(x), R(x, y ), ...
Quantiers ∀, ∃
A propositional function is a generalization of proposition:
its argument stands for en element from its domain;
its value is T or F depending on the property of its argument(s).
ioc.pdf
margarita.spitsakova@ttu.ee ICY0001: Lecture 2 September 11, 2018 5 / 25
Propositional function
Formally,
for a given n ∈ {0, 1, . . .}, a predicate is a n-ary function (=a function with n arguments)
of type
P : D1 × . . . × Dn → {T , F }
U = D1 × . . . × Dn is the domain (or the universe) of the predicate P;
the statement P(x1 , . . . , xn ), becomes a proposition (representing a property of its
arguments) if either x1 ∈ D1 , . . . , xn ∈ Dn or all variables x1 , . . . , xn are bound by quantiers
(see next slides).
Example 1
Let P(x) denote x > 2 and U = Z. Then
P(5) is true;
P(2) is false.
Example 2
Let R(x, y , z) denote the statement x + y = z and U = Z. Then
R(1, 2, 3) is true;
R(0, 0, −5) is false. ioc.pdf
margarita.spitsakova@ttu.ee ICY0001: Lecture 2 September 11, 2018 6 / 25
Propositional function
Formally,
for a given n ∈ {0, 1, . . .}, a predicate is a n-ary function (=a function with n arguments)
of type
P : D1 × . . . × Dn → {T , F }
U = D1 × . . . × Dn is the domain (or the universe) of the predicate P;
the statement P(x1 , . . . , xn ), becomes a proposition (representing a property of its
arguments) if either x1 ∈ D1 , . . . , xn ∈ Dn or all variables x1 , . . . , xn are bound by quantiers
(see next slides).
Example 1
Let P(x) denote x > 2 and U = Z. Then
P(5) is true;
P(2) is false.
Example 2
Let R(x, y , z) denote the statement x + y = z and U = Z. Then
R(1, 2, 3) is true;
R(0, 0, −5) is false. ioc.pdf
margarita.spitsakova@ttu.ee ICY0001: Lecture 2 September 11, 2018 6 / 25
Propositional function
Formally,
for a given n ∈ {0, 1, . . .}, a predicate is a n-ary function (=a function with n arguments)
of type
P : D1 × . . . × Dn → {T , F }
U = D1 × . . . × Dn is the domain (or the universe) of the predicate P;
the statement P(x1 , . . . , xn ), becomes a proposition (representing a property of its
arguments) if either x1 ∈ D1 , . . . , xn ∈ Dn or all variables x1 , . . . , xn are bound by quantiers
(see next slides).
Example 1
Let P(x) denote x > 2 and U = Z. Then
P(5) is true;
P(2) is false.
Example 2
Let R(x, y , z) denote the statement x + y = z and U = Z. Then
R(1, 2, 3) is true;
R(0, 0, −5) is false. ioc.pdf
margarita.spitsakova@ttu.ee ICY0001: Lecture 2 September 11, 2018 6 / 25
Universal quantier
Let U is a given domain of discourse (= universe of discourse or simply domain).
Denition
The universal quantication of P(x) is the statement
P(x) for all values of x in the domain U .
The notation ∀xP(x) denotes the universal quantication of P(x). Here ∀ is called the universal
quantier. We read ∀xP(x) as for all x P(x) or for every x P(x). An element for which P(x)
is false is called a counterexample of ∀xP(x).
ioc.pdf
margarita.spitsakova@ttu.ee ICY0001: Lecture 2 September 11, 2018 7 / 25
Universal quantier
Let U is a given domain of discourse (= universe of discourse or simply domain).
Denition
The universal quantication of P(x) is the statement
P(x) for all values of x in the domain U .
The notation ∀xP(x) denotes the universal quantication of P(x). Here ∀ is called the universal
quantier. We read ∀xP(x) as for all x P(x) or for every x P(x). An element for which P(x)
is false is called a counterexample of ∀xP(x).
Examples
Let P(x) be the statement x + 1 > x and domain is Z. Then the quantication ∀xP(x)
is true.
Let Q(x) be the statement x < 2 and domain is Z. Then the quantication ∀xQ(x) is
false.
2
Let R(x) be the statement x > 0 and domain is R. Then the quantication ∀xR(x) is
false. A counterexample here is x = 0.
ioc.pdf
margarita.spitsakova@ttu.ee ICY0001: Lecture 2 September 11, 2018 7 / 25
Universal quantier
Let U is a given domain of discourse (= universe of discourse or simply domain).
Denition
The universal quantication of P(x) is the statement
P(x) for all values of x in the domain U .
The notation ∀xP(x) denotes the universal quantication of P(x). Here ∀ is called the universal
quantier. We read ∀xP(x) as for all x P(x) or for every x P(x). An element for which P(x)
is false is called a counterexample of ∀xP(x).
Aanother example
2
Let P(x) be the statement x > x and domain is R. Then the quantication ∀xP(x) is
1
false. A counterexample is x= 2
.
However, if domain is Z, then the quantication ∀xP(x) is true.
ioc.pdf
margarita.spitsakova@ttu.ee ICY0001: Lecture 2 September 11, 2018 7 / 25
Existential quantier
Denition
The existential quantication of P(x) is the statement
There exists an element x in the domain U such that P(x).
We use the notation notation ∃xP(x) for the existential quantication of P(x). Here ∃ is called
the existential quantier.
Remark: The meaning of ∃xP(x) changes when the domain changes. Without
specifying the domain, the statement ∃xP(x) has no meaning.
Examples
Let P(x) be the statement x > 3 and domain is R. Then the quantication ∃xP(x) is
true.
Let Q(x) be the statement x = x + 1 and domain is R. Then the quantication ∃xQ(x)
is false.
ioc.pdf
margarita.spitsakova@ttu.ee ICY0001: Lecture 2 September 11, 2018 8 / 25
Existential quantier
Denition
The existential quantication of P(x) is the statement
There exists an element x in the domain U such that P(x).
We use the notation notation ∃xP(x) for the existential quantication of P(x). Here ∃ is called
the existential quantier.
Remark: The meaning of ∃xP(x) changes when the domain changes. Without
specifying the domain, the statement ∃xP(x) has no meaning.
Examples
Let P(x) be the statement x > 3 and domain is R. Then the quantication ∃xP(x) is
true.
Let Q(x) be the statement x = x + 1 and domain is R. Then the quantication ∃xQ(x)
is false.
ioc.pdf
margarita.spitsakova@ttu.ee ICY0001: Lecture 2 September 11, 2018 8 / 25
Bound and free variables
The quantiers are said to bind the variable x in the expressions ∀xP(x) and ∃xP(x).
Variables in the scope of some quantier are called bound variables. All other variables in
the expression are called free variables.
A propositional function that does not contain any free variables is a proposition and has
a truth value.
ioc.pdf
margarita.spitsakova@ttu.ee ICY0001: Lecture 2 September 11, 2018 9 / 25
Bound and free variables
The quantiers are said to bind the variable x in the expressions ∀xP(x) and ∃xP(x).
Variables in the scope of some quantier are called bound variables. All other variables in
the expression are called free variables.
A propositional function that does not contain any free variables is a proposition and has
a truth value.
ioc.pdf
margarita.spitsakova@ttu.ee ICY0001: Lecture 2 September 11, 2018 9 / 25
Bound and free variables
The quantiers are said to bind the variable x in the expressions ∀xP(x) and ∃xP(x).
Variables in the scope of some quantier are called bound variables. All other variables in
the expression are called free variables.
A propositional function that does not contain any free variables is a proposition and has
a truth value.
Examples
In the statement ∃x(x + y = 1), the variable x is bound, but the variable y is free;
In the statement ∃x(P(x) ∧ Q(x)) ∨ ∀xR(x), all variables are bound
ioc.pdf
margarita.spitsakova@ttu.ee ICY0001: Lecture 2 September 11, 2018 9 / 25
Quantiers as conjunctions and/or disjunctions
If the domain is nite then universal/existential quantiers can be expressed by
conjunctions/disjunctions.
If the domain U = {1, 2, 3, 4}, then
I ∀xP(x) = P(1) ∧ P(2) ∧ P(3) ∧ P(4), and
I ∃xP(x) = P(1) ∨ P(2) ∨ P(3) ∨ P(4).
Even if the domains are innite, you can still think of the quantiers in this fashion, but
the equivalent expressions without quantiers will be innitely long.
ioc.pdf
margarita.spitsakova@ttu.ee ICY0001: Lecture 2 September 11, 2018 10 / 25
Quantiers as conjunctions and/or disjunctions
If the domain is nite then universal/existential quantiers can be expressed by
conjunctions/disjunctions.
If the domain U = {1, 2, 3, 4}, then
I ∀xP(x) = P(1) ∧ P(2) ∧ P(3) ∧ P(4), and
I ∃xP(x) = P(1) ∨ P(2) ∨ P(3) ∨ P(4).
Even if the domains are innite, you can still think of the quantiers in this fashion, but
the equivalent expressions without quantiers will be innitely long.
ioc.pdf
margarita.spitsakova@ttu.ee ICY0001: Lecture 2 September 11, 2018 10 / 25
Quantiers as conjunctions and/or disjunctions
If the domain is nite then universal/existential quantiers can be expressed by
conjunctions/disjunctions.
If the domain U = {1, 2, 3, 4}, then
I ∀xP(x) = P(1) ∧ P(2) ∧ P(3) ∧ P(4), and
I ∃xP(x) = P(1) ∨ P(2) ∨ P(3) ∨ P(4).
Even if the domains are innite, you can still think of the quantiers in this fashion, but
the equivalent expressions without quantiers will be innitely long.
Example
Let P(x) be the statement x
2
< 10. Then it is true for the domain U1 = {1, 2, 3}, but it is
false for the domain U2 = {1, 2, 3, 4}.
ioc.pdf
margarita.spitsakova@ttu.ee ICY0001: Lecture 2 September 11, 2018 10 / 25
Examples of nested quantiers
Statements with complex semantics require nested quantiers.
Example 1
Statement: Every real number has an inverse w.r.t. addition
Domain U = R. The property is expressed by
∀x∃y (x + y = 0)
ioc.pdf
margarita.spitsakova@ttu.ee ICY0001: Lecture 2 September 11, 2018 11 / 25
Examples of nested quantiers
Statements with complex semantics require nested quantiers.
Example 1
Statement: Every real number has an inverse w.r.t. addition
Domain U = R. The property is expressed by
∀x∃y (x + y = 0)
Example 2
Statement: Every real number except zero has a multiplicative inverse.
Domain U = R. The property is expressed by
∀x(x 6= 0 → ∃y (xy = 1))
ioc.pdf
margarita.spitsakova@ttu.ee ICY0001: Lecture 2 September 11, 2018 11 / 25
Notation: quantiers with restricted domains
An abbreviated notation is often used to restrict the domain of a quantier.
∀x < 0.(x 2 > 0) is another way of expressing ∀x(x < 0 → x 2 > 0).
√ √
∀x ∈ A.(0 < x 6 5) is another way of expressing ∀x(x ∈ A → (0 < x) ∧ (x 6 5)).
2 2
∃z > 0.(z = 2) is another way of expressing ∃z(z > 0 ∧ z = 2).
ioc.pdf
margarita.spitsakova@ttu.ee ICY0001: Lecture 2 September 11, 2018 12 / 25
Precedence of quantiers
The quantiers ∀ and ∃ have higher precedence than all logical operators
from propositional calculus
For example
∀xP(x) ∨ Q(x) means (∀xP(x)) ∨ Q(x) rather than ∀x(P(x) ∨ Q(x)).
ioc.pdf
margarita.spitsakova@ttu.ee ICY0001: Lecture 2 September 11, 2018 13 / 25
Next section
1 Predicates and quantiers
2 Logical equivalences for quantiers
3 Validity and satisability
4 Examples
ioc.pdf
margarita.spitsakova@ttu.ee ICY0001: Lecture 2 September 11, 2018 14 / 25
Equivalences
Statements involving predicates and quantiers are logically equivalent
if and only if they have the same truth value no matter which
predicates are substituted into these statements and which domain of
discourse is used for the variables in these propositional functions.
We use the notation S ≡ T to indicate that two statements S and T
involving predicates and quantiers are logically equivalent.
Examples
∀x.¬¬S(x) ≡ ∀x.S(x)
∀x.(P(x) ∧ Q(x)) ≡ ∀x.P(x) ∧ ∀x.Q(x)
∀x.∀y .P(x, y ) ≡ ∀y .∀x.P(x, y )
∀x.∃y .P(x, y ) 6≡ ∃y .∀x.P(x, y )
ioc.pdf
margarita.spitsakova@ttu.ee ICY0001: Lecture 2 September 11, 2018 15 / 25
Equivalences
Statements involving predicates and quantiers are logically equivalent
if and only if they have the same truth value no matter which
predicates are substituted into these statements and which domain of
discourse is used for the variables in these propositional functions.
We use the notation S ≡ T to indicate that two statements S and T
involving predicates and quantiers are logically equivalent.
Examples
∀x.¬¬S(x) ≡ ∀x.S(x)
∀x.(P(x) ∧ Q(x)) ≡ ∀x.P(x) ∧ ∀x.Q(x)
∀x.∀y .P(x, y ) ≡ ∀y .∀x.P(x, y )
∀x.∃y .P(x, y ) 6≡ ∃y .∀x.P(x, y )
ioc.pdf
margarita.spitsakova@ttu.ee ICY0001: Lecture 2 September 11, 2018 15 / 25
Equivalences
Statements involving predicates and quantiers are logically equivalent
if and only if they have the same truth value no matter which
predicates are substituted into these statements and which domain of
discourse is used for the variables in these propositional functions.
We use the notation S ≡ T to indicate that two statements S and T
involving predicates and quantiers are logically equivalent.
Examples
∀x.¬¬S(x) ≡ ∀x.S(x)
∀x.(P(x) ∧ Q(x)) ≡ ∀x.P(x) ∧ ∀x.Q(x)
∀x.∀y .P(x, y ) ≡ ∀y .∀x.P(x, y )
∀x.∃y .P(x, y ) 6≡ ∃y .∀x.P(x, y )
ioc.pdf
margarita.spitsakova@ttu.ee ICY0001: Lecture 2 September 11, 2018 15 / 25
Equivalences
Statements involving predicates and quantiers are logically equivalent
if and only if they have the same truth value no matter which
predicates are substituted into these statements and which domain of
discourse is used for the variables in these propositional functions.
We use the notation S ≡ T to indicate that two statements S and T
involving predicates and quantiers are logically equivalent.
Examples
∀x.¬¬S(x) ≡ ∀x.S(x)
∀x.(P(x) ∧ Q(x)) ≡ ∀x.P(x) ∧ ∀x.Q(x)
∀x.∀y .P(x, y ) ≡ ∀y .∀x.P(x, y )
∀x.∃y .P(x, y ) 6≡ ∃y .∀x.P(x, y )
ioc.pdf
margarita.spitsakova@ttu.ee ICY0001: Lecture 2 September 11, 2018 15 / 25
Equivalences
Statements involving predicates and quantiers are logically equivalent
if and only if they have the same truth value no matter which
predicates are substituted into these statements and which domain of
discourse is used for the variables in these propositional functions.
We use the notation S ≡ T to indicate that two statements S and T
involving predicates and quantiers are logically equivalent.
Examples
∀x.¬¬S(x) ≡ ∀x.S(x)
∀x.(P(x) ∧ Q(x)) ≡ ∀x.P(x) ∧ ∀x.Q(x)
∀x.∀y .P(x, y ) ≡ ∀y .∀x.P(x, y )
∀x.∃y .P(x, y ) 6≡ ∃y .∀x.P(x, y )
ioc.pdf
margarita.spitsakova@ttu.ee ICY0001: Lecture 2 September 11, 2018 15 / 25
Quantications of two variables.
Example where ∀x.∃y .P(x, y ) 6≡ ∃y .∀x.P(x, y )
Let P(x, y ) denote x + y = 0 , where the domain for all variables consists of all real numbers.
∃y .∀x.P(x, y ) means the proposition
There is a real number y such that for every real number x , x + y = 0.
Actually, no matter what value of y is chosen, there is only one value of x for which
x + y = 0. Hence, the proposition ∃y .∀x.P(x, y ) false.
∀x.∃y .P(x, y ) means the proposition
For every real number x there is a real number y such that x + y = 0.
In fact, given a real number x, there is a real number y such that x + y = 0; namely,
y = −x . Hence, the statement is true.
ioc.pdf
margarita.spitsakova@ttu.ee ICY0001: Lecture 2 September 11, 2018 16 / 25
Quantications of two variables.
The meanings of the dierent possible quantications involving two
variables.
ioc.pdf
margarita.spitsakova@ttu.ee ICY0001: Lecture 2 September 11, 2018 16 / 25
De Morgan's law for quantiers
The rules for negating quantiers are:
¬(∀x.P(x)) ≡ ∃x.¬P(x)
¬(∃x.P(x)) ≡ ∀x.¬P(x)
ioc.pdf
margarita.spitsakova@ttu.ee ICY0001: Lecture 2 September 11, 2018 17 / 25
Next section
1 Predicates and quantiers
2 Logical equivalences for quantiers
3 Validity and satisability
4 Examples
ioc.pdf
margarita.spitsakova@ttu.ee ICY0001: Lecture 2 September 11, 2018 18 / 25
Validity
An assertion in predicate calculus is logically valid (or simply valid) if it is true in every
interpretation, that is i it is true
for all domains
for every propositional functions substituted for the predicates in the assertion
Valid assertions in predicate logic play a role similar to tautologies in propositional logic.
Example
∀x.(P(x) ∨ ¬P(x))
ioc.pdf
margarita.spitsakova@ttu.ee ICY0001: Lecture 2 September 11, 2018 19 / 25
Validity
An assertion in predicate calculus is logically valid (or simply valid) if it is true in every
interpretation, that is i it is true
for all domains
for every propositional functions substituted for the predicates in the assertion
Valid assertions in predicate logic play a role similar to tautologies in propositional logic.
Example
∀x.(P(x) ∨ ¬P(x))
ioc.pdf
margarita.spitsakova@ttu.ee ICY0001: Lecture 2 September 11, 2018 19 / 25
Satisability
An assertion in predicate calculus is satisable i it is true
for some domain
for some propositional functions that can be substituted for the predicates in the assertion
Valid assertions in predicate logic play a role similar to tautologies in propositional logic.
Examples
∀x.∃y .P(x, y ) is satisable
The domain N, and the propositional function 6 satisfy this assertion.
∀x.(P(x) ∧ ¬P(x)) is unsatisable
ioc.pdf
margarita.spitsakova@ttu.ee ICY0001: Lecture 2 September 11, 2018 20 / 25
Satisability
An assertion in predicate calculus is satisable i it is true
for some domain
for some propositional functions that can be substituted for the predicates in the assertion
Valid assertions in predicate logic play a role similar to tautologies in propositional logic.
Examples
∀x.∃y .P(x, y ) is satisable
The domain N, and the propositional function 6 satisfy this assertion.
∀x.(P(x) ∧ ¬P(x)) is unsatisable
ioc.pdf
margarita.spitsakova@ttu.ee ICY0001: Lecture 2 September 11, 2018 20 / 25
Next section
1 Predicates and quantiers
2 Logical equivalences for quantiers
3 Validity and satisability
4 Examples
ioc.pdf
margarita.spitsakova@ttu.ee ICY0001: Lecture 2 September 11, 2018 21 / 25
√
Example 1: If x is irrational then so is x
Let Irrational(x) denote the propositional function x is irrational, and
Rational(x) = ¬Irrational(x)
Proposition
√
∀x ∈ R+ . Irrational(x) → Irrational( x)
Proof. Let x be positive real number. We will show the contrapositive, i.e.
√
∀x ∈ R+ . Rational( x) → Rational(x)
√
In other words we prove that if x is rational then so is x.
√
Assume that x is a rational number. Then, by denition, there must exists
√
two natural numbers m and n such that x = m/n. But then x = m2 /n2 and,
2 2
since m and n are natural numbers, which by denition implies that x is a
rational number as required.
ioc.pdf
margarita.spitsakova@ttu.ee ICY0001: Lecture 2 September 11, 2018 22 / 25
Example 2: n is even i n2 is even
Let Even(x) denote the propositional function x is even, and Odd(x) = ¬Even(x)
Proposition
∀n ∈ Z. Even(n) ↔ Even(n2 )
Proof. Let n∈Z
Necessity. Let's assume that n is even, i.e. there exists an integer k such that
n = 2k . Then n2 = (2k)2 = 4k 2 = 2(2k 2 ), and thus for ` = 2k 2 , n2 = 2` and so
is even.
Suciency. We will show the contrapositive,i.e. Odd(n) → Odd(n 2
). Let's
assume that n is odd, i.e. there exists an integer k such that n = 2k + 1. Then
n2 = (2k + 1)2 = 2(2k 2 + 2k) + 1,and thus for ` = 2k 2 + k, n2 = 2` + 1 and so is
odd.
ioc.pdf
margarita.spitsakova@ttu.ee ICY0001: Lecture 2 September 11, 2018 23 / 25
Example 3: 4k = i 2 − j 2
Proposition
∀k ∈ N. ∃i ∈ N. ∃j ∈ N. 4k = i 2 − j 2
Proof. Let k ∈ N. Let i = k +1 and j = k − 1.
i 2 − j 2 = (k + 1)2 − (k − 1)2 = k 2 + 2k + 1 − k 2 + 2k − 1 = 4k.
ioc.pdf
margarita.spitsakova@ttu.ee ICY0001: Lecture 2 September 11, 2018 24 / 25
Example 4: Either n2 ≡ 0 (mod 4) or n2 ≡ 1 (mod 4)
Remark: Formula a ≡ b (mod 4) stands for the proposition b is the remainder after
division of a by 4.
Proposition
∀n ∈ Z. n2 ≡ 0 (mod 4) ∨ n2 ≡ 1 (mod 4)
Proof. Let n ∈ Z. n is either even or odd. We consider each case separately.
(1). Assume n is even. Then there exists m such that n = 2m. But then
n2 = 4m2 ≡ 0 (mod 4).
(2). Assume n is odd. Then there exists m such that n = 2m + 1. But then
n2 = 4m2 + 4m + 1 = 4(m2 + m) + 1 ≡ 1 (mod 4).
ioc.pdf
margarita.spitsakova@ttu.ee ICY0001: Lecture 2 September 11, 2018 25 / 25