OctoInform Beta

OpenAI preprint, September 2026 · §7. One witness for a halting computation · §7

Counter machines: Deterministic transitions on natural-number counters and the halting step of a run

A counter machine model of halting computations.

Hover over a blue or green term in the text, or a node in the graph, to find it in the other. Select it to read its declaration both in Lean and in words.

The setting

To represent computations inside Diophantine arithmetic, one needs a machine model whose state transitions and halting step are deterministic functions of the initial counter values. Starting from a designated initial state and a valuation of its counters in ℕ\mathbb{N}, a counter machine executes one instruction at each discrete step until it reaches a designated halt state.

The definition

Definition. Let QQ be a set of states and let JJ be a set of counters. A counter instruction over QQ and JJ is an element of the set ℐ(Q,J)\mathcal{I}(Q, J) given by ℐ(Q,J)={halt}⊔{inc(j,p):j∈J,p∈Q}⊔{test(j,p0,p1):j∈J,p0,p1∈Q}.\begin{split} \mathcal{I}(Q, J) = \{\mathrm{halt}\} &\sqcup \{\mathrm{inc}(j, p) : j \in J,\, p \in Q\} \\ &\sqcup \{\mathrm{test}(j, p_0, p_1) : j \in J,\, p_0, p_1 \in Q\}. \end{split}(1)✦ Using the instruction set (1), a counter machine M=(ι,q*,h)M = (\iota, q_*, h) over QQ and JJ consists of an instruction map ι:Q→ℐ(Q,J)\iota \colon Q \to \mathcal{I}(Q, J), an initial state q*∈Qq_* \in Q, and a halt state h∈Qh \in Q such that ι(q)=halt⇔q=hfor every q∈Q.\iota(q) = \mathrm{halt} \iff q = h \qquad \text{for every } q \in Q.(2)✦ For a counter machine M=(ι,q*,h)M = (\iota, q_*, h) satisfying (2), a machine configuration is a pair c=(q,v)∈Q×ℕJc = (q, v) \in Q \times \mathbb{N}^J, where πQ(c)=q\pi_Q(c) = q is the state and v:J→ℕv \colon J \to \mathbb{N} gives the counter values.✦ Writing v[j↦m]v[j \mapsto m] for the valuation that maps j∈Jj \in J to m∈ℕm \in \mathbb{N} and agrees with vv on J\{j}J \setminus \{j\}, the one-step transition δM:Q×ℕJ→Q×ℕJ\delta_M \colon Q \times \mathbb{N}^J \to Q \times \mathbb{N}^J is given by δM(q,v)={(q,v)if ι(q)=halt,(p,v[j↦v(j)+1])if ι(q)=inc(j,p),(p0,v)if ι(q)=test(j,p0,p1) and v(j)=0,(p1,v[j↦v(j)−1])if ι(q)=test(j,p0,p1) and v(j)>0.\delta_M(q, v) = \begin{cases} (q, v) & \text{if } \iota(q) = \mathrm{halt}, \\ (p, v[j \mapsto v(j) + 1]) & \text{if } \iota(q) = \mathrm{inc}(j, p), \\ (p_0, v) & \text{if } \iota(q) = \mathrm{test}(j, p_0, p_1) \text{ and } v(j) = 0, \\ (p_1, v[j \mapsto v(j) - 1]) & \text{if } \iota(q) = \mathrm{test}(j, p_0, p_1) \text{ and } v(j) > 0. \end{cases}(3)✦ For an initial valuation d:J→ℕd \colon J \to \mathbb{N} and a step count t∈ℕt \in \mathbb{N}, the tt-step run runM(d,t)∈Q×ℕJ\mathrm{run}_M(d, t) \in Q \times \mathbb{N}^J from (q*,d)(q_*, d) under the transition (3) is runM(d,t)=δMt(q*,d),\mathrm{run}_M(d, t) = \delta_M^{\,t}(q_*, d),(4)✦ where δMt\delta_M^{\,t} is the tt-fold iterate of δM\delta_M. Given the tt-step run (4), for an initial valuation d:J→ℕd \colon J \to \mathbb{N} and a step count T∈ℕT \in \mathbb{N}, halting at step TT is defined by M halts on d at step T⇔πQ(runM(d,T))=h and πQ(runM(d,t))≠h for all t∈ℕ with t<T.\begin{split} M \text{ halts on } d \text{ at step } T \iff &\pi_Q(\mathrm{run}_M(d, T)) = h \text{ and } \\ &\pi_Q(\mathrm{run}_M(d, t)) \neq h \text{ for all } t \in \mathbb{N} \text{ with } t < T. \end{split}(5)✦ A counter machine MM halts on an initial valuation d:J→ℕd \colon J \to \mathbb{N} when it halts on dd at some step T∈ℕT \in \mathbb{N} in the sense of (5): M halts on d⇔∃T∈ℕ,M halts on d at step T.M \text{ halts on } d \iff \exists T \in \mathbb{N},\; M \text{ halts on } d \text{ at step } T.(6)✦

In the paper, the result reads: a counter machine has finitely many states, an initial state q*q_*, a halt state hh, and finitely many counters in ℕ\mathbb{N}; every state other than hh has one instruction INC(j)\mathrm{INC}(j) or TESTDEC(j)\mathrm{TESTDEC}(j), and hh has none.

What is checked

The halting predicates (5) and (6) and the tt-step run (4) are stated for a counter machine MM as in (2) over sets QQ of states and JJ of counters, with instructions (1), configurations in Q×ℕJQ \times \mathbb{N}^J, transitions (3), initial valuations d:J→ℕd \colon J \to \mathbb{N}, and step counts t,T∈ℕt, T \in \mathbb{N}.