Certified native finite loops #
Generated tensor kernels use these primitives when a static traversal length
fits every Lean target. The executable loops carry USize counters, while
their theorems identify the results with standard Fin.foldl and
Array.ofFn semantics.
This module is operation-independent. Rearrangement, repetition, reduction, packing, unpacking, and einsum all share the same traversal boundary.
Fill the physical buffer selected for α in increasing native-index order.
The storage dictionary is specialized at each scalar type. For Float, this
loop therefore allocates and pushes directly into an unboxed FloatArray.
Instances For
The native physical-buffer builder observes as Array.ofFn when its callback
agrees with the semantic finite-index function.
The storage gather observes as Array.ofFn when every copied source entry
agrees with the semantic finite-index function.
The storage gather creates the requested scalar count.
Fill a physical buffer with an executable update callback.
Unlike nativeBufferOfFn, the callback returns the updated physical buffer
instead of a scalar. Movement kernels can therefore copy boxed objects or
unboxed native entries without materializing a scalar at the callback ABI.
Instances For
A physical-update buffer fill observes as Array.ofFn when every update is
the corresponding semantic push.
A physical-update buffer fill creates the requested scalar count.