Sunteți pe pagina 1din 12

1

Theory of Automata
Chapter 1
Theory of Automata Theory of Automata
Chapter 1 Chapter 1
by by
Abdus Abdus Salam Salam
Chapter 1 2
Class Policy
Grading
2 3 assignments (10)
Programming component
Mid-term exam (15)
Closed books, closed notes
3 4 quizzes (10)
Attendance and class participation (5)
Final exam (70)
Closed books, closed notes
Assignments
due at the beginning of the class
10% penalty for each day of delay, up to 3 days
2
Chapter 1 3
Recommended Book(s)
Text Book(s):
Sikander H. Khiyal, Theory of Automata and
Computation, National Book Foundation, 2004
Reference Book(s):
John E. Hopcroft, Rajeev Motvani, and Jeffrey D.
Ullman, Introduction to Automata theory,
Languages and Computation, Second Edition,
Addison-Wesley, New York, 2001.
Daniel I. A. Cohen, Introduction to Computer
Theory, Second Edition.
K.L.P. Mishra, N. Chandrasekaran, Theory of
Computer Science (Automata, Languages and
Computation), Prentice-Hall of India, 2002.
Chapter 1 4
Introduction
In automata theory we consider a
mathematical model of computing.
Such a model strips the computational
machinerythe programming language
down to the bare minimum, so that its easy
to manipulate these theoretical machines
(there are several such models, for different
purposes, as youll soon see) mathematically
to prove things about their capabilities.
3
Chapter 1 5
Introduction
The point of this study is that the
mathematical models are equivalent to
real computers and real programming
languages.
What this means is that any problem
that can be solved on a real computer
can be solved using these models, and
vice versa.
Chapter 1 6
Background
Automata theory is the study of
abstract computing devices, or
machines.
Allan Turing in the 1930s.
In the 1940s and 1950s, simpler kinds
of machines, which we today call
finite automata, were studied by a
number of researchers.
These automata, originally proposed to
model brain function.
4
Chapter 1 7
Background
In the late 1950s, the linguist Noam
Chomsky begun the study of formal
grammars.
In 1969, S. Cook extended Turings study
of what could and what could not be
computed.
The later class of problems is called
intractable, or NP-hard.
Chapter 1 8
Lets Play a Game!
In this game the computer has a rule in mind. You
type in strings of letters, using only the letters A,
B, and C. The computer tells you whether each
string follows the rule or not. Your job is to guess
the rule.
e.g., suppose you have done these experiments:
accepted rejected
ABC CBA
AAA BBB
ABCABCABC BCABCABC
A BBBBBBB
ACCCCCCCCC CAAAAAAAAA
GUES The Language
5
Chapter 1 9
Why Study Automata Theory?
Finite automata are a useful model for many
important kinds of hardware and software.
e.g.
Software for designing digital circuits.
Lexical analyzer of a compiler.
Searching for keywords in a file or on the Web.
Software for verifying finite state systems, such
as communication protocol.
Operating System (UNIX grep)
Text Editors
Markup Languages (HTML, XML)
Chapter 1 10
Formal languages
By formal we don't mean dressed up, we
mean languages with a form defined by rules
that say which strings are in the language
and which are not. We are only interested in
syntax here, not semantics. We are
interested in the form of a string of
symbols, not the meaning of the string.
6
Chapter 1 11
Types of Formal
Languages
Regular languages (type-3)
Context-free languages (type-2)
Context-sensitive languages (type-1)
Phrase structure languages (type-0)
Language Generators
Language Recognition
Chapter 1 12
Phrase-Structure Languages
Context Sensitive Languages
Context-Free Languages
Regular Languages
DFA
NFA
-NFA
RE
PDA CFG
LBA CSG
TM PSG
Type-3
Type-2
Type-1
Type-0
Acceptor
Generator
7
Chapter 1 13
Central Concepts
Alphabet
An alphabet is a finite, nonempty set of
symbols, (sigma) is used for an alphabet.
For example
{0, 1} is an alphabet with two symbols
{a, b} is another alphabet with two
symbols, and
English alphabet is also an alphabet
= {0,1}, or = the binary alphabet
= {a,b,..z}, or =the set of all lower-case
letters
Chapter 1 14
Central Concepts
String
A string is a finite sequence of symbols
chosen from some alphabet. e.g. 01101 is a
string from the binary alphabet = {0,1}.
The number of symbols in a string is
called the length of a string. e.g. 011101
has length 5 and the number of symbols
are 2. The standard notation for the
length of a string w is |w|. e.g. |011| = 3
and | | = 0
8
Chapter 1 15
Central Concepts
Strings
The empty string (also called null string) is the
string with length zero. That is, it has no symbols.
It is denoted with (epsilon), that may be chosen
from any alphabet whatsoever. Thus | | = 0.
Powers of an Alphabet: If is an alphabet, we
define
k
to be the set of strings of length k, each
of whose symbols is in . e.g.
0
= {}. If = {0,1},
then

