Professional Documents
Culture Documents
A Automata Theory
– Finite Automata and Regular Languages
∗ Deterministic finite automata
∗ Nondeterministic finite automata
∗ Regular expressions
∗ Regular languages
· Closure properties of regular languages
∗ Nonregular languages and the punping lemma for rgular lan-
guages
– Pushdown automata and context-free languages
∗ Pushdown automata
∗ Context-free grammars and context-free languages
∗ Closure Properties of context-free languages
∗ Non-context-free languages and the pumping lemma for context-
free languages
B Computability Theory
– Turing machines
∗ Turing machines - Formal definition
· Multitape turing machines
· Nondeterministic turing machines
∗ Turing-Recognizable languges and Decidable languages
· Properties of turing-recognizable and decidable languages
∗ Algorithm
– Decidable and Undecidable Languages
∗ Decidable langages - ADF A , ANF A , AREX , EDF A , EQDF A , ACF G , ECF G , EQCF G ,
etc.
∗ Undecidable Languages - ATM , HALTTM
– Reducibility
∗ Turing Reducibility
∗ Mapping Reducibility
∗ Examples
C Complexity Theory
– Measuring complexity
∗ Deterministic TM
∗ Nondeterministic TM
∗ Multitape TM
1
– The Class P
∗ Examples - PATH, RELPRIME, 2-SAT
∗ Closure Properties
PRACTICE PROBLEMS
1. Consider the DFA Figure 0.1.
q1 b q2
a
b b
a
b
q4 q3
a
Figure 0.1: M1
2. The formal description of a DFA M is ({q1 , q2 , q3 }, {a, b}, δ, q1, {q2 }), where
δ is given by the following table.
a b
q1 q1 q2
q2 q3 q2
q3 q3 q3
Give the state diagram of this machine.
3. The formal description of a DFA M is ({q1 , q2 , q3 }, {a, b}, δ, q1, {q3 }), where
δ is given by the following table.
a b
q1 q2 q1
q2 q3 q1
q3 q3 q3
Give the state diagram of this machine.
2
4. Convert the following nondeterministic finite automaton to an equivalent
deterministic finite automaton.
ǫ
1 2
a
a a, b
3 b
Figure 0.2: M2
a, b a
1 2
a b b
Figure 0.3: M2
a a
q1 b q2 b q3
a
b
Figure 0.4: M3
3
a. All strings that contain exactly one a.
b. All strings that contain exactly two a′ s.
c. All strings that contain at least two a′ s.
d. All strings that begin with aa.
e. All strings that begin with aa and end with bb.
f. All strings that do not begin with aa.
g. All strings that contain the substring aaa or the substring bbb.
h. All strings that contain the substring aa and the substring bb.
i. All strings, where every occurence of a is immediately followed by a
b.
9. Convert the following nondeterministic finite automata into regular ex-
pressions.
a. Figure 0.5.
a, b b b
q1 q2 q4 q5
a
b
a
a
q3
Figure 0.5: M4
b. Figure 0.6.
b
b a b a
q1 q2 q4 q5 q6
b
b
a
q3
b
Figure 0.6: M5
L = {w|abba is a substring of w}
is regular’
4
11. Convert each of the following regular expressions to a finite automaton
accepting the corresponding language.
a. (a ∪ b)∗ ab(abb ∪ a∗ )∗ bb∗
b. a(aa ∪ b)∗ (a∗ b ∪ b)∗ ab
c. (ab ∪ b)(b ∪ aaa)b∗ b((a∗ b)∗ ∪ b)∗
d. ab((b ∪ aa ∪ aab)bb∗ )∗ b
e. ((b ∪ ab)∗ b)∗ (ba∗ )∗ b
12. Consider the following languages over A = {a, } :
a. L1 = {am bn |m > 0, n > 0}
b. L2 = {bm abn |m > 0, n > 0}
c. L3 = {am bm |m > 0}.
Find regular expression R over A = {a, b} such that Li = L(R), i =
1, 2, 3.
13. Find the language L(G) over {a, b, c} generated by the grammar G with
productions
S → aSb, aS → Aa, Aab → c.
17. Consider the grammar G = {V, Σ, R, S} where V = {S, A}, Σ = {a, b},
and the set of rules, R, is
• S → aAS
5
• S→a
• A → SbA
• A → SS
• A → ba.
Convert G to Chomsky Normal Form (CNF).
18. Consider the CFG G = {V, Σ, R, S} where V = {S, A}, Σ = {a, b}, and
the set of rules, R, is
• S → aSb
• S → bA
• S → Aa
• A → bA
• A → aA
• A→ǫ
19. Show that the collection of decidable languages is closed under the oper-
ation of (a) union, (b) concatenation, (c) star, (d) complementation, (e)
intersection.
a Give computations of the pushdown automaton on the strings aaabba, abbaaa, aabba,
and aaaababa. Determine which of the strings are accepted by the
pushdown automaton.
b Describe the language accepted by the pushdown automaton.
6
a Show that the strings aababaaab, and baaabbaab are accepted by the
pushdown automaton. Show that the strings aabbabbaa, and abbbabbbb
are not accepted by the pushdown automaton. Show accepting com-
putations for accepted strings and nonaccepting computations for the
strings that are not accepted.
b Describe the language accepted by the pushdown automaton.
24. Find the Chomsky normal forms for the following grammars:
25. Find the context-free grammar for the language L = {an bn am bm |n, m =
0, 1, 2, · · · }.
27. Let L1 , L2 , and L3 be languages defined over the alphabet Σ = {a, b},
where
• L1 consists of all possible strings over Σ except the strings w1 , w2 , ..., w100 ;
i.e., start with all possible strings over the alphabet, take out 100 par-
ticular strings, and the remaining strings form the language L1 ;
• L2 is recognized by an NFA; and
• L3 is recognized by a PDA.
Prove that (L1 ∩ L2 )L3 is a context-free language. [Hint: First show that
L1 and L2 are regular. Also, consider L1 , the complement of L1 .]
7
28. Consider the problem of determining whether a DFA and a regular expres-
sion are equivalent. Express this problem as a language and show that it
is decidable.
29. Let AǫCF G = {< G > |G is a CFG that generates ǫ}. Show that AǫCF G
is decidable.
30. Let INFDF A = {hAi |A is a DFA and L(A) is an infinite language} Show
that INFDF A is decidable.
31. Let ALLDF A = {hAi |A is a DFA and L(A) = Σ∗ }. Show that ALLDF A
is decidable.
32. Let BALDF A = {hM i |M is DFA that accepts some string containing an equal number of 0sand 1s}.
Show that BALDF A is decidable.
33. Show that EQCF G is undecidable.
34. Show that EQCF G is co-Turng-recognizable.
35. If A ≤m B and B is a regular language, does this imply that A is a regular
language? Why or why not?
36. Show that AT M is not mapping reducible to ET M . That is, show that no
computable function reduces AT M to E
37. Show that ≤m is a transitive relation.
38. Show that if A is Turing-recognizable and A ≤m A, then A is decidable.
39. Consider the problem of determining whether a two-tape Turing machine
ever writes a nonblank symbol on its second tape when it is run on input
w. Formulate this problem as a language , and show that it is undecidable.
40. Show that P is closed under union, concatenation, and complement.
41. Show that ALLDF A is in P.
42. Show that N P is closed under union and concatenation.