Certified native pointwise kernels #
Packed scalar types can replace the generic output-building loop with one operation-specific native loop while retaining the ordinary pointwise tensor definition as their proof-visible semantics. Mixed packed byte/float addition also fuses scalar promotion into the output loop.
Reference bodies and their native twins #
Each proof-visible kernel has an @[extern] twin that calls the reference body.
A @[csimp] lemma selects the twin during compilation; its borrow annotations
match the C entry point. Keeping one Lean body prevents the two models from
drifting apart. As with Array.zipWith, buffer operations truncate to the
shorter input; tensor callers already have matching lengths by their shapes.
The C implementation's agreement with these models remains an FFI trust boundary.
Proof-visible packed floating-point addition.
Instances For
Native packed floating-point addition, compiled to one C loop.
Instances For
Compile packed floating-point addition to one native loop.
Proof-visible packed floating-point subtraction.
Instances For
Native packed floating-point subtraction, compiled to one C loop.
Instances For
Compile packed floating-point subtraction to one native loop.
Proof-visible packed floating-point multiplication.
Instances For
Native packed floating-point multiplication, compiled to one C loop.
Instances For
Compile packed floating-point multiplication to one native loop.
Proof-visible packed floating-point division.
Instances For
Native packed floating-point division, compiled to one C loop.
Instances For
Compile packed floating-point division to one native loop.
Proof-visible fused byte promotion and floating-point addition.
Instances For
Native fused byte promotion and floating-point addition.
Instances For
Compile fused byte/float addition to one native loop.
Proof-visible fused floating-point and promoted-byte addition.
Instances For
Native fused floating-point and promoted-byte addition.
Instances For
Compile fused float/byte addition to one native loop.
Add packed floats to promoted packed bytes in one native output loop.
Operand order remains explicit so IEEE exceptional behavior matches scalar
Float addition exactly.
Instances For
The ordinary array observation of packed addition is pointwise addition.
The ordinary array observation of packed subtraction is pointwise subtraction.
The ordinary array observation of packed multiplication is pointwise multiplication.
The ordinary array observation of packed division is pointwise division.
The ordinary array observation of byte/float addition includes promotion.
The ordinary array observation of float/byte addition includes promotion.
Native packed addition has the canonical coordinate semantics.
Native packed subtraction has the canonical coordinate semantics.
Native packed multiplication has the canonical coordinate semantics.
Native packed division has the canonical coordinate semantics.