Experimentation.Design­Based.Finite­Population­CLT

This module develops an explicit reveal martingale for a simple random sample without replacement.

Finite­Population­CLT 10 core · 15 supporting This module develops an explicit reveal martingale for a simple random sample without replacement. ★ standardizedSrsPermutationHajekArray_conditionalLindeberg★ standardizedSrsPermutationHajekArray_rowSum

Finite-population CLT under the Li–Ding maximal-deviation condition

This module develops an explicit reveal martingale for a simple random sample without replacement. Its first layer identifies each martingale increment as a deterministic coefficient times the next draw centered by its remaining-population mean. The asymptotic layer controls those increments and their predictable quadratic variation under the convenient Li–Ding maximal-deviation sufficient condition, then transports the Gaussian limit from ordered permutations to the library's complete-randomization design. It does not formalize Hájek's weaker necessary-and-sufficient Lindeberg criterion.

def hajekIncrementCoefficient reviewed
Causalean.Experimentation.DesignBased

Given a population size, a proper positive sample size, and a reveal time, the Hájek coefficient multiplying the centered next draw is (N-K)/(K(N-k-1)).

Definition (Lean source)
N K :
ℕ
hKpos :
0 < K
hKlt :
K < N
k :
ℕ
hajekIncrementCoefficient N K hKpos hKlt k :
ℝ
((N - K : ℕ) : ℝ) / ((K : ℝ) * ((N - k - 1 : ℕ) : ℝ))
Causalean.Experimentation.DesignBased.hajekIncrementCoefficient · Causalean/Experimentation/DesignBased/FinitePopulationCLT.lean:34
def permutationHajekIncrement reviewed
Causalean.Experimentation.DesignBased

Given a population size, a proper positive sample size, population outcomes, an active reveal time, and an ordering, the Hájek reveal increment is (N-K)/(K(N-k-1)) times the next outcome minus its prefix-conditional remaining-population mean.

Definition (Lean source)
N :
ℕ
K :
ℕ
hKpos :
0 < K
hKlt :
K < N
y :
Fin N → ℝ
k :
ℕ
hk :
k < K
permutationHajekIncrement K hKpos hKlt y k hk π :
ℝ
hajekIncrementCoefficient N K hKpos hKlt k * (permutationDraw y k (hk.trans hKlt) π - permutationNextMean y k (hk.trans hKlt) π)
Causalean.Experimentation.DesignBased.permutationHajekIncrement · Causalean/Experimentation/DesignBased/FinitePopulationCLT.lean:41 · uses PermutationSampleSpace
def permutationHajekValue reviewed
Causalean.Experimentation.DesignBased

Given a proper positive sample size, population outcomes, a feasible reveal time, and an ordering, the explicit Doob-martingale value after k reveals averages the revealed outcomes and fills the unrevealed sample positions with their remaining-population conditional mean.

Definition (Lean source)
N :
ℕ
K :
ℕ
hKpos :
0 < K
hKlt :
K < N
y :
Fin N → ℝ
k :
ℕ
hk :
k ≤ K
permutationHajekValue K hKpos hKlt y k hk π :
ℝ
(permutationRevealedSum y k (hk.trans hKlt.le) π + ((K - k : ℕ) : ℝ) * permutationNextMean y k (hk.trans_lt hKlt) π) / (K : ℝ)
- popMean y
Causalean.Experimentation.DesignBased.permutationHajekValue · Causalean/Experimentation/DesignBased/FinitePopulationCLT.lean:64 · uses PermutationSampleSpace
def srsSampleMeanVariance reviewed ⚑ 1 flagged
Causalean.Experimentation.DesignBased
  • ⚑ The name and docstring claim an exact SRS design variance, but the signature permits K = 0, K > N, and N < 2, where that interpretation is not justified.

Given two natural-number counts and finite-population outcomes, the simple-random-sample mean variance expression is the difference of their reciprocal real embeddings multiplied by the finite-population variance.

Definition (Lean source)
N K :
ℕ
y :
Fin N → ℝ
srsSampleMeanVariance N K y :
ℝ
(1 / (K : ℝ) - 1 / (N : ℝ)) * popVar y
Causalean.Experimentation.DesignBased.srsSampleMeanVariance · Causalean/Experimentation/DesignBased/FinitePopulationCLT.lean:248
def standardizedPermutationHajekIncrement reviewed
Causalean.Experimentation.DesignBased

Given a proper positive sample size, population outcomes, an active reveal time, and an ordering, the standardized Hájek increment divides the reveal increment by the exact sample-mean standard deviation.

Definition (Lean source)
N :
ℕ
K :
ℕ
hKpos :
0 < K
hKlt :
K < N
y :
Fin N → ℝ
k :
ℕ
hk :
k < K
standardizedPermutationHajekIncrement K hKpos hKlt y k hk π :
ℝ
permutationHajekIncrement K hKpos hKlt y k hk π / sqrt (srsSampleMeanVariance N K y)
Causalean.Experimentation.DesignBased.standardizedPermutationHajekIncrement · Causalean/Experimentation/DesignBased/FinitePopulationCLT.lean:270 · uses PermutationSampleSpace
def srsPermutationHajekArray reviewed
Causalean.Experimentation.DesignBased

Given sequences of population sizes, proper positive sample sizes, and finite-population outcomes, the explicit Hájek martingale-difference array reveals one sampled unit at a time.

Definition (Lean source)
N K :
ℕ → ℕ
hKpos :
∀ n, 0 < K n
hKlt :
∀ n, K n < N n
y :
∀ n
if
Fin (N n)
then
ℝ
srsPermutationHajekArray N K hKpos hKlt y :
MartingaleDifferenceArray (fun n => PermutationSampleSpace (N n)) (fun n => (uniformPermutationDesign (N n)).toMeasure)
clause 1
rowLength := K
clause 2
increment := fun n k π
=> if hk : k < K n then permutationHajekIncrement (K n) (hKpos n) (hKlt n) (y n) k hk π else 0
clause 3
filtration := fun n => permutationRevealFiltration (N n)
clause 4
adapted := by intro n k hk simp only [hk, dite_true, permutationHajekIncrement] apply StronglyMeasurable.const_mul exact (permutationDraw_stronglyMeasurable (y n) k (hk.trans (hKlt n))).sub ((permutationNextMean_stronglyMeasurable (y n) k (hk.trans (hKlt n))).mono ((permutationRevealFiltration (N n)).mono (le_succ k)))
clause 5
squareIntegrable := by intro n k hk exact (uniformPermutationDesign (N n)).memLp_toMeasure (fun π => if hk' : k < K n then permutationHajekIncrement (K n) (hKpos n) (hKlt n) (y n) k hk' π else 0) 2
clause 6
condExp_zero := by intro n k hk simp only [hk, dite_true, permutationHajekIncrement] let μ := (uniformPermutationDesign (N n)).toMeasure let m := (permutationRevealFiltration (N n)) k let X : PermutationSampleSpace (N n) → ℝ := fun π
=> permutationDraw (y n) k (hk.trans (hKlt n)) π
- permutationNextMean (y n) k (hk.trans (hKlt n)) π have hzero : μ[X | m]
=ᵐ[μ] 0 := permutationCenteredDraw_condExp_zero (y n) k (hk.trans (hKlt n)) have hsmul := condExp_smul (μ := μ) (hajekIncrementCoefficient (N n) (K n) (hKpos n) (hKlt n) k) X m let c := hajekIncrementCoefficient (N n) (K n) (hKpos n) (hKlt n) k have hfun : (fun ω => c * X ω) = c • X := by funext ω simp [smul_eq_mul] change μ[(fun ω => c * X ω) | m] =ᵐ[μ] 0 rw [hfun] filter_upwards [hsmul, hzero] with π hsmulπ hzeroπ rw [hsmulπ] simp [hzeroπ]
def scaleMartingaleDifferenceArray reviewed
Causalean.Experimentation.DesignBased

