Representing constraints with automata