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

ASSIGNMENT # 3

1. Determine whether the following problems are decidable or recognizable or


unrecognizable? Justify with a proper algorithm. Note: L (M) means Language of
Machine.
a) CONNECTED = {<G> | G is a connected undirected graph}
Universal U = {<G> | G is an undirected graph}
A = {<G> | G is a connected undirected graph}
1. To prove A is decidable language, need to show TM that decides A.
2. For a TM M to decide A, the TM must take any instance <G> ∈ U as input
halt and accept if <G> ∈ A
halt and reject if <G> does not ∈ A (i.e., never loops indefinitely)
M = “On input <G> ∈ U, where G is an undirected graph:
1. Check if <G> is a valid graph encoding. If not, reject.
2. Select first node of G and mark it.
3. Repeat until no new nodes marked
4. For each node in G, mark it if it’s attached by an edge to a node already marked.
5. Scan all nodes of G to see whether they all are marked. If they are, accept; otherwise,
reject.”
b) ISO = {<G,H> | G and H are isomorphic graphs}
To show that ISO is UNRECOGNIZABLE
We are given some reordering of the nodes in G to G’ so that they are identical to H.
To verify that G’ identical to H, verify each edge as follows:
Let L be a list of nodes that have been visited. Originally, this list is empty.
1. Let g be the first vertex on the tape in G
2. Let h in H be the candidate node equivalent to g.
3. If the degree of g is not equal to the degree of h, reject.
4. Add g and h to the list.
5. For each child g’ of g not in the list.
a). Let H’ in H be the isomorphic vertex.
b). If HH’ is not in H, reject.
c). Otherwise, execute Step 1 with the context of G’.
6. If each child of G is isomorphic to some child of H, then G and H are isomorphic.
c) {C | C is a CFG with such that L (M) is an empty set}
This language is proved through EMPTINESS PROBLEM OF CFG
R =“On input string G, where G is a CFG:
1. Mark all terminal symbols in G.
2. Repeat until no new nonterminal gets marked.
3. Mark any nonterminal A such that G contains a rule A → u1, ..., un and each symbol ui
has already been marked.
4. If the start nonterminal of G is marked, accept, otherwise reject.”
d) {A and B are two TMs and L (A) != L(B)}
This language is undecidable (UNRECOGNIZABLE).
Proof: We first assume that L is decidable, say the TM ML decides L. We prove that ATM is
decidable. Similar as the previous solution, for each pair of M and x, we define the function
(Mx). We also define the Turing machine Mc that accepts every string. Then we construct the
Turing machine MATM as follows,
1. On input (M, x).
2. Construct the Turing machines (Mx,Mc).
3. Run ML on the input (Mx,Mc)
4. If (M, x) ∈ ATM, e,g, M does not accepts x. By the definition of (Mx), it accepts nothing,
which means L(Mx) = ∅. Thus L(Mx) != L(Mc). Since ML decides the language L, ML
must reject (Mx, Mc), thus by the definition of MATM, it rejects (M, x).
e) {<M,w> | M is a Turing machine and it halts on input w}
Modify the universal TM to show that HALT TM is Turing-recognizable
Suppose there exists a TM R that decides HALT TM. Then we could use R to develop a TM S to
decide ATM by modifying the universal TM to first use R to see if it’s safe to run M on w.
S = “On input (M, w), where M is a TM and w is a string:
1. Run R on input (M, w).
2. If R rejects, reject.
3. If R accepts, simulate M on input w until it halts.
4. If M accepts, accept; otherwise, reject.
Because TM R is a decider, TM S always halts and is a decider. Thus, deciding ATM is reduced
to deciding HALT TM. However, ATM is undecidable (Theorem 4.I), so that must mean that
HALT TM is also undecidable (UNRECOGNIZABLE).
f) {<M> | M is a Turing machine and L (M) is an empty set}
This language is undecidable.
Proof: We prove it by contradiction. We first assume that L is decidable, say the TM ML decides
L. We prove that ATM is decidable. Remind that
ATM = {(M, x) : M accepts x}
For each pair of M and x, we define the Turing machine Mx as
1. Mx. On input w
2. Erase w and replace it by x.
3. Run M on the input x.
Then we construct the Turing machine MATM as follows
1. On input (M, x).
2. Construct the Turing machine (Mx).
3. Run ML on the input (Mx).
4. If ML accepts then accept; if ML rejects then reject.
Correctness: We prove correctness by two directions.
1. If (M, x) ∈ ATM, e,g, M accepts x. By the definition of Mx, it accepts everything, which
means L(Mx) = Σ∗ . In particular, we have that A ∈ L(Mx). Since ML decides the
language L, ML must accept (Mx), thus by the definition of MATM, it accepts (M, x).
2. If (M, x) ∈ ATM, e,g, M does not accepts x. By the definition of Mx, it accepts nothing,
which means L(Mx) = ∅. In particular, we have that A!∈ L(Mx). Since ML decides the
language L, ML must reject (Mx), thus by the definition of MATM, it rejects (M, x).
Combine these two cases, we show that MATM decides ATM, which is a contradiction since we
know that ATM is undecidable.
g) {X | X is a TM and X does not accept string “534”}
h) {Y | Y is a TM and L(Y) has at least 534 strings}
2. (a) Let A and B be two disjoint languages. Say that language C separates A and B if A ⊆
C and B ⊆ C. Show that any two disjoint co-Turing-recognizable languages are separable
by some decidable language.
Solution:
Preliminaries:
Let A and B be two co-turing recognizable languages. By definition, there exists turing machines
that recognizes the complement of these languages, let us call these: TM MA’ and MB’. Note
that L (MA’) =A’ and L (MB’) =B’ Also assume that A∩B=∅ ⇐⇒A’∪B’= Σ*
Proof: The proof is by construction, i.e., I will construct a machine M which is a decider and
separates A and B. Such machine works as follow:

