You are on page 1of 8

Department of Computer Science

Nile University of Nigeria, Abuja


Advanced Theory of Computation
Study Guide for Final Examination

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

a. What is the start state?

b. What is the set of accept states?


c. What sequence of states does the machine go through on input of
aabbaba?
d. Does the machine accept the string baabbaa?
e. Does the machine accept the string ǫ?

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

5. Describe the language accepted by the machine whose state diagram is


given by Figure 0.3.

a, b a
1 2

a b b

Figure 0.3: M2

6. Consider the finite automaton M3 :

a a
q1 b q2 b q3
a
b

Figure 0.4: M3

a. Determine if the automaton accepts the strings abab and aabaab.


b. Determine if the automaton accepts the strings abbb and abbaab.
c. Describe the language accepted by the automaton.

7. Construct a state diagram of a finite automaton that accepts strings in


the alphabet Σ = {a, b} of length up to 3.
8. For each of the following languages L ⊆ {a, b}∗, find a regular expression
representing it:

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

10. Let Σ = {a, b}. Show that

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.

14. Describe the language L = L(G) where G has the productions S →


aA, A → bbA, A → c.
15. Describe the language L = L(G) where G has the productions S →
aSb, Sb → bA, abA → c.
16. Consider the grammar G = {V, Σ, R, S} where V = {S, A, B}, Σ = {a, b},
and the set of rules, R, is
• S→A
• S→B
• S → AB
• A → aA
• B → bB
• A→ǫ
• B→ǫ

a What language does G generate?


b Show that G is ambiguous.
c Can G be replaced by an equivalent unambiguous grammar? If yes,
what is the equivalent unambiguous grammar?

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→ǫ

Give a description of L(G) in English.

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.

20. Show that the collection of Turing-recognizable languages is closed under


the operation of (a) union, (b) concatenation, (c) star, (d) intersection.

21. Consider the language L = {an b2n |n = 0, 1, 2, · · · }. Construct a pushdown


automaton that accepts it.

22. Consider the following pushdown automaton


state input top of stack δ(q, x, s)
q0 a ǫ (q0 , a)
q0 b a (q1 , ǫ)
q1 b a (q1 , ǫ)
q1 a a (q1 , ǫ)
where q0 is the initial state and q1 is the accept state.

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.

23. Consider the following pushdown automaton


state input top of stack δ(q, x, s)
q0 a ǫ (q0 , c)
q0 b ǫ (q0 , c)
q0 b ǫ (q1 , ǫ)
q1 a c (q1 , ǫ)
q1 b c (q1 , ǫ)
where q0 is the initial state and q1 is the accept state.

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:

a {S → ABC, S → a, A → aAaa, A → ǫ, B → bBbb, B → ǫ, C →


cCa, C → c}
b {S → aSa, S → AB, S → a, A → CC, A → aaA, A → ǫ, B →
bBb, B → ǫ, C → cCc, C → ǫ}

25. Find the context-free grammar for the language L = {an bn am bm |n, m =
0, 1, 2, · · · }.

26. Short answers:

(a) Define the following terms and concepts:


i. Union, intersection, set concatenation, star, set subtraction, com-
plement
ii. A set S is closed under an operation f
iii. Regular language
iv. Kleene’s theorem
v. Context-free language
vi. Chomsky normal form
vii. Church-Turing Thesis
viii. Turing-decidable language
ix. Turing-recognizable language
x. co-Turing-recognizable language
xi. Countable and uncountable sets
xiii. Function f (n) is O(g(n))
xiv. Classes P and N P
(b) Give the transition functions δ of a DFA, NFA, PDA, Turing machine
and nondeterministic Turing machine.

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.

You might also like