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.
Input length.
Instances For
Sorted input array.
Instances For
Unique-key output array.
Instances For
Multiplicity output array.
Instances For
Input cursor.
Instances For
Number of completed output runs.
Instances For
Current run key.
Instances For
Current run multiplicity.
Instances For
Loaded input word.
Instances For
Address temporary.
Instances For
Constant one.
Instances For
Run-counting loop flag.
Instances For
Read the next word only if the cursor is in bounds; count it or end the run.
Instances For
Count from the current cursor, starting with zero count and flag one.
Instances For
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.