Formal Languages and Automata
1
Introduction cont.
• In theoretical computer science, automata theory is
the study of abstract machines (abstract 'mathematical'
machines or systems) and the computational problems
that can be solved using these machines. These
abstract machines are called automata.
2
Why we study?
• Represent the foundation and principles of computer
science.
• Useful in subsequent courses.
• Example: Turing machines (the model of computer
programs and computers), and understanding Turing
machines allows us to understand what they are good
at, less good at …….
3
• Each model in automata theory plays
important roles in several applied areas.
Finite automata are used in text processing,
compilers, and hardware design. Context-
free grammar (CFGs) are used in
programming languages and artificial
intelligence. Originally, CFGs were used in
the study of the human languages.
4
Introduction
• This introductory course on
• formal languages and grammars
• Automata theory
• Computability
• Complexity
These topics constitutes the theoretical foundation of
computer science.
5
Introduction cont.
• We can think of automata, grammars, and
computability as the study of what can be done
by computers in principle, while complexity
addresses what can be done in practice.
• We focus on the first concern.
6
Introduction cont.
• We will study various automata, see how they
are related to languages and grammars and
investigate what can and cannot be done by
digital computers.
7
Introduction cont.
• Automaton (plural automata) is a
construct that possesses all the
indispensable features of a digital
computer. It accepts input and produces
output. May have some temporary storage.
8
Introduction cont.
• Formal language is an abstraction of a general
characteristics of programming languages. It
consists of a set of symbols and some rules of
formation by which these symbol can be
combined into entities called sentences.
9
Models of Computation
10
Computation
CPU memory
11
temporary memory
input memory
CPU
output memory
Program memory
12
3
Example: f ( x) x
temporary memory
input memory
CPU
output memory
Program memory
compute xx
2
compute x x
13
3
f ( x) x
temporary memory
input memory
x2
CPU
output memory
Program memory
compute xx
2
compute x x
14
3
temporary memory f ( x) x
z 2*2 4
f ( x) z * 2 8
input memory
x2
CPU
output memory
Program memory
compute xx
2
compute x x
15
3
temporary memory f ( x) x
z 2*2 4
f ( x) z * 2 8
input memory
x2
CPU
f ( x) 8
Program memory output memory
compute xx
2
compute x x
16
Automaton
temporary memory
Automaton
input memory
CPU
output memory
Program memory
17
Different Kinds of Automata
Automata are distinguished by the temporary memory
• Finite Automata: no temporary memory
• Pushdown Automata: stack
• Turing Machines: random access memory
18
Finite Automaton
temporary memory
input memory
Finite
Automaton
output memory
Example: Vending Machines
(small computing power)
19
Pushdown Automaton
Stack Push, Pop
input memory
Pushdown
Automaton
output memory
Example: Compilers for Programming Languages
(medium computing power)
20
Turing Machine
Random Access Memory
input memory
Turing
Machine
output memory
Examples: Any Algorithm
(highest computing power)
21
Power of Automata
Finite Pushdown Turing
Automata Automata Machine
Less power More power
Solve more
computational problems
22