02 Toc
02 Toc
Recursive Languages
Context-Free Languages
Regular Languages
1
Finite Automata
• DFA
• NFA
M = (Q, Σ, δ, q0, F)
Intuitively, δ(q,s) is the state entered by M after reading symbol s while in state q.
3
𝛿: 𝑄 × Σ → 𝑄
• From each state and every input, there is exactly one transition.
Example:
0
1 𝛿= 0 1
0,1
𝑞1 𝑞2 1 𝑞3 𝑞1 𝑞1 𝑞2
0
𝑞2 𝑞1 𝑞3
𝑞3 𝑞3 𝑞3
DFA NFA
All states with all i/p exactly once Optional
• Multuple
a a
a
a
Mention explicitly the dead state permanently or May or May not
rejecting state or trap state
Every DFA is NFA May or May not
0 0,1
𝑞1 𝑞2 DFA
𝑞1 1
DFA
0,1
0,1 𝑞2
𝑞1
𝑞1 Not DFA DFA
0,1
0,1
1
0 𝑞2
0 𝑞1 Not DFA
𝑞1 𝑞2 Not DFA
0,1
0
0 0 0
0 1 𝑞2
𝑞1 𝑞2 Not DFA 𝑞1 DFA
1 1
1. L accepting nothing , Σ={a,b}
a,b
𝑞1
0,1
𝑞3
3. All strings where everything starts with a, Σ={a,b}
a,b
𝑞2 a 𝑞3
b
a,b
𝑞4
4. All strings ending with b.
a b
b 𝑞2
𝑞1
a
4. All strings starting with a and ending with b
a b
a b
𝑞1 𝑞2 𝑞3
b
a
a,b
𝑞4
• All strings of 0 and 1 where every string contains a duplicate bit.
L={00,11,00x,x00,11x,x11,……..}
0 𝑞2
0
0,1
𝑞1 0 1 𝑞4
1 𝑞3 1
• All strings of 0 and 1 where every string ends with a duplicate bit.
(0+1)*(00+11)
0
0 𝑞2
0
𝑞1 0 1
1
1
1
• All strings of 0 and 1 where starting and ending symbol is same
0(0+1)*0+1(0+1)*1
1
0 0
0 𝑞2 𝑞4
1
𝑞1
1 𝑞3 𝑞5
1
0
0
• All strings of a and b where length of each string is exactly 3