Skip to content
Part IA Michaelmas, Lent Term

Equivalence of NFA and DFA

Main Theorem

Theorem: The class of languages recognised by NFAs equals the class recognised by DFAs.

L is NFA-recognisable    L is DFA-recognisableL \text{ is NFA-recognisable} \iff L \text{ is DFA-recognisable}

Proof Outline

DFA \Rightarrow NFA

Every DFA is trivially an NFA where each state-symbol pair has exactly one transition.

NFA \Rightarrow DFA

The subset construction converts any NFA to an equivalent DFA.

Since subset construction preserves language, any NFA-recognisable language is DFA-recognisable.

Extending to NFA-ε\varepsilon

NFA-ε\varepsilon \Rightarrow NFA

Given NFA-ε\varepsilon M=(Q,Σ,Δ,τ,s,F)M = (Q, \Sigma, \Delta, \tau, s, F):

Construct NFA M=(Q,Σ,Δ,s,F)M' = (Q, \Sigma, \Delta', s, F') where:

Δ={(q,a,q):q.qεq(q,a,q)Δ}\Delta' = \{(q, a, q') : \exists q''. q \xrightarrow{\varepsilon^*} q'' \land (q'', a, q') \in \Delta\}

F=F{q:E(q)F}F' = F \cup \{q : E(q) \cap F \neq \emptyset\}

Intuitively: absorb ε\varepsilon-transitions into labelled transitions.

Proof of Correctness

The extended transition relation is preserved:

  • In MM: qwqq \Rightarrow_w q' via labelled and ε\varepsilon-transitions
  • In MM': qwqq \xrightarrow{w} q' via labelled transitions only

Complete Equivalence

All three models recognise the same languages:

DFANFANFA-ε\text{DFA} \subset \text{NFA} \subset \text{NFA-}\varepsilon

where each \subset is strict in expressive convenience but equal in language-theoretic power.

The Class: Regular Languages

Definition

A language LL is regular if there exists a finite automaton (DFA, NFA, or NFA-ε\varepsilon) that recognises it.

Equivalent Characterisations

LL is regular iff any of:

  1. L=L(M)L = L(M) for some DFA MM
  2. L=L(M)L = L(M) for some NFA MM
  3. L=L(M)L = L(M) for some NFA-ε\varepsilon MM
  4. L=L(R)L = L(R) for some regular expression RR (Kleene’s theorem)
  5. LL is generated by a regular grammar
  6. LL is the language of a syntactic monoid

Practical Implications

For Design

  • NFAs are often easier to design (less constrained)
  • NFA-ε\varepsilon enables modular composition
  • DFAs have unique minimal form (useful for optimisation)

For Implementation

  • DFAs run in O(w)O(|w|) time
  • NFAs can be simulated in O(wQ)O(|w| \cdot |Q|) time
  • Subset construction may cause exponential blowup

For Theory

  • Closure properties are easier to prove with NFAs
  • Decidability results apply to all three

Closure Properties

Regular languages are closed under:

  • Union: disjoint union or NFA-ε\varepsilon construction
  • Concatenation: sequential composition
  • Kleene star: loop back construction
  • Complement: swap accepting/non-accepting in DFA
  • Intersection: product construction on DFAs

Summary

  • DFA, NFA, and NFA-ε\varepsilon are equally expressive
  • All recognise exactly the regular languages
  • Subset construction: NFA \to DFA
  • Epsilon elimination: NFA-ε\varepsilon \to NFA
  • Each model has practical advantages