Introduction Automata
Theory
Chapt
er 1 -
1
Automata Theory models represent features at
the core of all computers and their applications.
To model the hardware of a computer, we
introduce the notion of an automaton (plural,
automata).
An automaton is a construct that possesses all
the indispensable features of a digital computer.
It accepts input, produces output, may have
some temporary storage, and can make
decisions in transforming the input into the
output.
A formal language is an abstraction of the
general characteristics of programming
languages.
A formal language consists of a set of symbols
and some rules of formation by which these
symbols can be combined into entities called
sentences.
Chapt
er 1 -
3
Example 1.1 --- an FA modeling an on/off
switch
push
start off on
push
Example 1.2 --- an FA modeling recognition
of the keyword “then” in a lexical analyzer
t h e n
start t th the then
The double circles specify the final or “accepting
state.”
Chapt
er 1 -
4
Structural Representation
Two other models (not automaton-like)
Grammar --- processing data with a recursive
structure
E.g., grammatical rule E E + E for generating
arithmetic expressions
Regular expression --- describing text strings
E.g., UNIX-style regular expression
’[A-Z][a-z]*[ ][A-Z][A-Z]’ describes Ithaca NY, Lafayette IN…
Chapt
er 1 -
5
Automata and Complexity
What can a computer do? ---
Computability:
Studying problems which can be solved by
computer, called decidable problems.
Decidability is the main topic in computability.
Chapt
er 1 -
6
Three basic concepts
Alphabet --- a set of symbols
Strings --- a sequence of symbols from an
alphabet
Language --- a set of strings from the same
alphabet
Chapt
er 1 -
7
Alphabets
Definition ---
An alphabet is a finite,
finite
nonempty set of symbols.
Conventional notation ---
Chapt
er 1 -
8
Alphabets
The term “symbol”
symbol is usually undefined.
Examples ---
Binary alphabet
a, b, …, z} …
Chapt
er 1 -
9
Strings
Definition ---
A string (or word) is a finite sequence
of symbols from an alphabet.
Example ---
1011 is a string from alphabet
Chapt
er 1 -
10
Strings
Empty string --- a string with zero occurrences
of symbols
Length |w| of string w --- the number of positions
for symbols in w
Examples --- |0111|=4, ||=0, …
Chapt
er 1 -
11
Strings
Power of an alphabet k ---
a set of all strings of length k
Examples ---
given we have
= {
2 = {00, 01, 10, 11}
Supplemental --- 10 = (01)0 = …
Chapt
er 1 -
12
Strings
Set of all strings over --- denoted as
It is not difficult to know that
∪ ∪ ∪ …
Strings
set of nonempty strings from
Therefore, we have
∪ ∪ ∪…
∪
Chapt
er 1 -
14
Strings
Concatenation of two strings x and y --- xy
Example ---
if x = 01101, y = 110,
110 then
xy = 01101110, xx = x= 0110101101, …
is the identity for concatenation
since w = ww.
Chapt
er 1 -
15
Strings (supplemental)
Power of a string ---
Defined by concatenation ---
xi = xx…x (x concatenated i times)
Defined by recursion ---
x0 = (by definition)
xi = xxi-1
Chapt
er 1 -
16
Languages
Definition ---
a language is a set of strings all
chosen from some *
If is an alphabet, and L*, then L is a
language over .
Chapt
er 1 -
17
Languages
Examples ---
The set of all legal English words is a
language. Why? What is the alphabet
here?
Answer: the set of all letters
A legal program of C is a language.
Why? What is the alphabet here?
Answer: a subset of the ASCII Chapt
characters. er 1 -
18
Languages
More examples of languages ---
The set of all strings of n 0’s followed by n 1’s for n
0:
{, 01, 0011, 000111, …}
* is an infinite language for any alphabet .
Chapt
er 1 -
19
Languages
More examples of languages (cont’d) ---
the empty language (not the empty string is a
language over any alphabet.
{} is a language over any alphabet (consisting of
only one string, the empty string ).
Chapt
er 1 -
20
Languages
Ways to describe languages (1/3) ---
Description by exhaustive listing ---
L1 = {a, ab, abc} (finite language; listed one by one)
L2 = {a, ab, abb, abbb, ...} (infinite language; listed
partially)
L3 = L(ab*) (infinite language; expressed by a regular
expression)
Chapt
er 1 -
21
Languages
Ways to define languages (2/3) ---
Description by generic elements ---
L4 = {x | x is over V = {a, b}, begins with a,
followed by any number of b, possible none}
(note: L4 = L3 = L2)
Chapt
er 1 -
22
Languages
Ways to define languages (3/3) ---
Description by integer parameters ---
L5 = {abn | n 0}
(note: L5 = L4 = L3 = L2)
*** bn = power of a symbol
Chapt
er 1 -
23
A
a Operations on Languages
(supplemental)(1/2)
(supplemental)
Languages are sets, and operations of sets
may be applied to them:
(1) union --- A∪B = {a | a A or a B}
(2) intersection --- A∩B = {a | a A and a B}
(3) difference --- A B = {a | a A and a Chapt
B}
er 1 -
24
A
a Operations on Languages
(supplemental)(2/2)
(supplemental)
Languages are sets, and operations of sets
may be applied to them:
(4) product --- A B = {(a, b) | a A and b B}
(5) complement --- Ā = {a | a U and a A}
(6) power set --- 2A = {B | B A}
Note: U is the universal set,
set like which is the
closure of an alphabet Chapt
er 1 -
25
A
More Operations on Languages
(supplemental)(1/2)
Concatenation of two languages L1 and L2
---
L1L2 = {x1x2 | x1 L1 and x2 L2}
Power of a language L ---
Defined directly ---
Lk = {x1x2…xk | x1, x2, …, xk L}
Defined by recursion ---
Chapt
L0 = {} er 1 -
26
A
More Operations on Languages
(supplemental)(2/2)
Closure of language L ---
L* = Li = L∪ L∪ L∪ …
i 0
Positive closure of a language L ---
L+ = L∪ L∪ …
It can be shown that L LL – {}
Chapt
er 1 -
when L 27
Problems
A problem in automata theory ---
a question of deciding whether a given string is a
member of some particular language.
That is, if is an alphabet, and L is a language
over , the problem L is:
given a string w in *, decide ifw L or not
Chapt
er 1 -
28
The basic terminologies used in Automata
Theory:- Alphabets, Strings,
Languages, and Grammar.
Symbols: Symbols are an entity or
individual objects, which can be any
letter, alphabet or any picture. E.g.: 1, a,
b, #
Alphabets: A finite set of non-empty
symbols. It is denoted by ∑ (sigma).
Examples: ∑ = {a, b} is the binary alphabet
∑ = {A, B, C, D} is the set of uppercase letters
String: a finite collection of symbols from the
alphabet. The string is denoted by w.
Example1: If ∑ = {a, b}, various string that
can be generated from ∑ are {ab, aa, aaa,
bb, bbb, ba, aba.....}.
o A string with zero occurrences of symbols is
known as an empty string. It is represented
by ε.
o The number of symbols in a string w is
called the length of a string. It is denoted
by |w|. Chapt
er 1 -
30
Example 2:
w = 010; Number of String |w| = 3
abcbz is a string over ? = {a, b, c, d… z}
11001011 is a string over ? = {0, 1}
)) ()(() is a string over ? = {(,)}
Language: A language is a collection of
appropriate string. A language which is formed
over Σ can be Finite or Infinite.
Example: 1
L1 = {Set of string of length 2}, L1 = {aa, bb,
ba, bb} Finite Language
Example: 2
L2 = {Set of all strings starts with 'a'}, L2= {a,
aa, aaa, abb, abbb, ababb} Infinite Language
Grammar
A grammar defines a set of rules, and with
the use of these rules, valid sentences in a
language are generated. Similar to English
language we have set of rules in automata,
which help us in creating sentences.