Documentation

LeanMlir.Proofs.Nets.MobileNet.MobileNetV2FullPaperEval

The PAPER-SPEC MobileNetV2 at INFERENCE — all 17 bottlenecks, forward + graph + faithfulness #

The eval twin of MobileNetV2FullPaper.lean. That file states the seventeen-block [t,c,n,s] net at TRAINING BatchNorm, the world its VJP and its typed graph live in; this file states the same ladder at INFERENCE BatchNorm — frozen running statistics at all 52 sites, one shared ε, as the shipped mobilenetv2_fwd_eval does — and proves its typed SHlo graph denotes it — T2 at inference BatchNorm for the paper net, the graph of mobilenetv2_fwd_eval.mlir and its 1000-class twin. (Built 2026-09-05 so the whole-net float budget could end at a graph; the budget was deleted 2026-09-08 and the graph statement stays — planning/archive/proofs_tier_to_paper_nets.md 3.2(e).)

Pure enumeration and chaining of MobileNetV2RenderPCEval.lean's four inference stage abbreviations (ivExpandPCEval / ivDepthwisePCEval / ivDepthwiseStridedPCEval / ivProjectPCEval) and its two bodies, generic in the class count. No new mathematics and no new tokens: every BatchNorm node's den is bnPerChannelEvalTensor3, proved once.

The SSA names are the committed ones, and that is the point of this file's graph. The seventeen-block TRAINING graph names its parameters %b17gp/%b17btp, where the render emits %gp17/%btp17. This file's graph carries bnSiteP's names verbatim: %stnmu/%stnvar for the stem, %b{k}enmu, %b{k}dnmu, %b{k}pnmu and their nvar peers per block, %hnmu/%hnvar for the head, around irSig/irSigNoExp's %We{k}/%ge{k}/%bte{k}/%Wd{k}/%gd{k}/%btd{k}/%Wp{k}/%gp{k}/ %btp{k}. Names are pretty-printing metadata and do not enter den; matching them is what lets a reader diff the typed graph against the committed text line for line.

