The PAPER-SPEC MobileNetV2 input-VJP — the fold at all seventeen bottlenecks #
Closes MobileNetV2FullPaper.lean's standing TODO: Proofs.mobilenetv2_has_vjp_at
(MobileNetV2.lean) folds a stem, TWO inverted-residual blocks and a head; this file folds
the whole [t,c,n,s] table — stem + 17 bottlenecks + head — over the packaged IVW/IVWNoExp
weight bundles of MobileNetV2FullPaper.lean.
⚠ The statement is the POINTWISE _at form, and that is not a limitation to be lifted.
MobileNetV2's activation is relu6, which is kinked; a global HasVJP through a kink is false.
EfficientNetFullB0.lean's efficientnetForwardB_full_has_vjp may be global only because
EfficientNet's swish is smooth everywhere. The axis this file moves is DEPTH (2 → 17); the
_at form is the repo standard for relu-family nets and stays.
What this file assembles (no new mathematics) #
The per-block bodies already had certified VJPs — invresBodyPC_has_vjp_at and
invresBodyStridedPC_has_vjp_at (MobileNetV2BackCertifiedTie.lean), built there as the §B
tie targets. So the eight iv*W_{has_vjp_at, differentiableAt} bundle lemmas below are
delegations in the EfficientNetFullB0 style, not fresh six-operation compositions. Only two
per-stage pieces were genuinely missing and are supplied here: the differentiability peers of
those two body VJPs, and the per-channel STRIDED stem stage convBnRelu6StridedPC_*
(MobileNetV2.lean's convBnRelu6Strided_* is the global-bnForward twin, not the
per-channel one the paper-spec net renders).
The hypothesis budget, and why the prefix defs exist #
Seventeen blocks carry 33 relu6 sites plus the stem's and the head's, each of which must be
stated AT the running activation. Spelled inline that is unreadable by block 5 and quadratic
in the writing. So the running activations are named — mnv2StemW, then mnv2Pre1 … mnv2Pre17,
each one ∘ deeper — and the kink conditions are bundled per block into IVSmoothAt /
IVStridedSmoothAt / IVNoExpSmoothAt. The BN-epsilon positivity is bundled the same way
(IVPos, IVNoExpPos). The theorem then binds 19 smoothness hypotheses and 19 positivity
bundles rather than 35 and 52 loose ones.
The prefix defs double as the chain: mnv2Pre17 IS the 17-block trunk, so the VJP is stated
on mnv2HeadW w ∘ mnv2Pre17 w and mobilenetv2ForwardPaper_eq_chain bridges that back to the
nested-application forward, exactly as efficientnetForwardB_full_eq_chain does for B0.
Strided stem stage VJP, per-channel BN: relu6 ∘ bnPC ∘ flatConvStride2Xla. The per-channel
twin of MobileNetV2.lean's convBnRelu6Strided_has_vjp_at, in the bnPerChannelTensor3
vocabulary the paper-spec net renders.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Differentiability peer of invresBodyPC_has_vjp_at (which MobileNetV2BackCertifiedTie
did not need, having no residual wrapper to feed).
Differentiability peer of invresBodyStridedPC_has_vjp_at.
The single relu6 site of the t=1 bottleneck (depthwise-BN output) is away from the kink.
- hd (k : Fin (ic * h * w)) : bnPerChannelTensor3 ic h w q.dε q.dγ q.dβ (depthwiseFlat q.dW q.db v) k ≠ 0 ∧ bnPerChannelTensor3 ic h w q.dε q.dγ q.dβ (depthwiseFlat q.dW q.db v) k ≠ 6
Instances For
t=1 bottleneck VJP: ivProjectPC ∘ ivDepthwisePC. The one block shape with no
invresBody*PC body lemma to delegate to, so it composes its two stages here.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Stride-1 no-skip bottleneck VJP — invresBodyPC_has_vjp_at at the bundle's fields.
Equations
Instances For
Stride-1 skip bottleneck VJP — the body VJP under residual_has_vjp_at. The identity arm is
smooth everywhere, so it adds no hypothesis.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Stride-2 downsampling bottleneck VJP — invresBodyStridedPC_has_vjp_at at the bundle.
Equations
Instances For
The paper-spec stem: 3×3 stride-2 conv 3→32 at 224² → per-channel BN → relu6.
Equations
- Proofs.mnv2StemW w = Proofs.relu6 (32 * 112 * 112) ∘ Proofs.bnPerChannelTensor3 32 112 112 w.sε w.sγ w.sβ ∘ Proofs.flatConvStride2Xla w.sW w.sb
Instances For
The paper-spec head: 1×1 conv 320→1280 → per-channel BN → relu6 → GAP → dense 1280→10.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Stem relu6 away from the kink at the input x.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Head relu6 away from the kink at the trunk output v.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Proofs.mnv2StemW_has_vjp_at w hs x h_stem = Proofs.convBnRelu6StridedPC_has_vjp_at w.sW w.sb w.sε w.sγ w.sβ hs x h_stem
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Proofs.mnv2Pre1 w = Proofs.ivNoExpW 112 112 w.b1 ∘ Proofs.mnv2StemW w
Instances For
Equations
- Proofs.mnv2Pre2 w = Proofs.ivStridedW 56 56 w.b2 ∘ Proofs.mnv2Pre1 w
Instances For
Equations
- Proofs.mnv2Pre3 w = Proofs.ivResidW 56 56 w.b3 ∘ Proofs.mnv2Pre2 w
Instances For
Equations
- Proofs.mnv2Pre4 w = Proofs.ivStridedW 28 28 w.b4 ∘ Proofs.mnv2Pre3 w
Instances For
Equations
- Proofs.mnv2Pre5 w = Proofs.ivResidW 28 28 w.b5 ∘ Proofs.mnv2Pre4 w
Instances For
Equations
- Proofs.mnv2Pre6 w = Proofs.ivResidW 28 28 w.b6 ∘ Proofs.mnv2Pre5 w
Instances For
Equations
- Proofs.mnv2Pre7 w = Proofs.ivStridedW 14 14 w.b7 ∘ Proofs.mnv2Pre6 w
Instances For
Equations
- Proofs.mnv2Pre8 w = Proofs.ivResidW 14 14 w.b8 ∘ Proofs.mnv2Pre7 w
Instances For
Equations
- Proofs.mnv2Pre9 w = Proofs.ivResidW 14 14 w.b9 ∘ Proofs.mnv2Pre8 w
Instances For
Equations
- Proofs.mnv2Pre10 w = Proofs.ivResidW 14 14 w.b10 ∘ Proofs.mnv2Pre9 w
Instances For
Equations
- Proofs.mnv2Pre11 w = Proofs.ivExpOnlyW 14 14 w.b11 ∘ Proofs.mnv2Pre10 w
Instances For
Equations
- Proofs.mnv2Pre12 w = Proofs.ivResidW 14 14 w.b12 ∘ Proofs.mnv2Pre11 w
Instances For
Equations
- Proofs.mnv2Pre13 w = Proofs.ivResidW 14 14 w.b13 ∘ Proofs.mnv2Pre12 w
Instances For
Equations
- Proofs.mnv2Pre14 w = Proofs.ivStridedW 7 7 w.b14 ∘ Proofs.mnv2Pre13 w
Instances For
Equations
- Proofs.mnv2Pre15 w = Proofs.ivResidW 7 7 w.b15 ∘ Proofs.mnv2Pre14 w
Instances For
Equations
- Proofs.mnv2Pre16 w = Proofs.ivResidW 7 7 w.b16 ∘ Proofs.mnv2Pre15 w
Instances For
Equations
- Proofs.mnv2Pre17 w = Proofs.ivExpOnlyW 7 7 w.b17 ∘ Proofs.mnv2Pre16 w
Instances For
The paper-spec MobileNetV2 has a (correct) input-VJP at a smooth point — all seventeen
bottlenecks. Chains stem → the 17 blocks of the [t,c,n,s] table → head with
vjp_comp_at, one IVPos bundle and one *SmoothAt bundle per block. The full-depth
replacement for mobilenetv2_has_vjp_at's two-block fold.
⚠ Pointwise (HasVJPAt), not global (HasVJP), and necessarily so: relu6 is kinked, so
each of the 35 activation sites carries a ≠ 0 ∧ ≠ 6 side condition at its running
activation. EfficientNet-B0's global fold is available to it only because swish is smooth.
Equations
- One or more equations did not get rendered due to their size.
Instances For
mobilenetv2ForwardPaper = the ∘-chain the VJP is stated on — the kernel-checked
bridge between the nested-application forward and the layered mnv2PreK form, closing the
same form-gap efficientnetForwardB_full_eq_chain closes for B0. Peeled one layer at a
time through the *_apply lemmas above; see their section header for why the one-step
proofs do not survive (elaborator recursion depth / kernel deterministic timeout).
Public correctness theorem for mobilenetv2_full_has_vjp_at — the seventeen-block
backward equals the pdiv-contracted Jacobian of mobilenetv2ForwardPaper ITSELF (not of
the chain it is stated on), tied back through mobilenetv2ForwardPaper_eq_chain. The
full-depth analogue of mobilenetv2_has_vjp_at_correct.