Documentation

LeanMlir.Proofs.Certificates.Smoothing.PhiBounds

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

The scorecard's radii are σ·Φ⁻¹(q₀) with Φ⁻¹ SYMBOLIC; the driver prints decimals via float Acklam. This file supplies 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 Smoothing.DecScorecard (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 below e⁻³² at x = 3.299²/2 ≈ 5.44, the largest argument the 3300-panel h = 1/1000 grid of Smoothing.DecScorecard uses).

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 up to ~230-digit numerators whose lcm across the 3300 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.