Finite Automata?
Finite Automata?
Finite Automata?
06/25/22 TOA 1
FINITE AUTOMATA EXAMPLE
Elevators
Vending Machines
String Matching
06/25/22 TOA 2
FINITE AUTOMATA
Language Recognizers
Machines embedded with grammatical rules that
recognize a language
Automated language recognition
REs define a language and FAs accept (or reject )
them
FAs serve two purposes
Implicit language definition
Recognition
FINITE AUTOMATA
A finite set of transitions that tell for each state and for each letter of the input
alphabet which state to go to next
FINITE AUTOMATON
The start state marks the beginning of reading every
input
Reading a character triggers a transition from that state
which may transfer control to some other state and the
reading mechanism advances to next character and the
process continues
When the input terminates, if the control is left with a
final or accepting state, the input string is accepted
otherwise it is rejected and the FA resets control to the
initial state for next input
FINITE AUTOMATON
The state to go to next on reading a letter of the input
Visual representations
States represented by circles labeled to identify each distinctly
a
b
b
-1 +2
a
CHARACTERISTICS OF FA
06/25/22 TOA 17
FINITE AUTOMATA
06/25/22 TOA 18
FINITE AUTOMATA
06/25/22 TOA 19
FINITE AUTOMATA
06/25/22 TOA 20
FINITE AUTOMATA
06/25/22 TOA 21
FINITE AUTOMATA
06/25/22 TOA 22
DESIGN FINITE AUTOMATA
Given some language, design a finite automaton
that recognizes it.
• A = {w| w contains the string 001 as a substring}
• 001, 010001, 11100101 are all in the language
• 0101, 11100, 0000 are not.
• “Think as an automaton”
1. As symbols come in, initially skip over all 1s.
2. As a 0 comes in, it might be the first of the substring 001
3. If a 1 comes in, go back to skipping over 1s; if a 0 comes in,
it might be the second of the substring 001
4. If a 1 comes in, we see the substring, if a 0 comes in, it
might be the second of the substring
06/25/22 TOA 23
LANGUAGES OF FA
GRAPHS
DETERMINISTIC FA (DFA)
No missing edges
NFA
Reduces number of states and transitions
Costly execution
Needs concurrent processing to find a successful path
Rejection
Either machine crashes on input or ]
No successful path exists
NFA
Examples
An NFA that accepts the language {bb, bbb}
ε- Transitions
character
q1 a q2
a
Start
q0
a
q3
Example: Accepting
a a
q1 a q2
a
Start
q0
a
q3
Example: Accepting
a a
First choice q1 a q2
a
Start
q0
a
Parallel Processing
Second choice q3
Example: Accepting
a a
q1 a q2
a
Start
q0
a
q3 No transition so leave it
Example: Accepting
a a
a a a
q1 a q2
a
Start
q0
a
q3
Example: Rejecting
a a a
q1 a q2
a
Start
q0
a
q3
Example: Rejecting
a a a
q1 a q2
a
Start
q0
a
q3 No transition
Example: Rejecting
a a a
q1 a q2 No transition so leave
the state
a
Start
q0 Since there is no current state or
a accepting state therefore, NFA will
“Reject” the input string.
q3
Language of the NFA
L {aa}
q1 a q2
a
Start
q0
a
q3
TRANSITION GRAPHS
a,b
aa,bb
-1 2
aa,bb
+3
EXAMPLES
The arc from state 1 to state 2 is labeled with the string
aa, which is not a single letter.
There are two arcs leaving state 2 labeled with b.
There is no arc leaving state 2 labeled with a.
There is an arc from state 1 to state 3 labeled with ,
which is not a letter from .
There is no arc leaving state 3 labeled with b.
TRANSITION GRAPHS
Examples
All words that have al least one double letter in them
All words that begin and end with different letters
All words in which a occurs only in even clumps and that end in three or more bs
All words that have even number of letters
GENERALIZED
TRANSITION
a*
GRAPHS
a*
(ba +a)* (b + Λ)
-1 2 3
Examples
All words having even number of as and bs
All words having as in clumps of even numbers and end at one or more bs