6.
825 Exercise Solutions: Week 3
Solutions
September 27, 2004
Converting to CNF
Convert the following sentences to conjunctive normal form.
1. (A → B) → C
Answer:
¬(¬A ∨ B) ∨ C
(A ∧ ¬B) ∨ C
(A ∨ C) ∧ (¬B ∨ C)
2. A → (B → C)
Answer:
¬A ∨ ¬B ∨ C
3. (A → B) ∨ (B → A)
Answer:
(¬A ∨ B) ∨ (¬B ∨ A)
T rue
4. (¬P → (P → Q))
Answer:
¬¬P ∨ (¬P ∨ Q)
P ∨ ¬P ∨ Q
T rue
5. (P → (Q → R)) → (P → (R → Q))
Answer:
¬(¬P ∨ ¬Q ∨ R) ∨ (¬P ∨ ¬R ∨ Q)
(P ∧ Q ∧ ¬R) ∨ (¬P ∨ ¬R ∨ Q)
(P ∨ ¬P ∨ ¬R ∨ Q) ∧ (Q ∨ ¬P ∨ ¬R ∨ Q) ∧ (¬R ∨ ¬P ∨ ¬R ∨ Q)
¬P ∨ Q ∨ ¬R
6. (P → Q) → ((Q → R) → (P → R))
Answer:
¬(¬P ∨ Q) ∨ (¬(¬Q ∨ R) ∨ (¬P ∨ R))
(P ∧ ¬Q) ∨ ((Q ∧ ¬R) ∨ (¬P ∨ R))
(P ∧ ¬Q) ∨ ((Q ∨ ¬P ∨ R) ∧ (¬R ∨ ¬P ∨ R))
(P ∧ ¬Q) ∨ Q ∨ ¬P ∨ R
(P ∨ ¬P ∨ Q ∨ R) ∧ (¬P ∨ Q ∨ ¬Q ∨ R)
T rue
1
First Order Logic Sentences
For each of the following English sentences, write a corresponding sentence in FOL.
1. The only good extraterrestrial is a drunk extraterrestrial.
∀[Link] (x) ∧ Good(x) → Drunk(x)
2. The Barber of Seville shaves all men who do not shave themselves.
∀x.¬Shaves(x, x) → Shaves(BarberOf Seville, x)
3. There are at least two mountains in England.
∃x, y.M ountain(x) ∧ M ountain(y) ∧ InEngland(x) ∧ InEngland(y) ∧ x 6= y
4. There is exactly one coin in the box.
∃[Link](x) ∧ InBox(x) ∧ ∀y.(Coin(y) ∧ InBox(y) → x = y)
5. There are exactly two coins in the box.
∃x, [Link](x) ∧ InBox(x) ∧ Coin(y) ∧ InBox(y) ∧ x 6= y ∧ ∀z.(Coin(z) ∧ InBox(z) → (x = z ∨ y = z))
6. The largest coin in the box is a quarter.
∃[Link](x) ∧ InBox(x) ∧ Quarter(x) ∧ ∀y.(Coin(y) ∧ InBox(y) ∧ ¬Quarter(y) → Smaller(y, x))
7. No mountain is higher than itself.
∀x.M ountain(x) → ¬Higher(x, x)
8. All students get good grades if they study.
∀[Link](x) ∧ Study(x) → GetGoodGrade(x)
FOL Interpretations, Part 1
For each group of sentences, write an interpretation under which the last sentence is false and all the rest are
true.
1. ∀x.h(x) → g(x)
∀x.f (x) → g(x)
∃x.f (x) ∧ h(x)
An interpretation that makes the first two sentences true and the third false:
U = {A, B}
I(f ) = {A}
I(g) = {A, B}
I(h) = {B}
2. ∀x.∃y.f (x, y)
∃y.∀x.f (x, y)
An interpretation that makes the first sentence true and the second sentence false:
U = {A, B, C}
I(f ) = {< A, B >, < B, C >, < C, A >}
3. ∀x.(f (x) → g(A))
(∀x.f (x)) → g(A)
There is no interpretation that makes the first sentence true and the second sentence false.
Reason: For the second sentence to be false, ∀x.f (x) has to be true, and g(A) has to be false. With these
two requirements, we can see that the first sentence cannot be true because f (x) is true for ∀x, and g(A)
is false.
2
However, if we replace ∀x with ∃x,
∃x.(f (x) → g(A))
(∃x.f (x)) → g(A)
Then the following interpretation makes the first sentence true and the second sentence false.
U = {A, B}
f = {B}
g = {B}
FOL Interpretations, Part 2
For each group of sentences, give an interpretation in which all sentences are true.
1. (∀x.p(x) ∨ q(x)) → ∃x.r(x)
∀x.r(x) → q(x)
∃x.p(x) ∧ ¬q(x)
Interpretation:
U = {A, B}
I(p) = {A}
I(q) = {B}
I(r) = {B}
2. ∀x.¬f (x, x)
∀x, y, z.f (x, y) ∧ f (y, z) → f (x, z)
∀x.∃y.f (x, y)
There is no interpretation in a finite universe that makes all of these sentences true. However, if you
consider an infinite universe, (e.g., real numbers) and a greater than function (>), these sentences are all
true.
Interpretation:
U =R
I(f ) = >
3. ∀x.∃y.f (x, y)
∀x.(g(x) → ∃y.f (y, x))
∃x.g(x)
∀x.¬f (x, x)
Interpretation:
U = {A, B}
I(f ) = {< A, B >, < B, A >}
I(g) = {A}
3
FOL Semantics
(6) Consider a world with objects A, B, and C. We’ll look at a logical languge with constant symbols X, Y ,
and Z, function symbols f and g, and predicate symbols p, q, and r. Consider the following interpretation:
• I(X) = A, I(Y ) = A, I(Z) = B
• I(f ) = {hA, Bi, hB, Ci, hC, Ci}
• I(p) = {A, B}
• I(q) = {C}
• I(r) = {hB, Ai, hC, Bi, hC, Ci}
For each of the following sentences, say whether it is true or false in the given interpretation I:
1. q(f (Z))
Answer: T
2. r(X, Y )
Answer: F
3. ∃w.f (w) = Y
Answer: F
4. ∀w.r(f (w), w)
Answer: T
5. ∀u, v.r(u, v) → (∀w.r(u, w) → v = w)
Answer: F
6. ∀u, v.r(u, v) → (∀w.r(w, v) → u = w)
Answer: T
Clausal form
(6) Convert each sentence below to clausal form.
1. ∀y.∃x.r(x, y) ∨ s(x, y)
Answer: r(f (y), y) ∨ s(f (y), y)
2. ∀y.(∃x.r(x, y)) → p(y)
Answer: ¬r(x, y) ∨ p(y)
3. ∀y.∃x.(r(x, y) → p(x))
AnsweR: ¬r(f (y), y) ∨ p(f (y))
Implication vs. Entailment
Show that P |= Q ↔ (T rue |= P → Q).
Let M (P ) and M (Q) be the sets of interpretations (models) under which P and Q are true, respectively.
1. Assume P |= Q. By the definition of entailment, we have M (P ) ⊆ M (Q). Because M (Q) and M (¬Q) are
disjoint (there are no interpretations under which both Q and ¬Q are true), it follows that M (P )∩M (¬Q) =
. Therefore there are no interpretations under which P is true and Q is false, and so P → Q is true under
all interpretations: M (P → Q) = M (T rue) and consequently M (T rue) ⊆ M (P → Q). By the definition
of entailment, this means that T rue |= P → Q, and so we have shown that P |= Q → (T rue |= P → Q).
2. Assume T rue |= P → Q. By the definition of entailment, this means that P → Q is true under all
models, and so there can be no model such that P is true and Q is false: M (P ) ∩ M (¬Q) = . Therefore
M (P ) ⊆ M (Q) and we can conclude that P |= Q. Thus we have shown that (T rue |= P → Q) → P |= Q.
(1) and (2) together prove the statement P |= Q ↔ (T rue |= P → Q).