Documentation

LeanMlir.Proofs.Nets.MobileNet.MobileNetV4FullBSeal

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

MobileNetV4FullBVJP.lean proves mobilenetv4ForwardBFullHasVJPAt: the whole-net VJP at any (w, x) satisfying eight clause bundles — the stem's relu, the fused stage's, one per resolution group and the head's, 38 relu sites in all (the #guard below counts them off the block table). That statement is pointwise, so it could in principle be vacuous. This file exhibits a (w, x) that discharges every clause — centre-tap kernels on the stem, the fused stage, the three channel-changing rows and the head; the eighteen skip rows zeroed, each block then the exact identity — shows the forward is not constant there, and seals the Jacobian nonzero — hence, through Training/JacobianSeal.lean, the proven backward is not the zero map at that point.

The net is timm's mobilenetv4_conv_medium: relu throughout, BN-only pre-DWs, the stride on each downsample's post-DW, and a head that pools before conv_head, whose BatchNorm therefore normalises the pooled features over the batch alone.

All 38 clauses are weight-only — and generic in the table row #

Every kink in this net is a relu sitting directly on a bnBatchLA output (Mnv4StemSmoothAtB, cbReluLayer.ok, cbReluStridedLayer.ok, mnv4DWReluLayer.ok, mnv4DWReluStridedLayer.ok); projLayer.ok, mnv4DWBnLayer.ok, castLayer.ok and CertLayer.id'.ok are True. bnBatchLA_pos bounds a BatchNorm output above β − |γ|√(N·h·w) > 0 at EVERY input, so with γ = 1, β = 160, ε = 1 the whole bundle is discharged without the activation ever being read — including conv_head's, whose BatchNorm sees N·1·1 = 2 cells.

The carrier #

The input is per-(example, channel) constant (sealX t = t • rayV), so it is an EDiff from the start: example 0 is example 1 plus t on channel 0. Every stage on the carrier's path is a centre-tap conv or depthwise then a BatchNorm, and inside the margin window every relu is the identity, so each stage multiplies the carrier by one positive istd. Seventeen BatchNorms sit on the path: the stem's, the fused stage's two, four in each of rows 1, 3 and 11 (the only rows that change channels, hence the only ones without a skip) and the head's two. The pool in front of conv_head keeps the carrier (a per-channel shift survives an average), and the two relabels are index bijections. The readout along the ray is therefore t · Rr t, with Rr the product of the seventeen istds: continuous and positive, and no BatchNorm variance derivative is taken.

Note: every collapse, every clause bundle and every block lemma here is proved at variable shapes and instantiated at the witness's numerals afterwards, never proved at them.

noncomputable def Proofs.Mnv4FullBSeal.sealW (nCls : ℕ) :
Equations
  • One or more equations did not get rendered due to their size.
