FSA from words to automata

finite-state automata · regular expressions · type-3 grammars

Separate words with spaces, commas or new lines. Each character is one symbol; type ε for the empty word.

Automaton

2states 1 transitions · 1 final · |Σ| = 1

Minimal DFA (Moore’s partition refinement): states with the same future are merged, so shared suffixes are drawn once. Partial: a missing transition means rejection (an implicit dead state).

  1. NFA 2
  2. subset construction 2
  3. minimal 2
a
aq0 = {q0} · Sq0q1 = {q1} · A · finalq1

Hover or tap a word to trace its path. Double circles are final states.

Transition table
State a Nonterminal DFA states
→ q0 q1 S {q0}
∗ q1 — A {q1}

→ initial, ∗ final. Empty cells (—) lead to rejection.

Regular expression

Equivalent to the minimal DFA shown, by state elimination. Each automaton gives a different but equivalent expression: compare NFA, DFA and minimal DFA.

Notation
a
Elimination steps (2)

A new initial state s and final state f are linked by ε to the automaton; then each state is removed, and every path through it becomes one edge labelled with the concatenation. States with one way in and one way out go first.

  1. remove q0: s → q1 a
  2. remove q1: s → f a

Regular grammar

Right-linear rewriting rules read off the minimal DFA: one nonterminal per state, S for q0.

Form

Chomsky type-3 form: p —a→ q gives P → a Q when q has a way out, and P → a when q is final; S → ε only if ε is a word.

G = ⟨N, Σ, P, S⟩ with N = {S}, Σ = {a}, 1 rules.

S→ a
Nonterminals and states

S = q0, A = q1