1 1 1 FiniteAutomata
1 1 1 FiniteAutomata
1 1 1 FiniteAutomata
Finite Automata I
1. Regular Languages
• Deterministic FA
• Non-Deterministic FA
• NFA = DFA
• ε-NFA
• ε-NFA = NFA
Objectives
push
Start off on
push
Car Audio System (Homework)
On/Off
AM
Stop
mode
AM Hints:
Seek
mode • How to model modes (AM/ FM)?
• How to model the change
system states?
Types of Finite Automata
start q1 q2
0,1
M1: 0 1
1 0
q1 q2 q3
0, 1
1 0
q1 q2 q3
0, 1
1 0
q1 q2 q3
0, 1
q1 q2 q3
0, 1
010: reject
11: accept
0110100: accept
010000010010: reject
Remember!
start q1 q2
0,1
δ vs. δ* ?
δ* : an extended Transition
function for any possible string
formed in the language.
Formal Definition of Computation
Let M be a DFA
• Among all possible strings, M will
accept some of them, and M will
reject the remaining
• The set of strings which M accepts is
called the language recognized by M
• That is, M recognizes A if
A = { w | M accepts w }
Language of an FA
0 0
1
4. Assign the transitions from one
possibility to another upon reading qeven qodd
a symbol.
1
Example 1 (Cont’d)
0 0
1
5. Set the start and accept states.
qeven qodd
1
Example 2
Examples:
Decimal 2 4 6 8 10 12 14
Binary 10 100 110 1000 1010 1100 1110
Designing a DFA
Now, the designed DFA is:
0
Exercise 1
• Answer:
• Even number of 0s and Even number of 1s.
• Even number of 0s and odd number of 1s.
• Odd number of 0s and even number of 1s.
• Odd number of 02 and odd number of 1s.
• Then:
• We need 4 state for each combination:
{q00, q10, q01, q11}
Exercise 1 (Cont’d)
q00 q01
0 1 0 0
0
1
q10 q11
1
Exercise 2
• Then:
• We need 4 state for each possibility:
{q, q0, q00, q001}
Example 2
1
1.1 Finite Automata
• Deterministic FA
• Non-Deterministic FA
• NFA = DFA
• ε-NFA
• ε-NFA = NFA
Nondeterministic Finite Automata
0, 1
M2:
0 1
q0 q1 q2
How an NFA computes?
0, 1
0 1
q0 q1 q2
q0 q0 q0 q0 q0 q0
q1 q1 q1
(die)
q2 q2
(die)
Input: 0 0 1 0 1
Formal Definition of NFA
start
1 0, ε 1
q1 q2 q3 q4