The method produces the factorization of strings that are not recognized by the automaton.
Not sure if it was purposely intended to work this way.
Example:
HashSet<State> statesR = new HashSet<>();
HashSet<Transition> deltaR = new HashSet<>();
State q00 = new State("q0", true, false);
State q1 = new State("q1", false, false);
State q2 = new State("q2", false, false);
State q3 = new State("q3", false, false);
statesR.add(q00);
statesR.add(q1);
statesR.add(q2);
statesR.add(q3);
deltaR.add(new Transition(q00, q1, "b"));
deltaR.add(new Transition(q1, q2, "u"));
deltaR.add(new Transition(q2, q3, "g"));
FA result = new FA(new Automaton(deltaR, statesR));
System.out.println("factorization --> " + Automaton.factors(result.getAutomaton()));
The above println prints "(((((bug + bu) + b) + g) + (ug + u)) + ε)" even though "bug" is not actually a string of the language of the automaton.
The method produces the factorization of strings that are not recognized by the automaton.
Not sure if it was purposely intended to work this way.
Example:
The above println prints "(((((bug + bu) + b) + g) + (ug + u)) + ε)" even though "bug" is not actually a string of the language of the automaton.