Given row spaces, their measurable structures, row measures, a martingale-difference array, and deterministic row scalars, the row-scaled martingale-difference array multiplies every increment in row n by c n.

Definition (Lean source)
Ω :
ℕ → Type*
(n : ℕ) → MeasurableSpace (Ω n)
(n : ℕ) → Measure (Ω n)
c :
ℕ → ℝ
scaleMartingaleDifferenceArray A c :
clause 1
rowLength := A.rowLength
clause 2
increment := fun n k ω => c n * A.increment n k ω
clause 3
filtration := A.filtration
clause 4
adapted := by intro n k hk exact (A.adapted n k hk).const_mul (c n)
clause 5
squareIntegrable := by intro n k hk exact (A.squareIntegrable n k hk).const_mul (c n)
clause 6
condExp_zero := by intro n k hk have hlinear := condExp_smul (μ := μ n) (c n) (A.increment n k) (A.filtration n k) have hzero := A.condExp_zero n k hk have hfun : (fun ω => c n * A.increment n k ω)
= (c n) • A.increment n k := by funext ω simp [smul_eq_mul] rw [hfun] filter_upwards [hlinear, hzero] with ω hlinearω hzeroω rw [hlinearω] simp [hzeroω]
Causalean.Experimentation.DesignBased.scaleMartingaleDifferenceArray · Causalean/Experimentation/DesignBased/FinitePopulationCLT.lean:484 · uses MartingaleDifferenceArray
def standardizedSrsPermutationHajekArray reviewed
Causalean.Experimentation.DesignBased

Given sequences of population sizes, proper positive sample sizes, and finite-population outcomes, the standardized explicit Hájek martingale-difference array divides each reveal increment by the exact simple-random-sample standard deviation.

Definition (Lean source)
N K :
ℕ → ℕ
hKpos :
∀ n, 0 < K n
hKlt :
∀ n, K n < N n
y :
∀ n
if
Fin (N n)
then
ℝ
standardizedSrsPermutationHajekArray N K hKpos hKlt y :
MartingaleDifferenceArray (fun n => PermutationSampleSpace (N n)) (fun n => (uniformPermutationDesign (N n)).toMeasure)
scaleMartingaleDifferenceArray (srsPermutationHajekArray N K hKpos hKlt y) (fun n => (sqrt (srsSampleMeanVariance (N n) (K n) (y n)))⁻¹)
theorem standardizedSrsPermutationHajekArray_conditionalLindeberg reviewed
Causalean.Experimentation.DesignBased

Given nonempty finite populations, proper positive sample sizes, and population outcomes with positive variances, if the Li–Ding maximal-deviation sufficient-condition ratio tends to zero, then the standardized Hájek array satisfies the conditional Lindeberg condition.

Formal statement
N K :
ℕ → ℕ
∀ n, Nonempty (Fin (N n))
hKpos :
∀ n, 0 < K n
hKlt :
∀ n, K n < N n
y :
∀ n
if
Fin (N n)
then
ℝ
hvar :
∀ n, 0 < popVar (y n)
hmax :
Tendsto (fun n => popMaxSqDev (y n) / (((min (K n) (N n - K n) : ℕ) : ℝ) * popVar (y n))) atTop (nhds 0)
ε :
ℝ
0 < ε
Modes.TendstoInProbability (fun n => (uniformPermutationDesign (N n)).toMeasure) ((standardizedSrsPermutationHajekArray N K hKpos hKlt y).conditionalLindeberg ε) atTop (fun _ _ => 0)
Proof (Lean source)
theorem standardizedSrsPermutationHajekArray_conditionalLindeberg (N K : ℕ → ℕ) [hN : ∀ n, Nonempty (Fin (N n))] (hKpos : ∀ n, 0 < K n) (hKlt : ∀ n, K n < N n) (y : ∀ n, Fin (N n) → ℝ) (hvar : ∀ n, 0 < popVar (y n)) (hmax : Tendsto (fun n => popMaxSqDev (y n) / (((min (K n) (N n - K n) : ℕ) : ℝ) * popVar (y n))) atTop (nhds 0)) : ∀ ε : ℝ, 0 < ε → Modes.TendstoInProbability (fun n => (uniformPermutationDesign (N n)).toMeasure) ((standardizedSrsPermutationHajekArray N K hKpos hKlt y).conditionalLindeberg ε) atTop (fun _ _ => 0) := by apply conditionalLindeberg_tendstoInProbability_of_eventually_uniformly_small intro ε hε filter_upwards [standardizedPermutationHajekIncrement_eventually_uniformly_small N K hKpos hKlt y hvar hmax ε hε] with n hn intro k hk π change k < K n at hk rw [standardizedSrsPermutationHajekArray_increment N K hKpos hKlt y n k hk π] exact hn k hk π
theorem standardizedSrsPermutationHajekArray_rowSum reviewed
Causalean.Experimentation.DesignBased

Given sequences of population sizes, proper positive sample sizes, finite-population outcomes, and a row, the standardized Hájek array's row sum is the centered sample mean divided by its exact standard deviation.

Formal statement
N K :
ℕ → ℕ
hKpos :
∀ n, 0 < K n
hKlt :
∀ n, K n < N n
y :
∀ n
if
Fin (N n)
then
ℝ
n :
ℕ
(standardizedSrsPermutationHajekArray N K hKpos hKlt y).rowSum n
= fun π => (permutationSampleMean (K n) (hKlt n).le (y n) π - popMean (y n)) / sqrt (srsSampleMeanVariance (N n) (K n) (y n))
Proof (Lean source)
theorem standardizedSrsPermutationHajekArray_rowSum (N K : ℕ → ℕ) (hKpos : ∀ n, 0 < K n) (hKlt : ∀ n, K n < N n) (y : ∀ n, Fin (N n) → ℝ) (n : ℕ) : (standardizedSrsPermutationHajekArray N K hKpos hKlt y).rowSum n = fun π => (permutationSampleMean (K n) (hKlt n).le (y n) π - popMean (y n)) / sqrt (srsSampleMeanVariance (N n) (K n) (y n)) := by funext π unfold MartingaleDifferenceArray.rowSum standardizedSrsPermutationHajekArray scaleMartingaleDifferenceArray simp only [Finset.sum_apply, ← Finset.mul_sum] change (sqrt (srsSampleMeanVariance (N n) (K n) (y n)))⁻¹ * (∑ k ∈ range (K n), (srsPermutationHajekArray N K hKpos hKlt y).increment n k π) = _ rw [show (∑ k ∈ range (K n), (srsPermutationHajekArray N K hKpos hKlt y).increment n k π) = permutationSampleMean (K n) (hKlt n).le (y n) π - popMean (y n) by simpa [MartingaleDifferenceArray.rowSum, srsPermutationHajekArray] using congrFun (srsPermutationHajekArray_rowSum N K hKpos hKlt y n) π] rw [div_eq_mul_inv] ring
15 supporting declarations (lemmas, instances)
Difference­In­Means 2 core · 1 supporting This module reduces the complete-randomization difference in means to a simple-random-sample mean of Li and Ding's transformed finite population, then applies Hájek's finite-population CLT. ★ diffInMeans_clt

Finite-population CLT for difference in means

This module reduces the complete-randomization difference in means to a simple-random-sample mean of Li and Ding's transformed finite population, then applies Hájek's finite-population CLT.

def diffInMeansTransformedOutcome reviewed
Causalean.Experimentation.DesignBased

Given a population size, a natural-number count, and treated and control potential outcomes, the transformed finite-population outcome assigns each unit the formal weighted sum using weights given by the count and its truncated complement divided by the population size.

