§B: the MobileNetV2 inverted-residual body backward targets the CERTIFIED VJP #
invresBodyBackPC (MobileNetBackChains.lean) is the hand-composed reverse of the inverted-residual
body, written in the per-op backward maps of BackwardMaps.lean. This file closes §B for that
body: the chain IS the certified input-gradient VJP, in the SAME
non-batched per-channel-BN vocabulary the deployed net renders (invresBodyPC, MobileNetV2RenderPC).
The repo's invresBody_has_vjp_at (MobileNetV2.lean) is for the global-bnForward body, NOT the
deployed per-channel one — so (exactly as r34 built rblkPC_has_vjp_at fresh) we build the certified
per-channel body VJP invresBodyPC_has_vjp_at here (per-channel stage VJPs via bnPerChannelTensor3),
then tie. b1-free: the per-example per-channel body is the non-batched object the chain reverses, no
batchMap reconciliation.
The forward body is invresBodyPC = project ∘ depthwise ∘ expand, each stage (relu6) ∘ bnPC ∘ conv,
so the certified VJP applies projectBack → depthwiseBack → expandBack. invresBodyBackPC
is the peer chain (convFlatBack We ∘ bnBe ∘ reluMaskBack m_e) ∘ (depthwiseFlatBack Wd ∘ bnBd ∘ reluMaskBack m_d) ∘ (convFlatBack Wp ∘ bnBp). The tie pins the per-channel BN backs (bnBe/bnBd/bnBp)
to bnPerChannelTensor3_has_vjp.backward at the saved activations and the relu6 masks (m_e/m_d) to
the actual 0 < preact < 6 clamp-window signs (relu6's certified backward), and ties the two 1×1 convs
- the depthwise via the leaf gates (
convFlatBack_eq_vjp_backward,depthwiseFlatBack_eq_vjp_backward). The conv/depthwise backwards ignore their (linear) primal, the pinned backs/masks carry the certified saved activations, so after rewriting the three convolution leaves everything matches definitionally. 3-axiom-clean.
Expand / stem stage VJP, per-channel BN: relu6 ∘ bnPC ∘ conv. Mirror of convBnRelu6_has_vjp_at
with bnPerChannelTensor3 for bnForward.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Depthwise stage VJP (stride-1), per-channel BN: relu6 ∘ bnPC ∘ depthwise.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Project (linear bottleneck) stage VJP, per-channel BN: bnPC ∘ conv (no relu6, global HasVJP).
Equations
- One or more equations did not get rendered due to their size.
Instances For
Certified VJP of the per-channel-BN inverted-residual body invresBodyPC (stride-1,
non-batched). project ∘ depthwise ∘ expand, mirroring the global invresBody_has_vjp_at with
bnPerChannelTensor3. The same-vocabulary certified target for invresBodyBackPC
— no batched/batchMap reconciliation.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The §B mnv2 body tie: hand-composed backward = certified VJP. invresBodyBackPC, with its
abstract per-channel BN backs pinned to bnPerChannelTensor3_has_vjp.backward at the saved
activations and its relu6 masks pinned to the actual 0 < preact < 6 clamp-window signs (relu6's
certified backward), equals (invresBodyPC_has_vjp_at …).backward. The two 1×1 convs tie via
convFlatBack_eq_vjp_backward (1×1 odd) and the depthwise via depthwiseFlatBack_eq_vjp_backward;
conv/depthwise backwards ignore their (linear) primal, so after rewriting the three leaves
everything matches definitionally. Closes under [propext, Classical.choice, Quot.sound].
Strided depthwise stage VJP, per-channel BN: relu6 ∘ bnPC ∘ depthwiseStride2FlatXla.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Certified VJP of the per-channel-BN strided inverted-residual body invresBodyStridedPC
(downsample, non-batched). project ∘ depthwiseStrided ∘ expand(2h×2w) — the strided twin of
invresBodyPC_has_vjp_at; the same-vocabulary certified target for invresBodyStridedBackPC.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The §B mnv2 strided body tie: hand-composed backward = certified VJP. The downsample peer of
invresBodyBackPC_eq_invresBodyPC_vjp: invresBodyStridedBackPC with its per-channel BN backs and
relu6 masks pinned to the saved activations equals (invresBodyStridedPC_has_vjp_at …).backward.
The strided depthwise ties via depthwiseStride2FlatXlaBack_eq_vjp_backward; the expand conv at the
2h×2w grid and the project conv via convFlatBack_eq_vjp_backward. 3-axiom-clean.