Lecture notes on automata, languages, and grammars
Cristopher Moore
February 6, 2012
Abstract
These lecture notes are intended as a supplement to Moore and Mertens The Nature of Computation, and
are available to anyone who wants to use them. Written solut
Section 9.2:
Solutions for all problems in the book.
*
Section 12.1:
3. See book solution
5. We will reduce the halting problem to problem A, i.e. deciding
whether or not a machine halts on all inputs. This will show that
problem A is undecidable (i.e. th
Section 7.2
Problem 4: Solution in the book.
Problem 5:
S -> aABB | aAA,
A -> aBB | a,
B -> bBB | A
We first need to convert the grammar to Griebach Normal Form. In
this case, the only rule that is not in the proper form is the unit
production B -> A.
Homework 6 Solutions:
Note that below when writing a grammar, we will often use the shorthand to
denote rules with the same left-hand-side. For example,
A -> aA
A -> lambda
will be denoted by
A -> aA | lambda
We use the following ascii notation below:
a^n
Homework 2 Solutions
CS 321
2.2.6
(q0 , 1010) = cfw_q0 , q2
(q1 , 00) =
2.2.7
L = cfw_ababn : n 0 cfw_aban : n 0
Start
a
q0
q1
a
b
q2
q3
a
q4
b
1
Start
q0
q1
b
a
2.2.10(a)
Find an nfa with three states that accepts the language
L = cfw_ an : n 1 cfw_
Homework 3 Solutions
October 24, 2013
Problem 2.3.1
Since no alphabet was specied we will perform the construction for both the
alphabet = cfw_a and alphabet = cfw_a, b.
For = cfw_a we get,
Start
a
S0
S012
a
where S0 = cfw_q0 and S012 = cfw_q0 , q1 , q2
Homework 1 Solutions
CS 321
1.2.6
Let L be any language on a non-empty alphabet. Show that L and L cannot
both be nite.
There are two possible cases: 1) when L is innite, and 2) when L is nite.
The rst case is trivial since if L is innite then it is by de