Definition (Lean source)
N K :
ℕ
Y1 Y0 :
Fin N → ℝ
diffInMeansTransformedOutcome N K Y1 Y0 :
Fin N → ℝ
fun i => ((N - K : ℕ) : ℝ) / (N : ℝ) * Y1 i + (K : ℝ) / (N : ℝ) * Y0 i
Causalean.Experimentation.DesignBased.diffInMeansTransformedOutcome · Causalean/Experimentation/DesignBased/FinitePopulationCLT/DifferenceInMeans.lean:29
theorem diffInMeans_clt reviewed
Causalean.Experimentation.DesignBased

Given population-size and treated-count sequences, positive treatment and control arm sizes, and fixed treated and control potential outcomes, if Li and Ding's transformed population has positive variance and satisfies their maximal-deviation condition, then the difference in means, centered at the finite- population average effect and divided by its exact randomization standard deviation, converges in distribution to the standard normal law.

Formal statement
N K :
ℕ → ℕ
∀ n, Nonempty (Fin (N n))
hKpos :
∀ n, 0 < K n
hKlt :
∀ n, K n < N n
Y1 Y0 :
∀ n
if
Fin (N n)
then
ℝ
hvar :
∀ n, 0 < popVar (diffInMeansTransformedOutcome (N n) (K n) (Y1 n) (Y0 n))
hmax :
Tendsto (fun n => popMaxSqDev (diffInMeansTransformedOutcome (N n) (K n) (Y1 n) (Y0 n)) / (((min (K n) (N n - K n) : ℕ) : ℝ) * popVar (diffInMeansTransformedOutcome (N n) (K n) (Y1 n) (Y0 n)))) atTop (nhds 0)
Modes.TendstoInLaw (fun n => (completeRandomization (V := Fin (N n)) (K n) (by simpa using (hKlt n).le)).toMeasure) (fun n S => (diffInMeans (K n) (Y1 n) (Y0 n) S - sateEstimand (Y1 n) (Y0 n)) / sqrt ((completeRandomization (V := Fin (N n)) (K n) (by simpa using (hKlt n).le)).Var (diffInMeans (K n) (Y1 n) (Y0 n)))) atTop (gaussianReal 0 1)
Proof (Lean source)
theorem diffInMeans_clt (N K : ℕ → ℕ) [∀ n, Nonempty (Fin (N n))] (hKpos : ∀ n, 0 < K n) (hKlt : ∀ n, K n < N n) (Y1 Y0 : ∀ n, Fin (N n) → ℝ) (hvar : ∀ n, 0 < popVar (diffInMeansTransformedOutcome (N n) (K n) (Y1 n) (Y0 n))) (hmax : Tendsto (fun n => popMaxSqDev (diffInMeansTransformedOutcome (N n) (K n) (Y1 n) (Y0 n)) / (((min (K n) (N n - K n) : ℕ) : ℝ) * popVar (diffInMeansTransformedOutcome (N n) (K n) (Y1 n) (Y0 n)))) atTop (nhds 0)) : Modes.TendstoInLaw (fun n => (completeRandomization (V := Fin (N n)) (K n) (by simpa using (hKlt n).le)).toMeasure) (fun n S => (diffInMeans (K n) (Y1 n) (Y0 n) S - sateEstimand (Y1 n) (Y0 n)) / sqrt ((completeRandomization (V := Fin (N n)) (K n) (by simpa using (hKlt n).le)).Var (diffInMeans (K n) (Y1 n) (Y0 n)))) atTop (gaussianReal 0 1) := by let w := fun n => diffInMeansTransformedOutcome (N n) (K n) (Y1 n) (Y0 n) have hclt := completeRandomization_sampleMean_clt N K hKpos hKlt w hvar hmax have hstat : ∀ n, (fun S => (diffInMeans (K n) (Y1 n) (Y0 n) S - sateEstimand (Y1 n) (Y0 n)) / sqrt ((completeRandomization (V := Fin (N n)) (K n) (by simpa using (hKlt n).le)).Var (diffInMeans (K n) (Y1 n) (Y0 n)))) = (fun S => (sampleMean (K n) (w n) S - popMean (w n)) / sqrt (srsSampleMeanVariance (N n) (K n) (w n))) := by intro n funext S exact standardized_diffInMeans_eq_standardized_sampleMean (hKpos n) (hKlt n) (Y1 n) (Y0 n) (hvar n) S refine ⟨fun _ => (measurable_of_finite _).aemeasurable, hclt.aemeasurable_limit, ?_⟩ simpa only [hstat] using hclt.tendsto
1 supporting declaration (lemmas, instances)
Neyman­Coverage 1 core · 0 supporting This module combines the finite-population difference-in-means CLT with consistency of the two arm sample variances and the generic feasible Wald transfer theorem. ★ diffInMeans_neyman_coverage

Feasible Neyman coverage under complete randomization

This module combines the finite-population difference-in-means CLT with consistency of the two arm sample variances and the generic feasible Wald transfer theorem. The resulting random Neyman interval has asymptotic coverage at least its nominal level.

theorem diffInMeans_neyman_coverage reviewed
Causalean.Experimentation.DesignBased

Given population-size and treated-count sequences with at least two units in each arm, and fixed treated and control potential outcomes, suppose Li and Ding's transformed population is nondegenerate and satisfies their maximal-deviation condition. If both arm sizes diverge, the arm variances converge to finite limits, the armwise maximal deviations vanish at their sampling rates, the reciprocal allocation fractions converge to finite limits, and the scaled exact variance converges to a positive limit, then the feasible Neyman interval formed with the separate-arm variance estimator has coverage liminf at least 1-α for a nonnegative standard-normal quantile.