1. Run both machines MA’ and MB’ in parallel on input w.


2. If MB’ accepts w, accept.
3. If MA’ accepts w, reject.
From the preliminaries we know that any string in Σ*is either on A’ or B’. Machine M uses
recognizers for A’ and B’ and thus, will halt on every input, i.e., it is a decider. Moreover, because
A and B are disjoints, any string in A is in B’, i.e. A⊆B’. Every string in B’ is accepted by M, and
thus, A⊆L (M).
Conversely, any string in B is in A’, i.e. B⊆A’, but every string in A’ is rejected by M; thus, B is
not in the language of M. It follows that L (M) =C is a decider that separates A and B.

(b) Let S = {⟨M⟩| M is a DFA that accepts w^R whenever it accepts w}. Show that S is
decidable.
Solution: We are mapping this problem into Equivalence of DFA that is decidable.
Let S = {(M) | M is a DFA that accepts w R whenever it accepts w}. We show that S is
decidable.
Given (M), which represents an automata M, we can construct an automata N such that L(N) =
L(M)R, that is, N accepts a word w if and only if M accepts wR.
Clearly, (M) ∈ S if and only if L(M) = L(N). Since Equivalence of DFA is decidable, there is an
algorithm deciding whether (M, N) ∈ Equivalence of DFA.
1. If (M, N) ∈ Equivalence of DFA, we have L(M) = L(N). Therefore, (M) ∈ S.
2. If (M, N)!∈ Equivalence of DFA, we have L(M) != L(N). Therefore, (M)!∈ S.
3. You are given a push down automata P with one state. Determine whether the following
problem is decidable, recognizable or unrecognizable? “Is L(P) = Σ*?” Note: Σ* represents
language of all strings.
Solution:
Let DFA = {<A>: A is a DFA and L(A) is an infinite language}
To show that DFA is DECIDABLE, meaning to construct a TM M that decides DFA. This
means that for all DFAs A we want.
1. If L (A) is an infinite language then M(A) accepts.
2. If L (A) is a finite language then M(A) rejects.
Proof: Given (A) where A is a DFA, we want to be able to determine whether the number of
strings that A accepts is finite or infinite. TM M (DFA) decides the language
A (DFA) = {(A, w):A is a DFA and A accepts w}
One way to approach the design of a TM M to decide DFA is, on input hAi, start a loop over all
w ∈ Σ ∗ , with an iteration of the loop running M(DFA)((A, w)) to test whether or not w ∈ L(A).
The problem with this is that there are infinitely many w and our machine will not halt.
Justification:
Suppose A is a DFA with p states and alphabet Σ. Let
B (A) = {w ∈ Σ∗: w ∈ L(A) and p ≤ |w| ≤ 2p}
Then L (A) is infinite if and only if B (A)!= ∅. This means that to test whether or not L (A) is
infinite, we need only test whether or not B (A) is empty. The latter can be done using the
machine M (DFA) since B(A) is a finite set.
Construction:
M = On input (A), where A is a DFA
Let p be the number of states in DFA (A)
Let Σ be the alphabet of DFA (A)
For each string w ∈ Σ∗ such that p ≤ |w| ≤ 2p do:
1. Run M(DFA)((A, w))
2. If it accepts then accept
EndFor
Reject

4. You are given two Turing Machine X and Y. Determine whether the following problem
is decidable, recognizable or unrecognizable? “Can one Turing Machine recognize the
complement of the language that is recognized by the other Turing Machine?”
Solution: Let two machines X and Y.
If a language S = {a^n | n>0} over Σ= {a,b} is recognized by machine X and by taking its
complement
S’ = {b^n | n>0} that runs on machine Y will be recognized by Y.
Hence proved.
5. Find a language such that both the language and its complement are non-recognizable.
You will have to prove their unrecognizability.
Solution: This language is UN-RECOGNIZABLE
L= {⟨M1,M2⟩∣ M1,M2 Turing machines and L(M1)=L(M2)}
Proof:
It’s possible that both the language L and its complement L’ can be unrecognizable over the set
Σ={0,1} if L accepts all 1’s and L’ accepts all 0’s then by taking union of both the languages we
get M=1L+OL’ and this language M is Un-recognizable.

You might also like