CS 228 Tut5 Sol

Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

Logic in CS Autumn 2024

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.

Follow-up Question. What property should R satisfy so that φ is not satisfiable


over any structure with infinite and countable universe?
a
Assuming the set of natural numbers start with 1 and not 0

2. Let τ be a signature consisting of a binary relation P and a unary relation F . Let F be a


structure consisting of a universe of people, P (x, y) is interpreted on F as “x is a parent of
y” and F (x) is interpreted as “x is female”. Given the τ -structure F,

(a) Define a formula φB (x, y) which says x is a brother of y


(b) Define a formula φA (x, y) which says x is an aunt of y
(c) Define a formula φC (x, y) which says x and y are cousins
(d) Define a formula φO (x) which says x is an only child
(e) Give an example of a family relationship that cannot be defined by a formula

Solution
(a) Assuming a brother is a distinct non-female who shares a parent in common with
you, we have:

φB (x, y) = ¬(x = y) ∧ ¬F (x) ∧ ∃z[P (z, x) ∧ P (z, y)]

(b) Assuming an aunt is a female who shares a parent in common with a parent of
yours, we have:

φA (x, y) = F (x) ∧ ∃z[P (z, y) ∧ ∃w(P (w, z) ∧ P (w, x))]

(c) Assuming cousins are distinct people who have distinct parents who have a parent

1
in common, we can write:

φC (x, y) = ∃a∃b∃c[¬(a = b) ∧ P (a, x) ∧ P (b, y) ∧ P (c, a) ∧ P (c, b)] ∧ ¬(x = y)

(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

• For any a ∈ N, N |= Zero(a) iff a is zero.


• For any a ∈ N, N |= One(a) iff a is one.
• For any a ∈ N, N |= Even(a) iff a is even.
• For any a ∈ N, N |= Odd(a) iff a is odd.
• For any a ∈ N, N |= Prime(a) iff a is prime.

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)

• Prime(a) = ¬(∃x∃y (¬One(x) ∧ ¬One(y) ∧ (x × y) = a)) ∧ ¬One(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:

Goldbach := ∀x (¬Zero(x)∧¬Two(x)∧Even(x) → ∃y∃z Prime(y)∧Prime(z)∧(y+z) = x)

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

(a) The operation + is associative


(b) The constant 0 is a right-identity for the operation +
(c) Every element in G has a right inverse: for each x ∈ G, we can find y ∈ G such that
x+y =0
(d) For any three elements x, y, z ∈ G, if x + z = y + z, then x = y

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:

(a) φa = ∀x∀y∀z [op(op(x, y), z) = op(x, op(y, z))]

(b) φb = ∀x (op(x, c) = x)

(c) φc = ∀x∃y (op(x, y) = c)

(d) φd = ∀x∀y∀z [(op(x, z) = op(y, z)) → x = y]

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:

φ1 := ∀x∀y∀z [(x + (y + z)) = ((x + y) + z)]

φ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.

(a) Show that ψ is satisfiable by exhibiting a τ -structure.


(b) Show that ψ is not valid.
(c) Let α be the sentence ∀x∀y ((x + y) = (y + x)). Does α follow as a consequence of ψ?
That is, is it the case that ψ → α?
(d) Show that ψ is not equivalent to any of φ1 ∧ φ2 , φ2 ∧ φ3 and φ1 ∧ φ3 .

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).

(d) i. A structure A satisfying φ1 ∧ φ2 but not ψ is one where u(A) = Z, 0A = 1,


and +A (x, y) = xy.
ii. A structure A satisfying φ2 ∧ φ3 but not ψ is one where u(A) = N, 0A = 0,
and +A (x, y) = |x − y|.
iii. A structure A satisfying φ1 ∧ φ3 but not ψ is one where u(A) = Z, 0A = 1,
and +A (x, y) = x + y.

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.

Semantics : A |= ∃≥n x φ iff A |= φ(ai ) for each of n distinct elements a1 , a2 , . . . , an from


the universe u(A).

(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

is an FOL sentence equivalent to

∃≥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

One can show that this sentence is equivalent to:


   
^ _
∃x1 · · · ∃xn ¬(xi = xj ) ∧ ∀x1 · · · ∀xm+1 (xi = xj )
1≤i<j≤n 1≤i<j≤m+1

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy