Runtime link: lowerGraphToTape + Tape.backwardDenseFrom #
lowerGraphToTape produces a runtime tape whose node ids correspond to positions in the proof
context Γ ++ ss, and bakes the proved vjp into each node's runtime backward closure.
The theorem backwardDenseFrom_lowerGraphToTape_eq_backpropAllCtx states that executing the
runtime reverse-mode loop on this lowered tape matches the proved backpropAllCtx.
All nodes produced by lowerGraphDataToTape have requiresGrad = true.
This is a simplifying invariant: the lowered tape is meant for correctness proofs, so we mark every node as eligible for gradient accumulation (including leaves for inputs).
Pointwise form of lowerGraphDataToTape_all_requires_grad_true: every node index is requiresGrad = true.
This is often more convenient than the .all formulation when reasoning about array indexing.
Backward closure safety for lowerGraphDataToTape: parent ids produced by any node are strictly
smaller than the node id.
This is the “edges point backwards” invariant required by the runtime reverse loop: when processing
node id, every contribution targets an earlier node (pid < id), so accumulation is well-founded.
All nodes produced by lowerGraphToTape have requiresGrad = true.
This mirrors lowerGraphDataToTape_all_requires_grad_true for the Graph interface.
Pointwise form of lowerGraphToTape_all_requires_grad_true.
Backward closure safety for lowerGraphToTape: parent ids produced by any node are strictly
smaller than the node id.
This mirrors lowerGraphDataToTape_backward_pids_lt_id for the Graph interface.