On two-way nondeterministic finite automata with one reversal-bounded counter

We show that the emptiness problem for two-way nondeterministic finite automata augmented with one reversal-bounded counter (i.e., the counter alternates between nondecreasing and nonincreasing modes for a fixed number of times) operating on bounded languages (i.e., subsets of w*1 ... w*k for some nonnull words w1, ...., wk) is decidable, resolving an open problem. The proof is a rather involved reduction to the solution of a special class of Diophantine systems of degree 2 via a class of programs called two-phase programs.