Theory of Languages
and Automata
Chapter 4- Decidability
Sharif University of Technology
Decidable Languages
O Let
ADFA = { B, w | Bis a DFAthat acceptsinput string w}.
O Theorem 4.1
ADFA is decidable.
Theory of Languages and Automata
Prof. Movaghar
2
Decidable Languages
(Proof Idea)
O We simply need to present a TM M that decides
ADFA.
O
M = “On input 〈B, w〉, where B is a DFA and w
is a string:
1.
2.
Simulate B on input w.
If the simulation ends in an accept state, accept. If it
ends in a nonaccepting state, reject.”
Theory of Languages and Automata
Prof. Movaghar
3
Decidable Languages (cont.)
O
Let
ADFA = { B, w | Bis a NFAthat acceptsinput string w}.
O Theorem 4.2
ADFA is decidable.
Theory of Languages and Automata
Prof. Movaghar
4
Decidable Languages (Proof)
O
We design TM N that decides ADFA.
O
N = “On input 〈B, w〉, where B is a NFA and w is
a string:
1.
2.
3.
Convert NFA B to an equivalent DFA C, using the
procedure for this conversion given in Theorem 1.39.
Run TM M from the Theorem 4.1 on input 〈C, w〉 .
If M accepts, accept; otherwise, reject.”
Theory of Languages and Automata
Prof. Movaghar
5
Decidable Languages (cont.)
O Let
AREX = { R, w | Ris a regular expression that generates string w}.
O Theorem 4.3
AREX is decidable.
Theory of Languages and Automata
Prof. Movaghar
6
Decidable Languages (Proof)
O The following TM P decides AREX.
O
P = “On input 〈R, w〉, where R is a regular
expression and w is a string:
1.
2.
3.
Convert regular expression R to an equivalent NFA
A, using the procedure for this conversion given in
Theorem 1.54.
Run TM N on input 〈A, w〉 .
If N accepts, accept; in N rejects, reject.”
Theory of Languages and Automata
Prof. Movaghar
7
Decidable Languages (cont.)
O
Let
EDFA = { A | Ais a DFA and L(A) = }.
O Theorem 4.3
EDFA is decidable.
Theory of Languages and Automata
Prof. Movaghar
8
Proof
O The following TM T decides EDFA:
O T = “On input 〈A〉 where A is a DFA:
Mark the start state of A.
2. Repeat until no new states get marked:
3.
Mark any state has a transition coming into it
from any state that is already marked.
4. If no accept state is marked, accept; otherwise,
reject.”
1.
Theory of Languages and Automata
Prof. Movaghar
9
Proof
O The following TM T decides ADFA:
O T = “On input 〈A〉 where A is a DFA:
Mark the start state of A.
2. Repeat until no new states get marked:
3.
Mark any state has a transition coming into it
from any state that is already marked.
4. If no accept state is marked, accept; otherwise,
reject.”
1.
Theory of Languages and Automata
Prof. Movaghar
10
Decidable Languages (cont.)
O
Theory of Languages and Automata
Prof. Movaghar
11
Proof
O
Theory of Languages and Automata
Prof. Movaghar
12
Decidable Languages (cont.)
O
Theory of Languages and Automata
Prof. Movaghar
13
Proof
O The TM S for ACFG follows.
O S = “On input 〈G, w〉, where G is a CFG and w is a string:
Convert G to an equivalent grammar in Chomsky
normal form.
2. List all derivations with 2n – 1 steps, where n is the
length of w, except if n = 0, then instead list all
derivations with 1 step.
3. If any of these derivations generate w, accept; if not,
reject.”
1.
Theory of Languages and Automata
Prof. Movaghar
14
Decidable Languages (cont.)
O
Theory of Languages and Automata
Prof. Movaghar
15
Proof
O TM R decides ECFG as follows:
O R = “On input 〈G〉, where G is a CFG:
Mark all terminal symbols in G.
2. Repeat until no new variables get marked:
3.
Mark any variable A where G has a rule
A→U1U2…Uk and each symbol U1, …, Uk has
already been marked.
4. If the start variable is not marked, accept; otherwise,
reject.”
1.
Theory of Languages and Automata
Prof. Movaghar
16
Decidable Languages (continued)
O
Theory of Languages and Automata
Prof. Movaghar
17
Relationship Between Four Classes of Languages
Theory of Languages and Automata
Prof. Movaghar
18
Undecidable Languages
O Let
O Theorem 4.11: ATM is undecidable.
Theory of Languages and Automata
Prof. Movaghar
19
Proof
O PROOF Let H be a decider for ATM. Then
Define D as follows
O Then
O So
Theory of Languages and Automata
Prof. Movaghar
20
Turing-Unrecognizable Languages
O DEFINITION A language is co-Turing-
recognizable if it is the complement of a Turingrecognizable language.
Theory of Languages and Automata
Prof. Movaghar
21
Theorem
O THEOREM: A language is decidable if it is Turing-
recognizable and co-Turing-recognizable.
O PROOF We have two directions to prove. First, if A is
decidable, then both A and its complement AC are Turingrecognizable.
For the other direction, let M1 be the recognizer for A and
M2 be the recognizer for AC. The following Turing
Machine M is a decider for A.
M = “On input w:
1. Run both M1 and M2 on input w in parallel.
2. If M1 accepts, accept; if M2 accepts, reject.”
Theory of Languages and Automata
Prof. Movaghar
22
Theorem
Theory of Languages and Automata
Prof. Movaghar
23
© Copyright 2026 Paperzz