Optimal state reductions of automata with partially specified behaviors