Instances For
    @[reducible, inline]
    abbrev Proofs.Mnv4FullBSeal.Mg (N h w : ℕ) :
    Equations
    Instances For
      theorem Proofs.Mnv4FullBSeal.cbReluStridedB_eq {N ic oc h w kH kW : ℕ} (W : Kernel4 oc ic kH kW) (b : Vec oc) (hm : Mg N h w) (x : Vec (N * (ic * (2 * h) * (2 * w)))) :
      noncomputable def Proofs.Mnv4FullBSeal.sealV :
      Vec (2 * (3 * (2 * 112) * (2 * 112)))
      Equations
      Instances For
        noncomputable def Proofs.Mnv4FullBSeal.sealX (t : ℝ) :
        Vec (2 * (3 * (2 * 112) * (2 * 112)))
        Equations
        Instances For
          theorem Proofs.Mnv4FullBSeal.sc_stem (nCls : ℕ) (t : ℝ) :
          StableHLO.Mnv4StemSmoothAtB 2 112 112 (sealW nCls).sW (sealW nCls).sb (sealW nCls).sE (sealW nCls).sg (sealW nCls).sbt (sealX t)

          the head's two relus — cn_960's at 7×7 and conv_head's on the pooled 1×1 (its BatchNorm over the two examples alone); GAP, the relabels and dense are True.

          The eight group conditions above, as the apex's one smoothness hypothesis.

          The whole-net VJP at the witness — all eight bundles discharged.

          Equations
          Instances For
            noncomputable def Proofs.Mnv4FullBSeal.As (t : ℝ) :
            Vec (2 * (32 * 112 * 112))
            Equations
            Instances For
              noncomputable def Proofs.Mnv4FullBSeal.A1p (t : ℝ) :
              Vec (2 * (48 * 56 * 56))
              Equations
              Instances For
                noncomputable def Proofs.Mnv4FullBSeal.Aaz (t : ℝ) :
                Vec (2 * (80 * 28 * 28))
                Equations
                Instances For
                  noncomputable def Proofs.Mnv4FullBSeal.Abz (t : ℝ) :
                  Vec (2 * (160 * 14 * 14))
                  Equations
                  Instances For
                    noncomputable def Proofs.Mnv4FullBSeal.Acz (t : ℝ) :
                    Vec (2 * (256 * 7 * 7))
                    Equations
                    Instances For
                      noncomputable def Proofs.Mnv4FullBSeal.Ah2 (t : ℝ) :
                      Vec (2 * (1280 * 1 * 1))
                      Equations
                      Instances For
                        noncomputable def Proofs.Mnv4FullBSeal.rf (n : ℕ) (z : Vec n) :

                        one carrier BatchNorm's whole contribution: γ · istd at γ = 1.

                        Equations
                        Instances For
                          theorem Proofs.Mnv4FullBSeal.rf_pos (n : ℕ) (z : Vec n) :
                          0 < rf n z
                          noncomputable def Proofs.Mnv4FullBSeal.dx (t : ℝ) :
                          Fin 3 → ℝ

                          the carrier at the input: t on channel 0.

                          Equations
                          Instances For
                            noncomputable def Proofs.Mnv4FullBSeal.ds (t : ℝ) :
                            Fin 32 → ℝ
                            Equations
                            Instances For
                              noncomputable def Proofs.Mnv4FullBSeal.Rr (t : ℝ) :
                              Equations
                              • One or more equations did not get rendered due to their size.
                              Instances For

                                Rr is continuous: fun_prop composes the carrier's seventeen activations (each written off the one before, back to sealX) once they are unfolded. Every BN has ε = 1.

                                theorem Proofs.Mnv4FullBSeal.pc0 (nCls : ℕ) (t : ℝ) :

                                the stem's relu is the identity here, so mnv4Pre0 IS the stem BatchNorm.

                                theorem Proofs.Mnv4FullBSeal.pc1 (nCls : ℕ) (t : ℝ) :
                                theorem Proofs.Mnv4FullBSeal.pc2 (nCls : ℕ) (t : ℝ) :
                                theorem Proofs.Mnv4FullBSeal.pc3 (nCls : ℕ) (t : ℝ) :
                                theorem Proofs.Mnv4FullBSeal.pc4 (nCls : ℕ) (t : ℝ) :
                                theorem Proofs.Mnv4FullBSeal.pc5 (nCls : ℕ) (t : ℝ) :
                                theorem Proofs.Mnv4FullBSeal.pc6 (nCls : ℕ) (t : ℝ) :
                                theorem Proofs.Mnv4FullBSeal.sealW_Wd (nCls : ℕ) :
                                (sealW nCls).Wd = fun (i : Fin 1280) (j : Fin nCls) => if ↑i = 0 ∧ ↑j = 0 then 1 else 0
                                theorem Proofs.Mnv4FullBSeal.head_eq_dense (nCls : ℕ) (t : ℝ) :
                                StableHLO.mobilenetv4ForwardBFull 2 (sealW nCls) (sealX t) = StableHLO.batchMap 2 (dense (sealW nCls).Wd (sealW nCls).bd) fun (k : Fin (2 * 1280)) => Ah2 t (Fin.cast ⋯ k)

                                The class-0 difference between the two examples, along the ray: t times the seventeen BatchNorm factors on the carrier's path.

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

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

                                theorem Proofs.Mnv4FullBSeal.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, 21-block, 224×224 MobileNetV4-Conv-M — mobilenetv4ForwardBFull, the training-BatchNorm forward of the MobileNetV4 train steps (the mnv4in_emaacc* ones add classifier dropout), here at N = 2 — is not the zero map at the witness.