Documentation

LeanMlir.Proofs.Certificates.SmoothingPhiBounds

Certified decimal quantile bounds — Φ⁻¹ leaves symbolic-land #

The scorecard's radii are σ·Φ⁻¹(q₀) with Φ⁻¹ SYMBOLIC; the driver prints decimals via float Acklam. This file closes that gap with certified rational LOWER bounds on Φ⁻¹:

For the whole corpus, the §prefix-scan section makes per-image checks cheap: phiScanRev computes ALL grid values in one kernel pass (the head's two uses stay shared through the kernel's whnf cache), phiScanRev_getD indexes it, and le_stdNormalQuantile_of_scan/smooth_radius_dec turn one O(index) lookup against the one-shot literal into a certified decimal radius — see the generated SmoothingDecScorecard.lean (279 images). The literal is verified in CHUNKS (phiScanRevFrom + phiScanRevFrom_append): one whole-grid evaluation peaks at 15 GB of retained kernel-cache bignums (an OOM on 16 GB CI runners); per-declaration chunks are freed in between.

All results are propext / Classical.choice / Quot.sound-clean.

theorem Proofs.stdNormalCDF_panel {a b : } (h0 : 0 a) (hab : a b) :

One upper Riemann panel: on [a,b] ⊆ [0,∞) the density is at most its left-endpoint value, so Φ(b) ≤ Φ(a) + (b−a)·φ(a).

Truncated Taylor sum — a computable rational lower bound for exp on [0,∞) (32 terms: relative error < e⁻²⁴ at x = 5.12, our largest use).

Equations
Instances For
    theorem Proofs.ratExpLB_le {x : } (hx : 0 x) :
    (ratExpLB x) Real.exp x
    theorem Proofs.one_le_ratExpLB {x : } (hx : 0 x) :

    Computable rational upper bound for the standard-normal density at a rational point: φ(a) = 1/(√(2π)·exp(a²/2)) ≤ 1/(2.5066282·ratExpLB(a²/2)).

    Equations
    Instances For

      Round a rational UP to denominator 10⁹ — keeps the grid fold's denominators from exploding (the exact ratPdfUB values have ~190-digit numerators whose lcm across 640 grid points is astronomical).

      Equations
      Instances For
        def Proofs.phiGridUB (h : ) :

        Computable upper bound for Φ(m·h): cumulative left-endpoint upper Riemann panels from 0, each pdf bound ceiling-rounded to 10⁻⁹.

        Equations
        Instances For
          theorem Proofs.stdNormalCDF_le_phiGridUB {h : } (hh : 0 h) (m : ) :
          stdNormalCDF ↑(m * h) (phiGridUB h m)
          theorem Proofs.le_stdNormalQuantile_of_grid {h : } (hh : 0 h) (m : ) {q : } (hq : q Set.Ioo 0 1) (hcheck : (phiGridUB h m) q) :
          ↑(m * h) stdNormalQuantile q

          The certified-decimal-radius workhorse: one rational grid check phiGridUB h m ≤ q₀ certifies m·h ≤ Φ⁻¹(q₀).

          Descending prefix scan of the grid fold: phiScanRev h n = [phiGridUB h n, …, phiGridUB h 0]. Each step reuses the previous head, so ONE kernel evaluation prices the whole grid at O(n) pdf bounds (a per-image phiGridUB decide re-folds its whole prefix instead; the kernel's whnf cache keeps the head's two uses shared — measured 81 s for the full h = 1/1000, 3300-panel scan).

          Equations
          Instances For
            theorem Proofs.phiScanRev_succ (h : ) (m : ) :
            phiScanRev h (m + 1) = phiGridUB h (m + 1) :: phiScanRev h m
            theorem Proofs.phiScanRev_getD (h : ) {n m : } :
            m n(phiScanRev h n).getD (n - m) 1 = phiGridUB h m

            Index the scan: entry n − m (descending order) is phiGridUB h m.

            theorem Proofs.le_stdNormalQuantile_of_scan {h : } (hh : 0 h) {n : } {L : List } (hL : phiScanRev h n = L) {m : } (hm : m n) {qr : } (hq : qr Set.Ioo 0 1) (hcheck : L.getD (n - m) 1 qr) :
            ↑(m * h) stdNormalQuantile qr

            The scan workhorse: against a ONE-shot kernel-evaluated literal phiScanRev h n = L, a single O(index) lookup L.getD (n−m) 1 ≤ q₀ certifies m·h ≤ Φ⁻¹(q₀) — per-image checks stop re-folding the grid.

            def Proofs.phiScanRevFrom (h : ) (k : ) (v : ) :

            The scan CONTINUED from a checkpoint: given v = phiGridUB h k, phiScanRevFrom h k v j = [phiGridUB h (k+j), …, phiGridUB h k] (established by phiScanRevFrom_append). Lets the whole-grid kernel evaluation — 15 GB peak at 3300 panels, an OOM on 16 GB CI runners — be split into per-declaration chunks: the kernel's whnf cache (which retains every intermediate bignum) is freed between declarations.

            Equations
            Instances For
              theorem Proofs.phiScanRevFrom_ne_nil (h : ) (k : ) (v : ) (j : ) :
              theorem Proofs.phiScanRevFrom_append (h : ) (k j : ) :

              The chunk glue: a scan continued from the checkpoint phiGridUB h k extends the full scan from k to k + j.

              theorem Proofs.smooth_radius_dec {n : } {L : List } (hL : phiScanRev (1 / 1000) n = L) (m a : ) (hm : m n) (ha0 : 5000 a) (ha1 : a < 10000) (hcheck : L.getD (n - m) 1 a / 10000) :
              m / 2000 1 / 2 * stdNormalQuantile (a / 10000)

              The scorecard-protocol decimal-radius form (σ = 1/2, grid h = 1/1000, 4-decimal q₀ = a/10000): one scan lookup certifies m/2000 ≤ σ·Φ⁻¹(q₀) — the certified decimal counterpart of the driver's float radius printout.