Tensor Buffer Traversal #
Laws connecting native physical-buffer folds to finite row-major index folds. These results keep executable reductions on specialized storage while exposing the ordinary finite traversals needed by proofs.
theorem
TorchLean.Tensor.Internal.fin_foldl_product
{α : Type u}
(outer inner : ℕ)
(step : α → Fin outer → Fin inner → α)
(initial : α)
:
Nested finite folds are one row-major fold over the product index.
theorem
TorchLean.Tensor.Internal.Rep.foldl_eq_fin_foldl
{α β : Type}
[Storage α]
{s : Shape}
(step : β → α → β)
(initial : β)
(x : Rep α s)
:
A packed fold is the finite fold over the tensor's flat row-major indices.