AFTD Auto-Formalizing Theoretical Domains

CommunicationComplexity.Internal.invCdf

defimported Lean

Given a PMF $p$ on $\mathrm{Fin}\,m$ (with $m \ge 1$) and a value $x \in \mathbb{R}_{\ge 0}^\infty$, $\mathrm{invCdf}(p, x)$ is the largest index $i \in \mathrm{Fin}\,m$ satisfying $\mathrm{cdf}(p, i) \le x$, i.e.\ the generalized inverse (quantile) of the CDF.

Statement

set_option relaxedAutoImplicit false in
set_option autoImplicit false in
open MeasureTheory in
open scoped ENNReal in
noncomputable def CommunicationComplexity.Internal.invCdf {m : ℕ} [NeZero m] (p : PMF (Fin m)) (x : ℝ≥0∞) : Fin m
Defined in
TCSlib, `CommunicationComplexity.Internal.invCdf`
Lean proof
By Lucy Horowitz, Timothe Kasriel, Mihir Singhal, from github.com/Shilun-Allan-Li/tcslib at c8a02591b1e5 (Copyright (c) 2026 Lucy Horowitz, Timothe Kasriel, and Mihir Singhal. All rights reserved, Apache-2.0). Compiled here against leanprover/lean4:v4.33.1, Mathlib v4.33.1; written for leanprover/lean4:v4.25.0.
Verified
07 Oct 2026
Axioms
none listed
Built on 2
Used by 3

Lean source view module on GitHub

set_option relaxedAutoImplicit false in
set_option autoImplicit false in
open MeasureTheory in
open scoped ENNReal in
/-- The generalised inverse of the cumulative distribution function: `invCdf p x` is the largest index `i` with `cdf p i ≤ x` (always defined, since `cdf p 0 = 0 ≤ x`). -/
noncomputable def CommunicationComplexity.Internal.invCdf {m : ℕ} [NeZero m] (p : PMF (Fin m)) (x : ℝ≥0∞) : Fin m :=
  (Finset.univ.filter (fun (i : Fin m) => cdf p i ≤ x)).max' (by
    unfold Finset.Nonempty
    refine ⟨(⟨0, Nat.pos_of_neZero m⟩ : Fin m), ?_⟩
    simp
  )
See it in the graphDiscuss this resultChallenge it