Documentation

LeanMlir.Proofs.Nets.MobileNet.MobileNetV2StepTieB

MobileNetV2's train-step tie at batch BatchNorm — the un-fused, batched whole-net thread #

GradNodesB makes every parameter gradient node of the batched MobileNetV2 train step den-faithful for an arbitrary cotangent. This file removes the "arbitrary": each cotangent is pinned to the one the emitted backward chain delivers, so the whole train step is den-composed forward → loss → backward with no free activation and no symbolic cotangent. It is ResNet34StepTieB.lean's peer.

The block cotangents are not derived here. MobileNetV2FullBVJP's mnv2{ExpOnly,Resid,Strided,NoExp}BHasVJPAt are the certified block backwards, and mnv2{Body,DownBody,ResidBlock}BackBatchedGraph_faithful (MobileNetV2BackB0.lean) prove the emitted backward subgraphs denote them. The four *CotIn_eq_vjp lemmas below (mnv2NoExpCotIn_eq_vjp, mnv2ExpOnlyCotIn_eq_vjp, mnv2ResidCotIn_eq_vjp, mnv2StridedCotIn_eq_vjp) are those statements in this file's vocabulary: each says one block kind's constructed input cotangent is its certified block VJP's backward, under that block's positivity and smoothness hypotheses. The two ends are tied the same way: mnv2HeadCotBlk_eq_vjp (the cotangent the head hands to b17) and mnv2StemCotC_eq_vjp (the stem's conv-output cotangent, through the conv input-VJP the render does not emit).

One parameter-tie bundle covers twelve of the seventeen blocks. A skip block and a stride-1 widening have the SAME parameter cotangents — the identity skip changes only the dx handed to the previous block, which is why MobileNetV2RenderB's irBackStride1GradB is one function with a skip flag rather than two near-copies. So mnv2Stride1TiedB is stated once and instantiated at b3, b5, b6, b8, b9, b10, b12, b13, b15, b16 (skip) and b11, b17 (no skip).

The loss cotangent is the label-smoothed one, at a general target, shared with ResNet-34: Foundation/SmoothedLossCot.lean. MobileNetV2RenderB composes it from the same six kit ops (softmaxRow → subB → scaleB → addVB → shiftB → divConstB) with α at 0.1 and the target arriving as the graph input %onehot — a soft vector under mixup or cutmix.

N is a binder. The single-device artifacts at 32 (mobilenetv2_adam_train_step) or 64 (mobilenetv2in_adam64_train_step) are instances.

Data parallel. In the dp artifacts (e.g. mobilenetv2in_rmsdp64) each gradient node feeds allReduceMeanF and BatchNorm is synchronised across replicas, so a replica's gradient node is not this file's node at its own N. This file describes a data-parallel artifact only at N := R·N: the per-replica statement is MobileNetV2SyncTieB.mnv2_net_syncTiedB, whose right-hand side is mnv2_net_tiedB's node at the global batch.

Precision is a flag on the statement. The ImageNet run the book reports trains from mobilenetv2in_rmsdp64wxdols0eps0001bf16, whose conv and depthwise weight gradients are the bf16 kinds (convWeightGradBBf16, depthwiseWeightGradBBf16, …; Foundation.Bf16GradNodes). Every conv and depthwise weight node below is stated on the renderers' switch — ConvWTiedBAt bf16 / ConvStridedXlaWTiedBAt bf16 / DepthwiseWTiedBAt bf16 / DepthwiseStridedXlaWTiedBAt bf16 (Foundation.GradNodesBAt): bf16 := false is the f32 node, bf16 := true the bf16 one — and the capstone mnv2_net_tiedB takes bf16, so it reaches the bf16 artifacts' gradient nodes read over ℝ exactly as it reads the f32 ones (Bf16Erasure: at the identity rounding the bf16 kind denotes what its f32 peer does). BatchNorm, bias and dense nodes carry no flag because no render switches them.

Classifier dropout is an optional site on the statement. mobilenetv2in_rmsdp64wxdols0eps0001bf16 is a *do* artifact: MobileNetV2RenderB emits dropoutB on the driver's per-element mask %do between the GAP and the dense in the forward, reads the DROPPED activation at the classifier weight gradient (its cin), and applies the same mask to the dense's input-VJP before the GAP backward (Proofs.dropout_vjp_is_self). The head chain, the head bundle and the capstone take the site as cd : Option (Vec (N * 1280)) (Proofs.Foundation.DropSites): none is the drop-free artifacts' chain — the statement exactly as it was — and some m the *do* artifacts', where mnv2HeadCotGapIn is dropout m of the classifier's input-VJP and the dense weight node reads dropout m of the pooled activation (the content of the dropout-tie gate's W, tests/TestDropoutTie.lean). The head is stated at mnv2HeadBDoOpt — mnv2HeadB at none, mnv2HeadBDo at some m, both by rfl — and the net at mobilenetv2ForwardBFullDoOpt, likewise.

bnInB and bnInB_eq_bnBackB are ResNet-34's, imported rather than copied. They are the batched BatchNorm input-cotangent written as the den of the emitted backward op, and its identity with the certified bnBatchLA VJP — both net-agnostic, and they happen to live in the file that first needed them. What MobileNetV2 adds is the TWO-SIDED relu6 mask (relu6MaskB, where r34 threads the one-sided reluMaskB), the depthwise input-VJP and its XLA-SAME strided peer.

The parameter census is 158, and this file states 210 slots #

MobileNetV2RenderB defaults to convBias := false: every conv, depthwise and project bias is folded into the BatchNorm that follows it and bound to zeroBiasPrelude's shared zero constant. So mobilenetv2_adam_train_step.mlir carries 158 updated parameter tensors — stem 3 + b1 6 + 16 blocks × 9 + head 3 + dense 2 — and 210 is the census at convBias := true. The bias conjuncts below are kept (one delegation each, and they cover the flag) and are about ops the committed artifacts do not emit. Nothing here weakens a theorem: every fold is ∀-quantified over op instances, and bias = 0 is one of them.

Conventions, stated because nothing here checks them #

BatchNormbatch (bnBatchLA, reduce [0,2,3], width N·h·w), 52 sites
paddingXLA-SAME at all five stride-2 sites (the stem conv, the four strided depthwises)
activationrelu6, TWO kinks per site (≠ 0 and ≠ 6), 35 sites, none after a project
optimizer formthe RAW gradient (*GradB); this net's renders emit no fused θ − lr·g at all
losslabel-smoothed softmax-CE at a general target, batch-meaned

