CS 228 Tut5 Sol
CS 228 Tut5 Sol
CS 228 Tut5 Sol
Problem Sheet 5
S. Krishna
1. Consider the formula φ = ∀x∃yR(x, y) ∧ ∃y∀x¬R(x, y). Show that φ is satisfiable over a
structure whose universe is infinite and countable.
Solution
Let N be the structure having as universe the set N of natural numbers and which
interprets R(x, y) as the successor relation, i.e, R(x, y) = {(n, n + 1) | n ∈ N}.
Observe that N |= φ, because every x ∈ N has a successor in N, making ∀x∃yR(x, y)
true. But 1 ∈ N is not the predecessor of any number in Na , making ∃y∀x¬R(x, y) true.
Solution
(a) Assuming a brother is a distinct non-female who shares a parent in common with
you, we have:
(b) Assuming an aunt is a female who shares a parent in common with a parent of
yours, we have:
(c) Assuming cousins are distinct people who have distinct parents who have a parent
1
in common, we can write:
(d) Assuming an only child is a person whose parents have no other children, we
have:
φO (x) = ∀y∀z[P (z, x) ∧ P (z, y) =⇒ x = y]
(e) Since the only relationships modeled here are parent-child relationships and
whether a person is female, a relationship such as marriage, i.e., φM (x, y), that
says x is married to y cannot be defined.
3. Consider the signature τ that has the binary functions +, ×. Let N be the structure over τ
having as universe the set N of natural numbers and which interprets +, × in the usual way.
Construct FO formulae Zero(x), One(x), Even(x), Odd(x) and Prime(x) using τ such that
Goldbach’s conjecture says that every even integer greater than 2 is the sum of two primes.
Whether or not this is true is an open question in number theory. State Goldbach’s conjecture
as a FO-sentence over τ .
Solution
• Zero(a) = ∀x (a + x) = x
• One(a) = ∀x (a × x) = a
• Even(a) = ∃x (x + x) = a
• Odd(a) = ¬Even(a)
We can also define a FO formula Two(a) such that for any a ∈ N, N |= Two(a) iff a is
two, as Two(a) = ∃x (One(x) ∧ (x + x) = a).
Using the above formulae, we can state Goldbach’s conjecture as:
2
4. A group is a structure (G, +, 0) where G is a set, 0 ∈ G is a special element called the identity
and + : G × G → G is a binary operation such that
Using a signature τ = (c, op) where c is a constant and op is a binary function symbol write
(a)-(d) in FO.
Solution
We write the following formulae for each one of the above specifications:
(b) φb = ∀x (op(x, c) = x)
5. Let τ be a signature consisting of the binary function symbol + and a constant 0. We denote
by x + y the function +(x, y). Consider the following sentences:
φ2 := ∀x [(x + 0) = x ∧ (0 + x) = x]
φ3 := ∀x [∃y (x + y = 0) ∧ ∃z(z + x) = 0]
Let ψ be the conjunction of the three sentences.
Solution
(a) A structure A that satisfies ψ can be one with u(A) = Z, 0A = 0 and +A = +Z .
(b) A structure that does not satisfy ψ can be one where u(A) = Z, 0A = 0 and
+A (x, y) = 2x + 3y. You can in fact verify that none of φ1 , φ2 , and φ3 are
3
satisfied.
(c) An example of a structure A that does not satisfy ψ ⇒ α is one where u(A) =
{M ∈ Rn×n : |M | = ̸ 0} (the set of invertible real-valued n × n matrices), 0A = In ,
and +A (A, B) = AB. It can be verified that this structure satisfies ψ but not α
(i.e., it is not commutative).
6. Explain the difference between the first order prefixes ∃x∀y∃z and ∀x∃y∀z.
Solution
The first one states that there exists some x in the universe such that for every y in
the universe there is some z in the universe (which may depend on y) such that the
statement holds.
The second one states that for every x in the universe, there is some y in the universe
(which may depend on x) such that for every z in the universe the statement holds.
The difference between the two is illustrated with an example in the following question.
7. Show that the sentences ∀x∃y∀z (E(x, y) ∧ E(x, z) ∧ E(y, z)) and ∃x∀y∃z (E(x, y) ∧ E(x, z) ∧
E(y, z)) are not equivalent by exhibiting a graph which satisfies one but not both of the
sentences.
Solution
The first sentence is actually satisfied only by the complete graph Kn , where EA =
u(A) × u(A). To see this, assume there is some (a, b) ∈ / EA . If ∀x∃y∀z [E(x, y) ∧
E(x, z) ∧ E(y, z)], then we can choose x = a, and then, for any y that we choose,
choosing z = b will cause E(x, y) ∧ E(x, z) ∧ E(y, z) to not be satisfied, since E(a, b) is
not satisfied. This structure will also clearly satisfy the second sentence.
For an example of a structure that satisfies the second sentence but not the first,
consider the following graph:
4
1
2 3
u(A) = {1, 2, 3, 4}, EA = {(1, 1), (1, 2), (1, 3), (1, 4), (2, 4), (3, 4), (4, 4)}
8. For each n ∈ N, ∃≥n denotes a counting quantifier. Intuitively, ∃≥n means that “there exist
atleast n such that”. FO with counting quantifiers is the logic obtained by adding these
quantifiers (for each n ∈ N) to the fixed symbols of FO. The syntax and semantics are as
follows:
Syntax : For any formula φ of FO with counting quantifiers, ∃≥n x φ is also a formula.
(a) Using counting quantifiers, define a sentence φ45 such that A |= φ45 iff |u(A)| = 45.
(b) Define a FO sentence φ (not using counting quantifiers) that is equivalent to the sentence
∃≥n x (x = x).
Solution
(a)
∃≥k x(x = x) ∧ ¬∃≥k+1 x(x = x)
is an FOL sentence with counting quantifiers that is true iff |u(A)| = k.
(b) ^
∃x1 · · · ∃xn ¬(xi = xj )
1≤i<j≤n
∃≥n x(x = x)
5
9. Write an FO formula that will evaluate to true only over a structure that has atleast n
elements and atmost m elements.
Solution
Using the counting quantifiers we discussed earlier, such a sentence would be ∃≥n x(x =
x) ∧ ¬∃≥m+1 x(x = x). Removing the counting quantifiers, we get the sentence:
^ ^
∃x1 · · · ∃xn ¬(xi = xj ) ∧ ¬ ∃x1 · · · ∃xm+1 ¬(xi = xj )
1≤i<j≤n 1≤i<j≤m+1