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

SolutionsHuthRyanChapter2

The document contains solutions to selected exercises on predicate logic from 'Logic in Computer Science' by Huth and Ryan, covering various logical expressions and their formalizations. It includes exercises that translate natural language sentences into predicate logic using defined predicates and models, demonstrating concepts such as reflexivity, symmetry, and transitivity. Additionally, it discusses the entailment of formulas and provides examples of models that satisfy or do not satisfy specific logical statements.
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)
1 views

SolutionsHuthRyanChapter2

The document contains solutions to selected exercises on predicate logic from 'Logic in Computer Science' by Huth and Ryan, covering various logical expressions and their formalizations. It includes exercises that translate natural language sentences into predicate logic using defined predicates and models, demonstrating concepts such as reflexivity, symmetry, and transitivity. Additionally, it discusses the entailment of formulas and provides examples of models that satisfy or do not satisfy specific logical statements.
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/ 7

CSE 541 - Logic in Computer Science

Solutions for Selected problems on Predicate Logic

Exercises from Huth and Ryan, Logic in Computer Science, 2nd ed.
Exercise 2.1.3. We use the predicates,
InBox(x): x is in the box
Red(x): x is red
Animal(x): x is an animal
Cat(x): x is a cat
Dog(x): x is a dog
Boy(x): x is a boy
P rize(x): x is a prize
W on(x, y): x won y
to formalize the following sentences.
a. All red things are in the box.

∀x(Red(x) → InBox(x))

b. Only red things are in the box.

∀x(InBox(x) → Red(x))

c. No animal is both a cat and a dog.

¬∃x(Animal(x) ∧ (Cat(x) ∧ Dog(x)))

or ∀x(Animal(x) → (¬Cat(x) ∨ ¬Dog(x)))

d. Every prize was won by a boy.

∀x[P rize(x) → ∃y (Boy(y) ∧ W on(y, x))]

e. A boy won every prize.

∃y[Boy(y) ∧ ∀x (P rize(x) → W on(y, x))]

Exercise 2.1.4. Let F (x, y) mean that x is the father of y; M (x, y), that x
is the mother of y; H(x, y), that x is the husband of y; S(x, y), that x is the
sister of y; and B(x, y), that x is the brother of y. We use these predicate
symbols to translate the following sentences into predicate logic.
a. Everybody has a mother.

∀x∃yM (y, x)

b. Everybody has a father and a mother.

∀x[(∃yF (y, x)) ∧ (∃zM (z, x))]

or, equivalently,
∀x∃y∃z(F (y, x) ∧ M (z, x))

c. Whoever has a mother has a father.

∀x[(∃yM (y, x)) → (∃zF (z, x))]

d. Ed is a grandfather.

∃x∃y(F (Ed, y) ∧ (F (y, x) ∨ M (y, x)))

e. All fathers are parents.

∀x[∃yF (x, y) → ∃z(F (x, z) ∨ M (x, z))]

f. All husbands are spouses.

∀x[∃yH(x, y) → ∃z(H(x, z) ∨ H(z, x))]

Note that x is the wife of y means that y is the husband of x.

g. No uncle is an aunt.

According to Webster’s Collegiate Dictionary, an uncle is (i) the brother


of one’s father or mother or (ii) the husband of one’s aunt; where an
aunt is either the sister of one’s father or mother or else the wife of
one’s uncle.
Let α(x, y) be an abbreviation for the formula

∃z[B(x, z) ∧ (F (z, y) ∨ M (z, y))]∨


∃z∃w[H(x, z) ∧ S(z, w) ∧ (F (w, y) ∨ M (w, y))]

which expresses that x is an uncle of y; and let β(x, y) be an abbrevi-


ation for the formula
∃z[S(x, z) ∧ (F (z, y) ∨ M (z, y))]∨
∃z∃w[H(z, x) ∧ B(z, w) ∧ (F (w, y) ∨ M (w, y))]
which expresses that x is an aunt of y.
The given sentence can then be formulated as:

