Constructing deterministic finite-state automata in recurrent neural networks