Lemma 5: a larger p-value means smaller calibration scores
ProvedConformalOutlierTesting.calibration_scores_given_pvalueWork in the setting of Theorem 2 with continuous scores. Let be an inlier, and let be the order statistics of the calibration scores and . Let be two values that takes, namely and with . Then there exist random vectors
That is, a larger conformal p-value means stochastically smaller calibration scores. This is the key step in the proof of Theorem 2.
Formalization Note The coupling is a probability measure on pairs whose two marginals are the two conditional laws and which is concentrated on coordinatewise. The values are restricted to the grid , the only values with positive probability. This makes both conditional laws well defined.
import Mathlib import Definitions.Def_ConformalOutlierTesting_Basic open MeasureTheory ProbabilityTheory Filter Topology Set BoundedContinuousFunction
namespace ConformalOutlierTesting
theorem calibration_scores_given_pvalue {n m : ℕ} (μ : Measure ℝ) [IsProbabilityMeasure μ]
[NullSingletonClass μ] (ν : Fin m → Measure ℝ) [∀ j, IsProbabilityMeasure (ν j)] (I : Finset (Fin m))
(hI : ∀ j ∈ I, ν j = μ) (i : Fin m) (hi : i ∈ I)
(k k' : ℕ) (hk' : 1 ≤ k') (hkk : k' ≤ k) (hk : k ≤ n + 1) :
∃ κ : Measure ((Fin n → ℝ) × (Fin n → ℝ)), IsProbabilityMeasure κ ∧
κ.map Prod.fst = (ProbabilityTheory.cond (scoreLaw (n := n) μ ν) {ω | margPvals ω i = (k : ℝ) / (n + 1)}).map
(fun ω => orderStat ω.1) ∧
κ.map Prod.snd = (ProbabilityTheory.cond (scoreLaw (n := n) μ ν) {ω | margPvals ω i = (k' : ℝ) / (n + 1)}).map
(fun ω => orderStat ω.1) ∧
∀ᵐ x ∂κ, x.1 ≤ x.2 := by sorry
end ConformalOutlierTestingRead-back
What the Lean code literally says, in plain math · claude-opus-5-5
Setting. Fix natural numbers (number of calibration scores) and (number of test scores). The data are given and the hypotheses are:
- is a probability measure on with no atoms, so for every .
- are probability measures on .
- is a set of indices with for every . The for are arbitrary probability measures.
- is a fixed index, so . No other property of enters the statement.
- are natural numbers with
The score law. Let be the probability measure on defined by
A point is . Under :
- the calibration scores are i.i.d. with law ;
- the test scores are independent of and of each other;
- has law .
The p-value of test point . The marginal conformal p-value of test point is
So holds exactly when exactly calibration scores are . For a vector , write
for its order statistics, sorted so that .
The two conditional laws. For , let
Let be the conditional measure . Define
This is a measure on .
Two formal conventions apply here:
- If , the conditional measure is the zero measure.
- If the order-statistic map were not (almost-everywhere) measurable, the pushforward would be the zero measure.
In either case would be the zero measure and could not be a marginal of a probability measure.
Conclusion. There exists a probability measure on with the following properties:
- its first marginal is ;
- its second marginal is ;
- for -almost every pair , the inequality holds coordinatewise:
In words, couples the two conditional laws of the order statistics. Under this coupling, the order statistics conditioned on the larger p-value value are almost surely coordinatewise the order statistics conditioned on the smaller value .
Edge cases.
- When , the claim is that admits such a coupling with itself.
- When , is a single point and .
- The inequality conclusion is non-strict ().
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.