Section 3.5: the weights (15) reduce to the weights (7) under covariate shift
ProvedConformalCovariateShift.perm_weight_cov_shiftLet , let , , be points of and let . Take the weight functions for and . Then the weights (15) evaluated at are the covariate-shift weights (7):
that is, for and .
This computation turns the combinatorial weights of Theorem 2 into the weights of Corollary 1.
Formalization Note The identity is stated for every real function . When both sides are under Lean's convention .
import Mathlib import Definitions.Def_ConformalCovariateShift_Basic open MeasureTheory ProbabilityTheory
namespace ConformalCovariateShift
theorem perm_weight_cov_shift {d n : ℕ} (w : (Fin d → ℝ) → ℝ) (data : Fin n → DataPt d)
(x : Fin d → ℝ) (y : ℝ) :
permWeight (fun j (z : DataPt d) => if j = Fin.last n then w z.1 else 1)
(withTest data (x, y)) =
covShiftWeights w (fun i => (data i).1) x := by sorry
end ConformalCovariateShiftRead-back
What the Lean code literally says, in plain math · claude-opus-5-5
Setting. Fix natural numbers and (either may be ). The theorem takes:
- an arbitrary function . No nonnegativity, measurability or nonvanishing is assumed, so may take negative values or zero.
- data points , each .
- a point and a real number .
There are no further hypotheses. Form the points
and write , so the first component of is for every .
Left-hand side. Define weight functions on by
For each index , the left side is the permutation weight
Here is the set of all permutations of .
Right-hand side. For each , the right side is the covariate-shift weight
So it equals for and for .
Assertion. The two vectors in are equal, coordinate by coordinate:
Edge cases and conventions.
- All divisions are real divisions with the convention . In particular, if , every coordinate of the right side is . The left side then has whatever value its own sum over permutations gives, again with if that sum is zero.
- When there is a single coordinate. The right side is , which is if and if .
- The responses and the number do not appear on the right side. On the left side they enter only through , whose second components are ignored by every .
- The statement holds for all values of these inputs. Since may be negative, the "weights" on either side need not lie in or sum to .
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.