Lemma 2 (as proved): inflation of quantiles
ProvedConformalizedQuantileRegression.quantile_inflationLet and let be exchangeable real random variables. Let be the empirical quantile function of . For every ,
If moreover are almost surely distinct, then also
The inflated level accounts for the unseen -st variable; this lemma is what the coverage theorems apply to the conformity scores.
Formalization Note This is Lemma 2 as its proof establishes it. The printed upper bound is ; the proof (apply Lemma 1 with variables) gives the sharper , and the proof of Theorem 1 uses this sharper form to obtain . The empirical quantile at a level above is .
import Mathlib import Definitions.Def_ConformalizedQuantileRegression_Basic open MeasureTheory ProbabilityTheory
namespace ConformalizedQuantileRegression
theorem quantile_inflation {Ω : Type*} [MeasurableSpace Ω] (P : Measure Ω)
[IsProbabilityMeasure P] {n : ℕ} (hn : 0 < n) (Z : Fin (n + 1) → Ω → ℝ)
(hZ : IsExchangeable P Z) (α : ℝ) (hα0 : 0 < α) (hα1 : α < 1) :
ENNReal.ofReal α ≤
P {ω | (Z (Fin.last n) ω : EReal) ≤
empQuantile (Finset.univ.map Fin.castSuccEmb) (fun i => Z i ω) ((1 + 1 / (n : ℝ)) * α)} ∧
((∀ᵐ ω ∂P, Function.Injective (fun i => Z i ω)) →
P {ω | (Z (Fin.last n) ω : EReal) ≤
empQuantile (Finset.univ.map Fin.castSuccEmb) (fun i => Z i ω) ((1 + 1 / (n : ℝ)) * α)} ≤
ENNReal.ofReal (α + 1 / ((n : ℝ) + 1))) := by sorry
end ConformalizedQuantileRegressionRead-back
What the Lean code literally says, in plain math · claude-opus-5-5
Let be a probability space. Let be a natural number, and let be real-valued functions. (In the code they are indexed ; here they are relabelled , so is the last one.)
The family is assumed exchangeable in the following sense:
- each is measurable; and
- for every permutation of , the joint law of under equals the joint law of , as measures on .
Let be a real number with .
Empirical quantile. For each outcome , the empirical CDF of the first values is
For a level , the empirical quantile is defined in the extended reals as
Some features of this definition:
- when the set is empty, which happens exactly when .
- When , the infimum is attained and equals the -th smallest of , counted with multiplicity.
- The level used throughout is the inflated level
This is strictly positive. It exceeds , so that , precisely when .
- Only enter ; the last variable does not.
Define the event
The comparison is non-strict and takes place in the extended reals, so contains every for which the quantile is . Here denotes the measure applied to this set; measurability of is not asserted, and for a non-measurable set this value would be its outer measure.
The theorem asserts both of the following.
- Lower bound. With no further assumption:
- Upper bound under distinctness. If, for -almost every , the values are pairwise distinct, then
This bound is stated as an inequality of non-negative extended reals. Whenever , it holds automatically.
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.