Lemma 1: quantile lemma
ProvedConformalCovariateShift.quantile_lemmaLet be exchangeable real random variables on a probability space, , and let . Then
If moreover ties among occur with probability zero, that is , then the same probability is at most .
This is the quantile lemma on which conformal prediction rests.
Formalization Note Exchangeability includes measurability of each . The probability of the event is written as the measure of the set of outcomes where it holds.
import Mathlib import Definitions.Def_ConformalCovariateShift_Basic open MeasureTheory ProbabilityTheory
namespace ConformalCovariateShift
theorem quantile_lemma {Omega : Type*} [MeasurableSpace Omega] (P : Measure Omega) [IsProbabilityMeasure P]
{n : ℕ} (V : Fin (n + 1) → Omega → ℝ) (hV : IsExchangeable P V)
(β : ℝ) (hβ0 : 0 < β) (hβ1 : β < 1) :
ENNReal.ofReal β ≤ P {ω | (V (Fin.last n) ω : EReal) ≤ quantileWithInf β (fun i => V i ω)} ∧
(P {ω | ∃ i j, i ≠ j ∧ V i ω = V j ω} = 0 →
P {ω | (V (Fin.last n) ω : EReal) ≤ quantileWithInf β (fun i => V i ω)} ≤
ENNReal.ofReal (β + 1 / ((n : ℝ) + 1))) := by sorry
end ConformalCovariateShiftRead-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. Assume they are exchangeable in the following sense:
- each is measurable with respect to the Borel -algebra on ;
- for every permutation of , the joint law of under equals the joint law of , as measures on .
Let be a real number with (both inequalities strict).
The quantile. For each outcome , define the extended-real quantity as follows. First form the discrete probability distribution on the extended real line
This puts mass on each of the first values and mass at . The value does not enter . Then set
where the infimum is taken in the extended reals. Since and , the set is nonempty, so is a genuine infimum.
The two claims. The theorem asserts both of the following.
- Lower bound. With regarded as an extended real,
- Upper bound under no ties. Suppose the event that some two distinct indices in have has -measure . Then
The right-hand side may exceed , in which case the bound holds trivially.
Technical notes.
- Measurability of the two events (the coverage event and the tie event) is not assumed or asserted. is applied to them as an outer measure.
Edge case . There is a single variable . In this case:
- , so ;
- the coverage event is all of , with probability ;
- the tie event is empty, because there are no distinct indices, so the no-ties hypothesis holds automatically;
- both claims reduce to .
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.