Documentation

LeanMlir.Proofs.Nets.MobileNet.MobileNetV2FullBSeal

MobileNetV2's non-degeneracy seal, on the full-width batched net (levels 2 and 3) #

MobileNetV2FullBVJP.lean proves mobilenetv2ForwardBFullHasVJPAt: the whole-net VJP at any (w, x) satisfying 19 clause bundles — the stem's relu6, one per bottleneck, and the head's — covering 35 relu6 sites, each a two-sided window ≠ 0 ∧ ≠ 6. A conditional theorem of that shape says nothing unless its hypotheses are jointly satisfiable at a point with a nonzero Jacobian. This file exhibits such a point on mobilenetv2ForwardBFull itself: the seventeen bottlenecks of the [t,c,n,s] table, 32→1280 channels, XLA-SAME stride-2 padding, batch BatchNorm, at 224×224.

The witness #

Weights are structural, not trained:

N = 2, and the input is the shared ray sealX t = rayX … t.

Every one of the 35 clauses is weight-only #

Better than ResNet-34, whose post-residual relu still needed 0 ≤ activation. Two facts compose: every relu6 in this net sits directly on a BatchNorm output, and BatchSeal.bnBatchLA_window bounds a BN output inside (0, 6) at every input once |γ|·√(N·h·w) < β = 3; and the linear bottleneck has no relu after the residual add, so there is no post-residual clause at all. The margin holds at every site because the widest is 2·112² = 25 088 and √25 088 / 64 < 2.48 (BatchSeal.margin192). Consequence: no nonnegativity layer, no positional injectivity, and — with no max-pool anywhere in this net — no no-tie argument.

The carrier threads twenty-two BatchNorms #

MobileNetV2's channel-changing blocks have no skip — the body is the block — so unlike ResNet's carrier, which saw only the projection of each downsample, this one crosses every BN inside them: 1 (stem) + 2 (b1) + 3 × 6 + 1 (head). The ten residual blocks pass it through untouched. BatchSeal.EDiff is the invariant, BatchSeal.bnBatchLA_exdiff the step that survives per-channel batch BN, and BatchSeal.eDiff_dw is the one new shape: a depthwise cannot broadcast, so where a centre-tap conv collapses the carrier to fun _ => s · δ 0 at every output channel, a centre-tap depthwise scales the whole function δ channel by channel. The class-0 output difference between the two examples is t · Rr t with Rr a 22-fold product of 1/64 · istd, continuous and positive, so g'(0) = Rr 0 ≠ 0.

Note: every collapse below is stated at variable N, h, w, ic, mid, oc and instantiated at the witness's numerals afterwards, never proved at them.

noncomputable def Proofs.Mnv2FullBSeal.sealW (nCls : ℕ) :
Equations
  • One or more equations did not get rendered due to their size.