Formal statement
N K :
ℕ → ℕ
∀ n, Nonempty (Fin (N n))
hK2 :
∀ n, 2 ≤ K n
hKlt :
∀ n, K n < N n
hL2 :
∀ n, 2 ≤ N n - K n
Y1 Y0 :
∀ n
if
Fin (N n)
then
ℝ
htransVar :
∀ n, 0 < popVar (diffInMeansTransformedOutcome (N n) (K n) (Y1 n) (Y0 n))
htransMax :
Tendsto (fun n => popMaxSqDev (diffInMeansTransformedOutcome (N n) (K n) (Y1 n) (Y0 n)) / (((min (K n) (N n - K n) : ℕ) : ℝ) * popVar (diffInMeansTransformedOutcome (N n) (K n) (Y1 n) (Y0 n)))) atTop (nhds 0)
v1 v0 c1 c0 v :
ℝ
hv :
0 < v
hKTop :
hLTop :
Tendsto (fun n => N n - K n) atTop atTop
hvar1 :
Tendsto (fun n => popVar (Y1 n)) atTop (nhds v1)
hvar0 :
Tendsto (fun n => popVar (Y0 n)) atTop (nhds v0)
hmax1 :
Tendsto (fun n => popMaxSqDev (Y1 n) / (K n : ℝ)) atTop (nhds 0)
hmax0 :
Tendsto (fun n => popMaxSqDev (Y0 n) / ((N n - K n : ℕ) : ℝ)) atTop (nhds 0)
hc1 :
Tendsto (fun n => (N n : ℝ) / (K n : ℝ)) atTop (nhds c1)
hc0 :
Tendsto (fun n => (N n : ℝ) / ((N n - K n : ℕ) : ℝ)) atTop (nhds c0)
htrue :
Tendsto (fun n => (N n : ℝ) * (completeRandomization (V := Fin (N n)) (K n) (by simpa using (hKlt n).le)).Var (diffInMeans (K n) (Y1 n) (Y0 n))) atTop (nhds v)
α z :
ℝ
hz0 :
0 ≤ z
hz :
stdNormalCdf z = 1 - α / 2
1 - α
≤ liminf (fun n => (completeRandomization (V := Fin (N n)) (K n) (by simpa using (hKlt n).le)).Pr (fun S => |sateEstimand (Y1 n) (Y0 n) - diffInMeans (K n) (Y1 n) (Y0 n) S| ≤ z * sqrt (DifferenceInMeans.varianceEstimator (K n) (Y1 n) (Y0 n) S))) atTop
Proof (Lean source)
theorem diffInMeans_neyman_coverage (N K : ℕ → ℕ) [∀ n, Nonempty (Fin (N n))] (hK2 : ∀ n, 2 ≤ K n) (hKlt : ∀ n, K n < N n) (hL2 : ∀ n, 2 ≤ N n - K n) (Y1 Y0 : ∀ n, Fin (N n) → ℝ) (htransVar : ∀ n, 0 < popVar (diffInMeansTransformedOutcome (N n) (K n) (Y1 n) (Y0 n))) (htransMax : Tendsto (fun n => popMaxSqDev (diffInMeansTransformedOutcome (N n) (K n) (Y1 n) (Y0 n)) / (((min (K n) (N n - K n) : ℕ) : ℝ) * popVar (diffInMeansTransformedOutcome (N n) (K n) (Y1 n) (Y0 n)))) atTop (nhds 0)) (v1 v0 c1 c0 v : ℝ) (hv : 0 < v) (hKTop : Tendsto K atTop atTop) (hLTop : Tendsto (fun n => N n - K n) atTop atTop) (hvar1 : Tendsto (fun n => popVar (Y1 n)) atTop (nhds v1)) (hvar0 : Tendsto (fun n => popVar (Y0 n)) atTop (nhds v0)) (hmax1 : Tendsto (fun n => popMaxSqDev (Y1 n) / (K n : ℝ)) atTop (nhds 0)) (hmax0 : Tendsto (fun n => popMaxSqDev (Y0 n) / ((N n - K n : ℕ) : ℝ)) atTop (nhds 0)) (hc1 : Tendsto (fun n => (N n : ℝ) / (K n : ℝ)) atTop (nhds c1)) (hc0 : Tendsto (fun n => (N n : ℝ) / ((N n - K n : ℕ) : ℝ)) atTop (nhds c0)) (htrue : Tendsto (fun n => (N n : ℝ) * (completeRandomization (V := Fin (N n)) (K n) (by simpa using (hKlt n).le)).Var (diffInMeans (K n) (Y1 n) (Y0 n))) atTop (nhds v)) (α z : ℝ) (hz0 : 0 ≤ z) (hz : stdNormalCdf z = 1 - α / 2) : 1 - α ≤ liminf (fun n => (completeRandomization (V := Fin (N n)) (K n) (by simpa using (hKlt n).le)).Pr (fun S => |sateEstimand (Y1 n) (Y0 n) - diffInMeans (K n) (Y1 n) (Y0 n) S| ≤ z * sqrt (DifferenceInMeans.varianceEstimator (K n) (Y1 n) (Y0 n) S))) atTop := by let D := fun n => completeRandomization (V := Fin (N n)) (K n) (by simpa using (hKlt n).le) let est := fun n => diffInMeans (K n) (Y1 n) (Y0 n) let θ := fun n => sateEstimand (Y1 n) (Y0 n) let trueVar := fun n => (D n).Var (est n) let vhat := fun n => DifferenceInMeans.varianceEstimator (K n) (Y1 n) (Y0 n) have hKpos : ∀ n, 0 < K n := fun n => lt_of_lt_of_le (by norm_num) (hK2 n) have hscaled := scaledN_varianceEstimator_tendstoInProb N K hK2 hKlt hL2 Y1 Y0 v1 v0 c1 c0 hKTop hLTop hvar1 hvar0 hmax1 hmax0 hc1 hc0 have hunder := varianceEstimator_undershoot_tendsto_zero N K hK2 hKlt hL2 Y1 Y0 v hv hscaled htrue have hdist := diffInMeans_clt N K hKpos hKlt Y1 Y0 htransVar htransMax have hcdf0 := finiteDesign_cdf_of_tendstoInDistribution D (fun n S => (est n S - θ n) / sqrt (trueVar n)) hdist have hcdf : ∀ t : ℝ, Tendsto (fun n => (D n).Pr (fun S => sqrt (1 : ℝ) * (est n S - θ n) / sqrt (trueVar n) ≤ t)) atTop (nhds (stdNormalCdf t)) := by intro t simpa using hcdf0 t have hvarpos : ∀ n, 0 < trueVar n := by intro n have hfactor : (0 : ℝ) < 1 / (K n : ℝ) - 1 / (N n : ℝ) := by exact sub_pos.mpr (one_div_lt_one_div_of_lt (by exact_mod_cast hKpos n) (by exact_mod_cast hKlt n)) have hsrs : 0 < srsSampleMeanVariance (N n) (K n) (diffInMeansTransformedOutcome (N n) (K n) (Y1 n) (Y0 n)) := srsSampleMeanVariance_pos (hKpos n) (hKlt n) (htransVar n) dsimp only [trueVar, D, est] rw [Var_diffInMeans_eq_scaled_srsSampleMeanVariance (hKpos n) (hKlt n)] have hc : (0 : ℝ) < (N n : ℝ) / ((N n - K n : ℕ) : ℝ) := by have hN : 0 < N n := (hKpos n).trans (hKlt n) have hL : 0 < N n - K n := Nat.sub_pos_of_lt (hKlt n) positivity exact mul_pos (sq_pos_of_pos hc) hsrs have hcov := conservative_wald_liminf_of_feasible_studentized_cdf D est θ trueVar (fun _ => 1) vhat (fun _ => one_pos) hvarpos hunder α z hcdf hz0 hz simpa only [D, est, θ, trueVar, vhat, div_one] using hcov
Permutation­Transport 3 core · 5 supporting This module identifies the unordered first K entries of a uniform permutation with complete randomization on size-K subsets. ★ uniformPermutationDesign_map_prefixSet_eq_completeRandomization

Transport from permutation prefixes to simple random samples

This module identifies the unordered first K entries of a uniform permutation with complete randomization on size-K subsets. It then transports the exact expectation and variance of a simple-random-sample mean to the ordered prefix representation.

def permutationPrefixBase reviewed
Causalean.Experimentation.DesignBased

Given a feasible prefix length, the canonical size-K subset of the first positions consists of the indices 0, ..., K - 1.

Definition (Lean source)
N :
ℕ
K :
ℕ
hK :
K ≤ N
permutationPrefixBase K hK :
⟨Finset.univ.image (fun i : Fin K => castLE hK i), by change (Finset.univ.image (fun i : Fin K => castLE hK i)).card
= K rw [Finset.card_image_iff.mpr] · simp · intro i _ j _ hij apply Fin.ext exact congrArg (fun x : Fin N => x.val) hij⟩
Causalean.Experimentation.DesignBased.permutationPrefixBase · Causalean/Experimentation/DesignBased/FinitePopulationCLT/PermutationTransport.lean:106
def permutationPrefixSet reviewed
Causalean.Experimentation.DesignBased

Given a feasible prefix length and an ordering, the unordered prefix set contains exactly the population indices in the first K positions of the ordering.

