lecture 07
lecture 07
Lecture #7
Sarmad Abbasi
Virtual University
Decidable Languages
Decidable Problems concerning Regular Languages
Decidable Problems concerning Context Free Languages
The Halting Problem
Undecidability of the Halting Problem
You must have studied DFAs in your previous automata course. DFAs
are simple machines with a readonly head. Let us look at the following
problem:
The input to this problem consist of two parts. The first part is going to
be a description of a deterministic finite automata B. The second part
is going to be a string w. We have to decide if the DFA B accepts the
string w.
Note that the input will not be a DFA B but a suitable encoding of B.
Let us look at the following picture which shows two DFAs:
In this case:
1 hB1 , 1i ∈ ADFA .
2 hB1 , 000i 6∈ ADFA .
3 hB2 , 1i 6∈ ADFA .
4 hB2 , 000i ∈ ADFA .
We want to show ADFA is decidable.
Question
Is ADFA decidable?
Is ANFA decidable?
There are two ways we can approach this problem. The first one is
very similar to the previous one. We can show that a Turing machine
can simply “simulate” an NFA. All it has to do is to keep track of the set
of states that the NFA is in.
Is AREX decidable?
Once again, there is another approach. We know that every REX can
be converted to an equivalent DFA. In fact, there is an algorithm that
can convert any (suitable description of an) regular expression to a
(description of an) equivalent DFA.
The problem on the surface looks very difficult. We have to make sure
that A does not accept any strings. However, the number of potential
strings is infinite. Thus it would be futile to simulate A on all the strings.
The process will never end.
Note the problem on the surface again looks very difficult. We have to
make sure that A and B accept exactly the same strings and reject
exactly the same strings. However, the number of potential strings that
we can as input is infinite. Thus it would be futile to simulate A and B
on all the strings. The process will never end.
L(A) = L(B)
L(D 0 ) = L(D).
1 On input hA, Bi
2 Construct the DFA C described above.
3 If L(C) = ∅ accept. Else reject.
You have studied CFG in your previous automata course. Let us look
at the following problem:
The input to this problem consist of two parts. The first part is going to
be a CFG G. The second part is going to be a string w. We have to
decide if the G generates w.
Note that the input will not be a CFG G but a suitable encoding of G.
Question
Is ACFG decidable?
One idea is to try all possible derivation and check if we ever get the
string w. However, we do not know how many derivations to try and
this can be potentially infinite.
But we know how to convert a grammar into Chomsky Normal Form.
In chomsky normal form every string of length n has a derivation of
length at most 2n − 1.
1 On input hG, wi
2 Convert G into Chomsky normal form G’.
3 List all derivations with 2n − 1 steps.
4 If one of them generates w accept. Otherwise reject.
Note the above method is not the most efficient. You have studied
more efficient algorithms for this problem. You can recall the CYK
algorithm.
Note the problem again looks very difficult. We have to make sure that
G1 and G2 generate exactly the same strings.
Question
Is EQCFG decidable?