Documentation

LeanMlir.Proofs.Foundation.SpecVJP

Spec → math (the verification tie), Rung 1: the linear classifier #

The shape #guard beside resnet34Verified in VerifiedNets.lean only checks the parameter interface (typechecking). This file is the first rung of connecting a readable VerifiedNetSpec to the actual math — the proven VJP — on the simplest net, the Chapter-1 linear classifier (dense 784→10).

The pattern (extends to MLP → conv nets, each rigid/per-net):

  1. denote maps the spec's layers to the Mathlib math function the proofs are about;
  2. a rfl lemma ties the spec's denotation to that named function (mnistLinear);
  3. the whole-model VJP theorem is stated about the spec's denotation and discharged by the audited op-level VJP (dense_has_vjp).

If the spec's layers drifts from [.dense 784 10], step 2/3 stop reducing and the proofs fail to typecheck — so the readable architecture is provably the verified one, at the math level, not just the shape level.

noncomputable def denoteLinear (layers : List VLayer) (W : Proofs.Mat 784 10) (b : Proofs.Vec 10) :

Math denotation of the linear spec. The Chapter-1 model is a single dense layer, so [.dense 784 10] denotes to the Mathlib dense W b. Any other layer list is not the linear model (0), which makes the tie below drift-sensitive.

