The setting
Given a deterministic counter machine and initial counter values , one wants to represent a halting run of by a single tuple of natural numbers whose base- digits record the machine state, active branch, and counter values at each step. The base is a power with for , large enough for every counter value to stay below without carries between steps and for an auxiliary counter, the clock, that increases by one at each step.
Counter machines
A counter instruction over a finite state set and a finite counter index set is an operation of one of three kinds: halt; increment a counter and go to a state , written ; or test a counter with zero-branch state and decrement-branch state , written .
A counter machine over and is a triple consisting of an instruction map assigning a counter instruction over and to each state in , a start state , and a halting state such that is the halt instruction if and only if .
A machine configuration of is a pair consisting of a state and a counter assignment .✦
The one-step transition of at a configuration is the configuration obtained by executing : if is the halt instruction, then ; if , then where and for ; and if , then when , and when , where and for .
For initial counter values and a step count , the run of on for steps is the configuration obtained by applying to a total of times.
The machine , started on , halts at step if the state of is and for every the state of differs from .✦
Base- packing
For a base , a natural number , and a position , the base- digit of at position is the natural number (1)✦
For and a sequence , the base- packing of length is the natural number (2)
For , the all-ones packed number of length in base is the value of the packing (2) on the constant sequence , (3)
Bitwise domination
For natural numbers and , is bitwise dominated by , written , if every base- digit (1) of is at most that of : (4)
The base constant
For a finite state set , a finite counter index set , and initial counter values , the base constant is the natural number (5)✦
The halting witness tuple
Let with be the counter index set augmented by a clock index . A halting witness tuple collects the natural auxiliary variables whose complete tuple solves the system exactly when the counter machine halts. A halting witness tuple for and is a tuple consisting of natural numbers , state records , and counter records .
Transition flows
For a counter machine over and , a state , and a branch index , the transition target (with ) is when and , when and , when and , and in all remaining cases.
For a halting witness tuple , a state , and , the arc count is when and , when and , when and , and in all remaining cases.
For a counter machine over and , a halting witness tuple for and , and a state , the incoming flow is (6)✦
For a counter machine over and , a halting witness tuple for and , and a counter , the increment total is (7)✦
For a counter machine over and , a halting witness tuple for and , and a counter , the decrement total is (8)✦
The scaled counter system
Given a counter machine over and , initial counter values , and a halting witness tuple , the scaled counter system is the predicate stating that satisfies the constraints below, using the base constant (5), bitwise domination (4), and the flows (6), (7), and (8).
First, the scale parameters satisfy , , , , , , and .
Second, for every , the state records satisfy , , and , where is if and otherwise; if is a test instruction then , , , and , and otherwise .
Third, for every , the counter records satisfy , , and ; for every , ; for every with , ; and the clock satisfies , , and .
The packed run trace
For a configuration of and a state , the state indicator is if and otherwise.✦
For a configuration of and a state , the zero-branch indicator is if , for some and , and , and is otherwise.
For a configuration of and a state , the decrement-branch indicator is if , for some and , and , and is otherwise.
For initial counter values , an extended index , and a step , the time- value is when , and is the value of counter in when .✦
The packed run trace gives the base- encoding of a run’s configurations in which each time step occupies one block of binary digits. Given , initial counter values , and natural numbers , write . Using the packing (2) and the all-ones packed number (3), the packed run trace is the halting witness tuple whose record components are given by (9) for each , and (10) for each .
The claim
Theorem. First, for every natural number , there is a unique such that (11)✦
Second, let be a counter machine over a finite state set and a finite counter index set , let be initial counter values, and let be a halting witness tuple satisfying . Then the halt record equals , the marker of the last digit, (12)✦ and the final value of the clock satisfies (13)✦ Moreover, if has instruction for some and , and satisfies , then (14)✦
Third, for any counter machine over and , initial counter values , and natural numbers such that started on halts at step , , , , , , and , the packed run trace satisfies the scaled counter system: (15)✦
What is checked
The unique-scale claim (11) is stated over positive natural numbers ; the invariants (12), (13), and (14) are stated over any halting witness tuple satisfying the scaled counter system for a counter machine over finite sets and and initial counter values ; and the trace claim (15) is stated over the packed run trace defined by (9) and (10) for a run of on halting at step under the stated bounds on , , and .