<p>If the number of counters or the number of reversals (or both) is part of the
input, the problem becomes coNP-complete (unless there is exactly one counter):</p>

<p>The upper bound was shown by Hague and Lin, using a reduction to existential Presburger arithmetic:
Hague and Lin, "Model Checking Recursive Programs with Numeric Data Types", CAV 2011, <a href="http://dx.doi.org/10.1007/978-3-642-22110-1_60" rel="nofollow">http://dx.doi.org/10.1007/978-3-642-22110-1_60</a>.</p>

<ul>
<li><p>If the number of counters is part of the input and one has exactly one
reversal, it is not hard to reduce the knapsack problem: Given
binary representations of $x_1,\ldots,x_k,y$, each containing at most $n$
bits, one can easily construct a $(k+1)n$-counter automaton $A$ that can nondeterministically pick a subset $S\subseteq \{1,\ldots,k\}$ and
produce $\sum_{i\in S} x_i$ on the first counter and then subtracts
$y$ from the first counter. Then the language of $A$ is non-empty
if and only if there is a subset $S\subseteq \{1,\ldots,k\}$ with
$\sum_{i\in S} x_i=y$.</p></li>
<li><p>If the number of reversals is part of the input and one has exactly
two counters, coNP-hardness was already shown in
Gurari and Ibarra, "The complexity of decision problems for finite-turn multicounter machines", <a href="http://dx.doi.org/10.1016/0022-0000(81)90028-3" rel="nofollow">http://dx.doi.org/10.1016/0022-0000(81)90028-3</a> .
This seems to be the journal version of the paper linked in the question.</p></li>
<li><p>If the number of reversals is part of the input and one has exactly
one counter, however, then the problem is NL-complete. This is a well-known
result on one-counter automata.</p></li>
</ul>

CC BY-SA 3.0
2016-06-25T23:10:20.387Z
2016-06-26T16:23:04.400Z
2016-06-26T16:23:04.400Z
Georg Zetzsche
<p>I was reading <a href="http://link.springer.com/content/pdf/10.1007/3-540-10843-2_39.pdf" rel="noreferrer">this paper</a>, about the complexity of decision problems for
reversal bounded counter machines.
I got to Theorem 1 on Page 6.
The theorem shows that there's a log-space NTM which can determine if a non deterministic reversal-bounded counter machine is empty or not.
(A log-space NTM can be converted into a polynomial time DTM).</p>
<p>The proof shows that, for input machine represented as a string of length <span class="math-container">$n$</span>,
with <span class="math-container">$m$</span> counters, that <span class="math-container">$O(m\log n)$</span> space is required.</p>
<p>Here's where I get lost. The paper says that, since <span class="math-container">$m$</span> is fixed, we can consider
the machine to take <span class="math-container">$O(\log n)$</span> space.</p>
<p>Does this mean that the algorithm is only uses log-space if <span class="math-container">$m$</span> is fixed? Would the corresponding deterministic algorithm then be exponential in terms of <span class="math-container">$m$</span>?</p>

CC BY-SA 3.0
2013-07-06T17:36:20.850Z
It is not necessarily the case that the best algorithm is to determinize the NDTM, but certainly this approach may be exponential in $m$.
András Salamon
CC BY-SA 3.0
2013-07-08T08:22:56.077Z
The problem given in Theorem 1 is NCM(m,r). So, both $ m $ and $ r $ are fixed. When you design an algorithm for this problem, you can embed the values of $ m $ and $ r $ into the finite state set. Moreover, you can squeeze the work tape to $O(\log n)$ space by using more tape symbols (depending the value of $ m $).
Abuzer Yakaryilmaz
<cc.complexity-theory><fl.formal-languages><automata-theory><time-complexity><turing-machines>
Can emptiness of reversal-bounded counter languages be decided in time polynomial to the number of counters?
Joey Eremondi
# Can emptiness of reversal-bounded counter languages be decided in time polynomial to the number of counters?

(Asked by: username_0 on 2013-07-04)

I was reading [this paper](http://link.springer.com/content/pdf/10.1007/3-540-10843-2_39.pdf), about the complexity of decision problems for
reversal bounded counter machines.
I got to Theorem 1 on Page 6.
The theorem shows that there's a log-space NTM which can determine if a non deterministic reversal-bounded counter machine is empty or not.
(A log-space NTM can be converted into a polynomial time DTM).

The proof shows that, for input machine represented as a string of length $n$,
with $m$ counters, that $O(m\log n)$ space is required.

Here's where I get lost. The paper says that, since $m$ is fixed, we can consider
the machine to take $O(\log n)$ space.

Does this mean that the algorithm is only uses log-space if $m$ is fixed? Would the corresponding deterministic algorithm then be exponential in terms of $m$?

**Tags:** cc.complexity-theory, fl.formal-languages, automata-theory, time-complexity, turing-machines
> **Comments:**
> **username_1**: It is not necessarily the case that the best algorithm is to determinize the NDTM, but certainly this approach may be exponential in $m$.  
> **username_2**: The problem given in Theorem 1 is NCM(m,r). So, both $ m $ and $ r $ are fixed. When you design an algorithm for this problem, you can embed the values of $ m $ and $ r $ into the finite state set. Moreover, you can squeeze the work tape to $O(\log n)$ space by using more tape symbols (depending the value of $ m $).  

---

## 1 answers

### Answer by username_3 on 2016-06-25. Score: 8 | Accepted answer

If the number of counters or the number of reversals (or both) is part of the
input, the problem becomes coNP-complete (unless there is exactly one counter):

The upper bound was shown by Hague and Lin, using a reduction to existential Presburger arithmetic:
Hague and Lin, "Model Checking Recursive Programs with Numeric Data Types", CAV 2011, <http://dx.doi.org/10.1007/978-3-642-22110-1_60>.

* If the number of counters is part of the input and one has exactly one
  reversal, it is not hard to reduce the knapsack problem: Given
  binary representations of $x\_1,\ldots,x\_k,y$, each containing at most $n$
  bits, one can easily construct a $(k+1)n$-counter automaton $A$ that can nondeterministically pick a subset $S\subseteq \{1,\ldots,k\}$ and
  produce $\sum\_{i\in S} x\_i$ on the first counter and then subtracts
  $y$ from the first counter. Then the language of $A$ is non-empty
  if and only if there is a subset $S\subseteq \{1,\ldots,k\}$ with
  $\sum\_{i\in S} x\_i=y$.
* If the number of reversals is part of the input and one has exactly
  two counters, coNP-hardness was already shown in
  Gurari and Ibarra, "The complexity of decision problems for finite-turn multicounter machines", <http://dx.doi.org/10.1016/0022-0000(81)90028-3> .
  This seems to be the journal version of the paper linked in the question.
* If the number of reversals is part of the input and one has exactly
  one counter, however, then the problem is NL-complete. This is a well-known
  result on one-counter automata.


---

