Proofs: Brzozowski's minimization algorithm
These are the human proofs of Brzozowski's minimization algorithm, at full length.
Brzozowski's algorithm outputs the minimal DFA full
This proof shows: correctness, termination.
Let be an NFA with a set of start states and no -moves. For a set and a string , let be the set of states reachable from by a path labelled : and . accepts when .
Part 1: the subset construction
Lemma 1. DETERMINIZE (lines L6 to L13) stops, and returns a complete DFA that accepts , whose states are exactly the sets for , with the state reached on equal to .
Proof. Each subset gets a number at most once (line L10), and there are at most subsets, so the loop of line L7 runs at most times and stops. Line L9 sets , and every numbered subset is processed, so is total. By induction on , the state reached on is : for it is , and if it is for , then on it is . Every numbered subset was found from by a sequence of moves, so it is for some , and each such set is numbered because the search follows every move of every numbered subset. Line L12 makes the state of accepting if and only if , that is, if and only if .
Part 2: reversal
Lemma 2. , with , accepts . More precisely, if and only if .
Proof. A path in is the same as a path in , by the definition of . So has a path labelled from some state of to if and only if has a path labelled from to some state of . With and this says that accepts if and only if accepts .
Part 3: determinizing the reverse of a reachable DFA
Theorem. Let be a deterministic automaton, where may be partial, in which every state is reachable from . Then is the minimal complete DFA for .
Proof. Write for the state reached from on , when it is defined. By Lemma 1, the state of reached on is , and by Lemma 2,
By Lemma 1 and Lemma 2, accepts , and all its states are reachable.
Let be two of its states, and take in one of them and not in the other, say . Since is reachable in , there is with . Since is deterministic, is defined if and only if is, and then they are equal. Now
and the same holds for . The state is the state reached from on , and it is accepting if and only if it contains , because the accepting states of form the set . So is accepted from and rejected from , and the two states are not equivalent.
So is a complete DFA for whose states are all reachable and pairwise inequivalent. By Part 3 of the uniqueness theorem for minimal DFAs, it is the minimal complete DFA for .
Part 4: the algorithm
Lines L1 and L2 compute . By Lemmas 1 and 2, is a complete DFA for with all states reachable. Line L3 computes , an NFA with the single start set (the accepting states of ) and the single accepting state, the start state of . Line L4 computes . By the theorem of Part 3 with , this is the minimal complete DFA for . Both calls of DETERMINIZE stop by Lemma 1, and lines L1 and L3 are single passes over the transitions, so the algorithm stops and line L5 returns the minimal complete DFA for .