Any #
Bridge lemmas between the proved typed context (TList) and the runtime tape representation
(Runtime.AnyTensor stored in Arrays).
This is part of the explicit trust boundary: the runtime engine operates on erased tensors, while the proved model keeps shapes at the type level.
Convert a typed context (TList) into a runtime list of erased tensors (AnyTensor).
This is part of the “trust boundary” between the proved model (typed shapes) and the runtime engine (erased shape/value pairs).
Instances For
toAnyList but as an Array (the container used by the runtime tape).
Instances For
Like toAnyList, but tags each element with the absolute runtime node id it should correspond to,
starting from start.
Instances For
Every (pid, tensor) produced by toIndexedAnyList ts start satisfies pid < start + ss.length.
This is bookkeeping used to prove runtime backward only references earlier nodes.
toAnyList ignores type-level casts of the shape list.
This is a convenience lemma for rewriting across reassociation/cast steps in proofs.
toAnyArray ignores type-level casts of the shape list.
This is a direct corollary of toAnyList_cast.
toAnyArray has the same size as the underlying shape list.
Shape-erasing conversions #
The lemmas in this section show that these conversions preserve length/order and interact well with
TList.snoc and TList.get. They’re used later to relate runtime node ids to positions in the
typed proof context Γ ++ ss.
toAnyList commutes with appending a value: converting snoc xs t is toAnyList xs ++ [t].
Array-form version of toAnyList_snoc.
toAnyArray of a cons context is array cons/append of the head element.
Array lookup through toAnyArray corresponds to TList.get (up to the AnyTensor wrapper).
This is the key lemma that lets us connect runtime indexing (arr[i]) to proof indexing (get xs i).