MobileNetV2RenderB.irBackNoExpGradB, node for node, from the block-output cotangent dyOut:

%dpc = bnBatchBack(pg, pc)   %ddr = convBackBatched(pW)   %ddm = selectMidB(dn)
%ddn = bnBatchBack(dg, dc)   %dxb = depthwiseBackBatched(dW)

with dW,db ← %ddn, dg,dbt ← %ddm, pW,pb ← %dpc, pg,pbt ← %dy.

noncomputable def Proofs.MobileNetV2TieB.mnv2NoExpCotPc (N h w : ℕ) {ic oc : ℕ} (p : IVWNoExp ic oc) (xin : Vec (N * (ic * h * w))) (dyOut : Vec (N * (oc * h * w))) :
Vec (N * (oc * h * w))

Cotangent at the project conv's output. Feeds pW/pb.

Equations
  • One or more equations did not get rendered due to their size.
Instances For
    noncomputable def Proofs.MobileNetV2TieB.mnv2NoExpCotDn (N h w : ℕ) {ic oc : ℕ} (p : IVWNoExp ic oc) (xin : Vec (N * (ic * h * w))) (dyOut : Vec (N * (oc * h * w))) :
    Vec (N * (ic * h * w))

    Cotangent at the depthwise BN's output — the project conv's input-VJP masked by the depthwise relu6. Feeds dg/dbt.

    Equations
    • One or more equations did not get rendered due to their size.
    Instances For
      noncomputable def Proofs.MobileNetV2TieB.mnv2NoExpCotDc (N h w : ℕ) {ic oc : ℕ} (p : IVWNoExp ic oc) (xin : Vec (N * (ic * h * w))) (dyOut : Vec (N * (oc * h * w))) :
      Vec (N * (ic * h * w))

      Cotangent at the depthwise conv's output. Feeds dW/db.

      Equations
      • One or more equations did not get rendered due to their size.
      Instances For
        noncomputable def Proofs.MobileNetV2TieB.mnv2NoExpCotIn (N h w : ℕ) {ic oc : ℕ} (p : IVWNoExp ic oc) (xin : Vec (N * (ic * h * w))) (dyOut : Vec (N * (oc * h * w))) :
        Vec (N * (ic * h * w))

        The block-INPUT cotangent: the depthwise backward, directly — no expand conv and no skip.

        Equations
        Instances For
          noncomputable def Proofs.MobileNetV2TieB.mnv2NoExpBackGraph {N ic oc h w : ℕ} (p : IVWNoExp ic oc) (x : Vec (N * (ic * h * w))) (e : StableHLO.SHlo (N * (oc * h * w))) :
          StableHLO.SHlo (N * (ic * h * w))

          The t = 1 block's backward graph: the two stage graphs chained at their forward activations, dwbrLayer ; projLayer's graph. It lives here rather than in MobileNetV2BackB0.lean because mnv2NoExpB is defined in MobileNetV2FullB.lean, which imports that file.

          Equations
          • One or more equations did not get rendered due to their size.
          Instances For
            theorem Proofs.MobileNetV2TieB.mnv2NoExpBackGraph_faithful {N ic oc h w : ℕ} (p : IVWNoExp ic oc) (hq : IVNoExpPos p) (x : Vec (N * (ic * h * w))) (e : StableHLO.SHlo (N * (oc * h * w))) (hs : IVNoExpSmoothAtB N h w p x) :
            theorem Proofs.MobileNetV2TieB.mnv2NoExpCotIn_eq_vjp (N h w : ℕ) {ic oc : ℕ} (p : IVWNoExp ic oc) (hq : IVNoExpPos p) (xin : Vec (N * (ic * h * w))) (dyOut : Vec (N * (oc * h * w))) (hs : IVNoExpSmoothAtB N h w p xin) :
            mnv2NoExpCotIn N h w p xin dyOut = (mnv2NoExpBHasVJPAt N h w p hq xin hs).backward dyOut

            The emitted t = 1 chain is the certified block VJP's backward, at a block input with IVNoExpSmoothAtB.

            MobileNetV2RenderB.irBackStride1GradB, node for node, from the block-output cotangent dyOut:

            %dpc = bnBatchBack(pg, pc)   %ddr = convBackBatched(pW)         %ddm = selectMidB(dn)
            %ddn = bnBatchBack(dg, dc)   %der = depthwiseBackBatched(dW)    %dem = selectMidB(en)
            %den = bnBatchBack(eg, ec)   %dxb = convBackBatched(eW)
            %dx  = if skip then addVB(%dxb, %dy) else %dxb
            

            with eW,eb ← %den, eg,ebt ← %dem, dW,db ← %ddn, dg,dbt ← %ddm, pW,pb ← %dpc, pg,pbt ← %dy. The skip flag touches only %dx, so all twelve parameter cotangents below are shared between the skip blocks and the two stage-first widenings (b11, b17).

            @[reducible]
            noncomputable def Proofs.MobileNetV2TieB.mnv2XE (N h w : ℕ) {ic mid oc : ℕ} (p : IVW ic mid oc) (xin : Vec (N * (ic * h * w))) :
            Vec (N * (mid * h * w))

            The expand stage's output — the depthwise's input.

            Equations
            Instances For
              noncomputable def Proofs.MobileNetV2TieB.mnv2CotPc (N h w : ℕ) {ic mid oc : ℕ} (p : IVW ic mid oc) (xin : Vec (N * (ic * h * w))) (dyOut : Vec (N * (oc * h * w))) :
              Vec (N * (oc * h * w))

              Cotangent at the project conv's output. Feeds pW/pb.

              Equations
              • One or more equations did not get rendered due to their size.
              Instances For
                noncomputable def Proofs.MobileNetV2TieB.mnv2CotDn (N h w : ℕ) {ic mid oc : ℕ} (p : IVW ic mid oc) (xin : Vec (N * (ic * h * w))) (dyOut : Vec (N * (oc * h * w))) :
                Vec (N * (mid * h * w))

                Cotangent at the depthwise BN's output — the project conv's input-VJP masked by the depthwise relu6. Feeds dg/dbt.

                Equations
                • One or more equations did not get rendered due to their size.
                Instances For
                  noncomputable def Proofs.MobileNetV2TieB.mnv2CotDc (N h w : ℕ) {ic mid oc : ℕ} (p : IVW ic mid oc) (xin : Vec (N * (ic * h * w))) (dyOut : Vec (N * (oc * h * w))) :
                  Vec (N * (mid * h * w))

                  Cotangent at the depthwise conv's output. Feeds dW/db.

                  Equations
                  • One or more equations did not get rendered due to their size.
                  Instances For
                    noncomputable def Proofs.MobileNetV2TieB.mnv2CotEn (N h w : ℕ) {ic mid oc : ℕ} (p : IVW ic mid oc) (xin : Vec (N * (ic * h * w))) (dyOut : Vec (N * (oc * h * w))) :
                    Vec (N * (mid * h * w))

                    Cotangent at the expand BN's output — the depthwise's input-VJP masked by the expand relu6. Feeds eg/ebt.

                    Equations
                    • One or more equations did not get rendered due to their size.
                    Instances For
                      noncomputable def Proofs.MobileNetV2TieB.mnv2CotEc (N h w : ℕ) {ic mid oc : ℕ} (p : IVW ic mid oc) (xin : Vec (N * (ic * h * w))) (dyOut : Vec (N * (oc * h * w))) :
                      Vec (N * (mid * h * w))

                      Cotangent at the expand conv's output. Feeds eW/eb.

                      Equations
                      • One or more equations did not get rendered due to their size.
                      Instances For
                        noncomputable def Proofs.MobileNetV2TieB.mnv2CotInBody (N h w : ℕ) {ic mid oc : ℕ} (p : IVW ic mid oc) (xin : Vec (N * (ic * h * w))) (dyOut : Vec (N * (oc * h * w))) :
                        Vec (N * (ic * h * w))

                        The BODY's input cotangent — the expand conv's backward. This is the whole block-input cotangent for a widening (b11, b17); a skip block adds dyOut to it.

                        Equations
                        Instances For
                          theorem Proofs.MobileNetV2TieB.mnv2ExpOnlyCotIn_eq_vjp (N h w : ℕ) {ic mid oc : ℕ} (p : IVW ic mid oc) (hq : IVPos p) (xin : Vec (N * (ic * h * w))) (dyOut : Vec (N * (oc * h * w))) (hs : IVSmoothAtB N h w p xin) :
                          mnv2CotInBody N h w p xin dyOut = (mnv2ExpOnlyBHasVJPAt N h w p hq xin hs).backward dyOut

                          The emitted stride-1 chain is the certified body VJP's backward — the widening blocks' _eq_vjp, from mnv2BodyBackBatchedGraph_faithful.

                          noncomputable def Proofs.MobileNetV2TieB.mnv2ResidCotIn (N h w : ℕ) {c mid : ℕ} (p : IVW c mid c) (xin dyOut : Vec (N * (c * h * w))) :
                          Vec (N * (c * h * w))

                          The SKIP block's input cotangent: the body branch plus the identity skip, the addVB fan-in the render emits.

                          Equations
                          Instances For
                            theorem Proofs.MobileNetV2TieB.mnv2ResidCotIn_eq_vjp (N h w : ℕ) {c mid : ℕ} (p : IVW c mid c) (hq : IVPos p) (xin dyOut : Vec (N * (c * h * w))) (hs : IVSmoothAtB N h w p xin) :
                            mnv2ResidCotIn N h w p xin dyOut = (mnv2ResidBHasVJPAt N h w p hq xin hs).backward dyOut

                            The emitted residual fan-in is the certified skip-block VJP's backward, from mnv2ResidBlockBackBatchedGraph_faithful. No add_comm is needed here, unlike ResNet-34's downsample block: the render emits addVB(body, %dy) and residualBackGraph builds the fan-in in the same order.

                            MobileNetV2RenderB.irBackStridedGradB: the stride-1 chain with the depthwise replaced by its XLA-SAME strided peer, so the expand half runs at the 2h × 2w input grid and %der upsamples. There is no skip, so %dx is %dxb directly.

                            @[reducible]
                            noncomputable def Proofs.MobileNetV2TieB.mnv2XES (N h w : ℕ) {ic mid oc : ℕ} (p : IVW ic mid oc) (xin : Vec (N * (ic * (2 * h) * (2 * w)))) :
                            Vec (N * (mid * (2 * h) * (2 * w)))

                            The expand stage's output at the pre-downsample grid — the strided depthwise's input.

                            Equations
                            Instances For
                              noncomputable def Proofs.MobileNetV2TieB.mnv2SCotPc (N h w : ℕ) {ic mid oc : ℕ} (p : IVW ic mid oc) (xin : Vec (N * (ic * (2 * h) * (2 * w)))) (dyOut : Vec (N * (oc * h * w))) :
                              Vec (N * (oc * h * w))

                              Cotangent at the project conv's output. Feeds pW/pb.

                              Equations
                              • One or more equations did not get rendered due to their size.
                              Instances For
                                noncomputable def Proofs.MobileNetV2TieB.mnv2SCotDn (N h w : ℕ) {ic mid oc : ℕ} (p : IVW ic mid oc) (xin : Vec (N * (ic * (2 * h) * (2 * w)))) (dyOut : Vec (N * (oc * h * w))) :
                                Vec (N * (mid * h * w))

                                Cotangent at the strided depthwise BN's output. Feeds dg/dbt.

                                Equations
                                • One or more equations did not get rendered due to their size.
                                Instances For
                                  noncomputable def Proofs.MobileNetV2TieB.mnv2SCotDc (N h w : ℕ) {ic mid oc : ℕ} (p : IVW ic mid oc) (xin : Vec (N * (ic * (2 * h) * (2 * w)))) (dyOut : Vec (N * (oc * h * w))) :
                                  Vec (N * (mid * h * w))

                                  Cotangent at the strided depthwise conv's output. Feeds dW/db.

                                  Equations
                                  • One or more equations did not get rendered due to their size.
                                  Instances For
                                    noncomputable def Proofs.MobileNetV2TieB.mnv2SCotEn (N h w : ℕ) {ic mid oc : ℕ} (p : IVW ic mid oc) (xin : Vec (N * (ic * (2 * h) * (2 * w)))) (dyOut : Vec (N * (oc * h * w))) :
                                    Vec (N * (mid * (2 * h) * (2 * w)))

                                    Cotangent at the expand BN's output, at the 2h × 2w grid — the STRIDED depthwise's input-VJP (which upsamples) masked by the expand relu6. Feeds eg/ebt.

                                    Equations
                                    • One or more equations did not get rendered due to their size.
                                    Instances For
                                      noncomputable def Proofs.MobileNetV2TieB.mnv2SCotEc (N h w : ℕ) {ic mid oc : ℕ} (p : IVW ic mid oc) (xin : Vec (N * (ic * (2 * h) * (2 * w)))) (dyOut : Vec (N * (oc * h * w))) :
                                      Vec (N * (mid * (2 * h) * (2 * w)))

                                      Cotangent at the expand conv's output. Feeds eW/eb.

                                      Equations
                                      • One or more equations did not get rendered due to their size.
                                      Instances For
                                        noncomputable def Proofs.MobileNetV2TieB.mnv2StridedCotIn (N h w : ℕ) {ic mid oc : ℕ} (p : IVW ic mid oc) (xin : Vec (N * (ic * (2 * h) * (2 * w)))) (dyOut : Vec (N * (oc * h * w))) :
                                        Vec (N * (ic * (2 * h) * (2 * w)))

                                        The block-INPUT cotangent: the expand conv's backward. No skip — the downsample changes both spatial and channels.

                                        Equations
                                        Instances For
                                          theorem Proofs.MobileNetV2TieB.mnv2StridedCotIn_eq_vjp (N h w : ℕ) {ic mid oc : ℕ} (p : IVW ic mid oc) (hq : IVPos p) (xin : Vec (N * (ic * (2 * h) * (2 * w)))) (dyOut : Vec (N * (oc * h * w))) (hs : IVStridedSmoothAtB N h w p xin) :
                                          mnv2StridedCotIn N h w p xin dyOut = (mnv2StridedBHasVJPAt N h w p hq xin hs).backward dyOut

                                          The emitted stride-2 chain is the certified downsample-body VJP's backward.

                                          MobileNetV2RenderB, after the seventeen block backwards:

                                          %dsm = selectMidB(stn)   %dsn = bnBatchBack(sg, stc)
                                          

                                          with sW,sb ← %dsn and sg,sbt ← %dsm. There is no conv-back past %x, and no pool: the stem is one XLA-SAME strided conv, its BatchNorm and one relu6.

                                          noncomputable def Proofs.MobileNetV2TieB.mnv2StemCotN (N h w : ℕ) {ic oc kH kW : ℕ} (Ws : Kernel4 oc ic kH kW) (bs : Vec oc) (εs : ℝ) (γs βs : Vec oc) (x : Vec (N * (ic * (2 * h) * (2 * w)))) (cotStem : Vec (N * (oc * h * w))) :
                                          Vec (N * (oc * h * w))

                                          Cotangent at the stem BN's output — the stem relu6's mask. Feeds sg/sbt.

                                          Equations
                                          • One or more equations did not get rendered due to their size.
                                          Instances For
                                            noncomputable def Proofs.MobileNetV2TieB.mnv2StemCotC (N h w : ℕ) {ic oc kH kW : ℕ} (Ws : Kernel4 oc ic kH kW) (bs : Vec oc) (εs : ℝ) (γs βs : Vec oc) (x : Vec (N * (ic * (2 * h) * (2 * w)))) (cotStem : Vec (N * (oc * h * w))) :
                                            Vec (N * (oc * h * w))

                                            Cotangent at the stem conv's output. Feeds sW/sb.

                                            Equations
                                            • One or more equations did not get rendered due to their size.
                                            Instances For
                                              noncomputable def Proofs.MobileNetV2TieB.cStridedXlaInB (N : ℕ) {ic oc h w kH kW : ℕ} (W : Kernel4 oc ic kH kW) (b : Vec oc) (dy : Vec (N * (oc * h * w))) :
                                              Vec (N * (ic * (2 * h) * (2 * w)))

                                              Batched XLA-SAME STRIDED conv input-VJP (upsamples h → 2h). The render emits none — its backward stops at the stem's weight gradient — so this exists only to state the stem tie.

                                              Equations
                                              • One or more equations did not get rendered due to their size.
                                              Instances For
                                                theorem Proofs.MobileNetV2TieB.mnv2StemCotC_eq_vjp (N h w : ℕ) {ic oc kH kW : ℕ} (Ws : Kernel4 oc ic kH kW) (bs : Vec oc) (εs : ℝ) (hεs : 0 < εs) (γs βs : Vec oc) (x : Vec (N * (ic * (2 * h) * (2 * w)))) (cotStem : Vec (N * (oc * h * w))) (hs : MNV2StemSmoothAtB N h w Ws bs εs γs βs x) :
                                                cStridedXlaInB N Ws bs (mnv2StemCotC N h w Ws bs εs γs βs x cotStem) = (mnv2StemBHasVJPAt N h w Ws bs εs hεs γs βs x hs).backward cotStem

                                                The stem's emitted cotangents are its certified VJP's. The conv-output cotangent mnv2StemCotC — what sW/sb read, and mnv2StemCotN before it, what sg/sbt read — pushed through the stem conv's input-VJP is mnv2StemBHasVJPAt's backward, at a stem input with MNV2StemSmoothAtB.

                                                MobileNetV2RenderB, from the loss cotangent g:

                                                %dgi = denseRowBack(Wd)   %dgp = gapBackBatched   %dhm = selectMidB(hn)
                                                %dhn = bnBatchBack(hg, hc)   %dhx = convBackBatched(hW)
                                                

                                                with Wd,bd ← %dy, hW,hb ← %dhn, hg,hbt ← %dhm, and %dhx the cotangent handed to b17. Unlike ResNet-34's, this head is not batchMap of a smooth per-example map — MobileNetV2 puts a 1x1 conv-BN-relu6 in front of the pool — so the chain is spelled here as dens, exactly as EfficientNetStepTie.enetHeadTied spells B0's identically-shaped head.

                                                @[reducible]
                                                noncomputable def Proofs.MobileNetV2TieB.mnv2HeadBDoOpt (N h w : ℕ) {ic oc nCls : ℕ} (Wh : Kernel4 oc ic 1 1) (bh : Vec oc) (εh : ℝ) (γh βh : Vec oc) (Wd : Mat oc nCls) (bd : Vec nCls) (cd : Option (Vec (N * oc))) :
                                                Vec (N * (ic * h * w)) → Vec (N * nCls)

                                                The head with its classifier-dropout site as an Option: none is mnv2HeadB (the drop-free artifacts), some m is mnv2HeadBDo … m (the *do* artifacts: dropout m between the GAP and the dense) — both by rfl. The ties are stated at this head so one statement covers both artifact families.

                                                Equations
                                                • One or more equations did not get rendered due to their size.
                                                Instances For
                                                  theorem Proofs.MobileNetV2TieB.mnv2HeadBDoOpt_none (N h w : ℕ) {ic oc nCls : ℕ} (Wh : Kernel4 oc ic 1 1) (bh : Vec oc) (εh : ℝ) (γh βh : Vec oc) (Wd : Mat oc nCls) (bd : Vec nCls) :
                                                  mnv2HeadBDoOpt N h w Wh bh εh γh βh Wd bd none = mnv2HeadB N h w Wh bh εh γh βh Wd bd
                                                  theorem Proofs.MobileNetV2TieB.mnv2HeadBDoOpt_some (N h w : ℕ) {ic oc nCls : ℕ} (Wh : Kernel4 oc ic 1 1) (bh : Vec oc) (εh : ℝ) (γh βh : Vec oc) (Wd : Mat oc nCls) (bd : Vec nCls) (m : Vec (N * oc)) :
                                                  mnv2HeadBDoOpt N h w Wh bh εh γh βh Wd bd (some m) = mnv2HeadBDo N h w Wh bh εh γh βh Wd bd m
                                                  noncomputable def Proofs.MobileNetV2TieB.mobilenetv2ForwardBFullDoOpt (N : ℕ) {nCls : ℕ} (w : MNV2BWeights nCls) (cd : Option (Vec (N * 1280))) (x : Vec (N * (3 * (2 * 112) * (2 * 112)))) :
                                                  Vec (N * nCls)

                                                  The net at the optional site — mobilenetv2ForwardBFull's nested form with the head at cd: mobilenetv2ForwardBFull at none, mobilenetv2ForwardBFullDo at some m, both rfl. The loss-gradient capstone reads its loss here.

                                                  Equations
                                                  • One or more equations did not get rendered due to their size.
                                                  Instances For
                                                    theorem Proofs.MobileNetV2TieB.mobilenetv2ForwardBFullDoOpt_some (N : ℕ) {nCls : ℕ} (w : MNV2BWeights nCls) (m : Vec (N * 1280)) (x : Vec (N * (3 * (2 * 112) * (2 * 112)))) :
                                                    theorem Proofs.MobileNetV2TieB.mobilenetv2ForwardBFullDoOpt_eq_chain (N : ℕ) {nCls : ℕ} (w : MNV2BWeights nCls) (cd : Option (Vec (N * 1280))) (x : Vec (N * (3 * (2 * 112) * (2 * 112)))) :
                                                    mobilenetv2ForwardBFullDoOpt N w cd x = (mnv2HeadBDoOpt N 7 7 w.hW w.hb w.hε w.hγ w.hβ w.fcW w.fcb cd ∘ mnv2PreB17 N w) x

                                                    mobilenetv2ForwardBFull_eq_chain at the site: the nested form is the head after the trunk.

                                                    noncomputable def Proofs.MobileNetV2TieB.mnv2HeadBDoOptHasVJPAt (N h w : ℕ) {ic oc nCls : ℕ} (Wh : Kernel4 oc ic 1 1) (bh : Vec oc) (εh : ℝ) (hεh : 0 < εh) (γh βh : Vec oc) (Wd : Mat oc nCls) (bd : Vec nCls) (cd : Option (Vec (N * oc))) (v : Vec (N * (ic * h * w))) (hs : MNV2HeadSmoothAtB N h w Wh bh εh γh βh v) :
                                                    HasVJPAt (mnv2HeadBDoOpt N h w Wh bh εh γh βh Wd bd cd) v

                                                    mnv2HeadBHasVJPAt at the site: the dropout's VJP (dropoutOptHasVJP, its backward the op itself) composed between the dense's and the GAP's.

                                                    Equations
                                                    • One or more equations did not get rendered due to their size.
                                                    Instances For
                                                      noncomputable def Proofs.MobileNetV2TieB.mnv2HeadCotGapIn (N : ℕ) {oc nCls : ℕ} (Wd : Mat oc nCls) (cd : Option (Vec (N * oc))) (g : Vec (N * nCls)) :
                                                      Vec (N * oc)

                                                      Cotangent at the GAP output — the classifier's input-VJP, through the classifier-dropout site when it is rendered: the *do* artifacts' backward applies the mask %do to the dense's input-VJP before the GAP backward (Proofs.dropout_vjp_is_self); none is the drop-free chain.

                                                      Equations
                                                      Instances For
                                                        noncomputable def Proofs.MobileNetV2TieB.mnv2HeadCotHr (N h w : ℕ) {oc nCls : ℕ} (Wd : Mat oc nCls) (cd : Option (Vec (N * oc))) (g : Vec (N * nCls)) :
                                                        Vec (N * (oc * h * w))

                                                        Cotangent at the head relu6's output — the GAP backward.

                                                        Equations
                                                        Instances For
                                                          noncomputable def Proofs.MobileNetV2TieB.mnv2HeadCotHn (N h w : ℕ) {ic oc nCls : ℕ} (Wh : Kernel4 oc ic 1 1) (bh : Vec oc) (εh : ℝ) (γh βh : Vec oc) (Wd : Mat oc nCls) (cd : Option (Vec (N * oc))) (xin : Vec (N * (ic * h * w))) (g : Vec (N * nCls)) :
                                                          Vec (N * (oc * h * w))

                                                          Cotangent at the head BN's output — the head relu6's mask. Feeds hg/hbt.

                                                          Equations
                                                          • One or more equations did not get rendered due to their size.
                                                          Instances For
                                                            noncomputable def Proofs.MobileNetV2TieB.mnv2HeadCotHc (N h w : ℕ) {ic oc nCls : ℕ} (Wh : Kernel4 oc ic 1 1) (bh : Vec oc) (εh : ℝ) (γh βh : Vec oc) (Wd : Mat oc nCls) (cd : Option (Vec (N * oc))) (xin : Vec (N * (ic * h * w))) (g : Vec (N * nCls)) :
                                                            Vec (N * (oc * h * w))

                                                            Cotangent at the head conv's output. Feeds hW/hb.

                                                            Equations
                                                            • One or more equations did not get rendered due to their size.
                                                            Instances For
                                                              noncomputable def Proofs.MobileNetV2TieB.mnv2HeadCotBlk (N h w : ℕ) {ic oc nCls : ℕ} (Wh : Kernel4 oc ic 1 1) (bh : Vec oc) (εh : ℝ) (γh βh : Vec oc) (Wd : Mat oc nCls) (cd : Option (Vec (N * oc))) (xin : Vec (N * (ic * h * w))) (g : Vec (N * nCls)) :
                                                              Vec (N * (ic * h * w))

                                                              The cotangent the head hands to b17 — the head conv's backward.

                                                              Equations
                                                              Instances For
                                                                theorem Proofs.MobileNetV2TieB.mnv2HeadCotBlk_eq_vjp (N h w : ℕ) {ic oc nCls : ℕ} (Wh : Kernel4 oc ic 1 1) (bh : Vec oc) (εh : ℝ) (hεh : 0 < εh) (γh βh : Vec oc) (Wd : Mat oc nCls) (bd : Vec nCls) (cd : Option (Vec (N * oc))) (xin : Vec (N * (ic * h * w))) (g : Vec (N * nCls)) (hs : MNV2HeadSmoothAtB N h w Wh bh εh γh βh xin) :
                                                                mnv2HeadCotBlk N h w Wh bh εh γh βh Wd cd xin g = (mnv2HeadBDoOptHasVJPAt N h w Wh bh εh hεh γh βh Wd bd cd xin hs).backward g

                                                                The cotangent the head hands to b17 is the certified head VJP's backward, at any loss cotangent g, either value of the site and a trunk output with MNV2HeadSmoothAtB: the conv-BN-relu6 stage by cbrBackBatchedGraph_faithful, the GAP, dropout and dense backwards definitionally (dropoutOptHasVJP's backward IS dropoutOpt cd).

                                                                Each conjunct is GradNodesB's ∀ cot fold instantiated at the cotangent the render's chain delivers, so nothing here is a new proof: the bundles are the GradNodesB folds with the freedom removed. reassocB bridges the conv/relu6 index N·(c·h·w) to the BatchNorm parameter ops' N·(c·(h·w)).

                                                                The bias conjuncts are about conv{,StridedXla}BiasGradB and depthwise{,StridedXla}BiasGradB, which the committed artifacts do NOT emit — MobileNetV2RenderB runs convBias := false and binds every bias operand to zeroBiasPrelude's zero constant. They are kept because they cost one delegation each and they cover the flag.

                                                                def Proofs.MobileNetV2TieB.mnv2StemTiedB (N h w : ℕ) {ic oc : ℕ} (xN cotN vN epsStr : String) (Ws : Kernel4 oc ic 3 3) (bs : Vec oc) (εs : ℝ) (γs βs : Vec oc) (bf16 : Bool) (x : Vec (N * (ic * (2 * h) * (2 * w)))) (cotStem : Vec (N * (oc * h * w))) :

                                                                Stem, tied. The 3x3/s2 XLA-SAME conv's weight and bias and its BatchNorm's γ/β, at the cotangent that reaches the stem through block 1's input fan-in. convStridedXla*, not r34's symmetric convStrided*: identical types, identical emitted shapes, different certificates.

                                                                Equations
                                                                • One or more equations did not get rendered due to their size.
                                                                Instances For
                                                                  theorem Proofs.MobileNetV2TieB.mnv2_stem_tiedB (N h w : ℕ) {ic oc : ℕ} (xN cotN vN epsStr : String) (Ws : Kernel4 oc ic 3 3) (bs : Vec oc) (εs : ℝ) (γs βs : Vec oc) (bf16 : Bool) (x : Vec (N * (ic * (2 * h) * (2 * w)))) (cotStem : Vec (N * (oc * h * w))) :
                                                                  mnv2StemTiedB N h w xN cotN vN epsStr Ws bs εs γs βs bf16 x cotStem
                                                                  def Proofs.MobileNetV2TieB.mnv2NoExpTiedB (N h w : ℕ) {ic oc : ℕ} (xN cotN vN epsStr : String) (p : IVWNoExp ic oc) (bf16 : Bool) (xin : Vec (N * (ic * h * w))) (dyOut : Vec (N * (oc * h * w))) :

                                                                  t = 1 block (b1), tied. All eight parameter nodes — the stride-1 depthwise's weight and bias and its BatchNorm's γ/β, then the project 1x1's weight and bias and its BatchNorm's γ/β. The project BatchNorm's γ/β read dyOut itself: the linear bottleneck has no activation after project, so the block-output cotangent IS that BatchNorm's output cotangent.

                                                                  Equations
                                                                  • One or more equations did not get rendered due to their size.
                                                                  Instances For
                                                                    theorem Proofs.MobileNetV2TieB.mnv2_noexp_tiedB (N h w : ℕ) {ic oc : ℕ} (xN cotN vN epsStr : String) (p : IVWNoExp ic oc) (bf16 : Bool) (xin : Vec (N * (ic * h * w))) (dyOut : Vec (N * (oc * h * w))) :
                                                                    mnv2NoExpTiedB N h w xN cotN vN epsStr p bf16 xin dyOut
                                                                    def Proofs.MobileNetV2TieB.mnv2Stride1TiedB (N h w : ℕ) {ic mid oc : ℕ} (xN cotN vN epsStr : String) (p : IVW ic mid oc) (bf16 : Bool) (xin : Vec (N * (ic * h * w))) (dyOut : Vec (N * (oc * h * w))) :

                                                                    Stride-1 inverted-residual block, tied — all twelve parameter nodes. One statement for twelve of the seventeen blocks: the ten identity-skip ones and the two stage-first widenings (b11, b17). A skip changes only the dx handed to the previous block, never a parameter cotangent, which is why MobileNetV2RenderB.irBackStride1GradB is one function with a flag.

                                                                    Equations
                                                                    • One or more equations did not get rendered due to their size.
                                                                    Instances For
                                                                      theorem Proofs.MobileNetV2TieB.mnv2_stride1_tiedB (N h w : ℕ) {ic mid oc : ℕ} (xN cotN vN epsStr : String) (p : IVW ic mid oc) (bf16 : Bool) (xin : Vec (N * (ic * h * w))) (dyOut : Vec (N * (oc * h * w))) :
                                                                      mnv2Stride1TiedB N h w xN cotN vN epsStr p bf16 xin dyOut
                                                                      def Proofs.MobileNetV2TieB.mnv2Stride2TiedB (N h w : ℕ) {ic mid oc : ℕ} (xN cotN vN epsStr : String) (p : IVW ic mid oc) (bf16 : Bool) (xin : Vec (N * (ic * (2 * h) * (2 * w)))) (dyOut : Vec (N * (oc * h * w))) :

                                                                      Stride-2 downsampling block, tied — all twelve parameter nodes (b2, b4, b7, b14). Identical to the stride-1 profile except that the expand half runs at the 2h x 2w input grid and the depthwise is the XLA-SAME strided one. depthwiseStridedXla*GradB, not B0's symmetric depthwiseStrided*GradB: the two have identical types and identical emitted shapes, and only the certificate says which correlation the weight gradient runs.

                                                                      Equations
                                                                      • One or more equations did not get rendered due to their size.
                                                                      Instances For
                                                                        theorem Proofs.MobileNetV2TieB.mnv2_stride2_tiedB (N h w : ℕ) {ic mid oc : ℕ} (xN cotN vN epsStr : String) (p : IVW ic mid oc) (bf16 : Bool) (xin : Vec (N * (ic * (2 * h) * (2 * w)))) (dyOut : Vec (N * (oc * h * w))) :
                                                                        mnv2Stride2TiedB N h w xN cotN vN epsStr p bf16 xin dyOut
                                                                        def Proofs.MobileNetV2TieB.mnv2HeadTiedB (N h w : ℕ) {ic oc nCls : ℕ} (xN cotN vN epsStr : String) (Wh : Kernel4 oc ic 1 1) (bh : Vec oc) (εh : ℝ) (γh βh : Vec oc) (Wd : Mat oc nCls) (bd : Vec nCls) (bf16 : Bool) (cd : Option (Vec (N * oc))) (xin : Vec (N * (ic * h * w))) (g : Vec (N * nCls)) :

                                                                        Head, tied. The 1x1 conv's weight and bias, its BatchNorm's γ/β, and the classifier's weight and bias, at the loss cotangent g and the chain it drives — through the classifier- dropout site cd when it is rendered: the dense weight node reads the DROPPED activation dropoutOpt cd a (the render's cin), and every node above the site reads a cotangent that passed through the mask. The dense-bias conjunct's Jacobian witness carries a zero activation: dense's derivative in b is the identity whatever x is, so the statement is x-free (the shape EfficientNetStepTie's bias conjuncts take).

                                                                        Equations
                                                                        • One or more equations did not get rendered due to their size.
                                                                        Instances For
                                                                          theorem Proofs.MobileNetV2TieB.mnv2_head_tiedB (N h w : ℕ) {ic oc nCls : ℕ} (xN cotN vN epsStr : String) (Wh : Kernel4 oc ic 1 1) (bh : Vec oc) (εh : ℝ) (γh βh : Vec oc) (Wd : Mat oc nCls) (bd : Vec nCls) (bf16 : Bool) (cd : Option (Vec (N * oc))) (xin : Vec (N * (ic * h * w))) (g : Vec (N * nCls)) :
                                                                          mnv2HeadTiedB N h w xN cotN vN epsStr Wh bh εh γh βh Wd bd bf16 cd xin g
                                                                          theorem Proofs.MobileNetV2TieB.mnv2_net_tiedB (N : ℕ) {nCls : ℕ} (xN cotN vN epsStr : String) (w : MNV2BWeights nCls) (bf16 : Bool) (cd : Option (Vec (N * 1280))) (x : Vec (N * (3 * (2 * 112) * (2 * 112)))) (g : Vec (N * nCls)) :
                                                                          have dy17 := mnv2HeadCotBlk N 7 7 w.hW w.hb w.hε w.hγ w.hβ w.fcW cd (mnv2PreB17 N w x) g; have dy16 := mnv2CotInBody N 7 7 w.b17 (mnv2PreB16 N w x) dy17; have dy15 := mnv2ResidCotIn N 7 7 w.b16 (mnv2PreB15 N w x) dy16; have dy14 := mnv2ResidCotIn N 7 7 w.b15 (mnv2PreB14 N w x) dy15; have dy13 := mnv2StridedCotIn N 7 7 w.b14 (mnv2PreB13 N w x) dy14; have dy12 := mnv2ResidCotIn N 14 14 w.b13 (mnv2PreB12 N w x) dy13; have dy11 := mnv2ResidCotIn N 14 14 w.b12 (mnv2PreB11 N w x) dy12; have dy10 := mnv2CotInBody N 14 14 w.b11 (mnv2PreB10 N w x) dy11; have dy9 := mnv2ResidCotIn N 14 14 w.b10 (mnv2PreB9 N w x) dy10; have dy8 := mnv2ResidCotIn N 14 14 w.b9 (mnv2PreB8 N w x) dy9; have dy7 := mnv2ResidCotIn N 14 14 w.b8 (mnv2PreB7 N w x) dy8; have dy6 := mnv2StridedCotIn N 14 14 w.b7 (mnv2PreB6 N w x) dy7; have dy5 := mnv2ResidCotIn N 28 28 w.b6 (mnv2PreB5 N w x) dy6; have dy4 := mnv2ResidCotIn N 28 28 w.b5 (mnv2PreB4 N w x) dy5; have dy3 := mnv2StridedCotIn N 28 28 w.b4 (mnv2PreB3 N w x) dy4; have dy2 := mnv2ResidCotIn N 56 56 w.b3 (mnv2PreB2 N w x) dy3; have dy1 := mnv2StridedCotIn N 56 56 w.b2 (mnv2PreB1 N w x) dy2; have cotStem := mnv2NoExpCotIn N 112 112 w.b1 (mnv2PreB0 N w x) dy1; mnv2StemTiedB N 112 112 xN cotN vN epsStr w.sW w.sb w.sε w.sγ w.sβ bf16 x cotStem ∧ mnv2NoExpTiedB N 112 112 xN cotN vN epsStr w.b1 bf16 (mnv2PreB0 N w x) dy1 ∧ mnv2Stride2TiedB N 56 56 xN cotN vN epsStr w.b2 bf16 (mnv2PreB1 N w x) dy2 ∧ mnv2Stride1TiedB N 56 56 xN cotN vN epsStr w.b3 bf16 (mnv2PreB2 N w x) dy3 ∧ mnv2Stride2TiedB N 28 28 xN cotN vN epsStr w.b4 bf16 (mnv2PreB3 N w x) dy4 ∧ mnv2Stride1TiedB N 28 28 xN cotN vN epsStr w.b5 bf16 (mnv2PreB4 N w x) dy5 ∧ mnv2Stride1TiedB N 28 28 xN cotN vN epsStr w.b6 bf16 (mnv2PreB5 N w x) dy6 ∧ mnv2Stride2TiedB N 14 14 xN cotN vN epsStr w.b7 bf16 (mnv2PreB6 N w x) dy7 ∧ mnv2Stride1TiedB N 14 14 xN cotN vN epsStr w.b8 bf16 (mnv2PreB7 N w x) dy8 ∧ mnv2Stride1TiedB N 14 14 xN cotN vN epsStr w.b9 bf16 (mnv2PreB8 N w x) dy9 ∧ mnv2Stride1TiedB N 14 14 xN cotN vN epsStr w.b10 bf16 (mnv2PreB9 N w x) dy10 ∧ mnv2Stride1TiedB N 14 14 xN cotN vN epsStr w.b11 bf16 (mnv2PreB10 N w x) dy11 ∧ mnv2Stride1TiedB N 14 14 xN cotN vN epsStr w.b12 bf16 (mnv2PreB11 N w x) dy12 ∧ mnv2Stride1TiedB N 14 14 xN cotN vN epsStr w.b13 bf16 (mnv2PreB12 N w x) dy13 ∧ mnv2Stride2TiedB N 7 7 xN cotN vN epsStr w.b14 bf16 (mnv2PreB13 N w x) dy14 ∧ mnv2Stride1TiedB N 7 7 xN cotN vN epsStr w.b15 bf16 (mnv2PreB14 N w x) dy15 ∧ mnv2Stride1TiedB N 7 7 xN cotN vN epsStr w.b16 bf16 (mnv2PreB15 N w x) dy16 ∧ mnv2Stride1TiedB N 7 7 xN cotN vN epsStr w.b17 bf16 (mnv2PreB16 N w x) dy17 ∧ mnv2HeadTiedB N 7 7 xN cotN vN epsStr w.hW w.hb w.hε w.hγ w.hβ w.fcW w.fcb bf16 cd (mnv2PreB17 N w x) g

                                                                          The whole batch-BN MobileNetV2 train step, tied. Threading mobilenetv2ForwardBFull's own prefixes as the block inputs and an arbitrary loss cotangent g down through the constructed head chain and the seventeen constructed block backwards, every parameter gradient node of the net — stem 4, b1 8, sixteen blocks x 12, head 4, dense 2 — denotes the certified batched Σ_n gradient at that chain's cotangent. No free activation and no symbolic cotangent below the loss. One device; bf16 selects the conv and depthwise weight nodes' kind — false the f32 artifacts', true the bf16 kinds mobilenetv2in_rmsdp64wxdols0eps0001bf16 emits, read over ℝ at the identity rounding (Bf16Erasure); the right-hand side is the same certified gradient at either value. cd selects the classifier-dropout site — none the drop-free artifacts, some m the *do* ones, mobilenetv2in_rmsdp64wxdols0eps0001bf16 among them: the dense weight node reads the dropped activation and the chain above the site runs through the mask (the module's Scope).

                                                                          g is a binder. The loss chain is not part of this statement; mnv2_lossCot_is_smoothedCE_grad instantiates it at the label-smoothed softmax cotangent the artifacts actually emit.

                                                                          N is a binder and there is no smoothness hypothesis. The folds are ∀ cot statements instantiated at explicitly-constructed cotangents, so the capstone needs neither 0 < ε nor a relu6-kink condition. Those enter only in the *_eq_vjp lemmas, which say each segment's constructed backward is its certified VJP's backward: the four block kinds' *CotIn_eq_vjp, the head's mnv2HeadCotBlk_eq_vjp and the stem's mnv2StemCotC_eq_vjp.

                                                                          Of the 210 conjunct slots, the committed artifacts exercise 158: MobileNetV2RenderB runs convBias := false, so the 52 bias nodes are not emitted (each bias is folded into the BatchNorm after it and bound to zeroBiasPrelude's zero constant).

                                                                          On the data-parallel (sync-BN) artifacts this theorem applies at N := R·N: the per-replica statement is MobileNetV2SyncTieB.mnv2_net_syncTiedB, whose right-hand sides are this theorem's nodes at the global batch.

                                                                          theorem Proofs.MobileNetV2TieB.mnv2_lossCot_is_smoothedCE_grad (N : ℕ) {nCls : ℕ} (hK : 0 < nCls) (aStr negAK bStr logN ohN : String) (α B : ℝ) (w : MNV2BWeights nCls) (cd : Option (Vec (N * 1280))) (x : Vec (N * (3 * (2 * 112) * (2 * 112)))) (t : Vec (N * (1 * nCls))) (n : Fin N) (j : Fin nCls) (ht : ∑ k : Fin nCls, Mat.unflatten (StableHLO.batchSlice N (1 * nCls) t n) 0 k = 1) :
                                                                          StableHLO.den (smoothedLossCotGraph N nCls α B aStr negAK bStr logN ohN (BackLinks.rowB N nCls (mobilenetv2ForwardBFullDoOpt N w cd x)) t) (finProdFinEquiv (n, finProdFinEquiv (0, j))) = pdiv (fun (z' : Vec nCls) (x : Fin 1) => softCE nCls (smoothTarget nCls α (Mat.unflatten (StableHLO.batchSlice N (1 * nCls) t n) 0)) z') (Mat.unflatten (StableHLO.batchSlice N (1 * nCls) (BackLinks.rowB N nCls (mobilenetv2ForwardBFullDoOpt N w cd x)) n) 0) j 0 / B

                                                                          And the cotangent the artifacts feed the capstone is the smoothed loss's gradient. Row by row: g := unrowB (den (smoothedLossCotGraph …)) at the real logits is, at example n and class j, (1/B)·∂/∂logits of soft-target cross-entropy against the SMOOTHED target (1−α)·t + α/K, at that example's real logits. The only hypothesis is that the example's target sums to 1 — a one-hot, or mixup's convex combination of two. Together with the capstone: every parameter node denotes the certified batched gradient at the chain cotangent that starts from the gradient of the loss the trainer minimises. Shared with ResNet-34 through Foundation/SmoothedLossCot.lean, at a general target.