Stat.Sample­Split

Sample splitting and cross-fitting: fold structures, split σ-algebras, and the independence facts they deliver.

One­Shot 4 core · 3 supporting This file defines a two-fold split of an i.i.d. ★ folds_indep

One-Shot Sample Splits

This file defines a two-fold split of an i.i.d. sample into a nuisance-estimation fold and a target-estimation fold, with both folds growing without bound. It proves the finite-sample independence of the two fold-indexed sample tuples, which is the basic splitting fact used in debiased estimation.

structure OneShotSplit reviewed
Causalean.Stat

One-shot sample split. For an i.i.d. sample S, a fold-size schedule n₁ : ℕ → ℕ splitting the sample of size n into a nuisance fold A(n)={0,,n1(n)1}A(n) = \{0,\dots,n_1(n)-1\} and an estimation fold B(n)={n1(n),,n1}B(n) = \{n_1(n),\dots,n-1\}, where the nuisance fold never exceeds the full sample, n1(n)nn_1(n) \le n, the nuisance fold grows without bound, and the estimation fold also grows without bound, nn1(n)n - n_1(n) \to \infty.

Definition (Lean source)
_S :
IIDSample Ω X μ P
n₁ :
ℕ → ℕ
bound :
∀ n, n₁ n ≤ n
grow :
cogrow :
Tendsto (fun n => n - n₁ n) atTop atTop
Causalean.Stat.OneShotSplit · Causalean/Stat/SampleSplit/OneShot.lean:37 · uses IIDSample
def foldA reviewed
Causalean.Stat.OneShotSplit

Nuisance-fold index set at horizon n: A(n) := {0, …, n₁(n)−1}.

Definition (Lean source)
def foldA (n : ℕ) : Finset ℕ := range (split.n₁ n)
def foldB reviewed
Causalean.Stat.OneShotSplit

Estimation-fold index set at horizon n: B(n) := {n₁(n), …, n−1}.

Definition (Lean source)
def foldB (n : ℕ) : Finset ℕ := (range n).filter (fun i => split.n₁ n ≤ i)
theorem folds_indep reviewed
Causalean.Stat.OneShotSplit

Independence of folds. For a fixed sample size n, the sample sub-tuple indexed by the nuisance fold A(n) is independent, under μ, of the sub-tuple indexed by the estimation fold B(n).

Formal statement
n :
IndepFun (fun ω (i : split.foldA n) => S.Z i ω) (fun ω (i : split.foldB n) => S.Z i ω) μ
Proof (Lean source)
theorem folds_indep (n : ℕ) : IndepFun (fun ω (i : split.foldA n) => S.Z i ω) (fun ω (i : split.foldB n) => S.Z i ω) μ := by exact S.indep.indepFun_finset (split.foldA n) (split.foldB n) (split.foldA_disjoint_foldB n) S.meas
3 supporting declarations (lemmas, instances)
  • foldB_card lemma — Cardinality of the estimation fold: |B(n)| = n - n₁(n).
    n :
    (split.foldB n).card = n - split.n₁ n
    Proof (Lean source)
    lemma foldB_card (n : ℕ) : (split.foldB n).card = n - split.n₁ n := by have hfoldB_eq : split.foldB n = Ico (split.n₁ n) n := by ext i simp [OneShotSplit.foldB, Finset.mem_Ico, and_comm] rw [hfoldB_eq] exact Nat.card_Ico (split.n₁ n) n
    Causalean.Stat.OneShotSplit.foldB_card · Causalean/Stat/SampleSplit/OneShot.lean:62
  • foldB_card_tendsto lemma — The estimation-fold cardinality grows to infinity.
    Tendsto (fun n => (split.foldB n).card) atTop atTop
    Proof (Lean source)
    lemma foldB_card_tendsto : Tendsto (fun n => (split.foldB n).card) atTop atTop := by simpa [split.foldB_card] using split.cogrow
    Causalean.Stat.OneShotSplit.foldB_card_tendsto · Causalean/Stat/SampleSplit/OneShot.lean:70
  • foldA_disjoint_foldB lemma — Fold-A and fold-B index sets are disjoint.
    n :
    Disjoint (split.foldA n) (split.foldB n)
    Proof (Lean source)
    lemma foldA_disjoint_foldB (n : ℕ) : Disjoint (split.foldA n) (split.foldB n) := by rw [foldA, foldB] refine Finset.disjoint_left.mpr ?_ intro i hiA hiB simp only [Finset.mem_range, mem_filter] at hiA hiB have hnot : ¬ split.n₁ n ≤ i := Nat.not_le_of_gt hiA exact hnot hiB.2
    Causalean.Stat.OneShotSplit.foldA_disjoint_foldB · Causalean/Stat/SampleSplit/OneShot.lean:75
KFold 3 core · 1 supporting This file defines \(K\)-fold sample-splitting schedules for an i.i.d. ★ folds_indep

K-Fold Sample Splits

This file defines KK-fold sample-splitting schedules for an i.i.d. sample, including disjointness, coverage, fold growth, and limiting fold proportions. It also proves that each evaluation fold is independent of its training complement, supporting cross-fitted estimation procedures.

structure KFoldSplit reviewed
Causalean.Stat

K-fold sample split. For an i.i.d. sample S, a schedule assigning each sample size n and fold index k a finite index set fold n k, forming a K-fold cross-fitting scheme in which distinct folds are pairwise disjoint at every sample size, the K folds together cover the full index set {0,,n1}\{0,\dots,n-1\}, every fold grows without bound as nn \to \infty, and each fold's share of the sample converges to 1/K1/K.

Definition (Lean source)
_S :
IIDSample Ω X μ P
K :
fold :
ℕ → Fin K → Finset
partition :
∀ n (k₁ k₂ : Fin K)
if
k₁ ≠ k₂
then
Disjoint (fold n k₁) (fold n k₂)
cover :
∀ n, (Finset.univ : Finset (Fin K)).biUnion (fold n) = range n
grow :
∀ k, Tendsto (fun n => (fold n k).card) atTop atTop
ratio :
∀ k, Tendsto (fun n => ((fold n k).card : ℝ) / n) atTop (𝓝 ((K : ℝ)⁻¹))
Causalean.Stat.KFoldSplit · Causalean/Stat/SampleSplit/KFold.lean:42 · uses IIDSample
def trainComplement reviewed
Causalean.Stat.KFoldSplit

The training complement of fold k at sample size n: {0, …, n-1} \ fold(n, k).

Definition (Lean source)
def trainComplement (n : ℕ) (k : Fin K) : Finset ℕ := (range n) \ split.fold n k
Causalean.Stat.KFoldSplit.trainComplement · Causalean/Stat/SampleSplit/KFold.lean:63 · uses IIDSample , KFoldSplit
theorem folds_indep reviewed
Causalean.Stat.KFoldSplit

Independence of evaluation fold and training complement. For a fixed sample size n and fold index k, the sample sub-tuple indexed by the evaluation fold is independent, under μ, of the sub-tuple indexed by the training complement.

Formal statement
n :
k :
Fin K
IndepFun (fun ω (i : split.fold n k) => S.Z i ω) (fun ω (i : split.trainComplement n k) => S.Z i ω) μ
Proof (Lean source)
theorem folds_indep (n : ℕ) (k : Fin K) : IndepFun (fun ω (i : split.fold n k) => S.Z i ω) (fun ω (i : split.trainComplement n k) => S.Z i ω) μ := by exact S.indep.indepFun_finset (split.fold n k) (split.trainComplement n k) (split.fold_disjoint_trainComplement n k) S.meas
1 supporting declaration (lemmas, instances)
  • fold_disjoint_trainComplement lemma — The evaluation fold is disjoint from its training complement.
    n :
    k :
    Fin K
    Disjoint (split.fold n k) (split.trainComplement n k)
    Proof (Lean source)
    lemma fold_disjoint_trainComplement (n : ℕ) (k : Fin K) : Disjoint (split.fold n k) (split.trainComplement n k) := by rw [trainComplement] refine Finset.disjoint_left.mpr ?_ intro i hi hi' exact (Finset.mem_sdiff.mp hi').2 hi
    Causalean.Stat.KFoldSplit.fold_disjoint_trainComplement · Causalean/Stat/SampleSplit/KFold.lean:68
Finite­Category­Pilot 6 core · 8 supporting 6 to review This module controls threshold selection from finite-category counts on an arbitrary finite block of iid pilot observations. ★ finiteCategoryPilot_bad_probability

Finite-category counts on arbitrary IID pilot blocks

This module controls threshold selection from finite-category counts on an arbitrary finite block of iid pilot observations. Its simultaneous good event ensures that selected categories have enough population mass while rejected categories have no more than a supplied upper mass band.

The file provides measurable counts, cellwise tilted Chernoff bounds, and a cardinality-explicit union bound. Empty coordinate blocks and empty category types remain totalized.

def categoryMass unreviewed
Causalean.Stat

A category's population mass is the probability that the observation's label equals that category, represented as a real number.

