Implement minimize algorithm for DFA.