Documentation

LeanMlir.Proofs.Certificates.LipschitzCertScorecard

Certified-accuracy scorecard (post_audit_roadmap §1) #

REDUCED CERTIFICATE MODEL — this file's concrete net is the 4×4-pooled 49-dim MNIST family (width-8 hidden, /128–/256 rational weights), NOT the canonical 784→512→512→10 mlpVerified; chosen so every margin/norm/SOS check is exact rational arithmetic in-kernel. Canonical surface: Proofs/MlpCanonical.lean.

The one-input certificate of LipschitzCertInstance.lean, scaled to a dataset-level claim over a FIXED subset — the first 100 MNIST test images (4×4-pooled, exact pixel-sum rationals) — at a FIXED radius ε = 1/10 (pooled-feature L2; a pooled coordinate is a 16-pixel block average, so ε is a 4×4-block-averaged pixel budget of 0.1·255 ≈ 25.5 gray levels concentrated on one block, or spread L2-wise across blocks). Two nets:

Same theorem, same ε — the training method decides whether the certificate bites (the roadmap's caps 1.5–2 cost too much clean accuracy at this scale: σ ≤ 2 → 66% test acc; σ ≤ 4 keeps 87.0% vs 89.8% unconstrained).

Theorem vs. measurement — read this before quoting a number. Soundness lives in the ENGINE (certified_at_eps + LipschitzCert.lean), proved once — kernel-checking the 57th image buys nothing the 56th didn't. The counts above are exact-rational MEASUREMENTS over the first 100 images, carried in full by the certMargin* data table at the aggregate below (which is what downstream measurement passes read); the first 8 certified images per net additionally carry hpre*/margin*/certified* THEOREMS, and scorecard states only those. Every img<i> of the measured set is kept regardless — the 34 image definitions are cheap and other tiers reference them.

Each of the 8 EMITTED images gets a margin lemma (exact rational, in-kernel) and a ∀ δ, ‖δ‖ < ε → argmax fixed theorem via certified_at_eps. Every OTHER certified image appears only as a -- certMargin* comment line: a measurement, carrying no lemma of any kind. The aggregate count is the honest direction only ("at least K of 100") — an upper-bound L cannot prove an image UNcertifiable. Empirical bracket (not proof): L2-PGD (100 steps, 4 restarts) leaves uncon 69/100, capped 72/100 robust at the same ε — cert ≤ TRUE ≤ PGD.

Generated by scripts/lipschitz_cert_scorecard.py; weights/images are DATA.

noncomputable def Proofs.LipschitzCertDemo.W1s :
Fin 8Fin 49

Capped-net hidden weights (8×49), entries k/256.

Equations
  • One or more equations did not get rendered due to their size.
Instances For
    noncomputable def Proofs.LipschitzCertDemo.W2s :
    Fin 10Fin 8

    Capped-net output weights (10×8), entries k/256.

    Equations
    • One or more equations did not get rendered due to their size.
    Instances For
      noncomputable def Proofs.LipschitzCertDemo.G1s :
      Fin 8Fin 8

      G1s = W1s·W1sᵀ (8×8, denominators 256² = 65536).

      Equations
      • One or more equations did not get rendered due to their size.
      Instances For
        noncomputable def Proofs.LipschitzCertDemo.G2s :
        Fin 10Fin 10
        Equations
        • One or more equations did not get rendered due to their size.
        Instances For
          noncomputable def Proofs.LipschitzCertDemo.H1s :
          Fin 8Fin 8

          H1s = G1s² (denominators 256⁴ = 4294967296).

          Equations
          • One or more equations did not get rendered due to their size.
          Instances For
            noncomputable def Proofs.LipschitzCertDemo.H2s :
            Fin 10Fin 10
            Equations
            • One or more equations did not get rendered due to their size.
            Instances For
              theorem Proofs.LipschitzCertDemo.G1s_eq (a b : Fin 8) :
              G1s a b = j : Fin 49, W1s a j * W1s b j
              theorem Proofs.LipschitzCertDemo.G2s_eq (a b : Fin 10) :
              G2s a b = j : Fin 8, W2s a j * W2s b j
              theorem Proofs.LipschitzCertDemo.H1s_eq (a b : Fin 8) :
              H1s a b = c : Fin 8, G1s c a * G1s c b
              theorem Proofs.LipschitzCertDemo.H2s_eq (a b : Fin 10) :
              H2s a b = c : Fin 10, G2s c a * G2s c b

              Schatten-8 bound for the capped hidden layer: B₁ = 4323/1000 (cap 4).

              Capped-net Schatten-8 product: L = 19.760 vs 63.79 unconstrained — the projection is what makes the fixed-ε certificate bite.

              MNIST test image #0 (digit 7), exact pixel sums /4080.

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

                MNIST test image #3 (digit 0), exact pixel sums /4080.

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

                  MNIST test image #5 (digit 1), exact pixel sums /4080.

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

                    MNIST test image #10 (digit 0), exact pixel sums /4080.

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

                      MNIST test image #13 (digit 0), exact pixel sums /4080.

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

                        MNIST test image #14 (digit 1), exact pixel sums /4080.

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

                          MNIST test image #17 (digit 7), exact pixel sums /4080.

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

                            MNIST test image #25 (digit 0), exact pixel sums /4080.

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

                              MNIST test image #28 (digit 0), exact pixel sums /4080.

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

                                MNIST test image #29 (digit 1), exact pixel sums /4080.

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

                                  MNIST test image #34 (digit 7), exact pixel sums /4080.

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

                                    MNIST test image #36 (digit 7), exact pixel sums /4080.

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

                                      MNIST test image #37 (digit 1), exact pixel sums /4080.

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

                                        MNIST test image #39 (digit 1), exact pixel sums /4080.

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

                                          MNIST test image #41 (digit 7), exact pixel sums /4080.

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

                                            MNIST test image #52 (digit 5), exact pixel sums /4080.

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

                                              MNIST test image #56 (digit 4), exact pixel sums /4080.

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

                                                MNIST test image #60 (digit 7), exact pixel sums /4080.

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

                                                  MNIST test image #68 (digit 3), exact pixel sums /4080.

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

                                                    MNIST test image #69 (digit 0), exact pixel sums /4080.

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

                                                      MNIST test image #70 (digit 7), exact pixel sums /4080.

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

                                                        MNIST test image #71 (digit 0), exact pixel sums /4080.

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

                                                          MNIST test image #74 (digit 1), exact pixel sums /4080.

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

                                                            MNIST test image #79 (digit 7), exact pixel sums /4080.

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

                                                              MNIST test image #81 (digit 6), exact pixel sums /4080.

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

                                                                MNIST test image #82 (digit 2), exact pixel sums /4080.

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

                                                                  MNIST test image #85 (digit 4), exact pixel sums /4080.

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

                                                                    MNIST test image #86 (digit 7), exact pixel sums /4080.

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

                                                                      MNIST test image #89 (digit 1), exact pixel sums /4080.

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

                                                                        MNIST test image #90 (digit 3), exact pixel sums /4080.

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

                                                                          MNIST test image #93 (digit 3), exact pixel sums /4080.

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

                                                                            MNIST test image #94 (digit 1), exact pixel sums /4080.

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

                                                                              MNIST test image #95 (digit 4), exact pixel sums /4080.

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

                                                                                MNIST test image #98 (digit 6), exact pixel sums /4080.

                                                                                Equations
                                                                                • One or more equations did not get rendered due to their size.
                                                                                Instances For
                                                                                  noncomputable def Proofs.LipschitzCertDemo.hpreC0 :
                                                                                  Fin 8
                                                                                  Equations
                                                                                  Instances For
                                                                                    theorem Proofs.LipschitzCertDemo.marginC0 (j : Fin 10) :
                                                                                    j 7907357987 / 267386880 (mlpS img0).ofLp 7 - (mlpS img0).ofLp j
                                                                                    theorem Proofs.LipschitzCertDemo.certifiedC0 (δ : EuclideanSpace (Fin 49)) ( : δ < 1 / 10) (j : Fin 10) :
                                                                                    j 7(mlpS (img0 + δ)).ofLp j < (mlpS (img0 + δ)).ofLp 7

                                                                                    Test #0 (digit 7): certified at ε = 1/10 — margin 3.393 ≥ √2·L·ε.

                                                                                    noncomputable def Proofs.LipschitzCertDemo.hpreC3 :
                                                                                    Fin 8
                                                                                    Equations
                                                                                    Instances For
                                                                                      theorem Proofs.LipschitzCertDemo.marginC3 (j : Fin 10) :
                                                                                      j 053187503 / 13369344 (mlpS img3).ofLp 0 - (mlpS img3).ofLp j
                                                                                      theorem Proofs.LipschitzCertDemo.certifiedC3 (δ : EuclideanSpace (Fin 49)) ( : δ < 1 / 10) (j : Fin 10) :
                                                                                      j 0(mlpS (img3 + δ)).ofLp j < (mlpS (img3 + δ)).ofLp 0

                                                                                      Test #3 (digit 0): certified at ε = 1/10 — margin 3.978 ≥ √2·L·ε.

                                                                                      noncomputable def Proofs.LipschitzCertDemo.hpreC5 :
                                                                                      Fin 8
                                                                                      Equations
                                                                                      Instances For
                                                                                        theorem Proofs.LipschitzCertDemo.marginC5 (j : Fin 10) :
                                                                                        j 164216467 / 22282240 (mlpS img5).ofLp 1 - (mlpS img5).ofLp j
                                                                                        theorem Proofs.LipschitzCertDemo.certifiedC5 (δ : EuclideanSpace (Fin 49)) ( : δ < 1 / 10) (j : Fin 10) :
                                                                                        j 1(mlpS (img5 + δ)).ofLp j < (mlpS (img5 + δ)).ofLp 1

                                                                                        Test #5 (digit 1): certified at ε = 1/10 — margin 2.882 ≥ √2·L·ε.

                                                                                        noncomputable def Proofs.LipschitzCertDemo.hpreC10 :
                                                                                        Fin 8
                                                                                        Equations
                                                                                        Instances For
                                                                                          theorem Proofs.LipschitzCertDemo.marginC10 (j : Fin 10) :
                                                                                          j 0287439677 / 89128960 (mlpS img10).ofLp 0 - (mlpS img10).ofLp j
                                                                                          theorem Proofs.LipschitzCertDemo.certifiedC10 (δ : EuclideanSpace (Fin 49)) ( : δ < 1 / 10) (j : Fin 10) :
                                                                                          j 0(mlpS (img10 + δ)).ofLp j < (mlpS (img10 + δ)).ofLp 0

                                                                                          Test #10 (digit 0): certified at ε = 1/10 — margin 3.225 ≥ √2·L·ε.

                                                                                          noncomputable def Proofs.LipschitzCertDemo.hpreC13 :
                                                                                          Fin 8
                                                                                          Equations
                                                                                          Instances For
                                                                                            theorem Proofs.LipschitzCertDemo.marginC13 (j : Fin 10) :
                                                                                            j 0279315957 / 89128960 (mlpS img13).ofLp 0 - (mlpS img13).ofLp j
                                                                                            theorem Proofs.LipschitzCertDemo.certifiedC13 (δ : EuclideanSpace (Fin 49)) ( : δ < 1 / 10) (j : Fin 10) :
                                                                                            j 0(mlpS (img13 + δ)).ofLp j < (mlpS (img13 + δ)).ofLp 0

                                                                                            Test #13 (digit 0): certified at ε = 1/10 — margin 3.134 ≥ √2·L·ε.

                                                                                            noncomputable def Proofs.LipschitzCertDemo.hpreC14 :
                                                                                            Fin 8
                                                                                            Equations
                                                                                            Instances For
                                                                                              theorem Proofs.LipschitzCertDemo.marginC14 (j : Fin 10) :
                                                                                              j 134094067 / 11141120 (mlpS img14).ofLp 1 - (mlpS img14).ofLp j
                                                                                              theorem Proofs.LipschitzCertDemo.certifiedC14 (δ : EuclideanSpace (Fin 49)) ( : δ < 1 / 10) (j : Fin 10) :
                                                                                              j 1(mlpS (img14 + δ)).ofLp j < (mlpS (img14 + δ)).ofLp 1

                                                                                              Test #14 (digit 1): certified at ε = 1/10 — margin 3.060 ≥ √2·L·ε.

                                                                                              noncomputable def Proofs.LipschitzCertDemo.hpreC17 :
                                                                                              Fin 8
                                                                                              Equations
                                                                                              Instances For
                                                                                                theorem Proofs.LipschitzCertDemo.marginC17 (j : Fin 10) :
                                                                                                j 773973561 / 17825792 (mlpS img17).ofLp 7 - (mlpS img17).ofLp j
                                                                                                theorem Proofs.LipschitzCertDemo.certifiedC17 (δ : EuclideanSpace (Fin 49)) ( : δ < 1 / 10) (j : Fin 10) :
                                                                                                j 7(mlpS (img17 + δ)).ofLp j < (mlpS (img17 + δ)).ofLp 7

                                                                                                Test #17 (digit 7): certified at ε = 1/10 — margin 4.150 ≥ √2·L·ε.

                                                                                                noncomputable def Proofs.LipschitzCertDemo.hpreC25 :
                                                                                                Fin 8
                                                                                                Equations
                                                                                                Instances For
                                                                                                  theorem Proofs.LipschitzCertDemo.marginC25 (j : Fin 10) :
                                                                                                  j 01618574687 / 267386880 (mlpS img25).ofLp 0 - (mlpS img25).ofLp j
                                                                                                  theorem Proofs.LipschitzCertDemo.certifiedC25 (δ : EuclideanSpace (Fin 49)) ( : δ < 1 / 10) (j : Fin 10) :
                                                                                                  j 0(mlpS (img25 + δ)).ofLp j < (mlpS (img25 + δ)).ofLp 0

                                                                                                  Test #25 (digit 0): certified at ε = 1/10 — margin 6.053 ≥ √2·L·ε.

                                                                                                  noncomputable def Proofs.LipschitzCertDemo.hpreU82 :
                                                                                                  Fin 8
                                                                                                  Equations
                                                                                                  Instances For
                                                                                                    theorem Proofs.LipschitzCertDemo.marginU82 (j : Fin 10) :
                                                                                                    j 2726202319 / 66846720 (mlpT img82).ofLp 2 - (mlpT img82).ofLp j
                                                                                                    theorem Proofs.LipschitzCertDemo.certifiedU82 (δ : EuclideanSpace (Fin 49)) ( : δ < 1 / 10) (j : Fin 10) :
                                                                                                    j 2(mlpT (img82 + δ)).ofLp j < (mlpT (img82 + δ)).ofLp 2

                                                                                                    Test #82 (digit 2): certified at ε = 1/10 — margin 10.864 ≥ √2·L·ε.

                                                                                                    f is certified at radius ε on input x with class i: every perturbation of L2 norm < ε leaves i the strict argmax. This is the (undecidable — it quantifies over real δ) per-image certificate that each certifiedC<i>/certifiedU<i> theorem proves.

                                                                                                    Equations
                                                                                                    Instances For

                                                                                                      The capped-net certificate witnesses: (subset index, image, class), one triple per certifiedC<i> theorem, in index order.

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

                                                                                                        The unconstrained-net certificate witnesses (certifiedU<i>).

                                                                                                        Equations
                                                                                                        Instances For

                                                                                                          Every capped-net witness is certified — the aggregate is no longer bookkeeping over a bare index list: the proof term is literally the tuple of the 8 per-image theorems.

                                                                                                          theorem Proofs.LipschitzCertDemo.scorecard :
                                                                                                          (cappedCerts.length = 8 pcappedCerts, CertifiedAt mlpS (1 / 10) p.2.1 p.2.2) unconCerts.length = 1 punconCerts, CertifiedAt mlpT (1 / 10) p.2.1 p.2.2

                                                                                                          The scorecard, as a theorem: at ε = 1/10 (pooled L2) the capped net certifies 34/100 of the fixed test subset and the unconstrained net 1/100 — same certificate, same ε; training (σ-projection) decides whether it bites. Those are MEASUREMENTS (the certMargin* table above); the 8 and 1 witnesses BELOW are the ones carrying per-image CertifiedAt proofs, tied to them via cappedCerts_certified/ unconCerts_certified rather than a bare list length. Lower bounds only: an upper-bound L cannot prove an image uncertifiable.