Definition (Lean source)
def categoryMass (P : Measure X) (label : X -> Iota) (k : Iota) : Real := P.real (label ⁻¹' {k})
def categoryIndicator unreviewed
Causalean.Stat

A category indicator is one when an observation has the designated label and zero otherwise.

Definition (Lean source)
def categoryIndicator [DecidableEq Iota] (label : X -> Iota) (k : Iota) (x : X) : Real := if label x = k then 1 else 0
def pilotCategoryCount unreviewed
Causalean.Stat

A pilot category count is the number of coordinates in a chosen finite block whose observed label equals the designated category.

Definition (Lean source)
def pilotCategoryCount (S : IIDSample Omega X mu P) [DecidableEq Iota] (label : X -> Iota) (block : Finset Nat) (k : Iota) (omega : Omega) : Nat := (block.filter (fun j => label (S.Z j omega) = k)).card
def pilotSelected unreviewed
Causalean.Stat

Pilot thresholding selects exactly the categories whose finite-block count is strictly larger than the threshold.

Definition (Lean source)
def pilotSelected [Fintype Iota] [DecidableEq Iota] (S : IIDSample Omega X mu P) (label : X -> Iota) (block : Finset Nat) (t : Real) (omega : Omega) : Finset Iota := Finset.univ.filter (fun k => t < (pilotCategoryCount S label block k omega : Real))
def finiteCategoryPilotGood unreviewed
Causalean.Stat

The finite-category pilot good event requires every selected category to have at least the lower population-mass band and every rejected category to have at most the upper band.

Definition (Lean source)
def finiteCategoryPilotGood [Fintype Iota] [DecidableEq Iota] (S : IIDSample Omega X mu P) (label : X -> Iota) (block : Finset Nat) (t lowerBand upperBand : Real) : Set Omega := {omega | (∀ k ∈ pilotSelected S label block t omega, lowerBand ≤ categoryMass P label k) ∧ (∀ k ∉ pilotSelected S label block t omega, categoryMass P label k ≤ upperBand)}
Causalean.Stat.finiteCategoryPilotGood · Causalean/Stat/SampleSplit/FiniteCategoryPilot.lean:325 · uses IIDSample
theorem finiteCategoryPilot_bad_probability unreviewed
Causalean.Stat

Given an iid sample, a measurable category label, a finite pilot block, a positive selection threshold, a lower population-mass band, an upper population-mass band, an upper-tail exponential tilt, a lower-tail exponential tilt, nonnegativity of the upper-tail tilt, and nonpositivity of the lower-tail tilt, failure of the simultaneous category-mass sandwich has probability at most the number of categories times the sum of the two explicit Chernoff tails. The bound also covers empty blocks and empty category types.

Formal statement
Fintype Iota
S :
IIDSample Omega X mu P
label :
X -> Iota
hlabel :
block :
t :
ht :
0 < t
lowerBand upperBand sUpper sLower :
hsUpper :
0 ≤ sUpper
hsLower :
sLower ≤ 0
mu.real (finiteCategoryPilotGood S label block t lowerBand upperBand)ᶜ
≤ (Fintype.card Iota : Real) * (exp (-sUpper * t + (block.card : Real) * (lowerBand * (exp sUpper - 1))) + exp (-sLower * t + (block.card : Real) * (upperBand * (exp sLower - 1))))
Proof (Lean source)
theorem finiteCategoryPilot_bad_probability [Fintype Iota] [DecidableEq Iota] [MeasurableSingletonClass Iota] (S : IIDSample Omega X mu P) {label : X -> Iota} (hlabel : Measurable label) (block : Finset Nat) {t : Real} (ht : 0 < t) (lowerBand upperBand sUpper sLower : Real) (hsUpper : 0 ≤ sUpper) (hsLower : sLower ≤ 0) : mu.real (finiteCategoryPilotGood S label block t lowerBand upperBand)ᶜ ≤ (Fintype.card Iota : Real) * (exp (-sUpper * t + (block.card : Real) * (lowerBand * (exp sUpper - 1))) + exp (-sLower * t + (block.card : Real) * (upperBand * (exp sLower - 1)))) := by /- Negate the two universal clauses defining the good event. The bad set is contained in a union over categories of (selected and mass below the lower band) and (rejected and mass above the upper band). For each fixed category, split on the deterministic mass comparison and use the corresponding cellwise tail; then apply the two finite union bounds. -/ classical haveI : IsProbabilityMeasure mu := S.indep.isProbabilityMeasure let A : Iota -> Set Omega := fun k => {omega | t < (pilotCategoryCount S label block k omega : Real) ∧ ¬ lowerBand ≤ categoryMass P label k} let B : Iota -> Set Omega := fun k => {omega | (pilotCategoryCount S label block k omega : Real) ≤ t ∧ ¬ categoryMass P label k ≤ upperBand} have hbad : (finiteCategoryPilotGood S label block t lowerBand upperBand)ᶜ = (⋃ k, A k) ∪ ⋃ k, B k := by ext omega simp [finiteCategoryPilotGood, pilotSelected, A, B] constructor · intro h by_cases hall : ∀ k, t < (pilotCategoryCount S label block k omega : Real) -> lowerBand ≤ categoryMass P label k · exact inr (h hall) · left push_neg at hall exact hall · rintro (hA | hB) hall · obtain ⟨k, hkCount, hkMass⟩ := hA exact elim ((not_lt_of_ge (hall k hkCount)) hkMass) · exact hB let upperTail := exp (-sUpper * t + (block.card : Real) * (lowerBand * (exp sUpper - 1))) let lowerTail := exp (-sLower * t + (block.card : Real) * (upperBand * (exp sLower - 1))) have hA : ∀ k, mu.real (A k) ≤ upperTail := by intro k by_cases hk : lowerBand ≤ categoryMass P label k · have hempty : A k = ∅ := by ext omega simp [A, hk] rw [hempty] simp [upperTail, (Real.exp_pos _).le] · refine (measureReal_mono (fun omega homega => homega.1)).trans ?_ exact pilotCategoryCount_upper_tail_of_tilt S hlabel block k (le_of_lt (lt_of_not_ge hk)) sUpper hsUpper have hB : ∀ k, mu.real (B k) ≤ lowerTail := by intro k by_cases hk : categoryMass P label k ≤ upperBand · have hempty : B k = ∅ := by ext omega simp [B, hk] rw [hempty] simp [lowerTail, (Real.exp_pos _).le] · refine (measureReal_mono (fun omega homega => homega.1)).trans ?_ exact pilotCategoryCount_lower_tail_of_tilt S hlabel block k (le_of_lt (lt_of_not_ge hk)) sLower hsLower rw [hbad] calc mu.real ((⋃ k, A k) ∪ ⋃ k, B k) ≤ mu.real (⋃ k, A k) + mu.real (⋃ k, B k) := measureReal_union_le _ _ _ ≤ (∑ k, mu.real (A k)) + ∑ k, mu.real (B k) := add_le_add (measureReal_iUnion_fintype_le A) (measureReal_iUnion_fintype_le B) _ ≤ (∑ _k : Iota, upperTail) + ∑ _k : Iota, lowerTail := by gcongr with k · exact hA k · exact hB k _ = (Fintype.card Iota : Real) * (upperTail + lowerTail) := by simp [Finset.sum_const, nsmul_eq_mul] ring _ = (Fintype.card Iota : Real) * (exp (-sUpper * t + (block.card : Real) * (lowerBand * (exp sUpper - 1))) + exp (-sLower * t + (block.card : Real) * (upperBand * (exp sLower - 1)))) := by rfl
Causalean.Stat.finiteCategoryPilot_bad_probability · Causalean/Stat/SampleSplit/FiniteCategoryPilot.lean:371 · uses IIDSample , finiteCategoryPilotGood
8 supporting declarations (lemmas, instances)
  • measurable_categoryIndicator lemma — Given a measurable category label and a fixed category, the corresponding zero-one category indicator is measurable.
    label :
    X -> Iota
    hlabel :
    k :
    Iota
    Proof (Lean source)
    lemma measurable_categoryIndicator [DecidableEq Iota] [MeasurableSingletonClass Iota] {label : X -> Iota} (hlabel : Measurable label) (k : Iota) : Measurable (categoryIndicator label k) := by unfold categoryIndicator exact measurable_const.ite (hlabel (measurableSet_singleton k)) measurable_const
    Causalean.Stat.measurable_categoryIndicator · Causalean/Stat/SampleSplit/FiniteCategoryPilot.lean:44
  • integral_categoryIndicator lemma — Given a measurable category label and a fixed category, the mean of its zero-one indicator under a probability law equals the category's population mass.
    label :
    X -> Iota
    hlabel :
    k :
    Iota
    ∫ x, categoryIndicator label k x ∂P = categoryMass P label k
    Proof (Lean source)
    lemma integral_categoryIndicator [DecidableEq Iota] [MeasurableSingletonClass Iota] [IsProbabilityMeasure P] {label : X -> Iota} (hlabel : Measurable label) (k : Iota) : ∫ x, categoryIndicator label k x ∂P = categoryMass P label k := by rw [show categoryIndicator label k = (label ⁻¹' {k}).indicator (fun _ => (1 : Real)) by funext x by_cases hx : label x = k <;> simp [categoryIndicator, hx]] rw [integral_indicator (hlabel (measurableSet_singleton k)), integral_const] simp [categoryMass]
    Causalean.Stat.integral_categoryIndicator · Causalean/Stat/SampleSplit/FiniteCategoryPilot.lean:53
  • measurable_pilotCategoryCount lemma — Given an iid sample, a measurable category label, a finite coordinate block, and a fixed category, the pilot count of that category is measurable.
    S :
    IIDSample Omega X mu P
    label :
    X -> Iota
    hlabel :
    block :
    k :
    Iota
    Measurable (pilotCategoryCount S label block k)
    Proof (Lean source)
    lemma measurable_pilotCategoryCount [DecidableEq Iota] [MeasurableSingletonClass Iota] (S : IIDSample Omega X mu P) {label : X -> Iota} (hlabel : Measurable label) (block : Finset Nat) (k : Iota) : Measurable (pilotCategoryCount S label block k) := by induction block using Finset.induction_on with | empty => unfold pilotCategoryCount exact measurable_const | @insert j block hj ih => have hset : MeasurableSet {omega | label (S.Z j omega) = k} := (hlabel.comp (S.meas j)) (measurableSet_singleton k) unfold pilotCategoryCount at ih have hsucc : Measurable (fun omega => (block.filter (fun i => label (S.Z i omega) = k)).card + 1) := ih.add measurable_const unfold pilotCategoryCount have heq : (fun omega => ((insert j block).filter (fun i => label (S.Z i omega) = k)).card) = fun omega => if label (S.Z j omega) = k then (block.filter (fun i => label (S.Z i omega) = k)).card + 1 else (block.filter (fun i => label (S.Z i omega) = k)).card := by funext omega by_cases h : label (S.Z j omega) = k · rw [Finset.filter_insert] simp [h, Finset.card_insert_of_notMem, hj] · rw [Finset.filter_insert] simp [h] rw [heq] exact hsucc.ite hset ih
    Causalean.Stat.measurable_pilotCategoryCount · Causalean/Stat/SampleSplit/FiniteCategoryPilot.lean:73
  • pilotCategoryCount_cast_eq_sum lemma — Given an iid sample, a category label, a finite coordinate block, a category, and a sample outcome, the real-valued pilot count equals the sum of category indicators over the block.
    S :
    IIDSample Omega X mu P
    label :
    X -> Iota
    block :
    k :
    Iota
    omega :
    Omega
    (pilotCategoryCount S label block k omega : Real)
    = ∑ j ∈ block, categoryIndicator label k (S.Z j omega)
    Proof (Lean source)
    lemma pilotCategoryCount_cast_eq_sum [DecidableEq Iota] (S : IIDSample Omega X mu P) (label : X -> Iota) (block : Finset Nat) (k : Iota) (omega : Omega) : (pilotCategoryCount S label block k omega : Real) = ∑ j ∈ block, categoryIndicator label k (S.Z j omega) := by simp only [pilotCategoryCount, categoryIndicator, Finset.card_filter, Nat.cast_sum, Nat.cast_ite, cast_one, cast_zero]
    Causalean.Stat.pilotCategoryCount_cast_eq_sum · Causalean/Stat/SampleSplit/FiniteCategoryPilot.lean:107
  • pilotCategoryCount_upper_tail_of_tilt theorem — Given an iid sample, a measurable category label, a finite pilot block, a fixed category, an upper bound on that category's population mass, an exponential tilt, and nonnegativity of the tilt, the probability that the category count exceeds the specified level is bounded by the corresponding Chernoff exponent.
    S :
    IIDSample Omega X mu P
    label :
    X -> Iota
    hlabel :
    block :
    k :
    Iota
    p a :
    hmass :
    categoryMass P label k ≤ p
    s :
    hs :
    0 ≤ s
    mu.real {omega | a < (pilotCategoryCount S label block k omega : Real)}
    exp (-s * a + (block.card : Real) * (p * (exp s - 1)))
    Proof (Lean source)
    theorem pilotCategoryCount_upper_tail_of_tilt [DecidableEq Iota] [MeasurableSingletonClass Iota] (S : IIDSample Omega X mu P) {label : X -> Iota} (hlabel : Measurable label) (block : Finset Nat) (k : Iota) {p a : Real} (hmass : categoryMass P label k ≤ p) (s : Real) (hs : 0 ≤ s) : mu.real {omega | a < (pilotCategoryCount S label block k omega : Real)} ≤ exp (-s * a + (block.card : Real) * (p * (exp s - 1))) := by /- Repeat the bounded-count MGF proof from `BinomialCount` over `block` instead of `range m`: the composed indicators are independent by `S.indep.comp`, each has mean `categoryMass`, and `iIndepFun.mgf_sum` tensorizes the MGF. Finish with `measure_ge_le_exp_mul_mgf`. -/ haveI : IsProbabilityMeasure mu := S.indep.isProbabilityMeasure haveI : IsProbabilityMeasure P := by rw [← S.map_eq 0] exact Measure.isProbabilityMeasure_map (S.meas 0).aemeasurable let Xk : Nat -> Omega -> Real := fun j => categoryIndicator label k ∘ S.Z j have hindicator : Measurable (categoryIndicator label k) := measurable_categoryIndicator hlabel k have hXk_meas : ∀ j, Measurable (Xk j) := fun j => hindicator.comp (S.meas j) have hXk_indep : iIndepFun Xk mu := S.indep.comp (fun _ => categoryIndicator label k) (fun _ => hindicator) have h01 : ∀ x, categoryIndicator label k x ∈ Icc (0 : Real) 1 := by intro x by_cases hx : label x = k <;> simp [categoryIndicator, hx] have hmgf_one : ∀ j, mgf (Xk j) mu s ≤ exp (categoryMass P label k * (exp s - 1)) := by intro j rw [← mgf_map (S.meas j).aemeasurable (by fun_prop), S.map_eq] rw [← integral_categoryIndicator hlabel k] exact mgf_le_of_mem_Icc_zero_one hindicator.aemeasurable (ae_of_all _ h01) s have hsum : (fun omega => (pilotCategoryCount S label block k omega : Real)) = ∑ j ∈ block, Xk j := by funext omega simpa [Xk, Function.comp_apply] using pilotCategoryCount_cast_eq_sum S label block k omega have hmgf_base : mgf (fun omega => (pilotCategoryCount S label block k omega : Real)) mu s ≤ exp ((block.card : Real) * (categoryMass P label k * (exp s - 1))) := by rw [hsum, hXk_indep.mgf_sum hXk_meas] calc (∏ j ∈ block, mgf (Xk j) mu s) ≤ ∏ _j ∈ block, exp (categoryMass P label k * (exp s - 1)) := Finset.prod_le_prod (fun j _ => mgf_nonneg) (fun j _ => hmgf_one j) _ = exp ((block.card : Real) * (categoryMass P label k * (exp s - 1))) := by rw [Finset.prod_const, ← Real.exp_nat_mul] have hcoef : 0 ≤ exp s - 1 := by linarith [Real.one_le_exp hs] have hmgf : mgf (fun omega => (pilotCategoryCount S label block k omega : Real)) mu s ≤ exp ((block.card : Real) * (p * (exp s - 1))) := hmgf_base.trans (Real.exp_le_exp.mpr (mul_le_mul_of_nonneg_left (mul_le_mul_of_nonneg_right hmass hcoef) (Nat.cast_nonneg block.card))) have hcount_meas : Measurable (fun omega => (pilotCategoryCount S label block k omega : Real)) := by rw [hsum] convert (Finset.measurable_fun_sum block fun j _ => hXk_meas j) using 1 ext omega simp have hcount_le : ∀ omega, (pilotCategoryCount S label block k omega : Real) ≤ (block.card : Real) := by intro omega exact_mod_cast Finset.card_filter_le block (fun j => label (S.Z j omega) = k) have hint : Integrable (fun omega => exp (s * (pilotCategoryCount S label block k omega : Real))) mu := by refine Integrable.of_bound (hcount_meas.const_mul _ |>.exp.aestronglyMeasurable) (exp (s * block.card)) (ae_of_all _ fun omega => ?_) rw [Real.norm_eq_abs, abs_of_pos (Real.exp_pos _)] exact Real.exp_le_exp.mpr (mul_le_mul_of_nonneg_left (hcount_le omega) hs) calc mu.real {omega | a < (pilotCategoryCount S label block k omega : Real)} ≤ mu.real {omega | a ≤ (pilotCategoryCount S label block k omega : Real)} := measureReal_mono (by intro omega homega change a < (pilotCategoryCount S label block k omega : Real) at homega exact homega.le) _ ≤ exp (-s * a) * mgf (fun omega => (pilotCategoryCount S label block k omega : Real)) mu s := measure_ge_le_exp_mul_mgf a hs hint _ ≤ exp (-s * a) * exp ((block.card : Real) * (p * (exp s - 1))) := mul_le_mul_of_nonneg_left hmgf (Real.exp_pos _).le _ = exp (-s * a + (block.card : Real) * (p * (exp s - 1))) := (Real.exp_add _ _).symm
    Causalean.Stat.pilotCategoryCount_upper_tail_of_tilt · Causalean/Stat/SampleSplit/FiniteCategoryPilot.lean:119
  • pilotCategoryCount_lower_tail_of_tilt theorem — Given an iid sample, a measurable category label, a finite pilot block, a fixed category, a lower bound on that category's population mass, an exponential tilt, and nonpositivity of the tilt, the probability that the category count is at most the specified level is bounded by the corresponding Chernoff exponent.
    S :
    IIDSample Omega X mu P
    label :
    X -> Iota
    hlabel :
    block :
    k :
    Iota
    p a :
    hmass :
    p ≤ categoryMass P label k
    s :
    hs :
    s ≤ 0
    mu.real {omega | (pilotCategoryCount S label block k omega : Real) ≤ a}
    exp (-s * a + (block.card : Real) * (p * (exp s - 1)))
    Proof (Lean source)
    theorem pilotCategoryCount_lower_tail_of_tilt [DecidableEq Iota] [MeasurableSingletonClass Iota] (S : IIDSample Omega X mu P) {label : X -> Iota} (hlabel : Measurable label) (block : Finset Nat) (k : Iota) {p a : Real} (hmass : p ≤ categoryMass P label k) (s : Real) (hs : s ≤ 0) : mu.real {omega | (pilotCategoryCount S label block k omega : Real) ≤ a} ≤ exp (-s * a + (block.card : Real) * (p * (exp s - 1))) := by /- Use the same finite-block MGF tensorization at a nonpositive tilt. Since `exp s - 1 ≤ 0`, replace the true category mass by its lower bound `p`, then apply `measure_le_le_exp_mul_mgf`. -/ haveI : IsProbabilityMeasure mu := S.indep.isProbabilityMeasure haveI : IsProbabilityMeasure P := by rw [← S.map_eq 0] exact Measure.isProbabilityMeasure_map (S.meas 0).aemeasurable let Xk : Nat -> Omega -> Real := fun j => categoryIndicator label k ∘ S.Z j have hindicator : Measurable (categoryIndicator label k) := measurable_categoryIndicator hlabel k have hXk_meas : ∀ j, Measurable (Xk j) := fun j => hindicator.comp (S.meas j) have hXk_indep : iIndepFun Xk mu := S.indep.comp (fun _ => categoryIndicator label k) (fun _ => hindicator) have h01 : ∀ x, categoryIndicator label k x ∈ Icc (0 : Real) 1 := by intro x by_cases hx : label x = k <;> simp [categoryIndicator, hx] have hmgf_one : ∀ j, mgf (Xk j) mu s ≤ exp (categoryMass P label k * (exp s - 1)) := by intro j rw [← mgf_map (S.meas j).aemeasurable (by fun_prop), S.map_eq] rw [← integral_categoryIndicator hlabel k] exact mgf_le_of_mem_Icc_zero_one hindicator.aemeasurable (ae_of_all _ h01) s have hsum : (fun omega => (pilotCategoryCount S label block k omega : Real)) = ∑ j ∈ block, Xk j := by funext omega simpa [Xk, Function.comp_apply] using pilotCategoryCount_cast_eq_sum S label block k omega have hmgf_base : mgf (fun omega => (pilotCategoryCount S label block k omega : Real)) mu s ≤ exp ((block.card : Real) * (categoryMass P label k * (exp s - 1))) := by rw [hsum, hXk_indep.mgf_sum hXk_meas] calc (∏ j ∈ block, mgf (Xk j) mu s) ≤ ∏ _j ∈ block, exp (categoryMass P label k * (exp s - 1)) := Finset.prod_le_prod (fun j _ => mgf_nonneg) (fun j _ => hmgf_one j) _ = exp ((block.card : Real) * (categoryMass P label k * (exp s - 1))) := by rw [Finset.prod_const, ← Real.exp_nat_mul] have hcoef : exp s - 1 ≤ 0 := by linarith [Real.exp_le_one_iff.mpr hs] have hmgf : mgf (fun omega => (pilotCategoryCount S label block k omega : Real)) mu s ≤ exp ((block.card : Real) * (p * (exp s - 1))) := hmgf_base.trans (Real.exp_le_exp.mpr (mul_le_mul_of_nonneg_left (mul_le_mul_of_nonpos_right hmass hcoef) (Nat.cast_nonneg block.card))) have hcount_meas : Measurable (fun omega => (pilotCategoryCount S label block k omega : Real)) := by rw [hsum] convert (Finset.measurable_fun_sum block fun j _ => hXk_meas j) using 1 ext omega simp have hcount_nonneg : ∀ omega, 0 ≤ (pilotCategoryCount S label block k omega : Real) := fun _ => Nat.cast_nonneg _ have hint : Integrable (fun omega => exp (s * (pilotCategoryCount S label block k omega : Real))) mu := by refine Integrable.of_bound (hcount_meas.const_mul _ |>.exp.aestronglyMeasurable) 1 (ae_of_all _ fun omega => ?_) rw [Real.norm_eq_abs, abs_of_pos (Real.exp_pos _)] calc exp (s * (pilotCategoryCount S label block k omega : Real)) ≤ exp 0 := Real.exp_le_exp.mpr (mul_nonpos_of_nonpos_of_nonneg hs (hcount_nonneg omega)) _ = 1 := Real.exp_zero calc mu.real {omega | (pilotCategoryCount S label block k omega : Real) ≤ a} ≤ exp (-s * a) * mgf (fun omega => (pilotCategoryCount S label block k omega : Real)) mu s := measure_le_le_exp_mul_mgf a hs hint _ ≤ exp (-s * a) * exp ((block.card : Real) * (p * (exp s - 1))) := mul_le_mul_of_nonneg_left hmgf (Real.exp_pos _).le _ = exp (-s * a + (block.card : Real) * (p * (exp s - 1))) := (Real.exp_add _ _).symm
    Causalean.Stat.pilotCategoryCount_lower_tail_of_tilt · Causalean/Stat/SampleSplit/FiniteCategoryPilot.lean:221
  • measurableSet_finiteCategoryPilotGood lemma — Given an iid sample, a measurable category label, a finite pilot block, a selection threshold, a lower mass band, and an upper mass band, the simultaneous finite-category pilot good event is measurable.
    Fintype Iota
    S :
    IIDSample Omega X mu P
    label :
    X -> Iota
    hlabel :
    block :
    t lowerBand upperBand :
    MeasurableSet (finiteCategoryPilotGood S label block t lowerBand upperBand)
    Proof (Lean source)
    lemma measurableSet_finiteCategoryPilotGood [Fintype Iota] [DecidableEq Iota] [MeasurableSingletonClass Iota] (S : IIDSample Omega X mu P) {label : X -> Iota} (hlabel : Measurable label) (block : Finset Nat) (t lowerBand upperBand : Real) : MeasurableSet (finiteCategoryPilotGood S label block t lowerBand upperBand) := by classical have hcount : ∀ k, Measurable (fun omega => (pilotCategoryCount S label block k omega : Real)) := fun k => MeasurableEmbedding.natCast.measurable.comp (measurable_pilotCategoryCount S hlabel block k) rw [show finiteCategoryPilotGood S label block t lowerBand upperBand = (⋂ k, {omega | t < (pilotCategoryCount S label block k omega : Real) -> lowerBand ≤ categoryMass P label k}) ∩ (⋂ k, {omega | (pilotCategoryCount S label block k omega : Real) ≤ t -> categoryMass P label k ≤ upperBand}) by ext omega simp [finiteCategoryPilotGood, pilotSelected]] apply MeasurableSet.inter · apply MeasurableSet.iInter intro k by_cases hk : lowerBand ≤ categoryMass P label k · simpa [hk] using (MeasurableSet.univ : MeasurableSet (Set.univ : Set Omega)) · simpa [hk, not_lt] using measurableSet_le (hcount k) measurable_const · apply MeasurableSet.iInter intro k by_cases hk : categoryMass P label k ≤ upperBand · simpa [hk] using (MeasurableSet.univ : MeasurableSet (Set.univ : Set Omega)) · simpa [hk, not_le] using measurableSet_lt measurable_const (hcount k)
    Causalean.Stat.measurableSet_finiteCategoryPilotGood · Causalean/Stat/SampleSplit/FiniteCategoryPilot.lean:337
  • finiteCategoryPilot_bad_probability_log_two theorem — Given an iid sample, a measurable category label, a finite pilot block, a positive selection threshold, a lower population-mass band, and an upper population-mass band, the simultaneous category-mass sandwich failure probability obeys the explicit bound obtained from opposite logarithmic tilts of magnitude log two.
    Fintype Iota
    S :
    IIDSample Omega X mu P
    label :
    X -> Iota
    hlabel :
    block :
    t :
    ht :
    0 < t
    lowerBand upperBand :
    mu.real (finiteCategoryPilotGood S label block t lowerBand upperBand)ᶜ
    ≤ (Fintype.card Iota : Real) * (exp (-log 2 * t + (block.card : Real) * lowerBand) + exp (log 2 * t - (block.card : Real) * upperBand / 2))
    Proof (Lean source)
    theorem finiteCategoryPilot_bad_probability_log_two [Fintype Iota] [DecidableEq Iota] [MeasurableSingletonClass Iota] (S : IIDSample Omega X mu P) {label : X -> Iota} (hlabel : Measurable label) (block : Finset Nat) {t : Real} (ht : 0 < t) (lowerBand upperBand : Real) : mu.real (finiteCategoryPilotGood S label block t lowerBand upperBand)ᶜ ≤ (Fintype.card Iota : Real) * (exp (-log 2 * t + (block.card : Real) * lowerBand) + exp (log 2 * t - (block.card : Real) * upperBand / 2)) := by have hlog : 0 ≤ log (2 : Real) := (Real.log_pos (by norm_num)).le have h := finiteCategoryPilot_bad_probability S hlabel block ht lowerBand upperBand (log 2) (-log 2) hlog (neg_nonpos.mpr hlog) have hexp_pos : exp (log 2) = (2 : Real) := Real.exp_log (by norm_num) have hexp_neg : exp (-log 2) = (1 / 2 : Real) := by rw [Real.exp_neg, hexp_pos] norm_num convert h using 1 <;> rw [hexp_pos, hexp_neg] <;> ring
    Causalean.Stat.finiteCategoryPilot_bad_probability_log_two · Causalean/Stat/SampleSplit/FiniteCategoryPilot.lean:470
Finite­Selector 2 core · 8 supporting 2 to review This module transfers uniform squared-risk bounds through a finite branch chosen from an independent pilot sample. ★ integral_finiteSelector_sq_le

Finite pilot-selected L2 transfer

This module transfers uniform squared-risk bounds through a finite branch chosen from an independent pilot sample. It also bounds the full risk after a controlled bad pilot event and supplies the corresponding one-shot iid split bridge.

The construction expands the selected risk over measurable selector cells and uses independence to factor each cell probability from its fixed-branch tail risk. The statements are neutral about the meaning of the branches and sample coordinates.

def selectorCell unreviewed
Causalean.Stat

The selector cell for a branch is the part of a designated pilot event on which a finite-valued selection rule chooses that branch.

Definition (Lean source)
def selectorCell (select : Alpha -> Iota) (good : Set Alpha) (i : Iota) : Set Alpha := good ∩ select ⁻¹' {i}
theorem integral_finiteSelector_sq_le unreviewed
Causalean.Stat.IndepFun

If pilot and tail coordinates are independent, the pilot coordinate is measurable, the tail coordinate is measurable, the finite selection rule is measurable, the designated pilot event is measurable, the common risk bound is nonnegative, every branch selected on that event is eligible, eligible branches have integrable squared tail error, and their fixed-branch risks obey the common bound, the pilot-selected risk on the event obeys that same bound.

Formal statement
Fintype Iota
pilot :
Omega -> Alpha
tail :
Omega -> Beta
select :
Alpha -> Iota
err :
Iota -> Beta -> Real
Eligible :
Iota -> Prop
V :
hind :
IndepFun pilot tail mu
hpilot :
htail :
hselect :
Measurable select
good :
Set Alpha
hgood :
hV :
0 ≤ V
hEligible :
∀ a ∈ good, Eligible (select a)
hbranchInt :
∀ i, Eligible i -> Integrable (fun b => (err i b) ^ 2) (mu.map tail)
hbranch :
∀ i, Eligible i -> ∫ b, (err i b) ^ 2 ∂(mu.map tail) ≤ V
∫ omega in pilot ⁻¹' good, (err (select (pilot omega)) (tail omega)) ^ 2 ∂mu ≤ V
Proof (Lean source)
theorem IndepFun.integral_finiteSelector_sq_le [Fintype Iota] [MeasurableSingletonClass Iota] {mu : Measure Omega} [IsProbabilityMeasure mu] {pilot : Omega -> Alpha} {tail : Omega -> Beta} {select : Alpha -> Iota} {err : Iota -> Beta -> Real} {Eligible : Iota -> Prop} {V : Real} (hind : IndepFun pilot tail mu) (hpilot : Measurable pilot) (htail : Measurable tail) (hselect : Measurable select) {good : Set Alpha} (hgood : MeasurableSet good) (hV : 0 ≤ V) (hEligible : ∀ a ∈ good, Eligible (select a)) (hbranchInt : ∀ i, Eligible i -> Integrable (fun b => (err i b) ^ 2) (mu.map tail)) (hbranch : ∀ i, Eligible i -> ∫ b, (err i b) ^ 2 ∂(mu.map tail) ≤ V) : ∫ omega in pilot ⁻¹' good, (err (select (pilot omega)) (tail omega)) ^ 2 ∂mu ≤ V := by /- First obtain genuine integrability on the good event from `integrableOn_finiteSelector_sq_of_eligible`; there is no `integral_undef` case. Split into selector cells. Empty cells contribute zero. For every nonempty cell, eligibility supplies both fixed-branch integrability and the bound, so independence factors its integral. Sum the cell probabilities and use that the good-event probability is at most one. -/ classical let F : Omega → Real := fun omega => (err (select (pilot omega)) (tail omega)) ^ 2 let cell : Iota → Set Omega := fun i => pilot ⁻¹' selectorCell select good i have hcell : ∀ i, MeasurableSet (cell i) := fun i => hpilot (measurableSet_selectorCell hselect hgood i) have hpair : Pairwise (onFun Disjoint cell) := by intro i j hij simp only [onFun] rw [Set.disjoint_left] intro omega hi hj exact hij (hi.2.symm.trans hj.2) have hcover : (⋃ i, cell i) = pilot ⁻¹' good := by ext omega simp [cell, selectorCell] have hInt : IntegrableOn F (pilot ⁻¹' good) mu := integrableOn_finiteSelector_sq_of_eligible hpilot htail hselect hgood hEligible hbranchInt have hsplit : ∫ omega in pilot ⁻¹' good, F omega ∂mu = ∑ i : Iota, ∫ omega in cell i, F omega ∂mu := by rw [← hcover] exact integral_iUnion_fintype hcell hpair fun i => hInt.mono_set (by rw [← hcover]; exact Set.subset_iUnion cell i) have hfactor_bound : ∀ i : Iota, ∫ omega in cell i, F omega ∂mu ≤ (mu (cell i)).toReal * V := by intro i by_cases hi_empty : cell i = ∅ · simp [hi_empty] · obtain ⟨omega, homega⟩ := Set.nonempty_iff_ne_empty.mpr hi_empty have hi_eligible : Eligible i := by have hsel : select (pilot omega) = i := homega.2 exact hsel ▸ hEligible (pilot omega) homega.1 have hcongr : ∫ omega in cell i, F omega ∂mu = ∫ omega in cell i, (err i (tail omega)) ^ 2 ∂mu := by refine setIntegral_congr_fun (hcell i) ?_ intro omega homega simp only [F] rw [homega.2] rw [hcongr] have hdrop := hind.integral_restrict_preimage_eq_mul hpilot.aemeasurable htail.aemeasurable (measurableSet_selectorCell hselect hgood i) (hcell i) (hbranchInt i hi_eligible).aestronglyMeasurable rw [hdrop, ← integral_map htail.aemeasurable (hbranchInt i hi_eligible).aestronglyMeasurable] change (mu (cell i)).toReal * (∫ b, (err i b) ^ 2 ∂(mu.map tail)) ≤ (mu (cell i)).toReal * V exact mul_le_mul_of_nonneg_left (hbranch i hi_eligible) ENNReal.toReal_nonneg have hmass : ∑ i : Iota, (mu (cell i)).toReal = mu.real (pilot ⁻¹' good) := by rw [measureReal_def, ← hcover, measure_iUnion hpair hcell, tsum_fintype, ENNReal.toReal_sum] intro i _ exact measure_ne_top mu (cell i) rw [show (∫ omega in pilot ⁻¹' good, (err (select (pilot omega)) (tail omega)) ^ 2 ∂mu) = ∫ omega in pilot ⁻¹' good, F omega ∂mu from rfl, hsplit] calc ∑ i : Iota, ∫ omega in cell i, F omega ∂mu ≤ ∑ i : Iota, (mu (cell i)).toReal * V := Finset.sum_le_sum fun i _ => hfactor_bound i _ = (∑ i : Iota, (mu (cell i)).toReal) * V := by rw [Finset.sum_mul] _ = mu.real (pilot ⁻¹' good) * V := by rw [hmass] _ ≤ 1 * V := mul_le_mul_of_nonneg_right measureReal_le_one hV _ = V := one_mul V
Causalean.Stat.IndepFun.integral_finiteSelector_sq_le · Causalean/Stat/SampleSplit/FiniteSelector.lean:246
8 supporting declarations (lemmas, instances)
  • measurableSet_selectorCell lemma — When the selection rule is measurable, the designated pilot event is measurable, and a branch is fixed, its selector cell is measurable.
    select :
    Alpha -> Iota
    hselect :
    Measurable select
    good :
    Set Alpha
    hgood :
    i :
    Iota
    MeasurableSet (selectorCell select good i)
    Proof (Lean source)
    lemma measurableSet_selectorCell [MeasurableSingletonClass Iota] {select : Alpha -> Iota} (hselect : Measurable select) {good : Set Alpha} (hgood : MeasurableSet good) (i : Iota) : MeasurableSet (selectorCell select good i) := by exact hgood.inter (hselect (measurableSet_singleton i))
    Causalean.Stat.measurableSet_selectorCell · Causalean/Stat/SampleSplit/FiniteSelector.lean:40
  • measurable_finiteSelector_apply lemma — When finite branch selection is measurable and each branch-specific error is measurable, evaluating the selected error on a pilot-tail pair is measurable.
    Fintype Iota
    select :
    Alpha -> Iota
    hselect :
    Measurable select
    err :
    Iota -> Beta -> Real
    herr :
    ∀ i, Measurable (err i)
    Measurable (fun z : Alpha × Beta => err (select z.1) z.2)
    Proof (Lean source)
    lemma measurable_finiteSelector_apply [Fintype Iota] [MeasurableSingletonClass Iota] {select : Alpha -> Iota} (hselect : Measurable select) {err : Iota -> Beta -> Real} (herr : ∀ i, Measurable (err i)) : Measurable (fun z : Alpha × Beta => err (select z.1) z.2) := by classical let cell : Iota → Set (Alpha × Beta) := fun i => (fun z : Alpha × Beta => select z.1) ⁻¹' {i} have hcell : ∀ i, MeasurableSet (cell i) := fun i => (hselect.comp measurable_fst) (measurableSet_singleton i) have hsum : Measurable (fun z : Alpha × Beta => ∑ i : Iota, (cell i).indicator (fun z => err i z.2) z) := by exact measurable_sum univ fun i _ => ((herr i).comp measurable_snd).indicator (hcell i) convert hsum using 1 funext z simp only [cell, indicator, Set.mem_preimage, Set.mem_singleton_iff] simp
    Causalean.Stat.measurable_finiteSelector_apply · Causalean/Stat/SampleSplit/FiniteSelector.lean:49
  • measurable_finiteSelector_sq lemma — If the pilot coordinate is measurable, the tail coordinate is measurable, the finite selection rule is measurable, and every branch error is measurable, the selected squared error is measurable.
    Fintype Iota
    pilot :
    Omega -> Alpha
    tail :
    Omega -> Beta
    select :
    Alpha -> Iota
    err :
    Iota -> Beta -> Real
    hpilot :
    htail :
    hselect :
    Measurable select
    herr :
    ∀ i, Measurable (err i)
    Measurable (fun omega => (err (select (pilot omega)) (tail omega)) ^ 2)
    Proof (Lean source)
    lemma measurable_finiteSelector_sq [Fintype Iota] [MeasurableSingletonClass Iota] {pilot : Omega -> Alpha} {tail : Omega -> Beta} {select : Alpha -> Iota} {err : Iota -> Beta -> Real} (hpilot : Measurable pilot) (htail : Measurable tail) (hselect : Measurable select) (herr : ∀ i, Measurable (err i)) : Measurable (fun omega => (err (select (pilot omega)) (tail omega)) ^ 2) := by exact ((measurable_finiteSelector_apply hselect herr).comp (hpilot.prodMk htail)).pow_const 2
    Causalean.Stat.measurable_finiteSelector_sq · Causalean/Stat/SampleSplit/FiniteSelector.lean:70
  • integrable_finiteSelector_sq theorem — If pilot and tail coordinates are independent, the pilot coordinate is measurable, the tail coordinate is measurable, the finite selection rule is measurable, and every fixed branch has integrable squared error under the tail law, the pilot-selected squared error is integrable under the ambient probability law.
    Fintype Iota
    pilot :
    Omega -> Alpha
    tail :
    Omega -> Beta
    select :
    Alpha -> Iota
    err :
    Iota -> Beta -> Real
    hind :
    IndepFun pilot tail mu
    hpilot :
    htail :
    hselect :
    Measurable select
    herr :
    ∀ i, Integrable (fun b => (err i b) ^ 2) (mu.map tail)
    Integrable (fun omega => (err (select (pilot omega)) (tail omega)) ^ 2) mu
    Proof (Lean source)
    theorem IndepFun.integrable_finiteSelector_sq [Fintype Iota] [MeasurableSingletonClass Iota] {mu : Measure Omega} [IsProbabilityMeasure mu] {pilot : Omega -> Alpha} {tail : Omega -> Beta} {select : Alpha -> Iota} {err : Iota -> Beta -> Real} (hind : IndepFun pilot tail mu) (hpilot : Measurable pilot) (htail : Measurable tail) (hselect : Measurable select) (herr : ∀ i, Integrable (fun b => (err i b) ^ 2) (mu.map tail)) : Integrable (fun omega => (err (select (pilot omega)) (tail omega)) ^ 2) mu := by /- Expand over the measurable selector fibers. On each fiber, independence transports the branch integrability from `mu.map tail`; combine the finitely many restricted integrable functions. -/ classical let cell : Iota → Set Omega := fun i => pilot ⁻¹' (select ⁻¹' {i}) have hcell : ∀ i, MeasurableSet (cell i) := fun i => hpilot ((hselect (measurableSet_singleton i))) have hcover : (⋃ i, cell i) = univ := by ext omega simp [cell] rw [← integrableOn_univ, ← hcover, integrableOn_finite_iUnion] intro i have hi : Integrable (fun omega => (err i (tail omega)) ^ 2) mu := (herr i).comp_aemeasurable htail.aemeasurable refine hi.integrableOn.congr_fun ?_ (hcell i) intro omega homega have hsel : select (pilot omega) = i := homega simp [hsel]
    Causalean.Stat.IndepFun.integrable_finiteSelector_sq · Causalean/Stat/SampleSplit/FiniteSelector.lean:83
  • integral_finiteSelector_sq_eq_sum theorem — If pilot and tail coordinates are independent, the pilot coordinate is measurable, the tail coordinate is measurable, the finite selection rule is measurable, the designated pilot event is measurable, and every fixed branch has integrable squared error under the tail law, the selected risk on that event equals the sum of each selector-cell probability times its fixed-branch tail risk.
    Fintype Iota
    pilot :
    Omega -> Alpha
    tail :
    Omega -> Beta
    select :
    Alpha -> Iota
    err :
    Iota -> Beta -> Real
    hind :
    IndepFun pilot tail mu
    hpilot :
    htail :
    hselect :
    Measurable select
    good :
    Set Alpha
    hgood :
    herr :
    ∀ i, Integrable (fun b => (err i b) ^ 2) (mu.map tail)
    ∫ omega in pilot ⁻¹' good, (err (select (pilot omega)) (tail omega)) ^ 2 ∂mu
    = ∑ i : Iota, (mu (pilot ⁻¹' selectorCell select good i)).toReal * ∫ b, (err i b) ^ 2 ∂(mu.map tail)
    Proof (Lean source)
    theorem IndepFun.integral_finiteSelector_sq_eq_sum [Fintype Iota] [MeasurableSingletonClass Iota] {mu : Measure Omega} [IsProbabilityMeasure mu] {pilot : Omega -> Alpha} {tail : Omega -> Beta} {select : Alpha -> Iota} {err : Iota -> Beta -> Real} (hind : IndepFun pilot tail mu) (hpilot : Measurable pilot) (htail : Measurable tail) (hselect : Measurable select) {good : Set Alpha} (hgood : MeasurableSet good) (herr : ∀ i, Integrable (fun b => (err i b) ^ 2) (mu.map tail)) : ∫ omega in pilot ⁻¹' good, (err (select (pilot omega)) (tail omega)) ^ 2 ∂mu = ∑ i : Iota, (mu (pilot ⁻¹' selectorCell select good i)).toReal * ∫ b, (err i b) ^ 2 ∂(mu.map tail) := by /- Integrability is essential here: without it, Lean's Bochner integral is zero for a non-integrable function, so finite additivity across selector cells can fail when one cell is non-integrable and another contributes a positive finite integral. Partition `pilot ⁻¹' good` by the disjoint selector fibers. On the `i`th fiber replace the selected branch pointwise by `err i`, apply `IndepFun.integral_restrict_preimage_eq_mul`, then rewrite the tail-composed integral with `integral_map`. -/ classical let F : Omega → Real := fun omega => (err (select (pilot omega)) (tail omega)) ^ 2 let cell : Iota → Set Omega := fun i => pilot ⁻¹' selectorCell select good i have hcell : ∀ i, MeasurableSet (cell i) := fun i => hpilot (measurableSet_selectorCell hselect hgood i) have hpair : Pairwise (onFun Disjoint cell) := by intro i j hij simp only [onFun] rw [Set.disjoint_left] intro omega hi hj exact hij (hi.2.symm.trans hj.2) have hcover : (⋃ i, cell i) = pilot ⁻¹' good := by ext omega simp [cell, selectorCell] have hInt : IntegrableOn F (pilot ⁻¹' good) mu := (IndepFun.integrable_finiteSelector_sq hind hpilot htail hselect herr).integrableOn have hsplit : ∫ omega in pilot ⁻¹' good, F omega ∂mu = ∑ i : Iota, ∫ omega in cell i, F omega ∂mu := by rw [← hcover] exact integral_iUnion_fintype hcell hpair fun i => hInt.mono_set (by rw [← hcover]; exact Set.subset_iUnion cell i) have hfactor : ∀ i : Iota, ∫ omega in cell i, F omega ∂mu = (mu (cell i)).toReal * ∫ b, (err i b) ^ 2 ∂(mu.map tail) := by intro i have hcongr : ∫ omega in cell i, F omega ∂mu = ∫ omega in cell i, (err i (tail omega)) ^ 2 ∂mu := by refine setIntegral_congr_fun (hcell i) ?_ intro omega homega simp only [F] rw [homega.2] rw [hcongr] have hdrop := hind.integral_restrict_preimage_eq_mul hpilot.aemeasurable htail.aemeasurable (measurableSet_selectorCell hselect hgood i) (hcell i) (herr i).aestronglyMeasurable rw [hdrop, integral_map htail.aemeasurable (herr i).aestronglyMeasurable] rw [show (∫ omega in pilot ⁻¹' good, (err (select (pilot omega)) (tail omega)) ^ 2 ∂mu) = ∫ omega in pilot ⁻¹' good, F omega ∂mu from rfl, hsplit] apply Finset.sum_congr rfl intro i _ exact hfactor i
    Causalean.Stat.IndepFun.integral_finiteSelector_sq_eq_sum · Causalean/Stat/SampleSplit/FiniteSelector.lean:118
  • integrableOn_finiteSelector_sq_of_eligible theorem — If the pilot coordinate is measurable, the tail coordinate is measurable, the finite selection rule is measurable, the designated pilot event is measurable, every branch selected there is eligible, and eligible branches have integrable squared error under the tail law, the selected squared error is integrable on that pilot event.
    Fintype Iota
    mu :
    Measure Omega
    pilot :
    Omega -> Alpha
    tail :
    Omega -> Beta
    select :
    Alpha -> Iota
    err :
    Iota -> Beta -> Real
    Eligible :
    Iota -> Prop
    hpilot :
    htail :
    hselect :
    Measurable select
    good :
    Set Alpha
    hgood :
    hEligible :
    ∀ a ∈ good, Eligible (select a)
    hbranchInt :
    ∀ i, Eligible i -> Integrable (fun b => (err i b) ^ 2) (mu.map tail)
    IntegrableOn (fun omega => (err (select (pilot omega)) (tail omega)) ^ 2) (pilot ⁻¹' good) mu
    Proof (Lean source)
    theorem integrableOn_finiteSelector_sq_of_eligible [Fintype Iota] [MeasurableSingletonClass Iota] {mu : Measure Omega} {pilot : Omega -> Alpha} {tail : Omega -> Beta} {select : Alpha -> Iota} {err : Iota -> Beta -> Real} {Eligible : Iota -> Prop} (hpilot : Measurable pilot) (htail : Measurable tail) (hselect : Measurable select) {good : Set Alpha} (hgood : MeasurableSet good) (hEligible : ∀ a ∈ good, Eligible (select a)) (hbranchInt : ∀ i, Eligible i -> Integrable (fun b => (err i b) ^ 2) (mu.map tail)) : IntegrableOn (fun omega => (err (select (pilot omega)) (tail omega)) ^ 2) (pilot ⁻¹' good) mu := by /- Partition the good pullback into selector cells. An empty cell is integrable trivially. From a point in a nonempty ambient cell, its pilot value lies in the corresponding `selectorCell`; `hEligible` makes the branch eligible, and `hbranchInt` transported along `tail` gives ambient integrability. Replace the selected branch by that fixed branch on the cell and combine the finite union with `integrableOn_finite_iUnion`. -/ classical let cell : Iota → Set Omega := fun i => pilot ⁻¹' selectorCell select good i have hcell : ∀ i, MeasurableSet (cell i) := fun i => hpilot (measurableSet_selectorCell hselect hgood i) have hcover : (⋃ i, cell i) = pilot ⁻¹' good := by ext omega simp [cell, selectorCell] rw [← hcover, integrableOn_finite_iUnion] intro i by_cases hi_empty : cell i = ∅ · simp [hi_empty] · obtain ⟨omega, homega⟩ := Set.nonempty_iff_ne_empty.mpr hi_empty have hi_eligible : Eligible i := by have hsel : select (pilot omega) = i := homega.2 exact hsel ▸ hEligible (pilot omega) homega.1 have hi : Integrable (fun omega => (err i (tail omega)) ^ 2) mu := (hbranchInt i hi_eligible).comp_aemeasurable htail.aemeasurable refine hi.integrableOn.congr_fun ?_ (hcell i) intro omega homega change (err i (tail omega)) ^ 2 = (err (select (pilot omega)) (tail omega)) ^ 2 rw [homega.2]
    Causalean.Stat.integrableOn_finiteSelector_sq_of_eligible · Causalean/Stat/SampleSplit/FiniteSelector.lean:195
  • integral_finiteSelector_sq_le_add_bad theorem — If pilot and tail coordinates are independent, the pilot coordinate is measurable, the tail coordinate is measurable, the finite selection rule is measurable, all branch errors are measurable, the designated pilot event is measurable, the good-event risk bound is nonnegative, the global squared-error envelope is nonnegative, every branch selected on the good event is eligible, eligible branches have integrable squared tail error, their fixed-branch risks obey the good-event bound, the selected squared error obeys the global envelope, and the bad pilot event has probability at most the given tolerance, the full risk is at most the good-event bound plus the envelope times that tolerance.
    Fintype Iota
    pilot :
    Omega -> Alpha
    tail :
    Omega -> Beta
    select :
    Alpha -> Iota
    err :
    Iota -> Beta -> Real
    Eligible :
    Iota -> Prop
    V H delta :
    hind :
    IndepFun pilot tail mu
    hpilot :
    htail :
    hselect :
    Measurable select
    herr :
    ∀ i, Measurable (err i)
    good :
    Set Alpha
    hgood :
    hV :
    0 ≤ V
    hH :
    0 ≤ H
    hEligible :
    ∀ a ∈ good, Eligible (select a)
    hbranchInt :
    ∀ i, Eligible i -> Integrable (fun b => (err i b) ^ 2) (mu.map tail)
    hbranch :
    ∀ i, Eligible i -> ∫ b, (err i b) ^ 2 ∂(mu.map tail) ≤ V
    hbounded :
    ∀ omega, (err (select (pilot omega)) (tail omega)) ^ 2 ≤ H
    hbad :
    mu.real (pilot ⁻¹' goodᶜ) ≤ delta
    ∫ omega, (err (select (pilot omega)) (tail omega)) ^ 2 ∂mu ≤ V + H * delta
    Proof (Lean source)
    theorem IndepFun.integral_finiteSelector_sq_le_add_bad [Fintype Iota] [MeasurableSingletonClass Iota] {mu : Measure Omega} [IsProbabilityMeasure mu] {pilot : Omega -> Alpha} {tail : Omega -> Beta} {select : Alpha -> Iota} {err : Iota -> Beta -> Real} {Eligible : Iota -> Prop} {V H delta : Real} (hind : IndepFun pilot tail mu) (hpilot : Measurable pilot) (htail : Measurable tail) (hselect : Measurable select) (herr : ∀ i, Measurable (err i)) {good : Set Alpha} (hgood : MeasurableSet good) (hV : 0 ≤ V) (hH : 0 ≤ H) (hEligible : ∀ a ∈ good, Eligible (select a)) (hbranchInt : ∀ i, Eligible i -> Integrable (fun b => (err i b) ^ 2) (mu.map tail)) (hbranch : ∀ i, Eligible i -> ∫ b, (err i b) ^ 2 ∂(mu.map tail) ≤ V) (hbounded : ∀ omega, (err (select (pilot omega)) (tail omega)) ^ 2 ≤ H) (hbad : mu.real (pilot ⁻¹' goodᶜ) ≤ delta) : ∫ omega, (err (select (pilot omega)) (tail omega)) ^ 2 ∂mu ≤ V + H * delta := by /- The pointwise bound plus measurability makes the full square integrable. Split its integral over the good event and its complement. Apply the selector theorem on the good part and the constant bound `H` on the bad part, whose real probability is at most `delta`. -/ let F : Omega → Real := fun omega => (err (select (pilot omega)) (tail omega)) ^ 2 have hFmeas : Measurable F := by exact measurable_finiteSelector_sq hpilot htail hselect herr have hFint : Integrable F mu := by rw [← integrableOn_univ] apply mu.integrableOn_of_bounded (M := H) (by finiteness) hFmeas.aestronglyMeasurable filter_upwards with omega have hs : 0 ≤ F omega := by exact sq_nonneg _ rw [Real.norm_eq_abs, abs_of_nonneg hs] exact hbounded omega have hgood_pre : MeasurableSet (pilot ⁻¹' good) := hpilot hgood have hbad_pre : (pilot ⁻¹' good)ᶜ = pilot ⁻¹' goodᶜ := by ext omega simp have hgood_bound : ∫ omega in pilot ⁻¹' good, F omega ∂mu ≤ V := by exact IndepFun.integral_finiteSelector_sq_le hind hpilot htail hselect hgood hV hEligible hbranchInt hbranch have hbad_bound : ∫ omega in pilot ⁻¹' goodᶜ, F omega ∂mu ≤ H * delta := by calc ∫ omega in pilot ⁻¹' goodᶜ, F omega ∂mu ≤ ∫ _omega in pilot ⁻¹' goodᶜ, H ∂mu := by apply setIntegral_mono_on hFint.integrableOn integrableOn_const (hpilot hgood.compl) intro omega _ exact hbounded omega _ = H * mu.real (pilot ⁻¹' goodᶜ) := by simp [integral_const, mul_comm] _ ≤ H * delta := mul_le_mul_of_nonneg_left hbad hH have hsplit := integral_add_compl hgood_pre hFint rw [hbad_pre] at hsplit change ∫ omega, F omega ∂mu ≤ V + H * delta linarith
    Causalean.Stat.IndepFun.integral_finiteSelector_sq_le_add_bad · Causalean/Stat/SampleSplit/FiniteSelector.lean:348
  • integral_finiteSelector_sq_le theorem — Given an iid one-shot sample split, a sample horizon, a measurable finite branch selector on the pilot fold, a measurable good pilot event, a nonnegative common risk bound, eligibility of every branch selected on the good event, integrability of every eligible branch's squared error under the tail-fold law, and the common fixed-branch risk bound, the selected squared risk on the good event is at most that common bound.
    mu :
    Measure Omega
    P :
    Fintype Iota
    S :
    IIDSample Omega X mu P
    split :
    n :
    (split.foldA n -> X) -> Iota
    Iota -> (split.foldB n -> X) -> Real
    Eligible :
    Iota -> Prop
    V :
    hselect :
    Measurable select
    good :
    Set (split.foldA n -> X)
    hgood :
    hV :
    0 ≤ V
    hEligible :
    ∀ a ∈ good, Eligible (select a)
    hbranchInt :
    ∀ i,
    Eligible i -> Integrable (fun b => (err i b) ^ 2) (mu.map (fun omega => fun j : split.foldB n => S.Z j omega))
    hbranch :
    ∀ i,
    Eligible i -> ∫ b, (err i b) ^ 2 ∂(mu.map (fun omega => fun j : split.foldB n => S.Z j omega))
    ≤ V
    ∫ omega in (fun omega => fun j : split.foldA n => S.Z j omega) ⁻¹' good, (err (select (fun j : split.foldA n => S.Z j omega)) (fun j : split.foldB n => S.Z j omega)) ^ 2 ∂mu
    ≤ V
    Proof (Lean source)
    theorem OneShotSplit.integral_finiteSelector_sq_le {mu : Measure Omega} {P : Measure X} [Fintype Iota] [MeasurableSingletonClass Iota] {S : IIDSample Omega X mu P} (split : OneShotSplit S) (n : Nat) {select : (split.foldA n -> X) -> Iota} {err : Iota -> (split.foldB n -> X) -> Real} {Eligible : Iota -> Prop} {V : Real} (hselect : Measurable select) {good : Set (split.foldA n -> X)} (hgood : MeasurableSet good) (hV : 0 ≤ V) (hEligible : ∀ a ∈ good, Eligible (select a)) (hbranchInt : ∀ i, Eligible i -> Integrable (fun b => (err i b) ^ 2) (mu.map (fun omega => fun j : split.foldB n => S.Z j omega))) (hbranch : ∀ i, Eligible i -> ∫ b, (err i b) ^ 2 ∂(mu.map (fun omega => fun j : split.foldB n => S.Z j omega)) ≤ V) : ∫ omega in (fun omega => fun j : split.foldA n => S.Z j omega) ⁻¹' good, (err (select (fun j : split.foldA n => S.Z j omega)) (fun j : split.foldB n => S.Z j omega)) ^ 2 ∂mu ≤ V := by letI : IsProbabilityMeasure mu := S.indep.isProbabilityMeasure have hfoldA : Measurable (fun omega => fun j : split.foldA n => S.Z j omega) := measurable_pi_lambda _ fun j => S.meas j have hfoldB : Measurable (fun omega => fun j : split.foldB n => S.Z j omega) := measurable_pi_lambda _ fun j => S.meas j exact IndepFun.integral_finiteSelector_sq_le (split.folds_indep n) hfoldA hfoldB hselect hgood hV hEligible hbranchInt hbranch
    Causalean.Stat.OneShotSplit.integral_finiteSelector_sq_le · Causalean/Stat/SampleSplit/FiniteSelector.lean:417
Fold­BEmpirical­Process 4 core · 1 supporting This module proves the empirical-process estimates used to turn sample-split orthogonal expansions into stochastic remainders. ★ foldB_centered_sum_isLittleOp_one★ sqrtFoldB_integral_isLittleOp_one★ fold_centered_sum_isLittleOp_one★ sqrtFold_integral_isLittleOp_one

Fold-B empirical-process bounds

This module proves the empirical-process estimates used to turn sample-split orthogonal expansions into stochastic remainders. The main one-shot results are foldB_centered_sum_isLittleOp_one, which makes a centered evaluation-fold sum o_p(1) from an L²(P) o_p(1) nuisance rate, and sqrtFoldB_integral_isLittleOp_one, which controls the fold-B bias term from an o_p(n^{-1/2}) L²(P) rate and a fixed split proportion.

The same abstract conditional-independence argument is reused for K-fold splits through KFoldSplit.fold_centered_sum_isLittleOp_one and KFoldSplit.sqrtFold_integral_isLittleOp_one. The public helper oneShot_iid records the fold-B product-law bridge needed by downstream local empirical process modules.

theorem foldB_centered_sum_isLittleOp_one reviewed
Causalean.Stat

Centered fold-B empirical sum is o_p(1) from L²-rate o_p(1). For an i.i.d. sample and a one-shot split into a nuisance fold and an estimation fold, given a family of random functions f n ω : X → ℝ that is jointly measurable in the training data and the outcome, for every n, measurable with respect to the fold-A σ-algebra jointly with the outcome, for every n, square-integrable under the population measure, for every n and ω, and whose L2(P)L^2(P) norm is op(1)o_p(1) under the sampling measure, the centered fold-B empirical sum of f — the estimation-fold sample average of f n ω minus its population mean, rescaled by B(n)\sqrt{|B(n)|} — is op(1)o_p(1).

Formal statement
S :
IIDSample Ω X μ P
split :
f :
ℕ → Ω → X → ℝ
hf_meas :
∀ n, Measurable (uncurry (f n))
hf_uncurry_foldA :
∀ n,
Measurable[(comap (fun ω (i : split.foldA n) => S.Z i ω) inferInstance).prod (inferInstance : MeasurableSpace X)] (uncurry (f n))
hf_memLp :
∀ n ω, MemLp (f n ω) 2 P
hf_rate :
IsLittleOp (fun n ω => (eLpNorm (f n ω) 2 P).toReal) (fun _ => (1 : ℝ)) μ
IsLittleOp (fun n ω => (sqrt ((split.foldB n).card : ℝ))⁻¹ * ∑ i ∈ split.foldB n, (f n ω (S.Z i ω) - ∫ x, f n ω x ∂P)) (fun _ => (1 : ℝ)) μ
Proof (Lean source)
theorem foldB_centered_sum_isLittleOp_one (S : IIDSample Ω X μ P) (split : OneShotSplit S) (f : ℕ → Ω → X → ℝ) (hf_meas : ∀ n, Measurable (uncurry (f n))) (hf_uncurry_foldA : ∀ n, Measurable[(comap (fun ω (i : split.foldA n) => S.Z i ω) inferInstance).prod (inferInstance : MeasurableSpace X)] (uncurry (f n))) (hf_memLp : ∀ n ω, MemLp (f n ω) 2 P) (hf_rate : IsLittleOp (fun n ω => (eLpNorm (f n ω) 2 P).toReal) (fun _ => (1 : ℝ)) μ) : IsLittleOp (fun n ω => (sqrt ((split.foldB n).card : ℝ))⁻¹ * ∑ i ∈ split.foldB n, (f n ω (S.Z i ω) - ∫ x, f n ω x ∂P)) (fun _ => (1 : ℝ)) μ := evalSum_isLittleOp_one S (fun n => split.foldB n) (fun n => comap (fun ω (i : split.foldA n) => S.Z i ω) inferInstance) (fun n => foldA_sigma_le split n) (fun n => oneShot_indep split n) (fun n => oneShot_iid S split n) (by simpa [split.foldB_card] using split.cogrow) f hf_meas hf_uncurry_foldA hf_memLp hf_rate
theorem sqrtFoldB_integral_isLittleOp_one reviewed
Causalean.Stat

Bias term is o_p(1) under fixed-ratio split. Given a positive limiting fold-B sampling ratio cc with the fold-B fraction B(n)/n|B(n)|/n converging to cc, and a family of random functions f n ω that is square-integrable under the population measure, for every n, ω with L2(P)L^2(P) norm that is op(n1/2)o_p(n^{-1/2}) under the sampling measure, the bias term B(n)f(n,ω,)dP\sqrt{|B(n)|}\cdot\int f(n,\omega,\cdot)\,dP is op(1)o_p(1).

Formal statement
S :
IIDSample Ω X μ P
split :
c :
hc_pos :
0 < c
h_split_rate :
Tendsto (fun n => ((split.foldB n).card : ℝ) / n) atTop (𝓝 c)
f :
ℕ → Ω → X → ℝ
hf_memLp :
∀ n ω, MemLp (f n ω) 2 P
hf_rate :
IsLittleOp (fun n ω => (eLpNorm (f n ω) 2 P).toReal) (fun n => (n : ℝ) ^ (-(1 / 2 : ℝ))) μ
IsLittleOp (fun n ω => sqrt ((split.foldB n).card : ℝ) * ∫ x, f n ω x ∂P) (fun _ => (1 : ℝ)) μ
Proof (Lean source)
theorem sqrtFoldB_integral_isLittleOp_one (S : IIDSample Ω X μ P) (split : OneShotSplit S) {c : ℝ} (hc_pos : 0 < c) (h_split_rate : Tendsto (fun n => ((split.foldB n).card : ℝ) / n) atTop (𝓝 c)) (f : ℕ → Ω → X → ℝ) (hf_memLp : ∀ n ω, MemLp (f n ω) 2 P) (hf_rate : IsLittleOp (fun n ω => (eLpNorm (f n ω) 2 P).toReal) (fun n => (n : ℝ) ^ (-(1 / 2 : ℝ))) μ) : IsLittleOp (fun n ω => sqrt ((split.foldB n).card : ℝ) * ∫ x, f n ω x ∂P) (fun _ => (1 : ℝ)) μ := evalSum_bias_isLittleOp_one S (fun n => split.foldB n) hc_pos h_split_rate f hf_memLp hf_rate
theorem fold_centered_sum_isLittleOp_one reviewed
Causalean.Stat.KFoldSplit

Per-fold centered evaluation sum is o_p(1) (K-fold). For an i.i.d. sample and a K-fold split, fixing an evaluation fold k, given a family of random functions f n ω : X → ℝ that is jointly measurable in the training-complement data and the outcome, for every n, measurable with respect to the training-complement σ-algebra jointly with the outcome, for every n, square-integrable under the population measure, for every n and ω, and whose L2(P)L^2(P) norm is op(1)o_p(1), the centered per-fold empirical sum of f over the evaluation fold k — its fold sample average minus its population mean, rescaled by the square root of the fold size — is op(1)o_p(1).

Formal statement
S :
IIDSample Ω X μ P
K :
split :
k :
Fin K
f :
ℕ → Ω → X → ℝ
hf_meas :
∀ n, Measurable (uncurry (f n))
hf_uncurry_train :
∀ n,
Measurable[(comap (fun ω (i : split.trainComplement n k) => S.Z i ω) inferInstance).prod (inferInstance : MeasurableSpace X)] (uncurry (f n))
hf_memLp :
∀ n ω, MemLp (f n ω) 2 P
hf_rate :
IsLittleOp (fun n ω => (eLpNorm (f n ω) 2 P).toReal) (fun _ => (1 : ℝ)) μ
IsLittleOp (fun n ω => (sqrt ((split.fold n k).card : ℝ))⁻¹ * ∑ i ∈ split.fold n k, (f n ω (S.Z i ω) - ∫ x, f n ω x ∂P)) (fun _ => (1 : ℝ)) μ
Proof (Lean source)
theorem KFoldSplit.fold_centered_sum_isLittleOp_one (S : IIDSample Ω X μ P) {K : ℕ} (split : KFoldSplit S K) (k : Fin K) (f : ℕ → Ω → X → ℝ) (hf_meas : ∀ n, Measurable (uncurry (f n))) (hf_uncurry_train : ∀ n, Measurable[(comap (fun ω (i : split.trainComplement n k) => S.Z i ω) inferInstance).prod (inferInstance : MeasurableSpace X)] (uncurry (f n))) (hf_memLp : ∀ n ω, MemLp (f n ω) 2 P) (hf_rate : IsLittleOp (fun n ω => (eLpNorm (f n ω) 2 P).toReal) (fun _ => (1 : ℝ)) μ) : IsLittleOp (fun n ω => (sqrt ((split.fold n k).card : ℝ))⁻¹ * ∑ i ∈ split.fold n k, (f n ω (S.Z i ω) - ∫ x, f n ω x ∂P)) (fun _ => (1 : ℝ)) μ := evalSum_isLittleOp_one S (fun n => split.fold n k) (fun n => comap (fun ω (i : split.trainComplement n k) => S.Z i ω) inferInstance) (fun n => trainComplement_sigma_le split n k) (fun n => kFold_indep split n k) (fun n => kFold_iid S split n k) (split.grow k) f hf_meas hf_uncurry_train hf_memLp hf_rate
theorem sqrtFold_integral_isLittleOp_one reviewed
Causalean.Stat.KFoldSplit

Per-fold bias term is o_p(1) under a nonempty K-fold split. For an i.i.d. sample and a K-fold split with a positive number of folds KK, given a family of random functions f n ω that is square-integrable under the population measure, for every n, ω with L2(P)L^2(P) norm that is op(n1/2)o_p(n^{-1/2}), the per-fold bias term fold(n,k)f(n,ω,)dP\sqrt{|{\rm fold}(n,k)|}\cdot\int f(n,\omega,\cdot)\,dP at evaluation fold k is op(1)o_p(1).

Formal statement
S :
IIDSample Ω X μ P
K :
split :
k :
Fin K
hK_pos_nat :
0 < K
f :
ℕ → Ω → X → ℝ
hf_memLp :
∀ n ω, MemLp (f n ω) 2 P
hf_rate :
IsLittleOp (fun n ω => (eLpNorm (f n ω) 2 P).toReal) (fun n => (n : ℝ) ^ (-(1 / 2 : ℝ))) μ
IsLittleOp (fun n ω => sqrt ((split.fold n k).card : ℝ) * ∫ x, f n ω x ∂P) (fun _ => (1 : ℝ)) μ
Proof (Lean source)
theorem KFoldSplit.sqrtFold_integral_isLittleOp_one (S : IIDSample Ω X μ P) {K : ℕ} (split : KFoldSplit S K) (k : Fin K) (hK_pos_nat : 0 < K) (f : ℕ → Ω → X → ℝ) (hf_memLp : ∀ n ω, MemLp (f n ω) 2 P) (hf_rate : IsLittleOp (fun n ω => (eLpNorm (f n ω) 2 P).toReal) (fun n => (n : ℝ) ^ (-(1 / 2 : ℝ))) μ) : IsLittleOp (fun n ω => sqrt ((split.fold n k).card : ℝ) * ∫ x, f n ω x ∂P) (fun _ => (1 : ℝ)) μ := by have hK_pos : 0 < (K : ℝ) := by exact_mod_cast hK_pos_nat have hc_pos : 0 < (K : ℝ)⁻¹ := inv_pos.mpr hK_pos exact evalSum_bias_isLittleOp_one S (fun n => split.fold n k) hc_pos (split.ratio k) f hf_memLp hf_rate
Causalean.Stat.KFoldSplit.sqrtFold_integral_isLittleOp_one · Causalean/Stat/SampleSplit/FoldBEmpiricalProcess.lean:777 · uses IIDSample , IsLittleOp , KFoldSplit
1 supporting declaration (lemmas, instances)
  • oneShot_iid lemma — OneShot evaluation-fold i.i.d. product law. Public because the orthogonal-learning modulus chain consumes it as the joint-law bridge between fold B and Measure.pi (see Estimation/OrthogonalLearning/LocalEmpProcess/Rademacher.lean).
    S :
    IIDSample Ω X μ P
    split :
    n :
    μ.map (fun ω (i : split.foldB n) => S.Z i ω) = Measure.pi (fun _ : split.foldB n => P)
    Proof (Lean source)
    lemma oneShot_iid (S : IIDSample Ω X μ P) (split : OneShotSplit S) (n : ℕ) : μ.map (fun ω (i : split.foldB n) => S.Z i ω) = Measure.pi (fun _ : split.foldB n => P) := by have hindep_s : iIndepFun (fun i : split.foldB n => S.Z i) μ := by exact S.indep.precomp val_injective have hmap := (ProbabilityTheory.iIndepFun_iff_map_fun_eq_pi_map (fun i : split.foldB n => (S.meas i).aemeasurable)).mp hindep_s calc μ.map (fun ω (i : split.foldB n) => S.Z i ω) = Measure.pi (fun i : split.foldB n => μ.map (S.Z i)) := hmap _ = Measure.pi (fun _ : split.foldB n => P) := by congr with i rw [← (S.identDist i).map_eq, S.law]
Fold­BWLLN 1 core · 0 supporting This file provides a weak law of large numbers for the estimation fold of a one-shot sample split: the fold-B average of a fixed square-integrable statistic converges in probability to its population mean. ★ foldB_sampleMean_tendsto_inProb

Fold-B Weak Law of Large Numbers

This file provides a weak law of large numbers for the estimation fold of a one-shot sample split: the fold-B average of a fixed square-integrable statistic converges in probability to its population mean. It is the substrate that lets a fold-B average of a fixed function converge to its mean, as opposed to the existing fold-B lemmas which only treat the nuisance-vanishing regime.

theorem foldB_sampleMean_tendsto_inProb reviewed
Causalean.Stat.OneShotSplit

Fold-B weak law of large numbers. For an i.i.d. sample and a one-shot split into a nuisance fold and an estimation fold, given a measurable statistic g that is square-integrable under the population measure, the estimation-fold sample average of g converges in probability to the population integral gdP\int g\,dP as the sample size grows.

Formal statement
S :
IIDSample Ω X μ P
split :
g :
X → ℝ
hg_meas :
hg_memLp :
MemLp g 2 P
Tendsto_inProb (fun n ω => ((split.foldB n).card : ℝ)⁻¹ * ∑ i ∈ split.foldB n, g (S.Z i ω)) (fun _ => ∫ x, g x ∂P) μ
Proof (Lean source)
theorem foldB_sampleMean_tendsto_inProb [IsProbabilityMeasure μ] [IsProbabilityMeasure P] (S : IIDSample Ω X μ P) (split : OneShotSplit S) {g : X → ℝ} (hg_meas : Measurable g) (hg_memLp : MemLp g 2 P) : Tendsto_inProb (fun n ω => ((split.foldB n).card : ℝ)⁻¹ * ∑ i ∈ split.foldB n, g (S.Z i ω)) (fun _ => ∫ x, g x ∂P) μ := by set V : ℝ := variance g P with hV_def -- Per-index facts transported through `μ.map (Z i) = P`. have hmemLp_i : ∀ i, MemLp (fun ω => g (S.Z i ω)) 2 μ := by intro i have h : MemLp g 2 (μ.map (S.Z i)) := by rw [map_Z_eq S i]; exact hg_memLp exact h.comp_of_map (S.meas i).aemeasurable have hint_i : ∀ i, ∫ ω, g (S.Z i ω) ∂μ = ∫ x, g x ∂P := by intro i rw [← integral_map (S.meas i).aemeasurable hg_meas.aestronglyMeasurable, map_Z_eq S i] have hvar_i : ∀ i, variance (fun ω => g (S.Z i ω)) μ = V := by intro i have hident : IdentDistrib (fun ω => g (S.Z i ω)) g μ P := by refine ⟨(hg_meas.comp (S.meas i)).aemeasurable, hg_meas.aemeasurable, ?_⟩ change Measure.map (g ∘ S.Z i) μ = Measure.map g P rw [← Measure.map_map hg_meas (S.meas i), map_Z_eq S i] rw [hident.variance_eq, hV_def] have hintegrable_i : ∀ i, Integrable (fun ω => g (S.Z i ω)) μ := fun i => (hmemLp_i i).integrable (by norm_num) -- Independence of `g ∘ Z i` across distinct indices. have hindep_comp : iIndepFun (fun i => g ∘ S.Z i) μ := S.indep.comp (fun _ => g) (fun _ => hg_meas) -- Abbreviations for the fold-B average as a function of `n`. set Yn : ℕ → Ω → ℝ := fun n ω => ((split.foldB n).card : ℝ)⁻¹ * ∑ i ∈ split.foldB n, g (S.Z i ω) with hYn_def -- Mean of the fold-B average is `∫ g dP` whenever the fold is nonempty. have hmean : ∀ n, 0 < (split.foldB n).card → ∫ ω, Yn n ω ∂μ = ∫ x, g x ∂P := by intro n hcard have hsum : ∫ ω, ∑ i ∈ split.foldB n, g (S.Z i ω) ∂μ = ((split.foldB n).card : ℝ) * ∫ x, g x ∂P := by rw [integral_finset_sum _ (fun i _ => hintegrable_i i)] simp only [hint_i] rw [Finset.sum_const, nsmul_eq_mul] rw [hYn_def] simp only [] rw [integral_const_mul, hsum, ← mul_assoc, inv_mul_cancel₀ (by positivity), one_mul] -- Variance of the fold-B average is `V / |B(n)|`. have hvar : ∀ n, 0 < (split.foldB n).card → variance (Yn n) μ = V / ((split.foldB n).card : ℝ) := by intro n hcard have hsum_var : variance (fun ω => ∑ i ∈ split.foldB n, g (S.Z i ω)) μ = ((split.foldB n).card : ℝ) * V := by have hpair : (↑(split.foldB n) : Set ℕ).Pairwise (fun i j => IndepFun (fun ω => g (S.Z i ω)) (fun ω => g (S.Z j ω)) μ) := by intro i _ j _ hij exact hindep_comp.indepFun hij have hfun_eq : (fun ω => ∑ i ∈ split.foldB n, g (S.Z i ω)) = ∑ i ∈ split.foldB n, fun ω => g (S.Z i ω) := by funext ω; rw [Finset.sum_apply] rw [hfun_eq, ProbabilityTheory.IndepFun.variance_sum (fun i _ => hmemLp_i i) hpair] simp only [hvar_i] rw [Finset.sum_const, nsmul_eq_mul] have hcong : Yn n = fun ω => ((split.foldB n).card : ℝ)⁻¹ * (fun ω => ∑ i ∈ split.foldB n, g (S.Z i ω)) ω := rfl rw [hcong, variance_const_mul, hsum_var] have hcard_ne : ((split.foldB n).card : ℝ) ≠ 0 := by positivity field_simp -- Chebyshev bound on the fold-B average, eventually (once `|B(n)| > 0`). have hcard_pos : ∀ᶠ n in atTop, 0 < (split.foldB n).card := by have := split.foldB_card_tendsto filter_upwards [(tendsto_atTop.mp this) 1] with n hn exact hn have hcheb : ∀ ε : ℝ, 0 < ε → ∀ᶠ n in atTop, μ {ω | ε ≤ |Yn n ω - ∫ x, g x ∂P|} ≤ ofReal (V / (ε ^ 2 * (split.foldB n).card)) := by intro ε hε filter_upwards [hcard_pos] with n hcard have hmemLp_Yn : MemLp (Yn n) 2 μ := by rw [hYn_def] exact ((memLp_finset_sum _ (fun i _ => hmemLp_i i)).const_mul _) have hcheb_raw := ProbabilityTheory.meas_ge_le_variance_div_sq hmemLp_Yn hε rw [hmean n hcard] at hcheb_raw rw [hvar n hcard] at hcheb_raw -- Rewrite `(V / |B|) / ε² = V / (ε² · |B|)`. have hrw : V / ((split.foldB n).card : ℝ) / ε ^ 2 = V / (ε ^ 2 * (split.foldB n).card) := by rw [div_div]; ring_nf rwa [hrw] at hcheb_raw -- `|B(n)| → ∞` as a real sequence. have hb : Tendsto (fun n => ((split.foldB n).card : ℝ)) atTop atTop := by exact tendsto_natCast_atTop_atTop.comp split.foldB_card_tendsto exact tendsto_inProb_of_chebyshev hb hcheb
Causalean.Stat.OneShotSplit.foldB_sampleMean_tendsto_inProb · Causalean/Stat/SampleSplit/FoldBWLLN.lean:85 · uses IIDSample , OneShotSplit , foldB , Tendsto_inProb
Partial­Fold­CLT 3 core · 3 supporting This file provides the central-limit-theorem contact point for one-shot sample splits. ★ clt_normalizedFoldB★ tendsto_normal_foldB★ tendsto_normal_foldB_sqrt_n

Fold-Restricted Central Limit Theorems

This file provides the central-limit-theorem contact point for one-shot sample splits. It proves the fold-B normalized-sum CLT, converts fold-B asymptotic linearity into asymptotic normality at rate √|B(n)|, and gives the √n-rate conversion under a fixed split ratio with variance inflation.

theorem clt_normalizedFoldB reviewed
Causalean.Stat.IIDSample

Fold-B CLT. Along an i.i.d. sample S under a one-shot sample split split, fix a transform ψ : X → ℝ that is measurable, has population mean zero under P, and is square-integrable; provided the fold-B normalized partial sum is almost-everywhere measurable at every sample size, the fold-B normalized partial sum (1/√|B(n)|) Σ_{i∈B(n)} ψ(Z_i) converges in distribution to the centered Gaussian law with variance ∫ψ²dP.

Formal statement
S :
IIDSample Ω X μ P
split :
ψ :
X → ℝ
hψ_meas :
hψ_mean :
∫ x, ψ x ∂P = 0
hψ_sq_int :
Integrable (fun x => (ψ x) ^ 2) P
hSum_meas :
∀ n, AEMeasurable (IsAsymLinear.normalizedSum S ψ split.foldB n) μ
Tendsto_dist (IsAsymLinear.normalizedSum S ψ split.foldB) (gaussianMeasure 0 (∫ x, (ψ x) ^ 2 ∂P)) μ hSum_meas
Proof (Lean source)
theorem clt_normalizedFoldB (S : IIDSample Ω X μ P) (split : OneShotSplit S) {ψ : X → ℝ} (hψ_meas : Measurable ψ) (hψ_mean : ∫ x, ψ x ∂P = 0) (hψ_sq_int : Integrable (fun x => (ψ x) ^ 2) P) (hSum_meas : ∀ n, AEMeasurable (IsAsymLinear.normalizedSum S ψ split.foldB n) μ) : Tendsto_dist (IsAsymLinear.normalizedSum S ψ split.foldB) (gaussianMeasure 0 (∫ x, (ψ x) ^ 2 ∂P)) μ hSum_meas := by have hFull_meas : ∀ n, AEMeasurable (IsAsymLinear.normalizedSum S ψ (fun m => range m) n) μ := by intro n unfold IsAsymLinear.normalizedSum exact (measurable_const.mul (measurable_sum _ (fun i _hi => hψ_meas.comp (S.meas i)))).aemeasurable have hFull := IIDSample.clt_normalized_sum S hψ_meas hψ_mean hψ_sq_int have hcard_tendsto : Tendsto (fun n => (split.foldB n).card) atTop atTop := by convert split.cogrow using 1 funext n exact split.card_foldB n unfold Tendsto_dist at hFull ⊢ refine ProbabilityMeasure.tendsto_iff_tendsto_charFun.mpr fun t => ?_ have hFull_char := (ProbabilityMeasure.tendsto_iff_tendsto_charFun.mp hFull t).comp hcard_tendsto refine hFull_char.congr' ?_ filter_upwards with n have hcf := charFun_normalizedSum_finset_eq_range_card S hψ_meas (split.foldB n) t change charFun (μ.map (IsAsymLinear.normalizedSum S ψ (fun m => range m) (split.foldB n).card)) t = charFun (μ.map (IsAsymLinear.normalizedSum S ψ split.foldB n)) t rw [show IsAsymLinear.normalizedSum S ψ (fun m => range m) (split.foldB n).card = fun ω => (sqrt ((split.foldB n).card : ℝ))⁻¹ * ∑ i ∈ range (split.foldB n).card, ψ (S.Z i ω) by funext ω simp [IsAsymLinear.normalizedSum]] rw [show IsAsymLinear.normalizedSum S ψ split.foldB n = fun ω => (sqrt ((split.foldB n).card : ℝ))⁻¹ * ∑ i ∈ split.foldB n, ψ (S.Z i ω) by rfl] exact hcf.symm
theorem tendsto_normal_foldB reviewed
Causalean.Stat.IsAsymLinear

Fold-B asymptotic linearity ⇒ asymptotic normality at rate √|B(n)|. Along an i.i.d. sample S under a one-shot sample split split, if the estimator sequence θn is fold-B asymptotically linear toward θ₀ with influence function ψ that is measurable, and if the rescaled estimator and the fold-B normalized influence-function sum are almost-everywhere measurable at every sample size, then √|B(n)| · (θn n − θ₀) converges in distribution to the centered Gaussian law with variance ∫ψ²dP.

Formal statement
split :
h :
IsAsymLinear θn θ₀ ψ S split.foldB
hψ_meas :
hθn_meas :
∀ n : ℕ, AEMeasurable (IsAsymLinear.rescaledEstimator θn θ₀ split.foldB n) μ
hSum_meas :
∀ n : ℕ, AEMeasurable (IsAsymLinear.normalizedSum S ψ split.foldB n) μ
Tendsto_dist (IsAsymLinear.rescaledEstimator θn θ₀ split.foldB) (gaussianMeasure 0 (∫ x, (ψ x) ^ 2 ∂P)) μ hθn_meas
Proof (Lean source)
theorem IsAsymLinear.tendsto_normal_foldB (split : OneShotSplit S) (h : IsAsymLinear θn θ₀ ψ S split.foldB) (hψ_meas : Measurable ψ) (hθn_meas : ∀ n : ℕ, AEMeasurable (IsAsymLinear.rescaledEstimator θn θ₀ split.foldB n) μ) (hSum_meas : ∀ n : ℕ, AEMeasurable (IsAsymLinear.normalizedSum S ψ split.foldB n) μ) : Tendsto_dist (IsAsymLinear.rescaledEstimator θn θ₀ split.foldB) (gaussianMeasure 0 (∫ x, (ψ x) ^ 2 ∂P)) μ hθn_meas := by have hCLT := IIDSample.clt_normalizedFoldB S split hψ_meas h.mean_zero h.finite_var hSum_meas refine Tendsto_dist.add_isLittleOp_one hSum_meas hθn_meas hCLT ?_ simpa [IsAsymLinear.normalizedSum, IsAsymLinear.rescaledEstimator] using h.remainder
theorem tendsto_normal_foldB_sqrt_n reviewed
Causalean.Stat.IsAsymLinear

Conversion to √n-rate under a fixed split ratio. Along an i.i.d. sample S under a one-shot sample split split with a fold-B asymptotically linear estimator sequence θn (h), suppose the split ratio c is strictly positive, the estimation-fold share |B(n)|/n converges to c, the influence function ψ is measurable, and the √n-rescaled estimator is almost-everywhere measurable at every sample size; then √n · (θn n − θ₀) converges in distribution to the centered Gaussian law with variance (∫ψ²dP)/c.

Formal statement
split :
c :
hc_pos :
0 < c
h_split_rate :
Tendsto (fun n => ((split.foldB n).card : ℝ) / n) atTop (𝓝 c)
h :
IsAsymLinear θn θ₀ ψ S split.foldB
hψ_meas :
hθn_meas :
∀ n : ℕ, AEMeasurable (fun ω => sqrt (n : ℝ) * (θn n ω - θ₀)) μ
Tendsto_dist (fun n ω => sqrt (n : ℝ) * (θn n ω - θ₀)) (gaussianMeasure 0 ((∫ x, (ψ x) ^ 2 ∂P) / c)) μ hθn_meas
Proof (Lean source)
theorem IsAsymLinear.tendsto_normal_foldB_sqrt_n (split : OneShotSplit S) {c : ℝ} (hc_pos : 0 < c) (h_split_rate : Tendsto (fun n => ((split.foldB n).card : ℝ) / n) atTop (𝓝 c)) (h : IsAsymLinear θn θ₀ ψ S split.foldB) (hψ_meas : Measurable ψ) (hθn_meas : ∀ n : ℕ, AEMeasurable (fun ω => sqrt (n : ℝ) * (θn n ω - θ₀)) μ) : Tendsto_dist (fun n ω => sqrt (n : ℝ) * (θn n ω - θ₀)) (gaussianMeasure 0 ((∫ x, (ψ x) ^ 2 ∂P) / c)) μ hθn_meas := by let a : ℕ → ℝ := fun n => (sqrt ((split.foldB n).card : ℝ))⁻¹ * sqrt (n : ℝ) let σ2 : ℝ := ∫ x, (ψ x) ^ 2 ∂P have hfold_meas : ∀ n : ℕ, AEMeasurable (IsAsymLinear.rescaledEstimator θn θ₀ split.foldB n) μ := by intro n by_cases hn : n = 0 · subst n unfold IsAsymLinear.rescaledEstimator have hcard : (split.foldB 0).card = 0 := by simp [split.card_foldB] simp [hcard] · have hn_pos_nat : 0 < n := Nat.pos_of_ne_zero hn have hsqrtn_ne : sqrt (n : ℝ) ≠ 0 := by rw [Real.sqrt_ne_zero'] exact_mod_cast hn_pos_nat have h_eq : IsAsymLinear.rescaledEstimator θn θ₀ split.foldB n = fun ω => (sqrt ((split.foldB n).card : ℝ) * (sqrt (n : ℝ))⁻¹) * (sqrt (n : ℝ) * (θn n ω - θ₀)) := by funext ω unfold IsAsymLinear.rescaledEstimator field_simp [hsqrtn_ne] rw [h_eq] exact (hθn_meas n).const_mul _ have hSum_meas : ∀ n : ℕ, AEMeasurable (IsAsymLinear.normalizedSum S ψ split.foldB n) μ := by intro n unfold IsAsymLinear.normalizedSum exact (measurable_const.mul (measurable_sum _ (fun i _hi => hψ_meas.comp (S.meas i)))).aemeasurable have hfold : Tendsto_dist (IsAsymLinear.rescaledEstimator θn θ₀ split.foldB) (gaussianMeasure 0 σ2) μ hfold_meas := by simpa [σ2] using h.tendsto_normal_foldB split hψ_meas hfold_meas hSum_meas have hscaled_meas : ∀ n : ℕ, AEMeasurable (fun ω => a n * IsAsymLinear.rescaledEstimator θn θ₀ split.foldB n ω) μ := by intro n exact (hfold_meas n).const_mul (a n) have hcard_tendsto : Tendsto (fun n => (split.foldB n).card) atTop atTop := by convert split.cogrow using 1 funext n exact split.card_foldB n have hscale_tendsto : Tendsto a atTop (𝓝 ((sqrt c)⁻¹)) := by have h_inv : Tendsto (fun n => (((split.foldB n).card : ℝ) / n)⁻¹) atTop (𝓝 c⁻¹) := by exact h_split_rate.inv₀ hc_pos.ne' have h_sqrt : Tendsto (fun n => sqrt ((((split.foldB n).card : ℝ) / n)⁻¹)) atTop (𝓝 (sqrt c⁻¹)) := h_inv.sqrt have hcard_pos_event : ∀ᶠ n in atTop, 0 < (split.foldB n).card := hcard_tendsto.eventually (Ioi_mem_atTop 0) have hn_pos_event : ∀ᶠ n in atTop, 0 < n := eventually_gt_atTop 0 refine h_sqrt.congr' ?_ |>.mono_right ?_ · filter_upwards [hcard_pos_event, hn_pos_event] with n hcard hn have hcard_ne : ((split.foldB n).card : ℝ) ≠ 0 := by exact_mod_cast (ne_of_gt hcard) have hn_ne : (n : ℝ) ≠ 0 := by exact_mod_cast (ne_of_gt hn) dsimp [a] rw [show ((((split.foldB n).card : ℝ) / n)⁻¹) = (n : ℝ) / (split.foldB n).card by field_simp [hcard_ne, hn_ne]] rw [Real.sqrt_div (by positivity : 0 ≤ (n : ℝ))] ring · rw [Real.sqrt_inv] have hscaled : Tendsto_dist (fun n ω => a n * IsAsymLinear.rescaledEstimator θn θ₀ split.foldB n ω) (gaussianMeasure 0 (((sqrt c)⁻¹) ^ 2 * σ2)) μ hscaled_meas := Tendsto_dist.const_mul_tendsto_gaussian hfold_meas hfold hscale_tendsto have h_eventual_eq : ∀ᶠ n in atTop, (fun ω => a n * IsAsymLinear.rescaledEstimator θn θ₀ split.foldB n ω) =ᵐ[μ] (fun ω => sqrt (n : ℝ) * (θn n ω - θ₀)) := by have hcard_pos_event : ∀ᶠ n in atTop, 0 < (split.foldB n).card := hcard_tendsto.eventually (Ioi_mem_atTop 0) filter_upwards [hcard_pos_event] with n hcard apply ae_of_all intro ω unfold IsAsymLinear.rescaledEstimator have hsqrt_card_ne : sqrt ((split.foldB n).card : ℝ) ≠ 0 := by rw [Real.sqrt_ne_zero'] exact_mod_cast hcard dsimp [a] field_simp [hsqrt_card_ne] have hvar : (sqrt c ^ 2)⁻¹ * σ2 = σ2 / c := by rw [Real.sq_sqrt hc_pos.le] ring exact Tendsto_dist.congr_ae hscaled_meas hθn_meas (by simpa [hvar, σ2] using hscaled) h_eventual_eq
3 supporting declarations (lemmas, instances)
  • foldB_eq_Ico lemma — The estimation fold of a one-shot split is the interval from the split point to the sample size.
    split :
    n :
    split.foldB n = Ico (split.n₁ n) n
    Proof (Lean source)
    lemma foldB_eq_Ico (split : OneShotSplit S) (n : ℕ) : split.foldB n = Ico (split.n₁ n) n := by ext i simp [OneShotSplit.foldB, Finset.mem_Ico, and_comm]
    Causalean.Stat.OneShotSplit.foldB_eq_Ico · Causalean/Stat/SampleSplit/PartialFoldCLT.lean:65
  • card_foldB lemma — The size of the estimation fold is the sample size minus the split point.
    split :
    n :
    (split.foldB n).card = n - split.n₁ n
    Proof (Lean source)
    lemma card_foldB (split : OneShotSplit S) (n : ℕ) : (split.foldB n).card = n - split.n₁ n := by rw [split.foldB_eq_Ico n] exact Nat.card_Ico (split.n₁ n) n
    Causalean.Stat.OneShotSplit.card_foldB · Causalean/Stat/SampleSplit/PartialFoldCLT.lean:73
  • charFun_normalizedSum_finset_eq_range_card lemma — A normalized finite-set sum has the characteristic function of an equal-size initial block.
    S :
    IIDSample Ω X μ P
    ψ :
    X → ℝ
    hψ_meas :
    s :
    Finset
    t :
    charFun (μ.map (fun ω => (sqrt (s.card : ℝ))⁻¹ * ∑ i ∈ s, ψ (S.Z i ω))) t
    = charFun (μ.map (fun ω => (sqrt (s.card : ℝ))⁻¹ * ∑ i ∈ range s.card, ψ (S.Z i ω))) t
    Proof (Lean source)
    lemma charFun_normalizedSum_finset_eq_range_card (S : IIDSample Ω X μ P) {ψ : X → ℝ} (hψ_meas : Measurable ψ) (s : Finset ℕ) (t : ℝ) : charFun (μ.map (fun ω => (sqrt (s.card : ℝ))⁻¹ * ∑ i ∈ s, ψ (S.Z i ω))) t = charFun (μ.map (fun ω => (sqrt (s.card : ℝ))⁻¹ * ∑ i ∈ range s.card, ψ (S.Z i ω))) t := by let Y : ℕ → Ω → ℝ := fun i ω => ψ (S.Z i ω) let c : ℝ := (sqrt (s.card : ℝ))⁻¹ have hY_meas : ∀ i, Measurable (Y i) := by intro i exact hψ_meas.comp (S.meas i) have hY_ident : ∀ i, IdentDistrib (Y i) (Y 0) μ μ := by intro i simpa [Y, Function.comp_def] using (S.identDist i).symm.comp hψ_meas have hindep_Y : iIndepFun Y μ := by simpa [Y, Function.comp_def] using S.indep.comp (fun _ x => ψ x) (fun _ => hψ_meas) have hindep_s : iIndepFun (fun i : s => Y i) μ := by exact hindep_Y.precomp Subtype.val_injective have hleft_sum : (fun ω => ∑ i : s, Y i ω) = fun ω => ∑ i ∈ s, Y i ω := by funext ω exact Finset.sum_attach s (fun i => Y i ω) have hleft_unscaled : charFun (μ.map (fun ω => ∑ i ∈ s, Y i ω)) (c * t) = charFun (μ.map (Y 0)) (c * t) ^ s.card := by calc charFun (μ.map (fun ω => ∑ i ∈ s, Y i ω)) (c * t) = charFun (μ.map (fun ω => ∑ i : s, Y i ω)) (c * t) := by rw [hleft_sum] _ = (∏ i : s, charFun (μ.map (Y i)) (c * t)) := by simpa [Finset.prod_apply] using congrFun (iIndepFun.charFun_map_fun_sum_eq_prod (fun i : s => (hY_meas i).aemeasurable) hindep_s) (c * t) _ = charFun (μ.map (Y 0)) (c * t) ^ s.card := by rw [show (∏ i : s, charFun (μ.map (Y i)) (c * t)) = ∏ _i : s, charFun (μ.map (Y 0)) (c * t) by apply Finset.prod_congr rfl intro i _hi exact congrFun (congrArg charFun ((hY_ident i).map_eq)) (c * t)] simp have hleft_scaled : charFun (μ.map (fun ω => c * ∑ i ∈ s, Y i ω)) t = charFun (μ.map (Y 0)) (c * t) ^ s.card := by calc charFun (μ.map (fun ω => c * ∑ i ∈ s, Y i ω)) t = charFun (μ.map (fun ω => ∑ i ∈ s, Y i ω)) (c * t) := by rw [show μ.map (fun ω => c * ∑ i ∈ s, Y i ω) = (μ.map (fun ω => ∑ i ∈ s, Y i ω)).map (fun x => c * x) by rw [Measure.map_map] · rfl · exact measurable_const.mul measurable_id · exact measurable_sum _ (fun i _ => hY_meas i)] rw [charFun_map_mul] _ = charFun (μ.map (Y 0)) (c * t) ^ s.card := hleft_unscaled have hright_scaled : charFun (μ.map (fun ω => c * ∑ i ∈ range s.card, Y i ω)) t = charFun (μ.map (Y 0)) (c * t) ^ s.card := by simpa [c] using (ProbabilityTheory.charFun_inv_sqrt_mul_sum (X := Y) (P := μ) hindep_Y (fun i => hY_ident i) (n := s.card) (t := t)) simpa [Y, c] using hleft_scaled.trans hright_scaled.symm
    Causalean.Stat.IIDSample.charFun_normalizedSum_finset_eq_range_card · Causalean/Stat/SampleSplit/PartialFoldCLT.lean:83