Native heavy extraction and light placement #
The input, unsigned residue array and histogram are supplied by the actual Count.program.
One scan copies heavy integers, in input order, to a compact output. Each light integer is
tagged and placed directly in the packed node array. The third pass negates its integer and
its residue, and writes both copies required by arrZ.
The mathematical comparator is Anthropic's Buckets.lean
and NodeArray.lean at formal-math@16a5ce41304fcdaea4e0be7c132e1c361dc26da5.
The native code, encoding arithmetic and execution proofs here are original. No Light
execution theorem or source-machine simulation is assumed.
Main definitions #
Place.program: a fixed scan with runtime bases, length, modulus, tag and column.Place.heavyList: compact heavy elements in input order.Place.memory: exact writes of a prefix of the scan, including both third-column copies.
References #
Input array base.
Instances For
Unsigned residue array base.
Instances For
Input length.
Instances For
Histogram base.
Instances For
Compact heavy output base.
Instances For
Packed node output base.
Instances For
Positive modulus, decoded unsigned.
Instances For
Twice the positive tag added to a light integer.
Instances For
Column in a four-cell group.
Instances For
Distance to the second write: zero for X/Y, 4M for Z.
Instances For
Zero for X/Y, one for Z.
Instances For
Input cursor.
Instances For
Number of heavy integers already written.
Instances For
Temporary address.
Instances For
Current remainder.
Instances For
Current value and its tagged encoding.
Instances For
Twice the current magnitude.
Instances For
Current input sign.
Instances For
Constant one.
Instances For
Constant two.
Instances For
Constant four.
Instances For
Constant zero.
Instances For
Current histogram count.
Instances For
Integer contribution before the positive tag.
Instances For
The target index is exactly the residue of the signed contribution.
The compact array is the input subsequence selected by the histogram test.
The native compact output has exactly the existing heavy subset as its underlying set.
Copy a heavy integer without changing its signed encoding.
Instances For
Tag a light integer using its magnitude and sign, then write its required cells.
Instances For
Every iteration reads the original integer, its unsigned key and its exact bucket size.
Instances For
The same finite code handles every input length, width, modulus and output length.
Instances For
All runtime parameters survive the scan.
A scan can only change its heavy capacity block and its packed output block.