Professional Documents
Culture Documents
First–Order Logic
• variables
• connectives (∨, ∧, →, ↔, ¬ )
• function symbols
• relation symbols
• constant symbols
• equality (≈)
• quantifiers (∀, ∃)
(LMCS, p. 318) V.2
• If F is a formula, then so is (¬ F) .
(F ∨ G) , (F ∧ G) , (F → G) , (F ↔ G) .
Notational Conventions
the connectives.
An occurrence
of the variable x
bound by
A A E
x( ( rx y) ( y (( x ( r z x) ) ( r x z) ) )
free occurrences
A A E
x( ( rx y) ( y (( x ( r z x) ) ( r x z) ) )
bound occurrences
(LMCS, p. 322-323) V.9
Examples
b. 2 + 2 < 3 is also an atomic sentence,
which says “four is less than three.”
False in N.
True in N.
False in N.
(LMCS, p. 323-324) V.10
³ ´
f. ∀x (0 < x) → ∃y (y · y ≈ x) says that
“every positive number is a square.”
False in N.
µ ³ ´¶
h. ∀x∀y (x < y) → ∃z (x < z) ∧ (z < y)
says that “if one number is less than another,
then there is a number properly between the
two.”
False in N.
(LMCS, p. 323-324) V.11
F1 ∧ · · · ∧ F n .
F1 ∨ · · · ∨ F n .
(LMCS, p. 324-325) V.12
English to First-order
∃x F(x)
³ ´
∃x∃y ¬ (x ≈ y) ∧ F(x) ∧ F(y)
(LMCS, p. 324-325) V.13
³³V ´ ³V ´´
∃x1 · · · ∃xn 1≤i<j≤n ¬ (xi ≈ xj ) ∧ 1≤i≤n F(xi )
³ ´
∀x∃y (x < y) ∧ F(y)
³ ´
∀x∀y (F(x) ∧ F(y)) → (x ≈ y)
(LMCS, p. 325) V.14
Definable Relations
F is “true” at a k–tuple
(a1, . . . , ak ) of natural numbers
Example
Let F(x, y) be the formula x < y.
Example
Let F(x, y) be ∃z (x · z ≈ y).
a
[Note: Don’t confuse a|b with .
b
The first is true or false.
The second has a value.
Check that a|0 for any a, including a = 0.]
(LMCS, p. 325) V.16
Definition
Definition
r = FN .
(LMCS, p. 325-326) V.17
∃y (x ≈ y + y)
• x divides y is definable in N by
∃z (x · z ≈ y)
• x is prime is definable in N by
µ ³ ´¶
(1 < x) ∧ ∀y (y|x) → (y ≈ 1) ∨ (y ≈ x)
• x ≡ y modulo n is definable in N by
³ ´
∃z (x ≈ y + n · z) ∨ (y ≈ x + n · z)
(LMCS, p. 326) V.18
∃z ((u + 1) · z ≈ u · u + 1)
∃z (z · z ≈ 1 + 1)
∃w (x · w ≈ y),
³ ¡ ¢´
?
(1 < y + z) ∧ ∀v (v| (y + z)) → (v ≈ 1) ∨ (v ≈ y + z) .
Examples
[Expressing statements in first-order logic.]
³ ´¶
∃y∃z prime?(y) ∧ prime(z) ∧ (x ≈ y + z)
(LMCS, p. 329) V.26
Example
a. ∀x∃y (x < y)
b. ∀y∃x (x < y)
µ ³ ´¶
c. ∀x∀y (x < y) → ∃z (x < z) ∧ (z < y)
³ ´
d. ∀x∃y (0 < x) → (x ≈ y · y)
Then we have
N Z Q R
a. true true true true
b. false true true true
c. false false true true
d. false false false true
e. false false false false
Example
The subformulas of ∀x ((rxy) → ∃y (ryx))
are
First–Order to English
b
c
b a
a d
e d
c
Graph A Graph B
b. ∀x ¬ (rxx)
says “the (directed) graph is irreflexive.”
False for Graph A, true for Graph B.
³ ´
c. ∀x∀y (rxy) → (ryx)
says “the (directed) graph is symmetric.”
False for Graph A, true for Graph B.
(LMCS, p. 334-335) V.31
b
c
b a
a d
e d
c
Graph A Graph B
e. ∀x∀y (rxy)
says “all possible edges are present.”
False for both examples.
f. ∀x∃y (rxy)
says “for every vertex x there is an edge
going from x to some vertex y.”
True for both examples.
(LMCS, p. 335-336) V.32
English to First-Order
∃x∃y (¬ (x ≈ y)) .
³ ´
∀x∃y (rxy) ∨ (ryx) .
∃y (rxy)
³ ´
∃x∃y∃z ¬ (y ≈ z) ∧ (rxy) ∧ (rxz)
³ ´
∀x∃y∃z ¬ (y ≈ z) ∧ (rxy) ∧ (rxz)
(LMCS, p. 339) V.35
• F(~
x) is atomic:
F is t1(~
x ) ≈ t2(~
x) :
F is rt1(~
x) · · · tn(~
x)
• F is ¬G
• F is G∨H
• F is G∧H
• F is G→H
• F is G↔H
• F(~
x) is ∀y G(y, ~
x)
• F(~
x) is ∃y G(y, ~
x)
Example
r a b f
S = {a, b} a 0 1 a b
b 1 0 b a
FS =? Let
H1(x, y, z) = rf xf y
H2(x, y, z) = rf yf z
H(x, y, z) = H1(x, y, z) ∧ H2(x, y, z)
G(x, y) = ∃z H(x, y, z)
F(x) = ∀y G(x, y).
(LMCS, p. 340) V.40
Then
x y z fx fy fz H1(x, y, z) H2(x, y, z) H(x, y, z)
a a a b b b 0 0 0
a a b b b a 0 1 0
a b a b a b 1 1 1
a b b b a a 1 0 0
b a a a b b 1 0 0
b a b a b a 1 1 1
b b a a a b 0 1 0
b b b a a a 0 0 0
x y G(x, y) x F(x)
a a 0 a 0
a b 1 b 0
b a 1
b b 0
(LMCS, p. 341) V.41
r a b f
S = {a, b} a 0 1 a b
b 1 0 b a
G1(x, y, z) = rxf z
G2(x, y, z) = f y ≈ z
G(x, y, z) = G1(x, y, z) ∧ G2(x, y, z)
F1(x, y) = ∃z G(x, y, z)
F2(x, y) = f y ≈ f x
F(x, y) = F1(x, y) → F2(x, y).
(LMCS, p. 341) V.42
Then
x y z fx fy fz G1(x, y, z) G2(x, y, z) G(x, y, z)
a a a b b b 1 0 0
a a b b b a 0 1 0
a b a b a b 1 1 1
a b b b a a 0 0 0
b a a a b b 0 0 0
b a b a b a 1 1 1
b b a a a b 0 1 0
b b b a a a 1 0 0
• F is t 1 ≈ t2 and tS S
1 = t2 ;
• S |= F means F is true in S.
• Replace ≈ with 1.
Theorem
F has a one–element model iff Skel(F) is
satisfiable.
¬P ↔ P ∨ 1
Equivalent Sentences
S |= F iff S |= G.
∀x (¬ (x ≈ 0) → ∃y (x · y ≈ 1))
and
∀x∃y (¬ (x ≈ 0) → (x · y ≈ 1))
are equivalent.
Proposition
The sentences F and G are equivalent iff
F ↔ G is a valid sentence.
(LMCS, p. 344) V.50
Equivalent Formulas
¬ (x ≈ 0) → ∃y (x · y ≈ 1)
and
∃y (¬ (x ≈ 0) → (x · y ≈ 1))
are equivalent.
(LMCS, p. 345) V.51
Proposition
The formulas F(~
x) and G(~
x) are equivalent
iff ∀~
x(F(~
x) ↔ G(~
x)) is a valid sentence.
Proposition
The relation ∼ is an equivalence relation on
sentences as well as on formulas.
Fundamental Equivalences
¬ ∃x F ∼ ∀x (¬ F)
¬ ∀x F ∼ ∃x (¬ F)
(∀x F) ∨ G ∼ ∀x (F ∨ G) if x is not free in G
(∃x F) ∨ G ∼ ∃x (F ∨ G) if x is not free in G
(∀x F) ∧ G ∼ ∀x (F ∧ G) if x is not free in G
(∃x F) ∧ G ∼ ∃x (F ∧ G) if x is not free in G
(∀x F) → G ∼ ∃x (F → G) if x is not free in G
(∃x F) → G ∼ ∀x (F → G) if x is not free in G
F → (∀x G) ∼ ∀x (F → G) if x is not free in F
F → (∃x G) ∼ ∃x (F → G) if x is not free in F
∀x (F ∧ G) ∼ (∀x F) ∧ (∀x G)
∃x (F ∨ G) ∼ (∃x F) ∨ (∃x G)
(LMCS, p. 346) V.53
f is continuous at x:
negates to
f is not continuous at x:
Comment
If x occurs free in G then we cannot
conclude
(∀x F) ∨ G ∼ ∀x (F ∨ G),
for example,
(∀x F) → G ∼ ¬ (∀x F) ∨ G
∼ ∃x (¬ F) ∨ G
∼ ∃x (¬ F ∨ G)
∼ ∃x (F → G)
Example ¬ (P ∧ Q) ∼ ¬ P ∨ ¬ Q holds, so
we have, in first–order logic,
³ ´
¬ (∃x(x · x ≈ 1)) ∧ (∀x∀y(x · y ≈ y · x))
³ ´ ³ ´
∼ ¬ ∃x(x · x ≈ 1) ∨ ¬ ∀x∀y(x · y ≈ y · x)
(LMCS, p. 347) V.57
Lemma
Suppose F1 ∼ G1 and F2 ∼ G2. Then
¬ F1 ∼ ¬ G1
F1 ∨ F 2 ∼ G1 ∨ G 2
F1 ∧ F 2 ∼ G1 ∧ G2
F1 → F 2 ∼ G1 → G2
F1 ↔ F 2 ∼ G1 ↔ G2
∀x F1 ∼ ∀x G1
∃x F1 ∼ ∃x G1.
(LMCS, p. 347) V.58
Replacement Theorem
If F ∼ G then H(· · · F · · · ) ∼ H(· · · G · · · ) .
Example
Since
³ ´
¬ (∃x(x · x ≈ 1)) ∧ (∀x∀y(x · y ≈ y · x))
³ ´ ³ ´
∼ ¬ ∃x(x · x ≈ 1) ∨ ¬ ∀x∀y(x · y ≈ y · x)
we have
³ ´
(∀x∃y(x < y)) → ¬ (∃x(x · x ≈ 1)) ∧ (∀x∀y(x · y ≈ y · x))
³ ´ ³ ´
∼ (∀x∃y(x < y)) → ¬ ∃x(x · x ≈ 1) ∨ ¬ ∀x∀y(x · y ≈ y · x)
(LMCS, p. 348) V.59
If F is a conjugate of F, then F ∼ F.
Substitution Theorem
If
Prenex Form
Q 1 x1 · · · Q n xn G
The formula
³ ´
∃x (rxy) → ∀u (ruy)
Theorem
Every formula is equivalent to a formula in
prenex form.
Thus change
G↔H ∼ (¬ G ∨ H) ∧ (¬ H ∨ G)
G→H ∼ ¬G ∨ H
The above example becomes
¬ (F ∨ G) ∼ (¬ F ∧ ¬ G)
¬ (F ∧ G) ∼ (¬ F ∨ ¬ G)
G ∨ (∀x H) ∼ ∀x (G ∨ H)
G ∨ (∃x H) ∼ ∃x (G ∨ H)
G ∧ (∀x H) ∼ ∀x (G ∧ H)
G ∧ (∃x H) ∼ ∃x (G ∧ H)
(∀x G) ∨ H ∼ ∀x (G ∨ H)
(∃x G) ∨ H ∼ ∃x (G ∨ H)
(∀x G) ∧ H ∼ ∀x (G ∧ H)
(∃x G) ∧ H ∼ ∃x (G ∧ H)
¬ ∃x G ∼ ∀x ¬ G
¬ ∀x G ∼ ∃x ¬ G
(LMCS, p. 349-350) V.65
Valid Arguments
Proposition
An argument
F1 , · · · , F n ∴ F
F1 ∧ · · · ∧ F n → F
{F1, · · · Fn, ¬ F}
is not satisfiable.
(LMCS, p. 352) V.68
Example
The work in Chapter 3 concerned equations.
In first-order logic we treat equations as
universally quantified sentences:
x(s(~
∀~ x) ≈ t(~
x))
The argument
∀x∀y∀u∀v (x · y ≈ u · v)
∴ ∀x∀y∀z ((x · y) · z ≈ x · (y · z))
is valid.
∃y∀x (rxy)
The argument is valid.
∴ ∀x∃y (rxy)
S |= ϕ iff S ` ϕ.
• True of N
Counterexamples
∀x∃y (rxy)
The argument ∴ ∃y∀x (rxy) is not valid;
a two–element graph gives a counterexample:
a b
(LMCS, p. 353-354) V.75
Skolemization
Lemma
• Given the sentence ∃y G(y),
Proof
In each step we can expand a model of the
sentence on the left–hand side to one on the
right–hand side by adding the appropriately
designated element for the constant, or by
adding an appropriate function f .
Definition
A first–order formula F is universal if it is in
prenex form and all quantifiers are universal,
Example
∀x∀y∀z ((x
|
≤ y) ∧ (y ≤
{z
z) → (x ≤ z))}
matrix
(LMCS, p. 354) V.81
Theorem
Given a first–order sentence F, there is an
effective procedure for finding a universal
sentence F0 (usually in an extended
language) such that
Proof
First, we put F in prenex form. Then we
just apply the Lemma repeatedly until there
are no existential quantifiers.
(LMCS, p. 354) V.82
Example
To skolemize the sentence
Theorem
Given a set of first–order sentences S, there
is a set S 0 of universal sentences (usually in
an extended language) such that
Proof
We skolemize each sentence in S as before,
making sure that distinct sentences do not
have any common skolem constants or
functions.
(LMCS, p. 356) V.85
Example
We skolemize the set of sentences
C = {L1(~x), . . . , Lk (~x)}
in first-order logic.
(LMCS, p. 356) V.87
For indeed
S |= C iff S |= FC.
Lemma
One can effectively construct, for any given
universal sentence F, a finite set CF of
clauses such that for any structure S
S |= F iff S |= CF .
(LMCS, p. 356) V.88
Proof
Let F be ∀~
x G(~
x) with G(~
x)
quantifier–free. Put G(~
x) in conjunctive form
x G(~
∀~ x) ∼ ∀~
x (G1(~
x) ∧ · · · ∧ Gk (~
x))
∼ F1 ∧ · · · ∧ Fk
where Fi = ∀~
x Gi(~
x). Thus
S |= F iff S |= {F1, · · · , Fk }.
S |= F iff S |= CF
(LMCS, p. 356) V.89
Example
Let
rx → ry ∧ rz ∼ ¬ rx ∨ (ry ∧ rz)
∼ (¬ rx ∨ ry) ∧ (¬ rx ∨ rz).
S |= S iff S |= CS .
Thus
Lemma
Given a set S of first–order sentences, let
S 0 be a skolemization of S. Then
Example
For S = {∃x∀y (rxy), ¬ ∀y∃x (rxy)} we have
Theorem
Given S, a set of sentences, and F, a
sentence,
Example
³ ´
∀x∀y (rxy) → ¬ (ryx)
µ³ ´ ¶
∀x∀y∀z (rxy) ∧ (ryz) → (rxz)
(rab) ∧ (a ≈ b).
{¬ rxy, ¬ ryx}
{¬ rxy, ¬ ryz, rxz}
{rab}, {a ≈ b}
(LMCS, p. 360) V.95
Example
Consider the argument
∀x (x · 1 ≈ x)
∀x∃y (x · y ≈ 1)
³ ´
∀x∀y∀z (x · y) · z ≈ x · (y · z)
∴ ∀x (1 · x ≈ x).
The negation of the conclusion is the formula
∃x (¬ (1 · x ≈ x)).
(LMCS, p. 360) V.96
∀x (x · 1 ≈ x)
∀x (x · f x ≈ 1)
³ ´
∀x∀y∀z (x · y) · z ≈ x · (y · z)
¬ (1 · a ≈ a)
{x · 1 ≈ x}
{x · f x ≈ 1}
{(x · y) · z ≈ x · (y · z)}
{¬ (1 · a ≈ a)}
(LMCS, p. 360) V.97
We can convert
{x · 1 ≈ x} {(x · y) · z ≈ x · (y · z)}
{x · f x ≈ 1} {¬ (1 · a ≈ a)}
into a set of clauses without equality:
{x ≡ x}
{x 6 ≡ y, y ≡ x}
{x 6 ≡ y, y 6 ≡ z, x ≡ z}
{x 6 ≡ y, f x ≡ f y}
{x1 6 ≡ y1, x2 6 ≡ y2, x1 · x2 ≡ y1 · y2}
{x · 1 ≡ x}
{x · f x ≡ 1}
{(x · y) · z ≡ x · (y · z)}
{1 · a 6 ≡ a}
Now we are ready to apply resolution theorem
proving. (Go to Chapter 4!)