Native counting of one adjacent run #
The counter tests the array bound before every read and stops at the first different word. No sorting or counting oracle is used. The mathematical end index is a proof parameter and does not occur in the code or a register.
Main definitions #
Count.body,Count.code: the native run-counting loop.
Main results #
Count.exec: every matching input position advances the cursor, with linear charged time.
Sorted input array.
Unique-key output array.
Multiplicity output array.
Number of completed output runs.
Current run multiplicity.
Loaded input word.
Address temporary.
Run-counting loop flag.
Read the next word only if the cursor is in bounds; count it or end the run.
Count from the current cursor, starting with zero count and flag one.
Count a maximal adjacent run in 8c+10 instructions, including the terminating test.
stop is a proof parameter: execution learns the boundary solely through charged comparisons
and loads. The source memory is unchanged. Empty runs are also admitted by this kernel.