Consider a finite state machine as usual, but every transition, it can also update an integer counter by adding or subtracting a number. Say, a transition function of the form $\delta(q,a) = (p,k)$ moves to the new state $p$, and add $k$ to the counter, where $k \in \mathbb{Z}$ (so $k$ can be positive, negative, or zero).

A string is accepted if the final state and the counter value is in $F$, where $F$ is a finite set of pairs of states and counter values.

Is this model known? I could not find any reference of this particular extension.


Assuming $k$ can be any integer, then this can be formalized as a blind one-counter automaton. Usually these automata accept on final state when its counter is zero, but we can easily model your acceptance type if you allow $\epsilon$ transitions (that do not consume input). If I am not mistaken, like with finite state automata, one can get rid of the $\epsilon$, but that is a non-trivial result.

There are several types of one-counter automata. In the most general form they are allowed to test whether the value of the counter equals zero. The languages they accept are a strict subset of the context-free languages.

The model you are probably looking for is called blind, it cannot test for zero, except as the final test for acceptance at the end of the computation.

  • $\begingroup$ "Counter" may be misleading, since in one-counter machines you can also branch the run according to the value of the counter (i.e. zero-tests), which makes the model very different (and much stronger). $\endgroup$
    – Shaull
    Oct 2 '16 at 11:40
  • $\begingroup$ You are right. I add some words on that. Thanks. $\endgroup$ Oct 2 '16 at 11:44

This model is a variant of weighted automata, which are widely studied (although there are a lot of open questions about them). You can start here: Handbook of Weighted Automata.

Note that sometimes they are called "distance automata" (although this is becoming less common).


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.