Certified native tensor construction #
This module lifts the operation-independent native array builder to shaped
tensors. Generated kernels fill one contiguous buffer with a USize loop,
while the correctness theorem exposes the ordinary Rep.ofFlatFn
semantics used throughout the library.
Build a tensor with one native row-major output loop.
The shape-size equality and callback bound proofs erase during code generation.
Instances For
The native tensor builder equals Rep.ofFlatFn whenever its callback
agrees pointwise with the semantic finite-index function.
Build a tensor by copying physical entries from an existing tensor.
The source-index callback returns only native indices. Generic array storage can therefore transfer existing boxed objects directly, while specialized storage performs raw scalar-buffer reads and writes.
Instances For
A physical tensor gather equals its coordinate-level flat function.
Copy one native flat tensor entry into an output physical buffer.
Instances For
Copying a tensor entry is the same physical update as pushing its observed native flat value.
Build a tensor with a physical-buffer update callback.
This is the movement-oriented counterpart of nativeTensorOfFlatFn: the
callback copies or appends physical entries directly instead of returning an
α value.
Instances For
A physical-update tensor fill equals its coordinate-level flat function.
Return a native tensor whose semantic reference is carried only by an erased correctness certificate.
Unlike nativeTensorKernel, this boundary has no ordinary reference value or
compiled value argument. It is useful when constructing either reference
would duplicate a large dependent plan or perform avoidable strict runtime
work.
Instances For
Evaluate a staged value before entering the consumer that uses it.
Lean is strict, and @[noinline] prevents native code generation from
sinking value into a consumer closure. The transformation scheduler uses
this boundary when materializing an intermediate tensor is cheaper than
composing another flat-index program.
Instances For
Staging changes evaluation placement, not the returned value.
Execute a native tensor implementation while retaining semantic and compiled references.
Both equality proofs erase during code generation. Standalone reasoning uses the independent semantic reference, while a downstream compiler may consume the compiled reference without recovering executable callbacks or repeating the compilation proof.
Instances For
A native tensor implementation equals its compact compiled reference.
A certified native tensor implementation equals its compact reference.