Formal Languages and Automata Theory
Homework # 3
For each of the following, give a DFA that accepts the specied language. Exercises to be
handed in from Part I include 1,3 and 28. Exercises to be handed in from Part II include 4 and 6.
Part I
1. The set
Deterministic Finite State Automata (DFA)
0
1
1
0
0
.
Finite
Control
One-way, infinite tape, broken into cells
One-way, read-only tape head.
Finite control, i.e., a program, containing the position of the read head,
current symbol being scanned, and the c
Formal Languages and Automata Theory
Homework # 2
Prove each of the following. Exercises to be handed in included 1, 11, and give 16 a try.
1. Prove that the set cfw_x | x 1 and x is odd is countably innite.
2. Prove that the set cfw_x | x 0 is countably
Mathematical Induction
An inductive proof has three parts:
Basis case
Inductive hypothesis
Inductive step
Related to recursive programming.
1
Theorem:
n
i
i
1
n(n 1)
2
For all n>=1.
Proof #1: (by induction on n)
Basis:
n=1
1
1(1 1)
i
2
i
1
1=1
2
Induc
Course Overview
What does the term compute mean?
What does the term computer mean?
Is there anything that a computer cannot do?
These are the kinds of questions that will be addressed in this course.
As you will see, the answers to these questions are ver
Context-Free Languages
The class of context-free languages generalizes the class of regular languages, i.e., every
regular language is a context-free language.
The reverse of this is not true,i.e., every context-free language is not necessarily regular.
F
CPSC 4083/5210
Homework # 4
For problems 1-26, give a regular expression that accepts the specied language. Note that
these are the same problems from homework #3. Exercises to be handed in include 1,3, and 10.
1. The set of strings over cfw_a, b, c in wh
Answer to Question #3, Homework #6
The basic idea is to repeatedly compare bits from the number to the left of the #, to the corresponding bits from
the number to the right of the #. The algorithm starts with the highest order bits of the two numbers, and
t" a pd"d
u f% cf
o
0gs%"cdgo 0"d! w%"eo ' a ep a "d aq
% c
c
% s c r cf c
chd'%w"eo ' a c4 a "ud
s os s i u c % s
r %c o cf f
d!r!m~ AjSAzd 8 5 1 ( gd a )dd! Irf
% s c s c
f %
u 8 1 c % cf %
'0`%y!dd a x"'Verf
u
'%1
!cdp %V8d%!d a Sq p h!
Pumping Lemma for Regular Languages
Lemma: (the pumping lemma)
Let M be a DFA with |Q| = n states, and let x be a string in L(M), where |x| >= n.
Then x = uvw, where u,v, and w are all in * and:
1<= |uv| <= n
|v| >= 1
uviw is in L(M), for all i >= 0
No
Background Information for the Pumping
Lemma for Context-Free Languages
Definition: Let G = (V, T, P, S) be a CFG. If every production in P is one of the following
two forms:
A > BC
A > a
where A, B and C are all in V and a is in T, then G is in Chomsky N
Formal Languages and Automata Theory
Homework # 1
Prove each of the following by induction. You should explicitly state the basis, inductive
hypothesis, and the inductive step in each proof. Also indicate whether 1 st (weak) or 2nd (strong)
form is used o
Formal Languages and Automata Theory
Homework #5
Virtually all of the exercises from Chapter 5 of the text are relevant. I would recommend
you give as many as you can a try. Similarly, a CFG could be developed for any of the
languages from any of the prev
Formal Languages and Automata Theory
Homework #6
1) Construct a Deterministic Turing Machine for each of the following.
(a) cfw_w | w is in cfw_0,1* and w ends in 00
(b) cfw_w | w is in cfw_0,1* and w contains at least 2 0s
(c) cfw_w | w is in cfw_0,1* an
Definitions
Symbol An atomic unit, such as a digit, character, lower-case letter, etc.
Sometimes a word.
Alphabet A finite set of symbols, usually denoted by .
= cfw_0, 1
= cfw_0, a, 4
= cfw_a, b, c, d
String A finite length sequence of symbols, presum
FPFrvB6FpCGdP6C 'G6CgUG'B9
7 9 v uEs9 7 rp E R 4p 74 a 7E A
U!#424UC7vGB7P6GQECBUdrDDPrd9vU!eCGUQGdUBCP6CG'G'Q!y 6CF7U
e s
E9 rp 9 A9 u 7E c r 9 vU 7rp u 7E u 7E c q h h 4p v
9I
8mR~ Ergd4rH8F7zqC'z8B9m 'W 87dd8Bl8FuBCP6g8A
D v I 4A o W
H vs9U 4 A9
Pushdown Automata (PDA)
Informally:
Questions:
A PDA is an NFA- with a infinite stack.
Transitions are modified to accommodate stack operations.
What is a stack?
How does a stack help?
A DFA can remember only a finite amount of information, whereas a PDA
Turing Machines (TM)
Generalize the class of CFLs:
Recursively Enumerable Languages
Recursive Languages
Context-Free Languages
Regular Languages
Note that there are non-recursively enumerable languages.
1
Another Part of the Hierarchy:
Recursively Enumera
Operations on Languages
Let L, L1, L2 be subsets of *
Concatenation: L1L2 = cfw_xy | x is in L1 and y is in L2
Concatenating a language with itself:
L0 = cfw_
Li = LLi-1, for all i >= 1
Kleene Closure:
L* =
Li = L0 U L1 U L2 U
i
0
Positive Closure:
Li =