Equations
Instances For

    Spec ≡ the proven model. linearVerified's denotation is exactly mnistLinear (the function the Chapter-1 VJP capstone is about) — by rfl, so it's checked by the kernel and breaks if linearVerified.layers changes.

    The spec carries the math. The linear spec's denotation has the proven VJP — discharged by the audited dense_has_vjp. This is the whole-model verification stated about the readable layer list, not a hand-written function.

    Equations
    Instances For
      theorem linearVerified_has_vjp_correct (W : Proofs.Mat 784 10) (b : Proofs.Vec 10) (x : Proofs.Vec 784) (dy : Proofs.Vec 10) (i : Fin 784) :

      …and its correctness headline carries over verbatim (the backward is the pdiv-contracted Jacobian of the spec's denotation).

      Rung 2: the MLP — the first genuine vjp_comp fold #

      The linear model was the degenerate case (one layer, no fold). The MLP's denotation is a chaindense ∘ relu ∘ dense ∘ relu ∘ dense (mlpForward) — and its VJP is built by folding vjp_comp_at down that chain (mlp_has_vjp_at). So this is where the spec→math tie first exercises the chain rule, not just a single op.

      noncomputable def denoteMLP (layers : List VLayer) (W₀ : Proofs.Mat 784 512) (b₀ : Proofs.Vec 512) (W₁ : Proofs.Mat 512 512) (b₁ : Proofs.Vec 512) (W₂ : Proofs.Mat 512 10) (b₂ : Proofs.Vec 10) :

      Math denotation of the MLP spec: the 5-layer list denotes to mlpForward.

      Equations
      Instances For
        theorem mlpVerified_denote_eq (W₀ : Proofs.Mat 784 512) (b₀ : Proofs.Vec 512) (W₁ : Proofs.Mat 512 512) (b₁ : Proofs.Vec 512) (W₂ : Proofs.Mat 512 10) (b₂ : Proofs.Vec 10) :
        denoteMLP mlpVerified.layers W₀ b₀ W₁ b₁ W₂ b₂ = Proofs.mlpForward W₀ b₀ W₁ b₁ W₂ b₂

        Spec ≡ the proven model. mlpVerified's denotation is exactly mlpForward (dense ∘ relu ∘ dense ∘ relu ∘ dense) — by rfl, drift-sensitive.

        noncomputable def mlpVerified_has_vjp (W₀ : Proofs.Mat 784 512) (b₀ : Proofs.Vec 512) (W₁ : Proofs.Mat 512 512) (b₁ : Proofs.Vec 512) (W₂ : Proofs.Mat 512 10) (b₂ : Proofs.Vec 10) :
        Proofs.HasVJP (denoteMLP mlpVerified.layers W₀ b₀ W₁ b₁ W₂ b₂)

        The spec carries the math (canonical witness). The MLP spec's denotation has a VJP — the global pdiv-derived witness (mlp_has_vjp; relu uses the framework subgradient convention at the kinks, per Proofs/README.md).

        Equations
        Instances For
          noncomputable def mlpVerified_has_vjp_at (W₀ : Proofs.Mat 784 512) (b₀ : Proofs.Vec 512) (W₁ : Proofs.Mat 512 512) (b₁ : Proofs.Vec 512) (W₂ : Proofs.Mat 512 10) (b₂ : Proofs.Vec 10) (x : Proofs.Vec 784) (h0 : ∀ (k : Fin 512), Proofs.dense W₀ b₀ x k 0) (h1 : ∀ (k : Fin 512), Proofs.dense W₁ b₁ (Proofs.relu 512 (Proofs.dense W₀ b₀ x)) k 0) :
          Proofs.HasVJPAt (denoteMLP mlpVerified.layers W₀ b₀ W₁ b₁ W₂ b₂) x

          The spec carries the math (the real fold). At a smooth input — the two ReLU pre-activations avoid zero — the MLP spec's denotation has a VJP built by folding vjp_comp_at through dense → relu → dense → relu → dense (no rfl escape at the kinks). This is the chain rule applied to the spec, the step linear couldn't show.

          Equations
          Instances For
            theorem mlpVerified_has_vjp_correct (W₀ : Proofs.Mat 784 512) (b₀ : Proofs.Vec 512) (W₁ : Proofs.Mat 512 512) (b₁ : Proofs.Vec 512) (W₂ : Proofs.Mat 512 10) (b₂ : Proofs.Vec 10) (x : Proofs.Vec 784) (dy : Proofs.Vec 10) (i : Fin 784) :
            (mlpVerified_has_vjp W₀ b₀ W₁ b₁ W₂ b₂).backward x dy i = j : Fin 10, Proofs.pdiv (denoteMLP mlpVerified.layers W₀ b₀ W₁ b₁ W₂ b₂) x i j * dy j

            …correctness headline for the canonical witness carries over to the spec.

            Rung 3: the CNN — the fold now runs through conv + maxpool #

            The CNN's denotation is mnistCnnNoBnForward — a flat Vec 784 → Vec 10 chain flatConv → relu → flatConv → relu → maxPoolFlat → dense → relu → dense → relu → dense. The honest chain-rule fold (via vjp_comp_at through conv/maxpool/dense) is the audited mnistCnnNoBn_has_vjp_at, conditional on the four ReLU kinks + the maxpool being smooth at the input. Here we headline the unconditional canonical witness (mlp_has_vjp style); the spec is exactly the subject of that conditional fold via cnnVerified_denote_eq.

            noncomputable def denoteCNN (layers : List VLayer) (W₁ : Proofs.Kernel4 32 1 3 3) (b₁ : Proofs.Vec 32) (W₂ : Proofs.Kernel4 32 32 3 3) (b₂ : Proofs.Vec 32) (W₃ : Proofs.Mat 6272 512) (b₃ : Proofs.Vec 512) (W₄ : Proofs.Mat 512 512) (b₄ : Proofs.Vec 512) (W₅ : Proofs.Mat 512 10) (b₅ : Proofs.Vec 10) :

            Math denotation of the CNN spec: the 11-layer list denotes to mnistCnnNoBnForward (c=32, h=w=14, the Chapter-3 MNIST CNN).

            Equations
            • One or more equations did not get rendered due to their size.
            • denoteCNN layers W₁ b₁ W₂ b₂ W₃ b₃ W₄ b₄ W₅ b₅ = fun (x : Proofs.Vec 784) => 0
            Instances For
              theorem cnnVerified_denote_eq (W₁ : Proofs.Kernel4 32 1 3 3) (b₁ : Proofs.Vec 32) (W₂ : Proofs.Kernel4 32 32 3 3) (b₂ : Proofs.Vec 32) (W₃ : Proofs.Mat 6272 512) (b₃ : Proofs.Vec 512) (W₄ : Proofs.Mat 512 512) (b₄ : Proofs.Vec 512) (W₅ : Proofs.Mat 512 10) (b₅ : Proofs.Vec 10) :
              denoteCNN cnnVerified.layers W₁ b₁ W₂ b₂ W₃ b₃ W₄ b₄ W₅ b₅ = Proofs.mnistCnnNoBnForward W₁ b₁ W₂ b₂ W₃ b₃ W₄ b₄ W₅ b₅

              Spec ≡ the proven model. cnnVerified's denotation is exactly mnistCnnNoBnForward — the function the Chapter-3 fold mnistCnnNoBn_has_vjp_at is about — by rfl.

              noncomputable def cnnVerified_has_vjp (W₁ : Proofs.Kernel4 32 1 3 3) (b₁ : Proofs.Vec 32) (W₂ : Proofs.Kernel4 32 32 3 3) (b₂ : Proofs.Vec 32) (W₃ : Proofs.Mat 6272 512) (b₃ : Proofs.Vec 512) (W₄ : Proofs.Mat 512 512) (b₄ : Proofs.Vec 512) (W₅ : Proofs.Mat 512 10) (b₅ : Proofs.Vec 10) :
              Proofs.HasVJP (denoteCNN cnnVerified.layers W₁ b₁ W₂ b₂ W₃ b₃ W₄ b₄ W₅ b₅)

              The spec carries the math. The CNN spec's denotation (conv→relu→conv→relu→maxpool →dense→…) has a VJP — the canonical pdiv-derived witness. The conditional chain-rule fold through conv/maxpool is the audited mnistCnnNoBn_has_vjp_at.

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

                Rung E (linear): the spec ↔ the generated MLIR #

                The ties above connect the spec to the math (denote = the proven forward, which has the proven VJP). This connects the spec to the StableHLO the trainer actually compiles and runs: the generated forward graph fwdGraph (→ verified_mlir/linear_fwd.mlir, the eval path) and the train-step loss-cotangent graph lossCotGraph (→ linear_train_step.mlir) denote the spec's forward and its softmax-CE gradient — via the audited faithfulness theorems (fwdGraph_faithful, lossCotGraph_isCEgrad) composed with denoteLinear = mnistLinear (rfl). So the generated code provably computes the spec's function.

                What stays trusted (the codegen boundary, per Proofs/README.md): the text render linearFwdModuleV = pretty (emit fwdGraph) and that the committed .mlir equals that text — the pretty-printer + regeneration, NOT the semantics, which are proven here.

                Generated forward MLIR ↔ spec. The forward graph (rendered to linear_fwd.mlir, the eval path) denotes the spec's forward function.

                theorem linearVerified_lossCot_isCEgrad (W : Proofs.Mat 784 10) (b : Proofs.Vec 10) (x : Proofs.Vec 784) (label j : Fin 10) :

                Generated train-step cotangent ↔ spec. The loss-cotangent graph (in linear_train_step.mlir) denotes ∂(softmax-CE)/∂logits at the spec's logits.

                Rung E (MLP): the spec ↔ the generated MLIR — both forward and backward #

                The MLP has faithfulness for the whole forward graph (mlpFwdGraph_faithful) AND the whole backward input-VJP graph (mlpBackGraph_faithful). Composed with denoteMLP = mlpForward and mlpVerified_has_vjp_at = mlp_has_vjp_at, both halves of the generated train step are tied to the spec: the rendered forward computes the spec's forward, and the rendered backward computes the spec's VJP backward (at a smooth input).

                theorem mlpVerified_fwd_faithful (W₀ : Proofs.Mat 784 512) (b₀ : Proofs.Vec 512) (W₁ : Proofs.Mat 512 512) (b₁ : Proofs.Vec 512) (W₂ : Proofs.Mat 512 10) (b₂ : Proofs.Vec 10) (x : Proofs.Vec 784) :
                Proofs.StableHLO.den (Proofs.StableHLO.mlpFwdGraph W₀ b₀ W₁ b₁ W₂ b₂ x) = denoteMLP mlpVerified.layers W₀ b₀ W₁ b₁ W₂ b₂ x

                Generated MLP forward MLIR ↔ spec. The forward graph (→ mlp_fwd.mlir) denotes the spec's forward function.

                theorem mlpVerified_back_faithful (W₀ : Proofs.Mat 784 512) (b₀ : Proofs.Vec 512) (W₁ : Proofs.Mat 512 512) (b₁ : Proofs.Vec 512) (W₂ : Proofs.Mat 512 10) (b₂ : Proofs.Vec 10) (x : Proofs.Vec 784) (h0 : ∀ (k : Fin 512), Proofs.dense W₀ b₀ x k 0) (h1 : ∀ (k : Fin 512), Proofs.dense W₁ b₁ (Proofs.relu 512 (Proofs.dense W₀ b₀ x)) k 0) (dy : Proofs.Vec 10) :
                Proofs.StableHLO.den (Proofs.StableHLO.mlpBackGraph W₀ W₁ W₂ (Proofs.dense W₀ b₀ x) (Proofs.dense W₁ b₁ (Proofs.relu 512 (Proofs.dense W₀ b₀ x))) dy) = (mlpVerified_has_vjp_at W₀ b₀ W₁ b₁ W₂ b₂ x h0 h1).backward dy

                Generated MLP backward MLIR ↔ spec. The backward input-VJP graph (in mlp_train_step.mlir) denotes the spec's VJP backward (mlpVerified_has_vjp_at), at a smooth input (the two ReLU pre-activations avoid zero).

                Rung E (CNN): the spec ↔ the generated MLIR (forward) #

                The generated CNN forward graph (flatConv→relu→flatConv→relu→maxPoolFlat→dense→relu→ dense→relu→dense) denotes the spec's forward. The backward graph faithfulness exists too (cnnBackGraph_faithful denotes mnistCnnNoBn_has_vjp_at.backward — the VJP of exactly this spec's forward), but it carries the same five ReLU/maxpool smoothness hypotheses as the conditional fold, so we headline the unconditional forward tie (matching cnnVerified_has_vjp, the canonical witness).

                theorem cnnVerified_fwd_faithful (W₁ : Proofs.Kernel4 32 1 3 3) (b₁ : Proofs.Vec 32) (W₂ : Proofs.Kernel4 32 32 3 3) (b₂ : Proofs.Vec 32) (W₃ : Proofs.Mat 6272 512) (b₃ : Proofs.Vec 512) (W₄ : Proofs.Mat 512 512) (b₄ : Proofs.Vec 512) (W₅ : Proofs.Mat 512 10) (b₅ : Proofs.Vec 10) (x : Proofs.Vec 784) :
                Proofs.StableHLO.den (Proofs.StableHLO.cnnFwdGraph W₁ b₁ W₂ b₂ W₃ b₃ W₄ b₄ W₅ b₅ x) = denoteCNN cnnVerified.layers W₁ b₁ W₂ b₂ W₃ b₃ W₄ b₄ W₅ b₅ x

                Generated CNN forward MLIR ↔ spec. The forward graph (→ cnn_fwd.mlir) denotes the spec's forward (mnistCnnNoBnForward, c=32 / h=w=14).

                Rung 4 + E (CIFAR, both variants): completing the ch5 ladder #

                The two CIFAR-10 nets (ic=3, c1=32, c2=64, h=w=8 — spatial 32→16→8). Each gets the spec→math denotation (= cifarCnnForward / cifarCnnBnForward by rfl), the canonical witness VJP, and the forward spec→generated-MLIR tie (cifarFwdGraph_faithful / cifarBnFwdGraph_faithful). The conditional folds are cifarCnn_has_vjp_at / cifarCnnBn_has_vjp_at (six ReLU kinks + two maxpools; BN adds 0 < εᵢ). The BN here is the SCALAR bnForward (one γ/β over c·h·w), the same op ViT's LayerNorm witness reduces to.

                noncomputable def denoteCifar (layers : List VLayer) (W₁ : Proofs.Kernel4 32 3 3 3) (b₁ : Proofs.Vec 32) (W₂ : Proofs.Kernel4 32 32 3 3) (b₂ : Proofs.Vec 32) (W₃ : Proofs.Kernel4 64 32 3 3) (b₃ : Proofs.Vec 64) (W₄ : Proofs.Kernel4 64 64 3 3) (b₄ : Proofs.Vec 64) (W₅ : Proofs.Mat 4096 512) (b₅ : Proofs.Vec 512) (W₆ : Proofs.Mat 512 512) (b₆ : Proofs.Vec 512) (W₇ : Proofs.Mat 512 10) (b₇ : Proofs.Vec 10) :
                Equations
                • One or more equations did not get rendered due to their size.
                • denoteCifar layers W₁ b₁ W₂ b₂ W₃ b₃ W₄ b₄ W₅ b₅ W₆ b₆ W₇ b₇ = fun (x : Proofs.Vec 3072) => 0
                Instances For
                  theorem cifarVerified_denote_eq (W₁ : Proofs.Kernel4 32 3 3 3) (b₁ : Proofs.Vec 32) (W₂ : Proofs.Kernel4 32 32 3 3) (b₂ : Proofs.Vec 32) (W₃ : Proofs.Kernel4 64 32 3 3) (b₃ : Proofs.Vec 64) (W₄ : Proofs.Kernel4 64 64 3 3) (b₄ : Proofs.Vec 64) (W₅ : Proofs.Mat 4096 512) (b₅ : Proofs.Vec 512) (W₆ : Proofs.Mat 512 512) (b₆ : Proofs.Vec 512) (W₇ : Proofs.Mat 512 10) (b₇ : Proofs.Vec 10) :
                  denoteCifar cifarVerified.layers W₁ b₁ W₂ b₂ W₃ b₃ W₄ b₄ W₅ b₅ W₆ b₆ W₇ b₇ = Proofs.cifarCnnForward W₁ b₁ W₂ b₂ W₃ b₃ W₄ b₄ W₅ b₅ W₆ b₆ W₇ b₇
                  noncomputable def cifarVerified_has_vjp (W₁ : Proofs.Kernel4 32 3 3 3) (b₁ : Proofs.Vec 32) (W₂ : Proofs.Kernel4 32 32 3 3) (b₂ : Proofs.Vec 32) (W₃ : Proofs.Kernel4 64 32 3 3) (b₃ : Proofs.Vec 64) (W₄ : Proofs.Kernel4 64 64 3 3) (b₄ : Proofs.Vec 64) (W₅ : Proofs.Mat 4096 512) (b₅ : Proofs.Vec 512) (W₆ : Proofs.Mat 512 512) (b₆ : Proofs.Vec 512) (W₇ : Proofs.Mat 512 10) (b₇ : Proofs.Vec 10) :
                  Proofs.HasVJP (denoteCifar cifarVerified.layers W₁ b₁ W₂ b₂ W₃ b₃ W₄ b₄ W₅ b₅ W₆ b₆ W₇ b₇)

                  The (no-BN) CIFAR spec carries the math.

                  Equations
                  • One or more equations did not get rendered due to their size.
                  Instances For
                    theorem cifarVerified_fwd_faithful (W₁ : Proofs.Kernel4 32 3 3 3) (b₁ : Proofs.Vec 32) (W₂ : Proofs.Kernel4 32 32 3 3) (b₂ : Proofs.Vec 32) (W₃ : Proofs.Kernel4 64 32 3 3) (b₃ : Proofs.Vec 64) (W₄ : Proofs.Kernel4 64 64 3 3) (b₄ : Proofs.Vec 64) (W₅ : Proofs.Mat 4096 512) (b₅ : Proofs.Vec 512) (W₆ : Proofs.Mat 512 512) (b₆ : Proofs.Vec 512) (W₇ : Proofs.Mat 512 10) (b₇ : Proofs.Vec 10) (x : Proofs.Vec 3072) :
                    Proofs.StableHLO.den (Proofs.StableHLO.cifarFwdGraph W₁ b₁ W₂ b₂ W₃ b₃ W₄ b₄ W₅ b₅ W₆ b₆ W₇ b₇ x) = denoteCifar cifarVerified.layers W₁ b₁ W₂ b₂ W₃ b₃ W₄ b₄ W₅ b₅ W₆ b₆ W₇ b₇ x

                    Generated (no-BN) CIFAR forward MLIR ↔ spec.

                    noncomputable def denoteCifarBn (layers : List VLayer) (W₁ : Proofs.Kernel4 32 3 3 3) (b₁ : Proofs.Vec 32) (ε₁ : ) (γ₁ β₁ : Proofs.Vec 32) (W₂ : Proofs.Kernel4 32 32 3 3) (b₂ : Proofs.Vec 32) (ε₂ : ) (γ₂ β₂ : Proofs.Vec 32) (W₃ : Proofs.Kernel4 64 32 3 3) (b₃ : Proofs.Vec 64) (ε₃ : ) (γ₃ β₃ : Proofs.Vec 64) (W₄ : Proofs.Kernel4 64 64 3 3) (b₄ : Proofs.Vec 64) (ε₄ : ) (γ₄ β₄ : Proofs.Vec 64) (W₅ : Proofs.Mat 4096 512) (b₅ : Proofs.Vec 512) (W₆ : Proofs.Mat 512 512) (b₆ : Proofs.Vec 512) (W₇ : Proofs.Mat 512 10) (b₇ : Proofs.Vec 10) :
                    Equations
                    • One or more equations did not get rendered due to their size.
                    • denoteCifarBn layers W₁ b₁ ε₁ γ₁ β₁ W₂ b₂ ε₂ γ₂ β₂ W₃ b₃ ε₃ γ₃ β₃ W₄ b₄ ε₄ γ₄ β₄ W₅ b₅ W₆ b₆ W₇ b₇ = fun (x : Proofs.Vec 3072) => 0
                    Instances For
                      theorem cifarBnVerified_denote_eq (W₁ : Proofs.Kernel4 32 3 3 3) (b₁ : Proofs.Vec 32) (ε₁ : ) (γ₁ β₁ : Proofs.Vec 32) (W₂ : Proofs.Kernel4 32 32 3 3) (b₂ : Proofs.Vec 32) (ε₂ : ) (γ₂ β₂ : Proofs.Vec 32) (W₃ : Proofs.Kernel4 64 32 3 3) (b₃ : Proofs.Vec 64) (ε₃ : ) (γ₃ β₃ : Proofs.Vec 64) (W₄ : Proofs.Kernel4 64 64 3 3) (b₄ : Proofs.Vec 64) (ε₄ : ) (γ₄ β₄ : Proofs.Vec 64) (W₅ : Proofs.Mat 4096 512) (b₅ : Proofs.Vec 512) (W₆ : Proofs.Mat 512 512) (b₆ : Proofs.Vec 512) (W₇ : Proofs.Mat 512 10) (b₇ : Proofs.Vec 10) :
                      denoteCifarBn cifarBnVerified.layers W₁ b₁ ε₁ γ₁ β₁ W₂ b₂ ε₂ γ₂ β₂ W₃ b₃ ε₃ γ₃ β₃ W₄ b₄ ε₄ γ₄ β₄ W₅ b₅ W₆ b₆ W₇ b₇ = Proofs.cifarCnnBnForward W₁ b₁ ε₁ γ₁ β₁ W₂ b₂ ε₂ γ₂ β₂ W₃ b₃ ε₃ γ₃ β₃ W₄ b₄ ε₄ γ₄ β₄ W₅ b₅ W₆ b₆ W₇ b₇
                      noncomputable def cifarBnVerified_has_vjp (W₁ : Proofs.Kernel4 32 3 3 3) (b₁ : Proofs.Vec 32) (ε₁ : ) (γ₁ β₁ : Proofs.Vec 32) (W₂ : Proofs.Kernel4 32 32 3 3) (b₂ : Proofs.Vec 32) (ε₂ : ) (γ₂ β₂ : Proofs.Vec 32) (W₃ : Proofs.Kernel4 64 32 3 3) (b₃ : Proofs.Vec 64) (ε₃ : ) (γ₃ β₃ : Proofs.Vec 64) (W₄ : Proofs.Kernel4 64 64 3 3) (b₄ : Proofs.Vec 64) (ε₄ : ) (γ₄ β₄ : Proofs.Vec 64) (W₅ : Proofs.Mat 4096 512) (b₅ : Proofs.Vec 512) (W₆ : Proofs.Mat 512 512) (b₆ : Proofs.Vec 512) (W₇ : Proofs.Mat 512 10) (b₇ : Proofs.Vec 10) :
                      Proofs.HasVJP (denoteCifarBn cifarBnVerified.layers W₁ b₁ ε₁ γ₁ β₁ W₂ b₂ ε₂ γ₂ β₂ W₃ b₃ ε₃ γ₃ β₃ W₄ b₄ ε₄ γ₄ β₄ W₅ b₅ W₆ b₆ W₇ b₇)

                      The (per-channel-BN) CIFAR spec carries the math.

                      Equations
                      • One or more equations did not get rendered due to their size.
                      Instances For
                        theorem cifarBnVerified_fwd_faithful (epsStr : String) (W₁ : Proofs.Kernel4 32 3 3 3) (b₁ : Proofs.Vec 32) (ε₁ : ) (γ₁ β₁ : Proofs.Vec 32) (W₂ : Proofs.Kernel4 32 32 3 3) (b₂ : Proofs.Vec 32) (ε₂ : ) (γ₂ β₂ : Proofs.Vec 32) (W₃ : Proofs.Kernel4 64 32 3 3) (b₃ : Proofs.Vec 64) (ε₃ : ) (γ₃ β₃ : Proofs.Vec 64) (W₄ : Proofs.Kernel4 64 64 3 3) (b₄ : Proofs.Vec 64) (ε₄ : ) (γ₄ β₄ : Proofs.Vec 64) (W₅ : Proofs.Mat 4096 512) (b₅ : Proofs.Vec 512) (W₆ : Proofs.Mat 512 512) (b₆ : Proofs.Vec 512) (W₇ : Proofs.Mat 512 10) (b₇ : Proofs.Vec 10) (x : Proofs.Vec 3072) :
                        Proofs.StableHLO.den (Proofs.StableHLO.cifarBnFwdGraph epsStr W₁ b₁ ε₁ γ₁ β₁ W₂ b₂ ε₂ γ₂ β₂ W₃ b₃ ε₃ γ₃ β₃ W₄ b₄ ε₄ γ₄ β₄ W₅ b₅ W₆ b₆ W₇ b₇ x) = denoteCifarBn cifarBnVerified.layers W₁ b₁ ε₁ γ₁ β₁ W₂ b₂ ε₂ γ₂ β₂ W₃ b₃ ε₃ γ₃ β₃ W₄ b₄ ε₄ γ₄ β₄ W₅ b₅ W₆ b₆ W₇ b₇ x

                        Generated (per-channel-BN) CIFAR forward MLIR ↔ spec. (epsStr = the rendered ε text; the denotation uses the real εᵢ, so it holds for any string.)

                        Rung B/C (ch7 MobileNetV2, representative): the strided 6-block witness #

                        Representative tie, like the other imagenette nets below: denoteMobilenet maps mobilenetv2RepLayers — the 10-entry strided 6-block layer list (stem-s2 → 6 inverted-residual blocks [16→64→24, 24→96→24, 24→96→32, 32→128→32, 32→128→64, 64→256→64] with 4 stride-2 depthwise downsamples 224→7 and 2 stride-1 skips → 1×1 conv-bn-relu6 head → GAP → dense) — to mobilenetv2Forward_full, the faithful 6-block composition built in Proofs/MobileNetV2.lean from the strided inverted-residual VJP infrastructure (invresBodyStrided, flatConvStride2Xla, depthwiseStride2FlatXla). The rfl tie is drift-sensitive: change any block's [t,c,n,s] and the match stops reducing.

                        History note: this rung used to tie mobilenetv2Verified.layers itself — true while the committed spec WAS the 6-block net. The spec was promoted to the full-paper 17-block net (e9cd890), so this rung is now representative; the committed spec's full tie is the next section (denoteMobilenetPapermobilenetv2ForwardPaper).

                        The honest chain-rule fold is carried by the new strided inverted-residual block witness Proofs.invresBodyStrided_has_vjp_at (expand-SAME → stride-2 depthwise → project-SAME, the downsampling block the render uses) composed with the representative inverted-residual fold Proofs.mobilenetv2_has_vjp_at; here the rung-C headline is the unconditional canonical witness, matching the ch4/ch5 conv nets (cnnVerified_has_vjp / cifarVerified_has_vjp).

                        Stated gap (intrinsic, shared with ch5-BN / every BN net here): the proof's bnForward is SCALAR-global (one γ/β over the whole c·h·w map per example); the render uses per-channel [c] BN. Topology, channel flow, stride schedule, relu6 sites and residual placement are all faithful — only BN granularity differs.

                        The representative MobileNetV2 layer list: the strided 6-block net that mobilenetv2Forward_full actually renders and proves. A prefix-shaped slice of the committed full-paper mobilenetv2Verified spec (17 blocks, 210 tensors), whose full tie is the next section (denoteMobilenetPaper).

                        Equations
                        • One or more equations did not get rendered due to their size.
                        Instances For
                          noncomputable def denoteMobilenet (layers : List VLayer) (Ws : Proofs.Kernel4 16 3 3 3) (bs : Proofs.Vec 16) (εs γs βs : ) (We1 : Proofs.Kernel4 64 16 1 1) (be1 : Proofs.Vec 64) (εe1 γe1 βe1 : ) (Wd1 : Proofs.DepthwiseKernel 64 3 3) (bd1 : Proofs.Vec 64) (εd1 γd1 βd1 : ) (Wp1 : Proofs.Kernel4 24 64 1 1) (bp1 : Proofs.Vec 24) (εp1 γp1 βp1 : ) (We2 : Proofs.Kernel4 96 24 1 1) (be2 : Proofs.Vec 96) (εe2 γe2 βe2 : ) (Wd2 : Proofs.DepthwiseKernel 96 3 3) (bd2 : Proofs.Vec 96) (εd2 γd2 βd2 : ) (Wp2 : Proofs.Kernel4 24 96 1 1) (bp2 : Proofs.Vec 24) (εp2 γp2 βp2 : ) (We3 : Proofs.Kernel4 96 24 1 1) (be3 : Proofs.Vec 96) (εe3 γe3 βe3 : ) (Wd3 : Proofs.DepthwiseKernel 96 3 3) (bd3 : Proofs.Vec 96) (εd3 γd3 βd3 : ) (Wp3 : Proofs.Kernel4 32 96 1 1) (bp3 : Proofs.Vec 32) (εp3 γp3 βp3 : ) (We4 : Proofs.Kernel4 128 32 1 1) (be4 : Proofs.Vec 128) (εe4 γe4 βe4 : ) (Wd4 : Proofs.DepthwiseKernel 128 3 3) (bd4 : Proofs.Vec 128) (εd4 γd4 βd4 : ) (Wp4 : Proofs.Kernel4 32 128 1 1) (bp4 : Proofs.Vec 32) (εp4 γp4 βp4 : ) (We5 : Proofs.Kernel4 128 32 1 1) (be5 : Proofs.Vec 128) (εe5 γe5 βe5 : ) (Wd5 : Proofs.DepthwiseKernel 128 3 3) (bd5 : Proofs.Vec 128) (εd5 γd5 βd5 : ) (Wp5 : Proofs.Kernel4 64 128 1 1) (bp5 : Proofs.Vec 64) (εp5 γp5 βp5 : ) (We6 : Proofs.Kernel4 256 64 1 1) (be6 : Proofs.Vec 256) (εe6 γe6 βe6 : ) (Wd6 : Proofs.DepthwiseKernel 256 3 3) (bd6 : Proofs.Vec 256) (εd6 γd6 βd6 : ) (Wp6 : Proofs.Kernel4 64 256 1 1) (bp6 : Proofs.Vec 64) (εp6 γp6 βp6 : ) (Wh : Proofs.Kernel4 128 64 1 1) (bh : Proofs.Vec 128) (εh γh βh : ) (Wfc : Proofs.Mat 128 10) (bfc : Proofs.Vec 10) :
                          Proofs.Vec (3 * 224 * 224)Proofs.Vec 10

                          Math denotation of the representative MobileNetV2 spec: the 10-entry strided 6-block layer list denotes to mobilenetv2Forward_full. Any other list is not the net (0), making the tie below drift-sensitive.

                          Equations
                          • One or more equations did not get rendered due to their size.
                          Instances For
                            theorem mobilenetv2Rep_denote_eq (Ws : Proofs.Kernel4 16 3 3 3) (bs : Proofs.Vec 16) (εs γs βs : ) (We1 : Proofs.Kernel4 64 16 1 1) (be1 : Proofs.Vec 64) (εe1 γe1 βe1 : ) (Wd1 : Proofs.DepthwiseKernel 64 3 3) (bd1 : Proofs.Vec 64) (εd1 γd1 βd1 : ) (Wp1 : Proofs.Kernel4 24 64 1 1) (bp1 : Proofs.Vec 24) (εp1 γp1 βp1 : ) (We2 : Proofs.Kernel4 96 24 1 1) (be2 : Proofs.Vec 96) (εe2 γe2 βe2 : ) (Wd2 : Proofs.DepthwiseKernel 96 3 3) (bd2 : Proofs.Vec 96) (εd2 γd2 βd2 : ) (Wp2 : Proofs.Kernel4 24 96 1 1) (bp2 : Proofs.Vec 24) (εp2 γp2 βp2 : ) (We3 : Proofs.Kernel4 96 24 1 1) (be3 : Proofs.Vec 96) (εe3 γe3 βe3 : ) (Wd3 : Proofs.DepthwiseKernel 96 3 3) (bd3 : Proofs.Vec 96) (εd3 γd3 βd3 : ) (Wp3 : Proofs.Kernel4 32 96 1 1) (bp3 : Proofs.Vec 32) (εp3 γp3 βp3 : ) (We4 : Proofs.Kernel4 128 32 1 1) (be4 : Proofs.Vec 128) (εe4 γe4 βe4 : ) (Wd4 : Proofs.DepthwiseKernel 128 3 3) (bd4 : Proofs.Vec 128) (εd4 γd4 βd4 : ) (Wp4 : Proofs.Kernel4 32 128 1 1) (bp4 : Proofs.Vec 32) (εp4 γp4 βp4 : ) (We5 : Proofs.Kernel4 128 32 1 1) (be5 : Proofs.Vec 128) (εe5 γe5 βe5 : ) (Wd5 : Proofs.DepthwiseKernel 128 3 3) (bd5 : Proofs.Vec 128) (εd5 γd5 βd5 : ) (Wp5 : Proofs.Kernel4 64 128 1 1) (bp5 : Proofs.Vec 64) (εp5 γp5 βp5 : ) (We6 : Proofs.Kernel4 256 64 1 1) (be6 : Proofs.Vec 256) (εe6 γe6 βe6 : ) (Wd6 : Proofs.DepthwiseKernel 256 3 3) (bd6 : Proofs.Vec 256) (εd6 γd6 βd6 : ) (Wp6 : Proofs.Kernel4 64 256 1 1) (bp6 : Proofs.Vec 64) (εp6 γp6 βp6 : ) (Wh : Proofs.Kernel4 128 64 1 1) (bh : Proofs.Vec 128) (εh γh βh : ) (Wfc : Proofs.Mat 128 10) (bfc : Proofs.Vec 10) :
                            denoteMobilenet mobilenetv2RepLayers Ws bs εs γs βs We1 be1 εe1 γe1 βe1 Wd1 bd1 εd1 γd1 βd1 Wp1 bp1 εp1 γp1 βp1 We2 be2 εe2 γe2 βe2 Wd2 bd2 εd2 γd2 βd2 Wp2 bp2 εp2 γp2 βp2 We3 be3 εe3 γe3 βe3 Wd3 bd3 εd3 γd3 βd3 Wp3 bp3 εp3 γp3 βp3 We4 be4 εe4 γe4 βe4 Wd4 bd4 εd4 γd4 βd4 Wp4 bp4 εp4 γp4 βp4 We5 be5 εe5 γe5 βe5 Wd5 bd5 εd5 γd5 βd5 Wp5 bp5 εp5 γp5 βp5 We6 be6 εe6 γe6 βe6 Wd6 bd6 εd6 γd6 βd6 Wp6 bp6 εp6 γp6 βp6 Wh bh εh γh βh Wfc bfc = Proofs.mobilenetv2Forward_full Ws bs εs γs βs We1 be1 εe1 γe1 βe1 Wd1 bd1 εd1 γd1 βd1 Wp1 bp1 εp1 γp1 βp1 We2 be2 εe2 γe2 βe2 Wd2 bd2 εd2 γd2 βd2 Wp2 bp2 εp2 γp2 βp2 We3 be3 εe3 γe3 βe3 Wd3 bd3 εd3 γd3 βd3 Wp3 bp3 εp3 γp3 βp3 We4 be4 εe4 γe4 βe4 Wd4 bd4 εd4 γd4 βd4 Wp4 bp4 εp4 γp4 βp4 We5 be5 εe5 γe5 βe5 Wd5 bd5 εd5 γd5 βd5 Wp5 bp5 εp5 γp5 βp5 We6 be6 εe6 γe6 βe6 Wd6 bd6 εd6 γd6 βd6 Wp6 bp6 εp6 γp6 βp6 Wh bh εh γh βh Wfc bfc

                            Spec ≡ the representative proven render. mobilenetv2RepLayers's denotation is exactly mobilenetv2Forward_full (the strided 6-block net) — by rfl, drift-sensitive.

                            noncomputable def mobilenetv2Rep_has_vjp (Ws : Proofs.Kernel4 16 3 3 3) (bs : Proofs.Vec 16) (εs γs βs : ) (We1 : Proofs.Kernel4 64 16 1 1) (be1 : Proofs.Vec 64) (εe1 γe1 βe1 : ) (Wd1 : Proofs.DepthwiseKernel 64 3 3) (bd1 : Proofs.Vec 64) (εd1 γd1 βd1 : ) (Wp1 : Proofs.Kernel4 24 64 1 1) (bp1 : Proofs.Vec 24) (εp1 γp1 βp1 : ) (We2 : Proofs.Kernel4 96 24 1 1) (be2 : Proofs.Vec 96) (εe2 γe2 βe2 : ) (Wd2 : Proofs.DepthwiseKernel 96 3 3) (bd2 : Proofs.Vec 96) (εd2 γd2 βd2 : ) (Wp2 : Proofs.Kernel4 24 96 1 1) (bp2 : Proofs.Vec 24) (εp2 γp2 βp2 : ) (We3 : Proofs.Kernel4 96 24 1 1) (be3 : Proofs.Vec 96) (εe3 γe3 βe3 : ) (Wd3 : Proofs.DepthwiseKernel 96 3 3) (bd3 : Proofs.Vec 96) (εd3 γd3 βd3 : ) (Wp3 : Proofs.Kernel4 32 96 1 1) (bp3 : Proofs.Vec 32) (εp3 γp3 βp3 : ) (We4 : Proofs.Kernel4 128 32 1 1) (be4 : Proofs.Vec 128) (εe4 γe4 βe4 : ) (Wd4 : Proofs.DepthwiseKernel 128 3 3) (bd4 : Proofs.Vec 128) (εd4 γd4 βd4 : ) (Wp4 : Proofs.Kernel4 32 128 1 1) (bp4 : Proofs.Vec 32) (εp4 γp4 βp4 : ) (We5 : Proofs.Kernel4 128 32 1 1) (be5 : Proofs.Vec 128) (εe5 γe5 βe5 : ) (Wd5 : Proofs.DepthwiseKernel 128 3 3) (bd5 : Proofs.Vec 128) (εd5 γd5 βd5 : ) (Wp5 : Proofs.Kernel4 64 128 1 1) (bp5 : Proofs.Vec 64) (εp5 γp5 βp5 : ) (We6 : Proofs.Kernel4 256 64 1 1) (be6 : Proofs.Vec 256) (εe6 γe6 βe6 : ) (Wd6 : Proofs.DepthwiseKernel 256 3 3) (bd6 : Proofs.Vec 256) (εd6 γd6 βd6 : ) (Wp6 : Proofs.Kernel4 64 256 1 1) (bp6 : Proofs.Vec 64) (εp6 γp6 βp6 : ) (Wh : Proofs.Kernel4 128 64 1 1) (bh : Proofs.Vec 128) (εh γh βh : ) (Wfc : Proofs.Mat 128 10) (bfc : Proofs.Vec 10) :
                            Proofs.HasVJP (denoteMobilenet mobilenetv2RepLayers Ws bs εs γs βs We1 be1 εe1 γe1 βe1 Wd1 bd1 εd1 γd1 βd1 Wp1 bp1 εp1 γp1 βp1 We2 be2 εe2 γe2 βe2 Wd2 bd2 εd2 γd2 βd2 Wp2 bp2 εp2 γp2 βp2 We3 be3 εe3 γe3 βe3 Wd3 bd3 εd3 γd3 βd3 Wp3 bp3 εp3 γp3 βp3 We4 be4 εe4 γe4 βe4 Wd4 bd4 εd4 γd4 βd4 Wp4 bp4 εp4 γp4 βp4 We5 be5 εe5 γe5 βe5 Wd5 bd5 εd5 γd5 βd5 Wp5 bp5 εp5 γp5 βp5 We6 be6 εe6 γe6 βe6 Wd6 bd6 εd6 γd6 βd6 Wp6 bp6 εp6 γp6 βp6 Wh bh εh γh βh Wfc bfc)

                            The representative spec carries the math. The strided 6-block MobileNetV2 spec's denotation has a VJP, the canonical pdiv-derived witness.

                            The honest strided chain-rule fold is mobilenetv2_full_has_vjp_at (MobileNetV2FullVJP.lean), which folds stem + all seventeen bottlenecks + head over the paper [t,c,n,s] table. ⚠ Read it, not mobilenetv2_has_vjp_at, which is the representative-depth fold: stem + two inverted-residual blocks + head.

                            It did not close by copying EfficientNet's, and that is the trap worth naming here rather than rediscovering. efficientnetForwardB_full_has_vjp is a GLOBAL HasVJP over all sixteen MBConv blocks, and it can be global because swish is smooth everywhere. MobileNetV2 is relu6, and a global VJP through a kink is false, so the full-depth version keeps the pointwise _at form this net already had: the axis that moved is DEPTH (2 → 17), not pointwise → global. Anyone who conflates the two will spend the day proving something untrue.

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

                              Rung B/C/E (ch7 MobileNetV2, FULL): the committed spec ↔ the paper-spec net #

                              The real thing: denoteMobilenetPaper maps mobilenetv2Verified.layers — the committed 21-entry full-paper [t,c,n,s] list the trainer runs (stem-s2 3→32 → 17 bottlenecks → 1×1 head 320→1280 → GAP → dense 1280→10) — to mobilenetv2ForwardPaper (MobileNetV2FullPaper.lean: per-channel BN throughout, the t=1 no-expand first block, 4 stride-2 depthwise downsamples 224→7). Weights ride in the MNV2PaperWeights bundle, so the tie stays readable. The rfl is drift-sensitive: any [t,c,n,s] edit to the spec stops the match reducing — exactly the tripwire the 6→17-block promotion fired while this file was orphaned; certs.yml now re-elaborates it on every spec push.

                              This restores (and upgrades) the full mnv2 B/C lost in the promotion: the old full tie was the scalar-BN 6-block net; this one is the committed per-channel-BN 17-block net, with rung E on top (mobilenetv2FwdGraphPaper_faithful composed with the tie).

                              noncomputable def denoteMobilenetPaper (layers : List VLayer) (w : Proofs.MNV2PaperWeights) :
                              Proofs.Vec (3 * 224 * 224)Proofs.Vec 10

                              Math denotation of the committed MobileNetV2 spec: the 21-entry full-paper layer list denotes to mobilenetv2ForwardPaper. Any other list is not the net (0), making the tie below drift-sensitive.

                              Equations
                              Instances For

                                Spec ≡ the full paper-spec net. The committed mobilenetv2Verified's denotation is exactly mobilenetv2ForwardPaper (all 17 bottlenecks, per-channel BN) — by rfl, drift-sensitive.

                                The committed spec carries the math. The full-paper spec's denotation has a VJP — the canonical pdiv-derived witness (relu6 is kinked, so the honest whole-net input-VJP stays pointwise-only, the repo standard for relu-family nets; the dim-polymorphic MobileNetV2Close/ChainClose param-grad bridges apply at the paper shapes verbatim, per MobileNetV2FullPaper.lean's header).

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

                                  Rung E at the committed spec. The generated full-paper StableHLO graph denotes the committed spec's function: mobilenetv2FwdGraphPaper_faithful composed with the tie.

                                  Rung B/C/E (FULL, unified weight bundles): r34 / enet / convnext / vit #

                                  The mnv2 full-paper pattern applied to the remaining imagenette nets: each committed spec's ENTIRE layer list (literal dims, drift-sensitive) denotes the full proven forward, with weights riding a structure bundle so the ties stay readable. Existing bundles are reused where the Full module already has one (B0Weights, CnxTWeightsCh); r34 and vit get bundles here (R34Weights, ViTTinyWeights — SpecVJP-local so no proof module's signature changes). Rung E composes each net's full graph-faithfulness apex with the tie (vit's is vitFwdGraphKMHV_faithful, ViTDepthK §3 — the depth-k multi-head vector-LN graph). Rung C is the canonical witness except vit: all-smooth, so vit's rung C is the REAL whole-net VJP vitForwardKV_has_vjp (only 0 < ε) at the committed spec.

                                  structure R34BlockW (c : ) :

                                  Identity basic-block weights (conv-BN ×2), per-channel γ/β.

                                  Instances For
                                    structure R34DownW (ic oc kHp kWp : ) :

                                    Downsample basic-block weights (strided conv-BN ×2 + projection conv-BN).

                                    kHp kWp is the projection kernel: 3×3 as this repo renders it, 1×1 in He et al.'s option-B shortcut (§2k/§2l). R34Weights below is the single place that picks it.

                                    Instances For
                                      structure R34Weights :

                                      All ResNet-34 parameters (shared BN ε): stem + [3,4,6,3] basic blocks + dense.

                                      Instances For
                                        noncomputable def resnet34ForwardW (w : R34Weights) :
                                        Proofs.Vec (3 * 224 * 224)Proofs.Vec 10

                                        resnet34Forward_full_pc at the bundle (the 145-arg field expansion, once).

                                        Equations
                                        • One or more equations did not get rendered due to their size.
                                        Instances For
                                          noncomputable def denoteR34Full (layers : List VLayer) (w : R34Weights) :
                                          Proofs.Vec (3 * 224 * 224)Proofs.Vec 10

                                          Math denotation of the committed ResNet-34 spec: the 8-entry stage-level layer list denotes to the full per-channel [3,4,6,3] render. Any other list is not the net (0).

                                          Equations
                                          Instances For

                                            Spec ≡ the full proven render. resnet34Verified's denotation is exactly resnet34Forward_full_pc (per-channel BN, [3,4,6,3] at 224²) — by rfl.

                                            The committed spec carries the math — canonical pdiv witness (relu is kinked, so the honest whole-net input-VJP stays pointwise; the live/seal theorems (ResNet34Live*) discharge nontriviality at full depth and realistic dims).

                                            Equations
                                            • One or more equations did not get rendered due to their size.
                                            Instances For
                                              theorem resnet34Verified_fwd_faithful (epsStr : String) (w : R34Weights) (x : Proofs.Vec (3 * 224 * 224)) :
                                              Proofs.StableHLO.den (Proofs.StableHLO.resnet34FwdGraphFullPC epsStr w.ε w.sW w.sb w. w. w.a0.W1 w.a0.b1 w.a0.g1 w.a0.t1 w.a0.W2 w.a0.b2 w.a0.g2 w.a0.t2 w.a1.W1 w.a1.b1 w.a1.g1 w.a1.t1 w.a1.W2 w.a1.b2 w.a1.g2 w.a1.t2 w.a2.W1 w.a2.b1 w.a2.g1 w.a2.t1 w.a2.W2 w.a2.b2 w.a2.g2 w.a2.t2 w.d2.W1 w.d2.b1 w.d2.g1 w.d2.t1 w.d2.W2 w.d2.b2 w.d2.g2 w.d2.t2 w.d2.Wp w.d2.bp w.d2.gp w.d2.tp w.b0.W1 w.b0.b1 w.b0.g1 w.b0.t1 w.b0.W2 w.b0.b2 w.b0.g2 w.b0.t2 w.b1.W1 w.b1.b1 w.b1.g1 w.b1.t1 w.b1.W2 w.b1.b2 w.b1.g2 w.b1.t2 w.b2.W1 w.b2.b1 w.b2.g1 w.b2.t1 w.b2.W2 w.b2.b2 w.b2.g2 w.b2.t2 w.d3.W1 w.d3.b1 w.d3.g1 w.d3.t1 w.d3.W2 w.d3.b2 w.d3.g2 w.d3.t2 w.d3.Wp w.d3.bp w.d3.gp w.d3.tp w.c0.W1 w.c0.b1 w.c0.g1 w.c0.t1 w.c0.W2 w.c0.b2 w.c0.g2 w.c0.t2 w.c1.W1 w.c1.b1 w.c1.g1 w.c1.t1 w.c1.W2 w.c1.b2 w.c1.g2 w.c1.t2 w.c2.W1 w.c2.b1 w.c2.g1 w.c2.t1 w.c2.W2 w.c2.b2 w.c2.g2 w.c2.t2 w.c3.W1 w.c3.b1 w.c3.g1 w.c3.t1 w.c3.W2 w.c3.b2 w.c3.g2 w.c3.t2 w.c4.W1 w.c4.b1 w.c4.g1 w.c4.t1 w.c4.W2 w.c4.b2 w.c4.g2 w.c4.t2 w.d4.W1 w.d4.b1 w.d4.g1 w.d4.t1 w.d4.W2 w.d4.b2 w.d4.g2 w.d4.t2 w.d4.Wp w.d4.bp w.d4.gp w.d4.tp w.e0.W1 w.e0.b1 w.e0.g1 w.e0.t1 w.e0.W2 w.e0.b2 w.e0.g2 w.e0.t2 w.e1.W1 w.e1.b1 w.e1.g1 w.e1.t1 w.e1.W2 w.e1.b2 w.e1.g2 w.e1.t2 w.Wd w.bd x) = denoteR34Full resnet34Verified.layers w x

                                              Rung E at the committed spec. The full per-channel [3,4,6,3] graph denotes the committed spec's function: resnet34FwdGraphFullPC_faithful composed with the tie.

                                              noncomputable def denoteEfficientnetB0 (N : ) (layers : List VLayer) (w : Proofs.B0Weights) :
                                              Proofs.Vec (N * (3 * 224 * 224))Proofs.Vec (N * 10)

                                              Math denotation of the committed EfficientNet-B0 spec at batch N: the 21-entry [t,c,n,s,k] layer list denotes to efficientnetForwardB_full (all 16 MBConv blocks, true batch-norm + SE). The spec ties the batched net at EVERY batch size.

                                              Equations
                                              Instances For

                                                Spec ≡ the full proven net. efficientnetVerified's denotation is exactly efficientnetForwardB_full (16 MBConv, batched, per-channel BN + SE) — by rfl.

                                                The committed spec carries the math — canonical pdiv witness (swish/SE are smooth but relu6 clamps; the per-block differentiability lemmas live in EfficientNetFullB0.lean).

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

                                                  Rung E at the committed spec (batched). The full 16-MBConv batched graph denotes the committed spec's function: efficientnetFwdGraphB_full_faithful ∘ the tie.

                                                  noncomputable def denoteConvnextT (layers : List VLayer) (w : Proofs.CnxTWeightsCh 10) :
                                                  Proofs.Vec (3 * 224 * 224)Proofs.Vec 10

                                                  Math denotation of the committed ConvNeXt-T spec: the 29-entry [3,3,9,3] layer list denotes to convNextForwardTCh — the channel-LayerNorm net (§2m), whose 23 LN sites are 1 stem + 18 block + 3 downsample + 1 head, the first 22 reducing over the c channels at one spatial position with a per-channel [c] affine and the head one over the [768] GAP output (which is the same function at one spatial position — rowLNVecFlat 1 768).

                                                  ⚠ The head LN was RESTORED 2026-08-30 (planning/archive/next_session_execution_and_parity.md §7.1). §2m/§2n had deleted it to match the JAX reference, which was itself missing it against both the paper and timm; the parameter count was short by exactly 2×768.

                                                  ⚠ This used to match a .convNextBlock/.bn list and denote the SCALAR-LN net: one mean and one variance over the whole c·h·w map, two scalars, and no stem LN but a head LN. §2n deleted that chain outright, so the trap it guarded against — silently re-pointing this at the scalar function, which would typecheck by rfl and assert that the channel-LN layer list denotes the scalar-LN one (§2k's own sin, one level down) — is no longer expressible. Keeping the note because the SHAPE of that mistake is what §2k was about, not the specific symbol.

                                                  Equations
                                                  Instances For

                                                    Spec ≡ the full proven net. convnextVerified's denotation is exactly convNextForwardTCh ([3,3,9,3] @ [96,192,384,768], channel LN + head LN, 28,589,128 params at K = 1000 — the JAX reference's own count) — by rfl.

                                                    The committed spec carries the math — canonical pdiv witness; the REAL whole-net VJP exists at full depth (convNextForwardTCh_has_vjp_correct, all-smooth, the 22 LN positivities only) on the ∘-chain form.

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

                                                      Rung E at the committed spec. The committed-config [3,3,9,3] channel-LN graph denotes the committed spec's function: convNextFwdGraphTCh_faithful ∘ the tie.

                                                      structure ViTTinyWeights :

                                                      All ViT-Tiny parameters at the committed config (D=192, 3 heads, d_head=64, mlpDim=768, 12 untied blocks, vector-LN): patch embed + CLS/pos + 12 per-block BlockParamsV bundles + final LN + CLS head. Shared LN ε rides along.

                                                      Instances For
                                                        noncomputable def vitForwardTiny (w : ViTTinyWeights) :
                                                        Proofs.Vec (3 * 224 * 224)Proofs.Vec 10

                                                        vitForwardKV at the committed ViT-Tiny config (depth 12, 3 heads × 64).

                                                        Equations
                                                        Instances For
                                                          noncomputable def denoteVitTiny (layers : List VLayer) (w : ViTTinyWeights) :
                                                          Proofs.Vec (3 * 224 * 224)Proofs.Vec 10

                                                          Math denotation of the committed ViT-Tiny spec: the 17-entry layer list (12 untied .transformerBlocks, per-channel [192] LN, 1D CLS) denotes to vitForwardTiny.

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

                                                            Spec ≡ the full proven net. vitVerified's denotation is exactly vitForwardKV at the committed config (depth-12 DISTINCT-param multi-head, per-token vector-LN — ViTDepthK.lean) — by rfl. Retires the rep tie's weight-shared scalar-LN caveats at the spec level.

                                                            The committed spec carries the math — the REAL whole-net VJP. ViT is all-smooth (GELU/softmax/LN), so unlike the conv nets the honest chain-rule fold applies globally: vitForwardKV_has_vjp at the committed config, hypothesis 0 < ε only. The strongest rung C in this file — no canonical-witness fallback needed.

                                                            Equations
                                                            Instances For
                                                              theorem vitVerified_fwd_faithful (epsStr sStr oneStr zeroStr : String) (w : ViTTinyWeights) (x : Proofs.Vec (3 * 224 * 224)) :

                                                              Rung E at the committed spec. The depth-12 3-head vector-LN forward graph (vitFwdGraphKMHV, ViTDepthK §3 — patch embed → 12 spelled multi-head blocks → final vector-LN → CLS → head) denotes the committed spec's function: vitFwdGraphKMHV_faithful composed with the tie. Completes the B/C/E ladder for all five imagenette nets.

                                                              Rung B/C (representative): the imagenette nets' proof witnesses #

                                                              Every committed imagenette spec is now tied in FULL above (mnv2 denoteMobilenetPaper, r34 denoteR34Full, enet denoteEfficientnetB0, convnext denoteConvnextT, vit denoteVitTiny). The representative rungs below remain as the smaller readable skeletons the ORIGINAL per-net proof witnesses actually state (<net>Forward + the audited <net>_has_vjp apex), tied to generic-dim VLayer lists exactly like ch2–5: denote <rep layers> = <net>Forward := rfl (rung B) + canonical HasVJP witness (rung C; the honest fold is the apex).

                                                              noncomputable def denoteEfficientnetRep {ic c cmid₁ cout cmid₂ h w kHs kWs kHe₁ kWe₁ kHd₁ kWd₁ kHp₁ kWp₁ kHe₂ kWe₂ kHd₂ kWd₂ kHp₂ kWp₂ r₁ r₂ nClasses : } (layers : List VLayer) (Ws : Proofs.Kernel4 c ic kHs kWs) (bs : Proofs.Vec c) (εs γs βs : ) (We₁ : Proofs.Kernel4 cmid₁ c kHe₁ kWe₁) (be₁ : Proofs.Vec cmid₁) (εe₁ γe₁ βe₁ : ) (Wd₁ : Proofs.DepthwiseKernel cmid₁ kHd₁ kWd₁) (bd₁ : Proofs.Vec cmid₁) (εd₁ γd₁ βd₁ : ) (Ws₁₁ : Proofs.Mat cmid₁ r₁) (bs₁₁ : Proofs.Vec r₁) (Ws₁₂ : Proofs.Mat r₁ cmid₁) (bs₁₂ : Proofs.Vec cmid₁) (Wp₁ : Proofs.Kernel4 c cmid₁ kHp₁ kWp₁) (bp₁ : Proofs.Vec c) (εp₁ γp₁ βp₁ : ) (We₂ : Proofs.Kernel4 cmid₂ c kHe₂ kWe₂) (be₂ : Proofs.Vec cmid₂) (εe₂ γe₂ βe₂ : ) (Wd₂ : Proofs.DepthwiseKernel cmid₂ kHd₂ kWd₂) (bd₂ : Proofs.Vec cmid₂) (εd₂ γd₂ βd₂ : ) (Ws₂₁ : Proofs.Mat cmid₂ r₂) (bs₂₁ : Proofs.Vec r₂) (Ws₂₂ : Proofs.Mat r₂ cmid₂) (bs₂₂ : Proofs.Vec cmid₂) (Wp₂ : Proofs.Kernel4 cout cmid₂ kHp₂ kWp₂) (bp₂ : Proofs.Vec cout) (εp₂ γp₂ βp₂ : ) (Wh : Proofs.Mat cout nClasses) (bh : Proofs.Vec nClasses) :
                                                              Proofs.Vec (ic * h * w)Proofs.Vec nClasses

                                                              Math denotation of the representative EfficientNet layer list → efficientnetForward.

                                                              Equations
                                                              • One or more equations did not get rendered due to their size.
                                                              Instances For
                                                                theorem efficientnetRep_denote_eq {ic c cmid₁ cout cmid₂ h w kHs kWs kHe₁ kWe₁ kHd₁ kWd₁ kHp₁ kWp₁ kHe₂ kWe₂ kHd₂ kWd₂ kHp₂ kWp₂ r₁ r₂ nClasses : } (Ws : Proofs.Kernel4 c ic kHs kWs) (bs : Proofs.Vec c) (εs γs βs : ) (We₁ : Proofs.Kernel4 cmid₁ c kHe₁ kWe₁) (be₁ : Proofs.Vec cmid₁) (εe₁ γe₁ βe₁ : ) (Wd₁ : Proofs.DepthwiseKernel cmid₁ kHd₁ kWd₁) (bd₁ : Proofs.Vec cmid₁) (εd₁ γd₁ βd₁ : ) (Ws₁₁ : Proofs.Mat cmid₁ r₁) (bs₁₁ : Proofs.Vec r₁) (Ws₁₂ : Proofs.Mat r₁ cmid₁) (bs₁₂ : Proofs.Vec cmid₁) (Wp₁ : Proofs.Kernel4 c cmid₁ kHp₁ kWp₁) (bp₁ : Proofs.Vec c) (εp₁ γp₁ βp₁ : ) (We₂ : Proofs.Kernel4 cmid₂ c kHe₂ kWe₂) (be₂ : Proofs.Vec cmid₂) (εe₂ γe₂ βe₂ : ) (Wd₂ : Proofs.DepthwiseKernel cmid₂ kHd₂ kWd₂) (bd₂ : Proofs.Vec cmid₂) (εd₂ γd₂ βd₂ : ) (Ws₂₁ : Proofs.Mat cmid₂ r₂) (bs₂₁ : Proofs.Vec r₂) (Ws₂₂ : Proofs.Mat r₂ cmid₂) (bs₂₂ : Proofs.Vec cmid₂) (Wp₂ : Proofs.Kernel4 cout cmid₂ kHp₂ kWp₂) (bp₂ : Proofs.Vec cout) (εp₂ γp₂ βp₂ : ) (Wh : Proofs.Mat cout nClasses) (bh : Proofs.Vec nClasses) :
                                                                denoteEfficientnetRep [VLayer.convBn ic c kHs 1, VLayer.mbConvSE c cmid₁ c r₁ kHd₁, VLayer.mbConvSE c cmid₂ cout r₂ kHd₂, VLayer.globalAvgPool, VLayer.dense cout nClasses] Ws bs εs γs βs We₁ be₁ εe₁ γe₁ βe₁ Wd₁ bd₁ εd₁ γd₁ βd₁ Ws₁₁ bs₁₁ Ws₁₂ bs₁₂ Wp₁ bp₁ εp₁ γp₁ βp₁ We₂ be₂ εe₂ γe₂ βe₂ Wd₂ bd₂ εd₂ γd₂ βd₂ Ws₂₁ bs₂₁ Ws₂₂ bs₂₂ Wp₂ bp₂ εp₂ γp₂ βp₂ Wh bh = Proofs.efficientnetForward Ws bs εs γs βs We₁ be₁ εe₁ γe₁ βe₁ Wd₁ bd₁ εd₁ γd₁ βd₁ Ws₁₁ bs₁₁ Ws₁₂ bs₁₂ Wp₁ bp₁ εp₁ γp₁ βp₁ We₂ be₂ εe₂ γe₂ βe₂ Wd₂ bd₂ εd₂ γd₂ βd₂ Ws₂₁ bs₂₁ Ws₂₂ bs₂₂ Wp₂ bp₂ εp₂ γp₂ βp₂ Wh bh

                                                                Spec ≡ the representative proven model.

                                                                noncomputable def efficientnetRep_has_vjp {ic c cmid₁ cout cmid₂ h w kHs kWs kHe₁ kWe₁ kHd₁ kWd₁ kHp₁ kWp₁ kHe₂ kWe₂ kHd₂ kWd₂ kHp₂ kWp₂ r₁ r₂ nClasses : } (Ws : Proofs.Kernel4 c ic kHs kWs) (bs : Proofs.Vec c) (εs γs βs : ) (We₁ : Proofs.Kernel4 cmid₁ c kHe₁ kWe₁) (be₁ : Proofs.Vec cmid₁) (εe₁ γe₁ βe₁ : ) (Wd₁ : Proofs.DepthwiseKernel cmid₁ kHd₁ kWd₁) (bd₁ : Proofs.Vec cmid₁) (εd₁ γd₁ βd₁ : ) (Ws₁₁ : Proofs.Mat cmid₁ r₁) (bs₁₁ : Proofs.Vec r₁) (Ws₁₂ : Proofs.Mat r₁ cmid₁) (bs₁₂ : Proofs.Vec cmid₁) (Wp₁ : Proofs.Kernel4 c cmid₁ kHp₁ kWp₁) (bp₁ : Proofs.Vec c) (εp₁ γp₁ βp₁ : ) (We₂ : Proofs.Kernel4 cmid₂ c kHe₂ kWe₂) (be₂ : Proofs.Vec cmid₂) (εe₂ γe₂ βe₂ : ) (Wd₂ : Proofs.DepthwiseKernel cmid₂ kHd₂ kWd₂) (bd₂ : Proofs.Vec cmid₂) (εd₂ γd₂ βd₂ : ) (Ws₂₁ : Proofs.Mat cmid₂ r₂) (bs₂₁ : Proofs.Vec r₂) (Ws₂₂ : Proofs.Mat r₂ cmid₂) (bs₂₂ : Proofs.Vec cmid₂) (Wp₂ : Proofs.Kernel4 cout cmid₂ kHp₂ kWp₂) (bp₂ : Proofs.Vec cout) (εp₂ γp₂ βp₂ : ) (Wh : Proofs.Mat cout nClasses) (bh : Proofs.Vec nClasses) :
                                                                Proofs.HasVJP (denoteEfficientnetRep [VLayer.convBn ic c kHs 1, VLayer.mbConvSE c cmid₁ c r₁ kHd₁, VLayer.mbConvSE c cmid₂ cout r₂ kHd₂, VLayer.globalAvgPool, VLayer.dense cout nClasses] Ws bs εs γs βs We₁ be₁ εe₁ γe₁ βe₁ Wd₁ bd₁ εd₁ γd₁ βd₁ Ws₁₁ bs₁₁ Ws₁₂ bs₁₂ Wp₁ bp₁ εp₁ γp₁ βp₁ We₂ be₂ εe₂ γe₂ βe₂ Wd₂ bd₂ εd₂ γd₂ βd₂ Ws₂₁ bs₂₁ Ws₂₂ bs₂₂ Wp₂ bp₂ εp₂ γp₂ βp₂ Wh bh)

                                                                The representative spec carries the math (canonical witness; the honest unconditional fold is Proofs.efficientnet_has_vjp).

                                                                Equations
                                                                • One or more equations did not get rendered due to their size.
                                                                Instances For
                                                                  noncomputable def denoteConvnextRep {ic c cExp h w kH kW nClasses : } (layers : List VLayer) (Wst : Proofs.Kernel4 c ic 1 1) (bst : Proofs.Vec c) (εst γst βst : ) (Wdw₁ : Proofs.DepthwiseKernel c kH kW) (bdw₁ : Proofs.Vec c) (εn₁ γn₁ βn₁ : ) (Wex₁ : Proofs.Kernel4 cExp c 1 1) (bex₁ : Proofs.Vec cExp) (Wpr₁ : Proofs.Kernel4 c cExp 1 1) (bpr₁ : Proofs.Vec c) (γls₁ : Proofs.Vec (c * h * w)) (Wdw₂ : Proofs.DepthwiseKernel c kH kW) (bdw₂ : Proofs.Vec c) (εn₂ γn₂ βn₂ : ) (Wex₂ : Proofs.Kernel4 cExp c 1 1) (bex₂ : Proofs.Vec cExp) (Wpr₂ : Proofs.Kernel4 c cExp 1 1) (bpr₂ : Proofs.Vec c) (γls₂ : Proofs.Vec (c * h * w)) (εhd γhd βhd : ) (Wd : Proofs.Mat c nClasses) (bd : Proofs.Vec nClasses) :
                                                                  Proofs.Vec (ic * h * w)Proofs.Vec nClasses

                                                                  Math denotation of the representative ConvNeXt layer list → convNextForward.

                                                                  Equations
                                                                  • One or more equations did not get rendered due to their size.
                                                                  Instances For
                                                                    theorem convnextRep_denote_eq {ic c cExp h w kH kW nClasses : } (Wst : Proofs.Kernel4 c ic 1 1) (bst : Proofs.Vec c) (εst γst βst : ) (Wdw₁ : Proofs.DepthwiseKernel c kH kW) (bdw₁ : Proofs.Vec c) (εn₁ γn₁ βn₁ : ) (Wex₁ : Proofs.Kernel4 cExp c 1 1) (bex₁ : Proofs.Vec cExp) (Wpr₁ : Proofs.Kernel4 c cExp 1 1) (bpr₁ : Proofs.Vec c) (γls₁ : Proofs.Vec (c * h * w)) (Wdw₂ : Proofs.DepthwiseKernel c kH kW) (bdw₂ : Proofs.Vec c) (εn₂ γn₂ βn₂ : ) (Wex₂ : Proofs.Kernel4 cExp c 1 1) (bex₂ : Proofs.Vec cExp) (Wpr₂ : Proofs.Kernel4 c cExp 1 1) (bpr₂ : Proofs.Vec c) (γls₂ : Proofs.Vec (c * h * w)) (εhd γhd βhd : ) (Wd : Proofs.Mat c nClasses) (bd : Proofs.Vec nClasses) :
                                                                    denoteConvnextRep [VLayer.conv ic c 1 1, VLayer.bn, VLayer.convNextBlock c, VLayer.convNextBlock c, VLayer.globalAvgPool, VLayer.bn, VLayer.dense c nClasses] Wst bst εst γst βst Wdw₁ bdw₁ εn₁ γn₁ βn₁ Wex₁ bex₁ Wpr₁ bpr₁ γls₁ Wdw₂ bdw₂ εn₂ γn₂ βn₂ Wex₂ bex₂ Wpr₂ bpr₂ γls₂ εhd γhd βhd Wd bd = Proofs.convNextForward Wst bst εst γst βst Wdw₁ bdw₁ εn₁ γn₁ βn₁ Wex₁ bex₁ Wpr₁ bpr₁ γls₁ Wdw₂ bdw₂ εn₂ γn₂ βn₂ Wex₂ bex₂ Wpr₂ bpr₂ γls₂ εhd γhd βhd Wd bd

                                                                    Spec ≡ the representative proven model.

                                                                    noncomputable def convnextRep_has_vjp {ic c cExp h w kH kW nClasses : } (Wst : Proofs.Kernel4 c ic 1 1) (bst : Proofs.Vec c) (εst γst βst : ) (Wdw₁ : Proofs.DepthwiseKernel c kH kW) (bdw₁ : Proofs.Vec c) (εn₁ γn₁ βn₁ : ) (Wex₁ : Proofs.Kernel4 cExp c 1 1) (bex₁ : Proofs.Vec cExp) (Wpr₁ : Proofs.Kernel4 c cExp 1 1) (bpr₁ : Proofs.Vec c) (γls₁ : Proofs.Vec (c * h * w)) (Wdw₂ : Proofs.DepthwiseKernel c kH kW) (bdw₂ : Proofs.Vec c) (εn₂ γn₂ βn₂ : ) (Wex₂ : Proofs.Kernel4 cExp c 1 1) (bex₂ : Proofs.Vec cExp) (Wpr₂ : Proofs.Kernel4 c cExp 1 1) (bpr₂ : Proofs.Vec c) (γls₂ : Proofs.Vec (c * h * w)) (εhd γhd βhd : ) (Wd : Proofs.Mat c nClasses) (bd : Proofs.Vec nClasses) :
                                                                    Proofs.HasVJP (denoteConvnextRep [VLayer.conv ic c 1 1, VLayer.bn, VLayer.convNextBlock c, VLayer.convNextBlock c, VLayer.globalAvgPool, VLayer.bn, VLayer.dense c nClasses] Wst bst εst γst βst Wdw₁ bdw₁ εn₁ γn₁ βn₁ Wex₁ bex₁ Wpr₁ bpr₁ γls₁ Wdw₂ bdw₂ εn₂ γn₂ βn₂ Wex₂ bex₂ Wpr₂ bpr₂ γls₂ εhd γhd βhd Wd bd)

                                                                    The representative spec carries the math (canonical witness; the honest unconditional fold is Proofs.convnext_has_vjp).

                                                                    Equations
                                                                    • One or more equations did not get rendered due to their size.
                                                                    Instances For
                                                                      noncomputable def denoteVitRep (layers : List VLayer) (ic H W patchSize N mlpDim heads d_head kBlocks nClasses : ) (W_conv : Proofs.Kernel4 (heads * d_head) ic patchSize patchSize) (b_conv cls_token : Proofs.Vec (heads * d_head)) (pos_embed : Proofs.Mat (N + 1) (heads * d_head)) (ε γ1 β1 : ) (Wq Wk Wv Wo : Proofs.Mat (heads * d_head) (heads * d_head)) (bq bk bv bo : Proofs.Vec (heads * d_head)) (γ2 β2 : ) (Wfc1 : Proofs.Mat (heads * d_head) mlpDim) (bfc1 : Proofs.Vec mlpDim) (Wfc2 : Proofs.Mat mlpDim (heads * d_head)) (bfc2 : Proofs.Vec (heads * d_head)) (γF βF : ) (Wcls : Proofs.Mat (heads * d_head) nClasses) (bcls : Proofs.Vec nClasses) :
                                                                      Proofs.Vec (ic * H * W)Proofs.Vec nClasses

                                                                      Math denotation of the representative ViT layer list → vit_full. The single .transformerBlock VLayer stands for the kBlocks-deep weight-shared vit_body; per the proof witness the LayerNorm is scalar (layerNormForward = bnForward), so this ties the spec to the scalar-LN witness, not the rendered per-channel [D] LN.

                                                                      Equations
                                                                      • One or more equations did not get rendered due to their size.
                                                                      Instances For
                                                                        theorem vitRep_denote_eq (ic H W patchSize N mlpDim heads d_head kBlocks nClasses : ) (W_conv : Proofs.Kernel4 (heads * d_head) ic patchSize patchSize) (b_conv cls_token : Proofs.Vec (heads * d_head)) (pos_embed : Proofs.Mat (N + 1) (heads * d_head)) (ε γ1 β1 : ) (Wq Wk Wv Wo : Proofs.Mat (heads * d_head) (heads * d_head)) (bq bk bv bo : Proofs.Vec (heads * d_head)) (γ2 β2 : ) (Wfc1 : Proofs.Mat (heads * d_head) mlpDim) (bfc1 : Proofs.Vec mlpDim) (Wfc2 : Proofs.Mat mlpDim (heads * d_head)) (bfc2 : Proofs.Vec (heads * d_head)) (γF βF : ) (Wcls : Proofs.Mat (heads * d_head) nClasses) (bcls : Proofs.Vec nClasses) :
                                                                        denoteVitRep [VLayer.conv ic (heads * d_head) patchSize patchSize, VLayer.param #[1, heads * d_head] 2, VLayer.param #[N + 1, heads * d_head] 2, VLayer.transformerBlock (heads * d_head) mlpDim, VLayer.layerNorm (heads * d_head), VLayer.dense (heads * d_head) nClasses] ic H W patchSize N mlpDim heads d_head kBlocks nClasses W_conv b_conv cls_token pos_embed ε γ1 β1 Wq Wk Wv Wo bq bk bv bo γ2 β2 Wfc1 bfc1 Wfc2 bfc2 γF βF Wcls bcls = Proofs.vit_full ic H W patchSize N mlpDim heads d_head kBlocks nClasses W_conv b_conv cls_token pos_embed ε γ1 β1 Wq Wk Wv Wo bq bk bv bo γ2 β2 Wfc1 bfc1 Wfc2 bfc2 γF βF Wcls bcls

                                                                        Spec ≡ the representative proven model.

                                                                        noncomputable def vitRep_has_vjp (ic H W patchSize N mlpDim heads d_head kBlocks nClasses : ) (W_conv : Proofs.Kernel4 (heads * d_head) ic patchSize patchSize) (b_conv cls_token : Proofs.Vec (heads * d_head)) (pos_embed : Proofs.Mat (N + 1) (heads * d_head)) (ε γ1 β1 : ) (Wq Wk Wv Wo : Proofs.Mat (heads * d_head) (heads * d_head)) (bq bk bv bo : Proofs.Vec (heads * d_head)) (γ2 β2 : ) (Wfc1 : Proofs.Mat (heads * d_head) mlpDim) (bfc1 : Proofs.Vec mlpDim) (Wfc2 : Proofs.Mat mlpDim (heads * d_head)) (bfc2 : Proofs.Vec (heads * d_head)) (γF βF : ) (Wcls : Proofs.Mat (heads * d_head) nClasses) (bcls : Proofs.Vec nClasses) :
                                                                        Proofs.HasVJP (denoteVitRep [VLayer.conv ic (heads * d_head) patchSize patchSize, VLayer.param #[1, heads * d_head] 2, VLayer.param #[N + 1, heads * d_head] 2, VLayer.transformerBlock (heads * d_head) mlpDim, VLayer.layerNorm (heads * d_head), VLayer.dense (heads * d_head) nClasses] ic H W patchSize N mlpDim heads d_head kBlocks nClasses W_conv b_conv cls_token pos_embed ε γ1 β1 Wq Wk Wv Wo bq bk bv bo γ2 β2 Wfc1 bfc1 Wfc2 bfc2 γF βF Wcls bcls)

                                                                        The representative spec carries the math (canonical witness; the honest unconditional fold is Proofs.vit_full_has_vjp).

                                                                        Equations
                                                                        • One or more equations did not get rendered due to their size.
                                                                        Instances For
                                                                          noncomputable def denoteR34Rep {s0 s1 s2 s3 s4 s5 s6 s7 : } (layers : List VLayer) (stem : Proofs.Vec s0Proofs.Vec s1) (mp : Proofs.Vec s1Proofs.Vec s2) (ids1 : List (Proofs.Vec s2Proofs.Vec s2)) (down2 : Proofs.Vec s2Proofs.Vec s3) (ids2 : List (Proofs.Vec s3Proofs.Vec s3)) (down3 : Proofs.Vec s3Proofs.Vec s4) (ids3 : List (Proofs.Vec s4Proofs.Vec s4)) (down4 : Proofs.Vec s4Proofs.Vec s5) (ids4 : List (Proofs.Vec s5Proofs.Vec s5)) (gap : Proofs.Vec s5Proofs.Vec s6) (dense : Proofs.Vec s6Proofs.Vec s7) :

                                                                          Math denotation of the representative ResNet-34 layer list → the skeleton composition dense ∘ gap ∘ chainComp ids4 ∘ down4 ∘ … ∘ chainComp ids1 ∘ mp ∘ stem that the audited parametric apex resnet34_has_vjp_at is about. r34 has no concrete whole-net Forward (only this abstract [3,4,6,3]-stage skeleton over abstract block maps); the full faithful forward at real Imagenette dims is the deferred build.

                                                                          Equations
                                                                          • One or more equations did not get rendered due to their size.
                                                                          • denoteR34Rep layers stem mp ids1 down2 ids2 down3 ids3 down4 ids4 gap dense = fun (x : Proofs.Vec s0) => 0
                                                                          Instances For
                                                                            theorem r34Rep_denote_eq {s0 s1 s2 s3 s4 s5 s6 s7 : } (stem : Proofs.Vec s0Proofs.Vec s1) (mp : Proofs.Vec s1Proofs.Vec s2) (ids1 : List (Proofs.Vec s2Proofs.Vec s2)) (down2 : Proofs.Vec s2Proofs.Vec s3) (ids2 : List (Proofs.Vec s3Proofs.Vec s3)) (down3 : Proofs.Vec s3Proofs.Vec s4) (ids3 : List (Proofs.Vec s4Proofs.Vec s4)) (down4 : Proofs.Vec s4Proofs.Vec s5) (ids4 : List (Proofs.Vec s5Proofs.Vec s5)) (gap : Proofs.Vec s5Proofs.Vec s6) (dense : Proofs.Vec s6Proofs.Vec s7) :
                                                                            denoteR34Rep [VLayer.convBn 3 64 7 2, VLayer.maxPool 2 2, VLayer.residualStage 64 64 3 1, VLayer.residualStage 64 128 4 2, VLayer.residualStage 128 256 6 2, VLayer.residualStage 256 512 3 2, VLayer.globalAvgPool, VLayer.dense 512 10] stem mp ids1 down2 ids2 down3 ids3 down4 ids4 gap dense = dense gap Proofs.chainComp ids4 down4 Proofs.chainComp ids3 down3 Proofs.chainComp ids2 down2 Proofs.chainComp ids1 mp stem

                                                                            Spec ≡ the representative proven skeleton.

                                                                            noncomputable def r34Rep_has_vjp {s0 s1 s2 s3 s4 s5 s6 s7 : } (stem : Proofs.Vec s0Proofs.Vec s1) (mp : Proofs.Vec s1Proofs.Vec s2) (ids1 : List (Proofs.Vec s2Proofs.Vec s2)) (down2 : Proofs.Vec s2Proofs.Vec s3) (ids2 : List (Proofs.Vec s3Proofs.Vec s3)) (down3 : Proofs.Vec s3Proofs.Vec s4) (ids3 : List (Proofs.Vec s4Proofs.Vec s4)) (down4 : Proofs.Vec s4Proofs.Vec s5) (ids4 : List (Proofs.Vec s5Proofs.Vec s5)) (gap : Proofs.Vec s5Proofs.Vec s6) (dense : Proofs.Vec s6Proofs.Vec s7) :
                                                                            Proofs.HasVJP (denoteR34Rep [VLayer.convBn 3 64 7 2, VLayer.maxPool 2 2, VLayer.residualStage 64 64 3 1, VLayer.residualStage 64 128 4 2, VLayer.residualStage 128 256 6 2, VLayer.residualStage 256 512 3 2, VLayer.globalAvgPool, VLayer.dense 512 10] stem mp ids1 down2 ids2 down3 ids3 down4 ids4 gap dense)

                                                                            The representative spec carries the math (canonical witness; the honest conditional fold through the [3,4,6,3] stages is Proofs.resnet34_has_vjp_at).

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

                                                                              Rung E (ch7 mnv2, representative): the spec's math ↔ the generated MLIR #

                                                                              The forward graph mobilenetv2FwdGraphFull (StableHLO) — the strided 6-block render — denotes the representative spec's forward: den graph = mobilenetv2Forward_full (mobilenetv2FwdGraphFull_faithful) composed with mobilenetv2Rep_denote_eq gives den graph = denoteMobilenet mobilenetv2RepLayers. So the generated StableHLO provably computes the representative spec's function — the A+B+C+E ladder at the 6-block witness (the committed 17-block spec's E rung is mobilenetv2Verified_fwd_faithful, above). E is simp-based, so it does NOT hit the VJP-fold's concrete-dim isDefEq wall. (Forward only; the backward graph + the .mlir re-route off the committed tests/Test* string emitter are the remaining E work — see planning doc.)

                                                                              theorem mobilenetv2Rep_fwd_faithful (epsStr : String) (Ws : Proofs.Kernel4 16 3 3 3) (bs : Proofs.Vec 16) (εs γs βs : ) (We1 : Proofs.Kernel4 64 16 1 1) (be1 : Proofs.Vec 64) (εe1 γe1 βe1 : ) (Wd1 : Proofs.DepthwiseKernel 64 3 3) (bd1 : Proofs.Vec 64) (εd1 γd1 βd1 : ) (Wp1 : Proofs.Kernel4 24 64 1 1) (bp1 : Proofs.Vec 24) (εp1 γp1 βp1 : ) (We2 : Proofs.Kernel4 96 24 1 1) (be2 : Proofs.Vec 96) (εe2 γe2 βe2 : ) (Wd2 : Proofs.DepthwiseKernel 96 3 3) (bd2 : Proofs.Vec 96) (εd2 γd2 βd2 : ) (Wp2 : Proofs.Kernel4 24 96 1 1) (bp2 : Proofs.Vec 24) (εp2 γp2 βp2 : ) (We3 : Proofs.Kernel4 96 24 1 1) (be3 : Proofs.Vec 96) (εe3 γe3 βe3 : ) (Wd3 : Proofs.DepthwiseKernel 96 3 3) (bd3 : Proofs.Vec 96) (εd3 γd3 βd3 : ) (Wp3 : Proofs.Kernel4 32 96 1 1) (bp3 : Proofs.Vec 32) (εp3 γp3 βp3 : ) (We4 : Proofs.Kernel4 128 32 1 1) (be4 : Proofs.Vec 128) (εe4 γe4 βe4 : ) (Wd4 : Proofs.DepthwiseKernel 128 3 3) (bd4 : Proofs.Vec 128) (εd4 γd4 βd4 : ) (Wp4 : Proofs.Kernel4 32 128 1 1) (bp4 : Proofs.Vec 32) (εp4 γp4 βp4 : ) (We5 : Proofs.Kernel4 128 32 1 1) (be5 : Proofs.Vec 128) (εe5 γe5 βe5 : ) (Wd5 : Proofs.DepthwiseKernel 128 3 3) (bd5 : Proofs.Vec 128) (εd5 γd5 βd5 : ) (Wp5 : Proofs.Kernel4 64 128 1 1) (bp5 : Proofs.Vec 64) (εp5 γp5 βp5 : ) (We6 : Proofs.Kernel4 256 64 1 1) (be6 : Proofs.Vec 256) (εe6 γe6 βe6 : ) (Wd6 : Proofs.DepthwiseKernel 256 3 3) (bd6 : Proofs.Vec 256) (εd6 γd6 βd6 : ) (Wp6 : Proofs.Kernel4 64 256 1 1) (bp6 : Proofs.Vec 64) (εp6 γp6 βp6 : ) (Wh : Proofs.Kernel4 128 64 1 1) (bh : Proofs.Vec 128) (εh γh βh : ) (Wfc : Proofs.Mat 128 10) (bfc : Proofs.Vec 10) (x : Proofs.Vec (3 * 224 * 224)) :
                                                                              Proofs.StableHLO.den (Proofs.StableHLO.mobilenetv2FwdGraphFull epsStr Ws bs εs γs βs We1 be1 εe1 γe1 βe1 Wd1 bd1 εd1 γd1 βd1 Wp1 bp1 εp1 γp1 βp1 We2 be2 εe2 γe2 βe2 Wd2 bd2 εd2 γd2 βd2 Wp2 bp2 εp2 γp2 βp2 We3 be3 εe3 γe3 βe3 Wd3 bd3 εd3 γd3 βd3 Wp3 bp3 εp3 γp3 βp3 We4 be4 εe4 γe4 βe4 Wd4 bd4 εd4 γd4 βd4 Wp4 bp4 εp4 γp4 βp4 We5 be5 εe5 γe5 βe5 Wd5 bd5 εd5 γd5 βd5 Wp5 bp5 εp5 γp5 βp5 We6 be6 εe6 γe6 βe6 Wd6 bd6 εd6 γd6 βd6 Wp6 bp6 εp6 γp6 βp6 Wh bh εh γh βh Wfc bfc x) = denoteMobilenet mobilenetv2RepLayers Ws bs εs γs βs We1 be1 εe1 γe1 βe1 Wd1 bd1 εd1 γd1 βd1 Wp1 bp1 εp1 γp1 βp1 We2 be2 εe2 γe2 βe2 Wd2 bd2 εd2 γd2 βd2 Wp2 bp2 εp2 γp2 βp2 We3 be3 εe3 γe3 βe3 Wd3 bd3 εd3 γd3 βd3 Wp3 bp3 εp3 γp3 βp3 We4 be4 εe4 γe4 βe4 Wd4 bd4 εd4 γd4 βd4 Wp4 bp4 εp4 γp4 βp4 We5 be5 εe5 γe5 βe5 Wd5 bd5 εd5 γd5 βd5 Wp5 bp5 εp5 γp5 βp5 We6 be6 εe6 γe6 βe6 Wd6 bd6 εd6 γd6 βd6 Wp6 bp6 εp6 γp6 βp6 Wh bh εh γh βh Wfc bfc x

                                                                              Rung E (ch9 convnext, representative): the spec's math ↔ the generated MLIR #

                                                                              The representative forward graph convNextFwdGraph (StableHLO; patchify → LN → block×2 → GAP → head-LN → dense, via geluF/layerScaleF/bnF/addV) denotes the representative convNextForward (convNextFwdGraph_faithful), composed with convnextRep_denote_eqden graph = denoteConvnextRep <rep layers>. So convnext has the representative A+B+C+E(fwd) ladder. (Scalar LN; the full-render E is convnextVerified_fwd_faithful above.)

                                                                              theorem convnextRep_fwd_faithful {ic c cExp h w kH kW nClasses : } (epsStr : String) (Wst : Proofs.Kernel4 c ic 1 1) (bst : Proofs.Vec c) (εst γst βst : ) (Wdw₁ : Proofs.DepthwiseKernel c kH kW) (bdw₁ : Proofs.Vec c) (εn₁ γn₁ βn₁ : ) (Wex₁ : Proofs.Kernel4 cExp c 1 1) (bex₁ : Proofs.Vec cExp) (Wpr₁ : Proofs.Kernel4 c cExp 1 1) (bpr₁ : Proofs.Vec c) (γls₁ : Proofs.Vec (c * h * w)) (Wdw₂ : Proofs.DepthwiseKernel c kH kW) (bdw₂ : Proofs.Vec c) (εn₂ γn₂ βn₂ : ) (Wex₂ : Proofs.Kernel4 cExp c 1 1) (bex₂ : Proofs.Vec cExp) (Wpr₂ : Proofs.Kernel4 c cExp 1 1) (bpr₂ : Proofs.Vec c) (γls₂ : Proofs.Vec (c * h * w)) (εhd γhd βhd : ) (Wd : Proofs.Mat c nClasses) (bd : Proofs.Vec nClasses) (x : Proofs.Vec (ic * h * w)) :
                                                                              Proofs.StableHLO.den (Proofs.StableHLO.convNextFwdGraph epsStr Wst bst εst γst βst Wdw₁ bdw₁ εn₁ γn₁ βn₁ Wex₁ bex₁ Wpr₁ bpr₁ γls₁ Wdw₂ bdw₂ εn₂ γn₂ βn₂ Wex₂ bex₂ Wpr₂ bpr₂ γls₂ εhd γhd βhd Wd bd x) = denoteConvnextRep [VLayer.conv ic c 1 1, VLayer.bn, VLayer.convNextBlock c, VLayer.convNextBlock c, VLayer.globalAvgPool, VLayer.bn, VLayer.dense c nClasses] Wst bst εst γst βst Wdw₁ bdw₁ εn₁ γn₁ βn₁ Wex₁ bex₁ Wpr₁ bpr₁ γls₁ Wdw₂ bdw₂ εn₂ γn₂ βn₂ Wex₂ bex₂ Wpr₂ bpr₂ γls₂ εhd γhd βhd Wd bd x