Definition (Lean source)
N :
ℕ
K :
ℕ
hK :
K ≤ N
permutationPrefixSet K hK π :
{S : Finset (Fin N) // S.card = K}
⟨Finset.univ.image (fun i : Fin K => π (castLE hK i)), by rw [Finset.card_image_iff.mpr] · simp · intro i _ j _ hij apply Fin.ext exact congrArg (fun x : Fin N => x.val) (π.injective hij)⟩
theorem uniformPermutationDesign_map_prefixSet_eq_completeRandomization reviewed
Causalean.Experimentation.DesignBased

Given a feasible sample size, the unordered first-K prefix of a uniform permutation has exactly the complete-randomization law.

Formal statement
N :
ℕ
K :
ℕ
hK :
K ≤ N
Proof (Lean source)
theorem uniformPermutationDesign_map_prefixSet_eq_completeRandomization {N : ℕ} (K : ℕ) (hK : K ≤ N) : (uniformPermutationDesign N).map (permutationPrefixSet K hK) = completeRandomization (V := Fin N) K (by simpa using hK) := by classical letI : MulAction (Perm (Fin N)) {S : Finset (Fin N) // S.card = K} := inferInstanceAs (MulAction (Perm (Fin N)) (powersetCard (Fin N) K)) letI : MulAction.IsPretransitive (Perm (Fin N)) {S : Finset (Fin N) // S.card = K} := Set.powersetCard.isPretransitive let x : {S : Finset (Fin N) // S.card = K} := ⟨(permutationPrefixBase K hK).val, (permutationPrefixBase K hK).property⟩ apply FiniteDesign.eq_of_p_eq funext S have hp := uniformOrbit_p (uniformPermutationDesign N) (fun π => by rfl) x S have hfun : (fun π : PermutationSampleSpace N => π • x) = permutationPrefixSet K hK := by funext π exact (permutationPrefixSet_eq_smul K hK π).symm rw [hfun] at hp change ((uniformPermutationDesign N).map (permutationPrefixSet K hK)).p S = (completeRandomization (V := Fin N) K (by simpa using hK)).p S exact hp
5 supporting declarations (lemmas, instances)
Predictable­Variance 1 core · 2 supporting This module identifies the predictable quadratic variation of the explicit finite-population Hájek array. ★ standardizedSrsPermutationHajekArray_predictableQuadraticVariation_ae_eq

Predictable variance of the Hájek reveal martingale

This module identifies the predictable quadratic variation of the explicit finite-population Hájek array. The resulting formula is the starting point for the remaining concentration estimate in the finite-population central limit theorem.

theorem standardizedSrsPermutationHajekArray_predictableQuadraticVariation_ae_eq reviewed
Causalean.Experimentation.DesignBased

Given sequences of population sizes, proper positive sample sizes, finite-population outcomes with positive variances, and a row, the standardized array's predictable quadratic variation is the unstandardized predictable quadratic variation divided by the exact sample-mean variance almost everywhere.

Formal statement
N K :
ℕ → ℕ
hKpos :
∀ n, 0 < K n
hKlt :
∀ n, K n < N n
y :
∀ n
if
Fin (N n)
then
ℝ
hvar :
∀ n, 0 < popVar (y n)
n :
ℕ
Proof (Lean source)
theorem standardizedSrsPermutationHajekArray_predictableQuadraticVariation_ae_eq (N K : ℕ → ℕ) (hKpos : ∀ n, 0 < K n) (hKlt : ∀ n, K n < N n) (y : ∀ n, Fin (N n) → ℝ) (hvar : ∀ n, 0 < popVar (y n)) (n : ℕ) : (standardizedSrsPermutationHajekArray N K hKpos hKlt y).predictableQuadraticVariation n =ᵐ[(uniformPermutationDesign (N n)).toMeasure] fun π => (srsPermutationHajekArray N K hKpos hKlt y).predictableQuadraticVariation n π / srsSampleMeanVariance (N n) (K n) (y n) := by have hKR : (0 : ℝ) < K n := by exact_mod_cast hKpos n have hNR : (0 : ℝ) < N n := by exact_mod_cast (hKpos n).trans (hKlt n) have hspos : 0 < srsSampleMeanVariance (N n) (K n) (y n) := srsSampleMeanVariance_pos (hKpos n) (hKlt n) (hvar n) have hscale := scaleMartingaleDifferenceArray_predictableQuadraticVariation_ae_eq (srsPermutationHajekArray N K hKpos hKlt y) (fun r => (sqrt (srsSampleMeanVariance (N r) (K r) (y r)))⁻¹) n filter_upwards [hscale] with π hπ rw [show MartingaleDifferenceArray.predictableQuadraticVariation (standardizedSrsPermutationHajekArray N K hKpos hKlt y) n π = (sqrt (srsSampleMeanVariance (N n) (K n) (y n)))⁻¹ ^ 2 * MartingaleDifferenceArray.predictableQuadraticVariation (srsPermutationHajekArray N K hKpos hKlt y) n π by simpa [standardizedSrsPermutationHajekArray] using hπ] rw [inv_pow, Real.sq_sqrt hspos.le] ring
2 supporting declarations (lemmas, instances)
Predictable­Variance­Concentration 2 core · 4 supporting This module expands the standardized Hájek predictable quadratic variation into the two weighted prefix processes controlled by the finite-population moment estimates. ★ standardizedSrsPermutationHajekArray_predictableQuadraticVariation_tendstoInProbability

Concentration of the predictable variance

This module expands the standardized Hájek predictable quadratic variation into the two weighted prefix processes controlled by the finite-population moment estimates.

def srsPredictableVarianceExpression reviewed
Causalean.Experimentation.DesignBased

Given a population size, a proper sample size, population outcomes, and an ordering, the explicit standardized predictable-variance expression is the weighted sum of the remaining centered-square mean minus the squared remaining centered mean.

Definition (Lean source)
N K :
ℕ
hKlt :
K < N
y :
Fin N → ℝ
srsPredictableVarianceExpression N K hKlt y π :
ℝ
((((N - K : ℕ) : ℝ) * (N : ℝ)) / ((K : ℝ) * popVar y)) * ∑ k ∈ range K, if hk : k < K then (((∑ i : Fin N, (y i - popMean y) ^ 2) - permutationRevealedSum (fun i => (y i - popMean y) ^ 2) k (hk.le.trans hKlt.le) π) / (((N - k : ℕ) : ℝ) * ((N - k - 1 : ℕ) : ℝ) ^ 2) - (permutationRevealedSum (fun i => y i - popMean y) k (hk.le.trans hKlt.le) π) ^ 2 / (((N - k : ℕ) : ℝ) ^ 2 * ((N - k - 1 : ℕ) : ℝ) ^ 2)) else 0
theorem standardizedSrsPermutationHajekArray_predictableQuadraticVariation_tendstoInProbability reviewed
Causalean.Experimentation.DesignBased

Given population-size and sample-size sequences, positive proper sample sizes, and population outcomes with positive variances, if the Li–Ding maximal-deviation sufficient-condition ratio tends to zero, then the standardized Hájek array's predictable quadratic variation converges in probability to one.

Formal statement
N K :
ℕ → ℕ
∀ n, Nonempty (Fin (N n))
hKpos :
∀ n, 0 < K n
hKlt :
∀ n, K n < N n
y :
∀ n
if
Fin (N n)
then
ℝ
hvar :
∀ n, 0 < popVar (y n)
hmax :
Tendsto (fun n => popMaxSqDev (y n) / (((min (K n) (N n - K n) : ℕ) : ℝ) * popVar (y n))) atTop (nhds 0)
Modes.TendstoInProbability (fun n => (uniformPermutationDesign (N n)).toMeasure) (standardizedSrsPermutationHajekArray N K hKpos hKlt y).predictableQuadraticVariation atTop (fun _ _ => 1)
Proof (Lean source)
theorem standardizedSrsPermutationHajekArray_predictableQuadraticVariation_tendstoInProbability (N K : ℕ → ℕ) [∀ n, Nonempty (Fin (N n))] (hKpos : ∀ n, 0 < K n) (hKlt : ∀ n, K n < N n) (y : ∀ n, Fin (N n) → ℝ) (hvar : ∀ n, 0 < popVar (y n)) (hmax : Tendsto (fun n => popMaxSqDev (y n) / (((min (K n) (N n - K n) : ℕ) : ℝ) * popVar (y n))) atTop (nhds 0)) : Modes.TendstoInProbability (fun n => (uniformPermutationDesign (N n)).toMeasure) (standardizedSrsPermutationHajekArray N K hKpos hKlt y).predictableQuadraticVariation atTop (fun _ _ => 1) := by have hexpr := srsPredictableVarianceExpression_tendstoInProbability N K hKpos hKlt y hvar hmax rw [Modes.tendstoInProbability_iff_norm] at hexpr ⊢ simp only [Real.norm_eq_abs] at hexpr ⊢ intro ε hε have heq := standardizedSrsPermutationHajekArray_predictableQuadraticVariation_ae_eq_expression N K hKpos hKlt y hvar have hmeasure : ∀ n, (uniformPermutationDesign (N n)).toMeasure {π | ε ≤ |((standardizedSrsPermutationHajekArray N K hKpos hKlt y).predictableQuadraticVariation) n π - 1|} = (uniformPermutationDesign (N n)).toMeasure {π | ε ≤ |srsPredictableVarianceExpression (N n) (K n) (hKlt n) (y n) π - 1|} := by intro n apply measure_congr filter_upwards [heq n] with π hπ change (ε ≤ |((standardizedSrsPermutationHajekArray N K hKpos hKlt y).predictableQuadraticVariation) n π - 1|) = (ε ≤ |srsPredictableVarianceExpression (N n) (K n) (hKlt n) (y n) π - 1|) rw [hπ] simp_rw [hmeasure] exact hexpr ε hε
4 supporting declarations (lemmas, instances)
Predictable­Variance­Moments 1 core · 6 supporting This module gives exact second moments and an absolute first-moment bound for centered prefix sums of a uniform permutation, together with the remaining-variance identity used in Hájek’s finite-population martingale. ★ permutationNextVariance_eq_revealedSums

Moment bounds for permutation prefixes

This module gives exact second moments and an absolute first-moment bound for centered prefix sums of a uniform permutation, together with the remaining-variance identity used in Hájek’s finite-population martingale.

lemma permutationNextVariance_eq_revealedSums reviewed
Causalean.Experimentation.DesignBased

Given population outcomes, a valid reveal time, and an ordering, the next-draw conditional variance equals the remaining centered-square mean minus the squared remaining centered mean.

Formal statement
N :
ℕ
Nonempty (Fin N)
y :
Fin N → ℝ
k :
ℕ
hk :
k < N
= ((∑ i : Fin N, (y i - popMean y) ^ 2) - permutationRevealedSum (fun i => (y i - popMean y) ^ 2) k hk.le π) / ((N - k : ℕ) : ℝ)
- (permutationRevealedSum (fun i => y i - popMean y) k hk.le π / ((N - k : ℕ) : ℝ)) ^ 2
Proof (Lean source)
lemma permutationNextVariance_eq_revealedSums {N : ℕ} [Nonempty (Fin N)] (y : Fin N → ℝ) (k : ℕ) (hk : k < N) (π : PermutationSampleSpace N) : permutationNextVariance y k hk π = ((∑ i : Fin N, (y i - popMean y) ^ 2) - permutationRevealedSum (fun i => (y i - popMean y) ^ 2) k hk.le π) / ((N - k : ℕ) : ℝ) - (permutationRevealedSum (fun i => y i - popMean y) k hk.le π / ((N - k : ℕ) : ℝ)) ^ 2 := by rw [← permutationNextVariance_centered y k hk π, permutationNextVariance_eq_remainingSecondMoment] unfold permutationRemainingSum have hsumSq : (∑ i : Fin N, (fun i => (y i - popMean y) ^ 2) (π i)) = ∑ i : Fin N, (y i - popMean y) ^ 2 := by simpa using Equiv.sum_comp π (fun i : Fin N => (y i - popMean y) ^ 2) have hsum : (∑ i : Fin N, (fun i => y i - popMean y) (π i)) = ∑ i : Fin N, (y i - popMean y) := by simpa using Equiv.sum_comp π (fun i : Fin N => y i - popMean y) rw [hsumSq, hsum, sum_centered] simp only [zero_sub, neg_div, neg_sq]
6 supporting declarations (lemmas, instances)
Predictable­Variance­Weights 1 core · 2 supporting This module proves the two weighted prefix-moment estimates in Hájek’s predictable-variance argument. ★ predictableVariance_secondWeightedEstimate

Weighted predictable-variance estimates

This module proves the two weighted prefix-moment estimates in Hájek’s predictable-variance argument. The bounds are uniform in the allocation fraction by working through the smaller arm.

lemma predictableVariance_secondWeightedEstimate reviewed
Causalean.Experimentation.DesignBased

Given a population size, a positive proper sample size, population outcomes, and their positive variance, the weighted expected squares of the centered revealed sums are at most twice the inverse complementary-arm size.

Formal statement
N :
ℕ
Nonempty (Fin N)
K :
ℕ
hKpos :
0 < K
hKlt :
K < N
y :
Fin N → ℝ
hvar :
0 < popVar y
((((N - K : ℕ) : ℝ) * (N : ℝ)) / ((K : ℝ) * popVar y)) * (∑ k ∈ range K, (∫ π, (permutationRevealedSum (fun i => y i - popMean y) (min k N) (min_le_right k N) π) ^ 2 ∂(uniformPermutationDesign N).toMeasure) / (((N - k : ℕ) : ℝ) ^ 2 * ((N - k - 1 : ℕ) : ℝ) ^ 2))
≤ 2 / ((N - K : ℕ) : ℝ)
Proof (Lean source)
lemma predictableVariance_secondWeightedEstimate {N : ℕ} [Nonempty (Fin N)] (K : ℕ) (hKpos : 0 < K) (hKlt : K < N) (y : Fin N → ℝ) (hvar : 0 < popVar y) : ((((N - K : ℕ) : ℝ) * (N : ℝ)) / ((K : ℝ) * popVar y)) * (∑ k ∈ range K, (∫ π, (permutationRevealedSum (fun i => y i - popMean y) (min k N) (min_le_right k N) π) ^ 2 ∂(uniformPermutationDesign N).toMeasure) / (((N - k : ℕ) : ℝ) ^ 2 * ((N - k - 1 : ℕ) : ℝ) ^ 2)) ≤ 2 / ((N - K : ℕ) : ℝ) := by have hN : 2 ≤ N := by omega have hKR : (0 : ℝ) < K := by exact_mod_cast hKpos have hNR : (0 : ℝ) < N := by exact_mod_cast hKpos.trans hKlt have hvR : popVar y ≠ 0 := hvar.ne' have heq : ((((N - K : ℕ) : ℝ) * (N : ℝ)) / ((K : ℝ) * popVar y)) * (∑ k ∈ range K, (∫ π, (permutationRevealedSum (fun i => y i - popMean y) (min k N) (min_le_right k N) π) ^ 2 ∂(uniformPermutationDesign N).toMeasure) / (((N - k : ℕ) : ℝ) ^ 2 * ((N - k - 1 : ℕ) : ℝ) ^ 2)) = (((N - K : ℕ) : ℝ) / (K : ℝ)) * (∑ k ∈ range K, (k : ℝ) / (((N - k : ℕ) : ℝ) * ((N - k - 1 : ℕ) : ℝ) ^ 2)) := by rw [Finset.mul_sum, Finset.mul_sum] apply Finset.sum_congr rfl intro k hk have hk' := Finset.mem_range.mp hk have hmink : min k N = k := min_eq_left (hk'.le.trans hKlt.le) simp only [hmink] by_cases hk0 : k = 0 · subst k simp [permutationRevealedSum] · rw [integral_centered_revealedSum_sq y k (hk'.le.trans hKlt.le) (Nat.pos_of_ne_zero hk0) hN] have hR : (0 : ℝ) < (N - k : ℕ) := by exact_mod_cast Nat.sub_pos_of_lt (hk'.trans hKlt) have hRm : (0 : ℝ) < (N - k - 1 : ℕ) := by have hksN : k + 1 < N := (Nat.succ_le_iff.mpr hk').trans_lt hKlt rw [Nat.sub_sub] exact_mod_cast Nat.sub_pos_of_lt hksN field_simp [ne_of_gt hKR, ne_of_gt hNR, ne_of_gt hR, ne_of_gt hRm, hvR] rw [Nat.cast_sub (hk'.trans hKlt).le] rw [heq] exact second_weight N K hKpos hKlt
2 supporting declarations (lemmas, instances)
  • predictableVariance_deterministicBaseline lemma — Given a population size, a positive proper sample size, and a positive finite-population variance, the deterministic mean terms in the standardized predictable-variance expansion sum exactly to one.
    N K :
    ℕ
    hKpos :
    0 < K
    hKlt :
    K < N
    v :
    ℝ
    hv :
    0 < v
    ((((N - K : ℕ) : ℝ) * (N : ℝ)) / ((K : ℝ) * v)) * (∑ k ∈ range K, ((((N - 1 : ℕ) : ℝ) * v - (k : ℝ) * (((N - 1 : ℕ) : ℝ) * v) / (N : ℝ)) / (((N - k : ℕ) : ℝ) * ((N - k - 1 : ℕ) : ℝ) ^ 2) - (((k : ℕ) : ℝ) * ((N - k : ℕ) : ℝ) / (N : ℝ) * v) / (((N - k : ℕ) : ℝ) ^ 2 * ((N - k - 1 : ℕ) : ℝ) ^ 2)))
    = 1
    Proof (Lean source)
    lemma predictableVariance_deterministicBaseline (N K : ℕ) (hKpos : 0 < K) (hKlt : K < N) (v : ℝ) (hv : 0 < v) : ((((N - K : ℕ) : ℝ) * (N : ℝ)) / ((K : ℝ) * v)) * (∑ k ∈ range K, ((((N - 1 : ℕ) : ℝ) * v - (k : ℝ) * (((N - 1 : ℕ) : ℝ) * v) / (N : ℝ)) / (((N - k : ℕ) : ℝ) * ((N - k - 1 : ℕ) : ℝ) ^ 2) - (((k : ℕ) : ℝ) * ((N - k : ℕ) : ℝ) / (N : ℝ) * v) / (((N - k : ℕ) : ℝ) ^ 2 * ((N - k - 1 : ℕ) : ℝ) ^ 2))) = 1 := by have hterm : ∀ k ∈ range K, ((((N - 1 : ℕ) : ℝ) * v - (k : ℝ) * (((N - 1 : ℕ) : ℝ) * v) / (N : ℝ)) / (((N - k : ℕ) : ℝ) * ((N - k - 1 : ℕ) : ℝ) ^ 2) - (((k : ℕ) : ℝ) * ((N - k : ℕ) : ℝ) / (N : ℝ) * v) / (((N - k : ℕ) : ℝ) ^ 2 * ((N - k - 1 : ℕ) : ℝ) ^ 2)) = v / (((N - k : ℕ) : ℝ) * ((N - k - 1 : ℕ) : ℝ)) := by intro k hk have hk' := Finset.mem_range.mp hk have hNR : (N : ℝ) ≠ 0 := by exact_mod_cast (hKpos.trans hKlt).ne' have hR : ((N - k : ℕ) : ℝ) ≠ 0 := by exact_mod_cast (Nat.sub_pos_of_lt (hk'.trans hKlt)).ne' have hRmNat : 0 < N - k - 1 := by rw [Nat.sub_sub] exact Nat.sub_pos_of_lt ((Nat.succ_le_iff.mpr hk').trans_lt hKlt) have hRm : ((N - k - 1 : ℕ) : ℝ) ≠ 0 := by exact_mod_cast hRmNat.ne' rw [Nat.cast_sub (by omega : 1 ≤ N)] have hcastR : ((N - k : ℕ) : ℝ) = (N : ℝ) - (k : ℝ) := Nat.cast_sub (hk'.trans hKlt).le have hcastRm : ((N - k - 1 : ℕ) : ℝ) = (N : ℝ) - (k : ℝ) - 1 := by rw [Nat.cast_sub (by omega : 1 ≤ N - k), hcastR] norm_num rw [hcastR, hcastRm] have hR' : (N : ℝ) - (k : ℝ) ≠ 0 := by exact sub_ne_zero.mpr (by exact_mod_cast (ne_of_gt (hk'.trans hKlt))) have hRm' : (N : ℝ) - (k : ℝ) - 1 ≠ 0 := by have hksNR : (k : ℝ) + 1 < N := by exact_mod_cast ((Nat.succ_le_iff.mpr hk').trans_lt hKlt) linarith field_simp [hNR, hR', hRm'] ring rw [Finset.sum_congr rfl hterm] simp_rw [div_eq_mul_inv v] rw [← Finset.mul_sum] rw [show (∑ i ∈ range K, (((N - i : ℕ) : ℝ) * ((N - i - 1 : ℕ) : ℝ))⁻¹) = (K : ℝ) / (((N - K : ℕ) : ℝ) * (N : ℝ)) by simpa only [one_div] using sum_inv_product N K hKlt] have hKR : (K : ℝ) ≠ 0 := by exact_mod_cast hKpos.ne' have hLR : ((N - K : ℕ) : ℝ) ≠ 0 := by exact_mod_cast (Nat.sub_pos_of_lt hKlt).ne' have hNR : (N : ℝ) ≠ 0 := by exact_mod_cast (hKpos.trans hKlt).ne' field_simp [hKR, hLR, hNR, hv.ne']
    Causalean.Experimentation.DesignBased.predictableVariance_deterministicBaseline · Causalean/Experimentation/DesignBased/FinitePopulationCLT/PredictableVarianceWeights.lean:382
  • predictableVariance_firstWeightedEstimate lemma — Given a population size, a positive proper sample size, population outcomes, and their positive variance, the weighted expected absolute fluctuations of the revealed centered-square sums are bounded by four times the square root of the Li–Ding maximal-deviation sufficient-condition ratio.
    N :
    ℕ
    Nonempty (Fin N)
    K :
    ℕ
    hKpos :
    0 < K
    hKlt :
    K < N
    y :
    Fin N → ℝ
    hvar :
    0 < popVar y
    ((((N - K : ℕ) : ℝ) * (N : ℝ)) / ((K : ℝ) * popVar y)) * (∑ k ∈ range K, (∫ π, |permutationRevealedSum (fun i => (y i - popMean y) ^ 2) (min k N) (min_le_right k N) π - (k : ℝ) * popMean (fun i => (y i - popMean y) ^ 2)| ∂(uniformPermutationDesign N).toMeasure) / (((N - k : ℕ) : ℝ) * ((N - k - 1 : ℕ) : ℝ) ^ 2))
    ≤ 4 * sqrt (popMaxSqDev y / (((min K (N - K) : ℕ) : ℝ) * popVar y))
    Proof (Lean source)
    lemma predictableVariance_firstWeightedEstimate {N : ℕ} [Nonempty (Fin N)] (K : ℕ) (hKpos : 0 < K) (hKlt : K < N) (y : Fin N → ℝ) (hvar : 0 < popVar y) : ((((N - K : ℕ) : ℝ) * (N : ℝ)) / ((K : ℝ) * popVar y)) * (∑ k ∈ range K, (∫ π, |permutationRevealedSum (fun i => (y i - popMean y) ^ 2) (min k N) (min_le_right k N) π - (k : ℝ) * popMean (fun i => (y i - popMean y) ^ 2)| ∂(uniformPermutationDesign N).toMeasure) / (((N - k : ℕ) : ℝ) * ((N - k - 1 : ℕ) : ℝ) ^ 2)) ≤ 4 * sqrt (popMaxSqDev y / (((min K (N - K) : ℕ) : ℝ) * popVar y)) := by have hN : 2 ≤ N := by omega have hM : 0 ≤ popMaxSqDev y := by let i : Fin N := choice (inferInstance : Nonempty (Fin N)) exact (sq_nonneg (y i - popMean y)).trans (by unfold popMaxSqDev exact Finset.le_sup' (fun j : Fin N => (y j - popMean y) ^ 2) (Finset.mem_univ i)) have hscale : 0 ≤ (((N - K : ℕ) : ℝ) * (N : ℝ)) / ((K : ℝ) * popVar y) := by positivity apply (mul_le_mul_of_nonneg_left (Finset.sum_le_sum fun k hk ↦ ?_) hscale).trans (first_weight N K hKpos hKlt (popMaxSqDev y) (popVar y) hM hvar) have hk' := Finset.mem_range.mp hk have hmink : min k N = k := min_eq_left (hk'.le.trans hKlt.le) simp only [hmink] have hden : 0 ≤ (((N - k : ℕ) : ℝ) * ((N - k - 1 : ℕ) : ℝ) ^ 2) := by positivity apply div_le_div_of_nonneg_right _ hden by_cases hk0 : k = 0 · subst k simp [permutationRevealedSum] · exact integral_abs_centeredSq_revealedSum_le y k (hk'.le.trans hKlt.le) (Nat.pos_of_ne_zero hk0) hN
    Causalean.Experimentation.DesignBased.predictableVariance_firstWeightedEstimate · Causalean/Experimentation/DesignBased/FinitePopulationCLT/PredictableVarianceWeights.lean:438
SRS 2 core · 0 supporting This module combines predictable-variance concentration and conditional Lindeberg control to obtain the standardized central limit theorem for a simple random sample represented by the prefix of a uniform permutation, th ★ srs_finitePopulation_clt★ completeRandomization_sampleMean_clt

Finite-population CLT under the Li–Ding maximal-deviation condition

This module combines predictable-variance concentration and conditional Lindeberg control to obtain the standardized central limit theorem for a simple random sample represented by the prefix of a uniform permutation, then transports it to complete randomization. The formalized maximal-deviation condition is the convenient sufficient condition used by Li and Ding (2017), not Hájek's weaker necessary-and-sufficient Lindeberg criterion.

theorem srs_finitePopulation_clt reviewed
Causalean.Experimentation.DesignBased

Given population-size and sample-size sequences, positive proper sample sizes, and population outcomes with positive variances, if the Li–Ding maximal-deviation sufficient-condition ratio tends to zero, then the centered ordered simple-random-sample mean, standardized by its exact design variance, converges in distribution to the standard normal law.

Formal statement
N K :
ℕ → ℕ
∀ n, Nonempty (Fin (N n))
hKpos :
∀ n, 0 < K n
hKlt :
∀ n, K n < N n
y :
∀ n
if
Fin (N n)
then
ℝ
hvar :
∀ n, 0 < popVar (y n)
hmax :
Tendsto (fun n => popMaxSqDev (y n) / (((min (K n) (N n - K n) : ℕ) : ℝ) * popVar (y n))) atTop (nhds 0)
Modes.TendstoInLaw (fun n => (uniformPermutationDesign (N n)).toMeasure) (fun n π => (permutationSampleMean (K n) (hKlt n).le (y n) π - popMean (y n)) / sqrt (srsSampleMeanVariance (N n) (K n) (y n))) atTop (gaussianReal 0 1)
Proof (Lean source)
theorem srs_finitePopulation_clt (N K : ℕ → ℕ) [∀ n, Nonempty (Fin (N n))] (hKpos : ∀ n, 0 < K n) (hKlt : ∀ n, K n < N n) (y : ∀ n, Fin (N n) → ℝ) (hvar : ∀ n, 0 < popVar (y n)) (hmax : Tendsto (fun n => popMaxSqDev (y n) / (((min (K n) (N n - K n) : ℕ) : ℝ) * popVar (y n))) atTop (nhds 0)) : Modes.TendstoInLaw (fun n => (uniformPermutationDesign (N n)).toMeasure) (fun n π => (permutationSampleMean (K n) (hKlt n).le (y n) π - popMean (y n)) / sqrt (srsSampleMeanVariance (N n) (K n) (y n))) atTop (gaussianReal 0 1) := by let A := standardizedSrsPermutationHajekArray N K hKpos hKlt y have hclt := martingaleArrayCLT A (standardizedSrsPermutationHajekArray_predictableQuadraticVariation_tendstoInProbability N K hKpos hKlt y hvar hmax) (standardizedSrsPermutationHajekArray_conditionalLindeberg N K hKpos hKlt y hvar hmax) have hrow : A.rowSum = fun n π => (permutationSampleMean (K n) (hKlt n).le (y n) π - popMean (y n)) / sqrt (srsSampleMeanVariance (N n) (K n) (y n)) := by funext n exact standardizedSrsPermutationHajekArray_rowSum N K hKpos hKlt y n simpa only [hrow] using hclt
theorem completeRandomization_sampleMean_clt reviewed
Causalean.Experimentation.DesignBased

Given population-size and sample-size sequences, positive proper sample sizes, and population outcomes with positive variances, if the Li–Ding maximal-deviation sufficient-condition ratio tends to zero, then the centered sample mean under complete randomization, standardized by its exact design variance, converges in distribution to the standard normal law.

Formal statement
N K :
ℕ → ℕ
∀ n, Nonempty (Fin (N n))
hKpos :
∀ n, 0 < K n
hKlt :
∀ n, K n < N n
y :
∀ n
if
Fin (N n)
then
ℝ
hvar :
∀ n, 0 < popVar (y n)
hmax :
Tendsto (fun n => popMaxSqDev (y n) / (((min (K n) (N n - K n) : ℕ) : ℝ) * popVar (y n))) atTop (nhds 0)
Modes.TendstoInLaw (fun n => (completeRandomization (V := Fin (N n)) (K n) (by simpa using (hKlt n).le)).toMeasure) (fun n S => (sampleMean (K n) (y n) S - popMean (y n)) / sqrt (srsSampleMeanVariance (N n) (K n) (y n))) atTop (gaussianReal 0 1)
Proof (Lean source)
theorem completeRandomization_sampleMean_clt (N K : ℕ → ℕ) [∀ n, Nonempty (Fin (N n))] (hKpos : ∀ n, 0 < K n) (hKlt : ∀ n, K n < N n) (y : ∀ n, Fin (N n) → ℝ) (hvar : ∀ n, 0 < popVar (y n)) (hmax : Tendsto (fun n => popMaxSqDev (y n) / (((min (K n) (N n - K n) : ℕ) : ℝ) * popVar (y n))) atTop (nhds 0)) : Modes.TendstoInLaw (fun n => (completeRandomization (V := Fin (N n)) (K n) (by simpa using (hKlt n).le)).toMeasure) (fun n S => (sampleMean (K n) (y n) S - popMean (y n)) / sqrt (srsSampleMeanVariance (N n) (K n) (y n))) atTop (gaussianReal 0 1) := by have hclt := srs_finitePopulation_clt N K hKpos hKlt y hvar hmax have hrow : ∀ n, Measure.map (fun S => (sampleMean (K n) (y n) S - popMean (y n)) / sqrt (srsSampleMeanVariance (N n) (K n) (y n))) (completeRandomization (V := Fin (N n)) (K n) (by simpa using (hKlt n).le)).toMeasure = Measure.map (fun π => (permutationSampleMean (K n) (hKlt n).le (y n) π - popMean (y n)) / sqrt (srsSampleMeanVariance (N n) (K n) (y n))) (uniformPermutationDesign (N n)).toMeasure := by intro n let pfx := permutationPrefixSet (K n) (hKlt n).le have hdesign := uniformPermutationDesign_map_prefixSet_eq_completeRandomization (K n) (hKlt n).le have hmeasure := FiniteDesign.toMeasure_map (uniformPermutationDesign (N n)) pfx rw [hdesign] at hmeasure rw [hmeasure, Measure.map_map (measurable_of_finite _) (measurable_of_finite _)] apply Measure.map_congr filter_upwards with π change (sampleMean (K n) (y n) (pfx π) - popMean (y n)) / sqrt (srsSampleMeanVariance (N n) (K n) (y n)) = _ rw [sampleMean_permutationPrefixSet_eq] refine ⟨fun _ => (measurable_of_finite _).aemeasurable, hclt.aemeasurable_limit, ?_⟩ simpa only [hrow] using hclt.tendsto