⭐⭐ convnextInputGradB IS the certified whole-net ConvNeXt-T gradient AT A BATCH #
ConvNeXtWholeBackCertifiedTie.lean closed T6 for ONE image: convnextInputGrad, the reverse of
convNextForwardTCh, IS the certified gradient at that image. Every shipped ConvNeXt artifact
runs a batch — convnext_adam_train_step and the convnextin_* / convnextsin_* /
convnextbin_* families — and its batched T3 tie (ConvNeXtStepTieGB.lean) states every
activation as StableHLO.batchMap B of the per-example prefix and every cotangent as
batchMapAux B of the per-example chain, because LayerNorm is per-example and no ConvNeXt op
couples examples. This file closes T6 at that index: the twelve-stage batched chain
convnextInputGradB (ConvNeXtBackChains.lean), every slot the per-example slot lifted at the
batched saved activation, IS the certified gradient of batchMap B convNextForwardTCh at every
batch x, for every B and every class count nC. ConvNeXt was the last net without a batched
whole-net tie (planning/archive/renderer_convergence.md leg 3: its ImageNet artifacts never had
a batched fold); with this the *InputGradB_eq_*_vjp family covers all seven nets.
Nothing here is new mathematics, and it is ViT's batched tie (ViTWholeBackCertifiedTieB.lean)
one architecture over: ConvNeXt is smooth everywhere, so every stage has a GLOBAL HasVJP and its
batched witness is batchMap_has_vjp_at over HasVJP.toHasVJPAt at each row — no smooth-point
hypothesis anywhere, only the 23 LayerNorm positivities the per-example tie already carries.
cnxSavedB0 … cnxSavedB10— the eleven batched stage inputs, as reducible functions of the batch saved STAGE BY STAGE (batchMap B stage ∘ cnxSavedB_{k-1} B w), not asbatchMap Bof the composed per-example prefix: the two agree only up tobatchMap_comp, notrfl, and the apex'svjp_comp_diff_atproduces the former. Each is also its apex level's inner map, so the stage witness above it sits atcnxSavedB_k B w xon the nose (item 4).- The twelve batched stage witnesses
cnx*B_at, eachbatchMap_has_vjp_atover the per-exampleHasVJPat each row — at the dimension spellings the per-example tie normalised (cnxDn1,cnxLNh,cnxSavedA0:ConvNeXtWholeBackCertifiedTie.lean's "two spellings of one numeral" rule holds one batch index over). - The batched leaf ties. GAP's is
rfl(its per-example tie is); the others arefunextto one example, one rewrite of the per-example leaf tie at that example's row, thenrfl—batchMapAux's slice and the lift's.backwardrow are the same term. ⚠ The channel-LN and downsample leaves are proven at VARIABLE dims (cnxChanLNBackB_eq_vjp,cnxDownBackB_eq_vjp) and instantiated by term: at the literal96 56 56the samerflrecurses pastmaxRecDepth 100000on the numerals, the batched form of the per-example tie's "two spellings of one numeral" rule. convNextForwardTChB_has_vjp_at— the twelve-stage apex, elevenvjp_comp_diff_ats over the batched stage witnesses, levelk's inner map namedcnxSavedB_k B w— andconvnextInputGradB_eq_convNextForwardTChB_vjp, the tie: twelve leaf rewrites, then the eleven levels peeled byrw [vjp_comp_diff_at_fst_backward]. ⛔ Neither may leave the kernel a definitional step across the chain. A witness point spelled as the composed chain applied tox(what_elaborates to), or a peel bysimp only(the peel lemma isrfl, so simp records no step), makes the kernel unfold saved activations against the chain underneath the witnesses'.backwards. Spelled that way this module took ~18 min on Lean 4.32.2 and does not check at all on 4.34.0 (kernel timeout; tens of GB with the budget raised). As written it checks in seconds.convNextForwardTChB_eq_chain— the shape check:batchMap Bof the per-example twelve-factor chain IS the twelve batched stages, bybatchMap_compeleven times — andconvnextInputGradB_eq_batchMap_convNextForwardTCh_vjp, the tie carried to the committed GLOBAL witnessbatchMap_has_vjp _ (convNextForwardTCh_has_vjp …)throughHasVJPAt.backward_unique_of_eq, plus the∑ pdivreading onconvNextForwardTChitself.convnextImagenetInputGradB_eq_vjp— the same statement atnC = 1000, the class count of everyconvnextin_*artifact,Ba binder.
The batched stem-conv output — the stem LayerNorm's saved input at every example.
Equations
Instances For
Stage 1's batched saved input.
Equations
- Proofs.cnxSavedB1 B w = Proofs.StableHLO.batchMap B (Proofs.chanLNTensor3 96 56 56 w.sε w.sγ w.sβ) ∘ Proofs.cnxSavedB0 B w
Instances For
Downsample 1's batched saved input.
Equations
- Proofs.cnxSavedB2 B w = Proofs.StableHLO.batchMap B (Proofs.convNextStageChK 3 w.s1) ∘ Proofs.cnxSavedB1 B w
Instances For
Stage 2's batched saved input.
Equations
- Proofs.cnxSavedB3 B w = Proofs.StableHLO.batchMap B (Proofs.cnxDn1 w) ∘ Proofs.cnxSavedB2 B w
Instances For
Downsample 2's batched saved input.
Equations
- Proofs.cnxSavedB4 B w = Proofs.StableHLO.batchMap B (Proofs.convNextStageChK 3 w.s2) ∘ Proofs.cnxSavedB3 B w
Instances For
Stage 3's batched saved input.
Equations
- Proofs.cnxSavedB5 B w = Proofs.StableHLO.batchMap B (Proofs.cnxDn2 w) ∘ Proofs.cnxSavedB4 B w
Instances For
Downsample 3's batched saved input.
Equations
- Proofs.cnxSavedB6 B w = Proofs.StableHLO.batchMap B (Proofs.convNextStageChK 9 w.s3) ∘ Proofs.cnxSavedB5 B w
Instances For
Stage 4's batched saved input.
Equations
- Proofs.cnxSavedB7 B w = Proofs.StableHLO.batchMap B (Proofs.cnxDn3 w) ∘ Proofs.cnxSavedB6 B w
Instances For
GAP's batched saved input.
Equations
- Proofs.cnxSavedB8 B w = Proofs.StableHLO.batchMap B (Proofs.convNextStageChK 3 w.s4) ∘ Proofs.cnxSavedB7 B w
Instances For
The head LayerNorm's batched saved input.
Equations
- Proofs.cnxSavedB9 B w = Proofs.StableHLO.batchMap B (Proofs.globalAvgPoolFlat 768 7 7) ∘ Proofs.cnxSavedB8 B w
Instances For
The classifier's batched saved input.
Equations
- Proofs.cnxSavedB10 B w = Proofs.StableHLO.batchMap B (Proofs.cnxLNh w) ∘ Proofs.cnxSavedB9 B w
Instances For
The batched stem-conv witness at x.
Equations
- Proofs.cnxStemB_at B w x = Proofs.batchMap_has_vjp_at (Proofs.cnxSavedA0 w) x (fun (x_1 : Fin B) => (Proofs.cnxV0 w).toHasVJPAt (Proofs.Mat.unflatten x x_1)) ⋯
Instances For
The batched channel-LayerNorm witness at v, at any c h w.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The batched stem-LayerNorm witness at v.
Equations
- Proofs.cnxStemLNB_at B w hsε v = Proofs.cnxChanLNB_at B 96 56 56 w.sε hsε w.sγ w.sβ v
Instances For
The batched depth-k stage witness at v — one definition for all four stages.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The batched downsample witness at v, at any resolution and channel pair.
Equations
- Proofs.cnxDownB_at B h w p hε v = Proofs.batchMap_has_vjp_at (Proofs.cnxDownChW h w p) v (fun (x : Fin B) => (Proofs.cnxDownChW_has_vjp h w p hε).toHasVJPAt (Proofs.Mat.unflatten v x)) ⋯
Instances For
The batched downsample-1 witness at v, at the chain's dimension spelling (cnxDn1).
Equations
- Proofs.cnxDn1B_at B w hd1 v = Proofs.cnxDownB_at B 28 28 w.d1 hd1 v
Instances For
The batched downsample-2 witness at v, at the chain's dimension spelling (cnxDn2).
Equations
- Proofs.cnxDn2B_at B w hd2 v = Proofs.cnxDownB_at B 14 14 w.d2 hd2 v
Instances For
The batched downsample-3 witness at v, at the chain's dimension spelling (cnxDn3).
Equations
- Proofs.cnxDn3B_at B w hd3 v = Proofs.cnxDownB_at B 7 7 w.d3 hd3 v
Instances For
The batched GAP witness at v.
Equations
- Proofs.cnxGapB_at B v = Proofs.batchMap_has_vjp_at (Proofs.globalAvgPoolFlat 768 7 7) v (fun (x : Fin B) => (Proofs.globalAvgPoolFlat_has_vjp 768 7 7).toHasVJPAt (Proofs.Mat.unflatten v x)) ⋯
Instances For
The batched head-LayerNorm witness at v.
Equations
- Proofs.cnxLNhB_at B w hhε v = Proofs.batchMap_has_vjp_at (Proofs.cnxLNh w) v (fun (x : Fin B) => (Proofs.cnxLNhVjp w hhε).toHasVJPAt (Proofs.Mat.unflatten v x)) ⋯
Instances For
The batched classifier witness at v.
Equations
- Proofs.cnxDenseB_at B w v = Proofs.batchMap_has_vjp_at (Proofs.dense w.Wd w.bd) v (fun (x : Fin B) => (Proofs.dense_has_vjp w.Wd w.bd).toHasVJPAt (Proofs.Mat.unflatten v x)) ⋯
Instances For
The batched stem tie. batchMap B of the reversed-kernel conv at the zero-extended 4×4
kernel IS the lift's backward: flatConvStride4Back_padOdd_eq_vjp_backward at one example's
row. ⛔ padOdd is load-bearing here exactly as in the per-example tie: w.sW is 4×4.
The batched channel-LayerNorm tie, at any c h w — chanLNTensor3Back_eq_chanLN_vjp at
one example's row. ⚠ Generic on purpose: stated at the literal 96 56 56 the closing rfl
recurses past maxRecDepth 100000 on the numerals; at variables it is ViT's vitLNBackB_eq_vjp
and closes at once. The stem instance below is a term.
The batched stem-LayerNorm tie — cnxChanLNBackB_eq_vjp at 96 56 56.
The batched stage tie — cnxStageChKBack_eq_vjp at one example's row, for every depth.
The batched downsample tie, at any resolution — cnxDownChBack_eq_vjp at one example's
row. Generic for the same reason as cnxChanLNBackB_eq_vjp; the three instances below are
terms at the chain's dimension spellings (cnxDn1 … cnxDn3), which is the per-example tie's
cnxDn1Back_eq_vjp … cnxDn3Back_eq_vjp one batch index over. ⛔ padOdd is load-bearing:
p.W is 2×2.
The batched downsample-1 tie — cnxDownBackB_eq_vjp at 28 28.
The batched downsample-2 tie — cnxDownBackB_eq_vjp at 14 14.
The batched downsample-3 tie — cnxDownBackB_eq_vjp at 7 7.
The batched head-LayerNorm tie — cnxLNhBack_eq_vjp at one example's row.
The batched classifier tie — dense_transpose_eq_vjp_backward at one example's row (the
head is linear, so the saved v is free).
The batched whole-net witness, twelve batched stages composed by vjp_comp_diff_at, each
at the batched saved activation the chain uses (cnxSavedB0 … cnxSavedB10). Level k's inner
map is named cnxSavedB_k B w rather than left to the unifier, which would fill it with the
composed chain and put every witness at the chain applied to x (see the module note, item 4).
Equations
- One or more equations did not get rendered due to their size.
Instances For
One vjp_comp_diff_at level's backward, unfolded: the composite runs g's backward, then
f's. Definitional, stated so that a chain of eleven levels peels by rw rather than by a
rfl that has to find the same unfolding through twelve concrete witnesses. ⛔ Not by
simp only: simp would use it as a dsimp step and record nothing for the kernel to replay.
⭐⭐ THE BATCHED TIE. convnextInputGradB with every slot the per-example slot at the
batched saved activation IS the batched apex's backward. Twelve leaf rewrites, the chain's
eleven ∘s applied, then the eleven composition levels peeled by
vjp_comp_diff_at_fst_backward — every step a rw, so the kernel replays rewrites.
The shape check. batchMap B of the per-example twelve-factor chain — the function
convNextForwardTCh_has_vjp is stated on — IS the twelve batched stages the apex is stated
on: batchMap_comp eleven times, and the normalised spellings (cnxLNh, cnxDn1 … cnxDn3,
cnxSavedA0) unfold to the chain's.
⭐⭐ THE APEX, at the committed batched witness. convnextInputGradB IS
(batchMap_has_vjp _ (convNextForwardTCh_has_vjp …) …).backward x — the certified gradient of
the per-example net lifted whole over B examples, for every B, every nC and every batch
x. Carried from the chain-shaped apex by HasVJPAt.backward_unique_of_eq along the shape
check. Only the 23 LayerNorm positivities.
The batched apex, read as the Jacobian of the committed forward. convnextInputGradB is
the pdiv-contracted Jacobian transpose of batchMap B (convNextForwardTCh w) — the
nested-application forward the graph faithfulness convNextFwdGraphTCh_faithful is about —
at EVERY batch and EVERY cotangent, through convNextForwardTCh_eq_chain.
⭐⭐ ConvNeXt-T's BATCHED whole-net backward tie at the ImageNet head — tier T6 at the paper
net and the shipped index. convnextInputGradB_eq_batchMap_convNextForwardTCh_vjp at
nC = 1000, the class count of every convnextin_* / convnextsin_* / convnextbin_*
artifact, at a variable batch B — 64 or 128 per device in those runs, and neither number
appears here. The dims are the paper's (3×224², [3,3,9,3] at 96→192→384→768), so this
is the whole statement at the artifact and not an instance of it. ConvNeXt's entry in the
batched T6 column beside r34InputGradB_eq_r34B_full_vjp,
mnv2InputGradB_eq_mobilenetv2B_full_vjp and vitTinyInputGradB_eq_vitTiny_vjp.