¬∃x∃y∃z[α(x, y) ∧ β(x, z)]

h. All brothers are siblings.


Siblings are individuals that have a common parent.

∀x∀y(B(x, y) ∧ B(y, x) → ∃z[(F (z, x) ∧ F (z, y)) ∨ (M (z, x) ∧ M (z, y))])

i. Nobody’s grandmother is anybody’s father.

¬∃x∃y[∃z[M (y, z) ∧ (M (z, x) ∨ F (z, x))] ∧ ∃wF (y, w)]

or, equivalently,

∀x∀y[(∃z(M (y, z) ∧ (M (z, x) ∨ F (z, x)))) → ¬∃wF (y, w)]

j. Ed and Patsy are husband and wife.

H(Ed, P atsy)

k. Carl is Monique’s brother-in-law.


A brother-in law is (i) the brother of one’s spouse, (ii) the husband of
one’s sister, or (iii) the husband of one’s spouse’s sister.

∃x∃y[(B(Carl, x) ∧ H(x, M onique))


∨(H(Carl, x) ∧ S(x, M onique))
∨(H(Carl, x) ∧ S(x, y) ∧ H(y, M onique))]

Exercise 2.4.1. Let φ be the formula ∀x∀yQ(g(x, y), g(y, y), z).
If M is a model with universe A, such that QM = A × A × A, then
M |=l φ, for every environment l (regardless of what function g M is).
On the other hand, if M0 is a model with universe A, such that QM is
the empty set, then M0 6|=l φ, for any environment l.
Exercise 2.4.2. Let φ be the sentence

∀x∃y∃z (P (x, y) ∧ P (z, y) ∧ (P (x, z) → P (z, x))).

The following models all have the set N of natural numbers as universe.
a. The model M with P M = {(m, n) | m < n} satisfies φ because for
every environment l and every natural number k,
M |=l[x7→k][y7→k+1][z7→k] P (x, y) ∧ P (z, y) ∧ (P (x, z) → P (z, x)).
0
b. The model M0 with P M = {(m, 2 ∗ m) | m ∈ N} satisfies φ because
for every environment l and every natural number k,
M0 |=l[x7→k][y7→2∗k][z7→k] P (x, y) ∧ P (z, y) ∧ (P (x, z) → P (z, x)).
00
c. The model M00 with P M = {(m, n) | m < n + 1} satisfies φ because
for every environment l and every natural number k,
M00 |=l[x7→k][y7→k][z7→k] P (x, y) ∧ P (z, y) ∧ (P (x, z) → P (z, x)).

Exercise 2.4.3. Let P be a predicate with two arguments.


If M is a model with universe A and for which P M is the empty set,
then M |= ∀x ¬P (x, x).
0
If M0 is a model with universe A and for which P M = A × A , then
M0 6|= ∀x ¬P (x, x).
Exercise 2.4.5. Let φ be the formula
∀x∀y∃z (R(x, y) → R(y, z)).
a. Let A be the set {a, b, c, d} and RM be {(b, c), (b, b), (b, a)}. We have
M 6|= φ, because for every environment l,
M 6|=l[x7→b][y7→c] ∃z(R(x, y) → R(y, z)).
(Note that there is no element e ∈ A, such that
M |=l[x7→b][y7→c][z7→e] R(y, z),
whereas
M |=l0 [x7→b][y7→c] R(x, y),
for every environment l0 .)
0
b. Let A0 be the set {a, b, c} and RM be {(b, c), (a, b), (c, b)}. We have
M0 |= φ, because for every environment l and all elements e and f in
A0 , there is an element g ∈ A, such that either
M0 6|=l[x7→e][y7→f ][z7→g] R(x, y)
or else
M0 |=l[x7→e][y7→f ][z7→g] R(y, z).
Exercise 2.4.6.
Consider the three sentences

φ1 = ∀x P (x, x)
φ2 = ∀x∀y (P (x, y) → P (y, x))
φ3 = ∀x∀y∀z (P (x, y) ∧ P (y, z) → P (x, z))

