HW 3
HW 3
Recognizability
CS 212 Nature of Computation
Habib University
HW3 L3 3
Fall 2023
1. A Turing machine is said to compute a function f if, started with an input x on its tape,
it halts with f (x) on its tape. Consider a binary operator △ and a function f defined as
follows.
Consider the Turing machine, M , that computes f given a #-separated pair of binary strings
as input. The Turing machine should print nothing if the function is undefined.
(a) 5 points Give a high-level description of M .
Solution: We can build a Turing Machine M that computes f such that it traverses
over the tape and inputs a and b. If the lengths don’t match, it goes into the reject
state. Similarly, if the machine reads anything other than a 0 or 1 (excluding the
blank symbol and #), it goes into the reject state as these are conditions for which
the function would be undefined. Else the machine computes ci by applying the △
operator on ai and bi and writes it on the tape.
We can provide a high level description of M . Machine M starts with the head at
a1 . We use “skip” to denote one or more moves of the head that do not replace any
tape symbols.
1. Skip right until the very first blank symbol ( ) is encountered (indicating that
b has ended), and write a #. This # indicates end of the input string (if
anything other than a 0, 1, # is encountered, we move to the reject state)
2. Skip left until the first blank symbol is encountered and move right. Hence,
we are starting from a1 .
3. Remember this symbol, call it ai , and move right.
4. If the current symbol is a # (input a is exhausted)
(a) Skip right to find the first symbol that is a 0 or a 1.
(b) Remember the current symbol, call it bi , and replace it with .
1
CS 212, Fall 2023
HW 3: Turing Machine, Variants, Decidability, and Recognizability Fall 2023
Page 2 of 4
CS 212, Fall 2023
HW 3: Turing Machine, Variants, Decidability, and Recognizability Fall 2023
2. 10 points An Euclidean-Space Turing machine has the usual finite-state control but a tape
that extends in a three-dimensional grid of cells, infinite in all directions. Both the head and
the first input symbol are initially placed at a cell designated as the origin. Each consecutive
input symbol is in one of the six neighboring cells and does not overwrite a previous symbol.
The head can move in one transition to any of the six neighboring cells. All other workings
of the Turing machine are as usual.
Provide a formal description of the Euclidean-Space Turing Machine and prove that it is
equivalent to an ordinary Turing machine. Recall that two models are equivalent if each can
simulate the other.
Solution:
An Euclidean-Space Turing Machine has a 3D grid of cells, infinite in all directions,
so it can move in all 3 dimensions. We consider the 3D grid to represent the x, y, z
coordinate systems for ease, with right and left movements being on the x-axis, up and
down movements being on the z-axis, and forward and backward movements being on
the y-axis. Let EST M be an Euclidean-Space Turing Machine. Formally, we can define
EST M as a 7-Tuple: EST M = (Q, Σ, Γ, δ, qo , qaccept , qreject ) where:
1. Q is a finite set of states.
2. Σ is a finite set of input symbols.
3. Γ is a finite set of tape symbols, where Σ ⊆ Γ and Γ has additional tape symbol(s)
4. δ : Q × Γ → Q × Γ × {L, R, U, D, F, B} is the transition function.
The machine is in state q ∈ Q, and scans tape symbol γ ∈ Γ. It changes to state
q ′ ∈ Q, writes or reads symbol from the tape, and moves in any of the six directions
left(L), right(R), up(U), down(D), forward(F), backward(B).
5. qo is the start state.
6. qaccept is the accepting state.
7. qreject is the rejecting state.
We can show that the Euclidean-Space Turing Machine is equivalent to a normal Turing
Machine by showing that a normal Turing Machine can simulate the Euclidean-Space
Turing Machine, and vice versa. Let M be an ordinary Turing Machine and EST M be
an Euclidean-Space Turing Machine.
Page 3 of 4
CS 212, Fall 2023
HW 3: Turing Machine, Variants, Decidability, and Recognizability Fall 2023
Since M and EST M can both simulate each other, we have proved they are equivalent
and an EST M is no more powerful than an ordinary Turing Machine.
■
3. 10 points Let A = {L | L is decidable but not context-free}. Prove that every element of
A contains an unrecognizable subset.
Solution: Let L ∈ A. Then L is decidable but not context-free. Since every finite
language is context-free, then we can infer that L is infinite.
We consider the power set of L; P(L) since the power set is essentially a set containing
all possible subsets of L. According to Cantor’s Theorem, the cardinality of the power
set of any set is strictly greater than the cardinality of the set itself; | P(L) |>| L |.
Since L is infinite, then P(L) must also be infinite, however, as a direct consequence of
the Cantor’s Theorem, we can infer that P(L) is uncountably infinite unlike L which is
countably infinite since the cardinality of the power set is always strictly greater than
the cardinality of the set itself. COROLLARY 4.18 of the book states that there are some
languages that are not Turing recognizable - essentially showing that the set of all Turing
Machines is countable.
Since there exists uncountably many subsets in P(L), but countably many Turing Ma-
chines, then there must exist some subsets in P(L) for which no corresponding Turing
Machine exists, since a bijection cannot be made from the set of Turing Machines, to
P(L).
Therefore, for every element L ∈ A, L must have an unrecognizable subset.
■
Page 4 of 4