Experimentation.DesignBased
The shared, paper-agnostic substrate for design-based / randomization inference under interference: the finite-population, fixed-potential-outcome flavor of the potential-outcomes framework, where probability comes from
InProb 5 core · 10 supporting Finite-design convergence in probability tracks vanishing assignment-tail probabilities along a sequence of randomization designs. ★ tendstoInProb_of_var★ tendstoInProb_div_one★ mul_boundedInProb
Convergence in probability for finite designs
Finite-design convergence in probability tracks vanishing assignment-tail probabilities along a sequence of randomization designs.
The predicate FiniteDesign.TendstoInProb states convergence of statistics X m to targets c m
using the design probabilities of absolute-deviation events. The theorem tendstoInProb_of_var
turns vanishing randomization variance into convergence to the design mean via Chebyshev's
inequality. The closure result TendstoInProb.sub handles differences, and
tendstoInProb_div_one is the Hájek/Slutsky ratio step for denominators converging in probability
to one.
For a sequence of finite assignment spaces, a sequence of finite randomization designs, a sequence of real-valued statistics, and a sequence of real-valued targets, the assertion of convergence in probability means that, for every positive , the probability that the statistic differs from its target by at least tends to zero as the sequence index tends to infinity.
Definition (Lean source)
Chebyshev consistency engine. Along a sequence of finite designs D, for statistics X, if the design variance of X m tends to zero as m → ∞, then X m converges in probability to its design mean E[X m].
Formal statement
Proof (Lean source)
Slutsky ratio step. Along a sequence of finite designs D, fix statistics X and Y. If X m converges in probability to a m, the denominator Y m converges in probability to 1, and the limit sequence a m is uniformly bounded by a constant M, then the ratio X m / Y m converges in probability to a m. (The realized normalizer tends to one, so dividing by it does not change the probability limit.)
Formal statement
Proof (Lean source)
For a sequence of finite assignment spaces, a sequence of finite randomization designs, and a sequence of real-valued statistics, the assertion that the statistics are bounded in probability means that, for every positive tolerance, there is a real threshold such that, from some index onward, the probability that the statistic's absolute value is at least that threshold is at most the tolerance. This is the counterpart of convergence in probability.
Definition (Lean source)
If one sequence converges to zero in probability and a second sequence is bounded in probability, then their product converges to zero in probability. This is the product-tightness principle that turns a vanishing factor times a bounded factor into a vanishing remainder.
Formal statement
Proof (Lean source)
10 supporting declarations (lemmas, instances)
-
tendstoInProb_iff_tendstoInProbabilitytheorem — For finite assignment spaces, randomization designs, row statistics, and row targets, finite-design convergence in probability is equivalent to convergence in probability under the induced row measures.hypothesesconclusionTendstoInProb D X c↔ @TendstoInProbability ℕ Ω (fun _ => ⊤) ℝ inferInstance (fun m => @FiniteDesign.toMeasure (Ω m) (by infer_instance) ⊤ (D m)) X atTop (fun m _ => c m)Proof (Lean source)
theorem tendstoInProb_iff_tendstoInProbability (D : ∀ m, FiniteDesign (Ω m)) (X : ∀ m, Ω m → ℝ) (c : ℕ → ℝ) : TendstoInProb D X c ↔ @TendstoInProbability ℕ Ω (fun _ => ⊤) ℝ inferInstance (fun m => @FiniteDesign.toMeasure (Ω m) (by infer_instance) ⊤ (D m)) X atTop (fun m _ => c m) := by letI : ∀ m, MeasurableSpace (Ω m) := fun _ => ⊤ rw [tendstoInProbability_iff_measureReal_norm] simp only [Real.norm_eq_abs, FiniteDesign.toMeasure_real_setOf] rfl -
deterministic_tendstoInProbtheorem — Under a sequence of finite-design laws, if a deterministic real sequence converges to a constant, then the corresponding constant-on-assignment statistics converge in finite-design probability.hypothesesconclusionTendstoInProb D (fun n _ => a n) (fun _ => c)Proof (Lean source)
theorem deterministic_tendstoInProb (D : ∀ n, FiniteDesign (Ω n)) (a : ℕ → ℝ) (c : ℝ) (ha : Tendsto a atTop (𝓝 c)) : TendstoInProb D (fun n _ => a n) (fun _ => c) := by intro ε hε have hev : ∀ᶠ n in atTop, |a n - c| < ε := by simpa [Real.dist_eq] using (Metric.tendsto_atTop.1 ha ε hε) apply tendsto_order.2 constructor · intro u hu filter_upwards [] with n exact hu.trans_le ((D n).Pr_nonneg _) · intro u hu filter_upwards [hev] with n hn have hz : (D n).Pr (fun _ => ε ≤ |a n - c|) = 0 := by unfold FiniteDesign.Pr FiniteDesign.E FiniteDesign.ind simp [not_le.mpr hn] rw [hz] exact hu -
tendstoInProb_continuousMaptheorem — Under a sequence of finite-design laws, if a statistic converges in probability to a constant and a real map is continuous at that constant, then applying the map preserves convergence in probability.hypothesesΩ :sharedℕ → Type u_1D :∀ n, FiniteDesign (Ω n)X :∀ nifΩ nthenℝc :ℝf :ℝ → ℝhX :TendstoInProb D X (fun _ => c)hf :ContinuousAt f cconclusionTendstoInProb D (fun n z => f (X n z)) (fun _ => f c)Proof (Lean source)
theorem tendstoInProb_continuousMap (D : ∀ n, FiniteDesign (Ω n)) (X : ∀ n, Ω n → ℝ) (c : ℝ) (f : ℝ → ℝ) (hX : TendstoInProb D X (fun _ => c)) (hf : ContinuousAt f c) : TendstoInProb D (fun n z => f (X n z)) (fun _ => f c) := by intro ε hε obtain ⟨δ, hδ, hmap⟩ := (Metric.continuousAt_iff.1 hf) ε hε have htail := hX δ hδ refine squeeze_zero (fun n => (D n).Pr_nonneg _) (fun n => ?_) htail apply (D n).Pr_mono intro z hz by_contra hfar rw [not_le] at hfar have := hmap (show dist (X n z) c < δ by simpa [Real.dist_eq] using hfar) exact (not_lt_of_ge hz) (by simpa [Real.dist_eq] using this) -
Pr_or_lelemma — Union bound for two events: Pr(P ∨ Q) ≤ Pr P + Pr Q.hypothesesconclusionD.Pr (fun z => P z ∨ Q z) ≤ D.Pr P + D.Pr QProof (Lean source)
lemma Pr_or_le {Ω' : Type*} [Fintype Ω'] (D : FiniteDesign Ω') (P Q : Ω' → Prop) [DecidablePred P] [DecidablePred Q] : D.Pr (fun z => P z ∨ Q z) ≤ D.Pr P + D.Pr Q := by unfold FiniteDesign.Pr FiniteDesign.E FiniteDesign.ind rw [← Finset.sum_add_distrib] apply Finset.sum_le_sum intro z _ rw [← mul_add] apply mul_le_mul_of_nonneg_left _ (D.p_nonneg z) by_cases hP : P z <;> by_cases hQ : Q z <;> simp [hP, hQ] -
subtheorem — Along a sequence of finite designs, if the statistics X m converge in probability to a m and the statistics Y m converge in probability to b m, then the difference X m − Y m converges in probability to a m − b m: convergence in probability is closed under differences.hypothesesconclusionTendstoInProb D (fun m z => X m z - Y m z) (fun m => a m - b m)Proof (Lean source)
theorem TendstoInProb.sub {D : ∀ m, FiniteDesign (Ω m)} {X Y : ∀ m, Ω m → ℝ} {a b : ℕ → ℝ} (hX : TendstoInProb D X a) (hY : TendstoInProb D Y b) : TendstoInProb D (fun m z => X m z - Y m z) (fun m => a m - b m) := by intro ε hε have hε2 : (0 : ℝ) < ε / 2 := by linarith -- The combined tail bound: split each event into the two half-deviation events. have hbound : ∀ m, (D m).Pr (fun z => ε ≤ |(X m z - Y m z) - (a m - b m)|) ≤ (D m).Pr (fun z => ε / 2 ≤ |X m z - a m|) + (D m).Pr (fun z => ε / 2 ≤ |Y m z - b m|) := by intro m have hmono : (D m).Pr (fun z => ε ≤ |(X m z - Y m z) - (a m - b m)|) ≤ (D m).Pr (fun z => (ε / 2 ≤ |X m z - a m|) ∨ (ε / 2 ≤ |Y m z - b m|)) := by apply (D m).Pr_mono intro z hz by_contra hcon push_neg at hcon obtain ⟨h1, h2⟩ := hcon have htri : |(X m z - Y m z) - (a m - b m)| ≤ |X m z - a m| + |Y m z - b m| := by have : (X m z - Y m z) - (a m - b m) = (X m z - a m) - (Y m z - b m) := by ring rw [this] exact abs_sub _ _ linarith exact le_trans hmono (Pr_or_le (D m) _ _) have hupper : Tendsto (fun m => (D m).Pr (fun z => ε / 2 ≤ |X m z - a m|) + (D m).Pr (fun z => ε / 2 ≤ |Y m z - b m|)) atTop (𝓝 0) := by have := (hX (ε / 2) hε2).add (hY (ε / 2) hε2) simpa using this refine squeeze_zero (fun m => (D m).Pr_nonneg _) hbound hupper -
addtheorem — Convergence in probability is closed under sums.hypothesesconclusionTendstoInProb D (fun m z => X m z + Y m z) (fun m => a m + b m)Proof (Lean source)
theorem TendstoInProb.add {D : ∀ m, FiniteDesign (Ω m)} {X Y : ∀ m, Ω m → ℝ} {a b : ℕ → ℝ} (hX : TendstoInProb D X a) (hY : TendstoInProb D Y b) : TendstoInProb D (fun m z => X m z + Y m z) (fun m => a m + b m) := by intro ε hε have hε2 : (0 : ℝ) < ε / 2 := by linarith have hbound : ∀ m, (D m).Pr (fun z => ε ≤ |(X m z + Y m z) - (a m + b m)|) ≤ (D m).Pr (fun z => ε / 2 ≤ |X m z - a m|) + (D m).Pr (fun z => ε / 2 ≤ |Y m z - b m|) := by intro m have hmono : (D m).Pr (fun z => ε ≤ |(X m z + Y m z) - (a m + b m)|) ≤ (D m).Pr (fun z => (ε / 2 ≤ |X m z - a m|) ∨ (ε / 2 ≤ |Y m z - b m|)) := by apply (D m).Pr_mono intro z hz by_contra hcon push_neg at hcon obtain ⟨h1, h2⟩ := hcon have htri : |(X m z + Y m z) - (a m + b m)| ≤ |X m z - a m| + |Y m z - b m| := by have : (X m z + Y m z) - (a m + b m) = (X m z - a m) + (Y m z - b m) := by ring rw [this] exact abs_add_le _ _ linarith exact le_trans hmono (Pr_or_le (D m) _ _) have hupper : Tendsto (fun m => (D m).Pr (fun z => ε / 2 ≤ |X m z - a m|) + (D m).Pr (fun z => ε / 2 ≤ |Y m z - b m|)) atTop (𝓝 0) := by have := (hX (ε / 2) hε2).add (hY (ε / 2) hε2) simpa using this refine squeeze_zero (fun m => (D m).Pr_nonneg _) hbound hupper -
abstheorem — If X m → 0 in probability then |X m| → 0 in probability.hypothesesconclusionTendstoInProb D (fun m z => |X m z|) (fun _ => 0)Proof (Lean source)
theorem TendstoInProb.abs {D : ∀ m, FiniteDesign (Ω m)} {X : ∀ m, Ω m → ℝ} (h : TendstoInProb D X (fun _ => 0)) : TendstoInProb D (fun m z => |X m z|) (fun _ => 0) := by intro ε hε simpa only [sub_zero, abs_abs] using h ε hε -
boundedInProb_iff_boundedInProbabilitytheorem — For finite assignment spaces, randomization designs, and row statistics, finite-design boundedness in probability is equivalent to the shared measure-theoretic stochastic-order notion at constant rate one.hypothesesconclusionBoundedInProb D X↔ @BoundedInProbability ℕ Ω (fun _ => ⊤) ℝ inferInstance (fun m => @FiniteDesign.toMeasure (Ω m) (by infer_instance) ⊤ (D m)) X atTop (fun _ => 1)Proof (Lean source)
theorem boundedInProb_iff_boundedInProbability (D : ∀ m, FiniteDesign (Ω m)) (X : ∀ m, Ω m → ℝ) : BoundedInProb D X ↔ @BoundedInProbability ℕ Ω (fun _ => ⊤) ℝ inferInstance (fun m => @FiniteDesign.toMeasure (Ω m) (by infer_instance) ⊤ (D m)) X atTop (fun _ => 1) := by letI : ∀ m, MeasurableSpace (Ω m) := fun _ => ⊤ constructor · intro h δ hδ by_cases hδtop : δ = ⊤ · exact ⟨1, one_pos, by simp [hδtop]⟩ have hδreal : 0 < δ.toReal := ENNReal.toReal_pos hδ.ne' hδtop obtain ⟨M, hM⟩ := h δ.toReal hδreal let M' : ℝ := |M| + 1 have hM' : 0 < M' := by simp [M']; positivity refine ⟨M', hM', ?_⟩ filter_upwards [hM] with m hm apply (ENNReal.toReal_le_toReal (MeasureTheory.measure_ne_top _ _) hδtop).1 simp only [mul_one, Real.norm_eq_abs] change (D m).toMeasure.real {z | M' ≤ |X m z|} ≤ δ.toReal rw [(D m).toMeasure_real_setOf] refine le_trans ((D m).Pr_mono (fun z => M' ≤ |X m z|) (fun z => M ≤ |X m z|) ?_) hm intro z hz have hMM' : M ≤ M' := by dsimp [M']; linarith [le_abs_self M] exact hMM'.trans hz · intro h η hη obtain ⟨M, _hMpos, hM⟩ := h (ofReal η) (ENNReal.ofReal_pos.mpr hη) refine ⟨M, ?_⟩ filter_upwards [hM] with m hm have hto := (ENNReal.toReal_le_toReal (MeasureTheory.measure_ne_top _ _) ENNReal.ofReal_ne_top).2 hm simp only [mul_one, Real.norm_eq_abs] at hto change (D m).toMeasure.real {z | M ≤ |X m z|} ≤ (ofReal η).toReal at hto rw [(D m).toMeasure_real_setOf, ENNReal.toReal_ofReal hη.le] at hto exact hto -
boundedInProb_of_var_boundtheorem — An eventual variance bound together with an eventual mean bound makes a sequence bounded in probability: if the design variances Var(X m) are eventually at most V and the means E(X m) eventually lie within c of zero, then X is uniformly tight.hypothesesΩ :sharedℕ → Type u_1D :∀ m, FiniteDesign (Ω m)X :∀ mifΩ mthenℝV c :ℝhc :∀ᶠ m in atTop, |(D m).E (X m)| ≤ cconclusionBoundedInProb D XProof (Lean source)
theorem boundedInProb_of_var_bound (D : ∀ m, FiniteDesign (Ω m)) (X : ∀ m, Ω m → ℝ) {V c : ℝ} (hV : ∀ᶠ m in atTop, (D m).Var (X m) ≤ V) (hc : ∀ᶠ m in atTop, |(D m).E (X m)| ≤ c) : BoundedInProb D X := by intro η hη obtain ⟨m0, hm0⟩ := hV.exists have hVnn : 0 ≤ V := le_trans ((D m0).Var_nonneg (X m0)) hm0 set r : ℝ := V / η + 1 with hrdef have hr_pos : 0 < r := by rw [hrdef]; positivity have hr2_pos : 0 < r ^ 2 := pow_pos hr_pos 2 refine ⟨c + r, ?_⟩ filter_upwards [hV, hc] with m hVm hcm have hsub : (D m).Pr (fun z => c + r ≤ |X m z|) ≤ (D m).Pr (fun z => r ≤ |X m z - (D m).E (X m)|) := by apply (D m).Pr_mono intro z hz have h1 : |X m z| - |(D m).E (X m)| ≤ |X m z - (D m).E (X m)| := abs_sub_abs_le_abs_sub _ _ linarith refine le_trans hsub (le_trans ((D m).chebyshev (X m) hr_pos) ?_) rw [div_le_iff₀ hr2_pos] have hkey : η * r = V + η := by rw [hrdef]; field_simp have hexp : η * r ^ 2 = (V + η) * r := by rw [pow_two, ← mul_assoc, hkey] rw [hexp] have hr1 : (1 : ℝ) ≤ r := by rw [hrdef]; have : (0 : ℝ) ≤ V / η := by positivity linarith have hVle : V ≤ (V + η) * r := by calc V = V * 1 := (mul_one V).symm _ ≤ (V + η) * r := by apply mul_le_mul (by linarith) hr1 (by norm_num) (by linarith) linarith [hVm] -
const_multheorem — Scaling a convergent sequence by a constant scales its probability limit: if X m → a m in probability then c · X m → c · a m in probability.hypothesesconclusionTendstoInProb D (fun m z => c * X m z) (fun m => c * a m)Proof (Lean source)
theorem TendstoInProb.const_mul {D : ∀ m, FiniteDesign (Ω m)} {X : ∀ m, Ω m → ℝ} {a : ℕ → ℝ} (c : ℝ) (h : TendstoInProb D X a) : TendstoInProb D (fun m z => c * X m z) (fun m => c * a m) := by intro ε hε have hc1 : 0 < |c| + 1 := by positivity have hεc : 0 < ε / (|c| + 1) := by positivity have hsub : ∀ m, (D m).Pr (fun z => ε ≤ |c * X m z - c * a m|) ≤ (D m).Pr (fun z => ε / (|c| + 1) ≤ |X m z - a m|) := by intro m apply (D m).Pr_mono intro z hz rw [← mul_sub, abs_mul] at hz rw [div_le_iff₀ hc1] nlinarith [hz, abs_nonneg (X m z), abs_nonneg c] refine squeeze_zero (fun m => (D m).Pr_nonneg _) hsub ?_ simpa using h (ε / (|c| + 1)) hεc
GaussianCDF 3 core · 5 supporting The design-based standard-normal CDF is a namespace-local presentation of the canonical Mathlib-facing CDF. ★ stdNormalCdf_neg★ continuous_stdNormalCdf
Standard normal CDF adapter
The design-based standard-normal CDF is a namespace-local presentation of the canonical Mathlib-facing CDF.
The definition stdNormalCdf uses the .real (Iic t) probability-measure presentation needed by
design-based interval and CLT statements, while stdNormalCdf_eq identifies it with
Causalean.Mathlib.stdNormalCDF. The remaining lemmas forward the reusable facts needed
downstream: nonnegativity, the upper bound by one, monotonicity, symmetry
stdNormalCdf_neg, and continuity continuous_stdNormalCdf.
For a real threshold, the standard normal cumulative distribution function is the probability that a standard normal random variable is no greater than that threshold.
Definition (Lean source)
Symmetry of the standard normal CDF. For any threshold t, the standard normal CDF satisfies Φ(−t) = 1 − Φ(t).
Formal statement
Proof (Lean source)
Continuity of the standard normal CDF. The standard normal cumulative distribution function Φ is continuous.
Formal statement
Proof (Lean source)
5 supporting declarations (lemmas, instances)
-
stdNormalCdf_eqlemma — The design-based .real (Iic) presentation agrees with the canonical stdNormalCDF.Proof (Lean source)
@[simp] lemma stdNormalCdf_eq (t : ℝ) : stdNormalCdf t = stdNormalCDF t := by rw [stdNormalCDF_def]; exact (ProbabilityTheory.cdf_eq_real _ t).symm -
stdNormalCdf_nonneglemma — The standard-normal cumulative probability is nonnegative.Proof (Lean source)
lemma stdNormalCdf_nonneg (t : ℝ) : 0 ≤ stdNormalCdf t := by rw [stdNormalCdf_eq]; exact stdNormalCDF_nonneg t -
stdNormalCdf_le_onelemma — The standard-normal cumulative probability is at most one.Proof (Lean source)
lemma stdNormalCdf_le_one (t : ℝ) : stdNormalCdf t ≤ 1 := by rw [stdNormalCdf_eq]; exact stdNormalCDF_le_one t -
monotone_stdNormalCdflemma — The standard-normal cumulative distribution function is monotone in its threshold.conclusionProof (Lean source)
lemma monotone_stdNormalCdf : Monotone stdNormalCdf := by rw [show stdNormalCdf = stdNormalCDF from funext stdNormalCdf_eq] exact stdNormalCDF_monotone -
boundedInProb_of_stdNormalCDFtheorem — For a sequence of finite-design laws and real-valued statistics, if their CDFs converge pointwise to the standard normal CDF, then the statistics are bounded in probability.hypothesesconclusionBoundedInProb D TProof (Lean source)
theorem boundedInProb_of_stdNormalCDF (D : ∀ n, FiniteDesign (Ω n)) (T : ∀ n, Ω n → ℝ) (hT : ∀ x : ℝ, Tendsto (fun n => (D n).Pr (fun z => T n z ≤ x)) atTop (𝓝 (stdNormalCdf x))) : BoundedInProb D T := by intro η hη have htop : Tendsto stdNormalCdf atTop (𝓝 1) := by rw [show stdNormalCdf = stdNormalCDF by funext x; exact stdNormalCdf_eq x] exact Causalean.Mathlib.stdNormalCDF_tendsto_atTop have hevent : ∀ᶠ x : ℝ in atTop, 1 - stdNormalCdf x < η / 4 := by have h := (Metric.tendsto_nhds.1 htop) (η / 4) (by linarith) filter_upwards [h] with x hx rw [Real.dist_eq] at hx linarith [(abs_lt.1 hx).1] obtain ⟨R, hRtail, hRpos⟩ := (hevent.and (eventually_gt_atTop (0 : ℝ))).exists refine ⟨2 * R, ?_⟩ have hneg := hT (-R) have hpos := hT R have hsum : Tendsto (fun n => (D n).Pr (fun z => T n z ≤ -R) + (1 - (D n).Pr (fun z => T n z ≤ R))) atTop (𝓝 (2 * (1 - stdNormalCdf R))) := by convert hneg.add (tendsto_const_nhds.sub hpos) using 1 · rw [stdNormalCdf_neg] ring have hsumSmall : ∀ᶠ n in atTop, (D n).Pr (fun z => T n z ≤ -R) + (1 - (D n).Pr (fun z => T n z ≤ R)) < η := by have hlimlt : 2 * (1 - stdNormalCdf R) < η := by linarith exact hsum.eventually (eventually_lt_nhds hlimlt) filter_upwards [hsumSmall] with n hn have hcompl : (D n).Pr (fun z => ¬ T n z ≤ R) = 1 - (D n).Pr (fun z => T n z ≤ R) := by have hs := (D n).Pr_split (fun _ => True) (fun z => T n z ≤ R) have htrue : (D n).Pr (fun _ => True) = 1 := by unfold FiniteDesign.Pr FiniteDesign.E FiniteDesign.ind simp [(D n).p_sum] rw [htrue] at hs simp only [true_and] at hs linarith calc (D n).Pr (fun z => 2 * R ≤ |T n z|) ≤ (D n).Pr (fun z => T n z ≤ -R ∨ ¬ T n z ≤ R) := by apply (D n).Pr_mono intro z hz rcases le_total (T n z) 0 with hnonpos | hnonneg · left rw [abs_of_nonpos hnonpos] at hz linarith · right rw [abs_of_nonneg hnonneg] at hz linarith _ ≤ (D n).Pr (fun z => T n z ≤ -R) + (D n).Pr (fun z => ¬ T n z ≤ R) := Pr_or_le _ _ _ _ ≤ η := by rw [hcompl]; exact hn.le
Exposure 8 core · 3 supporting Exposure mappings turn assignments and unit traits into treatment conditions, and generalized exposure probabilities are the design probabilities of those conditions. ★ E_expoInd★ Cov_expoInd_same★ Cov_expoInd_cross
Exposure mappings and generalized exposure probabilities
Exposure mappings turn assignments and unit traits into treatment conditions, and generalized exposure probabilities are the design probabilities of those conditions.
The basic declarations are expo, the indicator expoInd, the marginal probability prop, and
the joint probabilities propPairSame and propPairCross. The covariance lemmas
Cov_expoInd_same and Cov_expoInd_cross rewrite indicator covariances into those probabilities,
while expoInd_mul_self_of_ne and propPairCross_self_of_ne record that one unit cannot occupy two
distinct exposures in the same assignment. For finite exposure spaces, sum_prop_eq_one shows that
each unit's exposure probabilities sum to one.
For an assignment-to-exposure rule, a map assigning each unit its traits, a unit, and an assignment, the unit's exposure is the exposure assigned by that rule to the assignment and the unit's traits.
Definition (Lean source)
For an assignment-to-exposure rule, a map assigning each unit its traits, a unit, and an exposure condition from a set whose elements can be compared for equality, the exposure indicator maps each assignment to one when that unit receives that condition and to zero otherwise.
Definition (Lean source)
On a finite assignment space, for a finite randomization design, an assignment-to-exposure rule, a map assigning each unit its traits, a unit, and an exposure condition from a set whose elements can be compared for equality, the generalized probability of exposure is the design probability that the unit receives that condition.
Definition (Lean source)
On a finite assignment space, for a finite randomization design, an assignment-to-exposure rule, a map assigning each unit its traits, two units, and an exposure condition from a set whose elements can be compared for equality, the same-condition joint exposure probability is the design expectation of the product of the two units' indicators for that condition.
Definition (Lean source)
On a finite assignment space, for a finite randomization design, an assignment-to-exposure rule, a map assigning each unit its traits, two units, and two exposure conditions from a set whose elements can be compared for equality, the cross-condition joint exposure probability is the design expectation of the product of the first unit's indicator for the first condition and the second unit's indicator for the second condition.
Definition (Lean source)
Exposure probability as an expectation. For a design, an exposure mapping, unit traits, a unit i, and an exposure level d, the design expectation of the exposure indicator equals the generalized probability of exposure π_i(d).
Formal statement
Proof (Lean source)
Covariance of same-exposure indicators. For a design, an exposure mapping, unit traits, units i and j, and an exposure level d, the design covariance of the two units' d-exposure indicators equals the joint exposure probability π_ij(d) minus the product of their marginal exposure probabilities.
Formal statement
Proof (Lean source)
Covariance of cross-exposure indicators. For a design, an exposure mapping, unit traits, units i and j, and exposure levels d and d', the design covariance of unit i's d-exposure indicator and unit j's d'-exposure indicator equals the cross joint exposure probability π_ij(d,d') minus the product of their marginal exposure probabilities.
Formal statement
Proof (Lean source)
3 supporting declarations (lemmas, instances)
-
expoInd_mul_self_of_nelemma — A unit cannot be in two distinct exposures at once: the indicators are pointwise disjoint.hypothesesΩ :sharedType u_1ι :sharedType u_2Θ :sharedType u_3Δ :sharedType u_4f :Ω → Θ → Δθ :ι → Θi :ιd d' :Δhne :d ≠ d'z :ΩProof (Lean source)
lemma expoInd_mul_self_of_ne (f : Ω → Θ → Δ) (θ : ι → Θ) (i : ι) {d d' : Δ} (hne : d ≠ d') (z : Ω) : expoInd f θ i d z * expoInd f θ i d' z = 0 := by unfold expoInd FiniteDesign.ind by_cases h : expo f θ i z = d · simp [h, hne] · simp [h] -
propPairCross_self_of_nelemma — The self cross-exposure joint probability vanishes for distinct exposures.hypothesesΩ :sharedType u_1ι :sharedType u_2Θ :sharedType u_3Δ :sharedType u_4D :f :Ω → Θ → Δθ :ι → Θi :ιd d' :Δhne :d ≠ d'conclusionpropPairCross D f θ i i d d' = 0Proof (Lean source)
lemma propPairCross_self_of_ne (D : FiniteDesign Ω) (f : Ω → Θ → Δ) (θ : ι → Θ) (i : ι) {d d' : Δ} (hne : d ≠ d') : propPairCross D f θ i i d d' = 0 := by unfold propPairCross rw [show (fun z => expoInd f θ i d z * expoInd f θ i d' z) = (fun _ => (0 : ℝ)) from funext (fun z => expoInd_mul_self_of_ne f θ i hne z)] exact D.E_const 0 -
sum_prop_eq_onelemma — Exposure probabilities sum to one. For a design, an exposure mapping, unit traits, and a unit i, the generalized exposure probabilities of unit i, summed over all exposure levels, equal one.hypothesesΩ :sharedType u_1ι :sharedType u_2Θ :sharedType u_3Δ :sharedType u_4D :f :Ω → Θ → Δθ :ι → Θi :ιconclusion∑ d, prop D f θ i d = 1Proof (Lean source)
lemma sum_prop_eq_one (D : FiniteDesign Ω) (f : Ω → Θ → Δ) (θ : ι → Θ) (i : ι) : ∑ d, prop D f θ i d = 1 := by simp only [prop, FiniteDesign.Pr, FiniteDesign.E, FiniteDesign.ind] rw [Finset.sum_comm] have : ∀ z, ∑ d, D.p z * (if expo f θ i z = d then (1:ℝ) else 0) = D.p z := by intro z rw [← Finset.mul_sum] simp rw [Finset.sum_congr rfl (fun z _ => this z), D.p_sum]
Risk 4 core · 6 supporting Bias and mean squared error summarize fixed-target estimation error under a finite design. ★ mse_eq_var_add_bias_sq
Design-based risk summaries
Bias and mean squared error summarize fixed-target estimation error under a finite design.
The definitions FiniteDesign.bias, FiniteDesign.mse, and FiniteDesign.Unbiased describe
estimation error for a fixed target under a finite randomization design. The central theorem
FiniteDesign.mse_eq_var_add_bias_sq proves the bias-variance decomposition, with supporting
lemmas for unbiased estimators, nonnegativity, the lower bound FiniteDesign.var_le_mse, and
congruence under pointwise-equal estimators.
For a randomization design, a real-valued estimator of the realized assignment, and a real-valued target, the estimator's design bias is its design expectation minus the target.
Definition (Lean source)
For a randomization design, a real-valued estimator of the realized assignment, and a real-valued target, the estimator's design mean squared error is the design expectation of the squared difference between the estimator and the target.
Definition (Lean source)
For a randomization design, a real-valued estimator of the realized assignment, and a real-valued target, the assertion that the estimator is unbiased means that its design expectation equals the target.
Definition (Lean source)
Bias–variance decomposition. The mean squared error mse of estimator est for target μ equals its randomization variance plus the square of its bias: mse = Var + bias².
Formal statement
Proof (Lean source)
6 supporting declarations (lemmas, instances)
-
mse_eq_var_of_unbiasedlemma — For an unbiased estimator the mean squared error equals the variance.hypothesesconclusionD.mse est μ = D.Var estProof (Lean source)
lemma mse_eq_var_of_unbiased {est : Ω → ℝ} {μ : ℝ} (h : D.Unbiased est μ) : D.mse est μ = D.Var est := by rw [mse_eq_var_add_bias_sq] unfold bias Unbiased at * rw [h]; ring -
bias_of_unbiasedlemma — The bias of an unbiased estimator is zero.hypothesesconclusionD.bias est μ = 0Proof (Lean source)
@[simp] lemma bias_of_unbiased {est : Ω → ℝ} {μ : ℝ} (h : D.Unbiased est μ) : D.bias est μ = 0 := by unfold bias Unbiased at *; rw [h]; ring -
mse_nonneglemma — Mean squared error is nonnegative.hypothesesconclusion0 ≤ D.mse est μProof (Lean source)
lemma mse_nonneg (est : Ω → ℝ) (μ : ℝ) : 0 ≤ D.mse est μ := D.E_nonneg (fun _ => sq_nonneg _) -
Var_nonneglemma — Variance is nonnegative (it is the mean squared error of the centered estimator).Proof (Lean source)
lemma Var_nonneg (X : Ω → ℝ) : 0 ≤ D.Var X := by have : D.Var X = D.mse X (D.E X) := by unfold mse Var; rfl rw [this]; exact D.mse_nonneg _ _ -
var_le_mselemma — Mean squared error is bounded below by the variance.hypothesesconclusionD.Var est ≤ D.mse est μProof (Lean source)
lemma var_le_mse (est : Ω → ℝ) (μ : ℝ) : D.Var est ≤ D.mse est μ := by rw [mse_eq_var_add_bias_sq] exact le_add_of_nonneg_right (sq_nonneg _) -
mse_congrlemma — Congruence: pointwise-equal estimators have equal mean squared error.hypothesesconclusionD.mse est μ = D.mse est' μProof (Lean source)
lemma mse_congr {est est' : Ω → ℝ} {μ : ℝ} (h : ∀ z, est z = est' z) : D.mse est μ = D.mse est' μ := D.E_congr (fun z => by rw [h z])
FinitePopulationVariance 2 core · 3 supporting This file supplies the variance-estimation half of finite-population inference. ★ sampleVariance_tendstoInProb
Consistency of finite-population sample variances
This file supplies the variance-estimation half of finite-population inference. It defines the ordinary sample variance of a simple random sample, proves its centered-second-moment identity, and establishes consistency under Li--Ding's maximal-deviation regularity. The proof uses only the exact simple-random-sampling variance formula and Chebyshev's inequality; variance consistency is not assumed.
For a finite population, a sample size, outcomes, and a sample of that size, the ordinary sample variance is the sum of squared deviations from the sample mean divided by one fewer than the sample size.
Definition (Lean source)
Absolute finite-population sample-variance consistency. Along outcome vectors and growing simple random samples whose sizes are between two and their population sizes, suppose the finite-population variances converge and the largest squared centered outcome divided by the sample size vanishes. Then the ordinary sample variance converges in randomization probability to the finite-population variance.
Formal statement
Proof (Lean source)
3 supporting declarations (lemmas, instances)
-
sampleVariance_eq_centeredlemma — For a nonempty simple random sample, its outcomes, and its realized sample, the sample variance equals n/(n-1) times the sampled centered second moment minus the squared sampled centered first moment.hypothesesconclusionsampleVariance n y S= ((n : ℝ) / ((n : ℝ) - 1)) * (sampleMean n (fun i => (y i - popMean y) ^ 2) S - (sampleMean n (fun i => y i - popMean y) S) ^ 2)Proof (Lean source)
lemma sampleVariance_eq_centered {U : Type*} [Fintype U] [DecidableEq U] (n : ℕ) (hn : 0 < n) (y : U → ℝ) (S : {S : Finset U // S.card = n}) : sampleVariance n y S = ((n : ℝ) / ((n : ℝ) - 1)) * (sampleMean n (fun i => (y i - popMean y) ^ 2) S - (sampleMean n (fun i => y i - popMean y) S) ^ 2) := by classical have hnR : (n : ℝ) ≠ 0 := by exact_mod_cast hn.ne' have hcenter : sampleMean n (fun i => y i - popMean y) S = sampleMean n y S - popMean y := by unfold sampleMean have hsum : (∑ i : U, if i ∈ S.val then y i - popMean y else 0) = (∑ i : U, if i ∈ S.val then y i else 0) - (n : ℝ) * popMean y := by rw [← Finset.sum_filter, Finset.sum_sub_distrib] simp [S.property] rw [hsum] field_simp let x : U → ℝ := fun i => y i - popMean y let xb : ℝ := sampleMean n x S have hsumxS : (∑ i ∈ S.val, x i) = (n : ℝ) * xb := by dsimp [xb] unfold sampleMean rw [show (∑ i : U, if i ∈ S.val then x i else 0) = ∑ i ∈ S.val, x i by simp] field_simp have hsq : (∑ i : U, if i ∈ S.val then (x i - xb) ^ 2 else 0) = (∑ i : U, if i ∈ S.val then (x i) ^ 2 else 0) - (n : ℝ) * xb ^ 2 := by rw [show (∑ i : U, if i ∈ S.val then (x i - xb) ^ 2 else 0) = ∑ i ∈ S.val, (x i - xb) ^ 2 by simp] rw [show (∑ i : U, if i ∈ S.val then x i ^ 2 else 0) = ∑ i ∈ S.val, x i ^ 2 by simp] have hterm : ∀ i, (x i - xb) ^ 2 = x i ^ 2 - 2 * xb * x i + xb ^ 2 := by intro i ring simp_rw [hterm, Finset.sum_add_distrib, Finset.sum_sub_distrib] rw [← Finset.mul_sum, hsumxS] simp [S.property] ring unfold sampleVariance have hshift : (∑ i : U, if i ∈ S.val then (y i - sampleMean n y S) ^ 2 else 0) = ∑ i : U, if i ∈ S.val then (x i - xb) ^ 2 else 0 := by apply Finset.sum_congr rfl intro i _ by_cases hi : i ∈ S.val <;> simp [hi, x, xb, hcenter] rw [hshift, hsq] change ((∑ i : U, if i ∈ S.val then (y i - popMean y) ^ 2 else 0) - (n : ℝ) * (sampleMean n (fun i => y i - popMean y) S) ^ 2) / ((n : ℝ) - 1) = _ unfold sampleMean field_simp -
popVar_centeredSq_le_max_mul_popVarlemma — For a population containing at least two units and its outcomes, the finite-population variance of the squared centered outcomes is at most the largest squared centered outcome times the original finite-population variance.hypothesesconclusionProof (Lean source)
lemma popVar_centeredSq_le_max_mul_popVar {U : Type*} [Fintype U] [Nonempty U] (hN : 2 ≤ Fintype.card U) (y : U → ℝ) : popVar (fun i => (y i - popMean y) ^ 2) ≤ popMaxSqDev y * popVar y := by classical let N : ℕ := Fintype.card U let x : U → ℝ := fun i => y i - popMean y let z : U → ℝ := fun i => x i ^ 2 have hNR : (2 : ℝ) ≤ (N : ℝ) := by exact_mod_cast hN have hNpos : (0 : ℝ) < (N : ℝ) := by linarith have hN1pos : (0 : ℝ) < (N : ℝ) - 1 := by linarith have hNne : (N : ℝ) ≠ 0 := ne_of_gt hNpos have hraw : (∑ i, (z i - popMean z) ^ 2) = (∑ i, z i ^ 2) - (∑ i, z i) ^ 2 / (N : ℝ) := by unfold popMean change (∑ i, (z i - (∑ j, z j) / (N : ℝ)) ^ 2) = _ have hterm : ∀ i, (z i - (∑ j, z j) / (N : ℝ)) ^ 2 = z i ^ 2 - 2 * ((∑ j, z j) / (N : ℝ)) * z i + ((∑ j, z j) / (N : ℝ)) ^ 2 := by intro i ring simp_rw [hterm, Finset.sum_add_distrib, Finset.sum_sub_distrib] rw [← Finset.mul_sum, Finset.sum_const, Finset.card_univ, nsmul_eq_mul] change _ = (∑ i, z i ^ 2) - (∑ i, z i) ^ 2 / (N : ℝ) field_simp ring have hraw_le : (∑ i, (z i - popMean z) ^ 2) ≤ ∑ i, z i ^ 2 := by rw [hraw] have hnonneg : 0 ≤ (∑ i, z i) ^ 2 / (N : ℝ) := div_nonneg (sq_nonneg _) hNpos.le linarith have hzmax : ∀ i, z i ≤ popMaxSqDev y := by intro i exact Finset.le_sup' (fun j => (y j - popMean y) ^ 2) (Finset.mem_univ i) have hsum_le : (∑ i, z i ^ 2) ≤ popMaxSqDev y * ∑ i, z i := by rw [Finset.mul_sum] apply Finset.sum_le_sum intro i _ change z i ^ 2 ≤ popMaxSqDev y * z i rw [sq] exact mul_le_mul_of_nonneg_right (hzmax i) (sq_nonneg (x i)) unfold popVar change (∑ i, (z i - popMean z) ^ 2) / ((N : ℝ) - 1) ≤ popMaxSqDev y * ((∑ i, x i ^ 2) / ((N : ℝ) - 1)) rw [div_le_iff₀ hN1pos] calc (∑ i, (z i - popMean z) ^ 2) ≤ ∑ i, z i ^ 2 := hraw_le _ ≤ popMaxSqDev y * ∑ i, z i := hsum_le _ = (popMaxSqDev y * ((∑ i, x i ^ 2) / ((N : ℝ) - 1))) * ((N : ℝ) - 1) := by dsimp [z] field_simp -
popMean_centered_eq_zerolemma — For a nonempty finite population with outcomes, the population mean of the centered outcomes is zero.Proof (Lean source)
lemma popMean_centered_eq_zero {U : Type*} [Fintype U] [Nonempty U] (y : U → ℝ) : popMean (fun i => y i - popMean y) = 0 := by classical have hN : (Fintype.card U : ℝ) ≠ 0 := by exact_mod_cast Fintype.card_ne_zero unfold popMean rw [Finset.sum_sub_distrib, Finset.sum_const, Finset.card_univ, nsmul_eq_mul] field_simp ring
SequentialSampling 17 core · 14 supporting This module represents sequential sampling without replacement by a uniformly random permutation. ★ permutationNextMean_eq_remainingMean★ permutationCenteredDraw_condExp_zero★ permutationNextVariance_eq_remainingVariance
Sequential simple random sampling without replacement
This module represents sequential sampling without replacement by a uniformly random permutation. It defines the prefix filtration, the next draw and its finite conditional moments, and the Doob martingale-difference array of a centered simple-random-sample mean.
Given a population size, the ordered sampling space is the set of permutations of the N population indices.
Given a population size, the uniform permutation design gives every ordering of the population the same probability.
Definition (Lean source)
Given a prefix length and an ordering, the revealed prefix records the draw at positions below k and records no value at later positions.
Definition (Lean source)
Given a truncation length and a possibly revealed coordinate vector, the truncated prefix retains positions below k and hides all later positions.
For a population size, the successive-draw filtration is generated at time k by the first k values of the random ordering.
Definition (Lean source)
Given a population outcome vector, a draw position that is inside the population, and an ordering, the outcome of that draw is the outcome at the index occupying position k.
Definition (Lean source)
Given a finite population and an ordering, a valid natural-number position, and any position in the ordering, the position-swapped ordering exchanges those two draw positions.
Definition (Lean source)
Given a population outcome vector, a revealed-prefix length, its feasibility, and an ordering, the sum of outcomes in the revealed positions adds the first k ordered outcomes.
Definition (Lean source)
Given a population outcome vector, a revealed-prefix length, its feasibility, and an ordering, the sum of outcomes remaining after the prefix is the population total minus the revealed sum.
Definition (Lean source)
Given a feasible prefix length and an offset among the remaining positions, the corresponding position in the original ordering has index k+j.
Given a population outcome vector, a valid draw position, and an ordering, the finite conditional mean of the next draw given the preceding prefix is the uniform-design fiber average over orderings with the same first k draws.
Definition (Lean source)
Given population outcomes, a valid next-draw position, and an ordering, the conditional mean of the next draw is the arithmetic mean of the outcomes remaining after the revealed prefix.
Formal statement
Proof (Lean source)
For population outcomes and a valid next-draw position, the next draw centered by its prefix-conditional mean has conditional expectation zero.
Formal statement
Proof (Lean source)
Given a population outcome vector, a valid draw position, and an ordering, the conditional centered second moment of the next draw is the prefix-fiber average of its squared deviation from the conditional first moment.
Definition (Lean source)
Given population outcomes, a valid next-draw position, and an ordering, the conditional centered second moment of the next draw is the average squared deviation of the remaining outcomes from their remaining mean.
Formal statement
Proof (Lean source)
Given a feasible sample size, population outcomes, and an ordering, the mean of the first K draws is the ordered representation of the simple-random-sample mean.
Definition (Lean source)
Given sequences of population and sample sizes and finite-population outcomes, the SRS Doob martingale-difference array reveals the permutation one draw at a time and has the centered first-K sample mean as its terminal statistic.
Definition (Lean source)
14 supporting declarations (lemmas, instances)
-
instMeasurableSpacePermutationSampleSpaceinstance — For a population size, the ordered sampling space carries the discrete σ-algebra.parametersN :ℕinstancegiven by⊤ -
instMeasurableSingletonClassPermutationSampleSpaceinstance — For a population size, singletons in the ordered sampling space are measurable under its discrete σ-algebra.parametersN :ℕinstanceinstMeasurableSingletonClassPermutationSampleSpace N :given by⟨fun _ => trivial⟩ -
instMeasurableSpaceForallFinOption_causaleaninstance — For a population size, the space of partially revealed permutation prefixes carries the discrete σ-algebra.parametersN :ℕinstancegiven by⊤ -
instMeasurableSingletonClassForallFinOption_causaleaninstance — For a population size, singletons of partially revealed permutation prefixes are measurable under the discrete σ-algebra.parametersN :ℕinstanceinstMeasurableSingletonClassForallFinOption_causalean N :given by⟨fun _ => trivial⟩ -
permutationPrefix_swapPositiontheorem — Given an ordering, a valid current position, and an unrevealed position, swapping the current position with that position preserves the prefix revealed before the current draw.hypothesesconclusionProof (Lean source)
theorem permutationPrefix_swapPosition {N : ℕ} (π : PermutationSampleSpace N) (k : ℕ) (hk : k < N) (j : Fin N) (hj : k ≤ j.val) : permutationPrefix k (permutationSwapPosition π k hk j) = permutationPrefix k π := by funext i by_cases hi : i.val < k · have hik : i ≠ ⟨k, hk⟩ := by intro h simp [h] at hi have hij : i ≠ j := by intro h subst j omega simp [permutationPrefix, permutationSwapPosition, hi, Equiv.Perm.mul_apply, Equiv.swap_apply_of_ne_of_ne hik hij] · simp [permutationPrefix, hi] -
permutationDraw_swapPositiontheorem — Given population outcomes, a valid current position, an ordering, and another position, the draw after swapping positions k and j is the outcome originally occupying position j.hypothesesconclusionpermutationDraw y k hk (permutationSwapPosition π k hk j) = y (π j)Proof (Lean source)
theorem permutationDraw_swapPosition {N : ℕ} (y : Fin N → ℝ) (k : ℕ) (hk : k < N) (π : PermutationSampleSpace N) (j : Fin N) : permutationDraw y k hk (permutationSwapPosition π k hk j) = y (π j) := by simp [permutationDraw, permutationSwapPosition, Equiv.Perm.mul_apply] -
sum_prefixFiber_permutationDraw_eq_positiontheorem — Given population outcomes, a valid current position, an ordering whose prefix fixes the conditioning fiber, and an unrevealed position, the fiber sum of the current draw equals the fiber sum of the outcome at that unrevealed position.hypothesesconclusion(∑ σ : PermutationSampleSpace N, if permutationPrefix k σ = permutationPrefix k π then permutationDraw y k hk σ else 0)= ∑ σ : PermutationSampleSpace N, if permutationPrefix k σ = permutationPrefix k π then y (σ j) else 0Proof (Lean source)
theorem sum_prefixFiber_permutationDraw_eq_position {N : ℕ} (y : Fin N → ℝ) (k : ℕ) (hk : k < N) (π : PermutationSampleSpace N) (j : Fin N) (hj : k ≤ j.val) : (∑ σ : PermutationSampleSpace N, if permutationPrefix k σ = permutationPrefix k π then permutationDraw y k hk σ else 0) = ∑ σ : PermutationSampleSpace N, if permutationPrefix k σ = permutationPrefix k π then y (σ j) else 0 := by classical let e : Perm (PermutationSampleSpace N) := Equiv.mulRight (swap ⟨k, hk⟩ j) let g : PermutationSampleSpace N → ℝ := fun σ => if permutationPrefix k σ = permutationPrefix k π then permutationDraw y k hk σ else 0 have hsum := Equiv.sum_comp e g have he : ∀ σ, e σ = permutationSwapPosition σ k hk j := fun _ => rfl simpa only [g, he, permutationPrefix_swapPosition _ k hk j hj, permutationDraw_swapPosition] using hsum.symm -
sum_remainingPositions_eq_permutationRemainingSumtheorem — For population outcomes, a feasible prefix length, and an ordering, the sum over the remaining positions equals the population total minus the revealed-position sum.hypothesesconclusion(∑ j : Fin (N - k), y (π (permutationRemainingPosition k hk j)))= permutationRemainingSum y k hk πProof (Lean source)
theorem sum_remainingPositions_eq_permutationRemainingSum {N : ℕ} (y : Fin N → ℝ) (k : ℕ) (hk : k ≤ N) (π : PermutationSampleSpace N) : (∑ j : Fin (N - k), y (π (permutationRemainingPosition k hk j))) = permutationRemainingSum y k hk π := by let e : Fin k ⊕ Fin (N - k) ≃ Fin N := finSumFinEquiv.trans (finCongr (Nat.add_sub_of_le hk)) have hsplit := Equiv.sum_comp e (fun i : Fin N => y (π i)) change _ = (∑ i : Fin N, y (π i)) - ∑ i : Fin k, y (π (castLE hk i)) rw [← hsplit] rw [Fintype.sum_sum_type] have hleft : (∑ i : Fin k, y (π (e (inl i)))) = ∑ i : Fin k, y (π (castLE hk i)) := by apply Finset.sum_congr rfl intro i _ congr 2 have hright : (∑ j : Fin (N - k), y (π (e (inr j)))) = ∑ j : Fin (N - k), y (π (permutationRemainingPosition k hk j)) := by apply Finset.sum_congr rfl intro j _ congr 2 rw [hleft, hright] ring -
permutationRemainingSum_eq_of_prefix_eqtheorem — Given population outcomes, a feasible prefix length, and two orderings with the same revealed prefix, their remaining outcome sums are equal.hypothesesconclusionpermutationRemainingSum y k hk σ = permutationRemainingSum y k hk πProof (Lean source)
theorem permutationRemainingSum_eq_of_prefix_eq {N : ℕ} (y : Fin N → ℝ) (k : ℕ) (hk : k ≤ N) (σ π : PermutationSampleSpace N) (hprefix : permutationPrefix k σ = permutationPrefix k π) : permutationRemainingSum y k hk σ = permutationRemainingSum y k hk π := by have hfullσ : (∑ i : Fin N, y (σ i)) = ∑ i : Fin N, y i := Equiv.sum_comp σ y have hfullπ : (∑ i : Fin N, y (π i)) = ∑ i : Fin N, y i := Equiv.sum_comp π y have hreveal : permutationRevealedSum y k hk σ = permutationRevealedSum y k hk π := by apply Finset.sum_congr rfl intro i _ have hi : (castLE hk i).val < k := i.isLt have hcoord := congrFun hprefix (castLE hk i) simp only [permutationPrefix, hi, if_true, Option.some.injEq] at hcoord rw [hcoord] simp only [permutationRemainingSum, hfullσ, hfullπ, hreveal] -
remainingCount_mul_sum_prefixFiber_permutationDrawtheorem — Given population outcomes, a valid current position, and an ordering fixing the conditioning fiber, the number of remaining positions times the fiber sum of the next draw equals the fiber count times the fixed remaining outcome sum.hypothesesconclusion((N - k : ℕ) : ℝ) * (∑ σ : PermutationSampleSpace N, if permutationPrefix k σ = permutationPrefix k π then permutationDraw y k hk σ else 0)= (∑ σ : PermutationSampleSpace N, if permutationPrefix k σ = permutationPrefix k π then (1 : ℝ) else 0) * permutationRemainingSum y k hk.le πProof (Lean source)
theorem remainingCount_mul_sum_prefixFiber_permutationDraw {N : ℕ} (y : Fin N → ℝ) (k : ℕ) (hk : k < N) (π : PermutationSampleSpace N) : ((N - k : ℕ) : ℝ) * (∑ σ : PermutationSampleSpace N, if permutationPrefix k σ = permutationPrefix k π then permutationDraw y k hk σ else 0) = (∑ σ : PermutationSampleSpace N, if permutationPrefix k σ = permutationPrefix k π then (1 : ℝ) else 0) * permutationRemainingSum y k hk.le π := by classical let drawFiberSum : ℝ := ∑ σ : PermutationSampleSpace N, if permutationPrefix k σ = permutationPrefix k π then permutationDraw y k hk σ else 0 calc ((N - k : ℕ) : ℝ) * drawFiberSum = ∑ j : Fin (N - k), drawFiberSum := by simp _ = ∑ j : Fin (N - k), ∑ σ : PermutationSampleSpace N, if permutationPrefix k σ = permutationPrefix k π then y (σ (permutationRemainingPosition k hk.le j)) else 0 := by apply Finset.sum_congr rfl intro j _ exact sum_prefixFiber_permutationDraw_eq_position y k hk π (permutationRemainingPosition k hk.le j) (by simp [permutationRemainingPosition]) _ = ∑ σ : PermutationSampleSpace N, ∑ j : Fin (N - k), if permutationPrefix k σ = permutationPrefix k π then y (σ (permutationRemainingPosition k hk.le j)) else 0 := by rw [Finset.sum_comm] _ = ∑ σ : PermutationSampleSpace N, if permutationPrefix k σ = permutationPrefix k π then permutationRemainingSum y k hk.le π else 0 := by apply Finset.sum_congr rfl intro σ _ by_cases hprefix : permutationPrefix k σ = permutationPrefix k π · simp only [hprefix, if_true] rw [sum_remainingPositions_eq_permutationRemainingSum] exact permutationRemainingSum_eq_of_prefix_eq y k hk.le σ π hprefix · simp [hprefix] _ = (∑ σ : PermutationSampleSpace N, if permutationPrefix k σ = permutationPrefix k π then (1 : ℝ) else 0) * permutationRemainingSum y k hk.le π := by rw [Finset.sum_mul] apply Finset.sum_congr rfl intro σ _ by_cases hprefix : permutationPrefix k σ = permutationPrefix k π <;> simp [hprefix] -
permutationDraw_stronglyMeasurabletheorem — For a population outcome vector and a valid draw position, the draw is measurable immediately after that position is revealed.hypothesesconclusionProof (Lean source)
@[fun_prop] theorem permutationDraw_stronglyMeasurable {N : ℕ} (y : Fin N → ℝ) (k : ℕ) (hk : k < N) : StronglyMeasurable[(permutationRevealFiltration N) (k + 1)] (permutationDraw y k hk) := by apply Measurable.stronglyMeasurable apply (measurable_of_finite y).comp have hcoord : Measurable[(permutationRevealFiltration N) (k + 1)] (fun π : PermutationSampleSpace N => π ⟨k, hk⟩) := by let read : (Fin N → Option (Fin N)) → Fin N := fun x => (x ⟨k, hk⟩).getD ⟨k, hk⟩ have hread : Measurable read := measurable_of_finite _ have heq : (fun π : PermutationSampleSpace N => π ⟨k, hk⟩) = read ∘ permutationPrefix (k + 1) := by funext π simp [read, permutationPrefix] rw [heq] exact hread.comp (comap_measurable _) exact hcoord -
permutationNextMean_stronglyMeasurabletheorem — For population outcomes and a valid next-draw position, the prefix-conditional next-draw mean is measurable before that draw.hypothesesconclusionProof (Lean source)
@[fun_prop] theorem permutationNextMean_stronglyMeasurable {N : ℕ} (y : Fin N → ℝ) (k : ℕ) (hk : k < N) : StronglyMeasurable[(permutationRevealFiltration N) k] (permutationNextMean y k hk) := by apply Measurable.stronglyMeasurable exact (measurable_of_finite (finiteConditionalMean (uniformPermutationDesign N) (permutationPrefix k) (permutationDraw y k hk))).comp (comap_measurable _) -
permutationNextMean_ae_eq_condExptheorem — For a population outcome vector and a valid draw position, the explicit prefix-fiber mean of the next draw equals its measure-theoretic conditional expectation given the preceding draws.hypothesesconclusionpermutationNextMean y k hk=ᵐ[(uniformPermutationDesign N).toMeasure] ((uniformPermutationDesign N).toMeasure)[ permutationDraw y k hk | (permutationRevealFiltration N) k]Proof (Lean source)
theorem permutationNextMean_ae_eq_condExp {N : ℕ} (y : Fin N → ℝ) (k : ℕ) (hk : k < N) : permutationNextMean y k hk =ᵐ[(uniformPermutationDesign N).toMeasure] ((uniformPermutationDesign N).toMeasure)[ permutationDraw y k hk | (permutationRevealFiltration N) k] := by change (fun π => finiteConditionalMean (uniformPermutationDesign N) (permutationPrefix k) (permutationDraw y k hk) (permutationPrefix k π)) =ᵐ[(uniformPermutationDesign N).toMeasure] ((uniformPermutationDesign N).toMeasure)[permutationDraw y k hk | comap (permutationPrefix k) inferInstance] exact finiteConditionalMean_comp_ae_eq_condExp (uniformPermutationDesign N) (permutationPrefix k) (permutationDraw y k hk) -
permutationNextVariance_ae_eq_condExptheorem — For population outcomes and a valid next-draw position, the explicit remaining-population variance equals the conditional expectation of the squared centered next draw.hypothesesconclusionpermutationNextVariance y k hk=ᵐ[(uniformPermutationDesign N).toMeasure] ((uniformPermutationDesign N).toMeasure)[ (fun π => (permutationDraw y k hk π - permutationNextMean y k hk π) ^ 2) | (permutationRevealFiltration N) k]Proof (Lean source)
theorem permutationNextVariance_ae_eq_condExp {N : ℕ} (y : Fin N → ℝ) (k : ℕ) (hk : k < N) : permutationNextVariance y k hk =ᵐ[(uniformPermutationDesign N).toMeasure] ((uniformPermutationDesign N).toMeasure)[ (fun π => (permutationDraw y k hk π - permutationNextMean y k hk π) ^ 2) | (permutationRevealFiltration N) k] := by change (fun π => finiteConditionalMean (uniformPermutationDesign N) (permutationPrefix k) (fun σ => (permutationDraw y k hk σ - permutationNextMean y k hk σ) ^ 2) (permutationPrefix k π)) =ᵐ[(uniformPermutationDesign N).toMeasure] ((uniformPermutationDesign N).toMeasure)[ (fun π => (permutationDraw y k hk π - permutationNextMean y k hk π) ^ 2) | comap (permutationPrefix k) inferInstance] exact finiteConditionalMean_comp_ae_eq_condExp (uniformPermutationDesign N) (permutationPrefix k) (fun π => (permutationDraw y k hk π - permutationNextMean y k hk π) ^ 2)
TwoStage 4 core · 0 supporting Compound designs combine a stage-one design with conditionally independent stage-two designs. ★ compound★ E_compound★ E_compound_factor
Two-stage compound randomization designs
Compound designs combine a stage-one design with conditionally independent stage-two designs.
The definition compound builds the joint finite design on (stage_one, stage_two_assignments)
from a first-stage design and conditionally independent coordinate designs. Lemma
FiniteDesign.E_compound expands expectations as an iterated finite sum, and
FiniteDesign.E_compound_factor collapses the stage-two expectation of a statistic that depends on
one coordinate to that coordinate's conditional marginal expectation.
For a finite space of first-stage outcomes, a finite space of second-stage outcomes, a probability design for the first stage, and a rule assigning a probability design for the second stage after each first-stage outcome, the compound two-stage design assigns a pair of outcomes the product of its first-stage probability and its conditional second-stage probability.
Definition (Lean source)
For a finite space of first-stage outcomes, a finite index set for second-stage coordinates, a finite outcome space for each coordinate, a probability design for the first stage, and a rule assigning, after each first-stage outcome, a design to each coordinate, the compound two-stage design first draws the first-stage outcome and then independently draws every coordinate from its conditional design.
Definition (Lean source)
For the stage-2 design map assigning each stage-1 outcome s a per-coordinate design D₂ s and any real-valued function X of the joint outcome, built on top of a stage-1 design D₁, the expectation of X under the compound (two-stage) design equals the double sum over stage-1 outcomes s and stage-2 profiles w of the compound probability D₁.p(s)·∏ᵢ(D₂ s i).p(wᵢ) times X(s,w).
Formal statement
Proof (Lean source)
Stage-2 collapse. For the stage-2 design map assigning each stage-1 outcome s a per-coordinate design D₂ s, the compound-design expectation of the product of a stage-1 quantity h(s) and a function g of a single group j's within-assignment wⱼ factors through the marginal expectation of group j's conditional design: E[h(s)·g(wⱼ)] = E_s[h(s)·E_{D₂ s j}[g]].
Formal statement
Proof (Lean source)
CompoundVariance 1 core · 1 supporting This file proves the expectation tower property FiniteDesign.E_compound_tower for the two-stage compound design and the corresponding law of total variance FiniteDesign.Var_compound_eq_tower. ★ Var_compound_eq_tower
Compound-design variance decomposition
This file proves the expectation tower property FiniteDesign.E_compound_tower for the two-stage
compound design and the corresponding law of total variance
FiniteDesign.Var_compound_eq_tower. The decomposition writes total variance as expected
within-stage variance plus the stage-1 variance of the stage-2 conditional mean, the algebraic form
used by partial-interference between-group and within-group variance decompositions.
Law of total variance for the two-stage compound design. For a stage-1 design D₁ paired with a stage-2 design D₂ s at every stage-1 outcome s, applied to any statistic X on the joint outcome space, the total variance of X under the compound design decomposes as the stage-1 expectation of the stage-2 conditional variance of X, plus the stage-1 variance of the stage-2 conditional mean of X:
Formal statement
Proof (Lean source)
1 supporting declaration (lemmas, instances)
-
E_compound_towerlemma — Tower property of expectation for the compound design. The compound expectation iterates as the stage-1 expectation of the stage-2 product-design conditional expectation, E[F] = E_s[E_{D₂ s}[F(s, ·)]].hypothesesΩ₁ :sharedType u_1ι :sharedType u_2ι → Type u_3D₁ :FiniteDesign Ω₁D₂ :Ω₁ → ∀ i, FiniteDesign (α i)F :(Ω₁ × ∀ i, α i) → ℝconclusion(compound D₁ D₂).E F = D₁.E (fun s => (prodDesign (D₂ s)).E (fun w => F (s, w)))Proof (Lean source)
lemma E_compound_tower (D₁ : FiniteDesign Ω₁) (D₂ : Ω₁ → ∀ i, FiniteDesign (α i)) (F : (Ω₁ × ∀ i, α i) → ℝ) : (compound D₁ D₂).E F = D₁.E (fun s => (prodDesign (D₂ s)).E (fun w => F (s, w))) := by rw [E_compound] simp only [FiniteDesign.E, prodDesign_p] apply Finset.sum_congr rfl intro s _ rw [Finset.mul_sum] apply Finset.sum_congr rfl intro w _ ring
Concentration 2 core · 2 supporting For a finite design D and a statistic X bounded by c, with design mean 0 and design variance at most v, bernstein_ge gives the one-sided tail bound Pr[ε ≤ X] ≤ exp(−ε² / (2(2v + cε))) and bernstein_abs_ge the two-sided b ★ bernstein_abs_ge★ bernstein_sum_ge_of_iIndepFun
Bernstein concentration for a bounded design statistic
For a finite design D and a statistic X bounded by c, with design mean 0 and design
variance at most v, bernstein_ge gives the one-sided tail bound
Pr[ε ≤ X] ≤ exp(−ε² / (2(2v + cε))) and bernstein_abs_ge the two-sided bound
Pr[ε ≤ |X|] ≤ 2·exp(−ε² / (2(2v + cε))). These are exponentially sharper than the Chebyshev
bound Var/ε², and are obtained from the measure-theoretic sub-exponential Chernoff bound through
the design-to-measure bridge. Their constant is a single-statistic sub-exponential proxy; the
independent-summand theorem bernstein_sum_ge_of_iIndepFun below has the sharp textbook constant.
Bernstein tail for a bounded design statistic (two-sided). For a statistic X on a finite design, suppose the bound c is nonnegative, X has design mean 0 , X is bounded in absolute value by c everywhere, the design variance of X is at most v, and the threshold ε is nonnegative. Then the design probability that X deviates from 0 by at least ε in absolute value is at most 2·exp(−ε²/(2(2v + cε))), twice the corresponding one-sided sub-exponential-proxy bound.
Formal statement
Proof (Lean source)
Sharp design-based Bernstein inequality for independent summands. Given a design law, a positive summand count, and summands that are independent under that law, centered in design expectation, bounded above by the nonnegative envelope b, and have second design moments at most the positive proxy σ², then for a nonnegative deviation ε, the design probability that their sum exceeds nε is at most exp (−nε²/(2(σ²+bε/3))).
Formal statement
Proof (Lean source)
2 supporting declarations (lemmas, instances)
-
hasSubexponentialMGF_of_boundedlemma — A bounded, mean-zero statistic on a finite design is sub-exponential under the design measure, with variance-proxy 2v and scale c. This is the finite-design instance of the Bernstein sub-exponential lemma, obtained through the measure bridge.hypothesesΩ :sharedType u_1X :Ω → ℝc v :ℝhc :0 ≤ chmean :D.E X = 0hbound :∀ z, |X z| ≤ chvar :D.Var X ≤ vconclusionHasSubexponentialMGF X ⟨2 * v, by exact mul_nonneg (by norm_num) (le_trans (D.E_nonneg fun _ => sq_nonneg _) hvar)⟩ ⟨c, hc⟩ D.toMeasureProof (Lean source)
lemma hasSubexponentialMGF_of_bounded (X : Ω → ℝ) {c v : ℝ} (hc : 0 ≤ c) (hmean : D.E X = 0) (hbound : ∀ z, |X z| ≤ c) (hvar : D.Var X ≤ v) : HasSubexponentialMGF X ⟨2 * v, by exact mul_nonneg (by norm_num) (le_trans (D.E_nonneg fun _ => sq_nonneg _) hvar)⟩ ⟨c, hc⟩ D.toMeasure := by have hmean' : D.toMeasure[X] = 0 := (D.integral_toMeasure X).trans hmean have hvar' : D.toMeasure[fun ω => X ω ^ 2] ≤ v := by rw [D.integral_toMeasure (fun z => X z ^ 2)] have : D.E (fun z => X z ^ 2) = D.Var X := by rw [D.Var_eq X, hmean]; ring rw [this]; exact hvar have hv : 0 ≤ v := le_trans (D.E_nonneg fun _ => sq_nonneg _) hvar simpa only [Real.sq_sqrt hv] using bounded_hasSubexponentialMGF (σ := sqrt v) hc (D.aemeasurable_toMeasure X) hmean' (Filter.Eventually.of_forall hbound) (by simpa only [Real.sq_sqrt hv] using hvar') -
bernstein_getheorem — Sub-exponential-proxy tail for one bounded design statistic. If a statistic is bounded by c, has design mean 0, and has design variance at most v, then it exceeds a nonnegative threshold ε with probability at most exp(−ε² / (2(2v + cε))). This is the older single-statistic proxy constant; use bernstein_sum_ge_of_iIndepFun for independent summands and the textbook Bernstein constant.hypothesesΩ :sharedType u_1X :Ω → ℝc v ε :ℝhc :0 ≤ chmean :D.E X = 0hbound :∀ z, |X z| ≤ chvar :D.Var X ≤ vhε :0 ≤ εconclusionD.Pr (fun z => ε ≤ X z) ≤ exp (-ε ^ 2 / (2 * (2 * v + c * ε)))Proof (Lean source)
theorem bernstein_ge (X : Ω → ℝ) {c v ε : ℝ} (hc : 0 ≤ c) (hmean : D.E X = 0) (hbound : ∀ z, |X z| ≤ c) (hvar : D.Var X ≤ v) (hε : 0 ≤ ε) : D.Pr (fun z => ε ≤ X z) ≤ exp (-ε ^ 2 / (2 * (2 * v + c * ε))) := by have hsub := D.hasSubexponentialMGF_of_bounded X hc hmean hbound hvar have h := hsub.measure_ge_le hε rw [D.toMeasure_real_setOf (fun z => ε ≤ X z)] at h -- `((⟨_, _⟩ : ℝ≥0) : ℝ)` is definitionally the underlying real, so `exact` closes this -- at default transparency (`simpa`'s final check no longer unfolds it). exact h
DependencyCLT 1 core · 0 supporting dependency_studentized_cdf transports the bounded-degree dependency-graph CLT to the finite-design layer: for a sequence of designs whose unit contributions X n are uniformly bounded, mean-zero, and dependent only across ★ dependency_studentized_cdf
Design-based dependency-graph CLT
dependency_studentized_cdf transports the bounded-degree dependency-graph CLT to the finite-design
layer: for a sequence of designs whose unit contributions X n are uniformly bounded, mean-zero,
and dependent only across a bounded-degree graph, with the standardizing variance v n bounded
below by a constant multiple of the number of units, the studentized statistic
depSum(X n)/√(v n) has standard-normal limiting CDF under D n. It is stated in the
FiniteDesign.Pr form so it plugs directly into
conservative_wald_liminf_of_feasible_studentized_cdf.
Design-based dependency-graph CLT (studentized CDF form). Consider a sequence of finite designs D n together with a triangular array of unit contributions X n i and, for each n, a dependency-graph structure Dep n on the units. Suppose every neighbourhood in the dependency graph has size at most Dmax, the contributions are uniformly bounded by a nonnegative constant M, each contribution has design mean 0, the design second moment v n of the aggregate depSum(X n) is recorded exactly, a positive constant c eventually lower-bounds v n by c times the number of units, and the number of units diverges to infinity. Then, at every point s, the studentized aggregate depSum(X n)/√(v n) has, under the design D n, a limiting CDF equal to the standard normal CDF at s.
Formal statement
Proof (Lean source)
EdgeVarianceBound 1 core · 5 supporting This file proves bounded-expectation and bounded-covariance helpers for FiniteDesign (abs_E_le, abs_Cov_le_two_sq, and Cov_zero_left) and the main dependency-graph edge-sum variance inequality var_edge_sum_le. ★ var_edge_sum_le
Edge-sum variance bound for finite designs
This file proves bounded-expectation and bounded-covariance helpers for FiniteDesign
(abs_E_le, abs_Cov_le_two_sq, and Cov_zero_left) and the main dependency-graph edge-sum
variance inequality var_edge_sum_le. The final theorem controls the variance of a sum of bounded
edge-indexed statistics by 8 * M ^ 2 * (m ^ 3 * N) when the edge variables vanish off a symmetric
bounded-degree graph and are uncorrelated across graph-separated edges.
Variance of an edge-sum over a bounded-degree dependency graph. Consider real-valued statistics b i j attached to ordered pairs of units, all defined on the same finite design. Suppose every statistic attached to an edge of a graph G is bounded in absolute value by a nonnegative constant M, G is symmetric, every unit has at most m neighbours in G, every statistic attached to a pair that is not an edge of G is identically zero, and two statistics are uncorrelated whenever no edge of G connects an endpoint of one pair to an endpoint of the other. Then the variance of the double sum ∑ᵢ∑ⱼ b i j is at most 8·M²·m³·N, where N is the number of units.
Formal statement
Proof (Lean source)
5 supporting declarations (lemmas, instances)
-
abs_E_lelemma — The expectation of a random variable whose absolute value is bounded by M pointwise is itself bounded by M in absolute value.hypothesesconclusion|D.E X| ≤ MProof (Lean source)
lemma abs_E_le {X : Ω → ℝ} {M : ℝ} (h : ∀ z, |X z| ≤ M) : |D.E X| ≤ M := by apply abs_le.mpr constructor · -- -M ≤ D.E X have hptw : ∀ z, 0 ≤ X z + M := by intro z; have := abs_le.mp (h z); linarith have hpos : 0 ≤ D.E (fun z => X z + M) := D.E_nonneg hptw have heq : D.E (fun z => X z + M) = D.E X + M := by rw [D.E_add]; simp [D.E_const] rw [heq] at hpos; linarith · -- D.E X ≤ M have hptw : ∀ z, 0 ≤ M - X z := by intro z; have := abs_le.mp (h z); linarith have hpos : 0 ≤ D.E (fun z => M - X z) := D.E_nonneg hptw have heq : D.E (fun z => M - X z) = M - D.E X := by rw [D.E_sub]; simp [D.E_const] rw [heq] at hpos; linarith -
E_monolemma — If one statistic is pointwise no larger than another, then its design expectation is no larger.hypothesesconclusionD.E X ≤ D.E YProof (Lean source)
lemma E_mono {X Y : Ω → ℝ} (h : ∀ z, X z ≤ Y z) : D.E X ≤ D.E Y := Finset.sum_le_sum (fun z _ => mul_le_mul_of_nonneg_left (h z) (D.p_nonneg z)) -
abs_E_le_E_abslemma — The absolute value of a finite-design expectation is at most the expectation of the statistic's absolute value.hypothesesconclusion|D.E X| ≤ D.E (fun z => |X z|)Proof (Lean source)
lemma abs_E_le_E_abs (X : Ω → ℝ) : |D.E X| ≤ D.E (fun z => |X z|) := by rw [abs_le] constructor · have hpos : 0 ≤ D.E (fun z => |X z| + X z) := D.E_nonneg (fun z => by linarith [neg_abs_le (X z)]) rw [D.E_add] at hpos linarith · have hpos : 0 ≤ D.E (fun z => |X z| - X z) := D.E_nonneg (fun z => by linarith [le_abs_self (X z)]) rw [D.E_sub] at hpos linarith -
abs_Cov_le_two_sqlemma — The design covariance of random variables bounded by MX and MY in absolute value pointwise is bounded by 2·MX·MY in absolute value.hypothesesΩ :sharedType u_1X Y :Ω → ℝMX MY :ℝhMX :0 ≤ MXhX :∀ z, |X z| ≤ MXhY :∀ z, |Y z| ≤ MYconclusion|D.Cov X Y| ≤ 2 * MX * MYProof (Lean source)
lemma abs_Cov_le_two_sq {X Y : Ω → ℝ} {MX MY : ℝ} (hMX : 0 ≤ MX) (hX : ∀ z, |X z| ≤ MX) (hY : ∀ z, |Y z| ≤ MY) : |D.Cov X Y| ≤ 2 * MX * MY := by rw [D.Cov_eq] have hExy : |D.E (fun z => X z * Y z)| ≤ MX * MY := by apply D.abs_E_le (X := fun z => X z * Y z) (M := MX * MY) intro z rw [abs_mul] exact mul_le_mul (hX z) (hY z) (abs_nonneg _) hMX have hEX : |D.E X| ≤ MX := D.abs_E_le hX have hEY : |D.E Y| ≤ MY := D.abs_E_le hY have hprod : |D.E X * D.E Y| ≤ MX * MY := by rw [abs_mul] exact mul_le_mul hEX hEY (abs_nonneg _) hMX calc |D.E (fun z => X z * Y z) - D.E X * D.E Y| ≤ |D.E (fun z => X z * Y z)| + |D.E X * D.E Y| := abs_sub _ _ _ ≤ MX * MY + MX * MY := by linarith _ = 2 * MX * MY := by ring -
Cov_zero_leftlemma — The covariance of the identically-zero random variable with anything is zero.hypothesesconclusionD.Cov (fun _ => 0) Y = 0Proof (Lean source)
lemma Cov_zero_left (Y : Ω → ℝ) : D.Cov (fun _ => 0) Y = 0 := by rw [D.Cov_eq] have h1 : D.E (fun z => (0 : ℝ) * Y z) = 0 := by rw [D.E_congr (fun z => zero_mul (Y z)), D.E_const] have h2 : D.E (fun _ : Ω => (0 : ℝ)) = 0 := D.E_const 0 rw [h1, h2]; ring
HeydeBrownBridge 14 core · 6 supporting This module turns a finite product randomization design into the product probability space and reveal filtration needed by a supplied fourth-moment Kolmogorov-bound premise. ★ finiteDesign_kolmogorovBound_of_heydeBrownPremise
Finite-design fourth-moment-premise bridge
This module turns a finite product randomization design into the product probability space and reveal filtration needed by a supplied fourth-moment Kolmogorov-bound premise. It identifies the finite and measure-theoretic conditional expectations, predictable variations, moments, and CDF expressions, then transports that supplied premise without proving a Heyde--Brown inequality.
A reveal permutation and coordinate determine that coordinate's reveal rank, namely the step at which the permutation reveals it.
A reveal permutation, prefix length, and two assignments determine agreement through the reveal prefix: the assignments have the same values on every coordinate already revealed by this equality condition.
Definition (Lean source)
A reveal permutation and prefix length determine the σ-algebra generated by the revealed coordinates, which records exactly the information available after that many reveal steps by generating from those coordinate evaluations.
Definition (Lean source)
A reveal permutation determines the reveal filtration, whose time-k σ-algebra is the prefix σ-algebra, is monotone in reveal time, and lies inside the full product σ-algebra.
Definition (Lean source)
A family of coordinate designs, reveal permutation, prefix length, and statistic determine the explicit prefix conditional expectation, obtained by averaging over unrevealed coordinates while holding revealed coordinates fixed by the stated finite sum.
Definition (Lean source)
A family of coordinate designs, reveal permutation, and increment family satisfy the prefix martingale-difference condition when each increment has zero conditional mean immediately before its reveal and is visible after that reveal.
Definition (Lean source)
A family of coordinate designs, reveal permutation, and increment family determine the finite-design predictable variation, the sum of conditional second moments just before each reveal step by the displayed finite sum.
Definition (Lean source)
A measure (in intended use a probability measure; none is required), filtration, and increment family determine the measure-theoretic predictable variation, the sum of conditional second moments at the preceding filtration times by the displayed finite sum.
Definition (Lean source)
A family of coordinate designs, reveal permutation, and increment family determine the finite fourth-moment error: the sum of fourth moments plus the second moment of predictable variation minus one by the displayed sum of two terms.
Definition (Lean source)
A measure (in intended use a probability measure; none is required), filtration, and increment family determine the measure-theoretic fourth-moment error: the sum of fourth moments plus the second moment of predictable variation minus one by the displayed sum of two terms.
Definition (Lean source)
A finite randomization design and real statistic determine its finite-design Kolmogorov expression, the largest absolute gap between its CDF and the standard-normal CDF by taking the supremum over thresholds.
Definition (Lean source)
A measure and real random variable determine its measure-theoretic Kolmogorov expression, the largest absolute gap between its CDF and the standard-normal CDF by taking the supremum over thresholds. No probability-measure assumption is made: the CDF term is the real-valued measure of the lower set (zero where that measure is infinite), and an unbounded family of gaps has supremum zero by convention; for a probability measure the gaps are bounded and this is the usual Kolmogorov distance.
Definition (Lean source)
A measure (in intended use a probability measure; the premise itself does not require one), filtration, increment family, and constant define the supplied Heyde--Brown fourth-moment premise: adapted, centered, normalized increments with finite fourth moments obey the stated one-fifth-power Kolmogorov bound by the four displayed assumptions and conclusion.
Definition (Lean source)
Given coordinate designs, a reveal permutation, an increment family, and a bound constant, if the increments are prefix martingale differences, their total second moment is one, and the supplied Heyde--Brown premise holds, then their sum satisfies the finite-design Kolmogorov bound transported from that premise.
Formal statement
Proof (Lean source)
6 supporting declarations (lemmas, instances)
-
prefixCondExp_ae_eq_condExptheorem — A family of coordinate designs, reveal permutation, prefix length, and statistic give an almost-everywhere identification of the explicit prefix average with conditional expectation under the product-design measure and its reveal σ-algebra.hypothesesconclusionprefixCondExp D pi k fProof (Lean source)
theorem prefixCondExp_ae_eq_condExp (D : ∀ i, FiniteDesign (alpha i)) (pi : Perm (Fin N)) (k : Fin (N + 1)) (f : (∀ i, alpha i) → ℝ) : prefixCondExp D pi k f =ᵐ[(prodDesign D).toMeasure] (prodDesign D).toMeasure[f | (revealFiltration pi) k] := by classical let m0 : MeasurableSpace (∀ i, alpha i) := inferInstance let m : MeasurableSpace (∀ i, alpha i) := (revealFiltration pi) k let mInv : MeasurableSpace (∀ i, alpha i) := by exact { MeasurableSet' := fun s ↦ ∀ w w', AgreeOnPrefix pi k w w' → (w ∈ s ↔ w' ∈ s) measurableSet_empty := by simp measurableSet_compl := by intro s hs w w' hww' simpa only [Set.mem_compl_iff] using not_congr (hs w w' hww') measurableSet_iUnion := by intro s hs w w' hww' constructor <;> intro hw · simp only [Set.mem_iUnion] at hw ⊢ obtain ⟨i, hi⟩ := hw exact ⟨i, (hs i w w' hww').1 hi⟩ · simp only [Set.mem_iUnion] at hw ⊢ obtain ⟨i, hi⟩ := hw exact ⟨i, (hs i w w' hww').2 hi⟩ } have hm : m ≤ m0 := by simpa only [m, m0] using (revealFiltration pi).le k have hmInv : m ≤ mInv := by unfold m revealFiltration revealMeasurableSpace refine iSup_le fun i ↦ ?_ by_cases hi : (prefixRank pi i).val < k.val · simp only [hi, if_true] intro s hs rw [MeasurableSpace.measurableSet_comap] at hs obtain ⟨t, ht, rfl⟩ := hs change ∀ w w', AgreeOnPrefix pi k w w' → (w i ∈ t ↔ w' i ∈ t) intro w w' hww' rw [hww' i hi] · simp [hi] have hmem_of_agree {s : Set (∀ i, alpha i)} (hs : MeasurableSet[m] s) {w w' : ∀ i, alpha i} (hww' : AgreeOnPrefix pi k w w') : w ∈ s ↔ w' ∈ s := by exact hmInv s hs w w' hww' have hcell (w' : ∀ i, alpha i) : MeasurableSet[m] {w | AgreeOnPrefix pi k w w'} := by have hset : {w | AgreeOnPrefix pi k w w'} = ⋂ i, if (prefixRank pi i).val < k.val then {w | w i = w' i} else univ := by ext w simp only [Set.mem_ofPred_eq, Set.mem_iInter] constructor · intro h i by_cases hi : (prefixRank pi i).val < k.val · simp [hi, (h i hi).symm] · simp [hi] · intro h i hi have h' : w i = w' i := by simpa [hi] using h i exact h'.symm rw [hset] refine MeasurableSet.iInter fun i ↦ ?_ by_cases hi : (prefixRank pi i).val < k.val · simp only [hi, if_true] have hbase : MeasurableSet[ comap (fun w : ∀ q, alpha q => w i) (inferInstance)] {w | w i = w' i} := (measurableSet_singleton (w' i)).preimage (comap_measurable (fun w : ∀ q, alpha q => w i)) have hcomponent : MeasurableSet[ if (prefixRank pi i).val < k.val then comap (fun w : ∀ q, alpha q => w i) inferInstance else ⊥] {w | w i = w' i} := by rw [if_pos hi] exact hbase exact (le_iSup (fun j : Fin N ↦ if (prefixRank pi j).val < k.val then comap (fun w : ∀ q, alpha q => w j) inferInstance else ⊥) i) _ hcomponent · simp [hi] have hmeas : Measurable[m] (prefixCondExp D pi k f) := by unfold prefixCondExp exact Finset.measurable_sum univ fun w' _ ↦ Measurable.ite (hcell w') measurable_const measurable_const let _ : MeasurableSpace (∀ i, alpha i) := m0 have hf : Integrable f (prodDesign D).toMeasure := Integrable.of_finite refine ae_eq_condExp_of_forall_setIntegral_eq hm hf ?_ ?_ hmeas.stronglyMeasurable.aestronglyMeasurable · intro s _ _ exact (show Integrable (prefixCondExp D pi k f) (prodDesign D).toMeasure from Integrable.of_finite).integrableOn · intro s hs _ have hs0 : MeasurableSet[m0] s := hm s hs rw [← integral_indicator hs0, ← integral_indicator hs0, FiniteDesign.integral_toMeasure, FiniteDesign.integral_toMeasure] have hmass (w' : ∀ i, alpha i) : (∑ z : ∀ i, alpha i, if AgreeOnPrefix pi k z w' then ∏ i, (D i).p (z i) else 0) = ∏ i, if (prefixRank pi i).val < k.val then (D i).p (w' i) else 1 := by have hterm (z : ∀ i, alpha i) : (if AgreeOnPrefix pi k z w' then ∏ i, (D i).p (z i) else 0) = ∏ i, if (prefixRank pi i).val < k.val then if z i = w' i then (D i).p (z i) else 0 else (D i).p (z i) := by by_cases hz : AgreeOnPrefix pi k z w' · rw [if_pos hz] apply Finset.prod_congr rfl intro i _ by_cases hi : (prefixRank pi i).val < k.val · simp [hi, (hz i hi).symm] · simp [hi] · rw [if_neg hz] simp only [AgreeOnPrefix] at hz push Not at hz obtain ⟨i, hi, hne⟩ := hz exact (Finset.prod_eq_zero (Finset.mem_univ i) (by simp [hi, hne.symm])).symm calc (∑ z : ∀ i, alpha i, if AgreeOnPrefix pi k z w' then ∏ i, (D i).p (z i) else 0) = ∑ z : ∀ i, alpha i, ∏ i, if (prefixRank pi i).val < k.val then if z i = w' i then (D i).p (z i) else 0 else (D i).p (z i) := Finset.sum_congr rfl fun z _ ↦ hterm z _ = ∏ i, ∑ a : alpha i, if (prefixRank pi i).val < k.val then if a = w' i then (D i).p a else 0 else (D i).p a := (Fintype.prod_sum (fun i (a : alpha i) ↦ if (prefixRank pi i).val < k.val then if a = w' i then (D i).p a else 0 else (D i).p a)).symm _ = ∏ i, if (prefixRank pi i).val < k.val then (D i).p (w' i) else 1 := by apply Finset.prod_congr rfl intro i _ by_cases hi : (prefixRank pi i).val < k.val · simp [hi] · simp [hi, (D i).p_sum] have hsplit (w' : ∀ i, alpha i) : (∏ i, if k.val ≤ (prefixRank pi i).val then (D i).p (w' i) else 1) * (∏ i, if (prefixRank pi i).val < k.val then (D i).p (w' i) else 1) = ∏ i, (D i).p (w' i) := by rw [← Finset.prod_mul_distrib] apply Finset.prod_congr rfl intro i _ by_cases hi : (prefixRank pi i).val < k.val · have hnle : ¬k.val ≤ (prefixRank pi i).val := Nat.not_le_of_gt hi simp [hi, hnle] · have hle : k.val ≤ (prefixRank pi i).val := Nat.le_of_not_gt hi simp [hi, hle] have hswap (z : ∀ i, alpha i) : (∏ i, (D i).p (z i)) * (if z ∈ s then ∑ w' : ∀ i, alpha i, if AgreeOnPrefix pi k z w' then (∏ i, if k.val ≤ (prefixRank pi i).val then (D i).p (w' i) else 1) * f w' else 0 else 0) = ∑ w' : ∀ i, alpha i, if w' ∈ s then (∏ i, if k.val ≤ (prefixRank pi i).val then (D i).p (w' i) else 1) * f w' * (if AgreeOnPrefix pi k z w' then ∏ i, (D i).p (z i) else 0) else 0 := by by_cases hz : z ∈ s · rw [if_pos hz, Finset.mul_sum] apply Finset.sum_congr rfl intro w' _ by_cases ha : AgreeOnPrefix pi k z w' · have hw' : w' ∈ s := (hmem_of_agree hs ha).1 hz simp only [ha, if_true, hw'] ring · simp [ha] · rw [if_neg hz] simp only [mul_zero] symm apply Finset.sum_eq_zero intro w' _ by_cases ha : AgreeOnPrefix pi k z w' · have hw' : w' ∉ s := fun hw' ↦ hz ((hmem_of_agree hs ha).2 hw') simp [hw'] · simp [ha] simp only [FiniteDesign.E, prodDesign_p, indicator, prefixCondExp] calc (∑ z, (∏ i, (D i).p (z i)) * if z ∈ s then ∑ w', if AgreeOnPrefix pi k z w' then (∏ i, if k.val ≤ (prefixRank pi i).val then (D i).p (w' i) else 1) * f w' else 0 else 0) = ∑ z, ∑ w', if w' ∈ s then (∏ i, if k.val ≤ (prefixRank pi i).val then (D i).p (w' i) else 1) * f w' * (if AgreeOnPrefix pi k z w' then ∏ i, (D i).p (z i) else 0) else 0 := Finset.sum_congr rfl fun z _ ↦ hswap z _ = ∑ w', ∑ z, if w' ∈ s then (∏ i, if k.val ≤ (prefixRank pi i).val then (D i).p (w' i) else 1) * f w' * (if AgreeOnPrefix pi k z w' then ∏ i, (D i).p (z i) else 0) else 0 := Finset.sum_comm _ = ∑ w', (∏ i, (D i).p (w' i)) * if w' ∈ s then f w' else 0 := by apply Finset.sum_congr rfl intro w' _ by_cases hw' : w' ∈ s · simp only [hw', if_true] rw [← Finset.mul_sum, hmass] rw [← hsplit w'] ring · simp [hw'] -
aestronglyMeasurable_reveal_of_prefixCondExp_eqtheorem — A family of coordinate designs, reveal permutation, prefix length, statistic, and pointwise equality to its prefix conditional expectation imply that the statistic is almost-everywhere strongly measurable for the reveal σ-algebra.hypothesesD :∀ i, FiniteDesign (alpha i)k :Fin (N + 1)f :(∀ i, alpha i) → ℝhf :prefixCondExp D pi k f = fconclusionProof (Lean source)
theorem aestronglyMeasurable_reveal_of_prefixCondExp_eq (D : ∀ i, FiniteDesign (alpha i)) (pi : Perm (Fin N)) (k : Fin (N + 1)) (f : (∀ i, alpha i) → ℝ) (hf : prefixCondExp D pi k f = f) : AEStronglyMeasurable[(revealFiltration pi) k] f (prodDesign D).toMeasure := by rw [← hf] exact stronglyMeasurable_condExp.aestronglyMeasurable.congr (prefixCondExp_ae_eq_condExp D pi k f).symm -
condExp_ae_eq_zero_of_prefixCondExp_eq_zerotheorem — A family of coordinate designs, reveal permutation, prefix length, statistic, and zero explicit prefix conditional expectation imply the measure-theoretic conditional expectation is almost everywhere zero.hypothesesD :∀ i, FiniteDesign (alpha i)k :Fin (N + 1)f :(∀ i, alpha i) → ℝhf :prefixCondExp D pi k f = 0conclusionProof (Lean source)
theorem condExp_ae_eq_zero_of_prefixCondExp_eq_zero (D : ∀ i, FiniteDesign (alpha i)) (pi : Perm (Fin N)) (k : Fin (N + 1)) (f : (∀ i, alpha i) → ℝ) (hf : prefixCondExp D pi k f = 0) : (prodDesign D).toMeasure[f | (revealFiltration pi) k] =ᵐ[(prodDesign D).toMeasure] 0 := by simpa only [hf] using (prefixCondExp_ae_eq_condExp D pi k f).symm -
finitePredictableVariation_ae_eq_measurePredictableVariationtheorem — A family of coordinate designs, reveal permutation, and increment family give an almost-everywhere equality between finite-design and measure-theoretic predictable variations under the product-design measure.hypothesesD :∀ i, FiniteDesign (alpha i)X :Fin N → (∀ i, alpha i) → ℝconclusionfinitePredictableVariation D pi X=ᵐ[(prodDesign D).toMeasure] measurePredictableVariation (prodDesign D).toMeasure (revealFiltration pi) XProof (Lean source)
theorem finitePredictableVariation_ae_eq_measurePredictableVariation (D : ∀ i, FiniteDesign (alpha i)) (pi : Perm (Fin N)) (X : Fin N → (∀ i, alpha i) → ℝ) : finitePredictableVariation D pi X =ᵐ[(prodDesign D).toMeasure] measurePredictableVariation (prodDesign D).toMeasure (revealFiltration pi) X := by unfold finitePredictableVariation measurePredictableVariation filter_upwards [ae_all_iff.2 (fun s ↦ prefixCondExp_ae_eq_condExp D pi (castSucc s) (fun z ↦ (X s z) ^ 2))] with w hw exact Finset.sum_congr rfl fun s _ ↦ hw s -
finiteKolmogorovExpr_eq_measureKolmogorovExprtheorem — A family of coordinate designs and real statistic give an exact identification between the finite-design and measure-theoretic Kolmogorov expressions under the induced product-design measure.hypothesesconclusionProof (Lean source)
theorem finiteKolmogorovExpr_eq_measureKolmogorovExpr (D : ∀ i, FiniteDesign (alpha i)) (Y : (∀ i, alpha i) → ℝ) : finiteKolmogorovExpr (prodDesign D) Y = measureKolmogorovExpr (prodDesign D).toMeasure Y := by classical unfold finiteKolmogorovExpr measureKolmogorovExpr apply congrArg sSup congr 1 funext t rw [FiniteDesign.Pr_eq_measureReal] -
finiteFourthMomentError_eq_measureFourthMomentErrortheorem — A family of coordinate designs, reveal permutation, and increment family give an exact identification between finite-design and measure-theoretic fourth-moment errors, including the predictable-variation term.hypothesesD :∀ i, FiniteDesign (alpha i)X :Fin N → (∀ i, alpha i) → ℝconclusionfiniteFourthMomentError D pi XProof (Lean source)
theorem finiteFourthMomentError_eq_measureFourthMomentError (D : ∀ i, FiniteDesign (alpha i)) (pi : Perm (Fin N)) (X : Fin N → (∀ i, alpha i) → ℝ) : finiteFourthMomentError D pi X = measureFourthMomentError (prodDesign D).toMeasure (revealFiltration pi) X := by unfold finiteFourthMomentError measureFourthMomentError congr 1 · apply Finset.sum_congr rfl intro s _ exact ((prodDesign D).integral_toMeasure (fun w ↦ |X s w| ^ 4)).symm · rw [← (prodDesign D).integral_toMeasure (fun w ↦ |finitePredictableVariation D pi X w - 1| ^ 2)] apply integral_congr_ae filter_upwards [finitePredictableVariation_ae_eq_measurePredictableVariation D pi X] with w hw rw [hw]
IndepSummandsCLT 2 core · 0 supporting Product-design sums of independent bounded mean-zero summands satisfy a standard-normal limit. ★ prodDesign_clt
Independent-summands CLT for product designs
Product-design sums of independent bounded mean-zero summands satisfy a standard-normal limit.
The construction diagDepGraph supplies the dependency graph whose only edges are self-edges, with
independence coming from finite product designs. The theorem prodDesign_clt then specializes the
dependency-graph Stein CLT: uniformly bounded, mean-zero coordinate summands with vanishing
third-moment envelope and unit total design variance have standard-normal distributional limits
under the product design.
At each stage suppose the coordinate index set and every coordinate assignment space are finite, coordinate equality is decidable, and every singleton in every coordinate assignment space is measurable. For a family of coordinate-specific randomization designs, indexed by stage and coordinate, a family of real-valued coordinate summands, and a stage, the diagonal dependency graph is the dependency graph of the coordinate summands under the corresponding product design, in which two coordinates are adjacent exactly when they are the same coordinate.
Definition (Lean source)
Independent-summands CLT over product designs. Fix a family of coordinate designs D n i and real-valued per-coordinate summands g n i, one pair per stage n and coordinate i. Suppose there is a sequence of nonnegative bounds B n tending to zero, every summand g n i a is bounded in absolute value by B n, the number of coordinates at stage n times B n cubed tends to zero, each summand has mean zero under its own coordinate design, and the total sum ∑ᵢ g n i (w i) has design variance exactly one under the product design at every stage n. Then the design probability that the sum is at most any fixed threshold s converges, as n → ∞, to the standard normal cumulative distribution function Φ(s).
Formal statement
Proof (Lean source)
LocalDependenceVariance 2 core · 0 supporting This file provides BlockDegreeLE, the condition that no unit lies in more than d of the dependence blocks, and bernoulliDesign_E_sum_sq_le_blockDegree_mul_sum_sq, the resulting bound E[(∑ᵢ Fᵢ)²] ≤ d · ∑ᵢ E[Fᵢ²] for mean- ★ bernoulliDesign_E_sum_sq_le_blockDegree_mul_sum_sq
Local-dependence variance bound on a Bernoulli design
This file provides BlockDegreeLE, the condition that no unit lies in more than d of the
dependence blocks, and bernoulliDesign_E_sum_sq_le_blockDegree_mul_sum_sq, the resulting bound
E[(∑ᵢ Fᵢ)²] ≤ d · ∑ᵢ E[Fᵢ²] for mean-zero, block-dependent summands.
For a finite population of units, a dependence block assigned to each unit, and a nonnegative integer bound, the assertion that the block family has degree at most means that, for every unit, at most blocks contain that unit. When the blocks are the in-neighbourhoods of a dependency graph, this is the out-degree bound.
Definition (Lean source)
Local-dependence variance bound. Under a Bernoulli design in which every unit's treatment probability lies strictly between 0 and 1, suppose each unit i contributes a term F i — attached to a dependence block N i — such that no unit's treatment is read by more than d of these blocks, every term has mean zero under the Bernoulli design, and each term F i depends only on the treatments of its own block N i. Then the second moment of the total ∑ᵢ F i is at most d times the total of the individual second moments, d · ∑ᵢ E[(F i)²]. The bound is scale free: it needs no uniform bound on the terms, no explicit decorrelation assumption, and no dependence on the population size.
Formal statement
Proof (Lean source)
NeymanComposition 3 core · 5 supporting This file connects the library's three representations of within-arm variation: ordinary sample variance on a fixed-size subset, Boolean-assignment arm variances, and the finite-population variance. ★ control_sampleVariance_tendstoInProb
Composition lemmas for Neyman inference under complete randomization
This file connects the library's three representations of within-arm variation: ordinary sample variance on a fixed-size subset, Boolean-assignment arm variances, and the finite-population variance. Complementing the treated subset transports complete randomization to the control design, so the existing sample-variance consistency theorem applies to either arm.
For a finite population, a feasible treated count, the complement equivalence between size-K treated subsets and size-N-K control subsets maps each treated set to precisely the units outside it.
Definition (Lean source)
For a population of n indexed units and a feasible treated count, the complement equivalence specialized to Fin n maps treated subsets to control subsets whose cardinality is written definitionally as n-K.
Definition (Lean source)
Along finite populations with outcome vectors and feasible treated counts, suppose every control arm contains at least two units, the control-arm sizes diverge, the population variances converge, and the largest squared centered outcome divided by the control-arm size vanishes. Then the ordinary sample variance on the complementary control set converges in randomization probability to the finite-population variance.
Formal statement
Proof (Lean source)
5 supporting declarations (lemmas, instances)
-
completeRandomization_map_complementtheorem — For a finite population and a feasible treated count, pushing complete randomization forward through set complementation gives complete randomization of the N-K controls.hypothesesconclusionProof (Lean source)
theorem completeRandomization_map_complement {U : Type*} [Fintype U] [DecidableEq U] (K : ℕ) (hK : K ≤ card U) : (completeRandomization K hK).map (completeRandomizationComplementEquiv K hK) = completeRandomization (card U - K) (sub_le _ _) := by apply FiniteDesign.ext_p funext T rw [FiniteDesign.map_p] simp only [completeRandomization] rw [show card {S : Finset U // S.card = K} = card {S : Finset U // S.card = card U - K} by exact Fintype.card_congr (completeRandomizationComplementEquiv K hK)] simp_rw [← Equiv.eq_symm_apply] rw [Fintype.sum_ite_eq'] -
S1_eq_popVarlemma — For a population of n units with outcomes, Neyman's treated-arm finite-population variance equals the generic finite-population variance. -
ShatTreated_crdToBoolOn_eq_sampleVariancelemma — For a population of n units, a treated count, treated outcomes, and a realized treated subset, the Boolean treated-arm variance equals the ordinary sample variance on that subset.hypothesesconclusionShatTreated K a (crdToBoolOn K S) = sampleVariance K a SProof (Lean source)
lemma ShatTreated_crdToBoolOn_eq_sampleVariance {n : ℕ} (K : ℕ) (a : Fin n → ℝ) (S : {S : Finset (Fin n) // S.card = K}) : ShatTreated K a (crdToBoolOn K S) = sampleVariance K a S := by classical have hT : ∀ i, T i (crdToBoolOn K S) = if i ∈ S.val then 1 else 0 := by intro i change (if decide (i ∈ S.val) = true then (1 : ℝ) else 0) = if i ∈ S.val then 1 else 0 by_cases hi : i ∈ S.val <;> simp [hi] have hmean : obsMeanTreated K a (crdToBoolOn K S) = sampleMean K a S := by unfold obsMeanTreated sampleMean apply congrArg (fun x : ℝ => x / (K : ℝ)) apply Finset.sum_congr rfl intro i _ rw [hT] by_cases hi : i ∈ S.val <;> simp [hi] unfold ShatTreated sampleVariance rw [hmean] congr 1 apply Finset.sum_congr rfl intro i _ rw [hT] by_cases hi : i ∈ S.val <;> simp [hi] -
ShatControl_crdToBoolOn_eq_sampleVariancelemma — For a population of n units, a feasible treated count, control outcomes, and a realized treated subset, the Boolean control-arm variance equals the ordinary sample variance on the complementary control subset.hypothesesconclusionShatControl K b (crdToBoolOn K S)= sampleVariance (n - K) b (finCompleteRandomizationComplementEquiv K hK S)Proof (Lean source)
lemma ShatControl_crdToBoolOn_eq_sampleVariance {n : ℕ} (K : ℕ) (hK : K ≤ n) (b : Fin n → ℝ) (S : {S : Finset (Fin n) // S.card = K}) : ShatControl K b (crdToBoolOn K S) = sampleVariance (n - K) b (finCompleteRandomizationComplementEquiv K hK S) := by classical let C := finCompleteRandomizationComplementEquiv K hK S change ShatControl K b (crdToBoolOn K S) = sampleVariance (n - K) b C have hT : ∀ i, 1 - T i (crdToBoolOn K S) = if i ∈ C.val then 1 else 0 := by intro i change 1 - (if decide (i ∈ S.val) = true then (1 : ℝ) else 0) = if i ∈ S.valᶜ then 1 else 0 by_cases hi : i ∈ S.val <;> simp [hi] have hmean : obsMeanControl K b (crdToBoolOn K S) = sampleMean (n - K) b C := by unfold obsMeanControl sampleMean rw [Nat.cast_sub hK] apply congrArg (fun x : ℝ => x / ((n : ℝ) - (K : ℝ))) apply Finset.sum_congr rfl intro i _ rw [hT] by_cases hi : i ∈ C.val <;> simp [hi] unfold ShatControl sampleVariance rw [hmean, Nat.cast_sub hK] congr 1 apply Finset.sum_congr rfl intro i _ rw [hT] by_cases hi : i ∈ C.val <;> simp [hi] -
varianceEstimator_eq_sampleVarianceslemma — For a population of n units, a feasible treated count, treated and control outcomes, and a realized treated subset, the feasible Neyman variance estimator is the treated sample variance divided by K plus the complementary control sample variance divided by n-K.hypothesesconclusionDifferenceInMeans.varianceEstimator K a b S= sampleVariance K a S / (K : ℝ)+ sampleVariance (n - K) b (finCompleteRandomizationComplementEquiv K hK S) / ((n - K : ℕ) : ℝ)Proof (Lean source)
lemma DifferenceInMeans.varianceEstimator_eq_sampleVariances {n : ℕ} (K : ℕ) (hK : K ≤ n) (a b : Fin n → ℝ) (S : {S : Finset (Fin n) // S.card = K}) : DifferenceInMeans.varianceEstimator K a b S = sampleVariance K a S / (K : ℝ) + sampleVariance (n - K) b (finCompleteRandomizationComplementEquiv K hK S) / ((n - K : ℕ) : ℝ) := by change varHat K a b (crdToBoolOn K S) = _ unfold varHat rw [ShatTreated_crdToBoolOn_eq_sampleVariance, ShatControl_crdToBoolOn_eq_sampleVariance K hK, Nat.cast_sub hK]
PotentialOutcome 3 core · 3 supporting This file represents a unit's outcome under an assignment by evaluating its potential outcome at the exposure induced by that assignment. ★ Yobs_eq_sum
Potential outcomes under exposure mappings
This file represents a unit's outcome under an assignment by evaluating its potential outcome at the exposure induced by that assignment. It supplies the properly specified exposure condition and the observed-outcome construction used by the design-based interference results.
For potential outcomes indexed by unit and exposure level, randomization potential outcomes indexed by unit and assignment, an assignment-to-exposure mapping, and unit-level attributes used by that mapping, the properly specified exposure condition states that, for every unit and every assignment, the randomization potential outcome equals the potential outcome at the exposure induced for that unit by the assignment.
Definition (Lean source)
For potential outcomes indexed by unit and exposure level, an assignment-to-exposure mapping, unit-level attributes used by that mapping, a unit, and an assignment, the observed outcome is that unit's potential outcome at the exposure induced by the assignment.
Definition (Lean source)
Condition 2 (consistency). The observed outcome of unit i under assignment z equals the sum, over every exposure level, of the exposure indicator times the exposure-indexed potential outcome.
Formal statement
Proof (Lean source)
3 supporting declarations (lemmas, instances)
-
expoInd_mul_Yobslemma — On the event expo i = d, the observed outcome agrees with the potential outcome y i d; hence 1(expo i = d)·Yobs i = 1(expo i = d)·y i d.hypothesesΩ :sharedType u_1ι :sharedType u_2Θ :sharedType u_3Δ :sharedType u_4y :ι → Δ → ℝf :Ω → Θ → Δθ :ι → Θi :ιd :Δz :ΩProof (Lean source)
lemma expoInd_mul_Yobs (y : ι → Δ → ℝ) (f : Ω → Θ → Δ) (θ : ι → Θ) (i : ι) (d : Δ) (z : Ω) : expoInd f θ i d z * Yobs y f θ i z = expoInd f θ i d z * y i d := by unfold expoInd FiniteDesign.ind Yobs by_cases h : expo f θ i z = d <;> simp [h] -
expoInd_mul_Yobs_sqlemma — Squared on-event substitution: 1(expo i = d)·(Yobs i)² = 1(expo i = d)·(y i d)².hypothesesΩ :sharedType u_1ι :sharedType u_2Θ :sharedType u_3Δ :sharedType u_4y :ι → Δ → ℝf :Ω → Θ → Δθ :ι → Θi :ιd :Δz :ΩProof (Lean source)
lemma expoInd_mul_Yobs_sq (y : ι → Δ → ℝ) (f : Ω → Θ → Δ) (θ : ι → Θ) (i : ι) (d : Δ) (z : Ω) : expoInd f θ i d z * (Yobs y f θ i z) ^ 2 = expoInd f θ i d z * (y i d) ^ 2 := by unfold expoInd FiniteDesign.ind Yobs by_cases h : expo f θ i z = d <;> simp [h] -
expoInd₂_mul_Yobslemma — On the event expo i = di, multiplying the observed outcome for unit i by any real quantity leaves it valid to replace that outcome by potential outcome y i di.hypothesesΩ :sharedType u_1ι :sharedType u_2Θ :sharedType u_3Δ :sharedType u_4y :ι → Δ → ℝf :Ω → Θ → Δθ :ι → Θi :ιdi :Δq :Ω → ℝz :ΩProof (Lean source)
lemma expoInd₂_mul_Yobs (y : ι → Δ → ℝ) (f : Ω → Θ → Δ) (θ : ι → Θ) (i : ι) (di : Δ) (q : Ω → ℝ) (z : Ω) : expoInd f θ i di z * q z * Yobs y f θ i z = expoInd f θ i di z * q z * y i di := by unfold expoInd FiniteDesign.ind Yobs by_cases h : expo f θ i z = di <;> simp [h]
ProductBlock 3 core · 1 supporting Functions of disjoint coordinate blocks factor under a finite product design. ★ E_prod_block_mul★ Cov_prod_block_zero★ Cov_prod_disjoint_zero
Disjoint-block independence for product designs
Functions of disjoint coordinate blocks factor under a finite product design.
The theorem FiniteDesign.E_prod_block_mul factors the expectation of f * g when f depends
only on coordinates in a block A and g depends only on the complement. The covariance
corollaries FiniteDesign.Cov_prod_block_zero and FiniteDesign.Cov_prod_disjoint_zero package
that independence for complement blocks and for arbitrary disjoint blocks.
Disjoint-block factorization of expectation. For a family of independent coordinate designs D and real-valued functions f and g on the joint assignment space, suppose f is invariant under any change to the coordinates outside a block A — it depends only on the coordinates in A, and g depends only on the coordinates outside A. Then under the product design, the expectation of the product f·g factors as E[f·g] = E[f]·E[g]. The general (block-level) form of E_prod_apply₂.
Formal statement
Proof (Lean source)
Disjoint-block covariance vanishing (complement form). For a family of independent coordinate designs D and real-valued functions f and g, suppose f depends only on the coordinates in a block A and g depends only on the coordinates outside A. Then their covariance under the product design is zero.
Formal statement
Proof (Lean source)
Disjoint-block covariance vanishing (two-block form). For a family of independent coordinate designs D and real-valued functions f and g, suppose the index sets S and T are disjoint, f depends only on the coordinates in S, and g depends only on the coordinates in T. Then their covariance under the product design is zero.
Formal statement
Proof (Lean source)
1 supporting declaration (lemmas, instances)
-
nonempty_of_designtheorem — Every coordinate type carrying a finite design is nonempty.hypothesesconclusionNonempty (α i)Proof (Lean source)
theorem nonempty_of_design (D : ∀ i, FiniteDesign (α i)) : ∀ i, Nonempty (α i) := by intro i by_contra h rw [not_nonempty_iff] at h have := (D i).p_sum rw [Finset.univ_eq_empty, Finset.sum_empty] at this exact one_ne_zero this.symm
ProductReindex 1 core · 0 supporting Permuting coordinate labels only relabels probabilities under a product design. ★ prodDesign_Pr_reindex
Reindexing product designs
Permuting coordinate labels only relabels probabilities under a product design.
The theorem FiniteDesign.prodDesign_Pr_reindex is a finite-sum reindexing identity: for a
coordinate permutation sigma, the probability of a permuted predicate under prodDesign D
equals the probability of the original predicate under the correspondingly permuted product
design. It is used to express selection symmetry in identical-group two-stage arguments without
invoking measure theory.
Relabeling a product design by a coordinate permutation. For a family of designs D over a common coordinate space W, indexed by ι, and a permutation σ : ι ≃ ι, the probability under prodDesign D of the predicate w ↦ P (w ∘ σ) equals the probability under the permuted product prodDesign (D ∘ σ) of P.
Formal statement
Proof (Lean source)
ProductVariance 1 core · 3 supporting Distinct coordinates of a finite product design are uncorrelated. ★ Var_prod_linear_comb
Product-design variance identities
Distinct coordinates of a finite product design are uncorrelated.
FiniteDesign.E_prod_apply₂ factors expectations of products of statistics on two distinct
coordinates, yielding FiniteDesign.Var_prod_apply for one-coordinate variances and
FiniteDesign.Cov_prod_apply_of_ne for zero cross-coordinate covariance. The payload
FiniteDesign.Var_prod_linear_comb states that the variance of a linear combination of
single-coordinate statistics is the sum of squared coefficients times the marginal variances.
The payload. Under the product design formed from a family of per-coordinate finite designs, the variance of a linear combination ∑ᵢ cᵢ·gᵢ(wᵢ) of single-coordinate functions gᵢ, with coefficients c, equals the sum over coordinates of the squared coefficient times the coordinate's own variance — cross-coordinate covariances vanish.
Formal statement
Proof (Lean source)
3 supporting declarations (lemmas, instances)
-
E_prod_apply₂lemma — Two-coordinate factorization: under the product design, the expectation of a product of a function of one coordinate and a function of a distinct coordinate factors into the product of the two marginal expectations.hypothesesι :sharedType u_1ι → Type u_2D :∀ i, FiniteDesign (α i)i j :ιh :i ≠ jg :α i → ℝhfun :α j → ℝconclusion(prodDesign D).E (fun w => g (w i) * hfun (w j)) = (D i).E g * (D j).E hfunProof (Lean source)
lemma E_prod_apply₂ (D : ∀ i, FiniteDesign (α i)) {i j : ι} (h : i ≠ j) (g : α i → ℝ) (hfun : α j → ℝ) : (prodDesign D).E (fun w => g (w i) * hfun (w j)) = (D i).E g * (D j).E hfun := by rw [E_prod_block_mul D {i} (fun w => g (w i)) (fun w => hfun (w j))] · rw [E_prod_apply D i g, E_prod_apply D j hfun] · intro w w' hw exact congrArg g (hw i (by simp)) · intro w w' hw exact congrArg hfun (hw j (by simpa using h.symm)) -
Var_prod_applylemma — Single-coordinate variance: under the product design, the variance of a function of one coordinate equals the variance of that function under the coordinate's own design.hypothesesconclusionProof (Lean source)
lemma Var_prod_apply (D : ∀ i, FiniteDesign (α i)) (j : ι) (g : α j → ℝ) : (prodDesign D).Var (fun w => g (w j)) = (D j).Var g := by rw [Var_eq, Var_eq] congr 1 · -- E[(g (w j))^2] = (D j).E (fun a => g a ^ 2) have : (fun w : ∀ i, α i => g (w j) ^ 2) = (fun w => (fun a => g a ^ 2) (w j)) := rfl rw [this, E_prod_apply D j (fun a => g a ^ 2)] · -- (prodDesign D).E (fun w => g (w j)) = (D j).E g rw [E_prod_apply D j g] -
Cov_prod_apply_of_nelemma — Cross-coordinate independence: under the product design, functions of two distinct coordinates have zero covariance.hypothesesι :sharedType u_1ι → Type u_2D :∀ i, FiniteDesign (α i)i j :ιh :i ≠ jg :α i → ℝhfun :α j → ℝconclusion(prodDesign D).Cov (fun w => g (w i)) (fun w => hfun (w j)) = 0Proof (Lean source)
lemma Cov_prod_apply_of_ne (D : ∀ i, FiniteDesign (α i)) {i j : ι} (h : i ≠ j) (g : α i → ℝ) (hfun : α j → ℝ) : (prodDesign D).Cov (fun w => g (w i)) (fun w => hfun (w j)) = 0 := by rw [Cov_eq] rw [show (fun w : ∀ i, α i => g (w i) * hfun (w j)) = (fun w => g (w i) * hfun (w j)) from rfl, E_prod_apply₂ D h g hfun, E_prod_apply D i g, E_prod_apply D j hfun] ring
RatioLinearization 2 core · 2 supporting Exact design-mean identities for mean-normalized (Horvitz–Thompson / Hájek) ratio statistics and their products, computed directly from FiniteDesign.E. ★ ratio_remainder_capped_bound★ E_centered_ratio_mul
Finite-sample delta-method identities for the design-based layer
Exact design-mean identities for mean-normalized (Horvitz–Thompson / Hájek) ratio statistics
and their products, computed directly from FiniteDesign.E.
These are the finite-design counterpart of the measure-theoretic ratio delta method
(Causalean.Stat's deltaMethod_ratio): rather than a limiting distributional statement, they
give the exact finite-n linearization kernel of a ratio estimator, so a design-based variance
computation never has to leave the FiniteDesign world.
* E_centered_ratio — a plug-in ratio X / E[X] is exactly centered.
* E_centered_ratio_mul — the exact covariance of two normalized ratios; the linearization
kernel for any ratio / Hájek variance.
* E_lin_expand — distributes the design mean over a product of two two-term linear forms, the
bilinear bookkeeping step for a two-arm linearized variance.
* ratio_remainder_capped_bound — the capped second-order remainder of a single scaled ratio
estimator, the per-arm building block of a ratio/Hájek CLT's asymptotic-linearity argument.
For a positive target scale, a square-root scale whose square is the target scale, a numerator and positive denominator, a target and its centered numerator identity, and a capped inverse-denominator ratio, the scaled ratio remainder is bounded by twice the product of the centered score magnitude and the relative denominator error.
Formal statement
Proof (Lean source)
For a finite design, two design statistics, their two means and cross moment, nonzero mean denominators, and the asserted first- and cross-moment identities, the mean product of the two normalized centered ratios equals the normalized cross moment minus one.
Formal statement
Proof (Lean source)
2 supporting declarations (lemmas, instances)
-
E_centered_ratiolemma — Centering of a plug-in ratio. In a finite design, the mean-normalized ratio X / E[X] − 1 has design mean zero whenever the mean E[X] is nonzero — the first-order (linearization) fact that a ratio statistic is exactly centered at its plug-in point.hypothesesconclusionD.E (fun z => X z / a - 1) = 0Proof (Lean source)
lemma E_centered_ratio (X : Ω → ℝ) (a : ℝ) (ha : a ≠ 0) (hEX : D.E X = a) : D.E (fun z => X z / a - 1) = 0 := by have hpoint : (fun z => X z / a - 1) = (fun z => (1 / a) * X z - 1) := by funext z ring rw [D.E_congr (by intro z; exact congrFun hpoint z)] rw [D.E_sub, D.E_const_mul, D.E_const, hEX] field_simp [ha] ring -
E_lin_expandlemma — Bilinear expansion of a design mean. In a finite design, suppose the mean of A·C equals AA, the mean of A·F equals AB, the mean of B·C equals BA, and the mean of B·F equals BB — the four pairwise cross-moments of the two-term linear forms (A·ai − B·bi) and (C·aj − F·bj). Then the mean of the product (A·ai − B·bi)(C·aj − F·bj) equals AA·ai·aj − AB·ai·bj − BA·bi·aj + BB·bi·bj. This is the generic bookkeeping step assembling a two-arm (e.g. treated/control) linearized variance from its component moments.hypothesesΩ :sharedType u_1A B C F :Ω → ℝai bi aj bj AA AB BA BB :ℝhAA :D.E (fun z => A z * C z) = AAhAB :D.E (fun z => A z * F z) = ABhBA :D.E (fun z => B z * C z) = BAhBB :D.E (fun z => B z * F z) = BBconclusionD.E (fun z => (A z * ai - B z * bi) * (C z * aj - F z * bj))= AA * ai * aj - AB * ai * bj - BA * bi * aj + BB * bi * bjProof (Lean source)
lemma E_lin_expand (A B C F : Ω → ℝ) (ai bi aj bj AA AB BA BB : ℝ) (hAA : D.E (fun z => A z * C z) = AA) (hAB : D.E (fun z => A z * F z) = AB) (hBA : D.E (fun z => B z * C z) = BA) (hBB : D.E (fun z => B z * F z) = BB) : D.E (fun z => (A z * ai - B z * bi) * (C z * aj - F z * bj)) = AA * ai * aj - AB * ai * bj - BA * bi * aj + BB * bi * bj := by have hpoint : (fun z => (A z * ai - B z * bi) * (C z * aj - F z * bj)) = (fun z => ((ai * aj) * (A z * C z) - (ai * bj) * (A z * F z)) - (bi * aj) * (B z * C z) + (bi * bj) * (B z * F z)) := by funext z ring rw [D.E_congr (by intro z; exact congrFun hpoint z)] rw [D.E_add, D.E_sub, D.E_sub] repeat rw [D.E_const_mul] rw [hAA, hAB, hBA, hBB] ring
Slutsky 1 core · 0 supporting The finite-design counterpart of the classical converging-together / Slutsky theorem, stated directly on FiniteDesign.Pr at the level of pointwise CDF convergence. ★ finiteDesign_cdf_converging_together
Design-based converging-together (CDF-level Slutsky)
The finite-design counterpart of the classical converging-together / Slutsky theorem, stated
directly on FiniteDesign.Pr at the level of pointwise CDF convergence. If Sₙ and Tₙ are
asymptotically indistinguishable in probability and the CDFs of Tₙ converge to a continuous limit
CDF Φ, then the CDFs of Sₙ converge to the same Φ. It transfers a limiting CDF across an
in-probability-negligible perturbation — the exact step a studentized design-based estimator needs
to pass from an oracle statistic to its feasible (plug-in standard error) version — without leaving
the finite-design layer for the measure-theoretic weak-convergence API.
Finite-design CDF converging-together. Along a sequence of finite designs on two sequences of real-valued statistics Sₙ and Tₙ, suppose Sₙ is asymptotically indistinguishable from Tₙ in probability: for every η > 0, Pr(η ≤ |Sₙ − Tₙ|) → 0, the CDFs of Tₙ converge pointwise to a limit function Φ, and Φ is continuous. Then the CDFs of Sₙ converge pointwise to the same Φ.
Formal statement
Proof (Lean source)
WaldCoverage 1 core · 2 supporting A paper-agnostic asymptotic-coverage transfer for two-sided Wald intervals built from a *random feasible* standard error. ★ conservative_wald_liminf_of_feasible_studentized_cdf
Design-based conservative Wald-interval coverage
A paper-agnostic asymptotic-coverage transfer for two-sided Wald intervals built from a
random feasible standard error. It is stated over abstract per-stage sequences — a
design D n, an estimator est n, a target θ n, the true variance scale v n, a conservative
(dominating) variance v̂ n, and the normalization size m n — so every design-based paper with a
studentized CLT and a conservative variance estimator can instantiate it in one line instead of
re-cloning the liminf/Pr_split/coverage argument (as the exposure-mapping, two-stage, and
bipartite-interference formalizations each previously did).
Feasible conservative Wald-interval liminf coverage. For finite designs, an estimator and target, positive normalization and oracle variance scales, and a random feasible variance estimator, suppose its probability of undershooting (1-η)v tends to zero for every positive slack. If the oracle-studentized statistic has standard-normal CDF limits at every threshold, and z is a nonnegative Gaussian quantile, then the random Wald interval based on vhat has coverage liminf at least 1-α.
Formal statement
Proof (Lean source)
2 supporting declarations (lemmas, instances)
-
conservative_wald_liminf_of_studentized_cdftheorem — Conservative Wald-interval liminf coverage. Consider a sequence of finite designs with an estimator est n of a target θ n. Suppose the normalization size m n is eventually positive, the true variance scale v n is eventually positive, and a deterministic conservative variance v̂ n eventually dominates v n. Suppose further that the studentized statistic √(m n)·(est n − θ n)/√(v n) has design-probability CDF converging to the standard-normal CDF at z and at −z, where z is nonnegative and satisfies Φ(z) = 1 − α/2. Then the two-sided interval |θ n − est n| ≤ z·√(v̂ n / m n) has asymptotic (liminf) coverage at least 1 − α.hypothesesΩ :sharedℕ → Type u_1D :∀ n, FiniteDesign (Ω n)est :∀ nifΩ nthenℝθ v vhat m :ℕ → ℝhmpos :∀ᶠ n in atTop, 0 < m nhvarpos :∀ᶠ n in atTop, 0 < v nhvar_le :∀ᶠ n in atTop, v n ≤ vhat nα z :ℝhclt :hclt_neg :hz0 :0 ≤ zhz :stdNormalCdf z = 1 - α / 2Proof (Lean source)
theorem conservative_wald_liminf_of_studentized_cdf (D : ∀ n, FiniteDesign (Ω n)) (est : ∀ n, Ω n → ℝ) (θ v vhat m : ℕ → ℝ) (hmpos : ∀ᶠ n in atTop, 0 < m n) (hvarpos : ∀ᶠ n in atTop, 0 < v n) (hvar_le : ∀ᶠ n in atTop, v n ≤ vhat n) (α z : ℝ) (hclt : Tendsto (fun n => (D n).Pr (fun zz => sqrt (m n) * (est n zz - θ n) / sqrt (v n) ≤ z)) atTop (𝓝 (stdNormalCdf z))) (hclt_neg : Tendsto (fun n => (D n).Pr (fun zz => sqrt (m n) * (est n zz - θ n) / sqrt (v n) ≤ -z)) atTop (𝓝 (stdNormalCdf (-z)))) (hz0 : 0 ≤ z) (hz : stdNormalCdf z = 1 - α / 2) : 1 - α ≤ liminf (fun n => (D n).Pr (fun zz => |θ n - est n zz| ≤ z * sqrt (vhat n / m n))) atTop := by classical set S : ℕ → ℝ := fun n => (D n).Pr (fun zz => sqrt (m n) * (est n zz - θ n) / sqrt (v n) ≤ z) with hSdef set Lo : ℕ → ℝ := fun n => (D n).Pr (fun zz => sqrt (m n) * (est n zz - θ n) / sqrt (v n) ≤ -z) with hLodef set Iv : ℕ → ℝ := fun n => (D n).Pr (fun zz => |θ n - est n zz| ≤ z * sqrt (vhat n / m n)) with hIdef have hS : Tendsto S atTop (𝓝 (stdNormalCdf z)) := by simpa [S] using hclt have hLo : Tendsto Lo atTop (𝓝 (stdNormalCdf (-z))) := by simpa [Lo] using hclt_neg have hlim : Tendsto (fun n => S n - Lo n) atTop (𝓝 (1 - α)) := by have h := hS.sub hLo rw [stdNormalCdf_neg z, hz] at h have he : (1 - α / 2) - (1 - (1 - α / 2)) = 1 - α := by ring rwa [he] at h have hbound : ∀ᶠ n in atTop, S n - Lo n ≤ Iv n := by filter_upwards [hvarpos, hmpos, hvar_le] with n hvpos hmposn hvarlen set W : Ω n → ℝ := fun zz => sqrt (m n) * (est n zz - θ n) / sqrt (v n) with hWdef have hsplit := (D n).Pr_split (fun zz => W zz ≤ z) (fun zz => W zz ≤ -z) have hfirst : (D n).Pr (fun zz => W zz ≤ z ∧ W zz ≤ -z) = Lo n := by apply (D n).Pr_congr intro zz constructor · exact fun h => h.2 · intro h2 exact ⟨le_trans h2 (by linarith [hz0]), h2⟩ have hSLo : S n - Lo n = (D n).Pr (fun zz => W zz ≤ z ∧ ¬ W zz ≤ -z) := by have : S n = (D n).Pr (fun zz => W zz ≤ z ∧ W zz ≤ -z) + (D n).Pr (fun zz => W zz ≤ z ∧ ¬ W zz ≤ -z) := by simpa [S, W, hWdef] using hsplit rw [this, hfirst] ring rw [hSLo] apply (D n).Pr_mono intro zz hzz obtain ⟨hzhi, hzlo_not⟩ := hzz rw [not_le] at hzlo_not have habsW : |W zz| ≤ z := abs_le.mpr ⟨le_of_lt hzlo_not, hzhi⟩ set vn : ℝ := v n with hvndef set vhatn : ℝ := vhat n with hvhatndef set cardR : ℝ := m n with hcardRdef have hcardposR : 0 < cardR := by simpa [cardR] using hmposn have hsvar : 0 < sqrt vn := Real.sqrt_pos.mpr (by simpa [vn] using hvpos) have hscard : 0 < sqrt cardR := Real.sqrt_pos.mpr hcardposR have habs_est : |est n zz - θ n| ≤ z * sqrt vn / sqrt cardR := by rw [hWdef, abs_div, abs_mul, abs_of_pos hsvar, abs_of_nonneg (Real.sqrt_nonneg cardR), div_le_iff₀ hsvar] at habsW have hmul : sqrt cardR * |est n zz - θ n| ≤ z * sqrt vn := by simpa [vn, cardR, mul_comm, mul_left_comm, mul_assoc] using habsW exact (le_div_iff₀ hscard).mpr (by simpa [mul_comm, mul_left_comm, mul_assoc] using hmul) have hsqrt_le : sqrt vn / sqrt cardR ≤ sqrt (vhatn / cardR) := by rw [← Real.sqrt_div (le_of_lt (by simpa [vn] using hvpos)) cardR] exact Real.sqrt_le_sqrt (div_le_div_of_nonneg_right (by simpa [vn, vhatn] using hvarlen) hcardposR.le) have hscale_le : z * sqrt vn / sqrt cardR ≤ z * sqrt (vhatn / cardR) := by rw [mul_div_assoc] exact mul_le_mul_of_nonneg_left hsqrt_le hz0 have habs_tau : |θ n - est n zz| ≤ z * sqrt (vhatn / cardR) := by rw [abs_sub_comm] exact habs_est.trans hscale_le simpa [Iv, vhatn, cardR] using habs_tau have hbdd : IsBoundedUnder (· ≥ ·) atTop (fun n => S n - Lo n) := hlim.isBoundedUnder_ge have hcobdd : IsCoboundedUnder (· ≥ ·) atTop Iv := isCoboundedUnder_ge_of_le atTop (x := (1 : ℝ)) (fun n => (D n).Pr_le_one _) calc 1 - α = liminf (fun n => S n - Lo n) atTop := hlim.liminf_eq.symm _ ≤ liminf Iv atTop := Filter.liminf_le_liminf hbound hbdd hcobdd _ = liminf (fun n => (D n).Pr (fun zz => |θ n - est n zz| ≤ z * sqrt (vhat n / m n))) atTop := by rfl -
finiteDesign_symmetricBand_tendstolemma — For a sequence of finite-design laws and real-valued statistics, if their CDFs converge pointwise to a limit CDF, the limit CDF is continuous, and the symmetric-band radius is nonnegative, then the closed symmetric-band probabilities converge to the difference of the limiting CDF at the two endpoints.hypothesesΩ :sharedℕ → Type u_1D :∀ n, FiniteDesign (Ω n)T :∀ nifΩ nthenℝF :ℝ → ℝhF :c :ℝhc :0 ≤ cProof (Lean source)
lemma finiteDesign_symmetricBand_tendsto (D : ∀ n, FiniteDesign (Ω n)) (T : ∀ n, Ω n → ℝ) (F : ℝ → ℝ) (hT : ∀ x : ℝ, Tendsto (fun n => (D n).Pr (fun z => T n z ≤ x)) atTop (𝓝 (F x))) (hF : Continuous F) (c : ℝ) (hc : 0 ≤ c) : Tendsto (fun n => (D n).Pr (fun z => -c ≤ T n z ∧ T n z ≤ c)) atTop (𝓝 (F c - F (-c))) := by classical rw [Metric.tendsto_atTop] intro ε hε have hε8 : 0 < ε / 8 := by linarith obtain ⟨δ, hδ, hcont⟩ := (Metric.continuousAt_iff.1 hF.continuousAt) (ε / 8) hε8 let d : ℝ := δ / 2 have hd : 0 < d := by dsimp [d]; linarith have hdlt : dist (-c - d) (-c) < δ := by rw [Real.dist_eq] dsimp [d] rw [show -c - δ / 2 - -c = -(δ / 2) by ring, abs_neg, abs_of_pos (by linarith : 0 < δ / 2)] linarith have hFd : |F (-c - d) - F (-c)| < ε / 8 := by simpa [Real.dist_eq] using hcont hdlt let S : ℕ → ℝ := fun n => (D n).Pr (fun z => T n z ≤ c) let L : ℕ → ℝ := fun n => (D n).Pr (fun z => T n z ≤ -c) let Ld : ℕ → ℝ := fun n => (D n).Pr (fun z => T n z ≤ -c - d) let J : ℕ → ℝ := fun n => (D n).Pr (fun z => -c ≤ T n z ∧ T n z ≤ c) have hS := hT c have hL := hT (-c) have hLd := hT (-c - d) have hevS : ∀ᶠ n in atTop, |S n - F c| < ε / 8 := by simpa [S, Real.dist_eq] using (Metric.tendsto_nhds.1 hS) (ε / 8) hε8 have hevL : ∀ᶠ n in atTop, |L n - F (-c)| < ε / 8 := by simpa [L, Real.dist_eq] using (Metric.tendsto_nhds.1 hL) (ε / 8) hε8 have hevLd : ∀ᶠ n in atTop, |Ld n - F (-c - d)| < ε / 8 := by simpa [Ld, Real.dist_eq] using (Metric.tendsto_nhds.1 hLd) (ε / 8) hε8 have hbounds : ∀ n, S n - L n ≤ J n ∧ J n ≤ S n - Ld n := by intro n have hlo := (D n).Pr_split (fun z => T n z ≤ c) (fun z => T n z ≤ -c) have hld := (D n).Pr_split (fun z => T n z ≤ c) (fun z => T n z ≤ -c - d) have hlofirst : (D n).Pr (fun z => T n z ≤ c ∧ T n z ≤ -c) = L n := by apply (D n).Pr_congr intro z constructor · exact fun h => h.2 · intro h exact ⟨h.trans (by linarith), h⟩ have hldfirst : (D n).Pr (fun z => T n z ≤ c ∧ T n z ≤ -c - d) = Ld n := by apply (D n).Pr_congr intro z constructor · exact fun h => h.2 · intro h exact ⟨h.trans (by linarith), h⟩ have hloeq : S n - L n = (D n).Pr (fun z => T n z ≤ c ∧ ¬ T n z ≤ -c) := by have : S n = (D n).Pr (fun z => T n z ≤ c ∧ T n z ≤ -c) + (D n).Pr (fun z => T n z ≤ c ∧ ¬ T n z ≤ -c) := by simpa [S, L] using hlo rw [this, hlofirst] ring have hldeq : S n - Ld n = (D n).Pr (fun z => T n z ≤ c ∧ ¬ T n z ≤ -c - d) := by have : S n = (D n).Pr (fun z => T n z ≤ c ∧ T n z ≤ -c - d) + (D n).Pr (fun z => T n z ≤ c ∧ ¬ T n z ≤ -c - d) := by simpa [S, Ld] using hld rw [this, hldfirst] ring constructor · rw [hloeq] apply (D n).Pr_mono intro z hz exact ⟨le_of_not_ge hz.2, hz.1⟩ · rw [hldeq] apply (D n).Pr_mono intro z hz constructor · exact hz.2 · rw [not_le] linarith apply Filter.eventually_atTop.1 filter_upwards [hevS, hevL, hevLd] with n hnS hnL hnLd rw [Real.dist_eq, abs_lt] rcases hbounds n with ⟨hlower, hupper⟩ rcases abs_lt.1 hnS with ⟨hnSlo, hnShi⟩ rcases abs_lt.1 hnL with ⟨hnLlo, hnLhi⟩ rcases abs_lt.1 hnLd with ⟨hnLdlo, hnLdhi⟩ rcases abs_lt.1 hFd with ⟨hFdlo, hFdhi⟩ constructor <;> linarith
WaldPipeline 1 core · 0 supporting dependency_wald_coverage chains the design-based dependency CLT (dependency_studentized_cdf) into the feasible Wald-coverage transfer. ★ dependency_wald_coverage
Design-based Wald-interval pipeline
dependency_wald_coverage chains the design-based dependency CLT (dependency_studentized_cdf)
into the feasible Wald-coverage transfer. Given unit contributions X n whose standardized sum
depSum(X n) is asymptotically equivalent to the scaled centered estimator
√(m n)·(est n − θ n), and a random variance estimator vhat n whose probability of materially
undershooting v n vanishes, the Wald interval
|θ n − est n| ≤ z·√(vhat n / m n) has liminf coverage at least 1 − α.
Design-based Wald-interval coverage from dependency-graph primitives. Consider a sequence of finite designs together with per-unit contributions X n i governed by a dependency graph Dep n on those contributions whose neighbourhoods have cardinality at most Dmax, where the contributions are uniformly bounded by a nonnegative constant M and have design mean zero. Suppose the standardizing quantity v n equals the design second moment of the contributions' sum depSum(X n), is bounded below by a positive constant c times the number of units eventually, and the number of units diverges. Suppose further that the standardized sum is asymptotically equivalent in probability to √(m n)·(est n − θ n) for an estimator est n of a target θ n, the normalization and oracle variance are positive, and a random feasible variance estimator has vanishing probability of material underestimation, with z the nonnegative quantile satisfying Φ(z) = 1 − α/2. Then the two-sided Wald interval |θ n − est n| ≤ z·√(v̂ n / m n) has asymptotic (liminf) coverage at least 1 − α.