예제 #1
0
 function it_minimizes_a_DFA_by_applying_the_Brzozowski_algorithm(DFA $dfa1, NFA $nfa1, DFA $dfa2, NFA $nfa2, DFA $dfa3)
 {
     $dfa1->reverse()->willReturn($nfa1);
     $nfa1->toDFA()->willReturn($dfa2);
     $dfa2->reverse()->willReturn($nfa2);
     $nfa2->toDFA()->willReturn($dfa3);
     $this->minimizeDFA($dfa1)->shouldReturn($dfa3);
 }
예제 #2
0
 /**
  * @param DFA $dfa
  *
  * @return DFA
  */
 public static function minimizeDFA(DFA $dfa)
 {
     return $dfa->reverse()->toDFA()->reverse()->toDFA();
 }