Tape-node context primitives #
This module contains the low-level vectorized context operations used by the tape-node proof library:
block projections, one-hot cotangent injections, and the bridge from generic OpSpecFDerivCorrect
witnesses to NodeFDerivCorrect nodes.
Raw projection from a vectorized context onto the ith block.
This is the underlying block-splitting operation; CtxVec.get below wraps it with an Idx Γ s
that also remembers the expected shape.
Instances For
Raw injection into a vectorized context: place v into block i, fill others with zeros.
This is the adjoint of getRaw with respect to the Euclidean inner product (proved below).
Instances For
Adjointness of raw projection/injection: ⟪x, singleRaw i v⟫ = ⟪getRaw i x, v⟫.
This is the vectorized counterpart of the “one-hot cotangent” principle used in tape soundness.
Project the block specified by idx : Idx Γ s out of a vectorized context.
Instances For
Inject a block into a vectorized context at idx, filling other blocks with zeros.
Instances For
Continuous linear map extracting the head block of a nonempty vectorized context.
Instances For
Continuous linear map extracting the tail blocks of a nonempty vectorized context.
Instances For
get packaged as a continuous linear map.
Instances For
Nodes in this file are authored directly on the vectorized context CtxVec.
This is the most convenient authoring style for analytic proofs: forwardVec/jvpVec/vjpVec
are definitional, and the correctness obligation is an inner-product identity on Euclidean
vectors.
Convenience constructor: build a tape Node from vector-level forward/JVP/VJP plus adjointness.
The correct_inner field is exactly the local VJP/JVP law:
⟪jvp x dx, δ⟫ = ⟪dx, vjp x δ⟫.
Instances For
OpSpecFDerivCorrect instance for a linear layer.
This is the analytic correctness lemma behind the tape node constructors: it identifies the JVP
with the Fréchet derivative (a matrix multiplication) for linear_spec.
PyTorch analogue: torch.nn.Linear forward map is affine, derivative is constant.
https://pytorch.org/docs/stable/generated/torch.nn.Linear.html