1
= {0,1}

2
= {00,01,10,11}

3
= {000,001,010,011,100,101,110,111}
The set of all strings over an alphabet is denoted as *.
For instance, {0,1}* = {,0,1,00,01,10,11,000,.}. Put
another way,

*
=
0
U
1
U
2
U
3
.

+
=
1
U
2
U
3
.
Chapter 1 16
Central Concepts
Strings
Concatenation of Strings: Let x and y be strings. Then xy
denotes the string obtained by concatenating x with y, that is,
xy is the string obtained by appending the sequence os
symbols of y to that of x. e.g. if x = aab and y = bbab, then xy
= aabbbab. Note that xy yx.
9
Chapter 1 17
Central Concepts
Languages
A language is a set of strings over an alphabet. Thus
{a, ab, baa} is a language (over alphabet {a, b}).
A set of strings all of which are chosen from some

*
, where is a particular alphabet, is called a
language. If is an alphabet, and L
*
, then L is a
language over .
An example is English, where the collection of legal English
words is a set of strings over the alphabet that consists of
all the letters.

Chapter 1 18
Examples of Languages
The language of all strings consisting of n 0s
followed by n 1s, for some n 0:
{, 01, 0011, 000111,..}
The set of strings of 0s and 1s with an equal
number of each:
{, 01,10,0011,0101,1001,..}
The set of binary numbers whose value is a
prime:
{10, 11, 101,111,1011..}
Note: The only important constraint on what can
be a language is that all alphabets are finite,
although they can have an infinite number of
strings.
10
Chapter 1 19
Graphs
A graph, denoted by G = (V, E), consists of
a finite set of vertices V and a set of
pairs of vertices E called edges. An
example of graph is shown below:
Here V={1,2,3,4,5} and E={(n,m)|n+m=4, or
n+m=7}
Directed graph?
1 3 2
4
5
Chapter 1 20
Trees
A tree is a digraph with the
following properties:
1. There is one vertex, called the root,
that has no predecessors and from
which there is path to every vertex.
2. Each vertex other than root has
exactly one predecessor.
3. The successors of each vertex are
ordered from the left.
11
Chapter 1 21
Set Notation
It is common to describe a language using
a set-notation:
{w | something about w }
It is read the set of strings w such that
(whatever is said about w to the right of
the vertical bar)
Examples are:
{ w | w consists of an equal number of 0s and 1s }
{ w | w is a binary integer that is prime }
{ w | w is a syntactically correct C++ program }
Chapter 1 22
Set-Notation as a way to
Define Languages
It is also common to replace w by
some expression with parameters
and describe the strings in the
language by stating conditions on
the parameters. For example:
1. { 0
n
1
n
| n 1}
2. {0
i
1
j
| 0 i j }
12
Chapter 1 23
Some Special Languages
The empty set is a language which has
no strings.
The set { } is a language which has one
string, namely . Though has no
symbols, this set has an object in it. So it
is not empty.
For any alphabet , the set of all strings
over is denoted by *. Thus a language
over alphabet is a subset of *.
Chapter 1 24
Operations on Languages
Since languages are sets, all the set operations
can be applied to languages.
Thus the union, intersection and difference of
two languages over an alphabet are languages
over . The complement of a language L over an
alphabet is * - L and it is also a language.
Another operation on a language is
concatenation. Let L
1
and L
2
be languages. Then
the concatenation of L
1
with L
2
is denoted as
L
1
L
2
and it is defined as
L
1
L
2
= ( xy | x L
1
and y L
2
}

S-ar putea să vă placă și