Commit 646290a
committed
proofs(autograd): connect the runtime link to the Fréchet-derivative model
The runtime link (Runtime/Link/BackwardGraph) proves the executable dense
reverse pass agrees with the algebraic model's backpropAllCtx over any
commutative semiring; the analytic tape model (Tape/Core/FDeriv) proves
reverse-mode accumulation computes the adjoint of the Fréchet derivative
of the forward evaluation over the reals. The two developments were
stated on different graph types with no formal connection between them.
New module NN/Proofs/Autograd/Runtime/Link/FDeriv.lean supplies it:
- Algebra.{Node,Graph}.toReal specialize the algebraic model at the real
carrier and a fixed environment to the analytic model, and
{Node,Graph}.toAlgebra embed the analytic model back as the Unit-
environment slice; the round trip is the identity, so the analytic
model is exactly the environment-free real slice of the algebraic one.
Commutation lemmas cover all three semantics (eval, jvpCtx,
backpropCtx).
- TList.takeLeft plus takeLeft_backpropAllCtx (Graph and GraphData
forms) identify the input-prefix block of the full backpropagation
with the inputs-only backpropCtx.
- flattenCtx transport lemmas commute context vectorization with
cast/snoc/unsnoc/add, exhibiting evalVec/jvpVec/backpropVec as the
flattenings of the TList semantics.
- Composed endpoints backpropCtx_eq_adjoint_fderiv and
backwardDenseFrom_compileAux_adjoint_fderiv, with pointwise _at
variants for graphs containing non-smooth primitives: the executable
dense reverse pass on a compiled graph returns the full
backpropagation context, whose input prefix is (fderiv eval x)† seed.
The round-trip lemmas double as the correctness specification for a
possible follow-up that re-founds the analytic model as an abbreviation
of the algebraic one (as already done for TList).
All new declarations depend only on [propext, Classical.choice,
Quot.sound].1 parent 46658fd commit 646290a
2 files changed
Lines changed: 556 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| |||
0 commit comments