Proposition 3 (as proved): total variation bound under distribution shift
ProvedConformalRiskControl.tv_bound_distribution_shiftLet be independent random elements of a measurable space , . Let be nonempty and compact, and . Let be measurable in for each , and non-increasing and right-continuous in for each . Assume that almost surely, for every , takes values in and . Let be the parameter of eq. (4) for . Then
Suppose further that with , that for every , and that almost surely. Then
Formalization Note The printed statement allows an arbitrary sequence and the losses of Theorem 1, which may be negative. The proof needs independence of the and , and the statement is false without either:
- Let , , , on , and let be uniform on . Then , but the risk is .
- Independent with give risk .
For the lower bound, "the assumptions of Theorem 2" are read as they are used in the proof: for the law of , applied to i.i.d. copies of . They include the left-endpoint condition of Theorem 2 (as proved).
import Mathlib import Definitions.Def_ConformalRiskControl_Basic open MeasureTheory ProbabilityTheory Filter
namespace ConformalRiskControl
theorem tv_bound_distribution_shift {Ω : Type*} [MeasurableSpace Ω] (P : Measure Ω)
[IsProbabilityMeasure P] {Z : Type*} [MeasurableSpace Z] (n : ℕ) (hn : 0 < n)
(Zs : Fin (n + 1) → Ω → Z) (hZ : ∀ i, Measurable (Zs i)) (hind : iIndepFun Zs P)
(Λ : Set ℝ) (hΛ : IsCompact Λ) (hΛne : Λ.Nonempty) (B α : ℝ) (hαB : α < B)
(ℓ : Z → ℝ → ℝ) (hℓ : ∀ x ∈ Λ, Measurable fun z => ℓ z x)
(hanti : ∀ z, AntitoneOn (ℓ z) Λ) (hrc : ∀ z, IsRightContOn Λ (ℓ z))
(hbd : ∀ᵐ ω ∂P, ∀ i, LossBounds Λ B α (ℓ (Zs i ω)) ∧ ∀ x ∈ Λ, 0 ≤ ℓ (Zs i ω) x) :
upperExp P B (fun ω =>
ℓ (Zs (Fin.last n) ω) (lhat Λ B α (fun i : Fin n => ℓ (Zs i.castSucc ω)))) ≤
((α + B * ∑ i : Fin n, tvDist (P.map (Zs i.castSucc)) (P.map (Zs (Fin.last n))) : ℝ)
: EReal) ∧
∀ a b : ℝ, a < b → Λ = Set.Icc a b →
(∀ x ∈ Set.Ioc a b, P {ω | 0 < jump (ℓ (Zs (Fin.last n) ω)) x} = 0) →
(∀ᵐ ω ∂P, α ≤ ℓ (Zs (Fin.last n) ω) a) →
((α - B * (2 / (n + 1) +
∑ i : Fin n, tvDist (P.map (Zs i.castSucc)) (P.map (Zs (Fin.last n)))) : ℝ) : EReal) ≤
upperExp P B (fun ω =>
ℓ (Zs (Fin.last n) ω) (lhat Λ B α (fun i : Fin n => ℓ (Zs i.castSucc ω)))) := by sorry
end ConformalRiskControlRead-back
What the Lean code literally says, in plain math · claude-opus-5-5
Let be a probability space and a measurable space. Fix a natural number with .
Data. Let be measurable random elements that are mutually independent under . In the code they are indexed ; here they are relabelled so that are the first and is the last. They are not assumed to be identically distributed. Write for the law of on .
Parameter set and constants.
- is compact and nonempty, so exists and lies in .
- are reals with .
Loss function. satisfies:
- for each , the map is measurable;
- for every , is non-increasing on ;
- for every , is right-continuous on . This means that at each it is continuous at relative to .
Almost-sure bounds. For -almost every , simultaneously for all (the test index included):
- for all ;
- ;
- for all .
The parameter . For each , let for , and define
By convention if this set is empty. The test loss is the random variable
No measurability of is asserted or assumed.
The "expectation" used. The expectation is not the ordinary integral. It is the extended-real quantity
where is the lower Lebesgue integral of a -valued function. This quantity equals if that integral is . Values of above contribute to the integral rather than a negative amount. When a.s. and is integrable, it coincides with the usual .
Total variation. For probability measures on ,
Let .
Conclusion. The statement asserts the conjunction of the following two claims.
- Upper bound (unconditional, given the standing hypotheses):
-
Lower bound. For every pair of reals , suppose all of the following hold:
- ;
- for every , the set has -(outer) measure ;
- for -almost every .
Then
Here the jump function is . The value is the limit of as , , when that limit exists. If the limit does not exist, is taken to be , so that . The measurability of the set in the second hypothesis is not assumed.
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.