Instances For
    @[reducible, inline]
    abbrev Proofs.Mnv2FullBSeal.Mg (N h w : ℕ) :
    Equations
    Instances For
      theorem Proofs.Mnv2FullBSeal.win (N oc h w : ℕ) (hm : Mg N h w) (v : Vec (N * (oc * h * w))) (k : Fin (N * (oc * h * w))) :
      0 < StableHLO.bnBatchLA N oc h w 1 (BatchSeal.kv oc (1 / 64)) (BatchSeal.kv oc 3) v k ∧ StableHLO.bnBatchLA N oc h w 1 (BatchSeal.kv oc (1 / 64)) (BatchSeal.kv oc 3) v k < 6
      noncomputable def Proofs.Mnv2FullBSeal.sealX (t : ℝ) :
      Vec (2 * (3 * (2 * 112) * (2 * 112)))

      The witness input: the shared ray at 224×224, N = 2. Both examples carry the same ramp in channel 0, and sealV adds t to all of example 0's channel 0. Every clause of this net is weight-only, so the ramp is doing no work beyond keeping one witness shape across the four sealed nets.

      Equations
      Instances For
        noncomputable def Proofs.Mnv2FullBSeal.sealV :
        Vec (2 * (3 * (2 * 112) * (2 * 112)))

        Its direction — all of example 0's channel 0.

        Equations
        Instances For
          theorem Proofs.Mnv2FullBSeal.eDiff_sealX (t : ℝ) :
          BatchSeal.EDiff (fun (ci : Fin 3) => if ↑ci = 0 then t else 0) (sealX t)
          noncomputable def Proofs.Mnv2FullBSeal.rf (n : ℕ) (z : Vec n) :
          Equations
          Instances For
            theorem Proofs.Mnv2FullBSeal.rf_pos (n : ℕ) (z : Vec n) :
            0 < rf n z
            theorem Proofs.Mnv2FullBSeal.seal_stem_smooth (N h w : ℕ) {ic oc kH kW : ℕ} (Ws : Kernel4 oc ic kH kW) (bs : Vec oc) (hm : Mg N h w) (x : Vec (N * (ic * (2 * h) * (2 * w)))) :
            MNV2StemSmoothAtB N h w Ws bs 1 (BatchSeal.kv oc (1 / 64)) (BatchSeal.kv oc 3) x
            theorem Proofs.Mnv2FullBSeal.sc_stem (nCls : ℕ) (t : ℝ) :
            MNV2StemSmoothAtB 2 112 112 (sealW nCls).sW (sealW nCls).sb (sealW nCls).sε (sealW nCls).sγ (sealW nCls).sβ (sealX t)
            theorem Proofs.Mnv2FullBSeal.sc1 (nCls : ℕ) (t : ℝ) :
            IVNoExpSmoothAtB 2 112 112 (sealW nCls).b1 (mnv2PreB0 2 (sealW nCls) (sealX t))
            theorem Proofs.Mnv2FullBSeal.sc2 (nCls : ℕ) (t : ℝ) :
            IVStridedSmoothAtB 2 56 56 (sealW nCls).b2 (mnv2PreB1 2 (sealW nCls) (sealX t))
            theorem Proofs.Mnv2FullBSeal.sc3 (nCls : ℕ) (t : ℝ) :
            IVSmoothAtB 2 56 56 (sealW nCls).b3 (mnv2PreB2 2 (sealW nCls) (sealX t))
            theorem Proofs.Mnv2FullBSeal.sc4 (nCls : ℕ) (t : ℝ) :
            IVStridedSmoothAtB 2 28 28 (sealW nCls).b4 (mnv2PreB3 2 (sealW nCls) (sealX t))
            theorem Proofs.Mnv2FullBSeal.sc5 (nCls : ℕ) (t : ℝ) :
            IVSmoothAtB 2 28 28 (sealW nCls).b5 (mnv2PreB4 2 (sealW nCls) (sealX t))
            theorem Proofs.Mnv2FullBSeal.sc_head (nCls : ℕ) (t : ℝ) :
            MNV2HeadSmoothAtB 2 7 7 (sealW nCls).hW (sealW nCls).hb (sealW nCls).hε (sealW nCls).hγ (sealW nCls).hβ (mnv2PreB17 2 (sealW nCls) (sealX t))

            Every ε of the witness is 1.

            theorem Proofs.Mnv2FullBSeal.seal_smooth (nCls : ℕ) (t : ℝ) :

            The nineteen bundles above, as the apex's one smoothness hypothesis.

            noncomputable def Proofs.Mnv2FullBSeal.sealVJP (nCls : ℕ) (t : ℝ) :

            The whole-net VJP at the witness — all 19 bundles discharged, on mobilenetv2ForwardBFull itself (through mobilenetv2ForwardBFull_eq_chain).

            Equations
            Instances For
              noncomputable def Proofs.Mnv2FullBSeal.Z1p (nCls : ℕ) (t : ℝ) :
              Vec (2 * (16 * 112 * 112))
              Equations
              Instances For
                noncomputable def Proofs.Mnv2FullBSeal.Z2p (nCls : ℕ) (t : ℝ) :
                Vec (2 * (24 * 56 * 56))
                Equations
                Instances For
                  noncomputable def Proofs.Mnv2FullBSeal.Z4p (nCls : ℕ) (t : ℝ) :
                  Vec (2 * (32 * 28 * 28))
                  Equations
                  Instances For
                    noncomputable def Proofs.Mnv2FullBSeal.Z7p (nCls : ℕ) (t : ℝ) :
                    Vec (2 * (64 * 14 * 14))
                    Equations
                    Instances For
                      noncomputable def Proofs.Mnv2FullBSeal.Z11p (nCls : ℕ) (t : ℝ) :
                      Vec (2 * (96 * 14 * 14))
                      Equations
                      Instances For
                        noncomputable def Proofs.Mnv2FullBSeal.Z14p (nCls : ℕ) (t : ℝ) :
                        Vec (2 * (160 * 7 * 7))
                        Equations
                        Instances For
                          noncomputable def Proofs.Mnv2FullBSeal.Ah (nCls : ℕ) (t : ℝ) :
                          Vec (2 * (1280 * 7 * 7))
                          Equations
                          Instances For
                            theorem Proofs.Mnv2FullBSeal.pc0 (nCls : ℕ) (t : ℝ) :
                            mnv2PreB0 2 (sealW nCls) (sealX t) = StableHLO.bnBatchLA 2 32 112 112 1 (BatchSeal.kv 32 (1 / 64)) (BatchSeal.kv 32 3) (Zs t)
                            theorem Proofs.Mnv2FullBSeal.pc1 (nCls : ℕ) (t : ℝ) :
                            mnv2PreB1 2 (sealW nCls) (sealX t) = StableHLO.bnBatchLA 2 16 112 112 1 (BatchSeal.kv 16 (1 / 64)) (BatchSeal.kv 16 0) (Z1p nCls t)
                            theorem Proofs.Mnv2FullBSeal.pc2 (nCls : ℕ) (t : ℝ) :
                            mnv2PreB2 2 (sealW nCls) (sealX t) = StableHLO.bnBatchLA 2 24 56 56 1 (BatchSeal.kv 24 (1 / 64)) (BatchSeal.kv 24 0) (Z2p nCls t)
                            theorem Proofs.Mnv2FullBSeal.pc3 (nCls : ℕ) (t : ℝ) :
                            mnv2PreB3 2 (sealW nCls) (sealX t) = mnv2PreB2 2 (sealW nCls) (sealX t)
                            theorem Proofs.Mnv2FullBSeal.pc4 (nCls : ℕ) (t : ℝ) :
                            mnv2PreB4 2 (sealW nCls) (sealX t) = StableHLO.bnBatchLA 2 32 28 28 1 (BatchSeal.kv 32 (1 / 64)) (BatchSeal.kv 32 0) (Z4p nCls t)
                            theorem Proofs.Mnv2FullBSeal.pc5 (nCls : ℕ) (t : ℝ) :
                            mnv2PreB5 2 (sealW nCls) (sealX t) = mnv2PreB4 2 (sealW nCls) (sealX t)
                            theorem Proofs.Mnv2FullBSeal.pc6 (nCls : ℕ) (t : ℝ) :
                            mnv2PreB6 2 (sealW nCls) (sealX t) = mnv2PreB5 2 (sealW nCls) (sealX t)
                            theorem Proofs.Mnv2FullBSeal.pc7 (nCls : ℕ) (t : ℝ) :
                            mnv2PreB7 2 (sealW nCls) (sealX t) = StableHLO.bnBatchLA 2 64 14 14 1 (BatchSeal.kv 64 (1 / 64)) (BatchSeal.kv 64 0) (Z7p nCls t)
                            theorem Proofs.Mnv2FullBSeal.pc8 (nCls : ℕ) (t : ℝ) :
                            mnv2PreB8 2 (sealW nCls) (sealX t) = mnv2PreB7 2 (sealW nCls) (sealX t)
                            theorem Proofs.Mnv2FullBSeal.pc9 (nCls : ℕ) (t : ℝ) :
                            mnv2PreB9 2 (sealW nCls) (sealX t) = mnv2PreB8 2 (sealW nCls) (sealX t)
                            theorem Proofs.Mnv2FullBSeal.pc10 (nCls : ℕ) (t : ℝ) :
                            mnv2PreB10 2 (sealW nCls) (sealX t) = mnv2PreB9 2 (sealW nCls) (sealX t)
                            theorem Proofs.Mnv2FullBSeal.pc11 (nCls : ℕ) (t : ℝ) :
                            mnv2PreB11 2 (sealW nCls) (sealX t) = StableHLO.bnBatchLA 2 96 14 14 1 (BatchSeal.kv 96 (1 / 64)) (BatchSeal.kv 96 0) (Z11p nCls t)
                            theorem Proofs.Mnv2FullBSeal.pc12 (nCls : ℕ) (t : ℝ) :
                            mnv2PreB12 2 (sealW nCls) (sealX t) = mnv2PreB11 2 (sealW nCls) (sealX t)
                            theorem Proofs.Mnv2FullBSeal.pc13 (nCls : ℕ) (t : ℝ) :
                            mnv2PreB13 2 (sealW nCls) (sealX t) = mnv2PreB12 2 (sealW nCls) (sealX t)
                            theorem Proofs.Mnv2FullBSeal.pc14 (nCls : ℕ) (t : ℝ) :
                            mnv2PreB14 2 (sealW nCls) (sealX t) = StableHLO.bnBatchLA 2 160 7 7 1 (BatchSeal.kv 160 (1 / 64)) (BatchSeal.kv 160 0) (Z14p nCls t)
                            theorem Proofs.Mnv2FullBSeal.pc15 (nCls : ℕ) (t : ℝ) :
                            mnv2PreB15 2 (sealW nCls) (sealX t) = mnv2PreB14 2 (sealW nCls) (sealX t)
                            theorem Proofs.Mnv2FullBSeal.pc16 (nCls : ℕ) (t : ℝ) :
                            mnv2PreB16 2 (sealW nCls) (sealX t) = mnv2PreB15 2 (sealW nCls) (sealX t)
                            noncomputable def Proofs.Mnv2FullBSeal.dS (t : ℝ) :
                            Fin 32 → ℝ
                            Equations
                            Instances For
                              noncomputable def Proofs.Mnv2FullBSeal.d1d (nCls : ℕ) (t : ℝ) :
                              Fin 32 → ℝ
                              Equations
                              Instances For
                                noncomputable def Proofs.Mnv2FullBSeal.d1p (nCls : ℕ) (t : ℝ) :
                                Fin 16 → ℝ
                                Equations
                                • One or more equations did not get rendered due to their size.
                                Instances For
                                  noncomputable def Proofs.Mnv2FullBSeal.d2d (nCls : ℕ) (t : ℝ) :
                                  Fin 96 → ℝ
                                  Equations
                                  Instances For
                                    noncomputable def Proofs.Mnv2FullBSeal.d2p (nCls : ℕ) (t : ℝ) :
                                    Fin 24 → ℝ
                                    Equations
                                    Instances For
                                      noncomputable def Proofs.Mnv2FullBSeal.d4p (nCls : ℕ) (t : ℝ) :
                                      Fin 32 → ℝ
                                      Equations
                                      Instances For
                                        noncomputable def Proofs.Mnv2FullBSeal.d7p (nCls : ℕ) (t : ℝ) :
                                        Fin 64 → ℝ
                                        Equations
                                        Instances For
                                          noncomputable def Proofs.Mnv2FullBSeal.d11p (nCls : ℕ) (t : ℝ) :
                                          Fin 96 → ℝ
                                          Equations
                                          Instances For
                                            noncomputable def Proofs.Mnv2FullBSeal.d14p (nCls : ℕ) (t : ℝ) :
                                            Fin 160 → ℝ
                                            Equations
                                            Instances For
                                              noncomputable def Proofs.Mnv2FullBSeal.dH (nCls : ℕ) (t : ℝ) :
                                              Fin 1280 → ℝ
                                              Equations
                                              Instances For
                                                theorem Proofs.Mnv2FullBSeal.ed0 (nCls : ℕ) (t : ℝ) :
                                                theorem Proofs.Mnv2FullBSeal.ed1 (nCls : ℕ) (t : ℝ) :
                                                BatchSeal.EDiff (d1p nCls t) (mnv2PreB1 2 (sealW nCls) (sealX t))
                                                theorem Proofs.Mnv2FullBSeal.ed2 (nCls : ℕ) (t : ℝ) :
                                                BatchSeal.EDiff (d2p nCls t) (mnv2PreB2 2 (sealW nCls) (sealX t))
                                                theorem Proofs.Mnv2FullBSeal.ed3 (nCls : ℕ) (t : ℝ) :
                                                BatchSeal.EDiff (d2p nCls t) (mnv2PreB3 2 (sealW nCls) (sealX t))
                                                theorem Proofs.Mnv2FullBSeal.ed4 (nCls : ℕ) (t : ℝ) :
                                                BatchSeal.EDiff (d4p nCls t) (mnv2PreB4 2 (sealW nCls) (sealX t))
                                                theorem Proofs.Mnv2FullBSeal.ed5 (nCls : ℕ) (t : ℝ) :
                                                BatchSeal.EDiff (d4p nCls t) (mnv2PreB5 2 (sealW nCls) (sealX t))
                                                theorem Proofs.Mnv2FullBSeal.ed6 (nCls : ℕ) (t : ℝ) :
                                                BatchSeal.EDiff (d4p nCls t) (mnv2PreB6 2 (sealW nCls) (sealX t))
                                                theorem Proofs.Mnv2FullBSeal.ed7 (nCls : ℕ) (t : ℝ) :
                                                BatchSeal.EDiff (d7p nCls t) (mnv2PreB7 2 (sealW nCls) (sealX t))
                                                theorem Proofs.Mnv2FullBSeal.ed8 (nCls : ℕ) (t : ℝ) :
                                                BatchSeal.EDiff (d7p nCls t) (mnv2PreB8 2 (sealW nCls) (sealX t))
                                                theorem Proofs.Mnv2FullBSeal.ed9 (nCls : ℕ) (t : ℝ) :
                                                BatchSeal.EDiff (d7p nCls t) (mnv2PreB9 2 (sealW nCls) (sealX t))
                                                theorem Proofs.Mnv2FullBSeal.ed10 (nCls : ℕ) (t : ℝ) :
                                                BatchSeal.EDiff (d7p nCls t) (mnv2PreB10 2 (sealW nCls) (sealX t))
                                                theorem Proofs.Mnv2FullBSeal.ed11 (nCls : ℕ) (t : ℝ) :
                                                BatchSeal.EDiff (d11p nCls t) (mnv2PreB11 2 (sealW nCls) (sealX t))
                                                theorem Proofs.Mnv2FullBSeal.ed12 (nCls : ℕ) (t : ℝ) :
                                                BatchSeal.EDiff (d11p nCls t) (mnv2PreB12 2 (sealW nCls) (sealX t))
                                                theorem Proofs.Mnv2FullBSeal.ed13 (nCls : ℕ) (t : ℝ) :
                                                BatchSeal.EDiff (d11p nCls t) (mnv2PreB13 2 (sealW nCls) (sealX t))
                                                theorem Proofs.Mnv2FullBSeal.ed14 (nCls : ℕ) (t : ℝ) :
                                                BatchSeal.EDiff (d14p nCls t) (mnv2PreB14 2 (sealW nCls) (sealX t))
                                                theorem Proofs.Mnv2FullBSeal.ed15 (nCls : ℕ) (t : ℝ) :
                                                BatchSeal.EDiff (d14p nCls t) (mnv2PreB15 2 (sealW nCls) (sealX t))
                                                theorem Proofs.Mnv2FullBSeal.ed16 (nCls : ℕ) (t : ℝ) :
                                                BatchSeal.EDiff (d14p nCls t) (mnv2PreB16 2 (sealW nCls) (sealX t))
                                                noncomputable def Proofs.Mnv2FullBSeal.Rr (nCls : ℕ) (t : ℝ) :

                                                The positive, continuous nonlinear factor. MobileNetV2's channel-changing blocks have no skip, so the carrier threads every BatchNorm inside them: the stem, both of b1's, three each in b2, b4, b7, b11, b14, b17, and the head's. No BatchNorm variance derivative is ever taken — Rr enters only through t * Rr t, whose derivative at 0 is Rr 0 for any Rr continuous there.

                                                Equations
                                                • One or more equations did not get rendered due to their size.
                                                Instances For
                                                  theorem Proofs.Mnv2FullBSeal.Rr_pos (nCls : ℕ) (t : ℝ) :
                                                  0 < Rr nCls t

                                                  R is continuous: every block is, and fun_prop composes the whole seventeen-block trunk once the carrier activations (Z*, A*) and the prefix chain are unfolded to their atoms. Every BN on the witness has ε = 1.

                                                  theorem Proofs.Mnv2FullBSeal.head_eq_dense (nCls : ℕ) (t : ℝ) :
                                                  mnv2HeadB 2 7 7 (sealW nCls).hW (sealW nCls).hb (sealW nCls).hε (sealW nCls).hγ (sealW nCls).hβ (sealW nCls).fcW (sealW nCls).fcb (mnv2PreB17 2 (sealW nCls) (sealX t)) = StableHLO.batchMap 2 (dense (sealW nCls).fcW (sealW nCls).fcb) (StableHLO.batchMap 2 (globalAvgPoolFlat 1280 7 7) (Ah nCls t))
                                                  theorem Proofs.Mnv2FullBSeal.head_diff (nCls : ℕ) (hn : 0 < nCls) (v : Vec (2 * (1280 * 7 * 7))) (δ : Fin 1280 → ℝ) (hv : BatchSeal.EDiff δ v) :
                                                  theorem Proofs.Mnv2FullBSeal.gd_ray (nCls : ℕ) (hn : 0 < nCls) (t : ℝ) :

                                                  The class-0 difference between the two examples, along the ray, is t · Rr t.

                                                  Level 2 — the witness is non-degenerate: the full-width batch-BN MobileNetV2 at the structural weights is NOT constant in its input.

                                                  Level 3 — the whole-net Jacobian is nonzero at the witness.

                                                  theorem Proofs.Mnv2FullBSeal.sealX_backward_nontrivial (nCls : ℕ) (hn : 0 < nCls) :
                                                  ∃ (j₀ : Fin (2 * nCls)) (i₀ : Fin (2 * (3 * (2 * 112) * (2 * 112)))), (sealVJP nCls 0).backward (basisVec j₀) i₀ ≠ 0

                                                  The seal: the proven whole-network backward of the full-width, batch-BatchNorm, seventeen-bottleneck, 224×224 MobileNetV2 — mobilenetv2ForwardBFull, the training-BatchNorm forward the MobileNetV2 train steps run, here at N = 2 — is not the zero map at the witness.