What it is tied to. mobilenetv2_fwd_eval.mlir is THIS net: 263 inputs — %x, 158 parameter tensors (paperSig at convBias := false, which is why the graph's bias slots %bs/%bd{k}/… have no argument: the render folds each conv bias into the BatchNorm that follows it) and 104 statistic slots (52 sites × μ, var) — with mobilenetv2in_fwd_eval.mlir its 1000-class twin. The classifier here is generic in nCls, so one theorem covers both.

Paper [t,c,n,s] spec (stem 3×3-s2 3→32 at the XLA-SAME phase; head 1×1 320→1280 → GAP → dense): (1, 16,1,1) (6, 24,2,2) (6, 32,3,2) (6, 64,4,2) (6, 96,3,1) (6,160,3,2) (6,320,1,1)

structure Proofs.IVWEval (ic mid oc : ) :

Weights and running statistics of one MobileNetV2 bottleneck at inference. ⚠ No per-site ε: the eval forward takes ONE shared ε, as the render emits (a single eps constant), where the training bundle IVW carries one per site.

Instances For
    structure Proofs.IVWNoExpEval (ic oc : ) :

    Weights and running statistics of the t=1 first bottleneck (no expand conv) at inference.

    Instances For

      All paper-spec MobileNetV2 parameters and running statistics at inference: stem (3×3-s2 3→32)

      • the 17 bottlenecks of the [t,c,n,s] table + head (1×1 320→1280) + dense (1280→nCls). 52 BatchNorm sites, each with its frozen μ and v.
      Instances For
        noncomputable def Proofs.ivNoExpEvalW (h w : ) (ε : ) {ic oc : } (p : IVWNoExpEval ic oc) :
        Vec (ic * h * w)Vec (oc * h * w)

        t=1 bottleneck at inference (no expand, no skip): project ∘ depthwise.

        Equations
        Instances For
          noncomputable def Proofs.ivExpOnlyEvalW (h w : ) (ε : ) {ic mid oc : } (p : IVWEval ic mid oc) :
          Vec (ic * h * w)Vec (oc * h * w)

          Stride-1 bottleneck WITHOUT skip (ic ≠ oc) at inference.

          Equations
          Instances For
            noncomputable def Proofs.ivResidEvalW (h w : ) (ε : ) {c mid : } (p : IVWEval c mid c) :
            Vec (c * h * w)Vec (c * h * w)

            Stride-1 bottleneck WITH the identity skip at inference.

            Equations
            Instances For
              noncomputable def Proofs.ivStridedEvalW (h w : ) (ε : ) {ic mid oc : } (p : IVWEval ic mid oc) :
              Vec (ic * (2 * h) * (2 * w))Vec (oc * h * w)

              Stride-2 downsampling bottleneck at inference (XLA-SAME depthwise).

              Equations
              Instances For
                noncomputable def Proofs.mobilenetv2ForwardPaperEval {nCls : } (ε : ) (w : MNV2PaperWeightsEval nCls) (x : Vec (3 * 224 * 224)) :
                Vec nCls

                The seventeen-block MobileNetV2 inference forward — the paper [t,c,n,s] ladder with frozen running statistics at all 52 BatchNorm sites, at one shared ε. Nested-application form (NOT ), as the training twin, so the faithfulness proof closes by simp and rfl.

                Equations
                • One or more equations did not get rendered due to their size.
                Instances For
                  def Proofs.StableHLO.ivNoExpGraphEvalW (k epsStr : String) (h w : ) (ε : ) {ic oc : } (p : IVWNoExpEval ic oc) (e : SHlo (ic * h * w)) :
                  SHlo (oc * h * w)

                  t=1 bottleneck inference graph: bnEval ∘ conv1×1 ∘ relu6 ∘ bnEval ∘ depthwise.

                  Equations
                  • One or more equations did not get rendered due to their size.
                  Instances For
                    theorem Proofs.StableHLO.ivNoExpGraphEvalW_faithful (k epsStr : String) (h w : ) (ε : ) {ic oc : } (p : IVWNoExpEval ic oc) (e : SHlo (ic * h * w)) :
                    den (ivNoExpGraphEvalW k epsStr h w ε p e) = ivNoExpEvalW h w ε p (den e)
                    def Proofs.StableHLO.ivExpOnlyGraphEvalW (k epsStr : String) (h w : ) (ε : ) {ic mid oc : } (p : IVWEval ic mid oc) (e : SHlo (ic * h * w)) :
                    SHlo (oc * h * w)

                    Stride-1 no-skip bottleneck inference graph: expand → depthwise → project.

                    Equations
                    • One or more equations did not get rendered due to their size.
                    Instances For
                      theorem Proofs.StableHLO.ivExpOnlyGraphEvalW_faithful (k epsStr : String) (h w : ) (ε : ) {ic mid oc : } (p : IVWEval ic mid oc) (e : SHlo (ic * h * w)) :
                      den (ivExpOnlyGraphEvalW k epsStr h w ε p e) = ivExpOnlyEvalW h w ε p (den e)
                      def Proofs.StableHLO.ivResidGraphEvalW (k epsStr : String) (h w : ) (ε : ) {c mid : } (p : IVWEval c mid c) (e : SHlo (c * h * w)) :
                      SHlo (c * h * w)

                      Stride-1 skip bottleneck inference graph: the body + the addV identity skip.

                      Equations
                      Instances For
                        theorem Proofs.StableHLO.ivResidGraphEvalW_faithful (k epsStr : String) (h w : ) (ε : ) {c mid : } (p : IVWEval c mid c) (e : SHlo (c * h * w)) :
                        den (ivResidGraphEvalW k epsStr h w ε p e) = ivResidEvalW h w ε p (den e)
                        def Proofs.StableHLO.ivStridedGraphEvalW (k epsStr : String) (h w : ) (ε : ) {ic mid oc : } (p : IVWEval ic mid oc) (e : SHlo (ic * (2 * h) * (2 * w))) :
                        SHlo (oc * h * w)

                        Stride-2 downsampling bottleneck inference graph: expand at 2h×2w → XLA-SAME strided depthwise → project.

                        Equations
                        • One or more equations did not get rendered due to their size.
                        Instances For
                          theorem Proofs.StableHLO.ivStridedGraphEvalW_faithful (k epsStr : String) (h w : ) (ε : ) {ic mid oc : } (p : IVWEval ic mid oc) (e : SHlo (ic * (2 * h) * (2 * w))) :
                          den (ivStridedGraphEvalW k epsStr h w ε p e) = ivStridedEvalW h w ε p (den e)
                          def Proofs.StableHLO.mobilenetv2FwdGraphPaperEval {nCls : } (epsStr : String) (ε : ) (w : MNV2PaperWeightsEval nCls) (x : Vec (3 * 224 * 224)) :
                          SHlo nCls

                          The full paper-spec MobileNetV2 inference forward graph (3×224² → nCls): XLA-SAME strided stem → the 17 bottlenecks of the [t,c,n,s] table → 1×1 conv-bn-relu6 head → GAP → dense, every one of the 52 BatchNorm sites reading frozen running statistics through bnPerChannelEvalF. The typed form of the shipped mobilenetv2_fwd_eval.

                          Equations
                          • One or more equations did not get rendered due to their size.
                          Instances For

                            Seventeen-block inference MobileNetV2 forward faithfulness. The typed graph denotes mobilenetv2ForwardPaperEval — chained from the per-block-kind *GraphEvalW_faithful lemmas and then a structural rfl, the training twin's recipe with bnPerChannelEvalF_faithful in place of bnPerChannelF_faithful.