Formalization: Sharp Minimax Rates for Average Treatment Effects with Discrete Confounding under Fixed Overlap

The complete Lean development behind this paper — every definition, lemma, and theorem of its module, including helpers the paper text never cites. Identifiers link within this page, into the Causalean library, or out to the official Mathlib docs.

Basic 48 declarations
def Cell

Defines Cell, the stated quantity or construction used in the discrete average-treatment-effect estimator.

Definition (Lean source)
abbrev Cell := Fin 2 × Fin 2
CausalSmith.Stat.DiscreteAteMinimaxLoggap.Cell · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Basic.lean:25

One observed unit (X,A,Y).

Definition (Lean source)
abbrev Obs (d : ℕ) := Fin d × Bool × Bool
CausalSmith.Stat.DiscreteAteMinimaxLoggap.Obs · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Basic.lean:28

A probability law with arbitrary masses on the finite observation alphabet.

Definition (Lean source)
d :
pmf :
PMF (Obs d)
CausalSmith.Stat.DiscreteAteMinimaxLoggap.DiscreteLaw · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Basic.lean:31
def obsLaw

The measure associated with a finite law.

Definition (Lean source)
noncomputable def obsLaw {d : ℕ} (P : DiscreteLaw d) : Measure (Obs d) := P.pmf.toMeasure
CausalSmith.Stat.DiscreteAteMinimaxLoggap.obsLaw · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Basic.lean:35
instance instIsProbabilityMeasureObsObsLaw

The measure attached to a finite observation law is a probability measure: its total mass is one.

Definition (Lean source)
instance {d : ℕ} (P : DiscreteLaw d) : IsProbabilityMeasure (obsLaw P) := by unfold obsLaw infer_instance
CausalSmith.Stat.DiscreteAteMinimaxLoggap.instIsProbabilityMeasureObsObsLaw · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Basic.lean:39
def jointMass

The mass of one (k,a,y) atom.

Definition (Lean source)
noncomputable def jointMass {d : ℕ} (P : DiscreteLaw d) (k : Fin d) (a y : Bool) : ℝ := (P.pmf (k, a, y)).toReal
CausalSmith.Stat.DiscreteAteMinimaxLoggap.jointMass · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Basic.lean:45
theorem jointMass_mem_unitInterval

Every atom probability of the observation law -- the chance of seeing a given category, treatment value and outcome value together -- lies between zero and one.

Formal statement
d :
P :
k :
Fin d
a y :
jointMass P k a y ∈ Icc (0 : ℝ) 1
Proof (Lean source)
lemma jointMass_mem_unitInterval {d : ℕ} (P : DiscreteLaw d) (k : Fin d) (a y : Bool) : jointMass P k a y ∈ Icc (0 : ℝ) 1 := by constructor · exact ENNReal.toReal_nonneg · exact ENNReal.toReal_le_coe_of_le_coe (P.pmf.coe_le_one (k, a, y))
CausalSmith.Stat.DiscreteAteMinimaxLoggap.jointMass_mem_unitInterval · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Basic.lean:51
def cellVector

The four masses in category k, indexed by (A,Y).

Definition (Lean source)
noncomputable def cellVector {d : ℕ} (P : DiscreteLaw d) (k : Fin d) : Cell → ℝ := fun ay => jointMass P k (finTwoEquiv ay.1) (finTwoEquiv ay.2)
CausalSmith.Stat.DiscreteAteMinimaxLoggap.cellVector · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Basic.lean:60
theorem cellVector_mem_unitCube

Each of the four coordinates of a category's mass vector, indexed by the treatment and outcome values, lies between zero and one, so the vector lies in the unit cube.

Formal statement
d :
P :
k :
Fin d
∀ ay, cellVector P k ay ∈ Icc (0 : ℝ) 1
Proof (Lean source)
lemma cellVector_mem_unitCube {d : ℕ} (P : DiscreteLaw d) (k : Fin d) : ∀ ay, cellVector P k ay ∈ Icc (0 : ℝ) 1 := by intro ay exact jointMass_mem_unitInterval P k (finTwoEquiv ay.1) (finTwoEquiv ay.2)
CausalSmith.Stat.DiscreteAteMinimaxLoggap.cellVector_mem_unitCube · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Basic.lean:65
def cellMass

Marginal mass P(X=k).

Definition (Lean source)
noncomputable def cellMass {d : ℕ} (P : DiscreteLaw d) (k : Fin d) : ℝ := ∑ a : Bool, ∑ y : Bool, jointMass P k a y
CausalSmith.Stat.DiscreteAteMinimaxLoggap.cellMass · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Basic.lean:73
theorem cellMass_mem_unitInterval

The marginal probability that the confounder takes a given category value lies between zero and one.

Formal statement
d :
P :
k :
Fin d
cellMass P k ∈ Icc (0 : ℝ) 1
Proof (Lean source)
lemma cellMass_mem_unitInterval {d : ℕ} (P : DiscreteLaw d) (k : Fin d) : cellMass P k ∈ Icc (0 : ℝ) 1 := by have hnonneg : 0 ≤ cellMass P k := by unfold cellMass exact sum_nonneg fun a _ => sum_nonneg fun y _ => (jointMass_mem_unitInterval P k a y).1 have hsum : ∑ z : Obs d, (P.pmf z).toReal = 1 := by simpa using (PMF.integral_eq_sum P.pmf (fun _ : Obs d => (1 : ℝ))).symm constructor · exact hnonneg · calc cellMass P k ≤ ∑ k' : Fin d, cellMass P k' := by exact Finset.single_le_sum (fun i _ => by unfold cellMass exact sum_nonneg fun a _ => sum_nonneg fun y _ => (jointMass_mem_unitInterval P i a y).1) (Finset.mem_univ k) _ = ∑ z : Obs d, (P.pmf z).toReal := by simp [cellMass, jointMass, Fintype.sum_prod_type] _ = 1 := hsum
CausalSmith.Stat.DiscreteAteMinimaxLoggap.cellMass_mem_unitInterval · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Basic.lean:78
def armMass

Joint mass P(X=k,A=a).

Definition (Lean source)
noncomputable def armMass {d : ℕ} (P : DiscreteLaw d) (k : Fin d) (a : Bool) : ℝ := ∑ y : Bool, jointMass P k a y
CausalSmith.Stat.DiscreteAteMinimaxLoggap.armMass · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Basic.lean:103
def propensity

Propensity, with Lean's total division convention on zero-mass cells.

Definition (Lean source)
noncomputable def propensity {d : ℕ} (P : DiscreteLaw d) (k : Fin d) : ℝ := armMass P k true / cellMass P k
CausalSmith.Stat.DiscreteAteMinimaxLoggap.propensity · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Basic.lean:107
theorem propensity_mem_unitInterval

The propensity of any category lies between zero and one. This holds unconditionally: on a category of zero mass the totalizing division convention returns zero, which is still in range.

Formal statement
d :
P :
k :
Fin d
propensity P k ∈ Icc (0 : ℝ) 1
Proof (Lean source)
lemma propensity_mem_unitInterval {d : ℕ} (P : DiscreteLaw d) (k : Fin d) : propensity P k ∈ Icc (0 : ℝ) 1 := by have harm_nonneg : 0 ≤ armMass P k true := by unfold armMass exact sum_nonneg fun y _ => (jointMass_mem_unitInterval P k true y).1 have hmass_nonneg : 0 ≤ cellMass P k := (cellMass_mem_unitInterval P k).1 have harm_le : armMass P k true ≤ cellMass P k := by simp [armMass, cellMass] have hfalse0 := (jointMass_mem_unitInterval P k false false).1 have hfalse1 := (jointMass_mem_unitInterval P k false true).1 linarith constructor · exact div_nonneg harm_nonneg hmass_nonneg · exact div_le_one_of_le₀ harm_le hmass_nonneg
CausalSmith.Stat.DiscreteAteMinimaxLoggap.propensity_mem_unitInterval · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Basic.lean:112
def outcomeMean

Binary outcome regression, again totalized on empty arm-cells.

Definition (Lean source)
noncomputable def outcomeMean {d : ℕ} (P : DiscreteLaw d) (a : Bool) (k : Fin d) : ℝ := jointMass P k a true / armMass P k a
CausalSmith.Stat.DiscreteAteMinimaxLoggap.outcomeMean · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Basic.lean:131
theorem outcomeMean_mem_unitInterval

The conditional mean of the binary outcome given a treatment arm and a category lies between zero and one. This holds unconditionally: on an empty arm-cell the totalizing division convention returns zero, which is still in range.

Formal statement
d :
P :
a :
k :
Fin d
outcomeMean P a k ∈ Icc (0 : ℝ) 1
Proof (Lean source)
lemma outcomeMean_mem_unitInterval {d : ℕ} (P : DiscreteLaw d) (a : Bool) (k : Fin d) : outcomeMean P a k ∈ Icc (0 : ℝ) 1 := by have hj_nonneg : 0 ≤ jointMass P k a true := (jointMass_mem_unitInterval P k a true).1 have harm_nonneg : 0 ≤ armMass P k a := by unfold armMass exact sum_nonneg fun y _ => (jointMass_mem_unitInterval P k a y).1 have hj_le : jointMass P k a truearmMass P k a := by simp [armMass] exact (jointMass_mem_unitInterval P k a false).1 constructor · exact div_nonneg hj_nonneg harm_nonneg · exact div_le_one_of_le₀ hj_le harm_nonneg
CausalSmith.Stat.DiscreteAteMinimaxLoggap.outcomeMean_mem_unitInterval · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Basic.lean:137
def productLaw

Canonical finite i.i.d. product law.

Definition (Lean source)
noncomputable def productLaw {d : ℕ} (P : DiscreteLaw d) (n : ℕ) : Measure (Fin n → Obs d) := Measure.pi (fun _ : Fin n => obsLaw P)
CausalSmith.Stat.DiscreteAteMinimaxLoggap.productLaw · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Basic.lean:155
instance instIsProbabilityMeasureForallFinObsProductLaw

The n-fold independent product of a finite observation law is again a probability measure.

Definition (Lean source)
instance {d n : ℕ} (P : DiscreteLaw d) : IsProbabilityMeasure (productLaw P n) := by unfold productLaw infer_instance
CausalSmith.Stat.DiscreteAteMinimaxLoggap.instIsProbabilityMeasureForallFinObsProductLaw · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Basic.lean:161
theorem finProductLaw_eq_map Lemma 20 in the paper ↗

The ambient infinite sample pushes forward to the canonical finite product.

Formal statement
X :
n :
(Measure.infinitePi (fun _ : ℕ => P)).map (fun ω : ℕ → X => fun i : Fin n => ω i)
= Measure.pi (fun _ : Fin n => P)
Proof (Lean source)
lemma finProductLaw_eq_map {X : Type*} [MeasurableSpace X] (P : Measure X) [IsProbabilityMeasure P] (n : ℕ) : (Measure.infinitePi (fun _ : ℕ => P)).map (fun ω : ℕ → X => fun i : Fin n => ω i) = Measure.pi (fun _ : Fin n => P) := by exact iidSample_finN_pushforward (iidSample_infinitePi P) n
CausalSmith.Stat.DiscreteAteMinimaxLoggap.finProductLaw_eq_map · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Basic.lean:179
def IidSampling

The observed sample law is the n-fold product of the one-unit law.

Definition (Lean source)
def IidSampling {d n : ℕ} (P : DiscreteLaw d) (mu_n : Measure (Fin n → Obs d)) : Prop := mu_n = productLaw P n
CausalSmith.Stat.DiscreteAteMinimaxLoggap.IidSampling · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Basic.lean:189
def Overlap

Positive-mass categories have propensity in [epsilon,1-epsilon].

Definition (Lean source)
def Overlap {d : ℕ} (epsilon : ℝ) (P : DiscreteLaw d) : Prop := ∀ k, 0 < cellMass P k → epsilon ≤ propensity P k ∧ propensity P k ≤ 1 - epsilon
CausalSmith.Stat.DiscreteAteMinimaxLoggap.Overlap · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Basic.lean:195
def FullObs

Full-data atom (X,A,Y,Y(0),Y(1)).

Definition (Lean source)
abbrev FullObs (d : ℕ) := Fin d × Bool × Bool × Bool × Bool
CausalSmith.Stat.DiscreteAteMinimaxLoggap.FullObs · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Basic.lean:203
structure PotentialLaw

Finite potential-outcome overlay used only by the causal witness.

Definition (Lean source)
d :
pmf :
CausalSmith.Stat.DiscreteAteMinimaxLoggap.PotentialLaw · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Basic.lean:206
def fullMass

The real-valued probability that a full-data law assigns to one atom of the extended alphabet, which records the category, the treatment, the observed outcome and both potential outcomes.

Definition (Lean source)
noncomputable def fullMass {d : ℕ} (Q : PotentialLaw d) (z : FullObs d) : ℝ := (Q.pmf z).toReal
CausalSmith.Stat.DiscreteAteMinimaxLoggap.fullMass · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Basic.lean:211

Y=Y(A) almost surely, written as zero mass on inconsistent atoms.

Definition (Lean source)
def Consistency {d : ℕ} (Q : PotentialLaw d) : Prop := ∀ z, z.2.2.1 ≠ (if z.2.1 then z.2.2.2.2 else z.2.2.2.1) → fullMass Q z = 0
CausalSmith.Stat.DiscreteAteMinimaxLoggap.Consistency · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Basic.lean:218
def poAtom

Conditional atom mass for (Y(0),Y(1),A,X).

Definition (Lean source)
noncomputable def poAtom {d : ℕ} (Q : PotentialLaw d) (k : Fin d) (a y0 y1 : Bool) : ℝ := ∑ y : Bool, fullMass Q (k, a, y, y0, y1)
CausalSmith.Stat.DiscreteAteMinimaxLoggap.poAtom · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Basic.lean:225
def ConditionalExchangeability Assumption 4 in the paper ↗

Finite conditional-independence identity (Y(0),Y(1)) ⟂ A | X.

Definition (Lean source)
def ConditionalExchangeability {d : ℕ} (Q : PotentialLaw d) : Prop := ∀ k a y0 y1, poAtom Q k a y0 y1 * (∑ a' : Bool, ∑ y0' : Bool, ∑ y1' : Bool, poAtom Q k a' y0' y1') = (∑ a' : Bool, poAtom Q k a' y0 y1) * (∑ y0' : Bool, ∑ y1' : Bool, poAtom Q k a y0' y1')
CausalSmith.Stat.DiscreteAteMinimaxLoggap.ConditionalExchangeability · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Basic.lean:231
structure ExperimentClass

Membership of a sample law in the unrestricted overlap experiment class.

Definition (Lean source)
n :
d :
epsilon :
P :
mu_n :
Measure (Fin n → Obs d)
epsilon_pos :
0 < epsilon
@realizes epsilon(strictly positive overlap constant)
epsilon_le_half :
epsilon ≤ 1 / 2
@realizes epsilon(overlap constant at most 1/2)
product_law :
@realizes \mathcal E_{n,d,\epsilon}(member law is productLaw P n) @realizes O_i(i.i.d. observations governed by the product law)
overlap :
Overlap epsilon P
CausalSmith.Stat.DiscreteAteMinimaxLoggap.ExperimentClass · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Basic.lean:243
def vectorArmMass

Four-cell arm mass.

Definition (Lean source)
def vectorArmMass (u : Cell → ℝ) (a : Fin 2) : ℝ := u (a, 0) + u (a, 1)
CausalSmith.Stat.DiscreteAteMinimaxLoggap.vectorArmMass · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Basic.lean:256
def vectorMass

Total four-cell mass.

Definition (Lean source)
def vectorMass (u : Cell → ℝ) : ℝ := vectorArmMass u 0 + vectorArmMass u 1
CausalSmith.Stat.DiscreteAteMinimaxLoggap.vectorMass · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Basic.lean:260

The nonnegative four-cell cone with treatment mass in the overlap band.

Definition (Lean source)
def overlapCone (epsilon : ℝ) : Set (Cell → ℝ) := {u | (∀ i, 0 ≤ u i) ∧ epsilon * vectorMass u ≤ vectorArmMass u 1 ∧ vectorArmMass u 1 ≤ (1 - epsilon) * vectorMass u}
CausalSmith.Stat.DiscreteAteMinimaxLoggap.overlapCone · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Basic.lean:265
def cellPhi

Total arithmetic extension of the homogeneous four-cell contribution. The paper-facing functional is cellPhiOnCone below.

Definition (Lean source)
noncomputable def cellPhi (u : Cell → ℝ) : ℝ := if u = 0 then 0 else vectorMass u * (u (1, 1) / vectorArmMass u 1 - u (0, 1) / vectorArmMass u 0)
CausalSmith.Stat.DiscreteAteMinimaxLoggap.cellPhi · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Basic.lean:272
def cellPhiOnCone

The homogeneous four-cell ATE contribution on its stated overlap-cone domain.

Definition (Lean source)
noncomputable def cellPhiOnCone (epsilon : ℝ) (u : overlapCone epsilon) : ℝ := cellPhi u.1
CausalSmith.Stat.DiscreteAteMinimaxLoggap.cellPhiOnCone · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Basic.lean:280
theorem cellPhiOnCone_apply

Evaluating the cell contribution functional at a point of the overlap cone returns the same number as applying the total arithmetic extension to the underlying four-vector of masses.

Formal statement
epsilon :
u :
overlapCone epsilon
cellPhiOnCone epsilon u = cellPhi u.1
Proof (Lean source)
@[simp] lemma cellPhiOnCone_apply (epsilon : ℝ) (u : overlapCone epsilon) : cellPhiOnCone epsilon u = cellPhi u.1 := rfl
CausalSmith.Stat.DiscreteAteMinimaxLoggap.cellPhiOnCone_apply · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Basic.lean:285
def ateFunctional

The observed-data ATE functional sum_k phi(q_k).

Definition (Lean source)
-- @node: def:ate-functional noncomputable def ateFunctional {d : ℕ} (P : DiscreteLaw d) : ℝ := ∑ k : Fin d, cellPhi (cellVector P k)
CausalSmith.Stat.DiscreteAteMinimaxLoggap.ateFunctional · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Basic.lean:291
theorem ateFunctional_eq_weighted_regression

The equivalent weighted-regression formula under overlap.

Formal statement
d :
epsilon :
P :
h :
Overlap epsilon P
= ∑ k : Fin d, cellMass P k * (outcomeMean P true k - outcomeMean P false k)
Proof (Lean source)
lemma ateFunctional_eq_weighted_regression {d : ℕ} {epsilon : ℝ} (P : DiscreteLaw d) (h : Overlap epsilon P) : ateFunctional P = ∑ k : Fin d, cellMass P k * (outcomeMean P true k - outcomeMean P false k) := by classical apply Finset.sum_congr rfl intro k _ by_cases hz : cellVector P k = 0 · have h00 := congrFun hz (0, 0) have h01 := congrFun hz (0, 1) have h10 := congrFun hz (1, 0) have h11 := congrFun hz (1, 1) simp [cellVector, finTwoEquiv] at h00 h01 h10 h11 simp [cellPhi, hz, cellMass, outcomeMean, armMass, h00, h01, h10, h11] · simp [cellPhi, hz, cellVector, vectorMass, vectorArmMass, cellMass, outcomeMean, armMass, finTwoEquiv] <;> ring
CausalSmith.Stat.DiscreteAteMinimaxLoggap.ateFunctional_eq_weighted_regression · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Basic.lean:297
theorem ateFunctional_mem_interval

Shows that ate Functional mem interval lies in the stated set or interval.

Formal statement
d :
epsilon :
P :
h :
Overlap epsilon P
ateFunctional P ∈ Icc (-1 : ℝ) 1
Proof (Lean source)
lemma ateFunctional_mem_interval {d : ℕ} {epsilon : ℝ} (P : DiscreteLaw d) (h : Overlap epsilon P) : ateFunctional P ∈ Icc (-1 : ℝ) 1 := by rw [ateFunctional_eq_weighted_regression P h] have hsum : ∑ k : Fin d, cellMass P k = 1 := by have htotal : ∑ z : Obs d, (P.pmf z).toReal = 1 := by simpa using (PMF.integral_eq_sum P.pmf (fun _ : Obs d => (1 : ℝ))).symm calc ∑ k : Fin d, cellMass P k = ∑ z : Obs d, (P.pmf z).toReal := by simp [cellMass, jointMass, Fintype.sum_prod_type] _ = 1 := htotal have habs : |∑ k : Fin d, cellMass P k * (outcomeMean P true k - outcomeMean P false k)| ≤ 1 := by calc |∑ k : Fin d, cellMass P k * (outcomeMean P true k - outcomeMean P false k)| ≤ ∑ k : Fin d, |cellMass P k * (outcomeMean P true k - outcomeMean P false k)| := Finset.abs_sum_le_sum_abs _ _ _ ≤ ∑ k : Fin d, cellMass P k := by apply Finset.sum_le_sum intro k _ have hp := cellMass_mem_unitInterval P k have hm1 := outcomeMean_mem_unitInterval P true k have hm0 := outcomeMean_mem_unitInterval P false k rcases hm1 with ⟨hm1lo, hm1hi⟩ rcases hm0 with ⟨hm0lo, hm0hi⟩ rw [abs_mul, abs_of_nonneg hp.1] have hdiff : |outcomeMean P true k - outcomeMean P false k| ≤ 1 := by rw [abs_le] constructor <;> linarith exact mul_le_of_le_one_right hp.1 hdiff _ = 1 := hsum exact abs_le.mp habs
CausalSmith.Stat.DiscreteAteMinimaxLoggap.ateFunctional_mem_interval · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Basic.lean:316

Mean squared error under a supplied sample law.

Definition (Lean source)
-- @realizes \(\mathsf R_{n,d,\epsilon}\)(expected squared loss under the product law) noncomputable def mse {d n : ℕ} (mu_n : Measure (Fin n → Obs d)) (est : (Fin n → Obs d) → ℝ) (target : ℝ) : ℝ := ∫ x, (est x - target) ^ 2 ∂mu_n
CausalSmith.Stat.DiscreteAteMinimaxLoggap.mse · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Basic.lean:353
def ClassLaw

A law packaged with overlap-class membership.

Definition (Lean source)
def ClassLaw (n d : ℕ) (epsilon : ℝ) := {P : DiscreteLaw d // ExperimentClass n epsilon P (productLaw P n)}
CausalSmith.Stat.DiscreteAteMinimaxLoggap.ClassLaw · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Basic.lean:361

Worst-case MSE of one measurable estimator over the experiment class.

Definition (Lean source)
-- @realizes \(\mathsf R_{n,d,\epsilon}\)(supremum over the overlap experiment class) noncomputable def worstCaseMSE (n d : ℕ) (epsilon : ℝ) (est : (Fin n → Obs d) → ℝ) : ℝ := ⨆ P : ClassLaw n d epsilon, mse (productLaw P.1 n) est (ateFunctional P.1)
CausalSmith.Stat.DiscreteAteMinimaxLoggap.worstCaseMSE · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Basic.lean:365

Infimum, over measurable estimators, of their worst-case product-law MSE.

Definition (Lean source)
-- @realizes \(\mathsf R_{n,d,\epsilon}\)(infimum measurable estimator worst-case MSE) -- @node: def:minimax-risk noncomputable def minimaxRisk (n d : ℕ) (epsilon : ℝ) : ℝ := ⨅ est : {f : (Fin n → Obs d) → ℝ // Measurable f}, worstCaseMSE n d epsilon est.1
CausalSmith.Stat.DiscreteAteMinimaxLoggap.minimaxRisk · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Basic.lean:371
theorem minimaxRisk_mem_unitInterval

The minimax mean-squared-error risk over the overlap experiment class lies between zero and one. It is nonnegative because every worst-case risk is an integral of a square, and it is at most one because the estimator that always reports zero already incurs squared error at most one against an average treatment effect that is confined to the interval from minus one to one.

Formal statement
n d :
epsilon :
minimaxRisk n d epsilon ∈ Icc (0 : ℝ) 1
Proof (Lean source)
lemma minimaxRisk_mem_unitInterval (n d : ℕ) (epsilon : ℝ) : minimaxRisk n d epsilon ∈ Icc (0 : ℝ) 1 := by have hnonneg (est : {f : (Fin n → Obs d) → ℝ // Measurable f}) : 0 ≤ worstCaseMSE n d epsilon est.1 := by unfold worstCaseMSE cases isEmpty_or_nonempty (ClassLaw n d epsilon) with | inl hempty => letI := hempty simp | inr hnonempty => letI := hnonempty by_cases hbounded : BddAbove (range (fun P : ClassLaw n d epsilon => mse (productLaw P.1 n) est (ateFunctional P.1))) · have hmse : 0 ≤ mse (productLaw (Classical.arbitrary (ClassLaw n d epsilon)).1 n) est (ateFunctional (Classical.arbitrary (ClassLaw n d epsilon)).1) := by unfold mse exact integral_nonneg (fun x => sq_nonneg (est.1 x - ateFunctional (Classical.arbitrary (ClassLaw n d epsilon)).1)) exact hmse.trans (le_ciSup hbounded (Classical.arbitrary _)) · change 0 ≤ (⨆ P : ClassLaw n d epsilon, mse (productLaw P.1 n) est.1 (ateFunctional P.1)) rw [show (⨆ P : ClassLaw n d epsilon, mse (productLaw P.1 n) est.1 (ateFunctional P.1)) = sSup ∅ from csSup_of_not_bddAbove hbounded] simp have hb : BddBelow (range (fun est : {f : (Fin n → Obs d) → ℝ // Measurable f} => worstCaseMSE n d epsilon est.1)) := by refine ⟨0, ?_⟩ rintro _ ⟨est, rfl⟩ exact hnonneg est letI : Nonempty {f : (Fin n → Obs d) → ℝ // Measurable f} := ⟨⟨fun _ => 0, measurable_const⟩⟩ constructor · apply le_ciInf intro est exact hnonneg est · have hzero : Measurable (fun _ : Fin n → Obs d => (0 : ℝ)) := measurable_const refine (ciInf_le hb ⟨fun _ => 0, hzero⟩).trans ?_ unfold worstCaseMSE cases isEmpty_or_nonempty (ClassLaw n d epsilon) with | inl hempty => letI := hempty simp | inr hnonempty => letI := hnonempty apply ciSup_le intro P have ht := ateFunctional_mem_interval P.1 P.2.overlap have hs : ateFunctional P.1 ^ 2 ≤ 1 := by rw [sq_le_one_iff_abs_le_one] exact abs_le.mpr ht simpa [mse] using hs
CausalSmith.Stat.DiscreteAteMinimaxLoggap.minimaxRisk_mem_unitInterval · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Basic.lean:379
def observedMarginal

Observed marginal of a full-data law.

Definition (Lean source)
noncomputable def observedMarginal {d : ℕ} (Q : PotentialLaw d) : DiscreteLaw d where pmf := Q.pmf.map (fun z => (z.1, z.2.1, z.2.2.1))
CausalSmith.Stat.DiscreteAteMinimaxLoggap.observedMarginal · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Basic.lean:439
def twoCategoryMass

Unnormalized explicit witness mass.

Definition (Lean source)
noncomputable def twoCategoryMass (epsilon : ℝ) (z : FullObs 2) : ℝ := let xFirst : Bool := z.1 = 0 let y0 : Bool := false let y1 : Bool := xFirst let propensityWeight : ℝ := if z.2.1 then (if xFirst then epsilon else 1 - epsilon) else (if xFirst then 1 - epsilon else epsilon) if z.2.2.2.1 = y0 ∧ z.2.2.2.2 = y1 ∧ z.2.2.1 = (if z.2.1 then y1 else y0) then (1 / 2 : ℝ) * propensityWeight else 0
CausalSmith.Stat.DiscreteAteMinimaxLoggap.twoCategoryMass · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Basic.lean:443
theorem twoCategoryMass_nonneg

The unnormalized masses of the explicit two-category confounding witness are nonnegative whenever the overlap constant lies between zero and one.

Formal statement
epsilon :
h0 :
0 ≤ epsilon
h1 :
epsilon ≤ 1
z :
0 ≤ twoCategoryMass epsilon z
Proof (Lean source)
lemma twoCategoryMass_nonneg (epsilon : ℝ) (h0 : 0 ≤ epsilon) (h1 : epsilon ≤ 1) (z : FullObs 2) : 0 ≤ twoCategoryMass epsilon z := by simp only [twoCategoryMass] split_ifs <;> nlinarith
CausalSmith.Stat.DiscreteAteMinimaxLoggap.twoCategoryMass_nonneg · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Basic.lean:456
theorem twoCategoryMass_sum

Establishes the stated summation identity or bound for two Category Mass sum.

Formal statement
epsilon :
h0 :
0 ≤ epsilon
h1 :
epsilon ≤ 1
∑ z : FullObs 2, ofReal (twoCategoryMass epsilon z) = 1
Proof (Lean source)
lemma twoCategoryMass_sum (epsilon : ℝ) (h0 : 0 ≤ epsilon) (h1 : epsilon ≤ 1) : ∑ z : FullObs 2, ofReal (twoCategoryMass epsilon z) = 1 := by classical simp [Fintype.sum_prod_type, Fin.sum_univ_two, twoCategoryMass] have he : ofReal epsilon + ofReal (1 - epsilon) = 1 := by rw [← ENNReal.ofReal_add h0 (sub_nonneg.mpr h1)] norm_num calc 2⁻¹ * ofReal epsilon + 2⁻¹ * ofReal (1 - epsilon) + (2⁻¹ * ofReal (1 - epsilon) + 2⁻¹ * ofReal epsilon) = 2⁻¹ * (ofReal epsilon + ofReal (1 - epsilon)) + 2⁻¹ * (ofReal epsilon + ofReal (1 - epsilon)) := by ring _ = 1 := by rw [he, mul_one]; exact ENNReal.inv_two_add_inv_two
CausalSmith.Stat.DiscreteAteMinimaxLoggap.twoCategoryMass_sum · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Basic.lean:463
def twoCategoryWitness

Explicit two-category confounding witness with p=(1/2,1/2) and propensities (epsilon,1-epsilon).

Definition (Lean source)
noncomputable def twoCategoryWitness (epsilon : ℝ) (h0 : 0 ≤ epsilon) (h1 : epsilon ≤ 1) : PotentialLaw 2 where pmf := PMF.ofFintype (fun z => ofReal (twoCategoryMass epsilon z)) (twoCategoryMass_sum epsilon h0 h1)
CausalSmith.Stat.DiscreteAteMinimaxLoggap.twoCategoryWitness · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Basic.lean:479
def naiveContrast

Naive observed treated-minus-control contrast.

Definition (Lean source)
noncomputable def naiveContrast {d : ℕ} (P : DiscreteLaw d) : ℝ := let treated := ∑ k : Fin d, jointMass P k true true let control := ∑ k : Fin d, jointMass P k false true let pT := ∑ k : Fin d, armMass P k true let pC := ∑ k : Fin d, armMass P k false treated / pT - control / pC
CausalSmith.Stat.DiscreteAteMinimaxLoggap.naiveContrast · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Basic.lean:492
Helpers.ChebyshevCertificate 21 declarations
theorem shifted_chebyshev_expansion

Shifted-Chebyshev coefficient expansion used in the paper's equation (1).

Formal statement
M :
x :
(T ℝ M).eval (1 - 2 * x)
= 1
+ ∑ j ∈ Icc 1 M, (-1 : ℝ) ^ j * (M : ℝ) / (M + j) * choose (M + j) (2 * j) * 4 ^ j * x ^ j
Proof (Lean source)
lemma shifted_chebyshev_expansion (M : ℕ) (x : ℝ) : (T ℝ M).eval (1 - 2 * x) = 1 + ∑ j ∈ Icc 1 M, (-1 : ℝ) ^ j * (M : ℝ) / (M + j) * choose (M + j) (2 * j) * 4 ^ j * x ^ j := shiftedChebyshevExpansion M x
CausalSmith.Stat.DiscreteAteMinimaxLoggap.shifted_chebyshev_expansion · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/ChebyshevCertificate.lean:12
theorem chebyshev_gPolynomial_identity

For a positive degree, the Chebyshev polynomial of the first kind evaluated at the shifted argument one minus twice the variable splits into three pieces: the constant one, a linear term with coefficient minus twice the squared degree, and a remainder equal to twice the squared degree times the variable squared times the explicit polynomial continuation. This isolates the quadratic-and-higher part of the shifted Chebyshev expansion that the light-cell approximation actually uses.

Formal statement
M :
hM :
0 < M
x :
(T ℝ M).eval (1 - 2 * x)
= 1 - 2 * (M : ℝ)^2 * x + 2 * (M : ℝ)^2 * x^2 * gPolynomial M x
Proof (Lean source)
lemma chebyshev_gPolynomial_identity {M : ℕ} (hM : 0 < M) (x : ℝ) : (T ℝ M).eval (1 - 2 * x) = 1 - 2 * (M : ℝ)^2 * x + 2 * (M : ℝ)^2 * x^2 * gPolynomial M x := by rw [shifted_chebyshev_expansion] let a : ℕ → ℝ := fun j => (-1 : ℝ) ^ j * (M : ℝ) / (M + j) * choose (M + j) (2 * j) * 4 ^ j * x ^ j have hM1 : 1 ≤ M := hM have hs : Icc 1 M = insert 1 (Icc 2 M) := by symm exact Finset.insert_Icc_add_one_left_eq_Icc hM1 have hnot : 1 ∉ Icc 2 M := by simp have hi : Icc 2 M = Ico 2 (M + 1) := by ext j simp change 1 + ∑ j ∈ Icc 1 M, a j = _ rw [hs, Finset.sum_insert hnot, hi, Finset.sum_Ico_eq_sum_range] have hsub : M + 1 - 2 = M - 1 := by omega rw [hsub] have ha1 : a 1 = -2 * (M : ℝ)^2 * x := by dsimp [a] rw [Nat.cast_choose_two] norm_num push_cast have hMn : (M : ℝ) ≠ 0 := by positivity field_simp ring rw [ha1] have hsum : (∑ k ∈ range (M - 1), a (2 + k)) = 2 * (M : ℝ)^2 * x^2 * gPolynomial M x := by unfold gPolynomial rw [Finset.mul_sum] apply Finset.sum_congr rfl intro k hk have hkn : k + 2 ≤ M := by simp only [Finset.mem_range] at hk; omega have hden : (M : ℝ) + (k : ℝ) + 2 ≠ 0 := by positivity simp only [a, gCoefficient] push_cast rw [show 2 + k = k + 2 by omega] rw [show 2 * (k + 2) = 2 * k + 4 by omega] rw [show M + (k + 2) = M + k + 2 by omega] rw [pow_add x k 2, pow_add (-1 : ℝ) k 2, pow_add 4 k 2] rw [show (-1 : ℝ)^2 = 1 by ring, show (4 : ℝ)^2 = 16 by ring] simp only [mul_one] rw [show (4 : ℝ)^k = 2^(2*k) by calc (4 : ℝ)^k = (2^2 : ℝ)^k := by norm_num _ = 2^(2*k) := by rw [pow_mul]] rw [show 2 * k = k * 2 by omega] rw [show (2 : ℝ)^(k*2+3) = 2^(k*2) * 8 by rw [pow_add]; norm_num] field_simp [hden] ring rw [hsum] ring
CausalSmith.Stat.DiscreteAteMinimaxLoggap.chebyshev_gPolynomial_identity · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/ChebyshevCertificate.lean:20
theorem gPolynomial_certificate

Uniform reciprocal-approximation certificate on [0,1].

Formal statement
M :
hM :
0 < M
x :
hx :
x ∈ Icc (0 : ℝ) 1
x * |1 - x * gPolynomial M x| ≤ ((M : ℝ) ^ 2)⁻¹
Proof (Lean source)
lemma gPolynomial_certificate {M : ℕ} (hM : 0 < M) {x : ℝ} (hx : x ∈ Icc (0 : ℝ) 1) : x * |1 - x * gPolynomial M x| ≤ ((M : ℝ) ^ 2)⁻¹ := by let t := (T ℝ M).eval (1 - 2 * x) have hy : |1 - 2 * x| ≤ (1 : ℝ) := by rw [abs_le] constructor <;> linarith [hx.1, hx.2] have ht : |t| ≤ (1 : ℝ) := by exact Polynomial.Chebyshev.abs_eval_T_real_le_one M hy have hdiff : |1 - t| ≤ (2 : ℝ) := by calc |1 - t| ≤ |(1 : ℝ)| + |t| := abs_sub _ _ _ ≤ 2 := by norm_num; linarith have hm : (0 : ℝ) < (M : ℝ) := by exact_mod_cast hM have hm2 : 0 < (M : ℝ)^2 := sq_pos_of_pos hm have hid : 1 - t = 2 * (M : ℝ)^2 * x * (1 - x * gPolynomial M x) := by dsimp [t] rw [chebyshev_gPolynomial_identity hM x] ring have habs : |1 - t| = 2 * (M : ℝ)^2 * x * |1 - x * gPolynomial M x| := by rw [hid, abs_mul, abs_mul, abs_mul] rw [abs_of_nonneg (by positivity : (0 : ℝ) ≤ 2), abs_of_nonneg (sq_nonneg (M : ℝ)), abs_of_nonneg hx.1] rw [inv_eq_one_div] apply (le_div_iff₀ hm2).2 rw [habs] at hdiff nlinarith [abs_nonneg (1 - x * gPolynomial M x)]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.gPolynomial_certificate · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/ChebyshevCertificate.lean:81
theorem cellApproxPolynomial_error Lemma 10 in the paper ↗

Cone approximation bound for the explicit four-cell polynomial.

Formal statement
M :
hM :
0 < M
B epsilon :
u :
Cell → ℝ
he0 :
0 < epsilon
hu :
u ∈ overlapCone epsilon
hB :
vectorMass u ≤ B
|(cellApproxPolynomial M B).eval u - cellPhi u| ≤ 2 * B / (epsilon * M ^ 2)
Proof (Lean source)
lemma cellApproxPolynomial_error {M : ℕ} (hM : 0 < M) {B epsilon : ℝ} {u : Cell → ℝ} (he0 : 0 < epsilon) (hu : u ∈ overlapCone epsilon) (hB : vectorMass u ≤ B) : |(cellApproxPolynomial M B).eval u - cellPhi u| ≤ 2 * B / (epsilon * M ^ 2) := by rcases hu with ⟨hu_nonneg, hu_low, hu_up⟩ by_cases huz : u = 0 · subst u rw [eval_cellApproxPolynomial] have hB0 : 0 ≤ B := by simpa [vectorMass, vectorArmMass] using hB simp [cellPhi, vectorMass, vectorArmMass] exact div_nonneg (mul_nonneg (by norm_num) hB0) (le_of_lt (mul_pos he0 (by positivity))) have hs0 : 0 ≤ vectorMass u := by simp only [vectorMass, vectorArmMass] linarith [hu_nonneg (0,0), hu_nonneg (0,1), hu_nonneg (1,0), hu_nonneg (1,1)] have hsne : vectorMass u ≠ 0 := by intro hs apply huz funext i rcases i with ⟨a,y⟩ fin_cases a <;> fin_cases y all_goals have h00 := hu_nonneg (0,0) have h01 := hu_nonneg (0,1) have h10 := hu_nonneg (1,0) have h11 := hu_nonneg (1,1) simp only [vectorMass, vectorArmMass] at hs simp_all linarith have hs : 0 < vectorMass u := lt_of_le_of_ne hs0 (Ne.symm hsne) have hBp : 0 < B := lt_of_lt_of_le hs hB have hM2 : 0 < (M : ℝ)^2 := by positivity have hlow0 : epsilon * vectorMass u ≤ vectorArmMass u 0 := by rw [vectorMass] at hu_up ⊢ linarith have arm_bound (a : Fin 2) (ha : epsilon * vectorMass u ≤ vectorArmMass u a) : |B⁻¹ * vectorMass u * u (a,1) * gPolynomial M (vectorArmMass u a / B) - vectorMass u * (u (a,1) / vectorArmMass u a)| ≤ B / (epsilon * (M : ℝ)^2) := by have hsa0 : 0 ≤ vectorArmMass u a := by rw [vectorArmMass] exact add_nonneg (hu_nonneg (a,0)) (hu_nonneg (a,1)) have hsap : 0 < vectorArmMass u a := lt_of_lt_of_le (mul_pos he0 hs) ha have htas : u (a,1) ≤ vectorArmMass u a := by simp only [vectorArmMass] linarith [hu_nonneg (a,0)] have hsaB : vectorArmMass u a ≤ B := by have h0 : vectorArmMass u 0 ≤ vectorMass u := by rw [vectorMass] have hn : 0 ≤ vectorArmMass u 1 := by rw [vectorArmMass] exact add_nonneg (hu_nonneg (1,0)) (hu_nonneg (1,1)) linarith have h1 : vectorArmMass u 1 ≤ vectorMass u := by rw [vectorMass] have hn : 0 ≤ vectorArmMass u 0 := by rw [vectorArmMass] exact add_nonneg (hu_nonneg (0,0)) (hu_nonneg (0,1)) linarith have : vectorArmMass u a ≤ vectorMass u := by fin_cases a · simpa using h0 · simpa using h1 exact this.trans hB have hx : vectorArmMass u a / B ∈ Icc (0 : ℝ) 1 := by constructor · positivity · exact (div_le_one hBp).2 hsaB have hcert := gPolynomial_certificate hM hx let E := |1 - (vectorArmMass u a / B) * gPolynomial M (vectorArmMass u a / B)| have hxp : 0 < vectorArmMass u a / B := div_pos hsap hBp have hE : E ≤ B / (vectorArmMass u a * (M : ℝ)^2) := by have h' : E ≤ ((M : ℝ)^2)⁻¹ / (vectorArmMass u a / B) := (le_div_iff₀ hxp).2 (by simpa [E, mul_comm] using hcert) calc E ≤ ((M : ℝ)^2)⁻¹ / (vectorArmMass u a / B) := h' _ = B / (vectorArmMass u a * (M : ℝ)^2) := by field_simp have hcoef0 : 0 ≤ vectorMass u * u (a,1) / vectorArmMass u a := by exact div_nonneg (mul_nonneg hs0 (hu_nonneg (a,1))) hsa0 have hcoef : vectorMass u * u (a,1) / vectorArmMass u a ≤ vectorMass u := by apply (div_le_iff₀ hsap).2 nlinarith [hu_nonneg (a,1)] have hfactor : vectorMass u * u (a,1) / vectorArmMass u a * E ≤ B / (epsilon * (M : ℝ)^2) := by calc vectorMass u * u (a,1) / vectorArmMass u a * E ≤ vectorMass u * (B / (vectorArmMass u a * (M : ℝ)^2)) := by gcongr _ ≤ B / (epsilon * (M : ℝ)^2) := by field_simp nlinarith have hid : B⁻¹ * vectorMass u * u (a,1) * gPolynomial M (vectorArmMass u a / B) - vectorMass u * (u (a,1) / vectorArmMass u a) = -(vectorMass u * u (a,1) / vectorArmMass u a) * (1 - (vectorArmMass u a / B) * gPolynomial M (vectorArmMass u a / B)) := by field_simp ring rw [hid, abs_mul, abs_neg] rw [abs_of_nonneg hcoef0] exact hfactor have hb1 := arm_bound 1 hu_low have hb0 := arm_bound 0 hlow0 rw [eval_cellApproxPolynomial, cellPhi, if_neg huz] have hdecomp : B⁻¹ * vectorMass u * u (1, 1) * gPolynomial M (vectorArmMass u 1 / B) - B⁻¹ * vectorMass u * u (0, 1) * gPolynomial M (vectorArmMass u 0 / B) - vectorMass u * (u (1, 1) / vectorArmMass u 1 - u (0, 1) / vectorArmMass u 0) = (B⁻¹ * vectorMass u * u (1,1) * gPolynomial M (vectorArmMass u 1 / B) - vectorMass u * (u (1,1) / vectorArmMass u 1)) - (B⁻¹ * vectorMass u * u (0,1) * gPolynomial M (vectorArmMass u 0 / B) - vectorMass u * (u (0,1) / vectorArmMass u 0)) := by ring rw [hdecomp] calc |(_ : ℝ) - _| ≤ |(_ : ℝ)| + |(_ : ℝ)| := abs_sub _ _ _ ≤ B / (epsilon * (M : ℝ)^2) + B / (epsilon * (M : ℝ)^2) := add_le_add hb1 hb0 _ = 2 * B / (epsilon * (M : ℝ)^2) := by ring
CausalSmith.Stat.DiscreteAteMinimaxLoggap.cellApproxPolynomial_error · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/ChebyshevCertificate.lean:118
theorem env_C

Establishes the stated property of env C in the discrete average-treatment-effect construction.

Formal statement
c :
v :
Cell → ℝ
Proof (Lean source)
lemma env_C (c : ℝ) (v : Cell → ℝ) : coefficientEnvelope (C c) v = |c| := by rw [show C c = monomial 0 c by rfl] unfold coefficientEnvelope monomialWeight by_cases hc : c = 0 · simp [hc] · rw [MvPolynomial.support_monomial] simp [hc]
theorem env_X

Establishes the stated property of env X in the discrete average-treatment-effect construction.

Formal statement
i :
v :
Cell → ℝ
Proof (Lean source)
lemma env_X (i : Cell) (v : Cell → ℝ) : coefficientEnvelope (X i) v = v i := by change coefficientEnvelope (monomial (Finsupp.single i 1) 1) v = _ unfold coefficientEnvelope monomialWeight rw [MvPolynomial.support_monomial] simp rcases i with ⟨a,y⟩ fin_cases a <;> fin_cases y <;> simp [Fintype.prod_prod_type, Fin.prod_univ_two]
theorem env_nonneg

Shows that env nonneg is nonnegative.

Formal statement
p :
v :
Cell → ℝ
hv :
∀ i, 0 ≤ v i
Proof (Lean source)
lemma env_nonneg (p : MvPolynomial Cell ℝ) (v : Cell → ℝ) (hv : ∀ i, 0 ≤ v i) : 0 ≤ coefficientEnvelope p v := by unfold coefficientEnvelope exact sum_nonneg fun r hr => mul_nonneg (abs_nonneg _) (monomialWeight_nonneg v hv r)
theorem env_pow_le

Establishes the stated upper bound for env pow le.

Formal statement
p :
v :
Cell → ℝ
hv :
∀ i, 0 ≤ v i
j :
Proof (Lean source)
lemma env_pow_le (p : MvPolynomial Cell ℝ) (v : Cell → ℝ) (hv : ∀ i, 0 ≤ v i) (j : ℕ) : coefficientEnvelope (p^j) v ≤ coefficientEnvelope p v ^ j := by induction j with | zero => change coefficientEnvelope (C 1) v ≤ 1 rw [env_C] norm_num | succ j ih => rw [pow_succ, pow_succ] calc coefficientEnvelope (p^j*p) v ≤ coefficientEnvelope (p^j) v * coefficientEnvelope p v := coefficientEnvelope_mul_le _ _ _ hv _ ≤ coefficientEnvelope p v ^ j * coefficientEnvelope p v := by exact mul_le_mul_of_nonneg_right ih (env_nonneg p v hv)
theorem env_sum_le

Establishes the stated upper bound for env sum le.

Formal statement
ι :
s :
f :
ι → MvPolynomial Cell
v :
Cell → ℝ
hv :
∀ i, 0 ≤ v i
coefficientEnvelope (∑ i ∈ s, f i) v ≤ ∑ i ∈ s, coefficientEnvelope (f i) v
Proof (Lean source)
lemma env_sum_le {ι : Type} [DecidableEq ι] (s : Finset ι) (f : ι → MvPolynomial Cell ℝ) (v : Cell → ℝ) (hv : ∀ i, 0 ≤ v i) : coefficientEnvelope (∑ i ∈ s, f i) v ≤ ∑ i ∈ s, coefficientEnvelope (f i) v := by induction s using Finset.induction_on with | empty => simp [coefficientEnvelope] | insert a s ha ih => simp only [Finset.sum_insert ha] exact (coefficientEnvelope_add_le _ _ _ hv).trans (add_le_add_right ih _)
def gpos

Defines gpos, the stated quantity or construction used in the discrete average-treatment-effect estimator.

Definition (Lean source)
noncomputable def gpos (M : ℕ) (z : ℝ) : ℝ := ∑ j ∈ range (M-1), |gCoefficient M j| * z^j
theorem abs_gCoefficient

Establishes the stated property of abs g Coefficient in the discrete average-treatment-effect construction.

Formal statement
M :
hM :
0 < M
j :
|gCoefficient M j| = 2^(2*j+3) / ((M:ℝ)*(M+j+2)) * choose (M+j+2) (2*j+4)
Proof (Lean source)
lemma abs_gCoefficient {M : ℕ} (hM : 0 < M) (j : ℕ) : |gCoefficient M j| = 2^(2*j+3) / ((M:ℝ)*(M+j+2)) * choose (M+j+2) (2*j+4) := by unfold gCoefficient rw [abs_mul, abs_div, abs_mul, abs_pow, abs_neg, abs_one] rw [abs_of_nonneg (by positivity : (0:ℝ) ≤ 2^(2*j+3))] rw [abs_of_pos (mul_pos (by exact_mod_cast hM) (by positivity))] rw [abs_of_nonneg (by positivity : (0:ℝ) ≤ (choose (M+j+2) (2*j+4) : ℝ))] norm_num
theorem sign_gCoefficient

Establishes the stated property of sign g Coefficient in the discrete average-treatment-effect construction.

Formal statement
M :
hM :
0 < M
j :
|gCoefficient M j| = (-1 : ℝ)^j * gCoefficient M j
Proof (Lean source)
lemma sign_gCoefficient {M : ℕ} (hM : 0 < M) (j : ℕ) : |gCoefficient M j| = (-1 : ℝ)^j * gCoefficient M j := by rw [abs_gCoefficient hM] unfold gCoefficient have hs : (-1 : ℝ)^j * (-1 : ℝ)^j = 1 := by rw [← pow_add] rw [show j+j=2*j by omega, pow_mul] simp calc 2 ^ (2*j+3) / ((M:ℝ)*(M+j+2)) * choose (M+j+2) (2*j+4) = ((-1 : ℝ)^j * (-1 : ℝ)^j) * (2 ^ (2*j+3) / ((M:ℝ)*(M+j+2)) * choose (M+j+2) (2*j+4)) := by rw [hs, one_mul] _ = _ := by ring
theorem gpos_eq

Establishes the stated equality relating gpos eq.

Formal statement
M :
hM :
0 < M
z :
gpos M z = gPolynomial M (-z)
Proof (Lean source)
lemma gpos_eq (M : ℕ) (hM : 0 < M) (z : ℝ) : gpos M z = gPolynomial M (-z) := by unfold gpos gPolynomial apply Finset.sum_congr rfl intro j hj rw [sign_gCoefficient hM, neg_pow] ring
theorem chebyshev_three_le

Establishes the stated upper bound for chebyshev three le.

Formal statement
M :
(T ℝ M).eval 3 ≤ (6 : ℝ)^M
Proof (Lean source)
lemma chebyshev_three_le (M : ℕ) : (T ℝ M).eval 3 ≤ (6 : ℝ)^M := by induction M using Nat.twoStepInduction with | zero => simp | one => norm_num [Polynomial.Chebyshev.T_one] | more n hn hn1 => rw [show (n+2 : ℕ) = (n:ℤ)+2 by omega] rw [Polynomial.Chebyshev.T_add_two] simp only [Polynomial.eval_sub, Polynomial.eval_mul, Polynomial.eval_ofNat, Polynomial.eval_X] have hnonneg : 0 ≤ (T ℝ n).eval 3 := le_trans (by norm_num) (Polynomial.Chebyshev.one_le_eval_T_real n (by norm_num)) calc 2 * 3 * (T ℝ (n+1)).eval 3 - (T ℝ n).eval 3 ≤ 6 * (T ℝ (n+1)).eval 3 := by linarith _ ≤ 6 * 6^(n+1) := by gcongr simpa using hn1 _ = 6^(n+2) := by rw [pow_succ]; ring
CausalSmith.Stat.DiscreteAteMinimaxLoggap.chebyshev_three_le · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/ChebyshevCertificate.lean:341
theorem gpos_nonneg

Shows that gpos nonneg is nonnegative.

Formal statement
M :
z :
hz :
0 ≤ z
0 ≤ gpos M z
Proof (Lean source)
lemma gpos_nonneg (M : ℕ) {z : ℝ} (hz : 0 ≤ z) : 0 ≤ gpos M z := by unfold gpos exact sum_nonneg fun j hj => mul_nonneg (abs_nonneg _) (pow_nonneg hz _)
theorem gpos_bound Lemma 14 in the paper ↗

Establishes the stated upper bound for gpos bound.

Formal statement
M :
hM :
0 < M
z :
hz :
0 ≤ z
gpos M z ≤ (6:ℝ)^M * max 1 (z^(M-2))
Proof (Lean source)
lemma gpos_bound {M : ℕ} (hM : 0 < M) {z : ℝ} (hz : 0 ≤ z) : gpos M z ≤ (6:ℝ)^M * max 1 (z^(M-2)) := by have hid := chebyshev_gPolynomial_identity hM (-1 : ℝ) norm_num at hid rw [← gpos_eq M hM 1] at hid have hg1n := gpos_nonneg M (show (0:ℝ) ≤ 1 by norm_num) have hm1 : (1:ℝ) ≤ (M:ℝ)^2 := by have : (1:ℝ) ≤ M := by exact_mod_cast hM nlinarith have hg1T : gpos M 1 ≤ (T ℝ M).eval 3 := by have hmul := mul_le_mul_of_nonneg_right hm1 hg1n have hgterm : gpos M 1 ≤ 2 * (M:ℝ)^2 * gpos M 1 := by nlinarith [mul_nonneg (sq_nonneg (M:ℝ)) hg1n] calc gpos M 1 ≤ 1 + 2 * (M:ℝ)^2 + 2 * (M:ℝ)^2 * gpos M 1 := by linarith [sq_nonneg (M:ℝ)] _ = (T ℝ M).eval 3 := hid.symm have hg1 : gpos M 1 ≤ (6:ℝ)^M := hg1T.trans (chebyshev_three_le M) by_cases hz1 : z ≤ 1 · have hgz : gpos M z ≤ gpos M 1 := by unfold gpos apply Finset.sum_le_sum intro j hj gcongr calc gpos M z ≤ gpos M 1 := hgz _ ≤ (6:ℝ)^M := hg1 _ ≤ (6:ℝ)^M * max 1 (z^(M-2)) := by have : (1:ℝ) ≤ max 1 (z^(M-2)) := le_max_left _ _ nlinarith [pow_nonneg (show (0:ℝ) ≤ 6 by norm_num) M] · have h1z : 1 ≤ z := le_of_not_ge hz1 have hgz : gpos M z ≤ z^(M-2) * gpos M 1 := by unfold gpos rw [Finset.mul_sum] apply Finset.sum_le_sum intro j hj have hjle : j ≤ M-2 := by simp only [Finset.mem_range] at hj; omega have hp : z^j ≤ z^(M-2) := pow_le_pow_right₀ h1z hjle simp only [one_pow, mul_one] rw [mul_comm (z^(M-2))] exact mul_le_mul_of_nonneg_left hp (abs_nonneg _) calc gpos M z ≤ z^(M-2) * gpos M 1 := hgz _ ≤ z^(M-2) * (6:ℝ)^M := by gcongr _ ≤ (6:ℝ)^M * max 1 (z^(M-2)) := by have := le_max_right (1:ℝ) (z^(M-2)) nlinarith [pow_nonneg (show (0:ℝ) ≤ 6 by norm_num) M]
theorem env_arm_le

Establishes the stated upper bound for env arm le.

Formal statement
a :
Fin 2
v :
Cell → ℝ
hv :
∀ i, 0 ≤ v i
Proof (Lean source)
lemma env_arm_le (a : Fin 2) (v : Cell → ℝ) (hv : ∀ i, 0 ≤ v i) : coefficientEnvelope (mvArmMass a) v ≤ vectorArmMass v a := by unfold mvArmMass vectorArmMass calc coefficientEnvelope (X (a,0) + X (a,1)) v ≤ coefficientEnvelope (X (a,0)) v + coefficientEnvelope (X (a,1)) v := coefficientEnvelope_add_le _ _ _ hv _ = _ := by rw [env_X, env_X]
theorem env_mass_le

Establishes the stated upper bound for env mass le.

Formal statement
v :
Cell → ℝ
hv :
∀ i, 0 ≤ v i
Proof (Lean source)
lemma env_mass_le (v : Cell → ℝ) (hv : ∀ i, 0 ≤ v i) : coefficientEnvelope mvMass v ≤ vectorMass v := by unfold mvMass vectorMass calc coefficientEnvelope (mvArmMass 0 + mvArmMass 1) v ≤ coefficientEnvelope (mvArmMass 0) v + coefficientEnvelope (mvArmMass 1) v := coefficientEnvelope_add_le _ _ _ hv _ ≤ vectorArmMass v 0 + vectorArmMass v 1 := add_le_add (env_arm_le 0 v hv) (env_arm_le 1 v hv)
theorem env_evalG_le

Establishes the stated upper bound for env eval G le.

Formal statement
M :
B R :
hB :
0 < B
hR :
0 ≤ R
s :
v :
Cell → ℝ
hv :
∀ i, 0 ≤ v i
hs :
coefficientEnvelope (∑ j ∈ range (M-1), C (gCoefficient M j) * (C B⁻¹ * s)^j) v
gpos M (R/B)
Proof (Lean source)
lemma env_evalG_le {M : ℕ} {B R : ℝ} (hB : 0 < B) (hR : 0 ≤ R) (s : MvPolynomial Cell ℝ) (v : Cell → ℝ) (hv : ∀ i, 0 ≤ v i) (hs : coefficientEnvelope s v ≤ R) : coefficientEnvelope (∑ j ∈ range (M-1), C (gCoefficient M j) * (C B⁻¹ * s)^j) v ≤ gpos M (R/B) := by calc coefficientEnvelope (∑ j ∈ range (M-1), C (gCoefficient M j) * (C B⁻¹ * s)^j) v ≤ ∑ j ∈ range (M-1), coefficientEnvelope (C (gCoefficient M j) * (C B⁻¹ * s)^j) v := env_sum_le _ _ _ hv _ ≤ ∑ j ∈ range (M-1), |gCoefficient M j| * (R/B)^j := by apply Finset.sum_le_sum intro j hj calc coefficientEnvelope (C (gCoefficient M j) * (C B⁻¹ * s)^j) v ≤ coefficientEnvelope (C (gCoefficient M j)) v * coefficientEnvelope ((C B⁻¹ * s)^j) v := coefficientEnvelope_mul_le _ _ _ hv _ ≤ |gCoefficient M j| * coefficientEnvelope (C B⁻¹ * s) v ^ j := by rw [env_C] gcongr exact env_pow_le _ _ hv _ _ ≤ |gCoefficient M j| * (R/B)^j := by have hscaled : coefficientEnvelope (C B⁻¹ * s) v ≤ R/B := by calc coefficientEnvelope (C B⁻¹ * s) v ≤ coefficientEnvelope (C B⁻¹) v * coefficientEnvelope s v := coefficientEnvelope_mul_le _ _ _ hv _ = B⁻¹ * coefficientEnvelope s v := by rw [env_C, abs_of_pos (inv_pos.mpr hB)] _ ≤ B⁻¹ * R := by gcongr _ = R/B := by ring have hp := pow_le_pow_left₀ (env_nonneg (C B⁻¹ * s) v hv) hscaled j exact mul_le_mul_of_nonneg_left hp (abs_nonneg _) _ = gpos M (R/B) := rfl
theorem env_mul4_le

Establishes the stated upper bound for env mul4 le.

Formal statement
p q r s :
v :
Cell → ℝ
hv :
∀ i, 0 ≤ v i
Proof (Lean source)
lemma env_mul4_le (p q r s : MvPolynomial Cell ℝ) (v : Cell → ℝ) (hv : ∀ i, 0 ≤ v i) : coefficientEnvelope (p*q*r*s) v ≤ coefficientEnvelope p v * coefficientEnvelope q v * coefficientEnvelope r v * coefficientEnvelope s v := by calc coefficientEnvelope (p*q*r*s) v ≤ coefficientEnvelope (p*q*r) v * coefficientEnvelope s v := coefficientEnvelope_mul_le _ _ _ hv _ ≤ (coefficientEnvelope (p*q) v * coefficientEnvelope r v) * coefficientEnvelope s v := by exact mul_le_mul_of_nonneg_right (coefficientEnvelope_mul_le (p*q) r v hv) (env_nonneg s v hv) _ ≤ ((coefficientEnvelope p v * coefficientEnvelope q v) * coefficientEnvelope r v) * coefficientEnvelope s v := by exact mul_le_mul_of_nonneg_right (mul_le_mul_of_nonneg_right (coefficientEnvelope_mul_le p q v hv) (env_nonneg r v hv)) (env_nonneg s v hv)
theorem cellApproxPolynomial_coeff_envelope

The numerical absolute-coefficient certificate with base A=6.

Formal statement
M :
B :
hB :
0 < B
v :
Cell → ℝ
hv :
∀ i, 0 ≤ v i
∑ r ∈ (cellApproxPolynomial M B).support, |(cellApproxPolynomial M B).coeff r| * r.prod (fun i e => (v i) ^ e)
≤ B * 6 ^ M * max ((vectorMass v / B) ^ 2) ((vectorMass v / B) ^ M)
Proof (Lean source)
lemma cellApproxPolynomial_coeff_envelope (M : ℕ) {B : ℝ} (hB : 0 < B) (v : Cell → ℝ) (hv : ∀ i, 0 ≤ v i) : ∑ r ∈ (cellApproxPolynomial M B).support, |(cellApproxPolynomial M B).coeff r| * r.prod (fun i e => (v i) ^ e) ≤ B * 6 ^ M * max ((vectorMass v / B) ^ 2) ((vectorMass v / B) ^ M) := by change coefficientEnvelope (cellApproxPolynomial M B) v ≤ _ by_cases hsmall : M < 2 · interval_cases M · simp [cellApproxPolynomial, coefficientEnvelope, le_of_lt hB] · simp [cellApproxPolynomial, coefficientEnvelope] have hz0 : 0 ≤ vectorMass v / B := by apply div_nonneg · dsimp [vectorMass, vectorArmMass] linarith [hv (0,0), hv (0,1), hv (1,0), hv (1,1)] · exact le_of_lt hB positivity have hM2 : 2 ≤ M := Nat.le_of_not_gt hsmall have hM : 0 < M := by omega let R := vectorMass v let z := R/B let evalG (s : MvPolynomial Cell ℝ) := ∑ j ∈ range (M-1), C (gCoefficient M j) * (C B⁻¹ * s)^j have hR : 0 ≤ R := by dsimp [R, vectorMass, vectorArmMass] linarith [hv (0,0), hv (0,1), hv (1,0), hv (1,1)] have hz : 0 ≤ z := div_nonneg hR (le_of_lt hB) have hArm0 : coefficientEnvelope (mvArmMass 0) v ≤ R := (env_arm_le 0 v hv).trans (by dsimp [R, vectorMass] have hn : 0 ≤ vectorArmMass v 1 := by dsimp [vectorArmMass] linarith [hv (1,0), hv (1,1)] linarith) have hArm1 : coefficientEnvelope (mvArmMass 1) v ≤ R := (env_arm_le 1 v hv).trans (by dsimp [R, vectorMass] have hn : 0 ≤ vectorArmMass v 0 := by dsimp [vectorArmMass] linarith [hv (0,0), hv (0,1)] linarith) have hEval (a : Fin 2) : coefficientEnvelope (evalG (mvArmMass a)) v ≤ gpos M z := by apply env_evalG_le hB hR (mvArmMass a) v hv fin_cases a · simpa using hArm0 · simpa using hArm1 have hArm (a : Fin 2) : coefficientEnvelope (C B⁻¹ * mvMass * X (a,1) * evalG (mvArmMass a)) v ≤ B⁻¹ * R * v (a,1) * gpos M z := by calc coefficientEnvelope (C B⁻¹ * mvMass * X (a,1) * evalG (mvArmMass a)) v ≤ coefficientEnvelope (C B⁻¹) v * coefficientEnvelope mvMass v * coefficientEnvelope (X (a,1)) v * coefficientEnvelope (evalG (mvArmMass a)) v := env_mul4_le _ _ _ _ _ hv _ = B⁻¹ * coefficientEnvelope mvMass v * v (a,1) * coefficientEnvelope (evalG (mvArmMass a)) v := by rw [env_C, abs_of_pos (inv_pos.mpr hB), env_X] _ ≤ B⁻¹ * R * v (a,1) * gpos M z := by have hmass := env_mass_le v hv have he := hEval a have hgp := gpos_nonneg M hz have ht := hv (a,1) have hbi : 0 ≤ B⁻¹ := le_of_lt (inv_pos.mpr hB) have h1 : B⁻¹ * coefficientEnvelope mvMass v ≤ B⁻¹ * R := mul_le_mul_of_nonneg_left hmass hbi have h2 : B⁻¹ * coefficientEnvelope mvMass v * v (a,1) ≤ B⁻¹ * R * v (a,1) := mul_le_mul_of_nonneg_right h1 ht exact mul_le_mul h2 he (env_nonneg (evalG (mvArmMass a)) v hv) (by positivity) have hpoly : coefficientEnvelope (cellApproxPolynomial M B) v ≤ B⁻¹ * R^2 * gpos M z := by change coefficientEnvelope (C B⁻¹ * mvMass * X (1,1) * evalG (mvArmMass 1) - C B⁻¹ * mvMass * X (0,1) * evalG (mvArmMass 0)) v ≤ _ calc coefficientEnvelope (_ - _) v ≤ coefficientEnvelope (C B⁻¹ * mvMass * X (1,1) * evalG (mvArmMass 1)) v + coefficientEnvelope (C B⁻¹ * mvMass * X (0,1) * evalG (mvArmMass 0)) v := coefficientEnvelope_sub_le _ _ _ hv _ ≤ B⁻¹ * R * v (1,1) * gpos M z + B⁻¹ * R * v (0,1) * gpos M z := add_le_add (hArm 1) (hArm 0) _ ≤ B⁻¹ * R^2 * gpos M z := by have ht : v (1,1) + v (0,1) ≤ R := by dsimp [R, vectorMass, vectorArmMass] linarith [hv (0,0), hv (1,0)] have hgp := gpos_nonneg M hz have hbi : 0 ≤ B⁻¹ := le_of_lt (inv_pos.mpr hB) have hfac0 : 0 ≤ B⁻¹ * R * gpos M z := by positivity calc B⁻¹ * R * v (1,1) * gpos M z + B⁻¹ * R * v (0,1) * gpos M z = (B⁻¹ * R * gpos M z) * (v (1,1) + v (0,1)) := by ring _ ≤ (B⁻¹ * R * gpos M z) * R := mul_le_mul_of_nonneg_left ht hfac0 _ = B⁻¹ * R^2 * gpos M z := by ring have hg := gpos_bound hM hz calc coefficientEnvelope (cellApproxPolynomial M B) v ≤ B⁻¹ * R^2 * gpos M z := hpoly _ ≤ B⁻¹ * R^2 * ((6:ℝ)^M * max 1 (z^(M-2))) := by gcongr _ = B * 6^M * max (z^2) (z^M) := by have hzrel : R = B*z := by dsimp [z]; field_simp have hpow : z^2 * z^(M-2) = z^M := by rw [← pow_add] congr 1 omega rw [hzrel] have hBne : B ≠ 0 := ne_of_gt hB by_cases hh : (1:ℝ) ≤ z^(M-2) · rw [max_eq_right hh, max_eq_right] · rw [← hpow] field_simp · exact (show z^2 ≤ z^M by rw [← hpow]; nlinarith [pow_nonneg hz 2]) · have hh' : z^(M-2) ≤ 1 := le_of_not_ge hh rw [max_eq_left hh', max_eq_left] · field_simp · rw [← hpow] nlinarith [pow_nonneg hz 2] _ = B * 6 ^ M * max ((vectorMass v / B)^2) ((vectorMass v / B)^M) := rfl
CausalSmith.Stat.DiscreteAteMinimaxLoggap.cellApproxPolynomial_coeff_envelope · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/ChebyshevCertificate.lean:504
Helpers.CombinedEnvelope 2 declarations

Deterministic choice between the hybrid and centered estimators.

Definition (Lean source)
noncomputable def selectedEstimator (C epsilon : ℝ) {n d : ℕ} : (Fin n → Obs d) → ℝ := if C * minimaxRate n d ≤ 1 / (n : ℝ) + 4 * (1 / 2 - epsilon) ^ 2 then hybridEstimator else centeredEstimator
CausalSmith.Stat.DiscreteAteMinimaxLoggap.selectedEstimator · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/CombinedEnvelope.lean:7
theorem combined_upper_envelope Lemma 6 in the paper ↗

The deterministic smaller-bound selector attains the combined envelope.

Formal statement
epsilon C_epsilon rho_epsilon :
N_epsilon :
he0 :
0 < epsilon
he1 :
epsilon < 1 / 2
hC :
0 < C_epsilon
hrho :
0 < rho_epsilon
hHybrid :
∀ n d : ℕ
if
0 < n
and
N_epsilon ≤ n
and
(d : ℝ) ≤ rho_epsilon * n * log n
then
worstCaseMSE n d epsilon hybridEstimator ≤ C_epsilon * minimaxRate n d
∀ n d : ℕ
if
0 < n
and
N_epsilon ≤ n
and
(d : ℝ) ≤ rho_epsilon * n * log n
then
let K_epsilon := max C_epsilon 4 minimaxRisk n d epsilon
worstCaseMSE n d epsilon (selectedEstimator C_epsilon epsilon) ∧
worstCaseMSE n d epsilon (selectedEstimator C_epsilon epsilon)
≤ K_epsilon * (1 / (n : ℝ) + min (d ^ 2 / ((n : ℝ) ^ 2 * (log n) ^ 2)) ((1 / 2 - epsilon) ^ 2))
Proof (Lean source)
lemma combined_upper_envelope (epsilon C_epsilon rho_epsilon : ℝ) (N_epsilon : ℕ) (he0 : 0 < epsilon) (he1 : epsilon < 1 / 2) (hC : 0 < C_epsilon) (hrho : 0 < rho_epsilon) (hHybrid : ∀ n d : ℕ, 0 < n → N_epsilon ≤ n → (d : ℝ) ≤ rho_epsilon * n * log n → worstCaseMSE n d epsilon hybridEstimator ≤ C_epsilon * minimaxRate n d) : ∀ n d : ℕ, 0 < n → N_epsilon ≤ n → (d : ℝ) ≤ rho_epsilon * n * log n → let K_epsilon := max C_epsilon 4 minimaxRisk n d epsilon ≤ worstCaseMSE n d epsilon (selectedEstimator C_epsilon epsilon) ∧ worstCaseMSE n d epsilon (selectedEstimator C_epsilon epsilon) ≤ K_epsilon * (1 / (n : ℝ) + min (d ^ 2 / ((n : ℝ) ^ 2 * (log n) ^ 2)) ((1 / 2 - epsilon) ^ 2)) := by intro n d hn hnN hd let a : ℝ := 1 / (n : ℝ) let u : ℝ := d ^ 2 / ((n : ℝ) ^ 2 * (log n) ^ 2) let v : ℝ := (1 / 2 - epsilon) ^ 2 let K : ℝ := max C_epsilon 4 have hcentered : worstCaseMSE n d epsilon centeredEstimator ≤ a + 4 * v := by unfold worstCaseMSE cases isEmpty_or_nonempty (ClassLaw n d epsilon) with | inl hempty => letI := hempty simp positivity | inr hnonempty => letI := hnonempty apply ciSup_le intro P simpa [a, v] using near_randomization_linear_upper P.1 (productLaw P.1 n) P.2 hn have hselected : worstCaseMSE n d epsilon (selectedEstimator C_epsilon epsilon) ≤ min (C_epsilon * (a + u)) (a + 4 * v) := by rw [selectedEstimator] split_ifs with hchoice · rw [min_eq_left] · simpa [a, u, minimaxRate] using hHybrid n d hn hnN hd · simpa [a, u, v, minimaxRate] using hchoice · rw [min_eq_right] · exact hcentered · exact le_of_not_ge hchoice have hminimax : minimaxRisk n d epsilon ≤ worstCaseMSE n d epsilon (selectedEstimator C_epsilon epsilon) := by have hmeas : Measurable (@selectedEstimator C_epsilon epsilon n d) := measurable_of_finite _ have hb : BddBelow (range (fun est : {f : (Fin n → Obs d) → ℝ // Measurable f} => worstCaseMSE n d epsilon est.1)) := by refine ⟨0, ?_⟩ rintro _ ⟨est, rfl⟩ unfold worstCaseMSE cases isEmpty_or_nonempty (ClassLaw n d epsilon) with | inl hempty => letI := hempty simp | inr hnonempty => letI := hnonempty by_cases hbounded : BddAbove (range (fun P : ClassLaw n d epsilon => mse (productLaw P.1 n) est (ateFunctional P.1))) · have hmse : 0 ≤ mse (productLaw (Classical.arbitrary (ClassLaw n d epsilon)).1 n) est (ateFunctional (Classical.arbitrary (ClassLaw n d epsilon)).1) := by unfold mse exact integral_nonneg (fun x => sq_nonneg (est.1 x - ateFunctional (Classical.arbitrary (ClassLaw n d epsilon)).1)) exact hmse.trans (le_ciSup hbounded (Classical.arbitrary _)) · change 0 ≤ (⨆ P : ClassLaw n d epsilon, mse (productLaw P.1 n) est (ateFunctional P.1)) rw [show (⨆ P : ClassLaw n d epsilon, mse (productLaw P.1 n) est (ateFunctional P.1)) = sSup ∅ from csSup_of_not_bddAbove hbounded] simp exact ciInf_le hb (⟨selectedEstimator C_epsilon epsilon, hmeas⟩ : {f : (Fin n → Obs d) → ℝ // Measurable f}) refine ⟨hminimax, hselected.trans ?_⟩ have hC_le_K : C_epsilon ≤ K := le_max_left _ _ have h4_le_K : 4 ≤ K := le_max_right _ _ have ha : 0 ≤ a := by dsimp [a] positivity have hu : 0 ≤ u := by dsimp [u] positivity have hv : 0 ≤ v := sq_nonneg _ have hfirst : C_epsilon * (a + u) ≤ K * (a + u) := by exact mul_le_mul_of_nonneg_right hC_le_K (add_nonneg ha hu) have hsecond : a + 4 * v ≤ K * (a + v) := by calc a + 4 * v ≤ K * a + K * v := add_le_add (by nlinarith [h4_le_K]) (mul_le_mul_of_nonneg_right h4_le_K hv) _ = K * (a + v) := by ring by_cases huv : u ≤ v · rw [min_eq_left huv] change min (C_epsilon * (a + u)) (a + 4 * v) ≤ K * (a + u) exact (min_le_left _ _).trans hfirst · rw [min_eq_right (le_of_not_ge huv)] change min (C_epsilon * (a + u)) (a + 4 * v) ≤ K * (a + v) exact (min_le_right _ _).trans hsecond
CausalSmith.Stat.DiscreteAteMinimaxLoggap.combined_upper_envelope · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/CombinedEnvelope.lean:15
Helpers.Endpoint 24 declarations
def centeredUnitScore

The bounded one-observation score averaged by centeredEstimator.

Definition (Lean source)
-- @node: centeredUnitScore noncomputable def centeredUnitScore {d : ℕ} (z : Obs d) : ℝ := 2 * (if z.2.1 then 1 else -1) * ((if z.2.2 then 1 else 0) - 1 / 2)
CausalSmith.Stat.DiscreteAteMinimaxLoggap.centeredUnitScore · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/Endpoint.lean:16
theorem centeredUnitScore_sq

The bounded one-observation score used by the centering estimator always squares to one: it takes only the two values plus one and minus one.

Formal statement
d :
z :
Obs d
Proof (Lean source)
lemma centeredUnitScore_sq {d : ℕ} (z : Obs d) : centeredUnitScore z ^ 2 = 1 := by rcases z with ⟨k, a, y⟩ cases a <;> cases y <;> norm_num [centeredUnitScore] all_goals exact inl rfl
CausalSmith.Stat.DiscreteAteMinimaxLoggap.centeredUnitScore_sq · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/Endpoint.lean:22
theorem centeredEstimator_eq_scoreMean

The centering estimator is exactly the sample average of the bounded one-observation score.

Formal statement
n d :
sample :
Fin n → Obs d
centeredEstimator sample = (n : ℝ)⁻¹ * ∑ i : Fin n, centeredUnitScore (sample i)
Proof (Lean source)
lemma centeredEstimator_eq_scoreMean {n d : ℕ} (sample : Fin n → Obs d) : centeredEstimator sample = (n : ℝ)⁻¹ * ∑ i : Fin n, centeredUnitScore (sample i) := by rfl
CausalSmith.Stat.DiscreteAteMinimaxLoggap.centeredEstimator_eq_scoreMean · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/Endpoint.lean:30
theorem centeredUnitScore_mean

Establishes the stated property of centered Unit Score mean in the discrete average-treatment-effect construction.

Formal statement
d :
P :
∫ z, centeredUnitScore z ∂obsLaw P
Proof (Lean source)
lemma centeredUnitScore_mean {d : ℕ} (P : DiscreteLaw d) : ∫ z, centeredUnitScore z ∂obsLaw P = ∑ k : Fin d, (jointMass P k true true - jointMass P k true false + jointMass P k false false - jointMass P k false true) := by classical rw [show obsLaw P = P.pmf.toMeasure by rfl, PMF.integral_eq_sum] simp [Fintype.sum_prod_type, centeredUnitScore, jointMass] rw [← Finset.sum_sub_distrib] apply Finset.sum_congr rfl intro k hk ring
CausalSmith.Stat.DiscreteAteMinimaxLoggap.centeredUnitScore_mean · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/Endpoint.lean:37
theorem centeredScore_category_identity

Exact conditional-bias identity on a positive-mass category.

Formal statement
d :
epsilon :
P :
hOverlap :
Overlap epsilon P
hepsilon :
0 < epsilon
k :
Fin d
hk :
0 < cellMass P k
= cellMass P k * (outcomeMean P true k - outcomeMean P false k)
+ 2 * (propensity P k - 1 / 2) * cellMass P k * (outcomeMean P true k + outcomeMean P false k - 1)
Proof (Lean source)
-- @node: centeredScore_category_identity lemma centeredScore_category_identity {d : ℕ} {epsilon : ℝ} (P : DiscreteLaw d) (hOverlap : Overlap epsilon P) (hepsilon : 0 < epsilon) (k : Fin d) (hk : 0 < cellMass P k) : jointMass P k true true - jointMass P k true false + jointMass P k false false - jointMass P k false true = cellMass P k * (outcomeMean P true k - outcomeMean P false k) + 2 * (propensity P k - 1 / 2) * cellMass P k * (outcomeMean P true k + outcomeMean P false k - 1) := by have hpi := hOverlap k hk have hmass_ne : cellMass P k ≠ 0 := ne_of_gt hk have harm_one : armMass P k true = propensity P k * cellMass P k := by rw [propensity] field_simp have hmass : cellMass P k = armMass P k false + armMass P k true := by simp [cellMass, armMass] ring have hprop_pos : 0 < propensity P k := lt_of_lt_of_le hepsilon hpi.1 have hprop_lt : propensity P k < 1 := by linarith have harm_one_pos : 0 < armMass P k true := by rw [harm_one]; exact mul_pos hprop_pos hk have harm_zero : armMass P k false = (1 - propensity P k) * cellMass P k := by rw [harm_one] at hmass linarith have harm_zero_pos : 0 < armMass P k false := by rw [harm_zero] exact mul_pos (sub_pos.mpr hprop_lt) hk have hy_one : jointMass P k true true = outcomeMean P true k * armMass P k true := by rw [outcomeMean] field_simp have hy_zero : jointMass P k false true = outcomeMean P false k * armMass P k false := by rw [outcomeMean] field_simp have harm_one_sum : armMass P k true = jointMass P k true false + jointMass P k true true := by simp [armMass] ring have harm_zero_sum : armMass P k false = jointMass P k false false + jointMass P k false true := by simp [armMass] ring rw [harm_one] at harm_one_sum hy_one rw [harm_zero] at harm_zero_sum hy_zero nlinarith
CausalSmith.Stat.DiscreteAteMinimaxLoggap.centeredScore_category_identity · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/Endpoint.lean:51
theorem jointMass_eq_zero_of_cellMass_eq_zero

Establishes the stated equality relating joint Mass eq zero of cell Mass eq zero.

Formal statement
d :
P :
k :
Fin d
hk :
cellMass P k = 0
a y :
jointMass P k a y = 0
Proof (Lean source)
lemma jointMass_eq_zero_of_cellMass_eq_zero {d : ℕ} (P : DiscreteLaw d) (k : Fin d) (hk : cellMass P k = 0) (a y : Bool) : jointMass P k a y = 0 := by have h00 := (jointMass_mem_unitInterval P k false false).1 have h01 := (jointMass_mem_unitInterval P k false true).1 have h10 := (jointMass_mem_unitInterval P k true false).1 have h11 := (jointMass_mem_unitInterval P k true true).1 simp [cellMass] at hk cases a <;> cases y <;> nlinarith
CausalSmith.Stat.DiscreteAteMinimaxLoggap.jointMass_eq_zero_of_cellMass_eq_zero · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/Endpoint.lean:99
theorem cellMass_sum

Establishes the stated summation identity or bound for cell Mass sum.

Formal statement
d :
P :
∑ k : Fin d, cellMass P k = 1
Proof (Lean source)
lemma cellMass_sum {d : ℕ} (P : DiscreteLaw d) : ∑ k : Fin d, cellMass P k = 1 := by classical have htotal : ∑ z : Obs d, (P.pmf z).toReal = 1 := by simpa using (PMF.integral_eq_sum P.pmf (fun _ : Obs d => (1 : ℝ))).symm calc ∑ k : Fin d, cellMass P k = ∑ z : Obs d, (P.pmf z).toReal := by simp [cellMass, jointMass, Fintype.sum_prod_type] _ = 1 := htotal
CausalSmith.Stat.DiscreteAteMinimaxLoggap.cellMass_sum · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/Endpoint.lean:110
theorem centeredUnitScore_bias_identity

Establishes the stated property of centered Unit Score bias identity in the discrete average-treatment-effect construction.

Formal statement
d :
epsilon :
P :
hOverlap :
Overlap epsilon P
hepsilon :
0 < epsilon
(∫ z, centeredUnitScore z ∂obsLaw P) - ateFunctional P
= ∑ k : Fin d, 2 * (propensity P k - 1 / 2) * cellMass P k * (outcomeMean P true k + outcomeMean P false k - 1)
Proof (Lean source)
lemma centeredUnitScore_bias_identity {d : ℕ} {epsilon : ℝ} (P : DiscreteLaw d) (hOverlap : Overlap epsilon P) (hepsilon : 0 < epsilon) : (∫ z, centeredUnitScore z ∂obsLaw P) - ateFunctional P = ∑ k : Fin d, 2 * (propensity P k - 1 / 2) * cellMass P k * (outcomeMean P true k + outcomeMean P false k - 1) := by rw [centeredUnitScore_mean P, ateFunctional_eq_weighted_regression P hOverlap, ← Finset.sum_sub_distrib] apply Finset.sum_congr rfl intro k hk by_cases hpk : 0 < cellMass P k · rw [centeredScore_category_identity P hOverlap hepsilon k hpk] ring · have hpk0 : cellMass P k = 0 := by have := (cellMass_mem_unitInterval P k).1 linarith have h00 := jointMass_eq_zero_of_cellMass_eq_zero P k hpk0 false false have h01 := jointMass_eq_zero_of_cellMass_eq_zero P k hpk0 false true have h10 := jointMass_eq_zero_of_cellMass_eq_zero P k hpk0 true false have h11 := jointMass_eq_zero_of_cellMass_eq_zero P k hpk0 true true simp [hpk0, h00, h01, h10, h11]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.centeredUnitScore_bias_identity · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/Endpoint.lean:121
theorem centeredUnitScore_bias_bound

Establishes the stated upper bound for centered Unit Score bias bound.

Formal statement
d :
epsilon :
P :
hOverlap :
Overlap epsilon P
hepsilon :
0 < epsilon
hepsilon_half :
epsilon ≤ 1 / 2
|(∫ z, centeredUnitScore z ∂obsLaw P) - ateFunctional P| ≤ 2 * (1 / 2 - epsilon)
Proof (Lean source)
lemma centeredUnitScore_bias_bound {d : ℕ} {epsilon : ℝ} (P : DiscreteLaw d) (hOverlap : Overlap epsilon P) (hepsilon : 0 < epsilon) (hepsilon_half : epsilon ≤ 1 / 2) : |(∫ z, centeredUnitScore z ∂obsLaw P) - ateFunctional P| ≤ 2 * (1 / 2 - epsilon) := by rw [centeredUnitScore_bias_identity P hOverlap hepsilon] calc |∑ k : Fin d, 2 * (propensity P k - 1 / 2) * cellMass P k * (outcomeMean P true k + outcomeMean P false k - 1)| ≤ ∑ k : Fin d, |2 * (propensity P k - 1 / 2) * cellMass P k * (outcomeMean P true k + outcomeMean P false k - 1)| := Finset.abs_sum_le_sum_abs _ _ _ ≤ ∑ k : Fin d, 2 * (1 / 2 - epsilon) * cellMass P k := by apply Finset.sum_le_sum intro k hk by_cases hpk : 0 < cellMass P k · have hpi := hOverlap k hpk have hpabs : |propensity P k - 1 / 2| ≤ 1 / 2 - epsilon := by rw [abs_le] constructor <;> linarith have hm1 := outcomeMean_mem_unitInterval P true k have hm0 := outcomeMean_mem_unitInterval P false k rcases hm1 with ⟨hm1lo, hm1hi⟩ rcases hm0 with ⟨hm0lo, hm0hi⟩ have hmabs : |outcomeMean P true k + outcomeMean P false k - 1| ≤ 1 := by rw [abs_le] constructor <;> linarith rw [abs_mul, abs_mul, abs_mul, abs_of_nonneg (by norm_num : (0 : ℝ) ≤ 2), abs_of_nonneg (le_of_lt hpk)] calc 2 * |propensity P k - 1 / 2| * cellMass P k * |outcomeMean P true k + outcomeMean P false k - 1| ≤ 2 * (1 / 2 - epsilon) * cellMass P k * |outcomeMean P true k + outcomeMean P false k - 1| := by gcongr _ ≤ 2 * (1 / 2 - epsilon) * cellMass P k * 1 := by apply mul_le_mul_of_nonneg_left hmabs exact mul_nonneg (mul_nonneg (by norm_num) (sub_nonneg.mpr hepsilon_half)) (le_of_lt hpk) _ = 2 * (1 / 2 - epsilon) * cellMass P k := by ring · have hpk0 : cellMass P k = 0 := by have := (cellMass_mem_unitInterval P k).1 linarith simp [hpk0] _ = 2 * (1 / 2 - epsilon) := by rw [← Finset.mul_sum, cellMass_sum P] ring
CausalSmith.Stat.DiscreteAteMinimaxLoggap.centeredUnitScore_bias_bound · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/Endpoint.lean:144
theorem centeredEstimator_mean

Establishes the stated property of centered Estimator mean in the discrete average-treatment-effect construction.

Formal statement
n d :
P :
hn :
0 < n
∫ sample, centeredEstimator sample ∂productLaw P n = ∫ z, centeredUnitScore z ∂obsLaw P
Proof (Lean source)
lemma centeredEstimator_mean {n d : ℕ} (P : DiscreteLaw d) (hn : 0 < n) : ∫ sample, centeredEstimator sample ∂productLaw P n = ∫ z, centeredUnitScore z ∂obsLaw P := by rw [show productLaw P n = Measure.pi (fun _ : Fin n => obsLaw P) by rfl] simp_rw [centeredEstimator_eq_scoreMean] exact iid_average_integral (obsLaw P) n hn centeredUnitScore .of_finite
CausalSmith.Stat.DiscreteAteMinimaxLoggap.centeredEstimator_mean · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/Endpoint.lean:194
theorem centeredUnitScore_variance_le_one

Establishes the stated upper bound for centered Unit Score variance le one.

Formal statement
d :
P :
variance (fun z => centeredUnitScore z) (obsLaw P) ≤ 1
Proof (Lean source)
lemma centeredUnitScore_variance_le_one {d : ℕ} (P : DiscreteLaw d) : variance (fun z => centeredUnitScore z) (obsLaw P) ≤ 1 := by rw [variance_eq_sub (MemLp.of_discrete : MemLp centeredUnitScore 2 (obsLaw P))] have hsquare : ∫ z, ((fun z => centeredUnitScore z) ^ 2) z ∂obsLaw P = 1 := by change ∫ z, centeredUnitScore z ^ 2 ∂obsLaw P = 1 simp_rw [centeredUnitScore_sq] simp rw [hsquare] nlinarith [sq_nonneg (∫ z, centeredUnitScore z ∂obsLaw P)]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.centeredUnitScore_variance_le_one · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/Endpoint.lean:204
theorem centeredEstimator_variance_le

Establishes the stated upper bound for centered Estimator variance le.

Formal statement
n d :
P :
hn :
0 < n
variance (fun sample => centeredEstimator sample) (productLaw P n) ≤ 1 / (n : ℝ)
Proof (Lean source)
lemma centeredEstimator_variance_le {n d : ℕ} (P : DiscreteLaw d) (hn : 0 < n) : variance (fun sample => centeredEstimator sample) (productLaw P n) ≤ 1 / (n : ℝ) := by rw [show productLaw P n = Measure.pi (fun _ : Fin n => obsLaw P) by rfl] simp_rw [centeredEstimator_eq_scoreMean] rw [iid_average_variance (obsLaw P) n centeredUnitScore MemLp.of_discrete] calc (n : ℝ)⁻¹ * variance centeredUnitScore (obsLaw P) ≤ (n : ℝ)⁻¹ * 1 := mul_le_mul_of_nonneg_left (centeredUnitScore_variance_le_one P) (by positivity) _ = 1 / (n : ℝ) := by rw [mul_one, one_div]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.centeredEstimator_variance_le · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/Endpoint.lean:216
theorem mse_eq_variance_add_sq_bias

Establishes the stated equality relating mse eq variance add sq bias.

Formal statement
n d :
mu :
est :
(Fin n → Obs d) → ℝ
target :
mse mu est target = variance est mu + ((∫ x, est x ∂mu) - target) ^ 2
Proof (Lean source)
lemma mse_eq_variance_add_sq_bias {n d : ℕ} (mu : Measure (Fin n → Obs d)) [IsProbabilityMeasure mu] (est : (Fin n → Obs d) → ℝ) (target : ℝ) : mse mu est target = variance est mu + ((∫ x, est x ∂mu) - target) ^ 2 := by have hest : MemLp est 2 mu := MemLp.of_discrete unfold mse have hsq : Integrable (fun x => est x ^ 2) mu := hest.integrable_sq have hint : Integrable est mu := hest.integrable one_le_two have hlinear : Integrable (fun x => 2 * target * est x) mu := hint.const_mul _ have hpow : (∫ x, (est ^ 2) x ∂mu) = ∫ x, est x ^ 2 ∂mu := by rfl rw [variance_eq_sub hest] calc ∫ x, (est x - target) ^ 2 ∂mu = ∫ x, (est x ^ 2 - 2 * target * est x) + target ^ 2 ∂mu := by apply integral_congr_ae filter_upwards with x ring _ = (∫ x, est x ^ 2 - 2 * target * est x ∂mu) + (∫ _x, target ^ 2 ∂mu) := integral_add (hsq.sub hlinear) (integrable_const _) _ = (∫ x, est x ^ 2 ∂mu) - (∫ x, 2 * target * est x ∂mu) + target ^ 2 := by rw [integral_sub hsq hlinear, integral_const, probReal_univ, one_smul] _ = (∫ x, est x ^ 2 ∂mu) - 2 * target * (∫ x, est x ∂mu) + target ^ 2 := by rw [integral_const_mul] _ = (∫ x, (est ^ 2) x ∂mu) - (∫ x, est x ∂mu) ^ 2 + ((∫ x, est x ∂mu) - target) ^ 2 := by rw [hpow] ring
CausalSmith.Stat.DiscreteAteMinimaxLoggap.mse_eq_variance_add_sq_bias · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/Endpoint.lean:231
theorem near_randomization_linear_upper Lemma 3 in the paper ↗

All-n,d MSE bound for the centered estimator.

Formal statement
n d :
epsilon :
P :
mu_n :
Measure (Fin n → Obs d)
hClass :
ExperimentClass n epsilon P mu_n
hn :
0 < n
mse mu_n centeredEstimator (ateFunctional P) ≤ 1 / (n : ℝ) + 4 * (1 / 2 - epsilon) ^ 2
Proof (Lean source)
lemma near_randomization_linear_upper {n d : ℕ} {epsilon : ℝ} (P : DiscreteLaw d) (mu_n : Measure (Fin n → Obs d)) (hClass : ExperimentClass n epsilon P mu_n) (hn : 0 < n) : mse mu_n centeredEstimator (ateFunctional P) ≤ 1 / (n : ℝ) + 4 * (1 / 2 - epsilon) ^ 2 := by rw [hClass.product_law] rw [mse_eq_variance_add_sq_bias] have hb := centeredUnitScore_bias_bound P hClass.overlap hClass.epsilon_pos hClass.epsilon_le_half rw [← centeredEstimator_mean P hn] at hb have hbnonneg : 0 ≤ 2 * (1 / 2 - epsilon) := by linarith [hClass.epsilon_le_half] have hb' : ((∫ sample, centeredEstimator sample ∂productLaw P n) - ateFunctional P) ^ 2 ≤ (2 * (1 / 2 - epsilon)) ^ 2 := by rw [abs_le] at hb nlinarith [sq_nonneg ((2 * (1 / 2 - epsilon)) - ((∫ sample, centeredEstimator sample ∂productLaw P n) - ateFunctional P)), sq_nonneg ((2 * (1 / 2 - epsilon)) + ((∫ sample, centeredEstimator sample ∂productLaw P n) - ateFunctional P))] calc variance (fun sample => centeredEstimator sample) (productLaw P n) + ((∫ sample, centeredEstimator sample ∂productLaw P n) - ateFunctional P) ^ 2 ≤ 1 / (n : ℝ) + (2 * (1 / 2 - epsilon)) ^ 2 := add_le_add (centeredEstimator_variance_le P hn) hb' _ = 1 / (n : ℝ) + 4 * (1 / 2 - epsilon) ^ 2 := by ring
CausalSmith.Stat.DiscreteAteMinimaxLoggap.near_randomization_linear_upper · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/Endpoint.lean:262
def endpointParametricLaw

Defines endpoint Parametric Law, the stated quantity or construction used in the discrete average-treatment-effect estimator.

Definition (Lean source)
noncomputable def endpointParametricLaw {d : ℕ} [Nonempty (Fin d)] {m g : ℝ} (hv : ValidDGP (mC (C := Fin d) m) (gNull (C := Fin d) g g)) : DiscreteLaw d := ⟨Causalean.Estimation.MinimaxATE.obsPMF hv⟩
CausalSmith.Stat.DiscreteAteMinimaxLoggap.endpointParametricLaw · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/Endpoint.lean:292
def endpointParametricPertLaw

Defines endpoint Parametric Pert Law, the stated quantity or construction used in the discrete average-treatment-effect estimator.

Definition (Lean source)
noncomputable def endpointParametricPertLaw {d : ℕ} [Nonempty (Fin d)] {m g delta : ℝ} (hv : ValidDGP (mC (C := Fin d) m) (gPert (C := Fin d) g g delta)) : DiscreteLaw d := ⟨Causalean.Estimation.MinimaxATE.obsPMF hv⟩
CausalSmith.Stat.DiscreteAteMinimaxLoggap.endpointParametricPertLaw · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/Endpoint.lean:300
theorem endpointParametricLaw_jointMass

Establishes the stated property of endpoint Parametric Law joint Mass in the discrete average-treatment-effect construction.

Formal statement
d :
Nonempty (Fin d)
m g :
hv :
ValidDGP (mC (C := Fin d) m) (gNull (C := Fin d) g g)
k :
Fin d
a y :
= obsReal (mC (C := Fin d) m) (gNull (C := Fin d) g g) (k, a, y)
Proof (Lean source)
lemma endpointParametricLaw_jointMass {d : ℕ} [Nonempty (Fin d)] {m g : ℝ} (hv : ValidDGP (mC (C := Fin d) m) (gNull (C := Fin d) g g)) (k : Fin d) (a y : Bool) : jointMass (endpointParametricLaw hv) k a y = obsReal (mC (C := Fin d) m) (gNull (C := Fin d) g g) (k, a, y) := by simp [jointMass, endpointParametricLaw, obsPMF, ENNReal.toReal_ofReal (obsReal_nonneg hv (k, a, y))]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.endpointParametricLaw_jointMass · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/Endpoint.lean:308
theorem endpointParametricPertLaw_jointMass

Establishes the stated property of endpoint Parametric Pert Law joint Mass in the discrete average-treatment-effect construction.

Formal statement
d :
Nonempty (Fin d)
m g delta :
hv :
ValidDGP (mC (C := Fin d) m) (gPert (C := Fin d) g g delta)
k :
Fin d
a y :
= obsReal (mC (C := Fin d) m) (gPert (C := Fin d) g g delta) (k, a, y)
Proof (Lean source)
lemma endpointParametricPertLaw_jointMass {d : ℕ} [Nonempty (Fin d)] {m g delta : ℝ} (hv : ValidDGP (mC (C := Fin d) m) (gPert (C := Fin d) g g delta)) (k : Fin d) (a y : Bool) : jointMass (endpointParametricPertLaw hv) k a y = obsReal (mC (C := Fin d) m) (gPert (C := Fin d) g g delta) (k, a, y) := by simp [jointMass, endpointParametricPertLaw, obsPMF, ENNReal.toReal_ofReal (obsReal_nonneg hv (k, a, y))]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.endpointParametricPertLaw_jointMass · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/Endpoint.lean:324
theorem endpointParametricLaw_overlap

Establishes the stated property of endpoint Parametric Law overlap in the discrete average-treatment-effect construction.

Formal statement
d :
Nonempty (Fin d)
g :
hv :
ValidDGP (mC (C := Fin d) (1 / 2)) (gNull (C := Fin d) g g)
Overlap (1 / 2) (endpointParametricLaw (d := d) hv)
Proof (Lean source)
lemma endpointParametricLaw_overlap {d : ℕ} [Nonempty (Fin d)] {g : ℝ} (hv : ValidDGP (mC (C := Fin d) (1 / 2)) (gNull (C := Fin d) g g)) : Overlap (1 / 2) (endpointParametricLaw (d := d) hv) := by intro k hk have hcard : (card (Fin d) : ℝ) ≠ 0 := Nat.cast_ne_zero.mpr Fintype.card_ne_zero have hdcast : (d : ℝ) ≠ 0 := by simpa using hcard have hmass : cellMass (endpointParametricLaw hv) k = (card (Fin d) : ℝ)⁻¹ := by simp [cellMass, endpointParametricLaw_jointMass, obsReal, mC, gNull] ring have harm : armMass (endpointParametricLaw hv) k true = (1 / 2) * (card (Fin d) : ℝ)⁻¹ := by simp [armMass, endpointParametricLaw_jointMass, obsReal, mC, gNull] ring rw [propensity, hmass, harm] field_simp norm_num
CausalSmith.Stat.DiscreteAteMinimaxLoggap.endpointParametricLaw_overlap · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/Endpoint.lean:340
theorem endpointParametricPertLaw_overlap

Establishes the stated property of endpoint Parametric Pert Law overlap in the discrete average-treatment-effect construction.

Formal statement
d :
Nonempty (Fin d)
g delta :
hv :
ValidDGP (mC (C := Fin d) (1 / 2)) (gPert (C := Fin d) g g delta)
Overlap (1 / 2) (endpointParametricPertLaw (d := d) hv)
Proof (Lean source)
lemma endpointParametricPertLaw_overlap {d : ℕ} [Nonempty (Fin d)] {g delta : ℝ} (hv : ValidDGP (mC (C := Fin d) (1 / 2)) (gPert (C := Fin d) g g delta)) : Overlap (1 / 2) (endpointParametricPertLaw (d := d) hv) := by intro k hk have hcard : (card (Fin d) : ℝ) ≠ 0 := Nat.cast_ne_zero.mpr Fintype.card_ne_zero have hmass : cellMass (endpointParametricPertLaw hv) k = (card (Fin d) : ℝ)⁻¹ := by simp [cellMass, endpointParametricPertLaw_jointMass, obsReal, mC, gPert] ring have harm : armMass (endpointParametricPertLaw hv) k true = (1 / 2) * (card (Fin d) : ℝ)⁻¹ := by simp [armMass, endpointParametricPertLaw_jointMass, obsReal, mC, gPert] ring rw [propensity, hmass, harm] field_simp norm_num
CausalSmith.Stat.DiscreteAteMinimaxLoggap.endpointParametricPertLaw_overlap · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/Endpoint.lean:369
theorem endpointParametricLaw_ate

Establishes the stated property of endpoint Parametric Law ate in the discrete average-treatment-effect construction.

Formal statement
d :
Nonempty (Fin d)
g :
hv :
ValidDGP (mC (C := Fin d) (1 / 2)) (gNull (C := Fin d) g g)
Proof (Lean source)
lemma endpointParametricLaw_ate {d : ℕ} [Nonempty (Fin d)] {g : ℝ} (hv : ValidDGP (mC (C := Fin d) (1 / 2)) (gNull (C := Fin d) g g)) : ateFunctional (endpointParametricLaw (d := d) hv) = 0 := by rw [ateFunctional_eq_weighted_regression _ (endpointParametricLaw_overlap hv)] apply Finset.sum_eq_zero intro k hk have hcard : (card (Fin d) : ℝ) ≠ 0 := Nat.cast_ne_zero.mpr Fintype.card_ne_zero have hdcast : (d : ℝ) ≠ 0 := by simpa using hcard have hmean (a : Bool) : outcomeMean (endpointParametricLaw hv) a k = g := by cases a <;> simp [outcomeMean, armMass, endpointParametricLaw_jointMass, obsReal, mC, gNull] <;> field_simp [hcard, hdcast] <;> ring rw [hmean true, hmean false, sub_self, mul_zero]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.endpointParametricLaw_ate · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/Endpoint.lean:397
theorem endpointParametricPertLaw_ate

Establishes the stated property of endpoint Parametric Pert Law ate in the discrete average-treatment-effect construction.

Formal statement
d :
Nonempty (Fin d)
g delta :
hv :
ValidDGP (mC (C := Fin d) (1 / 2)) (gPert (C := Fin d) g g delta)
Proof (Lean source)
lemma endpointParametricPertLaw_ate {d : ℕ} [Nonempty (Fin d)] {g delta : ℝ} (hv : ValidDGP (mC (C := Fin d) (1 / 2)) (gPert (C := Fin d) g g delta)) : ateFunctional (endpointParametricPertLaw (d := d) hv) = delta := by rw [ateFunctional_eq_weighted_regression _ (endpointParametricPertLaw_overlap hv)] have hcard : (card (Fin d) : ℝ) ≠ 0 := Nat.cast_ne_zero.mpr Fintype.card_ne_zero have hdcast : (d : ℝ) ≠ 0 := by simpa using hcard have hmean (a : Bool) (k : Fin d) : outcomeMean (endpointParametricPertLaw hv) a k = if a then g + delta else g := by cases a <;> simp [outcomeMean, armMass, endpointParametricPertLaw_jointMass, obsReal, mC, gPert] <;> field_simp [hcard, hdcast] <;> ring simp_rw [hmean true, hmean false] have hsum := cellMass_sum (endpointParametricPertLaw (d := d) hv) calc ∑ x, cellMass (endpointParametricPertLaw hv) x * ((if true then g + delta else g) - if false then g + delta else g) = ∑ x, cellMass (endpointParametricPertLaw hv) x * delta := by apply Finset.sum_congr rfl intro k hk simp _ = (∑ x, cellMass (endpointParametricPertLaw hv) x) * delta := by rw [Finset.sum_mul] _ = delta := by rw [hsum]; ring
CausalSmith.Stat.DiscreteAteMinimaxLoggap.endpointParametricPertLaw_ate · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/Endpoint.lean:419
theorem one_category_bernoulli_lower Lemma 4 in the paper ↗

Explicit one-category Bernoulli two-point lower bound at randomization.

Formal statement
n d :
hn :
0 < n
hd :
0 < d
1 / (100 * (n : ℝ)) ≤ minimaxRisk n d (1 / 2)
Proof (Lean source)
lemma one_category_bernoulli_lower (n d : ℕ) (hn : 0 < n) (hd : 0 < d) : -- @realizes d(positive alphabet size for the one-category witness) 1 / (100 * (n : ℝ)) ≤ minimaxRisk n d (1 / 2) := by letI : Nonempty (Fin d) := Fin.pos_iff_nonempty.mp hd let delta : ℝ := (2 / 5) / Real.sqrt n have hnR : (0 : ℝ) < n := by exact_mod_cast hn have hsqrt : 0 < Real.sqrt (n : ℝ) := Real.sqrt_pos.2 hnR have hdelta0 : 0 ≤ delta := by dsimp [delta]; positivity have hdeltasq : delta ^ 2 = 4 / (25 * (n : ℝ)) := by dsimp [delta] rw [div_pow, Real.sq_sqrt (le_of_lt hnR)] ring let hv0 := validDGP_null (C := Fin d) (m₀ := (1 / 2 : ℝ)) (g₀ := (1 / 2 : ℝ)) (g₁ := (1 / 2 : ℝ)) (by norm_num) (by norm_num) (by norm_num) (by norm_num) (by norm_num) (by norm_num) have hdeltaU : (1 / 2 : ℝ) + delta ≤ 1 := by have hsqrt_one : 1 ≤ Real.sqrt (n : ℝ) := by rw [← Real.sqrt_one] exact Real.sqrt_le_sqrt (by exact_mod_cast hn) have hdelta : delta ≤ 2 / 5 := by dsimp [delta] exact div_le_self (by norm_num) hsqrt_one linarith let hv1 := validDGP_pert (C := Fin d) (m₀ := (1 / 2 : ℝ)) (g₀ := (1 / 2 : ℝ)) (g₁ := (1 / 2 : ℝ)) (δ := delta) (by norm_num) (by norm_num) (by norm_num) (by norm_num) (by norm_num) hdelta0 hdeltaU let P0 : DiscreteLaw d := endpointParametricLaw hv0 let P1 : DiscreteLaw d := endpointParametricPertLaw hv1 have hclass0 : ExperimentClass n (1 / 2) P0 (productLaw P0 n) := by refine ⟨by norm_num, by norm_num, rfl, ?_⟩ exact endpointParametricLaw_overlap hv0 have hclass1 : ExperimentClass n (1 / 2) P1 (productLaw P1 n) := by refine ⟨by norm_num, by norm_num, rfl, ?_⟩ exact endpointParametricPertLaw_overlap hv1 have htau0 : ateFunctional P0 = 0 := endpointParametricLaw_ate hv0 have htau1 : ateFunctional P1 = delta := endpointParametricPertLaw_ate hv1 have hreg : (n : ℝ) * ((1 / 2 : ℝ) * delta ^ 2 / ((1 / 2 : ℝ) * (1 - 1 / 2))) ≤ log 2 := by rw [hdeltasq] have hlog : (8 / 25 : ℝ) ≤ log 2 := le_trans (by norm_num) (le_of_lt Real.log_two_gt_d9) convert hlog using 1 <;> field_simp <;> ring have htv : tvDist (productLaw P0 n) (productLaw P1 n) ≤ 1 / 2 := by simpa [P0, P1, endpointParametricLaw, endpointParametricPertLaw, productLaw, obsLaw, productLaw, obsLaw] using (tvDist_productLaw_le_half hv0 hv1 (by norm_num) (by norm_num) (by norm_num) (by norm_num) (by norm_num) (by norm_num) hreg) unfold minimaxRisk let est0 : {f : (Fin n → Obs d) → ℝ // Measurable f} := ⟨fun _ => 0, measurable_const⟩ letI : Nonempty {f : (Fin n → Obs d) → ℝ // Measurable f} := ⟨est0⟩ apply le_ciInf intro est have hprob := two_point_lower_bound_of_tvDist_le (P₀ := productLaw P0 n) (P₁ := productLaw P1 n) est.2 (θ₀ := ateFunctional P0) (θ₁ := ateFunctional P1) (s := delta / 2) (c := (1 / 2 : ℝ)) (by rw [htau0, htau1, zero_sub, abs_neg, abs_of_nonneg hdelta0]; linarith) htv have hmse0 : (delta / 2) ^ 2 * (productLaw P0 n).real {x | delta / 2 ≤ |est.1 x - ateFunctional P0|} ≤ mse (productLaw P0 n) est.1 (ateFunctional P0) := by unfold mse have hset : {x | delta / 2 ≤ |est.1 x - ateFunctional P0|} = {x | (delta / 2) ^ 2 ≤ (est.1 x - ateFunctional P0) ^ 2} := by ext x simp only [Set.mem_setOf_eq] constructor <;> intro h <;> nlinarith [hdelta0, abs_nonneg (est.1 x - ateFunctional P0), sq_abs (est.1 x - ateFunctional P0)] rw [hset] exact mul_meas_ge_le_integral_of_nonneg (μ := productLaw P0 n) (Filter.Eventually.of_forall fun x => sq_nonneg (est.1 x - ateFunctional P0)) MemLp.of_discrete.integrable_sq ((delta / 2) ^ 2) have hmse1 : (delta / 2) ^ 2 * (productLaw P1 n).real {x | delta / 2 ≤ |est.1 x - ateFunctional P1|} ≤ mse (productLaw P1 n) est.1 (ateFunctional P1) := by unfold mse have hset : {x | delta / 2 ≤ |est.1 x - ateFunctional P1|} = {x | (delta / 2) ^ 2 ≤ (est.1 x - ateFunctional P1) ^ 2} := by ext x simp only [Set.mem_setOf_eq] constructor <;> intro h <;> nlinarith [hdelta0, abs_nonneg (est.1 x - ateFunctional P1), sq_abs (est.1 x - ateFunctional P1)] rw [hset] exact mul_meas_ge_le_integral_of_nonneg (μ := productLaw P1 n) (Filter.Eventually.of_forall fun x => sq_nonneg (est.1 x - ateFunctional P1)) MemLp.of_discrete.integrable_sq ((delta / 2) ^ 2) have htwo : delta ^ 2 / 16 ≤ max (mse (productLaw P0 n) est.1 (ateFunctional P0)) (mse (productLaw P1 n) est.1 (ateFunctional P1)) := by have hscale : 0 ≤ (delta / 2) ^ 2 := sq_nonneg _ have hp := mul_le_mul_of_nonneg_left hprob hscale norm_num at hp rw [mul_max_of_nonneg _ _ hscale] at hp calc delta ^ 2 / 16 = (delta / 2) ^ 2 * (1 / 4) := by ring _ ≤ max ((delta / 2) ^ 2 * (productLaw P0 n).real {x | delta / 2 ≤ |est.1 x - ateFunctional P0|}) ((delta / 2) ^ 2 * (productLaw P1 n).real {x | delta / 2 ≤ |est.1 x - ateFunctional P1|}) := hp _ ≤ _ := max_le_max hmse0 hmse1 have hb : BddAbove (range (fun P : ClassLaw n d (1 / 2) => mse (productLaw P.1 n) est.1 (ateFunctional P.1))) := by refine ⟨((∑ sample : Fin n → Obs d, |est.1 sample|) + 1) ^ 2, ?_⟩ rintro _ ⟨P, rfl⟩ exact mse_le_estimator_abs_sum_bound P.1 P.2.overlap est.1 have hmax_le : max (mse (productLaw P0 n) est.1 (ateFunctional P0)) (mse (productLaw P1 n) est.1 (ateFunctional P1)) ≤ worstCaseMSE n d (1 / 2) est.1 := by apply max_le · exact le_ciSup hb (⟨P0, hclass0⟩ : ClassLaw n d (1 / 2)) · exact le_ciSup hb (⟨P1, hclass1⟩ : ClassLaw n d (1 / 2)) rw [hdeltasq] at htwo exact (by convert htwo.trans hmax_le using 1 <;> field_simp <;> ring)
CausalSmith.Stat.DiscreteAteMinimaxLoggap.one_category_bernoulli_lower · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/Endpoint.lean:451
theorem randomized_endpoint_minimax Lemma 5 in the paper ↗

At exact randomization the minimax risk is parametric uniformly in d.

Formal statement
n d :
hn :
0 < n
hd :
0 < d
1 / (100 * (n : ℝ)) ≤ minimaxRisk n d (1 / 2) ∧ minimaxRisk n d (1 / 2) ≤ 1 / (n : ℝ)
Proof (Lean source)
lemma randomized_endpoint_minimax (n d : ℕ) (hn : 0 < n) (hd : 0 < d) : -- @realizes d(positive alphabet size inherited by the endpoint bracket) 1 / (100 * (n : ℝ)) ≤ minimaxRisk n d (1 / 2) ∧ minimaxRisk n d (1 / 2) ≤ 1 / (n : ℝ) := by constructor · exact one_category_bernoulli_lower n d hn hd · have hmeas : Measurable (@centeredEstimator n d) := measurable_of_finite _ have hb : BddBelow (range (fun est : {f : (Fin n → Obs d) → ℝ // Measurable f} => worstCaseMSE n d (1 / 2) est.1)) := by refine ⟨0, ?_⟩ rintro _ ⟨est, rfl⟩ unfold worstCaseMSE cases isEmpty_or_nonempty (ClassLaw n d (1 / 2)) with | inl hempty => letI := hempty simp | inr hnonempty => letI := hnonempty by_cases hbounded : BddAbove (range (fun P : ClassLaw n d (1 / 2) => mse (productLaw P.1 n) est.1 (ateFunctional P.1))) · have hmse : 0 ≤ mse (productLaw (Classical.arbitrary (ClassLaw n d (1 / 2))).1 n) est.1 (ateFunctional (Classical.arbitrary (ClassLaw n d (1 / 2))).1) := by unfold mse exact integral_nonneg (fun x => sq_nonneg (est.1 x - ateFunctional (Classical.arbitrary (ClassLaw n d (1 / 2))).1)) exact hmse.trans (le_ciSup hbounded (Classical.arbitrary _)) · change 0 ≤ (⨆ P : ClassLaw n d (1 / 2), mse (productLaw P.1 n) est.1 (ateFunctional P.1)) rw [show (⨆ P : ClassLaw n d (1 / 2), mse (productLaw P.1 n) est.1 (ateFunctional P.1)) = sSup ∅ from csSup_of_not_bddAbove hbounded] simp calc minimaxRisk n d (1 / 2) ≤ worstCaseMSE n d (1 / 2) centeredEstimator := ciInf_le hb (⟨centeredEstimator, hmeas⟩ : {f : (Fin n → Obs d) → ℝ // Measurable f}) _ ≤ 1 / (n : ℝ) := by unfold worstCaseMSE cases isEmpty_or_nonempty (ClassLaw n d (1 / 2)) with | inl hempty => letI := hempty simp | inr hnonempty => letI := hnonempty apply ciSup_le intro P simpa using near_randomization_linear_upper P.1 (productLaw P.1 n) P.2 hn
CausalSmith.Stat.DiscreteAteMinimaxLoggap.randomized_endpoint_minimax · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/Endpoint.lean:576
Helpers.Estimator 42 declarations
def splitIndices

The balanced deterministic half-sample split.

Definition (Lean source)
def splitIndices (n : ℕ) (j : Fin 2) : Finset (Fin n) := if j = 0 then Finset.univ.filter (fun i => i.1 < n / 2) else Finset.univ.filter (fun i => n / 2 ≤ i.1)
CausalSmith.Stat.DiscreteAteMinimaxLoggap.splitIndices · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/Estimator.lean:13
def splitSize

The number of observations in one half of the deterministic sample split: the first half holds the floor of n over two indices, the second half the rest.

Definition (Lean source)
def splitSize (n : ℕ) (j : Fin 2) : ℕ := (splitIndices n j).card

Count of one (k,a,y) atom in a split.

Definition (Lean source)
def splitCellCount {n d : ℕ} (sample : Fin n → Obs d) (j : Fin 2) (k : Fin d) (a y : Fin 2) : ℕ := ((splitIndices n j).filter (fun i => sample i = (k, finTwoEquiv a, finTwoEquiv y))).card
CausalSmith.Stat.DiscreteAteMinimaxLoggap.splitCellCount · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/Estimator.lean:23
def splitCategoryCount

The number of observations in one half of the split whose category coordinate equals a given value.

Definition (Lean source)
def splitCategoryCount {n d : ℕ} (sample : Fin n → Obs d) (j : Fin 2) (k : Fin d) : ℕ := ((splitIndices n j).filter (fun i => (sample i).1 = k)).card
CausalSmith.Stat.DiscreteAteMinimaxLoggap.splitCategoryCount · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/Estimator.lean:30
def MultiIndex

A four-cell exponent vector.

Definition (Lean source)
abbrev MultiIndex := Cell →₀ ℕ
CausalSmith.Stat.DiscreteAteMinimaxLoggap.MultiIndex · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/Estimator.lean:36
def multiDegree

The total degree of a four-cell exponent vector, that is, the sum of its four exponents.

Definition (Lean source)
def multiDegree (r : MultiIndex) : ℕ := r.sum fun _ e => e
CausalSmith.Stat.DiscreteAteMinimaxLoggap.multiDegree · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/Estimator.lean:40
def fallingFactorial

Falling factorial, reusing Mathlib's Nat.descFactorial.

Definition (Lean source)
def fallingFactorial (z r : ℕ) : ℕ := z.descFactorial r
CausalSmith.Stat.DiscreteAteMinimaxLoggap.fallingFactorial · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/Estimator.lean:44
def logScale

The logarithmic scale log(e n), equivalently one plus the natural logarithm of the sample size. Every calibration in the estimator -- polynomial degree, bandwidth and heavy-cell threshold -- is measured against this scale.

Definition (Lean source)
noncomputable def logScale (n : ℕ) : ℝ := log (exp 1 * n)
def calibrationA

The numerical calibration constant A = 6, the base of the coefficient-envelope growth factor A raised to the polynomial degree that bounds the light-cell approximation.

Definition (Lean source)
def calibrationA : ℕ := 6
CausalSmith.Stat.DiscreteAteMinimaxLoggap.calibrationA · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/Estimator.lean:53
def lambda0

The numerical calibration constant lambda_0 = 256 fixing the pilot heavy/light threshold: a category is declared heavy when its pilot-half count exceeds lambda_0 times log(e n).

Definition (Lean source)
def lambda0 : ℕ := 256
def b0

The numerical calibration constant b_0 = 4096 fixing the light-cell bandwidth, which is b_0 times log(e n) divided by the size of the estimation half-sample.

Definition (Lean source)
def b0 : ℕ := 4096
def dA

The numerical calibration constant eight times the natural logarithm of 27/4, one of the two reciprocal caps that define the degree-calibration constant alpha_0.

Definition (Lean source)
noncomputable def dA : ℝ := 8 * log (27 / 4)
def alpha0

The degree-calibration constant alpha_0: the smallest of one, the reciprocal of 32 log 6, and the reciprocal of 256 times the constant d_A = 8 log(27/4). It fixes the proportion of the logarithmic scale used as the approximation degree.

Definition (Lean source)
noncomputable def alpha0 : ℝ := min 1 (min (1 / (32 * log 6)) (1 / (256 * dA)))
def polynomialDegree

The calibrated approximation degree M(n): the larger of two and the integer part of alpha_0 times log(e n). This is the degree of the polynomial that replaces the plug-in ratio on light cells.

Definition (Lean source)
noncomputable def polynomialDegree (n : ℕ) : ℕ := max 2 (Int.toNat ⌊alpha0 * logScale n⌋)
CausalSmith.Stat.DiscreteAteMinimaxLoggap.polynomialDegree · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/Estimator.lean:75
def bandwidth

Defines bandwidth, the stated quantity or construction used in the discrete average-treatment-effect estimator.

Definition (Lean source)
noncomputable def bandwidth (n : ℕ) : ℝ := b0 * logScale n / splitSize n 1
def cutoffProperty

Defines cutoff Property, the stated quantity or construction used in the discrete average-treatment-effect estimator.

Definition (Lean source)
def cutoffProperty (N : ℕ) : Prop := ∀ n ≥ N, 2 ≤ alpha0 * logScale n ∧ 4 * polynomialDegree n ^ 2 ≤ splitSize n 1 ∧ 4 * polynomialDegree n / (splitSize n 1 : ℝ) ≤ 3 * bandwidth n / 4
CausalSmith.Stat.DiscreteAteMinimaxLoggap.cutoffProperty · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/Estimator.lean:85
theorem cutoffProperty_eventually

Establishes the stated property of cutoff Property eventually in the discrete average-treatment-effect construction.

Formal statement
Proof (Lean source)
lemma cutoffProperty_eventually : ∃ N, cutoffProperty N := by have ha0 : 0 < alpha0 := by unfold alpha0 dA have hlog6 : 0 < log (6 : ℝ) := Real.log_pos (by norm_num) have hlog : 0 < log (27 / 4 : ℝ) := Real.log_pos (by norm_num) positivity have ha1 : alpha0 ≤ 1 := by simp [alpha0] have hlogSmall : ∀ᶠ n : ℕ in atTop, |log (n : ℝ) ^ 2| ≤ (1 / 64 : ℝ) * |(n : ℝ)| := by have hreal := (Real.isLittleO_pow_log_id_atTop (n := 2)).bound (by norm_num : (0 : ℝ) < 1 / 64) exact tendsto_natCast_atTop_atTop.eventually hreal have hlogLarge : ∀ᶠ n : ℕ in atTop, 2 / alpha0 ≤ log (n : ℝ) := by exact (Real.tendsto_log_atTop.comp tendsto_natCast_atTop_atTop).eventually (Filter.eventually_ge_atTop (2 / alpha0)) have hall : ∀ᶠ n : ℕ in atTop, 256 ≤ n ∧ |log (n : ℝ) ^ 2| ≤ (1 / 64 : ℝ) * |(n : ℝ)| ∧ 2 / alpha0 ≤ log (n : ℝ) := Filter.Eventually.and (Filter.eventually_ge_atTop 256) (hlogSmall.and hlogLarge) rw [Filter.eventually_atTop] at hall obtain ⟨N, hN⟩ := hall refine ⟨N, ?_⟩ intro n hn rcases hN n hn with ⟨hn256, hlogSq, hlogLarge⟩ have hn0 : 0 < n := lt_of_lt_of_le (by norm_num) hn256 have hlogn0 : 0 ≤ log (n : ℝ) := Real.log_nonneg (by exact_mod_cast (show 1 ≤ n by omega)) have hscale : logScale n = 1 + log (n : ℝ) := by rw [logScale, Real.log_mul (by positivity : exp 1 ≠ 0) (by positivity : (n : ℝ) ≠ 0)] simp have hscale_pos : 0 < logScale n := by rw [hscale]; positivity have hfirst : 2 ≤ alpha0 * logScale n := by rw [hscale] have := (div_le_iff₀' ha0).mp hlogLarge nlinarith have hdeg_cast : (polynomialDegree n : ℝ) ≤ logScale n := by have hfloor2 : (2 : ℤ) ≤ ⌊alpha0 * logScale n⌋ := by rw [Int.le_floor] exact_mod_cast hfirst have hmax : polynomialDegree n = Int.toNat ⌊alpha0 * logScale n⌋ := by rw [polynomialDegree, max_eq_right] exact Int.toNat_le_toNat hfloor2 rw [hmax] have hfloor_nonneg : 0 ≤ ⌊alpha0 * logScale n⌋ := le_trans (by norm_num) hfloor2 have hcast : ((Int.toNat ⌊alpha0 * logScale n⌋ : ℕ) : ℝ) = ((⌊alpha0 * logScale n⌋ : ℤ) : ℝ) := by exact_mod_cast Int.toNat_of_nonneg hfloor_nonneg rw [hcast] have hf := Int.floor_le (alpha0 * logScale n) exact le_trans hf (mul_le_of_le_one_left (le_of_lt hscale_pos) ha1) have hsize : splitSize n 1 = n - n / 2 := by unfold splitSize splitIndices simp only [show (1 : Fin 2) ≠ 0 by decide, if_false] have hc := Finset.card_filter_add_card_filter_not (s := (Finset.univ : Finset (Fin n))) (p := fun i => i.1 < n / 2) have hfirstCard : ((Finset.univ : Finset (Fin n)).filter (fun i => i.1 < n / 2)).card = n / 2 := by simpa [Fin.card_filter_val_lt, Nat.min_eq_right (Nat.div_le_self n 2)] have hc' : n / 2 + ((Finset.univ : Finset (Fin n)).filter (fun i => n / 2 ≤ i.1)).card = n := by simpa only [not_lt, hfirstCard, Finset.card_univ, Fintype.card_fin] using hc omega have hhalf : (n : ℝ) / 2 ≤ (splitSize n 1 : ℝ) := by have hnsize : n ≤ 2 * splitSize n 1 := by rw [hsize]; omega have hnsizeR : (n : ℝ) ≤ 2 * (splitSize n 1 : ℝ) := by exact_mod_cast hnsize linarith have hlogSq' : log (n : ℝ) ^ 2 ≤ (n : ℝ) / 64 := by rw [abs_of_nonneg (sq_nonneg _), abs_of_nonneg (Nat.cast_nonneg _)] at hlogSq norm_num [div_eq_mul_inv] at hlogSq ⊢ simpa [mul_comm] using hlogSq have hdegSq : 4 * polynomialDegree n ^ 2 ≤ splitSize n 1 := by have hreal : (4 : ℝ) * (polynomialDegree n : ℝ) ^ 2 ≤ (splitSize n 1 : ℝ) := by rw [hscale] at hdeg_cast have hnreal : (256 : ℝ) ≤ n := by exact_mod_cast hn256 nlinarith [sq_nonneg ((polynomialDegree n : ℝ) - (1 + log (n : ℝ)))] exact_mod_cast hreal refine ⟨hfirst, hdegSq, ?_⟩ have hsize_pos : 0 < (splitSize n 1 : ℝ) := lt_of_lt_of_le (by positivity) hhalf rw [bandwidth] rw [show 3 * ((b0 : ℝ) * logScale n / (splitSize n 1 : ℝ)) / 4 = 3072 * logScale n / (splitSize n 1 : ℝ) by rw [b0] field_simp ring] apply (div_le_div_iff_of_pos_right hsize_pos).2 nlinarith [hdeg_cast]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.cutoffProperty_eventually · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/Estimator.lean:92
def calibrationCutoff

Least numerical cutoff satisfying the three calibration inequalities.

Definition (Lean source)
noncomputable def calibrationCutoff : ℕ := by classical exact find cutoffProperty_eventually
CausalSmith.Stat.DiscreteAteMinimaxLoggap.calibrationCutoff · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/Estimator.lean:187
def gCoefficient

Coefficient of the explicit polynomial continuation G_M.

Definition (Lean source)
noncomputable def gCoefficient (M j : ℕ) : ℝ := (-1 : ℝ) ^ j * 2 ^ (2 * j + 3) / ((M : ℝ) * (M + j + 2)) * choose (M + j + 2) (2 * j + 4)
CausalSmith.Stat.DiscreteAteMinimaxLoggap.gCoefficient · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/Estimator.lean:192
def gPolynomial

Explicit closed polynomial continuation of G_M.

Definition (Lean source)
noncomputable def gPolynomial (M : ℕ) (x : ℝ) : ℝ := ∑ j ∈ range (M - 1), gCoefficient M j * x ^ j
CausalSmith.Stat.DiscreteAteMinimaxLoggap.gPolynomial · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/Estimator.lean:197
def mvArmMass

The formal linear polynomial in the four cell masses that returns the total mass of one treatment arm, namely the sum of that arm's outcome-zero and outcome-one coordinates.

Definition (Lean source)
noncomputable def mvArmMass (a : Fin 2) : MvPolynomial Cell ℝ := X (a, 0) + X (a, 1)
def mvMass

The formal linear polynomial in the four cell masses that returns the total mass of a category, namely the sum of the two arm masses.

Definition (Lean source)
noncomputable def mvMass : MvPolynomial Cell ℝ := mvArmMass 0 + mvArmMass 1
def cellApproxPolynomial

The multivariate polynomial P_{M,B} whose coefficients are factorial-lifted.

Definition (Lean source)
noncomputable def cellApproxPolynomial (M : ℕ) (B : ℝ) : MvPolynomial Cell ℝ := let evalG (s : MvPolynomial Cell ℝ) := ∑ j ∈ range (M - 1), C (gCoefficient M j) * (C B⁻¹ * s) ^ j C B⁻¹ * mvMass * X (1, 1) * evalG (mvArmMass 1) - C B⁻¹ * mvMass * X (0, 1) * evalG (mvArmMass 0)
CausalSmith.Stat.DiscreteAteMinimaxLoggap.cellApproxPolynomial · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/Estimator.lean:211
def factorialMonomial

The unbiased factorial-moment estimate of one monomial in the four cell masses of a category: the product over the four cells of the falling factorial of that cell's estimation-half count at the corresponding exponent, divided by the falling factorial of the estimation-half sample size at the total degree.

Definition (Lean source)
noncomputable def factorialMonomial {n d : ℕ} (sample : Fin n → Obs d) (k : Fin d) (r : MultiIndex) : ℝ := (∏ ay : Cell, (fallingFactorial (splitCellCount sample 1 k ay.1 ay.2) (r ay) : ℝ)) / (fallingFactorial (splitSize n 1) (multiDegree r) : ℝ)
CausalSmith.Stat.DiscreteAteMinimaxLoggap.factorialMonomial · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/Estimator.lean:219
def factorialExpansionIndex

Merged exponent vector in the sparse binomial expansion of one arm of cellApproxPolynomial.

Definition (Lean source)
noncomputable def factorialExpansionIndex (a : Fin 2) (ay : Cell) (j t : ℕ) : MultiIndex := Finsupp.single ay 1 + Finsupp.single (a, 1) 1 + Finsupp.single (a, 0) t + Finsupp.single (a, 1) (j - t)
CausalSmith.Stat.DiscreteAteMinimaxLoggap.factorialExpansionIndex · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/Estimator.lean:229
def factorialPolynomialContribution

Factorial-moment lift of the light-cell approximation polynomial, written in its sparse arm/binomial expansion. Keeping duplicate displayed monomials is intentional: linearity collects them to the coefficient-support form.

Definition (Lean source)
noncomputable def factorialPolynomialContribution {n d : ℕ} (sample : Fin n → Obs d) (k : Fin d) : ℝ := let M := polynomialDegree n let B := bandwidth n let arm (a : Fin 2) := ∑ j ∈ range (M - 1), ∑ t ∈ range (j + 1), ∑ ay : Cell, (B⁻¹ * gCoefficient M j * B⁻¹ ^ j * (Nat.choose j t : ℝ)) * factorialMonomial sample k (factorialExpansionIndex a ay j t) arm 1 - arm 0
CausalSmith.Stat.DiscreteAteMinimaxLoggap.factorialPolynomialContribution · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/Estimator.lean:235
def heavyCells

Pilot-heavy cells; below the cutoff every category uses the ratio branch.

Definition (Lean source)
-- @realizes \(\widehat{\mathcal H}_n,\widehat{\mathcal L}_n\)(pilot-heavy side; all cells below the cutoff) noncomputable def heavyCells {n d : ℕ} (sample : Fin n → Obs d) : Finset (Fin d) := if n < calibrationCutoff then univ else Finset.univ.filter (fun k => (lambda0 : ℝ) * logScale n < splitCategoryCount sample 0 k)
CausalSmith.Stat.DiscreteAteMinimaxLoggap.heavyCells · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/Estimator.lean:248
def lightCells

Pilot-light cells; below the cutoff this is empty as stipulated in the note.

Definition (Lean source)
-- @realizes \(\widehat{\mathcal H}_n,\widehat{\mathcal L}_n\)(light side is the heavy-set complement) noncomputable def lightCells {n d : ℕ} (sample : Fin n → Obs d) : Finset (Fin d) := if n < calibrationCutoff then ∅ else (heavyCells sample)ᶜ
CausalSmith.Stat.DiscreteAteMinimaxLoggap.lightCells · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/Estimator.lean:255
theorem heavyCells_eq_filter_of_cutoff_le

At or above the calibration cutoff, the heavy set is exactly the set of categories whose pilot-half count exceeds lambda_0 times log(e n).

Formal statement
n d :
sample :
Fin n → Obs d
h :
heavyCells sample
= Finset.univ.filter (fun k => (lambda0 : ℝ) * logScale n < splitCategoryCount sample 0 k)
Proof (Lean source)
lemma heavyCells_eq_filter_of_cutoff_le {n d : ℕ} (sample : Fin n → Obs d) (h : calibrationCutoff ≤ n) : heavyCells sample = Finset.univ.filter (fun k => (lambda0 : ℝ) * logScale n < splitCategoryCount sample 0 k) := by simp [heavyCells, Nat.not_lt.mpr h]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.heavyCells_eq_filter_of_cutoff_le · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/Estimator.lean:261
theorem heavyCells_eq_univ_of_lt_cutoff

Below the calibration cutoff every category is declared heavy, so the estimator reduces to the plug-in ratio branch on all of them.

Formal statement
n d :
sample :
Fin n → Obs d
heavyCells sample = univ
Proof (Lean source)
lemma heavyCells_eq_univ_of_lt_cutoff {n d : ℕ} (sample : Fin n → Obs d) (h : n < calibrationCutoff) : heavyCells sample = univ := by simp [heavyCells, h]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.heavyCells_eq_univ_of_lt_cutoff · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/Estimator.lean:270
theorem lightCells_eq_empty_of_lt_cutoff

Establishes the stated equality relating light Cells eq empty of lt cutoff.

Formal statement
n d :
sample :
Fin n → Obs d
lightCells sample = ∅
Proof (Lean source)
lemma lightCells_eq_empty_of_lt_cutoff {n d : ℕ} (sample : Fin n → Obs d) (h : n < calibrationCutoff) : lightCells sample = ∅ := by simp [lightCells, h]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.lightCells_eq_empty_of_lt_cutoff · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/Estimator.lean:277
theorem lightCells_eq_compl

Establishes the stated equality relating light Cells eq compl.

Formal statement
n d :
sample :
Fin n → Obs d
lightCells sample = (heavyCells sample)ᶜ
Proof (Lean source)
lemma lightCells_eq_compl {n d : ℕ} (sample : Fin n → Obs d) : lightCells sample = (heavyCells sample)ᶜ := by by_cases h : n < calibrationCutoff · simp [lightCells, heavyCells, h] · simp [lightCells, h]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.lightCells_eq_compl · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/Estimator.lean:283
def empiricalRatioCell

Defines empirical Ratio Cell, the stated quantity or construction used in the discrete average-treatment-effect estimator.

Definition (Lean source)
noncomputable def empiricalRatioCell {n d : ℕ} (sample : Fin n → Obs d) (k : Fin d) : ℝ := let Nk := splitCategoryCount sample 1 k let N1 := splitCellCount sample 1 k 1 0 + splitCellCount sample 1 k 1 1 let N0 := splitCellCount sample 1 k 0 0 + splitCellCount sample 1 k 0 1 (Nk : ℝ) / splitSize n 1 * ((splitCellCount sample 1 k 1 1 : ℝ) / N1 - (splitCellCount sample 1 k 0 1 : ℝ) / N0)
CausalSmith.Stat.DiscreteAteMinimaxLoggap.empiricalRatioCell · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/Estimator.lean:290
def heavyContribution

Defines heavy Contribution, the stated quantity or construction used in the discrete average-treatment-effect estimator.

Definition (Lean source)
noncomputable def heavyContribution {n d : ℕ} (sample : Fin n → Obs d) : ℝ := ∑ k ∈ heavyCells sample, empiricalRatioCell sample k
CausalSmith.Stat.DiscreteAteMinimaxLoggap.heavyContribution · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/Estimator.lean:300
def lightContribution

Defines light Contribution, the stated quantity or construction used in the discrete average-treatment-effect estimator.

Definition (Lean source)
noncomputable def lightContribution {n d : ℕ} (sample : Fin n → Obs d) : ℝ := ∑ k ∈ lightCells sample, factorialPolynomialContribution sample k
CausalSmith.Stat.DiscreteAteMinimaxLoggap.lightContribution · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/Estimator.lean:304
def hybridEstimator

Universally calibrated balanced ratio-polynomial hybrid, truncated to [-1,1]. Its type has no overlap parameter: overlap adaptation is structural.

Definition (Lean source)
-- @node: def:hybrid-estimator-handle noncomputable def hybridEstimator {n d : ℕ} (sample : Fin n → Obs d) : ℝ := max (-1) (min 1 (heavyContribution sample + lightContribution sample))
CausalSmith.Stat.DiscreteAteMinimaxLoggap.hybridEstimator · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/Estimator.lean:309
def HybridCountInput

Inputs available to the arithmetic realization: the eight split counts for each category. All dependence of the hybrid on the observed sample factors through this finite vector.

Definition (Lean source)
abbrev HybridCountInput (d : ℕ) := Fin 2 × Fin d × Fin 2 × Fin 2
CausalSmith.Stat.DiscreteAteMinimaxLoggap.HybridCountInput · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/Estimator.lean:316
def hybridCountVector

The finite vector of counts through which the hybrid estimator sees the sample: for each half of the split, each category, each treatment value and each outcome value, the number of matching observations, recorded as a real number.

Definition (Lean source)
def hybridCountVector {n d : ℕ} (sample : Fin n → Obs d) : HybridCountInput d → ℝ := fun i => (splitCellCount sample i.1 i.2.1 i.2.2.1 i.2.2.2 : ℝ)
CausalSmith.Stat.DiscreteAteMinimaxLoggap.hybridCountVector · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/Estimator.lean:321
inductive RealArithmeticInstruction

One instruction in a straight-line real-arithmetic program. Natural numbers address previously computed registers, allowing factorials and powers to be computed once and shared across all polynomial monomials.

Definition (Lean source)
inductive RealArithmeticInstruction (ι : Type*) where | input (i : ι) | const (x : ℝ) | add (x y : ℕ) | sub (x y : ℕ) | mul (x y : ℕ) | div (x y : ℕ) | branchNonpos (test yes no : ℕ)
CausalSmith.Stat.DiscreteAteMinimaxLoggap.RealArithmeticInstruction · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/Estimator.lean:328
def RealArithmeticProgram

A finite instruction list paired with its designated output register.

Definition (Lean source)
abbrev RealArithmeticProgram (ι : Type*) := List (RealArithmeticInstruction ι) × ℕ
CausalSmith.Stat.DiscreteAteMinimaxLoggap.RealArithmeticProgram · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/Estimator.lean:340

Clause (i)'s computability assertion, in the real-arithmetic model used in the note. A universal operation-count constant works for every n,d; the program reads only split counts, returns the stated hybrid exactly, and has O(d M(n)^4) arithmetic/comparison operations.

Definition (Lean source)
def HybridEstimatorComputable : Prop := ∃ K : ℕ, 0 < K ∧ ∀ n d : ℕ, ∃ program : RealArithmeticProgram (HybridCountInput d), program.operationCount ≤ K * d * polynomialDegree n ^ 4 ∧ ∀ sample : Fin n → Obs d, program.eval (hybridCountVector sample) = hybridEstimator sample
CausalSmith.Stat.DiscreteAteMinimaxLoggap.HybridEstimatorComputable · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/Estimator.lean:374

The sample average of a bounded one-observation score obtained by centering the binary outcome at one half, doubling it, and attaching the sign of the treatment indicator -- positive for treated units and negative for controls.

Definition (Lean source)
noncomputable def centeredEstimator {n d : ℕ} (sample : Fin n → Obs d) : ℝ := (n : ℝ)⁻¹ * ∑ i : Fin n, 2 * (if (sample i).2.1 then 1 else -1) * ((if (sample i).2.2 then 1 else 0) - 1 / 2)
CausalSmith.Stat.DiscreteAteMinimaxLoggap.centeredEstimator · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/Estimator.lean:385
Helpers.FactorialMoments 4 declarations
theorem descFactorial_mul_identity

Falling-factorial product identity used for within-cell moments.

Formal statement
z a b :
(z.descFactorial a) * (z.descFactorial b)
= ∑ h ∈ range (min a b + 1), choose a h * choose b h * h.factorial * z.descFactorial (a + b - h)
Proof (Lean source)
lemma descFactorial_mul_identity (z a b : ℕ) : (z.descFactorial a) * (z.descFactorial b) = ∑ h ∈ range (min a b + 1), choose a h * choose b h * h.factorial * z.descFactorial (a + b - h) := by have hp := congrArg (eval (z : ℤ)) (descPochhammer_mul_linearization a b) simp only [Polynomial.eval_mul, Polynomial.eval_finset_sum, Polynomial.eval_C, descPochhammer_eval_eq_descFactorial] at hp exact_mod_cast hp
CausalSmith.Stat.DiscreteAteMinimaxLoggap.descFactorial_mul_identity · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/FactorialMoments.lean:108
theorem factorial_normalization Lemma factorial_normalization in the paper ↗

The ordered injective tuple count is the normalizing falling factorial.

Formal statement
m r :
injectiveTupleCount r m = m.descFactorial r
Proof (Lean source)
-- @node: factorial_normalization lemma factorial_normalization (m r : ℕ) : injectiveTupleCount r m = m.descFactorial r := by exact injectiveTupleCount_eq_descFactorial r m
CausalSmith.Stat.DiscreteAteMinimaxLoggap.factorial_normalization · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/FactorialMoments.lean:120
theorem factorial_ratio_bound

Ratio estimate for two normalized ordered selections.

Formal statement
m r s H :
hdeg :
r ≤ s
hM :
4 * s ^ 2 ≤ m
hH :
H ≤ s
(m.descFactorial (r + s - H) : ℝ) / ((m.descFactorial r : ℝ) * m.descFactorial s)
exp 1 / m ^ H
Proof (Lean source)
lemma factorial_ratio_bound {m r s H : ℕ} (hdeg : r ≤ s) (hM : 4 * s ^ 2 ≤ m) (hH : H ≤ s) : (m.descFactorial (r + s - H) : ℝ) / ((m.descFactorial r : ℝ) * m.descFactorial s) ≤ exp 1 / m ^ H := by by_cases hs0 : s = 0 · subst s have hr0 : r = 0 := by omega have hH0 : H = 0 := by omega subst r subst H norm_num have hspos : 0 < s := Nat.pos_of_ne_zero hs0 have hmpos : 0 < m := lt_of_lt_of_le (by positivity : 0 < 4 * s ^ 2) hM have hsm : s ≤ m := by nlinarith [sq_nonneg (s : ℝ)] have hsubpos : 0 < m - s := by have : s < m := by nlinarith omega let u : ℕ := m - s have hu_pos : 0 < u := by simpa [u] using hsubpos have hnumNat : m.descFactorial (r + s - H) ≤ m ^ (r + s - H) := Nat.descFactorial_le_pow m _ have hlowS : u ^ s ≤ m.descFactorial s := by calc u ^ s ≤ (m + 1 - s) ^ s := Nat.pow_le_pow_left (by simp [u]; omega) s _ ≤ m.descFactorial s := Nat.pow_sub_le_descFactorial m s have hur : u ≤ m + 1 - r := by simp only [u] omega have hlowR : u ^ r ≤ m.descFactorial r := by calc u ^ r ≤ (m + 1 - r) ^ r := Nat.pow_le_pow_left hur r _ ≤ m.descFactorial r := Nat.pow_sub_le_descFactorial m r have hdenNat : u ^ (r + s) ≤ m.descFactorial r * m.descFactorial s := by rw [pow_add] exact Nat.mul_le_mul hlowR hlowS have hN : r + s ≤ 2 * s := by omega have hratio_exp : ((m : ℝ) / u) ^ (r + s) ≤ exp 1 := by have huR : (0 : ℝ) < u := by exact_mod_cast hu_pos have hmR : (0 : ℝ) < m := by exact_mod_cast hmpos have hratio_pos : (0 : ℝ) < (m : ℝ) / u := div_pos hmR huR have hratio_eq : (m : ℝ) / u = 1 + (s : ℝ) / u := by have hmu : m = u + s := by simp [u, Nat.sub_add_cancel hsm] rw [hmu, Nat.cast_add, add_div] simp [huR.ne'] have hlog : log ((m : ℝ) / u) ≤ (s : ℝ) / u := by calc log ((m : ℝ) / u) ≤ (m : ℝ) / u - 1 := Real.log_le_sub_one_of_pos hratio_pos _ = (s : ℝ) / u := by rw [hratio_eq]; ring have hfrac : ((r + s : ℕ) : ℝ) * ((s : ℝ) / u) ≤ 1 := by have huLowerNat : 2 * s ^ 2 ≤ u := by have hs_sq : s ≤ 2 * s ^ 2 := by calc s = s * 1 := by omega _ ≤ s * s := Nat.mul_le_mul_left s (Nat.succ_le_iff.mpr hspos) _ ≤ 2 * s ^ 2 := by nlinarith dsimp [u] omega have hNR : ((r + s : ℕ) : ℝ) ≤ 2 * s := by exact_mod_cast hN have hsR : (0 : ℝ) ≤ s := by positivity have huR' : (0 : ℝ) < u := by exact_mod_cast hu_pos calc ((r + s : ℕ) : ℝ) * ((s : ℝ) / u) = (((r + s : ℕ) : ℝ) * s) / u := by ring _ ≤ 1 := (div_le_one huR').2 (by calc ((r + s : ℕ) : ℝ) * s ≤ (2 * s : ℝ) * s := mul_le_mul_of_nonneg_right hNR hsR _ ≤ u := by norm_cast convert huLowerNat using 1 <;> simp [pow_two, mul_assoc]) have hlogN : ((r + s : ℕ) : ℝ) * log ((m : ℝ) / u) ≤ 1 := (mul_le_mul_of_nonneg_left hlog (by positivity)).trans hfrac calc ((m : ℝ) / u) ^ (r + s) = exp (((r + s : ℕ) : ℝ) * log ((m : ℝ) / u)) := by rw [← Real.log_pow, Real.exp_log (pow_pos hratio_pos _)] _ ≤ exp 1 := Real.exp_le_exp.mpr hlogN have hpow_ratio : (m : ℝ) ^ (r + s) / (u : ℝ) ^ (r + s) ≤ exp 1 := by simpa [div_pow] using hratio_exp have hdenpos : (0 : ℝ) < (m.descFactorial r : ℝ) * m.descFactorial s := by have hrm : r ≤ m := hdeg.trans hsm have hrp : (0 : ℝ) < m.descFactorial r := by exact_mod_cast (Nat.descFactorial_pos.mpr hrm) have hsp : (0 : ℝ) < m.descFactorial s := by exact_mod_cast (Nat.descFactorial_pos.mpr hsm) exact mul_pos hrp hsp have huPowPos : (0 : ℝ) < (u : ℝ) ^ (r + s) := by positivity have hmPowPos : (0 : ℝ) < (m : ℝ) ^ H := by positivity have hnum : (m.descFactorial (r + s - H) : ℝ) ≤ (m : ℝ) ^ (r + s - H) := by exact_mod_cast hnumNat have hden : (u : ℝ) ^ (r + s) ≤ (m.descFactorial r : ℝ) * m.descFactorial s := by exact_mod_cast hdenNat calc (m.descFactorial (r + s - H) : ℝ) / ((m.descFactorial r : ℝ) * m.descFactorial s) ≤ (m : ℝ) ^ (r + s - H) / (u : ℝ) ^ (r + s) := by calc (m.descFactorial (r + s - H) : ℝ) / ((m.descFactorial r : ℝ) * m.descFactorial s) ≤ (m : ℝ) ^ (r + s - H) / ((m.descFactorial r : ℝ) * m.descFactorial s) := div_le_div_of_nonneg_right hnum hdenpos.le _ ≤ (m : ℝ) ^ (r + s - H) / (u : ℝ) ^ (r + s) := div_le_div_of_nonneg_left (by positivity) huPowPos hden _ = ((m : ℝ) ^ (r + s) / (u : ℝ) ^ (r + s)) / (m : ℝ) ^ H := by have hHsum : H ≤ r + s := hH.trans (Nat.le_add_left s r) rw [← pow_sub_mul_pow (m : ℝ) hHsum] field_simp _ ≤ exp 1 / (m : ℝ) ^ H := div_le_div_of_nonneg_right hpow_ratio hmPowPos.le
CausalSmith.Stat.DiscreteAteMinimaxLoggap.factorial_ratio_bound · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/FactorialMoments.lean:126
theorem factorial_cross_ratio_bound

Sharp disjoint-selection normalization. This is the covariance factor for two monomials attached to distinct multinomial categories: the two ordered selections cannot share observations, so their joint moment differs from the product of their means only through this falling-factorial ratio.

Formal statement
m r s :
hdeg :
r ≤ s
hM :
4 * s ^ 2 ≤ m
|(m.descFactorial (r + s) : ℝ) / ((m.descFactorial r : ℝ) * m.descFactorial s) - 1|
≤ 2 * (s : ℝ) ^ 2 / m
Proof (Lean source)
lemma factorial_cross_ratio_bound {m r s : ℕ} (hdeg : r ≤ s) (hM : 4 * s ^ 2 ≤ m) : |(m.descFactorial (r + s) : ℝ) / ((m.descFactorial r : ℝ) * m.descFactorial s) - 1| ≤ 2 * (s : ℝ) ^ 2 / m := by by_cases hs0 : s = 0 · subst s have hr0 : r = 0 := by omega subst r norm_num have hspos : 0 < s := Nat.pos_of_ne_zero hs0 have hmpos : 0 < m := lt_of_lt_of_le (by positivity : 0 < 4 * s ^ 2) hM have hsm : s ≤ m := by nlinarith [sq_nonneg (s : ℝ)] have h2sm : 2 * s ≤ m := by have hs_sq' : s ≤ s ^ 2 := by calc s = s * 1 := by omega _ ≤ s * s := Nat.mul_le_mul_left s (Nat.succ_le_iff.mpr hspos) _ = s ^ 2 := by ring omega have hrm : r ≤ m := hdeg.trans hsm have hfac : (m - r).descFactorial s * m.descFactorial r = m.descFactorial (r + s) := by simpa using Nat.descFactorial_mul_descFactorial (n := m) (k := r) (m := r + s) (le_add_right r s) have hfrpos : (0 : ℝ) < m.descFactorial r := by exact_mod_cast (Nat.descFactorial_pos.mpr hrm) have hfspos : (0 : ℝ) < m.descFactorial s := by exact_mod_cast (Nat.descFactorial_pos.mpr hsm) have hratio_eq : (m.descFactorial (r + s) : ℝ) / ((m.descFactorial r : ℝ) * m.descFactorial s) = (m - r).descFactorial s / (m.descFactorial s : ℝ) := by rw [← hfac] push_cast field_simp have hratio_le_one : (m.descFactorial (r + s) : ℝ) / ((m.descFactorial r : ℝ) * m.descFactorial s) ≤ 1 := by rw [hratio_eq] apply (div_le_one hfspos).2 exact_mod_cast Nat.descFactorial_le s (Nat.sub_le m r) have hbaseNat : m - 2 * s ≤ m - r + 1 - s := by omega have hlowNumNat : (m - 2 * s) ^ s ≤ (m - r).descFactorial s := by calc (m - 2 * s) ^ s ≤ (m - r + 1 - s) ^ s := Nat.pow_le_pow_left hbaseNat s _ ≤ (m - r).descFactorial s := Nat.pow_sub_le_descFactorial (m - r) s have hdenUpperNat : m.descFactorial s ≤ m ^ s := Nat.descFactorial_le_pow m s have hmR : (0 : ℝ) < m := by exact_mod_cast hmpos have hratio_lower : ((m : ℝ) - 2 * s) ^ s / (m : ℝ) ^ s ≤ (m.descFactorial (r + s) : ℝ) / ((m.descFactorial r : ℝ) * m.descFactorial s) := by rw [hratio_eq] have hnumR : ((m : ℝ) - 2 * s) ^ s ≤ ((m - r).descFactorial s : ℝ) := by have hcast : ((m - 2 * s : ℕ) : ℝ) = (m : ℝ) - 2 * s := by rw [Nat.cast_sub h2sm] push_cast ring rw [← hcast] exact_mod_cast hlowNumNat have hdenR : (m.descFactorial s : ℝ) ≤ (m : ℝ) ^ s := by exact_mod_cast hdenUpperNat calc ((m : ℝ) - 2 * s) ^ s / (m : ℝ) ^ s ≤ ((m - r).descFactorial s : ℝ) / (m : ℝ) ^ s := div_le_div_of_nonneg_right hnumR (by positivity) _ ≤ ((m - r).descFactorial s : ℝ) / m.descFactorial s := div_le_div_of_nonneg_left (by positivity) hfspos hdenR have hbern : 1 - 2 * (s : ℝ) ^ 2 / m ≤ ((m : ℝ) - 2 * s) ^ s / (m : ℝ) ^ s := by have hx : (-1 : ℝ) ≤ -2 * (s : ℝ) / m := by apply (le_div_iff₀ hmR).2 have h2smR : (2 : ℝ) * s ≤ m := by exact_mod_cast h2sm nlinarith have hb := one_add_mul_le_pow ((by norm_num : (-2 : ℝ) ≤ -1).trans hx) s have heq : (1 + (-2 * (s : ℝ) / m)) ^ s = ((m : ℝ) - 2 * s) ^ s / (m : ℝ) ^ s := by rw [← div_pow] congr 1 field_simp ring rw [← heq] exact le_trans (le_of_eq (by ring)) hb rw [abs_of_nonpos (sub_nonpos.mpr hratio_le_one)] linarith [hbern.trans hratio_lower]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.factorial_cross_ratio_bound · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/FactorialMoments.lean:240
Helpers.HeavyCell 54 declarations
def balancedOneShotSplit

The deterministic half split used by the estimator, packaged in the generic one-shot independence interface.

Definition (Lean source)
noncomputable def balancedOneShotSplit {d : ℕ} (P : DiscreteLaw d) : OneShotSplit (iidSample_infinitePi (obsLaw P)) where n₁ n := n / 2 bound n := Nat.div_le_self n 2 grow := Nat.tendsto_div_const_atTop (by norm_num) cogrow := by show Tendsto (fun n : ℕ ↦ n - n / 2) atTop atTop apply Filter.tendsto_atTop_mono (f := fun n : ℕ ↦ n / 2) (g := fun n ↦ n - n / 2) · intro n omega · exact Nat.tendsto_div_const_atTop (by norm_num)
CausalSmith.Stat.DiscreteAteMinimaxLoggap.balancedOneShotSplit · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCell.lean:16
theorem integral_productLaw_eq_infinite_trunc

Transport a finite-sample integral to the canonical infinite IID sample. This lets the heavy branch use the same tail-count realization as the light branch while keeping the theorem stated under productLaw.

Formal statement
n d :
P :
f :
(Fin n → Obs d) → ℝ
∫ sample, f sample ∂productLaw P n
= ∫ ω : ℕ → Obs d, f (fun i : Fin n ↦ ω i) ∂(Measure.infinitePi (fun _ : ℕ ↦ obsLaw P))
Proof (Lean source)
lemma integral_productLaw_eq_infinite_trunc {n d : ℕ} (P : DiscreteLaw d) (f : (Fin n → Obs d) → ℝ) : ∫ sample, f sample ∂productLaw P n = ∫ ω : ℕ → Obs d, f (fun i : Fin n ↦ ω i) ∂(Measure.infinitePi (fun _ : ℕ ↦ obsLaw P)) := by let trunc : (ℕ → Obs d) → (Fin n → Obs d) := fun ω i ↦ ω i have htrunc : Measurable trunc := by fun_prop rw [productLaw, ← finProductLaw_eq_map (obsLaw P) n, integral_map htrunc.aemeasurable (measurable_of_finite f).aestronglyMeasurable]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.integral_productLaw_eq_infinite_trunc · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCell.lean:32
theorem componentErrorMSE_productLaw_eq_infinite_trunc

The mean squared deviation of an estimator component from its target, computed under the n-fold product law, equals the same expectation taken over the canonical infinite independent sample restricted to its first n coordinates.

Formal statement
n d :
P :
component target :
(Fin n → Obs d) → ℝ
componentErrorMSE (productLaw P n) component target
= ∫ ω : ℕ → Obs d, (component (fun i : Fin n ↦ ω i) - target (fun i : Fin n ↦ ω i)) ^ 2 ∂(Measure.infinitePi (fun _ : ℕ ↦ obsLaw P))
Proof (Lean source)
lemma componentErrorMSE_productLaw_eq_infinite_trunc {n d : ℕ} (P : DiscreteLaw d) (component target : (Fin n → Obs d) → ℝ) : componentErrorMSE (productLaw P n) component target = ∫ ω : ℕ → Obs d, (component (fun i : Fin n ↦ ω i) - target (fun i : Fin n ↦ ω i)) ^ 2 ∂(Measure.infinitePi (fun _ : ℕ ↦ obsLaw P)) := by unfold componentErrorMSE exact integral_productLaw_eq_infinite_trunc P _
CausalSmith.Stat.DiscreteAteMinimaxLoggap.componentErrorMSE_productLaw_eq_infinite_trunc · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCell.lean:45
def targetHeavy

Defines target Heavy, the stated quantity or construction used in the discrete average-treatment-effect estimator.

Definition (Lean source)
noncomputable def targetHeavy {n d : ℕ} (P : DiscreteLaw d) (sample : Fin n → Obs d) : ℝ := ∑ k ∈ heavyCells sample, cellPhi (cellVector P k)
CausalSmith.Stat.DiscreteAteMinimaxLoggap.targetHeavy · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCell.lean:57
def fixedHeavyContribution

Defines fixed Heavy Contribution, the stated quantity or construction used in the discrete average-treatment-effect estimator.

Definition (Lean source)
noncomputable def fixedHeavyContribution {n d : ℕ} (sample : Fin n → Obs d) (H : Finset (Fin d)) : ℝ := ∑ k ∈ H, empiricalRatioCell sample k
CausalSmith.Stat.DiscreteAteMinimaxLoggap.fixedHeavyContribution · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCell.lean:62
def fixedTargetHeavy

Defines fixed Target Heavy, the stated quantity or construction used in the discrete average-treatment-effect estimator.

Definition (Lean source)
noncomputable def fixedTargetHeavy {d : ℕ} (P : DiscreteLaw d) (H : Finset (Fin d)) : ℝ := ∑ k ∈ H, cellPhi (cellVector P k)
CausalSmith.Stat.DiscreteAteMinimaxLoggap.fixedTargetHeavy · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCell.lean:67
def fixedHeavyArmContribution

Defines fixed Heavy Arm Contribution, the stated quantity or construction used in the discrete average-treatment-effect estimator.

Definition (Lean source)
noncomputable def fixedHeavyArmContribution {n d : ℕ} (sample : Fin n → Obs d) (H : Finset (Fin d)) (a : Fin 2) : ℝ := ∑ k ∈ H, (splitCategoryCount sample 1 k : ℝ) / splitSize n 1 * ((splitCellCount sample 1 k a 1 : ℝ) / (splitCellCount sample 1 k a 0 + splitCellCount sample 1 k a 1 : ℕ))
CausalSmith.Stat.DiscreteAteMinimaxLoggap.fixedHeavyArmContribution · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCell.lean:72
def fixedTargetArm

Defines fixed Target Arm, the stated quantity or construction used in the discrete average-treatment-effect estimator.

Definition (Lean source)
noncomputable def fixedTargetArm {d : ℕ} (P : DiscreteLaw d) (H : Finset (Fin d)) (a : Fin 2) : ℝ := ∑ k ∈ H, cellMass P k * outcomeMean P (finTwoEquiv a) k
CausalSmith.Stat.DiscreteAteMinimaxLoggap.fixedTargetArm · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCell.lean:80
def fixedEmpiricalMassArm

Defines fixed Empirical Mass Arm, the stated quantity or construction used in the discrete average-treatment-effect estimator.

Definition (Lean source)
noncomputable def fixedEmpiricalMassArm {n d : ℕ} (P : DiscreteLaw d) (sample : Fin n → Obs d) (H : Finset (Fin d)) (a : Fin 2) : ℝ := ∑ k ∈ H, (splitCategoryCount sample 1 k : ℝ) / splitSize n 1 * outcomeMean P (finTwoEquiv a) k
CausalSmith.Stat.DiscreteAteMinimaxLoggap.fixedEmpiricalMassArm · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCell.lean:85
def fixedMassScore

One-observation bounded score whose sample mean is the empirical category-mass centering of a fixed arm.

Definition (Lean source)
noncomputable def fixedMassScore {d : ℕ} (P : DiscreteLaw d) (H : Finset (Fin d)) (a : Fin 2) (z : Obs d) : ℝ := ∑ k ∈ H, if z.1 = k then outcomeMean P (finTwoEquiv a) k else 0
CausalSmith.Stat.DiscreteAteMinimaxLoggap.fixedMassScore · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCell.lean:92
theorem fixedMassScore_eq

The fixed-mass score of an observation reduces to a single lookup: it returns the outcome regression of the given treatment arm at the observation's own category when that category belongs to the selected set, and zero otherwise.

Formal statement
d :
P :
H :
a :
Fin 2
z :
Obs d
fixedMassScore P H a z = if z.1 ∈ H then outcomeMean P (finTwoEquiv a) z.1 else 0
Proof (Lean source)
lemma fixedMassScore_eq {d : ℕ} (P : DiscreteLaw d) (H : Finset (Fin d)) (a : Fin 2) (z : Obs d) : fixedMassScore P H a z = if z.1 ∈ H then outcomeMean P (finTwoEquiv a) z.1 else 0 := by classical unfold fixedMassScore by_cases hz : z.1 ∈ H · rw [Finset.sum_eq_single z.1] · simp [hz] · intro k hk hne simp [hne.symm] · intro hnot exact (hnot hz).elim · rw [if_neg hz] apply Finset.sum_eq_zero intro k hk have hne : z.1 ≠ k := fun h => hz (h ▸ hk) simp [hne]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.fixedMassScore_eq · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCell.lean:98
theorem fixedMassScore_mem_unitInterval

Shows that fixed Mass Score mem unit Interval lies in the stated set or interval.

Formal statement
d :
P :
H :
a :
Fin 2
z :
Obs d
fixedMassScore P H a z ∈ Icc (0 : ℝ) 1
Proof (Lean source)
lemma fixedMassScore_mem_unitInterval {d : ℕ} (P : DiscreteLaw d) (H : Finset (Fin d)) (a : Fin 2) (z : Obs d) : fixedMassScore P H a z ∈ Icc (0 : ℝ) 1 := by rw [fixedMassScore_eq] split_ifs · exact outcomeMean_mem_unitInterval P (finTwoEquiv a) z.1 · exact ⟨le_rfl, zero_le_one⟩
CausalSmith.Stat.DiscreteAteMinimaxLoggap.fixedMassScore_mem_unitInterval · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCell.lean:120
theorem integral_fixedMassScore_eq

Evaluates or bounds the stated integral involving integral fixed Mass Score eq.

Formal statement
d :
P :
H :
a :
Fin 2
∫ z, fixedMassScore P H a z ∂obsLaw P = fixedTargetArm P H a
Proof (Lean source)
lemma integral_fixedMassScore_eq {d : ℕ} (P : DiscreteLaw d) (H : Finset (Fin d)) (a : Fin 2) : ∫ z, fixedMassScore P H a z ∂obsLaw P = fixedTargetArm P H a := by classical unfold fixedMassScore fixedTargetArm rw [integral_finset_sum H (fun _ _ => Integrable.of_finite)] apply Finset.sum_congr rfl intro k hk rw [show (fun z : Obs d => if z.1 = k then outcomeMean P (finTwoEquiv a) k else 0) = (categorySet k).indicator (fun _ => outcomeMean P (finTwoEquiv a) k) by funext z simp only [categorySet, indicator, Set.mem_setOf_eq]] rw [integral_indicator MeasurableSet.of_discrete] simp [obsLaw_categorySet_mass]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.integral_fixedMassScore_eq · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCell.lean:129
theorem heavyContribution_eq_fixed

Establishes the stated equality relating heavy Contribution eq fixed.

Formal statement
n d :
sample :
Fin n → Obs d
Proof (Lean source)
lemma heavyContribution_eq_fixed {n d : ℕ} (sample : Fin n → Obs d) : heavyContribution sample = fixedHeavyContribution sample (heavyCells sample) := rfl
CausalSmith.Stat.DiscreteAteMinimaxLoggap.heavyContribution_eq_fixed · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCell.lean:147
theorem targetHeavy_eq_fixed

Establishes the stated equality relating target Heavy eq fixed.

Formal statement
n d :
P :
sample :
Fin n → Obs d
Proof (Lean source)
lemma targetHeavy_eq_fixed {n d : ℕ} (P : DiscreteLaw d) (sample : Fin n → Obs d) : targetHeavy P sample = fixedTargetHeavy P (heavyCells sample) := rfl
CausalSmith.Stat.DiscreteAteMinimaxLoggap.targetHeavy_eq_fixed · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCell.lean:151
theorem fixedHeavyContribution_eq_arm_sub

Establishes the stated equality relating fixed Heavy Contribution eq arm sub.

Formal statement
n d :
sample :
Fin n → Obs d
H :
Proof (Lean source)
lemma fixedHeavyContribution_eq_arm_sub {n d : ℕ} (sample : Fin n → Obs d) (H : Finset (Fin d)) : fixedHeavyContribution sample H = fixedHeavyArmContribution sample H 1 - fixedHeavyArmContribution sample H 0 := by unfold fixedHeavyContribution fixedHeavyArmContribution empiricalRatioCell simp_rw [mul_sub] rw [Finset.sum_sub_distrib]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.fixedHeavyContribution_eq_arm_sub · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCell.lean:156
theorem fixedHeavyArm_error_sq_le_noise_mass

Establishes the stated upper bound for fixed Heavy Arm error sq le noise mass.

Formal statement
n d :
P :
sample :
Fin n → Obs d
H :
a :
Fin 2
(fixedHeavyArmContribution sample H a - fixedTargetArm P H a) ^ 2
≤ 2 * (fixedHeavyArmContribution sample H a - fixedEmpiricalMassArm P sample H a) ^ 2
+ 2 * (fixedEmpiricalMassArm P sample H a - fixedTargetArm P H a) ^ 2
Proof (Lean source)
lemma fixedHeavyArm_error_sq_le_noise_mass {n d : ℕ} (P : DiscreteLaw d) (sample : Fin n → Obs d) (H : Finset (Fin d)) (a : Fin 2) : (fixedHeavyArmContribution sample H a - fixedTargetArm P H a) ^ 2 ≤ 2 * (fixedHeavyArmContribution sample H a - fixedEmpiricalMassArm P sample H a) ^ 2 + 2 * (fixedEmpiricalMassArm P sample H a - fixedTargetArm P H a) ^ 2 := by nlinarith [sq_nonneg ((fixedHeavyArmContribution sample H a - fixedEmpiricalMassArm P sample H a) - (fixedEmpiricalMassArm P sample H a - fixedTargetArm P H a))]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.fixedHeavyArm_error_sq_le_noise_mass · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCell.lean:165
theorem heavyCells_eq_pilotHeavyAt_of_cutoff_le

Above the calibration cutoff, the estimator's heavy set is exactly the pilot set controlled by the sandwich theorem at its calibrated threshold.

Formal statement
n d :
sample :
Fin n → Obs d
hcut :
heavyCells sample = pilotHeavyAt sample 256
Proof (Lean source)
lemma heavyCells_eq_pilotHeavyAt_of_cutoff_le {n d : ℕ} (sample : Fin n → Obs d) (hcut : calibrationCutoff ≤ n) : heavyCells sample = pilotHeavyAt sample 256 := by classical rw [heavyCells_eq_filter_of_cutoff_le sample hcut] ext k simp only [pilotHeavyAt, mem_filter, Finset.mem_univ, true_and] simp only [lambda0] exact (Int.floor_lt).symm
CausalSmith.Stat.DiscreteAteMinimaxLoggap.heavyCells_eq_pilotHeavyAt_of_cutoff_le · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCell.lean:176
theorem heavy_cell_mass_lower_of_good_pilot

On the pilot-sandwich event, every selected heavy category has the deterministic mass lower bound required by the missing-arm estimates.

Formal statement
n d :
P :
sample :
Fin n → Obs d
hcut :
hgood :
sample ∉ pilotBadEvent P 256
∀ k ∈ heavyCells sample, 256 * logScale n / (2 * splitSize n 0) ≤ cellMass P k
Proof (Lean source)
lemma heavy_cell_mass_lower_of_good_pilot {n d : ℕ} (P : DiscreteLaw d) (sample : Fin n → Obs d) (hcut : calibrationCutoff ≤ n) (hgood : sample ∉ pilotBadEvent P 256) : ∀ k ∈ heavyCells sample, 256 * logScale n / (2 * splitSize n 0) ≤ cellMass P k := by have hsand : (∀ k ∈ pilotHeavyAt sample 256, 256 * logScale n / (2 * splitSize n 0) ≤ cellMass P k) ∧ (∀ k ∉ pilotHeavyAt sample 256, cellMass P k ≤ 2 * 256 * logScale n / splitSize n 0) := by simpa only [pilotBadEvent, Set.mem_setOf_eq, not_or, not_not] using hgood rw [heavyCells_eq_pilotHeavyAt_of_cutoff_le sample hcut] exact hsand.1
CausalSmith.Stat.DiscreteAteMinimaxLoggap.heavy_cell_mass_lower_of_good_pilot · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCell.lean:188
theorem splitCellCount_le_splitCategoryCount

Within one half of the split, the number of observations falling in a single treatment-outcome cell of a category never exceeds the number of observations falling in that category.

Formal statement
n d :
sample :
Fin n → Obs d
j :
Fin 2
k :
Fin d
a y :
Fin 2
splitCellCount sample j k a y ≤ splitCategoryCount sample j k
Proof (Lean source)
lemma splitCellCount_le_splitCategoryCount {n d : ℕ} (sample : Fin n → Obs d) (j : Fin 2) (k : Fin d) (a y : Fin 2) : splitCellCount sample j k a y ≤ splitCategoryCount sample j k := by rw [splitCategoryCount_eq_sum_cell] calc splitCellCount sample j k a y ≤ ∑ y' : Fin 2, splitCellCount sample j k a y' := Finset.single_le_sum (fun _ _ => zero_le _) (Finset.mem_univ y) _ ≤ ∑ a' : Fin 2, ∑ y' : Fin 2, splitCellCount sample j k a' y' := Finset.single_le_sum (fun _ _ => sum_nonneg fun _ _ => zero_le _) (Finset.mem_univ a)
CausalSmith.Stat.DiscreteAteMinimaxLoggap.splitCellCount_le_splitCategoryCount · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCell.lean:204
def splitTuple

The tuple obtained by restricting a finite sample to one deterministic split.

Definition (Lean source)
noncomputable def splitTuple {n d : ℕ} (sample : Fin n → Obs d) (j : Fin 2) : {i : Fin n // i ∈ splitIndices n j} → Obs d := fun i => sample i.1
CausalSmith.Stat.DiscreteAteMinimaxLoggap.splitTuple · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCell.lean:220
theorem indexSet_splitTuple_category_card

The abstract category index set is exactly the implemented split category count.

Formal statement
n d :
sample :
Fin n → Obs d
j :
Fin 2
k :
Fin d
(indexSet (splitTuple sample j) (categorySet k)).card = splitCategoryCount sample j k
Proof (Lean source)
lemma indexSet_splitTuple_category_card {n d : ℕ} (sample : Fin n → Obs d) (j : Fin 2) (k : Fin d) : (indexSet (splitTuple sample j) (categorySet k)).card = splitCategoryCount sample j k := by classical unfold indexSet splitTuple categorySet splitCategoryCount apply Finset.card_bij (fun i _hi => i.1) · intro i hi simp only [mem_filter, Finset.mem_univ, true_and] at hi exact Finset.mem_filter.mpr ⟨i.2, hi⟩ · intro i₁ hi₁ i₂ hi₂ heq exact Subtype.ext heq · intro b hb simp only [mem_filter] at hb exact ⟨⟨b, hb.1⟩, by simp [hb.2], rfl⟩
CausalSmith.Stat.DiscreteAteMinimaxLoggap.indexSet_splitTuple_category_card · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCell.lean:226
theorem indexSet_splitTuple_arm_card

The abstract nested arm index set is exactly the sum of the two implemented outcome counts in that arm.

Formal statement
n d :
sample :
Fin n → Obs d
j :
Fin 2
k :
Fin d
a :
Fin 2
(indexSet (splitTuple sample j) (categoryArmSet k (finTwoEquiv a))).card
= splitCellCount sample j k a 0 + splitCellCount sample j k a 1
Proof (Lean source)
lemma indexSet_splitTuple_arm_card {n d : ℕ} (sample : Fin n → Obs d) (j : Fin 2) (k : Fin d) (a : Fin 2) : (indexSet (splitTuple sample j) (categoryArmSet k (finTwoEquiv a))).card = splitCellCount sample j k a 0 + splitCellCount sample j k a 1 := by classical unfold indexSet splitTuple categoryArmSet splitCellCount rw [← Finset.card_union_of_disjoint] · apply Finset.card_bij (fun i _hi => i.1) · intro i hi simp only [mem_filter, Finset.mem_univ, true_and] at hi rcases hi with ⟨hx, ha⟩ rcases (show (sample i.1).2.2 = false ∨ (sample i.1).2.2 = true by cases (sample i.1).2.2 <;> simp) with hy | hy · apply mem_union_left exact Finset.mem_filter.mpr ⟨i.2, by ext <;> simp_all [finTwoEquiv]⟩ · apply mem_union_right exact Finset.mem_filter.mpr ⟨i.2, by ext <;> simp_all [finTwoEquiv]⟩ · intro i₁ hi₁ i₂ hi₂ heq exact Subtype.ext heq · intro b hb simp only [mem_union, mem_filter] at hb rcases hb with hb | hb · exact ⟨⟨b, hb.1⟩, by simp only [mem_filter, Finset.mem_univ, true_and] exact ⟨by simpa using congrArg fst hb.2, by simpa using congrArg (fun z => z.2.1) hb.2⟩, rfl⟩ · exact ⟨⟨b, hb.1⟩, by simp only [mem_filter, Finset.mem_univ, true_and] exact ⟨by simpa using congrArg fst hb.2, by simpa using congrArg (fun z => z.2.1) hb.2⟩, rfl⟩ · apply Finset.disjoint_left.mpr intro i hi0 hi1 simp only [mem_filter] at hi0 hi1 have hy0 := congrArg (fun z => z.2.2) hi0.2 have hy1 := congrArg (fun z => z.2.2) hi1.2 simp [finTwoEquiv] at hy0 hy1 rw [hy0] at hy1 simp at hy1
CausalSmith.Stat.DiscreteAteMinimaxLoggap.indexSet_splitTuple_arm_card · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCell.lean:244
theorem missingIndexCount_splitTuple

Establishes the stated upper bound for missing Index Count split Tuple.

Formal statement
n d :
sample :
Fin n → Obs d
j :
Fin 2
k :
Fin d
a :
Fin 2
= if splitCellCount sample j k a 0
+ splitCellCount sample j k a 1 = 0 then splitCategoryCount sample j k else 0
Proof (Lean source)
lemma missingIndexCount_splitTuple {n d : ℕ} (sample : Fin n → Obs d) (j : Fin 2) (k : Fin d) (a : Fin 2) : missingIndexCount (splitTuple sample j) (categorySet k) (categoryArmSet k (finTwoEquiv a)) = if splitCellCount sample j k a 0 + splitCellCount sample j k a 1 = 0 then splitCategoryCount sample j k else 0 := by unfold missingIndexCount rw [indexSet_splitTuple_category_card, indexSet_splitTuple_arm_card]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.missingIndexCount_splitTuple · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCell.lean:288
theorem sum_armOutcomeResidual_splitTuple

The abstract residual sum on a split tuple is the implemented arm-success count minus its conditional-mean centering.

Formal statement
n d :
P :
sample :
Fin n → Obs d
j :
Fin 2
k :
Fin d
a :
Fin 2
(∑ i, armOutcomeResidual P k a (splitTuple sample j i))
= (splitCellCount sample j k a 1 : ℝ)
- outcomeMean P (finTwoEquiv a) k * (splitCellCount sample j k a 0 + splitCellCount sample j k a 1 : ℕ)
Proof (Lean source)
lemma sum_armOutcomeResidual_splitTuple {n d : ℕ} (P : DiscreteLaw d) (sample : Fin n → Obs d) (j : Fin 2) (k : Fin d) (a : Fin 2) : (∑ i, armOutcomeResidual P k a (splitTuple sample j i)) = (splitCellCount sample j k a 1 : ℝ) - outcomeMean P (finTwoEquiv a) k * (splitCellCount sample j k a 0 + splitCellCount sample j k a 1 : ℕ) := by classical unfold armOutcomeResidual splitTuple splitCellCount simp only [Finset.card_eq_sum_ones, Nat.cast_sum, cast_one] simp_rw [Finset.sum_filter] rw [show (∑ x : { i // i ∈ splitIndices n j }, if (sample x.val).fst = k ∧ (sample x.val).snd.fst = finTwoEquiv a then (if (sample x.val).snd.snd then 1 else 0) - outcomeMean P (finTwoEquiv a) k else 0) = ∑ i ∈ splitIndices n j, if (sample i).fst = k ∧ (sample i).snd.fst = finTwoEquiv a then (if (sample i).snd.snd then 1 else 0) - outcomeMean P (finTwoEquiv a) k else 0 by exact (Finset.sum_subtype (splitIndices n j) (fun _ => Iff.rfl) (fun i => if (sample i).fst = k ∧ (sample i).snd.fst = finTwoEquiv a then (if (sample i).snd.snd then 1 else 0) - outcomeMean P (finTwoEquiv a) k else 0)).symm] rw [← Finset.sum_add_distrib, Nat.cast_sum] simp_rw [Nat.cast_add, Nat.cast_ite, cast_one, cast_zero] rw [Finset.mul_sum, ← Finset.sum_sub_distrib] apply Finset.sum_congr rfl intro i hi fin_cases a <;> rcases (sample i) with ⟨x, aa, y⟩ <;> fin_cases aa <;> fin_cases y <;> by_cases hx : x = k <;> simp [finTwoEquiv, hx] <;> ring
CausalSmith.Stat.DiscreteAteMinimaxLoggap.sum_armOutcomeResidual_splitTuple · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCell.lean:298
theorem productLaw_map_splitTuple

Restricting the canonical finite product sample to either deterministic split again has the corresponding finite product law.

Formal statement
n d :
P :
j :
Fin 2
(productLaw P n).map (fun sample => splitTuple sample j)
= Measure.pi (fun _ : {i : Fin n // i ∈ splitIndices n j} => obsLaw P)
Proof (Lean source)
lemma productLaw_map_splitTuple {n d : ℕ} (P : DiscreteLaw d) (j : Fin 2) : (productLaw P n).map (fun sample => splitTuple sample j) = Measure.pi (fun _ : {i : Fin n // i ∈ splitIndices n j} => obsLaw P) := map_pi_restrict_finset (obsLaw P) (splitIndices n j)
CausalSmith.Stat.DiscreteAteMinimaxLoggap.productLaw_map_splitTuple · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCell.lean:336
theorem integral_comp_splitTuple

Integral transport from the full sample to either deterministic split.

Formal statement
n d :
P :
j :
Fin 2
g :
({i : Fin n // i ∈ splitIndices n j} → Obs d) → ℝ
∫ sample : Fin n → Obs d, g (splitTuple sample j) ∂productLaw P n
= ∫ z, g z ∂Measure.pi (fun _ : {i : Fin n // i ∈ splitIndices n j} => obsLaw P)
Proof (Lean source)
lemma integral_comp_splitTuple {n d : ℕ} (P : DiscreteLaw d) (j : Fin 2) (g : ({i : Fin n // i ∈ splitIndices n j} → Obs d) → ℝ) : ∫ sample : Fin n → Obs d, g (splitTuple sample j) ∂productLaw P n = ∫ z, g z ∂Measure.pi (fun _ : {i : Fin n // i ∈ splitIndices n j} => obsLaw P) := integral_comp_pi_restrict_finset (obsLaw P) (splitIndices n j) g
CausalSmith.Stat.DiscreteAteMinimaxLoggap.integral_comp_splitTuple · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCell.lean:345
theorem sum_fixedMassScore_splitTuple

Summing the fixed-mass score over the observations of one half of the split gives the sum, over the selected categories, of each category's count in that half times its outcome regression for the given treatment arm.

Formal statement
n d :
P :
sample :
Fin n → Obs d
j :
Fin 2
H :
a :
Fin 2
∑ i, fixedMassScore P H a (splitTuple sample j i)
= ∑ k ∈ H, (splitCategoryCount sample j k : ℝ) * outcomeMean P (finTwoEquiv a) k
Proof (Lean source)
lemma sum_fixedMassScore_splitTuple {n d : ℕ} (P : DiscreteLaw d) (sample : Fin n → Obs d) (j : Fin 2) (H : Finset (Fin d)) (a : Fin 2) : ∑ i, fixedMassScore P H a (splitTuple sample j i) = ∑ k ∈ H, (splitCategoryCount sample j k : ℝ) * outcomeMean P (finTwoEquiv a) k := by classical unfold fixedMassScore splitTuple splitCategoryCount rw [Finset.sum_comm] apply Finset.sum_congr rfl intro k hk rw [show (∑ x : { i // i ∈ splitIndices n j }, if (sample x.val).fst = k then outcomeMean P (finTwoEquiv a) k else 0) = (∑ x : { i // i ∈ splitIndices n j }, if (sample x.val).fst = k then (1 : ℝ) else 0) * outcomeMean P (finTwoEquiv a) k by rw [Finset.sum_mul] apply Finset.sum_congr rfl intro x hx by_cases h : (sample x.val).fst = k <;> simp [h]] congr 1 rw [show (∑ x : { i // i ∈ splitIndices n j }, if (sample x.val).fst = k then (1 : ℝ) else 0) = ∑ i ∈ splitIndices n j, if (sample i).fst = k then (1 : ℝ) else 0 by exact (Finset.sum_subtype (splitIndices n j) (fun _ => Iff.rfl) (fun i => if (sample i).fst = k then (1 : ℝ) else 0)).symm] simp
CausalSmith.Stat.DiscreteAteMinimaxLoggap.sum_fixedMassScore_splitTuple · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCell.lean:353
theorem fixedEmpiricalMassArm_sub_target_eq_score

Establishes the stated equality relating fixed Empirical Mass Arm sub target eq score.

Formal statement
n d :
P :
sample :
Fin n → Obs d
H :
a :
Fin 2
= (∑ i, fixedMassScore P H a (splitTuple sample 1 i)) / splitSize n 1
Proof (Lean source)
lemma fixedEmpiricalMassArm_sub_target_eq_score {n d : ℕ} (P : DiscreteLaw d) (sample : Fin n → Obs d) (H : Finset (Fin d)) (a : Fin 2) : fixedEmpiricalMassArm P sample H a - fixedTargetArm P H a = (∑ i, fixedMassScore P H a (splitTuple sample 1 i)) / splitSize n 1 - fixedTargetArm P H a := by unfold fixedEmpiricalMassArm rw [sum_fixedMassScore_splitTuple] rw [Finset.sum_div] apply congrArg (fun x : ℝ => x - fixedTargetArm P H a) apply Finset.sum_congr rfl intro k hk ring
CausalSmith.Stat.DiscreteAteMinimaxLoggap.fixedEmpiricalMassArm_sub_target_eq_score · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCell.lean:386
theorem integral_fixedEmpiricalMassArm_sub_target_sq_le

A fixed empirical category-mass arm score has variance at most one over the estimation-fold size.

Formal statement
n d :
P :
H :
a :
Fin 2
hm :
0 < splitSize n 1
∫ sample : Fin n → Obs d, (fixedEmpiricalMassArm P sample H a - fixedTargetArm P H a) ^ 2 ∂productLaw P n
≤ 1 / (splitSize n 1 : ℝ)
Proof (Lean source)
lemma integral_fixedEmpiricalMassArm_sub_target_sq_le {n d : ℕ} (P : DiscreteLaw d) (H : Finset (Fin d)) (a : Fin 2) (hm : 0 < splitSize n 1) : ∫ sample : Fin n → Obs d, (fixedEmpiricalMassArm P sample H a - fixedTargetArm P H a) ^ 2 ∂productLaw P n ≤ 1 / (splitSize n 1 : ℝ) := by classical let J := {i : Fin n // i ∈ splitIndices n (1 : Fin 2)} have hmcard : Fintype.card J = splitSize n 1 := by simp [J, splitSize] haveI : Nonempty J := by rw [← card_pos_iff, hmcard]; exact hm have hg01 : ∀ z, fixedMassScore P H a z ∈ Icc (0 : ℝ) 1 := fixedMassScore_mem_unitInterval P H a -- The estimation-fold average of the bounded score IS the empirical mass arm. have hrewrite : (∫ sample : Fin n → Obs d, (fixedEmpiricalMassArm P sample H a - fixedTargetArm P H a) ^ 2 ∂productLaw P n) = ∫ z : J → Obs d, ((Fintype.card J : ℝ)⁻¹ * (∑ i, fixedMassScore P H a (z i)) - ∫ x, fixedMassScore P H a x ∂obsLaw P) ^ 2 ∂Measure.pi (fun _ : J => obsLaw P) := by rw [← integral_comp_splitTuple P 1 (fun z => ((Fintype.card J : ℝ)⁻¹ * (∑ i, fixedMassScore P H a (z i)) - ∫ x, fixedMassScore P H a x ∂obsLaw P) ^ 2)] refine integral_congr_ae (Filter.Eventually.of_forall fun sample => ?_) simp only [integral_fixedMassScore_eq, hmcard] rw [fixedEmpiricalMassArm_sub_target_eq_score, div_eq_inv_mul] rw [hrewrite] -- Second moment of a `[0,1]`-valued score is at most one. have hsq : ∫ z, (fixedMassScore P H a z) ^ 2 ∂obsLaw P ≤ 1 := by have hle : ∫ z, (fixedMassScore P H a z) ^ 2 ∂obsLaw P ≤ ∫ _z : Obs d, (1 : ℝ) ∂obsLaw P := integral_mono Integrable.of_finite (integrable_const 1) fun z => by nlinarith [(hg01 z).1, (hg01 z).2] simpa using hle have hscoreLp : MemLp (fixedMassScore P H a) 2 (obsLaw P) := MemLp.of_bound (measurable_of_finite _).aestronglyMeasurable 1 (ae_of_all _ fun z => abs_le.mpr ⟨by linarith [(hg01 z).1], (hg01 z).2⟩) refine le_trans (iid_mean_sq_le_fintype (ι := J) (obsLaw P) (fixedMassScore P H a) hscoreLp) ?_ rw [hmcard] have hmR : (0 : ℝ) < (splitSize n 1 : ℝ) := by exact_mod_cast hm rw [div_le_div_iff_of_pos_right hmR] exact hsq
CausalSmith.Stat.DiscreteAteMinimaxLoggap.integral_fixedEmpiricalMassArm_sub_target_sq_le · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCell.lean:401
theorem fixedHeavyArm_noise_decomposition

Exact pointwise decomposition of the implemented arm ratio error about its empirical category-mass centering. The first term is centered ratio noise; the second is precisely the bias from an unobserved treatment arm.

Formal statement
n d :
P :
sample :
Fin n → Obs d
H :
a :
Fin 2
Proof (Lean source)
lemma fixedHeavyArm_noise_decomposition {n d : ℕ} (P : DiscreteLaw d) (sample : Fin n → Obs d) (H : Finset (Fin d)) (a : Fin 2) : fixedHeavyArmContribution sample H a - fixedEmpiricalMassArm P sample H a = (fixedRatioResidual P (splitTuple sample 1) H a - fixedMissingOutcomeBias P (splitTuple sample 1) H a) / splitSize n 1 := by classical unfold fixedHeavyArmContribution fixedEmpiricalMassArm fixedRatioResidual fixedMissingOutcomeBias tupleRatioCoeff rw [← Finset.sum_sub_distrib] rw [sub_div, Finset.sum_div, Finset.sum_div, ← Finset.sum_sub_distrib] apply Finset.sum_congr rfl intro k hk rw [indexSet_splitTuple_category_card, indexSet_splitTuple_arm_card, sum_armOutcomeResidual_splitTuple, missingIndexCount_splitTuple] let N : ℕ := splitCategoryCount sample 1 k let D : ℕ := splitCellCount sample 1 k a 0 + splitCellCount sample 1 k a 1 let Y : ℕ := splitCellCount sample 1 k a 1 let m : ℕ := splitSize n 1 let mu : ℝ := outcomeMean P (finTwoEquiv a) k change (N : ℝ) / m * ((Y : ℝ) / D) - (N : ℝ) / m * mu = ((N : ℝ) * (if 0 < D then (D : ℝ)⁻¹ else 0) * ((Y : ℝ) - mu * D)) / m - mu * (if D = 0 then N else 0) / m by_cases hD : 0 < D · have hD0 : D ≠ 0 := Nat.ne_of_gt hD rw [if_pos hD, if_neg hD0] field_simp ring · have hDz : D = 0 := Nat.eq_zero_of_not_pos hD simp [hD, hDz] ring
CausalSmith.Stat.DiscreteAteMinimaxLoggap.fixedHeavyArm_noise_decomposition · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCell.lean:448
theorem integral_fixedHeavyArm_noise_sq_le

Fixed-set product-law MSE of the arm ratio about its empirical mass centering. The first two terms are parametric ratio and missing-label diagonals; the final term is the aggregate exponentially damped missing-arm bias envelope.

Formal statement
n d :
epsilon B :
P :
H :
a :
Fin 2
hm :
3 ≤ splitSize n 1
hOverlap :
Overlap epsilon P
hepsilon :
0 < epsilon
hB :
0 < B
hp :
∀ k ∈ H, B ≤ cellMass P k
∫ sample : Fin n → Obs d, (fixedHeavyArmContribution sample H a - fixedEmpiricalMassArm P sample H a) ^ 2 ∂productLaw P n
≤ 4 * (∑ k ∈ H, cellMass P k) / ((splitSize n 1 : ℝ) * epsilon)
+ 2 / (splitSize n 1 : ℝ)
+ 2 * (H.card / (((((splitSize n 1 - 2 : ℕ) : ℝ) / 2 * epsilon) ^ 2) * B)) ^ 2
Proof (Lean source)
lemma integral_fixedHeavyArm_noise_sq_le {n d : ℕ} {epsilon B : ℝ} (P : DiscreteLaw d) (H : Finset (Fin d)) (a : Fin 2) (hm : 3 ≤ splitSize n 1) (hOverlap : Overlap epsilon P) (hepsilon : 0 < epsilon) (hB : 0 < B) (hp : ∀ k ∈ H, B ≤ cellMass P k) : ∫ sample : Fin n → Obs d, (fixedHeavyArmContribution sample H a - fixedEmpiricalMassArm P sample H a) ^ 2 ∂productLaw P n ≤ 4 * (∑ k ∈ H, cellMass P k) / ((splitSize n 1 : ℝ) * epsilon) + 2 / (splitSize n 1 : ℝ) + 2 * (H.card / (((((splitSize n 1 - 2 : ℕ) : ℝ) / 2 * epsilon) ^ 2) * B)) ^ 2 := by classical let J := {i : Fin n // i ∈ splitIndices n (1 : Fin 2)} let m : ℝ := splitSize n 1 let R : (Fin n → Obs d) → ℝ := fun sample => fixedRatioResidual P (splitTuple sample 1) H a let M : (Fin n → Obs d) → ℝ := fun sample => fixedMissingOutcomeBias P (splitTuple sample 1) H a have hmcard : Fintype.card J = splitSize n 1 := by simp [J, splitSize] have hmpos : 0 < m := by dsimp [m]; positivity have hpoint : ∀ sample : Fin n → Obs d, (fixedHeavyArmContribution sample H a - fixedEmpiricalMassArm P sample H a) ^ 2 ≤ 2 / m ^ 2 * (R sample) ^ 2 + 2 / m ^ 2 * (M sample) ^ 2 := by intro sample rw [fixedHeavyArm_noise_decomposition] dsimp only [R, M, m] have hsq := sq_nonneg (fixedRatioResidual P (splitTuple sample 1) H a + fixedMissingOutcomeBias P (splitTuple sample 1) H a) field_simp nlinarith have hR : ∫ sample : Fin n → Obs d, (R sample) ^ 2 ∂productLaw P n ≤ (2 * m / epsilon) * ∑ k ∈ H, cellMass P k := by rw [show (∫ sample : Fin n → Obs d, (R sample) ^ 2 ∂productLaw P n) = ∫ z : J → Obs d, (fixedRatioResidual P z H a) ^ 2 ∂Measure.pi (fun _ : J => obsLaw P) by simpa only [R, J] using integral_comp_splitTuple P 1 (fun z => (fixedRatioResidual P z H a) ^ 2)] simpa [m, hmcard] using integral_fixedRatioResidual_sq_le (I := J) P hOverlap hepsilon H a (fun k hk => hB.trans_le (hp k hk)) have hM : ∫ sample : Fin n → Obs d, (M sample) ^ 2 ∂productLaw P n ≤ m + m ^ 2 * (H.card / (((((splitSize n 1 - 2 : ℕ) : ℝ) / 2 * epsilon) ^ 2) * B)) ^ 2 := by rw [show (∫ sample : Fin n → Obs d, (M sample) ^ 2 ∂productLaw P n) = ∫ z : J → Obs d, (fixedMissingOutcomeBias P z H a) ^ 2 ∂Measure.pi (fun _ : J => obsLaw P) by simpa only [M, J] using integral_comp_splitTuple P 1 (fun z => (fixedMissingOutcomeBias P z H a) ^ 2)] calc _ ≤ ∫ z : J → Obs d, (fixedMissingCount z H (finTwoEquiv a)) ^ 2 ∂Measure.pi (fun _ : J => obsLaw P) := by apply integral_mono (Integrable.of_finite) (Integrable.of_finite) intro z exact fixedMissingOutcomeBias_sq_le P z H a _ ≤ (Fintype.card J : ℝ) + (Fintype.card J : ℝ) ^ 2 * (H.card / (((((Fintype.card J - 2 : ℕ) : ℝ) / 2 * epsilon) ^ 2) * B)) ^ 2 := integral_fixedMissingCount_sq_le P H (finTwoEquiv a) (by simpa [hmcard] using hm) hOverlap hepsilon hB hp _ = m + m ^ 2 * (H.card / (((((splitSize n 1 - 2 : ℕ) : ℝ) / 2 * epsilon) ^ 2) * B)) ^ 2 := by simp [hmcard, m] calc _ ≤ ∫ sample : Fin n → Obs d, (2 / m ^ 2 * (R sample) ^ 2 + 2 / m ^ 2 * (M sample) ^ 2) ∂productLaw P n := by apply integral_mono (Integrable.of_finite) (Integrable.of_finite) exact hpoint _ = 2 / m ^ 2 * (∫ sample : Fin n → Obs d, (R sample) ^ 2 ∂productLaw P n) + 2 / m ^ 2 * (∫ sample : Fin n → Obs d, (M sample) ^ 2 ∂productLaw P n) := by rw [integral_add Integrable.of_finite Integrable.of_finite, integral_const_mul, integral_const_mul] _ ≤ 2 / m ^ 2 * ((2 * m / epsilon) * ∑ k ∈ H, cellMass P k) + 2 / m ^ 2 * (m + m ^ 2 * (H.card / (((((splitSize n 1 - 2 : ℕ) : ℝ) / 2 * epsilon) ^ 2) * B)) ^ 2) := by gcongr _ = 4 * (∑ k ∈ H, cellMass P k) / ((splitSize n 1 : ℝ) * epsilon) + 2 / (splitSize n 1 : ℝ) + 2 * (H.card / (((((splitSize n 1 - 2 : ℕ) : ℝ) / 2 * epsilon) ^ 2) * B)) ^ 2 := by dsimp [m] field_simp ring
CausalSmith.Stat.DiscreteAteMinimaxLoggap.integral_fixedHeavyArm_noise_sq_le · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCell.lean:488
theorem integral_fixedHeavyArm_error_sq_le

The implemented category and arm counts satisfy the sharp aggregate inverse-count bound on either split.

Formal statement
n d :
epsilon B :
P :
H :
a :
Fin 2
hm :
3 ≤ splitSize n 1
hOverlap :
Overlap epsilon P
hepsilon :
0 < epsilon
hB :
0 < B
hp :
∀ k ∈ H, B ≤ cellMass P k
∫ sample : Fin n → Obs d, (fixedHeavyArmContribution sample H a - fixedTargetArm P H a) ^ 2 ∂productLaw P n
≤ 8 * (∑ k ∈ H, cellMass P k) / ((splitSize n 1 : ℝ) * epsilon)
+ 6 / (splitSize n 1 : ℝ)
+ 4 * (H.card / (((((splitSize n 1 - 2 : ℕ) : ℝ) / 2 * epsilon) ^ 2) * B)) ^ 2
Proof (Lean source)
lemma integral_fixedHeavyArm_error_sq_le {n d : ℕ} {epsilon B : ℝ} (P : DiscreteLaw d) (H : Finset (Fin d)) (a : Fin 2) (hm : 3 ≤ splitSize n 1) (hOverlap : Overlap epsilon P) (hepsilon : 0 < epsilon) (hB : 0 < B) (hp : ∀ k ∈ H, B ≤ cellMass P k) : ∫ sample : Fin n → Obs d, (fixedHeavyArmContribution sample H a - fixedTargetArm P H a) ^ 2 ∂productLaw P n ≤ 8 * (∑ k ∈ H, cellMass P k) / ((splitSize n 1 : ℝ) * epsilon) + 6 / (splitSize n 1 : ℝ) + 4 * (H.card / (((((splitSize n 1 - 2 : ℕ) : ℝ) / 2 * epsilon) ^ 2) * B)) ^ 2 := by have hmpos : 0 < splitSize n 1 := by omega calc _ ≤ ∫ sample : Fin n → Obs d, (2 * (fixedHeavyArmContribution sample H a - fixedEmpiricalMassArm P sample H a) ^ 2 + 2 * (fixedEmpiricalMassArm P sample H a - fixedTargetArm P H a) ^ 2) ∂productLaw P n := by apply integral_mono Integrable.of_finite Integrable.of_finite intro sample exact fixedHeavyArm_error_sq_le_noise_mass P sample H a _ = 2 * (∫ sample : Fin n → Obs d, (fixedHeavyArmContribution sample H a - fixedEmpiricalMassArm P sample H a) ^ 2 ∂productLaw P n) + 2 * (∫ sample : Fin n → Obs d, (fixedEmpiricalMassArm P sample H a - fixedTargetArm P H a) ^ 2 ∂productLaw P n) := by rw [integral_add Integrable.of_finite Integrable.of_finite, integral_const_mul, integral_const_mul] _ ≤ 2 * (4 * (∑ k ∈ H, cellMass P k) / ((splitSize n 1 : ℝ) * epsilon) + 2 / (splitSize n 1 : ℝ) + 2 * (H.card / (((((splitSize n 1 - 2 : ℕ) : ℝ) / 2 * epsilon) ^ 2) * B)) ^ 2) + 2 * (1 / (splitSize n 1 : ℝ)) := by gcongr · exact integral_fixedHeavyArm_noise_sq_le P H a hm hOverlap hepsilon hB hp · exact integral_fixedEmpiricalMassArm_sub_target_sq_le P H a hmpos _ = 8 * (∑ k ∈ H, cellMass P k) / ((splitSize n 1 : ℝ) * epsilon) + 6 / (splitSize n 1 : ℝ) + 4 * (H.card / (((((splitSize n 1 - 2 : ℕ) : ℝ) / 2 * epsilon) ^ 2) * B)) ^ 2 := by ring
CausalSmith.Stat.DiscreteAteMinimaxLoggap.integral_fixedHeavyArm_error_sq_le · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCell.lean:584
theorem heavyCells_rebuildPilot

Establishes the stated property of heavy Cells rebuild Pilot in the discrete average-treatment-effect construction.

Formal statement
n d :
P :
base :
Obs d
ω :
ℕ → Obs d
heavyCells (rebuildPilotSample P base (fun i : (lightBalancedSplit P).foldA n => ω i))
= heavyCells (fun i : Fin n => ω i)
Proof (Lean source)
lemma heavyCells_rebuildPilot {n d : ℕ} (P : DiscreteLaw d) (base : Obs d) (ω : ℕ → Obs d) : heavyCells (rebuildPilotSample P base (fun i : (lightBalancedSplit P).foldA n => ω i)) = heavyCells (fun i : Fin n => ω i) := by classical unfold heavyCells by_cases hn : n < calibrationCutoff · simp [hn] · ext k simp only [hn, if_false, mem_filter, Finset.mem_univ, true_and] rw [splitCategoryCount_rebuildPilot P base ω k]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.heavyCells_rebuildPilot · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCell.lean:634
theorem splitCategoryCount_rebuildEstimation

Establishes the stated property of split Category Count rebuild Estimation in the discrete average-treatment-effect construction.

Formal statement
n d :
P :
base :
Obs d
ω :
ℕ → Obs d
k :
Fin d
= splitCategoryCount (fun i : Fin n => ω i) 1 k
Proof (Lean source)
lemma splitCategoryCount_rebuildEstimation {n d : ℕ} (P : DiscreteLaw d) (base : Obs d) (ω : ℕ → Obs d) (k : Fin d) : splitCategoryCount (rebuildEstimationSample P base (fun i : (lightBalancedSplit P).foldB n => ω i)) 1 k = splitCategoryCount (fun i : Fin n => ω i) 1 k := by rw [splitCategoryCount_eq_sum_cell, splitCategoryCount_eq_sum_cell] simp_rw [splitCellCount_rebuildEstimation P base ω]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.splitCategoryCount_rebuildEstimation · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCell.lean:648
theorem fixedHeavyArmContribution_rebuildEstimation

Establishes the stated property of fixed Heavy Arm Contribution rebuild Estimation in the discrete average-treatment-effect construction.

Formal statement
n d :
P :
base :
Obs d
ω :
ℕ → Obs d
H :
a :
Fin 2
= fixedHeavyArmContribution (fun i : Fin n => ω i) H a
Proof (Lean source)
lemma fixedHeavyArmContribution_rebuildEstimation {n d : ℕ} (P : DiscreteLaw d) (base : Obs d) (ω : ℕ → Obs d) (H : Finset (Fin d)) (a : Fin 2) : fixedHeavyArmContribution (rebuildEstimationSample P base (fun i : (lightBalancedSplit P).foldB n => ω i)) H a = fixedHeavyArmContribution (fun i : Fin n => ω i) H a := by unfold fixedHeavyArmContribution simp_rw [splitCategoryCount_rebuildEstimation P base ω, splitCellCount_rebuildEstimation P base ω]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.fixedHeavyArmContribution_rebuildEstimation · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCell.lean:658
theorem infinite_fixedHeavyArm_fiber_factorization

Freezing one pilot-selected set factors its fiber probability from every fixed-set estimation-fold arm error.

Formal statement
n d :
P :
base :
Obs d
H :
a :
Fin 2
∫ ω : ℕ → Obs d in {ω | heavyCells (fun i : Fin n => ω i) = H}, (fixedHeavyArmContribution (fun i : Fin n => ω i) H a - fixedTargetArm P H a) ^ 2 ∂Measure.infinitePi (fun _ : ℕ => obsLaw P)
= (Measure.infinitePi (fun _ : ℕ => obsLaw P)).real {ω | heavyCells (fun i : Fin n => ω i) = H} * ∫ ω : ℕ → Obs d, (fixedHeavyArmContribution (fun i : Fin n => ω i) H a - fixedTargetArm P H a) ^ 2 ∂Measure.infinitePi (fun _ : ℕ => obsLaw P)
Proof (Lean source)
lemma infinite_fixedHeavyArm_fiber_factorization {n d : ℕ} (P : DiscreteLaw d) (base : Obs d) (H : Finset (Fin d)) (a : Fin 2) : ∫ ω : ℕ → Obs d in {ω | heavyCells (fun i : Fin n => ω i) = H}, (fixedHeavyArmContribution (fun i : Fin n => ω i) H a - fixedTargetArm P H a) ^ 2 ∂Measure.infinitePi (fun _ : ℕ => obsLaw P) = (Measure.infinitePi (fun _ : ℕ => obsLaw P)).real {ω | heavyCells (fun i : Fin n => ω i) = H} * ∫ ω : ℕ → Obs d, (fixedHeavyArmContribution (fun i : Fin n => ω i) H a - fixedTargetArm P H a) ^ 2 ∂Measure.infinitePi (fun _ : ℕ => obsLaw P) := by letI : MeasurableSpace (Finset (Fin d)) := ⊤ let pilot := fun x : (lightBalancedSplit P).foldA n → Obs d => heavyCells (rebuildPilotSample P base x) let estimate := fun x : (lightBalancedSplit P).foldB n → Obs d => (fixedHeavyArmContribution (rebuildEstimationSample P base x) H a - fixedTargetArm P H a) ^ 2 have h := oneShot_integral_estimate_restrict_pilot (lightBalancedSplit P) n pilot estimate (measurable_of_finite _) (measurable_of_finite _) ({H}) (by exact MeasurableSet.of_discrete) have hp : (fun ω : ℕ → Obs d => pilot (fun i : (lightBalancedSplit P).foldA n => ω i)) = fun ω => heavyCells (fun i : Fin n => ω i) := by funext ω exact heavyCells_rebuildPilot P base ω have he : (fun ω : ℕ → Obs d => estimate (fun i : (lightBalancedSplit P).foldB n => ω i)) = fun ω => (fixedHeavyArmContribution (fun i : Fin n => ω i) H a - fixedTargetArm P H a) ^ 2 := by funext ω unfold estimate rw [fixedHeavyArmContribution_rebuildEstimation P base ω] dsimp only [iidSample_infinitePi] at h change (∫ ω : ℕ → Obs d in (fun ω => heavyCells (fun i : Fin n => ω i)) ⁻¹' {H}, (fun ω => (fixedHeavyArmContribution (fun i : Fin n => ω i) H a - fixedTargetArm P H a) ^ 2) ω ∂Measure.infinitePi (fun _ : ℕ => obsLaw P)) = (Measure.infinitePi (fun _ : ℕ => obsLaw P)).real ((fun ω => heavyCells (fun i : Fin n => ω i)) ⁻¹' {H}) * ∫ ω : ℕ → Obs d, (fun ω => (fixedHeavyArmContribution (fun i : Fin n => ω i) H a - fixedTargetArm P H a) ^ 2) ω ∂Measure.infinitePi (fun _ : ℕ => obsLaw P) rw [← hp, ← he] exact h
CausalSmith.Stat.DiscreteAteMinimaxLoggap.infinite_fixedHeavyArm_fiber_factorization · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCell.lean:669
theorem integral_split_count_ratio_le

Evaluates or bounds the stated integral involving integral split count ratio le.

Formal statement
n d :
epsilon :
P :
hOverlap :
Overlap epsilon P
hepsilon :
0 < epsilon
j :
Fin 2
k :
Fin d
a :
Fin 2
hp :
0 < cellMass P k
∫ sample : Fin n → Obs d, (splitCategoryCount sample j k : ℝ) ^ 2 * (if 0 < splitCellCount sample j k a 0 + splitCellCount sample j k a 1 then ((splitCellCount sample j k a 0 + splitCellCount sample j k a 1 : ℕ) : ℝ)⁻¹ else 0) ∂productLaw P n
≤ 2 * (splitSize n j : ℝ) * cellMass P k / epsilon
Proof (Lean source)
lemma integral_split_count_ratio_le {n d : ℕ} {epsilon : ℝ} (P : DiscreteLaw d) (hOverlap : Overlap epsilon P) (hepsilon : 0 < epsilon) (j : Fin 2) (k : Fin d) (a : Fin 2) (hp : 0 < cellMass P k) : ∫ sample : Fin n → Obs d, (splitCategoryCount sample j k : ℝ) ^ 2 * (if 0 < splitCellCount sample j k a 0 + splitCellCount sample j k a 1 then ((splitCellCount sample j k a 0 + splitCellCount sample j k a 1 : ℕ) : ℝ)⁻¹ else 0) ∂productLaw P n ≤ 2 * (splitSize n j : ℝ) * cellMass P k / epsilon := by let g : ({i : Fin n // i ∈ splitIndices n j} → Obs d) → ℝ := fun z => ((indexSet z (categorySet k)).card : ℝ) ^ 2 * (if 0 < (indexSet z (categoryArmSet k (finTwoEquiv a))).card then ((indexSet z (categoryArmSet k (finTwoEquiv a))).card : ℝ)⁻¹ else 0) have hsplit : Measurable (fun sample : Fin n → Obs d => splitTuple sample j) := measurable_of_finite _ have hg : Measurable g := measurable_of_finite _ calc _ = ∫ sample : Fin n → Obs d, g (splitTuple sample j) ∂productLaw P n := by apply integral_congr_ae filter_upwards with sample simp only [g, indexSet_splitTuple_category_card, indexSet_splitTuple_arm_card] _ = ∫ z, g z ∂((productLaw P n).map (fun sample => splitTuple sample j)) := by rw [integral_map hsplit.aemeasurable hg.aestronglyMeasurable] _ = ∫ z, g z ∂(Measure.pi (fun _ : {i : Fin n // i ∈ splitIndices n j} => obsLaw P)) := by rw [productLaw_map_splitTuple] _ ≤ 2 * (card {i : Fin n // i ∈ splitIndices n j} : ℝ) * cellMass P k / epsilon := by exact ate_nested_count_ratio_integral_le P hOverlap hepsilon k (finTwoEquiv a) hp _ = 2 * (splitSize n j : ℝ) * cellMass P k / epsilon := by congr 3 simp [splitSize]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.integral_split_count_ratio_le · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCell.lean:722
theorem empirical_arm_ratio_mem_unitInterval

Shows that empirical arm ratio mem unit Interval lies in the stated set or interval.

Formal statement
n d :
sample :
Fin n → Obs d
k :
Fin d
a :
Fin 2
(splitCellCount sample 1 k a 1 : ℝ) / (splitCellCount sample 1 k a 0 + splitCellCount sample 1 k a 1 : ℕ) ∈ Icc (0 : ℝ) 1
Proof (Lean source)
lemma empirical_arm_ratio_mem_unitInterval {n d : ℕ} (sample : Fin n → Obs d) (k : Fin d) (a : Fin 2) : (splitCellCount sample 1 k a 1 : ℝ) / (splitCellCount sample 1 k a 0 + splitCellCount sample 1 k a 1 : ℕ) ∈ Icc (0 : ℝ) 1 := by have hnum : splitCellCount sample 1 k a 1 ≤ splitCellCount sample 1 k a 0 + splitCellCount sample 1 k a 1 := by omega constructor · positivity · exact div_le_one_of_le₀ (by exact_mod_cast hnum) (by positivity)
CausalSmith.Stat.DiscreteAteMinimaxLoggap.empirical_arm_ratio_mem_unitInterval · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCell.lean:765
theorem abs_empiricalRatioCell_le

Establishes the stated upper bound for abs empirical Ratio Cell le.

Formal statement
n d :
sample :
Fin n → Obs d
k :
Fin d
|empiricalRatioCell sample k| ≤ (splitCategoryCount sample 1 k : ℝ) / splitSize n 1
Proof (Lean source)
lemma abs_empiricalRatioCell_le {n d : ℕ} (sample : Fin n → Obs d) (k : Fin d) : |empiricalRatioCell sample k| ≤ (splitCategoryCount sample 1 k : ℝ) / splitSize n 1 := by let r1 : ℝ := (splitCellCount sample 1 k 1 1 : ℝ) / (splitCellCount sample 1 k 1 0 + splitCellCount sample 1 k 1 1 : ℕ) let r0 : ℝ := (splitCellCount sample 1 k 0 1 : ℝ) / (splitCellCount sample 1 k 0 0 + splitCellCount sample 1 k 0 1 : ℕ) have hr1 := empirical_arm_ratio_mem_unitInterval sample k 1 have hr0 := empirical_arm_ratio_mem_unitInterval sample k 0 rcases hr1 with ⟨hr1lo, hr1hi⟩ rcases hr0 with ⟨hr0lo, hr0hi⟩ have hdiff : |r1 - r0| ≤ 1 := by rw [abs_le] constructor <;> dsimp [r1, r0] at hr1lo hr1hi hr0lo hr0hi ⊢ <;> linarith have hweight : 0 ≤ (splitCategoryCount sample 1 k : ℝ) / splitSize n 1 := by positivity change |((splitCategoryCount sample 1 k : ℝ) / splitSize n 1) * (r1 - r0)| ≤ _ rw [abs_mul, abs_of_nonneg hweight] exact mul_le_of_le_one_right hweight hdiff
CausalSmith.Stat.DiscreteAteMinimaxLoggap.abs_empiricalRatioCell_le · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCell.lean:777
theorem sum_splitCategoryCount

Establishes the stated summation identity or bound for sum split Category Count.

Formal statement
n d :
sample :
Fin n → Obs d
j :
Fin 2
∑ k : Fin d, splitCategoryCount sample j k = splitSize n j
Proof (Lean source)
lemma sum_splitCategoryCount {n d : ℕ} (sample : Fin n → Obs d) (j : Fin 2) : ∑ k : Fin d, splitCategoryCount sample j k = splitSize n j := by classical have h := Finset.card_eq_sum_card_fiberwise (s := splitIndices n j) (t := (Finset.univ : Finset (Fin d))) (f := fun i => (sample i).1) (fun _i _hi => Finset.mem_univ _) simpa [splitCategoryCount, splitSize] using h.symm
CausalSmith.Stat.DiscreteAteMinimaxLoggap.sum_splitCategoryCount · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCell.lean:799
theorem abs_heavyContribution_le_one

Establishes the stated upper bound for abs heavy Contribution le one.

Formal statement
n d :
sample :
Fin n → Obs d
|heavyContribution sample| ≤ 1
Proof (Lean source)
lemma abs_heavyContribution_le_one {n d : ℕ} (sample : Fin n → Obs d) : |heavyContribution sample| ≤ 1 := by calc |heavyContribution sample| ≤ ∑ k ∈ heavyCells sample, |empiricalRatioCell sample k| := by exact Finset.abs_sum_le_sum_abs _ _ _ ≤ ∑ k ∈ heavyCells sample, (splitCategoryCount sample 1 k : ℝ) / splitSize n 1 := by exact Finset.sum_le_sum fun k _hk => abs_empiricalRatioCell_le sample k _ ≤ ∑ k : Fin d, (splitCategoryCount sample 1 k : ℝ) / splitSize n 1 := by apply Finset.sum_le_sum_of_subset_of_nonneg (Finset.subset_univ _) intro k _hk _hnot positivity _ = (splitSize n 1 : ℝ) / splitSize n 1 := by rw [← Finset.sum_div] congr 1 exact_mod_cast sum_splitCategoryCount sample 1 _ ≤ 1 := div_le_one_of_le₀ le_rfl (by positivity)
CausalSmith.Stat.DiscreteAteMinimaxLoggap.abs_heavyContribution_le_one · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCell.lean:808
theorem cellPhi_cellVector_eq_weighted

Establishes the stated equality relating cell Phi cell Vector eq weighted.

Formal statement
d :
P :
k :
Fin d
cellPhi (cellVector P k) = cellMass P k * (outcomeMean P true k - outcomeMean P false k)
Proof (Lean source)
lemma cellPhi_cellVector_eq_weighted {d : ℕ} (P : DiscreteLaw d) (k : Fin d) : cellPhi (cellVector P k) = cellMass P k * (outcomeMean P true k - outcomeMean P false k) := by by_cases hz : cellVector P k = 0 · have h00 := congrFun hz (0, 0) have h01 := congrFun hz (0, 1) have h10 := congrFun hz (1, 0) have h11 := congrFun hz (1, 1) simp [cellVector, finTwoEquiv] at h00 h01 h10 h11 simp [cellPhi, hz, cellMass, outcomeMean, armMass, h00, h01, h10, h11] · simp [cellPhi, hz, cellVector, vectorMass, vectorArmMass, cellMass, outcomeMean, armMass, finTwoEquiv] <;> ring
CausalSmith.Stat.DiscreteAteMinimaxLoggap.cellPhi_cellVector_eq_weighted · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCell.lean:829
theorem fixedTargetHeavy_eq_arm_sub

Establishes the stated equality relating fixed Target Heavy eq arm sub.

Formal statement
d :
P :
H :
Proof (Lean source)
lemma fixedTargetHeavy_eq_arm_sub {d : ℕ} (P : DiscreteLaw d) (H : Finset (Fin d)) : fixedTargetHeavy P H = fixedTargetArm P H 1 - fixedTargetArm P H 0 := by unfold fixedTargetHeavy fixedTargetArm simp_rw [cellPhi_cellVector_eq_weighted, mul_sub] rw [Finset.sum_sub_distrib] simp [finTwoEquiv]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.fixedTargetHeavy_eq_arm_sub · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCell.lean:844
theorem fixedHeavy_error_sq_le_two_arms

Establishes the stated upper bound for fixed Heavy error sq le two arms.

Formal statement
n d :
P :
sample :
Fin n → Obs d
H :
≤ 2 * (fixedHeavyArmContribution sample H 1 - fixedTargetArm P H 1) ^ 2
+ 2 * (fixedHeavyArmContribution sample H 0 - fixedTargetArm P H 0) ^ 2
Proof (Lean source)
lemma fixedHeavy_error_sq_le_two_arms {n d : ℕ} (P : DiscreteLaw d) (sample : Fin n → Obs d) (H : Finset (Fin d)) : (fixedHeavyContribution sample H - fixedTargetHeavy P H) ^ 2 ≤ 2 * (fixedHeavyArmContribution sample H 1 - fixedTargetArm P H 1) ^ 2 + 2 * (fixedHeavyArmContribution sample H 0 - fixedTargetArm P H 0) ^ 2 := by rw [fixedHeavyContribution_eq_arm_sub, fixedTargetHeavy_eq_arm_sub] nlinarith [sq_nonneg ((fixedHeavyArmContribution sample H 1 - fixedTargetArm P H 1) + (fixedHeavyArmContribution sample H 0 - fixedTargetArm P H 0))]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.fixedHeavy_error_sq_le_two_arms · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCell.lean:853
theorem abs_cellPhi_cellVector_le_mass_unconditional

Establishes the stated upper bound for abs cell Phi cell Vector le mass unconditional.

Formal statement
d :
P :
k :
Fin d
|cellPhi (cellVector P k)| ≤ cellMass P k
Proof (Lean source)
lemma abs_cellPhi_cellVector_le_mass_unconditional {d : ℕ} (P : DiscreteLaw d) (k : Fin d) : |cellPhi (cellVector P k)| ≤ cellMass P k := by rw [cellPhi_cellVector_eq_weighted] have hp := cellMass_mem_unitInterval P k have hm1 := outcomeMean_mem_unitInterval P true k have hm0 := outcomeMean_mem_unitInterval P false k rw [abs_mul, abs_of_nonneg hp.1] apply mul_le_of_le_one_right hp.1 rw [abs_le] constructor <;> linarith [hm1.1, hm1.2, hm0.1, hm0.2]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.abs_cellPhi_cellVector_le_mass_unconditional · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCell.lean:864
theorem sum_cellMass_eq_one

Establishes the stated equality relating sum cell Mass eq one.

Formal statement
d :
P :
∑ k : Fin d, cellMass P k = 1
Proof (Lean source)
lemma sum_cellMass_eq_one {d : ℕ} (P : DiscreteLaw d) : ∑ k : Fin d, cellMass P k = 1 := by have htotal : ∑ z : Obs d, (P.pmf z).toReal = 1 := by simpa using (PMF.integral_eq_sum P.pmf (fun _ : Obs d => (1 : ℝ))).symm calc ∑ k : Fin d, cellMass P k = ∑ z : Obs d, (P.pmf z).toReal := by simp [cellMass, jointMass, Fintype.sum_prod_type] _ = 1 := htotal
CausalSmith.Stat.DiscreteAteMinimaxLoggap.sum_cellMass_eq_one · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCell.lean:877
theorem abs_targetHeavy_le_one

Establishes the stated upper bound for abs target Heavy le one.

Formal statement
n d :
P :
sample :
Fin n → Obs d
|targetHeavy P sample| ≤ 1
Proof (Lean source)
lemma abs_targetHeavy_le_one {n d : ℕ} (P : DiscreteLaw d) (sample : Fin n → Obs d) : |targetHeavy P sample| ≤ 1 := by calc |targetHeavy P sample| ≤ ∑ k ∈ heavyCells sample, |cellPhi (cellVector P k)| := Finset.abs_sum_le_sum_abs _ _ _ ≤ ∑ k ∈ heavyCells sample, cellMass P k := by exact Finset.sum_le_sum fun k _hk ↦ abs_cellPhi_cellVector_le_mass_unconditional P k _ ≤ ∑ k : Fin d, cellMass P k := by apply Finset.sum_le_sum_of_subset_of_nonneg (Finset.subset_univ _) intro k _hk _hnot exact (cellMass_mem_unitInterval P k).1 _ = 1 := sum_cellMass_eq_one P
CausalSmith.Stat.DiscreteAteMinimaxLoggap.abs_targetHeavy_le_one · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCell.lean:887
theorem heavy_component_sq_le_four

Establishes the stated upper bound for heavy component sq le four.

Formal statement
n d :
P :
sample :
Fin n → Obs d
(heavyContribution sample - targetHeavy P sample) ^ 2 ≤ 4
Proof (Lean source)
lemma heavy_component_sq_le_four {n d : ℕ} (P : DiscreteLaw d) (sample : Fin n → Obs d) : (heavyContribution sample - targetHeavy P sample) ^ 2 ≤ 4 := by have hh := abs_heavyContribution_le_one sample have ht := abs_targetHeavy_le_one P sample have habs : |heavyContribution sample - targetHeavy P sample| ≤ 2 := (abs_sub _ _).trans (by linarith) calc (heavyContribution sample - targetHeavy P sample) ^ 2 = |heavyContribution sample - targetHeavy P sample| ^ 2 := by rw [sq_abs] _ ≤ (2 : ℝ) ^ 2 := pow_le_pow_left₀ (abs_nonneg _) habs 2 _ = 4 := by norm_num
CausalSmith.Stat.DiscreteAteMinimaxLoggap.heavy_component_sq_le_four · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCell.lean:903
theorem heavy_bad_pilot_setIntegral_le

Pilot failure costs at most four times its probability, using the global range bound for the heavy component and its target.

Formal statement
n d :
P :
∫ sample in pilotBadEvent P 256, (heavyContribution sample - targetHeavy P sample) ^ 2 ∂productLaw P n
≤ 4 * (productLaw P n).real (pilotBadEvent P 256)
Proof (Lean source)
lemma heavy_bad_pilot_setIntegral_le {n d : ℕ} (P : DiscreteLaw d) : ∫ sample in pilotBadEvent P 256, (heavyContribution sample - targetHeavy P sample) ^ 2 ∂productLaw P n ≤ 4 * (productLaw P n).real (pilotBadEvent P 256) := by let err : (Fin n → Obs d) → ℝ := fun sample ↦ (heavyContribution sample - targetHeavy P sample) ^ 2 have herrInt : IntegrableOn err (pilotBadEvent P 256) (productLaw P n) := Integrable.of_finite have hfourInt : IntegrableOn (fun _sample : Fin n → Obs d ↦ (4 : ℝ)) (pilotBadEvent P 256) (productLaw P n) := integrableOn_const have hmono : ∫ sample in pilotBadEvent P 256, err sample ∂productLaw P n ≤ ∫ _sample in pilotBadEvent P 256, (4 : ℝ) ∂productLaw P n := by apply integral_mono_ae herrInt hfourInt filter_upwards with sample exact heavy_component_sq_le_four P sample simpa [err, MeasureTheory.setIntegral_const, mul_comm] using hmono
CausalSmith.Stat.DiscreteAteMinimaxLoggap.heavy_bad_pilot_setIntegral_le · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCell.lean:918
theorem heavy_bad_pilot_rate

The complete pilot-failure contribution is fourth-order polynomially small, uniformly over the calibrated dimension range.

Formal statement
∀ c : ℝ,
0 < c → ∃ C N, 0 < C ∧ ∀ (n d : ℕ) (P : DiscreteLaw d), N
≤ n → (d : ℝ) ≤ c * n * logScale n → ∫ sample in pilotBadEvent P 256, (heavyContribution sample - targetHeavy P sample) ^ 2 ∂productLaw P n ≤ C * rpow n (-4)
Proof (Lean source)
lemma heavy_bad_pilot_rate : ∀ c : ℝ, 0 < c → ∃ C N, 0 < C ∧ ∀ (n d : ℕ) (P : DiscreteLaw d), N ≤ n → (d : ℝ) ≤ c * n * logScale n → ∫ sample in pilotBadEvent P 256, (heavyContribution sample - targetHeavy P sample) ^ 2 ∂productLaw P n ≤ C * rpow n (-4) := by intro c hc rcases pilot_sandwich_256 c hc with ⟨C, N, hC, hpilot⟩ refine ⟨4 * C, N, by positivity, ?_⟩ intro n d P hn hd calc ∫ sample in pilotBadEvent P 256, (heavyContribution sample - targetHeavy P sample) ^ 2 ∂productLaw P n ≤ 4 * (productLaw P n).real (pilotBadEvent P 256) := heavy_bad_pilot_setIntegral_le P _ ≤ 4 * (C * rpow n (-4)) := by gcongr exact hpilot n d P (productLaw P n) hn hd rfl _ = (4 * C) * rpow n (-4) := by ring
CausalSmith.Stat.DiscreteAteMinimaxLoggap.heavy_bad_pilot_rate · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCell.lean:939
theorem heavy_good_arm_setIntegral_le

Any uniform fixed-set arm bound transfers unchanged to the random pilot-selected set on the pilot-good event.

Formal statement
n d :
epsilon B V :
P :
a :
Fin 2
base :
Obs d
hm :
3 ≤ splitSize n 1
hOverlap :
Overlap epsilon P
hepsilon :
0 < epsilon
hB :
0 < B
hpGood :
∀ sample : Fin n → Obs d
if
sample ∉ pilotBadEvent P 256
then
∀ k ∈ heavyCells sample, B ≤ cellMass P k
hV :
∀ H : Finset (Fin d)
if
(∀ k ∈ H, B ≤ cellMass P k)
then
8 * (∑ k ∈ H, cellMass P k) / ((splitSize n 1 : ℝ) * epsilon)
+ 6 / (splitSize n 1 : ℝ)
+ 4 * (H.card / (((((splitSize n 1 - 2 : ℕ) : ℝ) / 2 * epsilon) ^ 2) * B)) ^ 2
≤ V
∫ sample in (pilotBadEvent P 256)ᶜ, (fixedHeavyArmContribution sample (heavyCells sample) a - fixedTargetArm P (heavyCells sample) a) ^ 2 ∂productLaw P n
≤ V
Proof (Lean source)
lemma heavy_good_arm_setIntegral_le {n d : ℕ} {epsilon B V : ℝ} (P : DiscreteLaw d) (a : Fin 2) (base : Obs d) (hm : 3 ≤ splitSize n 1) (hOverlap : Overlap epsilon P) (hepsilon : 0 < epsilon) (hB : 0 < B) (hpGood : ∀ sample : Fin n → Obs d, sample ∉ pilotBadEvent P 256 → ∀ k ∈ heavyCells sample, B ≤ cellMass P k) (hV : ∀ H : Finset (Fin d), (∀ k ∈ H, B ≤ cellMass P k) → 8 * (∑ k ∈ H, cellMass P k) / ((splitSize n 1 : ℝ) * epsilon) + 6 / (splitSize n 1 : ℝ) + 4 * (H.card / (((((splitSize n 1 - 2 : ℕ) : ℝ) / 2 * epsilon) ^ 2) * B)) ^ 2 ≤ V) : ∫ sample in (pilotBadEvent P 256)ᶜ, (fixedHeavyArmContribution sample (heavyCells sample) a - fixedTargetArm P (heavyCells sample) a) ^ 2 ∂productLaw P n ≤ V := by classical letI : MeasurableSpace (Finset (Fin d)) := ⊤ let muInf := Measure.infinitePi (fun _ : ℕ => obsLaw P) let trunc : (ℕ → Obs d) → (Fin n → Obs d) := fun ω i => ω i let eligible : Finset (Finset (Fin d)) := Finset.univ.filter (fun H => ∀ k ∈ H, B ≤ cellMass P k) let errH : Finset (Fin d) → (ℕ → Obs d) → ℝ := fun H ω => (fixedHeavyArmContribution (trunc ω) H a - fixedTargetArm P H a) ^ 2 let fiber : Finset (Fin d) → Set (ℕ → Obs d) := fun H => {ω | heavyCells (trunc ω) = H} have htruncMeas : Measurable trunc := by fun_prop have htruncMP : MeasurePreserving trunc muInf (productLaw P n) := by refine ⟨htruncMeas, ?_⟩ exact finProductLaw_eq_map (obsLaw P) n have hintegrable_comp (f : (Fin n → Obs d) → ℝ) : Integrable (fun ω => f (trunc ω)) muInf := by change Integrable (f ∘ trunc) muInf exact htruncMP.integrable_comp_of_integrable Integrable.of_finite have hfiberMeas (H : Finset (Fin d)) : MeasurableSet (fiber H) := by unfold fiber exact (MeasurableSet.of_discrete : MeasurableSet {sample : Fin n → Obs d | heavyCells sample = H}).preimage htruncMeas have htransport : (∫ sample in (pilotBadEvent P 256)ᶜ, (fixedHeavyArmContribution sample (heavyCells sample) a - fixedTargetArm P (heavyCells sample) a) ^ 2 ∂productLaw P n) = ∫ ω in (trunc ⁻¹' (pilotBadEvent P 256)ᶜ), (fixedHeavyArmContribution (trunc ω) (heavyCells (trunc ω)) a - fixedTargetArm P (heavyCells (trunc ω)) a) ^ 2 ∂muInf := by rw [← integral_indicator MeasurableSet.of_discrete, integral_productLaw_eq_infinite_trunc, ← integral_indicator (MeasurableSet.of_discrete.preimage htruncMeas)] rfl rw [htransport] have hpoint (ω : ℕ → Obs d) : (trunc ⁻¹' (pilotBadEvent P 256)ᶜ).indicator (fun ω => (fixedHeavyArmContribution (trunc ω) (heavyCells (trunc ω)) a - fixedTargetArm P (heavyCells (trunc ω)) a) ^ 2) ω ≤ ∑ H ∈ eligible, (fiber H).indicator (errH H) ω := by by_cases hgood : trunc ω ∉ pilotBadEvent P 256 · have helig : heavyCells (trunc ω) ∈ eligible := by simp only [eligible, mem_filter, Finset.mem_univ, true_and] exact hpGood (trunc ω) hgood rw [Set.indicator_of_mem (by simpa using hgood)] rw [Finset.sum_eq_single (heavyCells (trunc ω))] · simp [fiber, errH] · intro H hH hne simp [fiber, hne.symm] · intro hnot exact (hnot helig).elim · rw [Set.indicator_of_notMem (by simpa using hgood)] exact sum_nonneg fun H hH => Set.indicator_nonneg (fun _ _ => sq_nonneg _) _ calc (∫ ω in (trunc ⁻¹' (pilotBadEvent P 256)ᶜ), (fixedHeavyArmContribution (trunc ω) (heavyCells (trunc ω)) a - fixedTargetArm P (heavyCells (trunc ω)) a) ^ 2 ∂muInf) ≤ ∫ ω, ∑ H ∈ eligible, (fiber H).indicator (errH H) ω ∂muInf := by rw [← integral_indicator] · apply integral_mono (by exact hintegrable_comp (fun sample => ((pilotBadEvent P 256)ᶜ).indicator (fun sample => (fixedHeavyArmContribution sample (heavyCells sample) a - fixedTargetArm P (heavyCells sample) a) ^ 2) sample)) (by let F : (Fin n → Obs d) → ℝ := fun sample => ∑ H ∈ eligible, (if heavyCells sample = H then (fixedHeavyArmContribution sample H a - fixedTargetArm P H a) ^ 2 else 0) have hF := hintegrable_comp F simpa only [F, fiber, errH, Set.indicator_apply, Set.mem_setOf_eq, Function.comp_apply] using hF) exact hpoint · exact MeasurableSet.of_discrete.preimage htruncMeas _ = ∑ H ∈ eligible, ∫ ω in fiber H, errH H ω ∂muInf := by rw [integral_finset_sum eligible (fun H _ => by have hcomp := hintegrable_comp (fun sample => ({sample | heavyCells sample = H}).indicator (fun sample => (fixedHeavyArmContribution sample H a - fixedTargetArm P H a) ^ 2) sample) change Integrable (fun ω => ({sample | heavyCells sample = H}).indicator (fun sample => (fixedHeavyArmContribution sample H a - fixedTargetArm P H a) ^ 2) (trunc ω)) muInf exact hcomp)] apply Finset.sum_congr rfl intro H hH rw [integral_indicator] exact hfiberMeas H _ = ∑ H ∈ eligible, muInf.real (fiber H) * ∫ ω, errH H ω ∂muInf := by apply Finset.sum_congr rfl intro H hH exact infinite_fixedHeavyArm_fiber_factorization P base H a _ ≤ ∑ H ∈ eligible, muInf.real (fiber H) * V := by apply Finset.sum_le_sum intro H hH apply mul_le_mul_of_nonneg_left _ (measureReal_nonneg) calc ∫ ω, errH H ω ∂muInf = ∫ sample : Fin n → Obs d, (fixedHeavyArmContribution sample H a - fixedTargetArm P H a) ^ 2 ∂productLaw P n := by symm exact integral_productLaw_eq_infinite_trunc P _ _ ≤ 8 * (∑ k ∈ H, cellMass P k) / ((splitSize n 1 : ℝ) * epsilon) + 6 / (splitSize n 1 : ℝ) + 4 * (H.card / (((((splitSize n 1 - 2 : ℕ) : ℝ) / 2 * epsilon) ^ 2) * B)) ^ 2 := by exact integral_fixedHeavyArm_error_sq_le P H a hm hOverlap hepsilon hB (by simpa only [eligible, mem_filter, Finset.mem_univ, true_and] using hH) _ ≤ V := hV H (by simpa only [eligible, mem_filter, Finset.mem_univ, true_and] using hH) _ = (∑ H ∈ eligible, muInf.real (fiber H)) * V := by rw [Finset.sum_mul] _ ≤ 1 * V := by have hsumle : (∑ H ∈ eligible, muInf.real (fiber H)) ≤ 1 := by calc ∑ H ∈ eligible, muInf.real (fiber H) ≤ ∑ H ∈ (Finset.univ : Finset (Finset (Fin d))), muInf.real (fiber H) := by apply Finset.sum_le_sum_of_subset_of_nonneg (Finset.subset_univ _) intro H hH hnot exact measureReal_nonneg _ = 1 := by rw [show (∑ H ∈ (Finset.univ : Finset (Finset (Fin d))), muInf.real (fiber H)) = muInf.real ((fun ω => heavyCells (trunc ω)) ⁻¹' (Finset.univ : Finset (Finset (Fin d)))) by exact sum_measureReal_preimage_singleton _ (fun H _ => hfiberMeas H)] simp [muInf] have hVnonneg : (0 : ℝ) ≤ V := by have hH0 : (0 : ℝ) ≤ 8 * (∑ k ∈ (∅ : Finset (Fin d)), cellMass P k) / ((splitSize n 1 : ℝ) * epsilon) + 6 / (splitSize n 1 : ℝ) + 4 * ((∅ : Finset (Fin d)).card / (((((splitSize n 1 - 2 : ℕ) : ℝ) / 2 * epsilon) ^ 2) * B)) ^ 2 := by simp positivity exact hH0.trans (hV ∅ (by simp)) exact mul_le_mul_of_nonneg_right hsumle hVnonneg _ = V := one_mul V
CausalSmith.Stat.DiscreteAteMinimaxLoggap.heavy_good_arm_setIntegral_le · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCell.lean:963
theorem heavy_fixed_envelope_rate

The deterministic fixed-heavy-set envelope has the target minimax rate, uniformly in the set and the underlying discrete law.

Formal statement
n d :
P :
epsilon :
hepsilon :
0 < epsilon
hn8 :
8 ≤ n
H :
8 * (∑ k ∈ H, cellMass P k) / ((splitSize n 1 : ℝ) * epsilon)
+ 6 / (splitSize n 1 : ℝ)
+ 4 * (H.card / (((((splitSize n 1 - 2 : ℕ) : ℝ) / 2 * epsilon) ^ 2) * (256 * logScale n / (2 * splitSize n 0)))) ^ 2
≤ (16 / epsilon + 12 + 1 / epsilon ^ 4) * minimaxRate n d
Proof (Lean source)
lemma heavy_fixed_envelope_rate {n d : ℕ} (P : DiscreteLaw d) {epsilon : ℝ} (hepsilon : 0 < epsilon) (hn8 : 8 ≤ n) (H : Finset (Fin d)) : 8 * (∑ k ∈ H, cellMass P k) / ((splitSize n 1 : ℝ) * epsilon) + 6 / (splitSize n 1 : ℝ) + 4 * (H.card / (((((splitSize n 1 - 2 : ℕ) : ℝ) / 2 * epsilon) ^ 2) * (256 * logScale n / (2 * splitSize n 0)))) ^ 2 ≤ (16 / epsilon + 12 + 1 / epsilon ^ 4) * minimaxRate n d := by classical have hn : 0 < n := by omega have hnR : (0 : ℝ) < n := by exact_mod_cast hn have hlog : 0 < log (n : ℝ) := Real.log_pos (by exact_mod_cast (show 1 < n by omega)) have hscale : logScale n = 1 + log (n : ℝ) := by rw [logScale, Real.log_mul (by positivity : exp 1 ≠ 0) (by positivity : (n : ℝ) ≠ 0)] simp have hL : 0 < logScale n := by rw [hscale]; positivity have hlogL : log (n : ℝ) ≤ logScale n := by rw [hscale]; linarith have hmEq : splitSize n 1 = n - n / 2 := splitSize_one_eq n have hm0Eq : splitSize n 0 = n / 2 := splitSize_zero_eq n have hmNat : n ≤ 2 * splitSize n 1 := by rw [hmEq]; omega have hm : (n : ℝ) / 2 ≤ (splitSize n 1 : ℝ) := by exact (div_le_iff₀' (by norm_num : (0 : ℝ) < 2)).mpr (by exact_mod_cast hmNat) have hmpos : (0 : ℝ) < splitSize n 1 := lt_of_lt_of_le (by positivity) hm have hm2Nat : n ≤ 4 * (splitSize n 1 - 2) := by rw [hmEq]; omega have hm2 : (n : ℝ) / 8 ≤ ((splitSize n 1 - 2 : ℕ) : ℝ) / 2 := by have hcast : (n : ℝ) ≤ 4 * ((splitSize n 1 - 2 : ℕ) : ℝ) := by exact_mod_cast hm2Nat linarith have hm0Nat : 2 * splitSize n 0 ≤ n := by rw [hm0Eq]; omega have hm0NatPos : 0 < splitSize n 0 := by rw [hm0Eq]; omega have hm0pos : (0 : ℝ) < 2 * splitSize n 0 := by exact mul_pos (by norm_num) (by exact_mod_cast hm0NatPos) let B : ℝ := 256 * logScale n / (2 * splitSize n 0) let D : ℝ := (((((splitSize n 1 - 2 : ℕ) : ℝ) / 2 * epsilon) ^ 2) * B) have hB : 256 * logScale n / (n : ℝ) ≤ B := by dsimp [B] apply div_le_div_of_nonneg_left (by positivity) hm0pos exact_mod_cast hm0Nat have hBpos : 0 < B := lt_of_lt_of_le (by positivity) hB have hq : (n : ℝ) / 8 * epsilon ≤ ((splitSize n 1 - 2 : ℕ) : ℝ) / 2 * epsilon := by exact mul_le_mul_of_nonneg_right hm2 hepsilon.le have hq0 : 0 ≤ (n : ℝ) / 8 * epsilon := by positivity have hq2 := pow_le_pow_left₀ hq0 hq 2 have hD : 4 * (n : ℝ) * epsilon ^ 2 * logScale n ≤ D := by calc 4 * (n : ℝ) * epsilon ^ 2 * logScale n = ((n : ℝ) / 8 * epsilon) ^ 2 * (256 * logScale n / (n : ℝ)) := by field_simp; ring _ ≤ (((splitSize n 1 - 2 : ℕ) : ℝ) / 2 * epsilon) ^ 2 * B := by exact mul_le_mul hq2 hB (by positivity) (by positivity) _ = D := rfl have hDpos : 0 < D := lt_of_lt_of_le (by positivity) hD have hsum : ∑ k ∈ H, cellMass P k ≤ 1 := by calc _ ≤ ∑ k : Fin d, cellMass P k := by apply Finset.sum_le_sum_of_subset_of_nonneg (Finset.subset_univ _) intro k hk hnot exact (cellMass_mem_unitInterval P k).1 _ = 1 := sum_cellMass_eq_one P have hcard : (H.card : ℝ) ≤ d := by exact_mod_cast (by simpa using H.card_le_univ) have hparam : 8 * (∑ k ∈ H, cellMass P k) / ((splitSize n 1 : ℝ) * epsilon) ≤ 16 / epsilon / n := by calc _ ≤ 8 * 1 / ((splitSize n 1 : ℝ) * epsilon) := by gcongr _ ≤ 16 / epsilon / n := by field_simp nlinarith [hm] have hmass : 6 / (splitSize n 1 : ℝ) ≤ 12 / n := by rw [div_eq_mul_inv, div_eq_mul_inv] have hi : ((splitSize n 1 : ℝ))⁻¹ ≤ ((n : ℝ) / 2)⁻¹ := inv_anti₀ (by positivity) hm calc 6 * (splitSize n 1 : ℝ)⁻¹ ≤ 6 * ((n : ℝ) / 2)⁻¹ := by gcongr _ = 12 * (n : ℝ)⁻¹ := by field_simp; norm_num have hmiss0 : (H.card : ℝ) / D ≤ (d : ℝ) / (4 * n * epsilon ^ 2 * logScale n) := by exact div_le_div₀ (by positivity) hcard (by positivity) hD have hmiss : 4 * ((H.card : ℝ) / D) ^ 2 ≤ (1 / epsilon ^ 4) * ((d : ℝ) ^ 2 / ((n : ℝ) ^ 2 * (log n) ^ 2)) := by have hsq := pow_le_pow_left₀ (by positivity : 0 ≤ (H.card : ℝ) / D) hmiss0 2 calc 4 * ((H.card : ℝ) / D) ^ 2 ≤ 4 * ((d : ℝ) / (4 * n * epsilon ^ 2 * logScale n)) ^ 2 := by gcongr _ ≤ (1 / epsilon ^ 4) * ((d : ℝ) ^ 2 / ((n : ℝ) ^ 2 * (log n) ^ 2)) := by have hsquares : (log (n : ℝ)) ^ 2 ≤ (logScale n) ^ 2 := pow_le_pow_left₀ hlog.le hlogL 2 have hmul := mul_le_mul_of_nonneg_left hsquares (sq_nonneg (d : ℝ)) field_simp nlinarith [sq_nonneg (d : ℝ), sq_nonneg (log (n : ℝ)), sq_nonneg (logScale n)] dsimp [B, D] at hmiss calc _ ≤ (16 / epsilon + 12) / n + (1 / epsilon ^ 4) * ((d : ℝ) ^ 2 / ((n : ℝ) ^ 2 * (log n) ^ 2)) := by have hadd := add_le_add (add_le_add hparam hmass) hmiss exact hadd.trans (le_of_eq (by ring)) _ ≤ (16 / epsilon + 12 + 1 / epsilon ^ 4) * minimaxRate n d := by unfold minimaxRate have hr0 : 0 ≤ 1 / (n : ℝ) := by positivity have hr1 : 0 ≤ (d : ℝ) ^ 2 / ((n : ℝ) ^ 2 * (log n) ^ 2) := by positivity have hc0 : 0 ≤ 16 / epsilon + 12 := by positivity have hc1 : 0 ≤ 1 / epsilon ^ 4 := by positivity let K : ℝ := 16 / epsilon + 12 + 1 / epsilon ^ 4 have hAle : 16 / epsilon + 12 ≤ K := by dsimp [K]; linarith have hc1le : 1 / epsilon ^ 4 ≤ K := by dsimp [K]; linarith calc _ = (16 / epsilon + 12) * (1 / (n : ℝ)) + (1 / epsilon ^ 4) * ((d : ℝ) ^ 2 / ((n : ℝ) ^ 2 * (log n) ^ 2)) := by ring _ ≤ K * (1 / (n : ℝ)) + K * ((d : ℝ) ^ 2 / ((n : ℝ) ^ 2 * (log n) ^ 2)) := by exact add_le_add (mul_le_mul_of_nonneg_right hAle hr0) (mul_le_mul_of_nonneg_right hc1le hr1) _ = (16 / epsilon + 12 + 1 / epsilon ^ 4) * (1 / (n : ℝ) + (d : ℝ) ^ 2 / ((n : ℝ) ^ 2 * (log n) ^ 2)) := by dsimp [K] ring
CausalSmith.Stat.DiscreteAteMinimaxLoggap.heavy_fixed_envelope_rate · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCell.lean:1135
theorem universal_heavy_cell_rate Lemma 15 in the paper ↗

The aggregate ratio branch has the same rate on pilot-heavy categories.

Formal statement
epsilon :
he0 :
0 < epsilon
he1 :
epsilon < 1 / 2
∃ C_epsilon rho_epsilon : ℝ,
∃ N_epsilon : ℕ,
0 < C_epsilon ∧
0 < rho_epsilon ∧
∀ (n d : ℕ) (P : DiscreteLaw d) (mu_n : Measure (Fin n → Obs d)),
N_epsilon
≤ n → (d : ℝ) ≤ rho_epsilon * n * log n → ExperimentClass n epsilon P mu_n → componentErrorMSE mu_n heavyContribution (targetHeavy P) ≤ C_epsilon * minimaxRate n d
Proof (Lean source)
lemma universal_heavy_cell_rate (epsilon : ℝ) (he0 : 0 < epsilon) (he1 : epsilon < 1 / 2) : ∃ C_epsilon rho_epsilon : ℝ, ∃ N_epsilon : ℕ, 0 < C_epsilon ∧ 0 < rho_epsilon ∧ ∀ (n d : ℕ) (P : DiscreteLaw d) (mu_n : Measure (Fin n → Obs d)), N_epsilon ≤ n → (d : ℝ) ≤ rho_epsilon * n * log n → ExperimentClass n epsilon P mu_n → componentErrorMSE mu_n heavyContribution (targetHeavy P) ≤ C_epsilon * minimaxRate n d := by rcases heavy_bad_pilot_rate 1 (by norm_num) with ⟨Cbad, Nbad, hCbad, hbad⟩ let K : ℝ := 16 / epsilon + 12 + 1 / epsilon ^ 4 refine ⟨4 * K + Cbad, 1, max 8 (max calibrationCutoff Nbad), ?_, by norm_num, ?_⟩ · dsimp [K] positivity intro n d P mu_n hn hd hclass have hn8 : 8 ≤ n := le_trans (le_max_left _ _) hn have hcut : calibrationCutoff ≤ n := le_trans (le_trans (le_max_left _ _) (le_max_right _ _)) hn have hnBad : Nbad ≤ n := le_trans (le_trans (le_max_right _ _) (le_max_right _ _)) hn have hn : 0 < n := by omega have hnR : (0 : ℝ) < n := by exact_mod_cast hn have hlog : 0 < log (n : ℝ) := Real.log_pos (by exact_mod_cast (show 1 < n by omega)) have hscale : logScale n = 1 + log (n : ℝ) := by rw [logScale, Real.log_mul (by positivity : exp 1 ≠ 0) (by positivity : (n : ℝ) ≠ 0)] simp have hL : 0 < logScale n := by rw [hscale]; positivity have hdPilot : (d : ℝ) ≤ 1 * n * logScale n := by have hlogL : log (n : ℝ) ≤ logScale n := by rw [hscale] linarith calc (d : ℝ) ≤ 1 * n * log n := by simpa using hd _ ≤ 1 * n * logScale n := by gcongr have hm : 3 ≤ splitSize n 1 := by rw [splitSize_one_eq]; omega have hm0 : 0 < splitSize n 0 := by rw [splitSize_zero_eq]; omega let B : ℝ := 256 * logScale n / (2 * splitSize n 0) have hB : 0 < B := by dsimp [B] positivity let V : ℝ := K * minimaxRate n d let base : Obs d := P.pmf.support_nonempty.some have hpGood : ∀ sample : Fin n → Obs d, sample ∉ pilotBadEvent P 256 → ∀ k ∈ heavyCells sample, B ≤ cellMass P k := by intro sample hgood exact heavy_cell_mass_lower_of_good_pilot P sample hcut hgood have hV : ∀ H : Finset (Fin d), (∀ k ∈ H, B ≤ cellMass P k) → 8 * (∑ k ∈ H, cellMass P k) / ((splitSize n 1 : ℝ) * epsilon) + 6 / (splitSize n 1 : ℝ) + 4 * (H.card / (((((splitSize n 1 - 2 : ℕ) : ℝ) / 2 * epsilon) ^ 2) * B)) ^ 2 ≤ V := by intro H hmass exact heavy_fixed_envelope_rate P he0 hn8 H have harm (a : Fin 2) : ∫ sample in (pilotBadEvent P 256)ᶜ, (fixedHeavyArmContribution sample (heavyCells sample) a - fixedTargetArm P (heavyCells sample) a) ^ 2 ∂productLaw P n ≤ V := heavy_good_arm_setIntegral_le P a base hm hclass.overlap he0 hB hpGood hV have hgood : ∫ sample in (pilotBadEvent P 256)ᶜ, (heavyContribution sample - targetHeavy P sample) ^ 2 ∂productLaw P n ≤ 4 * V := by calc _ ≤ ∫ sample in (pilotBadEvent P 256)ᶜ, (2 * (fixedHeavyArmContribution sample (heavyCells sample) 1 - fixedTargetArm P (heavyCells sample) 1) ^ 2 + 2 * (fixedHeavyArmContribution sample (heavyCells sample) 0 - fixedTargetArm P (heavyCells sample) 0) ^ 2) ∂productLaw P n := by apply integral_mono Integrable.of_finite Integrable.of_finite intro sample simpa only [heavyContribution_eq_fixed, targetHeavy_eq_fixed] using fixedHeavy_error_sq_le_two_arms P sample (heavyCells sample) _ = 2 * (∫ sample in (pilotBadEvent P 256)ᶜ, (fixedHeavyArmContribution sample (heavyCells sample) 1 - fixedTargetArm P (heavyCells sample) 1) ^ 2 ∂productLaw P n) + 2 * (∫ sample in (pilotBadEvent P 256)ᶜ, (fixedHeavyArmContribution sample (heavyCells sample) 0 - fixedTargetArm P (heavyCells sample) 0) ^ 2 ∂productLaw P n) := by rw [integral_add Integrable.of_finite Integrable.of_finite, integral_const_mul, integral_const_mul] _ ≤ 2 * V + 2 * V := by gcongr <;> exact harm _ _ = 4 * V := by ring have hbad' : ∫ sample in pilotBadEvent P 256, (heavyContribution sample - targetHeavy P sample) ^ 2 ∂productLaw P n ≤ Cbad * rpow n (-4) := hbad n d P hnBad hdPilot have hrpow : rpow n (-4) ≤ 1 / (n : ℝ) := by change (n : ℝ) ^ (-4 : ℝ) ≤ 1 / (n : ℝ) rw [show (-4 : ℝ) = -(4 : ℝ) by norm_num, Real.rpow_neg (Nat.cast_nonneg n) 4] rw [one_div] apply inv_anti₀ hnR have hn1 : (1 : ℝ) ≤ n := by exact_mod_cast (show 1 ≤ n by omega) simpa using (pow_le_pow_right₀ hn1 (by norm_num : 1 ≤ 4)) have hrate0 : 0 ≤ minimaxRate n d := by unfold minimaxRate positivity have honeRate : 1 / (n : ℝ) ≤ minimaxRate n d := by unfold minimaxRate exact le_add_of_nonneg_right (by positivity) have hbadRate : ∫ sample in pilotBadEvent P 256, (heavyContribution sample - targetHeavy P sample) ^ 2 ∂productLaw P n ≤ Cbad * minimaxRate n d := by calc _ ≤ Cbad * rpow n (-4) := hbad' _ ≤ Cbad * (1 / (n : ℝ)) := by gcongr _ ≤ Cbad * minimaxRate n d := by gcongr have hprod : mu_n = productLaw P n := hclass.product_law unfold componentErrorMSE rw [hprod] calc (∫ sample, (heavyContribution sample - targetHeavy P sample) ^ 2 ∂productLaw P n) = (∫ sample in pilotBadEvent P 256, (heavyContribution sample - targetHeavy P sample) ^ 2 ∂productLaw P n) + ∫ sample in (pilotBadEvent P 256)ᶜ, (heavyContribution sample - targetHeavy P sample) ^ 2 ∂productLaw P n := by symm exact integral_add_compl MeasurableSet.of_discrete Integrable.of_finite _ ≤ Cbad * minimaxRate n d + 4 * V := add_le_add hbadRate hgood _ = (4 * K + Cbad) * minimaxRate n d := by dsimp [V]; ring
CausalSmith.Stat.DiscreteAteMinimaxLoggap.universal_heavy_cell_rate · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCell.lean:1273
Helpers.HeavyCellMoments 103 declarations Probability and finite-sample algebra used by the ratio branch.

Probability and finite-sample algebra used by the ratio branch. These lemmas are deliberately stated independently of the calibrated estimator, so that the handling of an empty empirical treatment arm can be reused.

theorem inverse_count_indicator_le

The elementary pointwise inequality behind the inverse-binomial bound. The indicator is written explicitly to match Lean's total division convention.

Formal statement
D :
(if 0 < D then (D : ℝ)⁻¹ else 0) ≤ 2 * ((D : ℝ) + 1)⁻¹
Proof (Lean source)
lemma inverse_count_indicator_le (D : ℕ) : (if 0 < D then (D : ℝ)⁻¹ else 0) ≤ 2 * ((D : ℝ) + 1)⁻¹ := by by_cases hD : 0 < D · simp only [hD, if_true] have hDR : (1 : ℝ) ≤ D := by exact_mod_cast hD have hDpos : (0 : ℝ) < D := by positivity have hD1pos : (0 : ℝ) < (D : ℝ) + 1 := by positivity have hfrac : 1 / (D : ℝ) ≤ 2 / ((D : ℝ) + 1) := (div_le_div_iff₀ hDpos hD1pos).2 (by nlinarith) simpa only [one_div, div_eq_mul_inv, one_mul] using hfrac · have hDz : D = 0 := Nat.eq_zero_of_not_pos hD simp [hDz]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.inverse_count_indicator_le · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:16
theorem choose_div_succ

Multiplying a binomial coefficient by the reciprocal count shifts the coefficient from row t to row t+1.

Formal statement
t k :
(Nat.choose t k : ℝ) / (k + 1 : ℕ) = (Nat.choose (t + 1) (k + 1) : ℝ) / (t + 1 : ℕ)
Proof (Lean source)
lemma choose_div_succ (t k : ℕ) : (Nat.choose t k : ℝ) / (k + 1 : ℕ) = (Nat.choose (t + 1) (k + 1) : ℝ) / (t + 1 : ℕ) := by have ht : (0 : ℝ) < (t + 1 : ℕ) := by positivity have hk : (0 : ℝ) < (k + 1 : ℕ) := by positivity apply (div_eq_div_iff (ne_of_gt hk) (ne_of_gt ht)).2 have hcast : ((t + 1 : ℕ) : ℝ) * (Nat.choose t k : ℝ) = (Nat.choose (t + 1) (k + 1) : ℝ) * (k + 1 : ℕ) := by exact_mod_cast Nat.add_one_mul_choose_eq t k simpa [mul_comm] using hcast
CausalSmith.Stat.DiscreteAteMinimaxLoggap.choose_div_succ · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:31
theorem binomial_succ_reciprocal_sum

Exact finite-binomial reciprocal identity. This is equation (2) of the heavy-cell proof before dropping the numerator.

Formal statement
t :
rho :
hrho :
rho ≠ 0
(∑ k ∈ range (t + 1), (Nat.choose t k : ℝ) * rho ^ k * (1 - rho) ^ (t - k) / (k + 1 : ℕ))
= (1 - (1 - rho) ^ (t + 1)) / ((t + 1 : ℕ) * rho)
Proof (Lean source)
lemma binomial_succ_reciprocal_sum (t : ℕ) (rho : ℝ) (hrho : rho ≠ 0) : (∑ k ∈ range (t + 1), (Nat.choose t k : ℝ) * rho ^ k * (1 - rho) ^ (t - k) / (k + 1 : ℕ)) = (1 - (1 - rho) ^ (t + 1)) / ((t + 1 : ℕ) * rho) := by have hrow : (∑ k ∈ range (t + 1), (Nat.choose (t + 1) (k + 1) : ℝ) * rho ^ (k + 1) * (1 - rho) ^ (t - k)) = 1 - (1 - rho) ^ (t + 1) := by have hbin := add_pow rho (1 - rho) (t + 1) rw [show rho + (1 - rho) = 1 by ring, one_pow, Finset.sum_range_succ'] at hbin have hbin' : 1 = (∑ k ∈ range (t + 1), (Nat.choose (t + 1) (k + 1) : ℝ) * rho ^ (k + 1) * (1 - rho) ^ (t - k)) + (1 - rho) ^ (t + 1) := by simpa [Nat.add_sub_add_right, mul_comm, mul_left_comm, mul_assoc] using hbin linarith apply (eq_div_iff (mul_ne_zero (by positivity) hrho)).2 rw [Finset.sum_mul] calc (∑ k ∈ range (t + 1), ((Nat.choose t k : ℝ) * rho ^ k * (1 - rho) ^ (t - k) / (k + 1 : ℕ)) * ((t + 1 : ℕ) * rho)) = ∑ k ∈ range (t + 1), (Nat.choose (t + 1) (k + 1) : ℝ) * rho ^ (k + 1) * (1 - rho) ^ (t - k) := by apply Finset.sum_congr rfl intro k hk calc (Nat.choose t k : ℝ) * rho ^ k * (1 - rho) ^ (t - k) / (k + 1 : ℕ) * ((t + 1 : ℕ) * rho) = ((Nat.choose t k : ℝ) / (k + 1 : ℕ)) * rho ^ k * (1 - rho) ^ (t - k) * ((t + 1 : ℕ) * rho) := by ring _ = ((Nat.choose (t + 1) (k + 1) : ℝ) / (t + 1 : ℕ)) * rho ^ k * (1 - rho) ^ (t - k) * ((t + 1 : ℕ) * rho) := by rw [choose_div_succ] _ = (Nat.choose (t + 1) (k + 1) : ℝ) * rho ^ (k + 1) * (1 - rho) ^ (t - k) := by have ht : (((t + 1 : ℕ) : ℝ)) ≠ 0 := by positivity field_simp [ht] ring _ = 1 - (1 - rho) ^ (t + 1) := hrow
CausalSmith.Stat.DiscreteAteMinimaxLoggap.binomial_succ_reciprocal_sum · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:44
theorem binomial_inverse_count_bound

The inverse-binomial estimate used for conditional ratio variance.

Formal statement
t :
rho :
hrho :
0 < rho
hrho1 :
rho ≤ 1
(∑ k ∈ range (t + 1), (Nat.choose t k : ℝ) * rho ^ k * (1 - rho) ^ (t - k) * (if 0 < k then (k : ℝ)⁻¹ else 0))
≤ 2 / ((t + 1 : ℕ) * rho)
Proof (Lean source)
lemma binomial_inverse_count_bound (t : ℕ) (rho : ℝ) (hrho : 0 < rho) (hrho1 : rho ≤ 1) : (∑ k ∈ range (t + 1), (Nat.choose t k : ℝ) * rho ^ k * (1 - rho) ^ (t - k) * (if 0 < k then (k : ℝ)⁻¹ else 0)) ≤ 2 / ((t + 1 : ℕ) * rho) := by have hnonneg : 0 ≤ 1 - rho := sub_nonneg.mpr hrho1 have hden : 0 < ((t + 1 : ℕ) : ℝ) * rho := mul_pos (by positivity) hrho calc (∑ k ∈ range (t + 1), (Nat.choose t k : ℝ) * rho ^ k * (1 - rho) ^ (t - k) * (if 0 < k then (k : ℝ)⁻¹ else 0)) ≤ ∑ k ∈ range (t + 1), (Nat.choose t k : ℝ) * rho ^ k * (1 - rho) ^ (t - k) * (2 * ((k : ℝ) + 1)⁻¹) := by apply Finset.sum_le_sum intro k hk apply mul_le_mul_of_nonneg_left (inverse_count_indicator_le k) positivity _ = 2 * (∑ k ∈ range (t + 1), (Nat.choose t k : ℝ) * rho ^ k * (1 - rho) ^ (t - k) / (k + 1 : ℕ)) := by rw [Finset.mul_sum] apply Finset.sum_congr rfl intro k hk norm_num [div_eq_mul_inv] ring _ = 2 * ((1 - (1 - rho) ^ (t + 1)) / ((t + 1 : ℕ) * rho)) := by rw [binomial_succ_reciprocal_sum t rho (ne_of_gt hrho)] _ ≤ 2 / ((t + 1 : ℕ) * rho) := by have hpow : 0 ≤ (1 - rho) ^ (t + 1) := pow_nonneg hnonneg _ have hnum : 1 - (1 - rho) ^ (t + 1) ≤ 1 := by linarith rw [show 2 / (((t + 1 : ℕ) : ℝ) * rho) = 2 * (1 / (((t + 1 : ℕ) : ℝ) * rho)) by ring] gcongr
CausalSmith.Stat.DiscreteAteMinimaxLoggap.binomial_inverse_count_bound · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:91
theorem binomial_first_moment

First moment of the finite binomial weights.

Formal statement
m :
p :
(∑ t ∈ range (m + 1), (Nat.choose m t : ℝ) * p ^ t * (1 - p) ^ (m - t) * t)
= (m : ℝ) * p
Proof (Lean source)
lemma binomial_first_moment (m : ℕ) (p : ℝ) : (∑ t ∈ range (m + 1), (Nat.choose m t : ℝ) * p ^ t * (1 - p) ^ (m - t) * t) = (m : ℝ) * p := by cases m with | zero => simp | succ M => rw [Finset.sum_range_succ'] simp only [Nat.choose_zero_right, pow_zero, cast_zero, mul_zero, zero_add, add_zero, Nat.cast_add, cast_one] calc (∑ k ∈ range (M + 1), (Nat.choose (M + 1) (k + 1) : ℝ) * p ^ (k + 1) * (1 - p) ^ (M + 1 - (k + 1)) * ((k : ℝ) + 1)) = ((M : ℝ) + 1) * p * ∑ k ∈ range (M + 1), (Nat.choose M k : ℝ) * p ^ k * (1 - p) ^ (M - k) := by rw [Finset.mul_sum] apply Finset.sum_congr rfl intro k hk have hkM : k ≤ M := Nat.le_of_lt_succ (Finset.mem_range.mp hk) have hchoose : (Nat.choose (M + 1) (k + 1) : ℝ) * (k + 1 : ℕ) = (M + 1 : ℕ) * (Nat.choose M k : ℝ) := by exact_mod_cast (Nat.add_one_mul_choose_eq M k).symm norm_num only [Nat.cast_add, cast_one] at hchoose rw [Nat.add_sub_add_right] rw [pow_succ] calc (Nat.choose (M + 1) (k + 1) : ℝ) * (p ^ k * p) * (1 - p) ^ (M - k) * ((k : ℝ) + 1) = ((Nat.choose (M + 1) (k + 1) : ℝ) * ((k : ℝ) + 1)) * p ^ k * p * (1 - p) ^ (M - k) := by ring _ = (((M : ℝ) + 1) * (Nat.choose M k : ℝ)) * p ^ k * p * (1 - p) ^ (M - k) := by rw [hchoose] _ = ((M : ℝ) + 1) * p * ((Nat.choose M k : ℝ) * p ^ k * (1 - p) ^ (M - k)) := by ring _ = ((M : ℝ) + 1) * p * (p + (1 - p)) ^ M := by congr 1 rw [add_pow] apply Finset.sum_congr rfl intro k hk ring _ = ((M : ℝ) + 1) * p := by ring
CausalSmith.Stat.DiscreteAteMinimaxLoggap.binomial_first_moment · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:129
theorem nested_binomial_ratio_bound

Pure nested-binomial ratio bound. This is the complete analytic calculation after conditioning a category count N to equal t: the arm count is binomial with success probability rho, and the outer category count is binomial with success probability p.

Formal statement
m :
p rho :
hp0 :
0 ≤ p
hp1 :
p ≤ 1
hrho :
0 < rho
hrho1 :
rho ≤ 1
(∑ t ∈ range (m + 1), (Nat.choose m t : ℝ) * p ^ t * (1 - p) ^ (m - t) * (t : ℝ) ^ 2 * (∑ l ∈ range (t + 1), (Nat.choose t l : ℝ) * rho ^ l * (1 - rho) ^ (t - l) * (if 0 < l then (l : ℝ)⁻¹ else 0)))
≤ 2 * (m : ℝ) * p / rho
Proof (Lean source)
lemma nested_binomial_ratio_bound (m : ℕ) (p rho : ℝ) (hp0 : 0 ≤ p) (hp1 : p ≤ 1) (hrho : 0 < rho) (hrho1 : rho ≤ 1) : (∑ t ∈ range (m + 1), (Nat.choose m t : ℝ) * p ^ t * (1 - p) ^ (m - t) * (t : ℝ) ^ 2 * (∑ l ∈ range (t + 1), (Nat.choose t l : ℝ) * rho ^ l * (1 - rho) ^ (t - l) * (if 0 < l then (l : ℝ)⁻¹ else 0))) ≤ 2 * (m : ℝ) * p / rho := by calc _ ≤ ∑ t ∈ range (m + 1), (Nat.choose m t : ℝ) * p ^ t * (1 - p) ^ (m - t) * (t : ℝ) ^ 2 * (2 / ((t + 1 : ℕ) * rho)) := by apply Finset.sum_le_sum intro t ht have hq0 : 0 ≤ 1 - p := sub_nonneg.mpr hp1 have hbase : 0 ≤ (Nat.choose m t : ℝ) * p ^ t * (1 - p) ^ (m - t) := by positivity have hcoef : 0 ≤ (Nat.choose m t : ℝ) * p ^ t * (1 - p) ^ (m - t) * (t : ℝ) ^ 2 := mul_nonneg hbase (sq_nonneg _) exact mul_le_mul_of_nonneg_left (binomial_inverse_count_bound t rho hrho hrho1) hcoef _ ≤ ∑ t ∈ range (m + 1), (Nat.choose m t : ℝ) * p ^ t * (1 - p) ^ (m - t) * ((2 / rho) * t) := by apply Finset.sum_le_sum intro t ht have hq0 : 0 ≤ 1 - p := sub_nonneg.mpr hp1 have hbase : 0 ≤ (Nat.choose m t : ℝ) * p ^ t * (1 - p) ^ (m - t) := by positivity have ht0 : (0 : ℝ) ≤ t := by positivity have hden : (0 : ℝ) < (t + 1 : ℕ) * rho := by positivity calc (Nat.choose m t : ℝ) * p ^ t * (1 - p) ^ (m - t) * (t : ℝ) ^ 2 * (2 / ((t + 1 : ℕ) * rho)) = ((Nat.choose m t : ℝ) * p ^ t * (1 - p) ^ (m - t)) * ((t : ℝ) ^ 2 * (2 / ((t + 1 : ℕ) * rho))) := by ring _ ≤ ((Nat.choose m t : ℝ) * p ^ t * (1 - p) ^ (m - t)) * ((2 / rho) * t) := by apply mul_le_mul_of_nonneg_left _ hbase calc (t : ℝ) ^ 2 * (2 / ((t + 1 : ℕ) * rho)) = (2 / rho) * (t ^ 2 / (t + 1 : ℕ)) := by field_simp <;> ring _ ≤ (2 / rho) * t := by gcongr apply (div_le_iff₀ (by positivity : (0 : ℝ) < (t + 1 : ℕ))).2 norm_num only [Nat.cast_add, cast_one] nlinarith _ = (2 / rho) * (∑ t ∈ range (m + 1), (Nat.choose m t : ℝ) * p ^ t * (1 - p) ^ (m - t) * t) := by rw [Finset.mul_sum] apply Finset.sum_congr rfl intro t ht ring _ = (2 / rho) * ((m : ℝ) * p) := by rw [binomial_first_moment] _ = 2 * (m : ℝ) * p / rho := by ring
CausalSmith.Stat.DiscreteAteMinimaxLoggap.nested_binomial_ratio_bound · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:176
theorem setBernoulli_inverse_ncard

Exact inverse-cardinality expectation for a Bernoulli random subset of a fixed finite set. This supplies the conditional arm-count law without any abstract regular-conditional-probability API.

Formal statement
J :
U :
rho :
hr0 :
0 ≤ rho
hr1 :
rho ≤ 1
∫ S : Set J, (if 0 < S.ncard then (S.ncard : ℝ)⁻¹ else 0) ∂setBer((U : Set J), (⟨rho, hr0, hr1⟩ : unitInterval))
= ∑ l ∈ range (U.card + 1), (Nat.choose U.card l : ℝ) * rho ^ l * (1 - rho) ^ (U.card - l) * (if 0 < l then (l : ℝ)⁻¹ else 0)
Proof (Lean source)
lemma setBernoulli_inverse_ncard {J : Type*} [Fintype J] [DecidableEq J] (U : Finset J) (rho : ℝ) (hr0 : 0 ≤ rho) (hr1 : rho ≤ 1) : ∫ S : Set J, (if 0 < S.ncard then (S.ncard : ℝ)⁻¹ else 0) ∂setBer((U : Set J), (⟨rho, hr0, hr1⟩ : unitInterval)) = ∑ l ∈ range (U.card + 1), (Nat.choose U.card l : ℝ) * rho ^ l * (1 - rho) ^ (U.card - l) * (if 0 < l then (l : ℝ)⁻¹ else 0) := by classical rw [integral_fintype Integrable.of_finite] let q : unitInterval := ⟨rho, hr0, hr1⟩ let e : Finset J ↪ Set J := ⟨fun V => (V : Set J), fun V W h => Finset.coe_injective h⟩ have he : ∀ V : Finset J, e V = (V : Set J) := fun _ => rfl have hzero (S : Set J) (hS : ¬ S ⊆ (U : Set J)) : setBer((U : Set J), q).real {S} = 0 := by have hae := setBernoulli_ae_subset (u := (U : Set J)) (p := q) have hnull : setBer((U : Set J), q) {T : Set J | ¬ T ⊆ (U : Set J)} = 0 := by exact mem_ae_iff.mp hae have hsingle : ({S} : Set (Set J)) ⊆ {T : Set J | ¬ T ⊆ (U : Set J)} := by intro T hT simpa only [Set.mem_singleton_iff, Set.mem_setOf_eq] using hT ▸ hS rw [measureReal_def, measure_mono_null hsingle hnull] rfl have hfilter : ((Finset.univ : Finset (Set J)).filter fun S => S ⊆ (U : Set J)) = U.powerset.map e := by ext S simp only [mem_filter, Finset.mem_univ, true_and, Finset.mem_map, Finset.mem_powerset] constructor · intro hS let V : Finset J := S.toFinite.toFinset refine ⟨V, ?_, ?_⟩ · simpa [V] using hS · ext j simp [he, V] · rintro ⟨V, hVU, rfl⟩ simpa [he] using hVU calc (∑ S : Set J, setBer((U : Set J), q).real {S} • (if 0 < S.ncard then (S.ncard : ℝ)⁻¹ else 0)) = ∑ S ∈ (Finset.univ : Finset (Set J)).filter (fun S => S ⊆ (U : Set J)), setBer((U : Set J), q).real {S} * (if 0 < S.ncard then (S.ncard : ℝ)⁻¹ else 0) := by rw [Finset.sum_filter] apply Finset.sum_congr rfl intro S hS by_cases hsub : S ⊆ (U : Set J) · simp [hsub, smul_eq_mul] · simp [hsub, hzero S hsub, smul_eq_mul] _ = ∑ V ∈ U.powerset, setBer((U : Set J), q).real {(V : Set J)} * (if 0 < V.card then (V.card : ℝ)⁻¹ else 0) := by rw [hfilter, Finset.sum_map] apply Finset.sum_congr rfl intro V hV simp [he, Set.ncard_coe_finset] _ = ∑ V ∈ U.powerset, rho ^ V.card * (1 - rho) ^ (U.card - V.card) * (if 0 < V.card then (V.card : ℝ)⁻¹ else 0) := by apply Finset.sum_congr rfl intro V hV have hVU : (V : Set J) ⊆ (U : Set J) := by simpa using Finset.mem_powerset.mp hV have hVUfin : V ⊆ U := Finset.coe_subset.mp hVU have hdiff : ((U : Set J) \ (V : Set J)).ncard = U.card - V.card := by rw [← Finset.coe_sdiff, Set.ncard_coe_finset, Finset.card_sdiff_of_subset hVUfin] rw [show setBer((U : Set J), q).real {(V : Set J)} = rho ^ V.card * (1 - rho) ^ (U.card - V.card) by rw [measureReal_def, setBernoulli_singleton (u := (U : Set J)) (p := q) (s := (V : Set J)) hVU (Set.toFinite (U : Set J)), hdiff] simp [q, Set.ncard_coe_finset]] _ = ∑ l ∈ range (U.card + 1), (Nat.choose U.card l : ℝ) * rho ^ l * (1 - rho) ^ (U.card - l) * (if 0 < l then (l : ℝ)⁻¹ else 0) := by let f : ℕ → ℝ := fun l => rho ^ l * (1 - rho) ^ (U.card - l) * (if 0 < l then (l : ℝ)⁻¹ else 0) change (∑ V ∈ U.powerset, f V.card) = _ rw [Finset.sum_powerset_apply_card f] simp only [nsmul_eq_mul] apply Finset.sum_congr rfl intro l hl simp only [f] ring
CausalSmith.Stat.DiscreteAteMinimaxLoggap.setBernoulli_inverse_ncard · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:243
theorem setBernoulli_inverse_ncard_le

Conditional inverse arm-count bound on a fixed active category set.

Formal statement
J :
U :
rho :
hrho :
0 < rho
hrho1 :
rho ≤ 1
∫ S : Set J, (if 0 < S.ncard then (S.ncard : ℝ)⁻¹ else 0) ∂setBer((U : Set J), (⟨rho, hrho.le, hrho1⟩ : unitInterval))
≤ 2 / ((U.card + 1 : ℕ) * rho)
Proof (Lean source)
lemma setBernoulli_inverse_ncard_le {J : Type*} [Fintype J] [DecidableEq J] (U : Finset J) (rho : ℝ) (hrho : 0 < rho) (hrho1 : rho ≤ 1) : ∫ S : Set J, (if 0 < S.ncard then (S.ncard : ℝ)⁻¹ else 0) ∂setBer((U : Set J), (⟨rho, hrho.le, hrho1⟩ : unitInterval)) ≤ 2 / ((U.card + 1 : ℕ) * rho) := by rw [setBernoulli_inverse_ncard U rho hrho.le hrho1] exact binomial_inverse_count_bound U.card rho hrho hrho1
CausalSmith.Stat.DiscreteAteMinimaxLoggap.setBernoulli_inverse_ncard_le · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:337
theorem one_sub_pow_le_exp_neg_mul

Elementary exponential envelope used after the exact missing-arm moments have been counted.

Formal statement
r :
m :
hr1 :
r ≤ 1
(1 - r) ^ m ≤ exp (-(m : ℝ) * r)
Proof (Lean source)
lemma one_sub_pow_le_exp_neg_mul (r : ℝ) (m : ℕ) (hr1 : r ≤ 1) : (1 - r) ^ m ≤ exp (-(m : ℝ) * r) := by calc (1 - r) ^ m ≤ (exp (-r)) ^ m := by exact pow_le_pow_left₀ (sub_nonneg.mpr hr1) (Real.one_sub_le_exp_neg r) m _ = exp ((m : ℝ) * (-r)) := (Real.exp_nat_mul (-r) m).symm _ = exp (-(m : ℝ) * r) := by congr 1 <;> ring
CausalSmith.Stat.DiscreteAteMinimaxLoggap.one_sub_pow_le_exp_neg_mul · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:346
theorem missing_arm_second_moment_exp_bound

Exponential upper bound for the exact diagonal missing-arm second-moment formula. No asymptotics or independence approximation enters this step.

Formal statement
m :
r s :
hr1 :
r ≤ 1
hs0 :
0 ≤ s
(m : ℝ) * s * (1 - r) ^ (m - 1) + (m.descFactorial 2 : ℝ) * s ^ 2 * (1 - r) ^ (m - 2)
≤ (m : ℝ) * s * exp (-(m - 1 : ℕ) * r)
+ (m.descFactorial 2 : ℝ) * s ^ 2 * exp (-(m - 2 : ℕ) * r)
Proof (Lean source)
lemma missing_arm_second_moment_exp_bound (m : ℕ) (r s : ℝ) (hr1 : r ≤ 1) (hs0 : 0 ≤ s) : (m : ℝ) * s * (1 - r) ^ (m - 1) + (m.descFactorial 2 : ℝ) * s ^ 2 * (1 - r) ^ (m - 2) ≤ (m : ℝ) * s * exp (-(m - 1 : ℕ) * r) + (m.descFactorial 2 : ℝ) * s ^ 2 * exp (-(m - 2 : ℕ) * r) := by apply add_le_add · gcongr simpa using one_sub_pow_le_exp_neg_mul r (m - 1) hr1 · gcongr simpa using one_sub_pow_le_exp_neg_mul r (m - 2) hr1
CausalSmith.Stat.DiscreteAteMinimaxLoggap.missing_arm_second_moment_exp_bound · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:358
theorem missing_arm_exp_overlap_bound

Overlap substitution in the missing-arm exponential envelope.

Formal statement
m :
r p epsilon :
hr :
epsilon * p ≤ r
exp (-(m : ℝ) * r) ≤ exp (-(m : ℝ) * epsilon * p)
Proof (Lean source)
lemma missing_arm_exp_overlap_bound (m : ℕ) (r p epsilon : ℝ) (hr : epsilon * p ≤ r) : exp (-(m : ℝ) * r) ≤ exp (-(m : ℝ) * epsilon * p) := by apply Real.exp_le_exp.mpr have hm : (0 : ℝ) ≤ m := by positivity nlinarith
CausalSmith.Stat.DiscreteAteMinimaxLoggap.missing_arm_exp_overlap_bound · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:373
theorem exp_neg_le_inv_sq

A quadratic envelope for exponential decay. This is the analytic step that converts the heavy-cell mass lower bound into the extra logarithm in the aggregate missing-arm term.

Formal statement
t :
ht :
0 < t
exp (-t) ≤ (t ^ 2)⁻¹
Proof (Lean source)
lemma exp_neg_le_inv_sq (t : ℝ) (ht : 0 < t) : exp (-t) ≤ (t ^ 2)⁻¹ := by have hlin : t ≤ exp (t / 2) := by convert Real.two_mul_le_exp (x := t / 2) using 1 <;> ring have hsq : t ^ 2 ≤ exp t := by calc t ^ 2 ≤ (exp (t / 2)) ^ 2 := pow_le_pow_left₀ ht.le hlin 2 _ = exp t := by rw [← Real.exp_nat_mul]; congr 1 <;> ring rw [Real.exp_neg] exact inv_anti₀ (sq_pos_of_pos ht) hsq
CausalSmith.Stat.DiscreteAteMinimaxLoggap.exp_neg_le_inv_sq · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:381
theorem sum_mass_mul_exp_neg_mul_le

Aggregate exponential envelope on a set of cells whose masses are all at least B. With u of order the estimation-fold size and B of order log n / n, this is exactly the d / (n log n) term.

Formal statement
J :
H :
p :
J → ℝ
u B :
hu :
0 < u
hB :
0 < B
hp :
∀ k ∈ H, B ≤ p k
∑ k ∈ H, p k * exp (-u * p k) ≤ H.card / (u ^ 2 * B)
Proof (Lean source)
lemma sum_mass_mul_exp_neg_mul_le {J : Type*} [Fintype J] [DecidableEq J] (H : Finset J) (p : J → ℝ) (u B : ℝ) (hu : 0 < u) (hB : 0 < B) (hp : ∀ k ∈ H, B ≤ p k) : ∑ k ∈ H, p k * exp (-u * p k) ≤ H.card / (u ^ 2 * B) := by calc ∑ k ∈ H, p k * exp (-u * p k) ≤ ∑ _k ∈ H, 1 / (u ^ 2 * B) := by apply Finset.sum_le_sum intro k hk have hpk : 0 < p k := hB.trans_le (hp k hk) have hut : 0 < u * p k := mul_pos hu hpk calc p k * exp (-u * p k) ≤ p k * ((u * p k) ^ 2)⁻¹ := by gcongr simpa only [neg_mul] using exp_neg_le_inv_sq (u * p k) hut _ = 1 / (u ^ 2 * p k) := by field_simp [hu.ne', hpk.ne'] _ ≤ 1 / (u ^ 2 * B) := by apply one_div_le_one_div_of_le · positivity · gcongr exact hp k hk _ = H.card / (u ^ 2 * B) := by simp [div_eq_mul_inv]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.sum_mass_mul_exp_neg_mul_le · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:395
theorem jointMass_true_eq_outcomeMean_mul_armMass

The observed success mass in one treatment arm factors into its arm mass and conditional outcome mean. The statement also handles a zero-mass arm, where Lean's totalized conditional mean is zero.

Formal statement
d :
P :
k :
Fin d
a :
jointMass P k a true = outcomeMean P a k * armMass P k a
Proof (Lean source)
lemma jointMass_true_eq_outcomeMean_mul_armMass {d : ℕ} (P : DiscreteLaw d) (k : Fin d) (a : Bool) : jointMass P k a true = outcomeMean P a k * armMass P k a := by by_cases h : armMass P k a = 0 · have h0 := (jointMass_mem_unitInterval P k a false).1 have h1 := (jointMass_mem_unitInterval P k a true).1 have hy : jointMass P k a true = 0 := by simp [armMass] at h linarith simp [h, hy] · rw [outcomeMean] field_simp
CausalSmith.Stat.DiscreteAteMinimaxLoggap.jointMass_true_eq_outcomeMean_mul_armMass · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:424
def armOutcomeResidual

One-observation outcome residual for a specified category and arm.

Definition (Lean source)
noncomputable def armOutcomeResidual {d : ℕ} (P : DiscreteLaw d) (k : Fin d) (a : Fin 2) (z : Obs d) : ℝ := if z.1 = k ∧ z.2.1 = finTwoEquiv a then (if z.2.2 then 1 else 0) - outcomeMean P (finTwoEquiv a) k else 0
CausalSmith.Stat.DiscreteAteMinimaxLoggap.armOutcomeResidual · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:440
theorem integral_armOutcomeResidual_eq_zero

The category-arm outcome residual is centered under one observation.

Formal statement
d :
P :
k :
Fin d
a :
Fin 2
∫ z, armOutcomeResidual P k a z ∂obsLaw P = 0
Proof (Lean source)
lemma integral_armOutcomeResidual_eq_zero {d : ℕ} (P : DiscreteLaw d) (k : Fin d) (a : Fin 2) : ∫ z, armOutcomeResidual P k a z ∂obsLaw P = 0 := by rw [show obsLaw P = P.pmf.toMeasure by rfl, PMF.integral_eq_sum] unfold armOutcomeResidual simp only [Fintype.sum_prod_type] fin_cases a · simp only [finTwoEquiv, Fin.isValue, Bool.false_eq_true, and_false, ite_false, Bool.if_false_right, Bool.if_false_left, Bool.if_true_right, Bool.if_true_left] simp [jointMass] simp only [Finset.sum_add_distrib, Finset.sum_ite_eq', Finset.mem_univ, if_true] have hy : (P.pmf (k, false, true)).toReal = outcomeMean P false k * ((P.pmf (k, false, true)).toReal + (P.pmf (k, false, false)).toReal) := by simpa [jointMass, armMass] using jointMass_true_eq_outcomeMean_mul_armMass P k false nlinarith · simp only [finTwoEquiv, Fin.isValue, Bool.true_eq_false, and_false, ite_false, Bool.if_false_right, Bool.if_false_left, Bool.if_true_right, Bool.if_true_left] simp [jointMass] have hy : (P.pmf (k, true, true)).toReal = outcomeMean P true k * ((P.pmf (k, true, true)).toReal + (P.pmf (k, true, false)).toReal) := by simpa [jointMass, armMass] using jointMass_true_eq_outcomeMean_mul_armMass P k true nlinarith
CausalSmith.Stat.DiscreteAteMinimaxLoggap.integral_armOutcomeResidual_eq_zero · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:447
theorem integral_designWeight_mul_armOutcomeResidual_eq_zero

A multiplier depending on an observation only through its category and treatment design preserves residual centering.

Formal statement
d :
P :
k :
Fin d
a :
Fin 2
q :
Obs d → ℝ
hq :
∀ (l : Fin d) (b y y' : Bool), q (l, b, y) = q (l, b, y')
∫ z, q z * armOutcomeResidual P k a z ∂obsLaw P = 0
Proof (Lean source)
lemma integral_designWeight_mul_armOutcomeResidual_eq_zero {d : ℕ} (P : DiscreteLaw d) (k : Fin d) (a : Fin 2) (q : Obs d → ℝ) (hq : ∀ (l : Fin d) (b y y' : Bool), q (l, b, y) = q (l, b, y')) : ∫ z, q z * armOutcomeResidual P k a z ∂obsLaw P = 0 := by rw [show obsLaw P = P.pmf.toMeasure by rfl, PMF.integral_eq_sum] unfold armOutcomeResidual simp only [Fintype.sum_prod_type] fin_cases a · simp only [finTwoEquiv, Fin.isValue, Bool.false_eq_true, and_false, ite_false, Bool.if_false_right, Bool.if_false_left, Bool.if_true_right, Bool.if_true_left] rw [Finset.sum_eq_single k] · simp [finTwoEquiv, jointMass] have hqk := hq k false true false have hy : (P.pmf (k, false, true)).toReal = outcomeMean P false k * ((P.pmf (k, false, true)).toReal + (P.pmf (k, false, false)).toReal) := by simpa [jointMass, armMass] using jointMass_true_eq_outcomeMean_mul_armMass P k false rw [hqk] linear_combination q (k, false, false) * hy · intro l hl hlk simp [hlk] · simp · simp only [finTwoEquiv, Fin.isValue, Bool.true_eq_false, and_false, ite_false, Bool.if_false_right, Bool.if_false_left, Bool.if_true_right, Bool.if_true_left] rw [Finset.sum_eq_single k] · simp [finTwoEquiv, jointMass] have hqk := hq k true true false have hy : (P.pmf (k, true, true)).toReal = outcomeMean P true k * ((P.pmf (k, true, true)).toReal + (P.pmf (k, true, false)).toReal) := by simpa [jointMass, armMass] using jointMass_true_eq_outcomeMean_mul_armMass P k true rw [hqk] linear_combination q (k, true, false) * hy · intro l hl hlk simp [hlk] · simp
CausalSmith.Stat.DiscreteAteMinimaxLoggap.integral_designWeight_mul_armOutcomeResidual_eq_zero · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:479
def replaceOutcome

Replace only the outcome coordinate of observation i.

Definition (Lean source)
noncomputable def replaceOutcome {I : Type*} [DecidableEq I] {d : ℕ} (z : I → Obs d) (i : I) (y : Bool) : I → Obs d := update z i ((z i).1, (z i).2.1, y)
theorem replaceOutcome_apply_same

Overwriting the outcome coordinate of one observation leaves that observation's category and treatment coordinates unchanged and installs the new outcome value.

Formal statement
I :
d :
z :
I → Obs d
i :
I
y :
replaceOutcome z i y i = ((z i).1, (z i).2.1, y)
Proof (Lean source)
lemma replaceOutcome_apply_same {I : Type*} [DecidableEq I] {d : ℕ} (z : I → Obs d) (i : I) (y : Bool) : replaceOutcome z i y i = ((z i).1, (z i).2.1, y) := by simp [replaceOutcome]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.replaceOutcome_apply_same · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:529
theorem replaceOutcome_apply_ne

Overwriting the outcome coordinate of one observation leaves every other observation of the tuple untouched.

Formal statement
I :
d :
z :
I → Obs d
i j :
I
hji :
j ≠ i
y :
replaceOutcome z i y j = z j
Proof (Lean source)
lemma replaceOutcome_apply_ne {I : Type*} [DecidableEq I] {d : ℕ} (z : I → Obs d) (i j : I) (hji : j ≠ i) (y : Bool) : replaceOutcome z i y j = z j := by simp [replaceOutcome, hji]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.replaceOutcome_apply_ne · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:536
theorem integral_coordinate_designWeight_residual_eq_zero

Finite-product conditional-centering lemma. Any sample multiplier that is unchanged when only outcome i is replaced is orthogonal to the centered category-arm residual at i.

Formal statement
I :
d :
P :
i :
I
k :
Fin d
a :
Fin 2
F :
(I → Obs d) → ℝ
hF :
∀ z y, F (replaceOutcome z i y) = F z
∫ z : I → Obs d, F z * armOutcomeResidual P k a (z i) ∂(Measure.pi (fun _ : I => obsLaw P))
= 0
Proof (Lean source)
lemma integral_coordinate_designWeight_residual_eq_zero {I : Type*} [Fintype I] [DecidableEq I] {d : ℕ} (P : DiscreteLaw d) (i : I) (k : Fin d) (a : Fin 2) (F : (I → Obs d) → ℝ) (hF : ∀ z y, F (replaceOutcome z i y) = F z) : ∫ z : I → Obs d, F z * armOutcomeResidual P k a (z i) ∂(Measure.pi (fun _ : I => obsLaw P)) = 0 := by classical let p : I → Prop := fun j => j ≠ i let E := MeasurableEquiv.piEquivPiSubtypeProd (fun _ : I => Obs d) p let μrest : Measure ({j : I // p j} → Obs d) := Measure.pi (fun _ : {j : I // p j} => obsLaw P) let μone : Measure ({j : I // ¬ p j} → Obs d) := Measure.pi (fun _ : {j : I // ¬ p j} => obsLaw P) let g : (({j : I // p j} → Obs d) × ({j : I // ¬ p j} → Obs d)) → ℝ := fun uv => F (E.symm uv) * armOutcomeResidual P k a (E.symm uv i) have hmp := measurePreserving_piEquivPiSubtypeProd (fun _ : I => obsLaw P) p have hcomp : (fun z : I → Obs d => F z * armOutcomeResidual P k a (z i)) = fun z => g (E z) := by funext z simp [g, E] rw [hcomp, hmp.integral_comp E.measurableEmbedding g] rw [integral_prod g Integrable.of_finite] apply integral_eq_zero_of_ae filter_upwards with u let i0 : {j : I // ¬ p j} := ⟨i, by simp [p]⟩ let q : Obs d → ℝ := fun x => F (E.symm (u, fun _ => x)) have hq : ∀ (l : Fin d) (b y y' : Bool), q (l, b, y) = q (l, b, y') := by intro l b y y' let z := E.symm (u, fun _ => (l, b, y')) have hz : replaceOutcome z i y = E.symm (u, fun _ => (l, b, y)) := by funext j by_cases hji : j = i · subst j simp [replaceOutcome, z, E, p, MeasurableEquiv.piEquivPiSubtypeProd, Equiv.piEquivPiSubtypeProd] · simp [replaceOutcome, hji, z, E, p, MeasurableEquiv.piEquivPiSubtypeProd, Equiv.piEquivPiSubtypeProd] change F (E.symm (u, fun _ => (l, b, y))) = F (E.symm (u, fun _ => (l, b, y'))) rw [← hz, hF] have hinner : (fun v => g (u, v)) = fun v => q (v i0) * armOutcomeResidual P k a (v i0) := by funext v have hvfun : v = fun _ => v i0 := by funext t congr 1 apply Subtype.ext exact (not_ne_iff.mp t.2).trans (by rfl) rw [hvfun] simp [g, q, E, p, i0, MeasurableEquiv.piEquivPiSubtypeProd, Equiv.piEquivPiSubtypeProd] have heval := integral_pi_eval_eq (P := obsLaw P) i0 (f := fun x => q x * armOutcomeResidual P k a x) Integrable.of_finite rw [hinner, heval] exact integral_designWeight_mul_armOutcomeResidual_eq_zero P k a q hq
CausalSmith.Stat.DiscreteAteMinimaxLoggap.integral_coordinate_designWeight_residual_eq_zero · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:543
theorem integral_armOutcomeResidual_sq_le_armMass

The one-observation residual second moment is bounded by the probability of its category-arm. This is the diagonal input for the ratio variance.

Formal statement
d :
P :
k :
Fin d
a :
Fin 2
∫ z, (armOutcomeResidual P k a z) ^ 2 ∂obsLaw P ≤ armMass P k (finTwoEquiv a)
Proof (Lean source)
lemma integral_armOutcomeResidual_sq_le_armMass {d : ℕ} (P : DiscreteLaw d) (k : Fin d) (a : Fin 2) : ∫ z, (armOutcomeResidual P k a z) ^ 2 ∂obsLaw P ≤ armMass P k (finTwoEquiv a) := by rw [show obsLaw P = P.pmf.toMeasure by rfl, PMF.integral_eq_sum] unfold armOutcomeResidual have hmu (b : Bool) := outcomeMean_mem_unitInterval P b k fin_cases a · simp only [Fintype.sum_prod_type, finTwoEquiv, Fin.isValue, Bool.false_eq_true, and_false, ite_false, Bool.if_false_right, Bool.if_false_left, Bool.if_true_right, Bool.if_true_left] simp [jointMass] simp only [Finset.sum_add_distrib, Finset.sum_ite_eq', Finset.mem_univ, if_true] have hy : (P.pmf (k, false, true)).toReal = outcomeMean P false k * armMass P k false := by simpa [jointMass] using jointMass_true_eq_outcomeMean_mul_armMass P k false have hs : armMass P k false = (P.pmf (k, false, false)).toReal + (P.pmf (k, false, true)).toReal := by simp [armMass, jointMass] ring have hvar : (P.pmf (k, false, false)).toReal * (0 - outcomeMean P false k) ^ 2 + (P.pmf (k, false, true)).toReal * (1 - outcomeMean P false k) ^ 2 = armMass P k false * outcomeMean P false k * (1 - outcomeMean P false k) := by rw [hy] nlinarith have harm : 0 ≤ armMass P k false := by unfold armMass exact sum_nonneg fun y _ => (jointMass_mem_unitInterval P k false y).1 calc (P.pmf (k, false, true)).toReal * (1 - outcomeMean P false k) ^ 2 + (P.pmf (k, false, false)).toReal * outcomeMean P false k ^ 2 = (P.pmf (k, false, false)).toReal * (0 - outcomeMean P false k) ^ 2 + (P.pmf (k, false, true)).toReal * (1 - outcomeMean P false k) ^ 2 := by ring _ = armMass P k false * outcomeMean P false k * (1 - outcomeMean P false k) := hvar _ ≤ armMass P k false := by nlinarith [mul_nonneg harm (mul_nonneg (hmu false).1 (sub_nonneg.mpr (hmu false).2))] · simp only [Fintype.sum_prod_type, finTwoEquiv, Fin.isValue, Bool.true_eq_false, and_false, ite_false, Bool.if_false_right, Bool.if_false_left, Bool.if_true_right, Bool.if_true_left] simp [jointMass] have hy : (P.pmf (k, true, true)).toReal = outcomeMean P true k * armMass P k true := by simpa [jointMass] using jointMass_true_eq_outcomeMean_mul_armMass P k true have hs : armMass P k true = (P.pmf (k, true, false)).toReal + (P.pmf (k, true, true)).toReal := by simp [armMass, jointMass] ring have hvar : (P.pmf (k, true, false)).toReal * (0 - outcomeMean P true k) ^ 2 + (P.pmf (k, true, true)).toReal * (1 - outcomeMean P true k) ^ 2 = armMass P k true * outcomeMean P true k * (1 - outcomeMean P true k) := by rw [hy] nlinarith have harm : 0 ≤ armMass P k true := by unfold armMass exact sum_nonneg fun y _ => (jointMass_mem_unitInterval P k true y).1 calc (P.pmf (k, true, true)).toReal * (1 - outcomeMean P true k) ^ 2 + (P.pmf (k, true, false)).toReal * outcomeMean P true k ^ 2 = (P.pmf (k, true, false)).toReal * (0 - outcomeMean P true k) ^ 2 + (P.pmf (k, true, true)).toReal * (1 - outcomeMean P true k) ^ 2 := by ring _ = armMass P k true * outcomeMean P true k * (1 - outcomeMean P true k) := hvar _ ≤ armMass P k true := by nlinarith [mul_nonneg harm (mul_nonneg (hmu true).1 (sub_nonneg.mpr (hmu true).2))]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.integral_armOutcomeResidual_sq_le_armMass · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:611
def categorySet

The one-observation event that the confounder equals the given category.

Definition (Lean source)
noncomputable def categorySet {d : ℕ} (k : Fin d) : Set (Obs d) := {z | z.1 = k}
def categoryArmSet

The nested one-observation category and treatment-arm event.

Definition (Lean source)
noncomputable def categoryArmSet {d : ℕ} (k : Fin d) (a : Bool) : Set (Obs d) := {z | z.1 = k ∧ z.2.1 = a}
def armPropensity

The arm probability inside a positive-mass category, totalized at zero.

Definition (Lean source)
noncomputable def armPropensity {d : ℕ} (P : DiscreteLaw d) (k : Fin d) (a : Bool) : ℝ := armMass P k a / cellMass P k
theorem armMass_add_eq_cellMass

The control-arm and treated-arm masses of a category add up to the total mass of that category.

Formal statement
d :
P :
k :
Fin d
armMass P k false + armMass P k true = cellMass P k
Proof (Lean source)
lemma armMass_add_eq_cellMass {d : ℕ} (P : DiscreteLaw d) (k : Fin d) : armMass P k false + armMass P k true = cellMass P k := by simp [armMass, cellMass] ring
CausalSmith.Stat.DiscreteAteMinimaxLoggap.armMass_add_eq_cellMass · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:717
theorem armMass_nonneg

The joint probability of a category together with a treatment value is nonnegative.

Formal statement
d :
P :
k :
Fin d
a :
0 ≤ armMass P k a
Proof (Lean source)
lemma armMass_nonneg {d : ℕ} (P : DiscreteLaw d) (k : Fin d) (a : Bool) : 0 ≤ armMass P k a := by unfold armMass exact sum_nonneg fun y _ ↦ (jointMass_mem_unitInterval P k a y).1
theorem armMass_le_cellMass

The joint probability of a category together with a treatment value never exceeds the total probability of that category.

Formal statement
d :
P :
k :
Fin d
a :
armMass P k a ≤ cellMass P k
Proof (Lean source)
lemma armMass_le_cellMass {d : ℕ} (P : DiscreteLaw d) (k : Fin d) (a : Bool) : armMass P k a ≤ cellMass P k := by rw [← armMass_add_eq_cellMass] cases a · exact le_add_of_nonneg_right (armMass_nonneg P k true) · exact le_add_of_nonneg_left (armMass_nonneg P k false)
CausalSmith.Stat.DiscreteAteMinimaxLoggap.armMass_le_cellMass · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:731
theorem armPropensity_mem_unitInterval

Shows that arm Propensity mem unit Interval lies in the stated set or interval.

Formal statement
d :
P :
k :
Fin d
a :
armPropensity P k a ∈ Icc (0 : ℝ) 1
Proof (Lean source)
lemma armPropensity_mem_unitInterval {d : ℕ} (P : DiscreteLaw d) (k : Fin d) (a : Bool) : armPropensity P k a ∈ Icc (0 : ℝ) 1 := by exact ⟨div_nonneg (armMass_nonneg P k a) (cellMass_mem_unitInterval P k).1, div_le_one_of_le₀ (armMass_le_cellMass P k a) (cellMass_mem_unitInterval P k).1⟩
CausalSmith.Stat.DiscreteAteMinimaxLoggap.armPropensity_mem_unitInterval · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:740
theorem armMass_eq_cellMass_mul_armPropensity

Establishes the stated equality relating arm Mass eq cell Mass mul arm Propensity.

Formal statement
d :
P :
k :
Fin d
a :
hp :
0 < cellMass P k
armMass P k a = cellMass P k * armPropensity P k a
Proof (Lean source)
lemma armMass_eq_cellMass_mul_armPropensity {d : ℕ} (P : DiscreteLaw d) (k : Fin d) (a : Bool) (hp : 0 < cellMass P k) : armMass P k a = cellMass P k * armPropensity P k a := by unfold armPropensity field_simp
CausalSmith.Stat.DiscreteAteMinimaxLoggap.armMass_eq_cellMass_mul_armPropensity · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:748
theorem armPropensity_eq_true

Establishes the stated equality relating arm Propensity eq true.

Formal statement
d :
P :
k :
Fin d
armPropensity P k true = propensity P k
Proof (Lean source)
lemma armPropensity_eq_true {d : ℕ} (P : DiscreteLaw d) (k : Fin d) : armPropensity P k true = propensity P k := rfl
CausalSmith.Stat.DiscreteAteMinimaxLoggap.armPropensity_eq_true · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:756
theorem armPropensity_eq_false

Establishes the stated equality relating arm Propensity eq false.

Formal statement
d :
P :
k :
Fin d
hp :
0 < cellMass P k
armPropensity P k false = 1 - propensity P k
Proof (Lean source)
lemma armPropensity_eq_false {d : ℕ} (P : DiscreteLaw d) (k : Fin d) (hp : 0 < cellMass P k) : armPropensity P k false = 1 - propensity P k := by have hsum := armMass_add_eq_cellMass P k rw [armPropensity, propensity] field_simp linarith
CausalSmith.Stat.DiscreteAteMinimaxLoggap.armPropensity_eq_false · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:760
theorem armPropensity_lower_of_overlap

Overlap supplies the same lower bound for either arm probability.

Formal statement
d :
epsilon :
P :
hOverlap :
Overlap epsilon P
k :
Fin d
a :
hp :
0 < cellMass P k
epsilon ≤ armPropensity P k a
Proof (Lean source)
lemma armPropensity_lower_of_overlap {d : ℕ} {epsilon : ℝ} (P : DiscreteLaw d) (hOverlap : Overlap epsilon P) (k : Fin d) (a : Bool) (hp : 0 < cellMass P k) : epsilon ≤ armPropensity P k a := by rcases hOverlap k hp with ⟨hlo, hhi⟩ cases a · rw [armPropensity_eq_false P k hp] linarith · exact hlo
CausalSmith.Stat.DiscreteAteMinimaxLoggap.armPropensity_lower_of_overlap · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:769
theorem obsLaw_categorySet_mass

The category event has exactly its model cell mass.

Formal statement
d :
P :
k :
Fin d
(obsLaw P).real (categorySet k) = cellMass P k
Proof (Lean source)
lemma obsLaw_categorySet_mass {d : ℕ} (P : DiscreteLaw d) (k : Fin d) : (obsLaw P).real (categorySet k) = cellMass P k := by rw [measureReal_def, obsLaw, PMF.toMeasure_apply P.pmf MeasurableSet.of_discrete] rw [tsum_fintype, ENNReal.toReal_sum (fun x _ => by by_cases hx : x ∈ categorySet k <;> simp [hx, P.pmf.apply_ne_top])] simp only [Fintype.sum_prod_type] rw [Finset.sum_eq_single k] · simp [categorySet, cellMass, jointMass] · intro b _hb hbk simp [categorySet, hbk] · simp
CausalSmith.Stat.DiscreteAteMinimaxLoggap.obsLaw_categorySet_mass · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:780
theorem obsLaw_categoryArmSet_mass

The nested category-arm event has exactly its joint arm mass.

Formal statement
d :
P :
k :
Fin d
a :
(obsLaw P).real (categoryArmSet k a) = armMass P k a
Proof (Lean source)
lemma obsLaw_categoryArmSet_mass {d : ℕ} (P : DiscreteLaw d) (k : Fin d) (a : Bool) : (obsLaw P).real (categoryArmSet k a) = armMass P k a := by rw [measureReal_def, obsLaw, PMF.toMeasure_apply P.pmf MeasurableSet.of_discrete] rw [tsum_fintype, ENNReal.toReal_sum (fun x _ => by by_cases hx : x ∈ categoryArmSet k a <;> simp [hx, P.pmf.apply_ne_top])] simp only [Fintype.sum_prod_type] rw [Finset.sum_eq_single k] · cases a <;> simp [categoryArmSet, armMass, jointMass] · intro b _hb hbk simp [categoryArmSet, hbk] · simp
CausalSmith.Stat.DiscreteAteMinimaxLoggap.obsLaw_categoryArmSet_mass · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:794
theorem categoryArmSet_subset_categorySet

The one-observation event that both the category and the treatment value are as prescribed is contained in the event that only the category is as prescribed.

Formal statement
d :
k :
Fin d
a :
Proof (Lean source)
lemma categoryArmSet_subset_categorySet {d : ℕ} (k : Fin d) (a : Bool) : categoryArmSet k a ⊆ categorySet k := by intro z hz exact hz.1
CausalSmith.Stat.DiscreteAteMinimaxLoggap.categoryArmSet_subset_categorySet · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:810
theorem obsLaw_categoryArm_diff_mass

Establishes the stated property of obs Law category Arm diff mass in the discrete average-treatment-effect construction.

Formal statement
d :
P :
k :
Fin d
a :
hp :
0 < cellMass P k
(obsLaw P).real (categorySet k \ categoryArmSet k a)
= cellMass P k * (1 - armPropensity P k a)
Proof (Lean source)
lemma obsLaw_categoryArm_diff_mass {d : ℕ} (P : DiscreteLaw d) (k : Fin d) (a : Bool) (hp : 0 < cellMass P k) : (obsLaw P).real (categorySet k \ categoryArmSet k a) = cellMass P k * (1 - armPropensity P k a) := by rw [measureReal_diff (categoryArmSet_subset_categorySet k a) MeasurableSet.of_discrete, obsLaw_categorySet_mass, obsLaw_categoryArmSet_mass, armMass_eq_cellMass_mul_armPropensity P k a hp] ring
CausalSmith.Stat.DiscreteAteMinimaxLoggap.obsLaw_categoryArm_diff_mass · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:817
theorem obsLaw_categorySet_compl_mass

Establishes the stated property of obs Law category Set compl mass in the discrete average-treatment-effect construction.

Formal statement
d :
P :
k :
Fin d
(obsLaw P).real (categorySet k)ᶜ = 1 - cellMass P k
Proof (Lean source)
lemma obsLaw_categorySet_compl_mass {d : ℕ} (P : DiscreteLaw d) (k : Fin d) : (obsLaw P).real (categorySet k)ᶜ = 1 - cellMass P k := by rw [measureReal_compl MeasurableSet.of_discrete, probReal_univ, obsLaw_categorySet_mass]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.obsLaw_categorySet_compl_mass · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:828
theorem integral_designWeight_mul_residual_sq_factor

A design-only multiplier factors out of the one-observation residual second moment on its unique category-arm support.

Formal statement
d :
P :
k :
Fin d
a :
Fin 2
q :
Obs d → ℝ
hq :
∀ (l : Fin d) (b y y' : Bool), q (l, b, y) = q (l, b, y')
∫ z, q z * (armOutcomeResidual P k a z) ^ 2 ∂obsLaw P
= q (k, finTwoEquiv a, false) * ∫ z, (armOutcomeResidual P k a z) ^ 2 ∂obsLaw P
Proof (Lean source)
lemma integral_designWeight_mul_residual_sq_factor {d : ℕ} (P : DiscreteLaw d) (k : Fin d) (a : Fin 2) (q : Obs d → ℝ) (hq : ∀ (l : Fin d) (b y y' : Bool), q (l, b, y) = q (l, b, y')) : ∫ z, q z * (armOutcomeResidual P k a z) ^ 2 ∂obsLaw P = q (k, finTwoEquiv a, false) * ∫ z, (armOutcomeResidual P k a z) ^ 2 ∂obsLaw P := by rw [show obsLaw P = P.pmf.toMeasure by rfl] rw [PMF.integral_eq_sum, PMF.integral_eq_sum] unfold armOutcomeResidual simp only [Fintype.sum_prod_type] fin_cases a · simp only [finTwoEquiv, Fin.isValue, Bool.false_eq_true, and_false, ite_false, Bool.if_false_right, Bool.if_false_left, Bool.if_true_right, Bool.if_true_left] rw [Finset.sum_eq_single k, Finset.sum_eq_single k] · simp [finTwoEquiv] rw [hq k false true false] ring · intro l hl hlk; simp [hlk] · simp · intro l hl hlk; simp [hlk] · simp · simp only [finTwoEquiv, Fin.isValue, Bool.true_eq_false, and_false, ite_false, Bool.if_false_right, Bool.if_false_left, Bool.if_true_right, Bool.if_true_left] rw [Finset.sum_eq_single k, Finset.sum_eq_single k] · simp [finTwoEquiv] rw [hq k true true false] ring · intro l hl hlk; simp [hlk] · simp · intro l hl hlk; simp [hlk] · simp
CausalSmith.Stat.DiscreteAteMinimaxLoggap.integral_designWeight_mul_residual_sq_factor · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:835
theorem integral_designWeight_mul_armIndicator_factor

Evaluates or bounds the stated integral involving integral design Weight mul arm Indicator factor.

Formal statement
d :
P :
k :
Fin d
a :
Fin 2
q :
Obs d → ℝ
hq :
∀ (l : Fin d) (b y y' : Bool), q (l, b, y) = q (l, b, y')
∫ z, q z * (categoryArmSet k (finTwoEquiv a)).indicator (fun _ => (1 : ℝ)) z ∂obsLaw P
= q (k, finTwoEquiv a, false) * armMass P k (finTwoEquiv a)
Proof (Lean source)
lemma integral_designWeight_mul_armIndicator_factor {d : ℕ} (P : DiscreteLaw d) (k : Fin d) (a : Fin 2) (q : Obs d → ℝ) (hq : ∀ (l : Fin d) (b y y' : Bool), q (l, b, y) = q (l, b, y')) : ∫ z, q z * (categoryArmSet k (finTwoEquiv a)).indicator (fun _ => (1 : ℝ)) z ∂obsLaw P = q (k, finTwoEquiv a, false) * armMass P k (finTwoEquiv a) := by classical rw [show obsLaw P = P.pmf.toMeasure by rfl, PMF.integral_eq_sum] simp only [Fintype.sum_prod_type] fin_cases a · simp [categoryArmSet, finTwoEquiv, armMass, jointMass, indicator] simp only [Finset.sum_add_distrib, Finset.sum_ite_eq', Finset.mem_univ, if_true] rw [hq k false true false] ring · simp [categoryArmSet, finTwoEquiv, armMass, jointMass, indicator] rw [hq k true true false] ring
CausalSmith.Stat.DiscreteAteMinimaxLoggap.integral_designWeight_mul_armIndicator_factor · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:871
theorem integral_designWeight_mul_residual_sq_le_indicator

Conditional Bernoulli variance bound with an arbitrary nonnegative design-only multiplier.

Formal statement
d :
P :
k :
Fin d
a :
Fin 2
q :
Obs d → ℝ
hq :
∀ (l : Fin d) (b y y' : Bool), q (l, b, y) = q (l, b, y')
hq0 :
∀ z, 0 ≤ q z
∫ z, q z * (armOutcomeResidual P k a z) ^ 2 ∂obsLaw P
≤ ∫ z, q z * (categoryArmSet k (finTwoEquiv a)).indicator (fun _ => (1 : ℝ)) z ∂obsLaw P
Proof (Lean source)
lemma integral_designWeight_mul_residual_sq_le_indicator {d : ℕ} (P : DiscreteLaw d) (k : Fin d) (a : Fin 2) (q : Obs d → ℝ) (hq : ∀ (l : Fin d) (b y y' : Bool), q (l, b, y) = q (l, b, y')) (hq0 : ∀ z, 0 ≤ q z) : ∫ z, q z * (armOutcomeResidual P k a z) ^ 2 ∂obsLaw P ≤ ∫ z, q z * (categoryArmSet k (finTwoEquiv a)).indicator (fun _ => (1 : ℝ)) z ∂obsLaw P := by rw [integral_designWeight_mul_residual_sq_factor P k a q hq, integral_designWeight_mul_armIndicator_factor P k a q hq] exact mul_le_mul_of_nonneg_left (integral_armOutcomeResidual_sq_le_armMass P k a) (hq0 _)
CausalSmith.Stat.DiscreteAteMinimaxLoggap.integral_designWeight_mul_residual_sq_le_indicator · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:890
theorem integral_coordinate_designWeight_residual_sq_le_indicator

Product-sample conditional variance bound at one coordinate, for any nonnegative multiplier unchanged by replacing that coordinate's outcome.

Formal statement
I :
d :
P :
i :
I
k :
Fin d
a :
Fin 2
F :
(I → Obs d) → ℝ
hF :
∀ z y, F (replaceOutcome z i y) = F z
hF0 :
∀ z, 0 ≤ F z
∫ z : I → Obs d, F z * (armOutcomeResidual P k a (z i)) ^ 2 ∂(Measure.pi (fun _ : I => obsLaw P))
≤ ∫ z : I → Obs d, F z * (categoryArmSet k (finTwoEquiv a)).indicator (fun _ => (1 : ℝ)) (z i) ∂(Measure.pi (fun _ : I => obsLaw P))
Proof (Lean source)
lemma integral_coordinate_designWeight_residual_sq_le_indicator {I : Type*} [Fintype I] [DecidableEq I] {d : ℕ} (P : DiscreteLaw d) (i : I) (k : Fin d) (a : Fin 2) (F : (I → Obs d) → ℝ) (hF : ∀ z y, F (replaceOutcome z i y) = F z) (hF0 : ∀ z, 0 ≤ F z) : ∫ z : I → Obs d, F z * (armOutcomeResidual P k a (z i)) ^ 2 ∂(Measure.pi (fun _ : I => obsLaw P)) ≤ ∫ z : I → Obs d, F z * (categoryArmSet k (finTwoEquiv a)).indicator (fun _ => (1 : ℝ)) (z i) ∂(Measure.pi (fun _ : I => obsLaw P)) := by classical let p : I → Prop := fun j => j ≠ i let E := MeasurableEquiv.piEquivPiSubtypeProd (fun _ : I => Obs d) p let g1 : (({j : I // p j} → Obs d) × ({j : I // ¬ p j} → Obs d)) → ℝ := fun uv => F (E.symm uv) * (armOutcomeResidual P k a (E.symm uv i)) ^ 2 let g2 : (({j : I // p j} → Obs d) × ({j : I // ¬ p j} → Obs d)) → ℝ := fun uv => F (E.symm uv) * (categoryArmSet k (finTwoEquiv a)).indicator (fun _ => (1 : ℝ)) (E.symm uv i) have hmp := measurePreserving_piEquivPiSubtypeProd (fun _ : I => obsLaw P) p have hcomp1 : (fun z : I → Obs d => F z * (armOutcomeResidual P k a (z i)) ^ 2) = fun z => g1 (E z) := by funext z simp [g1, E] have hcomp2 : (fun z : I → Obs d => F z * (categoryArmSet k (finTwoEquiv a)).indicator (fun _ => (1 : ℝ)) (z i)) = fun z => g2 (E z) := by funext z simp [g2, E] rw [hcomp1, hmp.integral_comp E.measurableEmbedding g1] rw [hcomp2, hmp.integral_comp E.measurableEmbedding g2] rw [integral_prod g1 Integrable.of_finite, integral_prod g2 Integrable.of_finite] apply integral_mono Integrable.of_finite Integrable.of_finite intro u let i0 : {j : I // ¬ p j} := ⟨i, by simp [p]⟩ let q : Obs d → ℝ := fun x => F (E.symm (u, fun _ => x)) have hq : ∀ (l : Fin d) (b y y' : Bool), q (l, b, y) = q (l, b, y') := by intro l b y y' let z := E.symm (u, fun _ => (l, b, y')) have hz : replaceOutcome z i y = E.symm (u, fun _ => (l, b, y)) := by funext j by_cases hji : j = i · subst j simp [replaceOutcome, z, E, p, MeasurableEquiv.piEquivPiSubtypeProd, Equiv.piEquivPiSubtypeProd] · simp [replaceOutcome, hji, z, E, p, MeasurableEquiv.piEquivPiSubtypeProd, Equiv.piEquivPiSubtypeProd] change F (E.symm (u, fun _ => (l, b, y))) = F (E.symm (u, fun _ => (l, b, y'))) rw [← hz, hF] have hq0 : ∀ x, 0 ≤ q x := fun x => hF0 _ have hinner1 : (fun v => g1 (u, v)) = fun v => q (v i0) * (armOutcomeResidual P k a (v i0)) ^ 2 := by funext v have hvfun : v = fun _ => v i0 := by funext t congr 1 apply Subtype.ext exact (not_ne_iff.mp t.2).trans (by rfl) rw [hvfun] simp [g1, q, E, p, i0, MeasurableEquiv.piEquivPiSubtypeProd, Equiv.piEquivPiSubtypeProd] have hinner2 : (fun v => g2 (u, v)) = fun v => q (v i0) * (categoryArmSet k (finTwoEquiv a)).indicator (fun _ => (1 : ℝ)) (v i0) := by funext v have hvfun : v = fun _ => v i0 := by funext t congr 1 apply Subtype.ext exact (not_ne_iff.mp t.2).trans (by rfl) rw [hvfun] simp [g2, q, E, p, i0, MeasurableEquiv.piEquivPiSubtypeProd, Equiv.piEquivPiSubtypeProd] simp only rw [hinner1, hinner2] rw [integral_pi_eval_eq (P := obsLaw P) i0 (f := fun x => q x * (armOutcomeResidual P k a x) ^ 2) Integrable.of_finite] rw [integral_pi_eval_eq (P := obsLaw P) i0 (f := fun x => q x * (categoryArmSet k (finTwoEquiv a)).indicator (fun _ => (1 : ℝ)) x) Integrable.of_finite] exact integral_designWeight_mul_residual_sq_le_indicator P k a q hq hq0
CausalSmith.Stat.DiscreteAteMinimaxLoggap.integral_coordinate_designWeight_residual_sq_le_indicator · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:904
theorem prod_nested_partition

Product of three constants over a nested two-set partition.

Formal statement
I :
U V :
hVU :
V ⊆ U
r s q :
(∏ i : I, if i ∈ V then r else if i ∈ U then s else q)
= r ^ V.card * s ^ (U.card - V.card) * q ^ (card I - U.card)
Proof (Lean source)
lemma prod_nested_partition {I : Type*} [Fintype I] [DecidableEq I] (U V : Finset I) (hVU : V ⊆ U) (r s q : ℝ) : (∏ i : I, if i ∈ V then r else if i ∈ U then s else q) = r ^ V.card * s ^ (U.card - V.card) * q ^ (card I - U.card) := by classical change (∏ i ∈ (Finset.univ : Finset I), if i ∈ V then r else if i ∈ U then s else q) = _ rw [Finset.prod_ite] simp only [Finset.filter_mem_eq_inter, Finset.univ_inter] rw [Finset.prod_ite] have hA : ((Finset.univ : Finset I).filter (fun i => i ∉ V)).filter (fun i => i ∈ U) = U \ V := by ext i simp [and_comm] have hB : ((Finset.univ : Finset I).filter (fun i => i ∉ V)).filter (fun i => i ∉ U) = (Finset.univ : Finset I) \ U := by ext i simp only [mem_filter, mem_sdiff, Finset.mem_univ, true_and] constructor · exact fun h => h.2 · intro hiU exact ⟨fun hiV => hiU (hVU hiV), hiU⟩ rw [hA, hB] simp [Finset.prod_const, Finset.card_sdiff_of_subset hVU, Finset.card_sdiff_of_subset (Finset.subset_univ U)] ring
CausalSmith.Stat.DiscreteAteMinimaxLoggap.prod_nested_partition · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:1001
def indexSet

Indices whose observations land in a measurable or nonmeasurable set.

Definition (Lean source)
noncomputable def indexSet {I A : Type*} [Fintype I] [DecidableEq I] (z : I → A) (S : Set A) : Finset I := by classical exact Finset.univ.filter fun i => z i ∈ S
def nestedIndexEvent

Joint event fixing the index set in C and its nested sub-index-set in R.

Definition (Lean source)
def nestedIndexEvent {I A : Type*} [Fintype I] [DecidableEq I] (C R : Set A) (U V : Finset I) : Set (I → A) := {z | indexSet z C = U ∧ indexSet z R = V}
CausalSmith.Stat.DiscreteAteMinimaxLoggap.nestedIndexEvent · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:1036
theorem nestedIndexEvent_eq_pi

Suppose one label set sits inside another and the prescribed inner index set sits inside the prescribed outer one. Then the event that pins down both index sets is a product event over the observations: each inner index observation is confined to the inner label set, each remaining outer index observation to the part of the outer set not in the inner one, and every other observation to the complement of the outer set.

Formal statement
I A :
C R :
Set A
hRC :
R ⊆ C
U V :
hVU :
V ⊆ U
= Set.univ.pi (fun i => if i ∈ V then R else if i ∈ U then C \ R else Cᶜ)
Proof (Lean source)
lemma nestedIndexEvent_eq_pi {I A : Type*} [Fintype I] [DecidableEq I] (C R : Set A) (hRC : R ⊆ C) (U V : Finset I) (hVU : V ⊆ U) : nestedIndexEvent C R U V = Set.univ.pi (fun i => if i ∈ V then R else if i ∈ U then C \ R else Cᶜ) := by classical ext z simp only [nestedIndexEvent, Set.mem_setOf_eq, Set.mem_pi, Set.mem_univ, forall_true_left] constructor · rintro ⟨hC, hR⟩ i have hCi : (z i ∈ C ↔ i ∈ U) := by have hi := congrArg (fun W : Finset I => i ∈ W) hC simpa [indexSet] using hi have hRi : (z i ∈ R ↔ i ∈ V) := by have hi := congrArg (fun W : Finset I => i ∈ W) hR simpa [indexSet] using hi by_cases hiV : i ∈ V · simp [hiV, hRi.mpr hiV] · by_cases hiU : i ∈ U · simp [hiV, hiU, hCi.mpr hiU, hRi.not.mpr hiV] · simp [hiV, hiU, hCi.not.mpr hiU] · intro h constructor · apply Finset.ext intro i simp only [indexSet, mem_filter, Finset.mem_univ, true_and] have hi := h i by_cases hiV : i ∈ V · have hiU := hVU hiV simp only [hiV, if_true] at hi exact ⟨fun _ => hiU, fun _ => hRC hi⟩ · by_cases hiU : i ∈ U · simp only [hiV, if_false, hiU, if_true, Set.mem_diff] at hi exact ⟨fun _ => hiU, fun _ => hi.1⟩ · simp only [hiV, if_false, hiU, Set.mem_compl_iff] at hi exact ⟨fun hC => (hi hC).elim, fun hmem => (hiU hmem).elim⟩ · apply Finset.ext intro i simp only [indexSet, mem_filter, Finset.mem_univ, true_and] have hi := h i by_cases hiV : i ∈ V · simp only [hiV, if_true] at hi exact ⟨fun _ => hiV, fun _ => hi⟩ · by_cases hiU : i ∈ U · simp only [hiV, if_false, hiU, if_true, Set.mem_diff] at hi exact ⟨fun hRmem => (hi.2 hRmem).elim, fun hmem => (hiV hmem).elim⟩ · simp only [hiV, if_false, hiU, Set.mem_compl_iff] at hi exact ⟨fun hRmem => (hi (hRC hRmem)).elim, fun hmem => (hiV hmem).elim⟩
CausalSmith.Stat.DiscreteAteMinimaxLoggap.nestedIndexEvent_eq_pi · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:1042
theorem measure_nestedIndexEvent

Exact finite-product mass of a nested pair of index sets. This is the finite symmetry/counting bridge used in place of a conditional-law API.

Formal statement
C R :
Set A
hC :
hR :
hRC :
R ⊆ C
U V :
hVU :
V ⊆ U
(Measure.pi (fun _ : I => P)).real (nestedIndexEvent C R U V)
= (P R).toReal ^ V.card * (P (C \ R)).toReal ^ (U.card - V.card) * (P Cᶜ).toReal ^ (card I - U.card)
Proof (Lean source)
lemma measure_nestedIndexEvent {I A : Type*} [Fintype I] [DecidableEq I] [MeasurableSpace A] [MeasurableSingletonClass A] (P : Measure A) [IsProbabilityMeasure P] (C R : Set A) (hC : MeasurableSet C) (hR : MeasurableSet R) (hRC : R ⊆ C) (U V : Finset I) (hVU : V ⊆ U) : (Measure.pi (fun _ : I => P)).real (nestedIndexEvent C R U V) = (P R).toReal ^ V.card * (P (C \ R)).toReal ^ (U.card - V.card) * (P Cᶜ).toReal ^ (card I - U.card) := by rw [nestedIndexEvent_eq_pi C R hRC U V hVU, measureReal_def, Measure.pi_pi, ENNReal.toReal_prod] have hfun : (fun i : I => (P (if i ∈ V then R else if i ∈ U then C \ R else Cᶜ)).toReal) = fun i => if i ∈ V then (P R).toReal else if i ∈ U then (P (C \ R)).toReal else (P Cᶜ).toReal := by funext i by_cases hiV : i ∈ V <;> by_cases hiU : i ∈ U <;> simp [hiV, hiU] rw [hfun] exact prod_nested_partition U V hVU _ _ _
CausalSmith.Stat.DiscreteAteMinimaxLoggap.measure_nestedIndexEvent · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:1100
theorem indexSet_mono

Establishes the stated property of index Set mono in the discrete average-treatment-effect construction.

Formal statement
I A :
z :
I → A
R C :
Set A
hRC :
R ⊆ C
indexSet z R ⊆ indexSet z C
Proof (Lean source)
lemma indexSet_mono {I A : Type*} [Fintype I] [DecidableEq I] (z : I → A) {R C : Set A} (hRC : R ⊆ C) : indexSet z R ⊆ indexSet z C := by classical intro i hi simp only [indexSet, mem_filter, Finset.mem_univ, true_and] at hi ⊢ exact hRC hi
theorem nested_count_ratio_integral_eq

Exact finite-product nested-count identity. In particular, this proves algebraically that the arm count conditional on a category count t has the binomial weights with parameter rho.

Formal statement
C R :
Set A
hC :
hR :
hRC :
R ⊆ C
p rho :
hpC :
(P C).toReal = p
hpR :
(P R).toReal = p * rho
hpDiff :
(P (C \ R)).toReal = p * (1 - rho)
hpCompl :
(P Cᶜ).toReal = 1 - p
∫ z : I → A, ((indexSet z C).card : ℝ) ^ 2 * (if 0 < (indexSet z R).card then ((indexSet z R).card : ℝ)⁻¹ else 0) ∂(Measure.pi (fun _ : I => P))
= ∑ t ∈ range (card I + 1), (Nat.choose (card I) t : ℝ) * p ^ t * (1 - p) ^ (card I - t) * (t : ℝ) ^ 2 * (∑ l ∈ range (t + 1), (Nat.choose t l : ℝ) * rho ^ l * (1 - rho) ^ (t - l) * (if 0 < l then (l : ℝ)⁻¹ else 0))
Proof (Lean source)
lemma nested_count_ratio_integral_eq {I A : Type*} [Fintype I] [DecidableEq I] [Fintype A] [MeasurableSpace A] [MeasurableSingletonClass A] (P : Measure A) [IsProbabilityMeasure P] (C R : Set A) (hC : MeasurableSet C) (hR : MeasurableSet R) (hRC : R ⊆ C) (p rho : ℝ) (hpC : (P C).toReal = p) (hpR : (P R).toReal = p * rho) (hpDiff : (P (C \ R)).toReal = p * (1 - rho)) (hpCompl : (P Cᶜ).toReal = 1 - p) : ∫ z : I → A, ((indexSet z C).card : ℝ) ^ 2 * (if 0 < (indexSet z R).card then ((indexSet z R).card : ℝ)⁻¹ else 0) ∂(Measure.pi (fun _ : I => P)) = ∑ t ∈ range (card I + 1), (Nat.choose (card I) t : ℝ) * p ^ t * (1 - p) ^ (card I - t) * (t : ℝ) ^ 2 * (∑ l ∈ range (t + 1), (Nat.choose t l : ℝ) * rho ^ l * (1 - rho) ^ (t - l) * (if 0 < l then (l : ℝ)⁻¹ else 0)) := by classical letI : MeasurableSpace (Finset I) := ⊤ let pairMap : (I → A) → Finset I × Finset I := fun z => (indexSet z C, indexSet z R) let f : Finset I × Finset I → ℝ := fun uv => (uv.1.card : ℝ) ^ 2 * (if 0 < uv.2.card then (uv.2.card : ℝ)⁻¹ else 0) have hmap : Measurable pairMap := measurable_of_finite _ have hf : Measurable f := measurable_of_finite _ rw [show (∫ z : I → A, ((indexSet z C).card : ℝ) ^ 2 * (if 0 < (indexSet z R).card then ((indexSet z R).card : ℝ)⁻¹ else 0) ∂(Measure.pi (fun _ : I => P))) = ∫ uv, f uv ∂((Measure.pi (fun _ : I => P)).map pairMap) by rw [integral_map hmap.aemeasurable hf.aestronglyMeasurable]] rw [integral_fintype Integrable.of_finite] simp only [Fintype.sum_prod_type, smul_eq_mul] have hmass (U V : Finset I) : ((Measure.pi (fun _ : I => P)).map pairMap).real {(U, V)} = (Measure.pi (fun _ : I => P)).real (nestedIndexEvent C R U V) := by rw [map_measureReal_apply hmap (MeasurableSet.singleton (U, V))] congr 1 ext z simp [pairMap, nestedIndexEvent] simp_rw [hmass] have hzero (U V : Finset I) (hnot : ¬ V ⊆ U) : (Measure.pi (fun _ : I => P)).real (nestedIndexEvent C R U V) = 0 := by have hempty : nestedIndexEvent C R U V = ∅ := by ext z simp only [nestedIndexEvent, Set.mem_setOf_eq, Set.mem_empty_iff_false, iff_false] intro hz exact hnot (hz.2 ▸ hz.1 ▸ indexSet_mono z hRC) simp [hempty] calc (∑ U : Finset I, ∑ V : Finset I, (Measure.pi (fun _ : I => P)).real (nestedIndexEvent C R U V) * f (U, V)) = ∑ U ∈ (Finset.univ : Finset (Finset I)), ∑ V ∈ U.powerset, (Measure.pi (fun _ : I => P)).real (nestedIndexEvent C R U V) * f (U, V) := by apply Finset.sum_congr rfl intro U hU apply (Finset.sum_subset (s₁ := U.powerset) (s₂ := (Finset.univ : Finset (Finset I))) (Finset.subset_univ _) ?_).symm intro V hV hnotmem have hnot : ¬ V ⊆ U := by simpa using hnotmem simp [hzero U V hnot] _ = ∑ U ∈ (Finset.univ : Finset (Finset I)), ∑ V ∈ U.powerset, (p * rho) ^ V.card * (p * (1 - rho)) ^ (U.card - V.card) * (1 - p) ^ (card I - U.card) * ((U.card : ℝ) ^ 2 * (if 0 < V.card then (V.card : ℝ)⁻¹ else 0)) := by apply Finset.sum_congr rfl intro U hU apply Finset.sum_congr rfl intro V hV have hVU := Finset.mem_powerset.mp hV rw [measure_nestedIndexEvent P C R hC hR hRC U V hVU, hpR, hpDiff, hpCompl] _ = ∑ U ∈ (Finset.univ : Finset (Finset I)), p ^ U.card * (1 - p) ^ (card I - U.card) * (U.card : ℝ) ^ 2 * (∑ V ∈ U.powerset, rho ^ V.card * (1 - rho) ^ (U.card - V.card) * (if 0 < V.card then (V.card : ℝ)⁻¹ else 0)) := by apply Finset.sum_congr rfl intro U hU rw [Finset.mul_sum] apply Finset.sum_congr rfl intro V hV have hVU := Finset.mem_powerset.mp hV have hcard : V.card + (U.card - V.card) = U.card := Nat.add_sub_of_le (Finset.card_le_card hVU) rw [mul_pow, mul_pow] calc p ^ V.card * rho ^ V.card * (p ^ (U.card - V.card) * (1 - rho) ^ (U.card - V.card)) * (1 - p) ^ (card I - U.card) * ((U.card : ℝ) ^ 2 * (if 0 < V.card then (V.card : ℝ)⁻¹ else 0)) = (p ^ V.card * p ^ (U.card - V.card)) * (1 - p) ^ (card I - U.card) * (U.card : ℝ) ^ 2 * (rho ^ V.card * (1 - rho) ^ (U.card - V.card) * (if 0 < V.card then (V.card : ℝ)⁻¹ else 0)) := by ring _ = p ^ U.card * (1 - p) ^ (card I - U.card) * (U.card : ℝ) ^ 2 * (rho ^ V.card * (1 - rho) ^ (U.card - V.card) * (if 0 < V.card then (V.card : ℝ)⁻¹ else 0)) := by rw [← pow_add, hcard] _ = ∑ U ∈ (Finset.univ : Finset (Finset I)), p ^ U.card * (1 - p) ^ (card I - U.card) * (U.card : ℝ) ^ 2 * (∑ l ∈ range (U.card + 1), (Nat.choose U.card l : ℝ) * rho ^ l * (1 - rho) ^ (U.card - l) * (if 0 < l then (l : ℝ)⁻¹ else 0)) := by apply Finset.sum_congr rfl intro U hU congr 1 let g : ℕ → ℝ := fun l => rho ^ l * (1 - rho) ^ (U.card - l) * (if 0 < l then (l : ℝ)⁻¹ else 0) change (∑ V ∈ U.powerset, g V.card) = _ rw [Finset.sum_powerset_apply_card g] simp only [nsmul_eq_mul, g] apply Finset.sum_congr rfl intro l hl ring _ = ∑ t ∈ range (card I + 1), (Nat.choose (card I) t : ℝ) * p ^ t * (1 - p) ^ (card I - t) * (t : ℝ) ^ 2 * (∑ l ∈ range (t + 1), (Nat.choose t l : ℝ) * rho ^ l * (1 - rho) ^ (t - l) * (if 0 < l then (l : ℝ)⁻¹ else 0)) := by let G : ℕ → ℝ := fun t => p ^ t * (1 - p) ^ (card I - t) * (t : ℝ) ^ 2 * (∑ l ∈ range (t + 1), (Nat.choose t l : ℝ) * rho ^ l * (1 - rho) ^ (t - l) * (if 0 < l then (l : ℝ)⁻¹ else 0)) change (∑ U : Finset I, G U.card) = _ have huniv : (Finset.univ : Finset (Finset I)) = (Finset.univ : Finset I).powerset := by ext U; simp rw [huniv, Finset.sum_powerset_apply_card G] simp only [Finset.card_univ, nsmul_eq_mul, G] apply Finset.sum_congr rfl intro t ht ring
CausalSmith.Stat.DiscreteAteMinimaxLoggap.nested_count_ratio_integral_eq · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:1131
theorem nested_count_ratio_integral_le

The finite-product nested-count identity, combined with the sharp inverse-binomial calculation. This is the unconditional design bound needed for the heavy-cell variance calculation.

Formal statement
C R :
Set A
hC :
hR :
hRC :
R ⊆ C
p rho :
hpC :
(P C).toReal = p
hpR :
(P R).toReal = p * rho
hpDiff :
(P (C \ R)).toReal = p * (1 - rho)
hpCompl :
(P Cᶜ).toReal = 1 - p
hp0 :
0 ≤ p
hp1 :
p ≤ 1
hrho :
0 < rho
hrho1 :
rho ≤ 1
∫ z : I → A, ((indexSet z C).card : ℝ) ^ 2 * (if 0 < (indexSet z R).card then ((indexSet z R).card : ℝ)⁻¹ else 0) ∂(Measure.pi (fun _ : I ↦ P))
≤ 2 * (Fintype.card I : ℝ) * p / rho
Proof (Lean source)
lemma nested_count_ratio_integral_le {I A : Type*} [Fintype I] [DecidableEq I] [Fintype A] [MeasurableSpace A] [MeasurableSingletonClass A] (P : Measure A) [IsProbabilityMeasure P] (C R : Set A) (hC : MeasurableSet C) (hR : MeasurableSet R) (hRC : R ⊆ C) (p rho : ℝ) (hpC : (P C).toReal = p) (hpR : (P R).toReal = p * rho) (hpDiff : (P (C \ R)).toReal = p * (1 - rho)) (hpCompl : (P Cᶜ).toReal = 1 - p) (hp0 : 0 ≤ p) (hp1 : p ≤ 1) (hrho : 0 < rho) (hrho1 : rho ≤ 1) : ∫ z : I → A, ((indexSet z C).card : ℝ) ^ 2 * (if 0 < (indexSet z R).card then ((indexSet z R).card : ℝ)⁻¹ else 0) ∂(Measure.pi (fun _ : I ↦ P)) ≤ 2 * (Fintype.card I : ℝ) * p / rho := by rw [nested_count_ratio_integral_eq P C R hC hR hRC p rho hpC hpR hpDiff hpCompl] exact nested_binomial_ratio_bound (Fintype.card I) p rho hp0 hp1 hrho hrho1
CausalSmith.Stat.DiscreteAteMinimaxLoggap.nested_count_ratio_integral_le · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:1292
theorem ate_nested_count_ratio_integral_le

Specialization of the nested-count theorem to one discrete-ATE category and either treatment arm. Overlap replaces the arm probability denominator by the uniform lower bound epsilon.

Formal statement
I :
d :
epsilon :
P :
hOverlap :
Overlap epsilon P
hepsilon :
0 < epsilon
k :
Fin d
a :
hp :
0 < cellMass P k
∫ z : I → Obs d, ((indexSet z (categorySet k)).card : ℝ) ^ 2 * (if 0 < (indexSet z (categoryArmSet k a)).card then ((indexSet z (categoryArmSet k a)).card : ℝ)⁻¹ else 0) ∂(Measure.pi (fun _ : I ↦ obsLaw P))
≤ 2 * (Fintype.card I : ℝ) * cellMass P k / epsilon
Proof (Lean source)
lemma ate_nested_count_ratio_integral_le {I : Type*} [Fintype I] [DecidableEq I] {d : ℕ} {epsilon : ℝ} (P : DiscreteLaw d) (hOverlap : Overlap epsilon P) (hepsilon : 0 < epsilon) (k : Fin d) (a : Bool) (hp : 0 < cellMass P k) : ∫ z : I → Obs d, ((indexSet z (categorySet k)).card : ℝ) ^ 2 * (if 0 < (indexSet z (categoryArmSet k a)).card then ((indexSet z (categoryArmSet k a)).card : ℝ)⁻¹ else 0) ∂(Measure.pi (fun _ : I ↦ obsLaw P)) ≤ 2 * (Fintype.card I : ℝ) * cellMass P k / epsilon := by have hrhoLower := armPropensity_lower_of_overlap P hOverlap k a hp have hrhoPos : 0 < armPropensity P k a := lt_of_lt_of_le hepsilon hrhoLower have hbase := nested_count_ratio_integral_le (I := I) (P := obsLaw P) (categorySet k) (categoryArmSet k a) MeasurableSet.of_discrete MeasurableSet.of_discrete (categoryArmSet_subset_categorySet k a) (cellMass P k) (armPropensity P k a) (obsLaw_categorySet_mass P k) ((obsLaw_categoryArmSet_mass P k a).trans (armMass_eq_cellMass_mul_armPropensity P k a hp)) (obsLaw_categoryArm_diff_mass P k a hp) (obsLaw_categorySet_compl_mass P k) (cellMass_mem_unitInterval P k).1 (cellMass_mem_unitInterval P k).2 hrhoPos (armPropensity_mem_unitInterval P k a).2 calc _ ≤ 2 * (Fintype.card I : ℝ) * cellMass P k / armPropensity P k a := hbase _ ≤ 2 * (Fintype.card I : ℝ) * cellMass P k / epsilon := by exact div_le_div_of_nonneg_left (by positivity) hepsilon hrhoLower
CausalSmith.Stat.DiscreteAteMinimaxLoggap.ate_nested_count_ratio_integral_le · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:1316
def tupleRatioCoeff

Ratio coefficient multiplying one category's residual sum.

Definition (Lean source)
noncomputable def tupleRatioCoeff {I : Type*} [Fintype I] [DecidableEq I] {d : ℕ} (z : I → Obs d) (k : Fin d) (a : Fin 2) : ℝ := ((indexSet z (categorySet k)).card : ℝ) * (if 0 < (indexSet z (categoryArmSet k (finTwoEquiv a))).card then ((indexSet z (categoryArmSet k (finTwoEquiv a))).card : ℝ)⁻¹ else 0)
def fixedRatioResidual

Aggregate centered ratio residual over a fixed category set.

Definition (Lean source)
noncomputable def fixedRatioResidual {I : Type*} [Fintype I] [DecidableEq I] {d : ℕ} (P : DiscreteLaw d) (z : I → Obs d) (H : Finset (Fin d)) (a : Fin 2) : ℝ := ∑ k ∈ H, tupleRatioCoeff z k a * ∑ i : I, armOutcomeResidual P k a (z i)
CausalSmith.Stat.DiscreteAteMinimaxLoggap.fixedRatioResidual · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:1354
theorem indexSet_replaceOutcome_category

Overwriting the outcome coordinate of one observation does not change which observations belong to a given category.

Formal statement
I :
d :
z :
I → Obs d
i :
I
y :
k :
Fin d
Proof (Lean source)
lemma indexSet_replaceOutcome_category {I : Type*} [Fintype I] [DecidableEq I] {d : ℕ} (z : I → Obs d) (i : I) (y : Bool) (k : Fin d) : indexSet (replaceOutcome z i y) (categorySet k) = indexSet z (categorySet k) := by classical ext j by_cases hji : j = i · subst j simp only [indexSet, mem_filter, Finset.mem_univ, true_and, categorySet, Set.mem_setOf_eq, replaceOutcome, Function.update_self] · simp only [indexSet, mem_filter, Finset.mem_univ, true_and, categorySet, Set.mem_setOf_eq, replaceOutcome, Function.update_of_ne hji]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.indexSet_replaceOutcome_category · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:1361
theorem indexSet_replaceOutcome_arm

Establishes the stated property of index Set replace Outcome arm in the discrete average-treatment-effect construction.

Formal statement
I :
d :
z :
I → Obs d
i :
I
y :
k :
Fin d
a :
Fin 2
Proof (Lean source)
lemma indexSet_replaceOutcome_arm {I : Type*} [Fintype I] [DecidableEq I] {d : ℕ} (z : I → Obs d) (i : I) (y : Bool) (k : Fin d) (a : Fin 2) : indexSet (replaceOutcome z i y) (categoryArmSet k (finTwoEquiv a)) = indexSet z (categoryArmSet k (finTwoEquiv a)) := by classical ext j by_cases hji : j = i · subst j simp only [indexSet, mem_filter, Finset.mem_univ, true_and, categoryArmSet, Set.mem_setOf_eq, replaceOutcome, Function.update_self] · simp only [indexSet, mem_filter, Finset.mem_univ, true_and, categoryArmSet, Set.mem_setOf_eq, replaceOutcome, Function.update_of_ne hji]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.indexSet_replaceOutcome_arm · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:1377
theorem tupleRatioCoeff_replaceOutcome

Establishes the stated upper bound for tuple Ratio Coeff replace Outcome.

Formal statement
I :
d :
z :
I → Obs d
i :
I
y :
k :
Fin d
a :
Fin 2
Proof (Lean source)
lemma tupleRatioCoeff_replaceOutcome {I : Type*} [Fintype I] [DecidableEq I] {d : ℕ} (z : I → Obs d) (i : I) (y : Bool) (k : Fin d) (a : Fin 2) : tupleRatioCoeff (replaceOutcome z i y) k a = tupleRatioCoeff z k a := by unfold tupleRatioCoeff rw [indexSet_replaceOutcome_category, indexSet_replaceOutcome_arm]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.tupleRatioCoeff_replaceOutcome · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:1393
theorem integral_ratioResidual_cross_coordinates_eq_zero

Evaluates or bounds the stated integral involving integral ratio Residual cross coordinates eq zero.

Formal statement
I :
d :
P :
i j :
I
hij :
i ≠ j
k l :
Fin d
a :
Fin 2
∫ z : I → Obs d, (tupleRatioCoeff z k a * tupleRatioCoeff z l a * armOutcomeResidual P l a (z j)) * armOutcomeResidual P k a (z i) ∂(Measure.pi (fun _ : I => obsLaw P))
= 0
Proof (Lean source)
lemma integral_ratioResidual_cross_coordinates_eq_zero {I : Type*} [Fintype I] [DecidableEq I] {d : ℕ} (P : DiscreteLaw d) (i j : I) (hij : i ≠ j) (k l : Fin d) (a : Fin 2) : ∫ z : I → Obs d, (tupleRatioCoeff z k a * tupleRatioCoeff z l a * armOutcomeResidual P l a (z j)) * armOutcomeResidual P k a (z i) ∂(Measure.pi (fun _ : I => obsLaw P)) = 0 := by apply integral_coordinate_designWeight_residual_eq_zero P i k a intro z y rw [tupleRatioCoeff_replaceOutcome, tupleRatioCoeff_replaceOutcome, replaceOutcome_apply_ne _ _ _ hij.symm]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.integral_ratioResidual_cross_coordinates_eq_zero · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:1402
theorem armOutcomeResidual_mul_eq_zero_of_ne

Establishes the stated equality relating arm Outcome Residual mul eq zero of ne.

Formal statement
d :
P :
k l :
Fin d
hkl :
k ≠ l
a :
Fin 2
x :
Obs d
Proof (Lean source)
lemma armOutcomeResidual_mul_eq_zero_of_ne {d : ℕ} (P : DiscreteLaw d) (k l : Fin d) (hkl : k ≠ l) (a : Fin 2) (x : Obs d) : armOutcomeResidual P k a x * armOutcomeResidual P l a x = 0 := by unfold armOutcomeResidual by_cases hk : x.1 = k · have hl : x.1 ≠ l := fun h => hkl (hk.symm.trans h) simp [hk, hkl] · simp [hk]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.armOutcomeResidual_mul_eq_zero_of_ne · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:1417
theorem integral_ratioResidual_diagonal_le

Evaluates or bounds the stated integral involving integral ratio Residual diagonal le.

Formal statement
I :
d :
P :
i :
I
k :
Fin d
a :
Fin 2
∫ z : I → Obs d, (tupleRatioCoeff z k a) ^ 2 * (armOutcomeResidual P k a (z i)) ^ 2 ∂(Measure.pi (fun _ : I => obsLaw P))
≤ ∫ z : I → Obs d, (tupleRatioCoeff z k a) ^ 2 * (categoryArmSet k (finTwoEquiv a)).indicator (fun _ => (1 : ℝ)) (z i) ∂(Measure.pi (fun _ : I => obsLaw P))
Proof (Lean source)
lemma integral_ratioResidual_diagonal_le {I : Type*} [Fintype I] [DecidableEq I] {d : ℕ} (P : DiscreteLaw d) (i : I) (k : Fin d) (a : Fin 2) : ∫ z : I → Obs d, (tupleRatioCoeff z k a) ^ 2 * (armOutcomeResidual P k a (z i)) ^ 2 ∂(Measure.pi (fun _ : I => obsLaw P)) ≤ ∫ z : I → Obs d, (tupleRatioCoeff z k a) ^ 2 * (categoryArmSet k (finTwoEquiv a)).indicator (fun _ => (1 : ℝ)) (z i) ∂(Measure.pi (fun _ : I => obsLaw P)) := by apply integral_coordinate_designWeight_residual_sq_le_indicator P i k a · intro z y rw [tupleRatioCoeff_replaceOutcome] · intro z positivity
CausalSmith.Stat.DiscreteAteMinimaxLoggap.integral_ratioResidual_diagonal_le · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:1428
theorem integral_ratioResidual_pair_eq_zero_of_ne

Evaluates or bounds the stated integral involving integral ratio Residual pair eq zero of ne.

Formal statement
I :
d :
P :
i j :
I
k l :
Fin d
a :
Fin 2
hne :
k ≠ l ∨ i ≠ j
∫ z : I → Obs d, (tupleRatioCoeff z k a * armOutcomeResidual P k a (z i)) * (tupleRatioCoeff z l a * armOutcomeResidual P l a (z j)) ∂(Measure.pi (fun _ : I => obsLaw P))
= 0
Proof (Lean source)
lemma integral_ratioResidual_pair_eq_zero_of_ne {I : Type*} [Fintype I] [DecidableEq I] {d : ℕ} (P : DiscreteLaw d) (i j : I) (k l : Fin d) (a : Fin 2) (hne : k ≠ l ∨ i ≠ j) : ∫ z : I → Obs d, (tupleRatioCoeff z k a * armOutcomeResidual P k a (z i)) * (tupleRatioCoeff z l a * armOutcomeResidual P l a (z j)) ∂(Measure.pi (fun _ : I => obsLaw P)) = 0 := by rcases hne with hkl | hij · by_cases hij : i = j · subst j apply integral_eq_zero_of_ae filter_upwards with z rw [show (tupleRatioCoeff z k a * armOutcomeResidual P k a (z i)) * (tupleRatioCoeff z l a * armOutcomeResidual P l a (z i)) = (tupleRatioCoeff z k a * tupleRatioCoeff z l a) * (armOutcomeResidual P k a (z i) * armOutcomeResidual P l a (z i)) by ring, armOutcomeResidual_mul_eq_zero_of_ne P k l hkl] change tupleRatioCoeff z k a * tupleRatioCoeff z l a * 0 = (0 : ℝ) ring · rw [show (fun z : I → Obs d => (tupleRatioCoeff z k a * armOutcomeResidual P k a (z i)) * (tupleRatioCoeff z l a * armOutcomeResidual P l a (z j))) = fun z => (tupleRatioCoeff z k a * tupleRatioCoeff z l a * armOutcomeResidual P l a (z j)) * armOutcomeResidual P k a (z i) by funext z; ring] exact integral_ratioResidual_cross_coordinates_eq_zero P i j hij k l a · rw [show (fun z : I → Obs d => (tupleRatioCoeff z k a * armOutcomeResidual P k a (z i)) * (tupleRatioCoeff z l a * armOutcomeResidual P l a (z j))) = fun z => (tupleRatioCoeff z k a * tupleRatioCoeff z l a * armOutcomeResidual P l a (z j)) * armOutcomeResidual P k a (z i) by funext z; ring] exact integral_ratioResidual_cross_coordinates_eq_zero P i j hij k l a
CausalSmith.Stat.DiscreteAteMinimaxLoggap.integral_ratioResidual_pair_eq_zero_of_ne · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:1447
theorem integral_fixedRatioResidual_sq_eq_diagonal

All off-diagonal residual terms cancel exactly, across both observations and distinct categories.

Formal statement
I :
d :
P :
H :
a :
Fin 2
∫ z : I → Obs d, (fixedRatioResidual P z H a) ^ 2 ∂(Measure.pi (fun _ : I => obsLaw P))
= ∑ k ∈ H, ∑ i : I, ∫ z : I → Obs d, (tupleRatioCoeff z k a) ^ 2 * (armOutcomeResidual P k a (z i)) ^ 2 ∂(Measure.pi (fun _ : I => obsLaw P))
Proof (Lean source)
lemma integral_fixedRatioResidual_sq_eq_diagonal {I : Type*} [Fintype I] [DecidableEq I] {d : ℕ} (P : DiscreteLaw d) (H : Finset (Fin d)) (a : Fin 2) : ∫ z : I → Obs d, (fixedRatioResidual P z H a) ^ 2 ∂(Measure.pi (fun _ : I => obsLaw P)) = ∑ k ∈ H, ∑ i : I, ∫ z : I → Obs d, (tupleRatioCoeff z k a) ^ 2 * (armOutcomeResidual P k a (z i)) ^ 2 ∂(Measure.pi (fun _ : I => obsLaw P)) := by classical let S : Finset (Fin d × I) := H ×ˢ (Finset.univ : Finset I) let f : (Fin d × I) → (I → Obs d) → ℝ := fun ki z => tupleRatioCoeff z ki.1 a * armOutcomeResidual P ki.1 a (z ki.2) have hfixed (z : I → Obs d) : fixedRatioResidual P z H a = ∑ ki ∈ S, f ki z := by unfold fixedRatioResidual rw [show (∑ ki ∈ S, f ki z) = ∑ k ∈ H, ∑ i ∈ (Finset.univ : Finset I), f (k, i) z by simpa only [S] using (Finset.sum_product H (Finset.univ : Finset I) (fun ki => f ki z))] apply Finset.sum_congr rfl intro k hk rw [Finset.mul_sum] have hsquare (z : I → Obs d) : (fixedRatioResidual P z H a) ^ 2 = ∑ ki ∈ S, ∑ lj ∈ S, f ki z * f lj z := by rw [hfixed, sq, Finset.sum_mul] apply Finset.sum_congr rfl intro ki hki rw [Finset.mul_sum] simp_rw [hsquare] rw [integral_finset_sum S (fun _ _ => Integrable.of_finite)] simp_rw [integral_finset_sum S (fun _ _ => Integrable.of_finite)] have hinner (ki : Fin d × I) (hki : ki ∈ S) : (∑ lj ∈ S, ∫ z : I → Obs d, f ki z * f lj z ∂(Measure.pi (fun _ : I => obsLaw P))) = ∫ z : I → Obs d, (tupleRatioCoeff z ki.1 a) ^ 2 * (armOutcomeResidual P ki.1 a (z ki.2)) ^ 2 ∂(Measure.pi (fun _ : I => obsLaw P)) := by rw [Finset.sum_eq_single ki] · apply integral_congr_ae filter_upwards with z simp [f] ring · intro lj hlj hne have hpair : ki.1 ≠ lj.1 ∨ ki.2 ≠ lj.2 := by by_contra h push_neg at h exact hne (Prod.ext h.1.symm h.2.symm) exact integral_ratioResidual_pair_eq_zero_of_ne P ki.2 lj.2 ki.1 lj.1 a hpair · intro hnot exact (hnot hki).elim calc (∑ ki ∈ S, ∑ lj ∈ S, ∫ z : I → Obs d, f ki z * f lj z ∂(Measure.pi (fun _ : I => obsLaw P))) = ∑ ki ∈ S, ∫ z : I → Obs d, (tupleRatioCoeff z ki.1 a) ^ 2 * (armOutcomeResidual P ki.1 a (z ki.2)) ^ 2 ∂(Measure.pi (fun _ : I => obsLaw P)) := by apply Finset.sum_congr rfl intro ki hki exact hinner ki hki _ = ∑ k ∈ H, ∑ i : I, ∫ z : I → Obs d, (tupleRatioCoeff z k a) ^ 2 * (armOutcomeResidual P k a (z i)) ^ 2 ∂(Measure.pi (fun _ : I => obsLaw P)) := by simpa only [S] using (Finset.sum_product H (Finset.univ : Finset I) (fun ki => ∫ z : I → Obs d, (tupleRatioCoeff z ki.1 a) ^ 2 * (armOutcomeResidual P ki.1 a (z ki.2)) ^ 2 ∂(Measure.pi (fun _ : I => obsLaw P))))
CausalSmith.Stat.DiscreteAteMinimaxLoggap.integral_fixedRatioResidual_sq_eq_diagonal · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:1488
theorem sum_tupleRatioCoeff_sq_armIndicator_eq

Summing the squared ratio coefficient over observations in its arm produces exactly the nested count-ratio integrand.

Formal statement
I :
d :
z :
I → Obs d
k :
Fin d
a :
Fin 2
(∑ i : I, (tupleRatioCoeff z k a) ^ 2 * (categoryArmSet k (finTwoEquiv a)).indicator (fun _ => (1 : ℝ)) (z i))
= ((indexSet z (categorySet k)).card : ℝ) ^ 2 * (if 0 < (indexSet z (categoryArmSet k (finTwoEquiv a))).card then ((indexSet z (categoryArmSet k (finTwoEquiv a))).card : ℝ)⁻¹ else 0)
Proof (Lean source)
lemma sum_tupleRatioCoeff_sq_armIndicator_eq {I : Type*} [Fintype I] [DecidableEq I] {d : ℕ} (z : I → Obs d) (k : Fin d) (a : Fin 2) : (∑ i : I, (tupleRatioCoeff z k a) ^ 2 * (categoryArmSet k (finTwoEquiv a)).indicator (fun _ => (1 : ℝ)) (z i)) = ((indexSet z (categorySet k)).card : ℝ) ^ 2 * (if 0 < (indexSet z (categoryArmSet k (finTwoEquiv a))).card then ((indexSet z (categoryArmSet k (finTwoEquiv a))).card : ℝ)⁻¹ else 0) := by classical let D := (indexSet z (categoryArmSet k (finTwoEquiv a))).card have hsum : (∑ i : I, (categoryArmSet k (finTwoEquiv a)).indicator (fun _ => (1 : ℝ)) (z i)) = (D : ℝ) := by unfold D indexSet rw [show (((Finset.univ : Finset I).filter (fun i => z i ∈ categoryArmSet k (finTwoEquiv a))).card : ℝ) = ∑ i ∈ (Finset.univ : Finset I).filter (fun i => z i ∈ categoryArmSet k (finTwoEquiv a)), (1 : ℝ) by simp] rw [Finset.sum_filter] simp [indicator] rw [← Finset.mul_sum, hsum] unfold tupleRatioCoeff by_cases hD : 0 < D · simp only [D] at hD ⊢ rw [if_pos hD] have hDR : (D : ℝ) ≠ 0 := by positivity field_simp · have hDz : D = 0 := Nat.eq_zero_of_not_pos hD simp [D] at hDz simp [D, hD, hDz]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.sum_tupleRatioCoeff_sq_armIndicator_eq · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:1571
theorem integral_fixedRatioResidual_sq_le Lemma 11 in the paper ↗

Aggregate fixed-set residual variance. Cross-cell cancellation preserves the parametric order and the only overlap loss is one factor epsilon inverse.

Formal statement
I :
d :
epsilon :
P :
hOverlap :
Overlap epsilon P
hepsilon :
0 < epsilon
H :
a :
Fin 2
hp :
∀ k ∈ H, 0 < cellMass P k
∫ z : I → Obs d, (fixedRatioResidual P z H a) ^ 2 ∂(Measure.pi (fun _ : I => obsLaw P))
≤ (2 * (Fintype.card I : ℝ) / epsilon) * ∑ k ∈ H, cellMass P k
Proof (Lean source)
lemma integral_fixedRatioResidual_sq_le {I : Type*} [Fintype I] [DecidableEq I] {d : ℕ} {epsilon : ℝ} (P : DiscreteLaw d) (hOverlap : Overlap epsilon P) (hepsilon : 0 < epsilon) (H : Finset (Fin d)) (a : Fin 2) (hp : ∀ k ∈ H, 0 < cellMass P k) : ∫ z : I → Obs d, (fixedRatioResidual P z H a) ^ 2 ∂(Measure.pi (fun _ : I => obsLaw P)) ≤ (2 * (Fintype.card I : ℝ) / epsilon) * ∑ k ∈ H, cellMass P k := by rw [integral_fixedRatioResidual_sq_eq_diagonal] calc (∑ k ∈ H, ∑ i : I, ∫ z : I → Obs d, (tupleRatioCoeff z k a) ^ 2 * (armOutcomeResidual P k a (z i)) ^ 2 ∂(Measure.pi (fun _ : I => obsLaw P))) ≤ ∑ k ∈ H, 2 * (Fintype.card I : ℝ) * cellMass P k / epsilon := by apply Finset.sum_le_sum intro k hk calc (∑ i : I, ∫ z : I → Obs d, (tupleRatioCoeff z k a) ^ 2 * (armOutcomeResidual P k a (z i)) ^ 2 ∂(Measure.pi (fun _ : I => obsLaw P))) ≤ ∑ i : I, ∫ z : I → Obs d, (tupleRatioCoeff z k a) ^ 2 * (categoryArmSet k (finTwoEquiv a)).indicator (fun _ => (1 : ℝ)) (z i) ∂(Measure.pi (fun _ : I => obsLaw P)) := by apply Finset.sum_le_sum intro i hi exact integral_ratioResidual_diagonal_le P i k a _ = ∫ z : I → Obs d, ∑ i : I, (tupleRatioCoeff z k a) ^ 2 * (categoryArmSet k (finTwoEquiv a)).indicator (fun _ => (1 : ℝ)) (z i) ∂(Measure.pi (fun _ : I => obsLaw P)) := by rw [integral_finset_sum univ (fun _ _ => Integrable.of_finite)] _ = ∫ z : I → Obs d, ((indexSet z (categorySet k)).card : ℝ) ^ 2 * (if 0 < (indexSet z (categoryArmSet k (finTwoEquiv a))).card then ((indexSet z (categoryArmSet k (finTwoEquiv a))).card : ℝ)⁻¹ else 0) ∂(Measure.pi (fun _ : I => obsLaw P)) := by apply integral_congr_ae filter_upwards with z exact sum_tupleRatioCoeff_sq_armIndicator_eq z k a _ ≤ 2 * (Fintype.card I : ℝ) * cellMass P k / epsilon := ate_nested_count_ratio_integral_le P hOverlap hepsilon k (finTwoEquiv a) (hp k hk) _ = (2 * (Fintype.card I : ℝ) / epsilon) * ∑ k ∈ H, cellMass P k := by rw [Finset.mul_sum] apply Finset.sum_congr rfl intro k hk ring
CausalSmith.Stat.DiscreteAteMinimaxLoggap.integral_fixedRatioResidual_sq_le · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:1606
def oneSelectedAvoidEvent

One selected observation has label s, while every observation avoids the forbidden label r.

Definition (Lean source)
def oneSelectedAvoidEvent (i : I) (s r : A) : Set (I → A) := {z | z i = s ∧ ∀ j, z j ≠ r}
CausalSmith.Stat.DiscreteAteMinimaxLoggap.oneSelectedAvoidEvent · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:1724
theorem oneSelectedAvoidEvent_eq_pi

When the prescribed label differs from the forbidden one, the event that a distinguished observation carries the prescribed label while no observation carries the forbidden one is a product event: the distinguished coordinate is confined to the prescribed label and every other coordinate to the complement of the forbidden one.

Formal statement
i :
I
s r :
A
hsr :
s ≠ r
oneSelectedAvoidEvent i s r = Set.univ.pi (fun j => if j = i then {s} else ({r} : Set A)ᶜ)
Proof (Lean source)
lemma oneSelectedAvoidEvent_eq_pi (i : I) (s r : A) (hsr : s ≠ r) : oneSelectedAvoidEvent i s r = Set.univ.pi (fun j => if j = i then {s} else ({r} : Set A)ᶜ) := by ext z simp only [oneSelectedAvoidEvent, Set.mem_setOf_eq, Set.mem_pi, Set.mem_univ, forall_true_left] constructor · rintro ⟨hzi, hav⟩ j by_cases hji : j = i · subst j simp [hzi] · simp [hji, hav j] · intro h have hi := h i simp only [if_pos, Set.mem_singleton_iff] at hi refine ⟨hi, ?_⟩ intro j hjr have hj := h j by_cases hji : j = i · subst j exact hsr (hi.symm.trans hjr) · simpa [hji, hjr] using hj
CausalSmith.Stat.DiscreteAteMinimaxLoggap.oneSelectedAvoidEvent_eq_pi · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:1729
theorem measure_oneSelectedAvoidEvent

Exact product probability of one selected non-forbidden label and no forbidden labels among the remaining observations.

Formal statement
i :
I
s r :
A
hsr :
s ≠ r
(Measure.pi (fun _ : I => P)) (oneSelectedAvoidEvent i s r)
= P {s} * P ({r}ᶜ) ^ (card I - 1)
Proof (Lean source)
lemma measure_oneSelectedAvoidEvent (P : Measure A) [IsProbabilityMeasure P] (i : I) (s r : A) (hsr : s ≠ r) : (Measure.pi (fun _ : I => P)) (oneSelectedAvoidEvent i s r) = P {s} * P ({r}ᶜ) ^ (card I - 1) := by rw [oneSelectedAvoidEvent_eq_pi i s r hsr, Measure.pi_pi] classical have hfun : (fun l : I => P (if l = i then {s} else ({r} : Set A)ᶜ)) = fun l => if l = i then P {s} else P ({r}ᶜ) := by funext l by_cases hli : l = i <;> simp [hli] rw [hfun] exact prod_one_distinguished i (P {s}) (P ({r}ᶜ))
CausalSmith.Stat.DiscreteAteMinimaxLoggap.measure_oneSelectedAvoidEvent · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:1756
def twoSelectedAvoidEvent

Two distinct selected observations have prescribed labels while the whole sample avoids a third, forbidden label.

Definition (Lean source)
def twoSelectedAvoidEvent (i j : I) (s t r : A) : Set (I → A) := {z | z i = s ∧ z j = t ∧ ∀ l, z l ≠ r}
CausalSmith.Stat.DiscreteAteMinimaxLoggap.twoSelectedAvoidEvent · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:1771
theorem twoSelectedAvoidEvent_eq_pi

When two distinct distinguished observations carry two labels, each different from a third forbidden label, the event that they do so while no observation carries the forbidden label is a product event: each distinguished coordinate is confined to its own label and every remaining coordinate to the complement of the forbidden one.

Formal statement
i j :
I
s t r :
A
hij :
i ≠ j
hsr :
s ≠ r
htr :
t ≠ r
= Set.univ.pi (fun l => if l = i then {s} else if l = j then {t} else ({r} : Set A)ᶜ)
Proof (Lean source)
lemma twoSelectedAvoidEvent_eq_pi (i j : I) (s t r : A) (hij : i ≠ j) (hsr : s ≠ r) (htr : t ≠ r) : twoSelectedAvoidEvent i j s t r = Set.univ.pi (fun l => if l = i then {s} else if l = j then {t} else ({r} : Set A)ᶜ) := by ext z simp only [twoSelectedAvoidEvent, Set.mem_setOf_eq, Set.mem_pi, Set.mem_univ, forall_true_left] constructor · rintro ⟨hzi, hzj, hav⟩ l by_cases hli : l = i · subst l simp [hzi] · by_cases hlj : l = j · subst l simp [hli, hzj] · simp [hli, hlj, hav l] · intro h have hi := h i have hj := h j simp only [if_pos, Set.mem_singleton_iff] at hi simp only [hij.symm, if_false, if_pos, Set.mem_singleton_iff] at hj refine ⟨hi, hj, ?_⟩ intro l hlr have hl := h l by_cases hli : l = i · subst l exact hsr (hi.symm.trans hlr) · by_cases hlj : l = j · subst l exact htr (hj.symm.trans hlr) · simpa [hli, hlj, hlr] using hl
CausalSmith.Stat.DiscreteAteMinimaxLoggap.twoSelectedAvoidEvent_eq_pi · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:1776
theorem measure_twoSelectedAvoidEvent

Exact missing-label two-selection probability, the cross-cell term in equation (4) of the heavy-cell proof.

Formal statement
i j :
I
s t r :
A
hij :
i ≠ j
hsr :
s ≠ r
htr :
t ≠ r
(Measure.pi (fun _ : I => P)) (twoSelectedAvoidEvent i j s t r)
= P {s} * P {t} * P ({r}ᶜ) ^ (card I - 2)
Proof (Lean source)
lemma measure_twoSelectedAvoidEvent (P : Measure A) [IsProbabilityMeasure P] (i j : I) (s t r : A) (hij : i ≠ j) (hsr : s ≠ r) (htr : t ≠ r) : (Measure.pi (fun _ : I => P)) (twoSelectedAvoidEvent i j s t r) = P {s} * P {t} * P ({r}ᶜ) ^ (card I - 2) := by rw [twoSelectedAvoidEvent_eq_pi i j s t r hij hsr htr, Measure.pi_pi] classical have hfun : (fun l : I => P (if l = i then {s} else if l = j then {t} else ({r} : Set A)ᶜ)) = fun l => if l = i then P {s} else if l = j then P {t} else P ({r}ᶜ) := by funext l by_cases hli : l = i · simp [hli] · by_cases hlj : l = j · have hji : j ≠ i := fun h => hli (hlj.trans h) simp [hli, hlj, hji] · simp only [hli, hlj, if_false] rw [hfun] exact prod_two_distinguished i j (P {s}) (P {t}) (P ({r}ᶜ)) hij
CausalSmith.Stat.DiscreteAteMinimaxLoggap.measure_twoSelectedAvoidEvent · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:1813
def oneSelectedAvoidSetEvent

Set-valued version used for an entire treatment arm: the selected observation belongs to S, and every observation avoids the disjoint set R.

Definition (Lean source)
def oneSelectedAvoidSetEvent (i : I) (S R : Set A) : Set (I → A) := {z | z i ∈ S ∧ ∀ j, z j ∉ R}
CausalSmith.Stat.DiscreteAteMinimaxLoggap.oneSelectedAvoidSetEvent · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:1834
theorem oneSelectedAvoidSetEvent_eq_pi

When two sets of labels are disjoint, the event that a distinguished observation falls in the first set while no observation falls in the second is a product event: the distinguished coordinate is confined to the first set and every other coordinate to the complement of the second. This is the form used when the first set is a whole treatment arm rather than a single label.

Formal statement
i :
I
S R :
Set A
hSR :
oneSelectedAvoidSetEvent i S R = Set.univ.pi (fun j => if j = i then S else Rᶜ)
Proof (Lean source)
lemma oneSelectedAvoidSetEvent_eq_pi (i : I) (S R : Set A) (hSR : Disjoint S R) : oneSelectedAvoidSetEvent i S R = Set.univ.pi (fun j => if j = i then S else Rᶜ) := by ext z simp only [oneSelectedAvoidSetEvent, Set.mem_setOf_eq, Set.mem_pi, Set.mem_univ, forall_true_left] constructor · rintro ⟨hzi, hav⟩ j by_cases hji : j = i · simpa [hji] using hzi · simp [hji, hav j] · intro h have hi := h i simp only [if_pos] at hi refine ⟨hi, ?_⟩ intro j hjR have hj := h j by_cases hji : j = i · subst j exact Set.disjoint_left.1 hSR hi hjR · simpa [hji, hjR] using hj
CausalSmith.Stat.DiscreteAteMinimaxLoggap.oneSelectedAvoidSetEvent_eq_pi · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:1839
theorem measure_oneSelectedAvoidSetEvent

Exact one-selection/no-forbidden-set product probability.

Formal statement
i :
I
S R :
Set A
hS :
hR :
hSR :
(Measure.pi (fun _ : I => P)) (oneSelectedAvoidSetEvent i S R)
= P S * P (Rᶜ) ^ (card I - 1)
Proof (Lean source)
lemma measure_oneSelectedAvoidSetEvent (P : Measure A) [IsProbabilityMeasure P] (i : I) (S R : Set A) (hS : MeasurableSet S) (hR : MeasurableSet R) (hSR : Disjoint S R) : (Measure.pi (fun _ : I => P)) (oneSelectedAvoidSetEvent i S R) = P S * P (Rᶜ) ^ (card I - 1) := by rw [oneSelectedAvoidSetEvent_eq_pi i S R hSR, Measure.pi_pi] classical have hfun : (fun l : I => P (if l = i then S else Rᶜ)) = fun l => if l = i then P S else P (Rᶜ) := by funext l by_cases hli : l = i <;> simp [hli] rw [hfun] exact prod_one_distinguished i (P S) (P (Rᶜ))
CausalSmith.Stat.DiscreteAteMinimaxLoggap.measure_oneSelectedAvoidSetEvent · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:1867
def missingIndexCount

Number of observations in a category when its specified nested arm is entirely missing.

Definition (Lean source)
noncomputable def missingIndexCount (z : I → A) (C R : Set A) : ℕ := if (indexSet z R).card = 0 then (indexSet z C).card else 0
CausalSmith.Stat.DiscreteAteMinimaxLoggap.missingIndexCount · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:1882
theorem missingIndexCount_eq_sum_indicator

A missing-arm category count is the sum of one-selected/no-forbidden-arm indicators.

Formal statement
z :
I → A
C R :
Set A
hRC :
R ⊆ C
(missingIndexCount z C R : ℝ)
= ∑ i : I, (oneSelectedAvoidSetEvent i (C \ R) R).indicator (fun _ => (1 : ℝ)) z
Proof (Lean source)
lemma missingIndexCount_eq_sum_indicator (z : I → A) (C R : Set A) (hRC : R ⊆ C) : (missingIndexCount z C R : ℝ) = ∑ i : I, (oneSelectedAvoidSetEvent i (C \ R) R).indicator (fun _ => (1 : ℝ)) z := by classical by_cases hzero : (indexSet z R).card = 0 · have hav : ∀ i, z i ∉ R := by intro i hi have himem : i ∈ indexSet z R := by simp [indexSet, hi] have hne : (indexSet z R).card ≠ 0 := Finset.card_ne_zero.mpr ⟨i, himem⟩ exact hne hzero simp only [missingIndexCount, hzero, if_true, Nat.cast_sum, oneSelectedAvoidSetEvent, indicator, Set.mem_setOf_eq] unfold indexSet simp only [Finset.card_filter, Finset.sum_filter, Finset.sum_const_zero, Finset.sum_ite_irrel, Finset.mem_univ, true_and] rw [Nat.cast_sum] simp only [Nat.cast_ite, cast_one, cast_zero] apply Finset.sum_congr rfl intro i hi by_cases hiC : z i ∈ C · have hiR : z i ∉ R := hav i simp [hiC, hiR, hav] · simp [hiC] · have hex : ∃ i, z i ∈ R := by have hcard : 0 < (indexSet z R).card := Nat.pos_of_ne_zero hzero obtain ⟨i, hi⟩ := Finset.card_pos.mp hcard exact ⟨i, by simpa [indexSet] using hi⟩ rcases hex with ⟨i0, hi0⟩ simp only [missingIndexCount, hzero, if_false, cast_zero] symm apply Finset.sum_eq_zero intro i hi simp only [indicator] rw [if_neg] intro hevent exact hevent.2 i0 hi0
CausalSmith.Stat.DiscreteAteMinimaxLoggap.missingIndexCount_eq_sum_indicator · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:1887
def twoSelectedAvoidSetEvent

Two ordered, distinct selected observations belong to S, while all observations avoid the disjoint forbidden set R.

Definition (Lean source)
def twoSelectedAvoidSetEvent (i j : I) (S R : Set A) : Set (I → A) := {z | z i ∈ S ∧ z j ∈ S ∧ ∀ l, z l ∉ R}
CausalSmith.Stat.DiscreteAteMinimaxLoggap.twoSelectedAvoidSetEvent · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:1929
theorem twoSelectedAvoidSetEvent_eq_pi

When the two sets are disjoint, the event that two distinct distinguished observations both fall in the first set while no observation falls in the second is the product event confining the two distinguished coordinates to the first set and every remaining coordinate to the complement of the second.

Formal statement
i j :
I
S R :
Set A
hij :
i ≠ j
hSR :
= Set.univ.pi (fun l => if l = i then S else if l = j then S else Rᶜ)
Proof (Lean source)
lemma twoSelectedAvoidSetEvent_eq_pi (i j : I) (S R : Set A) (hij : i ≠ j) (hSR : Disjoint S R) : twoSelectedAvoidSetEvent i j S R = Set.univ.pi (fun l => if l = i then S else if l = j then S else Rᶜ) := by ext z simp only [twoSelectedAvoidSetEvent, Set.mem_setOf_eq, Set.mem_pi, Set.mem_univ, forall_true_left] constructor · rintro ⟨hzi, hzj, hav⟩ l by_cases hli : l = i · simpa [hli] using hzi · by_cases hlj : l = j · simpa [hli, hlj] using hzj · simp [hli, hlj, hav l] · intro h have hi := h i have hj := h j simp only [if_pos] at hi simp only [hij.symm, if_false, if_pos] at hj refine ⟨hi, hj, ?_⟩ intro l hlR have hl := h l by_cases hli : l = i · subst l exact Set.disjoint_left.1 hSR hi hlR · by_cases hlj : l = j · subst l exact Set.disjoint_left.1 hSR hj hlR · simpa [hli, hlj, hlR] using hl
CausalSmith.Stat.DiscreteAteMinimaxLoggap.twoSelectedAvoidSetEvent_eq_pi · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:1934
theorem measure_twoSelectedAvoidSetEvent

Exact ordered-pair/no-forbidden-set probability. Summing this lemma over ordered distinct indices produces the (m)_2 s^2 (1-r)^(m-2) term in the missing-arm second moment.

Formal statement
i j :
I
S R :
Set A
hij :
i ≠ j
hS :
hR :
hSR :
(Measure.pi (fun _ : I => P)) (twoSelectedAvoidSetEvent i j S R)
= P S * P S * P (Rᶜ) ^ (card I - 2)
Proof (Lean source)
lemma measure_twoSelectedAvoidSetEvent (P : Measure A) [IsProbabilityMeasure P] (i j : I) (S R : Set A) (hij : i ≠ j) (hS : MeasurableSet S) (hR : MeasurableSet R) (hSR : Disjoint S R) : (Measure.pi (fun _ : I => P)) (twoSelectedAvoidSetEvent i j S R) = P S * P S * P (Rᶜ) ^ (card I - 2) := by rw [twoSelectedAvoidSetEvent_eq_pi i j S R hij hSR, Measure.pi_pi] classical have hfun : (fun l : I => P (if l = i then S else if l = j then S else Rᶜ)) = fun l => if l = i then P S else if l = j then P S else P (Rᶜ) := by funext l by_cases hli : l = i · simp [hli] · by_cases hlj : l = j · have hji : j ≠ i := fun h => hli (hlj.trans h) simp [hli, hlj, hji] · simp only [hli, hlj, if_false] rw [hfun] exact prod_two_distinguished i j (P S) (P S) (P (Rᶜ)) hij
CausalSmith.Stat.DiscreteAteMinimaxLoggap.measure_twoSelectedAvoidSetEvent · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:1968
theorem sum_measure_oneSelectedAvoidSetEvent

Summed diagonal part of the exact missing-arm second moment.

Formal statement
S R :
Set A
hS :
hR :
hSR :
(∑ i : I, (Measure.pi (fun _ : I => P)) (oneSelectedAvoidSetEvent i S R))
= (Fintype.card I : ℝ≥0∞) * P S * P (Rᶜ) ^ (Fintype.card I - 1)
Proof (Lean source)
lemma sum_measure_oneSelectedAvoidSetEvent (P : Measure A) [IsProbabilityMeasure P] (S R : Set A) (hS : MeasurableSet S) (hR : MeasurableSet R) (hSR : Disjoint S R) : (∑ i : I, (Measure.pi (fun _ : I => P)) (oneSelectedAvoidSetEvent i S R)) = (Fintype.card I : ℝ≥0∞) * P S * P (Rᶜ) ^ (Fintype.card I - 1) := by simp_rw [measure_oneSelectedAvoidSetEvent P _ S R hS hR hSR] simp [mul_assoc]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.sum_measure_oneSelectedAvoidSetEvent · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:1991
theorem integral_missingIndexCount_eq

Exact first moment of the missing-arm category count in the discrete ATE model.

Formal statement
d :
P :
k :
Fin d
a :
hp :
0 < cellMass P k
∫ z : I → Obs d, (missingIndexCount z (categorySet k) (categoryArmSet k a) : ℝ) ∂(Measure.pi (fun _ : I => obsLaw P))
= (Fintype.card I : ℝ) * (cellMass P k * (1 - armPropensity P k a)) * (1 - cellMass P k * armPropensity P k a) ^ (Fintype.card I - 1)
Proof (Lean source)
lemma integral_missingIndexCount_eq {d : ℕ} (P : DiscreteLaw d) (k : Fin d) (a : Bool) (hp : 0 < cellMass P k) : ∫ z : I → Obs d, (missingIndexCount z (categorySet k) (categoryArmSet k a) : ℝ) ∂(Measure.pi (fun _ : I => obsLaw P)) = (Fintype.card I : ℝ) * (cellMass P k * (1 - armPropensity P k a)) * (1 - cellMass P k * armPropensity P k a) ^ (Fintype.card I - 1) := by have hpoint : (fun z : I → Obs d => (missingIndexCount z (categorySet k) (categoryArmSet k a) : ℝ)) = fun z => ∑ i : I, (oneSelectedAvoidSetEvent i (categorySet k \ categoryArmSet k a) (categoryArmSet k a)).indicator (fun _ => (1 : ℝ)) z := by funext z exact missingIndexCount_eq_sum_indicator z _ _ (categoryArmSet_subset_categorySet k a) rw [hpoint, integral_finset_sum univ (fun _ _ => Integrable.of_finite)] have hint (i : I) : ∫ z : I → Obs d, (oneSelectedAvoidSetEvent i (categorySet k \ categoryArmSet k a) (categoryArmSet k a)).indicator (fun _ => (1 : ℝ)) z ∂(Measure.pi (fun _ : I => obsLaw P)) = (Measure.pi (fun _ : I => obsLaw P)).real (oneSelectedAvoidSetEvent i (categorySet k \ categoryArmSet k a) (categoryArmSet k a)) := by exact (integral_indicator_one (MeasurableSet.of_discrete : MeasurableSet (oneSelectedAvoidSetEvent i (categorySet k \ categoryArmSet k a) (categoryArmSet k a)))) simp_rw [hint] simp_rw [measureReal_def] simp_rw [measure_oneSelectedAvoidSetEvent (obsLaw P) _ (categorySet k \ categoryArmSet k a) (categoryArmSet k a) MeasurableSet.of_discrete MeasurableSet.of_discrete Set.disjoint_sdiff_left] simp_rw [ENNReal.toReal_mul, ENNReal.toReal_pow] rw [Finset.sum_const, Finset.card_univ, nsmul_eq_mul] rw [show (obsLaw P (categorySet k \ categoryArmSet k a)).toReal = cellMass P k * (1 - armPropensity P k a) by exact obsLaw_categoryArm_diff_mass P k a hp] rw [show (obsLaw P (categoryArmSet k a)ᶜ).toReal = 1 - cellMass P k * armPropensity P k a by change (obsLaw P).real (categoryArmSet k a)ᶜ = _ rw [measureReal_compl MeasurableSet.of_discrete, probReal_univ, obsLaw_categoryArmSet_mass, armMass_eq_cellMass_mul_armPropensity P k a hp]] ring
CausalSmith.Stat.DiscreteAteMinimaxLoggap.integral_missingIndexCount_eq · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:2001
theorem sum_measure_twoSelectedAvoidSetEvent

Summed ordered-pair part of the exact missing-arm second moment. Together with sum_measure_oneSelectedAvoidSetEvent, this is precisely equation (4)'s m s (1-r)^(m-1) + (m)_2 s^2 (1-r)^(m-2) decomposition.

Formal statement
S R :
Set A
hS :
hR :
hSR :
(∑ i : I, ∑ j ∈ (Finset.univ : Finset I).erase i, (Measure.pi (fun _ : I => P)) (twoSelectedAvoidSetEvent i j S R))
= ((card I).descFactorial 2 : ℝ≥0∞) * P S * P S * P (Rᶜ) ^ (card I - 2)
Proof (Lean source)
lemma sum_measure_twoSelectedAvoidSetEvent (P : Measure A) [IsProbabilityMeasure P] (S R : Set A) (hS : MeasurableSet S) (hR : MeasurableSet R) (hSR : Disjoint S R) : (∑ i : I, ∑ j ∈ (Finset.univ : Finset I).erase i, (Measure.pi (fun _ : I => P)) (twoSelectedAvoidSetEvent i j S R)) = ((card I).descFactorial 2 : ℝ≥0∞) * P S * P S * P (Rᶜ) ^ (card I - 2) := by classical have hexact : (∑ i : I, ∑ j ∈ (Finset.univ : Finset I).erase i, (Measure.pi (fun _ : I => P)) (twoSelectedAvoidSetEvent i j S R)) = ∑ i : I, ∑ _j ∈ (Finset.univ : Finset I).erase i, P S * P S * P (Rᶜ) ^ (card I - 2) := by apply Finset.sum_congr rfl intro i hi apply Finset.sum_congr rfl intro j hj exact measure_twoSelectedAvoidSetEvent P i j S R (Finset.ne_of_mem_erase hj).symm hS hR hSR rw [hexact] simp only [Finset.sum_const, Finset.card_erase_of_mem, Finset.mem_univ, nsmul_eq_mul, Finset.card_univ] have hdesc : (card I).descFactorial 2 = card I * (card I - 1) := by cases card I <;> simp [descFactorial, Nat.mul_comm] rw [hdesc, Nat.cast_mul] ring
CausalSmith.Stat.DiscreteAteMinimaxLoggap.sum_measure_twoSelectedAvoidSetEvent · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:2054
theorem oneSelected_indicator_sq

Establishes the stated upper bound for one Selected indicator sq.

Formal statement
z :
I → A
i :
I
S R :
Set A
((oneSelectedAvoidSetEvent i S R).indicator (fun _ => (1 : ℝ)) z) ^ 2
= (oneSelectedAvoidSetEvent i S R).indicator (fun _ => (1 : ℝ)) z
Proof (Lean source)
lemma oneSelected_indicator_sq (z : I → A) (i : I) (S R : Set A) : ((oneSelectedAvoidSetEvent i S R).indicator (fun _ => (1 : ℝ)) z) ^ 2 = (oneSelectedAvoidSetEvent i S R).indicator (fun _ => (1 : ℝ)) z := by by_cases h : z ∈ oneSelectedAvoidSetEvent i S R <;> simp [indicator, h]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.oneSelected_indicator_sq · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:2087
theorem oneSelected_indicator_mul

Establishes the stated upper bound for one Selected indicator mul.

Formal statement
z :
I → A
i j :
I
S R :
Set A
(oneSelectedAvoidSetEvent i S R).indicator (fun _ => (1 : ℝ)) z * (oneSelectedAvoidSetEvent j S R).indicator (fun _ => (1 : ℝ)) z
= (twoSelectedAvoidSetEvent i j S R).indicator (fun _ => (1 : ℝ)) z
Proof (Lean source)
lemma oneSelected_indicator_mul (z : I → A) (i j : I) (S R : Set A) : (oneSelectedAvoidSetEvent i S R).indicator (fun _ => (1 : ℝ)) z * (oneSelectedAvoidSetEvent j S R).indicator (fun _ => (1 : ℝ)) z = (twoSelectedAvoidSetEvent i j S R).indicator (fun _ => (1 : ℝ)) z := by by_cases hi : z ∈ oneSelectedAvoidSetEvent i S R · by_cases hj : z ∈ oneSelectedAvoidSetEvent j S R · have ht : z ∈ twoSelectedAvoidSetEvent i j S R := ⟨hi.1, hj.1, hi.2⟩ simp [indicator, hi, hj, ht] · have ht : z ∉ twoSelectedAvoidSetEvent i j S R := fun h => hj ⟨h.2.1, h.2.2⟩ simp [indicator, hi, hj, ht] · have ht : z ∉ twoSelectedAvoidSetEvent i j S R := fun h => hi ⟨h.1, h.2.2⟩ simp [indicator, hi, ht]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.oneSelected_indicator_mul · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:2093
theorem missingIndexCount_sq_eq_sum_indicator

Exact pointwise diagonal/off-diagonal expansion of a squared missing-arm category count.

Formal statement
z :
I → A
C R :
Set A
hRC :
R ⊆ C
(missingIndexCount z C R : ℝ) ^ 2
= ∑ i : I, (oneSelectedAvoidSetEvent i (C \ R) R).indicator (fun _ => (1 : ℝ)) z
+ ∑ i : I, ∑ j ∈ (Finset.univ : Finset I).erase i, (twoSelectedAvoidSetEvent i j (C \ R) R).indicator (fun _ => (1 : ℝ)) z
Proof (Lean source)
lemma missingIndexCount_sq_eq_sum_indicator (z : I → A) (C R : Set A) (hRC : R ⊆ C) : (missingIndexCount z C R : ℝ) ^ 2 = ∑ i : I, (oneSelectedAvoidSetEvent i (C \ R) R).indicator (fun _ => (1 : ℝ)) z + ∑ i : I, ∑ j ∈ (Finset.univ : Finset I).erase i, (twoSelectedAvoidSetEvent i j (C \ R) R).indicator (fun _ => (1 : ℝ)) z := by classical rw [missingIndexCount_eq_sum_indicator z C R hRC, sq, Finset.sum_mul] rw [← Finset.sum_add_distrib] apply Finset.sum_congr rfl intro i hi rw [Finset.mul_sum, ← Finset.sum_erase_add _ _ (Finset.mem_univ i)] rw [add_comm] congr 1 · simpa [sq] using oneSelected_indicator_sq z i (C \ R) R · apply Finset.sum_congr rfl intro j hj exact oneSelected_indicator_mul z i j (C \ R) R
CausalSmith.Stat.DiscreteAteMinimaxLoggap.missingIndexCount_sq_eq_sum_indicator · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:2109
theorem integral_missingIndexCount_sq_eq

Exact second moment of one cell's category count on the event that a specified treatment arm is absent.

Formal statement
d :
P :
k :
Fin d
a :
hp :
0 < cellMass P k
∫ z : I → Obs d, (missingIndexCount z (categorySet k) (categoryArmSet k a) : ℝ) ^ 2 ∂(Measure.pi (fun _ : I => obsLaw P))
= (Fintype.card I : ℝ) * (cellMass P k * (1 - armPropensity P k a)) * (1 - cellMass P k * armPropensity P k a) ^ (Fintype.card I - 1)
+ ((Fintype.card I).descFactorial 2 : ℝ) * (cellMass P k * (1 - armPropensity P k a)) ^ 2 * (1 - cellMass P k * armPropensity P k a) ^ (Fintype.card I - 2)
Proof (Lean source)
lemma integral_missingIndexCount_sq_eq {d : ℕ} (P : DiscreteLaw d) (k : Fin d) (a : Bool) (hp : 0 < cellMass P k) : ∫ z : I → Obs d, (missingIndexCount z (categorySet k) (categoryArmSet k a) : ℝ) ^ 2 ∂(Measure.pi (fun _ : I => obsLaw P)) = (Fintype.card I : ℝ) * (cellMass P k * (1 - armPropensity P k a)) * (1 - cellMass P k * armPropensity P k a) ^ (Fintype.card I - 1) + ((Fintype.card I).descFactorial 2 : ℝ) * (cellMass P k * (1 - armPropensity P k a)) ^ 2 * (1 - cellMass P k * armPropensity P k a) ^ (Fintype.card I - 2) := by classical let S := categorySet k \ categoryArmSet k a let R := categoryArmSet k a rw [show (fun z : I → Obs d => (missingIndexCount z (categorySet k) (categoryArmSet k a) : ℝ) ^ 2) = fun z => ∑ i : I, (oneSelectedAvoidSetEvent i S R).indicator (fun _ => (1 : ℝ)) z + ∑ i : I, ∑ j ∈ (Finset.univ : Finset I).erase i, (twoSelectedAvoidSetEvent i j S R).indicator (fun _ => (1 : ℝ)) z by funext z exact missingIndexCount_sq_eq_sum_indicator z _ _ (categoryArmSet_subset_categorySet k a)] rw [integral_add Integrable.of_finite Integrable.of_finite] simp_rw [integral_finset_sum Finset.univ (fun _ _ => Integrable.of_finite)] simp_rw [integral_finset_sum ((Finset.univ : Finset I).erase _) (fun _ _ => Integrable.of_finite)] have hint1 (i : I) : ∫ z : I → Obs d, (oneSelectedAvoidSetEvent i S R).indicator (fun _ => (1 : ℝ)) z ∂(Measure.pi (fun _ : I => obsLaw P)) = (Measure.pi (fun _ : I => obsLaw P)).real (oneSelectedAvoidSetEvent i S R) := by exact (integral_indicator_one (MeasurableSet.of_discrete : MeasurableSet (oneSelectedAvoidSetEvent i S R))) have hint2 (i j : I) : ∫ z : I → Obs d, (twoSelectedAvoidSetEvent i j S R).indicator (fun _ => (1 : ℝ)) z ∂(Measure.pi (fun _ : I => obsLaw P)) = (Measure.pi (fun _ : I => obsLaw P)).real (twoSelectedAvoidSetEvent i j S R) := by exact (integral_indicator_one (MeasurableSet.of_discrete : MeasurableSet (twoSelectedAvoidSetEvent i j S R))) simp_rw [hint1, hint2] simp_rw [measureReal_def] have hcross : (∑ i : I, ∑ j ∈ (Finset.univ : Finset I).erase i, ((Measure.pi (fun _ : I => obsLaw P)) (twoSelectedAvoidSetEvent i j S R)).toReal) = (∑ i : I, ∑ j ∈ (Finset.univ : Finset I).erase i, (Measure.pi (fun _ : I => obsLaw P)) (twoSelectedAvoidSetEvent i j S R)).toReal := by rw [ENNReal.toReal_sum] · apply Finset.sum_congr rfl intro i hi rw [ENNReal.toReal_sum] intro j hj exact measure_ne_top _ _ · intro i hi rw [ENNReal.sum_ne_top] intro j hj exact measure_ne_top _ _ have hfirst : (∑ i : I, ((Measure.pi (fun _ : I => obsLaw P)) (oneSelectedAvoidSetEvent i S R)).toReal) = (∑ i : I, (Measure.pi (fun _ : I => obsLaw P)) (oneSelectedAvoidSetEvent i S R)).toReal := by rw [ENNReal.toReal_sum] intro i hi exact measure_ne_top _ _ rw [hfirst, hcross] rw [sum_measure_oneSelectedAvoidSetEvent (obsLaw P) S R MeasurableSet.of_discrete MeasurableSet.of_discrete Set.disjoint_sdiff_left] rw [sum_measure_twoSelectedAvoidSetEvent (obsLaw P) S R MeasurableSet.of_discrete MeasurableSet.of_discrete Set.disjoint_sdiff_left] simp only [ENNReal.toReal_mul, ENNReal.toReal_pow, ENNReal.toReal_natCast] rw [show (obsLaw P S).toReal = cellMass P k * (1 - armPropensity P k a) by exact obsLaw_categoryArm_diff_mass P k a hp] rw [show (obsLaw P Rᶜ).toReal = 1 - cellMass P k * armPropensity P k a by change (obsLaw P).real (categoryArmSet k a)ᶜ = _ rw [measureReal_compl MeasurableSet.of_discrete, probReal_univ, obsLaw_categoryArmSet_mass, armMass_eq_cellMass_mul_armPropensity P k a hp]] ring
CausalSmith.Stat.DiscreteAteMinimaxLoggap.integral_missingIndexCount_sq_eq · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:2132
def twoSelectedAvoidSetsEvent

Cross-category event: the two selected observations may belong to different sets, and the full sample avoids a common forbidden set.

Definition (Lean source)
def twoSelectedAvoidSetsEvent (i j : I) (S T R : Set A) : Set (I → A) := {z | z i ∈ S ∧ z j ∈ T ∧ ∀ l, z l ∉ R}
CausalSmith.Stat.DiscreteAteMinimaxLoggap.twoSelectedAvoidSetsEvent · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:2227
theorem twoSelectedAvoidSetsEvent_eq_pi

When a forbidden set of labels is disjoint from each of two prescribed sets, the event that one distinguished observation falls in the first set, a second distinct distinguished observation falls in the second set, and no observation falls in the forbidden set, is the product event confining each distinguished coordinate to its own set and every remaining coordinate to the complement of the forbidden set.

Formal statement
i j :
I
S T R :
Set A
hij :
i ≠ j
hSR :
hTR :
= Set.univ.pi (fun l => if l = i then S else if l = j then T else Rᶜ)
Proof (Lean source)
lemma twoSelectedAvoidSetsEvent_eq_pi (i j : I) (S T R : Set A) (hij : i ≠ j) (hSR : Disjoint S R) (hTR : Disjoint T R) : twoSelectedAvoidSetsEvent i j S T R = Set.univ.pi (fun l => if l = i then S else if l = j then T else Rᶜ) := by ext z simp only [twoSelectedAvoidSetsEvent, Set.mem_setOf_eq, Set.mem_pi, Set.mem_univ, forall_true_left] constructor · rintro ⟨hzi, hzj, hav⟩ l by_cases hli : l = i · simpa [hli] using hzi · by_cases hlj : l = j · have hji : j ≠ i := hij.symm simpa [hji, hlj] using hzj · simp [hli, hlj, hav l] · intro h have hi := h i have hj := h j simp only [if_pos] at hi simp only [hij.symm, if_false, if_pos] at hj refine ⟨hi, hj, ?_⟩ intro l hlR have hl := h l by_cases hli : l = i · subst l exact Set.disjoint_left.1 hSR hi hlR · by_cases hlj : l = j · subst l exact Set.disjoint_left.1 hTR hj hlR · simpa [hli, hlj, hlR] using hl
CausalSmith.Stat.DiscreteAteMinimaxLoggap.twoSelectedAvoidSetsEvent_eq_pi · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:2232
theorem measure_twoSelectedAvoidSetsEvent

Exact cross-category ordered-pair probability. Taking R to be the union of the two treated-arm atoms gives the second line of equation (4).

Formal statement
i j :
I
S T R :
Set A
hij :
i ≠ j
hS :
hT :
hR :
hSR :
hTR :
(Measure.pi (fun _ : I => P)) (twoSelectedAvoidSetsEvent i j S T R)
= P S * P T * P (Rᶜ) ^ (card I - 2)
Proof (Lean source)
lemma measure_twoSelectedAvoidSetsEvent (P : Measure A) [IsProbabilityMeasure P] (i j : I) (S T R : Set A) (hij : i ≠ j) (hS : MeasurableSet S) (hT : MeasurableSet T) (hR : MeasurableSet R) (hSR : Disjoint S R) (hTR : Disjoint T R) : (Measure.pi (fun _ : I => P)) (twoSelectedAvoidSetsEvent i j S T R) = P S * P T * P (Rᶜ) ^ (card I - 2) := by rw [twoSelectedAvoidSetsEvent_eq_pi i j S T R hij hSR hTR, Measure.pi_pi] classical have hfun : (fun l : I => P (if l = i then S else if l = j then T else Rᶜ)) = fun l => if l = i then P S else if l = j then P T else P (Rᶜ) := by funext l by_cases hli : l = i · simp [hli] · by_cases hlj : l = j · have hji : j ≠ i := fun h => hli (hlj.trans h) simp [hli, hlj, hji] · simp only [hli, hlj, if_false] rw [hfun] exact prod_two_distinguished i j (P S) (P T) (P (Rᶜ)) hij
CausalSmith.Stat.DiscreteAteMinimaxLoggap.measure_twoSelectedAvoidSetsEvent · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:2269
theorem sum_measure_twoSelectedAvoidSetsEvent

Summed cross-category ordered-pair term.

Formal statement
S T R :
Set A
hS :
hT :
hR :
hSR :
hTR :
(∑ i : I, ∑ j ∈ (Finset.univ : Finset I).erase i, (Measure.pi (fun _ : I => P)) (twoSelectedAvoidSetsEvent i j S T R))
= ((card I).descFactorial 2 : ℝ≥0∞) * P S * P T * P (Rᶜ) ^ (card I - 2)
Proof (Lean source)
lemma sum_measure_twoSelectedAvoidSetsEvent (P : Measure A) [IsProbabilityMeasure P] (S T R : Set A) (hS : MeasurableSet S) (hT : MeasurableSet T) (hR : MeasurableSet R) (hSR : Disjoint S R) (hTR : Disjoint T R) : (∑ i : I, ∑ j ∈ (Finset.univ : Finset I).erase i, (Measure.pi (fun _ : I => P)) (twoSelectedAvoidSetsEvent i j S T R)) = ((card I).descFactorial 2 : ℝ≥0∞) * P S * P T * P (Rᶜ) ^ (card I - 2) := by classical have hexact : (∑ i : I, ∑ j ∈ (Finset.univ : Finset I).erase i, (Measure.pi (fun _ : I => P)) (twoSelectedAvoidSetsEvent i j S T R)) = ∑ i : I, ∑ _j ∈ (Finset.univ : Finset I).erase i, P S * P T * P (Rᶜ) ^ (card I - 2) := by apply Finset.sum_congr rfl intro i hi apply Finset.sum_congr rfl intro j hj exact measure_twoSelectedAvoidSetsEvent P i j S T R (Finset.ne_of_mem_erase hj).symm hS hT hR hSR hTR rw [hexact] simp only [Finset.sum_const, Finset.card_erase_of_mem, Finset.mem_univ, nsmul_eq_mul, Finset.card_univ] have hdesc : (card I).descFactorial 2 = card I * (card I - 1) := by cases card I <;> simp [descFactorial, Nat.mul_comm] rw [hdesc, Nat.cast_mul] ring
CausalSmith.Stat.DiscreteAteMinimaxLoggap.sum_measure_twoSelectedAvoidSetsEvent · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:2292
theorem oneSelected_indicator_mul_cross

Establishes the stated upper bound for one Selected indicator mul cross.

Formal statement
z :
I → A
i j :
I
S T R Q :
Set A
(oneSelectedAvoidSetEvent i S R).indicator (fun _ => (1 : ℝ)) z * (oneSelectedAvoidSetEvent j T Q).indicator (fun _ => (1 : ℝ)) z
= (twoSelectedAvoidSetsEvent i j S T (R ∪ Q)).indicator (fun _ => (1 : ℝ)) z
Proof (Lean source)
lemma oneSelected_indicator_mul_cross (z : I → A) (i j : I) (S T R Q : Set A) : (oneSelectedAvoidSetEvent i S R).indicator (fun _ => (1 : ℝ)) z * (oneSelectedAvoidSetEvent j T Q).indicator (fun _ => (1 : ℝ)) z = (twoSelectedAvoidSetsEvent i j S T (R ∪ Q)).indicator (fun _ => (1 : ℝ)) z := by by_cases hi : z ∈ oneSelectedAvoidSetEvent i S R · by_cases hj : z ∈ oneSelectedAvoidSetEvent j T Q · have ht : z ∈ twoSelectedAvoidSetsEvent i j S T (R ∪ Q) := by refine ⟨hi.1, hj.1, ?_⟩ intro l hl exact hl.elim (hi.2 l) (hj.2 l) simp [indicator, hi, hj, ht] · have ht : z ∉ twoSelectedAvoidSetsEvent i j S T (R ∪ Q) := fun h => hj ⟨h.2.1, fun l hl => h.2.2 l (inr hl)⟩ simp [indicator, hi, hj, ht] · have ht : z ∉ twoSelectedAvoidSetsEvent i j S T (R ∪ Q) := fun h => hi ⟨h.1, fun l hl => h.2.2 l (inl hl)⟩ simp [indicator, hi, ht]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.oneSelected_indicator_mul_cross · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:2324
theorem oneSelected_indicator_mul_zero_of_disjoint

Establishes the stated upper bound for one Selected indicator mul zero of disjoint.

Formal statement
z :
I → A
i :
I
S T R Q :
Set A
hST :
(oneSelectedAvoidSetEvent i S R).indicator (fun _ => (1 : ℝ)) z * (oneSelectedAvoidSetEvent i T Q).indicator (fun _ => (1 : ℝ)) z
= 0
Proof (Lean source)
lemma oneSelected_indicator_mul_zero_of_disjoint (z : I → A) (i : I) (S T R Q : Set A) (hST : Disjoint S T) : (oneSelectedAvoidSetEvent i S R).indicator (fun _ => (1 : ℝ)) z * (oneSelectedAvoidSetEvent i T Q).indicator (fun _ => (1 : ℝ)) z = 0 := by by_cases hi : z ∈ oneSelectedAvoidSetEvent i S R · have hj : z ∉ oneSelectedAvoidSetEvent i T Q := fun h => Set.disjoint_left.1 hST hi.1 h.1 simp [indicator, hi, hj] · simp [indicator, hi]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.oneSelected_indicator_mul_zero_of_disjoint · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:2345
theorem missingIndexCount_mul_eq_sum_cross

Distinct categories cannot contribute through the same observation, so their missing-arm product is an ordered-pair cross-event sum.

Formal statement
z :
I → A
C D R Q :
Set A
hRC :
R ⊆ C
hQD :
Q ⊆ D
hCD :
(missingIndexCount z C R : ℝ) * (missingIndexCount z D Q : ℝ)
= ∑ i : I, ∑ j ∈ (Finset.univ : Finset I).erase i, (twoSelectedAvoidSetsEvent i j (C \ R) (D \ Q) (R ∪ Q)).indicator (fun _ => (1 : ℝ)) z
Proof (Lean source)
lemma missingIndexCount_mul_eq_sum_cross (z : I → A) (C D R Q : Set A) (hRC : R ⊆ C) (hQD : Q ⊆ D) (hCD : Disjoint C D) : (missingIndexCount z C R : ℝ) * (missingIndexCount z D Q : ℝ) = ∑ i : I, ∑ j ∈ (Finset.univ : Finset I).erase i, (twoSelectedAvoidSetsEvent i j (C \ R) (D \ Q) (R ∪ Q)).indicator (fun _ => (1 : ℝ)) z := by classical rw [missingIndexCount_eq_sum_indicator z C R hRC, missingIndexCount_eq_sum_indicator z D Q hQD, Finset.sum_mul] apply Finset.sum_congr rfl intro i hi rw [Finset.mul_sum, ← Finset.sum_erase_add _ _ (Finset.mem_univ i)] rw [oneSelected_indicator_mul_zero_of_disjoint z i (C \ R) (D \ Q) R Q (hCD.mono Set.diff_subset Set.diff_subset), add_zero] apply Finset.sum_congr rfl intro j hj exact oneSelected_indicator_mul_cross z i j (C \ R) (D \ Q) R Q
CausalSmith.Stat.DiscreteAteMinimaxLoggap.missingIndexCount_mul_eq_sum_cross · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:2356
theorem categorySet_disjoint_of_ne

Establishes the stated property of category Set disjoint of ne in the discrete average-treatment-effect construction.

Formal statement
d :
k l :
Fin d
hkl :
k ≠ l
Proof (Lean source)
lemma categorySet_disjoint_of_ne {d : ℕ} (k l : Fin d) (hkl : k ≠ l) : Disjoint (categorySet k) (categorySet l) := by rw [Set.disjoint_left] intro x hxk hxl exact hkl (hxk.symm.trans hxl)
CausalSmith.Stat.DiscreteAteMinimaxLoggap.categorySet_disjoint_of_ne · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:2377
theorem integral_missingIndexCount_mul_eq

Exact cross moment of the missing-arm counts in two distinct categories.

Formal statement
d :
P :
k l :
Fin d
a :
hkl :
k ≠ l
hpk :
0 < cellMass P k
hpl :
0 < cellMass P l
∫ z : I → Obs d, (missingIndexCount z (categorySet k) (categoryArmSet k a) : ℝ) * (missingIndexCount z (categorySet l) (categoryArmSet l a) : ℝ) ∂(Measure.pi (fun _ : I => obsLaw P))
= ((card I).descFactorial 2 : ℝ) * (cellMass P k * (1 - armPropensity P k a)) * (cellMass P l * (1 - armPropensity P l a)) * (1 - cellMass P k * armPropensity P k a - cellMass P l * armPropensity P l a) ^ (card I - 2)
Proof (Lean source)
lemma integral_missingIndexCount_mul_eq {d : ℕ} (P : DiscreteLaw d) (k l : Fin d) (a : Bool) (hkl : k ≠ l) (hpk : 0 < cellMass P k) (hpl : 0 < cellMass P l) : ∫ z : I → Obs d, (missingIndexCount z (categorySet k) (categoryArmSet k a) : ℝ) * (missingIndexCount z (categorySet l) (categoryArmSet l a) : ℝ) ∂(Measure.pi (fun _ : I => obsLaw P)) = ((card I).descFactorial 2 : ℝ) * (cellMass P k * (1 - armPropensity P k a)) * (cellMass P l * (1 - armPropensity P l a)) * (1 - cellMass P k * armPropensity P k a - cellMass P l * armPropensity P l a) ^ (card I - 2) := by classical let C := categorySet k let D := categorySet l let R := categoryArmSet k a let Q := categoryArmSet l a let S := C \ R let T := D \ Q let U := R ∪ Q have hCD : Disjoint C D := categorySet_disjoint_of_ne k l hkl have hRQ : Disjoint R Q := hCD.mono (categoryArmSet_subset_categorySet k a) (categoryArmSet_subset_categorySet l a) have hSU : Disjoint S U := by rw [Set.disjoint_left] intro x hx hxu rcases hxu with hxR | hxQ · exact hx.2 hxR · exact Set.disjoint_left.1 hCD hx.1 (categoryArmSet_subset_categorySet l a hxQ) have hTU : Disjoint T U := by rw [Set.disjoint_left] intro x hx hxu rcases hxu with hxR | hxQ · exact Set.disjoint_left.1 hCD (categoryArmSet_subset_categorySet k a hxR) hx.1 · exact hx.2 hxQ rw [show (fun z : I → Obs d => (missingIndexCount z C R : ℝ) * (missingIndexCount z D Q : ℝ)) = fun z => ∑ i : I, ∑ j ∈ (Finset.univ : Finset I).erase i, (twoSelectedAvoidSetsEvent i j S T U).indicator (fun _ => (1 : ℝ)) z by funext z exact missingIndexCount_mul_eq_sum_cross z C D R Q (categoryArmSet_subset_categorySet k a) (categoryArmSet_subset_categorySet l a) hCD] simp_rw [integral_finset_sum Finset.univ (fun _ _ => Integrable.of_finite)] simp_rw [integral_finset_sum ((Finset.univ : Finset I).erase _) (fun _ _ => Integrable.of_finite)] have hint (i j : I) : ∫ z : I → Obs d, (twoSelectedAvoidSetsEvent i j S T U).indicator (fun _ => (1 : ℝ)) z ∂(Measure.pi (fun _ : I => obsLaw P)) = (Measure.pi (fun _ : I => obsLaw P)).real (twoSelectedAvoidSetsEvent i j S T U) := by exact (integral_indicator_one (MeasurableSet.of_discrete : MeasurableSet (twoSelectedAvoidSetsEvent i j S T U))) simp_rw [hint, measureReal_def] have hcross : (∑ i : I, ∑ j ∈ (Finset.univ : Finset I).erase i, ((Measure.pi (fun _ : I => obsLaw P)) (twoSelectedAvoidSetsEvent i j S T U)).toReal) = (∑ i : I, ∑ j ∈ (Finset.univ : Finset I).erase i, (Measure.pi (fun _ : I => obsLaw P)) (twoSelectedAvoidSetsEvent i j S T U)).toReal := by rw [ENNReal.toReal_sum] · apply Finset.sum_congr rfl intro i hi rw [ENNReal.toReal_sum] intro j hj exact measure_ne_top _ _ · intro i hi rw [ENNReal.sum_ne_top] intro j hj exact measure_ne_top _ _ rw [hcross] rw [sum_measure_twoSelectedAvoidSetsEvent (obsLaw P) S T U MeasurableSet.of_discrete MeasurableSet.of_discrete MeasurableSet.of_discrete hSU hTU] simp only [ENNReal.toReal_mul, ENNReal.toReal_pow, ENNReal.toReal_natCast] rw [show (obsLaw P S).toReal = cellMass P k * (1 - armPropensity P k a) by exact obsLaw_categoryArm_diff_mass P k a hpk] rw [show (obsLaw P T).toReal = cellMass P l * (1 - armPropensity P l a) by exact obsLaw_categoryArm_diff_mass P l a hpl] rw [show (obsLaw P Uᶜ).toReal = 1 - cellMass P k * armPropensity P k a - cellMass P l * armPropensity P l a by change (obsLaw P).real (R ∪ Q)ᶜ = _ rw [measureReal_compl MeasurableSet.of_discrete, probReal_univ, measureReal_union hRQ MeasurableSet.of_discrete, obsLaw_categoryArmSet_mass, armMass_eq_cellMass_mul_armPropensity P k a hpk, obsLaw_categoryArmSet_mass, armMass_eq_cellMass_mul_armPropensity P l a hpl] ring]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.integral_missingIndexCount_mul_eq · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:2384
def fixedMissingCount

Defines fixed Missing Count, the stated quantity or construction used in the discrete average-treatment-effect estimator.

Definition (Lean source)
noncomputable def fixedMissingCount {J : Type*} [Fintype J] [DecidableEq J] {d : ℕ} (z : J → Obs d) (H : Finset (Fin d)) (a : Bool) : ℝ := ∑ k ∈ H, (missingIndexCount z (categorySet k) (categoryArmSet k a) : ℝ)
CausalSmith.Stat.DiscreteAteMinimaxLoggap.fixedMissingCount · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:2484
def fixedMissingOutcomeBias

Defines fixed Missing Outcome Bias, the stated quantity or construction used in the discrete average-treatment-effect estimator.

Definition (Lean source)
noncomputable def fixedMissingOutcomeBias {J : Type*} [Fintype J] [DecidableEq J] {d : ℕ} (P : DiscreteLaw d) (z : J → Obs d) (H : Finset (Fin d)) (a : Fin 2) : ℝ := ∑ k ∈ H, outcomeMean P (finTwoEquiv a) k * (missingIndexCount z (categorySet k) (categoryArmSet k (finTwoEquiv a)) : ℝ)
CausalSmith.Stat.DiscreteAteMinimaxLoggap.fixedMissingOutcomeBias · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:2489
theorem abs_fixedMissingOutcomeBias_le

Establishes the stated upper bound for abs fixed Missing Outcome Bias le.

Formal statement
J :
d :
P :
z :
J → Obs d
H :
a :
Fin 2
Proof (Lean source)
lemma abs_fixedMissingOutcomeBias_le {J : Type*} [Fintype J] [DecidableEq J] {d : ℕ} (P : DiscreteLaw d) (z : J → Obs d) (H : Finset (Fin d)) (a : Fin 2) : |fixedMissingOutcomeBias P z H a| ≤ fixedMissingCount z H (finTwoEquiv a) := by classical calc |fixedMissingOutcomeBias P z H a| ≤ ∑ k ∈ H, |outcomeMean P (finTwoEquiv a) k * (missingIndexCount z (categorySet k) (categoryArmSet k (finTwoEquiv a)) : ℝ)| := Finset.abs_sum_le_sum_abs _ _ _ ≤ ∑ k ∈ H, (missingIndexCount z (categorySet k) (categoryArmSet k (finTwoEquiv a)) : ℝ) := by apply Finset.sum_le_sum intro k hk have hmu := outcomeMean_mem_unitInterval P (finTwoEquiv a) k rw [abs_mul, abs_of_nonneg hmu.1, abs_of_nonneg (by positivity : 0 ≤ (missingIndexCount z (categorySet k) (categoryArmSet k (finTwoEquiv a)) : ℝ))] exact mul_le_of_le_one_left (by positivity) hmu.2 _ = fixedMissingCount z H (finTwoEquiv a) := rfl
CausalSmith.Stat.DiscreteAteMinimaxLoggap.abs_fixedMissingOutcomeBias_le · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:2497
theorem fixedMissingOutcomeBias_sq_le

Establishes the stated upper bound for fixed Missing Outcome Bias sq le.

Formal statement
J :
d :
P :
z :
J → Obs d
H :
a :
Fin 2
(fixedMissingOutcomeBias P z H a) ^ 2 ≤ (fixedMissingCount z H (finTwoEquiv a)) ^ 2
Proof (Lean source)
lemma fixedMissingOutcomeBias_sq_le {J : Type*} [Fintype J] [DecidableEq J] {d : ℕ} (P : DiscreteLaw d) (z : J → Obs d) (H : Finset (Fin d)) (a : Fin 2) : (fixedMissingOutcomeBias P z H a) ^ 2 ≤ (fixedMissingCount z H (finTwoEquiv a)) ^ 2 := by have hcount : 0 ≤ fixedMissingCount z H (finTwoEquiv a) := by unfold fixedMissingCount positivity rw [← sq_abs (fixedMissingOutcomeBias P z H a), ← sq_abs (fixedMissingCount z H (finTwoEquiv a)), abs_of_nonneg hcount] exact pow_le_pow_left₀ (abs_nonneg _) (abs_fixedMissingOutcomeBias_le P z H a) 2
CausalSmith.Stat.DiscreteAteMinimaxLoggap.fixedMissingOutcomeBias_sq_le · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:2523
theorem fixedMissingCount_sq_expand

Establishes the stated property of fixed Missing Count sq expand in the discrete average-treatment-effect construction.

Formal statement
J :
d :
z :
J → Obs d
H :
a :
(fixedMissingCount z H a) ^ 2
= ∑ k ∈ H, (missingIndexCount z (categorySet k) (categoryArmSet k a) : ℝ) ^ 2
+ ∑ k ∈ H, ∑ l ∈ H.erase k, (missingIndexCount z (categorySet k) (categoryArmSet k a) : ℝ) * (missingIndexCount z (categorySet l) (categoryArmSet l a) : ℝ)
Proof (Lean source)
lemma fixedMissingCount_sq_expand {J : Type*} [Fintype J] [DecidableEq J] {d : ℕ} (z : J → Obs d) (H : Finset (Fin d)) (a : Bool) : (fixedMissingCount z H a) ^ 2 = ∑ k ∈ H, (missingIndexCount z (categorySet k) (categoryArmSet k a) : ℝ) ^ 2 + ∑ k ∈ H, ∑ l ∈ H.erase k, (missingIndexCount z (categorySet k) (categoryArmSet k a) : ℝ) * (missingIndexCount z (categorySet l) (categoryArmSet l a) : ℝ) := by classical unfold fixedMissingCount rw [sq, Finset.sum_mul, ← Finset.sum_add_distrib] apply Finset.sum_congr rfl intro k hk rw [Finset.mul_sum, ← Finset.sum_erase_add _ _ hk, add_comm] rw [pow_two]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.fixedMissingCount_sq_expand · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:2538
theorem integral_fixedMissingCount_sq_eq

Exact aggregate missing-arm second moment on a fixed category set.

Formal statement
J :
d :
P :
H :
a :
hp :
∀ k ∈ H, 0 < cellMass P k
∫ z : J → Obs d, (fixedMissingCount z H a) ^ 2 ∂(Measure.pi (fun _ : J => obsLaw P))
= ∑ k ∈ H, ((Fintype.card J : ℝ) * (cellMass P k * (1 - armPropensity P k a)) * (1 - cellMass P k * armPropensity P k a) ^ (Fintype.card J - 1) + ((Fintype.card J).descFactorial 2 : ℝ) * (cellMass P k * (1 - armPropensity P k a)) ^ 2 * (1 - cellMass P k * armPropensity P k a) ^ (Fintype.card J - 2))
+ ∑ k ∈ H, ∑ l ∈ H.erase k, ((Fintype.card J).descFactorial 2 : ℝ) * (cellMass P k * (1 - armPropensity P k a)) * (cellMass P l * (1 - armPropensity P l a)) * (1 - cellMass P k * armPropensity P k a - cellMass P l * armPropensity P l a) ^ (Fintype.card J - 2)
Proof (Lean source)
lemma integral_fixedMissingCount_sq_eq {J : Type*} [Fintype J] [DecidableEq J] {d : ℕ} (P : DiscreteLaw d) (H : Finset (Fin d)) (a : Bool) (hp : ∀ k ∈ H, 0 < cellMass P k) : ∫ z : J → Obs d, (fixedMissingCount z H a) ^ 2 ∂(Measure.pi (fun _ : J => obsLaw P)) = ∑ k ∈ H, ((Fintype.card J : ℝ) * (cellMass P k * (1 - armPropensity P k a)) * (1 - cellMass P k * armPropensity P k a) ^ (Fintype.card J - 1) + ((Fintype.card J).descFactorial 2 : ℝ) * (cellMass P k * (1 - armPropensity P k a)) ^ 2 * (1 - cellMass P k * armPropensity P k a) ^ (Fintype.card J - 2)) + ∑ k ∈ H, ∑ l ∈ H.erase k, ((Fintype.card J).descFactorial 2 : ℝ) * (cellMass P k * (1 - armPropensity P k a)) * (cellMass P l * (1 - armPropensity P l a)) * (1 - cellMass P k * armPropensity P k a - cellMass P l * armPropensity P l a) ^ (Fintype.card J - 2) := by classical rw [show (fun z : J → Obs d => (fixedMissingCount z H a) ^ 2) = fun z => ∑ k ∈ H, (missingIndexCount z (categorySet k) (categoryArmSet k a) : ℝ) ^ 2 + ∑ k ∈ H, ∑ l ∈ H.erase k, (missingIndexCount z (categorySet k) (categoryArmSet k a) : ℝ) * (missingIndexCount z (categorySet l) (categoryArmSet l a) : ℝ) by funext z exact fixedMissingCount_sq_expand z H a] rw [integral_add Integrable.of_finite Integrable.of_finite] simp_rw [integral_finset_sum H (fun _ _ => Integrable.of_finite)] simp_rw [integral_finset_sum (H.erase _) (fun _ _ => Integrable.of_finite)] apply congrArg₂ (.+.) · apply Finset.sum_congr rfl intro k hk exact integral_missingIndexCount_sq_eq P k a (hp k hk) · apply Finset.sum_congr rfl intro k hk apply Finset.sum_congr rfl intro l hl exact integral_missingIndexCount_mul_eq P k l a (Finset.ne_of_mem_erase hl).symm (hp k hk) (hp l (mem_of_mem_erase hl))
CausalSmith.Stat.DiscreteAteMinimaxLoggap.integral_fixedMissingCount_sq_eq · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:2554
theorem descFactorial_two_cast_le_sq

Establishes the stated upper bound for desc Factorial two cast le sq.

Formal statement
m :
(m.descFactorial 2 : ℝ) ≤ (m : ℝ) ^ 2
Proof (Lean source)
lemma descFactorial_two_cast_le_sq (m : ℕ) : (m.descFactorial 2 : ℝ) ≤ (m : ℝ) ^ 2 := by have hdesc : m.descFactorial 2 = m * (m - 1) := by cases m <;> simp [descFactorial, Nat.mul_comm] rw [hdesc, Nat.cast_mul] have hsub : ((m - 1 : ℕ) : ℝ) ≤ m := by exact_mod_cast Nat.sub_le m 1 nlinarith [show 0 ≤ (m : ℝ) by positivity]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.descFactorial_two_cast_le_sq · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:2599
theorem missing_diag_envelope

Establishes the stated property of missing diag envelope in the discrete average-treatment-effect construction.

Formal statement
m :
p rho epsilon :
hm :
2 ≤ m
hp0 :
0 ≤ p
hp1 :
p ≤ 1
hr0 :
0 ≤ rho
hr1 :
rho ≤ 1
he :
epsilon * p ≤ p * rho
(m : ℝ) * (p * (1 - rho)) * (1 - p * rho) ^ (m - 1)
+ (m.descFactorial 2 : ℝ) * (p * (1 - rho)) ^ 2 * (1 - p * rho) ^ (m - 2)
≤ (m : ℝ) * p + (m : ℝ) ^ 2 * (p * exp (-((m - 2 : ℕ) : ℝ) / 2 * epsilon * p)) ^ 2
Proof (Lean source)
lemma missing_diag_envelope (m : ℕ) (p rho epsilon : ℝ) (hm : 2 ≤ m) (hp0 : 0 ≤ p) (hp1 : p ≤ 1) (hr0 : 0 ≤ rho) (hr1 : rho ≤ 1) (he : epsilon * p ≤ p * rho) : (m : ℝ) * (p * (1 - rho)) * (1 - p * rho) ^ (m - 1) + (m.descFactorial 2 : ℝ) * (p * (1 - rho)) ^ 2 * (1 - p * rho) ^ (m - 2) ≤ (m : ℝ) * p + (m : ℝ) ^ 2 * (p * exp (-((m - 2 : ℕ) : ℝ) / 2 * epsilon * p)) ^ 2 := by have hq0 : 0 ≤ p * rho := mul_nonneg hp0 hr0 have hq1 : p * rho ≤ 1 := (mul_le_of_le_one_right hp0 hr1).trans hp1 have hb0 : 0 ≤ 1 - p * rho := sub_nonneg.mpr hq1 have hb1 : 1 - p * rho ≤ 1 := by linarith have hs0 : 0 ≤ p * (1 - rho) := mul_nonneg hp0 (sub_nonneg.mpr hr1) have hsp : p * (1 - rho) ≤ p := by nlinarith have hpow1 : (1 - p * rho) ^ (m - 1) ≤ 1 := pow_le_one₀ hb0 hb1 have hpow2 : (1 - p * rho) ^ (m - 2) ≤ exp (-((m - 2 : ℕ) : ℝ) * epsilon * p) := by calc _ ≤ exp (-((m - 2 : ℕ) : ℝ) * (p * rho)) := one_sub_pow_le_exp_neg_mul (p * rho) (m - 2) hq1 _ ≤ exp (-((m - 2 : ℕ) : ℝ) * epsilon * p) := by apply Real.exp_le_exp.mpr have hu : 0 ≤ ((m - 2 : ℕ) : ℝ) := by positivity nlinarith have hfirst : (m : ℝ) * (p * (1 - rho)) * (1 - p * rho) ^ (m - 1) ≤ (m : ℝ) * p := by rw [mul_assoc] apply mul_le_mul_of_nonneg_left _ (by positivity) calc p * (1 - rho) * (1 - p * rho) ^ (m - 1) ≤ p * (1 - p * rho) ^ (m - 1) := by exact mul_le_mul_of_nonneg_right hsp (by positivity) _ ≤ p * 1 := mul_le_mul_of_nonneg_left hpow1 hp0 _ = p := mul_one p have hsecond : (m.descFactorial 2 : ℝ) * (p * (1 - rho)) ^ 2 * (1 - p * rho) ^ (m - 2) ≤ (m : ℝ) ^ 2 * p ^ 2 * exp (-((m - 2 : ℕ) : ℝ) * epsilon * p) := by have hd := descFactorial_two_cast_le_sq m have hs2 : (p * (1 - rho)) ^ 2 ≤ p ^ 2 := by exact pow_le_pow_left₀ hs0 hsp 2 gcongr calc _ ≤ (m : ℝ) * p + (m : ℝ) ^ 2 * p ^ 2 * exp (-((m - 2 : ℕ) : ℝ) * epsilon * p) := add_le_add hfirst hsecond _ = (m : ℝ) * p + (m : ℝ) ^ 2 * (p * exp (-((m - 2 : ℕ) : ℝ) / 2 * epsilon * p)) ^ 2 := by have hexp : exp (-((m - 2 : ℕ) : ℝ) / 2 * epsilon * p) ^ 2 = exp (-((m - 2 : ℕ) : ℝ) * epsilon * p) := by rw [← Real.exp_nat_mul] congr 1 ring rw [mul_pow, hexp] ring
CausalSmith.Stat.DiscreteAteMinimaxLoggap.missing_diag_envelope · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:2608
theorem missing_cross_envelope

Establishes the stated property of missing cross envelope in the discrete average-treatment-effect construction.

Formal statement
m :
p q rho sigma epsilon :
hp0 :
0 ≤ p
hq0 :
0 ≤ q
hr0 :
0 ≤ rho
hs0 :
0 ≤ sigma
hr1 :
rho ≤ 1
hs1 :
sigma ≤ 1
he0 :
0 ≤ epsilon
heP :
epsilon * p ≤ p * rho
heQ :
epsilon * q ≤ q * sigma
hsum :
p * rho + q * sigma ≤ 1
(m.descFactorial 2 : ℝ) * (p * (1 - rho)) * (q * (1 - sigma)) * (1 - p * rho - q * sigma) ^ (m - 2)
≤ (m : ℝ) ^ 2 * (p * exp (-((m - 2 : ℕ) : ℝ) / 2 * epsilon * p)) * (q * exp (-((m - 2 : ℕ) : ℝ) / 2 * epsilon * q))
Proof (Lean source)
lemma missing_cross_envelope (m : ℕ) (p q rho sigma epsilon : ℝ) (hp0 : 0 ≤ p) (hq0 : 0 ≤ q) (hr0 : 0 ≤ rho) (hs0 : 0 ≤ sigma) (hr1 : rho ≤ 1) (hs1 : sigma ≤ 1) (he0 : 0 ≤ epsilon) (heP : epsilon * p ≤ p * rho) (heQ : epsilon * q ≤ q * sigma) (hsum : p * rho + q * sigma ≤ 1) : (m.descFactorial 2 : ℝ) * (p * (1 - rho)) * (q * (1 - sigma)) * (1 - p * rho - q * sigma) ^ (m - 2) ≤ (m : ℝ) ^ 2 * (p * exp (-((m - 2 : ℕ) : ℝ) / 2 * epsilon * p)) * (q * exp (-((m - 2 : ℕ) : ℝ) / 2 * epsilon * q)) := by let u : ℝ := ((m - 2 : ℕ) : ℝ) have hbase0 : 0 ≤ 1 - (p * rho + q * sigma) := sub_nonneg.mpr hsum have hbase : 1 - p * rho - q * sigma = 1 - (p * rho + q * sigma) := by ring have hpow : (1 - p * rho - q * sigma) ^ (m - 2) ≤ exp (-u * (epsilon * p + epsilon * q)) := by rw [hbase] calc _ ≤ exp (-u * (p * rho + q * sigma)) := one_sub_pow_le_exp_neg_mul (p * rho + q * sigma) (m - 2) hsum _ ≤ exp (-u * (epsilon * p + epsilon * q)) := by apply Real.exp_le_exp.mpr have hu : 0 ≤ u := by dsimp [u]; positivity nlinarith have hsp : p * (1 - rho) ≤ p := by nlinarith have hsq : q * (1 - sigma) ≤ q := by nlinarith have hsp0 : 0 ≤ p * (1 - rho) := mul_nonneg hp0 (sub_nonneg.mpr hr1) have hsq0 : 0 ≤ q * (1 - sigma) := mul_nonneg hq0 (sub_nonneg.mpr hs1) have hraw : (m.descFactorial 2 : ℝ) * (p * (1 - rho)) * (q * (1 - sigma)) * (1 - p * rho - q * sigma) ^ (m - 2) ≤ (m : ℝ) ^ 2 * p * q * exp (-u * (epsilon * p + epsilon * q)) := by have hd := descFactorial_two_cast_le_sq m have hpow0 : 0 ≤ (1 - p * rho - q * sigma) ^ (m - 2) := by rw [hbase] positivity gcongr have hexp : exp (-u * (epsilon * p + epsilon * q)) ≤ exp (-u / 2 * epsilon * p) * exp (-u / 2 * epsilon * q) := by rw [← Real.exp_add] apply Real.exp_le_exp.mpr have hu : 0 ≤ u := by dsimp [u]; positivity have hsumep : 0 ≤ epsilon * p + epsilon * q := add_nonneg (mul_nonneg he0 hp0) (mul_nonneg he0 hq0) have hhalf : u / 2 ≤ u := by nlinarith have hmul := mul_le_mul_of_nonneg_right hhalf hsumep nlinarith calc _ ≤ (m : ℝ) ^ 2 * p * q * exp (-u * (epsilon * p + epsilon * q)) := hraw _ ≤ (m : ℝ) ^ 2 * p * q * (exp (-u / 2 * epsilon * p) * exp (-u / 2 * epsilon * q)) := by gcongr _ = (m : ℝ) ^ 2 * (p * exp (-((m - 2 : ℕ) : ℝ) / 2 * epsilon * p)) * (q * exp (-((m - 2 : ℕ) : ℝ) / 2 * epsilon * q)) := by dsimp [u] ring
CausalSmith.Stat.DiscreteAteMinimaxLoggap.missing_cross_envelope · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:2667
theorem integral_fixedMissingCount_sq_le Lemma 12 in the paper ↗

Aggregate second-moment bound for the missing-arm count on a fixed set of heavy categories. The diagonal contributes at most m; the off-diagonal and exponentially small part of the diagonal combine into the square of one mass-exponential sum.

Formal statement
J :
d :
epsilon B :
P :
H :
a :
hm :
3 ≤ Fintype.card J
hOverlap :
Overlap epsilon P
hepsilon :
0 < epsilon
hB :
0 < B
hp :
∀ k ∈ H, B ≤ cellMass P k
∫ z : J → Obs d, (fixedMissingCount z H a) ^ 2 ∂(Measure.pi (fun _ : J => obsLaw P))
≤ (Fintype.card J : ℝ)
+ (Fintype.card J : ℝ) ^ 2 * (H.card / (((((Fintype.card J - 2 : ℕ) : ℝ) / 2 * epsilon) ^ 2) * B)) ^ 2
Proof (Lean source)
lemma integral_fixedMissingCount_sq_le {J : Type*} [Fintype J] [DecidableEq J] {d : ℕ} {epsilon B : ℝ} (P : DiscreteLaw d) (H : Finset (Fin d)) (a : Bool) (hm : 3 ≤ Fintype.card J) (hOverlap : Overlap epsilon P) (hepsilon : 0 < epsilon) (hB : 0 < B) (hp : ∀ k ∈ H, B ≤ cellMass P k) : ∫ z : J → Obs d, (fixedMissingCount z H a) ^ 2 ∂(Measure.pi (fun _ : J => obsLaw P)) ≤ (Fintype.card J : ℝ) + (Fintype.card J : ℝ) ^ 2 * (H.card / (((((Fintype.card J - 2 : ℕ) : ℝ) / 2 * epsilon) ^ 2) * B)) ^ 2 := by classical let m := Fintype.card J let u : ℝ := ((m - 2 : ℕ) : ℝ) / 2 * epsilon let f : Fin d → ℝ := fun k => cellMass P k * exp (-u * cellMass P k) have hm2 : 2 ≤ m := le_trans (by omega : 2 ≤ 3) hm have hsub : 0 < m - 2 := by omega have hu : 0 < u := by dsimp [u] positivity have hpPos : ∀ k ∈ H, 0 < cellMass P k := by intro k hk exact hB.trans_le (hp k hk) have hdiag : ∀ k ∈ H, (m : ℝ) * (cellMass P k * (1 - armPropensity P k a)) * (1 - cellMass P k * armPropensity P k a) ^ (m - 1) + (m.descFactorial 2 : ℝ) * (cellMass P k * (1 - armPropensity P k a)) ^ 2 * (1 - cellMass P k * armPropensity P k a) ^ (m - 2) ≤ (m : ℝ) * cellMass P k + (m : ℝ) ^ 2 * (f k) ^ 2 := by intro k hk have hrho := armPropensity_mem_unitInterval P k a have heLower := armPropensity_lower_of_overlap P hOverlap k a (hpPos k hk) have heMul : epsilon * cellMass P k ≤ cellMass P k * armPropensity P k a := by simpa [mul_comm] using mul_le_mul_of_nonneg_left heLower (cellMass_mem_unitInterval P k).1 convert missing_diag_envelope m (cellMass P k) (armPropensity P k a) epsilon hm2 (cellMass_mem_unitInterval P k).1 (cellMass_mem_unitInterval P k).2 hrho.1 hrho.2 heMul using 1 <;> dsimp [m, u, f] <;> ring have hcross : ∀ k ∈ H, ∀ l ∈ H.erase k, (m.descFactorial 2 : ℝ) * (cellMass P k * (1 - armPropensity P k a)) * (cellMass P l * (1 - armPropensity P l a)) * (1 - cellMass P k * armPropensity P k a - cellMass P l * armPropensity P l a) ^ (m - 2) ≤ (m : ℝ) ^ 2 * f k * f l := by intro k hk l hl have hlH : l ∈ H := Finset.mem_of_mem_erase hl have hkl : k ≠ l := (Finset.ne_of_mem_erase hl).symm have hrho := armPropensity_mem_unitInterval P k a have hsigma := armPropensity_mem_unitInterval P l a have heLowerK := armPropensity_lower_of_overlap P hOverlap k a (hpPos k hk) have heLowerL := armPropensity_lower_of_overlap P hOverlap l a (hpPos l hlH) have heMulK : epsilon * cellMass P k ≤ cellMass P k * armPropensity P k a := by simpa [mul_comm] using mul_le_mul_of_nonneg_left heLowerK (cellMass_mem_unitInterval P k).1 have heMulL : epsilon * cellMass P l ≤ cellMass P l * armPropensity P l a := by simpa [mul_comm] using mul_le_mul_of_nonneg_left heLowerL (cellMass_mem_unitInterval P l).1 have hpq : cellMass P k + cellMass P l ≤ 1 := by have hdisj := categorySet_disjoint_of_ne k l hkl calc cellMass P k + cellMass P l = (obsLaw P).real (categorySet k ∪ categorySet l) := by rw [measureReal_union hdisj MeasurableSet.of_discrete, obsLaw_categorySet_mass, obsLaw_categorySet_mass] _ ≤ (obsLaw P).real univ := measureReal_mono (Set.subset_univ _) _ = 1 := probReal_univ have hsum : cellMass P k * armPropensity P k a + cellMass P l * armPropensity P l a ≤ 1 := by have hkprod : cellMass P k * armPropensity P k a ≤ cellMass P k := mul_le_of_le_one_right (cellMass_mem_unitInterval P k).1 hrho.2 have hlprod : cellMass P l * armPropensity P l a ≤ cellMass P l := mul_le_of_le_one_right (cellMass_mem_unitInterval P l).1 hsigma.2 linarith convert missing_cross_envelope m (cellMass P k) (cellMass P l) (armPropensity P k a) (armPropensity P l a) epsilon (cellMass_mem_unitInterval P k).1 (cellMass_mem_unitInterval P l).1 hrho.1 hsigma.1 hrho.2 hsigma.2 hepsilon.le heMulK heMulL hsum using 1 <;> dsimp [m, u, f] <;> ring have hmassSum : ∑ k ∈ H, cellMass P k ≤ 1 := by calc ∑ k ∈ H, cellMass P k ≤ ∑ k : Fin d, cellMass P k := by apply Finset.sum_le_sum_of_subset_of_nonneg (Finset.subset_univ _) intro k _hk _hnot exact (cellMass_mem_unitInterval P k).1 _ = 1 := by have htotal : ∑ z : Obs d, (P.pmf z).toReal = 1 := by simpa using (PMF.integral_eq_sum P.pmf (fun _ : Obs d => (1 : ℝ))).symm calc ∑ k : Fin d, cellMass P k = ∑ z : Obs d, (P.pmf z).toReal := by simp [cellMass, jointMass, Fintype.sum_prod_type] _ = 1 := htotal have hfSum : ∑ k ∈ H, f k ≤ H.card / (u ^ 2 * B) := by exact sum_mass_mul_exp_neg_mul_le H (fun k => cellMass P k) u B hu hB hp have hsquare : (∑ k ∈ H, f k) ^ 2 = ∑ k ∈ H, (f k) ^ 2 + ∑ k ∈ H, ∑ l ∈ H.erase k, f k * f l := by rw [sq, Finset.sum_mul, ← Finset.sum_add_distrib] apply Finset.sum_congr rfl intro k hk rw [Finset.mul_sum, ← Finset.sum_erase_add _ _ hk, add_comm] rw [pow_two] rw [integral_fixedMissingCount_sq_eq P H a hpPos] calc _ ≤ ∑ k ∈ H, ((m : ℝ) * cellMass P k + (m : ℝ) ^ 2 * (f k) ^ 2) + ∑ k ∈ H, ∑ l ∈ H.erase k, (m : ℝ) ^ 2 * f k * f l := by apply add_le_add · exact Finset.sum_le_sum fun k hk => hdiag k hk · exact Finset.sum_le_sum fun k hk => Finset.sum_le_sum fun l hl => hcross k hk l hl _ = (m : ℝ) * (∑ k ∈ H, cellMass P k) + (m : ℝ) ^ 2 * (∑ k ∈ H, f k) ^ 2 := by have hmassFactor : ∑ k ∈ H, (m : ℝ) * cellMass P k = (m : ℝ) * (∑ k ∈ H, cellMass P k) := by rw [Finset.mul_sum] have hdiagFactor : ∑ k ∈ H, (m : ℝ) ^ 2 * (f k) ^ 2 = (m : ℝ) ^ 2 * (∑ k ∈ H, (f k) ^ 2) := by rw [Finset.mul_sum] have hcrossFactor : ∑ k ∈ H, ∑ l ∈ H.erase k, (m : ℝ) ^ 2 * f k * f l = (m : ℝ) ^ 2 * (∑ k ∈ H, ∑ l ∈ H.erase k, f k * f l) := by rw [Finset.mul_sum] apply Finset.sum_congr rfl intro k hk rw [Finset.mul_sum] apply Finset.sum_congr rfl intro l hl ring rw [Finset.sum_add_distrib, hmassFactor, hdiagFactor, hcrossFactor, hsquare] ring _ ≤ (m : ℝ) + (m : ℝ) ^ 2 * (H.card / (u ^ 2 * B)) ^ 2 := by have hm0 : (0 : ℝ) ≤ m := by positivity have hf0 : 0 ≤ ∑ k ∈ H, f k := by apply sum_nonneg intro k hk dsimp [f] exact mul_nonneg (cellMass_mem_unitInterval P k).1 (Real.exp_pos _).le have hfirst := mul_le_mul_of_nonneg_left hmassSum hm0 have hsquares : (∑ k ∈ H, f k) ^ 2 ≤ (H.card / (u ^ 2 * B)) ^ 2 := pow_le_pow_left₀ hf0 hfSum 2 have hsecond := mul_le_mul_of_nonneg_left hsquares (sq_nonneg (m : ℝ)) exact add_le_add (by simpa using hfirst) hsecond _ = (Fintype.card J : ℝ) + (Fintype.card J : ℝ) ^ 2 * (H.card / (((((Fintype.card J - 2 : ℕ) : ℝ) / 2 * epsilon) ^ 2) * B)) ^ 2 := by rfl
CausalSmith.Stat.DiscreteAteMinimaxLoggap.integral_fixedMissingCount_sq_le · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HeavyCellMoments.lean:2728
Helpers.HybridProgram 74 declarations A verified tree-to-straight-line compiler

A verified tree-to-straight-line compiler

def hybridTermIndex

Defines hybrid Term Index, the stated quantity or construction used in the discrete average-treatment-effect estimator.

Definition (Lean source)
CausalSmith.Stat.DiscreteAteMinimaxLoggap.hybridTermIndex · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HybridProgram.lean:9
inductive RealArithmeticExpression

Syntax trees over exactly the operations admitted by RealArithmeticInstruction.

Definition (Lean source)
inductive RealArithmeticExpression (ι : Type*) where | input (i : ι) | const (x : ℝ) | add (x y : RealArithmeticExpression ι) | sub (x y : RealArithmeticExpression ι) | mul (x y : RealArithmeticExpression ι) | div (x y : RealArithmeticExpression ι) | branchNonpos (test yes no : RealArithmeticExpression ι)
CausalSmith.Stat.DiscreteAteMinimaxLoggap.RealArithmeticExpression · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HybridProgram.lean:14
def eval

The value of an arithmetic syntax tree under a given assignment of its inputs. Input and constant nodes return their own value; the addition, subtraction, multiplication and division nodes apply the corresponding real operation to the values of their two subtrees, division following the total convention that dividing by zero returns zero; the branch node returns the value of its second subtree when its first subtree evaluates to a nonpositive number and of its third subtree otherwise.

Definition (Lean source)
noncomputable def eval {ι : Type*} (input : ι → ℝ) : RealArithmeticExpression ι → ℝ | .input i => input i | .const x => x | .add x y => eval input x + eval input y | .sub x y => eval input x - eval input y | .mul x y => eval input x * eval input y | .div x y => eval input x / eval input y | .branchNonpos test yes no => if eval input test ≤ 0 then eval input yes else eval input no
CausalSmith.Stat.DiscreteAteMinimaxLoggap.RealArithmeticExpression.eval · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HybridProgram.lean:27
def nodeCount

Defines node Count, the stated quantity or construction used in the discrete average-treatment-effect estimator.

Definition (Lean source)
def nodeCount {ι : Type*} : RealArithmeticExpression ι → ℕ | .input _ | .const _ => 1 | .add x y | .sub x y | .mul x y | .div x y => nodeCount x + nodeCount y + 1 | .branchNonpos t y n => nodeCount t + nodeCount y + nodeCount n + 1
CausalSmith.Stat.DiscreteAteMinimaxLoggap.RealArithmeticExpression.nodeCount · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HybridProgram.lean:44
def operationCount

Defines operation Count, the stated quantity or construction used in the discrete average-treatment-effect estimator.

Definition (Lean source)
def operationCount {ι : Type*} : RealArithmeticExpression ι → ℕ | .input _ | .const _ => 0 | .add x y | .sub x y | .mul x y | .div x y => operationCount x + operationCount y + 1 | .branchNonpos t y n => operationCount t + operationCount y + operationCount n + 1
CausalSmith.Stat.DiscreteAteMinimaxLoggap.RealArithmeticExpression.operationCount · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HybridProgram.lean:50
theorem nodeCount_pos

Establishes the stated property of node Count pos in the discrete average-treatment-effect construction.

Formal statement
ι :
Type*
0 < nodeCount e
Proof (Lean source)
lemma nodeCount_pos {ι : Type*} (e : RealArithmeticExpression ι) : 0 < nodeCount e := by cases e <;> simp [nodeCount]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.RealArithmeticExpression.nodeCount_pos · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HybridProgram.lean:58
def codeAt

Compile an expression after offset already occupied registers.

Definition (Lean source)
def codeAt {ι : Type*} (offset : ℕ) : RealArithmeticExpression ι → List (RealArithmeticInstruction ι) | .input i => [.input i] | .const x => [.const x] | .add x y => codeAt offset x ++ codeAt (offset + nodeCount x) y ++ [.add (offset + nodeCount x - 1) (offset + nodeCount x + nodeCount y - 1)] | .sub x y => codeAt offset x ++ codeAt (offset + nodeCount x) y ++ [.sub (offset + nodeCount x - 1) (offset + nodeCount x + nodeCount y - 1)] | .mul x y => codeAt offset x ++ codeAt (offset + nodeCount x) y ++ [.mul (offset + nodeCount x - 1) (offset + nodeCount x + nodeCount y - 1)] | .div x y => codeAt offset x ++ codeAt (offset + nodeCount x) y ++ [.div (offset + nodeCount x - 1) (offset + nodeCount x + nodeCount y - 1)] | .branchNonpos t y n => codeAt offset t ++ codeAt (offset + nodeCount t) y ++ codeAt (offset + nodeCount t + nodeCount y) n ++ [.branchNonpos (offset + nodeCount t - 1) (offset + nodeCount t + nodeCount y - 1) (offset + nodeCount t + nodeCount y + nodeCount n - 1)]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.RealArithmeticExpression.codeAt · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HybridProgram.lean:62
theorem length_codeAt

The compiled instruction list for an expression has exactly one instruction per node of its expression tree.

Formal statement
ι :
Type*
offset :
(codeAt offset e).length = nodeCount e
Proof (Lean source)
@[simp] lemma length_codeAt {ι : Type*} (offset : ℕ) (e : RealArithmeticExpression ι) : (codeAt offset e).length = nodeCount e := by induction e generalizing offset with | input i => simp [codeAt, nodeCount] | const x => simp [codeAt, nodeCount] | add x y ihx ihy => simp [codeAt, nodeCount, ihx, ihy] <;> omega | sub x y ihx ihy => simp [codeAt, nodeCount, ihx, ihy] <;> omega | mul x y ihx ihy => simp [codeAt, nodeCount, ihx, ihy] <;> omega | div x y ihx ihy => simp [codeAt, nodeCount, ihx, ihy] <;> omega | branchNonpos t y n iht ihy ihn => simp [codeAt, nodeCount, iht, ihy, ihn] <;> omega
CausalSmith.Stat.DiscreteAteMinimaxLoggap.RealArithmeticExpression.length_codeAt · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HybridProgram.lean:82
def runFrom

Defines run From, the stated quantity or construction used in the discrete average-treatment-effect estimator.

Definition (Lean source)
noncomputable def runFrom {ι : Type*} (input : ι → ℝ) (registers : List ℝ) (code : List (RealArithmeticInstruction ι)) : List ℝ := code.foldl (fun rs instruction => rs ++ [RealArithmeticProgram.instructionValue input rs instruction]) registers
CausalSmith.Stat.DiscreteAteMinimaxLoggap.RealArithmeticExpression.runFrom · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HybridProgram.lean:95
theorem runFrom_append

Establishes the stated property of run From append in the discrete average-treatment-effect construction.

Formal statement
ι :
Type*
input :
ι → ℝ
registers :
List
runFrom input registers (xs ++ ys) = runFrom input (runFrom input registers xs) ys
Proof (Lean source)
lemma runFrom_append {ι : Type*} (input : ι → ℝ) (registers : List ℝ) (xs ys : List (RealArithmeticInstruction ι)) : runFrom input registers (xs ++ ys) = runFrom input (runFrom input registers xs) ys := by simp [runFrom, List.foldl_append]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.RealArithmeticExpression.runFrom_append · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HybridProgram.lean:101
theorem runFrom_eq_append

Establishes the stated equality relating run From eq append.

Formal statement
ι :
Type*
input :
ι → ℝ
registers :
List
tail, runFrom input registers code = registers ++ tail
Proof (Lean source)
lemma runFrom_eq_append {ι : Type*} (input : ι → ℝ) (registers : List ℝ) (code : List (RealArithmeticInstruction ι)) : ∃ tail, runFrom input registers code = registers ++ tail := by induction code generalizing registers with | nil => exact ⟨[], by simp [runFrom]⟩ | cons i code ih => rcases ih (registers ++ [RealArithmeticProgram.instructionValue input registers i]) with ⟨tail, htail⟩ refine ⟨RealArithmeticProgram.instructionValue input registers i :: tail, ?_⟩ rw [show runFrom input registers (i :: code) = runFrom input (registers ++ [RealArithmeticProgram.instructionValue input registers i]) code by rfl] rw [htail] simp
CausalSmith.Stat.DiscreteAteMinimaxLoggap.RealArithmeticExpression.runFrom_eq_append · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HybridProgram.lean:107
theorem runFrom_getD_of_lt

Establishes the stated property of run From get D of lt in the discrete average-treatment-effect construction.

Formal statement
ι :
Type*
input :
ι → ℝ
registers :
List
i :
hi :
i < registers.length
(runFrom input registers code).getD i 0 = registers.getD i 0
Proof (Lean source)
lemma runFrom_getD_of_lt {ι : Type*} (input : ι → ℝ) (registers : List ℝ) (code : List (RealArithmeticInstruction ι)) (i : ℕ) (hi : i < registers.length) : (runFrom input registers code).getD i 0 = registers.getD i 0 := by rcases runFrom_eq_append input registers code with ⟨tail, htail⟩ rw [htail, List.getD_append _ _ _ _ hi]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.RealArithmeticExpression.runFrom_getD_of_lt · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HybridProgram.lean:123
theorem length_runFrom

Executing a list of instructions appends exactly one register value for each instruction, leaving the initial registers in place.

Formal statement
ι :
Type*
input :
ι → ℝ
registers :
List
(runFrom input registers code).length = registers.length + code.length
Proof (Lean source)
@[simp] lemma length_runFrom {ι : Type*} (input : ι → ℝ) (registers : List ℝ) (code : List (RealArithmeticInstruction ι)) : (runFrom input registers code).length = registers.length + code.length := by induction code generalizing registers with | nil => simp [runFrom] | cons i code ih => rw [show runFrom input registers (i :: code) = runFrom input (registers ++ [RealArithmeticProgram.instructionValue input registers i]) code by rfl] rw [ih] simp omega
CausalSmith.Stat.DiscreteAteMinimaxLoggap.RealArithmeticExpression.length_runFrom · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HybridProgram.lean:130
theorem getD_append_singleton_length

Establishes the stated upper bound for get D append singleton length.

Formal statement
xs :
List
x :
(xs ++ [x]).getD xs.length 0 = x
Proof (Lean source)
lemma getD_append_singleton_length (xs : List ℝ) (x : ℝ) : (xs ++ [x]).getD xs.length 0 = x := by simp
CausalSmith.Stat.DiscreteAteMinimaxLoggap.RealArithmeticExpression.getD_append_singleton_length · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HybridProgram.lean:144
theorem codeAt_correct

Establishes the stated property of code At correct in the discrete average-treatment-effect construction.

Formal statement
ι :
Type*
input :
ι → ℝ
registers :
List
(runFrom input registers (codeAt registers.length e)).getD (registers.length + nodeCount e - 1) 0
= eval input e
Proof (Lean source)
lemma codeAt_correct {ι : Type*} (input : ι → ℝ) (registers : List ℝ) (e : RealArithmeticExpression ι) : (runFrom input registers (codeAt registers.length e)).getD (registers.length + nodeCount e - 1) 0 = eval input e := by induction e generalizing registers with | input i => simp [codeAt, nodeCount, runFrom, eval, RealArithmeticProgram.instructionValue] | const x => simp [codeAt, nodeCount, runFrom, eval, RealArithmeticProgram.instructionValue] | add x y ihx ihy => rw [codeAt, runFrom_append, runFrom_append] let rx := runFrom input registers (codeAt registers.length x) have hrx : rx.length = registers.length + nodeCount x := by simp [rx] let ry := runFrom input rx (codeAt (registers.length + nodeCount x) y) have hry : ry.length = registers.length + nodeCount x + nodeCount y := by simp [ry, hrx] change (runFrom input ry [RealArithmeticInstruction.add (registers.length + nodeCount x - 1) (registers.length + nodeCount x + nodeCount y - 1)]).getD _ 0 = _ simp only [runFrom, List.foldl_cons, List.foldl_nil] simp only [nodeCount, eval] rw [show registers.length + (nodeCount x + nodeCount y + 1) - 1 = ry.length by omega] rw [getD_append_singleton_length] simp only [RealArithmeticProgram.instructionValue] have hx := ihx registers have hy := ihy rx rw [show rx.length = registers.length + nodeCount x from hrx] at hy have hx' : ry.getD (registers.length + nodeCount x - 1) 0 = eval input x := by have hpos := nodeCount_pos x rw [runFrom_getD_of_lt input rx _ _ (by rw [hrx]; omega)] exact hx exact congrArg₂ (· + ·) hx' hy | sub x y ihx ihy => rw [codeAt, runFrom_append, runFrom_append] let rx := runFrom input registers (codeAt registers.length x) have hrx : rx.length = registers.length + nodeCount x := by simp [rx] let ry := runFrom input rx (codeAt (registers.length + nodeCount x) y) have hry : ry.length = registers.length + nodeCount x + nodeCount y := by simp [ry, hrx] change (runFrom input ry [RealArithmeticInstruction.sub (registers.length + nodeCount x - 1) (registers.length + nodeCount x + nodeCount y - 1)]).getD _ 0 = _ simp only [runFrom, List.foldl_cons, List.foldl_nil] simp only [nodeCount, eval] rw [show registers.length + (nodeCount x + nodeCount y + 1) - 1 = ry.length by omega] rw [getD_append_singleton_length] simp only [RealArithmeticProgram.instructionValue] have hx := ihx registers have hy := ihy rx rw [show rx.length = registers.length + nodeCount x from hrx] at hy have hx' : ry.getD (registers.length + nodeCount x - 1) 0 = eval input x := by have hpos := nodeCount_pos x rw [runFrom_getD_of_lt input rx _ _ (by rw [hrx]; omega)] exact hx exact congrArg₂ (· - ·) hx' hy | mul x y ihx ihy => rw [codeAt, runFrom_append, runFrom_append] let rx := runFrom input registers (codeAt registers.length x) have hrx : rx.length = registers.length + nodeCount x := by simp [rx] let ry := runFrom input rx (codeAt (registers.length + nodeCount x) y) have hry : ry.length = registers.length + nodeCount x + nodeCount y := by simp [ry, hrx] change (runFrom input ry [RealArithmeticInstruction.mul (registers.length + nodeCount x - 1) (registers.length + nodeCount x + nodeCount y - 1)]).getD _ 0 = _ simp only [runFrom, List.foldl_cons, List.foldl_nil] simp only [nodeCount, eval] rw [show registers.length + (nodeCount x + nodeCount y + 1) - 1 = ry.length by omega] rw [getD_append_singleton_length] simp only [RealArithmeticProgram.instructionValue] have hx := ihx registers have hy := ihy rx rw [show rx.length = registers.length + nodeCount x from hrx] at hy have hx' : ry.getD (registers.length + nodeCount x - 1) 0 = eval input x := by have hpos := nodeCount_pos x rw [runFrom_getD_of_lt input rx _ _ (by rw [hrx]; omega)] exact hx exact congrArg₂ (· * ·) hx' hy | div x y ihx ihy => rw [codeAt, runFrom_append, runFrom_append] let rx := runFrom input registers (codeAt registers.length x) have hrx : rx.length = registers.length + nodeCount x := by simp [rx] let ry := runFrom input rx (codeAt (registers.length + nodeCount x) y) have hry : ry.length = registers.length + nodeCount x + nodeCount y := by simp [ry, hrx] change (runFrom input ry [RealArithmeticInstruction.div (registers.length + nodeCount x - 1) (registers.length + nodeCount x + nodeCount y - 1)]).getD _ 0 = _ simp only [runFrom, List.foldl_cons, List.foldl_nil] simp only [nodeCount, eval] rw [show registers.length + (nodeCount x + nodeCount y + 1) - 1 = ry.length by omega] rw [getD_append_singleton_length] simp only [RealArithmeticProgram.instructionValue] have hx := ihx registers have hy := ihy rx rw [show rx.length = registers.length + nodeCount x from hrx] at hy have hx' : ry.getD (registers.length + nodeCount x - 1) 0 = eval input x := by have hpos := nodeCount_pos x rw [runFrom_getD_of_lt input rx _ _ (by rw [hrx]; omega)] exact hx exact congrArg₂ (· / ·) hx' hy | branchNonpos t y n iht ihy ihn => rw [codeAt, runFrom_append, runFrom_append, runFrom_append] let rt := runFrom input registers (codeAt registers.length t) have hrt : rt.length = registers.length + nodeCount t := by simp [rt] let ry := runFrom input rt (codeAt (registers.length + nodeCount t) y) have hry : ry.length = registers.length + nodeCount t + nodeCount y := by simp [ry, hrt] let rn := runFrom input ry (codeAt (registers.length + nodeCount t + nodeCount y) n) have hrn : rn.length = registers.length + nodeCount t + nodeCount y + nodeCount n := by simp [rn, hry] change (runFrom input rn [RealArithmeticInstruction.branchNonpos (registers.length + nodeCount t - 1) (registers.length + nodeCount t + nodeCount y - 1) (registers.length + nodeCount t + nodeCount y + nodeCount n - 1)]).getD _ 0 = _ simp only [runFrom, List.foldl_cons, List.foldl_nil] simp only [nodeCount, eval] rw [show registers.length + (nodeCount t + nodeCount y + nodeCount n + 1) - 1 = rn.length by omega] rw [getD_append_singleton_length] simp only [RealArithmeticProgram.instructionValue] have ht := iht registers have hy := ihy rt have hn := ihn ry rw [show rt.length = registers.length + nodeCount t from hrt] at hy rw [show ry.length = registers.length + nodeCount t + nodeCount y from hry] at hn have ht' : rn.getD (registers.length + nodeCount t - 1) 0 = eval input t := by have htpos := nodeCount_pos t rw [runFrom_getD_of_lt input ry _ _ (by rw [hry]; omega)] rw [runFrom_getD_of_lt input rt _ _ (by rw [hrt]; omega)] exact ht have hy' : rn.getD (registers.length + nodeCount t + nodeCount y - 1) 0 = eval input y := by have htpos := nodeCount_pos t have hypos := nodeCount_pos y rw [runFrom_getD_of_lt input ry _ _ (by rw [hry]; omega)] exact hy rw [ht', hy', hn]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.RealArithmeticExpression.codeAt_correct · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HybridProgram.lean:148
def program

Defines program, the stated quantity or construction used in the discrete average-treatment-effect estimator.

Definition (Lean source)
noncomputable def program {ι : Type*} (e : RealArithmeticExpression ι) : RealArithmeticProgram ι := (codeAt 0 e, nodeCount e - 1)
CausalSmith.Stat.DiscreteAteMinimaxLoggap.RealArithmeticExpression.program · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HybridProgram.lean:290
theorem eval_program

Establishes the stated property of eval program in the discrete average-treatment-effect construction.

Formal statement
ι :
Type*
input :
ι → ℝ
(program e).eval input = eval input e
Proof (Lean source)
lemma eval_program {ι : Type*} (e : RealArithmeticExpression ι) (input : ι → ℝ) : (program e).eval input = eval input e := by simpa [program, RealArithmeticProgram.eval, RealArithmeticProgram.run, runFrom] using codeAt_correct input [] e
CausalSmith.Stat.DiscreteAteMinimaxLoggap.RealArithmeticExpression.eval_program · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HybridProgram.lean:294
theorem operationCount_codeAt

Establishes the stated property of operation Count code At in the discrete average-treatment-effect construction.

Formal statement
ι :
Type*
offset :
((codeAt offset e).map RealArithmeticProgram.instructionCost).sum = operationCount e
Proof (Lean source)
lemma operationCount_codeAt {ι : Type*} (offset : ℕ) (e : RealArithmeticExpression ι) : ((codeAt offset e).map RealArithmeticProgram.instructionCost).sum = operationCount e := by induction e generalizing offset with | input i => simp [codeAt, operationCount, RealArithmeticProgram.instructionCost] | const x => simp [codeAt, operationCount, RealArithmeticProgram.instructionCost] | add x y ihx ihy => simp [codeAt, operationCount, ihx, ihy, RealArithmeticProgram.instructionCost] <;> omega | sub x y ihx ihy => simp [codeAt, operationCount, ihx, ihy, RealArithmeticProgram.instructionCost] <;> omega | mul x y ihx ihy => simp [codeAt, operationCount, ihx, ihy, RealArithmeticProgram.instructionCost] <;> omega | div x y ihx ihy => simp [codeAt, operationCount, ihx, ihy, RealArithmeticProgram.instructionCost] <;> omega | branchNonpos t y n iht ihy ihn => simp [codeAt, operationCount, iht, ihy, ihn, RealArithmeticProgram.instructionCost] <;> omega
CausalSmith.Stat.DiscreteAteMinimaxLoggap.RealArithmeticExpression.operationCount_codeAt · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HybridProgram.lean:300
theorem operationCount_program

Establishes the stated property of operation Count program in the discrete average-treatment-effect construction.

Formal statement
ι :
Type*
(program e).operationCount = operationCount e
Proof (Lean source)
lemma operationCount_program {ι : Type*} (e : RealArithmeticExpression ι) : (program e).operationCount = operationCount e := by simp [program, RealArithmeticProgram.operationCount, operationCount_codeAt]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.RealArithmeticExpression.operationCount_program · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HybridProgram.lean:319
def expressionSum

Defines expression Sum, the stated quantity or construction used in the discrete average-treatment-effect estimator.

Definition (Lean source)
def expressionSum {ι : Type*} : List (RealArithmeticExpression ι) → RealArithmeticExpression ι | [] => .const 0 | x :: xs => .add x (expressionSum xs)
CausalSmith.Stat.DiscreteAteMinimaxLoggap.expressionSum · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HybridProgram.lean:328
def expressionProduct

Defines expression Product, the stated quantity or construction used in the discrete average-treatment-effect estimator.

Definition (Lean source)
def expressionProduct {ι : Type*} : List (RealArithmeticExpression ι) → RealArithmeticExpression ι | [] => .const 1 | x :: xs => .mul x (expressionProduct xs)
CausalSmith.Stat.DiscreteAteMinimaxLoggap.expressionProduct · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HybridProgram.lean:334
theorem list_range_sum_eq_finset_sum

Establishes the stated equality relating list range sum eq finset sum.

Formal statement
α :
f :
ℕ → α
m :
((range m).map f).sum = ∑ i ∈ range m, f i
Proof (Lean source)
lemma list_range_sum_eq_finset_sum {α : Type*} [AddCommMonoid α] (f : ℕ → α) (m : ℕ) : ((range m).map f).sum = ∑ i ∈ range m, f i := by induction m with | zero => simp | succ m ihm => simp [List.range_succ, Finset.sum_range_succ, ihm]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.list_range_sum_eq_finset_sum · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HybridProgram.lean:340
theorem eval_expressionSum

Evaluating the expression formed by summing a list gives the sum of the separately evaluated expressions.

Formal statement
ι :
Type*
input :
ι → ℝ
eval input (expressionSum xs) = (xs.map (eval input)).sum
Proof (Lean source)
@[simp] lemma eval_expressionSum {ι : Type*} (input : ι → ℝ) (xs : List (RealArithmeticExpression ι)) : eval input (expressionSum xs) = (xs.map (eval input)).sum := by induction xs <;> simp [expressionSum, eval, *]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.eval_expressionSum · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HybridProgram.lean:348
theorem eval_expressionProduct

Evaluating the expression formed by multiplying a list gives the product of the separately evaluated expressions.

Formal statement
ι :
Type*
input :
ι → ℝ
eval input (expressionProduct xs) = (xs.map (eval input)).prod
Proof (Lean source)
@[simp] lemma eval_expressionProduct {ι : Type*} (input : ι → ℝ) (xs : List (RealArithmeticExpression ι)) : eval input (expressionProduct xs) = (xs.map (eval input)).prod := by induction xs <;> simp [expressionProduct, eval, *]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.eval_expressionProduct · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HybridProgram.lean:354
theorem operationCount_expressionSum

The cost of a summed expression is the sum of the component costs plus one addition for every list entry.

Formal statement
ι :
Type*
operationCount (expressionSum xs) = (xs.map operationCount).sum + xs.length
Proof (Lean source)
@[simp] lemma operationCount_expressionSum {ι : Type*} (xs : List (RealArithmeticExpression ι)) : operationCount (expressionSum xs) = (xs.map operationCount).sum + xs.length := by induction xs <;> simp [expressionSum, operationCount, *] <;> omega
CausalSmith.Stat.DiscreteAteMinimaxLoggap.operationCount_expressionSum · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HybridProgram.lean:360
theorem operationCount_expressionProduct

The cost of a product expression is the sum of the component costs plus one multiplication for every list entry.

Formal statement
ι :
Type*
operationCount (expressionProduct xs) = (xs.map operationCount).sum + xs.length
Proof (Lean source)
@[simp] lemma operationCount_expressionProduct {ι : Type*} (xs : List (RealArithmeticExpression ι)) : operationCount (expressionProduct xs) = (xs.map operationCount).sum + xs.length := by induction xs <;> simp [expressionProduct, operationCount, *] <;> omega
CausalSmith.Stat.DiscreteAteMinimaxLoggap.operationCount_expressionProduct · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HybridProgram.lean:367
def natSubExpression

Real-arithmetic implementation of truncated natural subtraction, on natural-valued inputs.

Definition (Lean source)
def natSubExpression {ι : Type*} (x : RealArithmeticExpression ι) (i : ℕ) : RealArithmeticExpression ι := .branchNonpos (.sub x (.const i)) (.const 0) (.sub x (.const i))
CausalSmith.Stat.DiscreteAteMinimaxLoggap.natSubExpression · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HybridProgram.lean:374
theorem eval_natSubExpression

The expression that implements truncated subtraction is correct: if a subexpression evaluates to a whole number, then guarding it by the branch node and subtracting a whole constant returns the truncated difference, which is zero whenever the constant is at least as large.

Formal statement
ι :
Type*
input :
ι → ℝ
z i :
hx :
eval input x = z
eval input (natSubExpression x i) = (z - i : ℕ)
Proof (Lean source)
lemma eval_natSubExpression {ι : Type*} (input : ι → ℝ) (x : RealArithmeticExpression ι) (z i : ℕ) (hx : eval input x = z) : eval input (natSubExpression x i) = (z - i : ℕ) := by simp only [natSubExpression, eval, hx] by_cases h : z ≤ i · have hcast : (z : ℝ) ≤ (i : ℝ) := Nat.cast_le.mpr h have hr : (z : ℝ) - (i : ℝ) ≤ 0 := sub_nonpos.mpr hcast rw [if_pos hr] simp [Nat.sub_eq_zero_of_le h] · have hlt : i < z := Nat.lt_of_not_ge h have hle : i ≤ z := Nat.le_of_lt hlt have hcast : (i : ℝ) < (z : ℝ) := Nat.cast_lt.mpr hlt have hr : ¬(z : ℝ) - (i : ℝ) ≤ 0 := not_le.mpr (sub_pos.mpr hcast) rw [if_neg hr] exact (Nat.cast_sub hle).symm
CausalSmith.Stat.DiscreteAteMinimaxLoggap.eval_natSubExpression · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HybridProgram.lean:380
def fallingExpression

Defines falling Expression, the stated quantity or construction used in the discrete average-treatment-effect estimator.

Definition (Lean source)
def fallingExpression {ι : Type*} (x : RealArithmeticExpression ι) : ℕ → RealArithmeticExpression ι | 0 => .const 1 | r + 1 => .mul (natSubExpression x r) (fallingExpression x r)
CausalSmith.Stat.DiscreteAteMinimaxLoggap.fallingExpression · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HybridProgram.lean:400
theorem eval_fallingExpression

Establishes the stated property of eval falling Expression in the discrete average-treatment-effect construction.

Formal statement
ι :
Type*
input :
ι → ℝ
z r :
hx :
eval input x = z
eval input (fallingExpression x r) = (z.descFactorial r : ℕ)
Proof (Lean source)
lemma eval_fallingExpression {ι : Type*} (input : ι → ℝ) (x : RealArithmeticExpression ι) (z r : ℕ) (hx : eval input x = z) : eval input (fallingExpression x r) = (z.descFactorial r : ℕ) := by induction r with | zero => simp [fallingExpression, eval] | succ r ihr => simp only [fallingExpression, eval, eval_natSubExpression input x z r hx, ihr, Nat.descFactorial_succ, Nat.cast_mul]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.eval_fallingExpression · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HybridProgram.lean:406
theorem operationCount_natSubExpression

Establishes the stated property of operation Count nat Sub Expression in the discrete average-treatment-effect construction.

Formal statement
ι :
Type*
i :
operationCount (natSubExpression x i) = 2 * operationCount x + 3
Proof (Lean source)
lemma operationCount_natSubExpression {ι : Type*} (x : RealArithmeticExpression ι) (i : ℕ) : operationCount (natSubExpression x i) = 2 * operationCount x + 3 := by simp [natSubExpression, operationCount] omega
CausalSmith.Stat.DiscreteAteMinimaxLoggap.operationCount_natSubExpression · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HybridProgram.lean:416
theorem operationCount_fallingExpression

Establishes the stated property of operation Count falling Expression in the discrete average-treatment-effect construction.

Formal statement
ι :
Type*
r :
operationCount (fallingExpression x r) = r * (2 * operationCount x + 4)
Proof (Lean source)
lemma operationCount_fallingExpression {ι : Type*} (x : RealArithmeticExpression ι) (r : ℕ) : operationCount (fallingExpression x r) = r * (2 * operationCount x + 4) := by induction r with | zero => simp [fallingExpression, operationCount] | succ r ihr => simp only [fallingExpression, operationCount, operationCount_natSubExpression, ihr] ring
CausalSmith.Stat.DiscreteAteMinimaxLoggap.operationCount_fallingExpression · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HybridProgram.lean:423
def hybridCellList

Defines hybrid Cell List, the stated quantity or construction used in the discrete average-treatment-effect estimator.

Definition (Lean source)
def hybridCellList : List Cell := [(0, 0), (0, 1), (1, 0), (1, 1)]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.hybridCellList · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HybridProgram.lean:434
theorem hybridCellList_sum

Establishes the stated summation identity or bound for hybrid Cell List sum.

Formal statement
f :
Cell → ℝ
(hybridCellList.map f).sum = ∑ ay : Cell, f ay
Proof (Lean source)
lemma hybridCellList_sum (f : Cell → ℝ) : (hybridCellList.map f).sum = ∑ ay : Cell, f ay := by rw [Fintype.sum_prod_type] simp [hybridCellList, Fin.sum_univ_two] ring
CausalSmith.Stat.DiscreteAteMinimaxLoggap.hybridCellList_sum · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HybridProgram.lean:437
theorem hybridCellList_prod

Establishes the stated property of hybrid Cell List prod in the discrete average-treatment-effect construction.

Formal statement
f :
Cell → ℝ
(hybridCellList.map f).prod = ∏ ay : Cell, f ay
Proof (Lean source)
lemma hybridCellList_prod (f : Cell → ℝ) : (hybridCellList.map f).prod = ∏ ay : Cell, f ay := by rw [Fintype.prod_prod_type] simp [hybridCellList, Fin.prod_univ_two] ring
CausalSmith.Stat.DiscreteAteMinimaxLoggap.hybridCellList_prod · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HybridProgram.lean:444
theorem splitCategoryCount_eq_sum_cell

Establishes the stated equality relating split Category Count eq sum cell.

Formal statement
n d :
sample :
Fin n → Obs d
j :
Fin 2
k :
Fin d
splitCategoryCount sample j k = ∑ a : Fin 2, ∑ y : Fin 2, splitCellCount sample j k a y
Proof (Lean source)
lemma splitCategoryCount_eq_sum_cell {n d : ℕ} (sample : Fin n → Obs d) (j : Fin 2) (k : Fin d) : splitCategoryCount sample j k = ∑ a : Fin 2, ∑ y : Fin 2, splitCellCount sample j k a y := by classical simp only [Fintype.sum_prod_type, Fin.sum_univ_two] simp only [splitCategoryCount, splitCellCount, Finset.card_eq_sum_ones, Finset.sum_filter] rw [← Finset.sum_add_distrib, ← Finset.sum_add_distrib, ← Finset.sum_add_distrib] apply Finset.sum_congr rfl intro i hi rcases hobs : sample i with ⟨k', a', y'⟩ simp only [hobs, fst] by_cases hk : k' = k · subst k' fin_cases a' <;> fin_cases y' <;> simp [finTwoEquiv] · simp [hk]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.splitCategoryCount_eq_sum_cell · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HybridProgram.lean:451
def splitCountExpression

Defines split Count Expression, the stated quantity or construction used in the discrete average-treatment-effect estimator.

Definition (Lean source)
def splitCountExpression {d : ℕ} (j : Fin 2) (k : Fin d) (ay : Cell) : RealArithmeticExpression (HybridCountInput d) := .input (j, k, ay.1, ay.2)
CausalSmith.Stat.DiscreteAteMinimaxLoggap.splitCountExpression · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HybridProgram.lean:471
def categoryCountExpression

Defines category Count Expression, the stated quantity or construction used in the discrete average-treatment-effect estimator.

Definition (Lean source)
def categoryCountExpression {d : ℕ} (j : Fin 2) (k : Fin d) : RealArithmeticExpression (HybridCountInput d) := expressionSum (hybridCellList.map (splitCountExpression j k))
CausalSmith.Stat.DiscreteAteMinimaxLoggap.categoryCountExpression · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HybridProgram.lean:475
theorem eval_splitCountExpression

Establishes the stated property of eval split Count Expression in the discrete average-treatment-effect construction.

Formal statement
n d :
sample :
Fin n → Obs d
j :
Fin 2
k :
Fin d
ay :
= splitCellCount sample j k ay.1 ay.2
Proof (Lean source)
lemma eval_splitCountExpression {n d : ℕ} (sample : Fin n → Obs d) (j : Fin 2) (k : Fin d) (ay : Cell) : eval (hybridCountVector sample) (splitCountExpression j k ay) = splitCellCount sample j k ay.1 ay.2 := by rfl
CausalSmith.Stat.DiscreteAteMinimaxLoggap.eval_splitCountExpression · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HybridProgram.lean:480
theorem eval_categoryCountExpression

Establishes the stated property of eval category Count Expression in the discrete average-treatment-effect construction.

Formal statement
n d :
sample :
Fin n → Obs d
j :
Fin 2
k :
Fin d
Proof (Lean source)
lemma eval_categoryCountExpression {n d : ℕ} (sample : Fin n → Obs d) (j : Fin 2) (k : Fin d) : eval (hybridCountVector sample) (categoryCountExpression j k) = splitCategoryCount sample j k := by simp only [categoryCountExpression, eval_expressionSum, List.map_map, Function.comp_apply, eval_splitCountExpression, hybridCellList_sum] rw [splitCategoryCount_eq_sum_cell] simp only [Fintype.sum_prod_type, Fin.sum_univ_two] norm_num
CausalSmith.Stat.DiscreteAteMinimaxLoggap.eval_categoryCountExpression · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HybridProgram.lean:487
def factorialMonomialExpression

Defines factorial Monomial Expression, the stated quantity or construction used in the discrete average-treatment-effect estimator.

Definition (Lean source)
def factorialMonomialExpression {n d : ℕ} (k : Fin d) (r : MultiIndex) : RealArithmeticExpression (HybridCountInput d) := .div (expressionProduct (hybridCellList.map fun ay => fallingExpression (splitCountExpression 1 k ay) (r ay))) (.const (fallingFactorial (splitSize n 1) (multiDegree r) : ℝ))
CausalSmith.Stat.DiscreteAteMinimaxLoggap.factorialMonomialExpression · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HybridProgram.lean:498
theorem eval_factorialMonomialExpression

Establishes the stated property of eval factorial Monomial Expression in the discrete average-treatment-effect construction.

Formal statement
n d :
sample :
Fin n → Obs d
k :
Fin d
eval (hybridCountVector sample) (factorialMonomialExpression (n := n) k r)
= factorialMonomial sample k r
Proof (Lean source)
lemma eval_factorialMonomialExpression {n d : ℕ} (sample : Fin n → Obs d) (k : Fin d) (r : MultiIndex) : eval (hybridCountVector sample) (factorialMonomialExpression (n := n) k r) = factorialMonomial sample k r := by simp only [factorialMonomialExpression, eval, eval_expressionProduct, List.map_map, Function.comp_apply] rw [hybridCellList_prod] apply congrArg (fun x : ℝ => x / (fallingFactorial (splitSize n 1) (multiDegree r) : ℝ)) apply Finset.prod_congr rfl intro ay hay exact eval_fallingExpression _ _ _ _ (eval_splitCountExpression sample 1 k ay)
CausalSmith.Stat.DiscreteAteMinimaxLoggap.eval_factorialMonomialExpression · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HybridProgram.lean:506
theorem operationCount_splitCountExpression

Establishes the stated property of operation Count split Count Expression in the discrete average-treatment-effect construction.

Formal statement
d :
j :
Fin 2
k :
Fin d
ay :
operationCount (splitCountExpression j k ay) = 0
Proof (Lean source)
lemma operationCount_splitCountExpression {d : ℕ} (j : Fin 2) (k : Fin d) (ay : Cell) : operationCount (splitCountExpression j k ay) = 0 := rfl
CausalSmith.Stat.DiscreteAteMinimaxLoggap.operationCount_splitCountExpression · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HybridProgram.lean:520
theorem operationCount_factorialMonomialExpression

Establishes the stated property of operation Count factorial Monomial Expression in the discrete average-treatment-effect construction.

Formal statement
n d :
k :
Fin d
operationCount (factorialMonomialExpression (n := n) k r) = 4 * multiDegree r + 5
Proof (Lean source)
lemma operationCount_factorialMonomialExpression {n d : ℕ} (k : Fin d) (r : MultiIndex) : operationCount (factorialMonomialExpression (n := n) k r) = 4 * multiDegree r + 5 := by simp [factorialMonomialExpression, operationCount, hybridCellList, operationCount_fallingExpression, operationCount_splitCountExpression] rw [show multiDegree r = r (0, 0) + r (0, 1) + r (1, 0) + r (1, 1) by simp only [multiDegree] rw [Finsupp.sum_fintype _ _ (fun _ => rfl)] simp only [Fintype.sum_prod_type, Fin.sum_univ_two] omega] omega
CausalSmith.Stat.DiscreteAteMinimaxLoggap.operationCount_factorialMonomialExpression · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HybridProgram.lean:524
def armFactorialExpression

Defines arm Factorial Expression, the stated quantity or construction used in the discrete average-treatment-effect estimator.

Definition (Lean source)
noncomputable def armFactorialExpression (n : ℕ) {d : ℕ} (k : Fin d) (a : Fin 2) : RealArithmeticExpression (HybridCountInput d) := let M := polynomialDegree n let B := bandwidth n expressionSum ((range (M - 1)).map fun j => expressionSum ((range (j + 1)).map fun t => expressionSum (hybridCellList.map fun ay => .mul (.const (B⁻¹ * gCoefficient M j * B⁻¹ ^ j * (Nat.choose j t : ℝ))) (factorialMonomialExpression (n := n) k (hybridTermIndex a ay j t)))))
CausalSmith.Stat.DiscreteAteMinimaxLoggap.armFactorialExpression · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HybridProgram.lean:539
def lightCellExpression

Defines light Cell Expression, the stated quantity or construction used in the discrete average-treatment-effect estimator.

Definition (Lean source)
noncomputable def lightCellExpression (n : ℕ) {d : ℕ} (k : Fin d) : RealArithmeticExpression (HybridCountInput d) := .sub (armFactorialExpression n k 1) (armFactorialExpression n k 0)
CausalSmith.Stat.DiscreteAteMinimaxLoggap.lightCellExpression · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HybridProgram.lean:551
theorem eval_armFactorialExpression

Establishes the stated property of eval arm Factorial Expression in the discrete average-treatment-effect construction.

Formal statement
n d :
sample :
Fin n → Obs d
k :
Fin d
a :
Fin 2
= ∑ j ∈ range (polynomialDegree n - 1), ∑ t ∈ range (j + 1), ∑ ay : Cell, ((bandwidth n)⁻¹ * gCoefficient (polynomialDegree n) j * (bandwidth n)⁻¹ ^ j * (Nat.choose j t : ℝ)) * factorialMonomial sample k (hybridTermIndex a ay j t)
Proof (Lean source)
lemma eval_armFactorialExpression {n d : ℕ} (sample : Fin n → Obs d) (k : Fin d) (a : Fin 2) : eval (hybridCountVector sample) (armFactorialExpression n k a) = ∑ j ∈ range (polynomialDegree n - 1), ∑ t ∈ range (j + 1), ∑ ay : Cell, ((bandwidth n)⁻¹ * gCoefficient (polynomialDegree n) j * (bandwidth n)⁻¹ ^ j * (Nat.choose j t : ℝ)) * factorialMonomial sample k (hybridTermIndex a ay j t) := by simp only [armFactorialExpression, eval_expressionSum, List.map_map] rw [list_range_sum_eq_finset_sum] apply Finset.sum_congr rfl intro j hj simp only [Function.comp_apply, eval_expressionSum, List.map_map] rw [list_range_sum_eq_finset_sum] apply Finset.sum_congr rfl intro t ht simp only [Function.comp_apply, eval_expressionSum, List.map_map, eval] rw [hybridCellList_sum] apply Finset.sum_congr rfl intro ay hay simp [Function.comp_apply, eval, eval_factorialMonomialExpression]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.eval_armFactorialExpression · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HybridProgram.lean:556
theorem eval_lightCellExpression

Establishes the stated property of eval light Cell Expression in the discrete average-treatment-effect construction.

Formal statement
n d :
sample :
Fin n → Obs d
k :
Fin d
Proof (Lean source)
CausalSmith.Stat.DiscreteAteMinimaxLoggap.eval_lightCellExpression · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HybridProgram.lean:579
theorem multiDegree_hybridTermIndex

Establishes the stated property of multi Degree hybrid Term Index in the discrete average-treatment-effect construction.

Formal statement
a :
Fin 2
ay :
j t :
ht :
t ≤ j
multiDegree (hybridTermIndex a ay j t) = j + 2
Proof (Lean source)
lemma multiDegree_hybridTermIndex (a : Fin 2) (ay : Cell) (j t : ℕ) (ht : t ≤ j) : multiDegree (hybridTermIndex a ay j t) = j + 2 := by unfold hybridTermIndex factorialExpansionIndex multiDegree rw [Finsupp.sum_add_index (by simp) (by simp), Finsupp.sum_add_index (by simp) (by simp), Finsupp.sum_add_index (by simp) (by simp)] simp only [Finsupp.sum_single_index] omega
CausalSmith.Stat.DiscreteAteMinimaxLoggap.multiDegree_hybridTermIndex · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HybridProgram.lean:586
theorem operationCount_factorialTerm

Establishes the stated property of operation Count factorial Term in the discrete average-treatment-effect construction.

Formal statement
n d :
k :
Fin d
a :
Fin 2
ay :
j t :
ht :
t ≤ j
c :
operationCount (.mul (.const c) (factorialMonomialExpression (n := n) k (hybridTermIndex a ay j t)))
= 4 * j + 14
Proof (Lean source)
lemma operationCount_factorialTerm {n d : ℕ} (k : Fin d) (a : Fin 2) (ay : Cell) (j t : ℕ) (ht : t ≤ j) (c : ℝ) : operationCount (.mul (.const c) (factorialMonomialExpression (n := n) k (hybridTermIndex a ay j t))) = 4 * j + 14 := by simp [operationCount, operationCount_factorialMonomialExpression, multiDegree_hybridTermIndex a ay j t ht] omega
CausalSmith.Stat.DiscreteAteMinimaxLoggap.operationCount_factorialTerm · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HybridProgram.lean:596
theorem list_sum_map_le_length_mul

Establishes the stated upper bound for list sum map le length mul.

Formal statement
α :
Type*
xs :
List α
f :
α → ℕ
C :
h :
∀ x ∈ xs, f x ≤ C
(xs.map f).sum ≤ xs.length * C
Proof (Lean source)
lemma list_sum_map_le_length_mul {α : Type*} (xs : List α) (f : α → ℕ) (C : ℕ) (h : ∀ x ∈ xs, f x ≤ C) : (xs.map f).sum ≤ xs.length * C := by induction xs with | nil => simp | cons x xs ih => simp only [map_cons, List.sum_cons, List.length_cons] have hx := h x (by simp) have hxs : ∀ y ∈ xs, f y ≤ C := by intro y hy exact h y (by simp [hy]) have := ih hxs nlinarith
CausalSmith.Stat.DiscreteAteMinimaxLoggap.list_sum_map_le_length_mul · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HybridProgram.lean:606
theorem operationCount_armFactorialExpression_le

Establishes the stated upper bound for operation Count arm Factorial Expression le.

Formal statement
n d :
k :
Fin d
a :
Fin 2
hM :
operationCount (armFactorialExpression n k a) ≤ 52 * polynomialDegree n ^ 3
Proof (Lean source)
lemma operationCount_armFactorialExpression_le {n d : ℕ} (k : Fin d) (a : Fin 2) (hM : 2 ≤ polynomialDegree n) : operationCount (armFactorialExpression n k a) ≤ 52 * polynomialDegree n ^ 3 := by let M := polynomialDegree n have hM' : 2 ≤ M := hM have hcell : ∀ j ∈ range (M - 1), ∀ t ∈ range (j + 1), operationCount (expressionSum (hybridCellList.map fun ay => RealArithmeticExpression.mul (.const ((bandwidth n)⁻¹ * gCoefficient M j * (bandwidth n)⁻¹ ^ j * (Nat.choose j t : ℝ))) (factorialMonomialExpression (n := n) k (hybridTermIndex a ay j t)))) ≤ 50 * M := by intro j hj t ht have hjM : j < M := by have : j < M - 1 := List.mem_range.mp hj omega have htj : t ≤ j := by have : t < j + 1 := List.mem_range.mp ht omega simp only [operationCount_expressionSum, List.map_map, hybridCellList, map_cons, map_nil, List.sum_cons, List.sum_nil, List.length_cons, List.length_nil] rw [operationCount_factorialTerm k a (0, 0) j t htj, operationCount_factorialTerm k a (0, 1) j t htj, operationCount_factorialTerm k a (1, 0) j t htj, operationCount_factorialTerm k a (1, 1) j t htj] omega have htlevel : ∀ j ∈ range (M - 1), operationCount (expressionSum ((range (j + 1)).map fun t => expressionSum (hybridCellList.map fun ay => RealArithmeticExpression.mul (.const ((bandwidth n)⁻¹ * gCoefficient M j * (bandwidth n)⁻¹ ^ j * (Nat.choose j t : ℝ))) (factorialMonomialExpression (n := n) k (hybridTermIndex a ay j t))))) ≤ 51 * M ^ 2 := by intro j hj simp only [operationCount_expressionSum, List.map_map, Function.comp_apply, List.length_range] apply le_trans (Nat.add_le_add (list_sum_map_le_length_mul (range (j + 1)) _ (50 * M) (fun t ht => hcell j hj t ht)) (le_refl _)) have hjM : j + 1 ≤ M := by have : j < M - 1 := List.mem_range.mp hj omega simp only [List.length_range, List.length_map] nlinarith simp only [armFactorialExpression, operationCount_expressionSum, List.map_map, Function.comp_apply, List.length_range] apply le_trans (Nat.add_le_add (list_sum_map_le_length_mul (range (M - 1)) _ (51 * M ^ 2) htlevel) (le_refl _)) simp only [List.length_range, List.length_map] dsimp [M] at * nlinarith [Nat.sub_le (polynomialDegree n) 1]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.operationCount_armFactorialExpression_le · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HybridProgram.lean:620
theorem operationCount_lightCellExpression_le

Establishes the stated upper bound for operation Count light Cell Expression le.

Formal statement
n d :
k :
Fin d
hM :
operationCount (lightCellExpression n k) ≤ 105 * polynomialDegree n ^ 4
Proof (Lean source)
lemma operationCount_lightCellExpression_le {n d : ℕ} (k : Fin d) (hM : 2 ≤ polynomialDegree n) : operationCount (lightCellExpression n k) ≤ 105 * polynomialDegree n ^ 4 := by simp only [lightCellExpression, operationCount] have h1 := operationCount_armFactorialExpression_le k (1 : Fin 2) hM have h0 := operationCount_armFactorialExpression_le k (0 : Fin 2) hM have hM1 : 1 ≤ polynomialDegree n := le_trans (by omega) hM have hpow : polynomialDegree n ^ 3 ≤ polynomialDegree n ^ 4 := by exact Nat.pow_le_pow_right hM1 (by omega) have hpow1 : 1 ≤ polynomialDegree n ^ 4 := by exact one_le_pow₀ hM1 omega
CausalSmith.Stat.DiscreteAteMinimaxLoggap.operationCount_lightCellExpression_le · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HybridProgram.lean:677
def heavyCellExpression

Defines heavy Cell Expression, the stated quantity or construction used in the discrete average-treatment-effect estimator.

Definition (Lean source)
def heavyCellExpression (n : ℕ) {d : ℕ} (k : Fin d) : RealArithmeticExpression (HybridCountInput d) := let Nk := categoryCountExpression 1 k let N1 := .add (splitCountExpression 1 k (1, 0)) (splitCountExpression 1 k (1, 1)) let N0 := .add (splitCountExpression 1 k (0, 0)) (splitCountExpression 1 k (0, 1)) .mul (.div Nk (.const (splitSize n 1))) (.sub (.div (splitCountExpression 1 k (1, 1)) N1) (.div (splitCountExpression 1 k (0, 1)) N0))
CausalSmith.Stat.DiscreteAteMinimaxLoggap.heavyCellExpression · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HybridProgram.lean:691
theorem eval_heavyCellExpression

Establishes the stated property of eval heavy Cell Expression in the discrete average-treatment-effect construction.

Formal statement
n d :
sample :
Fin n → Obs d
k :
Fin d
Proof (Lean source)
CausalSmith.Stat.DiscreteAteMinimaxLoggap.eval_heavyCellExpression · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HybridProgram.lean:703
theorem operationCount_heavyCellExpression

Establishes the stated property of operation Count heavy Cell Expression in the discrete average-treatment-effect construction.

Formal statement
n d :
k :
Fin d
operationCount (heavyCellExpression n k) = 11
Proof (Lean source)
CausalSmith.Stat.DiscreteAteMinimaxLoggap.operationCount_heavyCellExpression · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HybridProgram.lean:710
def selectedCellExpression

Defines selected Cell Expression, the stated quantity or construction used in the discrete average-treatment-effect estimator.

Definition (Lean source)
noncomputable def selectedCellExpression (n : ℕ) {d : ℕ} (k : Fin d) : RealArithmeticExpression (HybridCountInput d) := if n < calibrationCutoff then heavyCellExpression n k else .branchNonpos (.sub (categoryCountExpression 0 k) (.const (lambda0 * logScale n))) (lightCellExpression n k) (heavyCellExpression n k)
CausalSmith.Stat.DiscreteAteMinimaxLoggap.selectedCellExpression · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HybridProgram.lean:716
theorem eval_selectedCellExpression

Establishes the stated upper bound for eval selected Cell Expression.

Formal statement
n d :
sample :
Fin n → Obs d
k :
Fin d
= if k ∈ heavyCells sample then empiricalRatioCell sample k else factorialPolynomialContribution sample k
Proof (Lean source)
lemma eval_selectedCellExpression {n d : ℕ} (sample : Fin n → Obs d) (k : Fin d) : eval (hybridCountVector sample) (selectedCellExpression n k) = if k ∈ heavyCells sample then empiricalRatioCell sample k else factorialPolynomialContribution sample k := by by_cases hn : n < calibrationCutoff · simp [selectedCellExpression, heavyCells, hn, eval_heavyCellExpression] · simp only [selectedCellExpression, hn, ↓reduceIte, eval, eval_categoryCountExpression, eval_lightCellExpression, eval_heavyCellExpression, heavyCells, mem_filter, Finset.mem_univ, true_and] by_cases hk : (lambda0 : ℝ) * logScale n < splitCategoryCount sample 0 k · rw [if_neg, if_pos hk] linarith · rw [if_pos, if_neg hk] linarith
CausalSmith.Stat.DiscreteAteMinimaxLoggap.eval_selectedCellExpression · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HybridProgram.lean:724
theorem polynomialDegree_two_le

Establishes the stated upper bound for polynomial Degree two le.

Formal statement
n :
Proof (Lean source)
lemma polynomialDegree_two_le (n : ℕ) : 2 ≤ polynomialDegree n := by simp [polynomialDegree]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.polynomialDegree_two_le · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HybridProgram.lean:741
theorem operationCount_selectedCellExpression_le

Establishes the stated upper bound for operation Count selected Cell Expression le.

Formal statement
n :
d :
k :
Fin d
operationCount (selectedCellExpression n k) ≤ 110 * polynomialDegree n ^ 4
Proof (Lean source)
lemma operationCount_selectedCellExpression_le (n : ℕ) {d : ℕ} (k : Fin d) : operationCount (selectedCellExpression n k) ≤ 110 * polynomialDegree n ^ 4 := by have hM := polynomialDegree_two_le n have hMpow : 16 ≤ polynomialDegree n ^ 4 := by norm_num [show (16 : ℕ) = 2 ^ 4 by norm_num] exact Nat.pow_le_pow_left hM 4 by_cases hn : n < calibrationCutoff · simp [selectedCellExpression, hn, operationCount_heavyCellExpression] omega · simp only [selectedCellExpression, hn, ↓reduceIte, operationCount, operationCount_heavyCellExpression] have hlight := operationCount_lightCellExpression_le k hM have hcat : operationCount (categoryCountExpression 0 k) = 4 := by simp [categoryCountExpression, operationCount, hybridCellList, operationCount_splitCountExpression] rw [hcat] omega
CausalSmith.Stat.DiscreteAteMinimaxLoggap.operationCount_selectedCellExpression_le · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HybridProgram.lean:745
def untruncatedHybridExpression

Defines untruncated Hybrid Expression, the stated quantity or construction used in the discrete average-treatment-effect estimator.

Definition (Lean source)
noncomputable def untruncatedHybridExpression (n d : ℕ) : RealArithmeticExpression (HybridCountInput d) := expressionSum (List.ofFn fun k : Fin d => selectedCellExpression n k)
CausalSmith.Stat.DiscreteAteMinimaxLoggap.untruncatedHybridExpression · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HybridProgram.lean:764
def clampExpression

Defines clamp Expression, the stated quantity or construction used in the discrete average-treatment-effect estimator.

Definition (Lean source)
def clampExpression {ι : Type*} (x : RealArithmeticExpression ι) : RealArithmeticExpression ι := let minOne := .branchNonpos (.sub (.const 1) x) (.const 1) x .branchNonpos (.add minOne (.const 1)) (.const (-1)) minOne
CausalSmith.Stat.DiscreteAteMinimaxLoggap.clampExpression · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HybridProgram.lean:769
def hybridExpression

Defines hybrid Expression, the stated quantity or construction used in the discrete average-treatment-effect estimator.

Definition (Lean source)
CausalSmith.Stat.DiscreteAteMinimaxLoggap.hybridExpression · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HybridProgram.lean:775
theorem heavy_add_light_eq_selected_sum

Establishes the stated equality relating heavy add light eq selected sum.

Formal statement
n d :
sample :
Fin n → Obs d
= ∑ k : Fin d, if k ∈ heavyCells sample then empiricalRatioCell sample k else factorialPolynomialContribution sample k
Proof (Lean source)
lemma heavy_add_light_eq_selected_sum {n d : ℕ} (sample : Fin n → Obs d) : heavyContribution sample + lightContribution sample = ∑ k : Fin d, if k ∈ heavyCells sample then empiricalRatioCell sample k else factorialPolynomialContribution sample k := by classical rw [heavyContribution, lightContribution, lightCells_eq_compl, Finset.sum_ite] have hheavy : Finset.univ.filter (fun k => k ∈ heavyCells sample) = heavyCells sample := by ext k simp have hlight : Finset.univ.filter (fun k => k ∉ heavyCells sample) = (heavyCells sample)ᶜ := by ext k simp rw [hheavy, hlight]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.heavy_add_light_eq_selected_sum · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HybridProgram.lean:779
theorem eval_untruncatedHybridExpression

Establishes the stated property of eval untruncated Hybrid Expression in the discrete average-treatment-effect construction.

Formal statement
n d :
sample :
Fin n → Obs d
Proof (Lean source)
lemma eval_untruncatedHybridExpression {n d : ℕ} (sample : Fin n → Obs d) : eval (hybridCountVector sample) (untruncatedHybridExpression n d) = heavyContribution sample + lightContribution sample := by simp only [untruncatedHybridExpression, eval_expressionSum] rw [← List.ofFn_comp'] rw [List.sum_ofFn] simp only [eval_selectedCellExpression] rw [heavy_add_light_eq_selected_sum]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.eval_untruncatedHybridExpression · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HybridProgram.lean:796
theorem eval_clampExpression

Establishes the stated property of eval clamp Expression in the discrete average-treatment-effect construction.

Formal statement
ι :
Type*
input :
ι → ℝ
eval input (clampExpression x) = max (-1) (min 1 (eval input x))
Proof (Lean source)
lemma eval_clampExpression {ι : Type*} (input : ι → ℝ) (x : RealArithmeticExpression ι) : eval input (clampExpression x) = max (-1) (min 1 (eval input x)) := by simp only [clampExpression, eval] let m : ℝ := if 1 - eval input x ≤ 0 then 1 else eval input x have hm : m = min 1 (eval input x) := by dsimp [m] by_cases h : 1 - eval input x ≤ 0 · rw [if_pos h, min_eq_left (by linarith)] · rw [if_neg h, min_eq_right (by linarith)] change (if m + 1 ≤ 0 then -1 else m) = _ rw [hm] by_cases h : min 1 (eval input x) ≤ -1 · rw [if_pos (by linarith), max_eq_left h] · rw [if_neg (by linarith), max_eq_right (le_of_not_ge h)]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.eval_clampExpression · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HybridProgram.lean:806
theorem eval_hybridExpression

Establishes the stated property of eval hybrid Expression in the discrete average-treatment-effect construction.

Formal statement
n d :
sample :
Fin n → Obs d
Proof (Lean source)
CausalSmith.Stat.DiscreteAteMinimaxLoggap.eval_hybridExpression · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HybridProgram.lean:823
theorem operationCount_untruncatedHybridExpression_le

Establishes the stated upper bound for operation Count untruncated Hybrid Expression le.

Formal statement
n d :
operationCount (untruncatedHybridExpression n d) ≤ 111 * d * polynomialDegree n ^ 4
Proof (Lean source)
lemma operationCount_untruncatedHybridExpression_le (n d : ℕ) : operationCount (untruncatedHybridExpression n d) ≤ 111 * d * polynomialDegree n ^ 4 := by rw [untruncatedHybridExpression, operationCount_expressionSum] rw [← List.ofFn_comp'] rw [List.sum_ofFn, List.length_ofFn] have hsum : (∑ k : Fin d, operationCount (selectedCellExpression n k)) ≤ ∑ _k : Fin d, 110 * polynomialDegree n ^ 4 := by apply Finset.sum_le_sum intro k hk exact operationCount_selectedCellExpression_le n k calc (∑ k : Fin d, operationCount (selectedCellExpression n k)) + d ≤ (∑ _k : Fin d, 110 * polynomialDegree n ^ 4) + d := Nat.add_le_add_right hsum d _ = d * (110 * polynomialDegree n ^ 4) + d := by simp _ ≤ 111 * d * polynomialDegree n ^ 4 := by have hM : 1 ≤ polynomialDegree n ^ 4 := by exact one_le_pow₀ (le_trans (by omega) (polynomialDegree_two_le n)) nlinarith
CausalSmith.Stat.DiscreteAteMinimaxLoggap.operationCount_untruncatedHybridExpression_le · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HybridProgram.lean:829
theorem operationCount_clampExpression

Establishes the stated property of operation Count clamp Expression in the discrete average-treatment-effect construction.

Formal statement
ι :
Type*
operationCount (clampExpression x) = 4 * operationCount x + 6
Proof (Lean source)
lemma operationCount_clampExpression {ι : Type*} (x : RealArithmeticExpression ι) : operationCount (clampExpression x) = 4 * operationCount x + 6 := by simp [clampExpression, operationCount] omega
CausalSmith.Stat.DiscreteAteMinimaxLoggap.operationCount_clampExpression · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HybridProgram.lean:851
theorem operationCount_hybridExpression_le

Establishes the stated upper bound for operation Count hybrid Expression le.

Formal statement
n d :
hd :
0 < d
operationCount (hybridExpression n d) ≤ 450 * d * polynomialDegree n ^ 4
Proof (Lean source)
lemma operationCount_hybridExpression_le (n d : ℕ) (hd : 0 < d) : operationCount (hybridExpression n d) ≤ 450 * d * polynomialDegree n ^ 4 := by rw [hybridExpression, operationCount_clampExpression] have hu := operationCount_untruncatedHybridExpression_le n d have hM : 1 ≤ polynomialDegree n ^ 4 := by exact one_le_pow₀ (le_trans (by omega) (polynomialDegree_two_le n)) have hdM : 1 ≤ d * polynomialDegree n ^ 4 := by exact Nat.mul_pos hd (lt_of_lt_of_le Nat.zero_lt_one hM) nlinarith
CausalSmith.Stat.DiscreteAteMinimaxLoggap.operationCount_hybridExpression_le · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HybridProgram.lean:857
def hybridArithmeticProgram

The requested straight-line program. The zero-alphabet branch is a zero-cost constant; otherwise it is the verified compilation of the exact count expression above.

Definition (Lean source)
noncomputable def hybridArithmeticProgram (n d : ℕ) : RealArithmeticProgram (HybridCountInput d) := if d = 0 then RealArithmeticExpression.program (.const 0) else RealArithmeticExpression.program (hybridExpression n d)
CausalSmith.Stat.DiscreteAteMinimaxLoggap.hybridArithmeticProgram · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HybridProgram.lean:868
theorem hybridArithmeticProgram_eval

The compiled straight-line program computes the hybrid estimator exactly: run on the vector of split counts of any sample, its designated output register holds the value of the hybrid estimator at that sample.

Formal statement
n d :
sample :
Fin n → Obs d
Proof (Lean source)
lemma hybridArithmeticProgram_eval {n d : ℕ} (sample : Fin n → Obs d) : (hybridArithmeticProgram n d).eval (hybridCountVector sample) = hybridEstimator sample := by by_cases hd : d = 0 · subst d have hfinset (s : Finset (Fin 0)) : s = ∅ := by ext i exact Fin.elim0 i simp [hybridArithmeticProgram, RealArithmeticExpression.eval_program, RealArithmeticExpression.eval, hybridEstimator, heavyContribution, lightContribution, hfinset] · simp [hybridArithmeticProgram, hd, RealArithmeticExpression.eval_program, eval_hybridExpression]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.hybridArithmeticProgram_eval · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HybridProgram.lean:876
theorem hybridArithmeticProgram_operationCount

Establishes the stated property of hybrid Arithmetic Program operation Count in the discrete average-treatment-effect construction.

Formal statement
n d :
(hybridArithmeticProgram n d).operationCount ≤ 450 * d * polynomialDegree n ^ 4
Proof (Lean source)
lemma hybridArithmeticProgram_operationCount (n d : ℕ) : (hybridArithmeticProgram n d).operationCount ≤ 450 * d * polynomialDegree n ^ 4 := by by_cases hd : d = 0 · subst d simp [hybridArithmeticProgram, RealArithmeticExpression.operationCount_program, RealArithmeticExpression.operationCount] · rw [hybridArithmeticProgram, if_neg hd, RealArithmeticExpression.operationCount_program] exact operationCount_hybridExpression_le n d (Nat.pos_of_ne_zero hd)
CausalSmith.Stat.DiscreteAteMinimaxLoggap.hybridArithmeticProgram_operationCount · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HybridProgram.lean:893
theorem hybridEstimatorComputable

Exact computability and the uniform O(d M(n)^4) operation certificate.

Formal statement
Proof (Lean source)
theorem hybridEstimatorComputable : HybridEstimatorComputable := by refine ⟨450, by norm_num, ?_⟩ intro n d exact ⟨hybridArithmeticProgram n d, hybridArithmeticProgram_operationCount n d, fun sample => hybridArithmeticProgram_eval sample⟩
CausalSmith.Stat.DiscreteAteMinimaxLoggap.hybridEstimatorComputable · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/HybridProgram.lean:905
Helpers.LightCell 15 declarations
def targetLight

Defines target Light, the stated quantity or construction used in the discrete average-treatment-effect estimator.

Definition (Lean source)
noncomputable def targetLight {n d : ℕ} (P : DiscreteLaw d) (sample : Fin n → Obs d) : ℝ := ∑ k ∈ lightCells sample, cellPhi (cellVector P k)
CausalSmith.Stat.DiscreteAteMinimaxLoggap.targetLight · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCell.lean:9
def componentErrorMSE

Defines component Error MSE, the stated quantity or construction used in the discrete average-treatment-effect estimator.

Definition (Lean source)
noncomputable def componentErrorMSE {n d : ℕ} (mu_n : Measure (Fin n → Obs d)) (component target : (Fin n → Obs d) → ℝ) : ℝ := ∫ sample, (component sample - target sample) ^ 2 ∂mu_n
CausalSmith.Stat.DiscreteAteMinimaxLoggap.componentErrorMSE · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCell.lean:14

Defines minimax Rate, the stated quantity or construction used in the discrete average-treatment-effect estimator.

Definition (Lean source)
noncomputable def minimaxRate (n d : ℕ) : ℝ := 1 / (n : ℝ) + d ^ 2 / ((n : ℝ) ^ 2 * (log n) ^ 2)
CausalSmith.Stat.DiscreteAteMinimaxLoggap.minimaxRate · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCell.lean:20
theorem lightCells_eq_pilotHeavyAt_compl_of_cutoff_le

Establishes the stated equality relating light Cells eq pilot Heavy At compl of cutoff le.

Formal statement
n d :
sample :
Fin n → Obs d
hcut :
lightCells sample = (pilotHeavyAt sample 256)ᶜ
Proof (Lean source)
lemma lightCells_eq_pilotHeavyAt_compl_of_cutoff_le {n d : ℕ} (sample : Fin n → Obs d) (hcut : calibrationCutoff ≤ n) : lightCells sample = (pilotHeavyAt sample 256)ᶜ := by classical rw [lightCells_eq_compl, heavyCells_eq_filter_of_cutoff_le sample hcut] congr 1 ext k simp only [pilotHeavyAt, mem_filter, Finset.mem_univ, true_and] simp only [lambda0] exact (Int.floor_lt).symm
CausalSmith.Stat.DiscreteAteMinimaxLoggap.lightCells_eq_pilotHeavyAt_compl_of_cutoff_le · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCell.lean:25
theorem selected_light_mass_le_bandwidth_quarter

Establishes the stated upper bound for selected light mass le bandwidth quarter.

Formal statement
n d :
P :
sample :
Fin n → Obs d
hcut :
hgood :
sample ∉ pilotBadEvent P 256
k :
Fin d
hk :
k ∈ lightCells sample
cellMass P k ≤ bandwidth n / 4
Proof (Lean source)
lemma selected_light_mass_le_bandwidth_quarter {n d : ℕ} (P : DiscreteLaw d) (sample : Fin n → Obs d) (hcut : calibrationCutoff ≤ n) (hgood : sample ∉ pilotBadEvent P 256) (k : Fin d) (hk : k ∈ lightCells sample) : cellMass P k ≤ bandwidth n / 4 := by classical have hbase : cutoffProperty calibrationCutoff := by rw [calibrationCutoff] exact Nat.find_spec cutoffProperty_eventually have hprops := hbase n hcut rcases hprops with ⟨hscale, hdegreeSize, _hshift⟩ have hdeg2 : 2 ≤ polynomialDegree n := by simp [polynomialDegree] have hm1large : 16 ≤ splitSize n 1 := by nlinarith have hn2 : 2 ≤ n := by rw [splitSize_one_eq] at hm1large omega have hm0pos : 0 < splitSize n 0 := by rw [splitSize_zero_eq] omega have hm1pos : 0 < splitSize n 1 := lt_of_lt_of_le (by norm_num) hm1large have hmratio : splitSize n 1 ≤ 2 * splitSize n 0 := by rw [splitSize_zero_eq, splitSize_one_eq] omega have hscale0 : 0 ≤ logScale n := by have ha0 : 0 < alpha0 := by unfold alpha0 dA have hlog6 : 0 < log (6 : ℝ) := Real.log_pos (by norm_num) have hlog : 0 < log (27 / 4 : ℝ) := Real.log_pos (by norm_num) positivity nlinarith have hknot : k ∉ pilotHeavyAt sample 256 := by rw [lightCells_eq_pilotHeavyAt_compl_of_cutoff_le sample hcut] at hk simpa using hk have hsand : (∀ l ∈ pilotHeavyAt sample 256, 256 * logScale n / (2 * splitSize n 0) ≤ cellMass P l) ∧ (∀ l ∉ pilotHeavyAt sample 256, cellMass P l ≤ 2 * 256 * logScale n / splitSize n 0) := by simpa only [pilotBadEvent, Set.mem_setOf_eq, not_or, not_not] using hgood have hkbound := hsand.2 k hknot rw [bandwidth] have hmratioR : (splitSize n 1 : ℝ) ≤ 2 * splitSize n 0 := by exact_mod_cast hmratio have hm0R : 0 < (splitSize n 0 : ℝ) := by exact_mod_cast hm0pos have hm1R : 0 < (splitSize n 1 : ℝ) := by exact_mod_cast hm1pos calc cellMass P k ≤ 2 * 256 * logScale n / splitSize n 0 := hkbound _ ≤ (b0 : ℝ) * logScale n / splitSize n 1 / 4 := by rw [div_div, div_le_div_iff₀ hm0R (by positivity : 0 < (splitSize n 1 : ℝ) * 4)] norm_num [b0] nlinarith
CausalSmith.Stat.DiscreteAteMinimaxLoggap.selected_light_mass_le_bandwidth_quarter · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCell.lean:38
theorem selected_light_approximation_bias

Establishes the stated upper bound for selected light approximation bias.

Formal statement
n d :
epsilon :
P :
hOverlap :
Overlap epsilon P
sample :
Fin n → Obs d
hcut :
hgood :
sample ∉ pilotBadEvent P 256
he0 :
0 < epsilon
|sum (lightCells sample) (fun k : Fin d => (cellApproxPolynomial (polynomialDegree n) (bandwidth n)).eval (cellVector P k) - cellPhi (cellVector P k))|
≤ d * (2 * bandwidth n / (epsilon * polynomialDegree n ^ 2))
Proof (Lean source)
lemma selected_light_approximation_bias {n d : ℕ} {epsilon : ℝ} (P : DiscreteLaw d) (hOverlap : Overlap epsilon P) (sample : Fin n → Obs d) (hcut : calibrationCutoff ≤ n) (hgood : sample ∉ pilotBadEvent P 256) (he0 : 0 < epsilon) : |sum (lightCells sample) (fun k : Fin d => (cellApproxPolynomial (polynomialDegree n) (bandwidth n)).eval (cellVector P k) - cellPhi (cellVector P k))| ≤ d * (2 * bandwidth n / (epsilon * polynomialDegree n ^ 2)) := by classical have hM : 0 < polynomialDegree n := by simp [polynomialDegree] have hB (k : Fin d) (hk : k ∈ lightCells sample) : vectorMass (cellVector P k) ≤ bandwidth n := by rw [vectorMass_cellVector] exact (selected_light_mass_le_bandwidth_quarter P sample hcut hgood k hk).trans (by have hbase : cutoffProperty calibrationCutoff := by rw [calibrationCutoff] exact Nat.find_spec cutoffProperty_eventually have hs := (hbase n hcut).1 have ha0 : 0 < alpha0 := by unfold alpha0 dA have hlog6 : 0 < log (6 : ℝ) := Real.log_pos (by norm_num) have hlog : 0 < log (27 / 4 : ℝ) := Real.log_pos (by norm_num) positivity have hL : 0 < logScale n := by nlinarith have hm1 : 0 < splitSize n 1 := by have hd : 4 * polynomialDegree n ^ 2 ≤ splitSize n 1 := (hbase n hcut).2.1 nlinarith have hB0 : 0 ≤ bandwidth n := by rw [bandwidth] positivity linarith) calc |sum (lightCells sample) (fun k : Fin d => (cellApproxPolynomial (polynomialDegree n) (bandwidth n)).eval (cellVector P k) - cellPhi (cellVector P k))| ≤ ∑ k ∈ lightCells sample, |(cellApproxPolynomial (polynomialDegree n) (bandwidth n)).eval (cellVector P k) - cellPhi (cellVector P k)| := Finset.abs_sum_le_sum_abs _ _ _ ≤ ∑ _k ∈ lightCells sample, (2 * bandwidth n / (epsilon * polynomialDegree n ^ 2)) := by apply Finset.sum_le_sum intro k hk exact cellApproxPolynomial_error hM he0 (cellVector_mem_overlapCone P hOverlap k) (hB k hk) _ ≤ d * (2 * bandwidth n / (epsilon * polynomialDegree n ^ 2)) := by rw [Finset.sum_const, nsmul_eq_mul] have hcard : (lightCells sample).card ≤ d := by calc (lightCells sample).card ≤ (Finset.univ : Finset (Fin d)).card := Finset.card_le_card (Finset.subset_univ _) _ = d := Fintype.card_fin d exact mul_le_mul_of_nonneg_right (by exact_mod_cast hcard) (div_nonneg (by have hbase : cutoffProperty calibrationCutoff := by rw [calibrationCutoff] exact Nat.find_spec cutoffProperty_eventually have hs := (hbase n hcut).1 have ha0 : 0 < alpha0 := by unfold alpha0 dA have hlog6 : 0 < log (6 : ℝ) := Real.log_pos (by norm_num) have hlog : 0 < log (27 / 4 : ℝ) := Real.log_pos (by norm_num) positivity have hm1 : 0 < splitSize n 1 := by have hd := (hbase n hcut).2.1 nlinarith have hL : 0 < logScale n := by nlinarith rw [bandwidth] positivity) (by positivity))
CausalSmith.Stat.DiscreteAteMinimaxLoggap.selected_light_approximation_bias · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCell.lean:93
theorem integrable_factorialPolynomialContribution_trunc

Shows that integrable factorial Polynomial Contribution trunc is integrable under the stated sampling distribution.

Formal statement
n d :
P :
k :
Fin d
Integrable (fun ω : ℕ → Obs d => factorialPolynomialContribution (fun i : Fin n => ω i) k) (Measure.infinitePi (fun _ : ℕ => obsLaw P))
Proof (Lean source)
lemma integrable_factorialPolynomialContribution_trunc {n d : ℕ} (P : DiscreteLaw d) (k : Fin d) : Integrable (fun ω : ℕ → Obs d => factorialPolynomialContribution (fun i : Fin n => ω i) k) (Measure.infinitePi (fun _ : ℕ => obsLaw P)) := by let arm (a : Fin 2) := fun ω : ℕ → Obs d => ∑ j ∈ range (polynomialDegree n - 1), ∑ t ∈ range (j + 1), ∑ ay : Cell, ((bandwidth n)⁻¹ * gCoefficient (polynomialDegree n) j * (bandwidth n)⁻¹ ^ j * (Nat.choose j t : ℝ)) * factorialMonomial (fun i : Fin n => ω i) k (factorialExpansionIndex a ay j t) have harm (a : Fin 2) : Integrable (arm a) (Measure.infinitePi (fun _ : ℕ => obsLaw P)) := by apply integrable_finset_sum intro j _hj apply integrable_finset_sum intro t _ht apply integrable_finset_sum intro ay _hay exact Integrable.const_mul (integrable_factorialMonomial_trunc P k (factorialExpansionIndex a ay j t)) _ exact (harm 1).sub (harm 0)
CausalSmith.Stat.DiscreteAteMinimaxLoggap.integrable_factorialPolynomialContribution_trunc · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCell.lean:166
theorem integral_factorialPolynomialContribution_trunc Lemma 9 in the paper ↗

Evaluates or bounds the stated integral involving integral factorial Polynomial Contribution trunc.

Formal statement
n d :
P :
k :
Fin d
hcut :
∫ ω : ℕ → Obs d, factorialPolynomialContribution (fun i : Fin n => ω i) k ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P))
Proof (Lean source)
lemma integral_factorialPolynomialContribution_trunc {n d : ℕ} (P : DiscreteLaw d) (k : Fin d) (hcut : calibrationCutoff ≤ n) : ∫ ω : ℕ → Obs d, factorialPolynomialContribution (fun i : Fin n => ω i) k ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P)) = (cellApproxPolynomial (polynomialDegree n) (bandwidth n)).eval (cellVector P k) := by classical have hbase : cutoffProperty calibrationCutoff := by rw [calibrationCutoff] exact Nat.find_spec cutoffProperty_eventually have hprops := hbase n hcut rcases hprops with ⟨_hdegreeLower, hdegreeSize, _hshift⟩ let coeff (j t : ℕ) : ℝ := (bandwidth n)⁻¹ * gCoefficient (polynomialDegree n) j * (bandwidth n)⁻¹ ^ j * (Nat.choose j t : ℝ) let arm (a : Fin 2) := fun ω : ℕ → Obs d => ∑ j ∈ range (polynomialDegree n - 1), ∑ t ∈ range (j + 1), ∑ ay : Cell, coeff j t * factorialMonomial (fun i : Fin n => ω i) k (factorialExpansionIndex a ay j t) let meanArm (a : Fin 2) := ∑ j ∈ range (polynomialDegree n - 1), ∑ t ∈ range (j + 1), ∑ ay : Cell, coeff j t * (factorialExpansionIndex a ay j t).prod (fun ay' e => (cellVector P k ay') ^ e) have hMle : polynomialDegree n ≤ splitSize n 1 := by have hMpos : 0 < polynomialDegree n := by simp [polynomialDegree] nlinarith [sq_nonneg (polynomialDegree n : ℝ)] have hdeg (a : Fin 2) (j t : ℕ) (ay : Cell) (hj : j ∈ range (polynomialDegree n - 1)) (ht : t ∈ range (j + 1)) : multiDegree (factorialExpansionIndex a ay j t) ≤ splitSize n 1 := by have htj : t ≤ j := Nat.le_of_lt_succ (Finset.mem_range.mp ht) rw [multiDegree_factorialExpansionIndex a ay j t htj] have hjM : j + 2 ≤ polynomialDegree n := by have := Finset.mem_range.mp hj omega exact hjM.trans hMle have hterm (a : Fin 2) (j t : ℕ) (ay : Cell) : Integrable (fun ω : ℕ → Obs d => coeff j t * factorialMonomial (fun i : Fin n => ω i) k (factorialExpansionIndex a ay j t)) (Measure.infinitePi (fun _ : ℕ => obsLaw P)) := Integrable.const_mul (integrable_factorialMonomial_trunc P k (factorialExpansionIndex a ay j t)) _ have htSum (a : Fin 2) (j t : ℕ) : Integrable (fun ω : ℕ → Obs d => ∑ ay : Cell, coeff j t * factorialMonomial (fun i : Fin n => ω i) k (factorialExpansionIndex a ay j t)) (Measure.infinitePi (fun _ : ℕ => obsLaw P)) := by exact integrable_finset_sum _ fun ay _ => hterm a j t ay have hjSum (a : Fin 2) (j : ℕ) : Integrable (fun ω : ℕ → Obs d => ∑ t ∈ range (j + 1), ∑ ay : Cell, coeff j t * factorialMonomial (fun i : Fin n => ω i) k (factorialExpansionIndex a ay j t)) (Measure.infinitePi (fun _ : ℕ => obsLaw P)) := by exact integrable_finset_sum _ fun t _ => htSum a j t have harm (a : Fin 2) : Integrable (arm a) (Measure.infinitePi (fun _ : ℕ => obsLaw P)) := by exact integrable_finset_sum _ fun j _ => hjSum a j have hmean (a : Fin 2) : ∫ ω : ℕ → Obs d, arm a ω ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P)) = meanArm a := by unfold arm meanArm rw [integral_finset_sum _ (fun j _ => hjSum a j)] apply Finset.sum_congr rfl intro j hj rw [integral_finset_sum _ (fun t _ => htSum a j t)] apply Finset.sum_congr rfl intro t ht rw [integral_finset_sum _ (fun ay _ => hterm a j t ay)] apply Finset.sum_congr rfl intro ay _hay rw [integral_const_mul, integral_factorialMonomial_trunc P k _ (hdeg a j t ay hj ht)] change ∫ ω : ℕ → Obs d, arm 1 ω - arm 0 ω ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P)) = _ rw [integral_sub (harm 1) (harm 0), hmean 1, hmean 0] have hcollapse (a : Fin 2) (j : ℕ) : ∑ t ∈ range (j + 1), ∑ ay : Cell, coeff j t * (factorialExpansionIndex a ay j t).prod (fun ay' e => (cellVector P k ay') ^ e) = ((bandwidth n)⁻¹ * gCoefficient (polynomialDegree n) j * (bandwidth n)⁻¹ ^ j) * ((∑ ay : Cell, cellVector P k ay) * cellVector P k (a, 1) * (cellVector P k (a, 0) + cellVector P k (a, 1)) ^ j) := by rw [show (∑ t ∈ range (j + 1), ∑ ay : Cell, coeff j t * (factorialExpansionIndex a ay j t).prod (fun ay' e => (cellVector P k ay') ^ e)) = ((bandwidth n)⁻¹ * gCoefficient (polynomialDegree n) j * (bandwidth n)⁻¹ ^ j) * (∑ t ∈ range (j + 1), ∑ ay : Cell, (Nat.choose j t : ℝ) * (factorialExpansionIndex a ay j t).prod (fun ay' e => (cellVector P k ay') ^ e)) by rw [Finset.mul_sum] apply Finset.sum_congr rfl intro t _ht rw [Finset.mul_sum] apply Finset.sum_congr rfl intro ay _hay simp only [coeff] ring] rw [factorialExpansionIndex_binomial_sum] unfold meanArm simp_rw [hcollapse] have houter (a : Fin 2) : ∑ j ∈ range (polynomialDegree n - 1), ((bandwidth n)⁻¹ * gCoefficient (polynomialDegree n) j * (bandwidth n)⁻¹ ^ j) * ((∑ ay : Cell, cellVector P k ay) * cellVector P k (a, 1) * (cellVector P k (a, 0) + cellVector P k (a, 1)) ^ j) = (bandwidth n)⁻¹ * (∑ ay : Cell, cellVector P k ay) * cellVector P k (a, 1) * (∑ j ∈ range (polynomialDegree n - 1), gCoefficient (polynomialDegree n) j * ((bandwidth n)⁻¹ * (cellVector P k (a, 0) + cellVector P k (a, 1))) ^ j) := by rw [Finset.mul_sum] apply Finset.sum_congr rfl intro j _hj rw [mul_pow] ring rw [houter 1, houter 0] have hmass : (eval (cellVector P k)) mvMass = ∑ ay : Cell, cellVector P k ay := by simp [mvMass, mvArmMass, Fintype.sum_prod_type, Fin.sum_univ_two] have harmEval (a : Fin 2) : (eval (cellVector P k)) (mvArmMass a) = cellVector P k (a, 0) + cellVector P k (a, 1) := by simp [mvArmMass] simp only [cellApproxPolynomial, MvPolynomial.eval_sub, MvPolynomial.eval_mul, map_sum, MvPolynomial.eval_C, MvPolynomial.eval_X, map_pow] rw [hmass, harmEval 1, harmEval 0]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.integral_factorialPolynomialContribution_trunc · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCell.lean:193
theorem sparsePolynomialMean_eq_cellApprox

Establishes the stated equality relating sparse Polynomial Mean eq cell Approx.

Formal statement
n d :
P :
k :
Fin d
hcut :
Proof (Lean source)
lemma sparsePolynomialMean_eq_cellApprox {n d : ℕ} (P : DiscreteLaw d) (k : Fin d) (hcut : calibrationCutoff ≤ n) : sparsePolynomialMean P k (polynomialDegree n) (bandwidth n) = (cellApproxPolynomial (polynomialDegree n) (bandwidth n)).eval (cellVector P k) := by classical have hbase : cutoffProperty calibrationCutoff := by rw [calibrationCutoff] exact Nat.find_spec cutoffProperty_eventually have hsize := (hbase n hcut).2.1 have hMle : polynomialDegree n ≤ splitSize n 1 := by have hM1 : 1 ≤ polynomialDegree n := by simp [polynomialDegree] nlinarith [Nat.mul_self_le_mul_self hM1] rw [← integral_factorialPolynomialContribution_eq_sparsePolynomialMean P k hMle, integral_factorialPolynomialContribution_trunc P k hcut]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.sparsePolynomialMean_eq_cellApprox · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCell.lean:333
def selectedGenuineLightBias

Defines selected Genuine Light Bias, the stated quantity or construction used in the discrete average-treatment-effect estimator.

Definition (Lean source)
noncomputable def selectedGenuineLightBias {n d : ℕ} (P : DiscreteLaw d) (sample : Fin n → Obs d) : ℝ := ∑ k ∈ genuineLightSet (n := n) P, lightIndicator sample k * (sparsePolynomialMean P k (polynomialDegree n) (bandwidth n) - cellPhi (cellVector P k))
CausalSmith.Stat.DiscreteAteMinimaxLoggap.selectedGenuineLightBias · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCell.lean:350
theorem selectedGenuineLightBias_abs

Establishes the stated upper bound for selected Genuine Light Bias abs.

Formal statement
n d :
epsilon :
P :
hOverlap :
Overlap epsilon P
he0 :
0 < epsilon
hcut :
sample :
Fin n → Obs d
≤ d * (2 * bandwidth n / (epsilon * polynomialDegree n ^ 2))
Proof (Lean source)
lemma selectedGenuineLightBias_abs {n d : ℕ} {epsilon : ℝ} (P : DiscreteLaw d) (hOverlap : Overlap epsilon P) (he0 : 0 < epsilon) (hcut : calibrationCutoff ≤ n) (sample : Fin n → Obs d) : |selectedGenuineLightBias P sample| ≤ d * (2 * bandwidth n / (epsilon * polynomialDegree n ^ 2)) := by classical have hM : 0 < polynomialDegree n := by simp [polynomialDegree] have hB0 : 0 ≤ bandwidth n := by rw [bandwidth] have hp := (Nat.find_spec cutoffProperty_eventually) n have hL : 0 < logScale n := by have ha0 : 0 < alpha0 := by unfold alpha0 dA have hlog6 : 0 < log (6 : ℝ) := Real.log_pos (by norm_num) have hlog : 0 < log (27 / 4 : ℝ) := Real.log_pos (by norm_num) positivity have hs := (show cutoffProperty calibrationCutoff by rw [calibrationCutoff]; exact Nat.find_spec cutoffProperty_eventually) n hcut nlinarith [hs.1] positivity unfold selectedGenuineLightBias calc |∑ k ∈ genuineLightSet (n := n) P, lightIndicator sample k * (sparsePolynomialMean P k (polynomialDegree n) (bandwidth n) - cellPhi (cellVector P k))| ≤ ∑ k ∈ genuineLightSet (n := n) P, |lightIndicator sample k * (sparsePolynomialMean P k (polynomialDegree n) (bandwidth n) - cellPhi (cellVector P k))| := Finset.abs_sum_le_sum_abs _ _ _ ≤ ∑ _k ∈ genuineLightSet (n := n) P, (2 * bandwidth n / (epsilon * polynomialDegree n ^ 2)) := by apply Finset.sum_le_sum intro k hk rw [abs_mul] have hI : |lightIndicator sample k| ≤ 1 := by rw [abs_of_nonneg (lightIndicator_nonneg _ _)] exact lightIndicator_le_one _ _ have hkB : vectorMass (cellVector P k) ≤ bandwidth n := by rw [vectorMass_cellVector] have : cellMass P k ≤ bandwidth n / 4 := by simpa [genuineLightSet] using hk linarith have happ := cellApproxPolynomial_error hM he0 (cellVector_mem_overlapCone P hOverlap k) hkB rw [sparsePolynomialMean_eq_cellApprox P k hcut] calc |lightIndicator sample k| * |(cellApproxPolynomial (polynomialDegree n) (bandwidth n)).eval (cellVector P k) - cellPhi (cellVector P k)| ≤ 1 * (2 * bandwidth n / (epsilon * polynomialDegree n ^ 2)) := by gcongr _ = _ := one_mul _ _ ≤ d * (2 * bandwidth n / (epsilon * polynomialDegree n ^ 2)) := by rw [Finset.sum_const, nsmul_eq_mul] have hc : ((genuineLightSet (n := n) P).card : ℝ) ≤ d := by exact_mod_cast (calc (genuineLightSet (n := n) P).card ≤ (Finset.univ : Finset (Fin d)).card := Finset.card_le_card (Finset.subset_univ _) _ = d := Fintype.card_fin d) exact mul_le_mul_of_nonneg_right hc (div_nonneg (mul_nonneg (by norm_num) hB0) (mul_nonneg he0.le (sq_nonneg _)))
CausalSmith.Stat.DiscreteAteMinimaxLoggap.selectedGenuineLightBias_abs · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCell.lean:357
theorem polynomialDegree_lower_half

Establishes the stated property of polynomial Degree lower half in the discrete average-treatment-effect construction.

Formal statement
n :
hscale :
2 ≤ alpha0 * logScale n
alpha0 * logScale n / 2 ≤ (polynomialDegree n : ℝ)
Proof (Lean source)
lemma polynomialDegree_lower_half {n : ℕ} (hscale : 2 ≤ alpha0 * logScale n) : alpha0 * logScale n / 2 ≤ (polynomialDegree n : ℝ) := by classical have hfloor2 : (2 : ℤ) ≤ ⌊alpha0 * logScale n⌋ := by rw [Int.le_floor] exact_mod_cast hscale have hmax : polynomialDegree n = Int.toNat ⌊alpha0 * logScale n⌋ := by rw [polynomialDegree, max_eq_right] exact Int.toNat_le_toNat hfloor2 rw [hmax] have hfloor0 : 0 ≤ ⌊alpha0 * logScale n⌋ := le_trans (by norm_num) hfloor2 rw [show ((Int.toNat ⌊alpha0 * logScale n⌋ : ℕ) : ℝ) = ((⌊alpha0 * logScale n⌋ : ℤ) : ℝ) by exact_mod_cast Int.toNat_of_nonneg hfloor0] have hf := Int.sub_one_lt_floor (alpha0 * logScale n) exact le_of_lt (by nlinarith)
CausalSmith.Stat.DiscreteAteMinimaxLoggap.polynomialDegree_lower_half · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCell.lean:421
theorem selectedGenuineLightBias_sq_rate

The selected genuine-light approximation bias has the squared minimax normalization.

Formal statement
n d :
epsilon :
P :
hOverlap :
Overlap epsilon P
he0 :
0 < epsilon
hcut :
sample :
Fin n → Obs d
≤ (65536 / (epsilon * alpha0 ^ 2)) ^ 2 * lightAsymptoticRate n d
Proof (Lean source)
lemma selectedGenuineLightBias_sq_rate {n d : ℕ} {epsilon : ℝ} (P : DiscreteLaw d) (hOverlap : Overlap epsilon P) (he0 : 0 < epsilon) (hcut : calibrationCutoff ≤ n) (sample : Fin n → Obs d) : selectedGenuineLightBias P sample ^ 2 ≤ (65536 / (epsilon * alpha0 ^ 2)) ^ 2 * lightAsymptoticRate n d := by classical let L := logScale n let ell := log (n : ℝ) let M := polynomialDegree n let B := bandwidth n rcases large_calibration_bounds hcut (cutoff_logScale_ge_240 hcut) with ⟨hell, hellL, _hLell, _hm, _hnm, _hM, hB, _hgrowth⟩ have hbase : cutoffProperty calibrationCutoff := by rw [calibrationCutoff] exact Nat.find_spec cutoffProperty_eventually have hscale := (hbase n hcut).1 have ha0 : 0 < alpha0 := by unfold alpha0 dA have hlog6 : 0 < log (6 : ℝ) := Real.log_pos (by norm_num) have hlog : 0 < log (27 / 4 : ℝ) := Real.log_pos (by norm_num) positivity have hn : 0 < (n : ℝ) := by have hnNat : 0 < n := by by_contra hn0 have : n = 0 := Nat.eq_zero_of_not_pos hn0 subst n norm_num at hell exact_mod_cast hnNat have hLpos : 0 < L := lt_of_lt_of_le (by simpa only [ell] using hell) (by simpa only [L, ell] using hellL) have hMlower : alpha0 * L / 2 ≤ (M : ℝ) := by simpa only [L, M] using polynomialDegree_lower_half hscale have hMpos : 0 < (M : ℝ) := lt_of_lt_of_le (div_pos (mul_pos ha0 hLpos) (by norm_num)) hMlower have hden : 0 < epsilon * (M : ℝ) ^ 2 := mul_pos he0 (sq_pos_of_pos hMpos) have hsmallDen : 0 < epsilon * (alpha0 * L / 2) ^ 2 := by positivity have hdenLe : epsilon * (alpha0 * L / 2) ^ 2 ≤ epsilon * (M : ℝ) ^ 2 := by gcongr have hnum : 2 * B ≤ 16384 * L / (n : ℝ) := by calc 2 * B ≤ 2 * (8192 * L / (n : ℝ)) := mul_le_mul_of_nonneg_left hB (by norm_num) _ = 16384 * L / (n : ℝ) := by ring have hnum0 : 0 ≤ 16384 * L / (n : ℝ) := by positivity have hratio : 2 * B / (epsilon * (M : ℝ) ^ 2) ≤ 65536 / (epsilon * alpha0 ^ 2 * (n : ℝ) * L) := by calc 2 * B / (epsilon * (M : ℝ) ^ 2) ≤ (16384 * L / (n : ℝ)) / (epsilon * (M : ℝ) ^ 2) := by exact div_le_div_of_nonneg_right hnum hden.le _ ≤ (16384 * L / (n : ℝ)) / (epsilon * (alpha0 * L / 2) ^ 2) := by exact div_le_div_of_nonneg_left hnum0 hsmallDen hdenLe _ = 65536 / (epsilon * alpha0 ^ 2 * (n : ℝ) * L) := by field_simp ring have hratioEll : 2 * B / (epsilon * (M : ℝ) ^ 2) ≤ 65536 / (epsilon * alpha0 ^ 2 * (n : ℝ) * ell) := by refine hratio.trans ?_ apply div_le_div_of_nonneg_left (by norm_num) · positivity · gcongr have habs := selectedGenuineLightBias_abs P hOverlap he0 hcut sample have hcoef0 : 0 ≤ 65536 / (epsilon * alpha0 ^ 2 * (n : ℝ) * ell) := by positivity have habs' : |selectedGenuineLightBias P sample| ≤ (d : ℝ) * (65536 / (epsilon * alpha0 ^ 2 * (n : ℝ) * ell)) := by exact habs.trans (mul_le_mul_of_nonneg_left hratioEll (Nat.cast_nonneg d)) have hsq := pow_le_pow_left₀ (abs_nonneg _) habs' 2 rw [sq_abs] at hsq calc selectedGenuineLightBias P sample ^ 2 ≤ ((d : ℝ) * (65536 / (epsilon * alpha0 ^ 2 * (n : ℝ) * ell))) ^ 2 := hsq _ = (65536 / (epsilon * alpha0 ^ 2)) ^ 2 * ((d : ℝ) ^ 2 / ((n : ℝ) ^ 2 * ell ^ 2)) := by field_simp _ ≤ (65536 / (epsilon * alpha0 ^ 2)) ^ 2 * lightAsymptoticRate n d := by gcongr unfold lightAsymptoticRate exact le_add_of_nonneg_left (by positivity)
CausalSmith.Stat.DiscreteAteMinimaxLoggap.selectedGenuineLightBias_sq_rate · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCell.lean:440
theorem light_error_decompose

Establishes the stated property of light error decompose in the discrete average-treatment-effect construction.

Formal statement
n d :
P :
sample :
Fin n → Obs d
Proof (Lean source)
lemma light_error_decompose {n d : ℕ} (P : DiscreteLaw d) (sample : Fin n → Obs d) : lightContribution sample - targetLight P sample = selectedFixedLightCentered P sample (genuineLightSet (n := n) P) + selectedGenuineLightBias P sample + selectedFalseLightError P sample := by classical let e := fun k : Fin d => factorialPolynomialContribution sample k - cellPhi (cellVector P k) have hselected : ∑ k ∈ lightCells sample, e k = ∑ k : Fin d, lightIndicator sample k * e k := by rw [show (∑ k ∈ lightCells sample, e k) = sum (Finset.univ.filter fun k : Fin d => k ∈ lightCells sample) e by congr 1 ext k simp] simp [lightIndicator] have hpartition : (∑ k : Fin d, lightIndicator sample k * e k) = (∑ k ∈ genuineLightSet (n := n) P, lightIndicator sample k * e k) + ∑ k ∈ falseLightSet (n := n) P, lightIndicator sample k * e k := by rw [genuineLightSet, falseLightSet] simpa only [Finset.sum_filter, not_le] using (Finset.sum_filter_add_sum_filter_not (s := (Finset.univ : Finset (Fin d))) (p := fun k => cellMass P k ≤ bandwidth n / 4) (f := fun k => lightIndicator sample k * e k)).symm calc lightContribution sample - targetLight P sample = ∑ k ∈ lightCells sample, e k := by unfold lightContribution targetLight rw [← Finset.sum_sub_distrib] _ = ∑ k : Fin d, lightIndicator sample k * e k := hselected _ = (∑ k ∈ genuineLightSet (n := n) P, lightIndicator sample k * e k) + ∑ k ∈ falseLightSet (n := n) P, lightIndicator sample k * e k := hpartition _ = selectedFixedLightCentered P sample (genuineLightSet (n := n) P) + selectedGenuineLightBias P sample + selectedFalseLightError P sample := by unfold selectedFixedLightCentered selectedGenuineLightBias selectedFalseLightError rw [← Finset.sum_add_distrib] apply congrArg₂ (· + ·) · apply Finset.sum_congr rfl intro k hk dsimp only [e] ring · rfl
CausalSmith.Stat.DiscreteAteMinimaxLoggap.light_error_decompose · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCell.lean:525
theorem light_cell_polynomial Lemma 19 in the paper ↗

The factorial-polynomial light branch attains the fixed-interior minimax rate. The constants are chosen before the law and are allowed to depend only on the fixed overlap constant.

Formal statement
epsilon :
he0 :
0 < epsilon
he1 :
epsilon ≤ 1 / 2
∃ C_epsilon c_epsilon : ℝ,
0 < C_epsilon ∧
0 < c_epsilon ∧
∀ (n d : ℕ) (P : DiscreteLaw d) (mu_n : Measure (Fin n → Obs d)),
ExperimentClass n epsilon P mu_n → (d : ℝ)
≤ c_epsilon * n * log n → componentErrorMSE mu_n lightContribution (targetLight P) ≤ C_epsilon * minimaxRate n d
Proof (Lean source)
lemma light_cell_polynomial (epsilon : ℝ) (he0 : 0 < epsilon) (he1 : epsilon ≤ 1 / 2) : HybridEstimatorComputable ∧ ∃ C_epsilon c_epsilon : ℝ, 0 < C_epsilon ∧ 0 < c_epsilon ∧ ∀ (n d : ℕ) (P : DiscreteLaw d) (mu_n : Measure (Fin n → Obs d)), ExperimentClass n epsilon P mu_n → (d : ℝ) ≤ c_epsilon * n * log n → componentErrorMSE mu_n lightContribution (targetLight P) ≤ C_epsilon * minimaxRate n d := by classical refine ⟨hybridEstimatorComputable, ?_⟩ let Kc := 4 * (exp 1 + 1) * 8192 ^ 2 + 16 * 8192 ^ 2 let Kb := (65536 / (epsilon * alpha0 ^ 2)) ^ 2 let Kf := 8 * (exp 1 + 1) * 8192 ^ 2 let C := 3 * (Kc + Kb + Kf) have hC : 0 < C := by dsimp only [C, Kc, Kb, Kf] have ha0 : 0 < alpha0 := by unfold alpha0 dA have hlog6 : 0 < log (6 : ℝ) := Real.log_pos (by norm_num) have hlog : 0 < log (27 / 4 : ℝ) := Real.log_pos (by norm_num) positivity positivity refine ⟨C, 1, hC, by norm_num, ?_⟩ intro n d P mu_n hclass _hd rw [hclass.product_law] by_cases hcut : calibrationCutoff ≤ n · let X := fun sample : Fin n → Obs d => selectedFixedLightCentered P sample (genuineLightSet (n := n) P) let Y := fun sample : Fin n → Obs d => selectedGenuineLightBias P sample let Z := fun sample : Fin n → Obs d => selectedFalseLightError P sample let R := lightAsymptoticRate n d have hLlarge := cutoff_logScale_ge_240 hcut have hX : (∫ sample, X sample ^ 2 ∂productLaw P n) ≤ Kc * R := by calc (∫ sample, X sample ^ 2 ∂productLaw P n) = ∫ ω : ℕ → Obs d, X (fun i : Fin n => ω i) ^ 2 ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P)) := light_integral_productLaw_eq_infinite P (fun sample => X sample ^ 2) _ ≤ Kc * R := by simpa only [X, Kc, R] using selectedGenuineLightCentered_rate P hcut hLlarge have hZ : (∫ sample, Z sample ^ 2 ∂productLaw P n) ≤ Kf * R := by calc (∫ sample, Z sample ^ 2 ∂productLaw P n) = ∫ ω : ℕ → Obs d, Z (fun i : Fin n => ω i) ^ 2 ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P)) := light_integral_productLaw_eq_infinite P (fun sample => Z sample ^ 2) _ ≤ Kf * R := by simpa only [Z, Kf, R] using selectedFalseLightError_rate P hclass.overlap hcut hLlarge have hYpoint (sample : Fin n → Obs d) : Y sample ^ 2 ≤ Kb * R := by simpa only [Y, Kb, R] using selectedGenuineLightBias_sq_rate P hclass.overlap he0 hcut sample have hY : (∫ sample, Y sample ^ 2 ∂productLaw P n) ≤ Kb * R := by calc (∫ sample, Y sample ^ 2 ∂productLaw P n) ≤ ∫ _sample, Kb * R ∂productLaw P n := by apply integral_mono Integrable.of_finite (integrable_const _) exact hYpoint _ = Kb * R := by simp have hpoint (sample : Fin n → Obs d) : (X sample + Y sample + Z sample) ^ 2 ≤ 3 * (X sample ^ 2 + Y sample ^ 2 + Z sample ^ 2) := by nlinarith [sq_nonneg (X sample - Y sample), sq_nonneg (X sample - Z sample), sq_nonneg (Y sample - Z sample)] unfold componentErrorMSE rw [show (fun sample : Fin n → Obs d => (lightContribution sample - targetLight P sample) ^ 2) = (fun sample => (X sample + Y sample + Z sample) ^ 2) by funext sample rw [light_error_decompose P sample] ] calc (∫ sample, (X sample + Y sample + Z sample) ^ 2 ∂productLaw P n) ≤ ∫ sample, 3 * (X sample ^ 2 + Y sample ^ 2 + Z sample ^ 2) ∂productLaw P n := by apply integral_mono Integrable.of_finite Integrable.of_finite exact hpoint _ = 3 * ((∫ sample, X sample ^ 2 ∂productLaw P n) + (∫ sample, Y sample ^ 2 ∂productLaw P n) + ∫ sample, Z sample ^ 2 ∂productLaw P n) := by rw [integral_const_mul, integral_add Integrable.of_finite Integrable.of_finite, integral_add Integrable.of_finite Integrable.of_finite] _ ≤ 3 * (Kc * R + Kb * R + Kf * R) := by gcongr _ = C * R := by dsimp only [C]; ring _ = C * minimaxRate n d := by unfold R lightAsymptoticRate minimaxRate rfl · have hlt : n < calibrationCutoff := Nat.lt_of_not_ge hcut have hrate : 0 ≤ minimaxRate n d := by unfold minimaxRate positivity simpa [componentErrorMSE, lightContribution, targetLight, lightCells_eq_empty_of_lt_cutoff _ hlt] using mul_nonneg hC.le hrate
CausalSmith.Stat.DiscreteAteMinimaxLoggap.light_cell_polynomial · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCell.lean:572
Helpers.LightCellAssembly 41 declarations
instance optionCellMeasurableSpace

Equips the stated space with the measurable structure used in this construction.

Definition (Lean source)
instance optionCellMeasurableSpace : MeasurableSpace (Option Cell) := ⊤
CausalSmith.Stat.DiscreteAteMinimaxLoggap.optionCellMeasurableSpace · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellAssembly.lean:11

Defines iid Sample Shift, the stated quantity or construction used in the discrete average-treatment-effect estimator.

Definition (Lean source)
noncomputable def iidSampleShift {Ω X : Type*} [MeasurableSpace Ω] [MeasurableSpace X] {μ : Measure Ω} {Q : Measure X} (S : IIDSample Ω X μ Q) (offset : ℕ) : IIDSample Ω X μ Q where Z i := S.Z (offset + i) meas i := S.meas (offset + i) indep := S.indep.precomp (fun _ _ h ↦ Nat.add_left_cancel h) identDist i := by simpa using (S.identDist offset).symm.trans (S.identDist (offset + i)) law := by simpa using S.map_eq offset

Defines iid Sample Map, the stated quantity or construction used in the discrete average-treatment-effect estimator.

Definition (Lean source)
noncomputable def iidSampleMap {Ω X Y : Type*} [MeasurableSpace Ω] [MeasurableSpace X] [MeasurableSpace Y] {μ : Measure Ω} {Q : Measure X} (S : IIDSample Ω X μ Q) (f : X → Y) (hf : Measurable f) : IIDSample Ω Y μ (Q.map f) where Z i := f ∘ S.Z i meas i := hf.comp (S.meas i) indep := S.indep.comp (fun _ => f) (fun _ => hf) identDist i := (S.identDist i).comp hf law := by rw [← Measure.map_map hf (S.meas 0), S.law]
def categoryCellLabel

Defines category Cell Label, the stated quantity or construction used in the discrete average-treatment-effect estimator.

Definition (Lean source)
def categoryCellLabel {d : ℕ} (k : Fin d) (z : Obs d) : Option Cell := if z.1 = k then some (finTwoEquiv.symm z.2.1, finTwoEquiv.symm z.2.2) else none
CausalSmith.Stat.DiscreteAteMinimaxLoggap.categoryCellLabel · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellAssembly.lean:41
theorem categoryCellLabel_measurable

Establishes the stated upper bound for category Cell Label measurable.

Formal statement
d :
k :
Fin d
Proof (Lean source)
lemma categoryCellLabel_measurable {d : ℕ} (k : Fin d) : Measurable (categoryCellLabel k) := measurable_of_finite _
CausalSmith.Stat.DiscreteAteMinimaxLoggap.categoryCellLabel_measurable · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellAssembly.lean:48

Defines option Cell Exponent, the stated quantity or construction used in the discrete average-treatment-effect estimator.

Definition (Lean source)
def optionCellExponent (r : MultiIndex) : Option Cell → ℕ | none => 0 | some ay => r ay
CausalSmith.Stat.DiscreteAteMinimaxLoggap.optionCellExponent · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellAssembly.lean:53
theorem exponentDegree_optionCellExponent

Establishes the stated property of exponent Degree option Cell Exponent in the discrete average-treatment-effect construction.

Formal statement
Proof (Lean source)
CausalSmith.Stat.DiscreteAteMinimaxLoggap.exponentDegree_optionCellExponent · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellAssembly.lean:59
theorem categoryCellLabel_atom_mass

Establishes the stated property of category Cell Label atom mass in the discrete average-treatment-effect construction.

Formal statement
d :
P :
k :
Fin d
ay :
((obsLaw P).map (categoryCellLabel k)).real {some ay} = cellVector P k ay
Proof (Lean source)
lemma categoryCellLabel_atom_mass {d : ℕ} (P : DiscreteLaw d) (k : Fin d) (ay : Cell) : ((obsLaw P).map (categoryCellLabel k)).real {some ay} = cellVector P k ay := by rw [map_measureReal_apply (categoryCellLabel_measurable k) (MeasurableSet.singleton (some ay))] have hpre : categoryCellLabel k ⁻¹' {some ay} = {(k, finTwoEquiv ay.1, finTwoEquiv ay.2)} := by rcases ay with ⟨a₀, y₀⟩ fin_cases a₀ <;> fin_cases y₀ <;> ext z <;> rcases z with ⟨j, a, y⟩ <;> cases a <;> cases y <;> simp [categoryCellLabel, finTwoEquiv] rw [hpre] change (P.pmf.toMeasure).real {(k, finTwoEquiv ay.1, finTwoEquiv ay.2)} = _ rw [show (P.pmf.toMeasure).real {(k, finTwoEquiv ay.1, finTwoEquiv ay.2)} = (P.pmf (k, finTwoEquiv ay.1, finTwoEquiv ay.2)).toReal by exact congrArg toReal (P.pmf.toMeasure_apply_singleton _ (MeasurableSet.singleton _))] rfl
CausalSmith.Stat.DiscreteAteMinimaxLoggap.categoryCellLabel_atom_mass · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellAssembly.lean:66

Establishes the stated equality relating split Size zero eq.

Formal statement
n :
splitSize n 0 = n / 2
Proof (Lean source)
lemma splitSize_zero_eq (n : ℕ) : splitSize n 0 = n / 2 := by simp [splitSize, splitIndices, Fin.card_filter_val_lt, Nat.min_eq_right (Nat.div_le_self n 2)]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.splitSize_zero_eq · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellAssembly.lean:90

Establishes the stated equality relating split Size one eq.

Formal statement
n :
splitSize n 1 = n - n / 2
Proof (Lean source)
lemma splitSize_one_eq (n : ℕ) : splitSize n 1 = n - n / 2 := by unfold splitSize splitIndices simp only [show (1 : Fin 2) ≠ 0 by decide, if_false] have hpartition := Finset.card_filter_add_card_filter_not (s := (Finset.univ : Finset (Fin n))) (p := fun i => i.1 < n / 2) have hfirst : ((Finset.univ : Finset (Fin n)).filter (fun i => i.1 < n / 2)).card = n / 2 := by simpa [Fin.card_filter_val_lt, Nat.min_eq_right (Nat.div_le_self n 2)] have hsum : n / 2 + ((Finset.univ : Finset (Fin n)).filter (fun i => n / 2 ≤ i.1)).card = n := by simpa only [not_lt, hfirst, Finset.card_univ, Fintype.card_fin] using hpartition omega
CausalSmith.Stat.DiscreteAteMinimaxLoggap.splitSize_one_eq · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellAssembly.lean:96

Defines estimation Tail Index, the stated quantity or construction used in the discrete average-treatment-effect estimator.

Definition (Lean source)
def estimationTailIndex (n : ℕ) (j : Fin (splitSize n 1)) : Fin n := ⟨n / 2 + j, by have hhalf : n / 2 ≤ n := Nat.div_le_self n 2 have hdecomp : n / 2 + (n - n / 2) = n := Nat.add_sub_of_le hhalf have hj : j.1 < n - n / 2 := by simpa [splitSize_one_eq] using j.2 omega⟩
CausalSmith.Stat.DiscreteAteMinimaxLoggap.estimationTailIndex · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellAssembly.lean:111
theorem splitCellCount_eq_tail_count

Establishes the stated equality relating split Cell Count eq tail count.

Formal statement
n d :
sample :
Fin n → Obs d
k :
Fin d
a y :
Fin 2
splitCellCount sample 1 k a y
= ((Finset.univ : Finset (Fin (splitSize n 1))).filter (fun j => sample (estimationTailIndex n j) = (k, finTwoEquiv a, finTwoEquiv y))).card
Proof (Lean source)
lemma splitCellCount_eq_tail_count {n d : ℕ} (sample : Fin n → Obs d) (k : Fin d) (a y : Fin 2) : splitCellCount sample 1 k a y = ((Finset.univ : Finset (Fin (splitSize n 1))).filter (fun j => sample (estimationTailIndex n j) = (k, finTwoEquiv a, finTwoEquiv y))).card := by classical let atom : Obs d := (k, finTwoEquiv a, finTwoEquiv y) let s : Finset (Fin n) := (splitIndices n 1).filter (fun i => sample i = atom) let t : Finset (Fin (splitSize n 1)) := Finset.univ.filter (fun j => sample (estimationTailIndex n j) = atom) have hcard : s.card = t.card := by refine Finset.card_bij (s := s) (t := t) (fun i hi => (⟨i.1 - n / 2, by have hi' := hi simp only [s, mem_filter] at hi' have hiSplit : n / 2 ≤ i.1 := by simpa [splitIndices] using hi'.1 rw [splitSize_one_eq] omega⟩ : Fin (splitSize n 1))) ?_ ?_ ?_ · intro i hi have hi' := hi simp only [s, mem_filter] at hi' have hiSplit : n / 2 ≤ i.1 := by simpa [splitIndices] using hi'.1 simp only [t, mem_filter, Finset.mem_univ, true_and] simpa [estimationTailIndex, Nat.add_sub_of_le hiSplit] using hi'.2 · intro i hi j hj hij have hi' := hi have hj' := hj simp only [s, mem_filter] at hi' hj' have hiSplit : n / 2 ≤ i.1 := by simpa [splitIndices] using hi'.1 have hjSplit : n / 2 ≤ j.1 := by simpa [splitIndices] using hj'.1 have hij' := congrArg val hij apply Fin.ext dsimp at hij' omega · intro j hj refine ⟨estimationTailIndex n j, ?_, ?_⟩ · simp only [s, mem_filter] constructor · simp [estimationTailIndex, splitIndices] · simpa [t] using hj · apply Fin.ext dsimp [estimationTailIndex] omega simpa [s, t, atom, splitCellCount] using hcard
CausalSmith.Stat.DiscreteAteMinimaxLoggap.splitCellCount_eq_tail_count · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellAssembly.lean:121
theorem categoryCellLabel_fiber_card

Establishes the stated property of category Cell Label fiber card in the discrete average-treatment-effect construction.

Formal statement
n d :
sample :
Fin n → Obs d
k :
Fin d
ay :
card (PatternFiber (fun j : Fin (splitSize n 1) => categoryCellLabel k (sample (estimationTailIndex n j))) (some ay))
= splitCellCount sample 1 k ay.1 ay.2
Proof (Lean source)
lemma categoryCellLabel_fiber_card {n d : ℕ} (sample : Fin n → Obs d) (k : Fin d) (ay : Cell) : card (PatternFiber (fun j : Fin (splitSize n 1) => categoryCellLabel k (sample (estimationTailIndex n j))) (some ay)) = splitCellCount sample 1 k ay.1 ay.2 := by classical rw [Fintype.card_of_subtype ((Finset.univ : Finset (Fin (splitSize n 1))).filter (fun j => categoryCellLabel k (sample (estimationTailIndex n j)) = some ay))] · rw [splitCellCount_eq_tail_count] congr 1 ext j simp only [mem_filter, Finset.mem_univ, true_and] rcases ay with ⟨a, y⟩ fin_cases a <;> fin_cases y <;> generalize hobs : sample (estimationTailIndex n j) = z <;> rcases z with ⟨l, a', y'⟩ <;> cases a' <;> cases y' <;> simp [categoryCellLabel, finTwoEquiv] at hobs ⊢ <;> simpa [hobs] · intro j simp
CausalSmith.Stat.DiscreteAteMinimaxLoggap.categoryCellLabel_fiber_card · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellAssembly.lean:176
def estimationLabelSample

Defines estimation Label Sample, the stated quantity or construction used in the discrete average-treatment-effect estimator.

Definition (Lean source)
def estimationLabelSample {n d : ℕ} (sample : Fin n → Obs d) (k : Fin d) : Fin (splitSize n 1) → Option Cell := fun j => categoryCellLabel k (sample (estimationTailIndex n j))
CausalSmith.Stat.DiscreteAteMinimaxLoggap.estimationLabelSample · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellAssembly.lean:201
theorem multinomialFactorialCount_estimationLabelSample

Establishes the stated upper bound for multinomial Factorial Count estimation Label Sample.

Formal statement
n d :
sample :
Fin n → Obs d
k :
Fin d
= ∏ ay : Cell, ((splitCellCount sample 1 k ay.1 ay.2).descFactorial (r ay) : ℝ)
Proof (Lean source)
lemma multinomialFactorialCount_estimationLabelSample {n d : ℕ} (sample : Fin n → Obs d) (k : Fin d) (r : MultiIndex) : multinomialFactorialCount (optionCellExponent r) (estimationLabelSample sample k) = ∏ ay : Cell, ((splitCellCount sample 1 k ay.1 ay.2).descFactorial (r ay) : ℝ) := by rw [multinomialFactorialCount_eq_prod] simp only [Fintype.prod_option, optionCellExponent, Nat.descFactorial_zero, cast_one, one_mul] apply Finset.prod_congr rfl intro ay _hay change ((card (PatternFiber (fun j : Fin (splitSize n 1) => categoryCellLabel k (sample (estimationTailIndex n j))) (some ay))).descFactorial (r ay) : ℝ) = _ rw [categoryCellLabel_fiber_card]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.multinomialFactorialCount_estimationLabelSample · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellAssembly.lean:207
theorem factorialMonomial_eq_normalized_multinomialCount

Establishes the stated equality relating factorial Monomial eq normalized multinomial Count.

Formal statement
n d :
sample :
Fin n → Obs d
k :
Fin d
Proof (Lean source)
CausalSmith.Stat.DiscreteAteMinimaxLoggap.factorialMonomial_eq_normalized_multinomialCount · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellAssembly.lean:226
def lightCellEstimationIID

Defines light Cell Estimation IID, the stated quantity or construction used in the discrete average-treatment-effect estimator.

Definition (Lean source)
noncomputable def lightCellEstimationIID {d : ℕ} (P : DiscreteLaw d) (k : Fin d) (offset : ℕ) : IIDSample (ℕ → Obs d) (Option Cell) (Measure.infinitePi (fun _ : ℕ => obsLaw P)) ((obsLaw P).map (categoryCellLabel k)) := iidSampleMap (iidSampleShift (iidSample_infinitePi (obsLaw P)) offset) (categoryCellLabel k) (categoryCellLabel_measurable k)
CausalSmith.Stat.DiscreteAteMinimaxLoggap.lightCellEstimationIID · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellAssembly.lean:239
theorem factorialMonomial_trunc_eq_iidCount

Establishes the stated equality relating factorial Monomial trunc eq iid Count.

Formal statement
n d :
P :
k :
Fin d
ω :
ℕ → Obs d
factorialMonomial (fun i : Fin n => ω i) k r
Proof (Lean source)
lemma factorialMonomial_trunc_eq_iidCount {n d : ℕ} (P : DiscreteLaw d) (k : Fin d) (r : MultiIndex) (ω : ℕ → Obs d) : factorialMonomial (fun i : Fin n => ω i) k r = multinomialFactorialCount (optionCellExponent r) (fun j : Fin (splitSize n 1) => (lightCellEstimationIID P k (n / 2)).Z j ω) / ((splitSize n 1).descFactorial (exponentDegree (optionCellExponent r)) : ℝ) := by rw [factorialMonomial_eq_normalized_multinomialCount] congr 2
CausalSmith.Stat.DiscreteAteMinimaxLoggap.factorialMonomial_trunc_eq_iidCount · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellAssembly.lean:250
theorem integrable_factorialMonomial_trunc

Shows that integrable factorial Monomial trunc is integrable under the stated sampling distribution.

Formal statement
n d :
P :
k :
Fin d
Integrable (fun ω : ℕ → Obs d => factorialMonomial (fun i : Fin n => ω i) k r) (Measure.infinitePi (fun _ : ℕ => obsLaw P))
Proof (Lean source)
lemma integrable_factorialMonomial_trunc {n d : ℕ} (P : DiscreteLaw d) (k : Fin d) (r : MultiIndex) : Integrable (fun ω : ℕ → Obs d => factorialMonomial (fun i : Fin n => ω i) k r) (Measure.infinitePi (fun _ : ℕ => obsLaw P)) := by letI : IsProbabilityMeasure ((obsLaw P).map (categoryCellLabel k)) := Measure.isProbabilityMeasure_map (categoryCellLabel_measurable k).aemeasurable simp_rw [factorialMonomial_trunc_eq_iidCount P k r] exact (integrable_multinomialFactorialCount_sample (lightCellEstimationIID P k (n / 2)) (optionCellExponent r) (splitSize n 1)).div_const _
CausalSmith.Stat.DiscreteAteMinimaxLoggap.integrable_factorialMonomial_trunc · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellAssembly.lean:263
theorem integral_factorialMonomial_trunc

Evaluates or bounds the stated integral involving integral factorial Monomial trunc.

Formal statement
n d :
P :
k :
Fin d
hdeg :
∫ ω : ℕ → Obs d, factorialMonomial (fun i : Fin n => ω i) k r ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P))
= r.prod fun ay e => (cellVector P k ay) ^ e
Proof (Lean source)
lemma integral_factorialMonomial_trunc {n d : ℕ} (P : DiscreteLaw d) (k : Fin d) (r : MultiIndex) (hdeg : multiDegree r ≤ splitSize n 1) : ∫ ω : ℕ → Obs d, factorialMonomial (fun i : Fin n => ω i) k r ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P)) = r.prod fun ay e => (cellVector P k ay) ^ e := by letI : IsProbabilityMeasure ((obsLaw P).map (categoryCellLabel k)) := Measure.isProbabilityMeasure_map (categoryCellLabel_measurable k).aemeasurable simp_rw [factorialMonomial_trunc_eq_iidCount P k r] rw [integral_div, integral_multinomialFactorialCount_sample] have hfacpos : 0 < (splitSize n 1).descFactorial (exponentDegree (optionCellExponent r)) := by rw [exponentDegree_optionCellExponent] exact Nat.descFactorial_pos.mpr hdeg rw [mul_div_cancel_left₀ _ (by exact_mod_cast hfacpos.ne')] simp only [Fintype.prod_option, optionCellExponent, pow_zero, one_mul] rw [r.prod_fintype _ (fun _ => pow_zero _)] apply Finset.prod_congr rfl intro ay _hay rw [categoryCellLabel_atom_mass]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.integral_factorialMonomial_trunc · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellAssembly.lean:277
theorem integral_factorialMonomial_mul_trunc_le Lemma 13 in the paper ↗

Evaluates or bounds the stated integral involving integral factorial Monomial mul trunc le.

Formal statement
n d :
P :
k :
Fin d
r s :
hn :
0 < splitSize n 1
hdeg :
multiDegree r ≤ multiDegree s
hsize :
4 * (multiDegree s) ^ 2 ≤ splitSize n 1
∫ ω : ℕ → Obs d, factorialMonomial (fun i : Fin n => ω i) k r * factorialMonomial (fun i : Fin n => ω i) k s ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P))
exp 1 * (∏ ay : Cell, (cellVector P k ay) ^ (r ay)) * ∏ ay : Cell, (cellVector P k ay + (multiDegree s : ℝ) / splitSize n 1) ^ (s ay)
Proof (Lean source)
lemma integral_factorialMonomial_mul_trunc_le {n d : ℕ} (P : DiscreteLaw d) (k : Fin d) (r s : MultiIndex) (hn : 0 < splitSize n 1) (hdeg : multiDegree r ≤ multiDegree s) (hsize : 4 * (multiDegree s) ^ 2 ≤ splitSize n 1) : ∫ ω : ℕ → Obs d, factorialMonomial (fun i : Fin n => ω i) k r * factorialMonomial (fun i : Fin n => ω i) k s ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P)) ≤ exp 1 * (∏ ay : Cell, (cellVector P k ay) ^ (r ay)) * ∏ ay : Cell, (cellVector P k ay + (multiDegree s : ℝ) / splitSize n 1) ^ (s ay) := by letI : IsProbabilityMeasure ((obsLaw P).map (categoryCellLabel k)) := Measure.isProbabilityMeasure_map (categoryCellLabel_measurable k).aemeasurable simp_rw [factorialMonomial_trunc_eq_iidCount P] have h := normalized_multinomial_joint_moment_bound (lightCellEstimationIID P k (n / 2)) (optionCellExponent r) (optionCellExponent s) (splitSize n 1) hn (by simpa only [exponentDegree_optionCellExponent] using hdeg) (by simpa only [exponentDegree_optionCellExponent] using hsize) simpa only [exponentDegree_optionCellExponent, Fintype.prod_option, optionCellExponent, pow_zero, one_mul, categoryCellLabel_atom_mass] using h
CausalSmith.Stat.DiscreteAteMinimaxLoggap.integral_factorialMonomial_mul_trunc_le · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellAssembly.lean:299
theorem integrable_factorialMonomial_mul_trunc

Shows that integrable factorial Monomial mul trunc is integrable under the stated sampling distribution.

Formal statement
n d :
P :
k :
Fin d
r s :
Integrable (fun ω : ℕ → Obs d => factorialMonomial (fun i : Fin n => ω i) k r * factorialMonomial (fun i : Fin n => ω i) k s) (Measure.infinitePi (fun _ : ℕ => obsLaw P))
Proof (Lean source)
lemma integrable_factorialMonomial_mul_trunc {n d : ℕ} (P : DiscreteLaw d) (k : Fin d) (r s : MultiIndex) : Integrable (fun ω : ℕ → Obs d => factorialMonomial (fun i : Fin n => ω i) k r * factorialMonomial (fun i : Fin n => ω i) k s) (Measure.infinitePi (fun _ : ℕ => obsLaw P)) := by letI : IsProbabilityMeasure ((obsLaw P).map (categoryCellLabel k)) := Measure.isProbabilityMeasure_map (categoryCellLabel_measurable k).aemeasurable simp_rw [factorialMonomial_trunc_eq_iidCount P k] have hraw : Integrable (fun ω : ℕ → Obs d => multinomialFactorialCount (optionCellExponent r) (fun j : Fin (splitSize n 1) => (lightCellEstimationIID P k (n / 2)).Z j ω) * multinomialFactorialCount (optionCellExponent s) (fun j : Fin (splitSize n 1) => (lightCellEstimationIID P k (n / 2)).Z j ω)) (Measure.infinitePi (fun _ : ℕ => obsLaw P)) := by simp_rw [multinomialFactorialCount_mul] apply integrable_finset_sum intro H _hH exact Integrable.const_mul (integrable_multinomialFactorialCount_sample (lightCellEstimationIID P k (n / 2)) (mergedExponent (optionCellExponent r) (optionCellExponent s) H) (splitSize n 1)) _ convert hraw.div_const (((splitSize n 1).descFactorial (exponentDegree (optionCellExponent r)) : ℝ) * (splitSize n 1).descFactorial (exponentDegree (optionCellExponent s))) using 1 funext ω ring
CausalSmith.Stat.DiscreteAteMinimaxLoggap.integrable_factorialMonomial_mul_trunc · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellAssembly.lean:324
def observationExponent

Defines observation Exponent, the stated quantity or construction used in the discrete average-treatment-effect estimator.

Definition (Lean source)
def observationExponent {d : ℕ} (k : Fin d) (r : MultiIndex) : Obs d → ℕ := fun z => if z.1 = k then r (finTwoEquiv.symm z.2.1, finTwoEquiv.symm z.2.2) else 0
CausalSmith.Stat.DiscreteAteMinimaxLoggap.observationExponent · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellAssembly.lean:359
theorem exponentDegree_observationExponent

Establishes the stated property of exponent Degree observation Exponent in the discrete average-treatment-effect construction.

Formal statement
d :
k :
Fin d
Proof (Lean source)
lemma exponentDegree_observationExponent {d : ℕ} (k : Fin d) (r : MultiIndex) : exponentDegree (observationExponent k r) = multiDegree r := by classical simp only [exponentDegree, observationExponent, Fintype.sum_prod_type] rw [Finset.sum_eq_single k] · simp [multiDegree, Finsupp.sum_fintype, Fintype.sum_bool, Fintype.sum_prod_type, Fin.sum_univ_two, finTwoEquiv] omega · intro j _hj hjk simp [hjk] · simp
CausalSmith.Stat.DiscreteAteMinimaxLoggap.exponentDegree_observationExponent · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellAssembly.lean:365
theorem estimationTail_fiber_card

Establishes the stated property of estimation Tail fiber card in the discrete average-treatment-effect construction.

Formal statement
n d :
sample :
Fin n → Obs d
z :
Obs d
card (PatternFiber (fun j : Fin (splitSize n 1) => sample (estimationTailIndex n j)) z)
= ((Finset.univ : Finset (Fin (splitSize n 1))).filter (fun j => sample (estimationTailIndex n j) = z)).card
Proof (Lean source)
lemma estimationTail_fiber_card {n d : ℕ} (sample : Fin n → Obs d) (z : Obs d) : card (PatternFiber (fun j : Fin (splitSize n 1) => sample (estimationTailIndex n j)) z) = ((Finset.univ : Finset (Fin (splitSize n 1))).filter (fun j => sample (estimationTailIndex n j) = z)).card := by classical apply Fintype.card_of_subtype intro j simp
CausalSmith.Stat.DiscreteAteMinimaxLoggap.estimationTail_fiber_card · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellAssembly.lean:379
theorem observationExponent_fiber_count

Establishes the stated property of observation Exponent fiber count in the discrete average-treatment-effect construction.

Formal statement
n d :
sample :
Fin n → Obs d
k :
Fin d
z :
Obs d
((card (PatternFiber (fun j : Fin (splitSize n 1) => sample (estimationTailIndex n j)) z)).descFactorial (observationExponent k r z) : ℝ)
= if z.1 = k then ((splitCellCount sample 1 k (finTwoEquiv.symm z.2.1) (finTwoEquiv.symm z.2.2)).descFactorial (r (finTwoEquiv.symm z.2.1, finTwoEquiv.symm z.2.2)) : ℝ) else 1
Proof (Lean source)
lemma observationExponent_fiber_count {n d : ℕ} (sample : Fin n → Obs d) (k : Fin d) (r : MultiIndex) (z : Obs d) : ((card (PatternFiber (fun j : Fin (splitSize n 1) => sample (estimationTailIndex n j)) z)).descFactorial (observationExponent k r z) : ℝ) = if z.1 = k then ((splitCellCount sample 1 k (finTwoEquiv.symm z.2.1) (finTwoEquiv.symm z.2.2)).descFactorial (r (finTwoEquiv.symm z.2.1, finTwoEquiv.symm z.2.2)) : ℝ) else 1 := by by_cases hz : z.1 = k · rw [if_pos hz] rcases z with ⟨j, a, y⟩ have hjk : j = k := hz subst j rw [observationExponent, if_pos rfl, estimationTail_fiber_card, splitCellCount_eq_tail_count] simp · rw [if_neg hz, observationExponent, if_neg hz] simp
CausalSmith.Stat.DiscreteAteMinimaxLoggap.observationExponent_fiber_count · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellAssembly.lean:391
theorem multinomialFactorialCount_observationExponent

Establishes the stated property of multinomial Factorial Count observation Exponent in the discrete average-treatment-effect construction.

Formal statement
n d :
sample :
Fin n → Obs d
k :
Fin d
= ∏ ay : Cell, ((splitCellCount sample 1 k ay.1 ay.2).descFactorial (r ay) : ℝ)
Proof (Lean source)
lemma multinomialFactorialCount_observationExponent {n d : ℕ} (sample : Fin n → Obs d) (k : Fin d) (r : MultiIndex) : multinomialFactorialCount (observationExponent k r) (fun j : Fin (splitSize n 1) => sample (estimationTailIndex n j)) = ∏ ay : Cell, ((splitCellCount sample 1 k ay.1 ay.2).descFactorial (r ay) : ℝ) := by rw [multinomialFactorialCount_eq_prod] simp_rw [observationExponent_fiber_count sample k r] classical simp only [Fintype.prod_prod_type] rw [Finset.prod_eq_single k] · simp [Fintype.prod_bool, Fin.prod_univ_two, finTwoEquiv] ring · intro j _hj hjk simp [hjk] · simp
CausalSmith.Stat.DiscreteAteMinimaxLoggap.multinomialFactorialCount_observationExponent · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellAssembly.lean:414
theorem factorialMonomial_eq_normalized_observationCount

Establishes the stated equality relating factorial Monomial eq normalized observation Count.

Formal statement
n d :
sample :
Fin n → Obs d
k :
Fin d
Proof (Lean source)
CausalSmith.Stat.DiscreteAteMinimaxLoggap.factorialMonomial_eq_normalized_observationCount · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellAssembly.lean:433
theorem factorialMonomial_trunc_eq_observationCount

Establishes the stated equality relating factorial Monomial trunc eq observation Count.

Formal statement
n d :
P :
k :
Fin d
ω :
ℕ → Obs d
factorialMonomial (fun i : Fin n => ω i) k r
Proof (Lean source)
lemma factorialMonomial_trunc_eq_observationCount {n d : ℕ} (P : DiscreteLaw d) (k : Fin d) (r : MultiIndex) (ω : ℕ → Obs d) : factorialMonomial (fun i : Fin n => ω i) k r = multinomialFactorialCount (observationExponent k r) (fun j : Fin (splitSize n 1) => (iidSampleShift (iidSample_infinitePi (obsLaw P)) (n / 2)).Z j ω) / ((splitSize n 1).descFactorial (exponentDegree (observationExponent k r)) : ℝ) := by rw [factorialMonomial_eq_normalized_observationCount] congr 2
CausalSmith.Stat.DiscreteAteMinimaxLoggap.factorialMonomial_trunc_eq_observationCount · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellAssembly.lean:446
theorem obsLaw_real_cellAtom

Establishes the stated property of obs Law real cell Atom in the discrete average-treatment-effect construction.

Formal statement
d :
P :
k :
Fin d
ay :
(obsLaw P).real {(k, finTwoEquiv ay.1, finTwoEquiv ay.2)} = cellVector P k ay
Proof (Lean source)
lemma obsLaw_real_cellAtom {d : ℕ} (P : DiscreteLaw d) (k : Fin d) (ay : Cell) : (obsLaw P).real {(k, finTwoEquiv ay.1, finTwoEquiv ay.2)} = cellVector P k ay := by change (P.pmf.toMeasure).real {(k, finTwoEquiv ay.1, finTwoEquiv ay.2)} = _ rw [show (P.pmf.toMeasure).real {(k, finTwoEquiv ay.1, finTwoEquiv ay.2)} = (P.pmf (k, finTwoEquiv ay.1, finTwoEquiv ay.2)).toReal by exact congrArg toReal (P.pmf.toMeasure_apply_singleton _ (MeasurableSet.singleton _))] rfl
CausalSmith.Stat.DiscreteAteMinimaxLoggap.obsLaw_real_cellAtom · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellAssembly.lean:460
theorem observationExponent_mass_prod

Establishes the stated property of observation Exponent mass prod in the discrete average-treatment-effect construction.

Formal statement
d :
P :
k :
Fin d
∏ z : Obs d, ((obsLaw P).real {z}) ^ (observationExponent k r z)
= ∏ ay : Cell, (cellVector P k ay) ^ (r ay)
Proof (Lean source)
lemma observationExponent_mass_prod {d : ℕ} (P : DiscreteLaw d) (k : Fin d) (r : MultiIndex) : ∏ z : Obs d, ((obsLaw P).real {z}) ^ (observationExponent k r z) = ∏ ay : Cell, (cellVector P k ay) ^ (r ay) := by classical simp only [Fintype.prod_prod_type] rw [Finset.prod_eq_single k] · simp only [observationExponent, if_pos, Fintype.prod_bool] have h00 := obsLaw_real_cellAtom P k (0, 0) have h01 := obsLaw_real_cellAtom P k (0, 1) have h10 := obsLaw_real_cellAtom P k (1, 0) have h11 := obsLaw_real_cellAtom P k (1, 1) simp [finTwoEquiv] at h00 h01 h10 h11 rw [h00, h01, h10, h11] simp [Fin.prod_univ_two, finTwoEquiv] ring · intro j _hj hjk simp [observationExponent, hjk] · simp
CausalSmith.Stat.DiscreteAteMinimaxLoggap.observationExponent_mass_prod · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellAssembly.lean:475
theorem integral_factorialMonomial_cross_trunc

Evaluates or bounds the stated integral involving integral factorial Monomial cross trunc.

Formal statement
n d :
P :
k l :
Fin d
hkl :
k ≠ l
r s :
∫ ω : ℕ → Obs d, factorialMonomial (fun i : Fin n => ω i) k r * factorialMonomial (fun i : Fin n => ω i) l s ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P))
= ((splitSize n 1).descFactorial (multiDegree r + multiDegree s) : ℝ) / (((splitSize n 1).descFactorial (multiDegree r) : ℝ) * (splitSize n 1).descFactorial (multiDegree s)) * (∏ ay : Cell, (cellVector P k ay) ^ (r ay)) * ∏ ay : Cell, (cellVector P l ay) ^ (s ay)
Proof (Lean source)
lemma integral_factorialMonomial_cross_trunc {n d : ℕ} (P : DiscreteLaw d) (k l : Fin d) (hkl : k ≠ l) (r s : MultiIndex) : ∫ ω : ℕ → Obs d, factorialMonomial (fun i : Fin n => ω i) k r * factorialMonomial (fun i : Fin n => ω i) l s ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P)) = ((splitSize n 1).descFactorial (multiDegree r + multiDegree s) : ℝ) / (((splitSize n 1).descFactorial (multiDegree r) : ℝ) * (splitSize n 1).descFactorial (multiDegree s)) * (∏ ay : Cell, (cellVector P k ay) ^ (r ay)) * ∏ ay : Cell, (cellVector P l ay) ^ (s ay) := by simp_rw [factorialMonomial_trunc_eq_observationCount P] let S := iidSampleShift (iidSample_infinitePi (obsLaw P)) (n / 2) have hdisj : ∀ (i : MultiSlot (observationExponent k r)) (j : MultiSlot (observationExponent l s)), multiPattern (observationExponent k r) i ≠ multiPattern (observationExponent l s) j := by intro i j hij have hik : i.1.1 = k := by by_contra hi have := i.2 simp [observationExponent, hi] at this exact Fin.elim0 this have hjl : j.1.1 = l := by by_contra hj have := j.2 simp [observationExponent, hj] at this exact Fin.elim0 this apply hkl have hx : i.1.1 = j.1.1 := congrArg fst hij exact hik.symm.trans (hx.trans hjl) have h := integral_normalized_matchingCount_mul_sample S (multiPattern (observationExponent k r)) (multiPattern (observationExponent l s)) (splitSize n 1) hdisj simp only [multinomialFactorialCount] at h ⊢ rw [multiSlot_card, multiSlot_card, exponentDegree_observationExponent, exponentDegree_observationExponent] at h rw [multiPattern_mass_prod, multiPattern_mass_prod, observationExponent_mass_prod, observationExponent_mass_prod] at h simpa [S, exponentDegree_observationExponent] using h
CausalSmith.Stat.DiscreteAteMinimaxLoggap.integral_factorialMonomial_cross_trunc · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellAssembly.lean:497
theorem vectorMass_cellVector

Establishes the stated property of vector Mass cell Vector in the discrete average-treatment-effect construction.

Formal statement
d :
P :
k :
Fin d
vectorMass (cellVector P k) = cellMass P k
Proof (Lean source)
lemma vectorMass_cellVector {d : ℕ} (P : DiscreteLaw d) (k : Fin d) : vectorMass (cellVector P k) = cellMass P k := by simp [vectorMass, vectorArmMass, cellVector, cellMass, armMass, finTwoEquiv] ring
CausalSmith.Stat.DiscreteAteMinimaxLoggap.vectorMass_cellVector · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellAssembly.lean:540
theorem vectorArmMass_cellVector

Establishes the stated property of vector Arm Mass cell Vector in the discrete average-treatment-effect construction.

Formal statement
d :
P :
k :
Fin d
a :
Fin 2
Proof (Lean source)
lemma vectorArmMass_cellVector {d : ℕ} (P : DiscreteLaw d) (k : Fin d) (a : Fin 2) : vectorArmMass (cellVector P k) a = armMass P k (finTwoEquiv a) := by rcases a with ⟨a, ha⟩ interval_cases a <;> simp [vectorArmMass, cellVector, armMass, finTwoEquiv] <;> ring
CausalSmith.Stat.DiscreteAteMinimaxLoggap.vectorArmMass_cellVector · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellAssembly.lean:547
theorem obsLaw_real_singleton

Establishes the stated upper bound for obs Law real singleton.

Formal statement
d :
P :
z :
Obs d
(obsLaw P).real {z} = (P.pmf z).toReal
Proof (Lean source)
lemma obsLaw_real_singleton {d : ℕ} (P : DiscreteLaw d) (z : Obs d) : (obsLaw P).real {z} = (P.pmf z).toReal := by rw [show obsLaw P = P.pmf.toMeasure by rfl] exact congrArg toReal (P.pmf.toMeasure_apply_singleton z (MeasurableSet.singleton z))
CausalSmith.Stat.DiscreteAteMinimaxLoggap.obsLaw_real_singleton · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellAssembly.lean:556
theorem obsLaw_real_atom

Establishes the stated property of obs Law real atom in the discrete average-treatment-effect construction.

Formal statement
d :
P :
k :
Fin d
a y :
Fin 2
(obsLaw P).real {(k, finTwoEquiv a, finTwoEquiv y)} = cellVector P k (a, y)
Proof (Lean source)
lemma obsLaw_real_atom {d : ℕ} (P : DiscreteLaw d) (k : Fin d) (a y : Fin 2) : (obsLaw P).real {(k, finTwoEquiv a, finTwoEquiv y)} = cellVector P k (a, y) := by simp [obsLaw_real_singleton, cellVector, jointMass]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.obsLaw_real_atom · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellAssembly.lean:564
theorem cellVector_mem_overlapCone

Shows that cell Vector mem overlap Cone lies in the stated set or interval.

Formal statement
d :
epsilon :
P :
hOverlap :
Overlap epsilon P
k :
Fin d
cellVector P k ∈ overlapCone epsilon
Proof (Lean source)
lemma cellVector_mem_overlapCone {d : ℕ} {epsilon : ℝ} (P : DiscreteLaw d) (hOverlap : Overlap epsilon P) (k : Fin d) : cellVector P k ∈ overlapCone epsilon := by refine ⟨fun ay => (jointMass_mem_unitInterval P k (finTwoEquiv ay.1) (finTwoEquiv ay.2)).1, ?_, ?_⟩ rw [vectorMass_cellVector, vectorArmMass_cellVector] by_cases hp : 0 < cellMass P k · have hk := hOverlap k hp have hk1 : epsilon ≤ armMass P k (finTwoEquiv 1) / cellMass P k := by simpa [propensity, finTwoEquiv] using hk.1 exact (le_div_iff₀ hp).mp hk1 · have hp0 : cellMass P k = 0 := le_antisymm (le_of_not_gt hp) (cellMass_mem_unitInterval P k).1 have ha0 : armMass P k true = 0 := by have ha : 0 ≤ armMass P k true := by unfold armMass exact sum_nonneg fun y _ => (jointMass_mem_unitInterval P k true y).1 have hle : armMass P k true ≤ cellMass P k := by have hfalse0 := (jointMass_mem_unitInterval P k false false).1 have hfalse1 := (jointMass_mem_unitInterval P k false true).1 simp [armMass, cellMass] linarith linarith simpa [hp0, ha0, finTwoEquiv] using (show (0 : ℝ) ≤ armMass P k true by rw [ha0]) · rw [vectorMass_cellVector, vectorArmMass_cellVector] by_cases hp : 0 < cellMass P k · have hk := hOverlap k hp have hk2 : armMass P k (finTwoEquiv 1) / cellMass P k ≤ 1 - epsilon := by simpa [propensity, finTwoEquiv] using hk.2 exact (div_le_iff₀ hp).mp hk2 · have hp0 : cellMass P k = 0 := le_antisymm (le_of_not_gt hp) (cellMass_mem_unitInterval P k).1 have ha0 : armMass P k true = 0 := by have ha : 0 ≤ armMass P k true := by unfold armMass exact sum_nonneg fun y _ => (jointMass_mem_unitInterval P k true y).1 have hle : armMass P k true ≤ cellMass P k := by have hfalse0 := (jointMass_mem_unitInterval P k false false).1 have hfalse1 := (jointMass_mem_unitInterval P k false true).1 simp [armMass, cellMass] linarith linarith simpa [hp0, ha0, finTwoEquiv]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.cellVector_mem_overlapCone · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellAssembly.lean:571
theorem abs_cellPhi_cellVector_le_mass

Establishes the stated upper bound for abs cell Phi cell Vector le mass.

Formal statement
d :
epsilon :
P :
hOverlap :
Overlap epsilon P
k :
Fin d
|cellPhi (cellVector P k)| ≤ cellMass P k
Proof (Lean source)
lemma abs_cellPhi_cellVector_le_mass {d : ℕ} {epsilon : ℝ} (P : DiscreteLaw d) (hOverlap : Overlap epsilon P) (k : Fin d) : |cellPhi (cellVector P k)| ≤ cellMass P k := by by_cases hz : cellVector P k = 0 · simp [cellPhi, hz, (cellMass_mem_unitInterval P k).1] · simp only [cellPhi, hz, if_false] rw [vectorMass_cellVector, vectorArmMass_cellVector, vectorArmMass_cellVector] have hm1 := outcomeMean_mem_unitInterval P true k have hm0 := outcomeMean_mem_unitInterval P false k have hp := cellMass_mem_unitInterval P k rcases hm1 with ⟨hm1lo, hm1hi⟩ rcases hm0 with ⟨hm0lo, hm0hi⟩ have hdiff : |outcomeMean P true k - outcomeMean P false k| ≤ 1 := by rw [abs_le] constructor <;> linarith change |cellMass P k * (outcomeMean P true k - outcomeMean P false k)| ≤ cellMass P k rw [abs_mul, abs_of_nonneg hp.1] exact mul_le_of_le_one_right hp.1 hdiff
CausalSmith.Stat.DiscreteAteMinimaxLoggap.abs_cellPhi_cellVector_le_mass · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellAssembly.lean:619
theorem multiDegree_factorialExpansionIndex Lemma multiDegree_factorialExpansionIndex in the paper ↗

Establishes the stated property of multi Degree factorial Expansion Index in the discrete average-treatment-effect construction.

Formal statement
a :
Fin 2
ay :
j t :
ht :
t ≤ j
Proof (Lean source)
lemma multiDegree_factorialExpansionIndex (a : Fin 2) (ay : Cell) (j t : ℕ) (ht : t ≤ j) : multiDegree (factorialExpansionIndex a ay j t) = j + 2 := by classical rcases ay with ⟨a', y'⟩ fin_cases a <;> fin_cases a' <;> fin_cases y' <;> simp [multiDegree, Finsupp.sum_fintype, factorialExpansionIndex, Fintype.sum_prod_type, Fin.sum_univ_two] <;> omega
CausalSmith.Stat.DiscreteAteMinimaxLoggap.multiDegree_factorialExpansionIndex · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellAssembly.lean:642
theorem factorialExpansionIndex_prod Lemma factorialExpansionIndex_prod in the paper ↗

Establishes the stated property of factorial Expansion Index prod in the discrete average-treatment-effect construction.

Formal statement
v :
Cell → ℝ
a :
Fin 2
ay :
j t :
(factorialExpansionIndex a ay j t).prod (fun ay' e => v ay' ^ e)
= v ay * v (a, 1) * v (a, 0) ^ t * v (a, 1) ^ (j - t)
Proof (Lean source)
lemma factorialExpansionIndex_prod (v : Cell → ℝ) (a : Fin 2) (ay : Cell) (j t : ℕ) : (factorialExpansionIndex a ay j t).prod (fun ay' e => v ay' ^ e) = v ay * v (a, 1) * v (a, 0) ^ t * v (a, 1) ^ (j - t) := by classical rcases ay with ⟨a', y'⟩ fin_cases a <;> fin_cases a' <;> fin_cases y' <;> simp [factorialExpansionIndex, Finsupp.prod_fintype, Fintype.prod_prod_type, Fin.prod_univ_two] <;> ring
CausalSmith.Stat.DiscreteAteMinimaxLoggap.factorialExpansionIndex_prod · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellAssembly.lean:652
theorem factorialExpansionIndex_binomial_sum Lemma factorialExpansionIndex_binomial_sum in the paper ↗

Establishes the stated summation identity or bound for factorial Expansion Index binomial sum.

Formal statement
v :
Cell → ℝ
a :
Fin 2
j :
∑ t ∈ range (j + 1), ∑ ay : Cell, (Nat.choose j t : ℝ) * (factorialExpansionIndex a ay j t).prod (fun ay' e => v ay' ^ e)
= (∑ ay : Cell, v ay) * v (a, 1) * (v (a, 0) + v (a, 1)) ^ j
Proof (Lean source)
lemma factorialExpansionIndex_binomial_sum (v : Cell → ℝ) (a : Fin 2) (j : ℕ) : ∑ t ∈ range (j + 1), ∑ ay : Cell, (Nat.choose j t : ℝ) * (factorialExpansionIndex a ay j t).prod (fun ay' e => v ay' ^ e) = (∑ ay : Cell, v ay) * v (a, 1) * (v (a, 0) + v (a, 1)) ^ j := by classical simp_rw [factorialExpansionIndex_prod] have hay (t : ℕ) : ∑ ay : Cell, (Nat.choose j t : ℝ) * (v ay * v (a, 1) * v (a, 0) ^ t * v (a, 1) ^ (j - t)) = (Nat.choose j t : ℝ) * ((∑ ay : Cell, v ay) * v (a, 1) * v (a, 0) ^ t * v (a, 1) ^ (j - t)) := by calc _ = ∑ ay : Cell, v ay * ((Nat.choose j t : ℝ) * v (a, 1) * v (a, 0) ^ t * v (a, 1) ^ (j - t)) := by apply Finset.sum_congr rfl intro ay _hay ring _ = (∑ ay : Cell, v ay) * ((Nat.choose j t : ℝ) * v (a, 1) * v (a, 0) ^ t * v (a, 1) ^ (j - t)) := by rw [Finset.sum_mul] _ = _ := by ring simp_rw [hay] rw [show ∑ t ∈ range (j + 1), (Nat.choose j t : ℝ) * ((∑ ay : Cell, v ay) * v (a, 1) * v (a, 0) ^ t * v (a, 1) ^ (j - t)) = ((∑ ay : Cell, v ay) * v (a, 1)) * ∑ t ∈ range (j + 1), v (a, 0) ^ t * v (a, 1) ^ (j - t) * (Nat.choose j t : ℝ) by rw [Finset.mul_sum] apply Finset.sum_congr rfl intro t _ht ring] rw [← add_pow]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.factorialExpansionIndex_binomial_sum · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellAssembly.lean:664
Helpers.LightCellRateAsymptotic 10 declarations
theorem cutoff_logScale_ge_240

The calibrated cutoff already forces the numerical log-scale used by the rate algebra. The apparently separate 240 hypothesis is therefore free once n is above calibrationCutoff.

Formal statement
n :
hcut :
240 ≤ logScale n
Proof (Lean source)
lemma cutoff_logScale_ge_240 {n : ℕ} (hcut : calibrationCutoff ≤ n) : 240 ≤ logScale n := by classical have hbase : cutoffProperty calibrationCutoff := by rw [calibrationCutoff] exact Nat.find_spec cutoffProperty_eventually have hscale := (hbase n hcut).1 have ha0 : 0 < alpha0 := by unfold alpha0 dA have hlog6 : 0 < log (6 : ℝ) := Real.log_pos (by norm_num) have hlog : 0 < log (27 / 4 : ℝ) := Real.log_pos (by norm_num) positivity have hlogOne : 1 < log (27 / 4 : ℝ) := by rw [← Real.exp_lt_exp] rw [Real.exp_log (by norm_num : (0 : ℝ) < 27 / 4)] nlinarith [Real.exp_one_lt_d9] have hdA : 8 < dA := by unfold dA nlinarith have haSmall : alpha0 ≤ 1 / 120 := by have haBound : alpha0 ≤ 1 / (256 * dA) := by simp [alpha0] refine haBound.trans ?_ apply (div_le_div_iff₀ (mul_pos (by norm_num) (by linarith : 0 < dA)) (by norm_num : (0 : ℝ) < 120)).2 nlinarith have hL0 : 0 ≤ logScale n := by by_contra hneg have : alpha0 * logScale n < 0 := mul_neg_of_pos_of_neg ha0 (lt_of_not_ge hneg) linarith have hup : alpha0 * logScale n ≤ (1 / 120) * logScale n := by exact mul_le_mul_of_nonneg_right haSmall hL0 nlinarith
CausalSmith.Stat.DiscreteAteMinimaxLoggap.cutoff_logScale_ge_240 · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellRateAsymptotic.lean:8
theorem calibrated_polynomial_log_growth

The single elementary growth inequality used in the rate algebra: 6^(4M) L^6 ≤ n.

Formal statement
n :
hcut :
hLlarge :
240 ≤ logScale n
(6 : ℝ) ^ (4 * polynomialDegree n) * logScale n ^ 6 ≤ n
Proof (Lean source)
lemma calibrated_polynomial_log_growth {n : ℕ} (hcut : calibrationCutoff ≤ n) (hLlarge : 240 ≤ logScale n) : (6 : ℝ) ^ (4 * polynomialDegree n) * logScale n ^ 6 ≤ n := by classical have hbase : cutoffProperty calibrationCutoff := by rw [calibrationCutoff] exact Nat.find_spec cutoffProperty_eventually have hscale := (hbase n hcut).1 have hL : 0 < logScale n := by linarith have hn : 0 < n := by by_contra hn0 have : n = 0 := Nat.eq_zero_of_not_pos hn0 subst n simp [logScale] at hL have hlogn : logScale n = 1 + log (n : ℝ) := by rw [logScale, Real.log_mul (by positivity : exp 1 ≠ 0) (by positivity : (n : ℝ) ≠ 0)] simp have ha0 : 0 < alpha0 := by unfold alpha0 dA have hlog6 : 0 < log (6 : ℝ) := Real.log_pos (by norm_num) have hlog : 0 < log (27 / 4 : ℝ) := Real.log_pos (by norm_num) positivity have hlog6 : 0 < log (6 : ℝ) := Real.log_pos (by norm_num) have haBound : alpha0 ≤ 1 / (32 * log 6) := by simp [alpha0] have hM : (polynomialDegree n : ℝ) ≤ alpha0 * logScale n := by have hfloor2 : (2 : ℤ) ≤ ⌊alpha0 * logScale n⌋ := by rw [Int.le_floor] exact_mod_cast hscale have hmax : polynomialDegree n = Int.toNat ⌊alpha0 * logScale n⌋ := by rw [polynomialDegree, max_eq_right] exact Int.toNat_le_toNat hfloor2 rw [hmax] have hfloor0 : 0 ≤ ⌊alpha0 * logScale n⌋ := le_trans (by norm_num) hfloor2 rw [show ((Int.toNat ⌊alpha0 * logScale n⌋ : ℕ) : ℝ) = ((⌊alpha0 * logScale n⌋ : ℤ) : ℝ) by exact_mod_cast Int.toNat_of_nonneg hfloor0] exact Int.floor_le _ have hdegreeExp : 4 * (polynomialDegree n : ℝ) * log 6 ≤ logScale n / 8 := by have haMul : alpha0 * log 6 ≤ 1 / 32 := by calc alpha0 * log 6 ≤ (1 / (32 * log 6)) * log 6 := by gcongr _ = 1 / 32 := by field_simp nlinarith have hlog12 : log (12 : ℝ) ≤ 11 := by exact (Real.log_le_sub_one_of_pos (by norm_num : (0 : ℝ) < 12)).trans_eq (by norm_num) have hLdiv : 0 < logScale n / 12 := by positivity have hlogL : log (logScale n) ≤ logScale n / 8 := by have hsplit : log (logScale n) = log 12 + log (logScale n / 12) := by rw [← Real.log_mul (by norm_num : (12 : ℝ) ≠ 0) (by positivity)] congr 1 field_simp rw [hsplit] have hsmall := Real.log_le_sub_one_of_pos hLdiv nlinarith have hsix : (6 : ℝ) ^ (4 * polynomialDegree n) ≤ exp (logScale n / 8) := by rw [show (6 : ℝ) ^ (4 * polynomialDegree n) = exp ((4 * polynomialDegree n : ℕ) * log 6) by rw [Real.exp_nat_mul, Real.exp_log (by norm_num : (0 : ℝ) < 6)]] exact Real.exp_le_exp.mpr (by exact_mod_cast hdegreeExp) have hLpow : logScale n ^ 6 ≤ exp (3 * logScale n / 4) := by rw [show logScale n ^ 6 = exp (6 * log (logScale n)) by calc logScale n ^ 6 = (exp (log (logScale n))) ^ 6 := by rw [Real.exp_log hL] _ = exp ((6 : ℕ) * log (logScale n)) := by rw [Real.exp_nat_mul] _ = _ := by norm_num] exact Real.exp_le_exp.mpr (by nlinarith) calc (6 : ℝ) ^ (4 * polynomialDegree n) * logScale n ^ 6 ≤ exp (logScale n / 8) * exp (3 * logScale n / 4) := by gcongr _ = exp (7 * logScale n / 8) := by rw [← Real.exp_add] congr 1 ring _ ≤ exp (logScale n - 1) := by apply Real.exp_le_exp.mpr nlinarith _ = n := by rw [hlogn] simp [Real.exp_log (by positivity : (0 : ℝ) < (n : ℝ))]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.calibrated_polynomial_log_growth · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellRateAsymptotic.lean:44
theorem eventually_light_rate_cutoff

Establishes the stated property of eventually light rate cutoff in the discrete average-treatment-effect construction.

Formal statement
∃ N : ℕ, ∀ n ≥ N, calibrationCutoff ≤ n ∧ 240 ≤ logScale n
Proof (Lean source)
lemma eventually_light_rate_cutoff : ∃ N : ℕ, ∀ n ≥ N, calibrationCutoff ≤ n ∧ 240 ≤ logScale n := by have hL : Tendsto logScale atTop atTop := by have hlog := Real.tendsto_log_atTop.comp tendsto_natCast_atTop_atTop have heq : ∀ᶠ n : ℕ in atTop, logScale n = 1 + log (n : ℝ) := by filter_upwards [Filter.eventually_gt_atTop (0 : ℕ)] with n hn rw [logScale, Real.log_mul (by positivity : exp 1 ≠ 0) (by positivity : (n : ℝ) ≠ 0)] simp exact (tendsto_const_nhds.add_atTop hlog).congr' (Filter.EventuallyEq.symm heq) have hboth : ∀ᶠ n : ℕ in atTop, calibrationCutoff ≤ n ∧ 240 ≤ logScale n := (Filter.eventually_ge_atTop calibrationCutoff).and (hL.eventually (Filter.eventually_ge_atTop 240)) rw [Filter.eventually_atTop] at hboth exact hboth
CausalSmith.Stat.DiscreteAteMinimaxLoggap.eventually_light_rate_cutoff · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellRateAsymptotic.lean:136
def lightAsymptoticRate

Defines light Asymptotic Rate, the stated quantity or construction used in the discrete average-treatment-effect estimator.

Definition (Lean source)
noncomputable def lightAsymptoticRate (n d : ℕ) : ℝ := 1 / (n : ℝ) + d ^ 2 / ((n : ℝ) ^ 2 * (log n) ^ 2)
def genuineLightSet

Defines genuine Light Set, the stated quantity or construction used in the discrete average-treatment-effect estimator.

Definition (Lean source)
noncomputable def genuineLightSet {n d : ℕ} (P : DiscreteLaw d) : Finset (Fin d) := Finset.univ.filter fun k => cellMass P k ≤ bandwidth n / 4
theorem large_calibration_bounds Lemma 7 in the paper ↗

Establishes the stated upper bound for large calibration bounds.

Formal statement
n :
hcut :
hLlarge :
240 ≤ logScale n
let L := logScale n let ell := log (n : ℝ) let M := polynomialDegree n let B := bandwidth n let m := splitSize n 1 0 < ell ∧
ell ≤ L ∧
L ≤ 2 * ell ∧
0 < m ∧
(n : ℝ) ≤ 2 * m ∧
(M : ℝ) ≤ L ∧
B ≤ 8192 * L / n ∧
((6 : ℝ) ^ (2 * M)) ^ 2 * L ^ 6 ≤ n
Proof (Lean source)
lemma large_calibration_bounds {n : ℕ} (hcut : calibrationCutoff ≤ n) (hLlarge : 240 ≤ logScale n) : let L := logScale n let ell := log (n : ℝ) let M := polynomialDegree n let B := bandwidth n let m := splitSize n 1 0 < ell ∧ ell ≤ L ∧ L ≤ 2 * ell ∧ 0 < m ∧ (n : ℝ) ≤ 2 * m ∧ (M : ℝ) ≤ L ∧ B ≤ 8192 * L / n ∧ ((6 : ℝ) ^ (2 * M)) ^ 2 * L ^ 6 ≤ n := by classical dsimp have hbase : cutoffProperty calibrationCutoff := by rw [calibrationCutoff] exact Nat.find_spec cutoffProperty_eventually have hs := (hbase n hcut).1 have hL : 0 < logScale n := by linarith have hn : 0 < n := by by_contra hn0 have : n = 0 := Nat.eq_zero_of_not_pos hn0 subst n simp [logScale] at hL have hscale : logScale n = 1 + log (n : ℝ) := by rw [logScale, Real.log_mul (by positivity : exp 1 ≠ 0) (by positivity : (n : ℝ) ≠ 0)] simp have hell : 0 < log (n : ℝ) := by rw [hscale] at hLlarge linarith have hellL : log (n : ℝ) ≤ logScale n := by rw [hscale]; linarith have hLell : logScale n ≤ 2 * log (n : ℝ) := by rw [hscale] linarith have hM2nat : 2 ≤ polynomialDegree n := by simp [polynomialDegree] have hM4nat : 4 ≤ polynomialDegree n ^ 2 := by simpa [pow_two] using Nat.mul_self_le_mul_self hM2nat have hm : 0 < splitSize n 1 := by nlinarith [(hbase n hcut).2.1] have hnm : (n : ℝ) ≤ 2 * splitSize n 1 := by have hnat : n ≤ 2 * splitSize n 1 := by rw [splitSize_one_eq] omega exact_mod_cast hnat have hM : (polynomialDegree n : ℝ) ≤ logScale n := by have ha1 : alpha0 ≤ 1 := by simp [alpha0] have hfloor2 : (2 : ℤ) ≤ ⌊alpha0 * logScale n⌋ := by rw [Int.le_floor] exact_mod_cast hs have hmax : polynomialDegree n = Int.toNat ⌊alpha0 * logScale n⌋ := by rw [polynomialDegree, max_eq_right] exact Int.toNat_le_toNat hfloor2 rw [hmax] have hfloor0 : 0 ≤ ⌊alpha0 * logScale n⌋ := le_trans (by norm_num) hfloor2 rw [show ((Int.toNat ⌊alpha0 * logScale n⌋ : ℕ) : ℝ) = ((⌊alpha0 * logScale n⌋ : ℤ) : ℝ) by exact_mod_cast Int.toNat_of_nonneg hfloor0] exact (Int.floor_le _).trans (mul_le_of_le_one_left hL.le ha1) have hB : bandwidth n ≤ 8192 * logScale n / n := by rw [bandwidth] have hnR : 0 < (n : ℝ) := by positivity have hmR : 0 < (splitSize n 1 : ℝ) := by exact_mod_cast hm rw [div_le_div_iff₀ hmR hnR] norm_num [b0] nlinarith have hg := calibrated_polynomial_log_growth hcut hLlarge have hpow : (((6 : ℝ) ^ (2 * polynomialDegree n)) ^ 2) = (6 : ℝ) ^ (4 * polynomialDegree n) := by ring rw [hpow] exact ⟨hell, hellL, hLell, hm, hnm, hM, hB, hg⟩
CausalSmith.Stat.DiscreteAteMinimaxLoggap.large_calibration_bounds · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellRateAsymptotic.lean:166
theorem diagonal_rate_algebra

Establishes the stated property of diagonal rate algebra in the discrete average-treatment-effect construction.

Formal statement
n d :
L ell G :
hn :
0 < (n : ℝ)
hellDef :
ell = log (n : ℝ)
hell :
0 < ell
hellL :
ell ≤ L
hL0 :
0 ≤ L
hG1 :
1 ≤ G
hgrowth :
G ^ 2 * L ^ 6 ≤ n
(d : ℝ) * L ^ 2 * G / (n : ℝ) ^ 2 ≤ (lightAsymptoticRate n d) / 2
Proof (Lean source)
lemma diagonal_rate_algebra {n d : ℕ} {L ell G : ℝ} (hn : 0 < (n : ℝ)) (hellDef : ell = log (n : ℝ)) (hell : 0 < ell) (hellL : ell ≤ L) (hL0 : 0 ≤ L) (hG1 : 1 ≤ G) (hgrowth : G ^ 2 * L ^ 6 ≤ n) : (d : ℝ) * L ^ 2 * G / (n : ℝ) ^ 2 ≤ (lightAsymptoticRate n d) / 2 := by have hcore : L ^ 4 * G ^ 2 * ell ^ 4 ≤ (n : ℝ) * ell ^ 2 := by have hell0 : 0 ≤ ell := hell.le have hle : L ^ 4 * G ^ 2 * ell ^ 2 ≤ G ^ 2 * L ^ 6 := by have hell2 : ell ^ 2 ≤ L ^ 2 := pow_le_pow_left₀ hell0 hellL 2 calc L ^ 4 * G ^ 2 * ell ^ 2 ≤ L ^ 4 * G ^ 2 * L ^ 2 := by gcongr _ = G ^ 2 * L ^ 6 := by ring nlinarith [mul_nonneg (Nat.cast_nonneg n) (sq_nonneg ell)] unfold lightAsymptoticRate rw [← hellDef] have hn0 : (n : ℝ) ≠ 0 := ne_of_gt hn have he0 : ell ≠ 0 := ne_of_gt hell change (d : ℝ) * L ^ 2 * G / (n : ℝ) ^ 2 ≤ (1 / (n : ℝ) + (d : ℝ) ^ 2 / ((n : ℝ) ^ 2 * ell ^ 2)) / 2 field_simp nlinarith [sq_nonneg ((d : ℝ) - L ^ 2 * G * ell ^ 2)]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.diagonal_rate_algebra · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellRateAsymptotic.lean:237
theorem cross_rate_algebra

Establishes the stated property of cross rate algebra in the discrete average-treatment-effect construction.

Formal statement
n d :
L ell G :
hn :
0 < (n : ℝ)
hellDef :
ell = log (n : ℝ)
hell :
0 < ell
hellL :
ell ≤ L
hL0 :
0 ≤ L
hG1 :
1 ≤ G
hgrowth :
G ^ 2 * L ^ 6 ≤ n
(d : ℝ) ^ 2 * L ^ 4 * G / (n : ℝ) ^ 3 ≤ lightAsymptoticRate n d
Proof (Lean source)
lemma cross_rate_algebra {n d : ℕ} {L ell G : ℝ} (hn : 0 < (n : ℝ)) (hellDef : ell = log (n : ℝ)) (hell : 0 < ell) (hellL : ell ≤ L) (hL0 : 0 ≤ L) (hG1 : 1 ≤ G) (hgrowth : G ^ 2 * L ^ 6 ≤ n) : (d : ℝ) ^ 2 * L ^ 4 * G / (n : ℝ) ^ 3 ≤ lightAsymptoticRate n d := by have hG0 : 0 ≤ G := le_trans (by norm_num) hG1 have hell0 : 0 ≤ ell := hell.le have hcore : L ^ 4 * G * ell ^ 2 ≤ n := by have he2 : ell ^ 2 ≤ L ^ 2 := pow_le_pow_left₀ hell0 hellL 2 have hGG : G ≤ G ^ 2 := by nlinarith calc L ^ 4 * G * ell ^ 2 ≤ L ^ 4 * G ^ 2 * L ^ 2 := by gcongr _ = G ^ 2 * L ^ 6 := by ring _ ≤ n := hgrowth unfold lightAsymptoticRate rw [← hellDef] have hn0 : (n : ℝ) ≠ 0 := ne_of_gt hn have he0 : ell ≠ 0 := ne_of_gt hell change (d : ℝ) ^ 2 * L ^ 4 * G / (n : ℝ) ^ 3 ≤ 1 / (n : ℝ) + (d : ℝ) ^ 2 / ((n : ℝ) ^ 2 * ell ^ 2) have hmain : (d : ℝ) ^ 2 * L ^ 4 * G / (n : ℝ) ^ 3 ≤ (d : ℝ) ^ 2 / ((n : ℝ) ^ 2 * ell ^ 2) := by apply (div_le_div_iff₀ (by positivity : 0 < (n : ℝ) ^ 3) (by positivity : 0 < (n : ℝ) ^ 2 * ell ^ 2)).2 calc (d : ℝ) ^ 2 * L ^ 4 * G * ((n : ℝ) ^ 2 * ell ^ 2) = ((d : ℝ) ^ 2 * (n : ℝ) ^ 2) * (L ^ 4 * G * ell ^ 2) := by ring _ ≤ ((d : ℝ) ^ 2 * (n : ℝ) ^ 2) * (n : ℝ) := mul_le_mul_of_nonneg_left hcore (mul_nonneg (sq_nonneg _) (sq_nonneg _)) _ = (d : ℝ) ^ 2 * (n : ℝ) ^ 3 := by ring exact hmain.trans (le_add_of_nonneg_left (by positivity))
theorem selectedGenuineLightCentered_rate

Rate-normalized version of equation (17) for the pilot-selected genuinely light cells.

Formal statement
n d :
P :
hcut :
hLlarge :
240 ≤ logScale n
∫ ω : ℕ → Obs d, selectedFixedLightCentered P (fun i : Fin n => ω i) (genuineLightSet (n := n) P) ^ 2 ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P))
≤ (4 * (exp 1 + 1) * 8192 ^ 2 + 16 * 8192 ^ 2) * lightAsymptoticRate n d
Proof (Lean source)
lemma selectedGenuineLightCentered_rate {n d : ℕ} (P : DiscreteLaw d) (hcut : calibrationCutoff ≤ n) (hLlarge : 240 ≤ logScale n) : ∫ ω : ℕ → Obs d, selectedFixedLightCentered P (fun i : Fin n => ω i) (genuineLightSet (n := n) P) ^ 2 ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P)) ≤ (4 * (exp 1 + 1) * 8192 ^ 2 + 16 * 8192 ^ 2) * lightAsymptoticRate n d := by classical let L := logScale n let ell := log (n : ℝ) let M := polynomialDegree n let B := bandwidth n let m := splitSize n 1 let G := (6 : ℝ) ^ (2 * M) rcases large_calibration_bounds hcut hLlarge with ⟨hell, hellL, hLell, hm, hnm, hM, hB, hgrowth⟩ have hnNat : 0 < n := by by_contra hn0 have : n = 0 := Nat.eq_zero_of_not_pos hn0 subst n norm_num at hell have hn : 0 < (n : ℝ) := by exact_mod_cast hnNat have hL0 : 0 ≤ L := by dsimp only [L]; linarith have hG1 : 1 ≤ G := by dsimp only [G] exact one_le_pow₀ (by norm_num) have hbase : cutoffProperty calibrationCutoff := by rw [calibrationCutoff] exact Nat.find_spec cutoffProperty_eventually have hsize := (hbase n hcut).2.1 have hshift := (hbase n hcut).2.2 have hBpos : 0 < B := by dsimp only [B] rw [bandwidth] exact div_pos (mul_pos (by norm_num [b0]) (lt_of_lt_of_le hell hellL)) (by exact_mod_cast hm) have hlight (k : Fin d) (hk : k ∈ genuineLightSet (n := n) P) : cellMass P k + 4 * (M : ℝ) / m ≤ B := by have hk' : cellMass P k ≤ B / 4 := by simpa [genuineLightSet, B] using hk have hs := hshift change 4 * (M : ℝ) / m ≤ 3 * B / 4 at hs linarith have hraw := selectedFixedLightCentered_second_moment_le P (genuineLightSet (n := n) P) hm (by simp [M, polynomialDegree]) hBpos hsize hlight have hcard : ((genuineLightSet (n := n) P).card : ℝ) ≤ d := by exact_mod_cast (calc (genuineLightSet (n := n) P).card ≤ (Finset.univ : Finset (Fin d)).card := Finset.card_le_card (Finset.subset_univ _) _ = d := Fintype.card_fin d) have hBG : (B * 6 ^ M) ^ 2 = B ^ 2 * G := by dsimp only [G] rw [mul_pow] congr 1 ring have hBsq : B ^ 2 ≤ 8192 ^ 2 * L ^ 2 / (n : ℝ) ^ 2 := by have hB0 : 0 ≤ B := hBpos.le have hrhs0 : 0 ≤ 8192 * L / (n : ℝ) := by positivity exact pow_le_pow_left₀ hB0 hB 2 |>.trans_eq (by ring) have hmInv : 1 / (m : ℝ) ≤ 2 / (n : ℝ) := by apply (div_le_div_iff₀ (by exact_mod_cast hm) hn).2 nlinarith have hdiagBase := diagonal_rate_algebra (d := d) hn rfl hell hellL hL0 hG1 hgrowth have hcrossBase := cross_rate_algebra (d := d) hn rfl hell hellL hL0 hG1 hgrowth refine hraw.trans ?_ rw [hBG] have hdiag : ((genuineLightSet (n := n) P).card : ℝ) * (8 * (exp 1 + 1)) * (B ^ 2 * G) ≤ (4 * (exp 1 + 1) * 8192 ^ 2) * lightAsymptoticRate n d := by calc ((genuineLightSet (n := n) P).card : ℝ) * (8 * (exp 1 + 1)) * (B ^ 2 * G) ≤ (d : ℝ) * (8 * (exp 1 + 1)) * ((8192 ^ 2 * L ^ 2 / (n : ℝ) ^ 2) * G) := by gcongr _ = (8 * (exp 1 + 1) * 8192 ^ 2) * ((d : ℝ) * L ^ 2 * G / (n : ℝ) ^ 2) := by ring _ ≤ (8 * (exp 1 + 1) * 8192 ^ 2) * (lightAsymptoticRate n d / 2) := by gcongr _ = _ := by ring have hcross : ((genuineLightSet (n := n) P).card : ℝ) ^ 2 * (8 * (M : ℝ) ^ 2 / m) * (B ^ 2 * G) ≤ (16 * 8192 ^ 2) * lightAsymptoticRate n d := by have hc2 : ((genuineLightSet (n := n) P).card : ℝ) ^ 2 ≤ (d : ℝ) ^ 2 := pow_le_pow_left₀ (Nat.cast_nonneg _) hcard 2 have hM2 : (M : ℝ) ^ 2 ≤ L ^ 2 := pow_le_pow_left₀ (Nat.cast_nonneg _) hM 2 calc ((genuineLightSet (n := n) P).card : ℝ) ^ 2 * (8 * (M : ℝ) ^ 2 / m) * (B ^ 2 * G) ≤ (d : ℝ) ^ 2 * (8 * L ^ 2 * (2 / (n : ℝ))) * ((8192 ^ 2 * L ^ 2 / (n : ℝ) ^ 2) * G) := by rw [div_eq_mul_inv] have hmInv' : (m : ℝ)⁻¹ ≤ 2 / (n : ℝ) := by simpa using hmInv gcongr _ = (16 * 8192 ^ 2) * ((d : ℝ) ^ 2 * L ^ 4 * G / (n : ℝ) ^ 3) := by ring _ ≤ (16 * 8192 ^ 2) * lightAsymptoticRate n d := by gcongr linarith
CausalSmith.Stat.DiscreteAteMinimaxLoggap.selectedGenuineLightCentered_rate · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellRateAsymptotic.lean:299
theorem selectedFalseLightError_rate Lemma 18 in the paper ↗

Establishes the stated upper bound for selected False Light Error rate.

Formal statement
n d :
epsilon :
P :
hOverlap :
Overlap epsilon P
hcut :
hLlarge :
240 ≤ logScale n
∫ ω : ℕ → Obs d, selectedFalseLightError P (fun i : Fin n => ω i) ^ 2 ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P))
≤ (8 * (exp 1 + 1) * 8192 ^ 2) * lightAsymptoticRate n d
Proof (Lean source)
lemma selectedFalseLightError_rate {n d : ℕ} {epsilon : ℝ} (P : DiscreteLaw d) (hOverlap : Overlap epsilon P) (hcut : calibrationCutoff ≤ n) (hLlarge : 240 ≤ logScale n) : ∫ ω : ℕ → Obs d, selectedFalseLightError P (fun i : Fin n => ω i) ^ 2 ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P)) ≤ (8 * (exp 1 + 1) * 8192 ^ 2) * lightAsymptoticRate n d := by let L := logScale n let ell := log (n : ℝ) let B := bandwidth n let G := (6 : ℝ) ^ (2 * polynomialDegree n) rcases large_calibration_bounds hcut hLlarge with ⟨hell, hellL, _hLell, _hm, _hnm, _hM, hB, hgrowth⟩ have hnNat : 0 < n := by by_contra hn0 have : n = 0 := Nat.eq_zero_of_not_pos hn0 subst n norm_num at hell have hn : 0 < (n : ℝ) := by exact_mod_cast hnNat have hL0 : 0 ≤ L := by dsimp only [L]; linarith have hL1 : 1 ≤ L := by dsimp only [L]; linarith have hG1 : 1 ≤ G := by dsimp only [G] exact one_le_pow₀ (by norm_num) have hBpos : 0 < B := by dsimp only [B] rw [bandwidth] exact div_pos (mul_pos (by norm_num [b0]) (lt_of_lt_of_le hell hellL)) (by exact_mod_cast _hm) have hBsq : B ^ 2 ≤ 8192 ^ 2 * L ^ 2 / (n : ℝ) ^ 2 := by have hrhs0 : 0 ≤ 8192 * L / (n : ℝ) := by positivity exact pow_le_pow_left₀ hBpos.le hB 2 |>.trans_eq (by ring) have hexp : exp (-49 * L) ≤ 1 / (n : ℝ) := by have hscale : L = 1 + ell := by dsimp only [L, ell] rw [logScale, Real.log_mul (by positivity : exp 1 ≠ 0) (by positivity : (n : ℝ) ≠ 0)] simp calc exp (-49 * L) ≤ exp (-L) := by apply Real.exp_le_exp.mpr nlinarith _ = (exp L)⁻¹ := by rw [Real.exp_neg] _ = (exp 1 * (n : ℝ))⁻¹ := by dsimp only [L, logScale] rw [Real.exp_log (by positivity : 0 < exp 1 * (n : ℝ))] _ ≤ 1 / (n : ℝ) := by rw [one_div] exact inv_anti₀ hn (by nlinarith [Real.exp_one_gt_d9]) have hL4 : L ^ 4 ≤ (n : ℝ) := by calc L ^ 4 ≤ L ^ 6 := pow_le_pow_right₀ hL1 (by norm_num) _ ≤ G ^ 2 * L ^ 6 := by exact le_mul_of_one_le_left (pow_nonneg hL0 6) (by nlinarith [hG1]) _ ≤ n := hgrowth have hcore : L ^ 2 * ell ^ 2 ≤ (n : ℝ) := by have he2 : ell ^ 2 ≤ L ^ 2 := pow_le_pow_left₀ hell.le hellL 2 nlinarith [sq_nonneg (L ^ 2 - ell ^ 2)] have hbase : (d : ℝ) ^ 2 * L ^ 2 / (n : ℝ) ^ 3 ≤ lightAsymptoticRate n d := by unfold lightAsymptoticRate have hmain : (d : ℝ) ^ 2 * L ^ 2 / (n : ℝ) ^ 3 ≤ (d : ℝ) ^ 2 / ((n : ℝ) ^ 2 * ell ^ 2) := by apply (div_le_div_iff₀ (by positivity : 0 < (n : ℝ) ^ 3) (by positivity : 0 < (n : ℝ) ^ 2 * ell ^ 2)).2 calc (d : ℝ) ^ 2 * L ^ 2 * ((n : ℝ) ^ 2 * ell ^ 2) = ((d : ℝ) ^ 2 * (n : ℝ) ^ 2) * (L ^ 2 * ell ^ 2) := by ring _ ≤ ((d : ℝ) ^ 2 * (n : ℝ) ^ 2) * (n : ℝ) := mul_le_mul_of_nonneg_left hcore (mul_nonneg (sq_nonneg _) (sq_nonneg _)) _ = (d : ℝ) ^ 2 * (n : ℝ) ^ 3 := by ring exact hmain.trans (le_add_of_nonneg_left (by positivity)) refine (selectedFalseLightError_second_moment_le P hOverlap hcut).trans ?_ calc (d : ℝ) ^ 2 * (8 * (exp 1 + 1) * B ^ 2 * exp (-49 * L)) ≤ (8 * (exp 1 + 1) * 8192 ^ 2) * ((d : ℝ) ^ 2 * L ^ 2 / (n : ℝ) ^ 3) := by have hc : 0 ≤ 8 * (exp 1 + 1) := by positivity calc _ ≤ (d : ℝ) ^ 2 * (8 * (exp 1 + 1) * (8192 ^ 2 * L ^ 2 / (n : ℝ) ^ 2) * (1 / (n : ℝ))) := by gcongr _ = _ := by ring _ ≤ _ := by gcongr
CausalSmith.Stat.DiscreteAteMinimaxLoggap.selectedFalseLightError_rate · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellRateAsymptotic.lean:404
Helpers.LightCellRateDeterministic 41 declarations
def sparseIndexSet

A flattened index set for one arm of the sparse factorial lift.

Definition (Lean source)
def sparseIndexSet (M : ℕ) : Finset (ℕ × ℕ × Cell) := ((range (M - 1)).product ((range M).product (Finset.univ : Finset Cell))).filter fun u => u.2.1 ≤ u.1
theorem mem_sparseIndexSet

A triple made of an outer index, an inner index and a cell belongs to the flattened sparse index set exactly when the outer index is strictly below the degree minus one and the inner index does not exceed the outer one.

Formal statement
M j t :
ay :
(j, t, ay) ∈ sparseIndexSet M ↔ j < M - 1 ∧ t < j + 1
Proof (Lean source)
lemma mem_sparseIndexSet {M j t : ℕ} {ay : Cell} : (j, t, ay) ∈ sparseIndexSet M ↔ j < M - 1 ∧ t < j + 1 := by simp [sparseIndexSet] omega
theorem filter_range_le_eq_range_succ

Selecting, from the first M whole numbers, those that do not exceed a given number below M leaves exactly the first j+1 whole numbers.

Formal statement
M j :
hj :
j < M
(range M).filter (fun t => t ≤ j) = range (j + 1)
Proof (Lean source)
lemma filter_range_le_eq_range_succ {M j : ℕ} (hj : j < M) : (range M).filter (fun t => t ≤ j) = range (j + 1) := by ext t simp omega
CausalSmith.Stat.DiscreteAteMinimaxLoggap.filter_range_le_eq_range_succ · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellRateDeterministic.lean:23
theorem sum_sparseIndexSet

Establishes the stated summation identity or bound for sum sparse Index Set.

Formal statement
M :
f :
ℕ → ℕ → Cell → ℝ
∑ u ∈ sparseIndexSet M, f u.1 u.2.1 u.2.2
= ∑ j ∈ range (M - 1), ∑ t ∈ range (j + 1), ∑ ay : Cell, f j t ay
Proof (Lean source)
lemma sum_sparseIndexSet {M : ℕ} (f : ℕ → ℕ → Cell → ℝ) : ∑ u ∈ sparseIndexSet M, f u.1 u.2.1 u.2.2 = ∑ j ∈ range (M - 1), ∑ t ∈ range (j + 1), ∑ ay : Cell, f j t ay := by classical let S := range (M - 1) let T := (range M).product (Finset.univ : Finset Cell) calc ∑ u ∈ sparseIndexSet M, f u.1 u.2.1 u.2.2 = ∑ u ∈ S.product T, if u.2.1 ≤ u.1 then f u.1 u.2.1 u.2.2 else 0 := by exact Finset.sum_filter _ _ _ = ∑ j ∈ S, ∑ v ∈ T, if v.1 ≤ j then f j v.1 v.2 else 0 := by exact Finset.sum_product S T _ _ = ∑ j ∈ S, ∑ t ∈ range M, ∑ ay : Cell, if t ≤ j then f j t ay else 0 := by apply Finset.sum_congr rfl intro j _hj exact Finset.sum_product (range M) Finset.univ _ _ = _ := by apply Finset.sum_congr rfl intro j hj calc (∑ t ∈ range M, ∑ ay : Cell, if t ≤ j then f j t ay else 0) = ∑ t ∈ (range M).filter (fun t => t ≤ j), ∑ ay : Cell, f j t ay := by rw [Finset.sum_filter] apply Finset.sum_congr rfl intro t _ht by_cases h : t ≤ j <;> simp [h] _ = _ := by rw [filter_range_le_eq_range_succ (by have := Finset.mem_range.mp hj omega)]
def sparseTerm

Defines sparse Term, the stated quantity or construction used in the discrete average-treatment-effect estimator.

Definition (Lean source)
noncomputable def sparseTerm {n d : ℕ} (sample : Fin n → Obs d) (k : Fin d) (a : Fin 2) (u : ℕ × ℕ × Cell) : ℝ := sparseCoefficient (polynomialDegree n) (bandwidth n) u.1 u.2.1 * factorialMonomial sample k (factorialExpansionIndex a u.2.2 u.1 u.2.1)
theorem sparseArmContribution_eq_sum_sparseTerm

Establishes the stated equality relating sparse Arm Contribution eq sum sparse Term.

Formal statement
n d :
sample :
Fin n → Obs d
k :
Fin d
a :
Fin 2
= ∑ u ∈ sparseIndexSet (polynomialDegree n), sparseTerm sample k a u
Proof (Lean source)
lemma sparseArmContribution_eq_sum_sparseTerm {n d : ℕ} (sample : Fin n → Obs d) (k : Fin d) (a : Fin 2) : sparseArmContribution sample k a = ∑ u ∈ sparseIndexSet (polynomialDegree n), sparseTerm sample k a u := by classical unfold sparseArmContribution sparseTerm exact (sum_sparseIndexSet (fun j t ay => sparseCoefficient (polynomialDegree n) (bandwidth n) j t * factorialMonomial sample k (factorialExpansionIndex a ay j t))).symm
CausalSmith.Stat.DiscreteAteMinimaxLoggap.sparseArmContribution_eq_sum_sparseTerm · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellRateDeterministic.lean:76
theorem sparseIndex_degree

Establishes the stated property of sparse Index degree in the discrete average-treatment-effect construction.

Formal statement
M :
u :
ℕ × ℕ × Cell
hu :
u.1 + 2 ≤ M
Proof (Lean source)
lemma sparseIndex_degree {M : ℕ} {u : ℕ × ℕ × Cell} (hu : u ∈ sparseIndexSet M) : u.1 + 2 ≤ M := by rw [mem_sparseIndexSet] at hu omega
theorem sparseIndex_inner_le

Establishes the stated upper bound for sparse Index inner le.

Formal statement
M :
u :
ℕ × ℕ × Cell
hu :
u.2.1 ≤ u.1
Proof (Lean source)
lemma sparseIndex_inner_le {M : ℕ} {u : ℕ × ℕ × Cell} (hu : u ∈ sparseIndexSet M) : u.2.1 ≤ u.1 := by rw [mem_sparseIndexSet] at hu exact Nat.lt_succ_iff.mp (by simpa only [Nat.succ_eq_add_one] using hu.2)
def sparseTermEnvelope

Defines sparse Term Envelope, the stated quantity or construction used in the discrete average-treatment-effect estimator.

Definition (Lean source)
noncomputable def sparseTermEnvelope {d : ℕ} (P : DiscreteLaw d) (k : Fin d) (M m : ℕ) (B : ℝ) (a : Fin 2) (u : ℕ × ℕ × Cell) : ℝ := |sparseCoefficient M B u.1 u.2.1| * (factorialExpansionIndex a u.2.2 u.1 u.2.1).prod (fun cy e => (cellVector P k cy + (M : ℝ) / m) ^ e)
theorem sum_sparseTermEnvelope_eq_sparseArmEnvelope

Establishes the stated equality relating sum sparse Term Envelope eq sparse Arm Envelope.

Formal statement
d M m :
B :
P :
k :
Fin d
a :
Fin 2
∑ u ∈ sparseIndexSet M, sparseTermEnvelope P k M m B a u
Proof (Lean source)
lemma sum_sparseTermEnvelope_eq_sparseArmEnvelope {d M m : ℕ} {B : ℝ} (P : DiscreteLaw d) (k : Fin d) (a : Fin 2) : ∑ u ∈ sparseIndexSet M, sparseTermEnvelope P k M m B a u = sparseArmEnvelope M B (shiftedCellVector P k M m) a := by classical unfold sparseTermEnvelope sparseArmEnvelope shiftedCellVector sparseCoefficient exact sum_sparseIndexSet (fun j t ay => |(B⁻¹ * gCoefficient M j * B⁻¹ ^ j * (Nat.choose j t : ℝ))| * (factorialExpansionIndex a ay j t).prod (fun cy e => (cellVector P k cy + (M : ℝ) / m) ^ e))
CausalSmith.Stat.DiscreteAteMinimaxLoggap.sum_sparseTermEnvelope_eq_sparseArmEnvelope · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellRateDeterministic.lean:107
theorem integrable_sparseTerm_mul

Shows that integrable sparse Term mul is integrable under the stated sampling distribution.

Formal statement
n d :
P :
k :
Fin d
a b :
Fin 2
u v :
ℕ × ℕ × Cell
Integrable (fun ω : ℕ → Obs d => sparseTerm (fun i : Fin n => ω i) k a u * sparseTerm (fun i : Fin n => ω i) k b v) (Measure.infinitePi (fun _ : ℕ => obsLaw P))
Proof (Lean source)
lemma integrable_sparseTerm_mul {n d : ℕ} (P : DiscreteLaw d) (k : Fin d) (a b : Fin 2) (u v : ℕ × ℕ × Cell) : Integrable (fun ω : ℕ → Obs d => sparseTerm (fun i : Fin n => ω i) k a u * sparseTerm (fun i : Fin n => ω i) k b v) (Measure.infinitePi (fun _ : ℕ => obsLaw P)) := by have h := integrable_factorialMonomial_mul_trunc (n := n) P k (factorialExpansionIndex a u.2.2 u.1 u.2.1) (factorialExpansionIndex b v.2.2 v.1 v.2.1) convert h.const_mul (sparseCoefficient (polynomialDegree n) (bandwidth n) u.1 u.2.1 * sparseCoefficient (polynomialDegree n) (bandwidth n) v.1 v.2.1) using 1 funext ω simp only [sparseTerm] ring
CausalSmith.Stat.DiscreteAteMinimaxLoggap.integrable_sparseTerm_mul · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellRateDeterministic.lean:119
theorem integrable_sparseTerm

Shows that integrable sparse Term is integrable under the stated sampling distribution.

Formal statement
n d :
P :
k :
Fin d
a :
Fin 2
u :
ℕ × ℕ × Cell
Integrable (fun ω : ℕ → Obs d => sparseTerm (fun i : Fin n => ω i) k a u) (Measure.infinitePi (fun _ : ℕ => obsLaw P))
Proof (Lean source)
lemma integrable_sparseTerm {n d : ℕ} (P : DiscreteLaw d) (k : Fin d) (a : Fin 2) (u : ℕ × ℕ × Cell) : Integrable (fun ω : ℕ → Obs d => sparseTerm (fun i : Fin n => ω i) k a u) (Measure.infinitePi (fun _ : ℕ => obsLaw P)) := by unfold sparseTerm exact (integrable_factorialMonomial_trunc P k _).const_mul _
theorem integral_sparseArm_sq_le

The diagonal arm bound obtained by summing the joint factorial-moment certificate over the flattened sparse polynomial.

Formal statement
n d :
P :
k :
Fin d
a :
Fin 2
hn :
0 < splitSize n 1
hsize :
4 * polynomialDegree n ^ 2 ≤ splitSize n 1
∫ ω : ℕ → Obs d, sparseArmContribution (fun i : Fin n => ω i) k a ^ 2 ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P))
Proof (Lean source)
lemma integral_sparseArm_sq_le {n d : ℕ} (P : DiscreteLaw d) (k : Fin d) (a : Fin 2) (hn : 0 < splitSize n 1) (hsize : 4 * polynomialDegree n ^ 2 ≤ splitSize n 1) : ∫ ω : ℕ → Obs d, sparseArmContribution (fun i : Fin n => ω i) k a ^ 2 ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P)) ≤ exp 1 * (sparseArmEnvelope (polynomialDegree n) (bandwidth n) (shiftedCellVector P k (polynomialDegree n) (splitSize n 1)) a) ^ 2 := by classical let S := sparseIndexSet (polynomialDegree n) let T := fun u : ℕ × ℕ × Cell => fun ω : ℕ → Obs d => sparseTerm (fun i : Fin n => ω i) k a u let E := fun u : ℕ × ℕ × Cell => sparseTermEnvelope P k (polynomialDegree n) (splitSize n 1) (bandwidth n) a u simp_rw [sparseArmContribution_eq_sum_sparseTerm] change ∫ ω, (∑ u ∈ S, T u ω) ^ 2 ∂_ ≤ _ simp_rw [pow_two, Finset.sum_mul_sum] rw [integral_finset_sum S (fun u _hu => integrable_finset_sum S (fun v _hv => integrable_sparseTerm_mul P k a a u v))] have hsum : (∑ u ∈ S, ∫ ω : ℕ → Obs d, ∑ v ∈ S, T u ω * T v ω ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P))) ≤ ∑ u ∈ S, ∑ v ∈ S, exp 1 * (E u * E v) := by apply Finset.sum_le_sum intro u hu rw [integral_finset_sum S (fun v _hv => integrable_sparseTerm_mul P k a a u v)] apply Finset.sum_le_sum intro v hv have hterm := integral_sparse_terms_mul_shift_le (M := polynomialDegree n) (B := bandwidth n) P k a a u.1 u.2.1 v.1 v.2.1 u.2.2 v.2.2 (sparseIndex_inner_le hu) (sparseIndex_inner_le hv) (sparseIndex_degree hu) (sparseIndex_degree hv) hn hsize dsimp only [T, E, sparseTerm, sparseTermEnvelope] exact hterm.trans (le_of_eq (by ring)) refine hsum.trans ?_ change (∑ u ∈ S, ∑ v ∈ S, exp 1 * (E u * E v)) ≤ _ rw [show (∑ u ∈ S, ∑ v ∈ S, exp 1 * (E u * E v)) = exp 1 * (∑ u ∈ S, E u) ^ 2 by rw [pow_two, Finset.sum_mul_sum] simp only [Finset.mul_sum] ] rw [sum_sparseTermEnvelope_eq_sparseArmEnvelope] rw [pow_two]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.integral_sparseArm_sq_le · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellRateDeterministic.lean:145
theorem sparseArmEnvelope_shifted_le

A genuinely light cell has a uniformly bounded shifted coefficient envelope. This is equation (15) followed by the exact A=6 certificate.

Formal statement
n d :
P :
k :
Fin d
a :
Fin 2
hM :
0 < polynomialDegree n
hB :
0 < bandwidth n
hmass :
cellMass P k + 4 * (polynomialDegree n : ℝ) / splitSize n 1 ≤ bandwidth n
sparseArmEnvelope (polynomialDegree n) (bandwidth n) (shiftedCellVector P k (polynomialDegree n) (splitSize n 1)) a
bandwidth n * 6 ^ polynomialDegree n
Proof (Lean source)
lemma sparseArmEnvelope_shifted_le {n d : ℕ} (P : DiscreteLaw d) (k : Fin d) (a : Fin 2) (hM : 0 < polynomialDegree n) (hB : 0 < bandwidth n) (hmass : cellMass P k + 4 * (polynomialDegree n : ℝ) / splitSize n 1 ≤ bandwidth n) : sparseArmEnvelope (polynomialDegree n) (bandwidth n) (shiftedCellVector P k (polynomialDegree n) (splitSize n 1)) a ≤ bandwidth n * 6 ^ polynomialDegree n := by apply sparseArmEnvelope_le hM hB _ (shiftedCellVector_nonneg P k (polynomialDegree n) (splitSize n 1)) rw [shiftedCellVector_sum] exact hmass
CausalSmith.Stat.DiscreteAteMinimaxLoggap.sparseArmEnvelope_shifted_le · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellRateDeterministic.lean:194
theorem sparseArmEnvelope_nonneg

The absolute-coefficient envelope of one treatment arm in the sparse factorial expansion is nonnegative whenever the four cell values it is evaluated at are nonnegative.

Formal statement
M :
B :
v :
Cell → ℝ
hv :
∀ ay, 0 ≤ v ay
a :
Fin 2
0 ≤ sparseArmEnvelope M B v a
Proof (Lean source)
lemma sparseArmEnvelope_nonneg {M : ℕ} {B : ℝ} (v : Cell → ℝ) (hv : ∀ ay, 0 ≤ v ay) (a : Fin 2) : 0 ≤ sparseArmEnvelope M B v a := by unfold sparseArmEnvelope exact sum_nonneg fun j _ => sum_nonneg fun t _ => sum_nonneg fun ay _ => mul_nonneg (abs_nonneg _) (multiMonomial_nonneg _ _ hv)
CausalSmith.Stat.DiscreteAteMinimaxLoggap.sparseArmEnvelope_nonneg · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellRateDeterministic.lean:208
theorem integral_sparseArm_sq_rate_le

Evaluates or bounds the stated integral involving integral sparse Arm sq rate le.

Formal statement
n d :
P :
k :
Fin d
a :
Fin 2
hn :
0 < splitSize n 1
hsize :
4 * polynomialDegree n ^ 2 ≤ splitSize n 1
hM :
0 < polynomialDegree n
hB :
0 < bandwidth n
hmass :
cellMass P k + 4 * (polynomialDegree n : ℝ) / splitSize n 1 ≤ bandwidth n
∫ ω : ℕ → Obs d, sparseArmContribution (fun i : Fin n => ω i) k a ^ 2 ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P))
exp 1 * (bandwidth n * 6 ^ polynomialDegree n) ^ 2
Proof (Lean source)
lemma integral_sparseArm_sq_rate_le {n d : ℕ} (P : DiscreteLaw d) (k : Fin d) (a : Fin 2) (hn : 0 < splitSize n 1) (hsize : 4 * polynomialDegree n ^ 2 ≤ splitSize n 1) (hM : 0 < polynomialDegree n) (hB : 0 < bandwidth n) (hmass : cellMass P k + 4 * (polynomialDegree n : ℝ) / splitSize n 1 ≤ bandwidth n) : ∫ ω : ℕ → Obs d, sparseArmContribution (fun i : Fin n => ω i) k a ^ 2 ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P)) ≤ exp 1 * (bandwidth n * 6 ^ polynomialDegree n) ^ 2 := by refine (integral_sparseArm_sq_le P k a hn hsize).trans ?_ apply mul_le_mul_of_nonneg_left _ (Real.exp_pos 1).le apply pow_le_pow_left₀ · unfold sparseArmEnvelope exact sum_nonneg fun j _ => sum_nonneg fun t _ => sum_nonneg fun ay _ => mul_nonneg (abs_nonneg _) (multiMonomial_nonneg _ _ (shiftedCellVector_nonneg P k (polynomialDegree n) (splitSize n 1))) · exact sparseArmEnvelope_shifted_le P k a hM hB hmass
CausalSmith.Stat.DiscreteAteMinimaxLoggap.integral_sparseArm_sq_rate_le · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellRateDeterministic.lean:218
theorem integrable_sparseArm_sq

Shows that integrable sparse Arm sq is integrable under the stated sampling distribution.

Formal statement
n d :
P :
k :
Fin d
a :
Fin 2
Integrable (fun ω : ℕ → Obs d => sparseArmContribution (fun i : Fin n => ω i) k a ^ 2) (Measure.infinitePi (fun _ : ℕ => obsLaw P))
Proof (Lean source)
lemma integrable_sparseArm_sq {n d : ℕ} (P : DiscreteLaw d) (k : Fin d) (a : Fin 2) : Integrable (fun ω : ℕ → Obs d => sparseArmContribution (fun i : Fin n => ω i) k a ^ 2) (Measure.infinitePi (fun _ : ℕ => obsLaw P)) := by classical simp_rw [sparseArmContribution_eq_sum_sparseTerm, pow_two, Finset.sum_mul_sum] exact integrable_finset_sum _ fun u _ => integrable_finset_sum _ fun v _ => integrable_sparseTerm_mul P k a a u v
CausalSmith.Stat.DiscreteAteMinimaxLoggap.integrable_sparseArm_sq · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellRateDeterministic.lean:239
theorem integrable_sparseArm

Shows that integrable sparse Arm is integrable under the stated sampling distribution.

Formal statement
n d :
P :
k :
Fin d
a :
Fin 2
Integrable (fun ω : ℕ → Obs d => sparseArmContribution (fun i : Fin n => ω i) k a) (Measure.infinitePi (fun _ : ℕ => obsLaw P))
Proof (Lean source)
lemma integrable_sparseArm {n d : ℕ} (P : DiscreteLaw d) (k : Fin d) (a : Fin 2) : Integrable (fun ω : ℕ → Obs d => sparseArmContribution (fun i : Fin n => ω i) k a) (Measure.infinitePi (fun _ : ℕ => obsLaw P)) := by classical simp_rw [sparseArmContribution_eq_sum_sparseTerm] exact integrable_finset_sum _ fun u _ => integrable_sparseTerm P k a u
theorem integrable_factorialPolynomialContribution_trunc_rate

Shows that integrable factorial Polynomial Contribution trunc rate is integrable under the stated sampling distribution.

Formal statement
n d :
P :
k :
Fin d
Integrable (fun ω : ℕ → Obs d => factorialPolynomialContribution (fun i : Fin n => ω i) k) (Measure.infinitePi (fun _ : ℕ => obsLaw P))
Proof (Lean source)
lemma integrable_factorialPolynomialContribution_trunc_rate {n d : ℕ} (P : DiscreteLaw d) (k : Fin d) : Integrable (fun ω : ℕ → Obs d => factorialPolynomialContribution (fun i : Fin n => ω i) k) (Measure.infinitePi (fun _ : ℕ => obsLaw P)) := by rw [show (fun ω : ℕ → Obs d => factorialPolynomialContribution (fun i : Fin n => ω i) k) = (fun ω => sparseArmContribution (fun i : Fin n => ω i) k 1 - sparseArmContribution (fun i : Fin n => ω i) k 0) by funext ω exact factorialPolynomialContribution_eq_sparseArms _ _] apply Integrable.sub · unfold sparseArmContribution exact integrable_finset_sum _ fun j _ => integrable_finset_sum _ fun t _ => integrable_finset_sum _ fun ay _ => (integrable_factorialMonomial_trunc P k _).const_mul _ · unfold sparseArmContribution exact integrable_finset_sum _ fun j _ => integrable_finset_sum _ fun t _ => integrable_finset_sum _ fun ay _ => (integrable_factorialMonomial_trunc P k _).const_mul _
CausalSmith.Stat.DiscreteAteMinimaxLoggap.integrable_factorialPolynomialContribution_trunc_rate · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellRateDeterministic.lean:261
theorem integrable_factorialPolynomialContribution_sq

Shows that integrable factorial Polynomial Contribution sq is integrable under the stated sampling distribution.

Formal statement
n d :
P :
k :
Fin d
Integrable (fun ω : ℕ → Obs d => factorialPolynomialContribution (fun i : Fin n => ω i) k ^ 2) (Measure.infinitePi (fun _ : ℕ => obsLaw P))
Proof (Lean source)
lemma integrable_factorialPolynomialContribution_sq {n d : ℕ} (P : DiscreteLaw d) (k : Fin d) : Integrable (fun ω : ℕ → Obs d => factorialPolynomialContribution (fun i : Fin n => ω i) k ^ 2) (Measure.infinitePi (fun _ : ℕ => obsLaw P)) := by rw [show (fun ω : ℕ → Obs d => factorialPolynomialContribution (fun i : Fin n => ω i) k ^ 2) = (fun ω => sparseArmContribution (fun i : Fin n => ω i) k 1 ^ 2 + sparseArmContribution (fun i : Fin n => ω i) k 0 ^ 2 - 2 * (sparseArmContribution (fun i : Fin n => ω i) k 1 * sparseArmContribution (fun i : Fin n => ω i) k 0)) by funext ω rw [factorialPolynomialContribution_eq_sparseArms] ring] have h10 : Integrable (fun ω : ℕ → Obs d => sparseArmContribution (fun i : Fin n => ω i) k 1 * sparseArmContribution (fun i : Fin n => ω i) k 0) (Measure.infinitePi (fun _ : ℕ => obsLaw P)) := by classical simp_rw [sparseArmContribution_eq_sum_sparseTerm, Finset.sum_mul_sum] exact integrable_finset_sum _ fun u _ => integrable_finset_sum _ fun v _ => integrable_sparseTerm_mul P k 1 0 u v exact ((integrable_sparseArm_sq P k 1).add (integrable_sparseArm_sq P k 0)).sub (h10.const_mul 2)
CausalSmith.Stat.DiscreteAteMinimaxLoggap.integrable_factorialPolynomialContribution_sq · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellRateDeterministic.lean:283
theorem integral_factorialPolynomialContribution_sq_le

Diagonal second moment of one genuinely light polynomial cell.

Formal statement
n d :
P :
k :
Fin d
hn :
0 < splitSize n 1
hsize :
4 * polynomialDegree n ^ 2 ≤ splitSize n 1
hM :
0 < polynomialDegree n
hB :
0 < bandwidth n
hmass :
cellMass P k + 4 * (polynomialDegree n : ℝ) / splitSize n 1 ≤ bandwidth n
∫ ω : ℕ → Obs d, factorialPolynomialContribution (fun i : Fin n => ω i) k ^ 2 ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P))
≤ 4 * exp 1 * (bandwidth n * 6 ^ polynomialDegree n) ^ 2
Proof (Lean source)
lemma integral_factorialPolynomialContribution_sq_le {n d : ℕ} (P : DiscreteLaw d) (k : Fin d) (hn : 0 < splitSize n 1) (hsize : 4 * polynomialDegree n ^ 2 ≤ splitSize n 1) (hM : 0 < polynomialDegree n) (hB : 0 < bandwidth n) (hmass : cellMass P k + 4 * (polynomialDegree n : ℝ) / splitSize n 1 ≤ bandwidth n) : ∫ ω : ℕ → Obs d, factorialPolynomialContribution (fun i : Fin n => ω i) k ^ 2 ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P)) ≤ 4 * exp 1 * (bandwidth n * 6 ^ polynomialDegree n) ^ 2 := by let X := fun ω : ℕ → Obs d => sparseArmContribution (fun i : Fin n => ω i) k 1 let Y := fun ω : ℕ → Obs d => sparseArmContribution (fun i : Fin n => ω i) k 0 have hpoint (ω : ℕ → Obs d) : factorialPolynomialContribution (fun i : Fin n => ω i) k ^ 2 ≤ 2 * X ω ^ 2 + 2 * Y ω ^ 2 := by rw [factorialPolynomialContribution_eq_sparseArms] dsimp only [X, Y] nlinarith [sq_nonneg (sparseArmContribution (fun i : Fin n => ω i) k 1 + sparseArmContribution (fun i : Fin n => ω i) k 0)] have hmono : ∫ ω : ℕ → Obs d, factorialPolynomialContribution (fun i : Fin n => ω i) k ^ 2 ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P)) ≤ ∫ ω : ℕ → Obs d, (2 * X ω ^ 2 + 2 * Y ω ^ 2) ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P)) := by apply integral_mono (integrable_factorialPolynomialContribution_sq P k) · exact ((integrable_sparseArm_sq P k 1).const_mul 2).add ((integrable_sparseArm_sq P k 0).const_mul 2) · exact hpoint refine hmono.trans ?_ rw [integral_add, integral_const_mul, integral_const_mul] · have h1 := integral_sparseArm_sq_rate_le P k 1 hn hsize hM hB hmass have h0 := integral_sparseArm_sq_rate_le P k 0 hn hsize hM hB hmass nlinarith · exact (integrable_sparseArm_sq P k 1).const_mul 2 · exact (integrable_sparseArm_sq P k 0).const_mul 2
CausalSmith.Stat.DiscreteAteMinimaxLoggap.integral_factorialPolynomialContribution_sq_le · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellRateDeterministic.lean:310
def sparseTermMean

Defines sparse Term Mean, the stated quantity or construction used in the discrete average-treatment-effect estimator.

Definition (Lean source)
noncomputable def sparseTermMean {d : ℕ} (P : DiscreteLaw d) (k : Fin d) (M : ℕ) (B : ℝ) (a : Fin 2) (u : ℕ × ℕ × Cell) : ℝ := sparseCoefficient M B u.1 u.2.1 * (factorialExpansionIndex a u.2.2 u.1 u.2.1).prod (fun cy e => (cellVector P k cy) ^ e)
def sparseArmMean

Defines sparse Arm Mean, the stated quantity or construction used in the discrete average-treatment-effect estimator.

Definition (Lean source)
noncomputable def sparseArmMean {d : ℕ} (P : DiscreteLaw d) (k : Fin d) (M : ℕ) (B : ℝ) (a : Fin 2) : ℝ := ∑ u ∈ sparseIndexSet M, sparseTermMean P k M B a u
def sparsePolynomialMean

Defines sparse Polynomial Mean, the stated quantity or construction used in the discrete average-treatment-effect estimator.

Definition (Lean source)
noncomputable def sparsePolynomialMean {d : ℕ} (P : DiscreteLaw d) (k : Fin d) (M : ℕ) (B : ℝ) : ℝ := sparseArmMean P k M B 1 - sparseArmMean P k M B 0
theorem integrable_factorialMonomial_cross_trunc

Shows that integrable factorial Monomial cross trunc is integrable under the stated sampling distribution.

Formal statement
n d :
P :
k l :
Fin d
r s :
Integrable (fun ω : ℕ → Obs d => factorialMonomial (fun i : Fin n => ω i) k r * factorialMonomial (fun i : Fin n => ω i) l s) (Measure.infinitePi (fun _ : ℕ => obsLaw P))
Proof (Lean source)
lemma integrable_factorialMonomial_cross_trunc {n d : ℕ} (P : DiscreteLaw d) (k l : Fin d) (r s : MultiIndex) : Integrable (fun ω : ℕ → Obs d => factorialMonomial (fun i : Fin n => ω i) k r * factorialMonomial (fun i : Fin n => ω i) l s) (Measure.infinitePi (fun _ : ℕ => obsLaw P)) := by letI : IsProbabilityMeasure (obsLaw P) := inferInstance simp_rw [factorialMonomial_trunc_eq_observationCount P] let S := iidSampleShift (iidSample_infinitePi (obsLaw P)) (n / 2) have hraw : Integrable (fun ω : ℕ → Obs d => multinomialFactorialCount (observationExponent k r) (fun j : Fin (splitSize n 1) => S.Z j ω) * multinomialFactorialCount (observationExponent l s) (fun j : Fin (splitSize n 1) => S.Z j ω)) (Measure.infinitePi (fun _ : ℕ => obsLaw P)) := by simp_rw [multinomialFactorialCount_mul] apply integrable_finset_sum intro H _hH exact Integrable.const_mul (integrable_multinomialFactorialCount_sample S (mergedExponent (observationExponent k r) (observationExponent l s) H) (splitSize n 1)) _ convert hraw.div_const (((splitSize n 1).descFactorial (exponentDegree (observationExponent k r)) : ℝ) * (splitSize n 1).descFactorial (exponentDegree (observationExponent l s))) using 1 funext ω ring
CausalSmith.Stat.DiscreteAteMinimaxLoggap.integrable_factorialMonomial_cross_trunc · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellRateDeterministic.lean:369
theorem integrable_sparseTerm_cross_mul

Shows that integrable sparse Term cross mul is integrable under the stated sampling distribution.

Formal statement
n d :
P :
k l :
Fin d
a b :
Fin 2
u v :
ℕ × ℕ × Cell
Integrable (fun ω : ℕ → Obs d => sparseTerm (fun i : Fin n => ω i) k a u * sparseTerm (fun i : Fin n => ω i) l b v) (Measure.infinitePi (fun _ : ℕ => obsLaw P))
Proof (Lean source)
lemma integrable_sparseTerm_cross_mul {n d : ℕ} (P : DiscreteLaw d) (k l : Fin d) (a b : Fin 2) (u v : ℕ × ℕ × Cell) : Integrable (fun ω : ℕ → Obs d => sparseTerm (fun i : Fin n => ω i) k a u * sparseTerm (fun i : Fin n => ω i) l b v) (Measure.infinitePi (fun _ : ℕ => obsLaw P)) := by have h := integrable_factorialMonomial_cross_trunc (n := n) P k l (factorialExpansionIndex a u.2.2 u.1 u.2.1) (factorialExpansionIndex b v.2.2 v.1 v.2.1) convert h.const_mul (sparseCoefficient (polynomialDegree n) (bandwidth n) u.1 u.2.1 * sparseCoefficient (polynomialDegree n) (bandwidth n) v.1 v.2.1) using 1 funext ω simp only [sparseTerm] ring
CausalSmith.Stat.DiscreteAteMinimaxLoggap.integrable_sparseTerm_cross_mul · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellRateDeterministic.lean:400
theorem integral_sparseTerm_eq_mean

Evaluates or bounds the stated integral involving integral sparse Term eq mean.

Formal statement
n d :
P :
k :
Fin d
a :
Fin 2
u :
ℕ × ℕ × Cell
hMle :
∫ ω : ℕ → Obs d, sparseTerm (fun i : Fin n => ω i) k a u ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P))
Proof (Lean source)
lemma integral_sparseTerm_eq_mean {n d : ℕ} (P : DiscreteLaw d) (k : Fin d) (a : Fin 2) (u : ℕ × ℕ × Cell) (hu : u ∈ sparseIndexSet (polynomialDegree n)) (hMle : polynomialDegree n ≤ splitSize n 1) : ∫ ω : ℕ → Obs d, sparseTerm (fun i : Fin n => ω i) k a u ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P)) = sparseTermMean P k (polynomialDegree n) (bandwidth n) a u := by unfold sparseTerm sparseTermMean rw [integral_const_mul, integral_factorialMonomial_trunc] have hd := sparseIndex_degree hu rw [multiDegree_factorialExpansionIndex _ _ _ _ (sparseIndex_inner_le hu)] exact hd.trans hMle
CausalSmith.Stat.DiscreteAteMinimaxLoggap.integral_sparseTerm_eq_mean · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellRateDeterministic.lean:417
theorem integral_sparseArmContribution_eq_mean

Evaluates or bounds the stated integral involving integral sparse Arm Contribution eq mean.

Formal statement
n d :
P :
k :
Fin d
a :
Fin 2
hMle :
∫ ω : ℕ → Obs d, sparseArmContribution (fun i : Fin n => ω i) k a ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P))
Proof (Lean source)
lemma integral_sparseArmContribution_eq_mean {n d : ℕ} (P : DiscreteLaw d) (k : Fin d) (a : Fin 2) (hMle : polynomialDegree n ≤ splitSize n 1) : ∫ ω : ℕ → Obs d, sparseArmContribution (fun i : Fin n => ω i) k a ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P)) = sparseArmMean P k (polynomialDegree n) (bandwidth n) a := by classical simp_rw [sparseArmContribution_eq_sum_sparseTerm] rw [ integral_finset_sum _ (fun u _hu => integrable_sparseTerm P k a u)] unfold sparseArmMean apply Finset.sum_congr rfl intro u hu exact integral_sparseTerm_eq_mean P k a u hu hMle
CausalSmith.Stat.DiscreteAteMinimaxLoggap.integral_sparseArmContribution_eq_mean · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellRateDeterministic.lean:431
theorem integral_factorialPolynomialContribution_eq_sparsePolynomialMean

Evaluates or bounds the stated integral involving integral factorial Polynomial Contribution eq sparse Polynomial Mean.

Formal statement
n d :
P :
k :
Fin d
hMle :
∫ ω : ℕ → Obs d, factorialPolynomialContribution (fun i : Fin n => ω i) k ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P))
Proof (Lean source)
lemma integral_factorialPolynomialContribution_eq_sparsePolynomialMean {n d : ℕ} (P : DiscreteLaw d) (k : Fin d) (hMle : polynomialDegree n ≤ splitSize n 1) : ∫ ω : ℕ → Obs d, factorialPolynomialContribution (fun i : Fin n => ω i) k ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P)) = sparsePolynomialMean P k (polynomialDegree n) (bandwidth n) := by rw [show (fun ω : ℕ → Obs d => factorialPolynomialContribution (fun i : Fin n => ω i) k) = (fun ω => sparseArmContribution (fun i : Fin n => ω i) k 1 - sparseArmContribution (fun i : Fin n => ω i) k 0) by funext ω exact factorialPolynomialContribution_eq_sparseArms _ _] rw [integral_sub] · rw [integral_sparseArmContribution_eq_mean P k 1 hMle, integral_sparseArmContribution_eq_mean P k 0 hMle] rfl · exact integrable_sparseArm P k 1 · exact integrable_sparseArm P k 0
CausalSmith.Stat.DiscreteAteMinimaxLoggap.integral_factorialPolynomialContribution_eq_sparsePolynomialMean · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellRateDeterministic.lean:448
theorem sparseTermMean_abs

Establishes the stated property of sparse Term Mean abs in the discrete average-treatment-effect construction.

Formal statement
d :
P :
k :
Fin d
M :
B :
a :
Fin 2
u :
ℕ × ℕ × Cell
|sparseTermMean P k M B a u|
= |sparseCoefficient M B u.1 u.2.1| * (factorialExpansionIndex a u.2.2 u.1 u.2.1).prod (fun cy e => (cellVector P k cy) ^ e)
Proof (Lean source)
lemma sparseTermMean_abs {d : ℕ} (P : DiscreteLaw d) (k : Fin d) (M : ℕ) (B : ℝ) (a : Fin 2) (u : ℕ × ℕ × Cell) : |sparseTermMean P k M B a u| = |sparseCoefficient M B u.1 u.2.1| * (factorialExpansionIndex a u.2.2 u.1 u.2.1).prod (fun cy e => (cellVector P k cy) ^ e) := by unfold sparseTermMean rw [abs_mul, abs_of_nonneg (multiMonomial_nonneg _ _ (fun cy => (cellVector_mem_unitCube P k cy).1))]
theorem sum_abs_sparseTermMean_eq_envelope

Establishes the stated equality relating sum abs sparse Term Mean eq envelope.

Formal statement
d M :
B :
P :
k :
Fin d
a :
Fin 2
∑ u ∈ sparseIndexSet M, |sparseTermMean P k M B a u|
Proof (Lean source)
lemma sum_abs_sparseTermMean_eq_envelope {d M : ℕ} {B : ℝ} (P : DiscreteLaw d) (k : Fin d) (a : Fin 2) : ∑ u ∈ sparseIndexSet M, |sparseTermMean P k M B a u| = sparseArmEnvelope M B (cellVector P k) a := by classical simp_rw [sparseTermMean_abs] unfold sparseArmEnvelope sparseCoefficient exact sum_sparseIndexSet (fun j t ay => |B⁻¹ * gCoefficient M j * B⁻¹ ^ j * (Nat.choose j t : ℝ)| * (factorialExpansionIndex a ay j t).prod (fun cy e => cellVector P k cy ^ e))
CausalSmith.Stat.DiscreteAteMinimaxLoggap.sum_abs_sparseTermMean_eq_envelope · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellRateDeterministic.lean:480
theorem sparseArmMean_abs_le_envelope

Establishes the stated upper bound for sparse Arm Mean abs le envelope.

Formal statement
d M :
B :
P :
k :
Fin d
a :
Fin 2
|sparseArmMean P k M B a| ≤ sparseArmEnvelope M B (cellVector P k) a
Proof (Lean source)
lemma sparseArmMean_abs_le_envelope {d M : ℕ} {B : ℝ} (P : DiscreteLaw d) (k : Fin d) (a : Fin 2) : |sparseArmMean P k M B a| ≤ sparseArmEnvelope M B (cellVector P k) a := by unfold sparseArmMean calc |∑ u ∈ sparseIndexSet M, sparseTermMean P k M B a u| ≤ ∑ u ∈ sparseIndexSet M, |sparseTermMean P k M B a u| := Finset.abs_sum_le_sum_abs _ _ _ = _ := sum_abs_sparseTermMean_eq_envelope P k a
CausalSmith.Stat.DiscreteAteMinimaxLoggap.sparseArmMean_abs_le_envelope · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellRateDeterministic.lean:493
theorem sparseTerm_cross_covariance_le

Establishes the stated upper bound for sparse Term cross covariance le.

Formal statement
n d :
P :
k l :
Fin d
hkl :
k ≠ l
a b :
Fin 2
u v :
ℕ × ℕ × Cell
hu :
u ∈ sparseIndexSet (polynomialDegree n)
hv :
v ∈ sparseIndexSet (polynomialDegree n)
hsize :
4 * polynomialDegree n ^ 2 ≤ splitSize n 1
|∫ ω : ℕ → Obs d, sparseTerm (fun i : Fin n => ω i) k a u * sparseTerm (fun i : Fin n => ω i) l b v ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P))
- sparseTermMean P k (polynomialDegree n) (bandwidth n) a u * sparseTermMean P l (polynomialDegree n) (bandwidth n) b v|
≤ (2 * (polynomialDegree n : ℝ) ^ 2 / splitSize n 1) * |sparseTermMean P k (polynomialDegree n) (bandwidth n) a u| * |sparseTermMean P l (polynomialDegree n) (bandwidth n) b v|
Proof (Lean source)
lemma sparseTerm_cross_covariance_le {n d : ℕ} (P : DiscreteLaw d) (k l : Fin d) (hkl : k ≠ l) (a b : Fin 2) (u v : ℕ × ℕ × Cell) (hu : u ∈ sparseIndexSet (polynomialDegree n)) (hv : v ∈ sparseIndexSet (polynomialDegree n)) (hsize : 4 * polynomialDegree n ^ 2 ≤ splitSize n 1) : |∫ ω : ℕ → Obs d, sparseTerm (fun i : Fin n => ω i) k a u * sparseTerm (fun i : Fin n => ω i) l b v ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P)) - sparseTermMean P k (polynomialDegree n) (bandwidth n) a u * sparseTermMean P l (polynomialDegree n) (bandwidth n) b v| ≤ (2 * (polynomialDegree n : ℝ) ^ 2 / splitSize n 1) * |sparseTermMean P k (polynomialDegree n) (bandwidth n) a u| * |sparseTermMean P l (polynomialDegree n) (bandwidth n) b v| := by let r := factorialExpansionIndex a u.2.2 u.1 u.2.1 let s := factorialExpansionIndex b v.2.2 v.1 v.2.1 let c := sparseCoefficient (polynomialDegree n) (bandwidth n) u.1 u.2.1 let e := sparseCoefficient (polynomialDegree n) (bandwidth n) v.1 v.2.1 let x := r.prod fun cy q => (cellVector P k cy) ^ q let y := s.prod fun cy q => (cellVector P l cy) ^ q have hr : multiDegree r ≤ polynomialDegree n := by dsimp only [r] rw [multiDegree_factorialExpansionIndex _ _ _ _ (sparseIndex_inner_le hu)] exact sparseIndex_degree hu have hs : multiDegree s ≤ polynomialDegree n := by dsimp only [s] rw [multiDegree_factorialExpansionIndex _ _ _ _ (sparseIndex_inner_le hv)] exact sparseIndex_degree hv have hcov := factorialMonomial_cross_covariance_le P k l hkl r s hr hs hsize have hx0 : 0 ≤ x := multiMonomial_nonneg r _ (fun cy => (cellVector_mem_unitCube P k cy).1) have hy0 : 0 ≤ y := multiMonomial_nonneg s _ (fun cy => (cellVector_mem_unitCube P l cy).1) rw [show (fun ω : ℕ → Obs d => sparseTerm (fun i : Fin n => ω i) k a u * sparseTerm (fun i : Fin n => ω i) l b v) = (fun ω => c * e * (factorialMonomial (fun i : Fin n => ω i) k r * factorialMonomial (fun i : Fin n => ω i) l s)) by funext ω simp only [sparseTerm, c, e, r, s] ring, integral_const_mul] change |c * e * (∫ ω : ℕ → Obs d, factorialMonomial (fun i : Fin n => ω i) k r * factorialMonomial (fun i : Fin n => ω i) l s ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P))) - (c * x) * (e * y)| ≤ _ rw [show c * e * (∫ ω : ℕ → Obs d, factorialMonomial (fun i : Fin n => ω i) k r * factorialMonomial (fun i : Fin n => ω i) l s ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P))) - (c * x) * (e * y) = c * e * ((∫ ω : ℕ → Obs d, factorialMonomial (fun i : Fin n => ω i) k r * factorialMonomial (fun i : Fin n => ω i) l s ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P))) - x * y) by ring, abs_mul] dsimp only [sparseTermMean] change |c * e| * |(∫ ω : ℕ → Obs d, factorialMonomial (fun i : Fin n => ω i) k r * factorialMonomial (fun i : Fin n => ω i) l s ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P))) - x * y| ≤ (2 * (polynomialDegree n : ℝ) ^ 2 / splitSize n 1) * |c * x| * |e * y| rw [abs_mul c e, abs_mul c x, abs_mul e y, abs_of_nonneg hx0, abs_of_nonneg hy0] calc |c| * |e| * |(∫ ω : ℕ → Obs d, factorialMonomial (fun i : Fin n => ω i) k r * factorialMonomial (fun i : Fin n => ω i) l s ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P))) - x * y| ≤ |c| * |e| * ((2 * (polynomialDegree n : ℝ) ^ 2 / splitSize n 1) * x * y) := by gcongr _ = _ := by ring
CausalSmith.Stat.DiscreteAteMinimaxLoggap.sparseTerm_cross_covariance_le · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellRateDeterministic.lean:504
theorem sparseArm_cross_covariance_le

Establishes the stated upper bound for sparse Arm cross covariance le.

Formal statement
n d :
P :
k l :
Fin d
hkl :
k ≠ l
a b :
Fin 2
hsize :
4 * polynomialDegree n ^ 2 ≤ splitSize n 1
|∫ ω : ℕ → Obs d, sparseArmContribution (fun i : Fin n => ω i) k a * sparseArmContribution (fun i : Fin n => ω i) l b ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P))
- sparseArmMean P k (polynomialDegree n) (bandwidth n) a * sparseArmMean P l (polynomialDegree n) (bandwidth n) b|
≤ (2 * (polynomialDegree n : ℝ) ^ 2 / splitSize n 1) * sparseArmEnvelope (polynomialDegree n) (bandwidth n) (cellVector P k) a * sparseArmEnvelope (polynomialDegree n) (bandwidth n) (cellVector P l) b
Proof (Lean source)
lemma sparseArm_cross_covariance_le {n d : ℕ} (P : DiscreteLaw d) (k l : Fin d) (hkl : k ≠ l) (a b : Fin 2) (hsize : 4 * polynomialDegree n ^ 2 ≤ splitSize n 1) : |∫ ω : ℕ → Obs d, sparseArmContribution (fun i : Fin n => ω i) k a * sparseArmContribution (fun i : Fin n => ω i) l b ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P)) - sparseArmMean P k (polynomialDegree n) (bandwidth n) a * sparseArmMean P l (polynomialDegree n) (bandwidth n) b| ≤ (2 * (polynomialDegree n : ℝ) ^ 2 / splitSize n 1) * sparseArmEnvelope (polynomialDegree n) (bandwidth n) (cellVector P k) a * sparseArmEnvelope (polynomialDegree n) (bandwidth n) (cellVector P l) b := by classical let S := sparseIndexSet (polynomialDegree n) simp_rw [sparseArmContribution_eq_sum_sparseTerm] simp_rw [Finset.sum_mul_sum] rw [integral_finset_sum S (fun u _ => integrable_finset_sum S (fun v _ => integrable_sparseTerm_cross_mul P k l a b u v))] simp_rw [integral_finset_sum S (fun v _ => integrable_sparseTerm_cross_mul P k l a b _ v)] unfold sparseArmMean rw [Finset.sum_mul_sum, ← Finset.sum_sub_distrib] let C := fun u v : ℕ × ℕ × Cell => ∫ ω : ℕ → Obs d, sparseTerm (fun i : Fin n => ω i) k a u * sparseTerm (fun i : Fin n => ω i) l b v ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P)) let U := fun u : ℕ × ℕ × Cell => sparseTermMean P k (polynomialDegree n) (bandwidth n) a u let V := fun v : ℕ × ℕ × Cell => sparseTermMean P l (polynomialDegree n) (bandwidth n) b v let q := 2 * (polynomialDegree n : ℝ) ^ 2 / splitSize n 1 change |∑ u ∈ S, ((∑ v ∈ S, C u v) - ∑ v ∈ S, U u * V v)| ≤ q * sparseArmEnvelope (polynomialDegree n) (bandwidth n) (cellVector P k) a * sparseArmEnvelope (polynomialDegree n) (bandwidth n) (cellVector P l) b simp_rw [← Finset.sum_sub_distrib] change |∑ u ∈ S, ∑ v ∈ S, (C u v - U u * V v)| ≤ q * sparseArmEnvelope (polynomialDegree n) (bandwidth n) (cellVector P k) a * sparseArmEnvelope (polynomialDegree n) (bandwidth n) (cellVector P l) b calc |∑ u ∈ S, ∑ v ∈ S, (C u v - U u * V v)| ≤ ∑ u ∈ S, ∑ v ∈ S, |C u v - U u * V v| := by exact Finset.abs_sum_le_sum_abs _ _ |>.trans (Finset.sum_le_sum fun u _ => Finset.abs_sum_le_sum_abs _ _) _ ≤ ∑ u ∈ S, ∑ v ∈ S, q * |U u| * |V v| := by apply Finset.sum_le_sum intro u hu apply Finset.sum_le_sum intro v hv simpa only [C, U, V, q] using sparseTerm_cross_covariance_le P k l hkl a b u v hu hv hsize _ = _ := by have hU : (∑ u ∈ S, |U u|) = sparseArmEnvelope (polynomialDegree n) (bandwidth n) (cellVector P k) a := sum_abs_sparseTermMean_eq_envelope P k a have hV : (∑ v ∈ S, |V v|) = sparseArmEnvelope (polynomialDegree n) (bandwidth n) (cellVector P l) b := sum_abs_sparseTermMean_eq_envelope P l b calc (∑ u ∈ S, ∑ v ∈ S, q * |U u| * |V v|) = ∑ u ∈ S, q * |U u| * (∑ v ∈ S, |V v|) := by apply Finset.sum_congr rfl intro u hu exact (Finset.mul_sum (s := S) (f := fun v => |V v|) (q * |U u|)).symm _ = (∑ u ∈ S, q * |U u|) * (∑ v ∈ S, |V v|) := by exact (Finset.sum_mul (s := S) (f := fun u => q * |U u|) (∑ v ∈ S, |V v|)).symm _ = q * (∑ u ∈ S, |U u|) * (∑ v ∈ S, |V v|) := by congr 1 exact (Finset.mul_sum (s := S) (f := fun u => |U u|) q).symm _ = _ := by rw [hU, hV]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.sparseArm_cross_covariance_le · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellRateDeterministic.lean:586
theorem integrable_sparseArm_cross_mul

Shows that integrable sparse Arm cross mul is integrable under the stated sampling distribution.

Formal statement
n d :
P :
k l :
Fin d
a b :
Fin 2
Integrable (fun ω : ℕ → Obs d => sparseArmContribution (fun i : Fin n => ω i) k a * sparseArmContribution (fun i : Fin n => ω i) l b) (Measure.infinitePi (fun _ : ℕ => obsLaw P))
Proof (Lean source)
lemma integrable_sparseArm_cross_mul {n d : ℕ} (P : DiscreteLaw d) (k l : Fin d) (a b : Fin 2) : Integrable (fun ω : ℕ → Obs d => sparseArmContribution (fun i : Fin n => ω i) k a * sparseArmContribution (fun i : Fin n => ω i) l b) (Measure.infinitePi (fun _ : ℕ => obsLaw P)) := by classical simp_rw [sparseArmContribution_eq_sum_sparseTerm, Finset.sum_mul_sum] exact integrable_finset_sum _ fun u _ => integrable_finset_sum _ fun v _ => integrable_sparseTerm_cross_mul P k l a b u v
CausalSmith.Stat.DiscreteAteMinimaxLoggap.integrable_sparseArm_cross_mul · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellRateDeterministic.lean:663
theorem factorialPolynomial_cross_covariance_decompose

Establishes the stated property of factorial Polynomial cross covariance decompose in the discrete average-treatment-effect construction.

Formal statement
n d :
P :
k l :
Fin d
(∫ ω : ℕ → Obs d, factorialPolynomialContribution (fun i : Fin n => ω i) k * factorialPolynomialContribution (fun i : Fin n => ω i) l ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P)))
= ((∫ ω : ℕ → Obs d, sparseArmContribution (fun i : Fin n => ω i) k 1 * sparseArmContribution (fun i : Fin n => ω i) l 1 ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P))) - sparseArmMean P k (polynomialDegree n) (bandwidth n) 1 * sparseArmMean P l (polynomialDegree n) (bandwidth n) 1)
- ((∫ ω : ℕ → Obs d, sparseArmContribution (fun i : Fin n => ω i) k 1 * sparseArmContribution (fun i : Fin n => ω i) l 0 ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P))) - sparseArmMean P k (polynomialDegree n) (bandwidth n) 1 * sparseArmMean P l (polynomialDegree n) (bandwidth n) 0)
- ((∫ ω : ℕ → Obs d, sparseArmContribution (fun i : Fin n => ω i) k 0 * sparseArmContribution (fun i : Fin n => ω i) l 1 ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P))) - sparseArmMean P k (polynomialDegree n) (bandwidth n) 0 * sparseArmMean P l (polynomialDegree n) (bandwidth n) 1)
+ ((∫ ω : ℕ → Obs d, sparseArmContribution (fun i : Fin n => ω i) k 0 * sparseArmContribution (fun i : Fin n => ω i) l 0 ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P))) - sparseArmMean P k (polynomialDegree n) (bandwidth n) 0 * sparseArmMean P l (polynomialDegree n) (bandwidth n) 0)
Proof (Lean source)
lemma factorialPolynomial_cross_covariance_decompose {n d : ℕ} (P : DiscreteLaw d) (k l : Fin d) : (∫ ω : ℕ → Obs d, factorialPolynomialContribution (fun i : Fin n => ω i) k * factorialPolynomialContribution (fun i : Fin n => ω i) l ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P))) - sparsePolynomialMean P k (polynomialDegree n) (bandwidth n) * sparsePolynomialMean P l (polynomialDegree n) (bandwidth n) = ((∫ ω : ℕ → Obs d, sparseArmContribution (fun i : Fin n => ω i) k 1 * sparseArmContribution (fun i : Fin n => ω i) l 1 ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P))) - sparseArmMean P k (polynomialDegree n) (bandwidth n) 1 * sparseArmMean P l (polynomialDegree n) (bandwidth n) 1) - ((∫ ω : ℕ → Obs d, sparseArmContribution (fun i : Fin n => ω i) k 1 * sparseArmContribution (fun i : Fin n => ω i) l 0 ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P))) - sparseArmMean P k (polynomialDegree n) (bandwidth n) 1 * sparseArmMean P l (polynomialDegree n) (bandwidth n) 0) - ((∫ ω : ℕ → Obs d, sparseArmContribution (fun i : Fin n => ω i) k 0 * sparseArmContribution (fun i : Fin n => ω i) l 1 ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P))) - sparseArmMean P k (polynomialDegree n) (bandwidth n) 0 * sparseArmMean P l (polynomialDegree n) (bandwidth n) 1) + ((∫ ω : ℕ → Obs d, sparseArmContribution (fun i : Fin n => ω i) k 0 * sparseArmContribution (fun i : Fin n => ω i) l 0 ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P))) - sparseArmMean P k (polynomialDegree n) (bandwidth n) 0 * sparseArmMean P l (polynomialDegree n) (bandwidth n) 0) := by simp_rw [factorialPolynomialContribution_eq_sparseArms] rw [show (fun ω : ℕ → Obs d => (sparseArmContribution (fun i : Fin n => ω i) k 1 - sparseArmContribution (fun i : Fin n => ω i) k 0) * (sparseArmContribution (fun i : Fin n => ω i) l 1 - sparseArmContribution (fun i : Fin n => ω i) l 0)) = (fun ω => sparseArmContribution (fun i : Fin n => ω i) k 1 * sparseArmContribution (fun i : Fin n => ω i) l 1 - sparseArmContribution (fun i : Fin n => ω i) k 1 * sparseArmContribution (fun i : Fin n => ω i) l 0 - sparseArmContribution (fun i : Fin n => ω i) k 0 * sparseArmContribution (fun i : Fin n => ω i) l 1 + sparseArmContribution (fun i : Fin n => ω i) k 0 * sparseArmContribution (fun i : Fin n => ω i) l 0) by funext ω ring] have h11 := integrable_sparseArm_cross_mul (n := n) P k l 1 1 have h10 := integrable_sparseArm_cross_mul (n := n) P k l 1 0 have h01 := integrable_sparseArm_cross_mul (n := n) P k l 0 1 have h00 := integrable_sparseArm_cross_mul (n := n) P k l 0 0 have hi : (∫ ω : ℕ → Obs d, sparseArmContribution (fun i : Fin n => ω i) k 1 * sparseArmContribution (fun i : Fin n => ω i) l 1 - sparseArmContribution (fun i : Fin n => ω i) k 1 * sparseArmContribution (fun i : Fin n => ω i) l 0 - sparseArmContribution (fun i : Fin n => ω i) k 0 * sparseArmContribution (fun i : Fin n => ω i) l 1 + sparseArmContribution (fun i : Fin n => ω i) k 0 * sparseArmContribution (fun i : Fin n => ω i) l 0 ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P))) = (∫ ω, sparseArmContribution (fun i : Fin n => ω i) k 1 * sparseArmContribution (fun i : Fin n => ω i) l 1 ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P))) - (∫ ω, sparseArmContribution (fun i : Fin n => ω i) k 1 * sparseArmContribution (fun i : Fin n => ω i) l 0 ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P))) - (∫ ω, sparseArmContribution (fun i : Fin n => ω i) k 0 * sparseArmContribution (fun i : Fin n => ω i) l 1 ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P))) + (∫ ω, sparseArmContribution (fun i : Fin n => ω i) k 0 * sparseArmContribution (fun i : Fin n => ω i) l 0 ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P))) := by calc _ = (∫ ω, sparseArmContribution (fun i : Fin n => ω i) k 1 * sparseArmContribution (fun i : Fin n => ω i) l 1 - sparseArmContribution (fun i : Fin n => ω i) k 1 * sparseArmContribution (fun i : Fin n => ω i) l 0 - sparseArmContribution (fun i : Fin n => ω i) k 0 * sparseArmContribution (fun i : Fin n => ω i) l 1 ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P))) + (∫ ω, sparseArmContribution (fun i : Fin n => ω i) k 0 * sparseArmContribution (fun i : Fin n => ω i) l 0 ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P))) := by simpa only [Pi.add_apply, Pi.sub_apply] using integral_add ((h11.sub h10).sub h01) h00 _ = _ := by congr 1 calc (∫ ω, sparseArmContribution (fun i : Fin n => ω i) k 1 * sparseArmContribution (fun i : Fin n => ω i) l 1 - sparseArmContribution (fun i : Fin n => ω i) k 1 * sparseArmContribution (fun i : Fin n => ω i) l 0 - sparseArmContribution (fun i : Fin n => ω i) k 0 * sparseArmContribution (fun i : Fin n => ω i) l 1 ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P))) = (∫ ω, sparseArmContribution (fun i : Fin n => ω i) k 1 * sparseArmContribution (fun i : Fin n => ω i) l 1 - sparseArmContribution (fun i : Fin n => ω i) k 1 * sparseArmContribution (fun i : Fin n => ω i) l 0 ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P))) - (∫ ω, sparseArmContribution (fun i : Fin n => ω i) k 0 * sparseArmContribution (fun i : Fin n => ω i) l 1 ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P))) := by simpa only [Pi.sub_apply] using integral_sub (h11.sub h10) h01 _ = _ := by rw [show (∫ ω, sparseArmContribution (fun i : Fin n => ω i) k 1 * sparseArmContribution (fun i : Fin n => ω i) l 1 - sparseArmContribution (fun i : Fin n => ω i) k 1 * sparseArmContribution (fun i : Fin n => ω i) l 0 ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P))) = (∫ ω, sparseArmContribution (fun i : Fin n => ω i) k 1 * sparseArmContribution (fun i : Fin n => ω i) l 1 ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P))) - (∫ ω, sparseArmContribution (fun i : Fin n => ω i) k 1 * sparseArmContribution (fun i : Fin n => ω i) l 0 ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P))) by simpa only [Pi.sub_apply] using integral_sub h11 h10] rw [hi] unfold sparsePolynomialMean ring
CausalSmith.Stat.DiscreteAteMinimaxLoggap.factorialPolynomial_cross_covariance_decompose · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellRateDeterministic.lean:676
theorem factorialPolynomial_cross_covariance_le

Equation (16): covariance between distinct light categories, with all normalization constants explicit.

Formal statement
n d :
P :
k l :
Fin d
hkl :
k ≠ l
hM :
0 < polynomialDegree n
hB :
0 < bandwidth n
hsize :
4 * polynomialDegree n ^ 2 ≤ splitSize n 1
hk :
cellMass P k ≤ bandwidth n
hl :
cellMass P l ≤ bandwidth n
|(∫ ω : ℕ → Obs d, factorialPolynomialContribution (fun i : Fin n => ω i) k * factorialPolynomialContribution (fun i : Fin n => ω i) l ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P)))
- sparsePolynomialMean P k (polynomialDegree n) (bandwidth n) * sparsePolynomialMean P l (polynomialDegree n) (bandwidth n)|
≤ 8 * (polynomialDegree n : ℝ) ^ 2 / splitSize n 1 * (bandwidth n * 6 ^ polynomialDegree n) ^ 2
Proof (Lean source)
lemma factorialPolynomial_cross_covariance_le {n d : ℕ} (P : DiscreteLaw d) (k l : Fin d) (hkl : k ≠ l) (hM : 0 < polynomialDegree n) (hB : 0 < bandwidth n) (hsize : 4 * polynomialDegree n ^ 2 ≤ splitSize n 1) (hk : cellMass P k ≤ bandwidth n) (hl : cellMass P l ≤ bandwidth n) : |(∫ ω : ℕ → Obs d, factorialPolynomialContribution (fun i : Fin n => ω i) k * factorialPolynomialContribution (fun i : Fin n => ω i) l ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P))) - sparsePolynomialMean P k (polynomialDegree n) (bandwidth n) * sparsePolynomialMean P l (polynomialDegree n) (bandwidth n)| ≤ 8 * (polynomialDegree n : ℝ) ^ 2 / splitSize n 1 * (bandwidth n * 6 ^ polynomialDegree n) ^ 2 := by let q := 2 * (polynomialDegree n : ℝ) ^ 2 / splitSize n 1 let R := bandwidth n * 6 ^ polynomialDegree n have henvk (a : Fin 2) : sparseArmEnvelope (polynomialDegree n) (bandwidth n) (cellVector P k) a ≤ R := by exact sparseArmEnvelope_le hM hB _ (fun cy => (cellVector_mem_unitCube P k cy).1) (by have hm := vectorMass_cellVector P k simp [vectorMass, vectorArmMass] at hm have hsum : (∑ ay : Cell, cellVector P k ay) = cellMass P k := by simpa [Fintype.sum_prod_type, Fin.sum_univ_two] using hm rw [hsum] exact hk) a have henvl (a : Fin 2) : sparseArmEnvelope (polynomialDegree n) (bandwidth n) (cellVector P l) a ≤ R := by exact sparseArmEnvelope_le hM hB _ (fun cy => (cellVector_mem_unitCube P l cy).1) (by have hm := vectorMass_cellVector P l simp [vectorMass, vectorArmMass] at hm have hsum : (∑ ay : Cell, cellVector P l ay) = cellMass P l := by simpa [Fintype.sum_prod_type, Fin.sum_univ_two] using hm rw [hsum] exact hl) a have hq0 : 0 ≤ q := by unfold q; positivity have hR0 : 0 ≤ R := by unfold R; positivity have hc (a b : Fin 2) : |(∫ ω : ℕ → Obs d, sparseArmContribution (fun i : Fin n => ω i) k a * sparseArmContribution (fun i : Fin n => ω i) l b ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P))) - sparseArmMean P k (polynomialDegree n) (bandwidth n) a * sparseArmMean P l (polynomialDegree n) (bandwidth n) b| ≤ q * R ^ 2 := by refine (sparseArm_cross_covariance_le P k l hkl a b hsize).trans ?_ change q * _ * _ ≤ q * R ^ 2 rw [pow_two] have hek0 : 0 ≤ sparseArmEnvelope (polynomialDegree n) (bandwidth n) (cellVector P k) a := sparseArmEnvelope_nonneg _ (fun cy => (cellVector_mem_unitCube P k cy).1) a have hel0 : 0 ≤ sparseArmEnvelope (polynomialDegree n) (bandwidth n) (cellVector P l) b := sparseArmEnvelope_nonneg _ (fun cy => (cellVector_mem_unitCube P l cy).1) b calc q * _ * _ ≤ q * R * sparseArmEnvelope (polynomialDegree n) (bandwidth n) (cellVector P l) b := by exact mul_le_mul_of_nonneg_right (mul_le_mul_of_nonneg_left (henvk a) hq0) hel0 _ ≤ q * R * R := by exact mul_le_mul_of_nonneg_left (henvl b) (mul_nonneg hq0 hR0) _ = q * (R * R) := by ring rw [factorialPolynomial_cross_covariance_decompose P k l] have four_abs (x y z w : ℝ) : |x - y - z + w| ≤ |x| + |y| + |z| + |w| := by calc |x - y - z + w| ≤ |x - y - z| + |w| := abs_add_le _ _ _ ≤ (|x - y| + |z|) + |w| := by gcongr; exact abs_sub _ _ _ ≤ (|x| + |y| + |z|) + |w| := by gcongr; exact abs_sub _ _ _ = _ := by ring calc |_ - _ - _ + _| ≤ |_| + |_| + |_| + |_| := four_abs _ _ _ _ _ ≤ 4 * (q * R ^ 2) := by have h11 := hc 1 1 have h10 := hc 1 0 have h01 := hc 0 1 have h00 := hc 0 0 linarith _ = _ := by unfold q R; ring
CausalSmith.Stat.DiscreteAteMinimaxLoggap.factorialPolynomial_cross_covariance_le · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellRateDeterministic.lean:803
theorem integrable_factorialPolynomial_cross_mul

Shows that integrable factorial Polynomial cross mul is integrable under the stated sampling distribution.

Formal statement
n d :
P :
k l :
Fin d
Integrable (fun ω : ℕ → Obs d => factorialPolynomialContribution (fun i : Fin n => ω i) k * factorialPolynomialContribution (fun i : Fin n => ω i) l) (Measure.infinitePi (fun _ : ℕ => obsLaw P))
Proof (Lean source)
lemma integrable_factorialPolynomial_cross_mul {n d : ℕ} (P : DiscreteLaw d) (k l : Fin d) : Integrable (fun ω : ℕ → Obs d => factorialPolynomialContribution (fun i : Fin n => ω i) k * factorialPolynomialContribution (fun i : Fin n => ω i) l) (Measure.infinitePi (fun _ : ℕ => obsLaw P)) := by simp_rw [factorialPolynomialContribution_eq_sparseArms] rw [show (fun ω : ℕ → Obs d => (sparseArmContribution (fun i : Fin n => ω i) k 1 - sparseArmContribution (fun i : Fin n => ω i) k 0) * (sparseArmContribution (fun i : Fin n => ω i) l 1 - sparseArmContribution (fun i : Fin n => ω i) l 0)) = (fun ω => sparseArmContribution (fun i : Fin n => ω i) k 1 * sparseArmContribution (fun i : Fin n => ω i) l 1 - sparseArmContribution (fun i : Fin n => ω i) k 1 * sparseArmContribution (fun i : Fin n => ω i) l 0 - sparseArmContribution (fun i : Fin n => ω i) k 0 * sparseArmContribution (fun i : Fin n => ω i) l 1 + sparseArmContribution (fun i : Fin n => ω i) k 0 * sparseArmContribution (fun i : Fin n => ω i) l 0) by funext ω ring] exact (((integrable_sparseArm_cross_mul P k l 1 1).sub (integrable_sparseArm_cross_mul P k l 1 0)).sub (integrable_sparseArm_cross_mul P k l 0 1)).add (integrable_sparseArm_cross_mul P k l 0 0)
CausalSmith.Stat.DiscreteAteMinimaxLoggap.integrable_factorialPolynomial_cross_mul · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellRateDeterministic.lean:889
theorem integral_factorialPolynomial_centered_cross_le Lemma 17 in the paper ↗

The off-diagonal centered covariance estimate, packaged separately so that the pilot-selection layer need not normalize a large factorial expression.

Formal statement
n d :
P :
k l :
Fin d
hkl :
k ≠ l
hM :
0 < polynomialDegree n
hB :
0 < bandwidth n
hsize :
4 * polynomialDegree n ^ 2 ≤ splitSize n 1
hk :
cellMass P k ≤ bandwidth n
hl :
cellMass P l ≤ bandwidth n
∫ ω : ℕ → Obs d, (factorialPolynomialContribution (fun i : Fin n => ω i) k - sparsePolynomialMean P k (polynomialDegree n) (bandwidth n)) * (factorialPolynomialContribution (fun i : Fin n => ω i) l - sparsePolynomialMean P l (polynomialDegree n) (bandwidth n)) ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P))
≤ 8 * (polynomialDegree n : ℝ) ^ 2 / splitSize n 1 * (bandwidth n * 6 ^ polynomialDegree n) ^ 2
Proof (Lean source)
lemma integral_factorialPolynomial_centered_cross_le {n d : ℕ} (P : DiscreteLaw d) (k l : Fin d) (hkl : k ≠ l) (hM : 0 < polynomialDegree n) (hB : 0 < bandwidth n) (hsize : 4 * polynomialDegree n ^ 2 ≤ splitSize n 1) (hk : cellMass P k ≤ bandwidth n) (hl : cellMass P l ≤ bandwidth n) : ∫ ω : ℕ → Obs d, (factorialPolynomialContribution (fun i : Fin n => ω i) k - sparsePolynomialMean P k (polynomialDegree n) (bandwidth n)) * (factorialPolynomialContribution (fun i : Fin n => ω i) l - sparsePolynomialMean P l (polynomialDegree n) (bandwidth n)) ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P)) ≤ 8 * (polynomialDegree n : ℝ) ^ 2 / splitSize n 1 * (bandwidth n * 6 ^ polynomialDegree n) ^ 2 := by have hMle : polynomialDegree n ≤ splitSize n 1 := by nlinarith [Nat.mul_self_le_mul_self (show 1 ≤ polynomialDegree n by omega)] let μ := Measure.infinitePi (fun _ : ℕ => obsLaw P) let f := fun ω : ℕ → Obs d => factorialPolynomialContribution (fun i : Fin n => ω i) k let g := fun ω : ℕ → Obs d => factorialPolynomialContribution (fun i : Fin n => ω i) l let mk := sparsePolynomialMean P k (polynomialDegree n) (bandwidth n) let ml := sparsePolynomialMean P l (polynomialDegree n) (bandwidth n) have hf : Integrable f μ := integrable_factorialPolynomialContribution_trunc_rate P k have hg : Integrable g μ := integrable_factorialPolynomialContribution_trunc_rate P l have hfg : Integrable (fun ω => f ω * g ω) μ := integrable_factorialPolynomial_cross_mul P k l have hcenter : (∫ ω, (f ω - mk) * (g ω - ml) ∂μ) = (∫ ω, f ω * g ω ∂μ) - mk * ml := by rw [show (fun ω => (f ω - mk) * (g ω - ml)) = (fun ω => f ω * g ω - ml * f ω - mk * g ω + mk * ml) by funext ω ring] calc (∫ ω, f ω * g ω - ml * f ω - mk * g ω + mk * ml ∂μ) = (∫ ω, f ω * g ω - ml * f ω - mk * g ω ∂μ) + ∫ _ω, mk * ml ∂μ := by simpa only [Pi.add_apply, Pi.sub_apply] using integral_add ((hfg.sub (hf.const_mul ml)).sub (hg.const_mul mk)) (integrable_const (mk * ml)) _ = ((∫ ω, f ω * g ω - ml * f ω ∂μ) - ∫ ω, mk * g ω ∂μ) + ∫ _ω, mk * ml ∂μ := by rw [show (∫ ω, f ω * g ω - ml * f ω - mk * g ω ∂μ) = (∫ ω, f ω * g ω - ml * f ω ∂μ) - ∫ ω, mk * g ω ∂μ by simpa only [Pi.sub_apply] using integral_sub (hfg.sub (hf.const_mul ml)) (hg.const_mul mk)] _ = (((∫ ω, f ω * g ω ∂μ) - ∫ ω, ml * f ω ∂μ) - ∫ ω, mk * g ω ∂μ) + ∫ _ω, mk * ml ∂μ := by rw [show (∫ ω, f ω * g ω - ml * f ω ∂μ) = (∫ ω, f ω * g ω ∂μ) - ∫ ω, ml * f ω ∂μ by simpa only [Pi.sub_apply] using integral_sub hfg (hf.const_mul ml)] _ = (∫ ω, f ω * g ω ∂μ) - mk * ml := by rw [integral_const_mul, integral_const_mul] simp only [integral_const, probReal_univ, one_smul] rw [show (∫ ω, f ω ∂μ) = mk by simpa only [f, μ, mk] using integral_factorialPolynomialContribution_eq_sparsePolynomialMean P k hMle, show (∫ ω, g ω ∂μ) = ml by simpa only [g, μ, ml] using integral_factorialPolynomialContribution_eq_sparsePolynomialMean P l hMle] ring rw [hcenter] simpa only [f, g, mk, ml, μ] using (le_abs_self ((∫ ω : ℕ → Obs d, factorialPolynomialContribution (fun i : Fin n => ω i) k * factorialPolynomialContribution (fun i : Fin n => ω i) l ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P))) - sparsePolynomialMean P k (polynomialDegree n) (bandwidth n) * sparsePolynomialMean P l (polynomialDegree n) (bandwidth n))).trans (factorialPolynomial_cross_covariance_le P k l hkl hM hB hsize hk hl)
CausalSmith.Stat.DiscreteAteMinimaxLoggap.integral_factorialPolynomial_centered_cross_le · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellRateDeterministic.lean:918
theorem sparsePolynomialMean_abs_le

Establishes the stated upper bound for sparse Polynomial Mean abs le.

Formal statement
n d :
P :
k :
Fin d
hM :
hB :
0 < bandwidth n
hk :
cellMass P k ≤ bandwidth n
Proof (Lean source)
lemma sparsePolynomialMean_abs_le {n d : ℕ} (P : DiscreteLaw d) (k : Fin d) (hM : 0 < polynomialDegree n) (hB : 0 < bandwidth n) (hk : cellMass P k ≤ bandwidth n) : |sparsePolynomialMean P k (polynomialDegree n) (bandwidth n)| ≤ 2 * (bandwidth n * 6 ^ polynomialDegree n) := by unfold sparsePolynomialMean refine (abs_sub _ _).trans ?_ have h1 := sparseArmMean_abs_le_envelope (M := polynomialDegree n) (B := bandwidth n) P k 1 have h0 := sparseArmMean_abs_le_envelope (M := polynomialDegree n) (B := bandwidth n) P k 0 have he (a : Fin 2) : sparseArmEnvelope (polynomialDegree n) (bandwidth n) (cellVector P k) a ≤ bandwidth n * 6 ^ polynomialDegree n := sparseArmEnvelope_le hM hB _ (fun cy => (cellVector_mem_unitCube P k cy).1) (by have hm := vectorMass_cellVector P k simp [vectorMass, vectorArmMass] at hm have hsum : (∑ ay : Cell, cellVector P k ay) = cellMass P k := by simpa [Fintype.sum_prod_type, Fin.sum_univ_two] using hm rw [hsum] exact hk) a linarith [he 1, he 0]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.sparsePolynomialMean_abs_le · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellRateDeterministic.lean:995
theorem integral_factorialPolynomial_centered_sq_le Lemma 16 in the paper ↗

Evaluates or bounds the stated integral involving integral factorial Polynomial centered sq le.

Formal statement
n d :
P :
k :
Fin d
hn :
0 < splitSize n 1
hM :
0 < polynomialDegree n
hB :
0 < bandwidth n
hsize :
4 * polynomialDegree n ^ 2 ≤ splitSize n 1
hmassShift :
cellMass P k + 4 * (polynomialDegree n : ℝ) / splitSize n 1 ≤ bandwidth n
hmass :
cellMass P k ≤ bandwidth n
∫ ω : ℕ → Obs d, (factorialPolynomialContribution (fun i : Fin n => ω i) k - sparsePolynomialMean P k (polynomialDegree n) (bandwidth n)) ^ 2 ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P))
≤ 8 * (exp 1 + 1) * (bandwidth n * 6 ^ polynomialDegree n) ^ 2
Proof (Lean source)
lemma integral_factorialPolynomial_centered_sq_le {n d : ℕ} (P : DiscreteLaw d) (k : Fin d) (hn : 0 < splitSize n 1) (hM : 0 < polynomialDegree n) (hB : 0 < bandwidth n) (hsize : 4 * polynomialDegree n ^ 2 ≤ splitSize n 1) (hmassShift : cellMass P k + 4 * (polynomialDegree n : ℝ) / splitSize n 1 ≤ bandwidth n) (hmass : cellMass P k ≤ bandwidth n) : ∫ ω : ℕ → Obs d, (factorialPolynomialContribution (fun i : Fin n => ω i) k - sparsePolynomialMean P k (polynomialDegree n) (bandwidth n)) ^ 2 ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P)) ≤ 8 * (exp 1 + 1) * (bandwidth n * 6 ^ polynomialDegree n) ^ 2 := by let X := fun ω : ℕ → Obs d => factorialPolynomialContribution (fun i : Fin n => ω i) k let m := sparsePolynomialMean P k (polynomialDegree n) (bandwidth n) let R := bandwidth n * 6 ^ polynomialDegree n have hmabs : |m| ≤ 2 * R := sparsePolynomialMean_abs_le P k hM hB hmass have hm2 : m ^ 2 ≤ 4 * R ^ 2 := by rw [← sq_abs] nlinarith [sq_nonneg (|m| - 2 * R), abs_nonneg m] have hpoint (ω : ℕ → Obs d) : (X ω - m) ^ 2 ≤ 2 * X ω ^ 2 + 2 * m ^ 2 := by nlinarith [sq_nonneg (X ω + m)] have hint : ∫ ω, (X ω - m) ^ 2 ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P)) ≤ ∫ ω, (2 * X ω ^ 2 + 2 * m ^ 2) ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P)) := by apply integral_mono · have hi : Integrable (fun ω : ℕ → Obs d => factorialPolynomialContribution (fun i : Fin n => ω i) k ^ 2 - ((2 * m) * factorialPolynomialContribution (fun i : Fin n => ω i) k - m ^ 2)) (Measure.infinitePi (fun _ : ℕ => obsLaw P)) := (integrable_factorialPolynomialContribution_sq (n := n) P k).sub (((integrable_factorialPolynomialContribution_trunc_rate P k).const_mul (2 * m)).sub (integrable_const (m ^ 2))) convert hi using 1 funext ω dsimp only [X] ring · exact ((integrable_factorialPolynomialContribution_sq P k).const_mul 2).add (integrable_const (2 * m ^ 2)) · exact hpoint refine hint.trans ?_ rw [integral_add, integral_const_mul, integral_const] simp only [probReal_univ, one_smul] · have hX := integral_factorialPolynomialContribution_sq_le P k hn hsize hM hB hmassShift change 2 * (∫ ω, X ω ^ 2 ∂_) + 2 * m ^ 2 ≤ _ nlinarith [Real.exp_pos 1] · exact (integrable_factorialPolynomialContribution_sq P k).const_mul 2 · exact integrable_const _
CausalSmith.Stat.DiscreteAteMinimaxLoggap.integral_factorialPolynomial_centered_sq_le · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellRateDeterministic.lean:1021
Helpers.LightCellRatePilot 32 declarations
def lightBalancedSplit

The balanced split, duplicated here to keep the light-cell assembly below the final LightCell module in the import graph.

Definition (Lean source)
noncomputable def lightBalancedSplit {d : ℕ} (P : DiscreteLaw d) : OneShotSplit (iidSample_infinitePi (obsLaw P)) where n₁ n := n / 2 bound n := Nat.div_le_self n 2 grow := Nat.tendsto_div_const_atTop (by norm_num) cogrow := by show Tendsto (fun n : ℕ => n - n / 2) atTop atTop apply Filter.tendsto_atTop_mono (f := fun n : ℕ => n / 2) (g := fun n => n - n / 2) · intro n omega · exact Nat.tendsto_div_const_atTop (by norm_num)
CausalSmith.Stat.DiscreteAteMinimaxLoggap.lightBalancedSplit · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellRatePilot.lean:8
def rebuildPilotSample

Reassembles a full n-observation sample out of the pilot half alone: positions below the floor of n over two take the supplied pilot observations, and every later position takes a fixed filler observation. Statistics that read only the pilot half are unaffected by the choice of filler.

Definition (Lean source)
def rebuildPilotSample {n d : ℕ} (P : DiscreteLaw d) (base : Obs d) (x : (lightBalancedSplit P).foldA n → Obs d) : Fin n → Obs d := fun i => if h : i.1 < n / 2 then x ⟨i.1, by simpa [foldA, lightBalancedSplit] using h⟩ else base
CausalSmith.Stat.DiscreteAteMinimaxLoggap.rebuildPilotSample · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellRatePilot.lean:24
def rebuildEstimationSample

Defines rebuild Estimation Sample, the stated quantity or construction used in the discrete average-treatment-effect estimator.

Definition (Lean source)
def rebuildEstimationSample {n d : ℕ} (P : DiscreteLaw d) (base : Obs d) (x : (lightBalancedSplit P).foldB n → Obs d) : Fin n → Obs d := fun i => if h : n / 2 ≤ i.1 then x ⟨i.1, Finset.mem_filter.mpr ⟨Finset.mem_range.mpr i.2, h⟩⟩ else base
CausalSmith.Stat.DiscreteAteMinimaxLoggap.rebuildEstimationSample · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellRatePilot.lean:34
theorem splitCategoryCount_rebuildPilot

Establishes the stated property of split Category Count rebuild Pilot in the discrete average-treatment-effect construction.

Formal statement
n d :
P :
base :
Obs d
ω :
ℕ → Obs d
k :
Fin d
splitCategoryCount (rebuildPilotSample P base (fun i : (lightBalancedSplit P).foldA n => ω i)) 0 k
= splitCategoryCount (fun i : Fin n => ω i) 0 k
Proof (Lean source)
lemma splitCategoryCount_rebuildPilot {n d : ℕ} (P : DiscreteLaw d) (base : Obs d) (ω : ℕ → Obs d) (k : Fin d) : splitCategoryCount (rebuildPilotSample P base (fun i : (lightBalancedSplit P).foldA n => ω i)) 0 k = splitCategoryCount (fun i : Fin n => ω i) 0 k := by classical unfold splitCategoryCount congr 1 ext i simp only [mem_filter] by_cases hi : i.1 < n / 2 · simp [splitIndices, rebuildPilotSample, hi] · simp [splitIndices, rebuildPilotSample, hi]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.splitCategoryCount_rebuildPilot · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellRatePilot.lean:41
theorem lightCells_rebuildPilot

Establishes the stated property of light Cells rebuild Pilot in the discrete average-treatment-effect construction.

Formal statement
n d :
P :
base :
Obs d
ω :
ℕ → Obs d
lightCells (rebuildPilotSample P base (fun i : (lightBalancedSplit P).foldA n => ω i))
= lightCells (fun i : Fin n => ω i)
Proof (Lean source)
lemma lightCells_rebuildPilot {n d : ℕ} (P : DiscreteLaw d) (base : Obs d) (ω : ℕ → Obs d) : lightCells (rebuildPilotSample P base (fun i : (lightBalancedSplit P).foldA n => ω i)) = lightCells (fun i : Fin n => ω i) := by classical by_cases hn : n < calibrationCutoff · simp [lightCells, hn] · ext k simp only [lightCells, heavyCells, hn, if_false, Finset.mem_compl, mem_filter, Finset.mem_univ, true_and] rw [splitCategoryCount_rebuildPilot P base ω k]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.lightCells_rebuildPilot · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellRatePilot.lean:56
theorem splitCellCount_rebuildEstimation

Establishes the stated property of split Cell Count rebuild Estimation in the discrete average-treatment-effect construction.

Formal statement
n d :
P :
base :
Obs d
ω :
ℕ → Obs d
k :
Fin d
a y :
Fin 2
splitCellCount (rebuildEstimationSample P base (fun i : (lightBalancedSplit P).foldB n => ω i)) 1 k a y
= splitCellCount (fun i : Fin n => ω i) 1 k a y
Proof (Lean source)
lemma splitCellCount_rebuildEstimation {n d : ℕ} (P : DiscreteLaw d) (base : Obs d) (ω : ℕ → Obs d) (k : Fin d) (a y : Fin 2) : splitCellCount (rebuildEstimationSample P base (fun i : (lightBalancedSplit P).foldB n => ω i)) 1 k a y = splitCellCount (fun i : Fin n => ω i) 1 k a y := by classical unfold splitCellCount congr 1 ext i simp only [mem_filter] by_cases hi : n / 2 ≤ i.1 · simp [splitIndices, rebuildEstimationSample, hi] · have hnot : ¬n / 2 ≤ i.1 := hi simp [splitIndices, rebuildEstimationSample, hi, hnot]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.splitCellCount_rebuildEstimation · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellRatePilot.lean:70
theorem factorialMonomial_rebuildEstimation

Establishes the stated property of factorial Monomial rebuild Estimation in the discrete average-treatment-effect construction.

Formal statement
n d :
P :
base :
Obs d
ω :
ℕ → Obs d
k :
Fin d
= factorialMonomial (fun i : Fin n => ω i) k r
Proof (Lean source)
lemma factorialMonomial_rebuildEstimation {n d : ℕ} (P : DiscreteLaw d) (base : Obs d) (ω : ℕ → Obs d) (k : Fin d) (r : MultiIndex) : factorialMonomial (rebuildEstimationSample P base (fun i : (lightBalancedSplit P).foldB n => ω i)) k r = factorialMonomial (fun i : Fin n => ω i) k r := by unfold factorialMonomial apply congrArg (fun x : ℝ => x / (fallingFactorial (splitSize n 1) (multiDegree r) : ℝ)) apply Finset.prod_congr rfl intro ay _hay rw [splitCellCount_rebuildEstimation P base ω]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.factorialMonomial_rebuildEstimation · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellRatePilot.lean:86
theorem factorialPolynomialContribution_rebuildEstimation

Establishes the stated property of factorial Polynomial Contribution rebuild Estimation in the discrete average-treatment-effect construction.

Formal statement
n d :
P :
base :
Obs d
ω :
ℕ → Obs d
k :
Fin d
Proof (Lean source)
lemma factorialPolynomialContribution_rebuildEstimation {n d : ℕ} (P : DiscreteLaw d) (base : Obs d) (ω : ℕ → Obs d) (k : Fin d) : factorialPolynomialContribution (rebuildEstimationSample P base (fun i : (lightBalancedSplit P).foldB n => ω i)) k = factorialPolynomialContribution (fun i : Fin n => ω i) k := by unfold factorialPolynomialContribution simp_rw [factorialMonomial_rebuildEstimation P base ω]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.factorialPolynomialContribution_rebuildEstimation · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellRatePilot.lean:99
def lightIndicator

Defines light Indicator, the stated quantity or construction used in the discrete average-treatment-effect estimator.

Definition (Lean source)
noncomputable def lightIndicator {n d : ℕ} (sample : Fin n → Obs d) (k : Fin d) : ℝ := if k ∈ lightCells sample then 1 else 0
theorem lightIndicator_rebuildPilot

Establishes the stated property of light Indicator rebuild Pilot in the discrete average-treatment-effect construction.

Formal statement
n d :
P :
base :
Obs d
ω :
ℕ → Obs d
k :
Fin d
lightIndicator (rebuildPilotSample P base (fun i : (lightBalancedSplit P).foldA n => ω i)) k
= lightIndicator (fun i : Fin n => ω i) k
Proof (Lean source)
lemma lightIndicator_rebuildPilot {n d : ℕ} (P : DiscreteLaw d) (base : Obs d) (ω : ℕ → Obs d) (k : Fin d) : lightIndicator (rebuildPilotSample P base (fun i : (lightBalancedSplit P).foldA n => ω i)) k = lightIndicator (fun i : Fin n => ω i) k := by unfold lightIndicator rw [lightCells_rebuildPilot P base ω]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.lightIndicator_rebuildPilot · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellRatePilot.lean:112
theorem lightIndicator_centered_pair_factorization

Exact pilot/estimation factorization for two selected centered cell errors. This is the formal conditioning step behind equation (25).

Formal statement
n d :
P :
k l :
Fin d
∫ ω : ℕ → Obs d, (lightIndicator (fun i : Fin n => ω i) k * lightIndicator (fun i : Fin n => ω i) l) * ((factorialPolynomialContribution (fun i : Fin n => ω i) k - sparsePolynomialMean P k (polynomialDegree n) (bandwidth n)) * (factorialPolynomialContribution (fun i : Fin n => ω i) l - sparsePolynomialMean P l (polynomialDegree n) (bandwidth n))) ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P))
= (∫ ω : ℕ → Obs d, lightIndicator (fun i : Fin n => ω i) k * lightIndicator (fun i : Fin n => ω i) l ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P))) * ∫ ω : ℕ → Obs d, (factorialPolynomialContribution (fun i : Fin n => ω i) k - sparsePolynomialMean P k (polynomialDegree n) (bandwidth n)) * (factorialPolynomialContribution (fun i : Fin n => ω i) l - sparsePolynomialMean P l (polynomialDegree n) (bandwidth n)) ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P))
Proof (Lean source)
lemma lightIndicator_centered_pair_factorization {n d : ℕ} (P : DiscreteLaw d) (k l : Fin d) : ∫ ω : ℕ → Obs d, (lightIndicator (fun i : Fin n => ω i) k * lightIndicator (fun i : Fin n => ω i) l) * ((factorialPolynomialContribution (fun i : Fin n => ω i) k - sparsePolynomialMean P k (polynomialDegree n) (bandwidth n)) * (factorialPolynomialContribution (fun i : Fin n => ω i) l - sparsePolynomialMean P l (polynomialDegree n) (bandwidth n))) ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P)) = (∫ ω : ℕ → Obs d, lightIndicator (fun i : Fin n => ω i) k * lightIndicator (fun i : Fin n => ω i) l ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P))) * ∫ ω : ℕ → Obs d, (factorialPolynomialContribution (fun i : Fin n => ω i) k - sparsePolynomialMean P k (polynomialDegree n) (bandwidth n)) * (factorialPolynomialContribution (fun i : Fin n => ω i) l - sparsePolynomialMean P l (polynomialDegree n) (bandwidth n)) ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P)) := by let base : Obs d := (k, false, false) let pilot := fun x : (lightBalancedSplit P).foldA n → Obs d => lightIndicator (rebuildPilotSample P base x) k * lightIndicator (rebuildPilotSample P base x) l let estimate := fun x : (lightBalancedSplit P).foldB n → Obs d => (factorialPolynomialContribution (rebuildEstimationSample P base x) k - sparsePolynomialMean P k (polynomialDegree n) (bandwidth n)) * (factorialPolynomialContribution (rebuildEstimationSample P base x) l - sparsePolynomialMean P l (polynomialDegree n) (bandwidth n)) have h := oneShot_integral_mul_factorization (lightBalancedSplit P) n pilot estimate (measurable_of_finite _) (measurable_of_finite _) have hp (ω : ℕ → Obs d) : pilot (fun i : (lightBalancedSplit P).foldA n => ω i) = lightIndicator (fun i : Fin n => ω i) k * lightIndicator (fun i : Fin n => ω i) l := by dsimp only [pilot] rw [lightIndicator_rebuildPilot P base ω k, lightIndicator_rebuildPilot P base ω l] have he (ω : ℕ → Obs d) : estimate (fun i : (lightBalancedSplit P).foldB n => ω i) = (factorialPolynomialContribution (fun i : Fin n => ω i) k - sparsePolynomialMean P k (polynomialDegree n) (bandwidth n)) * (factorialPolynomialContribution (fun i : Fin n => ω i) l - sparsePolynomialMean P l (polynomialDegree n) (bandwidth n)) := by dsimp only [estimate] rw [factorialPolynomialContribution_rebuildEstimation P base ω k, factorialPolynomialContribution_rebuildEstimation P base ω l] dsimp only [iidSample_infinitePi] at h calc _ = ∫ ω, (pilot (fun i => ω i)) * estimate (fun i => ω i) ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P)) := by apply integral_congr_ae filter_upwards with ω rw [hp, he] _ = _ := h _ = _ := by congr 1 · apply integral_congr_ae filter_upwards with ω exact hp ω · apply integral_congr_ae filter_upwards with ω exact he ω
CausalSmith.Stat.DiscreteAteMinimaxLoggap.lightIndicator_centered_pair_factorization · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellRatePilot.lean:121
theorem lightIndicator_nonneg

Shows that light Indicator nonneg is nonnegative.

Formal statement
n d :
sample :
Fin n → Obs d
k :
Fin d
0 ≤ lightIndicator sample k
Proof (Lean source)
lemma lightIndicator_nonneg {n d : ℕ} (sample : Fin n → Obs d) (k : Fin d) : 0 ≤ lightIndicator sample k := by unfold lightIndicator split_ifs <;> norm_num
CausalSmith.Stat.DiscreteAteMinimaxLoggap.lightIndicator_nonneg · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellRatePilot.lean:187
theorem lightIndicator_le_one

Establishes the stated upper bound for light Indicator le one.

Formal statement
n d :
sample :
Fin n → Obs d
k :
Fin d
lightIndicator sample k ≤ 1
Proof (Lean source)
lemma lightIndicator_le_one {n d : ℕ} (sample : Fin n → Obs d) (k : Fin d) : lightIndicator sample k ≤ 1 := by unfold lightIndicator split_ifs <;> norm_num
CausalSmith.Stat.DiscreteAteMinimaxLoggap.lightIndicator_le_one · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellRatePilot.lean:193
theorem integral_lightIndicator_pair_mem_Icc

Evaluates or bounds the stated integral involving integral light Indicator pair mem Icc.

Formal statement
n d :
P :
k l :
Fin d
(∫ ω : ℕ → Obs d, lightIndicator (fun i : Fin n => ω i) k * lightIndicator (fun i : Fin n => ω i) l ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P))) ∈ Icc (0 : ℝ) 1
Proof (Lean source)
lemma integral_lightIndicator_pair_mem_Icc {n d : ℕ} (P : DiscreteLaw d) (k l : Fin d) : (∫ ω : ℕ → Obs d, lightIndicator (fun i : Fin n => ω i) k * lightIndicator (fun i : Fin n => ω i) l ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P))) ∈ Icc (0 : ℝ) 1 := by constructor · apply integral_nonneg_of_ae filter_upwards with ω exact mul_nonneg (lightIndicator_nonneg _ _) (lightIndicator_nonneg _ _) · have hmono : (∫ ω : ℕ → Obs d, lightIndicator (fun i : Fin n => ω i) k * lightIndicator (fun i : Fin n => ω i) l ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P))) ≤ ∫ _ω : ℕ → Obs d, (1 : ℝ) ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P)) := by have htrunc : Measurable (fun ω : ℕ → Obs d => fun i : Fin n => ω i) := by fun_prop have hmeas : AEStronglyMeasurable (fun ω : ℕ → Obs d => lightIndicator (fun i : Fin n => ω i) k * lightIndicator (fun i : Fin n => ω i) l) (Measure.infinitePi (fun _ : ℕ => obsLaw P)) := ((measurable_of_finite (fun sample : Fin n → Obs d => lightIndicator sample k * lightIndicator sample l)).comp htrunc).aestronglyMeasurable apply integral_mono (Integrable.of_bound hmeas 1 (Filter.Eventually.of_forall fun ω => by rw [Real.norm_eq_abs, abs_of_nonneg] · exact mul_le_one₀ (lightIndicator_le_one _ _) (lightIndicator_nonneg _ _) (lightIndicator_le_one _ _) · exact mul_nonneg (lightIndicator_nonneg _ _) (lightIndicator_nonneg _ _))) (integrable_const (1 : ℝ)) intro ω exact mul_le_one₀ (lightIndicator_le_one _ _) (lightIndicator_nonneg _ _) (lightIndicator_le_one _ _) simpa using hmono
CausalSmith.Stat.DiscreteAteMinimaxLoggap.integral_lightIndicator_pair_mem_Icc · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellRatePilot.lean:199
theorem integrable_centeredPolynomial_pair

Shows that integrable centered Polynomial pair is integrable under the stated sampling distribution.

Formal statement
n d :
P :
k l :
Fin d
Integrable (fun ω : ℕ → Obs d => (factorialPolynomialContribution (fun i : Fin n => ω i) k - sparsePolynomialMean P k (polynomialDegree n) (bandwidth n)) * (factorialPolynomialContribution (fun i : Fin n => ω i) l - sparsePolynomialMean P l (polynomialDegree n) (bandwidth n))) (Measure.infinitePi (fun _ : ℕ => obsLaw P))
Proof (Lean source)
lemma integrable_centeredPolynomial_pair {n d : ℕ} (P : DiscreteLaw d) (k l : Fin d) : Integrable (fun ω : ℕ → Obs d => (factorialPolynomialContribution (fun i : Fin n => ω i) k - sparsePolynomialMean P k (polynomialDegree n) (bandwidth n)) * (factorialPolynomialContribution (fun i : Fin n => ω i) l - sparsePolynomialMean P l (polynomialDegree n) (bandwidth n))) (Measure.infinitePi (fun _ : ℕ => obsLaw P)) := by let mk := sparsePolynomialMean P k (polynomialDegree n) (bandwidth n) let ml := sparsePolynomialMean P l (polynomialDegree n) (bandwidth n) have hi : Integrable (fun ω : ℕ → Obs d => ((factorialPolynomialContribution (fun i : Fin n => ω i) k * factorialPolynomialContribution (fun i : Fin n => ω i) l - ml * factorialPolynomialContribution (fun i : Fin n => ω i) k) - mk * factorialPolynomialContribution (fun i : Fin n => ω i) l) + mk * ml) (Measure.infinitePi (fun _ : ℕ => obsLaw P)) := (((integrable_factorialPolynomial_cross_mul (n := n) P k l).sub ((integrable_factorialPolynomialContribution_trunc_rate P k).const_mul ml)).sub ((integrable_factorialPolynomialContribution_trunc_rate P l).const_mul mk)).add (integrable_const (mk * ml)) convert hi using 1 funext ω dsimp only [mk, ml] ring
CausalSmith.Stat.DiscreteAteMinimaxLoggap.integrable_centeredPolynomial_pair · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellRatePilot.lean:238
theorem integrable_selected_centeredPolynomial_pair

Shows that integrable selected centered Polynomial pair is integrable under the stated sampling distribution.

Formal statement
n d :
P :
k l :
Fin d
Integrable (fun ω : ℕ → Obs d => (lightIndicator (fun i : Fin n => ω i) k * lightIndicator (fun i : Fin n => ω i) l) * ((factorialPolynomialContribution (fun i : Fin n => ω i) k - sparsePolynomialMean P k (polynomialDegree n) (bandwidth n)) * (factorialPolynomialContribution (fun i : Fin n => ω i) l - sparsePolynomialMean P l (polynomialDegree n) (bandwidth n)))) (Measure.infinitePi (fun _ : ℕ => obsLaw P))
Proof (Lean source)
lemma integrable_selected_centeredPolynomial_pair {n d : ℕ} (P : DiscreteLaw d) (k l : Fin d) : Integrable (fun ω : ℕ → Obs d => (lightIndicator (fun i : Fin n => ω i) k * lightIndicator (fun i : Fin n => ω i) l) * ((factorialPolynomialContribution (fun i : Fin n => ω i) k - sparsePolynomialMean P k (polynomialDegree n) (bandwidth n)) * (factorialPolynomialContribution (fun i : Fin n => ω i) l - sparsePolynomialMean P l (polynomialDegree n) (bandwidth n)))) (Measure.infinitePi (fun _ : ℕ => obsLaw P)) := by have htrunc : Measurable (fun ω : ℕ → Obs d => fun i : Fin n => ω i) := by fun_prop apply (integrable_centeredPolynomial_pair P k l).bdd_mul (((measurable_of_finite (fun sample : Fin n → Obs d => lightIndicator sample k * lightIndicator sample l)).comp htrunc).aestronglyMeasurable) filter_upwards with ω rw [Real.norm_eq_abs, abs_of_nonneg] · exact mul_le_one₀ (lightIndicator_le_one _ _) (lightIndicator_nonneg _ _) (lightIndicator_le_one _ _) · exact mul_nonneg (lightIndicator_nonneg _ _) (lightIndicator_nonneg _ _)
CausalSmith.Stat.DiscreteAteMinimaxLoggap.integrable_selected_centeredPolynomial_pair · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellRatePilot.lean:264
def selectedFixedLightCentered

Defines selected Fixed Light Centered, the stated quantity or construction used in the discrete average-treatment-effect estimator.

Definition (Lean source)
noncomputable def selectedFixedLightCentered {n d : ℕ} (P : DiscreteLaw d) (sample : Fin n → Obs d) (S : Finset (Fin d)) : ℝ := ∑ k ∈ S, lightIndicator sample k * (factorialPolynomialContribution sample k - sparsePolynomialMean P k (polynomialDegree n) (bandwidth n))
CausalSmith.Stat.DiscreteAteMinimaxLoggap.selectedFixedLightCentered · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellRatePilot.lean:286
theorem selectedFixedLightCentered_second_moment_le

Establishes the stated upper bound for selected Fixed Light Centered second moment le.

Formal statement
n d :
P :
S :
hn :
0 < splitSize n 1
hM :
0 < polynomialDegree n
hB :
0 < bandwidth n
hsize :
4 * polynomialDegree n ^ 2 ≤ splitSize n 1
hlight :
∀ k ∈ S, cellMass P k + 4 * (polynomialDegree n : ℝ) / splitSize n 1 ≤ bandwidth n
∫ ω : ℕ → Obs d, selectedFixedLightCentered P (fun i : Fin n => ω i) S ^ 2 ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P))
≤ (S.card : ℝ) * (8 * (exp 1 + 1)) * (bandwidth n * 6 ^ polynomialDegree n) ^ 2
+ (S.card : ℝ) ^ 2 * (8 * (polynomialDegree n : ℝ) ^ 2 / splitSize n 1) * (bandwidth n * 6 ^ polynomialDegree n) ^ 2
Proof (Lean source)
lemma selectedFixedLightCentered_second_moment_le {n d : ℕ} (P : DiscreteLaw d) (S : Finset (Fin d)) (hn : 0 < splitSize n 1) (hM : 0 < polynomialDegree n) (hB : 0 < bandwidth n) (hsize : 4 * polynomialDegree n ^ 2 ≤ splitSize n 1) (hlight : ∀ k ∈ S, cellMass P k + 4 * (polynomialDegree n : ℝ) / splitSize n 1 ≤ bandwidth n) : ∫ ω : ℕ → Obs d, selectedFixedLightCentered P (fun i : Fin n => ω i) S ^ 2 ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P)) ≤ (S.card : ℝ) * (8 * (exp 1 + 1)) * (bandwidth n * 6 ^ polynomialDegree n) ^ 2 + (S.card : ℝ) ^ 2 * (8 * (polynomialDegree n : ℝ) ^ 2 / splitSize n 1) * (bandwidth n * 6 ^ polynomialDegree n) ^ 2 := by classical let E := fun k : Fin d => fun ω : ℕ → Obs d => factorialPolynomialContribution (fun i : Fin n => ω i) k - sparsePolynomialMean P k (polynomialDegree n) (bandwidth n) let I := fun k : Fin d => fun ω : ℕ → Obs d => lightIndicator (fun i : Fin n => ω i) k let D := 8 * (exp 1 + 1) * (bandwidth n * 6 ^ polynomialDegree n) ^ 2 let Q := 8 * (polynomialDegree n : ℝ) ^ 2 / splitSize n 1 * (bandwidth n * 6 ^ polynomialDegree n) ^ 2 have hmass (k : Fin d) (hk : k ∈ S) : cellMass P k ≤ bandwidth n := (le_add_of_nonneg_right (by positivity : 0 ≤ 4 * (polynomialDegree n : ℝ) / splitSize n 1)).trans (hlight k hk) have hest (k : Fin d) (hk : k ∈ S) (l : Fin d) (hl : l ∈ S) : ∫ ω : ℕ → Obs d, E k ω * E l ω ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P)) ≤ (if k = l then D else 0) + Q := by by_cases hkl : k = l · subst l rw [if_pos rfl] have hd := integral_factorialPolynomial_centered_sq_le P k hn hM hB hsize (hlight k hk) (hmass k hk) have hd' : (∫ ω, E k ω * E k ω ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P))) ≤ D := by simpa only [E, D, pow_two] using hd refine hd'.trans (le_add_of_nonneg_right ?_) dsimp only [Q] positivity · rw [if_neg hkl, zero_add] simpa only [E, Q] using integral_factorialPolynomial_centered_cross_le P k l hkl hM hB hsize (hmass k hk) (hmass l hl) have hpair (k : Fin d) (hk : k ∈ S) (l : Fin d) (hl : l ∈ S) : ∫ ω : ℕ → Obs d, (I k ω * I l ω) * (E k ω * E l ω) ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P)) ≤ (if k = l then D else 0) + Q := by dsimp only [I, E] rw [lightIndicator_centered_pair_factorization P k l] let p := ∫ ω : ℕ → Obs d, I k ω * I l ω ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P)) let x := ∫ ω : ℕ → Obs d, E k ω * E l ω ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P)) let U := (if k = l then D else 0) + Q have hp := integral_lightIndicator_pair_mem_Icc (n := n) P k l have hx : x ≤ U := hest k hk l hl have hU : 0 ≤ U := by dsimp only [U, D, Q] split_ifs <;> positivity change p * x ≤ U by_cases hx0 : 0 ≤ x · calc p * x ≤ 1 * x := mul_le_mul_of_nonneg_right hp.2 hx0 _ ≤ U := by simpa using hx · have hxneg : x ≤ 0 := le_of_not_ge hx0 exact (mul_nonpos_of_nonneg_of_nonpos hp.1 hxneg).trans hU change (∫ ω : ℕ → Obs d, (∑ k ∈ S, I k ω * E k ω) ^ 2 ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P))) ≤ _ rw [show (fun ω : ℕ → Obs d => (∑ k ∈ S, I k ω * E k ω) ^ 2) = (fun ω => ∑ k ∈ S, ∑ l ∈ S, (I k ω * I l ω) * (E k ω * E l ω)) by funext ω rw [pow_two, Finset.sum_mul_sum] apply Finset.sum_congr rfl intro k hk apply Finset.sum_congr rfl intro l hl ring] rw [integral_finset_sum S (fun k _ => integrable_finset_sum S (fun l _ => integrable_selected_centeredPolynomial_pair P k l))] simp_rw [integral_finset_sum S (fun l _ => integrable_selected_centeredPolynomial_pair P _ l)] refine (Finset.sum_le_sum fun k hk => Finset.sum_le_sum fun l hl => hpair k hk l hl).trans ?_ have hsum : sum S (fun k => sum S (fun l => (if k = l then D else 0) + Q)) = (S.card : ℝ) * D + (S.card : ℝ) ^ 2 * Q := by simp [Finset.sum_add_distrib, pow_two] ring rw [hsum] dsimp only [D, Q] ring_nf exact le_refl _
CausalSmith.Stat.DiscreteAteMinimaxLoggap.selectedFixedLightCentered_second_moment_le · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellRatePilot.lean:297
theorem sparseArmEnvelope_le_growth

Coefficient growth away from the genuinely-light cone. This is the quantitative content of equations (21)--(22), before inserting the pilot-tail exponent.

Formal statement
M :
hM :
2 ≤ M
B w :
hB :
0 < B
hw :
1 ≤ w
v :
Cell → ℝ
hv :
∀ ay, 0 ≤ v ay
hR :
(∑ ay : Cell, v ay) ≤ B * w
a :
Fin 2
sparseArmEnvelope M B v a ≤ B * 6 ^ M * w ^ M
Proof (Lean source)
lemma sparseArmEnvelope_le_growth {M : ℕ} (hM : 2 ≤ M) {B w : ℝ} (hB : 0 < B) (hw : 1 ≤ w) (v : Cell → ℝ) (hv : ∀ ay, 0 ≤ v ay) (hR : (∑ ay : Cell, v ay) ≤ B * w) (a : Fin 2) : sparseArmEnvelope M B v a ≤ B * 6 ^ M * w ^ M := by rw [sparseArmEnvelope_eq hB v hv a] let R := ∑ ay : Cell, v ay let A := v (a, 0) + v (a, 1) have hR0 : 0 ≤ R := sum_nonneg fun ay _ => hv ay have hA0 : 0 ≤ A := add_nonneg (hv _) (hv _) have hAR : A ≤ R := by rcases a with ⟨a, ha⟩ interval_cases a <;> simp [A, R, Fintype.sum_prod_type, Fin.sum_univ_two] <;> linarith [hv (0, 0), hv (0, 1), hv (1, 0), hv (1, 1)] have hvaR : v (a, 1) ≤ R := (le_add_of_nonneg_left (hv (a, 0))).trans hAR have hBw0 : 0 ≤ B * w := mul_nonneg hB.le (le_trans (by norm_num) hw) have hz0 : 0 ≤ A / B := div_nonneg hA0 hB.le have hzw : A / B ≤ w := by apply (div_le_iff₀ hB).2 simpa [mul_comm] using hAR.trans hR have hpow : (A / B) ^ (M - 2) ≤ w ^ (M - 2) := pow_le_pow_left₀ hz0 hzw _ have hg : gpos M (A / B) ≤ 6 ^ M * w ^ (M - 2) := by refine (gpos_bound (by omega) hz0).trans ?_ have hmax : max 1 ((A / B) ^ (M - 2)) ≤ w ^ (M - 2) := by apply max_le · exact one_le_pow₀ hw · exact hpow exact mul_le_mul_of_nonneg_left hmax (by positivity) have hbinv : 0 ≤ B⁻¹ := (inv_pos.mpr hB).le have hgp0 := gpos_nonneg M hz0 have hvaBw : v (a, 1) ≤ B * w := hvaR.trans hR calc B⁻¹ * R * v (a, 1) * gpos M (A / B) ≤ B⁻¹ * (B * w) * (B * w) * (6 ^ M * w ^ (M - 2)) := by exact mul_le_mul (mul_le_mul (mul_le_mul_of_nonneg_left hR hbinv) hvaBw (hv _) (mul_nonneg hbinv hBw0)) hg hgp0 (mul_nonneg (mul_nonneg hbinv hBw0) hBw0) _ = B * 6 ^ M * w ^ M := by calc B⁻¹ * (B * w) * (B * w) * (6 ^ M * w ^ (M - 2)) = B * 6 ^ M * (w ^ 2 * w ^ (M - 2)) := by field_simp [hB.ne'] _ = B * 6 ^ M * w ^ M := by rw [← pow_add] congr 3 omega
CausalSmith.Stat.DiscreteAteMinimaxLoggap.sparseArmEnvelope_le_growth · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellRatePilot.lean:397
theorem sparseArmEnvelope_cell_growth

Establishes the stated property of sparse Arm Envelope cell growth in the discrete average-treatment-effect construction.

Formal statement
n d :
P :
k :
Fin d
a :
Fin 2
hM :
hB :
0 < bandwidth n
hn :
0 < splitSize n 1
hshift :
4 * polynomialDegree n / (splitSize n 1 : ℝ) ≤ 3 * bandwidth n / 4
Proof (Lean source)
lemma sparseArmEnvelope_cell_growth {n d : ℕ} (P : DiscreteLaw d) (k : Fin d) (a : Fin 2) (hM : 2 ≤ polynomialDegree n) (hB : 0 < bandwidth n) (hn : 0 < splitSize n 1) (hshift : 4 * polynomialDegree n / (splitSize n 1 : ℝ) ≤ 3 * bandwidth n / 4) : sparseArmEnvelope (polynomialDegree n) (bandwidth n) (shiftedCellVector P k (polynomialDegree n) (splitSize n 1)) a ≤ bandwidth n * 6 ^ polynomialDegree n * (1 + cellMass P k / bandwidth n) ^ polynomialDegree n := by let w := 1 + cellMass P k / bandwidth n have hw : 1 ≤ w := by dsimp only [w] exact le_add_of_nonneg_right (div_nonneg (cellMass_mem_unitInterval P k).1 hB.le) apply sparseArmEnvelope_le_growth hM hB hw _ (shiftedCellVector_nonneg P k (polynomialDegree n) (splitSize n 1)) rw [shiftedCellVector_sum] change cellMass P k + 4 * (polynomialDegree n : ℝ) / splitSize n 1 ≤ bandwidth n * w have hs : 4 * (polynomialDegree n : ℝ) / splitSize n 1 ≤ bandwidth n := hshift.trans (by linarith [hB]) dsimp only [w] rw [mul_add, mul_one, mul_div_cancel₀ _ hB.ne'] linarith
CausalSmith.Stat.DiscreteAteMinimaxLoggap.sparseArmEnvelope_cell_growth · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellRatePilot.lean:451
theorem integral_factorialPolynomial_sq_growth

Evaluates or bounds the stated integral involving integral factorial Polynomial sq growth.

Formal statement
n d :
P :
k :
Fin d
hn :
0 < splitSize n 1
hM :
hB :
0 < bandwidth n
hsize :
4 * polynomialDegree n ^ 2 ≤ splitSize n 1
hshift :
4 * polynomialDegree n / (splitSize n 1 : ℝ) ≤ 3 * bandwidth n / 4
∫ ω : ℕ → Obs d, factorialPolynomialContribution (fun i : Fin n => ω i) k ^ 2 ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P))
≤ 4 * exp 1 * (bandwidth n * 6 ^ polynomialDegree n * (1 + cellMass P k / bandwidth n) ^ polynomialDegree n) ^ 2
Proof (Lean source)
lemma integral_factorialPolynomial_sq_growth {n d : ℕ} (P : DiscreteLaw d) (k : Fin d) (hn : 0 < splitSize n 1) (hM : 2 ≤ polynomialDegree n) (hB : 0 < bandwidth n) (hsize : 4 * polynomialDegree n ^ 2 ≤ splitSize n 1) (hshift : 4 * polynomialDegree n / (splitSize n 1 : ℝ) ≤ 3 * bandwidth n / 4) : ∫ ω : ℕ → Obs d, factorialPolynomialContribution (fun i : Fin n => ω i) k ^ 2 ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P)) ≤ 4 * exp 1 * (bandwidth n * 6 ^ polynomialDegree n * (1 + cellMass P k / bandwidth n) ^ polynomialDegree n) ^ 2 := by let R := bandwidth n * 6 ^ polynomialDegree n * (1 + cellMass P k / bandwidth n) ^ polynomialDegree n have henv (a : Fin 2) : sparseArmEnvelope (polynomialDegree n) (bandwidth n) (shiftedCellVector P k (polynomialDegree n) (splitSize n 1)) a ≤ R := sparseArmEnvelope_cell_growth P k a hM hB hn hshift let X := fun ω : ℕ → Obs d => sparseArmContribution (fun i : Fin n => ω i) k 1 let Y := fun ω : ℕ → Obs d => sparseArmContribution (fun i : Fin n => ω i) k 0 have hpoint (ω : ℕ → Obs d) : factorialPolynomialContribution (fun i : Fin n => ω i) k ^ 2 ≤ 2 * X ω ^ 2 + 2 * Y ω ^ 2 := by rw [factorialPolynomialContribution_eq_sparseArms] dsimp only [X, Y] nlinarith [sq_nonneg (sparseArmContribution (fun i : Fin n => ω i) k 1 + sparseArmContribution (fun i : Fin n => ω i) k 0)] have hmono : ∫ ω : ℕ → Obs d, factorialPolynomialContribution (fun i : Fin n => ω i) k ^ 2 ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P)) ≤ ∫ ω : ℕ → Obs d, (2 * X ω ^ 2 + 2 * Y ω ^ 2) ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P)) := by apply integral_mono (integrable_factorialPolynomialContribution_sq P k) · exact ((integrable_sparseArm_sq P k 1).const_mul 2).add ((integrable_sparseArm_sq P k 0).const_mul 2) · exact hpoint refine hmono.trans ?_ rw [integral_add, integral_const_mul, integral_const_mul] · have h1 := integral_sparseArm_sq_le P k 1 hn hsize |>.trans (mul_le_mul_of_nonneg_left (pow_le_pow_left₀ (sparseArmEnvelope_nonneg _ (shiftedCellVector_nonneg P k _ _) 1) (henv 1) 2) (Real.exp_pos 1).le) have h0 := integral_sparseArm_sq_le P k 0 hn hsize |>.trans (mul_le_mul_of_nonneg_left (pow_le_pow_left₀ (sparseArmEnvelope_nonneg _ (shiftedCellVector_nonneg P k _ _) 0) (henv 0) 2) (Real.exp_pos 1).le) change 2 * (∫ ω, X ω ^ 2 ∂_) + 2 * (∫ ω, Y ω ^ 2 ∂_) ≤ _ nlinarith · exact (integrable_sparseArm_sq P k 1).const_mul 2 · exact (integrable_sparseArm_sq P k 0).const_mul 2
CausalSmith.Stat.DiscreteAteMinimaxLoggap.integral_factorialPolynomial_sq_growth · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellRatePilot.lean:477
theorem light_integral_productLaw_eq_infinite

Evaluates or bounds the stated integral involving light integral product Law eq infinite.

Formal statement
n d :
P :
f :
(Fin n → Obs d) → ℝ
∫ sample, f sample ∂productLaw P n
= ∫ ω : ℕ → Obs d, f (fun i : Fin n => ω i) ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P))
Proof (Lean source)
lemma light_integral_productLaw_eq_infinite {n d : ℕ} (P : DiscreteLaw d) (f : (Fin n → Obs d) → ℝ) : ∫ sample, f sample ∂productLaw P n = ∫ ω : ℕ → Obs d, f (fun i : Fin n => ω i) ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P)) := by let trunc : (ℕ → Obs d) → (Fin n → Obs d) := fun ω i => ω i have htrunc : Measurable trunc := by fun_prop rw [productLaw, ← finProductLaw_eq_map (obsLaw P) n, integral_map htrunc.aemeasurable (measurable_of_finite f).aestronglyMeasurable]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.light_integral_productLaw_eq_infinite · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellRatePilot.lean:535
theorem integral_lightIndicator_eq_probability

Evaluates or bounds the stated integral involving integral light Indicator eq probability.

Formal statement
n d :
P :
k :
Fin d
∫ ω : ℕ → Obs d, lightIndicator (fun i : Fin n => ω i) k ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P))
= (productLaw P n).real {sample | k ∈ lightCells sample}
Proof (Lean source)
lemma integral_lightIndicator_eq_probability {n d : ℕ} (P : DiscreteLaw d) (k : Fin d) : ∫ ω : ℕ → Obs d, lightIndicator (fun i : Fin n => ω i) k ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P)) = (productLaw P n).real {sample | k ∈ lightCells sample} := by calc (∫ ω : ℕ → Obs d, lightIndicator (fun i : Fin n => ω i) k ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P))) = ∫ sample, lightIndicator sample k ∂productLaw P n := (light_integral_productLaw_eq_infinite (n := n) P (fun sample : Fin n → Obs d => lightIndicator sample k)).symm _ = _ := by have hpred : Measurable (fun sample : Fin n → Obs d => k ∈ lightCells sample) := measurable_of_finite _ have hE : MeasurableSet {sample : Fin n → Obs d | k ∈ lightCells sample} := by exact (Set.toFinite _).measurableSet rw [show (fun sample : Fin n → Obs d => lightIndicator sample k) = indicator {sample | k ∈ lightCells sample} (fun _ => (1 : ℝ)) by funext sample simp [lightIndicator, indicator]] rw [integral_indicator hE] simp [Measure.real]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.integral_lightIndicator_eq_probability · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellRatePilot.lean:546
theorem falseLight_selection_probability

Equation (20) for the actual calibrated light indicator.

Formal statement
n d :
P :
k :
Fin d
hcut :
hfalse :
bandwidth n / 4 < cellMass P k
(productLaw P n).real {sample | k ∈ lightCells sample}
exp (-((n / 2 : ℕ) * cellMass P k) / 8)
Proof (Lean source)
lemma falseLight_selection_probability {n d : ℕ} (P : DiscreteLaw d) (k : Fin d) (hcut : calibrationCutoff ≤ n) (hfalse : bandwidth n / 4 < cellMass P k) : (productLaw P n).real {sample | k ∈ lightCells sample} ≤ exp (-((n / 2 : ℕ) * cellMass P k) / 8) := by classical have hbase : cutoffProperty calibrationCutoff := by rw [calibrationCutoff] exact Nat.find_spec cutoffProperty_eventually have hp := hbase n hcut have hLpos : 0 < logScale n := by have ha0 : 0 < alpha0 := by unfold alpha0 dA have hlog6 : 0 < log (6 : ℝ) := Real.log_pos (by norm_num) have hlog : 0 < log (27 / 4 : ℝ) := Real.log_pos (by norm_num) positivity nlinarith [hp.1] have hm0 : 0 < splitSize n 0 := by have hM2 : 2 ≤ polynomialDegree n := by simp [polynomialDegree] have hm1sq := hp.2.1 have hM4 : 4 ≤ polynomialDegree n ^ 2 := by simpa [pow_two] using Nat.mul_self_le_mul_self hM2 have h16 : 16 ≤ splitSize n 1 := by nlinarith have hm1le : splitSize n 1 ≤ n := by rw [splitSize_one_eq]; omega have hn16 : 16 ≤ n := h16.trans hm1le rw [splitSize_zero_eq] omega have hmratio : splitSize n 1 ≤ 2 * splitSize n 0 := by have hM2 : 2 ≤ polynomialDegree n := by simp [polynomialDegree] have hM4 : 4 ≤ polynomialDegree n ^ 2 := by simpa [pow_two] using Nat.mul_self_le_mul_self hM2 have h16 : 16 ≤ splitSize n 1 := by nlinarith [hp.2.1] have hm1le : splitSize n 1 ≤ n := by rw [splitSize_one_eq]; omega have hn16 : 16 ≤ n := h16.trans hm1le rw [splitSize_zero_eq, splitSize_one_eq] omega have hmean : 2 * (256 * logScale n) < (n / 2 : ℕ) * cellMass P k := by rw [← splitSize_zero_eq] rw [bandwidth] at hfalse have hm0R : 0 < (splitSize n 0 : ℝ) := by exact_mod_cast hm0 have hM2 : 2 ≤ polynomialDegree n := by simp [polynomialDegree] have hM4 : 4 ≤ polynomialDegree n ^ 2 := by simpa [pow_two] using Nat.mul_self_le_mul_self hM2 have hm1nat : 0 < splitSize n 1 := by nlinarith [hp.2.1] have hm1R : 0 < (splitSize n 1 : ℝ) := by exact_mod_cast hm1nat have hmratioR : (splitSize n 1 : ℝ) ≤ 2 * splitSize n 0 := by exact_mod_cast hmratio norm_num [b0] at hfalse have hf : 1024 * logScale n / (splitSize n 1 : ℝ) < cellMass P k := by convert hfalse using 1 <;> ring have hmul := (div_lt_iff₀ hm1R).mp hf nlinarith have htail := pilotCategory_lower_tail P k hmean refine (measureReal_mono ?_).trans htail intro sample hs have hnlt : ¬n < calibrationCutoff := by omega have hnotHeavy : k ∉ heavyCells sample := by simpa [lightCells, hnlt] using hs rw [heavyCells, if_neg hnlt] at hnotHeavy simp only [mem_filter, Finset.mem_univ, true_and, not_lt] at hnotHeavy change (splitCategoryCount sample 0 k : ℝ) ≤ 256 * logScale n simpa [lambda0] using hnotHeavy
CausalSmith.Stat.DiscreteAteMinimaxLoggap.falseLight_selection_probability · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellRatePilot.lean:571
theorem falseLight_tail_times_growth

The positive polynomial growth is dominated by the calibrated pilot-tail exponent. The deliberately coarse constant 49 leaves ample slack.

Formal statement
n d :
P :
k :
Fin d
hcut :
hfalse :
bandwidth n / 4 < cellMass P k
exp (-((n / 2 : ℕ) * cellMass P k) / 8) * (6 ^ polynomialDegree n * (1 + cellMass P k / bandwidth n) ^ polynomialDegree n) ^ 2
exp (-49 * logScale n)
Proof (Lean source)
lemma falseLight_tail_times_growth {n d : ℕ} (P : DiscreteLaw d) (k : Fin d) (hcut : calibrationCutoff ≤ n) (hfalse : bandwidth n / 4 < cellMass P k) : exp (-((n / 2 : ℕ) * cellMass P k) / 8) * (6 ^ polynomialDegree n * (1 + cellMass P k / bandwidth n) ^ polynomialDegree n) ^ 2 ≤ exp (-49 * logScale n) := by classical have hbase : cutoffProperty calibrationCutoff := by rw [calibrationCutoff] exact Nat.find_spec cutoffProperty_eventually rcases hbase n hcut with ⟨hscale, hsize, hshift⟩ have ha0 : 0 < alpha0 := by unfold alpha0 dA have hlog6 : 0 < log (6 : ℝ) := Real.log_pos (by norm_num) have hlog : 0 < log (27 / 4 : ℝ) := Real.log_pos (by norm_num) positivity have ha1 : alpha0 ≤ 1 := by simp [alpha0] have hL : 0 < logScale n := by nlinarith have hM2 : 2 ≤ polynomialDegree n := by simp [polynomialDegree] have hm1 : 0 < splitSize n 1 := by nlinarith have hm0 : 0 < splitSize n 0 := by have hM4 : 4 ≤ polynomialDegree n ^ 2 := by simpa [pow_two] using Nat.mul_self_le_mul_self hM2 have h16 : 16 ≤ splitSize n 1 := by nlinarith have hm1le : splitSize n 1 ≤ n := by rw [splitSize_one_eq]; omega have hn16 : 16 ≤ n := h16.trans hm1le rw [splitSize_zero_eq] omega have hmratio : splitSize n 1 ≤ 2 * splitSize n 0 := by have hM4 : 4 ≤ polynomialDegree n ^ 2 := by simpa [pow_two] using Nat.mul_self_le_mul_self hM2 have h16 : 16 ≤ splitSize n 1 := by nlinarith have hm1le : splitSize n 1 ≤ n := by rw [splitSize_one_eq]; omega have hn16 : 16 ≤ n := h16.trans hm1le rw [splitSize_zero_eq, splitSize_one_eq] omega have hB : 0 < bandwidth n := by rw [bandwidth] exact div_pos (mul_pos (by norm_num [b0]) hL) (by exact_mod_cast hm1) let M := polynomialDegree n let B := bandwidth n let p := cellMass P k let z := p / B let w := 1 + z have hz : 1 / 4 < z := by dsimp only [z, p, B] apply (lt_div_iff₀ hB).2 nlinarith [hfalse] have hz0 : 0 < z := (by linarith : 0 < z) have hw : 0 < w := by dsimp only [w]; linarith have hx : 0 < 6 * w := mul_pos (by norm_num) hw have hwz : w ≤ 5 * z := by dsimp only [w]; linarith have hxz : 6 * w ≤ 30 * z := by nlinarith have hMle : (M : ℝ) ≤ logScale n := by have hfloor2 : (2 : ℤ) ≤ ⌊alpha0 * logScale n⌋ := by rw [Int.le_floor] exact_mod_cast hscale have hmax : M = Int.toNat ⌊alpha0 * logScale n⌋ := by dsimp only [M] rw [polynomialDegree, max_eq_right] exact Int.toNat_le_toNat hfloor2 rw [hmax] have hfloor0 : 0 ≤ ⌊alpha0 * logScale n⌋ := le_trans (by norm_num) hfloor2 rw [show ((Int.toNat ⌊alpha0 * logScale n⌋ : ℕ) : ℝ) = ((⌊alpha0 * logScale n⌋ : ℤ) : ℝ) by exact_mod_cast Int.toNat_of_nonneg hfloor0] exact (Int.floor_le _).trans (mul_le_of_le_one_left hL.le ha1) have hlog : log (6 * w) ≤ 30 * z := (Real.log_le_sub_one_of_pos hx).trans (by linarith) have hgrowthExp : 2 * (M : ℝ) * log (6 * w) ≤ 60 * logScale n * z := by have hlog0 : 0 ≤ log (6 * w) := Real.log_nonneg (by nlinarith [hz] : 1 ≤ 6 * w) nlinarith have htailExp : 256 * logScale n * z ≤ (splitSize n 0 : ℝ) * p / 8 := by have hm0R : 0 < (splitSize n 0 : ℝ) := by exact_mod_cast hm0 have hm1R : 0 < (splitSize n 1 : ℝ) := by exact_mod_cast hm1 have hmratioR : (splitSize n 1 : ℝ) ≤ 2 * splitSize n 0 := by exact_mod_cast hmratio have hpz : p = B * z := by dsimp only [z] rw [mul_div_cancel₀ p hB.ne'] rw [hpz] dsimp only [B] rw [bandwidth] norm_num [b0] field_simp nlinarith have hexp : -((splitSize n 0 : ℝ) * p) / 8 + 2 * (M : ℝ) * log (6 * w) ≤ -49 * logScale n := by have hzquarter : 1 / 4 ≤ z := hz.le nlinarith have hpow : (6 ^ M * w ^ M) ^ 2 = exp (2 * (M : ℝ) * log (6 * w)) := by have hnat : (6 * w) ^ M = exp ((M : ℝ) * log (6 * w)) := by rw [← Real.rpow_natCast, Real.rpow_def_of_pos hx] congr 1 ring rw [← mul_pow, hnat, pow_two, ← Real.exp_add] congr 1 ring have hfinal : exp (-((splitSize n 0 : ℝ) * p) / 8) * (6 ^ M * w ^ M) ^ 2 ≤ exp (-49 * logScale n) := by rw [hpow, ← Real.exp_add] exact Real.exp_le_exp.mpr hexp simpa only [M, p, z, w, splitSize_zero_eq] using hfinal
CausalSmith.Stat.DiscreteAteMinimaxLoggap.falseLight_tail_times_growth · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellRatePilot.lean:636
theorem lightIndicator_target_pair_factorization

Establishes the stated property of light Indicator target pair factorization in the discrete average-treatment-effect construction.

Formal statement
n d :
P :
k l :
Fin d
tk tl :
∫ ω : ℕ → Obs d, (lightIndicator (fun i : Fin n => ω i) k * lightIndicator (fun i : Fin n => ω i) l) * ((factorialPolynomialContribution (fun i : Fin n => ω i) k - tk) * (factorialPolynomialContribution (fun i : Fin n => ω i) l - tl)) ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P))
= (∫ ω : ℕ → Obs d, lightIndicator (fun i : Fin n => ω i) k * lightIndicator (fun i : Fin n => ω i) l ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P))) * ∫ ω : ℕ → Obs d, (factorialPolynomialContribution (fun i : Fin n => ω i) k - tk) * (factorialPolynomialContribution (fun i : Fin n => ω i) l - tl) ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P))
Proof (Lean source)
lemma lightIndicator_target_pair_factorization {n d : ℕ} (P : DiscreteLaw d) (k l : Fin d) (tk tl : ℝ) : ∫ ω : ℕ → Obs d, (lightIndicator (fun i : Fin n => ω i) k * lightIndicator (fun i : Fin n => ω i) l) * ((factorialPolynomialContribution (fun i : Fin n => ω i) k - tk) * (factorialPolynomialContribution (fun i : Fin n => ω i) l - tl)) ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P)) = (∫ ω : ℕ → Obs d, lightIndicator (fun i : Fin n => ω i) k * lightIndicator (fun i : Fin n => ω i) l ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P))) * ∫ ω : ℕ → Obs d, (factorialPolynomialContribution (fun i : Fin n => ω i) k - tk) * (factorialPolynomialContribution (fun i : Fin n => ω i) l - tl) ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P)) := by let base : Obs d := (k, false, false) let pilot := fun x : (lightBalancedSplit P).foldA n → Obs d => lightIndicator (rebuildPilotSample P base x) k * lightIndicator (rebuildPilotSample P base x) l let estimate := fun x : (lightBalancedSplit P).foldB n → Obs d => (factorialPolynomialContribution (rebuildEstimationSample P base x) k - tk) * (factorialPolynomialContribution (rebuildEstimationSample P base x) l - tl) have h := oneShot_integral_mul_factorization (lightBalancedSplit P) n pilot estimate (measurable_of_finite _) (measurable_of_finite _) have hp (ω : ℕ → Obs d) : pilot (fun i : (lightBalancedSplit P).foldA n => ω i) = lightIndicator (fun i : Fin n => ω i) k * lightIndicator (fun i : Fin n => ω i) l := by dsimp only [pilot] rw [lightIndicator_rebuildPilot P base ω k, lightIndicator_rebuildPilot P base ω l] have he (ω : ℕ → Obs d) : estimate (fun i : (lightBalancedSplit P).foldB n => ω i) = (factorialPolynomialContribution (fun i : Fin n => ω i) k - tk) * (factorialPolynomialContribution (fun i : Fin n => ω i) l - tl) := by dsimp only [estimate] rw [factorialPolynomialContribution_rebuildEstimation P base ω k, factorialPolynomialContribution_rebuildEstimation P base ω l] dsimp only [iidSample_infinitePi] at h calc _ = ∫ ω, (pilot (fun i => ω i)) * estimate (fun i => ω i) ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P)) := by apply integral_congr_ae filter_upwards with ω rw [hp, he] _ = _ := h _ = _ := by congr 1 · apply integral_congr_ae filter_upwards with ω exact hp ω · apply integral_congr_ae filter_upwards with ω exact he ω
CausalSmith.Stat.DiscreteAteMinimaxLoggap.lightIndicator_target_pair_factorization · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellRatePilot.lean:752
theorem integral_factorialPolynomial_target_sq_growth

Evaluates or bounds the stated integral involving integral factorial Polynomial target sq growth.

Formal statement
n d :
epsilon :
P :
hOverlap :
Overlap epsilon P
k :
Fin d
hn :
0 < splitSize n 1
hM :
hB :
0 < bandwidth n
hsize :
4 * polynomialDegree n ^ 2 ≤ splitSize n 1
hshift :
4 * polynomialDegree n / (splitSize n 1 : ℝ) ≤ 3 * bandwidth n / 4
∫ ω : ℕ → Obs d, (factorialPolynomialContribution (fun i : Fin n => ω i) k - cellPhi (cellVector P k)) ^ 2 ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P))
≤ 8 * (exp 1 + 1) * bandwidth n ^ 2 * (6 ^ polynomialDegree n * (1 + cellMass P k / bandwidth n) ^ polynomialDegree n) ^ 2
Proof (Lean source)
lemma integral_factorialPolynomial_target_sq_growth {n d : ℕ} {epsilon : ℝ} (P : DiscreteLaw d) (hOverlap : Overlap epsilon P) (k : Fin d) (hn : 0 < splitSize n 1) (hM : 2 ≤ polynomialDegree n) (hB : 0 < bandwidth n) (hsize : 4 * polynomialDegree n ^ 2 ≤ splitSize n 1) (hshift : 4 * polynomialDegree n / (splitSize n 1 : ℝ) ≤ 3 * bandwidth n / 4) : ∫ ω : ℕ → Obs d, (factorialPolynomialContribution (fun i : Fin n => ω i) k - cellPhi (cellVector P k)) ^ 2 ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P)) ≤ 8 * (exp 1 + 1) * bandwidth n ^ 2 * (6 ^ polynomialDegree n * (1 + cellMass P k / bandwidth n) ^ polynomialDegree n) ^ 2 := by let X := fun ω : ℕ → Obs d => factorialPolynomialContribution (fun i : Fin n => ω i) k let t := cellPhi (cellVector P k) let G := 6 ^ polynomialDegree n * (1 + cellMass P k / bandwidth n) ^ polynomialDegree n have hz0 : 0 ≤ cellMass P k / bandwidth n := div_nonneg (cellMass_mem_unitInterval P k).1 hB.le have hw0 : 0 ≤ 1 + cellMass P k / bandwidth n := by linarith have hG0 : 0 ≤ G := by dsimp only [G] exact mul_nonneg (pow_nonneg (by norm_num) _ ) (pow_nonneg hw0 _) have hzone : cellMass P k / bandwidth n ≤ G := by have hw : 1 ≤ 1 + cellMass P k / bandwidth n := by linarith have hM1 : 1 ≤ polynomialDegree n := by omega calc cellMass P k / bandwidth n ≤ 1 + cellMass P k / bandwidth n := by linarith _ ≤ (1 + cellMass P k / bandwidth n) ^ polynomialDegree n := by simpa using pow_le_pow_right₀ hw hM1 _ ≤ G := by dsimp only [G] have h6 : (1 : ℝ) ≤ 6 ^ polynomialDegree n := one_le_pow₀ (by norm_num) nlinarith [pow_nonneg (by linarith : 0 ≤ 1 + cellMass P k / bandwidth n) (polynomialDegree n)] have ht : |t| ≤ bandwidth n * G := by refine (abs_cellPhi_cellVector_le_mass P hOverlap k).trans ?_ have hp : cellMass P k = bandwidth n * (cellMass P k / bandwidth n) := by field_simp [hB.ne'] rw [hp] exact mul_le_mul_of_nonneg_left hzone hB.le have ht2 : t ^ 2 ≤ (bandwidth n * G) ^ 2 := by rw [← sq_abs] exact pow_le_pow_left₀ (abs_nonneg _) ht 2 have hpoint (ω : ℕ → Obs d) : (X ω - t) ^ 2 ≤ 2 * X ω ^ 2 + 2 * t ^ 2 := by nlinarith [sq_nonneg (X ω + t)] have hmono : (∫ ω, (X ω - t) ^ 2 ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P))) ≤ ∫ ω, (2 * X ω ^ 2 + 2 * t ^ 2) ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P)) := by apply integral_mono · have hi : Integrable (fun ω : ℕ → Obs d => factorialPolynomialContribution (fun i : Fin n => ω i) k ^ 2 - ((2 * t) * factorialPolynomialContribution (fun i : Fin n => ω i) k - t ^ 2)) (Measure.infinitePi (fun _ : ℕ => obsLaw P)) := (integrable_factorialPolynomialContribution_sq (n := n) P k).sub (((integrable_factorialPolynomialContribution_trunc_rate P k).const_mul (2 * t)).sub (integrable_const (t ^ 2))) convert hi using 1 funext ω dsimp only [X] ring · exact ((integrable_factorialPolynomialContribution_sq P k).const_mul 2).add (integrable_const (2 * t ^ 2)) · exact hpoint refine hmono.trans ?_ rw [integral_add, integral_const_mul, integral_const] simp only [probReal_univ, one_smul] · have hX := integral_factorialPolynomial_sq_growth P k hn hM hB hsize hshift change 2 * (∫ ω, X ω ^ 2 ∂_) + 2 * t ^ 2 ≤ _ nlinarith [Real.exp_pos 1, sq_nonneg (bandwidth n * G)] · exact (integrable_factorialPolynomialContribution_sq P k).const_mul 2 · exact integrable_const _
CausalSmith.Stat.DiscreteAteMinimaxLoggap.integral_factorialPolynomial_target_sq_growth · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellRatePilot.lean:809
theorem falseLight_selected_error_sq

Equations (20)--(24) combined for one falsely selected light cell.

Formal statement
n d :
epsilon :
P :
hOverlap :
Overlap epsilon P
k :
Fin d
hcut :
hfalse :
bandwidth n / 4 < cellMass P k
∫ ω : ℕ → Obs d, lightIndicator (fun i : Fin n => ω i) k * (factorialPolynomialContribution (fun i : Fin n => ω i) k - cellPhi (cellVector P k)) ^ 2 ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P))
≤ 8 * (exp 1 + 1) * bandwidth n ^ 2 * exp (-49 * logScale n)
Proof (Lean source)
lemma falseLight_selected_error_sq {n d : ℕ} {epsilon : ℝ} (P : DiscreteLaw d) (hOverlap : Overlap epsilon P) (k : Fin d) (hcut : calibrationCutoff ≤ n) (hfalse : bandwidth n / 4 < cellMass P k) : ∫ ω : ℕ → Obs d, lightIndicator (fun i : Fin n => ω i) k * (factorialPolynomialContribution (fun i : Fin n => ω i) k - cellPhi (cellVector P k)) ^ 2 ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P)) ≤ 8 * (exp 1 + 1) * bandwidth n ^ 2 * exp (-49 * logScale n) := by classical have hbase : cutoffProperty calibrationCutoff := by rw [calibrationCutoff] exact Nat.find_spec cutoffProperty_eventually rcases hbase n hcut with ⟨_hscale, hsize, hshift⟩ have hM : 2 ≤ polynomialDegree n := by simp [polynomialDegree] have hM4 : 4 ≤ polynomialDegree n ^ 2 := by simpa [pow_two] using Nat.mul_self_le_mul_self hM have hn : 0 < splitSize n 1 := by nlinarith have hL : 0 < logScale n := by have ha0 : 0 < alpha0 := by unfold alpha0 dA have hlog6 : 0 < log (6 : ℝ) := Real.log_pos (by norm_num) have hlog : 0 < log (27 / 4 : ℝ) := Real.log_pos (by norm_num) positivity nlinarith have hB : 0 < bandwidth n := by rw [bandwidth] exact div_pos (mul_pos (by norm_num [b0]) hL) (by exact_mod_cast hn) rw [show (fun ω : ℕ → Obs d => lightIndicator (fun i : Fin n => ω i) k * (factorialPolynomialContribution (fun i : Fin n => ω i) k - cellPhi (cellVector P k)) ^ 2) = (fun ω => (lightIndicator (fun i : Fin n => ω i) k * lightIndicator (fun i : Fin n => ω i) k) * ((factorialPolynomialContribution (fun i : Fin n => ω i) k - cellPhi (cellVector P k)) * (factorialPolynomialContribution (fun i : Fin n => ω i) k - cellPhi (cellVector P k)))) by funext ω unfold lightIndicator split_ifs <;> ring, lightIndicator_target_pair_factorization P k k (cellPhi (cellVector P k)) (cellPhi (cellVector P k))] have hp : (∫ ω : ℕ → Obs d, lightIndicator (fun i : Fin n => ω i) k * lightIndicator (fun i : Fin n => ω i) k ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P))) ≤ exp (-((n / 2 : ℕ) * cellMass P k) / 8) := by rw [show (fun ω : ℕ → Obs d => lightIndicator (fun i : Fin n => ω i) k * lightIndicator (fun i : Fin n => ω i) k) = (fun ω => lightIndicator (fun i : Fin n => ω i) k) by funext ω unfold lightIndicator split_ifs <;> norm_num, integral_lightIndicator_eq_probability] exact falseLight_selection_probability P k hcut hfalse have he := integral_factorialPolynomial_target_sq_growth P hOverlap k hn hM hB hsize hshift have he' : (∫ ω : ℕ → Obs d, (factorialPolynomialContribution (fun i : Fin n => ω i) k - cellPhi (cellVector P k)) * (factorialPolynomialContribution (fun i : Fin n => ω i) k - cellPhi (cellVector P k)) ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P))) ≤ 8 * (exp 1 + 1) * bandwidth n ^ 2 * (6 ^ polynomialDegree n * (1 + cellMass P k / bandwidth n) ^ polynomialDegree n) ^ 2 := by simpa only [pow_two] using he have hp0 := (integral_lightIndicator_pair_mem_Icc (n := n) P k k).1 have he0 : 0 ≤ ∫ ω : ℕ → Obs d, (factorialPolynomialContribution (fun i : Fin n => ω i) k - cellPhi (cellVector P k)) * (factorialPolynomialContribution (fun i : Fin n => ω i) k - cellPhi (cellVector P k)) ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P)) := by apply integral_nonneg_of_ae filter_upwards with ω exact mul_self_nonneg _ calc (∫ ω : ℕ → Obs d, lightIndicator (fun i : Fin n => ω i) k * lightIndicator (fun i : Fin n => ω i) k ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P))) * (∫ ω : ℕ → Obs d, (factorialPolynomialContribution (fun i : Fin n => ω i) k - cellPhi (cellVector P k)) * (factorialPolynomialContribution (fun i : Fin n => ω i) k - cellPhi (cellVector P k)) ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P))) ≤ exp (-((n / 2 : ℕ) * cellMass P k) / 8) * (8 * (exp 1 + 1) * bandwidth n ^ 2 * (6 ^ polynomialDegree n * (1 + cellMass P k / bandwidth n) ^ polynomialDegree n) ^ 2) := by exact mul_le_mul hp he' he0 (Real.exp_pos _).le _ ≤ 8 * (exp 1 + 1) * bandwidth n ^ 2 * exp (-49 * logScale n) := by have hg := falseLight_tail_times_growth P k hcut hfalse have hc : 0 ≤ 8 * (exp 1 + 1) * bandwidth n ^ 2 := by positivity nlinarith
CausalSmith.Stat.DiscreteAteMinimaxLoggap.falseLight_selected_error_sq · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellRatePilot.lean:887
def falseLightSet

Defines false Light Set, the stated quantity or construction used in the discrete average-treatment-effect estimator.

Definition (Lean source)
noncomputable def falseLightSet {n d : ℕ} (P : DiscreteLaw d) : Finset (Fin d) := Finset.univ.filter fun k => bandwidth n / 4 < cellMass P k
def selectedFalseLightError

Defines selected False Light Error, the stated quantity or construction used in the discrete average-treatment-effect estimator.

Definition (Lean source)
noncomputable def selectedFalseLightError {n d : ℕ} (P : DiscreteLaw d) (sample : Fin n → Obs d) : ℝ := ∑ k ∈ falseLightSet (n := n) P, lightIndicator sample k * (factorialPolynomialContribution sample k - cellPhi (cellVector P k))
CausalSmith.Stat.DiscreteAteMinimaxLoggap.selectedFalseLightError · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellRatePilot.lean:996
theorem integrable_selected_target_pair

Shows that integrable selected target pair is integrable under the stated sampling distribution.

Formal statement
n d :
P :
k l :
Fin d
tk tl :
Integrable (fun ω : ℕ → Obs d => (lightIndicator (fun i : Fin n => ω i) k * lightIndicator (fun i : Fin n => ω i) l) * ((factorialPolynomialContribution (fun i : Fin n => ω i) k - tk) * (factorialPolynomialContribution (fun i : Fin n => ω i) l - tl))) (Measure.infinitePi (fun _ : ℕ => obsLaw P))
Proof (Lean source)
lemma integrable_selected_target_pair {n d : ℕ} (P : DiscreteLaw d) (k l : Fin d) (tk tl : ℝ) : Integrable (fun ω : ℕ → Obs d => (lightIndicator (fun i : Fin n => ω i) k * lightIndicator (fun i : Fin n => ω i) l) * ((factorialPolynomialContribution (fun i : Fin n => ω i) k - tk) * (factorialPolynomialContribution (fun i : Fin n => ω i) l - tl))) (Measure.infinitePi (fun _ : ℕ => obsLaw P)) := by have hest : Integrable (fun ω : ℕ → Obs d => (factorialPolynomialContribution (fun i : Fin n => ω i) k - tk) * (factorialPolynomialContribution (fun i : Fin n => ω i) l - tl)) (Measure.infinitePi (fun _ : ℕ => obsLaw P)) := by have hi : Integrable (fun ω : ℕ → Obs d => ((factorialPolynomialContribution (fun i : Fin n => ω i) k * factorialPolynomialContribution (fun i : Fin n => ω i) l - tl * factorialPolynomialContribution (fun i : Fin n => ω i) k) - tk * factorialPolynomialContribution (fun i : Fin n => ω i) l) + tk * tl) (Measure.infinitePi (fun _ : ℕ => obsLaw P)) := (((integrable_factorialPolynomial_cross_mul (n := n) P k l).sub ((integrable_factorialPolynomialContribution_trunc_rate P k).const_mul tl)).sub ((integrable_factorialPolynomialContribution_trunc_rate P l).const_mul tk)).add (integrable_const (tk * tl)) convert hi using 1 funext ω ring have htrunc : Measurable (fun ω : ℕ → Obs d => fun i : Fin n => ω i) := by fun_prop apply hest.bdd_mul (((measurable_of_finite (fun sample : Fin n → Obs d => lightIndicator sample k * lightIndicator sample l)).comp htrunc).aestronglyMeasurable) filter_upwards with ω rw [Real.norm_eq_abs, abs_of_nonneg] · exact mul_le_one₀ (lightIndicator_le_one _ _) (lightIndicator_nonneg _ _) (lightIndicator_le_one _ _) · exact mul_nonneg (lightIndicator_nonneg _ _) (lightIndicator_nonneg _ _)
CausalSmith.Stat.DiscreteAteMinimaxLoggap.integrable_selected_target_pair · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellRatePilot.lean:1002
theorem selectedFalseLightError_second_moment_le

Summed false-light remainder from equations (23)--(24).

Formal statement
n d :
epsilon :
P :
hOverlap :
Overlap epsilon P
hcut :
∫ ω : ℕ → Obs d, selectedFalseLightError P (fun i : Fin n => ω i) ^ 2 ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P))
≤ (d : ℝ) ^ 2 * (8 * (exp 1 + 1) * bandwidth n ^ 2 * exp (-49 * logScale n))
Proof (Lean source)
lemma selectedFalseLightError_second_moment_le {n d : ℕ} {epsilon : ℝ} (P : DiscreteLaw d) (hOverlap : Overlap epsilon P) (hcut : calibrationCutoff ≤ n) : ∫ ω : ℕ → Obs d, selectedFalseLightError P (fun i : Fin n => ω i) ^ 2 ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P)) ≤ (d : ℝ) ^ 2 * (8 * (exp 1 + 1) * bandwidth n ^ 2 * exp (-49 * logScale n)) := by classical let F := falseLightSet (n := n) P let e := fun k : Fin d => fun ω : ℕ → Obs d => lightIndicator (fun i : Fin n => ω i) k * (factorialPolynomialContribution (fun i : Fin n => ω i) k - cellPhi (cellVector P k)) let R := 8 * (exp 1 + 1) * bandwidth n ^ 2 * exp (-49 * logScale n) have hcard : (F.card : ℝ) ≤ d := by exact_mod_cast (calc F.card ≤ (Finset.univ : Finset (Fin d)).card := Finset.card_le_card (Finset.subset_univ _) _ = d := Fintype.card_fin d) have hR0 : 0 ≤ R := by dsimp only [R]; positivity have hpoint (ω : ℕ → Obs d) : (∑ k ∈ F, e k ω) ^ 2 ≤ (F.card : ℝ) * ∑ k ∈ F, (e k ω) ^ 2 := by simpa using (sq_sum_le_card_mul_sum_sq (s := F) (f := fun k => e k ω)) have hepair (k l : Fin d) : Integrable (fun ω => e k ω * e l ω) (Measure.infinitePi (fun _ : ℕ => obsLaw P)) := by convert integrable_selected_target_pair P k l (cellPhi (cellVector P k)) (cellPhi (cellVector P l)) using 1 funext ω dsimp only [e] ring have hesq (k : Fin d) : Integrable (fun ω => (e k ω) ^ 2) (Measure.infinitePi (fun _ : ℕ => obsLaw P)) := by convert hepair k k using 1 funext ω rw [pow_two] have hmono : (∫ ω, (∑ k ∈ F, e k ω) ^ 2 ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P))) ≤ ∫ ω, (F.card : ℝ) * ∑ k ∈ F, (e k ω) ^ 2 ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P)) := by apply integral_mono · have hs := integrable_finset_sum F fun k _ => integrable_finset_sum F fun l _ => hepair k l have hfun : (fun ω => (∑ k ∈ F, e k ω) ^ 2) = fun ω => ∑ k ∈ F, ∑ l ∈ F, e k ω * e l ω := by funext ω rw [pow_two, Finset.sum_mul_sum] rw [hfun] exact hs · have hs : Integrable (fun ω => ∑ k ∈ F, (e k ω) ^ 2) (Measure.infinitePi (fun _ : ℕ => obsLaw P)) := integrable_finset_sum F fun k _ => hesq k exact hs.const_mul _ · exact hpoint change (∫ ω, (∑ k ∈ F, e k ω) ^ 2 ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P))) ≤ _ refine hmono.trans ?_ rw [integral_const_mul, integral_finset_sum F (fun k _ => hesq k)] have hterm (k : Fin d) (hk : k ∈ F) : ∫ ω : ℕ → Obs d, e k ω ^ 2 ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P)) ≤ R := by have hkfalse : bandwidth n / 4 < cellMass P k := by simpa [F, falseLightSet] using hk have h := falseLight_selected_error_sq P hOverlap k hcut hkfalse calc (∫ ω : ℕ → Obs d, e k ω ^ 2 ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P))) = ∫ ω : ℕ → Obs d, lightIndicator (fun i : Fin n => ω i) k * (factorialPolynomialContribution (fun i : Fin n => ω i) k - cellPhi (cellVector P k)) ^ 2 ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P)) := by apply integral_congr_ae filter_upwards with ω dsimp only [e] unfold lightIndicator split_ifs <;> ring _ ≤ R := by simpa only [R] using h calc (F.card : ℝ) * ∑ k ∈ F, (∫ ω, e k ω ^ 2 ∂_) ≤ (F.card : ℝ) * ∑ _k ∈ F, R := by gcongr with k hk exact hterm k hk _ = (F.card : ℝ) ^ 2 * R := by simp [pow_two] ring _ ≤ (d : ℝ) ^ 2 * R := by gcongr
CausalSmith.Stat.DiscreteAteMinimaxLoggap.selectedFalseLightError_second_moment_le · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellRatePilot.lean:1038
Helpers.LightCellVariance 15 declarations
def sparseArmEnvelope

Absolute sparse coefficient sum for one arm of the factorial lift.

Definition (Lean source)
noncomputable def sparseArmEnvelope (M : ℕ) (B : ℝ) (v : Cell → ℝ) (a : Fin 2) : ℝ := ∑ j ∈ range (M - 1), ∑ t ∈ range (j + 1), ∑ ay : Cell, |B⁻¹ * gCoefficient M j * B⁻¹ ^ j * (Nat.choose j t : ℝ)| * (factorialExpansionIndex a ay j t).prod (fun ay' e => v ay' ^ e)
CausalSmith.Stat.DiscreteAteMinimaxLoggap.sparseArmEnvelope · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellVariance.lean:8

For a positive bandwidth and nonnegative cell values, the absolute-coefficient envelope of one treatment arm collapses to a closed form: the reciprocal bandwidth, times the total four-cell mass, times that arm's outcome-one coordinate, times the absolute-coefficient series of the polynomial continuation evaluated at the arm's own mass divided by the bandwidth.

Formal statement
M :
B :
hB :
0 < B
v :
Cell → ℝ
hv :
∀ ay, 0 ≤ v ay
a :
Fin 2
= B⁻¹ * (∑ ay : Cell, v ay) * v (a, 1) * gpos M ((v (a, 0) + v (a, 1)) / B)
Proof (Lean source)
lemma sparseArmEnvelope_eq {M : ℕ} {B : ℝ} (hB : 0 < B) (v : Cell → ℝ) (hv : ∀ ay, 0 ≤ v ay) (a : Fin 2) : sparseArmEnvelope M B v a = B⁻¹ * (∑ ay : Cell, v ay) * v (a, 1) * gpos M ((v (a, 0) + v (a, 1)) / B) := by classical unfold sparseArmEnvelope gpos have hBinv : 0 ≤ B⁻¹ := (inv_pos.mpr hB).le have hchoose (j t : ℕ) : 0 ≤ (Nat.choose j t : ℝ) := by positivity rw [show B⁻¹ * (∑ ay : Cell, v ay) * v (a, 1) * ∑ j ∈ range (M - 1), |gCoefficient M j| * ((v (a, 0) + v (a, 1)) / B) ^ j = ∑ j ∈ range (M - 1), B⁻¹ * |gCoefficient M j| * B⁻¹ ^ j * ((∑ ay : Cell, v ay) * v (a, 1) * (v (a, 0) + v (a, 1)) ^ j) by rw [Finset.mul_sum] apply Finset.sum_congr rfl intro j _hj rw [div_pow] ring] apply Finset.sum_congr rfl intro j _hj rw [show (∑ t ∈ range (j + 1), ∑ ay : Cell, |B⁻¹ * gCoefficient M j * B⁻¹ ^ j * (Nat.choose j t : ℝ)| * (factorialExpansionIndex a ay j t).prod (fun ay' e => v ay' ^ e)) = B⁻¹ * |gCoefficient M j| * B⁻¹ ^ j * ((∑ ay : Cell, v ay) * v (a, 1) * (v (a, 0) + v (a, 1)) ^ j) by rw [show (∑ t ∈ range (j + 1), ∑ ay : Cell, |B⁻¹ * gCoefficient M j * B⁻¹ ^ j * (Nat.choose j t : ℝ)| * (factorialExpansionIndex a ay j t).prod (fun ay' e => v ay' ^ e)) = (B⁻¹ * |gCoefficient M j| * B⁻¹ ^ j) * (∑ t ∈ range (j + 1), ∑ ay : Cell, (Nat.choose j t : ℝ) * (factorialExpansionIndex a ay j t).prod (fun ay' e => v ay' ^ e)) by rw [Finset.mul_sum] apply Finset.sum_congr rfl intro t _ht rw [Finset.mul_sum] apply Finset.sum_congr rfl intro ay _hay rw [abs_mul, abs_mul, abs_mul, abs_of_nonneg hBinv, abs_of_nonneg (pow_nonneg hBinv j), abs_of_nonneg (hchoose j t)] ring] rw [factorialExpansionIndex_binomial_sum]]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.sparseArmEnvelope_eq · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellVariance.lean:16

Establishes the stated upper bound for sparse Arm Envelope le.

Formal statement
M :
hM :
0 < M
B :
hB :
0 < B
v :
Cell → ℝ
hv :
∀ ay, 0 ≤ v ay
hR :
(∑ ay : Cell, v ay) ≤ B
a :
Fin 2
sparseArmEnvelope M B v a ≤ B * 6 ^ M
Proof (Lean source)
lemma sparseArmEnvelope_le {M : ℕ} (hM : 0 < M) {B : ℝ} (hB : 0 < B) (v : Cell → ℝ) (hv : ∀ ay, 0 ≤ v ay) (hR : (∑ ay : Cell, v ay) ≤ B) (a : Fin 2) : sparseArmEnvelope M B v a ≤ B * 6 ^ M := by rw [sparseArmEnvelope_eq hB v hv a] let R := ∑ ay : Cell, v ay have hR0 : 0 ≤ R := sum_nonneg fun ay _ => hv ay have harm0 : 0 ≤ v (a, 0) + v (a, 1) := add_nonneg (hv _) (hv _) have harmR : v (a, 0) + v (a, 1) ≤ R := by rcases a with ⟨a, ha⟩ interval_cases a <;> simp [R, Fintype.sum_prod_type, Fin.sum_univ_two] <;> linarith [hv (0, 0), hv (0, 1), hv (1, 0), hv (1, 1)] have hz0 : 0 ≤ (v (a, 0) + v (a, 1)) / B := div_nonneg harm0 hB.le have hz1 : (v (a, 0) + v (a, 1)) / B ≤ 1 := (div_le_one hB).2 (harmR.trans hR) have hpow : ((v (a, 0) + v (a, 1)) / B) ^ (M - 2) ≤ 1 := pow_le_one₀ hz0 hz1 have hg : gpos M ((v (a, 0) + v (a, 1)) / B) ≤ 6 ^ M := by refine (gpos_bound hM hz0).trans ?_ rw [max_eq_left (by simpa using hpow)] simp have hvaR : v (a, 1) ≤ R := (le_add_of_nonneg_left (hv (a, 0))).trans harmR have hbinv : 0 ≤ B⁻¹ := (inv_pos.mpr hB).le have hgp0 := gpos_nonneg M hz0 calc B⁻¹ * R * v (a, 1) * gpos M ((v (a, 0) + v (a, 1)) / B) ≤ B⁻¹ * R * R * 6 ^ M := by gcongr _ ≤ B * 6 ^ M := by have hsq : R * R ≤ B * B := mul_self_le_mul_self hR0 hR calc B⁻¹ * R * R * 6 ^ M = B⁻¹ * (R * R) * 6 ^ M := by ring _ ≤ B⁻¹ * (B * B) * 6 ^ M := by gcongr _ = B * 6 ^ M := by field_simp
CausalSmith.Stat.DiscreteAteMinimaxLoggap.sparseArmEnvelope_le · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellVariance.lean:72

Establishes the stated property of multi Monomial mono in the discrete average-treatment-effect construction.

Formal statement
v w :
Cell → ℝ
hv :
∀ ay, 0 ≤ v ay
hle :
∀ ay, v ay ≤ w ay
r.prod (fun ay e => v ay ^ e) ≤ r.prod (fun ay e => w ay ^ e)
Proof (Lean source)
lemma multiMonomial_mono (r : MultiIndex) (v w : Cell → ℝ) (hv : ∀ ay, 0 ≤ v ay) (hle : ∀ ay, v ay ≤ w ay) : r.prod (fun ay e => v ay ^ e) ≤ r.prod (fun ay e => w ay ^ e) := by classical rw [r.prod_fintype _ (fun _ => pow_zero _), r.prod_fintype _ (fun _ => pow_zero _)] apply Finset.prod_le_prod · intro ay _hay exact pow_nonneg (hv ay) _ · intro ay _hay exact pow_le_pow_left₀ (hv ay) (hle ay) _
CausalSmith.Stat.DiscreteAteMinimaxLoggap.multiMonomial_mono · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellVariance.lean:110
theorem multiMonomial_nonneg

Shows that multi Monomial nonneg is nonnegative.

Formal statement
v :
Cell → ℝ
hv :
∀ ay, 0 ≤ v ay
0 ≤ r.prod (fun ay e => v ay ^ e)
Proof (Lean source)
lemma multiMonomial_nonneg (r : MultiIndex) (v : Cell → ℝ) (hv : ∀ ay, 0 ≤ v ay) : 0 ≤ r.prod (fun ay e => v ay ^ e) := by classical rw [r.prod_fintype _ (fun _ => pow_zero _)] exact Finset.prod_nonneg fun ay _ => pow_nonneg (hv ay) _
CausalSmith.Stat.DiscreteAteMinimaxLoggap.multiMonomial_nonneg · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellVariance.lean:123
theorem integral_factorialMonomial_mul_shift_le

Evaluates or bounds the stated integral involving integral factorial Monomial mul shift le.

Formal statement
n d M :
P :
k :
Fin d
r s :
hn :
0 < splitSize n 1
hr :
multiDegree r ≤ M
hs :
multiDegree s ≤ M
hsize :
4 * M ^ 2 ≤ splitSize n 1
∫ ω : ℕ → Obs d, factorialMonomial (fun i : Fin n => ω i) k r * factorialMonomial (fun i : Fin n => ω i) k s ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P))
exp 1 * (r.prod fun ay e => (cellVector P k ay + (M : ℝ) / splitSize n 1) ^ e) * (s.prod fun ay e => (cellVector P k ay + (M : ℝ) / splitSize n 1) ^ e)
Proof (Lean source)
lemma integral_factorialMonomial_mul_shift_le {n d M : ℕ} (P : DiscreteLaw d) (k : Fin d) (r s : MultiIndex) (hn : 0 < splitSize n 1) (hr : multiDegree r ≤ M) (hs : multiDegree s ≤ M) (hsize : 4 * M ^ 2 ≤ splitSize n 1) : ∫ ω : ℕ → Obs d, factorialMonomial (fun i : Fin n => ω i) k r * factorialMonomial (fun i : Fin n => ω i) k s ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P)) ≤ exp 1 * (r.prod fun ay e => (cellVector P k ay + (M : ℝ) / splitSize n 1) ^ e) * (s.prod fun ay e => (cellVector P k ay + (M : ℝ) / splitSize n 1) ^ e) := by have hv (ay : Cell) : 0 ≤ cellVector P k ay := (cellVector_mem_unitCube P k ay).1 have hmpos : 0 < (splitSize n 1 : ℝ) := by exact_mod_cast hn have hshift0 : 0 ≤ (M : ℝ) / splitSize n 1 := div_nonneg (by positivity) hmpos.le have hle (ay : Cell) : cellVector P k ay ≤ cellVector P k ay + (M : ℝ) / splitSize n 1 := by linarith have hshiftMono (u : MultiIndex) (q : ℕ) (hq : q ≤ M) : u.prod (fun ay e => (cellVector P k ay + (q : ℝ) / splitSize n 1) ^ e) ≤ u.prod (fun ay e => (cellVector P k ay + (M : ℝ) / splitSize n 1) ^ e) := by apply multiMonomial_mono u · intro ay exact add_nonneg (hv ay) (div_nonneg (by positivity) hmpos.le) · intro ay have hqR : (q : ℝ) ≤ M := by exact_mod_cast hq have hdiv := div_le_div_of_nonneg_right hqR hmpos.le linarith have hsizeR : 4 * (multiDegree r) ^ 2 ≤ splitSize n 1 := by nlinarith [Nat.mul_self_le_mul_self hr] have hsizeS : 4 * (multiDegree s) ^ 2 ≤ splitSize n 1 := by nlinarith [Nat.mul_self_le_mul_self hs] by_cases hrs : multiDegree r ≤ multiDegree s · have hmoment := integral_factorialMonomial_mul_trunc_le P k r s hn hrs hsizeS rw [← r.prod_fintype _ (fun _ => pow_zero _), ← s.prod_fintype _ (fun _ => pow_zero _)] at hmoment refine hmoment.trans ?_ have hrmono := multiMonomial_mono r (cellVector P k) (fun ay => cellVector P k ay + (M : ℝ) / splitSize n 1) hv hle have hsdeg := hshiftMono s (multiDegree s) hs have hsold0 := multiMonomial_nonneg s (fun ay => cellVector P k ay + (multiDegree s : ℝ) / splitSize n 1) (fun ay => add_nonneg (hv ay) (div_nonneg (by positivity) hmpos.le)) have hsnew0 := multiMonomial_nonneg s (fun ay => cellVector P k ay + (M : ℝ) / splitSize n 1) (fun ay => add_nonneg (hv ay) hshift0) calc exp 1 * (r.prod fun ay e => cellVector P k ay ^ e) * (s.prod fun ay e => (cellVector P k ay + (multiDegree s : ℝ) / splitSize n 1) ^ e) ≤ exp 1 * (r.prod fun ay e => (cellVector P k ay + (M : ℝ) / splitSize n 1) ^ e) * (s.prod fun ay e => (cellVector P k ay + (multiDegree s : ℝ) / splitSize n 1) ^ e) := mul_le_mul_of_nonneg_right (mul_le_mul_of_nonneg_left hrmono (Real.exp_pos 1).le) hsold0 _ ≤ _ := mul_le_mul_of_nonneg_left hsdeg (mul_nonneg (Real.exp_pos 1).le (multiMonomial_nonneg r _ (fun ay => add_nonneg (hv ay) hshift0))) · have hsr : multiDegree s ≤ multiDegree r := Nat.le_of_not_ge hrs rw [show (fun ω : ℕ → Obs d => factorialMonomial (fun i : Fin n => ω i) k r * factorialMonomial (fun i : Fin n => ω i) k s) = (fun ω : ℕ → Obs d => factorialMonomial (fun i : Fin n => ω i) k s * factorialMonomial (fun i : Fin n => ω i) k r) by funext ω ring] have hmoment := integral_factorialMonomial_mul_trunc_le P k s r hn hsr hsizeR rw [← s.prod_fintype _ (fun _ => pow_zero _), ← r.prod_fintype _ (fun _ => pow_zero _)] at hmoment refine hmoment.trans ?_ have hsmono := multiMonomial_mono s (cellVector P k) (fun ay => cellVector P k ay + (M : ℝ) / splitSize n 1) hv hle have hrdeg := hshiftMono r (multiDegree r) hr have hrold0 := multiMonomial_nonneg r (fun ay => cellVector P k ay + (multiDegree r : ℝ) / splitSize n 1) (fun ay => add_nonneg (hv ay) (div_nonneg (by positivity) hmpos.le)) have hrnew0 := multiMonomial_nonneg r (fun ay => cellVector P k ay + (M : ℝ) / splitSize n 1) (fun ay => add_nonneg (hv ay) hshift0) calc exp 1 * (s.prod fun ay e => (cellVector P k ay) ^ e) * (r.prod fun ay e => (cellVector P k ay + (multiDegree r : ℝ) / splitSize n 1) ^ e) ≤ exp 1 * (s.prod fun ay e => (cellVector P k ay + (M : ℝ) / splitSize n 1) ^ e) * (r.prod fun ay e => (cellVector P k ay + (multiDegree r : ℝ) / splitSize n 1) ^ e) := mul_le_mul_of_nonneg_right (mul_le_mul_of_nonneg_left hsmono (Real.exp_pos 1).le) hrold0 _ ≤ exp 1 * (s.prod fun ay e => (cellVector P k ay + (M : ℝ) / splitSize n 1) ^ e) * (r.prod fun ay e => (cellVector P k ay + (M : ℝ) / splitSize n 1) ^ e) := mul_le_mul_of_nonneg_left hrdeg (mul_nonneg (Real.exp_pos 1).le (multiMonomial_nonneg s _ (fun ay => add_nonneg (hv ay) hshift0))) _ = _ := by ring
CausalSmith.Stat.DiscreteAteMinimaxLoggap.integral_factorialMonomial_mul_shift_le · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellVariance.lean:132
def sparseCoefficient

Defines sparse Coefficient, the stated quantity or construction used in the discrete average-treatment-effect estimator.

Definition (Lean source)
noncomputable def sparseCoefficient (M : ℕ) (B : ℝ) (j t : ℕ) : ℝ := B⁻¹ * gCoefficient M j * B⁻¹ ^ j * (Nat.choose j t : ℝ)
CausalSmith.Stat.DiscreteAteMinimaxLoggap.sparseCoefficient · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellVariance.lean:240
def sparseArmContribution

Defines sparse Arm Contribution, the stated quantity or construction used in the discrete average-treatment-effect estimator.

Definition (Lean source)
noncomputable def sparseArmContribution {n d : ℕ} (sample : Fin n → Obs d) (k : Fin d) (a : Fin 2) : ℝ := ∑ j ∈ range (polynomialDegree n - 1), ∑ t ∈ range (j + 1), ∑ ay : Cell, sparseCoefficient (polynomialDegree n) (bandwidth n) j t * factorialMonomial sample k (factorialExpansionIndex a ay j t)
CausalSmith.Stat.DiscreteAteMinimaxLoggap.sparseArmContribution · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellVariance.lean:244
theorem factorialPolynomialContribution_eq_sparseArms Lemma 8 in the paper ↗

Establishes the stated equality relating factorial Polynomial Contribution eq sparse Arms.

Formal statement
n d :
sample :
Fin n → Obs d
k :
Fin d
Proof (Lean source)
lemma factorialPolynomialContribution_eq_sparseArms {n d : ℕ} (sample : Fin n → Obs d) (k : Fin d) : factorialPolynomialContribution sample k = sparseArmContribution sample k 1 - sparseArmContribution sample k 0 := by rfl
CausalSmith.Stat.DiscreteAteMinimaxLoggap.factorialPolynomialContribution_eq_sparseArms · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellVariance.lean:252
def shiftedCellVector

Defines shifted Cell Vector, the stated quantity or construction used in the discrete average-treatment-effect estimator.

Definition (Lean source)
noncomputable def shiftedCellVector {d : ℕ} (P : DiscreteLaw d) (k : Fin d) (M m : ℕ) : Cell → ℝ := fun ay => cellVector P k ay + (M : ℝ) / m
CausalSmith.Stat.DiscreteAteMinimaxLoggap.shiftedCellVector · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellVariance.lean:259
theorem shiftedCellVector_nonneg

Shows that shifted Cell Vector nonneg is nonnegative.

Formal statement
d :
P :
k :
Fin d
M m :
ay :
0 ≤ shiftedCellVector P k M m ay
Proof (Lean source)
lemma shiftedCellVector_nonneg {d : ℕ} (P : DiscreteLaw d) (k : Fin d) (M m : ℕ) (ay : Cell) : 0 ≤ shiftedCellVector P k M m ay := by exact add_nonneg (cellVector_mem_unitCube P k ay).1 (by positivity)
CausalSmith.Stat.DiscreteAteMinimaxLoggap.shiftedCellVector_nonneg · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellVariance.lean:264
theorem shiftedCellVector_sum

Establishes the stated summation identity or bound for shifted Cell Vector sum.

Formal statement
d :
P :
k :
Fin d
M m :
∑ ay : Cell, shiftedCellVector P k M m ay = cellMass P k + 4 * (M : ℝ) / m
Proof (Lean source)
lemma shiftedCellVector_sum {d : ℕ} (P : DiscreteLaw d) (k : Fin d) (M m : ℕ) : ∑ ay : Cell, shiftedCellVector P k M m ay = cellMass P k + 4 * (M : ℝ) / m := by have hm := vectorMass_cellVector P k simp [vectorMass, vectorArmMass] at hm simp [shiftedCellVector, Finset.sum_add_distrib, Fintype.sum_prod_type, Fin.sum_univ_two] rw [← hm] ring
CausalSmith.Stat.DiscreteAteMinimaxLoggap.shiftedCellVector_sum · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellVariance.lean:270
theorem factorialMonomial_nonneg

Shows that factorial Monomial nonneg is nonnegative.

Formal statement
n d :
sample :
Fin n → Obs d
k :
Fin d
0 ≤ factorialMonomial sample k r
Proof (Lean source)
lemma factorialMonomial_nonneg {n d : ℕ} (sample : Fin n → Obs d) (k : Fin d) (r : MultiIndex) : 0 ≤ factorialMonomial sample k r := by unfold factorialMonomial positivity
CausalSmith.Stat.DiscreteAteMinimaxLoggap.factorialMonomial_nonneg · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellVariance.lean:282
theorem integral_sparse_terms_mul_shift_le

Evaluates or bounds the stated integral involving integral sparse terms mul shift le.

Formal statement
n d M :
B :
P :
k :
Fin d
a b :
Fin 2
j t j' t' :
ay ay' :
ht :
t ≤ j
ht' :
t' ≤ j'
hj :
j + 2 ≤ M
hj' :
j' + 2 ≤ M
hn :
0 < splitSize n 1
hsize :
4 * M ^ 2 ≤ splitSize n 1
∫ ω : ℕ → Obs d, (sparseCoefficient M B j t * factorialMonomial (fun i : Fin n => ω i) k (factorialExpansionIndex a ay j t)) * (sparseCoefficient M B j' t' * factorialMonomial (fun i : Fin n => ω i) k (factorialExpansionIndex b ay' j' t')) ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P))
exp 1 * (|sparseCoefficient M B j t| * (factorialExpansionIndex a ay j t).prod (fun cy e => (cellVector P k cy + (M : ℝ) / splitSize n 1) ^ e)) * (|sparseCoefficient M B j' t'| * (factorialExpansionIndex b ay' j' t').prod (fun cy e => (cellVector P k cy + (M : ℝ) / splitSize n 1) ^ e))
Proof (Lean source)
lemma integral_sparse_terms_mul_shift_le {n d M : ℕ} {B : ℝ} (P : DiscreteLaw d) (k : Fin d) (a b : Fin 2) (j t j' t' : ℕ) (ay ay' : Cell) (ht : t ≤ j) (ht' : t' ≤ j') (hj : j + 2 ≤ M) (hj' : j' + 2 ≤ M) (hn : 0 < splitSize n 1) (hsize : 4 * M ^ 2 ≤ splitSize n 1) : ∫ ω : ℕ → Obs d, (sparseCoefficient M B j t * factorialMonomial (fun i : Fin n => ω i) k (factorialExpansionIndex a ay j t)) * (sparseCoefficient M B j' t' * factorialMonomial (fun i : Fin n => ω i) k (factorialExpansionIndex b ay' j' t')) ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P)) ≤ exp 1 * (|sparseCoefficient M B j t| * (factorialExpansionIndex a ay j t).prod (fun cy e => (cellVector P k cy + (M : ℝ) / splitSize n 1) ^ e)) * (|sparseCoefficient M B j' t'| * (factorialExpansionIndex b ay' j' t').prod (fun cy e => (cellVector P k cy + (M : ℝ) / splitSize n 1) ^ e)) := by let r := factorialExpansionIndex a ay j t let s := factorialExpansionIndex b ay' j' t' let c := sparseCoefficient M B j t let c' := sparseCoefficient M B j' t' have hr : multiDegree r ≤ M := by dsimp only [r] rw [multiDegree_factorialExpansionIndex a ay j t ht] exact hj have hs : multiDegree s ≤ M := by dsimp only [s] rw [multiDegree_factorialExpansionIndex b ay' j' t' ht'] exact hj' have hprodInt := integrable_factorialMonomial_mul_trunc (n := n) P k r s have hI0 : 0 ≤ ∫ ω : ℕ → Obs d, factorialMonomial (fun i : Fin n => ω i) k r * factorialMonomial (fun i : Fin n => ω i) k s ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P)) := by apply integral_nonneg_of_ae filter_upwards with ω exact mul_nonneg (factorialMonomial_nonneg _ _ _) (factorialMonomial_nonneg _ _ _) have hmoment := integral_factorialMonomial_mul_shift_le P k r s hn hr hs hsize have hcc : c * c' ≤ |c| * |c'| := by rw [← abs_mul] exact le_abs_self _ rw [show (fun ω : ℕ → Obs d => (c * factorialMonomial (fun i : Fin n => ω i) k r) * (c' * factorialMonomial (fun i : Fin n => ω i) k s)) = (fun ω : ℕ → Obs d => c * c' * (factorialMonomial (fun i : Fin n => ω i) k r * factorialMonomial (fun i : Fin n => ω i) k s)) by funext ω ring, integral_const_mul] dsimp only [c, c', r, s] at hI0 hmoment hcc ⊢ calc sparseCoefficient M B j t * sparseCoefficient M B j' t' * ∫ ω : ℕ → Obs d, factorialMonomial (fun i : Fin n => ω i) k (factorialExpansionIndex a ay j t) * factorialMonomial (fun i : Fin n => ω i) k (factorialExpansionIndex b ay' j' t') ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P)) ≤ |sparseCoefficient M B j t| * |sparseCoefficient M B j' t'| * ∫ ω : ℕ → Obs d, factorialMonomial (fun i : Fin n => ω i) k (factorialExpansionIndex a ay j t) * factorialMonomial (fun i : Fin n => ω i) k (factorialExpansionIndex b ay' j' t') ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P)) := mul_le_mul_of_nonneg_right hcc hI0 _ ≤ |sparseCoefficient M B j t| * |sparseCoefficient M B j' t'| * (exp 1 * (factorialExpansionIndex a ay j t).prod (fun cy e => (cellVector P k cy + (M : ℝ) / splitSize n 1) ^ e) * (factorialExpansionIndex b ay' j' t').prod (fun cy e => (cellVector P k cy + (M : ℝ) / splitSize n 1) ^ e)) := mul_le_mul_of_nonneg_left hmoment (mul_nonneg (abs_nonneg _) (abs_nonneg _)) _ = _ := by ring
CausalSmith.Stat.DiscreteAteMinimaxLoggap.integral_sparse_terms_mul_shift_le · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellVariance.lean:289
theorem factorialMonomial_cross_covariance_le

Establishes the stated upper bound for factorial Monomial cross covariance le.

Formal statement
n d M :
P :
k l :
Fin d
hkl :
k ≠ l
r s :
hr :
multiDegree r ≤ M
hs :
multiDegree s ≤ M
hsize :
4 * M ^ 2 ≤ splitSize n 1
|∫ ω : ℕ → Obs d, factorialMonomial (fun i : Fin n => ω i) k r * factorialMonomial (fun i : Fin n => ω i) l s ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P))
- (r.prod fun ay e => (cellVector P k ay) ^ e) * (s.prod fun ay e => (cellVector P l ay) ^ e)|
≤ (2 * (M : ℝ) ^ 2 / splitSize n 1) * (r.prod fun ay e => (cellVector P k ay) ^ e) * (s.prod fun ay e => (cellVector P l ay) ^ e)
Proof (Lean source)
lemma factorialMonomial_cross_covariance_le {n d M : ℕ} (P : DiscreteLaw d) (k l : Fin d) (hkl : k ≠ l) (r s : MultiIndex) (hr : multiDegree r ≤ M) (hs : multiDegree s ≤ M) (hsize : 4 * M ^ 2 ≤ splitSize n 1) : |∫ ω : ℕ → Obs d, factorialMonomial (fun i : Fin n => ω i) k r * factorialMonomial (fun i : Fin n => ω i) l s ∂(Measure.infinitePi (fun _ : ℕ => obsLaw P)) - (r.prod fun ay e => (cellVector P k ay) ^ e) * (s.prod fun ay e => (cellVector P l ay) ^ e)| ≤ (2 * (M : ℝ) ^ 2 / splitSize n 1) * (r.prod fun ay e => (cellVector P k ay) ^ e) * (s.prod fun ay e => (cellVector P l ay) ^ e) := by rw [integral_factorialMonomial_cross_trunc P k l hkl r s] rw [← r.prod_fintype _ (fun _ => pow_zero _), ← s.prod_fintype _ (fun _ => pow_zero _)] let x := r.prod fun ay e => (cellVector P k ay) ^ e let y := s.prod fun ay e => (cellVector P l ay) ^ e let R := ((splitSize n 1).descFactorial (multiDegree r + multiDegree s) : ℝ) / (((splitSize n 1).descFactorial (multiDegree r) : ℝ) * (splitSize n 1).descFactorial (multiDegree s)) have hx0 : 0 ≤ x := multiMonomial_nonneg r (cellVector P k) (fun ay => (cellVector_mem_unitCube P k ay).1) have hy0 : 0 ≤ y := multiMonomial_nonneg s (cellVector P l) (fun ay => (cellVector_mem_unitCube P l ay).1) have hratio : |R - 1| ≤ 2 * (M : ℝ) ^ 2 / splitSize n 1 := by by_cases hrs : multiDegree r ≤ multiDegree s · have hsizes : 4 * (multiDegree s) ^ 2 ≤ splitSize n 1 := by nlinarith [Nat.mul_self_le_mul_self hs] refine (factorial_cross_ratio_bound hrs hsizes).trans ?_ have hmR : (multiDegree s : ℝ) ≤ M := by exact_mod_cast hs have hn0 : 0 ≤ (splitSize n 1 : ℝ) := by positivity exact div_le_div_of_nonneg_right (mul_le_mul_of_nonneg_left (by simpa [pow_two] using (mul_self_le_mul_self (Nat.cast_nonneg (multiDegree s)) hmR)) (by norm_num)) hn0 · have hsr : multiDegree s ≤ multiDegree r := Nat.le_of_not_ge hrs have hsizer : 4 * (multiDegree r) ^ 2 ≤ splitSize n 1 := by nlinarith [Nat.mul_self_le_mul_self hr] have h := factorial_cross_ratio_bound hsr hsizer rw [Nat.add_comm] at h rw [mul_comm ((splitSize n 1).descFactorial (multiDegree s) : ℝ)] at h refine h.trans ?_ have hmR : (multiDegree r : ℝ) ≤ M := by exact_mod_cast hr have hn0 : 0 ≤ (splitSize n 1 : ℝ) := by positivity exact div_le_div_of_nonneg_right (mul_le_mul_of_nonneg_left (by simpa [pow_two] using (mul_self_le_mul_self (Nat.cast_nonneg (multiDegree r)) hmR)) (by norm_num)) hn0 change |R * x * y - x * y| ≤ _ rw [show R * x * y - x * y = (R - 1) * x * y by ring, abs_mul, abs_mul, abs_of_nonneg hx0, abs_of_nonneg hy0] exact mul_le_mul_of_nonneg_right (mul_le_mul_of_nonneg_right hratio hx0) hy0
CausalSmith.Stat.DiscreteAteMinimaxLoggap.factorialMonomial_cross_covariance_le · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LightCellVariance.lean:373
Helpers.LowerBound 10 declarations

The control-zero subclass D₀: overlap laws with mu_0k=0 in every cell.

Definition (Lean source)
n :
d :
epsilon :
P :
control_zero :
∀ k, outcomeMean P false k = 0
CausalSmith.Stat.DiscreteAteMinimaxLoggap.ControlZeroClass · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LowerBound.lean:7
def ControlZeroLaw

A law of the control-zero subclass: an observation law together with the evidence that it belongs to the overlap experiment class and has an identically zero control-arm outcome regression in every category.

Definition (Lean source)
def ControlZeroLaw (n d : ℕ) (epsilon : ℝ) := {P : DiscreteLaw d // ControlZeroClass n epsilon P}
CausalSmith.Stat.DiscreteAteMinimaxLoggap.ControlZeroLaw · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LowerBound.lean:13
def treatedFunctional

Treated-arm functional psi₁(P)=sum_k p_k mu_1k.

Definition (Lean source)
noncomputable def treatedFunctional {d : ℕ} (P : DiscreteLaw d) : ℝ := ∑ k : Fin d, cellMass P k * outcomeMean P true k
CausalSmith.Stat.DiscreteAteMinimaxLoggap.treatedFunctional · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LowerBound.lean:19
def oneArmWorstCaseMSE

The worst-case mean squared error of a single estimator over the control-zero subclass, taken against the treated-arm functional -- the category-mass weighted average of the treated outcome regression.

Definition (Lean source)
noncomputable def oneArmWorstCaseMSE (n d : ℕ) (epsilon : ℝ) (est : (Fin n → Obs d) → ℝ) : ℝ := ⨆ P : ControlZeroLaw n d epsilon, mse (productLaw P.1 n) est (treatedFunctional P.1)
CausalSmith.Stat.DiscreteAteMinimaxLoggap.oneArmWorstCaseMSE · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LowerBound.lean:23
def oneArmMinimaxRisk

The minimax risk for estimating the treated-arm functional over the control-zero subclass: the infimum, over measurable estimators, of their worst-case mean squared error on that subclass.

Definition (Lean source)
noncomputable def oneArmMinimaxRisk (n d : ℕ) (epsilon : ℝ) : ℝ := ⨅ est : {f : (Fin n → Obs d) → ℝ // Measurable f}, oneArmWorstCaseMSE n d epsilon est.1
CausalSmith.Stat.DiscreteAteMinimaxLoggap.oneArmMinimaxRisk · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LowerBound.lean:31
theorem mse_le_estimator_abs_sum_bound

A uniform finite-alphabet bound used to justify the two class suprema.

Formal statement
n d :
epsilon :
P :
hOverlap :
Overlap epsilon P
est :
(Fin n → Obs d) → ℝ
mse (productLaw P n) est (ateFunctional P)
≤ ((∑ sample : Fin n → Obs d, |est sample|) + 1) ^ 2
Proof (Lean source)
lemma mse_le_estimator_abs_sum_bound {n d : ℕ} {epsilon : ℝ} (P : DiscreteLaw d) (hOverlap : Overlap epsilon P) (est : (Fin n → Obs d) → ℝ) : mse (productLaw P n) est (ateFunctional P) ≤ ((∑ sample : Fin n → Obs d, |est sample|) + 1) ^ 2 := by have htau := ateFunctional_mem_interval P hOverlap have htau_abs : |ateFunctional P| ≤ 1 := (abs_le).2 htau have hest (sample : Fin n → Obs d) : |est sample| ≤ ∑ x : Fin n → Obs d, |est x| := by exact Finset.single_le_sum (fun i _ => abs_nonneg (est i)) (Finset.mem_univ sample) unfold mse calc ∫ x, (est x - ateFunctional P) ^ 2 ∂productLaw P n ≤ ∫ _x, ((∑ sample : Fin n → Obs d, |est sample|) + 1) ^ 2 ∂productLaw P n := by apply integral_mono_ae · exact MemLp.of_discrete.integrable_sq · exact integrable_const _ · filter_upwards with x have habs : |est x - ateFunctional P| ≤ (∑ sample : Fin n → Obs d, |est sample|) + 1 := (abs_sub _ _).trans (add_le_add (hest x) htau_abs) have hB : 0 ≤ (∑ sample : Fin n → Obs d, |est sample|) + 1 := by positivity exact (sq_le_sq).2 (by simpa [abs_of_nonneg hB] using habs) _ = ((∑ sample : Fin n → Obs d, |est sample|) + 1) ^ 2 := by simp
CausalSmith.Stat.DiscreteAteMinimaxLoggap.mse_le_estimator_abs_sum_bound · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LowerBound.lean:39

Cited gate (Zeng, Balakrishnan, Han, Kennedy, 2026). Source handle cite:zeng-balakrishnan-han-kennedy-2024, arXiv:2405.00118v3, Theorem 2 and Appendix C.5, with the fixed-sample transfer in Lemma 4 and Appendix D.2. This is the documented fixed-sample control-zero specialization: the treated-arm minimax risk has the stated scale for every positive alphabet size in the source range.

Definition (Lean source)
def ZengOneArmMinimaxLower (epsilon : ℝ) : Prop := 0 < epsilon ∧ epsilon < 1 / 2 → ∃ a_epsilon b_epsilon : ℝ, ∃ N_epsilon : ℕ, 0 < a_epsilon ∧ 0 < b_epsilon ∧ ∀ n d : ℕ, 0 < d → N_epsilon ≤ n → (d : ℝ) ≤ b_epsilon * n * log n → a_epsilon * minimaxRate n d ≤ oneArmMinimaxRisk n d epsilon
CausalSmith.Stat.DiscreteAteMinimaxLoggap.ZengOneArmMinimaxLower · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LowerBound.lean:68
theorem ateFunctional_eq_treated_on_controlZero

On the control-zero subclass the observed-data ATE is the treated functional.

Formal statement
n d :
epsilon :
P :
ControlZeroLaw n d epsilon
Proof (Lean source)
lemma ateFunctional_eq_treated_on_controlZero {n d : ℕ} {epsilon : ℝ} (P : ControlZeroLaw n d epsilon) : ateFunctional P.1 = treatedFunctional P.1 := by rw [ateFunctional_eq_weighted_regression P.1 P.2.overlap] unfold treatedFunctional apply Finset.sum_congr rfl intro k _ rw [P.2.control_zero k, sub_zero]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.ateFunctional_eq_treated_on_controlZero · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LowerBound.lean:82
theorem oneArmMinimaxRisk_le_minimaxRisk

Restricting the global ATE experiment to the control-zero subclass can only decrease minimax risk. The target identity is proved law-by-law before the subclass supremum and common estimator infimum are compared.

Formal statement
n d :
epsilon :
oneArmMinimaxRisk n d epsilon ≤ minimaxRisk n d epsilon
Proof (Lean source)
-- @node: oneArmMinimaxRisk_le_minimaxRisk lemma oneArmMinimaxRisk_le_minimaxRisk (n d : ℕ) (epsilon : ℝ) : oneArmMinimaxRisk n d epsilon ≤ minimaxRisk n d epsilon := by have htarget : ∀ P : ControlZeroLaw n d epsilon, ateFunctional P.1 = treatedFunctional P.1 := ateFunctional_eq_treated_on_controlZero unfold oneArmMinimaxRisk minimaxRisk apply ciInf_mono · refine ⟨0, ?_⟩ rintro _ ⟨est, rfl⟩ unfold oneArmWorstCaseMSE cases isEmpty_or_nonempty (ControlZeroLaw n d epsilon) with | inl hempty => letI := hempty simp | inr hnonempty => letI := hnonempty change 0 ≤ ⨆ P : ControlZeroLaw n d epsilon, mse (productLaw P.1 n) est.1 (treatedFunctional P.1) let P : ControlZeroLaw n d epsilon := Classical.arbitrary _ have hb : BddAbove (range (fun R : ControlZeroLaw n d epsilon => mse (productLaw R.1 n) est.1 (treatedFunctional R.1))) := by refine ⟨((∑ sample : Fin n → Obs d, |est.1 sample|) + 1) ^ 2, ?_⟩ rintro _ ⟨R, rfl⟩ change mse (productLaw R.1 n) est.1 (treatedFunctional R.1) ≤ _ rw [← htarget R] exact mse_le_estimator_abs_sum_bound R.1 R.2.overlap est.1 have hnonneg : 0 ≤ mse (productLaw P.1 n) est.1 (treatedFunctional P.1) := by unfold mse exact integral_nonneg (fun x => sq_nonneg (est.1 x - treatedFunctional P.1)) exact hnonneg.trans (le_ciSup hb P) · intro est cases isEmpty_or_nonempty (ControlZeroLaw n d epsilon) with | inl hempty => letI := hempty simp [oneArmWorstCaseMSE] unfold worstCaseMSE cases isEmpty_or_nonempty (ClassLaw n d epsilon) with | inl hclass_empty => letI := hclass_empty simp | inr hclass_nonempty => letI := hclass_nonempty change 0 ≤ ⨆ P : ClassLaw n d epsilon, mse (productLaw P.1 n) est.1 (ateFunctional P.1) let P : ClassLaw n d epsilon := Classical.arbitrary _ have hb : BddAbove (range (fun R : ClassLaw n d epsilon => mse (productLaw R.1 n) est.1 (ateFunctional R.1))) := by refine ⟨((∑ sample : Fin n → Obs d, |est.1 sample|) + 1) ^ 2, ?_⟩ rintro _ ⟨R, rfl⟩ exact mse_le_estimator_abs_sum_bound R.1 R.2.overlap est.1 have hnonneg : 0 ≤ mse (productLaw P.1 n) est.1 (ateFunctional P.1) := by unfold mse exact integral_nonneg (fun x => sq_nonneg (est.1 x - ateFunctional P.1)) exact hnonneg.trans (le_ciSup hb P) | inr hnonempty => letI := hnonempty unfold oneArmWorstCaseMSE worstCaseMSE apply ciSup_le intro P rw [← htarget P] let Q : ClassLaw n d epsilon := ⟨P.1, P.2.toExperimentClass⟩ refine le_ciSup_of_le ?_ Q ?_ · refine ⟨((∑ sample : Fin n → Obs d, |est.1 sample|) + 1) ^ 2, ?_⟩ rintro _ ⟨R, rfl⟩ exact mse_le_estimator_abs_sum_bound R.1 R.2.overlap est.1 · exact le_rfl
CausalSmith.Stat.DiscreteAteMinimaxLoggap.oneArmMinimaxRisk_le_minimaxRisk · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LowerBound.lean:92
theorem ate_lower_bound_transfer Lemma 2 in the paper ↗

Transfers the cited control-zero one-arm converse to the unrestricted ATE minimax problem by restriction of the law class.

Formal statement
epsilon :
hZeng :
he0 :
0 < epsilon
he1 :
epsilon < 1 / 2
∃ a_epsilon b_epsilon : ℝ,
∃ N_epsilon : ℕ,
0 < a_epsilon ∧
0 < b_epsilon ∧
∀ n d : ℕ,
0 < d → N_epsilon
≤ n → (d : ℝ) ≤ b_epsilon * n * log n → a_epsilon * minimaxRate n d ≤ minimaxRisk n d epsilon
Proof (Lean source)
lemma ate_lower_bound_transfer {epsilon : ℝ} (hZeng : ZengOneArmMinimaxLower epsilon) (he0 : 0 < epsilon) (he1 : epsilon < 1 / 2) : ∃ a_epsilon b_epsilon : ℝ, ∃ N_epsilon : ℕ, 0 < a_epsilon ∧ 0 < b_epsilon ∧ ∀ n d : ℕ, 0 < d → N_epsilon ≤ n → (d : ℝ) ≤ b_epsilon * n * log n → a_epsilon * minimaxRate n d ≤ minimaxRisk n d epsilon := by rcases hZeng ⟨he0, he1⟩ with ⟨a_epsilon, b_epsilon, N_epsilon, ha, hb, hLower⟩ refine ⟨a_epsilon, b_epsilon, N_epsilon, ha, hb, ?_⟩ intro n d hd_pos hn hd_range exact (hLower n d hd_pos hn hd_range).trans (oneArmMinimaxRisk_le_minimaxRisk n d epsilon)
CausalSmith.Stat.DiscreteAteMinimaxLoggap.ate_lower_bound_transfer · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/LowerBound.lean:166
Helpers.MultinomialMoments 36 declarations
def PatternFiber

Indices in the fibre of a finite labelling.

Definition (Lean source)
abbrev PatternFiber (f : I → A) (a : A) := {i : I // f i = a}
def MatchingEmbedding

Ordered injective selections whose observed labels match a prescribed pattern.

Definition (Lean source)
abbrev MatchingEmbedding (g : I → A) (z : J → A) := {e : I ↪ J // ∀ i, z (e i) = g i}
CausalSmith.Stat.DiscreteAteMinimaxLoggap.MatchingEmbedding · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/MultinomialMoments.lean:17
theorem matchingEmbedding_card

Multinomial ordered-pattern cardinality, factored over label fibres.

Formal statement
g :
I → A
z :
J → A
Proof (Lean source)
lemma matchingEmbedding_card (g : I → A) (z : J → A) : card (MatchingEmbedding g z) = ∏ a : A, (card (PatternFiber z a)).descFactorial (card (PatternFiber g a)) := by rw [Fintype.card_congr (matchingEmbeddingEquiv g z), Fintype.card_pi] apply Finset.prod_congr rfl intro a _ exact Fintype.card_embedding_eq
CausalSmith.Stat.DiscreteAteMinimaxLoggap.matchingEmbedding_card · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/MultinomialMoments.lean:50
def matchingCount

Number of ordered injective selections matching a finite label pattern.

Definition (Lean source)
noncomputable def matchingCount (g : I → A) (z : J → A) : ℝ := ∑ e : I ↪ J, if ∀ i, z (e i) = g i then 1 else 0
theorem matchingCount_eq_card

The weighted count of ordered injective selections whose observed labels match a prescribed pattern is simply the number of such selections.

Formal statement
g :
I → A
z :
J → A
Proof (Lean source)
lemma matchingCount_eq_card (g : I → A) (z : J → A) : matchingCount g z = card (MatchingEmbedding g z) := by classical rw [matchingCount] have hcard : card (MatchingEmbedding g z) = ((Finset.univ : Finset (I ↪ J)).filter fun e => ∀ i, z (e i) = g i).card := by exact Fintype.card_of_subtype _ (by intro e; simp) rw [hcard] simpa using (Finset.sum_boole (R := ℝ) (fun e : I ↪ J => ∀ i, z (e i) = g i) Finset.univ)
CausalSmith.Stat.DiscreteAteMinimaxLoggap.matchingCount_eq_card · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/MultinomialMoments.lean:65
theorem matchingCount_eq_prod

Pointwise ordered multinomial count identity.

Formal statement
g :
I → A
z :
J → A
= ∏ a : A, ((card (PatternFiber z a)).descFactorial (card (PatternFiber g a)) : ℝ)
Proof (Lean source)
lemma matchingCount_eq_prod (g : I → A) (z : J → A) : matchingCount g z = ∏ a : A, ((card (PatternFiber z a)).descFactorial (card (PatternFiber g a)) : ℝ) := by rw [matchingCount_eq_card] exact_mod_cast matchingEmbedding_card g z
CausalSmith.Stat.DiscreteAteMinimaxLoggap.matchingCount_eq_prod · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/MultinomialMoments.lean:78
def patternKernel

Indicator kernel of one labelled tuple.

Definition (Lean source)
def patternKernel (g : I → A) (z : I → A) : ℝ := if z = g then 1 else 0
theorem patternKernel_measurable

The indicator that a labelled tuple equals a prescribed pattern is a measurable function of the tuple.

Formal statement
g :
I → A
Proof (Lean source)
lemma patternKernel_measurable (g : I → A) : Measurable (patternKernel g) := by fun_prop
CausalSmith.Stat.DiscreteAteMinimaxLoggap.patternKernel_measurable · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/MultinomialMoments.lean:93
theorem integral_patternKernel_pi

A labelled tuple under a finite product law has the product point mass.

Formal statement
g :
I → A
∫ z, patternKernel g z ∂(Measure.pi fun _ : I => P) = ∏ i : I, P.real {g i}
Proof (Lean source)
lemma integral_patternKernel_pi (P : Measure A) [IsProbabilityMeasure P] (g : I → A) : ∫ z, patternKernel g z ∂(Measure.pi fun _ : I => P) = ∏ i : I, P.real {g i} := by classical rw [integral_fintype Integrable.of_finite] simp [patternKernel, pi_real_singleton]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.integral_patternKernel_pi · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/MultinomialMoments.lean:98
theorem integral_patternKernel_sample

Under an independent identically distributed sample, the probability that a prescribed finite family of distinct sample positions carries a prescribed pattern of labels is the product, over those positions, of the point masses of the required labels.

Formal statement
S :
IIDSample Ω A μ P
g :
I → A
n :
e :
I ↪ Fin n
∫ ω, patternKernel g (fun i => S.Z (e i : ℕ) ω) ∂μ = ∏ i : I, P.real {g i}
Proof (Lean source)
lemma integral_patternKernel_sample [IsProbabilityMeasure μ] (S : IIDSample Ω A μ P) (g : I → A) {n : ℕ} (e : I ↪ Fin n) : ∫ ω, patternKernel g (fun i => S.Z (e i : ℕ) ω) ∂μ = ∏ i : I, P.real {g i} := by rw [← integral_patternKernel_pi P g] rw [← S.map_fintype_tuple_eq e.injective] rw [integral_map (measurable_pi_lambda _ (fun i : I => S.meas (e i : ℕ))).aemeasurable (patternKernel_measurable g).aestronglyMeasurable]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.integral_patternKernel_sample · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/MultinomialMoments.lean:110
theorem integrable_patternKernel_sample

Shows that integrable pattern Kernel sample is integrable under the stated sampling distribution.

Formal statement
S :
IIDSample Ω A μ P
g :
I → A
n :
e :
I ↪ Fin n
Integrable (fun ω => patternKernel g (fun i => S.Z (e i : ℕ) ω)) μ
Proof (Lean source)
lemma integrable_patternKernel_sample [IsProbabilityMeasure μ] (S : IIDSample Ω A μ P) (g : I → A) {n : ℕ} (e : I ↪ Fin n) : Integrable (fun ω => patternKernel g (fun i => S.Z (e i : ℕ) ω)) μ := by apply Integrable.of_bound (((patternKernel_measurable g).comp (measurable_pi_lambda _ (fun i : I => S.meas (e i : ℕ)))).aestronglyMeasurable) 1 filter_upwards with ω by_cases h : (fun i => S.Z (e i : ℕ) ω) = g <;> simp [patternKernel, h]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.integrable_patternKernel_sample · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/MultinomialMoments.lean:125
theorem integral_matchingCount_sample

Exact ordered-injective multinomial mean. This is equation (9) before normalization: the number of embeddings contributes (n)_{|I|}, and each labelled tuple contributes its product point mass.

Formal statement
S :
IIDSample Ω A μ P
g :
I → A
n :
∫ ω, matchingCount g (fun j : Fin n => S.Z j ω) ∂μ
= (n.descFactorial (card I) : ℝ) * ∏ i : I, P.real {g i}
Proof (Lean source)
lemma integral_matchingCount_sample [IsProbabilityMeasure μ] (S : IIDSample Ω A μ P) (g : I → A) (n : ℕ) : ∫ ω, matchingCount g (fun j : Fin n => S.Z j ω) ∂μ = (n.descFactorial (card I) : ℝ) * ∏ i : I, P.real {g i} := by classical unfold matchingCount rw [integral_finset_sum _ (fun e _ => by simpa [patternKernel, funext_iff] using integrable_patternKernel_sample S g e)] simp_rw [show ∀ e : I ↪ Fin n, (∫ ω, (if ∀ i, S.Z (e i : ℕ) ω = g i then 1 else 0) ∂μ) = ∏ i : I, P.real {g i} by intro e simpa [patternKernel, funext_iff] using integral_patternKernel_sample S g e] rw [Finset.sum_const, nsmul_eq_mul] rw [Finset.card_univ, Fintype.card_embedding_eq] norm_num
CausalSmith.Stat.DiscreteAteMinimaxLoggap.integral_matchingCount_sample · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/MultinomialMoments.lean:136
theorem integrable_matchingCount_sample

Shows that integrable matching Count sample is integrable under the stated sampling distribution.

Formal statement
S :
IIDSample Ω A μ P
g :
I → A
n :
Integrable (fun ω => matchingCount g (fun j : Fin n => S.Z j ω)) μ
Proof (Lean source)
lemma integrable_matchingCount_sample [IsProbabilityMeasure μ] (S : IIDSample Ω A μ P) (g : I → A) (n : ℕ) : Integrable (fun ω => matchingCount g (fun j : Fin n => S.Z j ω)) μ := by classical unfold matchingCount exact integrable_finset_sum _ fun e _ => by simpa [patternKernel, funext_iff] using integrable_patternKernel_sample S g e
CausalSmith.Stat.DiscreteAteMinimaxLoggap.integrable_matchingCount_sample · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/MultinomialMoments.lean:156
theorem matchingCount_mul_eq_sum

If two patterns have disjoint label ranges, their matching counts multiply to the matching count of the sum pattern. Observations cannot be shared by the two selections because their required labels differ.

Formal statement
g :
I → A
h :
K → A
z :
J → A
hdisj :
∀ i k, g i ≠ h k
Proof (Lean source)
lemma matchingCount_mul_eq_sum (g : I → A) (h : K → A) (z : J → A) (hdisj : ∀ i k, g i ≠ h k) : matchingCount g z * matchingCount h z = matchingCount (elim g h) z := by classical rw [matchingCount_eq_prod, matchingCount_eq_prod, matchingCount_eq_prod] rw [← Finset.prod_mul_distrib] apply Finset.prod_congr rfl intro a _ have hor : card (PatternFiber g a) = 0 ∨ card (PatternFiber h a) = 0 := by by_contra hn push_neg at hn obtain ⟨ig⟩ := Fintype.card_pos_iff.mp (Nat.pos_of_ne_zero hn.1) obtain ⟨ih⟩ := Fintype.card_pos_iff.mp (Nat.pos_of_ne_zero hn.2) exact hdisj ig.1 ih.1 (by rw [ig.2, ih.2]) have hcard : card (PatternFiber (elim g h) a) = card (PatternFiber g a) + card (PatternFiber h a) := by rw [Fintype.card_congr (sumFiberEquiv g h a), Fintype.card_sum] rw [hcard] rcases hor with hg | hh · simp [hg] · simp [hh]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.matchingCount_mul_eq_sum · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/MultinomialMoments.lean:181
theorem integral_matchingCount_mul_sample

Exact cross-category ordered-pattern moment (equation (13), raw form).

Formal statement
S :
IIDSample Ω A μ P
g :
I → A
h :
K → A
n :
hdisj :
∀ i k, g i ≠ h k
∫ ω, matchingCount g (fun j : Fin n => S.Z j ω) * matchingCount h (fun j : Fin n => S.Z j ω) ∂μ
= (n.descFactorial (card I + card K) : ℝ) * (∏ i : I, P.real {g i}) * (∏ k : K, P.real {h k})
Proof (Lean source)
lemma integral_matchingCount_mul_sample [IsProbabilityMeasure μ] (S : IIDSample Ω A μ P) (g : I → A) (h : K → A) (n : ℕ) (hdisj : ∀ i k, g i ≠ h k) : ∫ ω, matchingCount g (fun j : Fin n => S.Z j ω) * matchingCount h (fun j : Fin n => S.Z j ω) ∂μ = (n.descFactorial (card I + card K) : ℝ) * (∏ i : I, P.real {g i}) * (∏ k : K, P.real {h k}) := by simp_rw [matchingCount_mul_eq_sum g h _ hdisj] rw [integral_matchingCount_sample S (elim g h) n] rw [Fintype.card_sum, Fintype.prod_sum_type] simp only [Sum.elim_inl, Sum.elim_inr] ring
CausalSmith.Stat.DiscreteAteMinimaxLoggap.integral_matchingCount_mul_sample · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/MultinomialMoments.lean:208
theorem integral_normalized_matchingCount_mul_sample

Exact cross-category moment for normalized factorial estimators, including the finite-sample falling-factorial covariance ratio in equation (13).

Formal statement
S :
IIDSample Ω A μ P
g :
I → A
h :
K → A
n :
hdisj :
∀ i k, g i ≠ h k
∫ ω, (matchingCount g (fun j : Fin n => S.Z j ω) / (n.descFactorial (card I) : ℝ)) * (matchingCount h (fun j : Fin n => S.Z j ω) / (n.descFactorial (card K) : ℝ)) ∂μ
= (n.descFactorial (card I + card K) : ℝ) / ((n.descFactorial (card I) : ℝ) * n.descFactorial (card K)) * (∏ i : I, P.real {g i}) * (∏ k : K, P.real {h k})
Proof (Lean source)
lemma integral_normalized_matchingCount_mul_sample [IsProbabilityMeasure μ] (S : IIDSample Ω A μ P) (g : I → A) (h : K → A) (n : ℕ) (hdisj : ∀ i k, g i ≠ h k) : ∫ ω, (matchingCount g (fun j : Fin n => S.Z j ω) / (n.descFactorial (card I) : ℝ)) * (matchingCount h (fun j : Fin n => S.Z j ω) / (n.descFactorial (card K) : ℝ)) ∂μ = (n.descFactorial (card I + card K) : ℝ) / ((n.descFactorial (card I) : ℝ) * n.descFactorial (card K)) * (∏ i : I, P.real {g i}) * (∏ k : K, P.real {h k}) := by have hraw := integral_matchingCount_mul_sample S g h n hdisj calc ∫ ω, (matchingCount g (fun j : Fin n => S.Z j ω) / (n.descFactorial (card I) : ℝ)) * (matchingCount h (fun j : Fin n => S.Z j ω) / (n.descFactorial (card K) : ℝ)) ∂μ = ((n.descFactorial (card I) : ℝ) * n.descFactorial (card K))⁻¹ * ∫ ω, matchingCount g (fun j : Fin n => S.Z j ω) * matchingCount h (fun j : Fin n => S.Z j ω) ∂μ := by rw [← integral_const_mul] congr 1 funext ω simp only [div_eq_mul_inv, mul_inv_rev] ring _ = _ := by rw [hraw]; simp only [div_eq_mul_inv]; ring
CausalSmith.Stat.DiscreteAteMinimaxLoggap.integral_normalized_matchingCount_mul_sample · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/MultinomialMoments.lean:222
def MultiSlot

One distinguishable slot for each occurrence prescribed by an exponent vector.

Definition (Lean source)
abbrev MultiSlot (r : A → ℕ) := Σ a : A, Fin (r a)
def multiPattern

The label prescribed at a multiindex slot.

Definition (Lean source)
def multiPattern (r : A → ℕ) : MultiSlot r → A := fun i => i.1
def exponentDegree

Total degree of a finite exponent vector.

Definition (Lean source)
def exponentDegree (r : A → ℕ) : ℕ := ∑ a, r a
def multinomialFactorialCount

Product of falling-factorial cell counts, represented as an ordered-pattern count.

Definition (Lean source)
noncomputable def multinomialFactorialCount (r : A → ℕ) (z : J → A) : ℝ := matchingCount (multiPattern r) z
CausalSmith.Stat.DiscreteAteMinimaxLoggap.multinomialFactorialCount · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/MultinomialMoments.lean:267
theorem multiSlot_card

The number of distinguishable slots generated by an exponent vector equals the total degree of that vector, namely the sum of its exponents.

Formal statement
r :
A → ℕ
Proof (Lean source)
lemma multiSlot_card (r : A → ℕ) : card (MultiSlot r) = exponentDegree r := by simp [exponentDegree, Fintype.card_sigma]
theorem multinomialFactorialCount_eq_prod

The ordered-pattern representation is exactly the product of cellwise falling factorials.

Formal statement
r :
A → ℕ
z :
J → A
= ∏ a : A, ((card (PatternFiber z a)).descFactorial (r a) : ℝ)
Proof (Lean source)
lemma multinomialFactorialCount_eq_prod (r : A → ℕ) (z : J → A) : multinomialFactorialCount r z = ∏ a : A, ((card (PatternFiber z a)).descFactorial (r a) : ℝ) := by rw [multinomialFactorialCount, matchingCount_eq_prod] apply Finset.prod_congr rfl intro a _ rw [Fintype.card_congr (multiPatternFiberEquiv r a)] simp
CausalSmith.Stat.DiscreteAteMinimaxLoggap.multinomialFactorialCount_eq_prod · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/MultinomialMoments.lean:287
theorem multiPattern_mass_prod

The product of the point masses prescribed at the slots of an exponent vector factors into the point mass of each label raised to that label's exponent.

Formal statement
(∏ i : MultiSlot r, P.real {multiPattern r i}) = ∏ a : A, (P.real {a}) ^ (r a)
Proof (Lean source)
lemma multiPattern_mass_prod [MeasurableSpace A] [MeasurableSingletonClass A] (P : Measure A) (r : A → ℕ) : (∏ i : MultiSlot r, P.real {multiPattern r i}) = ∏ a : A, (P.real {a}) ^ (r a) := by rw [Fintype.prod_sigma] apply Finset.prod_congr rfl intro a _ simp [multiPattern]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.multiPattern_mass_prod · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/MultinomialMoments.lean:298
theorem integral_multinomialFactorialCount_sample

Equation (9) for a cell-count multiindex.

Formal statement
S :
IIDSample Ω A μ P
r :
A → ℕ
n :
∫ ω, multinomialFactorialCount r (fun j : Fin n => S.Z j ω) ∂μ
= (n.descFactorial (exponentDegree r) : ℝ) * ∏ a : A, (P.real {a}) ^ (r a)
Proof (Lean source)
lemma integral_multinomialFactorialCount_sample [IsProbabilityMeasure μ] (S : IIDSample Ω A μ P) (r : A → ℕ) (n : ℕ) : ∫ ω, multinomialFactorialCount r (fun j : Fin n => S.Z j ω) ∂μ = (n.descFactorial (exponentDegree r) : ℝ) * ∏ a : A, (P.real {a}) ^ (r a) := by unfold multinomialFactorialCount rw [integral_matchingCount_sample] rw [multiSlot_card, multiPattern_mass_prod]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.integral_multinomialFactorialCount_sample · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/MultinomialMoments.lean:313
theorem integrable_multinomialFactorialCount_sample

The product of falling-factorial cell counts of the first n observations of an independent identically distributed sample is an integrable function.

Formal statement
S :
IIDSample Ω A μ P
r :
A → ℕ
n :
Integrable (fun ω => multinomialFactorialCount r (fun j : Fin n => S.Z j ω)) μ
Proof (Lean source)
lemma integrable_multinomialFactorialCount_sample [IsProbabilityMeasure μ] (S : IIDSample Ω A μ P) (r : A → ℕ) (n : ℕ) : Integrable (fun ω => multinomialFactorialCount r (fun j : Fin n => S.Z j ω)) μ := by exact integrable_matchingCount_sample S (multiPattern r) n
CausalSmith.Stat.DiscreteAteMinimaxLoggap.integrable_multinomialFactorialCount_sample · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/MultinomialMoments.lean:323
def OverlapChoice

Coordinatewise overlap choices in the product of two factorial monomials.

Definition (Lean source)
abbrev OverlapChoice (r s : A → ℕ) := ∀ a : A, Fin (min (r a) (s a) + 1)
def mergedExponent

Exponent after identifying the selected observations prescribed by an overlap.

Definition (Lean source)
def mergedExponent (r s : A → ℕ) (H : OverlapChoice r s) : A → ℕ := fun a => r a + s a - H a
def overlapCoefficient

Multiplicity of one overlap pattern in the falling-factorial product identity.

Definition (Lean source)
def overlapCoefficient (r s : A → ℕ) (H : OverlapChoice r s) : ℕ := ∏ a : A, choose (r a) (H a) * choose (s a) (H a) * (H a : ℕ).factorial
CausalSmith.Stat.DiscreteAteMinimaxLoggap.overlapCoefficient · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/MultinomialMoments.lean:339
def totalOverlap

Total number of identified observations in an overlap choice.

Definition (Lean source)
def totalOverlap (r s : A → ℕ) (H : OverlapChoice r s) : ℕ := ∑ a : A, (H a : ℕ)
theorem totalOverlap_le_right

Establishes the stated upper bound for total Overlap le right.

Formal statement
r s :
A → ℕ
H :
Proof (Lean source)
lemma totalOverlap_le_right (r s : A → ℕ) (H : OverlapChoice r s) : totalOverlap r s H ≤ exponentDegree s := by unfold totalOverlap exponentDegree exact Finset.sum_le_sum fun a _ => le_trans (Nat.le_of_lt_succ (H a).isLt) (Nat.min_le_right _ _)
CausalSmith.Stat.DiscreteAteMinimaxLoggap.totalOverlap_le_right · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/MultinomialMoments.lean:365
theorem exponentDegree_mergedExponent

Establishes the stated property of exponent Degree merged Exponent in the discrete average-treatment-effect construction.

Formal statement
r s :
A → ℕ
H :
Proof (Lean source)
lemma exponentDegree_mergedExponent (r s : A → ℕ) (H : OverlapChoice r s) : exponentDegree (mergedExponent r s H) = exponentDegree r + exponentDegree s - totalOverlap r s H := by have hHs (a : A) : (H a : ℕ) ≤ s a := le_trans (Nat.le_of_lt_succ (H a).isLt) (Nat.min_le_right _ _) have hcoord (a : A) : r a + s a - (H a : ℕ) = r a + (s a - H a) := by omega simp only [exponentDegree, mergedExponent, totalOverlap, hcoord, Finset.sum_add_distrib] rw [finset_sum_sub_sum_of_le s (fun a => (H a : ℕ)) univ] · have htotal := totalOverlap_le_right r s H unfold totalOverlap exponentDegree at htotal omega · intro a _ exact hHs a
CausalSmith.Stat.DiscreteAteMinimaxLoggap.exponentDegree_mergedExponent · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/MultinomialMoments.lean:372
theorem factorial_ratio_overlap_bound

Establishes the stated upper bound for factorial ratio overlap bound.

Formal statement
r s :
A → ℕ
n :
hsize :
4 * (exponentDegree s) ^ 2 ≤ n
H :
(n.descFactorial (exponentDegree (mergedExponent r s H)) : ℝ) / ((n.descFactorial (exponentDegree r) : ℝ) * n.descFactorial (exponentDegree s))
exp 1 / (n : ℝ) ^ (totalOverlap r s H)
Proof (Lean source)
lemma factorial_ratio_overlap_bound (r s : A → ℕ) (n : ℕ) (hdeg : exponentDegree r ≤ exponentDegree s) (hsize : 4 * (exponentDegree s) ^ 2 ≤ n) (H : OverlapChoice r s) : (n.descFactorial (exponentDegree (mergedExponent r s H)) : ℝ) / ((n.descFactorial (exponentDegree r) : ℝ) * n.descFactorial (exponentDegree s)) ≤ exp 1 / (n : ℝ) ^ (totalOverlap r s H) := by rw [exponentDegree_mergedExponent] exact factorial_ratio_bound hdeg hsize (totalOverlap_le_right r s H)
CausalSmith.Stat.DiscreteAteMinimaxLoggap.factorial_ratio_overlap_bound · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/MultinomialMoments.lean:387
theorem multinomialFactorialCount_mul

Exact within-category joint-count expansion underlying equation (12).

Formal statement
r s :
A → ℕ
z :
J → A
Proof (Lean source)
lemma multinomialFactorialCount_mul (r s : A → ℕ) (z : J → A) : multinomialFactorialCount r z * multinomialFactorialCount s z = ∑ H : OverlapChoice r s, overlapCoefficient r s H * multinomialFactorialCount (mergedExponent r s H) z := by classical rw [multinomialFactorialCount_eq_prod, multinomialFactorialCount_eq_prod] rw [← Finset.prod_mul_distrib] have hfall (a : A) : ((card (PatternFiber z a)).descFactorial (r a) : ℝ) * (card (PatternFiber z a)).descFactorial (s a) = ∑ h : Fin (min (r a) (s a) + 1), (choose (r a) h * choose (s a) h * (h : ℕ).factorial : ℝ) * (card (PatternFiber z a)).descFactorial (r a + s a - (h : ℕ)) := by rw [Fin.sum_univ_eq_sum_range (fun h : ℕ => (choose (r a) h * choose (s a) h * h.factorial : ℝ) * (card (PatternFiber z a)).descFactorial (r a + s a - h)) (min (r a) (s a) + 1)] exact_mod_cast descFactorial_mul_identity (card (PatternFiber z a)) (r a) (s a) simp_rw [hfall] rw [Fintype.prod_sum] apply Finset.sum_congr rfl intro H _ rw [multinomialFactorialCount_eq_prod] simp only [mergedExponent, overlapCoefficient, Nat.cast_prod, Nat.cast_mul] rw [← Finset.prod_mul_distrib]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.multinomialFactorialCount_mul · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/MultinomialMoments.lean:510
theorem integral_multinomialFactorialCount_mul_sample

Exact within-category joint mean obtained by integrating the overlap expansion. This is the equality immediately preceding the bound in (12).

Formal statement
S :
IIDSample Ω A μ P
r s :
A → ℕ
n :
∫ ω, multinomialFactorialCount r (fun j : Fin n => S.Z j ω) * multinomialFactorialCount s (fun j : Fin n => S.Z j ω) ∂μ
= ∑ H : OverlapChoice r s, overlapCoefficient r s H * ((n.descFactorial (exponentDegree (mergedExponent r s H)) : ℝ) * ∏ a : A, (P.real {a}) ^ (mergedExponent r s H a))
Proof (Lean source)
lemma integral_multinomialFactorialCount_mul_sample [IsProbabilityMeasure μ] (S : IIDSample Ω A μ P) (r s : A → ℕ) (n : ℕ) : ∫ ω, multinomialFactorialCount r (fun j : Fin n => S.Z j ω) * multinomialFactorialCount s (fun j : Fin n => S.Z j ω) ∂μ = ∑ H : OverlapChoice r s, overlapCoefficient r s H * ((n.descFactorial (exponentDegree (mergedExponent r s H)) : ℝ) * ∏ a : A, (P.real {a}) ^ (mergedExponent r s H a)) := by simp_rw [multinomialFactorialCount_mul r s] rw [integral_finset_sum _] · apply Finset.sum_congr rfl intro H _ rw [integral_const_mul, integral_multinomialFactorialCount_sample] · intro H _ exact Integrable.const_mul (integrable_multinomialFactorialCount_sample S (mergedExponent r s H) n) _
CausalSmith.Stat.DiscreteAteMinimaxLoggap.integral_multinomialFactorialCount_mul_sample · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/MultinomialMoments.lean:540
theorem integral_normalized_multinomialFactorialCount_mul_sample

Exact normalized within-category joint moment, displaying the overlap sum and the falling-factorial ratio to which factorial_ratio_bound applies.

Formal statement
S :
IIDSample Ω A μ P
r s :
A → ℕ
n :
∫ ω, (multinomialFactorialCount r (fun j : Fin n => S.Z j ω) / (n.descFactorial (exponentDegree r) : ℝ)) * (multinomialFactorialCount s (fun j : Fin n => S.Z j ω) / (n.descFactorial (exponentDegree s) : ℝ)) ∂μ
= ∑ H : OverlapChoice r s, overlapCoefficient r s H * ((n.descFactorial (exponentDegree (mergedExponent r s H)) : ℝ) / ((n.descFactorial (exponentDegree r) : ℝ) * n.descFactorial (exponentDegree s))) * ∏ a : A, (P.real {a}) ^ (mergedExponent r s H a)
Proof (Lean source)
lemma integral_normalized_multinomialFactorialCount_mul_sample [IsProbabilityMeasure μ] (S : IIDSample Ω A μ P) (r s : A → ℕ) (n : ℕ) : ∫ ω, (multinomialFactorialCount r (fun j : Fin n => S.Z j ω) / (n.descFactorial (exponentDegree r) : ℝ)) * (multinomialFactorialCount s (fun j : Fin n => S.Z j ω) / (n.descFactorial (exponentDegree s) : ℝ)) ∂μ = ∑ H : OverlapChoice r s, overlapCoefficient r s H * ((n.descFactorial (exponentDegree (mergedExponent r s H)) : ℝ) / ((n.descFactorial (exponentDegree r) : ℝ) * n.descFactorial (exponentDegree s))) * ∏ a : A, (P.real {a}) ^ (mergedExponent r s H a) := by have hraw := integral_multinomialFactorialCount_mul_sample S r s n calc ∫ ω, (multinomialFactorialCount r (fun j : Fin n => S.Z j ω) / (n.descFactorial (exponentDegree r) : ℝ)) * (multinomialFactorialCount s (fun j : Fin n => S.Z j ω) / (n.descFactorial (exponentDegree s) : ℝ)) ∂μ = ((n.descFactorial (exponentDegree r) : ℝ) * n.descFactorial (exponentDegree s))⁻¹ * ∫ ω, multinomialFactorialCount r (fun j : Fin n => S.Z j ω) * multinomialFactorialCount s (fun j : Fin n => S.Z j ω) ∂μ := by rw [← integral_const_mul] congr 1 funext ω simp only [div_eq_mul_inv, mul_inv_rev] ring _ = _ := by rw [hraw, Finset.mul_sum] apply Finset.sum_congr rfl intro H _ simp only [div_eq_mul_inv] ring
CausalSmith.Stat.DiscreteAteMinimaxLoggap.integral_normalized_multinomialFactorialCount_mul_sample · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/MultinomialMoments.lean:559
theorem normalized_multinomial_joint_moment_bound

Proved light-cell factorial-moment inequality (equation (12)). The first factorial monomial supplies q^r; all possible overlaps with the second are absorbed by the shifted mass q + |s|/n, with the normalization loss bounded by exp 1.

Formal statement
S :
IIDSample Ω A μ P
r s :
A → ℕ
n :
hn :
0 < n
hdeg :
exponentDegree r ≤ exponentDegree s
hsize :
4 * (exponentDegree s) ^ 2 ≤ n
∫ ω, (multinomialFactorialCount r (fun j : Fin n => S.Z j ω) / (n.descFactorial (exponentDegree r) : ℝ)) * (multinomialFactorialCount s (fun j : Fin n => S.Z j ω) / (n.descFactorial (exponentDegree s) : ℝ)) ∂μ
exp 1 * (∏ a : A, (P.real {a}) ^ (r a)) * ∏ a : A, (P.real {a} + (exponentDegree s : ℝ) / n) ^ (s a)
Proof (Lean source)
lemma normalized_multinomial_joint_moment_bound [IsProbabilityMeasure μ] (S : IIDSample Ω A μ P) (r s : A → ℕ) (n : ℕ) (hn : 0 < n) (hdeg : exponentDegree r ≤ exponentDegree s) (hsize : 4 * (exponentDegree s) ^ 2 ≤ n) : ∫ ω, (multinomialFactorialCount r (fun j : Fin n => S.Z j ω) / (n.descFactorial (exponentDegree r) : ℝ)) * (multinomialFactorialCount s (fun j : Fin n => S.Z j ω) / (n.descFactorial (exponentDegree s) : ℝ)) ∂μ ≤ exp 1 * (∏ a : A, (P.real {a}) ^ (r a)) * ∏ a : A, (P.real {a} + (exponentDegree s : ℝ) / n) ^ (s a) := by rw [integral_normalized_multinomialFactorialCount_mul_sample] have hq (a : A) : 0 ≤ P.real {a} := by exact ENNReal.toReal_nonneg calc (∑ H : OverlapChoice r s, overlapCoefficient r s H * ((n.descFactorial (exponentDegree (mergedExponent r s H)) : ℝ) / ((n.descFactorial (exponentDegree r) : ℝ) * n.descFactorial (exponentDegree s))) * ∏ a : A, (P.real {a}) ^ (mergedExponent r s H a)) ≤ ∑ H : OverlapChoice r s, overlapCoefficient r s H * (exp 1 / (n : ℝ) ^ (totalOverlap r s H)) * ∏ a : A, (P.real {a}) ^ (mergedExponent r s H a) := by apply Finset.sum_le_sum intro H _ have hratio := factorial_ratio_overlap_bound r s n hdeg hsize H apply mul_le_mul_of_nonneg_right · exact mul_le_mul_of_nonneg_left hratio (by positivity) · exact Finset.prod_nonneg fun a _ => pow_nonneg (hq a) _ _ = exp 1 * ∑ H : OverlapChoice r s, (overlapCoefficient r s H : ℝ) / (n : ℝ) ^ (totalOverlap r s H) * ∏ a : A, (P.real {a}) ^ (mergedExponent r s H a) := by rw [Finset.mul_sum] apply Finset.sum_congr rfl intro H _ simp only [div_eq_mul_inv] ring _ ≤ exp 1 * ((∏ a : A, (P.real {a}) ^ (r a)) * ∏ a : A, (P.real {a} + (exponentDegree s : ℝ) / n) ^ (s a)) := by exact mul_le_mul_of_nonneg_left (overlap_sum_le r s n (fun a => P.real {a}) hq hn hdeg) (Real.exp_pos 1).le _ = _ := by ring
CausalSmith.Stat.DiscreteAteMinimaxLoggap.normalized_multinomial_joint_moment_bound · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/MultinomialMoments.lean:596
Helpers.MvPolynomialEnvelope 9 declarations
def monomialWeight

Defines monomial Weight, the stated quantity or construction used in the discrete average-treatment-effect estimator.

Definition (Lean source)
noncomputable def monomialWeight (v : Cell → ℝ) (r : MultiIndex) : ℝ := r.prod (fun i e => v i ^ e)
def coefficientEnvelope

Defines coefficient Envelope, the stated quantity or construction used in the discrete average-treatment-effect estimator.

Definition (Lean source)
noncomputable def coefficientEnvelope (p : MvPolynomial Cell ℝ) (v : Cell → ℝ) : ℝ := ∑ r ∈ p.support, |p.coeff r| * monomialWeight v r
CausalSmith.Stat.DiscreteAteMinimaxLoggap.coefficientEnvelope · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/MvPolynomialEnvelope.lean:12
theorem monomialWeight_nonneg

Shows that monomial Weight nonneg is nonnegative.

Formal statement
v :
Cell → ℝ
hv :
∀ i, 0 ≤ v i
0 ≤ monomialWeight v r
Proof (Lean source)
lemma monomialWeight_nonneg (v : Cell → ℝ) (hv : ∀ i, 0 ≤ v i) (r : MultiIndex) : 0 ≤ monomialWeight v r := by unfold monomialWeight exact Finset.prod_nonneg fun i _ => pow_nonneg (hv i) _
CausalSmith.Stat.DiscreteAteMinimaxLoggap.monomialWeight_nonneg · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/MvPolynomialEnvelope.lean:16
theorem monomialWeight_add

Establishes the stated property of monomial Weight add in the discrete average-treatment-effect construction.

Formal statement
v :
Cell → ℝ
r s :
Proof (Lean source)
lemma monomialWeight_add (v : Cell → ℝ) (r s : MultiIndex) : monomialWeight v (r+s) = monomialWeight v r * monomialWeight v s := by unfold monomialWeight apply Finsupp.prod_add_index · intro; simp · intro a ha b₁ b₂ exact pow_add _ _ _
CausalSmith.Stat.DiscreteAteMinimaxLoggap.monomialWeight_add · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/MvPolynomialEnvelope.lean:22
theorem coefficientEnvelope_extend

Establishes the stated property of coefficient Envelope extend in the discrete average-treatment-effect construction.

Formal statement
p :
v :
Cell → ℝ
hs :
p.support ⊆ s
coefficientEnvelope p v = ∑ r ∈ s, |p.coeff r| * monomialWeight v r
Proof (Lean source)
lemma coefficientEnvelope_extend (p : MvPolynomial Cell ℝ) (v : Cell → ℝ) (s : Finset MultiIndex) (hs : p.support ⊆ s) : coefficientEnvelope p v = ∑ r ∈ s, |p.coeff r| * monomialWeight v r := by unfold coefficientEnvelope apply Finset.sum_subset hs intro r hrs hrp have hc : p.coeff r = 0 := not_ne_iff.mp ((MvPolynomial.mem_support_iff).not.mp hrp) simp [hc]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.coefficientEnvelope_extend · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/MvPolynomialEnvelope.lean:31
theorem coefficientEnvelope_add_le

Establishes the stated upper bound for coefficient Envelope add le.

Formal statement
p q :
v :
Cell → ℝ
hv :
∀ i, 0 ≤ v i
Proof (Lean source)
lemma coefficientEnvelope_add_le (p q : MvPolynomial Cell ℝ) (v : Cell → ℝ) (hv : ∀ i, 0 ≤ v i) : coefficientEnvelope (p+q) v ≤ coefficientEnvelope p v + coefficientEnvelope q v := by let s := p.support ∪ q.support rw [coefficientEnvelope_extend (p+q) v s MvPolynomial.support_add] rw [coefficientEnvelope_extend p v s (subset_union_left)] rw [coefficientEnvelope_extend q v s (subset_union_right)] rw [← Finset.sum_add_distrib] apply Finset.sum_le_sum intro r hr rw [MvPolynomial.coeff_add] have hw := monomialWeight_nonneg v hv r nlinarith [abs_add_le (p.coeff r) (q.coeff r)]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.coefficientEnvelope_add_le · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/MvPolynomialEnvelope.lean:41
theorem coefficientEnvelope_neg

Establishes the stated property of coefficient Envelope neg in the discrete average-treatment-effect construction.

Formal statement
p :
v :
Cell → ℝ
Proof (Lean source)
lemma coefficientEnvelope_neg (p : MvPolynomial Cell ℝ) (v : Cell → ℝ) : coefficientEnvelope (-p) v = coefficientEnvelope p v := by unfold coefficientEnvelope simp
CausalSmith.Stat.DiscreteAteMinimaxLoggap.coefficientEnvelope_neg · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/MvPolynomialEnvelope.lean:56
theorem coefficientEnvelope_sub_le

Establishes the stated upper bound for coefficient Envelope sub le.

Formal statement
p q :
v :
Cell → ℝ
hv :
∀ i, 0 ≤ v i
Proof (Lean source)
lemma coefficientEnvelope_sub_le (p q : MvPolynomial Cell ℝ) (v : Cell → ℝ) (hv : ∀ i, 0 ≤ v i) : coefficientEnvelope (p-q) v ≤ coefficientEnvelope p v + coefficientEnvelope q v := by rw [sub_eq_add_neg] calc coefficientEnvelope (p + -q) v ≤ coefficientEnvelope p v + coefficientEnvelope (-q) v := coefficientEnvelope_add_le _ _ _ hv _ = _ := by rw [coefficientEnvelope_neg]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.coefficientEnvelope_sub_le · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/MvPolynomialEnvelope.lean:62
theorem coefficientEnvelope_mul_le

Establishes the stated upper bound for coefficient Envelope mul le.

Formal statement
p q :
v :
Cell → ℝ
hv :
∀ i, 0 ≤ v i
Proof (Lean source)
lemma coefficientEnvelope_mul_le (p q : MvPolynomial Cell ℝ) (v : Cell → ℝ) (hv : ∀ i, 0 ≤ v i) : coefficientEnvelope (p*q) v ≤ coefficientEnvelope p v * coefficientEnvelope q v := by let S := p.support ×ˢ q.support let U := p.support + q.support have hsupp : (p*q).support ⊆ U := MvPolynomial.support_mul p q rw [coefficientEnvelope_extend (p*q) v U hsupp] have hcoeff (n : MultiIndex) : |(p*q).coeff n| * monomialWeight v n ≤ ∑ rs ∈ S, if rs.1 + rs.2 = n then (|p.coeff rs.1| * monomialWeight v rs.1) * (|q.coeff rs.2| * monomialWeight v rs.2) else 0 := by rw [MvPolynomial.coeff_mul] let A := Finset.antidiagonal n have heq : (∑ rs ∈ A, p.coeff rs.1 * q.coeff rs.2) = ∑ rs ∈ A ∩ S, p.coeff rs.1 * q.coeff rs.2 := by symm apply Finset.sum_subset Finset.inter_subset_left intro rs hrs hrsnot have hnotS : rs ∉ S := by intro hS exact hrsnot (Finset.mem_inter.mpr ⟨hrs, hS⟩) by_cases hp : rs.1 ∈ p.support · have hq : rs.2 ∉ q.support := by intro hq exact hnotS (by simp [S, hp, hq]) have hc : q.coeff rs.2 = 0 := not_ne_iff.mp ((MvPolynomial.mem_support_iff).not.mp hq) simp [hc] · have hc : p.coeff rs.1 = 0 := not_ne_iff.mp ((MvPolynomial.mem_support_iff).not.mp hp) simp [hc] rw [heq] calc |∑ rs ∈ A ∩ S, p.coeff rs.1 * q.coeff rs.2| * monomialWeight v n ≤ (∑ rs ∈ A ∩ S, |p.coeff rs.1 * q.coeff rs.2|) * monomialWeight v n := by exact mul_le_mul_of_nonneg_right (Finset.abs_sum_le_sum_abs (G := ℝ) (fun rs : MultiIndex × MultiIndex => p.coeff rs.1 * q.coeff rs.2) (A ∩ S)) (monomialWeight_nonneg v hv n) _ = ∑ rs ∈ A ∩ S, (|p.coeff rs.1| * monomialWeight v rs.1) * (|q.coeff rs.2| * monomialWeight v rs.2) := by rw [Finset.sum_mul] apply Finset.sum_congr rfl intro rs hrs have hadd : rs.1 + rs.2 = n := by simpa [A] using (Finset.mem_inter.mp hrs).1 rw [abs_mul, ← hadd, monomialWeight_add] ring _ = ∑ rs ∈ S, if rs.1 + rs.2 = n then (|p.coeff rs.1| * monomialWeight v rs.1) * (|q.coeff rs.2| * monomialWeight v rs.2) else 0 := by rw [← Finset.sum_filter] apply Finset.sum_congr · ext rs simp [A, and_comm] · intro rs hrs simp only [mem_filter] at hrs simp calc (∑ n ∈ U, |(p*q).coeff n| * monomialWeight v n) ≤ ∑ n ∈ U, ∑ rs ∈ S, if rs.1 + rs.2 = n then (|p.coeff rs.1| * monomialWeight v rs.1) * (|q.coeff rs.2| * monomialWeight v rs.2) else 0 := by gcongr with n hn exact hcoeff n _ = ∑ rs ∈ S, (|p.coeff rs.1| * monomialWeight v rs.1) * (|q.coeff rs.2| * monomialWeight v rs.2) := by rw [Finset.sum_comm] apply Finset.sum_congr rfl intro rs hrs have hmem : rs.1 + rs.2 ∈ U := by rcases (Finset.mem_product.mp (show rs ∈ p.support ×ˢ q.support from hrs)) with ⟨hr, hs⟩ exact Finset.mem_add.mpr ⟨rs.1, hr, rs.2, hs, rfl⟩ rw [Finset.sum_eq_single (rs.1+rs.2)] · simp · intro n hn hne simp [hne.symm] · exact fun h => (h hmem).elim _ = coefficientEnvelope p v * coefficientEnvelope q v := by unfold S coefficientEnvelope rw [Finset.sum_product, Finset.sum_mul] apply Finset.sum_congr rfl intro r hr rw [Finset.mul_sum]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.coefficientEnvelope_mul_le · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/MvPolynomialEnvelope.lean:73
Helpers.PilotConditioning 3 declarations
theorem oneShot_statistics_indep

Any measurable pilot statistic is independent of any measurable estimation-fold statistic. This is the reusable conditioning interface for freezing the pilot-selected light-cell set before applying factorial-moment bounds on the estimation fold.

Formal statement
S :
IIDSample Ω X μ P
split :
n :
pilot :
(split.foldA n → X) → B
estimate :
(split.foldB n → X) → C
hpilot :
hestimate :
Measurable estimate
IndepFun (fun ω => pilot (fun i : split.foldA n => S.Z i ω)) (fun ω => estimate (fun i : split.foldB n => S.Z i ω)) μ
Proof (Lean source)
lemma oneShot_statistics_indep {S : IIDSample Ω X μ P} (split : OneShotSplit S) (n : ℕ) (pilot : (split.foldA n → X) → B) (estimate : (split.foldB n → X) → C) (hpilot : Measurable pilot) (hestimate : Measurable estimate) : IndepFun (fun ω => pilot (fun i : split.foldA n => S.Z i ω)) (fun ω => estimate (fun i : split.foldB n => S.Z i ω)) μ := by exact (split.folds_indep n).comp hpilot hestimate
CausalSmith.Stat.DiscreteAteMinimaxLoggap.oneShot_statistics_indep · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/PilotConditioning.lean:13
theorem oneShot_integral_mul_factorization

Integral factorization after the pilot/estimation split.

Formal statement
S :
IIDSample Ω X μ P
split :
n :
pilot :
(split.foldA n → X) → ℝ
estimate :
(split.foldB n → X) → ℝ
hpilot :
hestimate :
Measurable estimate
∫ ω, pilot (fun i : split.foldA n => S.Z i ω) * estimate (fun i : split.foldB n => S.Z i ω) ∂μ
= (∫ ω, pilot (fun i : split.foldA n => S.Z i ω) ∂μ) * ∫ ω, estimate (fun i : split.foldB n => S.Z i ω) ∂μ
Proof (Lean source)
lemma oneShot_integral_mul_factorization {S : IIDSample Ω X μ P} (split : OneShotSplit S) (n : ℕ) (pilot : (split.foldA n → X) → ℝ) (estimate : (split.foldB n → X) → ℝ) (hpilot : Measurable pilot) (hestimate : Measurable estimate) : ∫ ω, pilot (fun i : split.foldA n => S.Z i ω) * estimate (fun i : split.foldB n => S.Z i ω) ∂μ = (∫ ω, pilot (fun i : split.foldA n => S.Z i ω) ∂μ) * ∫ ω, estimate (fun i : split.foldB n => S.Z i ω) ∂μ := by have hpTuple : Measurable (fun ω => fun i : split.foldA n => S.Z i ω) := measurable_pi_lambda _ (fun i : split.foldA n => S.meas i) have heTuple : Measurable (fun ω => fun i : split.foldB n => S.Z i ω) := measurable_pi_lambda _ (fun i : split.foldB n => S.meas i) have hind := oneShot_statistics_indep split n pilot estimate hpilot hestimate exact hind.integral_fun_mul_eq_mul_integral (hpilot.comp hpTuple).aestronglyMeasurable (hestimate.comp heTuple).aestronglyMeasurable
CausalSmith.Stat.DiscreteAteMinimaxLoggap.oneShot_integral_mul_factorization · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/PilotConditioning.lean:26
theorem oneShot_integral_estimate_restrict_pilot

Conditioning on a measurable pilot event does not alter an estimation-fold integral, except for multiplication by the pilot-event probability.

Formal statement
S :
IIDSample Ω X μ P
split :
n :
pilot :
(split.foldA n → X) → B
estimate :
(split.foldB n → X) → ℝ
hpilot :
hestimate :
Measurable estimate
E :
Set B
hE :
∫ ω in (fun ω => pilot (fun i : split.foldA n => S.Z i ω)) ⁻¹' E, estimate (fun i : split.foldB n => S.Z i ω) ∂μ
= (μ ((fun ω => pilot (fun i : split.foldA n => S.Z i ω)) ⁻¹' E)).toReal * ∫ ω, estimate (fun i : split.foldB n => S.Z i ω) ∂μ
Proof (Lean source)
lemma oneShot_integral_estimate_restrict_pilot {S : IIDSample Ω X μ P} (split : OneShotSplit S) (n : ℕ) (pilot : (split.foldA n → X) → B) (estimate : (split.foldB n → X) → ℝ) (hpilot : Measurable pilot) (hestimate : Measurable estimate) (E : Set B) (hE : MeasurableSet E) : ∫ ω in (fun ω => pilot (fun i : split.foldA n => S.Z i ω)) ⁻¹' E, estimate (fun i : split.foldB n => S.Z i ω) ∂μ = (μ ((fun ω => pilot (fun i : split.foldA n => S.Z i ω)) ⁻¹' E)).toReal * ∫ ω, estimate (fun i : split.foldB n => S.Z i ω) ∂μ := by have hpTuple : Measurable (fun ω => fun i : split.foldA n => S.Z i ω) := measurable_pi_lambda _ (fun i : split.foldA n => S.meas i) have heTuple : Measurable (fun ω => fun i : split.foldB n => S.Z i ω) := measurable_pi_lambda _ (fun i : split.foldB n => S.meas i) have hind := oneShot_statistics_indep split n pilot estimate hpilot hestimate exact hind.integral_restrict_preimage_eq_mul (hpilot.comp hpTuple).aemeasurable (hestimate.comp heTuple).aemeasurable hE ((hpilot.comp hpTuple) hE) measurable_id.aestronglyMeasurable
CausalSmith.Stat.DiscreteAteMinimaxLoggap.oneShot_integral_estimate_restrict_pilot · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/PilotConditioning.lean:45
Helpers.PilotSandwich 13 declarations
def categoryIndicator

Defines category Indicator, the stated quantity or construction used in the discrete average-treatment-effect estimator.

Definition (Lean source)
noncomputable def categoryIndicator {d : ℕ} (k : Fin d) (z : Obs d) : ℝ := if z.1 = k then 1 else 0
CausalSmith.Stat.DiscreteAteMinimaxLoggap.categoryIndicator · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/PilotSandwich.lean:15
theorem categoryIndicator_mean

Establishes the stated property of category Indicator mean in the discrete average-treatment-effect construction.

Formal statement
d :
P :
k :
Fin d
∫ z, categoryIndicator k z ∂obsLaw P = cellMass P k
Proof (Lean source)
lemma categoryIndicator_mean {d : ℕ} (P : DiscreteLaw d) (k : Fin d) : ∫ z, categoryIndicator k z ∂obsLaw P = cellMass P k := by classical rw [show obsLaw P = P.pmf.toMeasure by rfl, PMF.integral_eq_sum] simp [categoryIndicator, cellMass, jointMass, Fintype.sum_prod_type] rw [Finset.sum_eq_single k] · simp · intro b _hb hne simp [hne] · simp
CausalSmith.Stat.DiscreteAteMinimaxLoggap.categoryIndicator_mean · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/PilotSandwich.lean:20
theorem pilot_count_eq_bernoulliCount

Establishes the stated equality relating pilot count eq bernoulli Count.

Formal statement
n d :
P :
k :
Fin d
ω :
ℕ → Obs d
(splitCategoryCount (fun i : Fin n => ω i) 0 k : ℝ)
= bernoulliCount (iidSample_infinitePi (obsLaw P)) (categoryIndicator k) (n / 2) ω
Proof (Lean source)
lemma pilot_count_eq_bernoulliCount {n d : ℕ} (P : DiscreteLaw d) (k : Fin d) (ω : ℕ → Obs d) : (splitCategoryCount (fun i : Fin n => ω i) 0 k : ℝ) = bernoulliCount (iidSample_infinitePi (obsLaw P)) (categoryIndicator k) (n / 2) ω := by simp only [splitCategoryCount, splitIndices, if_pos, mem_filter, Finset.mem_univ, true_and, bernoulliCount, categoryIndicator, iidSample_infinitePi, Function.comp_apply] have hsum : (∑ x ∈ range (n / 2), if (ω x).1 = k then (1 : ℝ) else 0) = ({x ∈ range (n / 2) | (ω x).1 = k}.card : ℝ) := Finset.sum_boole (R := ℝ) (fun x : ℕ ↦ (ω x).1 = k) (range (n / 2)) calc ((((Finset.univ : Finset (Fin n)).filter fun i ↦ i.1 < n / 2).filter (fun i : Fin n ↦ (ω i).1 = k)).card : ℝ) = ((range (n / 2)).filter (fun x : ℕ ↦ (ω x).1 = k)).card := by norm_cast apply Finset.card_bij (fun i _hi ↦ i.1) · intro i hi simp only [mem_filter, Finset.mem_range] at hi ⊢ exact ⟨hi.1.2, hi.2⟩ · intro i₁ _hi₁ i₂ _hi₂ heq exact Fin.ext heq · intro j hj simp only [mem_filter, Finset.mem_range] at hj let i : Fin n := ⟨j, lt_of_lt_of_le hj.1 (Nat.div_le_self n 2)⟩ refine ⟨i, ?_, rfl⟩ simp only [mem_filter, Finset.mem_univ, true_and] exact ⟨hj.1, hj.2⟩ _ = ∑ x ∈ range (n / 2), if (ω x).1 = k then (1 : ℝ) else 0 := hsum.symm
CausalSmith.Stat.DiscreteAteMinimaxLoggap.pilot_count_eq_bernoulliCount · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/PilotSandwich.lean:33
theorem pilotCategory_upper_tail

Establishes the stated property of pilot Category upper tail in the discrete average-treatment-effect construction.

Formal statement
n d :
P :
k :
Fin d
a :
hmean_lt :
(n / 2 : ℕ) * cellMass P k < a / 2
(productLaw P n).real {sample | a < (splitCategoryCount sample 0 k : ℝ)}
exp (-a * (log 2 - 1 / 2))
Proof (Lean source)
lemma pilotCategory_upper_tail {n d : ℕ} (P : DiscreteLaw d) (k : Fin d) {a : ℝ} (hmean_lt : (n / 2 : ℕ) * cellMass P k < a / 2) : (productLaw P n).real {sample | a < (splitCategoryCount sample 0 k : ℝ)} ≤ exp (-a * (log 2 - 1 / 2)) := by let trunc : (ℕ → Obs d) → (Fin n → Obs d) := fun ω i ↦ ω i have htrunc : Measurable trunc := by fun_prop have hE : MeasurableSet {sample : Fin n → Obs d | a < (splitCategoryCount sample 0 k : ℝ)} := MeasurableSet.of_discrete rw [productLaw, ← finProductLaw_eq_map (obsLaw P) n, map_measureReal_apply htrunc hE] have hpre : trunc ⁻¹' {sample : Fin n → Obs d | a < (splitCategoryCount sample 0 k : ℝ)} = {ω | a < bernoulliCount (iidSample_infinitePi (obsLaw P)) (categoryIndicator k) (n / 2) ω} := by ext ω simp only [Set.mem_preimage, Set.mem_setOf_eq, trunc] rw [← pilot_count_eq_bernoulliCount P] rw [hpre] apply bernoulliCount_upper_tail (iidSample_infinitePi (obsLaw P)) (measurable_of_finite _) (fun z ↦ ?_) (categoryIndicator_mean P k).le hmean_lt by_cases hz : z.1 = k <;> simp [categoryIndicator, hz]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.pilotCategory_upper_tail · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/PilotSandwich.lean:69
theorem pilotCategory_lower_tail

Establishes the stated property of pilot Category lower tail in the discrete average-treatment-effect construction.

Formal statement
n d :
P :
k :
Fin d
a :
hmean_gt :
2 * a < (n / 2 : ℕ) * cellMass P k
(productLaw P n).real {sample | (splitCategoryCount sample 0 k : ℝ) ≤ a}
exp (-((n / 2 : ℕ) * cellMass P k) / 8)
Proof (Lean source)
lemma pilotCategory_lower_tail {n d : ℕ} (P : DiscreteLaw d) (k : Fin d) {a : ℝ} (hmean_gt : 2 * a < (n / 2 : ℕ) * cellMass P k) : (productLaw P n).real {sample | (splitCategoryCount sample 0 k : ℝ) ≤ a} ≤ exp (-((n / 2 : ℕ) * cellMass P k) / 8) := by let trunc : (ℕ → Obs d) → (Fin n → Obs d) := fun ω i ↦ ω i have htrunc : Measurable trunc := by fun_prop have hE : MeasurableSet {sample : Fin n → Obs d | (splitCategoryCount sample 0 k : ℝ) ≤ a} := MeasurableSet.of_discrete rw [productLaw, ← finProductLaw_eq_map (obsLaw P) n, map_measureReal_apply htrunc hE] have hpre : trunc ⁻¹' {sample : Fin n → Obs d | (splitCategoryCount sample 0 k : ℝ) ≤ a} = {ω | bernoulliCount (iidSample_infinitePi (obsLaw P)) (categoryIndicator k) (n / 2) ω ≤ a} := by ext ω simp only [Set.mem_preimage, Set.mem_setOf_eq, trunc] rw [← pilot_count_eq_bernoulliCount P] rw [hpre] apply bernoulliCount_lower_tail (iidSample_infinitePi (obsLaw P)) (measurable_of_finite _) (fun z ↦ ?_) (cellMass_mem_unitInterval P k).1 (categoryIndicator_mean P k).ge hmean_gt by_cases hz : z.1 = k <;> simp [categoryIndicator, hz]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.pilotCategory_lower_tail · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/PilotSandwich.lean:97
def pilotHeavyAt

Defines pilot Heavy At, the stated quantity or construction used in the discrete average-treatment-effect estimator.

Definition (Lean source)
noncomputable def pilotHeavyAt {n d : ℕ} (sample : Fin n → Obs d) (t : ℝ) : Finset (Fin d) := Finset.univ.filter (fun k => ⌊t * logScale n⌋ < (splitCategoryCount sample 0 k : ℤ))
def pilotBadEvent

Defines pilot Bad Event, the stated quantity or construction used in the discrete average-treatment-effect estimator.

Definition (Lean source)
noncomputable def pilotBadEvent {n d : ℕ} (P : DiscreteLaw d) (t : ℝ) : Set (Fin n → Obs d) := {sample | ¬ (∀ k ∈ pilotHeavyAt sample t, t * logScale n / (2 * splitSize n 0) ≤ cellMass P k) ∨ ¬ (∀ k ∉ pilotHeavyAt sample t, cellMass P k ≤ 2 * t * logScale n / splitSize n 0)}
CausalSmith.Stat.DiscreteAteMinimaxLoggap.pilotBadEvent · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/PilotSandwich.lean:130
theorem pilotBadEvent_subset_cellwise

Establishes the stated property of pilot Bad Event subset cellwise in the discrete average-treatment-effect construction.

Formal statement
n d :
P :
t :
pilotBadEvent P t ⊆ (⋃ k : Fin d, {sample : Fin n → Obs d | cellMass P k < t * logScale n / (2 * splitSize n 0) ∧ t * logScale n < (splitCategoryCount sample 0 k : ℝ)}) ∪ (⋃ k : Fin d, {sample : Fin n → Obs d | 2 * t * logScale n / splitSize n 0 < cellMass P k ∧ (splitCategoryCount sample 0 k : ℝ) ≤ t * logScale n})
Proof (Lean source)
lemma pilotBadEvent_subset_cellwise {n d : ℕ} (P : DiscreteLaw d) (t : ℝ) : pilotBadEvent P t ⊆ (⋃ k : Fin d, {sample : Fin n → Obs d | cellMass P k < t * logScale n / (2 * splitSize n 0) ∧ t * logScale n < (splitCategoryCount sample 0 k : ℝ)}) ∪ (⋃ k : Fin d, {sample : Fin n → Obs d | 2 * t * logScale n / splitSize n 0 < cellMass P k ∧ (splitCategoryCount sample 0 k : ℝ) ≤ t * logScale n}) := by intro sample hs rw [pilotBadEvent] at hs rcases hs with hs | hs · push_neg at hs rcases hs with ⟨k, hk⟩ rcases hk with ⟨hkHeavy, hkMass⟩ apply Set.mem_union_left simp only [Set.mem_iUnion, Set.mem_setOf_eq] refine ⟨k, hkMass, ?_⟩ have hcount : ⌊t * logScale n⌋ < (splitCategoryCount sample 0 k : ℤ) := by simpa [pilotHeavyAt] using hkHeavy exact Int.floor_lt.mp hcount · push_neg at hs rcases hs with ⟨k, hk⟩ rcases hk with ⟨hkLight, hkMass⟩ apply Set.mem_union_right simp only [Set.mem_iUnion, Set.mem_setOf_eq] refine ⟨k, hkMass, ?_⟩ have hnot : ¬ ⌊t * logScale n⌋ < (splitCategoryCount sample 0 k : ℤ) := by simpa [pilotHeavyAt] using hkLight have hle : (splitCategoryCount sample 0 k : ℤ) ≤ ⌊t * logScale n⌋ := le_of_not_gt hnot exact_mod_cast (Int.le_floor.mp hle)
CausalSmith.Stat.DiscreteAteMinimaxLoggap.pilotBadEvent_subset_cellwise · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/PilotSandwich.lean:140
theorem pilotBadEvent_probability

Establishes the stated property of pilot Bad Event probability in the discrete average-treatment-effect construction.

Formal statement
n d :
P :
t :
ht :
0 ≤ t
hn :
2 ≤ n
(productLaw P n).real (pilotBadEvent P t)
≤ d * (exp (-(t * logScale n) * (log 2 - 1 / 2)) + exp (-(t * logScale n) / 4))
Proof (Lean source)
lemma pilotBadEvent_probability {n d : ℕ} (P : DiscreteLaw d) (t : ℝ) (ht : 0 ≤ t) (hn : 2 ≤ n) : (productLaw P n).real (pilotBadEvent P t) ≤ d * (exp (-(t * logScale n) * (log 2 - 1 / 2)) + exp (-(t * logScale n) / 4)) := by calc (productLaw P n).real (pilotBadEvent P t) ≤ (productLaw P n).real ((⋃ k : Fin d, {sample | cellMass P k < t * logScale n / (2 * splitSize n 0) ∧ t * logScale n < (splitCategoryCount sample 0 k : ℝ)}) ∪ (⋃ k : Fin d, {sample | 2 * t * logScale n / splitSize n 0 < cellMass P k ∧ (splitCategoryCount sample 0 k : ℝ) ≤ t * logScale n})) := measureReal_mono (pilotBadEvent_subset_cellwise P t) _ ≤ ∑ k : Fin d, (productLaw P n).real {sample | cellMass P k < t * logScale n / (2 * splitSize n 0) ∧ t * logScale n < (splitCategoryCount sample 0 k : ℝ)} + ∑ k : Fin d, (productLaw P n).real {sample | 2 * t * logScale n / splitSize n 0 < cellMass P k ∧ (splitCategoryCount sample 0 k : ℝ) ≤ t * logScale n} := by exact (measureReal_union_le _ _).trans (add_le_add (measureReal_iUnion_fintype_le _) (measureReal_iUnion_fintype_le _)) _ ≤ ∑ _k : Fin d, exp (-(t * logScale n) * (log 2 - 1 / 2)) + ∑ _k : Fin d, exp (-(t * logScale n) / 4) := by apply add_le_add · apply Finset.sum_le_sum intro k _hk_univ by_cases hk : cellMass P k < t * logScale n / (2 * splitSize n 0) · apply (measureReal_mono (fun sample hs ↦ hs.2)).trans have hs : splitSize n 0 = n / 2 := by simp [splitSize, splitIndices, Fin.card_filter_val_lt, Nat.min_eq_right (Nat.div_le_self n 2)] rw [hs] at hk apply pilotCategory_upper_tail P k have hmNat : 0 < n / 2 := Nat.div_pos (by omega) (by omega) have hm : (0 : ℝ) < ((n / 2 : ℕ) : ℝ) := by exact_mod_cast hmNat have hmult := (lt_div_iff₀ (mul_pos (by norm_num : (0 : ℝ) < 2) hm)).mp hk nlinarith · simp only [hk, false_and, Set.setOf_false, measureReal_empty] positivity · apply Finset.sum_le_sum intro k _hk_univ by_cases hk : 2 * t * logScale n / splitSize n 0 < cellMass P k · apply (measureReal_mono (fun sample hs ↦ hs.2)).trans have hs : splitSize n 0 = n / 2 := by simp [splitSize, splitIndices, Fin.card_filter_val_lt, Nat.min_eq_right (Nat.div_le_self n 2)] rw [hs] at hk have hmNat : 0 < n / 2 := Nat.div_pos (by omega) (by omega) have hm : (0 : ℝ) < ((n / 2 : ℕ) : ℝ) := by exact_mod_cast hmNat have hmean_gt : 2 * (t * logScale n) < (n / 2 : ℕ) * cellMass P k := by have hmult := (div_lt_iff₀ hm).mp hk nlinarith have htail := pilotCategory_lower_tail P k hmean_gt exact htail.trans (Real.exp_le_exp.mpr (by nlinarith)) · simp only [hk, false_and, Set.setOf_false, measureReal_empty] positivity _ = d * (exp (-(t * logScale n) * (log 2 - 1 / 2)) + exp (-(t * logScale n) / 4)) := by simp [Nat.cast_ofNat]; ring
CausalSmith.Stat.DiscreteAteMinimaxLoggap.pilotBadEvent_probability · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/PilotSandwich.lean:174

Establishes the stated upper bound for exp neg mul log Scale.

Formal statement
n :
hn :
0 < n
q :
exp (-q * logScale n) = exp (-q) * rpow n (-q)
Proof (Lean source)
lemma exp_neg_mul_logScale (n : ℕ) (hn : 0 < n) (q : ℝ) : exp (-q * logScale n) = exp (-q) * rpow n (-q) := by have hnR : (0 : ℝ) < n := by exact_mod_cast hn change exp (-q * logScale n) = exp (-q) * (n : ℝ) ^ (-q) rw [Real.rpow_def_of_pos hnR] unfold logScale rw [Real.log_mul (Real.exp_ne_zero 1) (ne_of_gt hnR), Real.log_exp] rw [← Real.exp_add] congr 1 ring
CausalSmith.Stat.DiscreteAteMinimaxLoggap.exp_neg_mul_logScale · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/PilotSandwich.lean:242

Establishes the stated upper bound for pilot decay bound.

Formal statement
K c t :
hK :
0 < K
hc :
0 < c
ht :
0 ≤ t
htUpper :
K + 4 ≤ t * (log 2 - 1 / 2)
htLower :
K + 4 ≤ t / 4
∀ n d : ℕ
if
1 ≤ n
and
(d : ℝ) ≤ c * n * logScale n
then
d * (exp (-(t * logScale n) * (log 2 - 1 / 2)) + exp (-(t * logScale n) / 4))
≤ (2 * c) * rpow n (-K)
Proof (Lean source)
lemma pilot_decay_bound (K c t : ℝ) (hK : 0 < K) (hc : 0 < c) (ht : 0 ≤ t) (htUpper : K + 4 ≤ t * (log 2 - 1 / 2)) (htLower : K + 4 ≤ t / 4) : ∀ n d : ℕ, 1 ≤ n → (d : ℝ) ≤ c * n * logScale n → d * (exp (-(t * logScale n) * (log 2 - 1 / 2)) + exp (-(t * logScale n) / 4)) ≤ (2 * c) * rpow n (-K) := by intro n d hn hd have hnpos : 0 < n := Nat.zero_lt_of_lt hn have hnR : (0 : ℝ) < n := by exact_mod_cast hnpos have hnR1 : (1 : ℝ) ≤ n := by exact_mod_cast hn have hLpos : 0 < logScale n := by unfold logScale apply Real.log_pos calc 1 < exp 1 := Real.one_lt_exp_iff.mpr (by norm_num) _ ≤ exp 1 * (n : ℝ) := le_mul_of_one_le_right (Real.exp_pos 1).le hnR1 have hLle : logScale n ≤ (n : ℝ) := by unfold logScale rw [Real.log_mul (Real.exp_ne_zero 1) (ne_of_gt hnR), Real.log_exp] have hlog : log (n : ℝ) ≤ n - 1 := Real.log_le_sub_one_of_pos hnR linarith have hupper : exp (-(t * logScale n) * (log 2 - 1 / 2)) ≤ exp (-(K + 4) * logScale n) := by apply Real.exp_le_exp.mpr nlinarith have hlower : exp (-(t * logScale n) / 4) ≤ exp (-(K + 4) * logScale n) := by apply Real.exp_le_exp.mpr nlinarith calc (d : ℝ) * (exp (-(t * logScale n) * (log 2 - 1 / 2)) + exp (-(t * logScale n) / 4)) ≤ (c * n * logScale n) * (2 * exp (-(K + 4) * logScale n)) := by gcongr <;> nlinarith _ ≤ (c * n * n) * (2 * exp (-(K + 4) * logScale n)) := by gcongr _ = 2 * c * exp (-(K + 4)) * ((n : ℝ) ^ 2 * rpow n (-(K + 4))) := by rw [exp_neg_mul_logScale n hnpos] ring _ ≤ 2 * c * ((n : ℝ) ^ 2 * rpow n (-(K + 4))) := by have hexp : exp (-(K + 4)) ≤ 1 := by rw [← Real.exp_zero] exact Real.exp_le_exp.mpr (by linarith) have hfactor : 0 ≤ 2 * c * ((n : ℝ) ^ 2 * rpow n (-(K + 4))) := by exact mul_nonneg (mul_nonneg (by positivity) hc.le) (mul_nonneg (sq_nonneg _) (Real.rpow_pos_of_pos hnR _).le) calc 2 * c * exp (-(K + 4)) * ((n : ℝ) ^ 2 * rpow n (-(K + 4))) = exp (-(K + 4)) * (2 * c * ((n : ℝ) ^ 2 * rpow n (-(K + 4))) ) := by ring _ ≤ 1 * (2 * c * ((n : ℝ) ^ 2 * rpow n (-(K + 4)))) := mul_le_mul_of_nonneg_right hexp hfactor _ = 2 * c * ((n : ℝ) ^ 2 * rpow n (-(K + 4))) := by ring _ = 2 * c * rpow n (-K - 2) := by have hpow : ((n : ℝ) ^ 2) = rpow n 2 := by symm exact Real.rpow_natCast n 2 have hrpow : rpow n 2 * rpow n (-(K + 4)) = rpow n (-K - 2) := by calc rpow n 2 * rpow n (-(K + 4)) = rpow n (2 + -(K + 4)) := (Real.rpow_add hnR 2 (-(K + 4))).symm _ = rpow n (-K - 2) := by congr 1 <;> ring rw [hpow, hrpow] _ ≤ 2 * c * rpow n (-K) := by gcongr exact Real.rpow_le_rpow_of_exponent_le hnR1 (by linarith)
CausalSmith.Stat.DiscreteAteMinimaxLoggap.pilot_decay_bound · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/PilotSandwich.lean:255
theorem pilot_sandwich Lemma 1 in the paper ↗

Polynomially small failure probability for the pilot heavy/light sandwich.

Formal statement
(∀ K c : ℝ, 0 < K → 0 < c → ∃ t₀ C N, 0 < t₀ ∧ 0 < C ∧ ∀ t : ℝ, t₀ ≤ t → ∀ (n d : ℕ) (P : DiscreteLaw d) (mu_n : Measure (Fin n → Obs d)), N ≤ n → (d : ℝ) ≤ c * n * logScale n → IidSampling P mu_n → mu_n.real (pilotBadEvent P t) ≤ C * rpow n (-K)) ∧
(∀ c : ℝ, 0 < c → ∃ C N, 0 < C ∧ ∀ (n d : ℕ) (P : DiscreteLaw d) (mu_n : Measure (Fin n → Obs d)), N ≤ n → (d : ℝ) ≤ c * n * logScale n → IidSampling P mu_n → mu_n.real (pilotBadEvent P 256) ≤ C * rpow n (-4))
Proof (Lean source)
lemma pilot_sandwich : (∀ K c : ℝ, 0 < K → 0 < c → -- @realizes c(positive constant in d ≤ c n log n) ∃ t₀ C N, 0 < t₀ ∧ 0 < C ∧ ∀ t : ℝ, t₀ ≤ t → ∀ (n d : ℕ) (P : DiscreteLaw d) (mu_n : Measure (Fin n → Obs d)), N ≤ n → (d : ℝ) ≤ c * n * logScale n → IidSampling P mu_n → mu_n.real (pilotBadEvent P t) ≤ C * rpow n (-K)) ∧ (∀ c : ℝ, 0 < c → -- @realizes c(positive constant in the K=4 specialization) ∃ C N, 0 < C ∧ ∀ (n d : ℕ) (P : DiscreteLaw d) (mu_n : Measure (Fin n → Obs d)), N ≤ n → (d : ℝ) ≤ c * n * logScale n → IidSampling P mu_n → mu_n.real (pilotBadEvent P 256) ≤ C * rpow n (-4)) := by have hA : 0 < log 2 - 1 / 2 := by nlinarith [Real.log_two_gt_d9] constructor · intro K c hK hc let t₀ := max ((K + 4) / (log 2 - 1 / 2)) (4 * (K + 4)) have hK4 : 0 < K + 4 := by linarith have ht₀ : 0 < t₀ := lt_of_lt_of_le (div_pos hK4 hA) (le_max_left _ _) refine ⟨t₀, 2 * c, 2, ht₀, by positivity, ?_⟩ intro t htt n d P mu_n hn hd hiid have ht : 0 ≤ t := (ht₀.trans_le htt).le have htUpper : K + 4 ≤ t * (log 2 - 1 / 2) := by have := le_trans (le_max_left ((K + 4) / (log 2 - 1 / 2)) (4 * (K + 4))) htt calc K + 4 = ((K + 4) / (log 2 - 1 / 2)) * (log 2 - 1 / 2) := by exact (div_mul_cancel₀ (K + 4) (ne_of_gt hA)).symm _ ≤ t * (log 2 - 1 / 2) := mul_le_mul_of_nonneg_right this hA.le have htLower : K + 4 ≤ t / 4 := by have := le_trans (le_max_right ((K + 4) / (log 2 - 1 / 2)) (4 * (K + 4))) htt linarith rw [hiid] exact (pilotBadEvent_probability P t ht hn).trans (pilot_decay_bound K c t hK hc ht htUpper htLower n d (le_trans (by omega) hn) hd) · intro c hc have ht : (0 : ℝ) ≤ 256 := by norm_num have htUpper : (4 : ℝ) + 4 ≤ 256 * (log 2 - 1 / 2) := by nlinarith [Real.log_two_gt_d9] have htLower : (4 : ℝ) + 4 ≤ 256 / 4 := by norm_num refine ⟨2 * c, 2, by positivity, ?_⟩ intro n d P mu_n hn hd hiid rw [hiid] exact (pilotBadEvent_probability P 256 ht hn).trans (pilot_decay_bound 4 c 256 (by norm_num) hc ht htUpper htLower n d (le_trans (by omega) hn) hd)
CausalSmith.Stat.DiscreteAteMinimaxLoggap.pilot_sandwich · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/PilotSandwich.lean:332
theorem pilot_sandwich_256

The paper's explicit threshold t=256 works for exponent K=4.

Formal statement
∀ c : ℝ,
0 < c → ∃ C N, 0 < C ∧ ∀ (n d : ℕ) (P : DiscreteLaw d) (mu_n : Measure (Fin n → Obs d)), N
≤ n → (d : ℝ) ≤ c * n * logScale n → IidSampling P mu_n → mu_n.real (pilotBadEvent P 256) ≤ C * rpow n (-4)
Proof (Lean source)
lemma pilot_sandwich_256 : ∀ c : ℝ, 0 < c → ∃ C N, 0 < C ∧ ∀ (n d : ℕ) (P : DiscreteLaw d) (mu_n : Measure (Fin n → Obs d)), N ≤ n → (d : ℝ) ≤ c * n * logScale n → IidSampling P mu_n → mu_n.real (pilotBadEvent P 256) ≤ C * rpow n (-4) := by exact pilot_sandwich.2
CausalSmith.Stat.DiscreteAteMinimaxLoggap.pilot_sandwich_256 · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/PilotSandwich.lean:389
Helpers.ShiftedChebyshev 1 declarations
theorem shiftedChebyshevExpansion

Explicit coefficient expansion of the shifted Chebyshev polynomial.

Formal statement
M :
x :
(T ℝ M).eval (1 - 2 * x)
= 1
+ ∑ j ∈ Icc 1 M, (-1 : ℝ) ^ j * (M : ℝ) / (M + j) * choose (M + j) (2 * j) * 4 ^ j * x ^ j
Proof (Lean source)
lemma shiftedChebyshevExpansion (M : ℕ) (x : ℝ) : (T ℝ M).eval (1 - 2 * x) = 1 + ∑ j ∈ Icc 1 M, (-1 : ℝ) ^ j * (M : ℝ) / (M + j) * choose (M + j) (2 * j) * 4 ^ j * x ^ j := by by_cases hM : M = 0 · subst M simp have hMp : 0 < M := Nat.pos_of_ne_zero hM let p := Polynomial.taylor 1 (T ℝ M) have hdeg : p.natDegree = M := by dsimp [p] simp calc (T ℝ M).eval (1 - 2*x) = p.eval (-2*x) := by rw [Polynomial.taylor_eval] congr 2 ring _ = ∑ j ∈ range (M+1), p.coeff j * (-2*x)^j := by rw [Polynomial.eval_eq_sum_range, hdeg] _ = ∑ j ∈ range (M+1), shiftedTaylorCoeff M j * x^j := by apply Finset.sum_congr rfl intro j hj rw [shiftedTaylorCoeff] dsimp [p] rw [mul_pow] ring _ = ∑ j ∈ range (M+1), shiftedCoeff M j * x^j := by apply Finset.sum_congr rfl intro j hj rw [shiftedTaylorCoeff_eq hMp (by simpa using hj)] _ = 1 + ∑ j ∈ Icc 1 M, shiftedCoeff M j * x^j := by have hs : range (M+1) = insert 0 (Icc 1 M) := by ext j simp omega rw [hs, Finset.sum_insert (by simp)] simp [shiftedCoeff, hM] _ = 1 + ∑ j ∈ Icc 1 M, (-1 : ℝ) ^ j * (M : ℝ) / (M + j) * choose (M + j) (2 * j) * 4 ^ j * x ^ j := by rfl
CausalSmith.Stat.DiscreteAteMinimaxLoggap.shiftedChebyshevExpansion · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/Helpers/ShiftedChebyshev.lean:134
T_OverlapAdaptiveUniversalHybrid 2 declarations Clause (v) is deliberately represented by this scope note rather than a Lean proposition: every constant below is pointwise in a fixed epsilon.

Clause (v) is deliberately represented by this scope note rather than a Lean proposition: every constant below is pointwise in a fixed epsilon. Nothing in this theorem asserts a matching lower envelope for triangular arrays epsilon = epsilon_n.

theorem overlap_adaptive_universal_hybrid_statistical

The statistical clauses of the universal-hybrid theorem, assembled from the fixed-interior upper bound, centered-estimator bound, endpoint bracket, and deterministic selector.

Formal statement
(∀ epsilon : ℝ, 0 < epsilon → epsilon < 1 / 2 → ∃ C_epsilon rho_epsilon : ℝ, ∃ N_epsilon : ℕ, 0 < C_epsilon ∧ 0 < rho_epsilon ∧ ∀ n d : ℕ, 0 < n → 0 < d → N_epsilon ≤ n → (d : ℝ) ≤ rho_epsilon * n * log n → worstCaseMSE n d epsilon hybridEstimator ≤ C_epsilon * minimaxRate n d ∧ minimaxRisk n d epsilon ≤ worstCaseMSE n d epsilon (selectedEstimator C_epsilon epsilon) ∧ worstCaseMSE n d epsilon (selectedEstimator C_epsilon epsilon) ≤ max C_epsilon 4 * (1 / (n : ℝ) + min (d ^ 2 / ((n : ℝ) ^ 2 * (log n) ^ 2)) ((1 / 2 - epsilon) ^ 2))) ∧
(∀ epsilon : ℝ, 0 < epsilon → epsilon ≤ 1 / 2 → ∀ n d : ℕ, 0 < n → 0 < d → worstCaseMSE n d epsilon centeredEstimator ≤ 1 / (n : ℝ) + 4 * (1 / 2 - epsilon) ^ 2) ∧
(∀ n d : ℕ, 0 < n → 0 < d → 1 / (100 * (n : ℝ)) ≤ minimaxRisk n d (1 / 2) ∧ minimaxRisk n d (1 / 2) ≤ 1 / (n : ℝ))
Proof (Lean source)
lemma overlap_adaptive_universal_hybrid_statistical : (∀ epsilon : ℝ, 0 < epsilon → epsilon < 1 / 2 → ∃ C_epsilon rho_epsilon : ℝ, ∃ N_epsilon : ℕ, 0 < C_epsilon ∧ 0 < rho_epsilon ∧ ∀ n d : ℕ, 0 < n → 0 < d → N_epsilon ≤ n → (d : ℝ) ≤ rho_epsilon * n * log n → worstCaseMSE n d epsilon hybridEstimator ≤ C_epsilon * minimaxRate n d ∧ minimaxRisk n d epsilon ≤ worstCaseMSE n d epsilon (selectedEstimator C_epsilon epsilon) ∧ worstCaseMSE n d epsilon (selectedEstimator C_epsilon epsilon) ≤ max C_epsilon 4 * (1 / (n : ℝ) + min (d ^ 2 / ((n : ℝ) ^ 2 * (log n) ^ 2)) ((1 / 2 - epsilon) ^ 2))) ∧ (∀ epsilon : ℝ, 0 < epsilon → epsilon ≤ 1 / 2 → ∀ n d : ℕ, 0 < n → 0 < d → worstCaseMSE n d epsilon centeredEstimator ≤ 1 / (n : ℝ) + 4 * (1 / 2 - epsilon) ^ 2) ∧ (∀ n d : ℕ, 0 < n → 0 < d → 1 / (100 * (n : ℝ)) ≤ minimaxRisk n d (1 / 2) ∧ minimaxRisk n d (1 / 2) ≤ 1 / (n : ℝ)) := by refine ⟨?_, ?_, ?_⟩ · intro epsilon he0 he1 rcases hybrid_upper_fixed_interior epsilon he0 he1 with ⟨C, rho, N, hC, hrho, hupper⟩ have hhybrid : ∀ n d : ℕ, 0 < n → N ≤ n → (d : ℝ) ≤ rho * n * log n → worstCaseMSE n d epsilon hybridEstimator ≤ C * minimaxRate n d := by intro n d hn hnN hdim by_cases hd : 0 < d · let Q := canonicalClassLaw n d hd epsilon he0 he1 exact (hupper n d Q.1 (productLaw Q.1 n) Q.2 hnN hdim).2 · have hd0 : d = 0 := Nat.eq_zero_of_not_pos hd subst d letI : IsEmpty (DiscreteLaw 0) := ⟨fun P => by have hmass := P.pmf.tsum_coe simpa using hmass⟩ letI : IsEmpty (ClassLaw n 0 epsilon) := ⟨fun Q => isEmptyElim Q.1⟩ simpa [worstCaseMSE, minimaxRate] using mul_nonneg (le_of_lt hC) (inv_nonneg.mpr (Nat.cast_nonneg n)) refine ⟨C, rho, N, hC, hrho, ?_⟩ intro n d hn hd hnN hdim have hselector := combined_upper_envelope epsilon C rho N he0 he1 hC hrho hhybrid n d hn hnN hdim exact ⟨hhybrid n d hn hnN hdim, hselector.1, hselector.2⟩ · intro epsilon he0 hehalf n d hn _hd unfold worstCaseMSE cases isEmpty_or_nonempty (ClassLaw n d epsilon) with | inl hempty => letI := hempty simp positivity | inr hnonempty => letI := hnonempty apply ciSup_le intro P simpa using near_randomization_linear_upper P.1 (productLaw P.1 n) P.2 hn · intro n d hn hd exact randomized_endpoint_minimax n d hn hd
CausalSmith.Stat.DiscreteAteMinimaxLoggap.overlap_adaptive_universal_hybrid_statistical · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/T_OverlapAdaptiveUniversalHybrid.lean:16
theorem overlap_adaptive_universal_hybrid Theorem 2 in the paper ↗

Universal fixed-class calibration, the all-sample centered bound, the exact randomization bracket, and the combined upper envelope. Clause (i) includes a finite real-arithmetic realization with the stated O(d M^4) operation bound; the hybrid's type has no epsilon argument, realizing its no-selector claim.

Formal statement
(∀ epsilon : ℝ, 0 < epsilon → epsilon < 1 / 2 → ∃ C_epsilon rho_epsilon : ℝ, ∃ N_epsilon : ℕ, 0 < C_epsilon ∧ 0 < rho_epsilon ∧ ∀ n d : ℕ, 0 < n → 0 < d → N_epsilon ≤ n → (d : ℝ) ≤ rho_epsilon * n * log n → worstCaseMSE n d epsilon hybridEstimator ≤ C_epsilon * minimaxRate n d ∧ minimaxRisk n d epsilon ≤ worstCaseMSE n d epsilon (selectedEstimator C_epsilon epsilon) ∧ worstCaseMSE n d epsilon (selectedEstimator C_epsilon epsilon) ≤ max C_epsilon 4 * (1 / (n : ℝ) + min (d ^ 2 / ((n : ℝ) ^ 2 * (log n) ^ 2)) ((1 / 2 - epsilon) ^ 2))) ∧
(∀ epsilon : ℝ, 0 < epsilon → epsilon ≤ 1 / 2 → ∀ n d : ℕ, 0 < n → 0 < d → worstCaseMSE n d epsilon centeredEstimator ≤ 1 / (n : ℝ) + 4 * (1 / 2 - epsilon) ^ 2) ∧
(∀ n d : ℕ, 0 < n → 0 < d → 1 / (100 * (n : ℝ)) ≤ minimaxRisk n d (1 / 2) ∧ minimaxRisk n d (1 / 2) ≤ 1 / (n : ℝ))
Proof (Lean source)
theorem overlap_adaptive_universal_hybrid : HybridEstimatorComputable ∧ (∀ epsilon : ℝ, 0 < epsilon → epsilon < 1 / 2 → ∃ C_epsilon rho_epsilon : ℝ, ∃ N_epsilon : ℕ, 0 < C_epsilon ∧ 0 < rho_epsilon ∧ ∀ n d : ℕ, 0 < n → 0 < d → N_epsilon ≤ n → (d : ℝ) ≤ rho_epsilon * n * log n → worstCaseMSE n d epsilon hybridEstimator ≤ C_epsilon * minimaxRate n d ∧ minimaxRisk n d epsilon ≤ worstCaseMSE n d epsilon (selectedEstimator C_epsilon epsilon) ∧ worstCaseMSE n d epsilon (selectedEstimator C_epsilon epsilon) ≤ max C_epsilon 4 * (1 / (n : ℝ) + min (d ^ 2 / ((n : ℝ) ^ 2 * (log n) ^ 2)) ((1 / 2 - epsilon) ^ 2))) ∧ (∀ epsilon : ℝ, 0 < epsilon → epsilon ≤ 1 / 2 → ∀ n d : ℕ, 0 < n → 0 < d → worstCaseMSE n d epsilon centeredEstimator ≤ 1 / (n : ℝ) + 4 * (1 / 2 - epsilon) ^ 2) ∧ (∀ n d : ℕ, 0 < n → 0 < d → 1 / (100 * (n : ℝ)) ≤ minimaxRisk n d (1 / 2) ∧ minimaxRisk n d (1 / 2) ≤ 1 / (n : ℝ)) := by refine ⟨?_, overlap_adaptive_universal_hybrid_statistical⟩ exact hybridEstimatorComputable
CausalSmith.Stat.DiscreteAteMinimaxLoggap.overlap_adaptive_universal_hybrid · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/T_OverlapAdaptiveUniversalHybrid.lean:84
T_SharpMinimaxFixedInterior 6 declarations

Establishes the stated upper bound for clamp sq error le.

Formal statement
x t :
ht :
t ∈ Icc (-1 : ℝ) 1
(max (-1) (min 1 x) - t) ^ 2 ≤ (x - t) ^ 2
Proof (Lean source)
lemma clamp_sq_error_le (x t : ℝ) (ht : t ∈ Icc (-1 : ℝ) 1) : (max (-1) (min 1 x) - t) ^ 2 ≤ (x - t) ^ 2 := by rcases ht with ⟨htl, htu⟩ by_cases hxlow : x ≤ -1 · rw [min_eq_right (hxlow.trans (by norm_num : (-1 : ℝ) ≤ 1)), max_eq_left hxlow] nlinarith [sq_nonneg (x - t)] · have hxlow' : -1 ≤ x := le_of_not_ge hxlow rw [max_eq_right (le_min (by norm_num) hxlow')] by_cases hxhigh : x ≤ 1 · rw [min_eq_right hxhigh] · rw [min_eq_left (le_of_not_ge hxhigh)] nlinarith [sq_nonneg (x - t)]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.clamp_sq_error_le · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/T_SharpMinimaxFixedInterior.lean:11
theorem targetHeavy_add_targetLight

Establishes the stated property of target Heavy add target Light in the discrete average-treatment-effect construction.

Formal statement
n d :
P :
sample :
Fin n → Obs d
targetHeavy P sample + targetLight P sample = ateFunctional P
Proof (Lean source)
lemma targetHeavy_add_targetLight {n d : ℕ} (P : DiscreteLaw d) (sample : Fin n → Obs d) : targetHeavy P sample + targetLight P sample = ateFunctional P := by rw [targetHeavy, targetLight, ateFunctional] rw [← Finset.sum_union] · congr 1 rw [lightCells_eq_compl] exact Finset.union_compl _ · rw [Finset.disjoint_left] intro k hkH hkL rw [lightCells_eq_compl] at hkL exact (Finset.mem_compl.mp hkL) hkH
CausalSmith.Stat.DiscreteAteMinimaxLoggap.targetHeavy_add_targetLight · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/T_SharpMinimaxFixedInterior.lean:27
theorem hybrid_mse_le_component_errors

Establishes the stated upper bound for hybrid mse le component errors.

Formal statement
n d :
epsilon :
P :
mu_n :
Measure (Fin n → Obs d)
hclass :
ExperimentClass n epsilon P mu_n
Proof (Lean source)
lemma hybrid_mse_le_component_errors {n d : ℕ} {epsilon : ℝ} (P : DiscreteLaw d) (mu_n : Measure (Fin n → Obs d)) (hclass : ExperimentClass n epsilon P mu_n) : mse mu_n hybridEstimator (ateFunctional P) ≤ 2 * componentErrorMSE mu_n heavyContribution (targetHeavy P) + 2 * componentErrorMSE mu_n lightContribution (targetLight P) := by have hpoint : ∀ sample : Fin n → Obs d, (hybridEstimator sample - ateFunctional P) ^ 2 ≤ 2 * (heavyContribution sample - targetHeavy P sample) ^ 2 + 2 * (lightContribution sample - targetLight P sample) ^ 2 := by intro sample calc (hybridEstimator sample - ateFunctional P) ^ 2 ≤ (heavyContribution sample + lightContribution sample - ateFunctional P) ^ 2 := by exact clamp_sq_error_le _ _ (ateFunctional_mem_interval P hclass.overlap) _ = ((heavyContribution sample - targetHeavy P sample) + (lightContribution sample - targetLight P sample)) ^ 2 := by have ht := targetHeavy_add_targetLight P sample rw [← ht] ring _ ≤ 2 * (heavyContribution sample - targetHeavy P sample) ^ 2 + 2 * (lightContribution sample - targetLight P sample) ^ 2 := by nlinarith [sq_nonneg ((heavyContribution sample - targetHeavy P sample) - (lightContribution sample - targetLight P sample))] rw [hclass.product_law] unfold mse componentErrorMSE calc ∫ sample, (hybridEstimator sample - ateFunctional P) ^ 2 ∂productLaw P n ≤ ∫ sample, (2 * (heavyContribution sample - targetHeavy P sample) ^ 2 + 2 * (lightContribution sample - targetLight P sample) ^ 2) ∂productLaw P n := integral_mono_ae Integrable.of_finite Integrable.of_finite (Filter.Eventually.of_forall hpoint) _ = 2 * ∫ sample, (heavyContribution sample - targetHeavy P sample) ^ 2 ∂productLaw P n + 2 * ∫ sample, (lightContribution sample - targetLight P sample) ^ 2 ∂productLaw P n := by rw [integral_add Integrable.of_finite Integrable.of_finite, integral_const_mul, integral_const_mul]
CausalSmith.Stat.DiscreteAteMinimaxLoggap.hybrid_mse_le_component_errors · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/T_SharpMinimaxFixedInterior.lean:42

Defines canonical Class Law, the stated quantity or construction used in the discrete average-treatment-effect estimator.

Definition (Lean source)
noncomputable def canonicalClassLaw (n d : ℕ) (hd : 0 < d) (epsilon : ℝ) (he0 : 0 < epsilon) (he1 : epsilon < 1 / 2) : ClassLaw n d epsilon := by letI : Nonempty (Fin d) := Fin.pos_iff_nonempty.mp hd let hv := validDGP_null (C := Fin d) (m₀ := (1 / 2 : ℝ)) (g₀ := (1 / 2 : ℝ)) (g₁ := (1 / 2 : ℝ)) (by norm_num) (by norm_num) (by norm_num) (by norm_num) (by norm_num) (by norm_num) let P := endpointParametricLaw hv refine ⟨P, ⟨he0, le_of_lt he1, rfl, ?_⟩⟩ have hhalf := endpointParametricLaw_overlap (d := d) hv intro k hk rcases hhalf k hk with ⟨hl, hu⟩ constructor <;> linarith
CausalSmith.Stat.DiscreteAteMinimaxLoggap.canonicalClassLaw · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/T_SharpMinimaxFixedInterior.lean:81
theorem hybrid_upper_fixed_interior

Certified upper half, separated from the cited lower gate for downstream use.

Formal statement
epsilon :
he0 :
0 < epsilon
he1 :
epsilon < 1 / 2
∃ C_epsilon rho_epsilon : ℝ,
∃ N_epsilon : ℕ,
0 < C_epsilon ∧
0 < rho_epsilon ∧
∀ (n d : ℕ) (P : DiscreteLaw d) (mu_n : Measure (Fin n → Obs d)),
ExperimentClass n epsilon P mu_n → N_epsilon
≤ n → (d : ℝ) ≤ rho_epsilon * n * log n → minimaxRisk n d epsilon ≤ worstCaseMSE n d epsilon hybridEstimator
worstCaseMSE n d epsilon hybridEstimator ≤ C_epsilon * minimaxRate n d
Proof (Lean source)
-- @node: hybrid_upper_fixed_interior lemma hybrid_upper_fixed_interior (epsilon : ℝ) (he0 : 0 < epsilon) (he1 : epsilon < 1 / 2) : ∃ C_epsilon rho_epsilon : ℝ, ∃ N_epsilon : ℕ, 0 < C_epsilon ∧ 0 < rho_epsilon ∧ ∀ (n d : ℕ) (P : DiscreteLaw d) (mu_n : Measure (Fin n → Obs d)), ExperimentClass n epsilon P mu_n → N_epsilon ≤ n → (d : ℝ) ≤ rho_epsilon * n * log n → minimaxRisk n d epsilon ≤ worstCaseMSE n d epsilon hybridEstimator ∧ worstCaseMSE n d epsilon hybridEstimator ≤ C_epsilon * minimaxRate n d := by rcases light_cell_polynomial epsilon he0 (le_of_lt he1) with ⟨_, hlightRate⟩ rcases hlightRate with ⟨CL, ⟨cL, ⟨hCL, ⟨hcL, hlight⟩⟩⟩⟩ rcases universal_heavy_cell_rate epsilon he0 he1 with ⟨CH, cH, NH, hCH, hcH, hheavy⟩ refine ⟨2 * (CL + CH), min cL cH, NH, by positivity, lt_min hcL hcH, ?_⟩ intro n d P mu_n hclass hn hd have hdL : (d : ℝ) ≤ cL * n * log n := hd.trans (by gcongr; exact min_le_left _ _) have hdH : (d : ℝ) ≤ cH * n * log n := hd.trans (by gcongr; exact min_le_right _ _) have hL := hlight n d P mu_n hclass hdL have hH := hheavy n d P mu_n hn hdH hclass have hrate : 0 ≤ minimaxRate n d := by unfold minimaxRate positivity have hLaw : mse mu_n hybridEstimator (ateFunctional P) ≤ (2 * (CL + CH)) * minimaxRate n d := by calc _ ≤ 2 * componentErrorMSE mu_n heavyContribution (targetHeavy P) + 2 * componentErrorMSE mu_n lightContribution (targetLight P) := hybrid_mse_le_component_errors P mu_n hclass _ ≤ 2 * (CH * minimaxRate n d) + 2 * (CL * minimaxRate n d) := by gcongr _ = (2 * (CL + CH)) * minimaxRate n d := by ring constructor · have hmeas : Measurable (@hybridEstimator n d) := measurable_of_finite _ have hb : BddBelow (range (fun est : {f : (Fin n → Obs d) → ℝ // Measurable f} => worstCaseMSE n d epsilon est.1)) := by refine ⟨0, ?_⟩ rintro _ ⟨est, rfl⟩ unfold worstCaseMSE let Q : ClassLaw n d epsilon := ⟨P, ⟨hclass.epsilon_pos, hclass.epsilon_le_half, rfl, hclass.overlap⟩⟩ letI : Nonempty (ClassLaw n d epsilon) := ⟨Q⟩ exact (integral_nonneg (fun x => sq_nonneg (est.1 x - ateFunctional Q.1))).trans (le_ciSup (show BddAbove (range (fun R : ClassLaw n d epsilon => mse (productLaw R.1 n) est.1 (ateFunctional R.1))) from by refine ⟨((∑ sample : Fin n → Obs d, |est.1 sample|) + 1) ^ 2, ?_⟩ rintro _ ⟨R, rfl⟩ exact mse_le_estimator_abs_sum_bound R.1 R.2.overlap est.1) Q) exact ciInf_le hb ⟨hybridEstimator, hmeas⟩ · unfold worstCaseMSE let Q0 : ClassLaw n d epsilon := ⟨P, ⟨hclass.epsilon_pos, hclass.epsilon_le_half, rfl, hclass.overlap⟩⟩ letI : Nonempty (ClassLaw n d epsilon) := ⟨Q0⟩ apply ciSup_le intro Q have hLQ := hlight n d Q.1 (productLaw Q.1 n) Q.2 hdL have hHQ := hheavy n d Q.1 (productLaw Q.1 n) hn hdH Q.2 calc mse (productLaw Q.1 n) hybridEstimator (ateFunctional Q.1) ≤ 2 * componentErrorMSE (productLaw Q.1 n) heavyContribution (targetHeavy Q.1) + 2 * componentErrorMSE (productLaw Q.1 n) lightContribution (targetLight Q.1) := hybrid_mse_le_component_errors Q.1 (productLaw Q.1 n) Q.2 _ ≤ 2 * (CH * minimaxRate n d) + 2 * (CL * minimaxRate n d) := by gcongr _ = (2 * (CL + CH)) * minimaxRate n d := by ring
CausalSmith.Stat.DiscreteAteMinimaxLoggap.hybrid_upper_fixed_interior · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/T_SharpMinimaxFixedInterior.lean:95
theorem sharp_minimax_fixed_interior Theorem 1 in the paper ↗

Matched fixed-interior minimax rate. The lower half is explicitly conditional on the cited ZengOneArmMinimaxLower interface.

Formal statement
epsilon :
hZeng :
he0 :
0 < epsilon
he1 :
epsilon < 1 / 2
∃ a_epsilon rho_epsilon C_epsilon : ℝ,
∃ N_epsilon : ℕ,
0 < a_epsilon ∧
0 < rho_epsilon ∧
0 < C_epsilon ∧
(∀ (n d : ℕ) (P : DiscreteLaw d) (mu_n : Measure (Fin n → Obs d)), ExperimentClass n epsilon P mu_n → 0 < d → N_epsilon ≤ n → (d : ℝ) ≤ rho_epsilon * n * log n → a_epsilon * minimaxRate n d ≤ minimaxRisk n d epsilon ∧ minimaxRisk n d epsilon ≤ worstCaseMSE n d epsilon hybridEstimatorworstCaseMSE n d epsilon hybridEstimator ≤ C_epsilon * minimaxRate n d) ∧
(∀ K : ℝ, 0 < K → ∃ C_K : ℝ, 0 < C_K ∧ ∀ (n d : ℕ) (P : DiscreteLaw d) (mu_n : Measure (Fin n → Obs d)), ExperimentClass n epsilon P mu_n → 0 < d → N_epsilon ≤ n → (d : ℝ) ≤ K * sqrt n * log n → (d : ℝ) ≤ rho_epsilon * n * log n → a_epsilon / n ≤ minimaxRisk n d epsilon ∧ minimaxRisk n d epsilon ≤ C_K / n) ∧
(∀ ns ds : ℕ → ℕ, Tendsto ns atTop atTop → (∀ᶠ j in atTop, 0 < ds j) → (∀ᶠ j in atTop, (ds j : ℝ) ≤ rho_epsilon * ns j * log (ns j)) → (Tendsto (fun j => minimaxRisk (ns j) (ds j) epsilon) atTop (nhds 0) ↔ Tendsto (fun j => (ds j : ℝ) / (ns j * log (ns j))) atTop (nhds 0)))
Proof (Lean source)
theorem sharp_minimax_fixed_interior (epsilon : ℝ) (hZeng : ZengOneArmMinimaxLower epsilon) (he0 : 0 < epsilon) (he1 : epsilon < 1 / 2) : ∃ a_epsilon rho_epsilon C_epsilon : ℝ, ∃ N_epsilon : ℕ, 0 < a_epsilon ∧ 0 < rho_epsilon ∧ 0 < C_epsilon ∧ (∀ (n d : ℕ) (P : DiscreteLaw d) (mu_n : Measure (Fin n → Obs d)), ExperimentClass n epsilon P mu_n → 0 < d → N_epsilon ≤ n → (d : ℝ) ≤ rho_epsilon * n * log n → a_epsilon * minimaxRate n d ≤ minimaxRisk n d epsilon ∧ minimaxRisk n d epsilon ≤ worstCaseMSE n d epsilon hybridEstimatorworstCaseMSE n d epsilon hybridEstimator ≤ C_epsilon * minimaxRate n d) ∧ (∀ K : ℝ, 0 < K → ∃ C_K : ℝ, 0 < C_K ∧ ∀ (n d : ℕ) (P : DiscreteLaw d) (mu_n : Measure (Fin n → Obs d)), ExperimentClass n epsilon P mu_n → 0 < d → N_epsilon ≤ n → (d : ℝ) ≤ K * sqrt n * log n → (d : ℝ) ≤ rho_epsilon * n * log n → a_epsilon / n ≤ minimaxRisk n d epsilon ∧ minimaxRisk n d epsilon ≤ C_K / n) ∧ (∀ ns ds : ℕ → ℕ, Tendsto ns atTop atTop → (∀ᶠ j in atTop, 0 < ds j) → (∀ᶠ j in atTop, (ds j : ℝ) ≤ rho_epsilon * ns j * log (ns j)) → (Tendsto (fun j => minimaxRisk (ns j) (ds j) epsilon) atTop (nhds 0) ↔ Tendsto (fun j => (ds j : ℝ) / (ns j * log (ns j))) atTop (nhds 0))) := by rcases hybrid_upper_fixed_interior epsilon he0 he1 with ⟨CU, rhoU, NU, hCU, hrhoU, hupper⟩ rcases ate_lower_bound_transfer hZeng he0 he1 with ⟨a, rhoL, NL, ha, hrhoL, hlower⟩ let rho := min rhoU rhoL let N := max NU NL refine ⟨a, rho, CU, N, ha, lt_min hrhoU hrhoL, hCU, ?_, ?_, ?_⟩ · intro n d P mu_n hclass hd hn hdRange have hnU : NU ≤ n := (le_max_left _ _).trans hn have hnL : NL ≤ n := (le_max_right _ _).trans hn have hdU : (d : ℝ) ≤ rhoU * n * log n := hdRange.trans (by dsimp [rho]; gcongr; exact min_le_left _ _) have hdL : (d : ℝ) ≤ rhoL * n * log n := hdRange.trans (by dsimp [rho]; gcongr; exact min_le_right _ _) rcases hupper n d P mu_n hclass hnU hdU with ⟨hmin, hU⟩ exact ⟨hlower n d hd hnL hdL, hmin, hU⟩ · intro K hK refine ⟨CU * (1 + K ^ 2), by positivity, ?_⟩ intro n d P mu_n hclass hd hn hdK hdRange have hnpos : 0 < n := by by_contra hn0 have hnz : n = 0 := Nat.eq_zero_of_not_pos hn0 subst n norm_num at hdK omega have hlog : 0 < log (n : ℝ) := by have hdcast : 0 < (d : ℝ) := by exact_mod_cast hd have hfactor : 0 ≤ K * sqrt (n : ℝ) := by positivity by_contra hnot have hnonpos : log (n : ℝ) ≤ 0 := le_of_not_gt hnot have : K * sqrt (n : ℝ) * log (n : ℝ) ≤ 0 := mul_nonpos_of_nonneg_of_nonpos hfactor hnonpos linarith have hsqrt : 0 ≤ sqrt (n : ℝ) := Real.sqrt_nonneg _ have hdcast : 0 ≤ (d : ℝ) := by positivity have hright : 0 ≤ K * sqrt (n : ℝ) * log (n : ℝ) := by positivity have hsq : (d : ℝ) ^ 2 ≤ K ^ 2 * (n : ℝ) * (log (n : ℝ)) ^ 2 := by have := (sq_le_sq₀ hdcast hright).2 hdK rw [mul_pow, mul_pow, Real.sq_sqrt (show 0 ≤ (n : ℝ) by positivity)] at this nlinarith have hratio : d ^ 2 / ((n : ℝ) ^ 2 * (log n) ^ 2) ≤ K ^ 2 / n := by have hnR : (0 : ℝ) < n := by exact_mod_cast hnpos apply (div_le_div_iff₀ (mul_pos (sq_pos_of_pos hnR) (sq_pos_of_pos hlog)) hnR).2 nlinarith [hsq] have hnU : NU ≤ n := (le_max_left _ _).trans hn have hdU : (d : ℝ) ≤ rhoU * n * log n := hdRange.trans (by dsimp [rho]; gcongr; exact min_le_left _ _) rcases hupper n d P mu_n hclass hnU hdU with ⟨hmin, hU⟩ constructor · calc a / n ≤ a * minimaxRate n d := by unfold minimaxRate have : 0 ≤ d ^ 2 / ((n : ℝ) ^ 2 * (log n) ^ 2) := by positivity simpa [div_eq_mul_inv] using mul_le_mul_of_nonneg_left (le_add_of_nonneg_right this) (le_of_lt ha) _ ≤ minimaxRisk n d epsilon := by have hnL : NL ≤ n := (le_max_right _ _).trans hn have hdL : (d : ℝ) ≤ rhoL * n * log n := hdRange.trans (by dsimp [rho]; gcongr; exact min_le_right _ _) exact hlower n d hd hnL hdL · calc minimaxRisk n d epsilon ≤ CU * minimaxRate n d := hmin.trans hU _ ≤ (CU * (1 + K ^ 2)) / n := by unfold minimaxRate have hnR : (0 : ℝ) < n := by exact_mod_cast hnpos calc CU * (1 / (n : ℝ) + d ^ 2 / ((n : ℝ) ^ 2 * log n ^ 2)) ≤ CU * (1 / (n : ℝ) + K ^ 2 / n) := by gcongr _ = (CU * (1 + K ^ 2)) / n := by ring · intro ns ds hns hdsPos hdsRange let q : ℕ → ℝ := fun j => (ds j : ℝ) / (ns j * log (ns j)) have hnsCast : Tendsto (fun j => (ns j : ℝ)) atTop atTop := tendsto_natCast_atTop_atTop.comp hns have hinv : Tendsto (fun j => 1 / (ns j : ℝ)) atTop (nhds 0) := by simpa [one_div, Function.comp_def] using tendsto_inv_atTop_zero.comp hnsCast have hq_nonneg : ∀ᶠ j in atTop, 0 ≤ q j := by filter_upwards [hns (eventually_ge_atTop 2)] with j hj dsimp [q] positivity have hrate_eq : ∀ᶠ j in atTop, minimaxRate (ns j) (ds j) = 1 / (ns j : ℝ) + (q j) ^ 2 := by filter_upwards with j dsimp [q, minimaxRate] ring have hbounds : ∀ᶠ j in atTop, a * minimaxRate (ns j) (ds j) ≤ minimaxRisk (ns j) (ds j) epsilon ∧ minimaxRisk (ns j) (ds j) epsilon ≤ CU * minimaxRate (ns j) (ds j) := by filter_upwards [hdsPos, hdsRange, hns (eventually_ge_atTop N)] with j hdj hrange hn let Pj := canonicalClassLaw (ns j) (ds j) hdj epsilon he0 he1 have hmain := hupper (ns j) (ds j) Pj.1 (productLaw Pj.1 (ns j)) Pj.2 ((le_max_left _ _).trans hn) (hrange.trans (by dsimp [rho]; gcongr; exact min_le_left _ _)) exact ⟨hlower (ns j) (ds j) hdj ((le_max_right _ _).trans hn) (hrange.trans (by dsimp [rho]; gcongr; exact min_le_right _ _)), hmain.1.trans hmain.2⟩ constructor · intro hrisk have hrate : Tendsto (fun j => minimaxRate (ns j) (ds j)) atTop (nhds 0) := by apply squeeze_zero' · filter_upwards with j unfold minimaxRate positivity · filter_upwards [hbounds] with j hj calc minimaxRate (ns j) (ds j) = a⁻¹ * (a * minimaxRate (ns j) (ds j)) := by field_simp _ ≤ a⁻¹ * minimaxRisk (ns j) (ds j) epsilon := mul_le_mul_of_nonneg_left hj.1 (inv_nonneg.mpr (le_of_lt ha)) · simpa using (tendsto_const_nhds.mul hrisk : Tendsto (fun j => a⁻¹ * minimaxRisk (ns j) (ds j) epsilon) atTop (nhds (a⁻¹ * 0))) have hq_sq : Tendsto (fun j => (q j) ^ 2) atTop (nhds 0) := by apply squeeze_zero' · exact Filter.Eventually.of_forall (fun j => sq_nonneg (q j)) · filter_upwards [hrate_eq] with j hj change q j ^ 2 ≤ minimaxRate (ns j) (ds j) rw [hj] exact le_add_of_nonneg_left (by positivity) · exact hrate have hsqrt := (Real.continuous_sqrt.continuousAt.tendsto.comp hq_sq) have hsqrt' : Tendsto (fun j => sqrt ((q j) ^ 2)) atTop (nhds 0) := by simpa [Function.comp_def] using hsqrt apply hsqrt'.congr' filter_upwards [hq_nonneg] with j hj rw [Real.sqrt_sq_eq_abs, abs_of_nonneg hj] · intro hq have hrate : Tendsto (fun j => minimaxRate (ns j) (ds j)) atTop (nhds 0) := by have hadd := hinv.add (hq.pow 2) norm_num at hadd have hsum : Tendsto (fun j => 1 / (ns j : ℝ) + q j ^ 2) atTop (nhds 0) := by simpa [q, one_div] using hadd exact hsum.congr' (Filter.EventuallyEq.symm hrate_eq) apply squeeze_zero' · exact Filter.Eventually.of_forall (fun j => (minimaxRisk_mem_unitInterval _ _ _).1) · filter_upwards [hbounds] with j hj exact hj.2 · simpa using (tendsto_const_nhds.mul hrate : Tendsto (fun j => CU * minimaxRate (ns j) (ds j)) atTop (nhds (CU * 0)))
CausalSmith.Stat.DiscreteAteMinimaxLoggap.sharp_minimax_fixed_interior · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/T_SharpMinimaxFixedInterior.lean:168
T_TwoCategoryConfounding 1 declarations
theorem two_category_confounding

The explicit full-data witness is consistent, conditionally exchangeable and overlapping, has ATE 1/2, and naive observed contrast epsilon.

Formal statement
epsilon :
he0 :
0 < epsilon
he1 :
epsilon ≤ 1 / 2
let Q := twoCategoryWitness epsilon he0.le (he1.trans (by norm_num)) Consistency Q ∧
Overlap epsilon (observedMarginal Q) ∧
Proof (Lean source)
theorem two_category_confounding (epsilon : ℝ) (he0 : 0 < epsilon) (he1 : epsilon ≤ 1 / 2) : let Q := twoCategoryWitness epsilon he0.le (he1.trans (by norm_num)) Consistency Q ∧ ConditionalExchangeability Q ∧ Overlap epsilon (observedMarginal Q) ∧ ateFunctional (observedMarginal Q) = 1 / 2 ∧ naiveContrast (observedMarginal Q) = epsilon := by classical let Q := twoCategoryWitness epsilon he0.le (he1.trans (by norm_num : (1 / 2 : ℝ) ≤ 1)) let P := observedMarginal Q change Consistency Q ∧ ConditionalExchangeability Q ∧ Overlap epsilon P ∧ ateFunctional P = 1 / 2 ∧ naiveContrast P = epsilon have hOverlap : Overlap epsilon P := by simp [P, Q, Finset.sum_filter, Fintype.sum_prod_type, Fin.sum_univ_two, Overlap, observedMarginal, jointMass, cellMass, armMass, propensity, twoCategoryWitness, twoCategoryMass, PMF.ofFintype_apply, finTwoEquiv, he0.le, sub_nonneg.mpr (he1.trans (by norm_num : (1 / 2 : ℝ) ≤ 1))] constructor · intro _ have hden : (2 : ℝ)⁻¹ * epsilon + 2⁻¹ * (1 - epsilon) = 1 / 2 := by ring rw [hden] constructor <;> field_simp <;> nlinarith · intro _ have hden : (2 : ℝ)⁻¹ * (1 - epsilon) + 2⁻¹ * epsilon = 1 / 2 := by ring rw [hden] constructor <;> field_simp <;> nlinarith have hATE : ateFunctional P = 1 / 2 := by rw [ateFunctional_eq_weighted_regression P hOverlap] simp [P, Q, Finset.sum_filter, Fintype.sum_prod_type, Fin.sum_univ_two, observedMarginal, jointMass, cellMass, armMass, outcomeMean, twoCategoryWitness, twoCategoryMass, PMF.ofFintype_apply, finTwoEquiv, he0.le, sub_nonneg.mpr (he1.trans (by norm_num : (1 / 2 : ℝ) ≤ 1))] field_simp ring refine ⟨?_, ?_, hOverlap, hATE, ?_⟩ · simp [Q, Finset.sum_filter, Fintype.sum_prod_type, Fin.sum_univ_two, Consistency, fullMass, twoCategoryWitness, twoCategoryMass, PMF.ofFintype_apply, finTwoEquiv, he0.le] · simp [Q, Finset.sum_filter, Fintype.sum_prod_type, Fin.sum_univ_two, ConditionalExchangeability, poAtom, fullMass, twoCategoryWitness, twoCategoryMass, PMF.ofFintype_apply, finTwoEquiv, he0.le] constructor · constructor <;> ring · constructor <;> ring · simp [P, Q, Finset.sum_filter, Fintype.sum_prod_type, Fin.sum_univ_two, naiveContrast, observedMarginal, jointMass, armMass, twoCategoryWitness, twoCategoryMass, PMF.ofFintype_apply, finTwoEquiv, he0.le, sub_nonneg.mpr (he1.trans (by norm_num : (1 / 2 : ℝ) ≤ 1))] field_simp ring
CausalSmith.Stat.DiscreteAteMinimaxLoggap.two_category_confounding · CausalSmith/Stat/STAT_DiscreteAteMinimaxLoggap_Research/T_TwoCategoryConfounding.lean:10