Automata
Automata
Finite Automata
A formal System
A → initial State
0 → Input
C → next State
Start State → q0
Final State → F
Strings vs Language
States\inputs 0 1 Transition
→ A A B δ(A,0) = A δ(A,1) = B
B A C δ(B,0) = A δ(B,1) = C
*C C C δ(C,0) = C δ(C,1) = C
We know what happens when we give one input to a state it will move to another state but in
extended transitions, we will provide more than one input and then we need to find the transition of the
state to the corresponding inputs.
δ^(B,00) → δ(δ(B,0),0) = δ(A,0) = A → here we know that when we give 0 to the state B it
will move to state A, and then we will consider the next
input based on the current state A.
Language of a DFA
| → Such that
Regular Language
Ex: Square number set, all natural numbers, real numbers, etc.
L(A) = {01,0011,000111,00001111, 0000011111…} this never ends and therefore this is a no regular
language
Main thing here is the non-determinism. Unlike in DFA a here we can transit to different states based in a
single input. As a result, we cannot determine the next state correctly.
1 2 3 B W
1 2,4 5
2 4,6 1,3,5
4 5 6 3 2,6 5
4 2,8 1,5,7
7 8 9 5 2,4,6,8 1,3,7,9
6 2,8 3,5,9
7 4,8 5
8 4,6 7,5,9
9 8,6 5
A → initial State
0 → Input
C → next State
Start State → q0
Final State → F
DFA can be changed into NFA which accepts the same language.
NFA to DFA
B W B W
1 2,4 5 →{1} {2,4} {5}
2 4,6 1,3,5 {2,4} {2,4,6,8} {1,3,5,7}
3 2,6 5 {5} {2,4,6,8} {1,3,7,9}
4 2,8 1,5,7 {2,4,6,8} {2,4,6,8} {1,3,5,7,9}
5 2,4,6,8 1,3,7,9 {1,3,5,7} {2,4,6,8} {1,3,5,7,9}
6 2,8 3,5,9 *{1,3,7,9} {2,4,6,8} {5}
7 4,8 5 *{1,3,5,7,9} {2,4,6,8} {1,3,5,7,9}
8 4,6 7,5,9
9 8,6 5
Do the math
Proof of equivalence
δN(q0,w) = δD({q0},w)
if w = ε (empty set)
δN(q0,w) = q0
δD({q0},w) = {q0}
assume that w = x (length x)
δN(q0,x) = δD({q0},x) = F
Closure of a state → set of states we can reach from state q by following arcs labeled ε.
CL(A) = {A}
CL(E) = {E,B,C,D}
Extended delta of NFA
δ^(A,01) = del(del(A,0),1)
0 1
0 1 ε
A {E} {B}
B Φ {C} {D}
C φ {D}
C φ {D} Φ
D φ Φ
D φ Φ Φ E {F} {C,D}
E {F} Φ {B,C}
F {D} φ
F {D} φ φ
Do the math
= del(B,0) U del(D,0) ➔ φ U φ = φ
= del(B,1) U del(D,1) ➔{C} U φ = {c}
Procedure
Get ε-NFA → Identify Interesting States → Calculate Closure → Find the Transitions for 1 and 0 (inputs)
If the closure of any ε state have the final state then it will become an accepting state.
Operations on languages
3 operations
Definition:
Induction 1
Induction 2
We should show that for each RE there is a finite automaton that accepts the same language
Symbol a
Union
a+b
concatenation
a.b
Kleen star
Questions
Regular Expressions – IF, While, For loops, somethings from programming, etc.
if(x>0):
while(. {a..z+1..9+<>,..}*.){}
Regular Expressions
{a,b,c}*.ab.{a,b,c}*
Alphabet {0,1} strings which does not accpect things with 2 consecutive 11’s