NFA Builder

Design your Nondeterministic Finite Automaton — add states, transitions, and epsilon moves

šŸ“ Automaton Settings

āž• Add Transition

šŸ“‹ Transition Table

šŸŽÆ Example NFAs

NFA State Diagram
šŸ’” Drag states to reposition • Double-click canvas to add state

Subset Construction

Convert NFA to DFA using the Powerset/Subset Construction algorithm — watch it unfold step by step

āš™ Algorithm Steps

šŸ“Š ε-Closure Table

DFA State Diagram

šŸ“‹ DFA Transition Table

DFA Minimization

Minimize the DFA using the Table-Filling (Myhill-Nerode) algorithm

āš™ Minimization Steps

šŸ”² Distinguishability Table

Minimized DFA

šŸ”— Equivalence Classes

String Simulation

Watch your automaton process input strings step by step with live state highlighting

šŸŽ® Simulation Controls

0.8s

šŸ“ Current State

Ready to simulate

šŸ“œ Computation History

🧪 Batch Test

Simulation Canvas

šŸ”¤ Input Tape

Theory Reference

Formal definitions and key theorems from Unit 1 & Unit 2 of TOC

šŸ¤–

DFA (Deterministic Finite Automaton)

A 5-tuple M = (Q, Σ, Γ, q₀, F) where:

  • Q — finite set of states
  • Ī£ — finite input alphabet
  • Ī“: Q Ɨ Ī£ → Q — total transition function
  • qā‚€ ∈ Q — initial state
  • F āŠ† Q — set of accepting states
The DFA is deterministic — for each (state, symbol) pair there is exactly one next state.
🌫

NFA (Nondeterministic Finite Automaton)

A 5-tuple M = (Q, Σ, Γ, q₀, F) where:

  • Ī“: Q Ɨ (Ī£ ∪ {ε}) → 2^Q — transition to a set of states
  • May have ε-transitions (move without consuming input)
  • Multiple transitions for same (state, symbol) allowed
NFAs and DFAs accept the same class of languages (Regular Languages).
⚔

ε-Closure

ε-closure(q) = set of all states reachable from q via zero or more ε-transitions.

ε-closure(q) = {q} ∪
  āˆŖ{ε-closure(p) | p ∈ Ī“(q, ε)}

Extended to sets: ε-closure(S) = ∪{ε-closure(q) | q ∈ S}

šŸ”„

Subset Construction (NFA → DFA)

  1. Start state = ε-closure({qā‚€})
  2. For each DFA state S and symbol a:
    Γ_DFA(S, a) = ε-closure(∪{Γ_NFA(q,a) | q∈S})
  3. Mark S as accepting if S ∩ F ≠ āˆ…
  4. Repeat until no new states
Can produce up to 2^n DFA states from an n-state NFA.
šŸ”¬

DFA Minimization (Table-Filling)

  1. Base: Mark (p,q) if exactly one is in F
  2. Inductive: Mark (p,q) if ∃a: (Γ(p,a), Γ(q,a)) is marked
  3. Repeat until no new marks
  4. Merge all unmarked pairs into equivalence classes
An unmarked pair (p,q) means p and q are indistinguishable — they can be merged.
šŸ“

Myhill-Nerode Theorem

A language L is regular iff the Myhill-Nerode equivalence relation ≔_L has finitely many equivalence classes.

The number of equivalence classes equals the number of states in the minimal DFA for L.

This gives us a unique (up to isomorphism) minimal DFA for every regular language.
šŸ”

Pumping Lemma

If L is regular, ∃ pumping length p such that every string w ∈ L with |w| ≄ p can be written as w = xyz where:

  • |y| ≄ 1  (y is non-empty)
  • |xy| ≤ p
  • āˆ€i ≄ 0: xy^i z ∈ L
Used to prove languages are NOT regular (by contradiction).
🌟

Closure Properties

Regular languages are closed under:

  • Union: L₁ ∪ Lā‚‚
  • Concatenation: L₁ Ā· Lā‚‚
  • Kleene Star: L*
  • Complement: LĢ„
  • Intersection: L₁ ∩ Lā‚‚
  • Reversal: L^R
All operations on regular languages produce regular languages.