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

CS 228 (M) - Logic in CS

Tutorial V - Solutions

Ashwin Abraham

IIT Bombay

12th September, 2023

Ashwin Abraham 2023 1/6


Table of Contents

1 Question 1

2 Question 2

3 Question 3

Ashwin Abraham 2023 2/6


Question 1
(a) Since our alphabet is {a, b}, this is equivalent to the set of languages
that end and start with the same alphabet. The FO formula for this
would be:

∀x [first(x) =⇒ Qa (x) ∧ last(x) =⇒ Qa (x)]



∀x [first(x) =⇒ Qb (x) ∧ last(x) =⇒ Qb (x)]

where first(x) ≡ ¬∃y [y < x] and left(x) ≡ ¬∃y [x < y ]


(b)

∃x[Q# (x) ∧ ∀y (Q# (y ) =⇒ y = x) ∧ ∀y (y < x =⇒ Qa (x)) ∧


∀y (x < y =⇒ Qb (x))]

(c) ¬∃x∃y [S(x, y ) ∧ Qb (x) ∧ Qa (y )]


(d) ∃x, y , z, w [first(x) ∧ S(x, y ) ∧ Q0 (y ) ∧ last(z) ∧ S(w , z) ∧ Q0 (w )]
Ashwin Abraham 2023 3/6
Question 1

Recall that S(x, y ) is redundant in FOL over words, and can be defined in
terms of < as x < y ∧ ¬∃z [x < z ∧ z < y ]
(e) A necessary and sufficient condition for the top row to be larger than
the bottom row is that at the first point of difference (which should
exist), the top row should have bit 1 and the bottom row should have
bit 0. In FOL, this can be expressed as:
   
   
∃x 
Q
  (x) ∧ ∀y 
y < x =⇒ Q 0 (y ) ∨ Q 1 (y )
     
 
1    
0 0 1

Note that since all of these languages are FO definable, they are all also
regular.

Ashwin Abraham 2023 4/6


Question 2

Firstly, note that the answers to (c) and (d) would both always be yes, as
all FO definable languages are regular, and FO definable languages are
closed under complementation. By inspection, we observe that the
answers to (a) and (b) for the languages defined by the FO formulas are:
(1) (a) ε
(b) ΣΣ∗ = Σ+
(2) (a) Σ∗ baΣ∗
∗ ∗
(b) [(Σ − b)∗ [b(Σ − a)]∗ ] + [(Σ − b)∗ [b(Σ − a)]∗ ] b
(3) (a) Σ∗ aΣ
(b) ε + Σ + Σ∗ (Σ − a)Σ
(4) (a) (ab)+ = a(ba)∗ b
(b) Σ∗ (Σ−a−b)Σ∗ +ε+b(a+b)∗ +(a+b)∗ a+(a+b)∗ (aa+bb)(a+b)∗

Ashwin Abraham 2023 5/6


Question 3
By observation, L = b(a+ b 3 )∗ and we also have L = L(ϕ) where ϕ is

∃x [first(x) ∧ Qb (x)] ∧ ∀x[¬first(x) =⇒ ([Qa (x) ∧ ∃y (x < y ∧ Qb (y ))]


∨[C1 (x) ∨ C2 (x) ∨ C3 (x)])]

where Ci (x) expresses that x is the i th b in the a+ b 3 element, i = 1, 2, 3.

C1 (x) ≡ ∃p, q, r [Qa (p) ∧ S(p, x) ∧ Qb (x) ∧ S(x, q) ∧ Qb (q)


∧S(q, r ) ∧ Qb (r ) ∧ ∀s(S(r , s) =⇒ Qa (s))]

C2 (x) ≡ ∃p, q, r [Qa (p) ∧ S(p, q) ∧ Qb (q) ∧ S(q, x) ∧ Qb (x)


∧S(x, r ) ∧ Qb (r ) ∧ ∀s(S(r , s) =⇒ Qa (s))]

C3 (x) ≡ ∃p, q, r [Qa (p) ∧ S(p, q) ∧ Qb (q) ∧ S(q, r ) ∧ Qb (r )


∧S(r , x) ∧ Qb (x) ∧ ∀s(S(x, s) =⇒ Qa (s))]

Ashwin Abraham 2023 6/6

You might also like