Formal Defn of an NFA
M = ( Q, Σ, δ, q0, F )
δ : Q × (Σ ∪ {ϵ}) → 𝒫(Q)
An NFA N accepts a string s = w1w2w3…wn iff ∃ a sequence of r0r1…rn ∈ Q such that rn ∈ F and ri+1 ∈ δ(ri, wi)
Equivalence of NFA and DFA
Theorem: L is regular iff it can be recognized by an NFA.
Proof:
If L is recognisable by a NFA (let) N = (Q, Σ, δ, q0, F)
Consider the DFA, D = (Q’, Σ, δ’, q0’, F’) where -
- Q’ = 𝒫(Q)
- δ’ : Q’ → Q’ and
- δ’(A, c) → ⋃ E(δ(a,c)), where
- a∈A
- E(A) = the set of states connected to some q∈A by ϵ. Trivially, some qs map to themselves via a ϵ.
- δ’(A, c) → ⋃ E(δ(a,c)), where
- q0’ = E(q0)
- F’ = {A’∈Q’ | A∩F ≠ ∅}
If S is accepted by N iff ∃ r0…rn ∈ Q r0=q0 and ri+1 ∈ δ(ri, wi)
⟹ ri+1 ∈ Ri = E(δ(ri, wi)) and rn ∈ Rn ∈ F.