which express that the binary relation denoted by P is reflexive, symmetric,


and transitive, respectively.
Let M be a model with universe A and for which P M is the empty set.
Then M |= φ2 and M |= φ3 , but M 6|= φ1 .
Let M0 be a model with the set of natural numbers as universe and
0
for which P M is the less-than-or-equal-to relation. Then M0 |= φ1 and
M0 |= φ3 , but M0 6|= φ2 .
Let M00 be a model with universe A = {a, b, c} and for which
00
P M = {(a, a), (b, b), (c, c), (a, b), (b, a), (b, c), (c, b)}.

Then M00 |= φ1 and M00 |= φ2 , but M00 6|= φ3 .

Exercise 2.4.8. We prove that

∀x P (x) ∨ ∀x Q(x) |= ∀x (P (x) ∨ Q(x)).

Let M be a model with universe A such that

M |= ∀x P (x) ∨ ∀x Q(x).

We have to show that

M |= ∀x (P (x) ∨ Q(x)).

By the semantics of disjunction, we know that

M |= ∀x P (x)

or
M |= ∀x Q(x).
(i) We first consider the case that M |= ∀x P (x). By the semantics of
universal quantification, we know that

M |=l[x7→a] P (x)
for every environment l and all elements a ∈ A. But then we also have

M |=l[x7→a] P (x) ∨ Q(x)

for every environment l and all elements a ∈ A. This implies

M |= ∀x (P (x) ∨ Q(x)).

(ii) A similar argument can be applied if M |= ∀x Q(x).

Exercise 2.4.9. Let φ, ψ, and η be formulas of predicate logic that contain


no free variables.

a. Let ψ be the tautology P ∨ ¬P . Then φ |= ψ and ¬φ |= ψ, for any


formula φ. In other words, a formula ψ may be entailed both by φ
and the negation ¬φ.

b. Let φ be the atomic formula P , η be the atomic formula Q, and ψ be


the conjunction P ∧ Q. Then φ ∧ η |= ψ, but neither φ |= ψ nor η |= ψ.

c. Let φ be the atomic formula P , ψ also be P , and η be the formula


¬P . Then φ |= ψ, but φ ∨ η 6|= ψ.

d. Suppose φ → ψ is true in all models. By the semantics of implication


(and since φ and ψ are sentences) this means that, for every model
M, M |= ψ holds whenever M |= φ holds. Therefore, φ semantically
entails ψ.

Exercise 2.4.11.

a. Let M be a model where the domain is the set of natural numbers,


P M = {n ∈ N | n > 0}, and S M = {(m, n) ∈ N × N | m < n}.
Informally, P (x) means that x is positive, and S(x, y) means that x is
(strictly) less than y. The model M satisfies the formulas ∀x¬S(x, x),
∃xP (x), ∀x∃yS(x, y), and ∀x(P (x) → ∃yS(y, x)), which shows that
the set of these four formulas is consistent.

b. The model from the preceding part also satisfies the formula ∀x∀y∀z(S(x, y)∧
S(y, z) → S(x, z)), which expresses that S denotes a transitive binary
relation.
Exercise 2.4.12(h). The formula ∀x∀y ((P (x) → P (y)) ∧ (P (y) → P (x)))
is not a theorem. For instance, it is false in the model M with the set of
natural numbers as universe and for which P M is the relation {n | n is even}.
Exercise 2.4.12(i). The formula

(∀x((P (x) → Q(x)) ∧ (Q(x) → P (x)))) → ((∀x P (x)) → (∀x Q(x)))

is a theorem. [Proof omitted]


Exercise 2.4.12(j). The formula

((∀x P (x)) → (∀x Q(x))) → (∀x((P (x) → Q(x)) ∧ (Q(x) → P (x))))

is not a theorem. For example, it is false in the model M with the set of
natural numbers as universe and for which P M is the relation {n | n is even}
and QM is the relation {n | n is odd}.

You might also like