Theorem 1: coverage of conformal prediction
ProvedConformalCovariateShift.conformal_coverageLet , , be exchangeable random variables, let be a score function and let . Let be the conformal band (5) built from :
with the scores (4). Then
If moreover ties among occur with probability zero, this probability is at most .
This is the finite-sample, distribution-free coverage guarantee of conformal prediction (Vovk et al. 2005; Lei et al. 2018).
Formalization Note The score function is assumed measurable in the sense that each map is measurable, so that the scores are random variables; the paper uses this implicitly when it applies Lemma 1 to them. is written as functions .
import Mathlib import Definitions.Def_ConformalCovariateShift_Basic open MeasureTheory ProbabilityTheory
namespace ConformalCovariateShift
theorem conformal_coverage {Omega : Type*} [MeasurableSpace Omega] (P : Measure Omega) [IsProbabilityMeasure P]
{d n : ℕ} (Z : Fin (n + 1) → Omega → DataPt d) (hZ : IsExchangeable P Z)
(S : ScoreFn (DataPt d)) (hS : ∀ i, Measurable (fun z : Fin (n + 1) → DataPt d => scores S z i))
(α : ℝ) (hα0 : 0 < α) (hα1 : α < 1) :
ENNReal.ofReal (1 - α) ≤
P {ω | (Z (Fin.last n) ω).2 ∈
conformalBand S α (fun i => Z i.castSucc ω) (Z (Fin.last n) ω).1} ∧
(P {ω | ∃ i j, i ≠ j ∧ scores S (fun k => Z k ω) i = scores S (fun k => Z k ω) j} = 0 →
P {ω | (Z (Fin.last n) ω).2 ∈
conformalBand S α (fun i => Z i.castSucc ω) (Z (Fin.last n) ω).1} ≤
ENNReal.ofReal (1 - α + 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 natural numbers; is allowed. Let
be random data points, written with and .
Exchangeability hypothesis. The theorem assumes the are exchangeable, which here means:
- each is measurable (Borel σ-algebra on );
- for every permutation of , the random vector has the same joint law under as .
Scores. Let be any function that takes a point and a finite multiset of such points and returns a real number . For a tuple , the score of the -th point is
where the second argument is the multiset of the other points. The only assumption on is that, for each , the map on is measurable.
Level. Let be a real number with .
Quantile. For a measure on the extended real line and , define
Here a negative is read as .
Conformal band. Given training points and a test covariate , form the points and write for their scores. Let
This is the uniform distribution on the values . The band is
In the theorem, is built from and evaluated at . With , the scores involved are exactly . Write the coverage event as
Conclusion. The theorem asserts both of the following:
- Lower bound (unconditional):
- Upper bound (under no ties): Suppose the event that some two distinct indices in have has probability . Ties involving the test score count. Then
Fine print.
- The measurability of and of the tie event is not asserted or assumed. If either set is not measurable, is applied as an outer measure.
- The upper bound may exceed , in which case statement 2 is automatic.
- When :
- is the point mass at , so the quantile is , , and .
- The no-ties hypothesis holds vacuously, since there are no two distinct indices.
- The upper bound equals .
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.