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
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 =
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
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
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!
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
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
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
Definitions
Symbol An atomic unit, such as a digit, character, lower-case letter, etc.
Sometimes a word. [Formal language does not deal with the meaning of
the symbols.]
Alphabet A finite set of symbols, usually denoted by .
= cfw_0, 1
= cfw_0, a, , 4
Course Overview
What does the term compute mean?
What does the term computer mean?
Is there anything that a computer cannot do?
Such highly theoretical questions lead one to ask:
Why does one need to study formal languages and automata theory?
What are
Diagonalization
Fact: Many books exist.
Fact: Some books contain the titles of other books within them.
Fact: Some books contain their own titles within them.
Consider the following book with title The Special Book.
The Special Book is defined to be a boo
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
Relations and Functions
Let A and B be two sets. The cartesian product of A and B, denoted A X B, is dened
to be the set
cfw_(a,b) l a EAandbEB
For example, if A = cfw_a, b, c and B = cfw_a, c, d, then
cfw_(m); (1:0); (Ind); (541); (5:0); (IUD: (ea); (0:0
Introduction to Formal Languages and Automata Theory
CSE 4083
Instructor: Debasis Mitra, Ph.D.
Office: Harris Building 325
Email: dmitra at cs. fit. edu
Website: www.cs.fit.edu/~dmitra/FormaLang, follow the info on table ./12Spr/TabularPlan2012.doc
Office
Background Information for the Pumping
Lemma for Context-Free Languages
Definition: Let G = (V, T, P, S) be a CFL. If every production in P is of the form
A > BC
A > a
or
where A, B and C are all in V and a is in T, then G is in Chomsky Normal Form (CNF).
Pushdown Automata (PDA)
Informally:
Questions:
A PDA is an NFA- with a 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 can
remem
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