Documentation

LeanMlir.Proofs.Foundation.ListDot

Kernel-fast ℤ-list dot products for certificate data #

The pooled 49-dim scorecard (LipschitzCertScorecard.lean) evaluates its rational dot products by simp [Fin.sum_univ_succ] <;> norm_num — fine at 49 terms, but quadratic in the sum length and ~15–20 s per 784-term dot, which priced a FULL-INPUT (un-pooled, 784-dim) scorecard out of CI.

This file is the fix, in three parts:

Used by LipschitzCertScorecardFull*.lean (generated by scripts/lipschitz_cert_scorecard_full.py). All 3-axiom clean.

def Proofs.dotZ (xs ys : List ) :

Integer dot product of two lists — the shape the kernel evaluates fast (decide +kernel: pointer-shared tails, GMP mul/add, no Fin indexing).

Equations
Instances For
    theorem Proofs.dotZ_comm (xs ys : List ) :
    dotZ xs ys = dotZ ys xs
    theorem Proofs.sum_getD_mul (n : ) (xs ys : List ) :
    xs.length = nys.length = nj : Fin n, (xs.getD (↑j) 0) * (ys.getD (↑j) 0) = (dotZ xs ys)

    getD-dot over Fin n = list dot, generically (proved once, by induction on n so Fin.sum_univ_succ applies syntactically).

    theorem Proofs.sum_getD_div {xs ys : List } {n : } (hx : xs.length = n) (hy : ys.length = n) {v : } (h : dotZ xs ys = v) (c d : ) :
    j : Fin n, (xs.getD (↑j) 0) / c * ((ys.getD (↑j) 0) / d) = v / (c * d)

    The scaled form the certificate files instantiate: rows stored as ℤ-lists of numerators over denominators c, d; once dotZ xs ys = v is checked in the kernel, the ℝ-level dense-layer dot is v/(c·d).

    Integer absolute row sum — the ℓ1 weight of a row, kernel-evaluable (decide +kernel). Feeds the IBP uniform-radius layer bound denseLo/Hi (x ∓ ε) = ⟨w,x⟩ ∓ ε·Σ|w| (IntervalBound.lean).

    Equations
    Instances For
      theorem Proofs.sum_getD_abs (n : ) (xs : List ) :
      xs.length = nj : Fin n, |(xs.getD (↑j) 0)| = (absSumZ xs)

      getD abs-sum over Fin n = list abs-sum (the sum_getD_mul sibling).

      theorem Proofs.sum_getD_abs_div {xs : List } {n : } (hx : xs.length = n) {v : } (h : absSumZ xs = v) {c : } (hc : 0 c) :
      j : Fin n, |(xs.getD (↑j) 0) / c| = v / c

      Scaled form: a k/c-grid row's ℓ1 norm from one kernel fact.