You are on page 1of 36

What is Automata

Courtesy Costas Busch - RPI 2


Computation
CPU
memory
Courtesy Costas Busch - RPI 3
CPU
input memory
output memory
Program memory
temporary memory
Courtesy Costas Busch - RPI 4
CPU
input memory
output memory
Program memory
temporary memory
3
) ( x x f =
compute x x -
compute
x x -
2
Example:
Courtesy Costas Busch - RPI 5
CPU
input memory
output memory
Program memory
temporary memory
3
) ( x x f =
compute x x -
compute
x x -
2
2 = x
Courtesy Costas Busch - RPI 6
CPU
input memory
output memory
Program memory
temporary memory
3
) ( x x f =
compute x x -
compute
x x -
2
2 = x
4 2 * 2 = = z
8 2 * ) ( = = z x f
Courtesy Costas Busch - RPI 7
CPU
input memory
output memory
Program memory
temporary memory
3
) ( x x f =
compute x x -
compute
x x -
2
2 = x
4 2 * 2 = = z
8 2 * ) ( = = z x f
8 ) ( = x f
Courtesy Costas Busch - RPI 8
Automaton
CPU
input memory
output memory
Program memory
temporary memory
Automaton
Courtesy Costas Busch - RPI 9
Different Kinds of Automata
Automata are distinguished by the temporary memory

Finite Automata: no temporary memory

Pushdown Automata: stack

Turing Machines: random access memory
Courtesy Costas Busch - RPI 10
input memory
output memory
temporary memory
Finite
Automaton
Finite Automaton
Example: Vending Machines
(small computing power)
Courtesy Costas Busch - RPI 11
input memory
output memory
Stack
Pushdown
Automaton
Pushdown Automaton
Example: Compilers for Programming Languages
(medium computing power)
Push, Pop
Courtesy Costas Busch - RPI 12
input memory
output memory
Random Access Memory
Turing
Machine
Turing Machine
Examples: Any Algorithm
(highest computing power)
Courtesy Costas Busch - RPI 13
Finite
Automata
Pushdown
Automata
Turing
Machine
Power of Automata
Less power More power
Solve more
computational problems
Courtesy Costas Busch - RPI 14
Languages
Courtesy Costas Busch - RPI 15
A language is a set of strings

String: A sequence of letters

Examples: cat, dog, house,

Defined over an alphabet:

{ } z c b a , , , , = E
Courtesy Costas Busch - RPI 16
Alphabets and Strings
We will use small alphabets:

Strings

abba w
bbbaaa v
ab u
=
=
=
{ } b a, = E
b aaabbbaaba
baba
abba
ab
a
Courtesy Costas Busch - RPI 17
String Operations
m
n
b b b v
a a a w

2 1
2 1
=
=
bbbaaa
abba
m n
b b b a a a wv
2 1 2 1
=
Concatenation
abbabbbaaa
Courtesy Costas Busch - RPI 18
1 2
a a a w
n
R
=
n
a a a w
2 1
=
ababaaabbb
Reverse
bbbaaababa
Courtesy Costas Busch - RPI 19
String Length


Length:


Examples:

n
a a a w
2 1
=
n w =
1
2
4
=
=
=
a
aa
abba
Courtesy Costas Busch - RPI 20
Length of Concatenation



Example:
v u uv + =
8 5 3
8
5 ,
3 ,
= + = + =
= =
= =
= =
v u uv
aababaab uv
v abaab v
u aab u
Courtesy Costas Busch - RPI 21
Empty String
A string with no letters:


Observations:


c ,
abba abba abba
w w w
= =
= =
=


0
Courtesy Costas Busch - RPI 22
Substring
Substring of string:
a subsequence of consecutive characters

String Substring
bbab
b
abba
ab
abbab
abbab
abbab
abbab
Courtesy Costas Busch - RPI 23
Prefix and Suffix

Prefixes Suffixes


abbab
abbab
abba
abb
ab
a

b
ab
bab
bbab
abbab
uv w=
prefix
suffix
Courtesy Costas Busch - RPI 24
Another Operation



Example:


Definition:

n
n
w ww w =
( ) abbaabba abba =
2
=
0
w
( ) =
0
abba
Courtesy Costas Busch - RPI 25
The * Operation
: the set of all possible strings from
alphabet






* E
E
{ }
{ } , , , , , , , , , *
,
aab aaa bb ba ab aa b a
b a
= E
= E
Courtesy Costas Busch - RPI 26
The + Operation
: the set of all possible strings from
alphabet except






+
E
E
{ }
{ } , , , , , , , , , *
,
aab aaa bb ba ab aa b a
b a
= E
= E
E = E
+
*
{ } , , , , , , , , aab aaa bb ba ab aa b a = E
+

Courtesy Costas Busch - RPI 27


Languages
A language is any subset of

Example:



Languages:

* E
{ }
{ } , , , , , , , , *
,
aaa bb ba ab aa b a
b a
= E
= E
{ }
{ }
} , , , , , {
, ,
aaaaaa ab aa baba abba
aab aa a

Courtesy Costas Busch - RPI 28


Note that:
} { } { = = C
0 } { = C =
1 } { =
0 =
Sets
Set size
Set size
String length
Courtesy Costas Busch - RPI 29
Another Example

An infinite language
} 0 : { > = n b a L
n n
aaaaabbbbb
aabb
ab

L e L abbe
Courtesy Costas Busch - RPI 30
Operations on Languages
The usual set operations





Complement:

{ } { }
{ } { }
{ } { } { } aaaa a ab bb aaaa ab a
ab ab bb aaaa ab a
aaaa bb ab a ab bb aaaa ab a
, , , ,
} { , , ,
} , , , { , , ,
=
=
=

L L E = *
{ } { } , , , , , , , aaa bb ab aa b ba a =
Courtesy Costas Busch - RPI 31
Reverse

Definition:

Examples:
} : { L w w L
R R
e =
{ } { } abab baa ba baba aab ab
R
, , , , =
} 0 : {
} 0 : {
> =
> =
n a b L
n b a L
n n R
n n
Courtesy Costas Busch - RPI 32
Concatenation

Definition:



Example:
{ }
2 1 2 1
, : L y L x xy L L e e =
{ }{ }
{ } baaa bab abaa abb aaa ab
aa b ba ab a
, , , , ,
, , ,
=
Courtesy Costas Busch - RPI 33
Another Operation
Definition:





Special case:

n
n
L LL L =
{ } { }{ }{ }
{ } bbb bba bab baa abb aba aab aaa
b a b a b a b a
, , , , , , ,
, , , ,
3
= =
{ }
{ } { }

=
=
0
0
, , aaa bba a
L
Courtesy Costas Busch - RPI 34
More Examples

} 0 : { > = n b a L
n n
} 0 , : {
2
> = m n b a b a L
m m n n
2
L aabbaaabbbe
Courtesy Costas Busch - RPI 35
Star-Closure (Kleene *)

Definition:


Example:





2 1 0
* L L L L =
{ }

=
, , , ,
, , , ,
, ,
,
* ,
abbbb abba aabb aaa
bbbb bba abb aa
bb a
bb a

Courtesy Costas Busch - RPI 36


Positive Closure

Definition:
{ } =
=
+
*
2 1
L
L L L
{ }

=
+
, , , ,
, , , ,
, ,
,
abbbb abba aabb aaa
bbbb bba abb aa
bb a
bb a

You might also like