public static Automaton cleanAutomaton(Automaton a) {
		Automaton ac = (Automaton) a.clone();
		State[] s = ac.getStates();
		Set useless = getUselessStates(ac);
		for (int i = 0; i < s.length; i++) {
			if (useless.contains(s[i]) && s[i] != ac.getInitialState())
				ac.removeState(s[i]);
		}
		if (useless.contains(ac.getInitialState())) {
			Transition[] t = ac.getTransitions();
			for (int i = 0; i < t.length; i++)
				ac.removeTransition(t[i]);
		}
		return ac;
	}