Formalization: Outcome Annotation and Minimax Risk for Discrete Average Treatment Effects

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. Note: this index was generated at a different commit than the paper's audited pin (db544e5) — statements may have moved since the audit.

CausalSmith.Stat.STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research.Basic 53 declarations This file defines the finite two-sample experiment, its potential-outcome overlay, the observed-data ATE functional, and the two minimax risks used by the annotation-frontier results.

Semi-supervised discrete ATE annotation frontier

This file defines the finite two-sample experiment, its potential-outcome overlay, the observed-data ATE functional, and the two minimax risks used by the annotation-frontier results. The finite PMF presentation is intentional: the Causalean PO and minimax APIs are measure-theoretic and kernel-indexed, whereas this paper needs an explicit finite labeled/auxiliary product law.

One complete record (X,A,Y) on the finite alphabet. the stated conditions the stated conclusion.

Definition (Lean source)
d :
Obs d :
Type
Fin d × Bool × Bool
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.Obs · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Basic.lean:28
def AuxObs

One outcome-unlabeled record (X,A). the stated conditions the stated conclusion.

Definition (Lean source)
d :
AuxObs d :
Type
Fin d × Bool
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.AuxObs · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Basic.lean:34

A law of a complete finite record.

Definition (Lean source)
d :
pmf :
PMF (Obs d)
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.DiscreteLaw · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Basic.lean:37
def obsLaw

The measure associated with a finite observed-data law. the stated conditions the stated conclusion.

Definition (Lean source)
d :
P :
obsLaw P :
Measure (Obs d)
P.pmf.toMeasure
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.obsLaw · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Basic.lean:41
instance instIsProbabilityMeasureObsObsLaw

the stated conditions defines the specified object.

Definition (Lean source)
instance {d : Nat} (P : DiscreteLaw d) : IsProbabilityMeasure (obsLaw P) := by unfold obsLaw infer_instance
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.instIsProbabilityMeasureObsObsLaw · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Basic.lean:44
def jointMass

The probability mass of one complete atom. the stated conditions the stated conclusion.

Definition (Lean source)
d :
P :
x :
Fin d
a y :
jointMass P x a y :
(P.pmf (x, a, y)).toReal
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.jointMass · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Basic.lean:50

The covariate-cell mass P(X=x). the stated conditions the stated conclusion.

Definition (Lean source)
d :
P :
x :
Fin d
cellMass P x :
∑ a : Bool, ∑ y : Bool, jointMass P x a y
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.cellMass · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Basic.lean:55

The treatment-covariate cell mass P(X=x,A=a). the stated conditions the stated conclusion.

Definition (Lean source)
d :
P :
x :
Fin d
a :
armMass P x a :
∑ y : Bool, jointMass P x a y
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.armMass · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Basic.lean:60

The propensity, totalized to zero when P(X=x)=0. the stated conditions the stated conclusion.

Definition (Lean source)
d :
P :
x :
Fin d
propensity P x :
armMass P x true / cellMass P x
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.propensity · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Basic.lean:66

The binary outcome regression, totalized to zero on a null arm-cell. the stated conditions the stated conclusion.

Definition (Lean source)
d :
P :
a :
x :
Fin d
outcomeMean P a x :
jointMass P x a true / armMass P x a
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.outcomeMean · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Basic.lean:71
theorem jointMass_mem_unitInterval

The formal statement establishes the stated conclusion.

Formal statement
d :
P :
x :
Fin d
a y :
jointMass P x a y ∈ Icc (0 : Real) 1
Proof (Lean source)
lemma jointMass_mem_unitInterval {d : Nat} (P : DiscreteLaw d) (x : Fin d) (a y : Bool) : jointMass P x a y ∈ Icc (0 : Real) 1 := by constructor · exact ENNReal.toReal_nonneg · exact ENNReal.toReal_le_coe_of_le_coe (P.pmf.coe_le_one (x, a, y))
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.jointMass_mem_unitInterval · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Basic.lean:78
theorem cellMass_mem_unitInterval

The formal statement establishes the stated conclusion.

Formal statement
d :
P :
x :
Fin d
cellMass P x ∈ Icc (0 : Real) 1
Proof (Lean source)
lemma cellMass_mem_unitInterval {d : Nat} (P : DiscreteLaw d) (x : Fin d) : cellMass P x ∈ Icc (0 : Real) 1 := by have hsum : ∑ z : Obs d, (P.pmf z).toReal = 1 := by simpa using (PMF.integral_eq_sum P.pmf (fun _ : Obs d => (1 : Real))).symm constructor · exact Finset.sum_nonneg fun a _ => Finset.sum_nonneg fun y _ => (jointMass_mem_unitInterval P x a y).1 · calc cellMass P x ≤ ∑ x' : Fin d, cellMass P x' := by exact Finset.single_le_sum (fun i _ => Finset.sum_nonneg fun a _ => Finset.sum_nonneg fun y _ => (jointMass_mem_unitInterval P i a y).1) (Finset.mem_univ x) _ = ∑ z : Obs d, (P.pmf z).toReal := by simp [cellMass, jointMass, Fintype.sum_prod_type] _ = 1 := hsum
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.cellMass_mem_unitInterval · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Basic.lean:86
theorem outcomeMean_mem_unitInterval

The formal statement establishes the stated conclusion.

Formal statement
d :
P :
a :
x :
Fin d
outcomeMean P a x ∈ Icc (0 : Real) 1
Proof (Lean source)
lemma outcomeMean_mem_unitInterval {d : Nat} (P : DiscreteLaw d) (a : Bool) (x : Fin d) : outcomeMean P a x ∈ Icc (0 : Real) 1 := by have hj_nonneg : 0 ≤ jointMass P x a true := (jointMass_mem_unitInterval P x a true).1 have harm_nonneg : 0 ≤ armMass P x a := by exact Finset.sum_nonneg fun y _ => (jointMass_mem_unitInterval P x a y).1 have hj_le : jointMass P x a true ≤ armMass P x a := by simp [armMass] exact (jointMass_mem_unitInterval P x a false).1 constructor · exact div_nonneg hj_nonneg harm_nonneg · exact div_le_one_of_le₀ hj_le harm_nonneg
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.outcomeMean_mem_unitInterval · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Basic.lean:105

The outcome-marked cell mass P(X=x,A=a,Y=1). the stated conditions the stated conclusion.

Definition (Lean source)
d :
P :
x :
Fin d
a :
markedMass P x a :
jointMass P x a true
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.markedMass · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Basic.lean:119

The treatment-covariate marginal PMF. the stated conditions the stated conclusion.

Definition (Lean source)
d :
P :
auxMarginal P :
P.pmf.map (fun z => (z.1, z.2.1))
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.auxMarginal · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Basic.lean:126
def labeledProductLaw

The canonical labeled product law. the stated conditions the stated conclusion.

Definition (Lean source)
d :
P :
n :
labeledProductLaw P n :
Measure (Fin n → Obs d)
Measure.pi (fun _ : Fin n => obsLaw P)
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.labeledProductLaw · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Basic.lean:131
def auxProductLaw

The canonical auxiliary product law. the stated conditions the stated conclusion.

Definition (Lean source)
d :
P :
m :
auxProductLaw P m :
Measure (Fin m → AuxObs d)
Measure.pi (fun _ : Fin m => (auxMarginal P).toMeasure)
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.auxProductLaw · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Basic.lean:137

The joint sample space. the stated conditions the stated conclusion.

Definition (Lean source)
n m d :
Sample n m d :
Type
(Fin n → Obs d) × (Fin m → AuxObs d)
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.Sample · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Basic.lean:143
def Overlap

Positive-mass cells have propensity in the fixed overlap band. the stated conditions the stated conclusion.

Definition (Lean source)
d :
eps :
P :
x :
0 < cellMass P x
Overlap eps P :
Prop
clause 1
eps ≤ propensity P x
clause 2
propensity P x ≤ 1 - eps
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.Overlap · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Basic.lean:158
def LabeledIid

The supplied labeled sample law is the iid product generated by P. the stated conditions the stated conclusion.

Definition (Lean source)
d :
P :
n :
mu :
Measure (Fin n → Obs d)
LabeledIid P n mu :
Prop
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.LabeledIid · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Basic.lean:166
def AuxiliaryIid

The supplied auxiliary law is iid from the same population's (X,A) marginal. the stated conditions the stated conclusion.

Definition (Lean source)
d :
P :
m :
nu :
Measure (Fin m → AuxObs d)
AuxiliaryIid P m nu :
Prop
nu = auxProductLaw P m
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.AuxiliaryIid · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Basic.lean:172
def SampleIndependence

The supplied joint probability law factorizes into its labeled and auxiliary marginals. the stated conditions the stated conclusion.

Definition (Lean source)
n m d :
mu :
Measure (Sample n m d)
SampleIndependence mu :
Prop
clause 2
mu = (mu.map fst).prod (mu.map snd)
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.SampleIndependence · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Basic.lean:178

The canonical independent annotation law. the stated conditions the stated conclusion.

Definition (Lean source)
d :
P :
n m :
annotationLaw P n m :
Measure (Sample n m d)
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.annotationLaw · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Basic.lean:183
def FullObs

Full-data atom (X,A,Y,Y(0),Y(1)). the stated conditions the stated conclusion.

Definition (Lean source)
d :
FullObs d :
Type
Fin d × Bool × Bool × Bool × Bool
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.FullObs · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Basic.lean:188
structure PotentialLaw

A finite potential-outcome law.

Definition (Lean source)
d :
pmf :
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.PotentialLaw · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Basic.lean:194
def fullMass

The mass of a full-data atom. the stated conditions the stated conclusion.

Definition (Lean source)
d :
Q :
z :
fullMass Q z :
(Q.pmf z).toReal
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.fullMass · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Basic.lean:198

Consistency: atoms violating Y=Y(A) have zero mass. the stated conditions the stated conclusion.

Definition (Lean source)
d :
Q :
z :
z.2.2.1 ≠ (if z.2.1 then z.2.2.2.2 else z.2.2.2.1)
Consistency Q :
Prop
fullMass Q z = 0
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.Consistency · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Basic.lean:203
def poAtom

The (X,A,Y(0),Y(1)) atom mass after summing out observed Y. the stated conditions the stated conclusion.

Definition (Lean source)
d :
Q :
x :
Fin d
a y0 y1 :
poAtom Q x a y0 y1 :
∑ y : Bool, fullMass Q (x, a, y, y0, y1)
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.poAtom · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Basic.lean:210
def ConditionalExchangeability Assumption 6 in the paper ↗

The finite cross-multiplied form of (Y(0),Y(1)) independent of A given X. the stated conditions the stated conclusion.

Definition (Lean source)
d :
Q :
x a y0 y1 :
ConditionalExchangeability Q :
Prop
poAtom Q x a y0 y1 * (∑ a' : Bool, ∑ y0' : Bool, ∑ y1' : Bool, poAtom Q x a' y0' y1')
= (∑ a' : Bool, poAtom Q x a' y0 y1) * (∑ y0' : Bool, ∑ y1' : Bool, poAtom Q x a y0' y1')
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.ConditionalExchangeability · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Basic.lean:216
def observedMarginal

The observed (X,A,Y) marginal of a potential-outcome law. the stated conditions the stated conclusion.

Definition (Lean source)
d :
Q :
observedMarginal Q :
⟨Q.pmf.map (fun z => (z.1, z.2.1, z.2.2.1))⟩
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.observedMarginal · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Basic.lean:227
structure ModelClass

Membership in the unrestricted finite law class includes the paper's full parameter domain.

Definition (Lean source)
d :
eps :
P :
alphabet :
2 ≤ d
eps_pos :
0 < eps
eps_lt_half :
eps < 1 / 2
overlap :
Overlap eps P
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.ModelClass · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Basic.lean:232

A law bundled with membership in the overlap class. the stated conditions the stated conclusion.

Definition (Lean source)
d :
eps :
ClassLaw d eps :
Type
{P : DiscreteLaw d // ModelClass d eps P}
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.ClassLaw · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Basic.lean:240
def ateFunctional

The observed-data ATE functional sum_x p_x (mu_1x-mu_0x). the stated conditions the stated conclusion.

Definition (Lean source)
d :
P :
ateFunctional P :
∑ x : Fin d, cellMass P x * (outcomeMean P true x - outcomeMean P false x)
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.ateFunctional · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Basic.lean:244
theorem ateFunctional_mem_Icc_neg_one_one

Under overlap the ATE functional is in [-1,1]. the stated conditions the stated conclusion.

Formal statement
d :
eps :
P :
hP :
Overlap eps P
ateFunctional P ∈ Icc (-1 : Real) 1
Proof (Lean source)
lemma ateFunctional_mem_Icc_neg_one_one {d : Nat} {eps : Real} (P : DiscreteLaw d) (hP : Overlap eps P) : ateFunctional P ∈ Icc (-1 : Real) 1 := by have hsum : ∑ x : Fin d, cellMass P x = 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 : Real))).symm calc ∑ x : Fin d, cellMass P x = ∑ z : Obs d, (P.pmf z).toReal := by simp [cellMass, jointMass, Fintype.sum_prod_type] _ = 1 := htotal have habs : |ateFunctional P| ≤ 1 := by rw [ateFunctional] calc |∑ x : Fin d, cellMass P x * (outcomeMean P true x - outcomeMean P false x)| ≤ ∑ x : Fin d, |cellMass P x * (outcomeMean P true x - outcomeMean P false x)| := Finset.abs_sum_le_sum_abs _ _ _ ≤ ∑ x : Fin d, cellMass P x := by apply Finset.sum_le_sum intro x _ have hp := cellMass_mem_unitInterval P x have hm1 := outcomeMean_mem_unitInterval P true x have hm0 := outcomeMean_mem_unitInterval P false x rcases hm1 with ⟨hm1lo, hm1hi⟩ rcases hm0 with ⟨hm0lo, hm0hi⟩ rw [abs_mul, abs_of_nonneg hp.1] apply mul_le_of_le_one_right hp.1 rw [abs_le] constructor <;> linarith _ = 1 := hsum exact abs_le.mp habs
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.ateFunctional_mem_Icc_neg_one_one · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Basic.lean:249
theorem observedMarginal_jointMass Lemma observedMarginal_jointMass in the paper ↗

The formal statement establishes the stated conclusion.

Formal statement
d :
Q :
x :
Fin d
a y :
jointMass (observedMarginal Q) x a y
= ∑ y0 : Bool, ∑ y1 : Bool, fullMass Q (x, a, y, y0, y1)
Proof (Lean source)
lemma observedMarginal_jointMass {d : Nat} (Q : PotentialLaw d) (x : Fin d) (a y : Bool) : jointMass (observedMarginal Q) x a y = ∑ y0 : Bool, ∑ y1 : Bool, fullMass Q (x, a, y, y0, y1) := by classical unfold jointMass observedMarginal fullMass rw [PMF.map_apply, tsum_fintype] cases a <;> cases y <;> simp only [Fintype.sum_prod_type] <;> simp all_goals rw [ENNReal.toReal_add (ENNReal.add_ne_top.mpr ⟨Q.pmf.apply_ne_top _, Q.pmf.apply_ne_top _⟩) (ENNReal.add_ne_top.mpr ⟨Q.pmf.apply_ne_top _, Q.pmf.apply_ne_top _⟩), ENNReal.toReal_add (PMF.apply_ne_top _ _) (PMF.apply_ne_top _ _), ENNReal.toReal_add (PMF.apply_ne_top _ _) (PMF.apply_ne_top _ _)]
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.observedMarginal_jointMass · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Basic.lean:284
theorem ateFunctional_observedMarginal_eq_po_contrast

Consistency, exchangeability and overlap identify the observed functional. the stated conditions establishes the stated conclusion.

Formal statement
d :
eps :
Q :
heps :
0 < eps
hCons :
Consistency Q
hOv :
= ∑ z : FullObs d, fullMass Q z * ((if z.2.2.2.2 then (1 : Real) else 0) - (if z.2.2.2.1 then (1 : Real) else 0))
Proof (Lean source)
-- @node: ateFunctional_observedMarginal_eq_po_contrast lemma ateFunctional_observedMarginal_eq_po_contrast {d : Nat} {eps : Real} (Q : PotentialLaw d) (heps : 0 < eps) (hCons : Consistency Q) (hExch : ConditionalExchangeability Q) (hOv : Overlap eps (observedMarginal Q)) : ateFunctional (observedMarginal Q) = ∑ z : FullObs d, fullMass Q z * ((if z.2.2.2.2 then (1 : Real) else 0) - (if z.2.2.2.1 then (1 : Real) else 0)) := by classical rw [ateFunctional] simp only [Fintype.sum_prod_type] apply Finset.sum_congr rfl intro x _ have hc_tf (y0 : Bool) : fullMass Q (x, true, false, y0, true) = 0 := hCons _ (by simp) have hc_tt (y0 : Bool) : fullMass Q (x, true, true, y0, false) = 0 := hCons _ (by simp) have hc_ff (y1 : Bool) : fullMass Q (x, false, false, true, y1) = 0 := hCons _ (by simp) have hc_ft (y1 : Bool) : fullMass Q (x, false, true, false, y1) = 0 := hCons _ (by simp) have hcellarm : cellMass (observedMarginal Q) x = armMass (observedMarginal Q) x false + armMass (observedMarginal Q) x true := by simp [cellMass, armMass, Fintype.sum_bool] ring by_cases hcx : cellMass (observedMarginal Q) x = 0 · have htotal : (∑ a : Bool, ∑ y0 : Bool, ∑ y1 : Bool, fullMass Q (x, a, (if a then y1 else y0), y0, y1)) = 0 := by rw [← hcx] simp only [cellMass, armMass, observedMarginal_jointMass, Fintype.sum_bool] simp [hc_tf, hc_tt, hc_ff, hc_ft] ring have hn (a y y0 y1 : Bool) : 0 ≤ fullMass Q (x, a, y, y0, y1) := ENNReal.toReal_nonneg simp only [cellMass, outcomeMean, armMass, observedMarginal_jointMass, Fintype.sum_bool] simp [hc_tf, hc_tt, hc_ff, hc_ft] simp only [Fintype.sum_bool] at htotal simp at htotal have h00 := hn false false false false have h01 := hn false false false true have h10 := hn false true true false have h11 := hn false true true true have ht00 := hn true false false false have ht01 := hn true true false true have ht10 := hn true false true false have ht11 := hn true true true true have hz00 : fullMass Q (x, false, false, false, false) = 0 := by nlinarith [htotal] have hz01 : fullMass Q (x, false, false, false, true) = 0 := by nlinarith [htotal] have hz10 : fullMass Q (x, false, true, true, false) = 0 := by nlinarith [htotal] have hz11 : fullMass Q (x, false, true, true, true) = 0 := by nlinarith [htotal] have hzt00 : fullMass Q (x, true, false, false, false) = 0 := by nlinarith [htotal] have hzt01 : fullMass Q (x, true, true, false, true) = 0 := by nlinarith [htotal] have hzt10 : fullMass Q (x, true, false, true, false) = 0 := by nlinarith [htotal] have hzt11 : fullMass Q (x, true, true, true, true) = 0 := by nlinarith [htotal] simp [hz00, hz01, hz10, hz11, hzt00, hzt01, hzt10, hzt11] · have hcxpos : 0 < cellMass (observedMarginal Q) x := lt_of_le_of_ne (cellMass_mem_unitInterval _ _).1 (Ne.symm hcx) have hprop := hOv x hcxpos have htpos : 0 < armMass (observedMarginal Q) x true := by have hr : 0 < propensity (observedMarginal Q) x := lt_of_lt_of_le heps hprop.1 rw [propensity] at hr rcases (div_pos_iff.mp hr) with h | h · exact h.1 · linarith have hfpos : 0 < armMass (observedMarginal Q) x false := by have hr : propensity (observedMarginal Q) x < 1 := lt_of_le_of_lt hprop.2 (by linarith) rw [propensity, div_lt_one hcxpos] at hr linarith [hcellarm] have he_t0 := hExch x true false true have he_t1 := hExch x true true true have he_f0 := hExch x false true false have he_f1 := hExch x false true true simp only [poAtom, Fintype.sum_bool] at he_t0 he_t1 he_f0 he_f1 simp [hc_tf, hc_tt, hc_ff, hc_ft] at he_t0 he_t1 he_f0 he_f1 have htne : fullMass Q (x, true, true, true, true) + fullMass Q (x, true, true, false, true) + (fullMass Q (x, true, false, true, false) + fullMass Q (x, true, false, false, false)) ≠ 0 := by simpa [armMass, observedMarginal_jointMass, Fintype.sum_bool, hc_tf, hc_tt] using ne_of_gt htpos have hfne : fullMass Q (x, false, true, true, true) + fullMass Q (x, false, true, true, false) + (fullMass Q (x, false, false, false, true) + fullMass Q (x, false, false, false, false)) ≠ 0 := by simpa [armMass, observedMarginal_jointMass, Fintype.sum_bool, hc_ff, hc_ft] using ne_of_gt hfpos simp only [cellMass, outcomeMean, armMass, observedMarginal_jointMass, Fintype.sum_bool] simp [hc_tf, hc_tt, hc_ff, hc_ft] field_simp [htne, hfne] linear_combination (fullMass Q (x, false, true, true, true) + fullMass Q (x, false, true, true, false) + (fullMass Q (x, false, false, false, true) + fullMass Q (x, false, false, false, false))) * (he_t0 + he_t1) - (fullMass Q (x, true, true, true, true) + fullMass Q (x, true, false, true, false) + (fullMass Q (x, true, true, false, true) + fullMass Q (x, true, false, false, false))) * (he_f0 + he_f1)
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.ateFunctional_observedMarginal_eq_po_contrast · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Basic.lean:302
def annotationExperiment

Laws in the two-sample experiment, with all three sampling atoms explicit. the stated conditions the stated conclusion.

Definition (Lean source)
n m d :
eps :
annotationExperiment n m d eps :
Set (Measure (Sample n m d))
{mu | 1 ≤ n ∧ 2 ≤ d ∧ ∃ P : DiscreteLaw d, ModelClass d eps P ∧ LabeledIid P n (mu.map fst) ∧ AuxiliaryIid P m (mu.map snd) ∧ SampleIndependence mu}
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.annotationExperiment · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Basic.lean:409
theorem annotationLaw_mem_annotationExperiment

The canonical product law belongs to the annotation experiment. the stated conditions establishes the stated conclusion.

Formal statement
n m d :
eps :
P :
hn :
1 ≤ n
hP :
ModelClass d eps P
Proof (Lean source)
-- keep: canonical law membership certificate explicitly promised by the F1 plan and public experiment API lemma annotationLaw_mem_annotationExperiment {n m d : Nat} {eps : Real} (P : DiscreteLaw d) (hn : 1 ≤ n) (hP : ModelClass d eps P) : annotationLaw P n m ∈ annotationExperiment n m d eps := by letI : IsProbabilityMeasure (labeledProductLaw P n) := by unfold labeledProductLaw infer_instance letI : IsProbabilityMeasure (auxProductLaw P m) := by unfold auxProductLaw infer_instance refine ⟨hn, hP.alphabet, P, hP, ?_, ?_, ?_⟩ · unfold LabeledIid annotationLaw simp · unfold AuxiliaryIid annotationLaw simp · constructor · unfold annotationLaw infer_instance · unfold annotationLaw simp
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.annotationLaw_mem_annotationExperiment · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Basic.lean:419

Mean squared error under a supplied two-sample law. the stated conditions the stated conclusion.

Definition (Lean source)
n m d :
mu :
Measure (Sample n m d)
est :
Sample n m d → Real
target :
twoSampleMSE mu est target :
∫ z, (est z - target) ^ 2 ∂mu
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.twoSampleMSE · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Basic.lean:441

Infimum measurable-estimator, supremum overlap-law MSE in the canonical annotation experiment. the stated conditions the stated conclusion.

Definition (Lean source)
n m d :
eps :
minimaxRisk n m d eps :
⨅ est : {f : Sample n m d → Real // Measurable f}, ⨆ P : ClassLaw d eps, twoSampleMSE (annotationLaw P.1 n m) est.1 (ateFunctional P.1)
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.minimaxRisk · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Basic.lean:447
theorem minimaxRisk_mem_Icc_zero_one

The canonical minimax risk has the paper's stated range. the stated conclusion.

Formal statement
n m d :
eps :
minimaxRisk n m d eps ∈ Icc (0 : Real) 1
Proof (Lean source)
lemma minimaxRisk_mem_Icc_zero_one (n m d : Nat) (eps : Real) : minimaxRisk n m d eps ∈ Icc (0 : Real) 1 := by have hnonneg (est : {f : Sample n m d → Real // Measurable f}) : 0 ≤ ⨆ P : ClassLaw d eps, twoSampleMSE (annotationLaw P.1 n m) est.1 (ateFunctional P.1) := by cases isEmpty_or_nonempty (ClassLaw d eps) with | inl hempty => letI := hempty simp | inr hnonempty => letI := hnonempty by_cases hbounded : BddAbove (range (fun P : ClassLaw d eps => twoSampleMSE (annotationLaw P.1 n m) est.1 (ateFunctional P.1))) · have hmse : 0 ≤ twoSampleMSE (annotationLaw (Classical.arbitrary (ClassLaw d eps)).1 n m) est.1 (ateFunctional (Classical.arbitrary (ClassLaw d eps)).1) := by exact integral_nonneg (fun z => sq_nonneg (est.1 z - ateFunctional (Classical.arbitrary (ClassLaw d eps)).1)) exact hmse.trans (le_ciSup hbounded (Classical.arbitrary _)) · rw [show (⨆ P : ClassLaw d eps, twoSampleMSE (annotationLaw P.1 n m) est.1 (ateFunctional P.1)) = sSup ∅ from csSup_of_not_bddAbove hbounded] simp have hb : BddBelow (range (fun est : {f : Sample n m d → Real // Measurable f} => ⨆ P : ClassLaw d eps, twoSampleMSE (annotationLaw P.1 n m) est.1 (ateFunctional P.1))) := by refine ⟨0, ?_⟩ rintro _ ⟨est, rfl⟩ exact hnonneg est letI : Nonempty {f : Sample n m d → Real // Measurable f} := ⟨⟨fun _ => 0, measurable_const⟩⟩ constructor · apply le_ciInf exact hnonneg · have hzero : Measurable (fun _ : Sample n m d => (0 : Real)) := measurable_const refine (ciInf_le hb ⟨fun _ => 0, hzero⟩).trans ?_ cases isEmpty_or_nonempty (ClassLaw d eps) with | inl hempty => letI := hempty simp | inr hnonempty => letI := hnonempty apply ciSup_le intro P have ht := ateFunctional_mem_Icc_neg_one_one P.1 P.2.overlap have hs : ateFunctional P.1 ^ 2 ≤ 1 := (sq_le_one_iff_abs_le_one (ateFunctional P.1)).2 (abs_le.mpr ht) letI : IsProbabilityMeasure (annotationLaw P.1 n m) := by unfold annotationLaw labeledProductLaw auxProductLaw infer_instance simpa [twoSampleMSE] using hs
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.minimaxRisk_mem_Icc_zero_one · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Basic.lean:454
def logEN

The logarithmic scale log(e n). the stated conditions the stated conclusion.

Definition (Lean source)
n :
logEN n :
log (exp 1 * n)
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.logEN · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Basic.lean:508

The explicit unequal-information annotation-frontier rate. the stated conditions the stated conclusion.

Definition (Lean source)
n m d :
frontierRate n m d :
min 1 (1 / (n : Real) + (d : Real) ^ 2 / (((n + m : Nat) : Real) ^ 2 * logEN n ^ 2))
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.frontierRate · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Basic.lean:512
theorem frontierRate_mem_Ioc_zero_one

the stated conditions establishes the stated conclusion.

Formal statement
n m d :
hn :
1 ≤ n
frontierRate n m d ∈ Ioc (0 : Real) 1
Proof (Lean source)
lemma frontierRate_mem_Ioc_zero_one (n m d : Nat) (hn : 1 ≤ n) : frontierRate n m d ∈ Ioc (0 : Real) 1 := by have hnpos : (0 : Real) < n := by exact_mod_cast (lt_of_lt_of_le Nat.zero_lt_one hn) constructor · rw [frontierRate] apply lt_min (by norm_num) have hdim : 0 ≤ (d : Real) ^ 2 / (((n + m : Nat) : Real) ^ 2 * logEN n ^ 2) := by positivity exact lt_of_lt_of_le (one_div_pos.mpr hnpos) (le_add_of_nonneg_right hdim) · exact min_le_left _ _
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.frontierRate_mem_Ioc_zero_one · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Basic.lean:518
theorem inv_n_le_frontierRate

the stated conditions establishes the stated conclusion.

Formal statement
n m d :
hn :
1 ≤ n
1 / (n : Real) ≤ frontierRate n m d
Proof (Lean source)
lemma inv_n_le_frontierRate (n m d : Nat) (hn : 1 ≤ n) : 1 / (n : Real) ≤ frontierRate n m d := by have hnpos : (0 : Real) < n := by exact_mod_cast (lt_of_lt_of_le Nat.zero_lt_one hn) rw [frontierRate] apply le_min · rw [div_le_iff₀ hnpos] have hnreal : (1 : Real) ≤ n := by exact_mod_cast hn simpa using hnreal · exact le_add_of_nonneg_right (by positivity)
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.inv_n_le_frontierRate · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Basic.lean:530
def AuxTable

The exact treatment-covariate probability table. the stated conditions the stated conclusion.

Definition (Lean source)
d :
AuxTable d :
Type
AuxObs d → Real
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.AuxTable · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Basic.lean:542
def KnownSample

The known-marginal observation space. the stated conditions the stated conclusion.

Definition (Lean source)
n d :
KnownSample n d :
Type
(Fin n → Obs d) × AuxTable d
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.KnownSample · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Basic.lean:546
def auxTableOf

The exact table associated with P. the stated conditions the stated conclusion.

Definition (Lean source)
d :
P :
auxTableOf P :
fun z => armMass P z.1 z.2
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.auxTableOf · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Basic.lean:549
def knownMarginalExperiment

The benchmark experiment supplying labeled data and the exact (X,A) table. the stated conditions the stated conclusion.

Definition (Lean source)
n d :
eps :
knownMarginalExperiment n d eps :
Set (Measure (Fin n → Obs d) × AuxTable d)
{q | 1 ≤ n ∧ 2 ≤ d ∧ ∃ P : DiscreteLaw d, ModelClass d eps P ∧ LabeledIid P n q.1 ∧ q.2 = auxTableOf P}
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.knownMarginalExperiment · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Basic.lean:557
def clipAte

Projection of a real decision into the target's known range [-1,1]. the stated conditions the stated conclusion.

Definition (Lean source)
z :
clipAte z :
max (-1) (min 1 z)
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.clipAte · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Basic.lean:564
theorem exists_clipped_knownMarginalEstimator

Clipping any measurable known-marginal estimator is measurable, remains in [-1,1], and cannot increase squared loss against any legal ATE target. the stated conditions the stated conclusion.

Formal statement
n d :
est :
hest :
∃ clipped : {f : KnownSample n d → Real // Measurable f ∧ ∀ z, f z ∈ Icc (-1 : Real) 1},
∀ z (target : Real),
target ∈ Icc (-1 : Real) 1 → (clipped.1 z - target) ^ 2 ≤ (est z - target) ^ 2
Proof (Lean source)
lemma exists_clipped_knownMarginalEstimator (n d : Nat) (est : KnownSample n d → Real) (hest : Measurable est) : ∃ clipped : {f : KnownSample n d → Real // Measurable f ∧ ∀ z, f z ∈ Icc (-1 : Real) 1}, ∀ z (target : Real), target ∈ Icc (-1 : Real) 1 → (clipped.1 z - target) ^ 2 ≤ (est z - target) ^ 2 := by let hbounds : (-1 : Real) ≤ 1 := by norm_num let clipped : KnownSample n d → Real := fun z => clipAte (est z) have hclipped_measurable : Measurable clipped := by dsimp [clipped, clipAte] fun_prop have hclipped_mem : ∀ z, clipped z ∈ Icc (-1 : Real) 1 := by intro z exact (projIcc (-1 : Real) 1 hbounds (est z)).property refine ⟨⟨clipped, hclipped_measurable, hclipped_mem⟩, ?_⟩ intro z target htarget have habs : |clipped z - target| ≤ |est z - target| := by simpa [clipped, clipAte, Set.coe_projIcc, Set.projIcc_of_mem hbounds htarget] using (Set.abs_projIcc_sub_projIcc (a := (-1 : Real)) (b := 1) (c := est z) (d := target) hbounds) exact sq_le_sq.mpr habs
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.exists_clipped_knownMarginalEstimator · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Basic.lean:567
def knownMarginalRisk Definition 15 in the paper ↗

Minimax MSE when the exact treatment-covariate table is supplied. the stated conditions the stated conclusion.

Definition (Lean source)
n d :
eps :
knownMarginalRisk n d eps :
⨅ est : {f : KnownSample n d → Real // Measurable f ∧ ∀ z, f z ∈ Icc (-1 : Real) 1}, ⨆ P : ClassLaw d eps, ∫ x, (est.1 (x, auxTableOf P.1) - ateFunctional P.1) ^ 2 ∂(labeledProductLaw P.1 n)
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.knownMarginalRisk · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Basic.lean:593
theorem knownMarginalRisk_mem_Icc_zero_one

The formal statement establishes the stated conclusion.

Formal statement
n d :
eps :
knownMarginalRisk n d eps ∈ Icc (0 : Real) 1
Proof (Lean source)
lemma knownMarginalRisk_mem_Icc_zero_one (n d : Nat) (eps : Real) : knownMarginalRisk n d eps ∈ Icc (0 : Real) 1 := by have hnonneg (est : {f : KnownSample n d → Real // Measurable f ∧ ∀ z, f z ∈ Icc (-1 : Real) 1}) : 0 ≤ ⨆ P : ClassLaw d eps, ∫ x, (est.1 (x, auxTableOf P.1) - ateFunctional P.1) ^ 2 ∂(labeledProductLaw P.1 n) := by cases isEmpty_or_nonempty (ClassLaw d eps) with | inl hempty => letI := hempty simp | inr hnonempty => letI := hnonempty by_cases hbounded : BddAbove (range (fun P : ClassLaw d eps => ∫ x, (est.1 (x, auxTableOf P.1) - ateFunctional P.1) ^ 2 ∂(labeledProductLaw P.1 n))) · have hint : 0 ≤ ∫ x, (est.1 (x, auxTableOf (Classical.arbitrary (ClassLaw d eps)).1) - ateFunctional (Classical.arbitrary (ClassLaw d eps)).1) ^ 2 ∂(labeledProductLaw (Classical.arbitrary (ClassLaw d eps)).1 n) := integral_nonneg (fun x => sq_nonneg _) exact hint.trans (le_ciSup hbounded (Classical.arbitrary _)) · rw [show (⨆ P : ClassLaw d eps, ∫ x, (est.1 (x, auxTableOf P.1) - ateFunctional P.1) ^ 2 ∂(labeledProductLaw P.1 n)) = sSup ∅ from csSup_of_not_bddAbove hbounded] simp have hb : BddBelow (range (fun est : {f : KnownSample n d → Real // Measurable f ∧ ∀ z, f z ∈ Icc (-1 : Real) 1} => ⨆ P : ClassLaw d eps, ∫ x, (est.1 (x, auxTableOf P.1) - ateFunctional P.1) ^ 2 ∂(labeledProductLaw P.1 n))) := by refine ⟨0, ?_⟩ rintro _ ⟨est, rfl⟩ exact hnonneg est let zeroEst : {f : KnownSample n d → Real // Measurable f ∧ ∀ z, f z ∈ Icc (-1 : Real) 1} := ⟨fun _ => 0, measurable_const, by intro z; norm_num⟩ letI : Nonempty {f : KnownSample n d → Real // Measurable f ∧ ∀ z, f z ∈ Icc (-1 : Real) 1} := ⟨zeroEst⟩ constructor · apply le_ciInf exact hnonneg · refine (ciInf_le hb zeroEst).trans ?_ cases isEmpty_or_nonempty (ClassLaw d eps) with | inl hempty => letI := hempty simp | inr hnonempty => letI := hnonempty apply ciSup_le intro P have ht := ateFunctional_mem_Icc_neg_one_one P.1 P.2.overlap have hs : ateFunctional P.1 ^ 2 ≤ 1 := (sq_le_one_iff_abs_le_one (ateFunctional P.1)).2 (abs_le.mpr ht) letI : IsProbabilityMeasure (labeledProductLaw P.1 n) := by unfold labeledProductLaw infer_instance simpa [zeroEst] using hs
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.knownMarginalRisk_mem_Icc_zero_one · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Basic.lean:604
CausalSmith.Stat.STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research.Helpers.AlternationDuality 2 declarations Finite alternation duality for the rational target p/(p+a).

Finite alternation duality for the rational target p/(p+a).

structure FiniteMomentDual

A finitely supported signed measure, presented by its nodes and signed weights.

Definition (Lean source)
L :
lo hi a c :
node :
Fin (L + 2) → Real
node_injective :
weight :
Fin (L + 2) → Real
support :
∀ i, node i ∈ Icc lo hi
totalVariation :
(∑ i, |weight i|) = 1
moments :
∀ j : Nat
if
j ≤ L
then
∑ i, weight i * node i ^ j = 0
gap :
c ≤ ∑ i, weight i * (node i / (node i + a))
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.FiniteMomentDual · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/AlternationDuality.lean:20
theorem finite_alternation_duality Lemma 17 in the paper ↗

Positive constants depending only on overlap yield a normalized finite signed measure with vanishing moments through degree L and a uniform rational gap. the stated conditions the stated conclusion.

Formal statement
eps :
heps :
0 < eps
heps2 :
eps < 1 / 2
∃ gamma c : Real,
0 < gamma
0 < c
conclusion 1
L :
2 ≤ L
B :
0 < B
kappa :
(1 - 2 * eps) / eps
a :
gamma * B / (L : Real) ^ 2
a / kappa ≤ B
Nonempty (FiniteMomentDual L (a / kappa) B a c)
Proof (Lean source)
lemma finite_alternation_duality {eps : Real} (heps : 0 < eps) (heps2 : eps < 1 / 2) : ∃ gamma c : Real, 0 < gamma ∧ 0 < c ∧ ∀ (L : Nat), 2 ≤ L → ∀ B : Real, 0 < B → let kappa := (1 - 2 * eps) / eps let a := gamma * B / (L : Real) ^ 2 a / kappa ≤ B ∧ Nonempty (FiniteMomentDual L (a / kappa) B a c) := by let kappa := (1 - 2 * eps) / eps let D := kappa / ((1 + kappa) * (2 + kappa)) let gamma := min (kappa / 4) (D * kappa / 32) let c := D / 8 have hkappa : 0 < kappa := by dsimp [kappa] apply div_pos · linarith · exact heps have hD : 0 < D := by dsimp [D] exact div_pos hkappa (mul_pos (by linarith) (by linarith)) have hDlt : D < 1 := by dsimp [D] apply (div_lt_one (mul_pos (by linarith [hkappa]) (by linarith [hkappa]))).2 nlinarith [sq_nonneg kappa] have hgamma : 0 < gamma := by dsimp [gamma] positivity have hc : 0 < c := by dsimp [c] positivity refine ⟨gamma, c, hgamma, hc, ?_⟩ intro L hL B hB dsimp only let a := gamma * B / (L : Real) ^ 2 have hLreal : 0 < (L : Real) := by positivity have ha : 0 < a := by dsimp [a] positivity have hgamma_le : gamma ≤ kappa / 4 := min_le_left _ _ have hLtwo : (2 : Real) ≤ L := by exact_mod_cast hL have hLsq : 4 ≤ (L : Real) ^ 2 := by nlinarith have hLsqpos : 0 < (L : Real) ^ 2 := lt_of_lt_of_le (by norm_num) hLsq have hleft : a / kappa ≤ B := by rw [div_le_iff₀ hkappa] dsimp [a] rw [div_le_iff₀ hLsqpos] have : gamma * B ≤ kappa * B := by gcongr <;> linarith nlinarith [mul_pos hkappa hB] refine ⟨hleft, ?_⟩ have hapos : 0 < a / kappa := div_pos ha hkappa have hleft16 : a / kappa ≤ B / 16 := by rw [div_le_iff₀ hkappa] dsimp [a] rw [div_le_iff₀ hLsqpos] have hgamB : gamma * B ≤ (kappa / 4) * B := by gcongr nlinarith [mul_pos hkappa hB] have hright_strict : a / kappa < B := by linarith let f := Causalean.Mathlib.Analysis.FinitePolynomialAlternationDuality.rationalTarget a have hpole : -a ∉ Icc (a / kappa) B := by intro h linarith [h.1, hapos] have hf : ContinuousOn f (Icc (a / kappa) B) := continuousOn_rationalTarget hpole obtain ⟨A⟩ := exists_alternationDualCertificate hright_strict hf L let E := bestUniformApproxError f (a / kappa) B L have hE : c ≤ E := by by_contra hnot have hElt : E < c := lt_of_not_ge hnot let p₁ := a / kappa let p₂ := 2 * a / kappa have hp₁pos : 0 < p₁ := by dsimp [p₁]; positivity have hp₁p₂ : p₁ < p₂ := by dsimp [p₁, p₂] calc a / kappa < 2 * (a / kappa) := by linarith [hapos] _ = 2 * a / kappa := by ring have hp₂B : p₂ ≤ B := by dsimp [p₂, a] have hgam : gamma ≤ kappa := hgamma_le.trans (by linarith [hkappa]) have hmul : 2 * gamma * B ≤ 2 * kappa * B := by gcongr field_simp [ne_of_gt hkappa, ne_of_gt hLsqpos] nlinarith [mul_pos hkappa hB] have hp₁mem : p₁ ∈ Icc (a / kappa) B := ⟨le_rfl, hp₁p₂.le.trans hp₂B⟩ have hp₂mem : p₂ ∈ Icc (a / kappa) B := ⟨hp₁p₂.le, hp₂B⟩ have hres (p : Real) (hp : p ∈ Icc (a / kappa) B) : |f p - A.approximant.eval p| ≤ E := by have herr : intervalSupNorm (fun x => f x - A.approximant.eval x) (a / kappa) B = E := by simpa [uniformApproxError, E] using A.approximant_best have hu := (intervalSupNorm_le_iff (hf.sub A.approximant.continuous.continuousOn) hright_strict.le).mp (herr.le) p hp exact hu have hf₁ : f p₁ = 1 / (1 + kappa) := by dsimp [f, p₁, Causalean.Mathlib.Analysis.FinitePolynomialAlternationDuality.rationalTarget] field_simp [ne_of_gt ha, ne_of_gt hkappa] <;> ring have hf₂ : f p₂ = 2 / (2 + kappa) := by dsimp [f, p₂, Causalean.Mathlib.Analysis.FinitePolynomialAlternationDuality.rationalTarget] field_simp [ne_of_gt ha, ne_of_gt hkappa] <;> ring have hfdiff : f p₂ - f p₁ = D := by rw [hf₁, hf₂] dsimp [D] field_simp ring have hQdiff : D - 2 * E ≤ A.approximant.eval p₂ - A.approximant.eval p₁ := by have h1 := abs_le.mp (hres p₁ hp₁mem) have h2 := abs_le.mp (hres p₂ hp₂mem) linarith [hfdiff] obtain ⟨z, hz, hzderiv⟩ := exists_hasDerivAt_eq_slope (fun x => A.approximant.eval x) (fun x => A.approximant.derivative.eval x) hp₁p₂ A.approximant.continuous.continuousOn (fun x _ => A.approximant.hasDerivAt x) have hzmem : z ∈ Icc (a / kappa) B := ⟨hp₁mem.1.trans hz.1.le, hz.2.le.trans hp₂B⟩ have hQnorm : intervalSupNorm (fun x => A.approximant.eval x) (a / kappa) B ≤ 1 + E := by apply (intervalSupNorm_le_iff A.approximant.continuous.continuousOn hright_strict.le).2 intro x hx have hr := abs_le.mp (hres x hx) have hfx0 : 0 ≤ f x := by dsimp [f, Causalean.Mathlib.Analysis.FinitePolynomialAlternationDuality.rationalTarget] exact div_nonneg (hp₁pos.le.trans hx.1) (by linarith [ha, hp₁pos, hx.1]) have hfx1 : f x ≤ 1 := by dsimp [f, Causalean.Mathlib.Analysis.FinitePolynomialAlternationDuality.rationalTarget] apply (div_le_one (by linarith [ha, hp₁pos, hx.1])).2 linarith [ha] rw [abs_le] constructor <;> linarith have hmarkov := markov_derivative_Icc A.approximant hright_strict L A.approximant_degree have hzupper := (intervalSupNorm_le_iff A.approximant.derivative.continuous.continuousOn hright_strict.le).mp hmarkov z hzmem have hE0 : 0 ≤ E := by exact Causalean.Mathlib.Analysis.FinitePolynomialAlternationDuality.bestUniformApproxError_nonneg hright_strict hf L have hEone : E < 1 := hElt.trans (by dsimp [c]; linarith [hDlt]) have hden : 0 < B - a / kappa := sub_pos.mpr hright_strict have hslope : (D - 2 * E) / (p₂ - p₁) ≤ |A.approximant.derivative.eval z| := by rw [hzderiv] rw [abs_of_nonneg] · exact div_le_div_of_nonneg_right hQdiff (sub_nonneg.mpr hp₁p₂.le) · apply div_nonneg · dsimp [c] at hElt nlinarith · linarith have hgamma_le' : gamma ≤ D * kappa / 32 := min_le_right _ _ have hhalfden : B / 2 ≤ B - a / kappa := by linarith [hleft16] have hupper : |A.approximant.derivative.eval z| ≤ (2 * (L : Real) ^ 2 / (B - a / kappa)) * (1 + E) := hzupper.trans (mul_le_mul_of_nonneg_left hQnorm (by positivity)) dsimp [p₁, p₂, a] at hslope hupper hhalfden have hupper' : |A.approximant.derivative.eval z| ≤ 8 * (L : Real) ^ 2 / B := by have hfac : 0 ≤ 2 * (L : Real) ^ 2 := by positivity have hdiv : 2 * (L : Real) ^ 2 / (B - a / kappa) ≤ 2 * (L : Real) ^ 2 / (B / 2) := div_le_div_of_nonneg_left hfac (by positivity) hhalfden calc |A.approximant.derivative.eval z| ≤ (2 * (L : Real) ^ 2 / (B - a / kappa)) * (1 + E) := hupper _ ≤ (2 * (L : Real) ^ 2 / (B / 2)) * (1 + E) := mul_le_mul_of_nonneg_right hdiv (by linarith) _ ≤ (2 * (L : Real) ^ 2 / (B / 2)) * 2 := by apply mul_le_mul_of_nonneg_left (by linarith [hEone]) positivity _ = 8 * (L : Real) ^ 2 / B := by field_simp [ne_of_gt hB] ring have hkapne : kappa ≠ 0 := ne_of_gt hkappa have hgamne : gamma ≠ 0 := ne_of_gt hgamma have hBne : B ≠ 0 := ne_of_gt hB have hLne : (L : Real) ^ 2 ≠ 0 := ne_of_gt hLsqpos field_simp [hkapne, hgamne, hBne, hLne] at hslope have hprod : gamma * B * |A.approximant.derivative.eval z| ≤ 8 * gamma * (L : Real) ^ 2 := by calc gamma * B * |A.approximant.derivative.eval z| ≤ gamma * B * (8 * (L : Real) ^ 2 / B) := by gcongr _ = 8 * gamma * (L : Real) ^ 2 := by field_simp [hBne] dsimp [c] at hElt nlinarith [mul_pos hLsqpos hkappa] let sign : Real := if 0 ≤ ∑ i, A.weights i * f (A.nodes i) then 1 else -1 refine ⟨{ node := A.nodes node_injective := A.nodes_strictMono.injective weight := fun i => sign * A.weights i support := A.nodes_mem totalVariation := ?_ moments := ?_ gap := ?_ }⟩ · simp only [abs_mul, Finset.mul_sum] have hsignabs : |sign| = 1 := by dsimp [sign] split <;> simp simpa [hsignabs] using A.weights_normalized · intro j hj simp_rw [mul_assoc] rw [← Finset.mul_sum, A.moments_zero j hj, mul_zero] · have htarget : |∑ i, A.weights i * f (A.nodes i)| = E := by rw [A.target_eq] rcases A.orientation_eq with h | h <;> rw [h] <;> simp [E, abs_of_nonneg (Causalean.Mathlib.Analysis.FinitePolynomialAlternationDuality.bestUniformApproxError_nonneg hright_strict hf L)] change c ≤ ∑ i, sign * A.weights i * (A.nodes i / (A.nodes i + a)) simp_rw [mul_assoc] rw [← Finset.mul_sum] change c ≤ sign * ∑ i, A.weights i * f (A.nodes i) rw [show sign * ∑ i, A.weights i * f (A.nodes i) = |∑ i, A.weights i * f (A.nodes i)| by simp only [sign] split_ifs with h · simpa [abs_of_nonneg h] · have : ∑ i, A.weights i * f (A.nodes i) ≤ 0 := le_of_not_ge h simpa [abs_of_nonpos this]] simpa [htarget] using hE
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.finite_alternation_duality · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/AlternationDuality.lean:31
CausalSmith.Stat.STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research.Helpers.AnnotationFrontierConsequences 4 declarations

the stated conditions establishes the stated conclusion.

Formal statement
n :
hn :
1 ≤ n
0 < logEN n
Proof (Lean source)
lemma logEN_pos_of_one_le (n : Nat) (hn : 1 ≤ n) : 0 < logEN n := by rw [logEN] apply Real.log_pos have he : 1 < exp 1 := Real.one_lt_exp_iff.mpr (by norm_num) have hnR : (1 : Real) ≤ n := by exact_mod_cast hn exact he.trans_le (by simpa using mul_le_mul_of_nonneg_left hnR (Real.exp_nonneg 1))
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.logEN_pos_of_one_le · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/AnnotationFrontierConsequences.lean:16
theorem frontierRate_sequence_formula

The formal statement establishes the stated conclusion.

Formal statement
mSeq dSeq :
Nat → Nat
n :
frontierRate n (mSeq n) (dSeq n)
= min 1 (1 / (n : Real) + ((dSeq n : Real) / (((n + mSeq n : Nat) : Real) * logEN n)) ^ 2)
Proof (Lean source)
lemma frontierRate_sequence_formula (mSeq dSeq : Nat → Nat) (n : Nat) : frontierRate n (mSeq n) (dSeq n) = min 1 (1 / (n : Real) + ((dSeq n : Real) / (((n + mSeq n : Nat) : Real) * logEN n)) ^ 2) := by rw [frontierRate] simp only [Nat.cast_add, div_pow] ring
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.frontierRate_sequence_formula · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/AnnotationFrontierConsequences.lean:25
theorem annotation_frontier_consistency_iff

the stated conditions establishes the stated conclusion.

Formal statement
mSeq dSeq :
Nat → Nat
_hd :
∀ n
if
1 ≤ n
then
2 ≤ dSeq n
Tendsto (fun n ↦ frontierRate n (mSeq n) (dSeq n)) atTop (nhds 0)
↔ Tendsto (fun n ↦ (dSeq n : Real) / (((n + mSeq n : Nat) : Real) * logEN n)) atTop (nhds 0)
Proof (Lean source)
lemma annotation_frontier_consistency_iff (mSeq dSeq : Nat → Nat) (_hd : ∀ n, 1 ≤ n → 2 ≤ dSeq n) : Tendsto (fun n ↦ frontierRate n (mSeq n) (dSeq n)) atTop (nhds 0) ↔ Tendsto (fun n ↦ (dSeq n : Real) / (((n + mSeq n : Nat) : Real) * logEN n)) atTop (nhds 0) := by let b : Nat → Real := fun n ↦ (dSeq n : Real) / (((n + mSeq n : Nat) : Real) * logEN n) have hnat : Tendsto (fun n : Nat ↦ (n : Real)) atTop atTop := tendsto_natCast_atTop_atTop have hinv : Tendsto (fun n : Nat ↦ 1 / (n : Real)) atTop (nhds 0) := by simpa [one_div, Function.comp_def] using tendsto_inv_atTop_zero.comp hnat have hb_nonneg : ∀ᶠ n in atTop, 0 ≤ b n := by filter_upwards [eventually_ge_atTop 1] with n hn dsimp [b] exact div_nonneg (Nat.cast_nonneg _) (mul_nonneg (Nat.cast_nonneg _) (logEN_pos_of_one_le n hn).le) constructor · intro hr have hsmall : ∀ᶠ n in atTop, frontierRate n (mSeq n) (dSeq n) < 1 / 2 := (tendsto_order.1 hr).2 (1 / 2) (by norm_num) have hbsq : Tendsto (fun n ↦ (b n) ^ 2) atTop (nhds 0) := by apply squeeze_zero' (g := fun n ↦ frontierRate n (mSeq n) (dSeq n)) · exact Filter.Eventually.of_forall fun n ↦ sq_nonneg (b n) · filter_upwards [eventually_ge_atTop 1, hsmall] with n hn hs rw [frontierRate_sequence_formula] have hsum : 1 / (n : Real) + b n ^ 2 ≤ 1 := by by_contra h rw [frontierRate_sequence_formula, min_eq_left (le_of_not_ge h)] at hs norm_num at hs rw [min_eq_right hsum] exact le_add_of_nonneg_left (by positivity) · exact hr have hsqrt : Tendsto (fun n ↦ sqrt ((b n) ^ 2)) atTop (nhds 0) := by simpa [Function.comp_def] using Real.continuous_sqrt.continuousAt.tendsto.comp hbsq apply (hsqrt.congr' ?_) filter_upwards [hb_nonneg] with n hn rw [Real.sqrt_sq_eq_abs, abs_of_nonneg hn] · intro hb have hb' : Tendsto b atTop (nhds 0) := by simpa [b] using hb have hsum : Tendsto (fun n : Nat ↦ 1 / (n : Real) + b n ^ 2) atTop (nhds 0) := by convert hinv.add (hb'.pow 2) using 1 <;> norm_num have hmin : Tendsto (fun n : Nat ↦ min (1 : Real) (1 / (n : Real) + b n ^ 2)) atTop (nhds 0) := by convert (tendsto_const_nhds.min hsum) using 1 <;> norm_num apply hmin.congr' filter_upwards with n exact (frontierRate_sequence_formula mSeq dSeq n).symm
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.annotation_frontier_consistency_iff · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/AnnotationFrontierConsequences.lean:36
theorem annotation_frontier_parametric_iff

the stated conditions establishes the stated conclusion.

Formal statement
mSeq dSeq :
Nat → Nat
_hd :
∀ n
if
1 ≤ n
then
2 ≤ dSeq n
(fun n ↦ frontierRate n (mSeq n) (dSeq n))
=O[atTop] (fun n ↦ 1 / (n : Real)) ↔ (fun n ↦ (dSeq n : Real)) =O[atTop] (fun n ↦ ((n + mSeq n : Nat) : Real) * logEN n / sqrt n)
Proof (Lean source)
lemma annotation_frontier_parametric_iff (mSeq dSeq : Nat → Nat) (_hd : ∀ n, 1 ≤ n → 2 ≤ dSeq n) : (fun n ↦ frontierRate n (mSeq n) (dSeq n)) =O[atTop] (fun n ↦ 1 / (n : Real)) ↔ (fun n ↦ (dSeq n : Real)) =O[atTop] (fun n ↦ ((n + mSeq n : Nat) : Real) * logEN n / sqrt n) := by let D : Nat → Real := fun n ↦ ((n + mSeq n : Nat) : Real) * logEN n let b : Nat → Real := fun n ↦ (dSeq n : Real) / D n let inv : Nat → Real := fun n ↦ 1 / (n : Real) let rate : Nat → Real := fun n ↦ frontierRate n (mSeq n) (dSeq n) have hDpos : ∀ᶠ n in atTop, 0 < D n := by filter_upwards [eventually_ge_atTop 1] with n hn dsimp [D] exact mul_pos (by exact_mod_cast (hn.trans (le_add_right n (mSeq n)))) (logEN_pos_of_one_le n hn) have hinv_nonneg : ∀ᶠ n in atTop, 0 ≤ inv n := by filter_upwards [eventually_ge_atTop 1] with n hn dsimp [inv] positivity have hinv_zero : Tendsto inv atTop (nhds 0) := by dsimp [inv] simpa [one_div, Function.comp_def] using tendsto_inv_atTop_zero.comp tendsto_natCast_atTop_atTop have hb_nonneg : ∀ᶠ n in atTop, 0 ≤ b n := by filter_upwards [hDpos] with n hD exact div_nonneg (Nat.cast_nonneg _) hD.le constructor · intro hr have hr' : rate =O[atTop] inv := by simpa [rate, inv] using hr have hrzero := hr'.trans_tendsto hinv_zero have hsmall : ∀ᶠ n in atTop, rate n < 1 / 2 := (tendsto_order.1 hrzero).2 (1 / 2) (by norm_num) have hb_sq_le : (fun n ↦ b n ^ 2) =O[atTop] rate := by apply IsBigO.of_bound 1 filter_upwards [eventually_ge_atTop 1, hsmall] with n hn hs rw [Real.norm_eq_abs, Real.norm_eq_abs, abs_of_nonneg (sq_nonneg _), abs_of_nonneg (frontierRate_mem_Ioc_zero_one _ _ _ hn).1.le, one_mul] have hsum : 1 / (n : Real) + b n ^ 2 ≤ 1 := by by_contra h change frontierRate n (mSeq n) (dSeq n) < 1 / 2 at hs rw [frontierRate_sequence_formula] at hs rw [min_eq_left (le_of_not_ge (by simpa [b, D] using h))] at hs norm_num at hs change b n ^ 2 ≤ frontierRate n (mSeq n) (dSeq n) rw [frontierRate_sequence_formula, min_eq_right (by simpa [b, D] using hsum)] exact le_add_of_nonneg_left (by positivity) have hb2 : (fun n ↦ b n ^ 2) =O[atTop] inv := hb_sq_le.trans hr' have hbsqrt : (fun n ↦ sqrt (b n ^ 2)) =O[atTop] (fun n ↦ sqrt (inv n)) := hb2.sqrt hinv_nonneg have hbO : b =O[atTop] (fun n ↦ sqrt (inv n)) := hbsqrt.congr' (by filter_upwards [hb_nonneg] with n hn rw [Real.sqrt_sq_eq_abs, abs_of_nonneg hn]) Filter.EventuallyEq.rfl have hmul := hbO.mul (isBigO_refl D atTop) apply hmul.congr' · filter_upwards [hDpos] with n hD dsimp [b] field_simp · filter_upwards [eventually_ge_atTop 1] with n hn dsimp [inv, D] rw [Real.sqrt_div (by norm_num : (0 : Real) ≤ 1), Real.sqrt_one] ring · intro hdO have hdiv := hdO.mul (isBigO_refl (fun n ↦ (D n)⁻¹) atTop) have hbO : b =O[atTop] (fun n ↦ 1 / sqrt n) := by apply hdiv.congr' · filter_upwards [hDpos] with n hD dsimp [b] rw [div_eq_mul_inv] · filter_upwards [hDpos, eventually_ge_atTop 1] with n hD hn dsimp [D] dsimp [D] at hD have hlog := logEN_pos_of_one_le n hn field_simp [hD.ne', hlog.ne'] have hb2 := hbO.pow 2 have hb2' : (fun n ↦ b n ^ 2) =O[atTop] inv := by apply hb2.congr' Filter.EventuallyEq.rfl filter_upwards [eventually_ge_atTop 1] with n hn dsimp [inv] have hnR : (0 : Real) < n := by exact_mod_cast hn rw [div_pow, one_pow, Real.sq_sqrt hnR.le] have hsum : (fun n ↦ inv n + b n ^ 2) =O[atTop] inv := (isBigO_refl inv atTop).add hb2' refine (show rate =O[atTop] (fun n ↦ inv n + b n ^ 2) by apply IsBigO.of_bound 1 filter_upwards [eventually_ge_atTop 1] with n hn rw [Real.norm_eq_abs, Real.norm_eq_abs, abs_of_nonneg (frontierRate_mem_Ioc_zero_one _ _ _ hn).1.le, abs_of_nonneg (add_nonneg (by dsimp [inv]; positivity) (sq_nonneg _)), one_mul] rw [frontierRate_sequence_formula] exact min_le_right _ _).trans hsum
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.annotation_frontier_parametric_iff · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/AnnotationFrontierConsequences.lean:87
CausalSmith.Stat.STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research.Helpers.ChebyshevCalibration 10 declarations Chebyshev continuations and their explicit factorial-moment calibration.

Chebyshev continuations and their explicit factorial-moment calibration.

def chebQ

The shifted Chebyshev polynomial Q_L(z)=T_L(1-2z). the stated conditions the stated conclusion.

Definition (Lean source)
L :
chebQ L :
(T Real L).comp (1 - 2 * X)
def chebH

Polynomial continuation of (1-Q_L)/(2L²). the stated conditions the stated conclusion.

Definition (Lean source)
L :
chebH L :
(2 * (L : Real) ^ 2)⁻¹ • (1 - chebQ L)
def chebE

Polynomial continuation of H_L(z)/z. the stated conditions the stated conclusion.

Definition (Lean source)
L :
chebE L :
(chebH L).divByMonic X
def chebG

Polynomial continuation of (1-E_L(z))/z. the stated conditions the stated conclusion.

Definition (Lean source)
L :
chebG L :
(1 - chebE L).divByMonic X
def coefficientL1

Coefficient ℓ¹ norm of a real polynomial. the stated conditions the stated conclusion.

Definition (Lean source)
coefficientL1 p :
∑ i ∈ p.support, |p.coeff i|
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.coefficientL1 · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/ChebyshevCalibration.lean:40
def factorialLift

Coefficientwise bivariate falling-factorial lift of (s₀+s₁)G_L(s_a/B)/B. Each monomial is lifted separately, so the same-arm contribution uses (K_a)_{j+1} rather than K_a (K_a)_j. the stated conditions the stated conclusion.

Definition (Lean source)
a :
L :
B t :
k0 k1 :
factorialLift a L B t k0 k1 :
∑ j ∈ (chebG L).support, let ka := if a then k1 else k0 let kb := if a then k0 else k1 (chebG L).coeff j * ((((ka.descFactorial (j + 1) : Nat) : Real) + (kb : Real) * ((ka.descFactorial j : Nat) : Real)) / (t * B) ^ (j + 1))
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.factorialLift · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/ChebyshevCalibration.lean:44
def factorialLiftSecondMoment

The explicit second moment under independent Poisson cell counts. the stated conditions the stated conclusion.

Definition (Lean source)
a :
L :
B t s0 s1 :
factorialLiftSecondMoment a L B t s0 s1 :
∫ K : Nat × Nat, factorialLift a L B t K.1 K.2 ^ 2 ∂ (poissonMeasure (toNNReal (t * s0))).prod (poissonMeasure (toNNReal (t * s1)))
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.factorialLiftSecondMoment · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/ChebyshevCalibration.lean:57
def ChebyshevCalibration

All coefficient, factorial-moment, and interval inequalities (C7)--(C9). the stated conditions the stated conclusion.

Definition (Lean source)
L :
ChebyshevCalibration L :
Prop
clause 1
coefficientL1 (chebQ L) ≤ 7 ^ L
clause 2
2 * coefficientL1 (chebG L) ≤ 14 ^ L
clause 3
a :
t B s0 s1 :
0 < t
0 < B
0 ≤ s0
0 ≤ s1
(L : Real) ≤ t * B
p :
s0 + s1
factorialLiftSecondMoment a L B t s0 s1 ≤ (7056 : Real) ^ L * (1 + p / B) ^ (2 * L)
p ≤ B
factorialLiftSecondMoment a L B t s0 s1 ≤ (7056 : Real) ^ L
clause 4
z :
z ∈ Icc (0 : Real) 1
0 ≤ (chebE L).eval z
(chebE L).eval z ≤ 1
0 < z
(chebE L).eval z ≤ ((L : Real) ^ 2 * z)⁻¹
z * (chebG L).eval z + (chebE L).eval z = 1
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.ChebyshevCalibration · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/ChebyshevCalibration.lean:64
theorem coefficientL1_chebG_le Lemma 15 in the paper ↗

For a positive polynomial degree, the coefficient ℓ¹ norm of the shifted Chebyshev quotient is at most six to that degree.

Formal statement
L :
hL :
0 < L
coefficientL1 (chebG L) ≤ (6 : Real) ^ L
Proof (Lean source)
lemma coefficientL1_chebG_le (L : Nat) (hL : 0 < L) : coefficientL1 (chebG L) ≤ (6 : Real) ^ L := by rw [chebG_eq_explicit L hL] calc coefficientL1 (explicitG L) = ∑ j ∈ (explicitG L).support, |(explicitG L).coeff j| := rfl _ ≤ ∑ j ∈ range (L - 1), |(explicitG L).coeff j| := by apply Finset.sum_le_sum_of_subset_of_nonneg (explicitG_support_subset L) intro j _ _ exact abs_nonneg _ _ = DiscreteAteMinimaxLoggap.gpos L 1 := by unfold DiscreteAteMinimaxLoggap.gpos apply Finset.sum_congr rfl intro j hj simp [explicitG, Finset.mem_range.mp hj] _ ≤ (6 : Real) ^ L := by simpa using DiscreteAteMinimaxLoggap.gpos_bound hL (z := (1 : Real)) (by norm_num)
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.coefficientL1_chebG_le · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/ChebyshevCalibration.lean:555
theorem explicit_chebyshev_calibration Lemma 16 in the paper ↗

The explicit shifted-Chebyshev construction satisfies (C7)--(C9). the stated conditions the stated conclusion.

Formal statement
L :
hL :
2 ≤ L
Proof (Lean source)
lemma explicit_chebyshev_calibration (L : Nat) (hL : 2 ≤ L) : ChebyshevCalibration L := by have hLpos : 0 < L := by omega refine ⟨coefficientL1_chebQ_le L hLpos, ?_, ?_, ?_⟩ · have hg := coefficientL1_chebG_le L hLpos have hpow : (6 : Real) ^ L ≤ 7 ^ L := pow_le_pow_left₀ (by norm_num) (by norm_num) L have htwo : (2 : Real) ≤ 2 ^ L := by calc (2 : Real) = 2 ^ (1 : Nat) := by norm_num _ ≤ 2 ^ L := pow_le_pow_right₀ (by norm_num) (by omega) calc 2 * coefficientL1 (chebG L) ≤ 2 * 6 ^ L := by gcongr _ ≤ 2 ^ L * 7 ^ L := mul_le_mul htwo hpow (by positivity) (by positivity) _ = 14 ^ L := by rw [← mul_pow]; norm_num · intro a t B s0 s1 ht hB hs0 hs1 hLD dsimp only let D := t * B let p := s0 + s1 let q := 1 + p / B have hD : 0 < D := mul_pos ht hB have hrate0 : D * (s0 / B) = t * s0 := by dsimp [D] field_simp have hrate1 : D * (s1 / B) = t * s1 := by dsimp [D] field_simp have hsupp : (chebG L).support ⊆ range (L - 1) := by rw [chebG_eq_explicit L hLpos] exact explicitG_support_subset L let Xj : Nat → Nat × Nat → Real := fun j K ↦ sameArmMonomial a (j + 1) D K + crossArmMonomial a j D K let μ := (poissonMeasure (toNNReal (D * (s0 / B)))).prod (poissonMeasure (toNNReal (D * (s1 / B)))) have hjOrder (j : Nat) (hj : j ∈ (chebG L).support) : j + 1 ≤ L := by have hjr := Finset.mem_range.mp (hsupp hj) omega have hXmem (j : Nat) (hj : j ∈ (chebG L).support) : MemLp (Xj j) 2 μ := by exact armMonomial_sum_memLp a j (D := D) (z0 := s0 / B) (z1 := s1 / B) hD have hXsq (j : Nat) (hj : j ∈ (chebG L).support) : (∫ K, Xj j K ^ 2 ∂μ) ≤ ((6 : Real) ^ L * q ^ L) ^ 2 := by have h := armMonomial_sum_sq_le a hD hB hs0 hs1 hLD (hjOrder j hj) dsimp [Xj, μ, q, p] at h ⊢ calc _ ≤ (36 : Real) ^ L * (1 + (s0 + s1) / B) ^ (2 * L) := h _ = ((6 : Real) ^ L * (1 + (s0 + s1) / B) ^ L) ^ 2 := by rw [show (36 : Real) = 6 * 6 by norm_num, mul_pow] rw [show 2 * L = L + L by omega, pow_add, mul_pow, pow_two] ring have houter := DiscreteOptimalValueMinimaxMatched.integral_sq_finset_sum_le_coeffL1 μ (chebG L).support (chebG L).coeff Xj ((6 : Real) ^ L * q ^ L) (by positivity) hXmem hXsq have hlift : (fun K : Nat × Nat ↦ factorialLift a L B t K.1 K.2) = fun K ↦ ∑ j ∈ (chebG L).support, (chebG L).coeff j * Xj j K := by funext K unfold factorialLift apply Finset.sum_congr rfl intro j hj dsimp [Xj, D, sameArmMonomial, crossArmMonomial] cases a <;> simp only [Bool.false_eq_true, ↓reduceIte] <;> ring have hmoment : factorialLiftSecondMoment a L B t s0 s1 ≤ coefficientL1 (chebG L) ^ 2 * ((6 : Real) ^ L * q ^ L) ^ 2 := by unfold factorialLiftSecondMoment dsimp [μ] at houter rw [hrate0, hrate1] at houter rw [show (fun K : Nat × Nat ↦ factorialLift a L B t K.1 K.2 ^ 2) = (fun K ↦ (∑ j ∈ (chebG L).support, (chebG L).coeff j * Xj j K) ^ 2) by funext K rw [congrFun hlift K]] simpa only [coefficientL1] using houter have hg := coefficientL1_chebG_le L hLpos have hq0 : 0 ≤ q := by dsimp [q, p] have := div_nonneg (add_nonneg hs0 hs1) hB.le linarith have hg0 : 0 ≤ coefficientL1 (chebG L) := by unfold coefficientL1 exact Finset.sum_nonneg fun _ _ ↦ abs_nonneg _ have hmain : factorialLiftSecondMoment a L B t s0 s1 ≤ (1296 : Real) ^ L * q ^ (2 * L) := by calc _ ≤ coefficientL1 (chebG L) ^ 2 * ((6 : Real) ^ L * q ^ L) ^ 2 := hmoment _ ≤ ((6 : Real) ^ L) ^ 2 * ((6 : Real) ^ L * q ^ L) ^ 2 := by exact mul_le_mul_of_nonneg_right (pow_le_pow_left₀ hg0 hg 2) (sq_nonneg _) _ = (1296 : Real) ^ L * q ^ (2 * L) := by norm_num [pow_two, pow_mul, Nat.mul_comm] rw [show (1296 : Real) = 6 * 6 * 6 * 6 by norm_num, mul_pow, mul_pow, mul_pow] ring constructor · dsimp [p, q] at hmain ⊢ exact hmain.trans (mul_le_mul_of_nonneg_right (pow_le_pow_left₀ (by norm_num) (by norm_num : (1296 : Real) ≤ 7056) L) (by positivity)) · intro hpB have hq2 : q ≤ 2 := by dsimp [q, p] have : (s0 + s1) / B ≤ 1 := (div_le_one hB).2 hpB linarith calc factorialLiftSecondMoment a L B t s0 s1 ≤ (1296 : Real) ^ L * q ^ (2 * L) := hmain _ ≤ (1296 : Real) ^ L * 2 ^ (2 * L) := by gcongr _ = (5184 : Real) ^ L := by rw [show (5184 : Real) = 1296 * 4 by norm_num, mul_pow, show (2 : Real) ^ (2 * L) = 4 ^ L by rw [show (4 : Real) = 2 ^ 2 by norm_num, pow_mul]] _ ≤ (7056 : Real) ^ L := pow_le_pow_left₀ (by norm_num) (by norm_num) L · intro z hz rcases chebE_interval_bounds L hLpos hz with ⟨h0, h1, hinv⟩ exact ⟨h0, h1, hinv, chebG_defining_identity L hLpos z⟩
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.explicit_chebyshev_calibration · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/ChebyshevCalibration.lean:824
CausalSmith.Stat.STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research.Helpers.CommonMarginalCalibration 9 declarations Arithmetic closure of the common-marginal C55 calibration.

Arithmetic closure of the common-marginal C55 calibration.

theorem commonMarginal_logEN_pos

The logarithmic schedule is positive at every nonempty sample size. the stated conditions the stated conclusion.

Formal statement
n :
hn :
1 ≤ n
0 < logEN n
Proof (Lean source)
lemma commonMarginal_logEN_pos (n : Nat) (hn : 1 ≤ n) : 0 < logEN n := by rw [logEN] apply Real.log_pos have he : 1 < exp 1 := Real.one_lt_exp_iff.mpr (by norm_num) have hnR : (1 : Real) ≤ n := by exact_mod_cast hn nlinarith
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.commonMarginal_logEN_pos · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalCalibration.lean:10
theorem commonMarginal_one_le_logEN

the stated conditions establishes the stated conclusion.

Formal statement
n :
hn :
1 ≤ n
1 ≤ logEN n
Proof (Lean source)
lemma commonMarginal_one_le_logEN (n : Nat) (hn : 1 ≤ n) : 1 ≤ logEN n := by have hnR : (0 : Real) < n := by exact_mod_cast hn have hlog : 0 ≤ log (n : Real) := Real.log_nonneg (by exact_mod_cast hn) rw [logEN, Real.log_mul (Real.exp_ne_zero 1) hnR.ne', Real.log_exp] linarith
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.commonMarginal_one_le_logEN · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalCalibration.lean:17
theorem commonMarginal_logEN_le_two_sqrt

The logarithmic schedule is at most twice the square-root scale. the stated conditions the stated conclusion.

Formal statement
n :
hn :
1 ≤ n
logEN n ≤ 2 * sqrt n
Proof (Lean source)
lemma commonMarginal_logEN_le_two_sqrt (n : Nat) (hn : 1 ≤ n) : logEN n ≤ 2 * sqrt n := by have hnR : (0 : Real) < n := by exact_mod_cast hn have hs : 1 ≤ sqrt (n : Real) := Real.one_le_sqrt.mpr (by exact_mod_cast hn) have hlog := Real.log_le_sub_one_of_pos (Real.sqrt_pos.2 hnR) rw [Real.log_sqrt hnR.le] at hlog rw [logEN, Real.log_mul (Real.exp_ne_zero 1) hnR.ne', Real.log_exp] nlinarith
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.commonMarginal_logEN_le_two_sqrt · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalCalibration.lean:25
theorem commonMarginal_logEN_le_nat

The logarithmic schedule is at most the sample size. the stated conditions the stated conclusion.

Formal statement
n :
hn :
1 ≤ n
logEN n ≤ n
Proof (Lean source)
lemma commonMarginal_logEN_le_nat (n : Nat) (hn : 1 ≤ n) : logEN n ≤ n := by have hnR : (0 : Real) < n := by exact_mod_cast hn have hlog := Real.log_le_sub_one_of_pos hnR rw [logEN, Real.log_mul (Real.exp_ne_zero 1) hnR.ne', Real.log_exp] linarith
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.commonMarginal_logEN_le_nat · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalCalibration.lean:36
theorem commonMarginal_half_le_floor

Above one, taking a natural floor preserves at least half the input. the stated conditions the stated conclusion.

Formal statement
x :
hx :
1 ≤ x
x / 2 ≤ (Nat.floor x : Real)
Proof (Lean source)
lemma commonMarginal_half_le_floor {x : Real} (hx : 1 ≤ x) : x / 2 ≤ (Nat.floor x : Real) := by by_cases hx2 : x ≤ 2 · have hfloor : 1 ≤ Nat.floor x := Nat.le_floor (by simpa using hx) have hfloorR : (1 : Real) ≤ Nat.floor x := by exact_mod_cast hfloor linarith · have hfloor := Nat.sub_one_lt_floor x linarith
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.commonMarginal_half_le_floor · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalCalibration.lean:44
theorem commonMarginal_degree_upper

A ceiling of the calibrated logarithmic degree costs at most one extra copy of the logarithmic schedule. the stated conditions the stated conclusion.

Formal statement
eps :
calibration :
n L :
hn :
1 ≤ n
hL :
L = ceil (calibration.degreeConstant * logEN n)
(L : Real) ≤ (calibration.degreeConstant + 1) * logEN n
Proof (Lean source)
lemma commonMarginal_degree_upper {eps : Real} (calibration : CommonMarginalCalibration eps) (n L : Nat) (hn : 1 ≤ n) (hL : L = ceil (calibration.degreeConstant * logEN n)) : (L : Real) ≤ (calibration.degreeConstant + 1) * logEN n := by have hlog := commonMarginal_one_le_logEN n hn have hx : 0 ≤ calibration.degreeConstant * logEN n := mul_nonneg calibration.degreeConstant_pos.le (by linarith) have hc := Nat.ceil_lt_add_one hx rw [← hL] at hc nlinarith
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.commonMarginal_degree_upper · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalCalibration.lean:54
theorem commonMarginal_degree_lower

The canonical degree is at least two. the stated conditions the stated conclusion.

Formal statement
C rho :
closure :
n L :
hn :
1 ≤ n
hL :
L = ceil (calibration.degreeConstant * logEN n)
2 ≤ L
Proof (Lean source)
lemma commonMarginal_degree_lower {eps : Real} {calibration : CommonMarginalCalibration eps} {C rho : Real} (closure : CommonMarginalCalibrationClosure calibration C rho) (n L : Nat) (hn : 1 ≤ n) (hL : L = ceil (calibration.degreeConstant * logEN n)) : 2 ≤ L := by have hlog := commonMarginal_one_le_logEN n hn have hx : (2 : Real) ≤ calibration.degreeConstant * logEN n := by have hm := mul_le_mul_of_nonneg_left hlog calibration.degreeConstant_pos.le have hm' : calibration.degreeConstant ≤ calibration.degreeConstant * logEN n := by simpa only [mul_one] using hm exact closure.degreeFloor.trans hm' rw [hL] exact_mod_cast (hx.trans (Nat.le_ceil _))
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.commonMarginal_degree_lower · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalCalibration.lean:67
theorem commonMarginal_rareCount_degree_lower

Outside the parametric regime, the capped rare-cell count dominates the square of the approximation degree at the variance-absorption scale. the stated conditions the stated conclusion.

Formal statement
C rho :
hC :
0 < C
closure :
n m d L k :
hn :
1 ≤ n
hd :
2 ≤ d
hL :
L = ceil (calibration.degreeConstant * logEN n)
hk :
k = min (d - 1) ⌊calibration.rareCountConstant * (n + m : Nat) * L⌋₊
hnon :
¬commonMarginalParametricRegime calibration n m d
(L : Real) ^ 2 / ((1 / (65536 * C)) * calibration.dualGap ^ 2 * calibration.gamma) ≤ k
Proof (Lean source)
lemma commonMarginal_rareCount_degree_lower {eps : Real} {calibration : CommonMarginalCalibration eps} {C rho : Real} (hC : 0 < C) (closure : CommonMarginalCalibrationClosure calibration C rho) (n m d L k : Nat) (hn : 1 ≤ n) (hd : 2 ≤ d) (hL : L = ceil (calibration.degreeConstant * logEN n)) (hk : k = min (d - 1) ⌊calibration.rareCountConstant * (n + m : Nat) * L⌋₊) (hnon : ¬commonMarginalParametricRegime calibration n m d) : (L : Real) ^ 2 / ((1 / (65536 * C)) * calibration.dualGap ^ 2 * calibration.gamma) ≤ k := by let K : Real := (1 / (65536 * C)) * calibration.dualGap ^ 2 * calibration.gamma let N : Real := (n + m : Nat) let ell : Real := logEN n have hK : 0 < K := by dsimp [K] exact mul_pos (mul_pos (div_pos (by norm_num) (mul_pos (by norm_num) hC)) (sq_pos_of_pos calibration.dualGap_pos)) calibration.gamma_pos have hnR : (0 : Real) < n := by exact_mod_cast hn have hN : (0 : Real) < N := by dsimp [N]; positivity have hNn : (n : Real) ≤ N := by dsimp [N] exact_mod_cast Nat.le_add_right n m have hell : 0 < ell := by exact commonMarginal_logEN_pos n hn have hLtwo := commonMarginal_degree_lower closure n L hn hL have hLpos : (0 : Real) < L := by exact_mod_cast (lt_of_lt_of_le (by omega : 0 < 2) hLtwo) have hLupper : (L : Real) ≤ (calibration.degreeConstant + 1) * ell := by exact commonMarginal_degree_upper calibration n L hn hL have hellN : ell ≤ N := (commonMarginal_logEN_le_nat n hn).trans hNn have hrK : 4 * (calibration.degreeConstant + 1) / K ≤ calibration.rareCountConstant := by simpa [K] using closure.rareCountLower have hxone : 1 ≤ calibration.rareCountConstant * N * L := by have hr : (4 : Real) ≤ calibration.rareCountConstant := closure.rareCountFloor have hN1 : (1 : Real) ≤ N := by dsimp [N] exact_mod_cast (show 1 ≤ n + m by omega) have hrN : (4 : Real) ≤ calibration.rareCountConstant * N := by nlinarith [mul_le_mul hr hN1 (by norm_num : (0 : Real) ≤ 1) calibration.rareCountConstant_pos.le] have hL1 : (1 : Real) ≤ L := by exact_mod_cast (show 1 ≤ L by omega) have hm := mul_le_mul_of_nonneg_right hrN (by positivity : (0 : Real) ≤ L) nlinarith have hfloorHalf : calibration.rareCountConstant * N * L / 2 ≤ (⌊calibration.rareCountConstant * (n + m : Nat) * L⌋₊ : Real) := by simpa [N] using commonMarginal_half_le_floor hxone subst k by_cases hcap : d - 1 ≤ ⌊calibration.rareCountConstant * (n + m : Nat) * L⌋₊ · rw [min_eq_left hcap] have hkcast : ((d - 1 : Nat) : Real) = (d : Real) - 1 := by rw [Nat.cast_sub (by omega)] norm_num have hdR : (2 : Real) ≤ d := by exact_mod_cast hd have hkhalf : (d : Real) / 2 ≤ (d - 1 : Nat) := by rw [hkcast] linarith have hreg : calibration.regimeConstant / (n : Real) < (d : Real) ^ 2 / (N ^ 2 * ell ^ 2) := by have h := lt_of_not_ge hnon exact lt_of_lt_of_le h (min_le_right _ _) have hq : (4 * (calibration.degreeConstant + 1) ^ 2 / K) ^ 2 ≤ calibration.regimeConstant := by simpa [K] using closure.regimeScale have hlogSqrt := commonMarginal_logEN_le_two_sqrt n hn have hsqrt : 0 < sqrt (n : Real) := Real.sqrt_pos.2 hnR have hsqrtSq : sqrt (n : Real) ^ 2 = n := Real.sq_sqrt hnR.le have hcross : (4 * (calibration.degreeConstant + 1) ^ 2 / K * N * ell) ^ 2 < ((d : Real) * sqrt n) ^ 2 := by have hden2 : 0 < N ^ 2 * ell ^ 2 := mul_pos (sq_pos_of_pos hN) (sq_pos_of_pos hell) rw [div_lt_div_iff₀ hnR hden2] at hreg nlinarith [mul_nonneg (sq_nonneg N) (sq_nonneg ell), hq] have hcross' : 4 * (calibration.degreeConstant + 1) ^ 2 / K * N * ell < (d : Real) * sqrt n := by have hl0 : 0 ≤ 4 * (calibration.degreeConstant + 1) ^ 2 / K * N * ell := by positivity have hr0 : 0 ≤ (d : Real) * sqrt n := by positivity exact (sq_lt_sq₀ hl0 hr0).mp hcross have htarget : 2 * (L : Real) ^ 2 / K ≤ d := by have hellS : ell * sqrt n ≤ 2 * n := by nlinarith have hLN : ell * sqrt n ≤ 2 * N := hellS.trans (by nlinarith) have hLU : (L : Real) ^ 2 ≤ (calibration.degreeConstant + 1) ^ 2 * ell ^ 2 := by nlinarith [sq_nonneg ((calibration.degreeConstant + 1) * ell - (L : Real))] have hD1 : 0 < calibration.degreeConstant + 1 := by linarith [calibration.degreeConstant_pos] have hmul := mul_le_mul_of_nonneg_left hLN (mul_nonneg (mul_nonneg (by positivity : (0 : Real) ≤ 2) (sq_nonneg (calibration.degreeConstant + 1))) hell.le) have hcrossK : 4 * (calibration.degreeConstant + 1) ^ 2 * N * ell < (d : Real) * sqrt n * K := by have := mul_lt_mul_of_pos_right hcross' hK field_simp [ne_of_gt hK] at this simpa only [mul_assoc, mul_comm, mul_left_comm] using this have hLs : 2 * (L : Real) ^ 2 * sqrt n ≤ 4 * (calibration.degreeConstant + 1) ^ 2 * N * ell := by nlinarith [mul_nonneg (sq_nonneg (L : Real)) hsqrt.le] have hLK : 2 * (L : Real) ^ 2 * sqrt n < (d : Real) * sqrt n * K := hLs.trans_lt hcrossK have hLK' : (2 * (L : Real) ^ 2) * sqrt n < ((d : Real) * K) * sqrt n := by convert hLK using 1 <;> ring have := lt_of_mul_lt_mul_right hLK' hsqrt.le exact le_of_lt ((div_lt_iff₀ hK).2 (by nlinarith [this])) change (L : Real) ^ 2 / K ≤ ((d - 1 : Nat) : Real) calc (L : Real) ^ 2 / K ≤ (d : Real) / 2 := by have ht' : 2 * ((L : Real) ^ 2 / K) ≤ (d : Real) := by calc 2 * ((L : Real) ^ 2 / K) = 2 * (L : Real) ^ 2 / K := by ring _ ≤ (d : Real) := htarget calc (L : Real) ^ 2 / K = (2 * ((L : Real) ^ 2 / K)) / 2 := by ring _ ≤ (d : Real) / 2 := div_le_div_of_nonneg_right ht' (by norm_num) _ ≤ ((d - 1 : Nat) : Real) := hkhalf · rw [min_eq_right (Nat.le_of_not_ge hcap)] have hscale : (L : Real) ^ 2 / K ≤ calibration.rareCountConstant * N * L / 2 := by have hrare : 4 * (calibration.degreeConstant + 1) / K * N ≤ calibration.rareCountConstant * N := mul_le_mul_of_nonneg_right hrK hN.le have hLN : (L : Real) ≤ (calibration.degreeConstant + 1) * N := hLupper.trans (mul_le_mul_of_nonneg_left hellN (by linarith [calibration.degreeConstant_pos])) have hrare' : 4 * (calibration.degreeConstant + 1) * N / K ≤ calibration.rareCountConstant * N := by convert hrare using 1 <;> ring have htwo : 2 * (L : Real) / K ≤ calibration.rareCountConstant * N := by have hLK : 2 * (L : Real) ≤ 4 * (calibration.degreeConstant + 1) * N := by nlinarith have := (div_le_div_iff_of_pos_right hK).2 hLK exact this.trans hrare' have hm := mul_le_mul_of_nonneg_right htwo hLpos.le calc (L : Real) ^ 2 / K = (2 * (L : Real) / K * L) / 2 := by ring _ ≤ (calibration.rareCountConstant * N * L) / 2 := div_le_div_of_nonneg_right hm (by norm_num) exact hscale.trans hfloorHalf
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.commonMarginal_rareCount_degree_lower · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalCalibration.lean:83
theorem commonMarginal_dimension_absorption

Either side of the capped rare-cell count supplies the corresponding dimension-rate lower bound. the stated conditions the stated conclusion.

Formal statement
C rho :
closure :
n m d L k :
hn :
1 ≤ n
hd :
2 ≤ d
hL :
L = ceil (calibration.degreeConstant * logEN n)
hk :
k = min (d - 1) ⌊calibration.rareCountConstant * (n + m : Nat) * L⌋₊
a :
ha :
a
= calibration.gamma * (calibration.bandwidthConstant * L / (n + m : Nat)) / (L : Real) ^ 2
calibration.dimensionConstant * commonMarginalDimensionTerm n m d
≤ (calibration.dualGap * k * a) ^ 2
Proof (Lean source)
lemma commonMarginal_dimension_absorption {eps : Real} {calibration : CommonMarginalCalibration eps} {C rho : Real} (closure : CommonMarginalCalibrationClosure calibration C rho) (n m d L k : Nat) (hn : 1 ≤ n) (hd : 2 ≤ d) (hL : L = ceil (calibration.degreeConstant * logEN n)) (hk : k = min (d - 1) ⌊calibration.rareCountConstant * (n + m : Nat) * L⌋₊) (a : Real) (ha : a = calibration.gamma * (calibration.bandwidthConstant * L / (n + m : Nat)) / (L : Real) ^ 2) : calibration.dimensionConstant * commonMarginalDimensionTerm n m d ≤ (calibration.dualGap * k * a) ^ 2 := by let N : Real := (n + m : Nat) let ell : Real := logEN n have hN : 0 < N := by dsimp [N]; positivity have hell : 0 < ell := commonMarginal_logEN_pos n hn have hLtwo := commonMarginal_degree_lower closure n L hn hL have hLpos : (0 : Real) < L := by exact_mod_cast (show 0 < L by omega) have hLupper := commonMarginal_degree_upper calibration n L hn hL have hxone : 1 ≤ calibration.rareCountConstant * N * L := by have hr := closure.rareCountFloor have hN1 : (1 : Real) ≤ N := by dsimp [N] exact_mod_cast (show 1 ≤ n + m by omega) have hrN : (4 : Real) ≤ calibration.rareCountConstant * N := by nlinarith [mul_le_mul hr hN1 (by norm_num : (0 : Real) ≤ 1) calibration.rareCountConstant_pos.le] have hL1 : (1 : Real) ≤ L := by exact_mod_cast (show 1 ≤ L by omega) have hm := mul_le_mul_of_nonneg_right hrN (by positivity : (0 : Real) ≤ L) nlinarith have hfloorHalf : calibration.rareCountConstant * N * L / 2 ≤ (⌊calibration.rareCountConstant * (n + m : Nat) * L⌋₊ : Real) := by simpa [N] using commonMarginal_half_le_floor hxone have ha' : a = calibration.gamma * calibration.bandwidthConstant / (N * L) := by rw [ha] dsimp [N] field_simp [ne_of_gt hLpos, ne_of_gt hN] subst k by_cases hcap : d - 1 ≤ ⌊calibration.rareCountConstant * (n + m : Nat) * L⌋₊ · rw [min_eq_left hcap] have hkcast : ((d - 1 : Nat) : Real) = (d : Real) - 1 := by rw [Nat.cast_sub (by omega)] norm_num have hdR : (2 : Real) ≤ d := by exact_mod_cast hd have hkhalf : (d : Real) / 2 ≤ (d - 1 : Nat) := by rw [hkcast] linarith have hterm : commonMarginalDimensionTerm n m d ≤ (d : Real) ^ 2 / (N ^ 2 * ell ^ 2) := by exact min_le_right _ _ have hdim := closure.dimensionBranch rw [ha'] have hD1 : 0 < calibration.degreeConstant + 1 := by linarith [calibration.degreeConstant_pos] have hdim0 : 0 ≤ calibration.dimensionConstant := calibration.dimensionConstant_pos.le have hterm0 : 0 ≤ commonMarginalDimensionTerm n m d := by unfold commonMarginalDimensionTerm positivity calc calibration.dimensionConstant * commonMarginalDimensionTerm n m d ≤ calibration.dimensionConstant * ((d : Real) ^ 2 / (N ^ 2 * ell ^ 2)) := mul_le_mul_of_nonneg_left hterm hdim0 _ ≤ (calibration.dualGap * calibration.gamma * calibration.bandwidthConstant / (2 * (calibration.degreeConstant + 1))) ^ 2 * ((d : Real) ^ 2 / (N ^ 2 * ell ^ 2)) := mul_le_mul_of_nonneg_right hdim (div_nonneg (sq_nonneg _) (mul_nonneg (sq_nonneg _) (sq_nonneg _))) _ ≤ (calibration.dualGap * (d - 1 : Nat) * (calibration.gamma * calibration.bandwidthConstant / (N * L))) ^ 2 := by have hdle : (d : Real) ≤ 2 * ((d - 1 : Nat) : Real) := by nlinarith [hkhalf] have hbase : calibration.dualGap * calibration.gamma * calibration.bandwidthConstant * (d : Real) / (2 * (calibration.degreeConstant + 1) * N * ell) ≤ calibration.dualGap * ((d - 1 : Nat) : Real) * (calibration.gamma * calibration.bandwidthConstant / (N * L)) := by rw [show calibration.dualGap * calibration.gamma * calibration.bandwidthConstant * (d : Real) / (2 * (calibration.degreeConstant + 1) * N * ell) = (calibration.dualGap * calibration.gamma * calibration.bandwidthConstant * (d : Real)) / ((2 * (calibration.degreeConstant + 1)) * (N * ell)) by ring, show calibration.dualGap * ((d - 1 : Nat) : Real) * (calibration.gamma * calibration.bandwidthConstant / (N * L)) = (calibration.dualGap * ((d - 1 : Nat) : Real) * (calibration.gamma * calibration.bandwidthConstant)) / (N * L) by ring] apply (div_le_div_iff₀ (show 0 < (2 * (calibration.degreeConstant + 1)) * (N * ell) by exact mul_pos (mul_pos (by norm_num) hD1) (mul_pos hN hell)) (mul_pos hN hLpos)).2 have hcore : (d : Real) * L ≤ (2 * ((d - 1 : Nat) : Real)) * ((calibration.degreeConstant + 1) * ell) := mul_le_mul hdle hLupper (Nat.cast_nonneg _) (by positivity) have hm := mul_le_mul_of_nonneg_left hcore (mul_nonneg (mul_nonneg calibration.dualGap_pos.le calibration.gamma_pos.le) calibration.bandwidthConstant_pos.le) nlinarith have hbase0 : 0 ≤ calibration.dualGap * calibration.gamma * calibration.bandwidthConstant * (d : Real) / (2 * (calibration.degreeConstant + 1) * N * ell) := by exact div_nonneg (mul_nonneg (mul_nonneg (mul_nonneg calibration.dualGap_pos.le calibration.gamma_pos.le) calibration.bandwidthConstant_pos.le) (Nat.cast_nonneg _)) (mul_nonneg (mul_nonneg (mul_nonneg (by norm_num : (0 : Real) ≤ 2) hD1.le) hN.le) hell.le) have hbaseR0 : 0 ≤ calibration.dualGap * ((d - 1 : Nat) : Real) * (calibration.gamma * calibration.bandwidthConstant / (N * L)) := by exact mul_nonneg (mul_nonneg calibration.dualGap_pos.le (Nat.cast_nonneg _)) (div_nonneg (mul_nonneg calibration.gamma_pos.le calibration.bandwidthConstant_pos.le) (mul_nonneg hN.le hLpos.le)) have hs := (sq_le_sq₀ hbase0 hbaseR0).2 hbase calc (calibration.dualGap * calibration.gamma * calibration.bandwidthConstant / (2 * (calibration.degreeConstant + 1))) ^ 2 * ((d : Real) ^ 2 / (N ^ 2 * ell ^ 2)) = (calibration.dualGap * calibration.gamma * calibration.bandwidthConstant * (d : Real) / (2 * (calibration.degreeConstant + 1) * N * ell)) ^ 2 := by field_simp [ne_of_gt hN, ne_of_gt hell, ne_of_gt hD1] _ ≤ _ := hs · rw [min_eq_right (Nat.le_of_not_ge hcap), ha'] have hgap : calibration.dualGap ^ 2 / 4 ≤ calibration.dualGap * (⌊calibration.rareCountConstant * (n + m : Nat) * L⌋₊ : Real) * (calibration.gamma * calibration.bandwidthConstant / (N * L)) := by rw [closure.rareCountIdentity] rw [closure.rareCountIdentity] at hfloorHalf have hgp := calibration.gamma_pos have hbp := calibration.bandwidthConstant_pos let t : Real := 2 * calibration.dualGap * calibration.gamma * calibration.bandwidthConstant / (N * L) have ht : 0 ≤ t := by dsimp [t] exact div_nonneg (mul_nonneg (mul_nonneg (mul_nonneg (by norm_num : (0 : Real) ≤ 2) calibration.dualGap_pos.le) calibration.gamma_pos.le) calibration.bandwidthConstant_pos.le) (mul_nonneg hN.le hLpos.le) have hm := mul_le_mul_of_nonneg_right hfloorHalf ht dsimp [t] at hm field_simp [ne_of_gt hN, ne_of_gt hLpos, ne_of_gt hgp, ne_of_gt hbp, ne_of_gt calibration.dualGap_pos] at hm ⊢ nlinarith have hgap0 : 0 ≤ calibration.dualGap ^ 2 / 4 := by positivity have hright0 : 0 ≤ calibration.dualGap * (⌊calibration.rareCountConstant * (n + m : Nat) * L⌋₊ : Real) * (calibration.gamma * calibration.bandwidthConstant / (N * L)) := by exact mul_nonneg (mul_nonneg calibration.dualGap_pos.le (Nat.cast_nonneg _)) (div_nonneg (mul_nonneg calibration.gamma_pos.le calibration.bandwidthConstant_pos.le) (mul_nonneg hN.le hLpos.le)) have hsquare := (sq_le_sq₀ hgap0 hright0).2 hgap have hterm : commonMarginalDimensionTerm n m d ≤ 1 := min_le_left _ _ calc calibration.dimensionConstant * commonMarginalDimensionTerm n m d ≤ calibration.dimensionConstant * 1 := mul_le_mul_of_nonneg_left hterm calibration.dimensionConstant_pos.le _ ≤ calibration.dualGap ^ 4 / 16 := by simpa using closure.dimensionRare _ = (calibration.dualGap ^ 2 / 4) ^ 2 := by ring _ ≤ _ := hsquare
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.commonMarginal_dimension_absorption · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalCalibration.lean:235
CausalSmith.Stat.STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research.Helpers.CommonMarginalFiniteLaw 36 declarations Explicit finite control-zero laws used by the common-marginal prior.

Explicit finite control-zero laws used by the common-marginal prior.

theorem measurable_comp_of_finite_range

the stated conditions establishes the stated conclusion.

Formal statement
alpha beta gamma :
hq :
hfinite :
(range q).Finite
f :
beta → gamma
Measurable (f ∘ q)
Proof (Lean source)
lemma measurable_comp_of_finite_range {alpha beta gamma : Type*} [MeasurableSpace alpha] [MeasurableSpace beta] [MeasurableSpace gamma] [MeasurableSingletonClass beta] {q : alpha → beta} (hq : Measurable q) (hfinite : (Set.range q).Finite) (f : beta → gamma) : Measurable (f ∘ q) := by intro s _ let t := f ⁻¹' s ∩ Set.range q have ht : t.Finite := hfinite.subset (Set.inter_subset_right) have htmeas : MeasurableSet t := ht.measurableSet have hpre := hq htmeas convert hpre using 1 ext x simp [t]
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.measurable_comp_of_finite_range · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalFiniteLaw.lean:11
def commonMarginalReservoir

the stated conditions defines the specified object.

Definition (Lean source)
d :
hd :
1 ≤ d
commonMarginalReservoir hd :
Fin d
⟨0, hd⟩
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.commonMarginalReservoir · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalFiniteLaw.lean:26
def commonMarginalRareCell

the stated conditions defines the specified object.

Definition (Lean source)
k d :
hkd :
k + 1 ≤ d
i :
Fin k
commonMarginalRareCell hkd i :
Fin d
⟨i.val + 1, lt_of_lt_of_le (Nat.add_lt_add_right i.isLt 1) hkd⟩
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.commonMarginalRareCell · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalFiniteLaw.lean:29
theorem commonMarginalRareCell_injective

the stated conditions establishes the stated conclusion.

Formal statement
k d :
hkd :
k + 1 ≤ d
Proof (Lean source)
lemma commonMarginalRareCell_injective {k d : Nat} (hkd : k + 1 ≤ d) : Injective (commonMarginalRareCell hkd) := by intro i j hij apply Fin.ext simpa [commonMarginalRareCell] using congrArg val hij
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.commonMarginalRareCell_injective · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalFiniteLaw.lean:33
theorem commonMarginalReservoir_ne_rareCell

the stated conditions establishes the stated conclusion.

Formal statement
k d :
hd :
1 ≤ d
hkd :
k + 1 ≤ d
i :
Fin k
Proof (Lean source)
lemma commonMarginalReservoir_ne_rareCell {k d : Nat} (hd : 1 ≤ d) (hkd : k + 1 ≤ d) (i : Fin k) : commonMarginalReservoir hd ≠ commonMarginalRareCell hkd i := by intro h have := congrArg val h simp [commonMarginalReservoir, commonMarginalRareCell] at this
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.commonMarginalReservoir_ne_rareCell · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalFiniteLaw.lean:40
def commonMarginalRawMass

the stated conditions defines the specified object.

Definition (Lean source)
k d :
hd :
1 ≤ d
hkd :
k + 1 ≤ d
reservoirMass :
w :
Fin k → Real
x :
Fin d
commonMarginalRawMass hd hkd reservoirMass w x :
(if x = commonMarginalReservoir hd then reservoirMass else 0) + ∑ i, if x
= commonMarginalRareCell hkd i then w i else 0
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.commonMarginalRawMass · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalFiniteLaw.lean:48
def commonMarginalPropensity

the stated conditions defines the specified object.

Definition (Lean source)
k d :
hd :
1 ≤ d
hkd :
k + 1 ≤ d
eps a :
w :
Fin k → Real
x :
Fin d
commonMarginalPropensity hd hkd eps a w x :
if x
= commonMarginalReservoir hd then 1 / 2 else let p := commonMarginalRawMass hd hkd 0 w x if p = 0 then 1 / 2 else eps * (p + a) / p
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.commonMarginalPropensity · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalFiniteLaw.lean:54
def commonMarginalOutcomeMean

the stated conditions defines the specified object.

Definition (Lean source)
k d :
hd :
1 ≤ d
hkd :
k + 1 ≤ d
sign :
branch :
w :
Fin k → Real
x :
Fin d
commonMarginalOutcomeMean hd hkd sign branch w x :
∑ i, if x = commonMarginalRareCell hkd i ∧
w i ≠ 0 then (1 + (if branch then sign (w i) else -sign (w i))) / 2 else 0
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.commonMarginalOutcomeMean · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalFiniteLaw.lean:62
def commonMarginalClampSign

the stated conditions defines the specified object.

Definition (Lean source)
s :
p :
commonMarginalClampSign s p :
max (-1) (min 1 (s p))
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.commonMarginalClampSign · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalFiniteLaw.lean:69
theorem commonMarginalClampSign_mem

The formal statement establishes the stated conclusion.

Formal statement
s :
p :
Proof (Lean source)
lemma commonMarginalClampSign_mem (s : Real → Real) (p : Real) : commonMarginalClampSign s p ∈ Icc (-1 : Real) 1 := by constructor <;> simp [commonMarginalClampSign]
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.commonMarginalClampSign_mem · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalFiniteLaw.lean:73
theorem commonMarginalClampSign_eq

the stated conditions establishes the stated conclusion.

Formal statement
s :
p :
hp :
s p ∈ Icc (-1 : Real) 1
Proof (Lean source)
lemma commonMarginalClampSign_eq {s : Real → Real} {p : Real} (hp : s p ∈ Icc (-1 : Real) 1) : commonMarginalClampSign s p = s p := by simp [commonMarginalClampSign, hp.1, hp.2]
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.commonMarginalClampSign_eq · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalFiniteLaw.lean:78
theorem commonMarginalRawMass_reservoir

the stated conditions establishes the stated conclusion.

Formal statement
k d :
hd :
1 ≤ d
hkd :
k + 1 ≤ d
reservoirMass :
w :
Fin k → Real
commonMarginalRawMass hd hkd reservoirMass w (commonMarginalReservoir hd) = reservoirMass
Proof (Lean source)
lemma commonMarginalRawMass_reservoir {k d : Nat} (hd : 1 ≤ d) (hkd : k + 1 ≤ d) (reservoirMass : Real) (w : Fin k → Real) : commonMarginalRawMass hd hkd reservoirMass w (commonMarginalReservoir hd) = reservoirMass := by simp [commonMarginalRawMass, commonMarginalReservoir_ne_rareCell]
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.commonMarginalRawMass_reservoir · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalFiniteLaw.lean:84
theorem commonMarginalRawMass_rare

the stated conditions establishes the stated conclusion.

Formal statement
k d :
hd :
1 ≤ d
hkd :
k + 1 ≤ d
reservoirMass :
w :
Fin k → Real
i :
Fin k
commonMarginalRawMass hd hkd reservoirMass w (commonMarginalRareCell hkd i) = w i
Proof (Lean source)
lemma commonMarginalRawMass_rare {k d : Nat} (hd : 1 ≤ d) (hkd : k + 1 ≤ d) (reservoirMass : Real) (w : Fin k → Real) (i : Fin k) : commonMarginalRawMass hd hkd reservoirMass w (commonMarginalRareCell hkd i) = w i := by rw [commonMarginalRawMass] simp only [if_neg (commonMarginalReservoir_ne_rareCell hd hkd i).symm, zero_add] rw [Finset.sum_eq_single i] · simp · intro j _ hji simp [(commonMarginalRareCell_injective hkd).ne hji |>.symm] · simp
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.commonMarginalRawMass_rare · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalFiniteLaw.lean:91
theorem commonMarginalPropensity_reservoir

the stated conditions establishes the stated conclusion.

Formal statement
k d :
hd :
1 ≤ d
hkd :
k + 1 ≤ d
eps a :
w :
Fin k → Real
Proof (Lean source)
lemma commonMarginalPropensity_reservoir {k d : Nat} (hd : 1 ≤ d) (hkd : k + 1 ≤ d) (eps a : Real) (w : Fin k → Real) : commonMarginalPropensity hd hkd eps a w (commonMarginalReservoir hd) = 1 / 2 := by simp [commonMarginalPropensity]
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.commonMarginalPropensity_reservoir · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalFiniteLaw.lean:103
theorem commonMarginalPropensity_rare

the stated conditions establishes the stated conclusion.

Formal statement
k d :
hd :
1 ≤ d
hkd :
k + 1 ≤ d
eps a :
w :
Fin k → Real
i :
Fin k
hi :
w i ≠ 0
= eps * (w i + a) / w i
Proof (Lean source)
lemma commonMarginalPropensity_rare {k d : Nat} (hd : 1 ≤ d) (hkd : k + 1 ≤ d) (eps a : Real) (w : Fin k → Real) (i : Fin k) (hi : w i ≠ 0) : commonMarginalPropensity hd hkd eps a w (commonMarginalRareCell hkd i) = eps * (w i + a) / w i := by rw [commonMarginalPropensity] simp only [if_neg (commonMarginalReservoir_ne_rareCell hd hkd i).symm] rw [commonMarginalRawMass_rare hd hkd 0 w i, if_neg hi]
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.commonMarginalPropensity_rare · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalFiniteLaw.lean:109
theorem commonMarginalOutcomeMean_reservoir

the stated conditions establishes the stated conclusion.

Formal statement
k d :
hd :
1 ≤ d
hkd :
k + 1 ≤ d
sign :
branch :
w :
Fin k → Real
Proof (Lean source)
lemma commonMarginalOutcomeMean_reservoir {k d : Nat} (hd : 1 ≤ d) (hkd : k + 1 ≤ d) (sign : Real → Real) (branch : Bool) (w : Fin k → Real) : commonMarginalOutcomeMean hd hkd sign branch w (commonMarginalReservoir hd) = 0 := by simp [commonMarginalOutcomeMean, commonMarginalReservoir_ne_rareCell]
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.commonMarginalOutcomeMean_reservoir · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalFiniteLaw.lean:119
theorem commonMarginalOutcomeMean_rare

the stated conditions establishes the stated conclusion.

Formal statement
k d :
hd :
1 ≤ d
hkd :
k + 1 ≤ d
sign :
branch :
w :
Fin k → Real
i :
Fin k
hi :
w i ≠ 0
= (1 + (if branch then sign (w i) else -sign (w i))) / 2
Proof (Lean source)
lemma commonMarginalOutcomeMean_rare {k d : Nat} (hd : 1 ≤ d) (hkd : k + 1 ≤ d) (sign : Real → Real) (branch : Bool) (w : Fin k → Real) (i : Fin k) (hi : w i ≠ 0) : commonMarginalOutcomeMean hd hkd sign branch w (commonMarginalRareCell hkd i) = (1 + (if branch then sign (w i) else -sign (w i))) / 2 := by rw [commonMarginalOutcomeMean, Finset.sum_eq_single i] · simp [hi] · intro j _ hji have hne := (commonMarginalRareCell_injective hkd).ne hji simp [hne.symm] · simp
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.commonMarginalOutcomeMean_rare · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalFiniteLaw.lean:125
theorem commonMarginalOutcomeMean_mem

the stated conditions establishes the stated conclusion.

Formal statement
k d :
hd :
1 ≤ d
hkd :
k + 1 ≤ d
sign :
hsign :
∀ p, sign p ∈ Icc (-1 : Real) 1
branch :
w :
Fin k → Real
x :
Fin d
commonMarginalOutcomeMean hd hkd sign branch w x ∈ Icc (0 : Real) 1
Proof (Lean source)
lemma commonMarginalOutcomeMean_mem {k d : Nat} (hd : 1 ≤ d) (hkd : k + 1 ≤ d) (sign : Real → Real) (hsign : ∀ p, sign p ∈ Icc (-1 : Real) 1) (branch : Bool) (w : Fin k → Real) (x : Fin d) : commonMarginalOutcomeMean hd hkd sign branch w x ∈ Icc (0 : Real) 1 := by by_cases hx : ∃ i, x = commonMarginalRareCell hkd i ∧ w i ≠ 0 · obtain ⟨i, hxi, hi⟩ := hx rw [hxi, commonMarginalOutcomeMean_rare hd hkd sign branch w i hi] cases branch <;> simp only [Bool.false_eq_true, if_false, if_true] · constructor <;> linarith [(hsign (w i)).1, (hsign (w i)).2] · constructor <;> linarith [(hsign (w i)).1, (hsign (w i)).2] · simp only [commonMarginalOutcomeMean] have hzero : (∑ i, if x = commonMarginalRareCell hkd i ∧ w i ≠ 0 then (1 + (if branch then sign (w i) else -sign (w i))) / 2 else 0) = 0 := by apply Finset.sum_eq_zero intro i _ rw [if_neg (fun hi => hx ⟨i, hi⟩)] rw [hzero] exact ⟨le_rfl, zero_le_one⟩
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.commonMarginalOutcomeMean_mem · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalFiniteLaw.lean:138
theorem commonMarginalRawMass_unused

the stated conditions establishes the stated conclusion.

Formal statement
k d :
hd :
1 ≤ d
hkd :
k + 1 ≤ d
reservoirMass :
w :
Fin k → Real
x :
Fin d
hx :
hxi :
∀ i, x ≠ commonMarginalRareCell hkd i
commonMarginalRawMass hd hkd reservoirMass w x = 0
Proof (Lean source)
lemma commonMarginalRawMass_unused {k d : Nat} (hd : 1 ≤ d) (hkd : k + 1 ≤ d) (reservoirMass : Real) (w : Fin k → Real) (x : Fin d) (hx : x ≠ commonMarginalReservoir hd) (hxi : ∀ i, x ≠ commonMarginalRareCell hkd i) : commonMarginalRawMass hd hkd reservoirMass w x = 0 := by simp [commonMarginalRawMass, hx, hxi]
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.commonMarginalRawMass_unused · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalFiniteLaw.lean:159
theorem commonMarginalRawMass_sum

the stated conditions establishes the stated conclusion.

Formal statement
k d :
hd :
1 ≤ d
hkd :
k + 1 ≤ d
reservoirMass :
w :
Fin k → Real
∑ x, commonMarginalRawMass hd hkd reservoirMass w x = reservoirMass + ∑ i, w i
Proof (Lean source)
lemma commonMarginalRawMass_sum {k d : Nat} (hd : 1 ≤ d) (hkd : k + 1 ≤ d) (reservoirMass : Real) (w : Fin k → Real) : ∑ x, commonMarginalRawMass hd hkd reservoirMass w x = reservoirMass + ∑ i, w i := by simp_rw [commonMarginalRawMass] rw [Finset.sum_add_distrib] rw [Finset.sum_ite_eq'] simp only [Finset.mem_univ, if_true] rw [Finset.sum_comm] apply congrArg (fun z => reservoirMass + z) apply Finset.sum_congr rfl intro i _ rw [Finset.sum_ite_eq'] simp
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.commonMarginalRawMass_sum · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalFiniteLaw.lean:167
theorem commonMarginalRawMass_nonneg

the stated conditions establishes the stated conclusion.

Formal statement
k d :
hd :
1 ≤ d
hkd :
k + 1 ≤ d
reservoirMass :
w :
Fin k → Real
hr :
0 ≤ reservoirMass
hw :
∀ i, 0 ≤ w i
x :
Fin d
0 ≤ commonMarginalRawMass hd hkd reservoirMass w x
Proof (Lean source)
lemma commonMarginalRawMass_nonneg {k d : Nat} (hd : 1 ≤ d) (hkd : k + 1 ≤ d) {reservoirMass : Real} {w : Fin k → Real} (hr : 0 ≤ reservoirMass) (hw : ∀ i, 0 ≤ w i) (x : Fin d) : 0 ≤ commonMarginalRawMass hd hkd reservoirMass w x := by unfold commonMarginalRawMass apply add_nonneg · split_ifs <;> positivity · apply Finset.sum_nonneg intro i _ split_ifs · exact hw i · exact le_rfl
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.commonMarginalRawMass_nonneg · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalFiniteLaw.lean:183
theorem commonMarginalRawMass_mul_outcome_sum

the stated conditions establishes the stated conclusion.

Formal statement
k d :
hd :
1 ≤ d
hkd :
k + 1 ≤ d
reservoirMass :
sign :
branch :
w :
Fin k → Real
∑ x, commonMarginalRawMass hd hkd reservoirMass w x * commonMarginalOutcomeMean hd hkd sign branch w x
= ∑ i, w i * (1 + (if branch then sign (w i) else -sign (w i))) / 2
Proof (Lean source)
lemma commonMarginalRawMass_mul_outcome_sum {k d : Nat} (hd : 1 ≤ d) (hkd : k + 1 ≤ d) (reservoirMass : Real) (sign : Real → Real) (branch : Bool) (w : Fin k → Real) : ∑ x, commonMarginalRawMass hd hkd reservoirMass w x * commonMarginalOutcomeMean hd hkd sign branch w x = ∑ i, w i * (1 + (if branch then sign (w i) else -sign (w i))) / 2 := by simp_rw [commonMarginalOutcomeMean, Finset.mul_sum] rw [Finset.sum_comm] apply Finset.sum_congr rfl intro i _ by_cases hi : w i = 0 · simp [hi] · rw [Finset.sum_eq_single (commonMarginalRareCell hkd i)] · rw [if_pos ⟨rfl, hi⟩, commonMarginalRawMass_rare] ring · intro x _ hxi simp [hxi] · simp
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.commonMarginalRawMass_mul_outcome_sum · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalFiniteLaw.lean:197
def finiteControlZeroAtom

the stated conditions defines the specified object.

Definition (Lean source)
d :
p e mu :
Fin d → Real
z :
Obs d
finiteControlZeroAtom p e mu z :
if z.2.1 then if z.2.2 then p z.1 * e z.1 * mu z.1 else p z.1 * e z.1 * (1 - mu z.1) else if z.2.2 then 0 else p z.1 * (1 - e z.1)
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.finiteControlZeroAtom · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalFiniteLaw.lean:217
theorem finiteControlZeroAtom_nonneg

the stated conditions establishes the stated conclusion.

Formal statement
d :
p e mu :
Fin d → Real
hp :
∀ x, p x ∈ Icc (0 : Real) 1
he :
∀ x, e x ∈ Icc (0 : Real) 1
hmu :
∀ x, mu x ∈ Icc (0 : Real) 1
z :
Obs d
0 ≤ finiteControlZeroAtom p e mu z
Proof (Lean source)
lemma finiteControlZeroAtom_nonneg {d : Nat} (p e mu : Fin d → Real) (hp : ∀ x, p x ∈ Icc (0 : Real) 1) (he : ∀ x, e x ∈ Icc (0 : Real) 1) (hmu : ∀ x, mu x ∈ Icc (0 : Real) 1) (z : Obs d) : 0 ≤ finiteControlZeroAtom p e mu z := by unfold finiteControlZeroAtom split_ifs <;> try positivity · exact mul_nonneg (mul_nonneg (hp _).1 (he _).1) (hmu _).1 · exact mul_nonneg (mul_nonneg (hp _).1 (he _).1) (sub_nonneg.mpr (hmu _).2) · exact mul_nonneg (hp _).1 (sub_nonneg.mpr (he _).2)
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.finiteControlZeroAtom_nonneg · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalFiniteLaw.lean:225
theorem finiteControlZeroAtom_sum

the stated conditions establishes the stated conclusion.

Formal statement
d :
p e mu :
Fin d → Real
hp :
∑ x, p x = 1
∑ z : Obs d, finiteControlZeroAtom p e mu z = 1
Proof (Lean source)
lemma finiteControlZeroAtom_sum {d : Nat} (p e mu : Fin d → Real) (hp : ∑ x, p x = 1) : ∑ z : Obs d, finiteControlZeroAtom p e mu z = 1 := by simp only [Fintype.sum_prod_type, Fintype.sum_bool, finiteControlZeroAtom, Bool.false_eq_true, if_false, if_true] calc ∑ x, (p x * e x * mu x + p x * e x * (1 - mu x) + (0 + p x * (1 - e x))) = ∑ x, p x := by apply Finset.sum_congr rfl intro x _ ring _ = 1 := hp
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.finiteControlZeroAtom_sum · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalFiniteLaw.lean:238
def finiteControlZeroLaw

the stated conditions defines the specified object.

Definition (Lean source)
d :
p e mu :
Fin d → Real
hp :
∀ x, p x ∈ Icc (0 : Real) 1
he :
∀ x, e x ∈ Icc (0 : Real) 1
hmu :
∀ x, mu x ∈ Icc (0 : Real) 1
hsum :
∑ x, p x = 1
finiteControlZeroLaw p e mu hp he hmu hsum :
pmf := PMF.ofFintype (fun z => ofReal (finiteControlZeroAtom p e mu z)) <| by rw [← ENNReal.ofReal_sum_of_nonneg (fun z _ => finiteControlZeroAtom_nonneg p e mu hp he hmu z), finiteControlZeroAtom_sum p e mu hsum] simp
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.finiteControlZeroLaw · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalFiniteLaw.lean:252
theorem finiteControlZeroLaw_jointMass

the stated conditions establishes the stated conclusion.

Formal statement
d :
p e mu :
Fin d → Real
hp :
∀ x, p x ∈ Icc (0 : Real) 1
he :
∀ x, e x ∈ Icc (0 : Real) 1
hmu :
∀ x, mu x ∈ Icc (0 : Real) 1
hsum :
∑ x, p x = 1
x :
Fin d
arm y :
jointMass (finiteControlZeroLaw p e mu hp he hmu hsum) x arm y
= finiteControlZeroAtom p e mu (x, arm, y)
Proof (Lean source)
lemma finiteControlZeroLaw_jointMass {d : Nat} (p e mu : Fin d → Real) (hp : ∀ x, p x ∈ Icc (0 : Real) 1) (he : ∀ x, e x ∈ Icc (0 : Real) 1) (hmu : ∀ x, mu x ∈ Icc (0 : Real) 1) (hsum : ∑ x, p x = 1) (x : Fin d) (arm y : Bool) : jointMass (finiteControlZeroLaw p e mu hp he hmu hsum) x arm y = finiteControlZeroAtom p e mu (x, arm, y) := by unfold jointMass finiteControlZeroLaw rw [PMF.ofFintype_apply, ENNReal.toReal_ofReal] exact finiteControlZeroAtom_nonneg p e mu hp he hmu (x, arm, y)
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.finiteControlZeroLaw_jointMass · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalFiniteLaw.lean:266
theorem finiteControlZeroLaw_cellMass

the stated conditions establishes the stated conclusion.

Formal statement
d :
p e mu :
Fin d → Real
hp :
∀ x, p x ∈ Icc (0 : Real) 1
he :
∀ x, e x ∈ Icc (0 : Real) 1
hmu :
∀ x, mu x ∈ Icc (0 : Real) 1
hsum :
∑ x, p x = 1
x :
Fin d
cellMass (finiteControlZeroLaw p e mu hp he hmu hsum) x = p x
Proof (Lean source)
lemma finiteControlZeroLaw_cellMass {d : Nat} (p e mu : Fin d → Real) (hp : ∀ x, p x ∈ Icc (0 : Real) 1) (he : ∀ x, e x ∈ Icc (0 : Real) 1) (hmu : ∀ x, mu x ∈ Icc (0 : Real) 1) (hsum : ∑ x, p x = 1) (x : Fin d) : cellMass (finiteControlZeroLaw p e mu hp he hmu hsum) x = p x := by unfold cellMass simp only [Fintype.sum_bool, finiteControlZeroLaw_jointMass p e mu hp he hmu hsum, finiteControlZeroAtom, Bool.false_eq_true, if_false, if_true] ring
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.finiteControlZeroLaw_cellMass · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalFiniteLaw.lean:279
theorem finiteControlZeroLaw_armMass

the stated conditions establishes the stated conclusion.

Formal statement
d :
p e mu :
Fin d → Real
hp :
∀ x, p x ∈ Icc (0 : Real) 1
he :
∀ x, e x ∈ Icc (0 : Real) 1
hmu :
∀ x, mu x ∈ Icc (0 : Real) 1
hsum :
∑ x, p x = 1
x :
Fin d
armMass (finiteControlZeroLaw p e mu hp he hmu hsum) x true = p x * e x
Proof (Lean source)
lemma finiteControlZeroLaw_armMass {d : Nat} (p e mu : Fin d → Real) (hp : ∀ x, p x ∈ Icc (0 : Real) 1) (he : ∀ x, e x ∈ Icc (0 : Real) 1) (hmu : ∀ x, mu x ∈ Icc (0 : Real) 1) (hsum : ∑ x, p x = 1) (x : Fin d) : armMass (finiteControlZeroLaw p e mu hp he hmu hsum) x true = p x * e x := by unfold armMass simp only [Fintype.sum_bool, finiteControlZeroLaw_jointMass p e mu hp he hmu hsum, finiteControlZeroAtom, Bool.false_eq_true, if_false, if_true] ring
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.finiteControlZeroLaw_armMass · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalFiniteLaw.lean:293
theorem finiteControlZeroLaw_armMass_false

the stated conditions establishes the stated conclusion.

Formal statement
d :
p e mu :
Fin d → Real
hp :
∀ x, p x ∈ Icc (0 : Real) 1
he :
∀ x, e x ∈ Icc (0 : Real) 1
hmu :
∀ x, mu x ∈ Icc (0 : Real) 1
hsum :
∑ x, p x = 1
x :
Fin d
armMass (finiteControlZeroLaw p e mu hp he hmu hsum) x false = p x * (1 - e x)
Proof (Lean source)
lemma finiteControlZeroLaw_armMass_false {d : Nat} (p e mu : Fin d → Real) (hp : ∀ x, p x ∈ Icc (0 : Real) 1) (he : ∀ x, e x ∈ Icc (0 : Real) 1) (hmu : ∀ x, mu x ∈ Icc (0 : Real) 1) (hsum : ∑ x, p x = 1) (x : Fin d) : armMass (finiteControlZeroLaw p e mu hp he hmu hsum) x false = p x * (1 - e x) := by unfold armMass simp only [Fintype.sum_bool, finiteControlZeroLaw_jointMass p e mu hp he hmu hsum, finiteControlZeroAtom, Bool.false_eq_true, if_false, if_true] ring
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.finiteControlZeroLaw_armMass_false · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalFiniteLaw.lean:307
theorem finiteControlZeroLaw_propensity

the stated conditions establishes the stated conclusion.

Formal statement
d :
p e mu :
Fin d → Real
hp :
∀ x, p x ∈ Icc (0 : Real) 1
he :
∀ x, e x ∈ Icc (0 : Real) 1
hmu :
∀ x, mu x ∈ Icc (0 : Real) 1
hsum :
∑ x, p x = 1
x :
Fin d
hx :
0 < p x
propensity (finiteControlZeroLaw p e mu hp he hmu hsum) x = e x
Proof (Lean source)
lemma finiteControlZeroLaw_propensity {d : Nat} (p e mu : Fin d → Real) (hp : ∀ x, p x ∈ Icc (0 : Real) 1) (he : ∀ x, e x ∈ Icc (0 : Real) 1) (hmu : ∀ x, mu x ∈ Icc (0 : Real) 1) (hsum : ∑ x, p x = 1) (x : Fin d) (hx : 0 < p x) : propensity (finiteControlZeroLaw p e mu hp he hmu hsum) x = e x := by rw [propensity, finiteControlZeroLaw_cellMass p e mu hp he hmu hsum, finiteControlZeroLaw_armMass p e mu hp he hmu hsum] field_simp [ne_of_gt hx]
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.finiteControlZeroLaw_propensity · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalFiniteLaw.lean:322
theorem finiteControlZeroLaw_outcomeMean_true

the stated conditions establishes the stated conclusion.

Formal statement
d :
p e mu :
Fin d → Real
hp :
∀ x, p x ∈ Icc (0 : Real) 1
he :
∀ x, e x ∈ Icc (0 : Real) 1
hmu :
∀ x, mu x ∈ Icc (0 : Real) 1
hsum :
∑ x, p x = 1
x :
Fin d
hx :
0 < p x * e x
outcomeMean (finiteControlZeroLaw p e mu hp he hmu hsum) true x = mu x
Proof (Lean source)
lemma finiteControlZeroLaw_outcomeMean_true {d : Nat} (p e mu : Fin d → Real) (hp : ∀ x, p x ∈ Icc (0 : Real) 1) (he : ∀ x, e x ∈ Icc (0 : Real) 1) (hmu : ∀ x, mu x ∈ Icc (0 : Real) 1) (hsum : ∑ x, p x = 1) (x : Fin d) (hx : 0 < p x * e x) : outcomeMean (finiteControlZeroLaw p e mu hp he hmu hsum) true x = mu x := by rw [outcomeMean, finiteControlZeroLaw_armMass p e mu hp he hmu hsum, finiteControlZeroLaw_jointMass] simp only [finiteControlZeroAtom, if_true] exact mul_div_cancel_left₀ (mu x) (ne_of_gt hx)
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.finiteControlZeroLaw_outcomeMean_true · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalFiniteLaw.lean:334
theorem finiteControlZeroLaw_outcomeMean_false

the stated conditions establishes the stated conclusion.

Formal statement
d :
p e mu :
Fin d → Real
hp :
∀ x, p x ∈ Icc (0 : Real) 1
he :
∀ x, e x ∈ Icc (0 : Real) 1
hmu :
∀ x, mu x ∈ Icc (0 : Real) 1
hsum :
∑ x, p x = 1
x :
Fin d
outcomeMean (finiteControlZeroLaw p e mu hp he hmu hsum) false x = 0
Proof (Lean source)
lemma finiteControlZeroLaw_outcomeMean_false {d : Nat} (p e mu : Fin d → Real) (hp : ∀ x, p x ∈ Icc (0 : Real) 1) (he : ∀ x, e x ∈ Icc (0 : Real) 1) (hmu : ∀ x, mu x ∈ Icc (0 : Real) 1) (hsum : ∑ x, p x = 1) (x : Fin d) : outcomeMean (finiteControlZeroLaw p e mu hp he hmu hsum) false x = 0 := by rw [outcomeMean, finiteControlZeroLaw_jointMass] simp [finiteControlZeroAtom]
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.finiteControlZeroLaw_outcomeMean_false · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalFiniteLaw.lean:347
theorem finiteControlZeroLaw_auxTable

the stated conditions establishes the stated conclusion.

Formal statement
d :
p e mu :
Fin d → Real
hp :
∀ x, p x ∈ Icc (0 : Real) 1
he :
∀ x, e x ∈ Icc (0 : Real) 1
hmu :
∀ x, mu x ∈ Icc (0 : Real) 1
hsum :
∑ x, p x = 1
auxTableOf (finiteControlZeroLaw p e mu hp he hmu hsum)
= fun z => if z.2 then p z.1 * e z.1 else p z.1 * (1 - e z.1)
Proof (Lean source)
lemma finiteControlZeroLaw_auxTable {d : Nat} (p e mu : Fin d → Real) (hp : ∀ x, p x ∈ Icc (0 : Real) 1) (he : ∀ x, e x ∈ Icc (0 : Real) 1) (hmu : ∀ x, mu x ∈ Icc (0 : Real) 1) (hsum : ∑ x, p x = 1) : auxTableOf (finiteControlZeroLaw p e mu hp he hmu hsum) = fun z => if z.2 then p z.1 * e z.1 else p z.1 * (1 - e z.1) := by funext z cases z with | mk x arm => cases arm · unfold auxTableOf armMass simp [finiteControlZeroLaw_jointMass, finiteControlZeroAtom] · simp [auxTableOf, finiteControlZeroLaw_armMass]
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.finiteControlZeroLaw_auxTable · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalFiniteLaw.lean:358
theorem finiteControlZeroLaw_model

the stated conditions establishes the stated conclusion.

Formal statement
d :
eps :
p e mu :
Fin d → Real
hp :
∀ x, p x ∈ Icc (0 : Real) 1
he :
∀ x, e x ∈ Icc (0 : Real) 1
hmu :
∀ x, mu x ∈ Icc (0 : Real) 1
hsum :
∑ x, p x = 1
hd :
2 ≤ d
heps :
0 < eps
hepsHalf :
eps < 1 / 2
hoverlap :
∀ x
if
0 < p x
then
eps ≤ e x ∧ e x ≤ 1 - eps
ModelClass d eps (finiteControlZeroLaw p e mu hp he hmu hsum)
Proof (Lean source)
lemma finiteControlZeroLaw_model {d : Nat} {eps : Real} (p e mu : Fin d → Real) (hp : ∀ x, p x ∈ Icc (0 : Real) 1) (he : ∀ x, e x ∈ Icc (0 : Real) 1) (hmu : ∀ x, mu x ∈ Icc (0 : Real) 1) (hsum : ∑ x, p x = 1) (hd : 2 ≤ d) (heps : 0 < eps) (hepsHalf : eps < 1 / 2) (hoverlap : ∀ x, 0 < p x → eps ≤ e x ∧ e x ≤ 1 - eps) : ModelClass d eps (finiteControlZeroLaw p e mu hp he hmu hsum) := by refine ⟨hd, heps, hepsHalf, ?_⟩ intro x hx rw [finiteControlZeroLaw_cellMass p e mu hp he hmu hsum] at hx rw [finiteControlZeroLaw_propensity p e mu hp he hmu hsum x hx] exact hoverlap x hx
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.finiteControlZeroLaw_model · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalFiniteLaw.lean:375
theorem finiteControlZeroLaw_ate

the stated conditions establishes the stated conclusion.

Formal statement
d :
eps :
p e mu :
Fin d → Real
hp :
∀ x, p x ∈ Icc (0 : Real) 1
he :
∀ x, e x ∈ Icc (0 : Real) 1
hmu :
∀ x, mu x ∈ Icc (0 : Real) 1
hsum :
∑ x, p x = 1
heps :
0 < eps
hoverlap :
∀ x
if
0 < p x
then
eps ≤ e x
ateFunctional (finiteControlZeroLaw p e mu hp he hmu hsum) = ∑ x, p x * mu x
Proof (Lean source)
lemma finiteControlZeroLaw_ate {d : Nat} {eps : Real} (p e mu : Fin d → Real) (hp : ∀ x, p x ∈ Icc (0 : Real) 1) (he : ∀ x, e x ∈ Icc (0 : Real) 1) (hmu : ∀ x, mu x ∈ Icc (0 : Real) 1) (hsum : ∑ x, p x = 1) (heps : 0 < eps) (hoverlap : ∀ x, 0 < p x → eps ≤ e x) : ateFunctional (finiteControlZeroLaw p e mu hp he hmu hsum) = ∑ x, p x * mu x := by unfold ateFunctional apply Finset.sum_congr rfl intro x _ rw [finiteControlZeroLaw_cellMass p e mu hp he hmu hsum, finiteControlZeroLaw_outcomeMean_false p e mu hp he hmu hsum] by_cases hx : p x = 0 · simp [hx] · have hpx : 0 < p x := lt_of_le_of_ne (hp x).1 (Ne.symm hx) have hex : 0 < e x := heps.trans_le (hoverlap x hpx) rw [finiteControlZeroLaw_outcomeMean_true p e mu hp he hmu hsum x (mul_pos hpx hex)] ring
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.finiteControlZeroLaw_ate · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalFiniteLaw.lean:391
CausalSmith.Stat.STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research.Helpers.CommonMarginalPoissonPrior 4 declarations Scale specialization of the common-marginal rare-cell prior.

Scale specialization of the common-marginal rare-cell prior.

structure CommonMarginalPoissonPriorFamily

The generalized all-bandwidth realization interface supplied by the uniform-intensity construction.

Definition (Lean source)
eps :
calibration :
C rho :
boundConstant_pos :
0 < C
rho_mem :
rho ∈ Ioo (0 : Real) 1
realize :
∀ (n m L : Nat),
1
≤ n → 2 ≤ L → ∀ (u v B a : Real) (k d : Nat), 2 ≤ d → 0 ≤ u → 0 ≤ v → 0 < u
+ v → (u + v) * B
≤ calibration.uniformBandwidthConstant * L → 0 < B → a = calibration.gamma * B / (L : Real) ^ 2 → k * a ≤ calibration.dualGap → k
+ 1
≤ d → ∃ R : CommonMarginalRecipe calibration n m d L B a k, CommonMarginalPoissonPriorWitness (u := u) (v := v) (C := C) (rho := rho) R
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.CommonMarginalPoissonPriorFamily · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalPoissonPrior.lean:12
structure CommonMarginalExactPoissonPriorWitness Definition aux_CommonMarginalExactPoissonPriorWitness in the paper ↗

A witness produced at an explicitly named exact bandwidth scale. Keeping the numerator constant and denominator as indices of the witness lets the uniform Poisson specialization use bε L / (u + v), while the C55 fixed-sample construction uses the different, paper-facing scale b₀ L / (n + m). Both remain strictly narrower than the inequality-only CommonMarginalPoissonPriorWitness.

Definition (Lean source)
n m d L k :
B a u v C rho :
bandwidthScale bandwidthDenominator :
R :
CommonMarginalRecipe calibration n m d L B a k
sampleSize_pos :
1 ≤ n
degree_ge_two :
2 ≤ L
dimension_ge_two :
2 ≤ d
labeledIntensity_nonneg :
0 ≤ u
auxiliaryIntensity_nonneg :
0 ≤ v
totalIntensity_pos :
0 < u + v
rareCount_fit :
k + 1 ≤ d
bandwidthDenominator_pos :
0 < bandwidthDenominator
bandwidth_eq :
B = bandwidthScale * L / bandwidthDenominator
bandwidth_bound :
(u + v) * B ≤ calibration.uniformBandwidthConstant * L
bandwidth_pos :
0 < B
shift_eq :
a = calibration.gamma * B / (L : Real) ^ 2
rareShiftSmall :
k * a ≤ calibration.dualGap
labeledIntensity_eq :
R.labeledIntensity = u
auxiliaryIntensity_eq :
R.auxiliaryIntensity = v
bounds :
CommonMarginalBounds R u v calibration.dualGap C rho
witness :
CommonMarginalPoissonPriorWitness (u := u) (v := v) (C := C) (rho := rho) R
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.CommonMarginalExactPoissonPriorWitness · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalPoissonPrior.lean:29

Quantitative closure of the canonical C55 recipe. These are outputs of the epsilon-only calibration construction, rather than premises imposed on the fixed-sample transfer or on the converse. Every clause refers to the single exact-bandwidth recipe stored in H.

Definition (Lean source)
n m d :
Cfixed cSmall cFloor C rho :
H :
CommonMarginalPriorHandle calibration n m d
degree_ge_two :
2 ≤ H.L
transferBandwidthConstants :
2 * Cfixed * calibration.bandwidthConstant ≤ calibration.uniformBandwidthConstant
bandwidthClosure :
≤ calibration.uniformBandwidthConstant * H.L
rareShiftSmall :
H.recipe.finiteAtomConstruction → H.k * H.a ≤ calibration.dualGap
poissonPriorWitness :
H.recipe.finiteAtomConstruction → CommonMarginalExactPoissonPriorWitness calibration.bandwidthConstant (n + m : Nat) H.recipe (u := commonMarginalLabeledIntensity Cfixed n) (v := commonMarginalAuxiliaryIntensity Cfixed n m) (C := C) (rho := rho)
bounds :
H.recipe.finiteAtomConstruction → CommonMarginalBounds H.recipe (commonMarginalLabeledIntensity Cfixed n) (commonMarginalAuxiliaryIntensity Cfixed n m) calibration.dualGap C rho
mixtureTV :
H.recipe.finiteAtomConstruction → tvDist H.recipe.rawExperiment0 H.recipe.rawExperiment1
≤ 1 / 8
centerSeparation :
H.recipe.finiteAtomConstruction → commonMarginalDelta H
≤ |rawPriorCenter H.recipe true - rawPriorCenter H.recipe false|
varianceAbsorption :
H.recipe.finiteAtomConstruction → H.k * H.B * H.a ≤ cSmall * commonMarginalDelta H ^ 2
transferredRisk :
H.recipe.finiteAtomConstruction → cFloor * commonMarginalDelta H ^ 2
≤ minimaxRisk n m d eps
floorRisk :
cFloor / n ≤ minimaxRisk n m d eps
dimensionNonparametric :
H.recipe.finiteAtomConstruction → calibration.dimensionConstant * commonMarginalDimensionTerm n m d
dimensionParametric :
¬H.recipe.finiteAtomConstruction → calibration.dimensionConstant * commonMarginalDimensionTerm n m d
≤ cFloor / n
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.CommonMarginalCanonicalCertificate · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalPoissonPrior.lean:60
theorem common_marginal_poisson_prior

The exact B = bε L / (u + v) specialization of the uniform-intensity common-marginal construction. the stated conditions the stated conclusion.

Formal statement
eps :
heps :
0 < eps
heps2 :
eps < 1 / 2
∃ calibration : CommonMarginalCalibration eps, ∃ C rho : Real,
0 < C
rho ∈ Ioo (0 : Real) 1
conclusion 1
n m L :
1 ≤ n
2 ≤ L
u v :
k d :
2 ≤ d
0 ≤ u
0 ≤ v
0 < u + v
B :
calibration.uniformBandwidthConstant * L / (u + v)
a :
calibration.gamma * B / (L : Real) ^ 2
k * a ≤ calibration.dualGap
k + 1 ≤ d
∃ R : CommonMarginalRecipe calibration n m d L B a k,
CommonMarginalExactPoissonPriorWitness calibration.uniformBandwidthConstant (u + v) (u := u) (v := v) (C := C) (rho := rho) R
Proof (Lean source)
lemma common_marginal_poisson_prior {eps : Real} (heps : 0 < eps) (heps2 : eps < 1 / 2) : ∃ calibration : CommonMarginalCalibration eps, ∃ C rho : Real, 0 < C ∧ rho ∈ Ioo (0 : Real) 1 ∧ ∀ (n m L : Nat), 1 ≤ n → 2 ≤ L → ∀ (u v : Real) (k d : Nat), 2 ≤ d → 0 ≤ u → 0 ≤ v → 0 < u + v → let B := calibration.uniformBandwidthConstant * L / (u + v) let a := calibration.gamma * B / (L : Real) ^ 2 k * a ≤ calibration.dualGap → k + 1 ≤ d → ∃ R : CommonMarginalRecipe calibration n m d L B a k, CommonMarginalExactPoissonPriorWitness calibration.uniformBandwidthConstant (u + v) (u := u) (v := v) (C := C) (rho := rho) R := by rcases common_marginal_uniform_intensity eps heps heps2 with ⟨calibration, C, rho, hC, hrho, _hclosure, hrealize⟩ refine ⟨calibration, C, rho, hC, hrho, ?_⟩ intro n m L hn hL u v k d hd hu hv huv dsimp only intro hka hkd let B : Real := calibration.uniformBandwidthConstant * L / (u + v) let a : Real := calibration.gamma * B / (L : Real) ^ 2 have hLpos : (0 : Real) < L := by exact_mod_cast (lt_of_lt_of_le (by omega : 0 < 2) hL) have hBpos : 0 < B := by exact div_pos (mul_pos calibration.uniformBandwidthConstant_pos hLpos) huv have hband : (u + v) * B ≤ calibration.uniformBandwidthConstant * L := by have huv_ne : u + v ≠ 0 := ne_of_gt huv dsimp [B] field_simp exact le_rfl rcases hrealize n m L hn hL u v B a k d hd hu hv huv hband hBpos (by rfl) hka hkd with ⟨R, hRu, hRv, _hprior0, _hprior1, hbounds⟩ refine ⟨R, ?_⟩ exact { sampleSize_pos := hn degree_ge_two := hL dimension_ge_two := hd labeledIntensity_nonneg := hu auxiliaryIntensity_nonneg := hv totalIntensity_pos := huv rareCount_fit := hkd bandwidthDenominator_pos := huv bandwidth_eq := rfl bandwidth_bound := hband bandwidth_pos := hBpos shift_eq := rfl rareShiftSmall := hka labeledIntensity_eq := hRu auxiliaryIntensity_eq := hRv bounds := hbounds witness := { bandwidth_bound := hband bandwidth_pos := hBpos shift_eq := rfl rareShiftSmall := hka labeledIntensity_eq := hRu auxiliaryIntensity_eq := hRv bounds := hbounds } }
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.common_marginal_poisson_prior · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalPoissonPrior.lean:110
CausalSmith.Stat.STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research.Helpers.CommonMarginalPoissonReindex 5 declarations Finite reindexing identities for the common-marginal Poisson experiment.

Finite reindexing identities for the common-marginal Poisson experiment.

theorem poissonMeasure_zero

The formal statement establishes the stated conclusion.

Formal statement
poissonMeasure 0 = Measure.dirac 0
Proof (Lean source)
theorem poissonMeasure_zero : poissonMeasure 0 = Measure.dirac 0 := by ext s hs rw [poissonMeasure, Measure.sum_apply _ hs] refine (tsum_eq_single 0 ?_).trans ?_ · intro n hn rw [Measure.smul_apply, smul_eq_mul] simp [zero_pow hn] · simp
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.poissonMeasure_zero · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalPoissonReindex.lean:11
theorem rawCellZeroLaw

The formal statement establishes the stated conclusion.

Formal statement
(Measure.pi fun _ : Bool => ((poissonMeasure 0).prod (poissonMeasure 0)).prod (poissonMeasure 0))
= Measure.dirac (fun _ : Bool => ((0, 0), 0))
Proof (Lean source)
theorem rawCellZeroLaw : (Measure.pi fun _ : Bool => ((poissonMeasure 0).prod (poissonMeasure 0)).prod (poissonMeasure 0)) = Measure.dirac (fun _ : Bool => ((0, 0), 0)) := by simp only [poissonMeasure_zero] simp only [Measure.dirac_prod_dirac] refine Measure.pi_eq fun s hs => ?_ by_cases h0 : ((0, 0), 0) ∈ s false <;> by_cases h1 : ((0, 0), 0) ∈ s true <;> simp [Measure.dirac_apply', hs, h0, h1]
def rareObservationToCell

Regroup the five rare-cell counts into the Boolean arm table used by the raw experiment. the stated conclusion.

Definition (Lean source)
rareObservationToCell :
((Nat × Nat) × (Nat × (Nat × Nat))) → Bool → (Nat × Nat) × Nat
fun z arm => if arm then (z.1, z.2.1) else ((0, z.2.2.1), z.2.2.2)
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.rareObservationToCell · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalPoissonReindex.lean:34
theorem prod_map_insertZero

Inserting a deterministic zero coordinate commutes with a binary product law. the stated conclusion.

Formal statement
(mu.prod nu).map (fun z => ((0, z.1), z.2)) = ((Measure.dirac 0).prod mu).prod nu
Proof (Lean source)
theorem prod_map_insertZero (mu nu : Measure Nat) [IsProbabilityMeasure mu] [IsProbabilityMeasure nu] : (mu.prod nu).map (fun z => ((0, z.1), z.2)) = ((Measure.dirac 0).prod mu).prod nu := by change (mu.prod nu).map (map (Prod.mk 0) id) = _ rw [← Measure.map_prod_map mu nu (by fun_prop : Measurable (Prod.mk 0)) measurable_id] rw [← Measure.dirac_prod] simp
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.prod_map_insertZero · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalPoissonReindex.lean:39
theorem fiveProduct_map_rareObservationToCell

The nested five-factor product, after regrouping, is exactly the two-arm product law. the stated conclusion.

Formal statement
(((mu11.prod mu10).prod (mu1a.prod (mu00.prod mu0a))).map rareObservationToCell)
= Measure.pi fun arm : Bool => if arm then (mu11.prod mu10).prod mu1a else ((Measure.dirac 0).prod mu00).prod mu0a
Proof (Lean source)
theorem fiveProduct_map_rareObservationToCell (mu11 mu10 mu1a mu00 mu0a : Measure Nat) [IsProbabilityMeasure mu11] [IsProbabilityMeasure mu10] [IsProbabilityMeasure mu1a] [IsProbabilityMeasure mu00] [IsProbabilityMeasure mu0a] : (((mu11.prod mu10).prod (mu1a.prod (mu00.prod mu0a))).map rareObservationToCell) = Measure.pi fun arm : Bool => if arm then (mu11.prod mu10).prod mu1a else ((Measure.dirac 0).prod mu00).prod mu0a := by let treated : Measure ((Nat × Nat) × Nat) := (mu11.prod mu10).prod mu1a let control : Measure ((Nat × Nat) × Nat) := ((Measure.dirac 0).prod mu00).prod mu0a have hregroup : (((mu11.prod mu10).prod (mu1a.prod (mu00.prod mu0a))).map (fun z => (((0, z.2.2.1), z.2.2.2), (z.1, z.2.1)))) = control.prod treated := by rw [← Measure.prodAssoc_prod] rw [Measure.map_map (by fun_prop) MeasurableEquiv.prodAssoc.measurable] change Measure.map (swap ∘ map id (fun z : Nat × Nat => ((0, z.1), z.2))) (treated.prod (mu00.prod mu0a)) = _ rw [← Measure.map_map (by fun_prop) (by fun_prop)] rw [← Measure.map_prod_map treated (mu00.prod mu0a) measurable_id (by fun_prop : Measurable fun z : Nat × Nat => ((0, z.1), z.2))] rw [prod_map_insertZero] simpa [treated, control, Function.comp_def] using (Measure.prod_swap (μ := treated) (ν := control)) rw [← prod_map_boolArrow control treated] rw [← hregroup, Measure.map_map (by fun_prop) (by fun_prop)] rfl
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.fiveProduct_map_rareObservationToCell · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalPoissonReindex.lean:49
CausalSmith.Stat.STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research.Helpers.CommonMarginalPoissonTransport 20 declarations Countable Poisson splitting and total-variation transport helpers.

Countable Poisson splitting and total-variation transport helpers.

theorem tvDist_bind_le

Total variation contracts under a common Markov kernel. the stated conclusion.

Formal statement
tvDist (K ∘ₘ mu) (K ∘ₘ nu) ≤ tvDist mu nu
Proof (Lean source)
theorem tvDist_bind_le {X Y : Type*} [MeasurableSpace X] [MeasurableSpace Y] (mu nu : Measure X) [IsProbabilityMeasure mu] [IsProbabilityMeasure nu] (K : Kernel X Y) [IsMarkovKernel K] : tvDist (K ∘ₘ mu) (K ∘ₘ nu) ≤ tvDist mu nu := by let _ : IsProbabilityMeasure (K ∘ₘ mu) := by infer_instance let _ : IsProbabilityMeasure (K ∘ₘ nu) := by infer_instance unfold tvDist apply ciSup_le rintro ⟨A, hA⟩ have hreal (rho : Measure X) [IsProbabilityMeasure rho] : (K ∘ₘ rho).real A = ∫ x, (K x A).toReal ∂rho := by rw [measureReal_def, Measure.bind_apply hA K.aemeasurable, integral_toReal (K.measurable_coe hA).aemeasurable] filter_upwards with x exact measure_lt_top (K x) A rw [hreal mu, hreal nu] have hrange : ∀ x, (K x A).toReal ∈ Icc (0 : Real) 1 := by intro x constructor · exact ENNReal.toReal_nonneg · have hle := ENNReal.toReal_mono (measure_ne_top (K x) _) (measure_mono (Set.subset_univ A)) simpa using hle simpa only [zero_add, mul_one, tvDist] using tvDist_integral_range mu nu (fun x => (K x A).toReal) (K.measurable_coe hA).ennreal_toReal 0 1 (by norm_num) (by simpa using hrange)
theorem kernel_comp_priorPredictive

Post-processing commutes with formation of a prior-predictive law. the stated conclusion.

Formal statement
pi :
Measure Theta
K :
Kernel Theta X
T :
Kernel X Y
T ∘ₘ priorPredictive pi K
= priorPredictive pi (T ∘ₖ K)
Proof (Lean source)
theorem kernel_comp_priorPredictive {Theta X Y : Type*} [MeasurableSpace Theta] [MeasurableSpace X] [MeasurableSpace Y] (pi : Measure Theta) (K : Kernel Theta X) (T : Kernel X Y) : T ∘ₘ priorPredictive pi K = priorPredictive pi (T ∘ₖ K) := by unfold priorPredictive exact Measure.comp_assoc
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.kernel_comp_priorPredictive · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalPoissonTransport.lean:44
theorem tvDist_priorPredictive_eq_of_fiber_sub_eq

Prior-predictive TV depends only on the pointwise difference of kernel masses. the stated conditions the stated conclusion.

Formal statement
Theta X :
K0 K1 J0 J1 :
Kernel Theta X
hK0 :
hK1 :
hJ0 :
hJ1 :
hdiff :
∀ theta A
then
(K0 theta).real A - (K1 theta).real A = (J0 theta).real A - (J1 theta).real A
Proof (Lean source)
theorem tvDist_priorPredictive_eq_of_fiber_sub_eq {Theta X : Type*} [MeasurableSpace Theta] [MeasurableSpace X] (pi : Measure Theta) [IsProbabilityMeasure pi] (K0 K1 J0 J1 : Kernel Theta X) (hK0 : ∀ theta, IsProbabilityMeasure (K0 theta)) (hK1 : ∀ theta, IsProbabilityMeasure (K1 theta)) (hJ0 : ∀ theta, IsProbabilityMeasure (J0 theta)) (hJ1 : ∀ theta, IsProbabilityMeasure (J1 theta)) (hdiff : ∀ theta A, MeasurableSet A → (K0 theta).real A - (K1 theta).real A = (J0 theta).real A - (J1 theta).real A) : tvDist (priorPredictive pi K0) (priorPredictive pi K1) = tvDist (priorPredictive pi J0) (priorPredictive pi J1) := by have hreal (K : Kernel Theta X) (hK : ∀ theta, IsProbabilityMeasure (K theta)) (A : Set X) (hA : MeasurableSet A) : (priorPredictive pi K).real A = ∫ theta, (K theta).real A ∂pi := by change (priorPredictive pi K).real A = ∫ theta, (K theta A).toReal ∂pi rw [measureReal_def, priorPredictive_apply _ _ hA, integral_toReal (K.measurable_coe hA).aemeasurable] filter_upwards with theta let _ := hK theta exact measure_lt_top _ _ have hint (K : Kernel Theta X) (hK : ∀ theta, IsProbabilityMeasure (K theta)) (A : Set X) (hA : MeasurableSet A) : Integrable (fun theta => (K theta).real A) pi := by apply Integrable.of_bound (K.measurable_coe hA).ennreal_toReal.aestronglyMeasurable 1 filter_upwards with theta rw [Real.norm_eq_abs, abs_of_nonneg ENNReal.toReal_nonneg] let _ := hK theta have hle := ENNReal.toReal_mono (measure_ne_top (K theta) _) (measure_mono (Set.subset_univ A)) simpa using hle unfold tvDist congr 1 ext A rcases A with ⟨A, hA⟩ simp only rw [hreal K0 hK0 A hA, hreal K1 hK1 A hA, hreal J0 hJ0 A hA, hreal J1 hJ1 A hA, ← integral_sub (hint K0 hK0 A hA) (hint K1 hK1 A hA), ← integral_sub (hint J0 hJ0 A hA) (hint J1 hJ1 A hA)] congr 2 with theta exact hdiff theta A hA
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.tvDist_priorPredictive_eq_of_fiber_sub_eq · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalPoissonTransport.lean:54
def poissonSplitEmbed

the stated conditions defines the specified object.

Definition (Lean source)
n j :
poissonSplitEmbed n j :
Nat × Nat
(j, n - j)
def poissonSplitMeasure

Given a total count, split it according to a binomial draw. the stated conditions the stated conclusion.

Definition (Lean source)
n :
poissonSplitMeasure q n :
∑ j ∈ range (n + 1), (binomial n q) {j} • Measure.dirac (poissonSplitEmbed n j)
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.poissonSplitMeasure · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalPoissonTransport.lean:111
instance poissonSplitMeasure_isProbabilityMeasure

the stated conditions defines the specified object.

Definition (Lean source)
noncomputable instance poissonSplitMeasure_isProbabilityMeasure (q : unitInterval) (n : Nat) : IsProbabilityMeasure (poissonSplitMeasure q n) := ⟨poissonSplitMeasure_univ q n⟩
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.poissonSplitMeasure_isProbabilityMeasure · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalPoissonTransport.lean:132
def poissonSplitKernel

The binomial splitting law as a countable-state Markov kernel. the stated conditions the stated conclusion.

Definition (Lean source)
poissonSplitKernel q :
Kernel.ofFunOfCountable (poissonSplitMeasure q)
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.poissonSplitKernel · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalPoissonTransport.lean:139
instance poissonSplitKernel_isMarkovKernel

the stated conditions defines the specified object.

Definition (Lean source)
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.poissonSplitKernel_isMarkovKernel · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalPoissonTransport.lean:143
theorem poissonSplitKernel_comp_poisson

Splitting a Poisson count binomially produces two independent Poisson counts. the stated conditions the stated conclusion.

Formal statement
u v r :
hu :
0 ≤ u
hv :
0 ≤ v
hr :
0 ≤ r
ht :
0 < u + v
poissonSplitKernel (⟨u / (u + v), by constructor · positivity · rw [div_le_one ht] linarith⟩ : unitInterval) ∘ₘ poissonMeasure (toNNReal ((u + v) * r))
Proof (Lean source)
theorem poissonSplitKernel_comp_poisson (u v r : Real) (hu : 0 ≤ u) (hv : 0 ≤ v) (hr : 0 ≤ r) (ht : 0 < u + v) : poissonSplitKernel (⟨u / (u + v), by constructor · positivity · rw [div_le_one ht] linarith⟩ : unitInterval) ∘ₘ poissonMeasure (toNNReal ((u + v) * r)) = (poissonMeasure (toNNReal (u * r))).prod (poissonMeasure (toNNReal (v * r))) := by let q : unitInterval := ⟨u / (u + v), by constructor · positivity · rw [div_le_one ht] linarith⟩ apply Measure.ext_of_measureReal_singleton rintro ⟨k, s⟩ have hreal : (poissonSplitKernel q ∘ₘ poissonMeasure (toNNReal ((u + v) * r))).real {(k, s)} = ∫ n, (poissonSplitMeasure q n).real {(k, s)} ∂poissonMeasure (toNNReal ((u + v) * r)) := by rw [measureReal_def, Measure.bind_apply (measurableSet_singleton _) (by fun_prop), ← integral_toReal (by fun_prop)] · apply integral_congr_ae filter_upwards with n rfl · filter_upwards with n exact measure_lt_top _ _ change (poissonSplitKernel q ∘ₘ poissonMeasure (toNNReal ((u + v) * r))).real {(k, s)} = _ rw [hreal, integral_countable (by apply Integrable.of_bound (by fun_prop) 1 filter_upwards with n rw [Real.norm_eq_abs, abs_of_nonneg measureReal_nonneg] exact (measureReal_mono (Set.subset_univ _) (measure_ne_top _ _)).trans_eq (by simp))] simp only [smul_eq_mul] rw [show (fun n : Nat => (poissonMeasure (toNNReal ((u + v) * r))).real {n} * (poissonSplitMeasure q n).real {(k, s)}) = fun n => if n = k + s then (poissonMeasure (toNNReal ((u + v) * r))).real {n} * (binomial (k + s) q).real {k} else 0 by funext n simp only [measureReal_def] rw [poissonSplitMeasure_singleton] split_ifs <;> simp_all] rw [tsum_ite_eq (k + s), prod_real_singleton] exact poisson_binomial_split u v r hu hv hr ht k s
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.poissonSplitKernel_comp_poisson · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalPoissonTransport.lean:223
def coordinatewiseKernel

Apply the same countable-state kernel independently in finitely many coordinates. the stated conditions the stated conclusion.

Definition (Lean source)
I X Y :
K :
Kernel X Y
coordinatewiseKernel K :
Kernel (I → X) (I → Y)
Kernel.ofFunOfCountable fun x => Measure.pi fun i => K (x i)
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.coordinatewiseKernel · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalPoissonTransport.lean:279
theorem coordinatewiseKernel_apply

Applying a kernel coordinatewise at an input array equals the product measure of its coordinatewise applications.

Formal statement
I X Y :
K :
Kernel X Y
x :
I → X
coordinatewiseKernel K x = Measure.pi fun i => K (x i)
Proof (Lean source)
@[simp] theorem coordinatewiseKernel_apply {I X Y : Type*} [Fintype I] [MeasurableSpace X] [Countable (I → X)] [MeasurableSingletonClass (I → X)] [MeasurableSpace Y] (K : Kernel X Y) (x : I → X) : coordinatewiseKernel K x = Measure.pi fun i => K (x i) := rfl
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.coordinatewiseKernel_apply · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalPoissonTransport.lean:286
instance coordinatewiseKernel_isMarkovKernel

the stated conditions defines the specified object.

Definition (Lean source)
noncomputable instance coordinatewiseKernel_isMarkovKernel {I X Y : Type*} [Fintype I] [MeasurableSpace X] [Countable (I → X)] [MeasurableSingletonClass (I → X)] [MeasurableSpace Y] (K : Kernel X Y) [IsMarkovKernel K] : IsMarkovKernel (coordinatewiseKernel K : Kernel (I → X) (I → Y)) where isProbabilityMeasure x := by change IsProbabilityMeasure (Measure.pi fun i => K (x i)) infer_instance
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.coordinatewiseKernel_isMarkovKernel · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalPoissonTransport.lean:292
theorem tvDist_pi_iid_le_bound

A one-coordinate TV bound tensorizes across an i.i.d. finite product. the stated conditions the stated conclusion.

Formal statement
X :
k :
delta :
h :
tvDist mu nu ≤ delta
tvDist (Measure.pi fun _ : Fin k => mu) (Measure.pi fun _ : Fin k => nu)
≤ k * delta
Proof (Lean source)
theorem tvDist_pi_iid_le_bound {X : Type*} [MeasurableSpace X] (k : Nat) (mu nu : Measure X) [IsProbabilityMeasure mu] [IsProbabilityMeasure nu] (delta : Real) (h : tvDist mu nu ≤ delta) : tvDist (Measure.pi fun _ : Fin k => mu) (Measure.pi fun _ : Fin k => nu) ≤ k * delta := by exact (tvDist_pi_iid_le k mu nu).trans (mul_le_mul_of_nonneg_left h (Nat.cast_nonneg k))
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.tvDist_pi_iid_le_bound · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalPoissonTransport.lean:303
def markedControlSplitKernel

Split only the aggregate control coordinate of a marked-Poisson observation. the stated conditions the stated conclusion.

Definition (Lean source)
markedControlSplitKernel q :
Kernel.id ∥ₖ (Kernel.id ∥ₖ poissonSplitKernel q)
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.markedControlSplitKernel · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalPoissonTransport.lean:313
instance markedControlSplitKernel_isMarkovKernel

the stated conditions defines the specified object.

Definition (Lean source)
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.markedControlSplitKernel_isMarkovKernel · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalPoissonTransport.lean:319
theorem markedControlSplitKernel_comp_markedPoissonLaw

The marked-Poisson law after control splitting, with all five raw rates exposed. the stated conditions the stated conclusion.

Formal statement
eps a u v :
h :
branch :
p :
hu :
0 ≤ u
hv :
0 ≤ v
hcontrol :
0
≤ controlMass eps a p
ht :
0 < u + v
markedControlSplitKernel (⟨u / (u + v), by constructor · positivity · rw [div_le_one ht] linarith⟩ : unitInterval) ∘ₘ markedPoissonLaw eps a u v h branch p
= ((poissonMeasure (toNNReal (u * treatedMass eps a p * (1 + branchMark branch (h p)) / 2))).prod (poissonMeasure (toNNReal (u * treatedMass eps a p * (1 - branchMark branch (h p)) / 2)))).prod ((poissonMeasure (toNNReal (v * treatedMass eps a p))).prod ((poissonMeasure (toNNReal (u * controlMass eps a p))).prod (poissonMeasure (toNNReal (v * controlMass eps a p)))))
Proof (Lean source)
theorem markedControlSplitKernel_comp_markedPoissonLaw (eps a u v : Real) (h : Real → Real) (branch : Bool) (p : Real) (hu : 0 ≤ u) (hv : 0 ≤ v) (hcontrol : 0 ≤ controlMass eps a p) (ht : 0 < u + v) : markedControlSplitKernel (⟨u / (u + v), by constructor · positivity · rw [div_le_one ht] linarith⟩ : unitInterval) ∘ₘ markedPoissonLaw eps a u v h branch p = ((poissonMeasure (toNNReal (u * treatedMass eps a p * (1 + branchMark branch (h p)) / 2))).prod (poissonMeasure (toNNReal (u * treatedMass eps a p * (1 - branchMark branch (h p)) / 2)))).prod ((poissonMeasure (toNNReal (v * treatedMass eps a p))).prod ((poissonMeasure (toNNReal (u * controlMass eps a p))).prod (poissonMeasure (toNNReal (v * controlMass eps a p))))) := by let q : unitInterval := ⟨u / (u + v), by constructor · positivity · rw [div_le_one ht] linarith⟩ change markedControlSplitKernel q ∘ₘ markedPoissonLaw eps a u v h branch p = _ unfold markedPoissonLaw unfold markedControlSplitKernel rw [← Measure.prod_comp_right, ← Measure.prod_comp_right] dsimp [q] rw [poissonSplitKernel_comp_poisson u v (controlMass eps a p) hu hv hcontrol ht]
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.markedControlSplitKernel_comp_markedPoissonLaw · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalPoissonTransport.lean:326
def finitePadding

Pad an injectively indexed family and one distinguished coordinate by a fixed value on all unused coordinates. the stated conditions the stated conclusion.

Definition (Lean source)
I J Y :
f :
I → J
r :
J
y0 :
Y
finitePadding f r y0 :
((I → Y) × Y) → J → Y
fun zy j
=> if hj : j = r then zy.2 else if hi : ∃ i, j = f i then zy.1 (choose hi) else y0
def finitePaddedMeasure

Coordinate laws corresponding to finitePadding. the stated conditions the stated conclusion.

Definition (Lean source)
f :
I → J
r :
J
mu :
I → Measure Y
nu :
y0 :
Y
finitePaddedMeasure f r mu nu y0 :
J → Measure Y
fun j
=> if hj : j = r then nu else if hi : ∃ i, j = f i then mu (choose hi) else Measure.dirac y0
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.finitePaddedMeasure · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalPoissonTransport.lean:386
theorem pi_prod_map_finitePadding Lemma 23 in the paper ↗

Pad an injectively indexed finite product and one distinguished coordinate by a fixed value on all unused coordinates. the stated conditions the stated conclusion.

Formal statement
f :
I → J
r :
J
hf :
hr :
∀ i, r ≠ f i
mu :
I → Measure Y
nu :
y0 :
Y
∀ i, IsProbabilityMeasure (mu i)
((Measure.pi mu).prod nu).map (finitePadding f r y0)
= Measure.pi (finitePaddedMeasure f r mu nu y0)
Proof (Lean source)
theorem pi_prod_map_finitePadding {I J Y : Type*} [Fintype I] [Fintype J] [DecidableEq J] [MeasurableSpace Y] [MeasurableSingletonClass Y] (f : I → J) (r : J) (hf : Injective f) (hr : ∀ i, r ≠ f i) (mu : I → Measure Y) (nu : Measure Y) (y0 : Y) [∀ i, IsProbabilityMeasure (mu i)] [IsProbabilityMeasure nu] : ((Measure.pi mu).prod nu).map (finitePadding f r y0) = Measure.pi (finitePaddedMeasure f r mu nu y0) := by classical let pad : ((I → Y) × Y) → J → Y := finitePadding f r y0 have hchoose (i : I) (hi : ∃ i', f i = f i') : choose hi = i := by apply hf exact (Classical.choose_spec hi).symm have hpad_meas : Measurable pad := by refine measurable_pi_lambda _ fun j => ?_ by_cases hj : j = r · simpa [pad, finitePadding, hj] using measurable_snd · by_cases hi : ∃ i, j = f i · simp only [pad, finitePadding, hj, hi, ↓reduceDIte] exact (measurable_pi_apply (choose hi)).comp measurable_fst · simp only [pad, finitePadding, hj, hi, ↓reduceDIte] exact measurable_const letI : ∀ j, SigmaFinite (finitePaddedMeasure f r mu nu y0 j) := fun j => by unfold finitePaddedMeasure split · exact IsFiniteMeasure.toSigmaFinite nu · split · exact IsFiniteMeasure.toSigmaFinite (mu _) · exact IsFiniteMeasure.toSigmaFinite (Measure.dirac y0) symm refine Measure.pi_eq (μ := finitePaddedMeasure f r mu nu y0) fun s hs => ?_ simp only [finitePaddedMeasure] rw [Measure.map_apply hpad_meas (MeasurableSet.pi Set.countable_univ fun j _ => hs j)] by_cases hbad : ∃ j, j ≠ r ∧ (∀ i, j ≠ f i) ∧ y0 ∉ s j · obtain ⟨j, hjr, hjf, hj0⟩ := hbad have hpre : pad ⁻¹' (Set.univ.pi s) = ∅ := by ext zy constructor · intro hz have := hz j (Set.mem_univ j) simp only [pad, finitePadding] at this rw [dif_neg hjr, dif_neg (not_exists.mpr hjf)] at this exact (hj0 this).elim · intro hz simpa using hz rw [hpre, measure_empty] symm apply Finset.prod_eq_zero (Finset.mem_univ j) rw [dif_neg hjr, dif_neg (not_exists.mpr hjf), Measure.dirac_apply' y0 (hs j)] simp [hj0] · push_neg at hbad have hpre : pad ⁻¹' (Set.univ.pi s) = (Set.univ.pi fun i => s (f i)) ×ˢ s r := by ext zy simp only [Set.mem_preimage, Set.mem_pi, Set.mem_univ, true_implies, Set.mem_prod] constructor · intro hz constructor · intro i simpa [pad, finitePadding, (hr i).symm, hchoose i] using hz (f i) · simpa [pad, finitePadding] using hz r · rintro ⟨hzi, hzr⟩ j by_cases hjr : j = r · simpa [pad, finitePadding, hjr] using hzr · by_cases hjf : ∃ i, j = f i · have hj : j = f (choose hjf) := Classical.choose_spec hjf rw [show pad zy j = zy.1 (choose hjf) by simp only [pad, finitePadding, hjr, hjf, ↓reduceDIte]] rw [congrArg s hj] exact hzi (choose hjf) · simpa [pad, finitePadding, hjr, hjf] using hbad j hjr (not_exists.mp hjf) rw [hpre, Measure.prod_prod, Measure.pi_pi] have hcoord (i : I) : (if hj : f i = r then nu else if hi : ∃ i', f i = f i' then mu (choose hi) else Measure.dirac y0) (s (f i)) = mu i (s (f i)) := by simp [show f i ≠ r from (hr i).symm, hchoose i] have hunused (j : J) (hjr : j ≠ r) (hjf : ∀ i, j ≠ f i) : (if hj : j = r then nu else if hi : ∃ i, j = f i then mu (choose hi) else Measure.dirac y0) (s j) = 1 := by rw [dif_neg hjr, dif_neg (not_exists.mpr hjf), Measure.dirac_apply' y0 (hs j)] simp [hbad j hjr hjf] rw [← Finset.prod_erase_mul _ _ (Finset.mem_univ r)] simp only [if_pos] apply congrArg (fun z => z * nu (s r)) symm calc ∏ j ∈ Finset.univ.erase r, (if hj : j = r then nu else if hi : ∃ i, j = f i then mu (choose hi) else Measure.dirac y0) (s j) = ∏ j ∈ Finset.univ.image f, (if hj : j = r then nu else if hi : ∃ i, j = f i then mu (choose hi) else Measure.dirac y0) (s j) := by apply (Finset.prod_subset ?_ ?_).symm · intro j hj simp only [mem_image, Finset.mem_univ, true_and] at hj obtain ⟨i, rfl⟩ := hj exact Finset.mem_erase.mpr ⟨(hr i).symm, Finset.mem_univ _⟩ · intro j hj jhimage rw [hunused j (Finset.mem_erase.mp hj).1] intro i hji apply jhimage exact Finset.mem_image.mpr ⟨i, Finset.mem_univ i, hji.symm⟩ _ = ∏ i, (if hj : f i = r then nu else if hi : ∃ i', f i = f i' then mu (choose hi) else Measure.dirac y0) (s (f i)) := Finset.prod_image hf.injOn _ = ∏ i, mu i (s (f i)) := Finset.prod_congr rfl fun i _ => hcoord i
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.pi_prod_map_finitePadding · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalPoissonTransport.lean:396
theorem prod_map_boolArrow

A binary product, written as a Boolean-indexed random function. the stated conclusion.

Formal statement
Y :
muFalse muTrue :
(muFalse.prod muTrue).map (fun z arm => if arm then z.2 else z.1)
= Measure.pi fun arm : Bool => if arm then muTrue else muFalse
Proof (Lean source)
theorem prod_map_boolArrow {Y : Type*} [MeasurableSpace Y] (muFalse muTrue : Measure Y) [IsProbabilityMeasure muFalse] [IsProbabilityMeasure muTrue] : (muFalse.prod muTrue).map (fun z arm => if arm then z.2 else z.1) = Measure.pi fun arm : Bool => if arm then muTrue else muFalse := by classical symm refine Measure.pi_eq (μ := fun arm : Bool => if arm then muTrue else muFalse) fun s hs => ?_ have hfun : Measurable (fun (z : Y × Y) (arm : Bool) => if arm then z.2 else z.1) := by refine measurable_pi_lambda _ fun arm => ?_ cases arm <;> simp only [Bool.false_eq_true, if_false, if_true] · exact measurable_fst · exact measurable_snd rw [Measure.map_apply hfun (MeasurableSet.pi Set.countable_univ fun arm _ => hs arm)] have hpre : (fun z arm => if arm then z.2 else z.1) ⁻¹' Set.univ.pi s = s false ×ˢ s true := by ext z simp only [Set.mem_preimage, Set.mem_pi, Set.mem_univ, true_implies, Set.mem_prod] constructor · intro hz exact ⟨by simpa using hz false, by simpa using hz true⟩ · rintro ⟨hf, ht⟩ arm cases arm <;> assumption rw [hpre, Measure.prod_prod] simp [Fintype.prod_bool, mul_comm]
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.prod_map_boolArrow · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalPoissonTransport.lean:513
CausalSmith.Stat.STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research.Helpers.CommonMarginalPrior 22 declarations Auxiliary-invariant fuzzy priors and their uniform-intensity certificate.

Auxiliary-invariant fuzzy priors and their uniform-intensity certificate.

instance instMeasurableSpaceDiscreteLaw

This declaration defines the specified object.

Definition (Lean source)
noncomputable instance {d : Nat} : MeasurableSpace (DiscreteLaw d) := ⊤
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.instMeasurableSpaceDiscreteLaw · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalPrior.lean:26
def RawPoissonCounts

Raw cell counts: independent labeled Y=1 and Y=0 counts, followed by the auxiliary (X,A) count. the stated conditions the stated conclusion.

Definition (Lean source)
d :
RawPoissonCounts d :
Type
Fin d → Bool → (Nat × Nat) × Nat
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.RawPoissonCounts · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalPrior.lean:30
def rawPoissonLaw

The explicit raw marked-Poisson law of one normalized finite law. the stated conditions the stated conclusion.

Definition (Lean source)
d :
P :
scale u v :
rawPoissonLaw P scale u v :
Measure.pi fun x
=> Measure.pi fun arm => ((poissonMeasure (toNNReal (u * scale * markedMass P x arm))).prod (poissonMeasure (toNNReal (u * scale * (armMass P x arm - markedMass P x arm))))).prod (poissonMeasure (toNNReal (v * scale * armMass P x arm)))
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.rawPoissonLaw · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalPrior.lean:34

The load-bearing constants chosen once for a fixed overlap level. The handle bandwidth is the paper's b₀, while uniformBandwidthConstant is the larger bε allowance used by the uniform-intensity construction.

Definition (Lean source)
eps :
regimeConstant :
regimeConstant_pos :
0 < regimeConstant
degreeConstant :
degreeConstant_pos :
0 < degreeConstant
bandwidthConstant :
bandwidthConstant_pos :
0 < bandwidthConstant
uniformBandwidthConstant :
uniformBandwidthConstant_pos :
0 < uniformBandwidthConstant
gamma :
gamma_pos :
0 < gamma
rareCountConstant :
rareCountConstant_pos :
0 < rareCountConstant
dualGap :
dualGap_pos :
0 < dualGap
dualGap_le_quarter :
dualGap ≤ 1 / 4
dimensionConstant :
dimensionConstant_pos :
0 < dimensionConstant
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.CommonMarginalCalibration · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalPrior.lean:47

A pair of priors at one realized finite-atom scale. The epsilon-only calibration is fixed before the instance indices; L, B, a, and k are indices of the recipe rather than consequences of a canonical n + m scale.

Definition (Lean source)
eps :
calibration :
n m d L :
B a :
k :
finiteAtomConstruction :
Prop
kappa :
degree_ge_two :
finiteAtomConstruction → 2 ≤ L
bandwidth_pos :
finiteAtomConstruction → 0 < B
shift_eq :
finiteAtomConstruction → a = calibration.gamma * B / (L : Real) ^ 2
kappa_eq :
kappa = (1 - 2 * eps) / eps
rareCount_le :
k ≤ d - 1
reservoir :
Fin d
reservoir_is_first :
reservoir.val = 0
rareCell :
Fin k → Fin d
rareCell_injective :
Injective rareCell
reservoir_ne_rare :
∀ i, reservoir ≠ rareCell i
outcomeSign :
outcomeSign_mem :
∀ p, outcomeSign p ∈ Icc (-1 : Real) 1
generator :
Measure (Fin k → Real)
generatorProbability :
sigmaVariationProbability :
IsProbabilityMeasure sigma.variation
sigma_support :
finiteAtomConstruction → ∀ᵐ p ∂sigma.variation, p ∈ Icc (a / kappa) B
outcomeSign_integrable :
Integrable outcomeSign sigma.variation
sigma_density :
sigma = sigma.variation.withDensityᵥ outcomeSign
nu :
nuProbability :
nu_eq :
finiteAtomConstruction → nu
= sigma.variation.withDensity (fun p ↦ ofReal (a / (p + a)))
+ ofReal (1 - ∫ p, a / (p + a) ∂sigma.variation) • Measure.dirac 0
generator_eq_iid :
generator = Measure.pi (fun _ : Fin k => nu)
generator_support :
finiteAtomConstruction → ∀ᵐ w ∂generator, ∀ i, w i = 0 ∨ w i ∈ Icc (a / kappa) B
dual0 :
dual1 :
dualProbability0 :
dualProbability1 :
dualSupport0 :
finiteAtomConstruction → ∀ᵐ p ∂dual0, p ∈ Icc (a / kappa) B
dualSupport1 :
finiteAtomConstruction → ∀ᵐ p ∂dual1, p ∈ Icc (a / kappa) B
dualMomentMatch :
finiteAtomConstruction → ∀ j : Nat, j ≤ L → ∫ p, p ^ j ∂dual0 = ∫ p, p ^ j ∂dual1
dualSeparation :
finiteAtomConstruction → calibration.dualGap
≤ ∫ p, p / (p + a) ∂dual1 - ∫ p, p / (p + a) ∂dual0
sigmaMomentZero :
finiteAtomConstruction → ∀ j : Nat, j ≤ L → ∫ᵛ p, p ^ j ∂<•sigma = 0
sigmaSeparation :
finiteAtomConstruction → calibration.dualGap ≤ ∫ᵛ p, p / (p + a) ∂<•sigma
lawOf :
Bool → (Fin k → Real) → DiscreteLaw d
lawOf_measurable :
∀ branch, Measurable (lawOf branch)
rawMass :
(Fin k → Real) → Fin d → Real
rawTotalMass :
(Fin k → Real) → Real
rawTarget :
Bool → (Fin k → Real) → Real
rawMass_sum :
∀ᵐ w ∂generator, rawTotalMass w = ∑ x, rawMass w x
rawMass_pos :
∀ᵐ w ∂generator, 0 < rawTotalMass w
rareRawMass :
finiteAtomConstruction → ∀ᵐ w ∂generator, ∀ i, rawMass w (rareCell i) = w i
reservoirRawMass :
finiteAtomConstruction → ∀ᵐ w ∂generator, rawMass w reservoir
= 1 - ∑ i, ∫ z, z i ∂generator
unusedRawMass :
∀ᵐ w ∂generator, ∀ x, x ≠ reservoir → (∀ i, x ≠ rareCell i) → rawMass w x = 0
normalization :
∀ branch, ∀ᵐ w ∂generator, ∀ x, cellMass (lawOf branch w) x = rawMass w x / rawTotalMass w
rawTarget_formula :
∀ branch,
∀ᵐ w ∂generator, rawTarget branch w = rawTotalMass w * ateFunctional (lawOf branch w)
rawScale :
rawScale_measurable :
Measurable rawScale
rawScale_lawOf :
∀ branch, ∀ᵐ w ∂generator, rawScale (lawOf branch w) = rawTotalMass w
commonTable_pointwise :
∀ᵐ w ∂generator, auxTableOf (lawOf false w) = auxTableOf (lawOf true w)
rareTreatmentMass :
finiteAtomConstruction → ∀ branch, ∀ᵐ w ∂generator, ∀ i, w i
≠ 0 → armMass (lawOf branch w) (rareCell i) true = eps * (w i + a) / rawTotalMass w
reservoirPropensity :
∀ branch, ∀ᵐ w ∂generator, propensity (lawOf branch w) reservoir = 1 / 2
controlOutcomeZero :
∀ branch, ∀ᵐ w ∂generator, ∀ x, outcomeMean (lawOf branch w) false x = 0
reservoirTreatedOutcomeZero :
finiteAtomConstruction → ∀ branch, ∀ᵐ w ∂generator, outcomeMean (lawOf branch w) true reservoir
= 0
rareOutcomeMeans :
finiteAtomConstruction → ∀ᵐ w ∂generator, ∀ i, w i
≠ 0 → outcomeMean (lawOf false w) true (rareCell i) = (1 - outcomeSign (w i)) / 2 ∧
outcomeMean (lawOf true w) true (rareCell i) = (1 + outcomeSign (w i)) / 2
parametricShape :
¬finiteAtomConstruction → ∀ᵐ w ∂generator, calibration.dualGap / sqrt n
≤ 1 / 4 ∧
cellMass (lawOf false w) reservoir = 1 ∧
cellMass (lawOf true w) reservoir = 1 ∧
outcomeMean (lawOf false w) true reservoir = 1 / 2 - calibration.dualGap / sqrt n ∧
outcomeMean (lawOf true w) true reservoir = 1 / 2 + calibration.dualGap / sqrt n
model0 :
∀ᵐ w ∂generator, ModelClass d eps (lawOf false w)
model1 :
∀ᵐ w ∂generator, ModelClass d eps (lawOf true w)
prior0 :
prior1 :
prior0_eq :
prior0 = generator.map (lawOf false)
prior1_eq :
prior1 = generator.map (lawOf true)
probability0 :
probability1 :
priorModel0 :
∀ᵐ P ∂prior0, ModelClass d eps P
priorModel1 :
∀ᵐ P ∂prior1, ModelClass d eps P
labeledIntensity :
auxiliaryIntensity :
experimentKernel :
experimentKernel_eq :
∀ P, experimentKernel P = rawPoissonLaw P (rawScale P) labeledIntensity auxiliaryIntensity
rawExperiment0 :
rawExperiment1 :
rawExperiment0_eq :
rawExperiment0
= priorPredictive prior0 experimentKernel
rawExperiment1_eq :
rawExperiment1
= priorPredictive prior1 experimentKernel
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.CommonMarginalRecipe · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalPrior.lean:69

The law of the random full treatment-covariate table under a prior. the stated conditions the stated conclusion.

Definition (Lean source)
d :
Pi :
randomAuxTableLaw Pi :
Pi.map auxTableOf
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.randomAuxTableLaw · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalPrior.lean:194
def rawPriorCenter

Center of the unnormalized target induced directly from the atom generator. the stated conditions the stated conclusion.

Definition (Lean source)
n m d L k :
B a :
R :
CommonMarginalRecipe calibration n m d L B a k
branch :
rawPriorCenter R branch :
∫ w, R.rawTarget branch w ∂R.generator
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.rawPriorCenter · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalPrior.lean:198
def generatorVariance

Variance of the unnormalized mass or target over the atom generator. the stated conditions the stated conclusion.

Definition (Lean source)
n m d L k :
B a :
R :
CommonMarginalRecipe calibration n m d L B a k
f :
(Fin k → Real) → Real
generatorVariance R f :
∫ w, (f w - ∫ z, f z ∂R.generator) ^ 2 ∂R.generator
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.generatorVariance · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalPrior.lean:204

A quantitative certificate for one common-marginal rare-cell recipe.

Definition (Lean source)
n m d L k :
B a :
R :
CommonMarginalRecipe calibration n m d L B a k
u v c C rho :
finiteAtomConstruction :
R.finiteAtomConstruction
class0 :
∀ᵐ P ∂R.prior0, ModelClass d eps P
class1 :
∀ᵐ P ∂R.prior1, ModelClass d eps P
sameTable :
separation :
c * k * a ≤ |rawPriorCenter R true - rawPriorCenter R false|
massMean :
∫ w, R.rawTotalMass w ∂R.generator = 1
mass_memLp_two :
MemLp R.rawTotalMass 2 R.generator
target_memLp_two :
∀ branch, MemLp (R.rawTarget branch) 2 R.generator
massVariance :
generatorVariance R R.rawTotalMass ≤ C * k * B * a
targetVariance :
max (generatorVariance R (R.rawTarget false)) (generatorVariance R (R.rawTarget true))
≤ C * k * B * a
mixtureTV :
tvDist R.rawExperiment0 R.rawExperiment1 ≤ C * u * k * a * rho ^ L
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.CommonMarginalBounds · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalPrior.lean:211

Provenance certificate for a realized finite-atom scale produced by the common-marginal Poisson-prior construction.

Definition (Lean source)
n m d L k :
B a u v C rho :
R :
CommonMarginalRecipe calibration n m d L B a k
bandwidth_bound :
(u + v) * B ≤ calibration.uniformBandwidthConstant * L
bandwidth_pos :
0 < B
shift_eq :
a = calibration.gamma * B / (L : Real) ^ 2
rareShiftSmall :
k * a ≤ calibration.dualGap
labeledIntensity_eq :
R.labeledIntensity = u
auxiliaryIntensity_eq :
R.auxiliaryIntensity = v
bounds :
CommonMarginalBounds R u v calibration.dualGap C rho
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.CommonMarginalPoissonPriorWitness · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalPrior.lean:230
def commonMarginalRecipePriorOf

The null or alternative prior belonging to an arbitrary calibrated recipe. This projection is used by the scale-robust Poisson lemmas; the paper-facing commonMarginalPriorOf below additionally enforces the regime and C55 scales. the stated conditions the stated conclusion.

Definition (Lean source)
n m d L k :
B a :
R :
CommonMarginalRecipe calibration n m d L B a k
branch :
commonMarginalRecipePriorOf R branch :
if branch then R.prior1 else R.prior0
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.commonMarginalRecipePriorOf · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalPrior.lean:244

The low-dimensional branch in the paper's regime-dependent prior handle. the stated conditions the stated conclusion.

Definition (Lean source)
eps :
calibration :
n m d :
commonMarginalParametricRegime calibration n m d :
Prop
min 1 ((d : Real) ^ 2 / (((n + m : Nat) : Real) ^ 2 * logEN n ^ 2))
≤ calibration.regimeConstant / (n : Real)
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.commonMarginalParametricRegime · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalPrior.lean:253

A paper-facing prior handle. It stores one recipe, chosen only after the /-- This declaration defines the specified object. -/ instance indices, and pins its branch and all four approximation-dual scales to the formulas in the note. In particular, C55 uses the treatment--covariate information size n + m; the fixed-sample multiplier does not enter this bandwidth.

Definition (Lean source)
eps :
calibration :
n m d :
L :
B :
a :
k :
recipe :
CommonMarginalRecipe calibration n m d L B a k
branchCondition :
recipe.finiteAtomConstruction ↔ ¬commonMarginalParametricRegime calibration n m d
degree_eq :
L = ceil (calibration.degreeConstant * logEN n)
bandwidth_eq :
B = calibration.bandwidthConstant * L / (n + m : Nat)
shift_eq :
a = calibration.gamma * B / (L : Real) ^ 2
rareCount_eq :
k = min (d - 1) ⌊calibration.rareCountConstant * (n + m : Nat) * L⌋₊
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.CommonMarginalPriorHandle · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalPrior.lean:260
def commonMarginalPriorOf

The null or alternative prior from the uniquely supplied regime-dependent handle. Both branches project from the identical calibrated recipe. the stated conditions the stated conclusion.

Definition (Lean source)
n m d :
H :
CommonMarginalPriorHandle calibration n m d
branch :
commonMarginalPriorOf H branch :
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.commonMarginalPriorOf · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalPrior.lean:282
theorem commonMarginalPriorOf_isProbabilityMeasure Lemma commonMarginalPriorOf_isProbabilityMeasure in the paper ↗

The formal statement establishes the stated conclusion.

Formal statement
n m d :
H :
CommonMarginalPriorHandle calibration n m d
branch :
Proof (Lean source)
lemma commonMarginalPriorOf_isProbabilityMeasure {eps : Real} {calibration : CommonMarginalCalibration eps} {n m d : Nat} (H : CommonMarginalPriorHandle calibration n m d) (branch : Bool) : IsProbabilityMeasure (commonMarginalPriorOf H branch) := by cases branch · change IsProbabilityMeasure H.recipe.prior0 exact H.recipe.probability0 · change IsProbabilityMeasure H.recipe.prior1 exact H.recipe.probability1
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.commonMarginalPriorOf_isProbabilityMeasure · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalPrior.lean:291
theorem map_auxMarginal_commonMarginalPriorOf_eq Lemma map_auxMarginal_commonMarginalPriorOf_eq in the paper ↗

The formal statement establishes the stated conclusion.

Formal statement
Proof (Lean source)
lemma map_auxMarginal_commonMarginalPriorOf_eq {eps : Real} {calibration : CommonMarginalCalibration eps} {n m d : Nat} (H : CommonMarginalPriorHandle calibration n m d) : randomAuxTableLaw (commonMarginalPriorOf H false) = randomAuxTableLaw (commonMarginalPriorOf H true) := by change randomAuxTableLaw H.recipe.prior0 = randomAuxTableLaw H.recipe.prior1 unfold randomAuxTableLaw rw [H.recipe.prior0_eq, H.recipe.prior1_eq] rw [Measure.map_map (by fun_prop) (H.recipe.lawOf_measurable false), Measure.map_map (by fun_prop) (H.recipe.lawOf_measurable true)] exact Measure.map_congr H.recipe.commonTable_pointwise
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.map_auxMarginal_commonMarginalPriorOf_eq · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalPrior.lean:302
def commonMarginalLabeledIntensity

The exact labeled intensity used by the fixed-sample coupling. the stated conditions the stated conclusion.

Definition (Lean source)
Cfixed :
n :
commonMarginalLabeledIntensity Cfixed n :
Cfixed * n
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.commonMarginalLabeledIntensity · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalPrior.lean:316
def commonMarginalAuxiliaryIntensity

The exact auxiliary intensity used by the fixed-sample coupling. the stated conditions the stated conclusion.

Definition (Lean source)
Cfixed :
n m :
commonMarginalAuxiliaryIntensity Cfixed n m :
Cfixed * (n + m)
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.commonMarginalAuxiliaryIntensity · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalPrior.lean:320
def commonMarginalDelta

The C55 lower-bound separation attached to the recipe stored in H. the stated conditions the stated conclusion.

Definition (Lean source)
n m d :
H :
CommonMarginalPriorHandle calibration n m d
commonMarginalDelta H :
calibration.dualGap * H.k * H.a
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.commonMarginalDelta · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalPrior.lean:324
def commonMarginalDimensionTerm

The dimension-dependent part of the annotation-frontier rate. the stated conditions the stated conclusion.

Definition (Lean source)
n m d :
commonMarginalDimensionTerm n m d :
min 1 ((d : Real) ^ 2 / (((n + m : Nat) : Real) ^ 2 * logEN n ^ 2))
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.commonMarginalDimensionTerm · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalPrior.lean:330
structure CommonMarginalCalibrationClosure

Quantitative facts retained from the explicit epsilon-only calibration.

Definition (Lean source)
eps :
calibration :
C rho :
bandwidthSlack :
131072 * calibration.bandwidthConstant ≤ calibration.uniformBandwidthConstant
degreeFloor :
2 ≤ calibration.degreeConstant
rareScale :
calibration.rareCountConstant * calibration.gamma * calibration.bandwidthConstant
≤ calibration.dualGap
rareCountIdentity :
calibration.rareCountConstant
= calibration.dualGap / (2 * calibration.gamma * calibration.bandwidthConstant)
rareCountFloor :
4 ≤ calibration.rareCountConstant
dimensionFloor :
calibration.dimensionConstant * calibration.regimeConstant ≤ 1 / 65536
varianceBandwidth :
8 * (calibration.degreeConstant + 1) * calibration.bandwidthConstant
≤ calibration.dualGap ^ 3 / (65536 * C)
rareCountLower :
4 * (calibration.degreeConstant + 1) / ((1 / (65536 * C)) * calibration.dualGap ^ 2 * calibration.gamma)
≤ calibration.rareCountConstant
regimeScale :
(4 * (calibration.degreeConstant + 1) ^ 2 / ((1 / (65536 * C)) * calibration.dualGap ^ 2 * calibration.gamma)) ^ 2
≤ calibration.regimeConstant
dimensionRare :
calibration.dimensionConstant ≤ calibration.dualGap ^ 4 / 16
dimensionBranch :
calibration.dimensionConstant
≤ (calibration.dualGap * calibration.gamma * calibration.bandwidthConstant / (2 * (calibration.degreeConstant + 1))) ^ 2
mixtureDecay :
∀ n : Nat
if
1 ≤ n
then
C * (65536 * (n : Real)) * calibration.dualGap * rho ^ ceil (calibration.degreeConstant * logEN n)
≤ 1 / 8
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.CommonMarginalCalibrationClosure · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalPrior.lean:349
theorem common_marginal_uniform_intensity Lemma 24 in the paper ↗

Uniform-intensity rare-cell priors have overlap, identical random (X,A) tables, separated target centers, controlled variance, and label-gated mixture distance. The returned calibration also exports the degree floor and the C55 bandwidth slack already used by its construction. the stated conclusion.

Formal statement
eps :
ℝ
shared
eps :
0 < eps
eps < 1 / 2
∃ calibration : CommonMarginalCalibration eps, ∃ C rho : Real,
0 < C
rho ∈ Ioo (0 : Real) 1
conclusion 1
n m L :
1 ≤ n
2 ≤ L
u v B a :
k d :
2 ≤ d
0 ≤ u
0 ≤ v
0 < u + v
(u + v) * B ≤ calibration.uniformBandwidthConstant * L
0 < B
a = calibration.gamma * B / (L : Real) ^ 2
k * a ≤ calibration.dualGap
k + 1 ≤ d
∃ R : CommonMarginalRecipe calibration n m d L B a k,
R.labeledIntensity = u
R.auxiliaryIntensity = v
CommonMarginalBounds R u v calibration.dualGap C rho
Proof (Lean source)
lemma common_marginal_uniform_intensity : ∀ (eps : Real), 0 < eps → eps < 1 / 2 → ∃ calibration : CommonMarginalCalibration eps, ∃ C rho : Real, 0 < C ∧ rho ∈ Ioo (0 : Real) 1 ∧ CommonMarginalCalibrationClosure calibration C rho ∧ ∀ (n m L : Nat), 1 ≤ n → 2 ≤ L → ∀ (u v B a : Real) (k d : Nat), 2 ≤ d → 0 ≤ u → 0 ≤ v → 0 < u + v → (u + v) * B ≤ calibration.uniformBandwidthConstant * L → 0 < B → a = calibration.gamma * B / (L : Real) ^ 2 → k * a ≤ calibration.dualGap → k + 1 ≤ d → ∃ R : CommonMarginalRecipe calibration n m d L B a k, R.labeledIntensity = u ∧ R.auxiliaryIntensity = v ∧ R.prior0 = commonMarginalRecipePriorOf R false ∧ R.prior1 = commonMarginalRecipePriorOf R true ∧ CommonMarginalBounds R u v calibration.dualGap C rho := by intro eps heps hepsHalf rcases finite_alternation_duality heps hepsHalf with ⟨gamma, gap, hgamma, hgap, hdual⟩ let kappa := (1 - 2 * eps) / eps have hkappa : 0 < kappa := by dsimp [kappa] exact div_pos (by linarith) heps rcases Causalean.Stat.Minimax.MomentMatchedMixture.FiniteSignedMomentMarkedPoissonMixture.NormalizedFiniteSignedMomentCertificate.exists_geometric_markedPoisson_tv_bound.{0} eps kappa heps hepsHalf rfl with ⟨bandwidth, C0, rho, hbandwidth, hC0, hrho, htv⟩ let C := max C0 1 have hC : 0 < C := lt_of_lt_of_le (by norm_num) (le_max_right C0 1) have hC0_le : C0 ≤ C := le_max_left C0 1 let dualGap : Real := min gap (1 / 4) have hdualGap : 0 < dualGap := lt_min hgap (by norm_num) let degreeConstant := commonMarginalDegreeConstant C dualGap rho have hdegreeConstant : 0 < degreeConstant := lt_of_lt_of_le (by norm_num) (le_max_left _ _) let s : Real := 1 / (65536 * C) have hs : 0 < s := by dsimp [s]; positivity let K : Real := s * dualGap ^ 2 * gamma have hK : 0 < K := by dsimp [K]; positivity let b0 : Real := min (bandwidth / 131072) (min (dualGap / (8 * gamma)) (s * dualGap ^ 3 / (8 * (degreeConstant + 1)))) have hb0 : 0 < b0 := by apply lt_min (div_pos hbandwidth (by norm_num)) apply lt_min (div_pos hdualGap (mul_pos (by norm_num) hgamma)) exact div_pos (mul_pos hs (pow_pos hdualGap 3)) (mul_pos (by norm_num) (by linarith)) let rareConstant : Real := dualGap / (2 * gamma * b0) have hrareConstant : 0 < rareConstant := by exact div_pos hdualGap (mul_pos (mul_pos (by norm_num) hgamma) hb0) let regimeConstant : Real := max 1 (4 * (degreeConstant + 1) ^ 2 / K) ^ 2 have hregimeConstant : 0 < regimeConstant := by dsimp [regimeConstant] positivity let dimensionConstant : Real := min (dualGap ^ 4 / 16) (min ((dualGap * gamma * b0 / (2 * (degreeConstant + 1))) ^ 2) ((1 / 65536) / regimeConstant)) have hdimensionConstant : 0 < dimensionConstant := by dsimp [dimensionConstant] positivity let calibration : CommonMarginalCalibration eps := { regimeConstant := regimeConstant regimeConstant_pos := hregimeConstant degreeConstant := degreeConstant degreeConstant_pos := hdegreeConstant bandwidthConstant := b0 bandwidthConstant_pos := hb0 uniformBandwidthConstant := bandwidth uniformBandwidthConstant_pos := hbandwidth gamma := gamma gamma_pos := hgamma rareCountConstant := rareConstant rareCountConstant_pos := hrareConstant dualGap := dualGap dualGap_pos := hdualGap dualGap_le_quarter := min_le_right _ _ dimensionConstant := dimensionConstant dimensionConstant_pos := hdimensionConstant } have hbandwidthSlack : 131072 * calibration.bandwidthConstant ≤ calibration.uniformBandwidthConstant := by dsimp [calibration] have hb0_le : b0 ≤ bandwidth / 131072 := min_le_left _ _ nlinarith have hdegreeFloor : (2 : Real) ≤ calibration.degreeConstant := by exact le_max_left _ _ have hrareScale : calibration.rareCountConstant * calibration.gamma * calibration.bandwidthConstant ≤ calibration.dualGap := by dsimp [calibration, rareConstant] field_simp nlinarith [hdualGap] have hrareCountIdentity : calibration.rareCountConstant = calibration.dualGap / (2 * calibration.gamma * calibration.bandwidthConstant) := by rfl have hrareCountFloor : (4 : Real) ≤ calibration.rareCountConstant := by dsimp [calibration, rareConstant] have hb0_le : b0 ≤ dualGap / (8 * gamma) := (min_le_right _ _).trans (min_le_left _ _) have hgne : gamma ≠ 0 := ne_of_gt hgamma have hbne : b0 ≠ 0 := ne_of_gt hb0 field_simp [hgne, hbne] at hb0_le ⊢ nlinarith have hdimensionFloor : calibration.dimensionConstant * calibration.regimeConstant ≤ 1 / 65536 := by dsimp [calibration, dimensionConstant] have hdim : dimensionConstant ≤ (1 / 65536) / regimeConstant := (min_le_right _ _).trans (min_le_right _ _) calc dimensionConstant * regimeConstant ≤ ((1 / 65536) / regimeConstant) * regimeConstant := mul_le_mul_of_nonneg_right hdim hregimeConstant.le _ = 1 / 65536 := by field_simp [ne_of_gt hregimeConstant] have hvarianceBandwidth : 8 * (calibration.degreeConstant + 1) * calibration.bandwidthConstant ≤ calibration.dualGap ^ 3 / (65536 * C) := by dsimp [calibration] have hb0_le : b0 ≤ s * dualGap ^ 3 / (8 * (degreeConstant + 1)) := (min_le_right _ _).trans (min_le_right _ _) dsimp [s] at hb0_le have hD1 : 0 < degreeConstant + 1 := by linarith have hCne : C ≠ 0 := ne_of_gt hC have hDne : degreeConstant + 1 ≠ 0 := ne_of_gt hD1 field_simp [hCne, hDne] at hb0_le ⊢ nlinarith have hrareCountLower : 4 * (calibration.degreeConstant + 1) / ((1 / (65536 * C)) * calibration.dualGap ^ 2 * calibration.gamma) ≤ calibration.rareCountConstant := by dsimp [calibration, rareConstant] have hb0_le : b0 ≤ s * dualGap ^ 3 / (8 * (degreeConstant + 1)) := (min_le_right _ _).trans (min_le_right _ _) have hCne : C ≠ 0 := ne_of_gt hC have hDne : degreeConstant + 1 ≠ 0 := by linarith have hgne : gamma ≠ 0 := ne_of_gt hgamma have hbne : b0 ≠ 0 := ne_of_gt hb0 have hgapne : dualGap ≠ 0 := ne_of_gt hdualGap dsimp [s] at hb0_le ⊢ field_simp [hCne, hDne, hgne, hbne, hgapne] at hb0_le ⊢ nlinarith have hregimeScale : (4 * (calibration.degreeConstant + 1) ^ 2 / ((1 / (65536 * C)) * calibration.dualGap ^ 2 * calibration.gamma)) ^ 2 ≤ calibration.regimeConstant := by dsimp [calibration, regimeConstant, K, s] have hq : 0 ≤ 4 * (degreeConstant + 1) ^ 2 / (1 / (65536 * C) * dualGap ^ 2 * gamma) := by positivity have hqmax := le_max_right (1 : Real) (4 * (degreeConstant + 1) ^ 2 / (1 / (65536 * C) * dualGap ^ 2 * gamma)) nlinarith [sq_nonneg (max 1 (4 * (degreeConstant + 1) ^ 2 / (1 / (65536 * C) * dualGap ^ 2 * gamma)) - 4 * (degreeConstant + 1) ^ 2 / (1 / (65536 * C) * dualGap ^ 2 * gamma))] have hdimensionRare : calibration.dimensionConstant ≤ calibration.dualGap ^ 4 / 16 := by exact min_le_left _ _ have hdimensionBranch : calibration.dimensionConstant ≤ (calibration.dualGap * calibration.gamma * calibration.bandwidthConstant / (2 * (calibration.degreeConstant + 1))) ^ 2 := by exact (min_le_right _ _).trans (min_le_left _ _) have hmixtureDecay : ∀ n : Nat, 1 ≤ n → C * (65536 * (n : Real)) * calibration.dualGap * rho ^ ceil (calibration.degreeConstant * logEN n) ≤ 1 / 8 := by intro n hn let q : Real := -Real.log rho let M : Real := 8 * (C * 65536 * dualGap) have hq : 0 < q := by dsimp [q] exact neg_pos.mpr (Real.log_neg hrho.1 hrho.2) have hM : 0 < M := by dsimp [M]; positivity have hnR : (0 : Real) < n := by exact_mod_cast hn have hlogn : 0 ≤ Real.log (n : Real) := Real.log_nonneg (by exact_mod_cast hn) have hdegree : max 1 (Real.log M + 2) / q ≤ commonMarginalDegreeConstant C dualGap rho := by exact le_max_right _ _ have hqdegree : max 1 (Real.log M + 2) ≤ q * commonMarginalDegreeConstant C dualGap rho := by rw [mul_comm] exact (div_le_iff₀ hq).mp hdegree have hqdegree_one : 1 ≤ q * commonMarginalDegreeConstant C dualGap rho := (le_max_left _ _).trans hqdegree have hqdegree_log : Real.log M + 2 ≤ q * commonMarginalDegreeConstant C dualGap rho := (le_max_right _ _).trans hqdegree have hlogEN : logEN n = 1 + Real.log (n : Real) := by rw [logEN, Real.log_mul (Real.exp_ne_zero 1) hnR.ne', Real.log_exp] have hceil : commonMarginalDegreeConstant C dualGap rho * logEN n ≤ (ceil (commonMarginalDegreeConstant C dualGap rho * logEN n) : Real) := Nat.le_ceil _ have hlogpow : (ceil (commonMarginalDegreeConstant C dualGap rho * logEN n) : Real) * Real.log rho ≤ -Real.log M - Real.log (n : Real) := by have hqrho : Real.log rho = -q := by simp [q] rw [hlogEN] at hceil rw [hlogEN, hqrho] nlinarith [mul_le_mul_of_nonneg_left hqdegree_one hlogn] have htarget : 0 < 1 / (M * (n : Real)) := by positivity have htargetLog : Real.log (1 / (M * (n : Real))) = -Real.log M - Real.log (n : Real) := by rw [one_div, Real.log_inv, Real.log_mul hM.ne' hnR.ne'] ring have hpow : rho ^ ceil (commonMarginalDegreeConstant C dualGap rho * logEN n) ≤ 1 / (M * (n : Real)) := by apply (Real.pow_le_iff_le_log hrho.1 htarget).2 rw [htargetLog] exact hlogpow dsimp [calibration] have hfactor : 0 ≤ C * (65536 * (n : Real)) * dualGap := by positivity calc C * (65536 * (n : Real)) * dualGap * rho ^ ceil (commonMarginalDegreeConstant C dualGap rho * logEN n) ≤ C * (65536 * (n : Real)) * dualGap * (1 / (M * (n : Real))) := mul_le_mul_of_nonneg_left hpow hfactor _ = 1 / 8 := by dsimp [M]; field_simp have hclosure : CommonMarginalCalibrationClosure calibration C rho := ⟨hbandwidthSlack, hdegreeFloor, hrareScale, hrareCountIdentity, hrareCountFloor, hdimensionFloor, hvarianceBandwidth, hrareCountLower, hregimeScale, hdimensionRare, hdimensionBranch, hmixtureDecay⟩ refine ⟨calibration, C, rho, hC, hrho, hclosure, ?_⟩ intro n m L hn hL u v B a k d hd hu hv huv hband hB ha hka hkd have ha' : a = gamma * B / (L : Real) ^ 2 := by simpa [calibration] using ha have ha_pos : 0 < a := by rw [ha']; positivity have hdualScale := hdual L hL B hB dsimp only at hdualScale rw [← ha'] at hdualScale rcases hdualScale with ⟨hlo, ⟨D⟩⟩ let cert := normalizedCertificateOfFiniteMomentDual D have hcertSupport : ∀ᵐ p ∂cert.signedMeasure.variation, p ∈ Icc (a / kappa) B := by rw [cert.variation_eq_absoluteMeasure] unfold absoluteMeasure rw [ae_finsetSum_measure_iff] intro i _ apply Measure.ae_smul_measure exact (ae_dirac_iff measurableSet_Icc).2 (by -- … truncated; follow the source link for the rest …
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.common_marginal_uniform_intensity · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalPrior.lean:389
CausalSmith.Stat.STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research.Helpers.CommonMarginalProductBounds 4 declarations Product-measure variance bounds used by the common-marginal construction.

Product-measure variance bounds used by the common-marginal construction.

theorem integral_sum_iid

the stated conditions establishes the stated conclusion.

Formal statement
k :
g :
hg :
∫ w : Fin k → Real, ∑ i, g (w i) ∂Measure.pi (fun _ : Fin k => nu) = k * ∫ p, g p ∂nu
Proof (Lean source)
lemma integral_sum_iid {k : Nat} {nu : Measure Real} [IsProbabilityMeasure nu] {g : Real → Real} (hg : Integrable g nu) : ∫ w : Fin k → Real, ∑ i, g (w i) ∂Measure.pi (fun _ : Fin k => nu) = k * ∫ p, g p ∂nu := by rw [integral_finsetSum] · simp_rw [integral_comp_eval (μ := fun _ : Fin k => nu) (f := g) hg.aestronglyMeasurable, Finset.sum_const, Finset.card_univ, Fintype.card_fin, nsmul_eq_mul] · intro i _ exact integrable_comp_eval hg
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.integral_sum_iid · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalProductBounds.lean:12
theorem zeroInflated_polar_firstMoment

the stated conditions establishes the stated conclusion.

Formal statement
iota :
Type*
Fintype iota
L :
a kappa B :
ha :
0 < a
hkappa :
0 < kappa
hsupport :
∀ᵐ p ∂C.signedMeasure.variation, p ∈ Icc (a / kappa) B
∫ p, p * C.polarSign p ∂C.zeroInflatedPrior a
= a * ∑ i, C.weight i * (C.node i / (C.node i + a))
Proof (Lean source)
lemma zeroInflated_polar_firstMoment {iota : Type*} [Fintype iota] {L : Nat} (C : NormalizedFiniteSignedMomentCertificate iota L) (a kappa B : Real) (ha : 0 < a) (hkappa : 0 < kappa) (hsupport : ∀ᵐ p ∂C.signedMeasure.variation, p ∈ Icc (a / kappa) B) : ∫ p, p * C.polarSign p ∂C.zeroInflatedPrior a = a * ∑ i, C.weight i * (C.node i / (C.node i + a)) := by classical have hpolar_node (i : iota) : C.polarSign (C.node i) = sign (C.weight i) := by unfold Causalean.Stat.Minimax.MomentMatchedMixture.FiniteSignedMomentMarkedPoissonMixture.NormalizedFiniteSignedMomentCertificate.polarSign rw [Finset.sum_eq_single i] · simp · intro j _ hji simp [C.node_injective.ne hji.symm] · simp have hpolar_mem (p : Real) : C.polarSign p ∈ Icc (-1 : Real) 1 := by by_cases hp : ∃ i, p = C.node i · obtain ⟨i, rfl⟩ := hp rw [hpolar_node] rcases lt_trichotomy (C.weight i) 0 with hi | hi | hi · simp [Real.sign_of_neg hi] · simp [hi] · simp [Real.sign_of_pos hi] · unfold Causalean.Stat.Minimax.MomentMatchedMixture.FiniteSignedMomentMarkedPoissonMixture.NormalizedFiniteSignedMomentCertificate.polarSign have hne : ∀ i, p ≠ C.node i := fun i hi => hp ⟨i, hi⟩ simp [hne] have hf : Integrable (fun p => p * C.polarSign p) (C.zeroInflatedPrior a) := by let _ := C.zeroInflatedPrior_isProbabilityMeasure a kappa B ha hkappa hsupport apply Integrable.of_bound (measurable_id.mul C.measurable_polarSign).aestronglyMeasurable |B| filter_upwards [C.zeroInflatedPrior_support a kappa B hsupport] with p hp rcases hp with rfl | hp · simp · change |p * C.polarSign p| ≤ |B| rw [abs_mul] have hp0 : 0 ≤ p := (div_nonneg ha.le hkappa.le).trans hp.1 rw [abs_of_nonneg hp0] calc p * |C.polarSign p| ≤ p * 1 := by gcongr exact (abs_le).2 (hpolar_mem p) _ ≤ |B| := by simpa using hp.2.trans (le_abs_self B) let tilt : Real → ENNReal := fun p => ofReal (a / (p + a)) have hleft : Integrable (fun p => p * C.polarSign p) (C.signedMeasure.variation.withDensity tilt) := by exact hf.mono_measure (by unfold zeroInflatedPrior exact Measure.le_add_right le_rfl) have hright : Integrable (fun p => p * C.polarSign p) (ofReal (1 - ∫ p, a / (p + a) ∂C.signedMeasure.variation) • Measure.dirac 0) := by exact hf.mono_measure (by unfold zeroInflatedPrior exact Measure.le_add_left le_rfl) rw [zeroInflatedPrior, integral_add_measure hleft hright, integral_withDensity_eq_integral_toReal_smul (by fun_prop) (ae_of_all _ fun _ => ENNReal.ofReal_lt_top), integral_smul_measure, integral_dirac] simp only [smul_eq_mul, zero_mul, mul_zero, add_zero] have htilt : ∀ᵐ p ∂C.signedMeasure.variation, (tilt p).toReal = a / (p + a) := by filter_upwards [hsupport] with p hp rw [ENNReal.toReal_ofReal] exact div_nonneg ha.le (add_nonneg ((div_nonneg ha.le hkappa.le).trans hp.1) ha.le) rw [integral_congr_ae (htilt.mono fun p hp => by rw [hp])] rw [show (fun p : Real => a / (p + a) * (p * C.polarSign p)) = fun p => a * ((p / (p + a)) * C.polarSign p) by funext p ring] rw [integral_const_mul] rw [C.variation_eq_absoluteMeasure] unfold absoluteMeasure rw [integral_finsetSum_measure (fun i _ => (integrable_dirac (by finiteness)).smul_measure ENNReal.ofReal_ne_top)] apply congrArg (fun z : Real => a * z) apply Finset.sum_congr rfl intro i _ rw [integral_smul_measure, integral_dirac, ENNReal.toReal_ofReal (abs_nonneg _), hpolar_node] change |C.weight i| * ((C.node i / (C.node i + a)) * sign (C.weight i)) = C.weight i * (C.node i / (C.node i + a)) have habs : |C.weight i| * sign (C.weight i) = C.weight i := by rcases lt_trichotomy (C.weight i) 0 with hi | hi | hi · simp [abs_of_neg hi, Real.sign_of_neg hi] · simp [hi] · simp [abs_of_pos hi, Real.sign_of_pos hi] calc |C.weight i| * ((C.node i / (C.node i + a)) * sign (C.weight i)) = (|C.weight i| * sign (C.weight i)) * (C.node i / (C.node i + a)) := by ring _ = C.weight i * (C.node i / (C.node i + a)) := by rw [habs]
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.zeroInflated_polar_firstMoment · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalProductBounds.lean:24
theorem variance_sum_iid_le

the stated conditions establishes the stated conclusion.

Formal statement
k :
g :
B a :
hg :
hsupport :
∀ᵐ p ∂nu, 0 ≤ g p ∧ g p ≤ p ∧ p ≤ B
hB :
0 ≤ B
hmean :
∫ p, p ∂nu ≤ a
variance (fun w : Fin k → Real => ∑ i, g (w i)) (Measure.pi fun _ : Fin k => nu)
≤ k * B * a
Proof (Lean source)
lemma variance_sum_iid_le {k : Nat} {nu : Measure Real} [IsProbabilityMeasure nu] {g : Real → Real} {B a : Real} (hg : Measurable g) (hsupport : ∀ᵐ p ∂nu, 0 ≤ g p ∧ g p ≤ p ∧ p ≤ B) (hB : 0 ≤ B) (hmean : ∫ p, p ∂nu ≤ a) : variance (fun w : Fin k → Real => ∑ i, g (w i)) (Measure.pi fun _ : Fin k => nu) ≤ k * B * a := by have hgIcc : ∀ᵐ p ∂nu, g p ∈ Icc (0 : Real) B := by filter_upwards [hsupport] with p hp exact ⟨hp.1, hp.2.1.trans hp.2.2⟩ have hgMem : MemLp g 2 nu := memLp_of_bounded hgIcc hg.aestronglyMeasurable 2 have hgMean_nonneg : 0 ≤ ∫ p, g p ∂nu := integral_nonneg_of_ae <| hsupport.mono fun _ hp => hp.1 have hpInt : Integrable id nu := by apply Integrable.of_bound measurable_id.aestronglyMeasurable (max |B| 0) filter_upwards [hsupport] with p hp change |p| ≤ max |B| 0 rw [abs_of_nonneg (hp.1.trans hp.2.1), abs_of_nonneg hB, max_eq_left hB] exact hp.2.2 have hgInt : Integrable g nu := hgMem.integrable (by norm_num) have hgMean_le : ∫ p, g p ∂nu ≤ a := by exact (integral_mono_ae hgInt hpInt (hsupport.mono fun _ hp => hp.2.1)).trans hmean have hvar : variance g nu ≤ B * a := by calc variance g nu ≤ (B - ∫ p, g p ∂nu) * (∫ p, g p ∂nu) := by simpa using variance_le_sub_mul_sub hgIcc hg.aemeasurable _ ≤ B * a := by nlinarith [sq_nonneg (∫ p, g p ∂nu), mul_nonneg hB (sub_nonneg.mpr hgMean_le)] rw [show (fun w : Fin k → Real => ∑ i, g (w i)) = ∑ i, fun w : Fin k → Real => g (w i) by funext w; simp, variance_sum_pi (fun _ => hgMem)] simp only [Finset.sum_const, Finset.card_univ, Fintype.card_fin, nsmul_eq_mul] calc (k : Real) * variance g nu ≤ (k : Real) * (B * a) := mul_le_mul_of_nonneg_left hvar (Nat.cast_nonneg k) _ = (k : Real) * B * a := by ring
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.variance_sum_iid_le · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalProductBounds.lean:121
theorem variance_const_add_sum_iid_le

the stated conditions establishes the stated conclusion.

Formal statement
k :
c B a :
hsupport :
∀ᵐ p ∂nu, p ∈ Icc (0 : Real) B
hB :
0 ≤ B
hmean :
∫ p, p ∂nu ≤ a
variance (fun w : Fin k → Real => c + ∑ i, w i) (Measure.pi fun _ : Fin k => nu)
≤ k * B * a
Proof (Lean source)
lemma variance_const_add_sum_iid_le {k : Nat} {nu : Measure Real} [IsProbabilityMeasure nu] {c B a : Real} (hsupport : ∀ᵐ p ∂nu, p ∈ Icc (0 : Real) B) (hB : 0 ≤ B) (hmean : ∫ p, p ∂nu ≤ a) : variance (fun w : Fin k → Real => c + ∑ i, w i) (Measure.pi fun _ : Fin k => nu) ≤ k * B * a := by have hsum_meas : AEStronglyMeasurable (fun w : Fin k → Real => ∑ i, w i) (Measure.pi fun _ : Fin k => nu) := by fun_prop rw [variance_const_add hsum_meas c] apply variance_sum_iid_le measurable_id · filter_upwards [hsupport] with p hp exact ⟨hp.1, le_rfl, hp.2⟩ · exact hB · exact hmean
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.variance_const_add_sum_iid_le · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalProductBounds.lean:161
CausalSmith.Stat.STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research.Helpers.CommonMarginalTransfer 4 declarations Fixed-sample common-marginal transfer and its canonical calibrated family.

Fixed-sample common-marginal transfer and its canonical calibrated family.

def FixedSampleCommonMarginalTransferRuleAt

Fixed-sample transfer for one exact witness of the Poisson-prior construction, with the labeled and auxiliary intensities fixed at the two unequal sample-size scales from the paper. the stated conditions the stated conclusion.

Definition (Lean source)
eps :
Cfixed cSmall cRisk CBound rho :
calibration :
n m d :
H :
CommonMarginalPriorHandle calibration n m d
1 ≤ n
2 ≤ d
CommonMarginalExactPoissonPriorWitness calibration.bandwidthConstant (n + m : Nat) H.recipe (u := commonMarginalLabeledIntensity Cfixed n) (v := commonMarginalAuxiliaryIntensity Cfixed n m) (C := CBound) (rho := rho)
tvDist H.recipe.rawExperiment0 H.recipe.rawExperiment1 ≤ 1 / 8
H.k * H.B * H.a
≤ cSmall * |rawPriorCenter H.recipe true - rawPriorCenter H.recipe false| ^ 2
FixedSampleCommonMarginalTransferRuleAt Cfixed cSmall cRisk CBound rho calibration :
Prop
cRisk * |rawPriorCenter H.recipe true - rawPriorCenter H.recipe false| ^ 2
≤ minimaxRisk n m d eps
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.FixedSampleCommonMarginalTransferRuleAt · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalTransfer.lean:18
theorem fixed_sample_common_marginal_recipe_transfer_rule Lemma 20 in the paper ↗

Under the stated overlap, positivity, sample-size, witness, affinity, and variance conditions, the recipe's squared raw-center separation gives the stated fixed-sample minimax-risk lower bound.

Formal statement
eps :
heps :
0 < eps
heps2 :
eps < 1 / 2
calibration :
CBound rho :
hCBound :
0 < CBound
n m d L k :
B a :
R :
CommonMarginalRecipe calibration n m d L B a k
hn :
1 ≤ n
hd :
2 ≤ d
hprior :
htv :
tvDist R.rawExperiment0 R.rawExperiment1 ≤ 1 / 8
hvariance :
k * B * a ≤ (1 / (65536 * CBound)) * |rawPriorCenter R true - rawPriorCenter R false| ^ 2
(1 / 65536) * |rawPriorCenter R true - rawPriorCenter R false| ^ 2 ≤ minimaxRisk n m d eps
Proof (Lean source)
lemma fixed_sample_common_marginal_recipe_transfer_rule (eps : Real) (heps : 0 < eps) (heps2 : eps < 1 / 2) (calibration : CommonMarginalCalibration eps) (CBound rho : Real) (hCBound : 0 < CBound) (n m d L k : Nat) (B a : Real) (R : CommonMarginalRecipe calibration n m d L B a k) (hn : 1 ≤ n) (hd : 2 ≤ d) (hprior : CommonMarginalPoissonPriorWitness R (u := commonMarginalLabeledIntensity 65536 n) (v := commonMarginalAuxiliaryIntensity 65536 n m) (C := CBound) (rho := rho)) (htv : tvDist R.rawExperiment0 R.rawExperiment1 ≤ 1 / 8) (hvariance : k * B * a ≤ (1 / (65536 * CBound)) * |rawPriorCenter R true - rawPriorCenter R false| ^ 2) : (1 / 65536) * |rawPriorCenter R true - rawPriorCenter R false| ^ 2 ≤ minimaxRisk n m d eps := by let Delta := |rawPriorCenter R true - rawPriorCenter R false| let u : Real := commonMarginalLabeledIntensity 65536 n let v : Real := commonMarginalAuxiliaryIntensity 65536 n m have hu : 0 ≤ u := by dsimp [u, commonMarginalLabeledIntensity] positivity have hv : 0 ≤ v := by dsimp [v, commonMarginalAuxiliaryIntensity] positivity have hDelta0 : 0 ≤ Delta := by exact abs_nonneg _ have hDelta_le : Delta ≤ 2 := by have hfalse := commonMarginal_rawPriorCenter_abs_le_one R hprior.bounds false have htrue := commonMarginal_rawPriorCenter_abs_le_one R hprior.bounds true dsimp [Delta] rw [abs_le] constructor <;> linarith [le_abs_self (rawPriorCenter R false), le_abs_self (rawPriorCenter R true), neg_le_of_abs_le hfalse, neg_le_of_abs_le htrue] letI : IsProbabilityMeasure (commonMarginalRecipePriorOf R false) := by dsimp [commonMarginalRecipePriorOf] exact R.probability0 letI : IsProbabilityMeasure (commonMarginalRecipePriorOf R true) := by dsimp [commonMarginalRecipePriorOf] exact R.probability1 letI : IsProbabilityMeasure R.prior0 := by exact R.probability0 have hclass : Nonempty (ClassLaw d eps) := by rcases hprior.bounds.class0.exists with ⟨P, hP⟩ exact ⟨⟨P, hP⟩⟩ letI : Nonempty (ClassLaw d eps) := hclass letI : Nonempty (Fin d) := ⟨⟨0, by omega⟩⟩ have hfixed : IsFixedTwoPoolExperiment n m (commonMarginalFixedKernel n m d) (commonMarginalLabeledMarkKernel d) (commonMarginalAuxMarkKernel d) := by intro P rfl have hraw := commonMarginal_orderedRaw_isRandomScale R (Real.toNNReal u) (Real.toNNReal v) have hpredictive : tvDist (priorPredictive (commonMarginalRecipePriorOf R false) (commonMarginalOrderedRawKernel R (Real.toNNReal u) (Real.toNNReal v))) (priorPredictive (commonMarginalRecipePriorOf R true) (commonMarginalOrderedRawKernel R (Real.toNNReal u) (Real.toNNReal v))) ≤ 1 / 8 := by have hc := commonMarginal_predictive_reconstruction_contraction R hu hv hprior.labeledIntensity_eq hprior.auxiliaryIntensity_eq simpa [commonMarginalRecipePriorOf] using hc.trans htv let cFloor : Real := 1 / 100 have hcFloor : 0 < cFloor := by dsimp [cFloor]; norm_num have hfloor : cFloor / n ≤ minimaxRisk n m d eps := by exact commonMarginal_explicit_parametric_floor eps heps heps2 n m d hn hd have hfloorRisk : ofReal (cFloor / n) ≤ minimaxDecisionRisk (commonMarginalFixedKernel n m d) (commonMarginalTransferLoss eps) := by exact (ENNReal.ofReal_le_ofReal hfloor).trans (commonMarginal_ofReal_minimax_le_classGated n m d eps) by_cases hDelta_zero : Delta = 0 · dsimp [Delta] at hDelta_zero ⊢ rw [hDelta_zero] have hnR : (0 : Real) < n := by exact_mod_cast hn nlinarith [hfloor, div_pos hcFloor hnR] have hDelta : 0 < Delta := lt_of_le_of_ne hDelta0 (Ne.symm hDelta_zero) have hvariance' := hvariance field_simp at hvariance' have htransfer := randomScale_twoFuzzy_minimax_lower_transfer (commonMarginalRecipePriorOf R false) (commonMarginalRecipePriorOf R true) (commonMarginalOrderedRawKernel R (Real.toNNReal u) (Real.toNNReal v)) (commonMarginalFixedKernel n m d) (commonMarginalLabeledMarkKernel d) (commonMarginalAuxMarkKernel d) (fun P => Real.toNNReal (R.rawScale P)) R.rawScale_measurable.real_toNNReal (Real.toNNReal u) (Real.toNNReal v) (1 / 2) hraw hfixed (commonMarginalTransferLoss eps) 4 (by norm_num) (commonMarginalTransferLoss_measurable eps) (commonMarginalTransferLoss_le_four eps) (fun _ => Classical.arbitrary (Obs d)) (fun _ => Classical.arbitrary (AuxObs d)) 0 (ofReal (3 * Delta ^ 2 / 128)) (ofReal (Delta ^ 2 / 16384)) (ofReal (1 / (4096 * (n : Real)))) (ofReal (1 / (4096 * (n : Real)))) (by intro rawRule hrawRule refine commonMarginal_raw_fuzzy_lower R hprior.bounds _ (fun P => ?_) hDelta (by simp [Delta]) ?_ ?_ hpredictive rawRule hrawRule · dsimp only [commonMarginalOrderedRawKernel] letI : IsProbabilityMeasure (obsLaw P) := inferInstance letI : IsProbabilityMeasure (auxMarginal P).toMeasure := inferInstance change IsProbabilityMeasure ((finitePoissonSampleLaw (obsLaw P) (Real.toNNReal u * Real.toNNReal (R.rawScale P))).prod (finitePoissonSampleLaw (auxMarginal P).toMeasure (Real.toNNReal v * Real.toNNReal (R.rawScale P)))) exact Measure.prod.instIsProbabilityMeasure _ _ · exact (commonMarginal_prior_target_concentration R hprior.bounds false hDelta hDelta_le).trans (by rw [div_le_iff₀ (sq_pos_of_pos hDelta)] dsimp [Delta] nlinarith [hvariance']) · exact (commonMarginal_prior_target_concentration R hprior.bounds true hDelta hDelta_le).trans (by rw [div_le_iff₀ (sq_pos_of_pos hDelta)] dsimp [Delta] nlinarith [hvariance'])) (by apply (ENNReal.toReal_le_toReal (measure_ne_top _ _) (ENNReal.ofReal_ne_top)).mp rw [ENNReal.toReal_ofReal (by positivity)] exact (commonMarginal_prior_scale_tail R hprior.bounds false).trans (by dsimp [Delta] nlinarith [hvariance'])) (by apply (ENNReal.toReal_le_toReal (measure_ne_top _ _) (ENNReal.ofReal_ne_top)).mp rw [ENNReal.toReal_ofReal (by positivity)] exact (commonMarginal_prior_scale_tail R hprior.bounds true).trans (by dsimp [Delta] nlinarith [hvariance'])) (by intro P hscale apply commonMarginal_poisson_lower_tail n hn have hucoe : (Real.toNNReal u : Real) = u := Real.coe_toNNReal _ hu have hscoe : (1 / 2 : Real) ≤ Real.toNNReal (R.rawScale P) := by exact_mod_cast hscale calc (32768 : Real) * n = u * (1 / 2 : Real) := by dsimp [u, commonMarginalLabeledIntensity] ring _ ≤ u * (Real.toNNReal (R.rawScale P) : Real) := mul_le_mul_of_nonneg_left hscoe hu _ = (Real.toNNReal u * Real.toNNReal (R.rawScale P) : NNReal) := by rw [NNReal.coe_mul, hucoe]) (by intro P hscale refine (measure_mono (Set.Iio_subset_Iio (Nat.le_add_left m n))).trans ?_ refine (commonMarginal_poisson_lower_tail (n + m) (by omega) _ ?_).trans ?_ have hvcoe : (Real.toNNReal v : Real) = v := Real.coe_toNNReal _ hv have hscoe : (1 / 2 : Real) ≤ Real.toNNReal (R.rawScale P) := by exact_mod_cast hscale · calc (32768 : Real) * ((n + m : Nat) : Real) = v * (1 / 2 : Real) := by dsimp [v, commonMarginalAuxiliaryIntensity] push_cast ring _ ≤ v * (Real.toNNReal (R.rawScale P) : Real) := mul_le_mul_of_nonneg_left hscoe hv _ = (Real.toNNReal v * Real.toNNReal (R.rawScale P) : NNReal) := by rw [NNReal.coe_mul, hvcoe] · apply ENNReal.ofReal_le_ofReal have hnR : (0 : Real) < n := by exact_mod_cast hn have hnmR : (n : Real) ≤ (n + m : Nat) := by exact_mod_cast le_add_right n m apply one_div_le_one_div_of_le (by positivity) nlinarith) have hdecision : max (ofReal (3 * Delta ^ 2 / 128) - 4 * (ofReal (Delta ^ 2 / 16384) + ofReal (1 / (4096 * (n : Real))) + ofReal (1 / (4096 * (n : Real))))) (ofReal (cFloor / n)) ≤ ofReal (minimaxRisk n m d eps) := -- The transfer theorem now yields only the penalised raw bound; the floor branch is -- discharged here from `hfloorRisk`, which is where that fact actually comes from. max_le (htransfer.trans (commonMarginal_classGated_minimax_le n m d eps)) (hfloorRisk.trans (commonMarginal_classGated_minimax_le n m d eps)) have hminimax0 : 0 ≤ minimaxRisk n m d eps := by have hnR : (0 : Real) < n := by exact_mod_cast hn exact (div_pos hcFloor hnR).le.trans hfloor apply (ENNReal.ofReal_le_ofReal_iff hminimax0).mp refine (show ofReal ((1 / 65536) * Delta ^ 2) ≤ ofReal (minimaxRisk n m d eps) from ?_) by_cases hlarge : 1 / (n : Real) ≤ Delta ^ 2 · have hlargeENN : ofReal ((1 / 65536) * Delta ^ 2) ≤ ofReal (3 * Delta ^ 2 / 128) - 4 * (ofReal (Delta ^ 2 / 16384) + ofReal (1 / (4096 * (n : Real))) + ofReal (1 / (4096 * (n : Real)))) := by have hpenalty : 4 * (ofReal (Delta ^ 2 / 16384) + ofReal (1 / (4096 * (n : Real))) + ofReal (1 / (4096 * (n : Real)))) = ofReal (4 * (Delta ^ 2 / 16384 + 1 / (4096 * (n : Real)) + 1 / (4096 * (n : Real)))) := by apply (ENNReal.toReal_eq_toReal_iff' (by finiteness) (by finiteness)).mp rw [ENNReal.toReal_mul, ENNReal.toReal_add (by finiteness) (by finiteness), ENNReal.toReal_add (by finiteness) (by finiteness)] simp only [ENNReal.toReal_ofReal (by positivity : 0 ≤ Delta ^ 2 / 16384), ENNReal.toReal_ofReal (by positivity : 0 ≤ 1 / (4096 * (n : Real))), ENNReal.toReal_ofReal (by positivity : 0 ≤ 4 * (Delta ^ 2 / 16384 + 1 / (4096 * (n : Real)) + 1 / (4096 * (n : Real))))] norm_num rw [hpenalty, ← ENNReal.ofReal_sub _ (by positivity)] apply ENNReal.ofReal_le_ofReal have hnR : (0 : Real) < n := by exact_mod_cast hn field_simp [hnR.ne'] at hlarge ⊢ nlinarith exact (hlargeENN.trans (le_max_left _ _)).trans hdecision · have hsmallENN : ofReal ((1 / 65536) * Delta ^ 2) ≤ ofReal (cFloor / n) := by apply ENNReal.ofReal_le_ofReal have hsmall : Delta ^ 2 < 1 / (n : Real) := lt_of_not_ge hlarge have hnR : (0 : Real) < n := by exact_mod_cast hn dsimp [cFloor] field_simp [hnR.ne'] at hsmall ⊢ nlinarith exact (hsmallENN.trans (le_max_right _ _)).trans hdecision
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.fixed_sample_common_marginal_recipe_transfer_rule · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalTransfer.lean:122
theorem fixed_sample_common_marginal_transfer Lemma 21 in the paper ↗

The fixed-sample risk transfer for every supplied uniform-intensity recipe. The variance-bound constant is universal, and the concentration threshold may depend on it and on eps. The recipe is not selected here: both the exact bε L / (u + v) specialization and C55 recipes allowed by the bandwidth inequality are covered through CommonMarginalPoissonPriorWitness. the stated conclusion.

Formal statement
∃ Cfixed cRisk : Real,
0 < Cfixed
0 < cRisk
conclusion 1
eps :
0 < eps
eps < 1 / 2
CBound :
0 < CBound
∃ cSmall : Real,
0 < cSmall
calibration :
rho :
n m d L k :
B a :
R :
CommonMarginalRecipe calibration n m d L B a k
1 ≤ n
2 ≤ d
CommonMarginalPoissonPriorWitness R (u := commonMarginalLabeledIntensity Cfixed n) (v := commonMarginalAuxiliaryIntensity Cfixed n m) (C := CBound) (rho := rho)
tvDist R.rawExperiment0 R.rawExperiment1 ≤ 1 / 8
k * B * a ≤ cSmall * |rawPriorCenter R true - rawPriorCenter R false| ^ 2
cRisk * |rawPriorCenter R true - rawPriorCenter R false| ^ 2 ≤ minimaxRisk n m d eps
Proof (Lean source)
lemma fixed_sample_common_marginal_transfer : ∃ Cfixed cRisk : Real, 0 < Cfixed ∧ 0 < cRisk ∧ ∀ (eps : Real), 0 < eps → eps < 1 / 2 → ∀ CBound : Real, 0 < CBound → ∃ cSmall : Real, 0 < cSmall ∧ ∀ (calibration : CommonMarginalCalibration eps) (rho : Real) (n m d L k : Nat) (B a : Real) (R : CommonMarginalRecipe calibration n m d L B a k), 1 ≤ n → 2 ≤ d → CommonMarginalPoissonPriorWitness R (u := commonMarginalLabeledIntensity Cfixed n) (v := commonMarginalAuxiliaryIntensity Cfixed n m) (C := CBound) (rho := rho) → tvDist R.rawExperiment0 R.rawExperiment1 ≤ 1 / 8 → k * B * a ≤ cSmall * |rawPriorCenter R true - rawPriorCenter R false| ^ 2 → cRisk * |rawPriorCenter R true - rawPriorCenter R false| ^ 2 ≤ minimaxRisk n m d eps := by refine ⟨65536, 1 / 65536, by norm_num, by norm_num, ?_⟩ intro eps heps heps2 intro CBound hCBound let cSmall : Real := 1 / (65536 * CBound) refine ⟨cSmall, by dsimp [cSmall] positivity, ?_⟩ intro calibration rho n m d L k B a R hn hd hprior htv hvariance exact fixed_sample_common_marginal_recipe_transfer_rule eps heps heps2 calibration CBound rho hCBound n m d L k B a R hn hd hprior htv (by simpa [cSmall] using hvariance)
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.fixed_sample_common_marginal_transfer · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalTransfer.lean:370
theorem common_marginal_canonical_certificate_family Lemma 25 in the paper ↗

A single construction chain chooses the fixed intensity and risk constants first, then an epsilon-only calibration and its variance-absorption threshold, and finally constructs, for every instance, one paper-facing handle together with a certificate for that very same recipe. The transfer rule recorded beside the family is the rule proved by fixed_sample_common_marginal_transfer, so the producer and consumer use the identical constants at their respective quantifier levels. the stated conclusion.

Formal statement
∃ Cfixed cRisk : Real,
0 < Cfixed
0 < cRisk
conclusion 1
eps :
0 < eps
eps < 1 / 2
∃ calibration : CommonMarginalCalibration eps, ∃ CBound rho cSmall cFloor : Real,
0 < CBound
rho ∈ Ioo (0 : Real) 1
0 < cSmall
0 < cFloor
cFloor ≤ cRisk
FixedSampleCommonMarginalTransferRuleAt Cfixed cSmall cRisk CBound rho calibration
n m d :
1 ≤ n
2 ≤ d
∃ H : CommonMarginalPriorHandle calibration n m d,
CommonMarginalCanonicalCertificate Cfixed cSmall cFloor CBound rho H
Proof (Lean source)
lemma common_marginal_canonical_certificate_family : ∃ Cfixed cRisk : Real, 0 < Cfixed ∧ 0 < cRisk ∧ ∀ (eps : Real), 0 < eps → eps < 1 / 2 → ∃ calibration : CommonMarginalCalibration eps, ∃ CBound rho cSmall cFloor : Real, 0 < CBound ∧ rho ∈ Ioo (0 : Real) 1 ∧ 0 < cSmall ∧ 0 < cFloor ∧ cFloor ≤ cRisk ∧ FixedSampleCommonMarginalTransferRuleAt Cfixed cSmall cRisk CBound rho calibration ∧ ∀ (n m d : Nat), 1 ≤ n → 2 ≤ d → ∃ H : CommonMarginalPriorHandle calibration n m d, CommonMarginalCanonicalCertificate Cfixed cSmall cFloor CBound rho H := by refine ⟨65536, 1 / 65536, by norm_num, by norm_num, ?_⟩ intro eps heps heps2 rcases common_marginal_uniform_intensity eps heps heps2 with ⟨calibration, C, rho, hC, hrho, closure, realize⟩ let cSmall : Real := 1 / (65536 * C) let cFloor : Real := 1 / 65536 have hcSmall : 0 < cSmall := by dsimp [cSmall]; positivity have hcFloor : 0 < cFloor := by dsimp [cFloor]; norm_num refine ⟨calibration, C, rho, cSmall, cFloor, hC, hrho, hcSmall, hcFloor, by rfl, ?_, ?_⟩ · exact fixed_sample_common_marginal_transfer_rule eps heps heps2 calibration C rho hC · intro n m d hn hd have hnR : (0 : Real) < n := by exact_mod_cast hn have hN : (0 : Real) < (n + m : Nat) := by positivity have hgapRoot : calibration.dualGap / sqrt n ≤ 1 / 4 := by have hs : 1 ≤ sqrt (n : Real) := Real.one_le_sqrt.mpr (by exact_mod_cast hn) calc calibration.dualGap / sqrt n ≤ calibration.dualGap := div_le_self calibration.dualGap_pos.le hs _ ≤ 1 / 4 := calibration.dualGap_le_quarter by_cases hreg : commonMarginalParametricRegime calibration n m d · let H := parametricCommonMarginalPriorHandle calibration n m d hd hn heps heps2 hreg hgapRoot refine ⟨H, ?_⟩ have hdegree : 2 ≤ H.L := commonMarginal_degree_lower closure n H.L hn H.degree_eq have hbandConst : 2 * (65536 : Real) * calibration.bandwidthConstant ≤ calibration.uniformBandwidthConstant := by simpa only [show (2 : Real) * 65536 = 131072 by norm_num] using closure.bandwidthSlack have hband : (commonMarginalLabeledIntensity 65536 n + commonMarginalAuxiliaryIntensity 65536 n m) * H.B ≤ calibration.uniformBandwidthConstant * H.L := by rw [H.bandwidth_eq] unfold commonMarginalLabeledIntensity commonMarginalAuxiliaryIntensity push_cast have hnN : (n : Real) ≤ (n + m : Nat) := by exact_mod_cast le_add_right n m have hb0 := calibration.bandwidthConstant_pos have hL0 : (0 : Real) ≤ H.L := by positivity calc (65536 * (n : Real) + 65536 * ((n : Real) + (m : Real))) * (calibration.bandwidthConstant * (H.L : Real) / ((n : Real) + (m : Real))) ≤ (131072 * ((n : Real) + (m : Real))) * (calibration.bandwidthConstant * (H.L : Real) / ((n : Real) + (m : Real))) := by have hsum : 65536 * (n : Real) + 65536 * ((n : Real) + (m : Real)) ≤ 131072 * ((n : Real) + (m : Real)) := by nlinarith [show (0 : Real) ≤ m by positivity] exact mul_le_mul_of_nonneg_right hsum (div_nonneg (mul_nonneg calibration.bandwidthConstant_pos.le (Nat.cast_nonneg _)) (by positivity)) _ = 131072 * calibration.bandwidthConstant * H.L := by field_simp [show ((n + m : Nat) : Real) ≠ 0 by exact_mod_cast (show n + m ≠ 0 by omega)] _ ≤ calibration.uniformBandwidthConstant * H.L := by exact mul_le_mul_of_nonneg_right closure.bandwidthSlack hL0 refine { degree_ge_two := hdegree transferBandwidthConstants := hbandConst bandwidthClosure := hband rareShiftSmall := by intro h; exact False.elim (H.branchCondition.mp h hreg) sameTable := map_auxMarginal_commonMarginalPriorOf_eq H poissonPriorWitness := by intro h; exact False.elim (H.branchCondition.mp h hreg) bounds := by intro h; exact False.elim (H.branchCondition.mp h hreg) mixtureTV := by intro h; exact False.elim (H.branchCondition.mp h hreg) centerSeparation := by intro h; exact False.elim (H.branchCondition.mp h hreg) varianceAbsorption := by intro h; exact False.elim (H.branchCondition.mp h hreg) transferredRisk := by intro h; exact False.elim (H.branchCondition.mp h hreg) floorRisk := by exact (by dsimp [cFloor] calc (1 / 65536 : Real) / n ≤ (1 / 100 : Real) / n := by gcongr <;> norm_num _ ≤ minimaxRisk n m d eps := commonMarginal_explicit_parametric_floor eps heps heps2 n m d hn hd) dimensionNonparametric := by intro h; exact False.elim (H.branchCondition.mp h hreg) dimensionParametric := by intro _ have hdim := closure.dimensionFloor have hreg' := hreg unfold commonMarginalParametricRegime at hreg' dsimp [cFloor] have hn0 : 0 ≤ (n : Real) := hnR.le calc calibration.dimensionConstant * commonMarginalDimensionTerm n m d ≤ calibration.dimensionConstant * (calibration.regimeConstant / (n : Real)) := mul_le_mul_of_nonneg_left hreg' calibration.dimensionConstant_pos.le _ = (calibration.dimensionConstant * calibration.regimeConstant) / (n : Real) := by ring _ ≤ (1 / 65536) / (n : Real) := div_le_div_of_nonneg_right hdim hn0 } · let L := ceil (calibration.degreeConstant * logEN n) let B : Real := calibration.bandwidthConstant * L / (n + m : Nat) let a : Real := calibration.gamma * B / (L : Real) ^ 2 let k := min (d - 1) ⌊calibration.rareCountConstant * (n + m : Nat) * L⌋₊ have hL : 2 ≤ L := commonMarginal_degree_lower closure n L hn rfl have hLpos : (0 : Real) < L := by exact_mod_cast (show 0 < L by omega) have hB : 0 < B := by dsimp [B] exact div_pos (mul_pos calibration.bandwidthConstant_pos hLpos) (by exact_mod_cast hN) have ha : 0 < a := by dsimp [a] exact div_pos (mul_pos calibration.gamma_pos hB) (sq_pos_of_pos hLpos) have hkfit : k + 1 ≤ d := by dsimp [k] have := min_le_left (d - 1) ⌊calibration.rareCountConstant * (n + m : Nat) * L⌋₊ omega have hkFloor : (k : Real) ≤ calibration.rareCountConstant * (n + m : Nat) * L := by calc (k : Real) ≤ (⌊calibration.rareCountConstant * (n + m : Nat) * L⌋₊ : Nat) := by exact_mod_cast min_le_right (d - 1) ⌊calibration.rareCountConstant * (n + m : Nat) * L⌋₊ _ ≤ calibration.rareCountConstant * (n + m : Nat) * L := Nat.floor_le (mul_nonneg (mul_nonneg calibration.rareCountConstant_pos.le (Nat.cast_nonneg _)) (Nat.cast_nonneg _)) have hka : (k : Real) * a ≤ calibration.dualGap := by have hfactor : 0 ≤ calibration.gamma * calibration.bandwidthConstant / (((n + m : Nat) : Real) * L) := by exact div_nonneg (mul_nonneg calibration.gamma_pos.le calibration.bandwidthConstant_pos.le) (mul_nonneg (by exact_mod_cast hN.le) hLpos.le) have hm := mul_le_mul_of_nonneg_right hkFloor hfactor dsimp [a, B] calc (k : Real) * (calibration.gamma * (calibration.bandwidthConstant * (L : Real) / (n + m : Nat)) / (L : Real) ^ 2) = (k : Real) * (calibration.gamma * calibration.bandwidthConstant / (((n + m : Nat) : Real) * L)) := by field_simp [show ((n + m : Nat) : Real) ≠ 0 by exact_mod_cast (show n + m ≠ 0 by omega), ne_of_gt hLpos] _ ≤ (calibration.rareCountConstant * (n + m : Nat) * L) * (calibration.gamma * calibration.bandwidthConstant / (((n + m : Nat) : Real) * L)) := hm _ = calibration.rareCountConstant * calibration.gamma * calibration.bandwidthConstant := by field_simp [show ((n + m : Nat) : Real) ≠ 0 by exact_mod_cast (show n + m ≠ 0 by omega), ne_of_gt hLpos] _ ≤ calibration.dualGap := closure.rareScale have hu : 0 ≤ commonMarginalLabeledIntensity 65536 n := by unfold commonMarginalLabeledIntensity; positivity have hv : 0 ≤ commonMarginalAuxiliaryIntensity 65536 n m := by unfold commonMarginalAuxiliaryIntensity; positivity have huv : 0 < commonMarginalLabeledIntensity 65536 n + commonMarginalAuxiliaryIntensity 65536 n m := by unfold commonMarginalLabeledIntensity commonMarginalAuxiliaryIntensity positivity have hband : (commonMarginalLabeledIntensity 65536 n + commonMarginalAuxiliaryIntensity 65536 n m) * B ≤ calibration.uniformBandwidthConstant * L := by dsimp [B] unfold commonMarginalLabeledIntensity commonMarginalAuxiliaryIntensity push_cast have hnN : (n : Real) ≤ (n + m : Nat) := by exact_mod_cast le_add_right n m calc (65536 * (n : Real) + 65536 * ((n : Real) + (m : Real))) * (calibration.bandwidthConstant * (L : Real) / ((n : Real) + (m : Real))) ≤ (131072 * ((n : Real) + (m : Real))) * (calibration.bandwidthConstant * (L : Real) / ((n : Real) + (m : Real))) := by have hsum : 65536 * (n : Real) + 65536 * ((n : Real) + (m : Real)) ≤ 131072 * ((n : Real) + (m : Real)) := by nlinarith [show (0 : Real) ≤ m by positivity] exact mul_le_mul_of_nonneg_right hsum (div_nonneg (mul_nonneg calibration.bandwidthConstant_pos.le (Nat.cast_nonneg _)) (by positivity)) _ = 131072 * calibration.bandwidthConstant * L := by field_simp [show ((n + m : Nat) : Real) ≠ 0 by exact_mod_cast (show n + m ≠ 0 by omega)] _ ≤ calibration.uniformBandwidthConstant * L := mul_le_mul_of_nonneg_right closure.bandwidthSlack (Nat.cast_nonneg _) rcases realize n m L hn hL (commonMarginalLabeledIntensity 65536 n) (commonMarginalAuxiliaryIntensity 65536 n m) B a k d hd hu hv huv hband hB rfl hka hkfit with ⟨R, hRu, hRv, _, _, bounds⟩ let H : CommonMarginalPriorHandle calibration n m d := { L := L, B := B, a := a, k := k, recipe := R branchCondition := by simp [bounds.finiteAtomConstruction, hreg] degree_eq := rfl, bandwidth_eq := rfl, shift_eq := rfl, rareCount_eq := rfl } have exactWitness : CommonMarginalExactPoissonPriorWitness calibration.bandwidthConstant (n + m : Nat) R (u := commonMarginalLabeledIntensity 65536 n) (v := commonMarginalAuxiliaryIntensity 65536 n m) (C := C) (rho := rho) := { sampleSize_pos := hn, degree_ge_two := hL, dimension_ge_two := hd labeledIntensity_nonneg := hu, auxiliaryIntensity_nonneg := hv totalIntensity_pos := huv, rareCount_fit := hkfit bandwidthDenominator_pos := by positivity bandwidth_eq := rfl, bandwidth_bound := hband, bandwidth_pos := hB shift_eq := rfl, rareShiftSmall := hka labeledIntensity_eq := hRu, auxiliaryIntensity_eq := hRv bounds := bounds witness := ⟨hband, hB, rfl, hka, hRu, hRv, bounds⟩ } have htv : tvDist R.rawExperiment0 R.rawExperiment1 ≤ 1 / 8 := by calc _ ≤ C * commonMarginalLabeledIntensity 65536 n * k * a * rho ^ L := bounds.mixtureTV _ = C * (65536 * (n : Real)) * ((k : Real) * a) * rho ^ L := by unfold commonMarginalLabeledIntensity ring _ ≤ C * (65536 * (n : Real)) * calibration.dualGap * rho ^ L := by exact mul_le_mul_of_nonneg_right (mul_le_mul_of_nonneg_left hka (by positivity)) (pow_nonneg hrho.1.le _) _ ≤ 1 / 8 := by simpa [L] using closure.mixtureDecay n hn have hkLower := commonMarginal_rareCount_degree_lower hC closure n m d L k hn hd rfl rfl hreg have hvariance : (k : Real) * B * a ≤ -- … truncated; follow the source link for the rest …
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.common_marginal_canonical_certificate_family · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalTransfer.lean:406
CausalSmith.Stat.STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research.Helpers.CommonMarginalTransferConcentration 10 declarations Mass, target, event, tail, and fuzzy-hypothesis bounds for common-marginal transfer.

Mass, target, event, tail, and fuzzy-hypothesis bounds for common-marginal transfer.

theorem commonMarginal_mass_concentration

the stated conditions establishes the stated conclusion.

Formal statement
n m d L k :
B a u v C rho :
R :
CommonMarginalRecipe calibration n m d L B a k
hb :
CommonMarginalBounds R u v calibration.dualGap C rho
(R.generator {w | (1 / 2 : Real) < |R.rawTotalMass w - 1|}).toReal ≤ 4 * C * k * B * a
Proof (Lean source)
lemma commonMarginal_mass_concentration {eps : Real} {calibration : CommonMarginalCalibration eps} {n m d L k : Nat} {B a u v C rho : Real} (R : CommonMarginalRecipe calibration n m d L B a k) (hb : CommonMarginalBounds R u v calibration.dualGap C rho) : (R.generator {w | (1 / 2 : Real) < |R.rawTotalMass w - 1|}).toReal ≤ 4 * C * k * B * a := by letI : IsProbabilityMeasure R.generator := R.generatorProbability have hvar : variance R.rawTotalMass R.generator ≤ C * k * B * a := by rw [variance_eq_integral hb.mass_memLp_two.1.aemeasurable] exact hb.massVariance have h := probability_abs_sub_mean_gt_le R.generator R.rawTotalMass 1 (C * k * B * a) (1 / 2) hb.mass_memLp_two (by norm_num) hb.massMean hvar convert h using 1 <;> ring
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.commonMarginal_mass_concentration · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalTransferConcentration.lean:15
theorem commonMarginal_target_concentration

the stated conditions establishes the stated conclusion.

Formal statement
n m d L k :
B a u v C rho t :
R :
CommonMarginalRecipe calibration n m d L B a k
hb :
CommonMarginalBounds R u v calibration.dualGap C rho
branch :
ht :
0 < t
(R.generator {w | t < |R.rawTarget branch w - rawPriorCenter R branch|}).toReal
≤ C * k * B * a / t ^ 2
Proof (Lean source)
lemma commonMarginal_target_concentration {eps : Real} {calibration : CommonMarginalCalibration eps} {n m d L k : Nat} {B a u v C rho t : Real} (R : CommonMarginalRecipe calibration n m d L B a k) (hb : CommonMarginalBounds R u v calibration.dualGap C rho) (branch : Bool) (ht : 0 < t) : (R.generator {w | t < |R.rawTarget branch w - rawPriorCenter R branch|}).toReal ≤ C * k * B * a / t ^ 2 := by letI : IsProbabilityMeasure R.generator := R.generatorProbability have hvar : variance (R.rawTarget branch) R.generator ≤ C * k * B * a := by rw [variance_eq_integral (hb.target_memLp_two branch).1.aemeasurable] have hbranch : generatorVariance R (R.rawTarget branch) ≤ max (generatorVariance R (R.rawTarget false)) (generatorVariance R (R.rawTarget true)) := by cases branch · exact le_max_left _ _ · exact le_max_right _ _ exact hbranch.trans hb.targetVariance apply probability_abs_sub_mean_gt_le R.generator (R.rawTarget branch) (rawPriorCenter R branch) (C * k * B * a) t (hb.target_memLp_two branch) ht · rfl · exact hvar
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.commonMarginal_target_concentration · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalTransferConcentration.lean:33
theorem commonMarginal_mass_concentration_at

the stated conditions establishes the stated conclusion.

Formal statement
n m d L k :
B a u v C rho t :
R :
CommonMarginalRecipe calibration n m d L B a k
hb :
CommonMarginalBounds R u v calibration.dualGap C rho
ht :
0 < t
(R.generator {w | t < |R.rawTotalMass w - 1|}).toReal ≤ C * k * B * a / t ^ 2
Proof (Lean source)
lemma commonMarginal_mass_concentration_at {eps : Real} {calibration : CommonMarginalCalibration eps} {n m d L k : Nat} {B a u v C rho t : Real} (R : CommonMarginalRecipe calibration n m d L B a k) (hb : CommonMarginalBounds R u v calibration.dualGap C rho) (ht : 0 < t) : (R.generator {w | t < |R.rawTotalMass w - 1|}).toReal ≤ C * k * B * a / t ^ 2 := by letI : IsProbabilityMeasure R.generator := R.generatorProbability have hvar : variance R.rawTotalMass R.generator ≤ C * k * B * a := by rw [variance_eq_integral hb.mass_memLp_two.1.aemeasurable] exact hb.massVariance apply probability_abs_sub_mean_gt_le R.generator R.rawTotalMass 1 (C * k * B * a) t hb.mass_memLp_two ht hb.massMean hvar
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.commonMarginal_mass_concentration_at · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalTransferConcentration.lean:59
theorem commonMarginal_prior_scale_tail Lemma 19 in the paper ↗

the stated conditions establishes the stated conclusion.

Formal statement
n m d L k :
B a u v C rho :
R :
CommonMarginalRecipe calibration n m d L B a k
hb :
CommonMarginalBounds R u v calibration.dualGap C rho
branch :
((commonMarginalRecipePriorOf R branch) {P | toNNReal (R.rawScale P) < (1 / 2 : NNReal)}).toReal
≤ 4 * C * k * B * a
Proof (Lean source)
lemma commonMarginal_prior_scale_tail {eps : Real} {calibration : CommonMarginalCalibration eps} {n m d L k : Nat} {B a u v C rho : Real} (R : CommonMarginalRecipe calibration n m d L B a k) (hb : CommonMarginalBounds R u v calibration.dualGap C rho) (branch : Bool) : ((commonMarginalRecipePriorOf R branch) {P | toNNReal (R.rawScale P) < (1 / 2 : NNReal)}).toReal ≤ 4 * C * k * B * a := by let bad : Set (Fin k → Real) := {w | (1 / 2 : Real) < |R.rawTotalMass w - 1|} have htail := commonMarginal_mass_concentration R hb have hmap (b : Bool) : ((R.generator.map (R.lawOf b)) {P | toNNReal (R.rawScale P) < (1 / 2 : NNReal)}) ≤ R.generator bad := by rw [Measure.map_apply (R.lawOf_measurable b) MeasurableSpace.measurableSet_top] apply measure_mono_ae filter_upwards [R.rawScale_lawOf b, R.rawMass_pos] with w hscale hpos intro hw change toNNReal (R.rawScale (R.lawOf b w)) < (1 / 2 : NNReal) at hw rw [hscale, Real.toNNReal_lt_iff_lt_coe hpos.le] at hw norm_num at hw change w ∈ bad dsimp [bad] rw [abs_of_neg (by linarith : R.rawTotalMass w - 1 < 0)] linarith have hmeasure : (commonMarginalRecipePriorOf R branch) {P | toNNReal (R.rawScale P) < (1 / 2 : NNReal)} ≤ R.generator bad := by cases branch · simpa [commonMarginalRecipePriorOf, R.prior0_eq] using hmap false · simpa [commonMarginalRecipePriorOf, R.prior1_eq] using hmap true letI : IsProbabilityMeasure R.generator := R.generatorProbability calc ((commonMarginalRecipePriorOf R branch) {P | toNNReal (R.rawScale P) < (1 / 2 : NNReal)}).toReal ≤ (R.generator bad).toReal := ENNReal.toReal_mono (measure_ne_top _ _) hmeasure _ ≤ 4 * C * k * B * a := htail
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.commonMarginal_prior_scale_tail · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalTransferConcentration.lean:77
theorem commonMarginal_rawPriorCenter_abs_le_one

the stated conditions establishes the stated conclusion.

Formal statement
n m d L k :
B a u v C rho :
R :
CommonMarginalRecipe calibration n m d L B a k
hb :
CommonMarginalBounds R u v calibration.dualGap C rho
branch :
|rawPriorCenter R branch| ≤ 1
Proof (Lean source)
lemma commonMarginal_rawPriorCenter_abs_le_one {eps : Real} {calibration : CommonMarginalCalibration eps} {n m d L k : Nat} {B a u v C rho : Real} (R : CommonMarginalRecipe calibration n m d L B a k) (hb : CommonMarginalBounds R u v calibration.dualGap C rho) (branch : Bool) : |rawPriorCenter R branch| ≤ 1 := by letI : IsProbabilityMeasure R.generator := R.generatorProbability have htInt : Integrable (R.rawTarget branch) R.generator := (hb.target_memLp_two branch).integrable (by norm_num) have hsInt : Integrable R.rawTotalMass R.generator := hb.mass_memLp_two.integrable (by norm_num) have hmodel : ∀ᵐ w ∂R.generator, ModelClass d eps (R.lawOf branch w) := by cases branch · exact R.model0 · exact R.model1 have hdom : ∀ᵐ w ∂R.generator, |R.rawTarget branch w| ≤ R.rawTotalMass w := by filter_upwards [R.rawTarget_formula branch, R.rawMass_pos, hmodel] with w hformula hs hclass rw [hformula, abs_mul, abs_of_pos hs] have hate := ateFunctional_mem_Icc_neg_one_one _ hclass.overlap have habs : |ateFunctional (R.lawOf branch w)| ≤ 1 := abs_le.2 hate nlinarith unfold rawPriorCenter calc |∫ w, R.rawTarget branch w ∂R.generator| ≤ ∫ w, |R.rawTarget branch w| ∂R.generator := abs_integral_le_integral_abs _ ≤ ∫ w, R.rawTotalMass w ∂R.generator := integral_mono_ae htInt.abs hsInt hdom _ = 1 := hb.massMean
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.commonMarginal_rawPriorCenter_abs_le_one · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalTransferConcentration.lean:120
theorem commonMarginal_normalizedTarget_event

the stated conditions establishes the stated conclusion.

Formal statement
n m d L k :
B a u v C rho Delta :
R :
CommonMarginalRecipe calibration n m d L B a k
hb :
CommonMarginalBounds R u v calibration.dualGap C rho
branch :
hDelta :
0 < Delta
hDelta_le :
Delta ≤ 2
∀ᵐ w ∂R.generator, Delta / 4 < |ateFunctional (R.lawOf branch w)
- rawPriorCenter R branch| → Delta / 16 < |R.rawTarget branch w
- rawPriorCenter R branch| ∨ Delta / 16 < |R.rawTotalMass w
- 1|
Proof (Lean source)
lemma commonMarginal_normalizedTarget_event {eps : Real} {calibration : CommonMarginalCalibration eps} {n m d L k : Nat} {B a u v C rho Delta : Real} (R : CommonMarginalRecipe calibration n m d L B a k) (hb : CommonMarginalBounds R u v calibration.dualGap C rho) (branch : Bool) (hDelta : 0 < Delta) (hDelta_le : Delta ≤ 2) : ∀ᵐ w ∂R.generator, Delta / 4 < |ateFunctional (R.lawOf branch w) - rawPriorCenter R branch| → Delta / 16 < |R.rawTarget branch w - rawPriorCenter R branch| ∨ Delta / 16 < |R.rawTotalMass w - 1| := by have hc := commonMarginal_rawPriorCenter_abs_le_one R hb branch filter_upwards [R.rawTarget_formula branch, R.rawMass_pos] with w hformula hs intro hbad by_contra hgood push_neg at hgood have hSlo : 0 < R.rawTotalMass w := hs have hSclose := hgood.2 have hTclose := hgood.1 rw [hformula] at hTclose have hSbound : |R.rawTotalMass w - 1| ≤ Delta / 16 := hSclose have hTbound : |R.rawTotalMass w * ateFunctional (R.lawOf branch w) - rawPriorCenter R branch| ≤ Delta / 16 := hTclose have hscaleA : |R.rawTotalMass w * ateFunctional (R.lawOf branch w) - R.rawTotalMass w * rawPriorCenter R branch| = R.rawTotalMass w * |ateFunctional (R.lawOf branch w) - rawPriorCenter R branch| := by rw [← mul_sub, abs_mul, abs_of_pos hSlo] have hcenterScale : |R.rawTotalMass w * rawPriorCenter R branch - rawPriorCenter R branch| ≤ Delta / 16 := by rw [show R.rawTotalMass w * rawPriorCenter R branch - rawPriorCenter R branch = (R.rawTotalMass w - 1) * rawPriorCenter R branch by ring, abs_mul] calc |R.rawTotalMass w - 1| * |rawPriorCenter R branch| ≤ (Delta / 16) * 1 := mul_le_mul hSbound hc (abs_nonneg _) (by positivity) _ = Delta / 16 := by ring have hprod : R.rawTotalMass w * |ateFunctional (R.lawOf branch w) - rawPriorCenter R branch| ≤ Delta / 8 := by rw [← hscaleA] have htri := abs_sub_le (R.rawTotalMass w * ateFunctional (R.lawOf branch w)) (rawPriorCenter R branch) (R.rawTotalMass w * rawPriorCenter R branch) rw [abs_sub_comm (rawPriorCenter R branch) (R.rawTotalMass w * rawPriorCenter R branch)] at htri linarith have hSge : 1 - Delta / 16 ≤ R.rawTotalMass w := by have := (abs_le.mp hSbound).1 linarith have hSge' : (7 : Real) / 8 ≤ R.rawTotalMass w := by linarith have hmulLower : (7 : Real) / 8 * |ateFunctional (R.lawOf branch w) - rawPriorCenter R branch| ≤ R.rawTotalMass w * |ateFunctional (R.lawOf branch w) - rawPriorCenter R branch| := mul_le_mul_of_nonneg_right hSge' (abs_nonneg _) have hmulStrict : (7 : Real) / 8 * (Delta / 4) < (7 : Real) / 8 * |ateFunctional (R.lawOf branch w) - rawPriorCenter R branch| := mul_lt_mul_of_pos_left hbad (by norm_num) nlinarith [hprod, hmulLower, hmulStrict]
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.commonMarginal_normalizedTarget_event · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalTransferConcentration.lean:152
theorem commonMarginal_prior_target_concentration Lemma 18 in the paper ↗

the stated conditions establishes the stated conclusion.

Formal statement
n m d L k :
B a u v C rho Delta :
R :
CommonMarginalRecipe calibration n m d L B a k
hb :
CommonMarginalBounds R u v calibration.dualGap C rho
branch :
hDelta :
0 < Delta
hDelta_le :
Delta ≤ 2
(commonMarginalRecipePriorOf R branch).real {P | Delta / 4 < |ateFunctional P - rawPriorCenter R branch|}
≤ 512 * C * k * B * a / Delta ^ 2
Proof (Lean source)
lemma commonMarginal_prior_target_concentration {eps : Real} {calibration : CommonMarginalCalibration eps} {n m d L k : Nat} {B a u v C rho Delta : Real} (R : CommonMarginalRecipe calibration n m d L B a k) (hb : CommonMarginalBounds R u v calibration.dualGap C rho) (branch : Bool) (hDelta : 0 < Delta) (hDelta_le : Delta ≤ 2) : (commonMarginalRecipePriorOf R branch).real {P | Delta / 4 < |ateFunctional P - rawPriorCenter R branch|} ≤ 512 * C * k * B * a / Delta ^ 2 := by letI : IsProbabilityMeasure R.generator := R.generatorProbability let targetBad : Set (Fin k → Real) := {w | Delta / 16 < |R.rawTarget branch w - rawPriorCenter R branch|} let massBad : Set (Fin k → Real) := {w | Delta / 16 < |R.rawTotalMass w - 1|} have hsubset : ((R.generator.map (R.lawOf branch)).real {P | Delta / 4 < |ateFunctional P - rawPriorCenter R branch|}) ≤ (R.generator (targetBad ∪ massBad)).toReal := by rw [Measure.real, Measure.map_apply (R.lawOf_measurable branch) MeasurableSpace.measurableSet_top] apply ENNReal.toReal_mono (measure_ne_top _ _) apply measure_mono_ae filter_upwards [commonMarginal_normalizedTarget_event R hb branch hDelta hDelta_le] with w hw intro hbad exact hw hbad have htarget := commonMarginal_target_concentration R hb branch (show 0 < Delta / 16 by positivity) have hmass := commonMarginal_mass_concentration_at R hb (show 0 < Delta / 16 by positivity) have hunion : (R.generator (targetBad ∪ massBad)).toReal ≤ (R.generator targetBad).toReal + (R.generator massBad).toReal := by have h := measure_union_le targetBad massBad (μ := R.generator) calc (R.generator (targetBad ∪ massBad)).toReal ≤ (R.generator targetBad + R.generator massBad).toReal := ENNReal.toReal_mono (ENNReal.add_ne_top.mpr ⟨measure_ne_top _ _, measure_ne_top _ _⟩) h _ = (R.generator targetBad).toReal + (R.generator massBad).toReal := ENNReal.toReal_add (measure_ne_top _ _) (measure_ne_top _ _) have hmap : (commonMarginalRecipePriorOf R branch).real {P | Delta / 4 < |ateFunctional P - rawPriorCenter R branch|} ≤ (R.generator (targetBad ∪ massBad)).toReal := by cases branch · simpa [commonMarginalRecipePriorOf, R.prior0_eq] using hsubset · simpa [commonMarginalRecipePriorOf, R.prior1_eq] using hsubset refine hmap.trans (hunion.trans ?_) dsimp [targetBad, massBad] at htarget hmass ⊢ calc (R.generator {w | Delta / 16 < |R.rawTarget branch w - rawPriorCenter R branch|}).toReal + (R.generator {w | Delta / 16 < |R.rawTotalMass w - 1|}).toReal ≤ C * k * B * a / (Delta / 16) ^ 2 + C * k * B * a / (Delta / 16) ^ 2 := add_le_add htarget hmass _ = 512 * C * k * B * a / Delta ^ 2 := by field_simp [ne_of_gt hDelta] ring
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.commonMarginal_prior_target_concentration · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalTransferConcentration.lean:224
theorem commonMarginal_raw_bayesSquared_eq_bayesDecision

the stated conditions establishes the stated conclusion.

Formal statement
eps :
X :
calibration :
n m d L k :
B a u v C rho :
R :
CommonMarginalRecipe calibration n m d L B a k
hb :
CommonMarginalBounds R u v calibration.dualGap C rho
branch :
K :
rule :
X → Real
Proof (Lean source)
lemma commonMarginal_raw_bayesSquared_eq_bayesDecision {eps : Real} {X : Type*} [MeasurableSpace X] {calibration : CommonMarginalCalibration eps} {n m d L k : Nat} {B a u v C rho : Real} (R : CommonMarginalRecipe calibration n m d L B a k) (hb : CommonMarginalBounds R u v calibration.dualGap C rho) (branch : Bool) (K : Kernel (DiscreteLaw d) X) (rule : X → Real) : Causalean.Stat.Minimax.FuzzyHypotheses.bayesSquaredRisk (commonMarginalRecipePriorOf R branch) K ateFunctional (fun x => commonMarginalTransferClip (rule x)) = bayesDecisionRisk (commonMarginalRecipePriorOf R branch) K (commonMarginalTransferLoss eps) rule := by unfold Causalean.Stat.Minimax.FuzzyHypotheses.bayesSquaredRisk bayesDecisionRisk apply lintegral_congr_ae have hclass : ∀ᵐ P ∂commonMarginalRecipePriorOf R branch, ModelClass d eps P := by cases branch · simpa [commonMarginalRecipePriorOf] using hb.class0 · simpa [commonMarginalRecipePriorOf] using hb.class1 filter_upwards [hclass] with P hP simp [squaredRisk, decisionRisk, commonMarginalTransferLoss, hP]
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.commonMarginal_raw_bayesSquared_eq_bayesDecision · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalTransferConcentration.lean:284
theorem commonMarginal_raw_fuzzy_lower

the stated conditions establishes the stated conclusion.

Formal statement
eps :
X :
calibration :
n m d L k :
B a u v C rho Delta :
R :
CommonMarginalRecipe calibration n m d L B a k
hb :
CommonMarginalBounds R u v calibration.dualGap C rho
K :
hK :
hDelta :
0 < Delta
hsep :
hmass0 :
hmass1 :
≤ 1 / 16
rule :
X → Real
Proof (Lean source)
lemma commonMarginal_raw_fuzzy_lower {eps : Real} {X : Type*} [MeasurableSpace X] {calibration : CommonMarginalCalibration eps} {n m d L k : Nat} {B a u v C rho Delta : Real} (R : CommonMarginalRecipe calibration n m d L B a k) (hb : CommonMarginalBounds R u v calibration.dualGap C rho) (K : Kernel (DiscreteLaw d) X) (hK : ∀ P, IsProbabilityMeasure (K P)) (hDelta : 0 < Delta) (hsep : Delta ≤ |rawPriorCenter R true - rawPriorCenter R false|) (hmass0 : (commonMarginalRecipePriorOf R false).real {P | Delta / 4 < |ateFunctional P - rawPriorCenter R false|} ≤ 1 / 16) (hmass1 : (commonMarginalRecipePriorOf R true).real {P | Delta / 4 < |ateFunctional P - rawPriorCenter R true|} ≤ 1 / 16) (htv : tvDist (priorPredictive (commonMarginalRecipePriorOf R false) K) (priorPredictive (commonMarginalRecipePriorOf R true) K) ≤ 1 / 8) : ∀ rule : X → Real, Measurable rule → ofReal (3 * Delta ^ 2 / 128) ≤ max (bayesDecisionRisk (commonMarginalRecipePriorOf R false) K (commonMarginalTransferLoss eps) rule) (bayesDecisionRisk (commonMarginalRecipePriorOf R true) K (commonMarginalTransferLoss eps) rule) := by letI : IsProbabilityMeasure R.prior0 := R.probability0 letI : IsProbabilityMeasure R.prior1 := R.probability1 letI : IsProbabilityMeasure (commonMarginalRecipePriorOf R false) := by simpa [commonMarginalRecipePriorOf] using R.probability0 letI : IsProbabilityMeasure (commonMarginalRecipePriorOf R true) := by simpa [commonMarginalRecipePriorOf] using R.probability1 intro rule hrule have hclip : Measurable (fun x => commonMarginalTransferClip (rule x)) := measurable_const.max (measurable_const.min hrule) have htarget : Measurable (ateFunctional : DiscreteLaw d → Real) := measurable_from_top have hconst : (((Delta / 2 - Delta / 4) ^ 2 * (1 - (1 / 8 : Real) - 1 / 16 - 1 / 16)) / 2) = 3 * Delta ^ 2 / 128 := by ring by_cases horder : rawPriorCenter R false ≤ rawPriorCenter R true · have hsep' : Delta ≤ rawPriorCenter R true - rawPriorCenter R false := by rw [abs_of_nonneg (sub_nonneg.mpr horder)] at hsep exact hsep have h := twoFuzzyHypotheses_bayesRisk_lower (commonMarginalRecipePriorOf R false) (commonMarginalRecipePriorOf R true) K ateFunctional hK (fun x => commonMarginalTransferClip (rule x)) hclip htarget (rawPriorCenter R false) (rawPriorCenter R true) Delta (Delta / 4) (1 / 16) (1 / 16) (1 / 8) (by linarith) hsep' hmass0 hmass1 htv rw [hconst, commonMarginal_raw_bayesSquared_eq_bayesDecision R hb false K rule, commonMarginal_raw_bayesSquared_eq_bayesDecision R hb true K rule] at h exact h · have horder' : rawPriorCenter R true ≤ rawPriorCenter R false := le_of_not_ge horder have hsep' : Delta ≤ rawPriorCenter R false - rawPriorCenter R true := by rw [abs_of_nonpos (sub_nonpos.mpr horder')] at hsep linarith have h := twoFuzzyHypotheses_bayesRisk_lower (commonMarginalRecipePriorOf R true) (commonMarginalRecipePriorOf R false) K ateFunctional hK (fun x => commonMarginalTransferClip (rule x)) hclip htarget (rawPriorCenter R true) (rawPriorCenter R false) Delta (Delta / 4) (1 / 16) (1 / 16) (1 / 8) (by linarith) hsep' hmass1 hmass0 (by have hcomm : tvDist (priorPredictive (commonMarginalRecipePriorOf R true) K) (priorPredictive (commonMarginalRecipePriorOf R false) K) = tvDist (priorPredictive (commonMarginalRecipePriorOf R false) K) (priorPredictive (commonMarginalRecipePriorOf R true) K) := by unfold tvDist congr 1 funext A rw [abs_sub_comm] rw [hcomm] exact htv) rw [hconst, commonMarginal_raw_bayesSquared_eq_bayesDecision R hb true K rule, commonMarginal_raw_bayesSquared_eq_bayesDecision R hb false K rule] at h simpa [max_comm] using h
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.commonMarginal_raw_fuzzy_lower · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalTransferConcentration.lean:309

the stated conditions establishes the stated conclusion.

Formal statement
N :
hN :
1 ≤ N
lambda :
hlambda :
(32768 : Real) * N ≤ lambda
poissonMeasure lambda (Iio N) ≤ ofReal (1 / (4096 * (N : Real)))
Proof (Lean source)
lemma commonMarginal_poisson_lower_tail (N : Nat) (hN : 1 ≤ N) (lambda : NNReal) (hlambda : (32768 : Real) * N ≤ lambda) : poissonMeasure lambda (Iio N) ≤ ofReal (1 / (4096 * (N : Real))) := by have hNR : (0 : Real) < N := by exact_mod_cast hN have hlambdaR : (0 : Real) < lambda := lt_of_lt_of_le (by positivity) hlambda let z : Real := (lambda : Real) / 8 have hz : 0 ≤ z := by dsimp [z]; positivity have hsqrt : sqrt (2 * (lambda : Real) * z) = (lambda : Real) / 2 := by dsimp [z] rw [show 2 * (lambda : Real) * ((lambda : Real) / 8) = ((lambda : Real) / 2) ^ 2 by ring, Real.sqrt_sq_eq_abs, abs_of_nonneg (by positivity)] have hsubset : Iio N ⊆ {w : Nat | (lambda : Real) - (w : Real) > sqrt (2 * (lambda : Real) * z)} := by intro w hw simp only [Set.mem_Iio] at hw have hwR : (w : Real) < N := by exact_mod_cast hw change sqrt (2 * (lambda : Real) * z) < (lambda : Real) - (w : Real) rw [hsqrt] nlinarith have hbern := Causalean.Stat.Concentration.PoissonSelfNormalized.poisson_lower_bernstein lambda hz have htail : poissonMeasure lambda (Iio N) ≤ ofReal (exp (-z)) := (measure_mono hsubset).trans hbern refine htail.trans (ENNReal.ofReal_le_ofReal ?_) have hzpos : 0 < z := by dsimp [z]; positivity have hexp : z ≤ exp z := by linarith [Real.add_one_le_exp z] calc exp (-z) = 1 / exp z := by rw [Real.exp_neg, one_div] _ ≤ 1 / z := one_div_le_one_div_of_le hzpos hexp _ ≤ 1 / (4096 * (N : Real)) := by apply one_div_le_one_div_of_le (by positivity) dsimp [z] nlinarith
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.commonMarginal_poisson_lower_tail · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalTransferConcentration.lean:395
CausalSmith.Stat.STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research.Helpers.CommonMarginalTransferReconstruction 9 declarations Raw-count reindexing, ordered Poisson kernels, and predictive reconstruction.

Raw-count reindexing, ordered Poisson kernels, and predictive reconstruction.

def commonMarginalLabeledMarkKernel

the stated conditions defines the specified object.

Definition (Lean source)
d :
commonMarginalLabeledMarkKernel d :
Kernel (DiscreteLaw d) (Obs d)
clause 1
toFun P := obsLaw P
clause 2
measurable' := measurable_from_top
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.commonMarginalLabeledMarkKernel · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalTransferReconstruction.lean:15
instance instIsProbabilityMeasureObsCoeKernelDiscreteLawMeasureCommonMarginalLabeledMarkKernel

the stated conditions defines the specified object.

Definition (Lean source)
instance (d : Nat) (P : DiscreteLaw d) : IsProbabilityMeasure ((commonMarginalLabeledMarkKernel d) P) := by change IsProbabilityMeasure (obsLaw P) infer_instance
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.instIsProbabilityMeasureObsCoeKernelDiscreteLawMeasureCommonMarginalLabeledMarkKernel · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalTransferReconstruction.lean:20
def commonMarginalAuxMarkKernel

the stated conditions defines the specified object.

Definition (Lean source)
d :
commonMarginalAuxMarkKernel d :
clause 1
toFun P := (auxMarginal P).toMeasure
clause 2
measurable' := measurable_from_top
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.commonMarginalAuxMarkKernel · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalTransferReconstruction.lean:28
instance instIsProbabilityMeasureAuxObsCoeKernelDiscreteLawMeasureCommonMarginalAuxMarkKernel

the stated conditions defines the specified object.

Definition (Lean source)
instance (d : Nat) (P : DiscreteLaw d) : IsProbabilityMeasure ((commonMarginalAuxMarkKernel d) P) := by change IsProbabilityMeasure (auxMarginal P).toMeasure infer_instance
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.instIsProbabilityMeasureAuxObsCoeKernelDiscreteLawMeasureCommonMarginalAuxMarkKernel · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalTransferReconstruction.lean:33
def commonMarginalOrderedRawKernel

the stated conditions defines the specified object.

Definition (Lean source)
n m d L k :
B a :
R :
CommonMarginalRecipe calibration n m d L B a k
u v :
commonMarginalOrderedRawKernel R u v :
clause 1
toFun P := (finitePoissonSampleLaw (obsLaw P) (u * toNNReal (R.rawScale P))).prod (finitePoissonSampleLaw (auxMarginal P).toMeasure (v * toNNReal (R.rawScale P)))
clause 2
measurable' := measurable_from_top
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.commonMarginalOrderedRawKernel · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalTransferReconstruction.lean:41
theorem commonMarginal_orderedRaw_isRandomScale

The formal statement establishes the stated conclusion.

Formal statement
n m d L k :
B a :
R :
CommonMarginalRecipe calibration n m d L B a k
u v :
Proof (Lean source)
lemma commonMarginal_orderedRaw_isRandomScale {eps : Real} {calibration : CommonMarginalCalibration eps} {n m d L k : Nat} {B a : Real} (R : CommonMarginalRecipe calibration n m d L B a k) (u v : NNReal) : IsRandomScaleTwoPoolExperiment (commonMarginalOrderedRawKernel R u v) (commonMarginalLabeledMarkKernel d) (commonMarginalAuxMarkKernel d) (fun P => toNNReal (R.rawScale P)) u v := by intro P rfl
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.commonMarginal_orderedRaw_isRandomScale · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalTransferReconstruction.lean:57
def commonMarginalRawCountEquiv

The nested count-table encoding used by the common-marginal construction is canonically equivalent to a pair of labeled and auxiliary histograms. the stated conditions the stated conclusion.

Definition (Lean source)
d :
commonMarginalRawCountEquiv d :
RawPoissonCounts d ≃ ((Obs d → Nat) × (AuxObs d → Nat))
clause 1
toFun z := (⟨fun o => if o.2.2 then (z o.1 o.2.1).1.1 else (z o.1 o.2.1).1.2, fun o => (z o.1 o.2).2⟩)
clause 2
invFun z := fun x arm => ((z.1 (x, arm, true), z.1 (x, arm, false)), z.2 (x, arm))
clause 3
left_inv z := by funext x arm simp
clause 4
right_inv z := by rcases z with ⟨zL, zU⟩ apply Prod.ext · funext o rcases o with ⟨x, arm, y⟩ cases y <;> rfl · funext o rcases o with ⟨x, arm⟩ rfl
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.commonMarginalRawCountEquiv · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalTransferReconstruction.lean:72
theorem rawPoissonLaw_map_commonMarginalRawCountEquiv

Reindexing the recipe's nested raw count law gives the generic paired independent-Poisson histogram law consumed by histogram reconstruction. the stated conditions the stated conclusion.

Formal statement
d :
P :
scale u v :
hu :
0 ≤ u
hv :
0 ≤ v
Measure.map (commonMarginalRawCountEquiv d) (rawPoissonLaw P scale u v)
= (independentPoissonCountLaw (obsLaw P) (toNNReal (u * scale))).prod (independentPoissonCountLaw (auxMarginal P).toMeasure (toNNReal (v * scale)))
Proof (Lean source)
lemma rawPoissonLaw_map_commonMarginalRawCountEquiv {d : Nat} (P : DiscreteLaw d) (scale u v : Real) (hu : 0 ≤ u) (hv : 0 ≤ v) : Measure.map (commonMarginalRawCountEquiv d) (rawPoissonLaw P scale u v) = (independentPoissonCountLaw (obsLaw P) (toNNReal (u * scale))).prod (independentPoissonCountLaw (auxMarginal P).toMeasure (toNNReal (v * scale))) := by apply Measure.ext_of_singleton rintro ⟨zL, zU⟩ rw [Measure.map_apply (measurable_of_countable _) (measurableSet_singleton (zL, zU))] rw [show (commonMarginalRawCountEquiv d : RawPoissonCounts d → ((Obs d → Nat) × (AuxObs d → Nat))) ⁻¹' ({(zL, zU)} : Set ((Obs d → Nat) × (AuxObs d → Nat))) = {((commonMarginalRawCountEquiv d).symm (zL, zU))} by ext z constructor · intro h calc z = (commonMarginalRawCountEquiv d).symm ((commonMarginalRawCountEquiv d) z) := by simp _ = (commonMarginalRawCountEquiv d).symm (zL, zU) := by rw [h] · intro h rw [h] simp] rw [show ({(zL, zU)} : Set ((Obs d → Nat) × (AuxObs d → Nat))) = ({zL} : Set (Obs d → Nat)) ×ˢ ({zU} : Set (AuxObs d → Nat)) by ext z simp] rw [Measure.prod_prod] have hobsRate (x : Fin d) (arm y : Bool) : toNNReal (u * scale * jointMass P x arm y) = toNNReal u * toNNReal scale * ((obsLaw P) ({(x, arm, y)} : Set (Obs d))).toNNReal := by have hj : 0 ≤ jointMass P x arm y := ENNReal.toReal_nonneg have hjNN : toNNReal (jointMass P x arm y) = ((obsLaw P) ({(x, arm, y)} : Set (Obs d))).toNNReal := by apply NNReal.eq simpa [obsLaw, jointMass, Real.coe_toNNReal] using (ENNReal.coe_toNNReal_eq_toReal (P.pmf (x, arm, y))).symm calc toNNReal (u * scale * jointMass P x arm y) = toNNReal (u * (jointMass P x arm y * scale)) := by congr 1 <;> ring _ = toNNReal u * toNNReal (jointMass P x arm y * scale) := Real.toNNReal_mul hu _ = toNNReal u * (toNNReal (jointMass P x arm y) * toNNReal scale) := by rw [Real.toNNReal_mul hj] _ = toNNReal u * toNNReal scale * ((obsLaw P) ({(x, arm, y)} : Set (Obs d))).toNNReal := by rw [hjNN] ac_rfl have hauxMass (x : Fin d) (arm : Bool) : (auxMarginal P (x, arm)).toReal = armMass P x arm := by unfold auxMarginal armMass jointMass rw [PMF.map_apply, tsum_fintype] cases arm <;> simp only [Fintype.sum_prod_type] <;> simp all_goals rw [ENNReal.toReal_add (PMF.apply_ne_top _ _) (PMF.apply_ne_top _ _)] have hauxRate (x : Fin d) (arm : Bool) : toNNReal (v * scale * armMass P x arm) = toNNReal v * toNNReal scale * ((auxMarginal P).toMeasure ({(x, arm)} : Set (AuxObs d))).toNNReal := by have ha : 0 ≤ armMass P x arm := by unfold armMass jointMass positivity have haNN : toNNReal (armMass P x arm) = ((auxMarginal P).toMeasure ({(x, arm)} : Set (AuxObs d))).toNNReal := by apply NNReal.eq rw [PMF.toMeasure_apply_singleton _ _ (measurableSet_singleton _)] rw [ENNReal.coe_toNNReal_eq_toReal, hauxMass] exact Real.coe_toNNReal _ ha calc toNNReal (v * scale * armMass P x arm) = toNNReal (v * (armMass P x arm * scale)) := by congr 1 <;> ring _ = toNNReal v * toNNReal (armMass P x arm * scale) := Real.toNNReal_mul hv _ = toNNReal v * (toNNReal (armMass P x arm) * toNNReal scale) := by rw [Real.toNNReal_mul ha] _ = toNNReal v * toNNReal scale * ((auxMarginal P).toMeasure ({(x, arm)} : Set (AuxObs d))).toNNReal := by rw [haNN] ac_rfl have hcontrolMass (x : Fin d) (arm : Bool) : armMass P x arm - markedMass P x arm = jointMass P x arm false := by unfold armMass markedMass simp simp [rawPoissonLaw, independentPoissonCountLaw, commonMarginalRawCountEquiv, Measure.pi_singleton, Real.toNNReal_mul hu, Real.toNNReal_mul hv] simp_rw [← Set.singleton_prod_singleton, Measure.prod_prod] simp_rw [hcontrolMass] simp_rw [markedMass] simp_rw [hobsRate] simp_rw [hauxRate] simp [Fintype.prod_prod_type] simp_rw [Finset.prod_mul_distrib] ac_rfl
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.rawPoissonLaw_map_commonMarginalRawCountEquiv · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalTransferReconstruction.lean:93
theorem commonMarginal_predictive_reconstruction_contraction

Reindexing the nested raw counts and reconstructing the two ordered Poisson samples is a common Markov channel, so it contracts the distance between the recipe's two prior-predictive laws. the stated conditions the stated conclusion.

Formal statement
n m d L k :
B a u v :
R :
CommonMarginalRecipe calibration n m d L B a k
hu :
0 ≤ u
hv :
0 ≤ v
hRu :
R.labeledIntensity = u
hRv :
R.auxiliaryIntensity = v
≤ tvDist R.rawExperiment0 R.rawExperiment1
Proof (Lean source)
lemma commonMarginal_predictive_reconstruction_contraction {eps : Real} {calibration : CommonMarginalCalibration eps} {n m d L k : Nat} {B a u v : Real} (R : CommonMarginalRecipe calibration n m d L B a k) (hu : 0 ≤ u) (hv : 0 ≤ v) (hRu : R.labeledIntensity = u) (hRv : R.auxiliaryIntensity = v) : tvDist (priorPredictive R.prior0 (commonMarginalOrderedRawKernel R (toNNReal u) (toNNReal v))) (priorPredictive R.prior1 (commonMarginalOrderedRawKernel R (toNNReal u) (toNNReal v))) ≤ tvDist R.rawExperiment0 R.rawExperiment1 := by let Kreindex : Kernel (RawPoissonCounts d) ((Obs d → Nat) × (AuxObs d → Nat)) := Kernel.deterministic (commonMarginalRawCountEquiv d) (measurable_of_countable _) let Kreconstruct := pairedHistogramReconstructionKernel (Obs d) (AuxObs d) let K := Kreconstruct ∘ₖ Kreindex have hkernel : K ∘ₖ R.experimentKernel = commonMarginalOrderedRawKernel R (toNNReal u) (toNNReal v) := by apply Kernel.ext intro P dsimp only [K] rw [Kernel.comp_assoc, Kernel.comp_apply, Kernel.comp_apply] change Kreconstruct ∘ₘ (Kernel.deterministic (commonMarginalRawCountEquiv d) (measurable_of_countable _) ∘ₘ R.experimentKernel P) = _ rw [Measure.deterministic_comp_eq_map, R.experimentKernel_eq, hRu, hRv, rawPoissonLaw_map_commonMarginalRawCountEquiv P (R.rawScale P) u v hu hv, pairedIndependentPoissonCountLaw_comp_reconstruction] simp only [commonMarginalOrderedRawKernel] rw [Real.toNNReal_mul hu, Real.toNNReal_mul hv] rfl have hbranch0 : K ∘ₘ R.rawExperiment0 = priorPredictive R.prior0 (commonMarginalOrderedRawKernel R (toNNReal u) (toNNReal v)) := by rw [R.rawExperiment0_eq] unfold priorPredictive rw [Measure.comp_assoc, hkernel] have hbranch1 : K ∘ₘ R.rawExperiment1 = priorPredictive R.prior1 (commonMarginalOrderedRawKernel R (toNNReal u) (toNNReal v)) := by rw [R.rawExperiment1_eq] unfold priorPredictive rw [Measure.comp_assoc, hkernel] rw [← hbranch0, ← hbranch1] letI : IsProbabilityMeasure R.prior0 := R.probability0 letI : IsProbabilityMeasure R.prior1 := R.probability1 have hExperimentProbability (P : DiscreteLaw d) : IsProbabilityMeasure (R.experimentKernel P) := by rw [R.experimentKernel_eq] unfold rawPoissonLaw infer_instance letI : IsProbabilityMeasure R.rawExperiment0 := by rw [R.rawExperiment0_eq] exact Causalean.Stat.Minimax.MomentMatchedMixture.priorPredictive_isProbability R.prior0 R.experimentKernel hExperimentProbability letI : IsProbabilityMeasure R.rawExperiment1 := by rw [R.rawExperiment1_eq] exact Causalean.Stat.Minimax.MomentMatchedMixture.priorPredictive_isProbability R.prior1 R.experimentKernel hExperimentProbability exact tvDist_bind_le R.rawExperiment0 R.rawExperiment1 K
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.commonMarginal_predictive_reconstruction_contraction · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalTransferReconstruction.lean:198
CausalSmith.Stat.STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research.Helpers.CommonMarginalTransferRisk 13 declarations Loss, clipping, and minimax-risk bridges for common-marginal transfer.

Loss, clipping, and minimax-risk bridges for common-marginal transfer.

the stated conditions defines the specified object.

Definition (Lean source)
z :
commonMarginalTransferClip z :
max (-1) (min 1 z)
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.commonMarginalTransferClip · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalTransferRisk.lean:26
def commonMarginalTransferLoss

the stated conditions defines the specified object.

Definition (Lean source)
d :
eps :
commonMarginalTransferLoss eps :
by classical exact fun P z
=> if ModelClass d eps P then ofReal ((commonMarginalTransferClip z - ateFunctional P) ^ 2) else 0
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.commonMarginalTransferLoss · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalTransferRisk.lean:31
def commonMarginalFixedKernel

the stated conditions defines the specified object.

Definition (Lean source)
n m d :
commonMarginalFixedKernel n m d :
Kernel (DiscreteLaw d) (Sample n m d)
clause 1
toFun P := annotationLaw P n m
clause 2
measurable' := measurable_from_top
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.commonMarginalFixedKernel · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalTransferRisk.lean:41
theorem commonMarginalTransferLoss_measurable

The formal statement establishes the stated conclusion.

Formal statement
d :
eps :
Proof (Lean source)
lemma commonMarginalTransferLoss_measurable {d : Nat} (eps : Real) : Measurable (uncurry (commonMarginalTransferLoss (d := d) eps)) := by have hat : Measurable (ateFunctional : DiscreteLaw d → Real) := measurable_from_top unfold commonMarginalTransferLoss uncurry apply Measurable.ite · exact measurable_fst MeasurableSpace.measurableSet_top · apply ENNReal.measurable_ofReal.comp apply Measurable.pow_const exact (measurable_const.max (measurable_const.min measurable_snd)).sub (hat.comp measurable_fst) · exact measurable_const
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.commonMarginalTransferLoss_measurable · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalTransferRisk.lean:48
theorem commonMarginalTransferLoss_le_four

The formal statement establishes the stated conclusion.

Formal statement
d :
eps :
P :
z :
Proof (Lean source)
lemma commonMarginalTransferLoss_le_four {d : Nat} (eps : Real) (P : DiscreteLaw d) (z : Real) : commonMarginalTransferLoss eps P z ≤ (4 : ENNReal) := by unfold commonMarginalTransferLoss split_ifs with hP · rw [show (4 : ENNReal) = ofReal 4 by norm_num] apply ENNReal.ofReal_le_ofReal have hz0 : -1 ≤ commonMarginalTransferClip z := le_max_left _ _ have hz1 : commonMarginalTransferClip z ≤ 1 := max_le (by norm_num) (min_le_left _ _) have ht := ateFunctional_mem_Icc_neg_one_one P hP.overlap have hd : |commonMarginalTransferClip z - ateFunctional P| ≤ 2 := abs_le.2 ⟨by linarith [ht.2], by linarith [ht.1]⟩ have hs : (commonMarginalTransferClip z - ateFunctional P) ^ 2 ≤ (2 : Real) ^ 2 := (sq_le_sq).2 (by simpa using hd) norm_num at hs ⊢ exact hs · simp
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.commonMarginalTransferLoss_le_four · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalTransferRisk.lean:62
theorem commonMarginal_clippedLoss_lintegral

the stated conditions establishes the stated conclusion.

Formal statement
n m d :
eps :
P :
hP :
ModelClass d eps P
rule :
Sample n m d → Real
hrule :
Proof (Lean source)
lemma commonMarginal_clippedLoss_lintegral {n m d : Nat} {eps : Real} (P : DiscreteLaw d) (hP : ModelClass d eps P) (rule : Sample n m d → Real) (hrule : Measurable rule) : decisionRisk (commonMarginalFixedKernel n m d) (commonMarginalTransferLoss eps) rule P = ofReal (twoSampleMSE (annotationLaw P n m) (fun z => commonMarginalTransferClip (rule z)) (ateFunctional P)) := by classical letI : IsProbabilityMeasure (annotationLaw P n m) := by unfold annotationLaw labeledProductLaw auxProductLaw infer_instance have hclip : Measurable (fun z => commonMarginalTransferClip (rule z)) := by exact (measurable_const.max (measurable_const.min hrule)) have ht := ateFunctional_mem_Icc_neg_one_one P hP.overlap have hclip_mem (z : Sample n m d) : commonMarginalTransferClip (rule z) ∈ Icc (-1 : Real) 1 := by constructor · exact le_max_left _ _ · exact max_le (by norm_num) (min_le_left _ _) have hsqInt : Integrable (fun z => (commonMarginalTransferClip (rule z) - ateFunctional P) ^ 2) (annotationLaw P n m) := by apply Integrable.of_bound ((hclip.sub measurable_const).pow_const 2).aestronglyMeasurable 4 filter_upwards with z rw [Real.norm_eq_abs, abs_of_nonneg (sq_nonneg _)] change (commonMarginalTransferClip (rule z) - ateFunctional P) ^ 2 ≤ 4 rcases hclip_mem z with ⟨hz0, hz1⟩ rcases ht with ⟨ht0, ht1⟩ nlinarith [sq_nonneg (commonMarginalTransferClip (rule z) - ateFunctional P - 2), sq_nonneg (commonMarginalTransferClip (rule z) - ateFunctional P + 2)] unfold decisionRisk commonMarginalFixedKernel commonMarginalTransferLoss simp only [if_pos hP] change (∫⁻ z, ofReal ((commonMarginalTransferClip (rule z) - ateFunctional P) ^ 2) ∂annotationLaw P n m) = _ rw [← ofReal_integral_eq_lintegral_ofReal hsqInt (Filter.Eventually.of_forall fun z => sq_nonneg _)] rfl
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.commonMarginal_clippedLoss_lintegral · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalTransferRisk.lean:83
theorem commonMarginalTransferClip_sq_sub_le

the stated conditions establishes the stated conclusion.

Formal statement
z theta :
htheta :
theta ∈ Icc (-1 : Real) 1
(commonMarginalTransferClip z - theta) ^ 2 ≤ (z - theta) ^ 2
Proof (Lean source)
lemma commonMarginalTransferClip_sq_sub_le (z theta : Real) (htheta : theta ∈ Icc (-1 : Real) 1) : (commonMarginalTransferClip z - theta) ^ 2 ≤ (z - theta) ^ 2 := by unfold commonMarginalTransferClip by_cases hz1 : z ≤ 1 · rw [min_eq_right hz1] by_cases hzm : -1 ≤ z · rw [max_eq_right hzm] · rw [max_eq_left (le_of_not_ge hzm)] nlinarith [htheta.1, sq_nonneg (z - theta)] · rw [min_eq_left (le_of_not_ge hz1), max_eq_right (by norm_num)] nlinarith [htheta.2, sq_nonneg (z - theta)]
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.commonMarginalTransferClip_sq_sub_le · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalTransferRisk.lean:125
theorem commonMarginal_clipping_mse_le

the stated conditions establishes the stated conclusion.

Formal statement
eps :
n m d :
P :
hP :
ModelClass d eps P
rule :
Sample n m d → Real
Proof (Lean source)
lemma commonMarginal_clipping_mse_le {eps : Real} {n m d : Nat} (P : DiscreteLaw d) (hP : ModelClass d eps P) (rule : Sample n m d → Real) : twoSampleMSE (annotationLaw P n m) (fun z => commonMarginalTransferClip (rule z)) (ateFunctional P) ≤ twoSampleMSE (annotationLaw P n m) rule (ateFunctional P) := by letI : IsProbabilityMeasure (annotationLaw P n m) := by unfold annotationLaw labeledProductLaw auxProductLaw infer_instance unfold twoSampleMSE have hleft : Integrable (fun z => (commonMarginalTransferClip (rule z) - ateFunctional P) ^ 2) (annotationLaw P n m) := (MemLp.of_discrete (p := 1)).integrable (by norm_num) have hright : Integrable (fun z => (rule z - ateFunctional P) ^ 2) (annotationLaw P n m) := (MemLp.of_discrete (p := 1)).integrable (by norm_num) apply integral_mono hleft hright intro z exact commonMarginalTransferClip_sq_sub_le _ _ (ateFunctional_mem_Icc_neg_one_one P hP.overlap)
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.commonMarginal_clipping_mse_le · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalTransferRisk.lean:140
theorem commonMarginal_classGated_worstCase_le

the stated conditions establishes the stated conclusion.

Formal statement
n m d :
eps :
rule :
Sample n m d → Real
hrule :
Proof (Lean source)
lemma commonMarginal_classGated_worstCase_le {n m d : Nat} {eps : Real} (rule : Sample n m d → Real) (hrule : Measurable rule) : worstCaseDecisionRisk (commonMarginalFixedKernel n m d) (commonMarginalTransferLoss eps) rule ≤ ⨆ P : ClassLaw d eps, ofReal (twoSampleMSE (annotationLaw P.1 n m) rule (ateFunctional P.1)) := by classical unfold worstCaseDecisionRisk apply iSup_le intro P by_cases hP : ModelClass d eps P · rw [commonMarginal_clippedLoss_lintegral P hP rule hrule] refine (ENNReal.ofReal_le_ofReal (commonMarginal_clipping_mse_le P hP rule)).trans ?_ exact le_iSup (fun Q : ClassLaw d eps => ofReal (twoSampleMSE (annotationLaw Q.1 n m) rule (ateFunctional Q.1))) ⟨P, hP⟩ · unfold decisionRisk commonMarginalTransferLoss commonMarginalFixedKernel simp [hP]
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.commonMarginal_classGated_worstCase_le · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalTransferRisk.lean:162
theorem commonMarginal_mse_bddAbove

The formal statement establishes the stated conclusion.

Formal statement
n m d :
eps :
rule :
Sample n m d → Real
BddAbove (Set.range fun P : ClassLaw d eps => twoSampleMSE (annotationLaw P.1 n m) rule (ateFunctional P.1))
Proof (Lean source)
lemma commonMarginal_mse_bddAbove {n m d : Nat} {eps : Real} (rule : Sample n m d → Real) : BddAbove (Set.range fun P : ClassLaw d eps => twoSampleMSE (annotationLaw P.1 n m) rule (ateFunctional P.1)) := by let M : Real := ∑ z : Sample n m d, |rule z| + 1 refine ⟨M ^ 2, ?_⟩ rintro value ⟨P, rfl⟩ letI : IsProbabilityMeasure (annotationLaw P.1 n m) := by unfold annotationLaw labeledProductLaw auxProductLaw infer_instance have hM0 : 0 ≤ M := by dsimp [M] positivity have hruleM (z : Sample n m d) : |rule z| + 1 ≤ M := by have hz : |rule z| ≤ ∑ w : Sample n m d, |rule w| := by exact Finset.single_le_sum (f := fun w : Sample n m d => |rule w|) (fun w _ => abs_nonneg (rule w)) (Finset.mem_univ z) dsimp [M] linarith have hpoint (z : Sample n m d) : (rule z - ateFunctional P.1) ^ 2 ≤ M ^ 2 := by have ht := ateFunctional_mem_Icc_neg_one_one P.1 P.2.overlap have habs : |rule z - ateFunctional P.1| ≤ M := by calc |rule z - ateFunctional P.1| ≤ |rule z| + |ateFunctional P.1| := abs_sub _ _ _ ≤ M := by have hat : |ateFunctional P.1| ≤ 1 := abs_le.2 ht linarith [hruleM z, hat] rw [sq_le_sq, abs_of_nonneg hM0] exact habs unfold twoSampleMSE calc ∫ z, (rule z - ateFunctional P.1) ^ 2 ∂annotationLaw P.1 n m ≤ ∫ _z, M ^ 2 ∂annotationLaw P.1 n m := by apply integral_mono · exact (MemLp.of_discrete (p := 1)).integrable (by norm_num) · exact integrable_const _ · exact hpoint _ = M ^ 2 := by simp
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.commonMarginal_mse_bddAbove · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalTransferRisk.lean:185
theorem commonMarginal_classGated_minimax_le

The formal statement establishes the stated conclusion.

Formal statement
n m d :
eps :
Proof (Lean source)
lemma commonMarginal_classGated_minimax_le (n m d : Nat) (eps : Real) : minimaxDecisionRisk (commonMarginalFixedKernel n m d) (commonMarginalTransferLoss eps) ≤ ofReal (minimaxRisk n m d eps) := by letI : Nonempty {f : Sample n m d → Real // Measurable f} := ⟨⟨fun _ => 0, measurable_const⟩⟩ unfold minimaxDecisionRisk minimaxRisk rw [ENNReal.ofReal_iInf] apply iInf_mono intro est refine (commonMarginal_classGated_worstCase_le est.1 est.2).trans ?_ apply iSup_le intro P apply ENNReal.ofReal_le_ofReal exact le_ciSup (commonMarginal_mse_bddAbove est.1) P
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.commonMarginal_classGated_minimax_le · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalTransferRisk.lean:228
theorem commonMarginal_ofReal_minimax_le_classGated_worstCase

the stated conditions establishes the stated conclusion.

Formal statement
n m d :
eps :
Nonempty (ClassLaw d eps)
rule :
Sample n m d → Real
hrule :
Proof (Lean source)
lemma commonMarginal_ofReal_minimax_le_classGated_worstCase (n m d : Nat) (eps : Real) [Nonempty (ClassLaw d eps)] (rule : Sample n m d → Real) (hrule : Measurable rule) : ofReal (minimaxRisk n m d eps) ≤ worstCaseDecisionRisk (commonMarginalFixedKernel n m d) (commonMarginalTransferLoss eps) rule := by let clipped : Sample n m d → Real := fun z => commonMarginalTransferClip (rule z) have hclipped : Measurable clipped := measurable_const.max (measurable_const.min hrule) have hmin : minimaxRisk n m d eps ≤ ⨆ P : ClassLaw d eps, twoSampleMSE (annotationLaw P.1 n m) clipped (ateFunctional P.1) := by unfold minimaxRisk have hb : BddBelow (range (fun est : {f : Sample n m d → Real // Measurable f} => ⨆ P : ClassLaw d eps, twoSampleMSE (annotationLaw P.1 n m) est.1 (ateFunctional P.1))) := by refine ⟨0, ?_⟩ rintro _ ⟨est, rfl⟩ have hmse : 0 ≤ twoSampleMSE (annotationLaw (Classical.arbitrary (ClassLaw d eps)).1 n m) est.1 (ateFunctional (Classical.arbitrary (ClassLaw d eps)).1) := by unfold twoSampleMSE exact integral_nonneg (fun z => sq_nonneg _) exact hmse.trans (le_ciSup (commonMarginal_mse_bddAbove est.1) (Classical.arbitrary _)) exact ciInf_le hb ⟨clipped, hclipped⟩ have hsup : ofReal (⨆ P : ClassLaw d eps, twoSampleMSE (annotationLaw P.1 n m) clipped (ateFunctional P.1)) ≤ worstCaseDecisionRisk (commonMarginalFixedKernel n m d) (commonMarginalTransferLoss eps) rule := by by_cases hw : worstCaseDecisionRisk (commonMarginalFixedKernel n m d) (commonMarginalTransferLoss eps) rule = ⊤ · simp [hw] rw [ENNReal.ofReal_le_iff_le_toReal hw] apply ciSup_le intro P have hterm : ofReal (twoSampleMSE (annotationLaw P.1 n m) clipped (ateFunctional P.1)) ≤ worstCaseDecisionRisk (commonMarginalFixedKernel n m d) (commonMarginalTransferLoss eps) rule := by rw [← commonMarginal_clippedLoss_lintegral P.1 P.2 rule hrule] unfold worstCaseDecisionRisk exact le_iSup (fun Q : DiscreteLaw d => decisionRisk (commonMarginalFixedKernel n m d) (commonMarginalTransferLoss eps) rule Q) P.1 rwa [ENNReal.ofReal_le_iff_le_toReal hw] at hterm calc ofReal (minimaxRisk n m d eps) ≤ ofReal (⨆ P : ClassLaw d eps, twoSampleMSE (annotationLaw P.1 n m) clipped (ateFunctional P.1)) := ENNReal.ofReal_le_ofReal hmin _ ≤ worstCaseDecisionRisk (commonMarginalFixedKernel n m d) (commonMarginalTransferLoss eps) rule := hsup
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.commonMarginal_ofReal_minimax_le_classGated_worstCase · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalTransferRisk.lean:246
theorem commonMarginal_ofReal_minimax_le_classGated

The formal statement establishes the stated conclusion.

Formal statement
n m d :
eps :
Nonempty (ClassLaw d eps)
Proof (Lean source)
lemma commonMarginal_ofReal_minimax_le_classGated (n m d : Nat) (eps : Real) [Nonempty (ClassLaw d eps)] : ofReal (minimaxRisk n m d eps) ≤ minimaxDecisionRisk (commonMarginalFixedKernel n m d) (commonMarginalTransferLoss eps) := by unfold minimaxDecisionRisk apply le_iInf intro rule exact commonMarginal_ofReal_minimax_le_classGated_worstCase n m d eps rule.1 rule.2
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.commonMarginal_ofReal_minimax_le_classGated · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/CommonMarginalTransferRisk.lean:305
CausalSmith.Stat.STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research.Helpers.Estimator 23 declarations The finite mixed-information hybrid estimator and its calibration data.

The finite mixed-information hybrid estimator and its calibration data.

def starA

Explicit factorial-moment constant. the stated conclusion.

Definition (Lean source)
starA :
7056
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.starA · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/Estimator.lean:16
def cCirc

Degree calibration constant. the stated conclusion.

Definition (Lean source)
cCirc :
1 / 256
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.cCirc · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/Estimator.lean:19
def dyadicIndex

Least dyadic index whose inverse power is below the overlap constant. the stated conditions the stated conclusion.

Definition (Lean source)
eps :
dyadicIndex eps :
sInf {j : Nat | 1 ≤ j ∧ (2 : Real) ^ (-(j : Int)) ≤ eps}
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.dyadicIndex · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/Estimator.lean:22
def barEps

Dyadic lower approximation to the overlap constant. the stated conditions the stated conclusion.

Definition (Lean source)
eps :
barEps eps :
(2 : Real) ^ (-(dyadicIndex eps : Int))
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.barEps · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/Estimator.lean:26
def Hconst

Least integer satisfying the four numerical inequalities in (C1). the stated conditions the stated conclusion.

Definition (Lean source)
eps :
Hconst eps :
sInf {H : Nat | 4 ≤ H ∧ 15 + 24 / cCirc ≤ (H : Real) / 4 ∧ 672 ≤ (H : Real) * cCirc * barEps eps ∧ 24 ≤ (H : Real) * cCirc * barEps eps}
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.Hconst · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/Estimator.lean:30

Deterministic labeled/auxiliary block sizes from (C2).

Definition (Lean source)
M0 :
np :
nf :
mp :
mf :
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.BlockSizes · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/Estimator.lean:37
def blockSizes

The ordered split sizes used by the estimator. the stated conditions the stated conclusion.

Definition (Lean source)
n m :
blockSizes n m :
M0 :
n / 3
np :
(n - M0) / 2
{ M0 := M0, np := np, nf := n - M0 - np, mp := m / 2, mf := m - m / 2 }
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.blockSizes · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/Estimator.lean:45
def binLen

Binary length 1+clog₂ n. the stated conditions the stated conclusion.

Definition (Lean source)
n :
binLen n :
1 + Nat.clog 2 n
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.binLen · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/Estimator.lean:51
def Ldeg

Polynomial degree in (C3). the stated conditions the stated conclusion.

Definition (Lean source)
n :
Ldeg n :
max 2 (toNat ⌊cCirc * binLen n⌋)
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.Ldeg · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/Estimator.lean:54
def Bscale

Pilot/factorial bandwidth in (C3). the stated conditions the stated conclusion.

Definition (Lean source)
n m :
eps :
Bscale n m eps :
bs :
tp :
(bs.np + bs.mp : Nat) / 8 (: Real)
t :
(bs.nf + bs.mf : Nat) / 8 (: Real)
Hconst eps * Ldeg n / min tp t
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.Bscale · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/Estimator.lean:58
def k0

Pilot heavy-cell threshold in (C3). the stated conditions the stated conclusion.

Definition (Lean source)
n m :
eps :
k0 n m eps :
bs :
toNat ⌊((bs.np + bs.mp : Nat) / 8 : Real) * Bscale n m eps / 4⌋

The exact finite conjunction (C4)--(C6). the stated conditions the stated conclusion.

Definition (Lean source)
n m :
eps :
calibrationPredicate n m eps :
Prop
bs :
N :
n + m (: Nat)
u :
bs.M0 / 8 (: Real)
tp :
(bs.np + bs.mp : Nat) / 8 (: Real)
t :
(bs.nf + bs.mf : Nat) / 8 (: Real)
L :
Ldeg n (: Nat)
B :
Bscale n m eps
24 ≤ n
1 / 32 ≤ u / n
u / n ≤ 1 / 24
1 / 32 ≤ tp / N
tp / N ≤ 3 / 32
1 / 32 ≤ t / N
t / N ≤ 3 / 32
1 / 3 ≤ t / tp
t / tp ≤ 3
cCirc * binLen n / 2 ≤ L
8 ≤ tp * B
(L : Real) ≤ t * B
(L : Real) ^ 4 * starA ^ (2 * L) ≤ n
(L : Real) ^ 6 * starA ^ (2 * L) ≤ n
15 * L + 12 * binLen n ≤ tp * B / 4
(n : Real) ^ 12 ≤ (1 + barEps eps * t / tp) ^ k0 n m eps
12 * binLen n ≤ barEps eps * t * B
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.calibrationPredicate · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/Estimator.lean:70
instance instDecidableCalibrationPredicate

the stated conditions defines the specified object.

Definition (Lean source)
noncomputable instance (n m : Nat) (eps : Real) : Decidable (calibrationPredicate n m eps) := propDecidable _
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.instDecidableCalibrationPredicate · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/Estimator.lean:91
def labeledBlockCount

Count complete records in a prefix of the block beginning at offset. the stated conditions the stated conclusion.

Definition (Lean source)
n d :
sample :
Fin n → Obs d
offset r :
x :
Fin d
a y :
labeledBlockCount sample offset r x a y :
((Finset.univ.filter fun i => offset ≤ i.1 ∧ i.1 < offset + r ∧ sample i = (x, a, y))).card
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.labeledBlockCount · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/Estimator.lean:96
def auxiliaryBlockCount

Count auxiliary records in a prefix of the block beginning at offset. the stated conditions the stated conclusion.

Definition (Lean source)
m d :
sample :
Fin m → AuxObs d
offset r :
x :
Fin d
a :
auxiliaryBlockCount sample offset r x a :
((Finset.univ.filter fun i => offset ≤ i.1 ∧ i.1 < offset + r ∧ sample i = (x, a))).card
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.auxiliaryBlockCount · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/Estimator.lean:102
def labeledArmBlockCount

Arm count in a labeled block, summing over the binary outcome mark. the stated conditions the stated conclusion.

Definition (Lean source)
n d :
sample :
Fin n → Obs d
offset r :
x :
Fin d
a :
labeledArmBlockCount sample offset r x a :
labeledBlockCount sample offset r x a false + labeledBlockCount sample offset r x a true
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.labeledArmBlockCount · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/Estimator.lean:108
def pooledArmCount

Count one arm in a pooled block ordered as its labeled part followed by its auxiliary part. This makes pilot and factorial prefixes disjoint. the stated conditions the stated conclusion.

Definition (Lean source)
n m d :
sample :
Sample n m d
labeledOffset labeledSize auxiliaryOffset r :
x :
Fin d
a :
pooledArmCount sample labeledOffset labeledSize auxiliaryOffset r x a :
labeledArmBlockCount sample.1 labeledOffset (min r labeledSize) x a
+ auxiliaryBlockCount sample.2 auxiliaryOffset (r - labeledSize) x a
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.pooledArmCount · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/Estimator.lean:114
def clipUnit

Clip a real number to [-1,1]. the stated conditions the stated conclusion.

Definition (Lean source)
z :
clipUnit z :
max (-1) (min 1 z)
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.clipUnit · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/Estimator.lean:122
def prefixOutput

A finite valid-prefix output using separate outcome, pilot, and factorial pools. the stated conditions the stated conclusion.

Definition (Lean source)
n m d :
eps :
sample :
Sample n m d
r0 rp rf :
prefixOutput eps sample r0 rp rf :
bs :
u :
bs.M0 / 8 (: Real)
t :
(bs.nf + bs.mf : Nat) / 8 (: Real)
clipUnit <| ∑ x : Fin d, let j0 := pooledArmCount sample bs.M0 bs.np 0 rp x false let j1 := pooledArmCount sample bs.M0 bs.np 0 rp x true let jx := j0
+ j1 let s1 : Real := labeledBlockCount sample.1 0 r0 x true true let s0 : Real := labeledBlockCount sample.1 0 r0 x false true let k1 := pooledArmCount sample (bs.M0 + bs.np) bs.nf bs.mp rf x true let k0' := pooledArmCount sample (bs.M0 + bs.np) bs.nf bs.mp rf x false if jx
≤ k0 n m eps then s1 / u * factorialLift true (Ldeg n) (Bscale n m eps) t k0' k1
- s0 / u * factorialLift false (Ldeg n) (Bscale n m eps) t k0' k1 else s1 / u * (k0' + k1 + 1 : Nat) / (k1 + 1 : Nat)
- s0 / u * (k0' + k1 + 1 : Nat) / (k0' + 1 : Nat)
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.prefixOutput · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/Estimator.lean:125
def mixedEstimator

Conditional finite Poisson-prefix average of the clipped mixed statistic. the stated conditions the stated conclusion.

Definition (Lean source)
n m d :
eps :
mixedEstimator n m d eps :
Sample n m d → Real
fun sample
=> if calibrationPredicate n m eps then let bs := blockSizes n m let u : Real := bs.M0 / 8 let tp : Real := (bs.np + bs.mp : Nat) / 8 let t : Real := (bs.nf + bs.mf : Nat) / 8 ∑ r0 ∈ range (bs.M0 + 1), ∑ rp ∈ range (bs.np + bs.mp + 1), ∑ rf ∈ range (bs.nf + bs.mf + 1), (poissonMeasure (toNNReal u)).real {r0} * (poissonMeasure (toNNReal tp)).real {rp} * (poissonMeasure (toNNReal t)).real {rf} * prefixOutput eps sample r0 rp rf else 0
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.mixedEstimator · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/Estimator.lean:147
theorem measurable_mixedEstimator

The formal statement establishes the stated conclusion.

Formal statement
n m d :
eps :
Proof (Lean source)
lemma measurable_mixedEstimator (n m d : Nat) (eps : Real) : Measurable (mixedEstimator n m d eps) := by fun_prop
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.measurable_mixedEstimator · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/Estimator.lean:164
theorem poissonPrefixMass_le_one Lemma poissonPrefixMass_le_one in the paper ↗

The retained mass of a finite Poisson prefix is at most one. the stated conclusion.

Formal statement
lam :
N :
∑ r ∈ range N, (poissonMeasure lam).real {r} ≤ 1
Proof (Lean source)
lemma poissonPrefixMass_le_one (lam : NNReal) (N : Nat) : ∑ r ∈ range N, (poissonMeasure lam).real {r} ≤ 1 := by let mu := poissonMeasure lam change ∑ r ∈ range N, mu.real {r} ≤ 1 simp only [MeasureTheory.measureReal_def] rw [← ENNReal.toReal_sum (fun r _ => MeasureTheory.measure_ne_top mu {r})] rw [MeasureTheory.sum_measure_singleton] change mu.real (↑(range N) : Set Nat) ≤ 1 calc mu.real (↑(range N) : Set Nat) ≤ mu.real univ := MeasureTheory.measureReal_mono (Set.subset_univ _) (MeasureTheory.measure_ne_top mu _) _ = 1 := by simp [MeasureTheory.measureReal_def]
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.poissonPrefixMass_le_one · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/Estimator.lean:171
theorem mixedEstimator_mem_Icc_neg_one_one

The formal statement establishes the stated conclusion.

Formal statement
n m d :
eps :
z :
Sample n m d
mixedEstimator n m d eps z ∈ Icc (-1 : Real) 1
Proof (Lean source)
lemma mixedEstimator_mem_Icc_neg_one_one (n m d : Nat) (eps : Real) (z : Sample n m d) : mixedEstimator n m d eps z ∈ Icc (-1 : Real) 1 := by by_cases hcal : calibrationPredicate n m eps · simp only [mixedEstimator, hcal, if_pos] let bs := blockSizes n m let u : Real := bs.M0 / 8 let tp : Real := (bs.np + bs.mp : Nat) / 8 let t : Real := (bs.nf + bs.mf : Nat) / 8 let w0 : Nat → Real := fun r => (poissonMeasure (toNNReal u)).real {r} let wp : Nat → Real := fun r => (poissonMeasure (toNNReal tp)).real {r} let wf : Nat → Real := fun r => (poissonMeasure (toNNReal t)).real {r} have hw0 (r : Nat) : 0 ≤ w0 r := MeasureTheory.measureReal_nonneg have hwp (r : Nat) : 0 ≤ wp r := MeasureTheory.measureReal_nonneg have hwf (r : Nat) : 0 ≤ wf r := MeasureTheory.measureReal_nonneg have hout (r0 rp rf : Nat) : prefixOutput eps z r0 rp rf ∈ Icc (-1 : Real) 1 := by dsimp [prefixOutput, clipUnit] constructor · exact le_max_left _ _ · exact max_le (by norm_num) (min_le_left _ _) change (∑ r0 ∈ range (bs.M0 + 1), ∑ rp ∈ range (bs.np + bs.mp + 1), ∑ rf ∈ range (bs.nf + bs.mf + 1), w0 r0 * wp rp * wf rf * prefixOutput eps z r0 rp rf) ∈ Icc (-1 : Real) 1 have hmass0 : ∑ r0 ∈ range (bs.M0 + 1), w0 r0 ≤ 1 := poissonPrefixMass_le_one _ _ have hmassp : ∑ rp ∈ range (bs.np + bs.mp + 1), wp rp ≤ 1 := poissonPrefixMass_le_one _ _ have hmassf : ∑ rf ∈ range (bs.nf + bs.mf + 1), wf rf ≤ 1 := poissonPrefixMass_le_one _ _ have hweight_eq : (∑ r0 ∈ range (bs.M0 + 1), ∑ rp ∈ range (bs.np + bs.mp + 1), ∑ rf ∈ range (bs.nf + bs.mf + 1), w0 r0 * wp rp * wf rf * (1 : Real)) = (∑ r0 ∈ range (bs.M0 + 1), w0 r0) * (∑ rp ∈ range (bs.np + bs.mp + 1), wp rp) * (∑ rf ∈ range (bs.nf + bs.mf + 1), wf rf) := by symm calc (∑ r0 ∈ range (bs.M0 + 1), w0 r0) * (∑ rp ∈ range (bs.np + bs.mp + 1), wp rp) * (∑ rf ∈ range (bs.nf + bs.mf + 1), wf rf) = (∑ r0 ∈ range (bs.M0 + 1), w0 r0) * ((∑ rp ∈ range (bs.np + bs.mp + 1), wp rp) * (∑ rf ∈ range (bs.nf + bs.mf + 1), wf rf)) := by ring _ = ∑ r0 ∈ range (bs.M0 + 1), w0 r0 * ((∑ rp ∈ range (bs.np + bs.mp + 1), wp rp) * (∑ rf ∈ range (bs.nf + bs.mf + 1), wf rf)) := Finset.sum_mul _ _ _ _ = ∑ r0 ∈ range (bs.M0 + 1), ∑ rp ∈ range (bs.np + bs.mp + 1), w0 r0 * (wp rp * (∑ rf ∈ range (bs.nf + bs.mf + 1), wf rf)) := by apply Finset.sum_congr rfl intro r0 _ rw [Finset.sum_mul, Finset.mul_sum] _ = ∑ r0 ∈ range (bs.M0 + 1), ∑ rp ∈ range (bs.np + bs.mp + 1), ∑ rf ∈ range (bs.nf + bs.mf + 1), w0 r0 * wp rp * wf rf * (1 : Real) := by apply Finset.sum_congr rfl intro r0 _ apply Finset.sum_congr rfl intro rp _ rw [Finset.mul_sum] rw [Finset.mul_sum] apply Finset.sum_congr rfl intro rf _ ring have hweight_le : (∑ r0 ∈ range (bs.M0 + 1), w0 r0) * (∑ rp ∈ range (bs.np + bs.mp + 1), wp rp) * (∑ rf ∈ range (bs.nf + bs.mf + 1), wf rf) ≤ 1 := by have hs0 : 0 ≤ ∑ r0 ∈ range (bs.M0 + 1), w0 r0 := Finset.sum_nonneg fun _ _ => hw0 _ have hsp : 0 ≤ ∑ rp ∈ range (bs.np + bs.mp + 1), wp rp := Finset.sum_nonneg fun _ _ => hwp _ have hsf : 0 ≤ ∑ rf ∈ range (bs.nf + bs.mf + 1), wf rf := Finset.sum_nonneg fun _ _ => hwf _ calc (∑ r0 ∈ range (bs.M0 + 1), w0 r0) * (∑ rp ∈ range (bs.np + bs.mp + 1), wp rp) * (∑ rf ∈ range (bs.nf + bs.mf + 1), wf rf) ≤ 1 * 1 * 1 := by gcongr _ = 1 := by norm_num constructor · calc (-1 : Real) ≤ -((∑ r0 ∈ range (bs.M0 + 1), w0 r0) * (∑ rp ∈ range (bs.np + bs.mp + 1), wp rp) * (∑ rf ∈ range (bs.nf + bs.mf + 1), wf rf)) := neg_le_neg hweight_le _ = ∑ r0 ∈ range (bs.M0 + 1), ∑ rp ∈ range (bs.np + bs.mp + 1), ∑ rf ∈ range (bs.nf + bs.mf + 1), w0 r0 * wp rp * wf rf * (-1 : Real) := by rw [← hweight_eq] simp only [mul_neg, mul_one, Finset.sum_neg_distrib] _ ≤ ∑ r0 ∈ range (bs.M0 + 1), ∑ rp ∈ range (bs.np + bs.mp + 1), ∑ rf ∈ range (bs.nf + bs.mf + 1), w0 r0 * wp rp * wf rf * prefixOutput eps z r0 rp rf := by gcongr exact (hout _ _ _).1 · calc (∑ r0 ∈ range (bs.M0 + 1), ∑ rp ∈ range (bs.np + bs.mp + 1), ∑ rf ∈ range (bs.nf + bs.mf + 1), w0 r0 * wp rp * wf rf * prefixOutput eps z r0 rp rf) ≤ ∑ r0 ∈ range (bs.M0 + 1), ∑ rp ∈ range (bs.np + bs.mp + 1), ∑ rf ∈ range (bs.nf + bs.mf + 1), w0 r0 * wp rp * wf rf * (1 : Real) := by gcongr exact (hout _ _ _).2 _ = (∑ r0 ∈ range (bs.M0 + 1), w0 r0) * (∑ rp ∈ range (bs.np + bs.mp + 1), wp rp) * (∑ rf ∈ range (bs.nf + bs.mf + 1), wf rf) := hweight_eq _ ≤ 1 := hweight_le · simp [mixedEstimator, hcal]
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.mixedEstimator_mem_Icc_neg_one_one · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/Estimator.lean:187
CausalSmith.Stat.STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research.Helpers.FactorialCertificate 1 declarations A universal-constant packaging of the Chebyshev factorial certificate.

A universal-constant packaging of the Chebyshev factorial certificate.

theorem chebyshev_factorial_certificate Lemma 5 in the paper ↗

For every degree at least two, the continuations obey (C9), have the stated degree, and use one universal factorial-lift moment constant. the stated conclusion.

Formal statement
∃ A : Real,
1 < A
conclusion 1
L :
2 ≤ L
(chebG L).natDegree ≤ L - 2
z :
z ∈ Icc (0 : Real) 1
0 ≤ (chebE L).eval z
(chebE L).eval z ≤ 1
0 < z
(chebE L).eval z ≤ ((L : Real) ^ 2 * z)⁻¹
z * (chebG L).eval z + (chebE L).eval z = 1
a :
t B s0 s1 :
0 < t
0 < B
0 ≤ s0
0 ≤ s1
(L : Real) ≤ t * B
factorialLiftSecondMoment a L B t s0 s1 ≤ A ^ L * (1 + (s0 + s1) / B) ^ (2 * L)
s0 + s1 ≤ B
factorialLiftSecondMoment a L B t s0 s1 ≤ A ^ L
Proof (Lean source)
lemma chebyshev_factorial_certificate : ∃ A : Real, 1 < A ∧ ∀ L : Nat, 2 ≤ L → (chebG L).natDegree ≤ L - 2 ∧ (∀ z : Real, z ∈ Icc (0 : Real) 1 → 0 ≤ (chebE L).eval z ∧ (chebE L).eval z ≤ 1 ∧ (0 < z → (chebE L).eval z ≤ ((L : Real) ^ 2 * z)⁻¹) ∧ z * (chebG L).eval z + (chebE L).eval z = 1) ∧ ∀ (a : Bool) (t B s0 s1 : Real), 0 < t → 0 < B → 0 ≤ s0 → 0 ≤ s1 → (L : Real) ≤ t * B → factorialLiftSecondMoment a L B t s0 s1 ≤ A ^ L * (1 + (s0 + s1) / B) ^ (2 * L) ∧ (s0 + s1 ≤ B → factorialLiftSecondMoment a L B t s0 s1 ≤ A ^ L) := by refine ⟨7056, by norm_num, ?_⟩ intro L hL have hcal := explicit_chebyshev_calibration L hL have hH : (chebH L).natDegree ≤ L := by unfold chebH chebQ calc ((2 * (L : Real) ^ 2)⁻¹ • (1 - (Chebyshev.T Real L).comp (1 - 2 * X))).natDegree ≤ (1 - (Chebyshev.T Real L).comp (1 - 2 * X)).natDegree := natDegree_smul_le _ _ _ ≤ max 0 ((Chebyshev.T Real L).comp (1 - 2 * X)).natDegree := by simpa using natDegree_sub_le (1 : Polynomial Real) ((Chebyshev.T Real L).comp (1 - 2 * X)) _ ≤ L := by rw [max_le_iff] constructor · omega · calc ((Chebyshev.T Real L).comp (1 - 2 * X)).natDegree ≤ (Chebyshev.T Real L).natDegree * (1 - 2 * X : Polynomial Real).natDegree := natDegree_comp_le _ ≤ L := by rw [Chebyshev.natDegree_T] have hlin : (1 - 2 * X : Polynomial Real).natDegree ≤ 1 := by exact (natDegree_sub_le (1 : Polynomial Real) (2 * X)).trans (by simp) simpa using Nat.mul_le_mul_left L hlin have hE : (chebE L).natDegree ≤ L - 1 := by rw [chebE, natDegree_divByMonic _ monic_X, natDegree_X] exact Nat.sub_le_sub_right hH 1 have hnum : (1 - chebE L).natDegree ≤ L - 1 := (natDegree_sub_le (1 : Polynomial Real) (chebE L)).trans (max_le (by simpa using hL) hE) have hdegree : (chebG L).natDegree ≤ L - 2 := by rw [chebG, natDegree_divByMonic _ monic_X, natDegree_X] simpa [Nat.sub_sub] using Nat.sub_le_sub_right hnum 1 refine ⟨hdegree, hcal.2.2.2, ?_⟩ intro a t B s0 s1 ht hB hs0 hs1 htB exact hcal.2.2.1 a t B s0 s1 ht hB hs0 hs1 htB
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.chebyshev_factorial_certificate · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/FactorialCertificate.lean:13
CausalSmith.Stat.STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research.Helpers.FiniteSmallInstance 42 declarations The explicit two-cell diagnostic calculation.

The explicit two-cell diagnostic calculation.

def smallNullAtomMass

The null diagnostic law is uniform on (X,A) and has outcome zero. the stated conditions the stated conclusion.

Definition (Lean source)
z :
Obs 2
smallNullAtomMass z :
if z.2.2 then 0 else 1 / 4
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.smallNullAtomMass · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/FiniteSmallInstance.lean:17
def smallAlternativeAtomMass

The alternative diagnostic law changes only the treated outcome in cell zero. the stated conditions the stated conclusion.

Definition (Lean source)
z :
Obs 2
smallAlternativeAtomMass z :
if z.2.2 = (z.2.1 && decide (z.1 = 0)) then 1 / 4 else 0
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.smallAlternativeAtomMass · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/FiniteSmallInstance.lean:22
def smallNullLaw

The explicit null law in the two-cell diagnostic. the stated conclusion.

Definition (Lean source)
smallNullLaw :
⟨PMF.ofFintype smallNullAtomMass (by norm_num [smallNullAtomMass, Fintype.sum_prod_type] rw [← ENNReal.toReal_eq_toReal_iff' (by finiteness) (by finiteness)] norm_num [ENNReal.toReal_add, ENNReal.toReal_inv])⟩
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.smallNullLaw · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/FiniteSmallInstance.lean:27
def smallAlternativeLaw

The explicit alternative law in the two-cell diagnostic. the stated conclusion.

Definition (Lean source)
smallAlternativeLaw :
⟨PMF.ofFintype smallAlternativeAtomMass (by norm_num [smallAlternativeAtomMass, Fintype.sum_prod_type] rw [← ENNReal.toReal_eq_toReal_iff' (by finiteness) (by finiteness)] norm_num [ENNReal.toReal_add, ENNReal.toReal_inv])⟩
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.smallAlternativeLaw · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/FiniteSmallInstance.lean:35
def smallMixedStatistic

The displayed n=m=1 mixed indicator statistic. the stated conditions the stated conclusion.

Definition (Lean source)
z :
Sample 1 1 2
smallMixedStatistic z :
2 * (if z.1 0 = (0, true, true) then 1 else 0) * ((if z.2 0 = (0, false) then 1 else 0) + (if z.2 0 = (0, true) then 1 else 0))
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.smallMixedStatistic · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/FiniteSmallInstance.lean:42
structure FiniteCalculationWitness

The prescribed laws and identities comprising the finite diagnostic calculation.

Definition (Lean source)
Pi0Small :
Pi1Small :
law0 :
law1 :
prior0_dirac :
Pi0Small = Measure.dirac law0
prior1_dirac :
Pi1Small = Measure.dirac law1
class0 :
ModelClass 2 (1 / 4) law0
class1 :
ModelClass 2 (1 / 4) law1
cellMass0 :
∀ x, cellMass law0 x = 1 / 2
cellMass1 :
∀ x, cellMass law1 x = 1 / 2
propensity0 :
∀ x, propensity law0 x = 1 / 2
propensity1 :
∀ x, propensity law1 x = 1 / 2
controlMean0 :
∀ x, outcomeMean law0 false x = 0
controlMean1 :
∀ x, outcomeMean law1 false x = 0
treatedMean0 :
∀ x, outcomeMean law0 true x = 0
treatedMean1_first :
outcomeMean law1 true 0 = 1
treatedMean1_second :
outcomeMean law1 true 1 = 0
uniformAux0 :
∀ z, auxTableOf law0 z = 1 / 4
uniformAux1 :
∀ z, auxTableOf law1 z = 1 / 4
uniformAux :
target0 :
ateFunctional law0 = 0
target1 :
ateFunctional law1 = 1 / 2
expectationIdentity :
∫ z, smallMixedStatistic z ∂annotationLaw law1 1 1
= 2 * markedMass law1 0 true * cellMass law1 0
expectationValue :
2 * markedMass law1 0 true * cellMass law1 0 = 1 / 4
treatedCellTarget :
cellMass law1 0 * outcomeMean law1 true 0 = 1 / 2
labeledTV :
∀ n : Nat,
= 1 - (3 / 4 : Real) ^ n
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.FiniteCalculationWitness · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/FiniteSmallInstance.lean:48

The formal statement establishes the stated conclusion.

Formal statement
∫ x : Fin 1 → X, f (x 0) ∂Measure.pi (fun _ : Fin 1 ↦ μ) = ∫ x, f x ∂μ
Proof (Lean source)
lemma integral_pi_fin_one {X : Type*} [MeasurableSpace X] [MeasurableSingletonClass X] [Fintype X] (μ : Measure X) [IsProbabilityMeasure μ] (f : X → Real) : ∫ x : Fin 1 → X, f (x 0) ∂Measure.pi (fun _ : Fin 1 ↦ μ) = ∫ x, f x ∂μ := by have hmap : Measure.map (fun x : Fin 1 → X ↦ x 0) (Measure.pi (fun _ : Fin 1 ↦ μ)) = μ := by simpa using Measure.pi_map_eval (fun _ : Fin 1 ↦ μ) 0 calc _ = ∫ x, f x ∂Measure.map (fun x : Fin 1 → X ↦ x 0) (Measure.pi (fun _ : Fin 1 ↦ μ)) := by rw [integral_map (measurable_pi_apply 0).aemeasurable (measurable_of_countable f).aestronglyMeasurable] _ = _ := by rw [hmap]
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.integral_pi_fin_one · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/FiniteSmallInstance.lean:83
theorem tvDist_le_one_sub_common Lemma tvDist_le_one_sub_common in the paper ↗

the stated conditions establishes the stated conclusion.

Formal statement
X :
E :
Set X
hE :
hres :
μ.restrict E = ν.restrict E
q :
hμ :
μ.real E = q
hν :
ν.real E = q
tvDist μ ν ≤ 1 - q
Proof (Lean source)
lemma tvDist_le_one_sub_common {X : Type*} [MeasurableSpace X] {μ ν : Measure X} [IsProbabilityMeasure μ] [IsProbabilityMeasure ν] {E : Set X} (hE : MeasurableSet E) (hres : μ.restrict E = ν.restrict E) {q : Real} (hμ : μ.real E = q) (hν : ν.real E = q) : tvDist μ ν ≤ 1 - q := by unfold tvDist apply ciSup_le rintro ⟨A, hA⟩ have hcommon : μ.real (A ∩ E) = ν.real (A ∩ E) := by have h := congrArg (fun ξ : Measure X ↦ ξ.real A) hres change ((μ.restrict E) A).toReal = ((ν.restrict E) A).toReal at h rw [Measure.restrict_apply hA, Measure.restrict_apply hA] at h rw [measureReal_def, measureReal_def] simpa [Set.inter_comm] using h have hμcompl : μ.real Eᶜ = 1 - q := by rw [measureReal_compl hE, probReal_univ, hμ] have hνcompl : ν.real Eᶜ = 1 - q := by rw [measureReal_compl hE, probReal_univ, hν] have hsubset : A ⊆ (A ∩ E) ∪ Eᶜ := by intro x hx by_cases hxe : x ∈ E · exact inl ⟨hx, hxe⟩ · exact Or.inr hxe have hμb : μ.real A ≤ μ.real (A ∩ E) + μ.real Eᶜ := (measureReal_mono hsubset (measure_ne_top μ _)).trans (measureReal_union_le _ _) have hνb : ν.real A ≤ ν.real (A ∩ E) + ν.real Eᶜ := (measureReal_mono hsubset (measure_ne_top ν _)).trans (measureReal_union_le _ _) have hμl : μ.real (A ∩ E) ≤ μ.real A := measureReal_mono Set.inter_subset_left (measure_ne_top μ _) have hνl : ν.real (A ∩ E) ≤ ν.real A := measureReal_mono Set.inter_subset_left (measure_ne_top ν _) rw [abs_le] constructor <;> linarith
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.tvDist_le_one_sub_common · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/FiniteSmallInstance.lean:99
theorem smallAlternative_auxMarginal

The formal statement establishes the stated conclusion.

Formal statement
z :
Proof (Lean source)
lemma smallAlternative_auxMarginal (z : AuxObs 2) : (auxMarginal smallAlternativeLaw z).toReal = 1 / 4 := by rcases z with ⟨x, a⟩ unfold auxMarginal rw [PMF.map_apply, tsum_fintype, Fintype.sum_prod_type, Fin.sum_univ_two] fin_cases x <;> cases a <;> norm_num [smallAlternativeLaw, smallAlternativeAtomMass, Fintype.sum_prod_type, ENNReal.toReal_add, ENNReal.toReal_inv]
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.smallAlternative_auxMarginal · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/FiniteSmallInstance.lean:135
def smallCommonAtom

This declaration defines the specified object.

Definition (Lean source)
smallCommonAtom :
Set (Obs 2)
{z | z.1 ≠ 0 ∨ z.2.1 ≠ true}
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.smallCommonAtom · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/FiniteSmallInstance.lean:146
def smallCommonSample

the stated conditions defines the specified object.

Definition (Lean source)
n :
smallCommonSample n :
Set (Fin n → Obs 2)
pi univ (fun _ ↦ smallCommonAtom)
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.smallCommonSample · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/FiniteSmallInstance.lean:150
theorem smallCommonNullMass

The formal statement establishes the stated conclusion.

Formal statement
Proof (Lean source)
lemma smallCommonNullMass : obsLaw smallNullLaw smallCommonAtom = (3 / 4 : ENNReal) := by rw [obsLaw, PMF.toMeasure_apply_fintype] norm_num [smallCommonAtom, indicator, smallNullLaw, smallNullAtomMass, Fintype.sum_prod_type, Fin.sum_univ_two] rw [← ENNReal.toReal_eq_toReal_iff' (by finiteness) (by finiteness)] norm_num [ENNReal.toReal_add, ENNReal.toReal_inv]
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.smallCommonNullMass · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/FiniteSmallInstance.lean:155
theorem smallCommonAlternativeMass

The formal statement establishes the stated conclusion.

Formal statement
Proof (Lean source)
lemma smallCommonAlternativeMass : obsLaw smallAlternativeLaw smallCommonAtom = (3 / 4 : ENNReal) := by rw [obsLaw, PMF.toMeasure_apply_fintype] norm_num [smallCommonAtom, indicator, smallAlternativeLaw, smallAlternativeAtomMass, Fintype.sum_prod_type, Fin.sum_univ_two] rw [← ENNReal.toReal_eq_toReal_iff' (by finiteness) (by finiteness)] norm_num [ENNReal.toReal_add, ENNReal.toReal_inv]
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.smallCommonAlternativeMass · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/FiniteSmallInstance.lean:165
theorem smallCommonProductMassNull

The formal statement establishes the stated conclusion.

Formal statement
n :
Proof (Lean source)
lemma smallCommonProductMassNull (n : Nat) : (labeledProductLaw smallNullLaw n).real (smallCommonSample n) = (3 / 4 : Real) ^ n := by rw [measureReal_def, labeledProductLaw, smallCommonSample, Measure.pi_pi] simp_rw [smallCommonNullMass] rw [ENNReal.toReal_prod] norm_num [ENNReal.toReal_div] rw [div_pow]
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.smallCommonProductMassNull · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/FiniteSmallInstance.lean:175
theorem smallCommonProductMassAlternative

The formal statement establishes the stated conclusion.

Formal statement
n :
Proof (Lean source)
lemma smallCommonProductMassAlternative (n : Nat) : (labeledProductLaw smallAlternativeLaw n).real (smallCommonSample n) = (3 / 4 : Real) ^ n := by rw [measureReal_def, labeledProductLaw, smallCommonSample, Measure.pi_pi] simp_rw [smallCommonAlternativeMass] rw [ENNReal.toReal_prod] norm_num [ENNReal.toReal_div] rw [div_pow]
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.smallCommonProductMassAlternative · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/FiniteSmallInstance.lean:186
theorem smallAtomEqOfCommon

the stated conditions establishes the stated conclusion.

Formal statement
z :
Obs 2
hz :
smallNullLaw.pmf z = smallAlternativeLaw.pmf z
Proof (Lean source)
lemma smallAtomEqOfCommon (z : Obs 2) (hz : z ∈ smallCommonAtom) : smallNullLaw.pmf z = smallAlternativeLaw.pmf z := by rcases z with ⟨x, a, y⟩ fin_cases x <;> cases a <;> cases y <;> simp [smallCommonAtom, smallNullLaw, smallAlternativeLaw, smallNullAtomMass, smallAlternativeAtomMass, PMF.ofFintype_apply] at hz ⊢
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.smallAtomEqOfCommon · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/FiniteSmallInstance.lean:197
theorem smallCommonRestrictEq

The formal statement establishes the stated conclusion.

Formal statement
Proof (Lean source)
lemma smallCommonRestrictEq (n : Nat) : (labeledProductLaw smallNullLaw n).restrict (smallCommonSample n) = (labeledProductLaw smallAlternativeLaw n).restrict (smallCommonSample n) := by apply Measure.ext_of_singleton intro s rw [Measure.restrict_apply (measurableSet_singleton s), Measure.restrict_apply (measurableSet_singleton s)] by_cases hs : s ∈ smallCommonSample n · have hinter : ({s} : Set (Fin n → Obs 2)) ∩ smallCommonSample n = {s} := by ext z simp only [Set.mem_inter_iff, Set.mem_singleton_iff] aesop rw [hinter] simp only [labeledProductLaw, Measure.pi_singleton] apply Finset.prod_congr rfl intro i _ rw [obsLaw, obsLaw, PMF.toMeasure_apply_singleton _ _ (measurableSet_singleton _), PMF.toMeasure_apply_singleton _ _ (measurableSet_singleton _)] exact smallAtomEqOfCommon (s i) (hs i (Set.mem_univ i)) · have hinter : ({s} : Set (Fin n → Obs 2)) ∩ smallCommonSample n = ∅ := by ext z constructor · rintro ⟨rfl, hzs⟩ exact (hs hzs).elim · intro hz exact hz.elim rw [hinter] simp
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.smallCommonRestrictEq · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/FiniteSmallInstance.lean:206
def smallAvoidNullAtom

This declaration defines the specified object.

Definition (Lean source)
smallAvoidNullAtom :
Set (Obs 2)
{z | z ≠ (0, true, false)}
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.smallAvoidNullAtom · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/FiniteSmallInstance.lean:237
def smallAvoidNullSample

the stated conditions defines the specified object.

Definition (Lean source)
n :
smallAvoidNullSample n :
Set (Fin n → Obs 2)
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.smallAvoidNullSample · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/FiniteSmallInstance.lean:241
theorem smallAvoidNullMass

The formal statement establishes the stated conclusion.

Formal statement
Proof (Lean source)
lemma smallAvoidNullMass : obsLaw smallNullLaw smallAvoidNullAtom = (3 / 4 : ENNReal) := by rw [obsLaw, PMF.toMeasure_apply_fintype] norm_num [smallAvoidNullAtom, indicator, smallNullLaw, smallNullAtomMass, Fintype.sum_prod_type, Fin.sum_univ_two] rw [← ENNReal.toReal_eq_toReal_iff' (by finiteness) (by finiteness)] norm_num [ENNReal.toReal_add, ENNReal.toReal_inv]
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.smallAvoidNullMass · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/FiniteSmallInstance.lean:246
theorem smallAvoidAlternativeMass

The formal statement establishes the stated conclusion.

Formal statement
Proof (Lean source)
lemma smallAvoidAlternativeMass : obsLaw smallAlternativeLaw smallAvoidNullAtom = 1 := by rw [obsLaw, PMF.toMeasure_apply_fintype] norm_num [smallAvoidNullAtom, indicator, smallAlternativeLaw, smallAlternativeAtomMass, Fintype.sum_prod_type, Fin.sum_univ_two] rw [← ENNReal.toReal_eq_toReal_iff' (by finiteness) (by finiteness)] norm_num [ENNReal.toReal_add, ENNReal.toReal_inv]
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.smallAvoidAlternativeMass · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/FiniteSmallInstance.lean:256
theorem smallAvoidProductMassNull

The formal statement establishes the stated conclusion.

Formal statement
n :
Proof (Lean source)
lemma smallAvoidProductMassNull (n : Nat) : (labeledProductLaw smallNullLaw n).real (smallAvoidNullSample n) = (3 / 4 : Real) ^ n := by rw [measureReal_def, labeledProductLaw, smallAvoidNullSample, Measure.pi_pi] simp_rw [smallAvoidNullMass] rw [ENNReal.toReal_prod] norm_num [ENNReal.toReal_div] rw [div_pow]
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.smallAvoidProductMassNull · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/FiniteSmallInstance.lean:266
theorem smallAvoidProductMassAlternative

The formal statement establishes the stated conclusion.

Formal statement
n :
Proof (Lean source)
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.smallAvoidProductMassAlternative · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/FiniteSmallInstance.lean:277
theorem smallLabeledTV

The formal statement establishes the stated conclusion.

Formal statement
n :
Proof (Lean source)
lemma smallLabeledTV (n : Nat) : tvDist (labeledProductLaw smallNullLaw n) (labeledProductLaw smallAlternativeLaw n) = 1 - (3 / 4 : Real) ^ n := by letI : IsProbabilityMeasure (labeledProductLaw smallNullLaw n) := by unfold labeledProductLaw infer_instance letI : IsProbabilityMeasure (labeledProductLaw smallAlternativeLaw n) := by unfold labeledProductLaw infer_instance apply le_antisymm · exact tvDist_le_one_sub_common (Set.toFinite _ |>.measurableSet) (smallCommonRestrictEq n) (smallCommonProductMassNull n) (smallCommonProductMassAlternative n) · have hA : MeasurableSet (smallAvoidNullSample n)ᶜ := Set.toFinite _ |>.measurableSet have hgap := abs_measureReal_sub_le_tvDist (μ := labeledProductLaw smallNullLaw n) (ν := labeledProductLaw smallAlternativeLaw n) hA rw [measureReal_compl (Set.toFinite _ |>.measurableSet), probReal_univ, smallAvoidProductMassNull, measureReal_compl (Set.toFinite _ |>.measurableSet), probReal_univ, smallAvoidProductMassAlternative] at hgap norm_num only [sub_self, sub_zero] at hgap have hpow : (3 / 4 : Real) ^ n ≤ 1 := pow_le_one₀ (by norm_num) (by norm_num) rw [abs_of_nonneg (sub_nonneg.mpr hpow)] at hgap exact hgap
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.smallLabeledTV · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/FiniteSmallInstance.lean:285
theorem smallNullCellMass

The formal statement establishes the stated conclusion.

Formal statement
x :
Fin 2
cellMass smallNullLaw x = 1 / 2
Proof (Lean source)
lemma smallNullCellMass (x : Fin 2) : cellMass smallNullLaw x = 1 / 2 := by fin_cases x <;> norm_num [cellMass, jointMass, smallNullLaw, smallNullAtomMass, PMF.ofFintype_apply, ENNReal.toReal_inv]
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.smallNullCellMass · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/FiniteSmallInstance.lean:313
theorem smallAlternativeCellMass

The formal statement establishes the stated conclusion.

Formal statement
x :
Fin 2
cellMass smallAlternativeLaw x = 1 / 2
Proof (Lean source)
lemma smallAlternativeCellMass (x : Fin 2) : cellMass smallAlternativeLaw x = 1 / 2 := by fin_cases x <;> norm_num [cellMass, jointMass, smallAlternativeLaw, smallAlternativeAtomMass, PMF.ofFintype_apply, ENNReal.toReal_inv]
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.smallAlternativeCellMass · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/FiniteSmallInstance.lean:320
theorem smallNullPropensity

The formal statement establishes the stated conclusion.

Formal statement
x :
Fin 2
propensity smallNullLaw x = 1 / 2
Proof (Lean source)
lemma smallNullPropensity (x : Fin 2) : propensity smallNullLaw x = 1 / 2 := by fin_cases x <;> norm_num [propensity, armMass, cellMass, jointMass, smallNullLaw, smallNullAtomMass, PMF.ofFintype_apply, ENNReal.toReal_inv]
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.smallNullPropensity · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/FiniteSmallInstance.lean:328
theorem smallAlternativePropensity

The formal statement establishes the stated conclusion.

Formal statement
x :
Fin 2
propensity smallAlternativeLaw x = 1 / 2
Proof (Lean source)
lemma smallAlternativePropensity (x : Fin 2) : propensity smallAlternativeLaw x = 1 / 2 := by fin_cases x <;> norm_num [propensity, armMass, cellMass, jointMass, smallAlternativeLaw, smallAlternativeAtomMass, PMF.ofFintype_apply, ENNReal.toReal_inv]
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.smallAlternativePropensity · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/FiniteSmallInstance.lean:335
theorem smallNullControlMean

The formal statement establishes the stated conclusion.

Formal statement
x :
Fin 2
Proof (Lean source)
lemma smallNullControlMean (x : Fin 2) : outcomeMean smallNullLaw false x = 0 := by fin_cases x <;> norm_num [outcomeMean, armMass, jointMass, smallNullLaw, smallNullAtomMass, PMF.ofFintype_apply, ENNReal.toReal_inv]
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.smallNullControlMean · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/FiniteSmallInstance.lean:343
theorem smallAlternativeControlMean

The formal statement establishes the stated conclusion.

Formal statement
x :
Fin 2
Proof (Lean source)
lemma smallAlternativeControlMean (x : Fin 2) : outcomeMean smallAlternativeLaw false x = 0 := by fin_cases x <;> norm_num [outcomeMean, armMass, jointMass, smallAlternativeLaw, smallAlternativeAtomMass, PMF.ofFintype_apply, ENNReal.toReal_inv]
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.smallAlternativeControlMean · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/FiniteSmallInstance.lean:350
theorem smallNullTreatedMean

The formal statement establishes the stated conclusion.

Formal statement
x :
Fin 2
Proof (Lean source)
lemma smallNullTreatedMean (x : Fin 2) : outcomeMean smallNullLaw true x = 0 := by fin_cases x <;> norm_num [outcomeMean, armMass, jointMass, smallNullLaw, smallNullAtomMass, PMF.ofFintype_apply, ENNReal.toReal_inv]
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.smallNullTreatedMean · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/FiniteSmallInstance.lean:358
theorem smallAlternativeTreatedMeanFirst

The formal statement establishes the stated conclusion.

Formal statement
Proof (Lean source)
lemma smallAlternativeTreatedMeanFirst : outcomeMean smallAlternativeLaw true 0 = 1 := by norm_num [outcomeMean, armMass, jointMass, smallAlternativeLaw, smallAlternativeAtomMass, PMF.ofFintype_apply, ENNReal.toReal_inv]
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.smallAlternativeTreatedMeanFirst · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/FiniteSmallInstance.lean:365
theorem smallAlternativeTreatedMeanSecond

The formal statement establishes the stated conclusion.

Formal statement
Proof (Lean source)
lemma smallAlternativeTreatedMeanSecond : outcomeMean smallAlternativeLaw true 1 = 0 := by norm_num [outcomeMean, armMass, jointMass, smallAlternativeLaw, smallAlternativeAtomMass, PMF.ofFintype_apply, ENNReal.toReal_inv]
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.smallAlternativeTreatedMeanSecond · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/FiniteSmallInstance.lean:371
theorem smallNullAuxTable

The formal statement establishes the stated conclusion.

Formal statement
z :
Proof (Lean source)
lemma smallNullAuxTable (z : AuxObs 2) : auxTableOf smallNullLaw z = 1 / 4 := by rcases z with ⟨x, a⟩ fin_cases x <;> cases a <;> norm_num [auxTableOf, auxMarginal, armMass, jointMass, smallNullLaw, smallNullAtomMass, PMF.map_apply, PMF.ofFintype_apply, ENNReal.toReal_inv]
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.smallNullAuxTable · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/FiniteSmallInstance.lean:377
theorem smallAlternativeAuxTable

The formal statement establishes the stated conclusion.

Formal statement
z :
Proof (Lean source)
lemma smallAlternativeAuxTable (z : AuxObs 2) : auxTableOf smallAlternativeLaw z = 1 / 4 := by rcases z with ⟨x, a⟩ fin_cases x <;> cases a <;> norm_num [auxTableOf, auxMarginal, armMass, jointMass, smallAlternativeLaw, smallAlternativeAtomMass, PMF.map_apply, PMF.ofFintype_apply, ENNReal.toReal_inv]
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.smallAlternativeAuxTable · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/FiniteSmallInstance.lean:386
theorem smallNullTarget

The formal statement establishes the stated conclusion.

Formal statement
Proof (Lean source)
lemma smallNullTarget : ateFunctional smallNullLaw = 0 := by norm_num [ateFunctional, cellMass, outcomeMean, armMass, jointMass, smallNullLaw, smallNullAtomMass, PMF.ofFintype_apply, ENNReal.toReal_inv]
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.smallNullTarget · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/FiniteSmallInstance.lean:396
theorem smallAlternativeTarget

The formal statement establishes the stated conclusion.

Formal statement
Proof (Lean source)
lemma smallAlternativeTarget : ateFunctional smallAlternativeLaw = 1 / 2 := by norm_num [ateFunctional, cellMass, outcomeMean, armMass, jointMass, smallAlternativeLaw, smallAlternativeAtomMass, PMF.ofFintype_apply, ENNReal.toReal_inv]
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.smallAlternativeTarget · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/FiniteSmallInstance.lean:402
theorem smallAlternativeAuxIntegral

The formal statement establishes the stated conclusion.

Formal statement
(∫ y : Fin 1 → AuxObs 2, ((if y 0 = (0, false) then 1 else 0) + (if y 0 = (0, true) then 1 else 0) : Real) ∂auxProductLaw smallAlternativeLaw 1)
= 1 / 2
Proof (Lean source)
lemma smallAlternativeAuxIntegral : (∫ y : Fin 1 → AuxObs 2, ((if y 0 = (0, false) then 1 else 0) + (if y 0 = (0, true) then 1 else 0) : Real) ∂auxProductLaw smallAlternativeLaw 1) = 1 / 2 := by rw [auxProductLaw] let f : AuxObs 2 → Real := fun z ↦ (if z = (0, false) then 1 else 0) + (if z = (0, true) then 1 else 0) calc _ = ∫ z, f z ∂(auxMarginal smallAlternativeLaw).toMeasure := integral_pi_fin_one _ f _ = _ := by rw [PMF.integral_eq_sum] simp_rw [smallAlternative_auxMarginal] norm_num [f, Fintype.sum_prod_type]
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.smallAlternativeAuxIntegral · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/FiniteSmallInstance.lean:409
theorem smallAlternativeLabelIntegral

The formal statement establishes the stated conclusion.

Formal statement
(∫ x : Fin 1 → Obs 2, (if x 0 = (0, true, true) then 1 else 0 : Real) ∂labeledProductLaw smallAlternativeLaw 1)
= 1 / 4
Proof (Lean source)
lemma smallAlternativeLabelIntegral : (∫ x : Fin 1 → Obs 2, (if x 0 = (0, true, true) then 1 else 0 : Real) ∂labeledProductLaw smallAlternativeLaw 1) = 1 / 4 := by rw [labeledProductLaw] let f : Obs 2 → Real := fun z ↦ if z = (0, true, true) then 1 else 0 calc _ = ∫ z, f z ∂obsLaw smallAlternativeLaw := integral_pi_fin_one _ f _ = _ := by rw [show obsLaw smallAlternativeLaw = smallAlternativeLaw.pmf.toMeasure from rfl, PMF.integral_eq_sum] norm_num [f, smallAlternativeLaw, smallAlternativeAtomMass, PMF.ofFintype_apply, ENNReal.toReal_inv]
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.smallAlternativeLabelIntegral · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/FiniteSmallInstance.lean:427
theorem smallAlternativeExpectationIdentity

The formal statement establishes the stated conclusion.

Formal statement
Proof (Lean source)
lemma smallAlternativeExpectationIdentity : ∫ z, smallMixedStatistic z ∂annotationLaw smallAlternativeLaw 1 1 = 2 * markedMass smallAlternativeLaw 0 true * cellMass smallAlternativeLaw 0 := by letI : IsProbabilityMeasure (labeledProductLaw smallAlternativeLaw 1) := by unfold labeledProductLaw infer_instance letI : IsProbabilityMeasure (auxProductLaw smallAlternativeLaw 1) := by unfold auxProductLaw infer_instance rw [annotationLaw, MeasureTheory.integral_prod] all_goals try exact Integrable.of_finite simp only [smallMixedStatistic] have hinner (x : Fin 1 → Obs 2) : (∫ y : Fin 1 → AuxObs 2, (2 * if x 0 = (0, true, true) then 1 else 0) * ((if y 0 = (0, false) then 1 else 0) + (if y 0 = (0, true) then 1 else 0)) ∂auxProductLaw smallAlternativeLaw 1) = (2 * if x 0 = (0, true, true) then 1 else 0) * (1 / 2 : Real) := by rw [integral_const_mul, smallAlternativeAuxIntegral] simp_rw [hinner] have hid : (fun x : Fin 1 → Obs 2 ↦ (2 * if x 0 = (0, true, true) then 1 else 0) * (1 / 2 : Real)) = fun x ↦ (if x 0 = (0, true, true) then 1 else 0 : Real) := by funext x split_ifs <;> norm_num rw [hid, smallAlternativeLabelIntegral] norm_num [markedMass, cellMass, jointMass, smallAlternativeLaw, smallAlternativeAtomMass, PMF.ofFintype_apply, ENNReal.toReal_inv]
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.smallAlternativeExpectationIdentity · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/FiniteSmallInstance.lean:443
theorem exists_finiteSmallInstance

The formal statement establishes the stated conclusion.

Formal statement
Proof (Lean source)
lemma exists_finiteSmallInstance : Nonempty FiniteCalculationWitness := by refine ⟨{ Pi0Small := Measure.dirac smallNullLaw Pi1Small := Measure.dirac smallAlternativeLaw law0 := smallNullLaw law1 := smallAlternativeLaw prior0_dirac := rfl prior1_dirac := rfl class0 := ?_ class1 := ?_ cellMass0 := smallNullCellMass cellMass1 := smallAlternativeCellMass propensity0 := smallNullPropensity propensity1 := smallAlternativePropensity controlMean0 := smallNullControlMean controlMean1 := smallAlternativeControlMean treatedMean0 := smallNullTreatedMean treatedMean1_first := smallAlternativeTreatedMeanFirst treatedMean1_second := smallAlternativeTreatedMeanSecond uniformAux0 := smallNullAuxTable uniformAux1 := smallAlternativeAuxTable uniformAux := by funext z; rw [smallNullAuxTable, smallAlternativeAuxTable] target0 := smallNullTarget target1 := smallAlternativeTarget expectationIdentity := smallAlternativeExpectationIdentity expectationValue := by norm_num [markedMass, cellMass, jointMass, smallAlternativeLaw, smallAlternativeAtomMass, PMF.ofFintype_apply, ENNReal.toReal_inv] treatedCellTarget := by norm_num [cellMass, outcomeMean, armMass, jointMass, smallAlternativeLaw, smallAlternativeAtomMass, PMF.ofFintype_apply, ENNReal.toReal_inv] labeledTV := smallLabeledTV }⟩ · refine ⟨by norm_num, by norm_num, by norm_num, ?_⟩ intro x _ rw [smallNullPropensity] constructor <;> norm_num · refine ⟨by norm_num, by norm_num, by norm_num, ?_⟩ intro x _ rw [smallAlternativePropensity] constructor <;> norm_num
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.exists_finiteSmallInstance · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/FiniteSmallInstance.lean:473
def finiteSmallInstance Definition 27 in the paper ↗

The explicit d=2, epsilon=1/4, n=m=1 common-marginal calculation. the stated conclusion.

Definition (Lean source)
finiteSmallInstance :
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.finiteSmallInstance · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/FiniteSmallInstance.lean:517
CausalSmith.Stat.STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research.Helpers.FixedSampleHybridTransfer 1 declarations Transfer of the Poisson hybrid to the fixed two-sample experiment.

Transfer of the Poisson hybrid to the fixed two-sample experiment.

theorem fixed_sample_hybrid_transfer Lemma 14 in the paper ↗

The deterministic fixed-sample implementation costs at most a factor two and an additive order-1/n overflow term. the stated conclusion.

Formal statement
∃ C : Real,
0 < C
conclusion 1
eps :
0 < eps
eps < 1 / 2
n m d :
1 ≤ n
2 ≤ d
P :
ModelClass d eps P
≤ 2 * poissonHybridMSE P n m eps + C / n
Proof (Lean source)
lemma fixed_sample_hybrid_transfer : ∃ C : Real, 0 < C ∧ ∀ (eps : Real), 0 < eps → eps < 1 / 2 → ∀ (n m d : Nat), 1 ≤ n → 2 ≤ d → ∀ (P : DiscreteLaw d), ModelClass d eps P → Measurable (mixedEstimator n m d eps) ∧ twoSampleMSE (annotationLaw P n m) (mixedEstimator n m d eps) (ateFunctional P) ≤ 2 * poissonHybridMSE P n m eps + C / n := by refine ⟨384, by norm_num, ?_⟩ intro eps _heps _heps2 n m d hn _hd P hP refine ⟨measurable_mixedEstimator n m d eps, ?_⟩ by_cases hcal : calibrationPredicate n m eps · let bs := blockSizes n m let u : Real := bs.M0 / 8 let tp : Real := (bs.np + bs.mp : Nat) / 8 let t : Real := (bs.nf + bs.mf : Nat) / 8 let P3 := threePoolObservationLaw (obsLaw P) (auxMarginal P).toMeasure let lam := threePoolIntensity (toNNReal u) (toNNReal tp) (toNNReal t) let cap := threePoolCapacity bs.M0 (bs.np + bs.mp) (bs.nf + bs.mf) let T := finitePrefixHybridStatistic (d := d) n m eps let RB := prefixRaoBlackwellStatistic (N := cap) lam T 0 have htransfer := finiteAlphabet_threePoolSharedLaw_risk_le (obsLaw P) (auxMarginal P).toMeasure (toNNReal u) (toNNReal tp) (toNNReal t) bs.M0 (bs.np + bs.mp) (bs.nf + bs.mf) (T := T) (measurable_finitePrefixHybridStatistic n m eps) (a := (-1 : Real)) (b := 1) (theta := ateFunctional P) (zOver := 0) (by norm_num) (finitePrefixHybridStatistic_mem_Icc n m eps) (ateFunctional_mem_Icc_neg_one_one P hP.overlap) (by norm_num) have hRB : mixedEstimator n m d eps = RB ∘ hybridFixedPools := by funext sample exact (prefixRaoBlackwellStatistic_hybridFixedPools eps hcal sample).symm have hfixed : twoSampleMSE (annotationLaw P n m) (mixedEstimator n m d eps) (ateFunctional P) = sqRisk (fixedPoolsLaw P3 cap) RB (ateFunctional P) := by unfold twoSampleMSE sqRisk rw [hRB] change (∫ z, (RB (hybridFixedPools z) - ateFunctional P) ^ 2 ∂annotationLaw P n m) = _ have hf : AEStronglyMeasurable (fun z ↦ (RB z - ateFunctional P) ^ 2) (Measure.map hybridFixedPools (annotationLaw P n m)) := (measurable_of_countable _).aestronglyMeasurable rw [← integral_map (measurable_hybridFixedPools n m d).aemeasurable hf, hybridFixedPools_map_annotationLaw] have hpoisson : sqRisk (independentPoissonPrefixLaw P3 lam) T (ateFunctional P) = poissonHybridMSE P n m eps := by unfold sqRisk let stat := hybridPoissonStatistic (d := d) n m eps u t have hf : AEStronglyMeasurable (fun K ↦ (stat K - ateFunctional P) ^ 2) (Measure.map hybridPrefixCounts (independentPoissonPrefixLaw P3 lam)) := (measurable_of_countable _).aestronglyMeasurable have hi := integral_map measurable_hybridPrefixCounts.aemeasurable hf change (∫ s, (stat (hybridPrefixCounts s) - ateFunctional P) ^ 2 ∂independentPoissonPrefixLaw P3 lam) = _ rw [← hi] rw [hybridPrefixCounts_map_eq_hybridPoissonCountLaw P u tp t (by positivity) (by positivity) (by positivity)] simp only [poissonHybridMSE, hcal, if_pos, stat, u, tp, t, bs] have hn24 : 24 ≤ n := by simpa only [calibrationPredicate] using hcal.1 have hM : n ≤ 4 * bs.M0 := by dsimp [bs, blockSizes]; omega have hPcap : n ≤ 4 * (bs.np + bs.mp) := by dsimp [bs, blockSizes]; omega have hF : n ≤ 4 * (bs.nf + bs.mf) := by dsimp [bs, blockSizes]; omega have hMpos : 0 < bs.M0 := by omega have hPpos : 0 < bs.np + bs.mp := by omega have hFpos : 0 < bs.nf + bs.mf := by omega have hnR : 0 < (n : Real) := by positivity have tail_le (N : Nat) (hN : 0 < N) (hlarge : n ≤ 4 * N) : (poissonMeasure (toNNReal ((N : Real) / 8))).real (Ioi N) ≤ 32 / (n : Real) := by refine (poisson_eighth_tail N hN).trans ?_ apply (div_le_div_iff₀ (by positivity : (0 : Real) < N) hnR).2 have hc : (n : Real) ≤ 4 * (N : Real) := by exact_mod_cast hlarge nlinarith have htails : (poissonMeasure (toNNReal u)).real (Ioi bs.M0) + (poissonMeasure (toNNReal tp)).real (Ioi (bs.np + bs.mp)) + (poissonMeasure (toNNReal t)).real (Ioi (bs.nf + bs.mf)) ≤ 96 / (n : Real) := by have h0 := tail_le bs.M0 hMpos hM have hp := tail_le (bs.np + bs.mp) hPpos hPcap have hf := tail_le (bs.nf + bs.mf) hFpos hF dsimp [u, tp, t] at h0 hp hf ⊢ calc _ ≤ 32 / (n : Real) + 32 / (n : Real) + 32 / (n : Real) := add_le_add (add_le_add h0 hp) hf _ = 96 / (n : Real) := by ring rw [hfixed] calc _ ≤ sqRisk (independentPoissonPrefixLaw P3 lam) T (ateFunctional P) + 4 * ((poissonMeasure (toNNReal u)).real (Ioi bs.M0) + (poissonMeasure (toNNReal tp)).real (Ioi (bs.np + bs.mp)) + (poissonMeasure (toNNReal t)).real (Ioi (bs.nf + bs.mf))) := by convert htransfer using 1 <;> norm_num [P3, lam, cap, T, RB, bs, u, tp, t] _ ≤ poissonHybridMSE P n m eps + 384 / (n : Real) := by rw [hpoisson] gcongr calc 4 * ((poissonMeasure (toNNReal u)).real (Ioi bs.M0) + (poissonMeasure (toNNReal tp)).real (Ioi (bs.np + bs.mp)) + (poissonMeasure (toNNReal t)).real (Ioi (bs.nf + bs.mf))) ≤ 4 * (96 / (n : Real)) := mul_le_mul_of_nonneg_left htails (by norm_num) _ = 384 / (n : Real) := by ring _ ≤ 2 * poissonHybridMSE P n m eps + 384 / (n : Real) := by have hmse : 0 ≤ poissonHybridMSE P n m eps := by simp only [poissonHybridMSE, hcal, if_pos] exact integral_nonneg fun _ ↦ sq_nonneg _ linarith · unfold twoSampleMSE letI : IsProbabilityMeasure (annotationLaw P n m) := by unfold annotationLaw labeledProductLaw auxProductLaw infer_instance simp only [mixedEstimator, poissonHybridMSE, hcal, if_false, zero_sub, neg_sq, integral_const] have hnR : 0 < (n : Real) := by positivity have hnonneg : 0 ≤ ateFunctional P ^ 2 := sq_nonneg _ have hconst : 0 ≤ (384 : Real) / n := by positivity rw [show (annotationLaw P n m).real univ = 1 by simp] simp only [one_smul] nlinarith
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.fixed_sample_hybrid_transfer · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/FixedSampleHybridTransfer.lean:68
CausalSmith.Stat.STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research.Helpers.HybridBlockCalibration 7 declarations Exact arithmetic for the deterministic labeled/auxiliary block split.

Exact arithmetic for the deterministic labeled/auxiliary block split.

theorem blockSizes_nat_bounds

Integer form of the uniform quarter/three-quarter block bounds. the stated conditions the stated conclusion.

Formal statement
n m :
hn :
24 ≤ n
conclusion 1
n ≤ 4 * (blockSizes n m).M0
conclusion 2
3 * (blockSizes n m).M0 ≤ n
conclusion 3
n + m ≤ 4 * ((blockSizes n m).np + (blockSizes n m).mp)
conclusion 4
4 * ((blockSizes n m).np + (blockSizes n m).mp) ≤ 3 * (n + m)
conclusion 5
n + m ≤ 4 * ((blockSizes n m).nf + (blockSizes n m).mf)
conclusion 6
4 * ((blockSizes n m).nf + (blockSizes n m).mf) ≤ 3 * (n + m)
Proof (Lean source)
lemma blockSizes_nat_bounds (n m : Nat) (hn : 24 ≤ n) : n ≤ 4 * (blockSizes n m).M0 ∧ 3 * (blockSizes n m).M0 ≤ n ∧ n + m ≤ 4 * ((blockSizes n m).np + (blockSizes n m).mp) ∧ 4 * ((blockSizes n m).np + (blockSizes n m).mp) ≤ 3 * (n + m) ∧ n + m ≤ 4 * ((blockSizes n m).nf + (blockSizes n m).mf) ∧ 4 * ((blockSizes n m).nf + (blockSizes n m).mf) ≤ 3 * (n + m) := by simp only [blockSizes] omega
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.blockSizes_nat_bounds · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridBlockCalibration.lean:10
theorem blockSizes_intensity_ratios

The deterministic intensities satisfy all ratio bounds in C15. the stated conditions the stated conclusion.

Formal statement
n m :
hn :
24 ≤ n
bs :
N :
n + m (: Nat)
u :
bs.M0 / 8 (: Real)
tp :
(bs.np + bs.mp : Nat) / 8 (: Real)
t :
(bs.nf + bs.mf : Nat) / 8 (: Real)
1 / 32 ≤ u / n
u / n ≤ 1 / 24
1 / 32 ≤ tp / N
tp / N ≤ 3 / 32
1 / 32 ≤ t / N
t / N ≤ 3 / 32
1 / 3 ≤ t / tp
t / tp ≤ 3
Proof (Lean source)
lemma blockSizes_intensity_ratios (n m : Nat) (hn : 24 ≤ n) : let bs := blockSizes n m let N : Nat := n + m let u : Real := bs.M0 / 8 let tp : Real := (bs.np + bs.mp : Nat) / 8 let t : Real := (bs.nf + bs.mf : Nat) / 8 1 / 32 ≤ u / n ∧ u / n ≤ 1 / 24 ∧ 1 / 32 ≤ tp / N ∧ tp / N ≤ 3 / 32 ∧ 1 / 32 ≤ t / N ∧ t / N ≤ 3 / 32 ∧ 1 / 3 ≤ t / tp ∧ t / tp ≤ 3 := by dsimp only rcases blockSizes_nat_bounds n m hn with ⟨hu0, hu1, hp0, hp1, hf0, hf1⟩ have hnR : (0 : Real) < n := by positivity have hNR : (0 : Real) < n + m := by positivity have hpR : (0 : Real) < (blockSizes n m).np + (blockSizes n m).mp := by have : (0 : Nat) < (blockSizes n m).np + (blockSizes n m).mp := by omega exact_mod_cast this have hfR : (0 : Real) < (blockSizes n m).nf + (blockSizes n m).mf := by have : (0 : Nat) < (blockSizes n m).nf + (blockSizes n m).mf := by omega exact_mod_cast this have hu0R : (n : Real) ≤ 4 * (blockSizes n m).M0 := by exact_mod_cast hu0 have hu1R : 3 * ((blockSizes n m).M0 : Real) ≤ n := by exact_mod_cast hu1 have hp0R : (n + m : Real) ≤ 4 * ((blockSizes n m).np + (blockSizes n m).mp : Nat) := by exact_mod_cast hp0 have hp1R : 4 * ((blockSizes n m).np + (blockSizes n m).mp : Nat) ≤ 3 * (n + m : Real) := by exact_mod_cast hp1 have hf0R : (n + m : Real) ≤ 4 * ((blockSizes n m).nf + (blockSizes n m).mf : Nat) := by exact_mod_cast hf0 have hf1R : 4 * ((blockSizes n m).nf + (blockSizes n m).mf : Nat) ≤ 3 * (n + m : Real) := by exact_mod_cast hf1 norm_num [Nat.cast_add] at * constructor · field_simp nlinarith constructor · field_simp nlinarith constructor · field_simp nlinarith constructor · field_simp nlinarith constructor · field_simp nlinarith constructor · field_simp nlinarith constructor <;> field_simp [hpR.ne'] <;> nlinarith
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.blockSizes_intensity_ratios · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridBlockCalibration.lean:21
theorem blockSizes_mul_Bscale_lower

Multiplication by the calibrated bandwidth cancels its positive minimum denominator. This form is convenient for all three tail tests. the stated conditions the stated conclusion.

Formal statement
n m :
eps :
hn :
24 ≤ n
bs :
tp :
(bs.np + bs.mp : Nat) / 8 (: Real)
t :
(bs.nf + bs.mf : Nat) / 8 (: Real)
L :
Ldeg n (: Real)
H :
Hconst eps (: Real)
H * L ≤ tp * Bscale n m eps
H * L ≤ t * Bscale n m eps
Proof (Lean source)
lemma blockSizes_mul_Bscale_lower (n m : Nat) (eps : Real) (hn : 24 ≤ n) : let bs := blockSizes n m let tp : Real := (bs.np + bs.mp : Nat) / 8 let t : Real := (bs.nf + bs.mf : Nat) / 8 let L : Real := Ldeg n let H : Real := Hconst eps H * L ≤ tp * Bscale n m eps ∧ H * L ≤ t * Bscale n m eps := by dsimp only have hr := blockSizes_intensity_ratios n m hn dsimp only at hr rcases hr with ⟨_, _, htpN, _, htN, _, _, _⟩ have hN : (0 : Real) < n + m := by positivity have htp : 0 < (((blockSizes n m).np + (blockSizes n m).mp : Nat) : Real) / 8 := by have : 0 < ((((blockSizes n m).np + (blockSizes n m).mp : Nat) : Real) / 8) / (n + m : Nat) := lt_of_lt_of_le (by norm_num : (0 : Real) < 1 / 32) htpN rcases div_pos_iff.mp this with h | h · exact h.1 · linarith have ht : 0 < (((blockSizes n m).nf + (blockSizes n m).mf : Nat) : Real) / 8 := by have : 0 < ((((blockSizes n m).nf + (blockSizes n m).mf : Nat) : Real) / 8) / (n + m : Nat) := lt_of_lt_of_le (by norm_num : (0 : Real) < 1 / 32) htN rcases div_pos_iff.mp this with h | h · exact h.1 · linarith have hHL : 0 ≤ (Hconst eps : Real) * Ldeg n := by positivity have hmin : 0 < min ((((blockSizes n m).np + (blockSizes n m).mp : Nat) : Real) / 8) ((((blockSizes n m).nf + (blockSizes n m).mf : Nat) : Real) / 8) := lt_min htp ht simp only [Bscale] constructor · calc (Hconst eps : Real) * Ldeg n ≤ ((Hconst eps : Real) * Ldeg n) / min ((((blockSizes n m).np + (blockSizes n m).mp : Nat) : Real) / 8) ((((blockSizes n m).nf + (blockSizes n m).mf : Nat) : Real) / 8) * ((((blockSizes n m).np + (blockSizes n m).mp : Nat) : Real) / 8) := by rw [div_mul_eq_mul_div] apply (le_div_iff₀ hmin).2 exact mul_le_mul_of_nonneg_left (min_le_left _ _) hHL _ = _ := by ring · calc (Hconst eps : Real) * Ldeg n ≤ ((Hconst eps : Real) * Ldeg n) / min ((((blockSizes n m).np + (blockSizes n m).mp : Nat) : Real) / 8) ((((blockSizes n m).nf + (blockSizes n m).mf : Nat) : Real) / 8) * ((((blockSizes n m).nf + (blockSizes n m).mf : Nat) : Real) / 8) := by rw [div_mul_eq_mul_div] apply (le_div_iff₀ hmin).2 exact mul_le_mul_of_nonneg_left (min_le_right _ _) hHL _ = _ := by ring
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.blockSizes_mul_Bscale_lower · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridBlockCalibration.lean:73
theorem k0_lower_eighth

When the unrounded pilot scale is at least eight, the floored pilot threshold retains at least one eighth of that scale.

Formal statement
n m :
eps :
h :
let bs := blockSizes n m let tp : Real := (bs.np + bs.mp : Nat) / 8 8
≤ tp * Bscale n m eps
bs :
blockSizes n m
tp :
(bs.np + bs.mp : Nat) / 8 (: Real)
tp * Bscale n m eps / 8 ≤ (k0 n m eps : Real)
Proof (Lean source)
lemma k0_lower_eighth (n m : Nat) (eps : Real) (h : let bs := blockSizes n m let tp : Real := (bs.np + bs.mp : Nat) / 8 8 ≤ tp * Bscale n m eps) : let bs := blockSizes n m let tp : Real := (bs.np + bs.mp : Nat) / 8 tp * Bscale n m eps / 8 ≤ (k0 n m eps : Real) := by dsimp only at h ⊢ let x : Real := (((blockSizes n m).np + (blockSizes n m).mp : Nat) : Real) / 8 * Bscale n m eps / 4 have hx2 : 2 ≤ x := by dsimp [x]; linarith have hfloor0 : (0 : Int) ≤ ⌊x⌋ := by rw [Int.floor_nonneg]; linarith have hcast : ((Int.toNat ⌊x⌋ : Nat) : Real) = (⌊x⌋ : Int) := by exact_mod_cast Int.toNat_of_nonneg hfloor0 have hfloor := Int.lt_floor_add_one x simp only [k0] change (((blockSizes n m).np + (blockSizes n m).mp : Nat) : Real) / 8 * Bscale n m eps / 8 ≤ ((Int.toNat ⌊x⌋ : Nat) : Real) rw [show ((((blockSizes n m).np + (blockSizes n m).mp : Nat) : Real) / 8 * Bscale n m eps / 8) = x / 2 by dsimp [x]; ring] rw [hcast] have hfloorR : x < ((⌊x⌋ : Int) : Real) + 1 := by exact_mod_cast hfloor linarith
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.k0_lower_eighth · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridBlockCalibration.lean:127
theorem k0_upper_quarter

When the pilot scale is nonnegative, the floored pilot threshold is at most one quarter of that scale.

Formal statement
n m :
eps :
h :
let bs := blockSizes n m let tp : Real := (bs.np + bs.mp : Nat) / 8 0
≤ tp * Bscale n m eps
bs :
blockSizes n m
tp :
(bs.np + bs.mp : Nat) / 8 (: Real)
(k0 n m eps : Real) ≤ tp * Bscale n m eps / 4
Proof (Lean source)
lemma k0_upper_quarter (n m : Nat) (eps : Real) (h : let bs := blockSizes n m let tp : Real := (bs.np + bs.mp : Nat) / 8 0 ≤ tp * Bscale n m eps) : let bs := blockSizes n m let tp : Real := (bs.np + bs.mp : Nat) / 8 (k0 n m eps : Real) ≤ tp * Bscale n m eps / 4 := by dsimp only at h ⊢ let x : Real := (((blockSizes n m).np + (blockSizes n m).mp : Nat) : Real) / 8 * Bscale n m eps / 4 have hx : 0 ≤ x := by dsimp [x]; linarith have hfloor0 : (0 : Int) ≤ ⌊x⌋ := by rw [Int.floor_nonneg]; exact hx have hcast : ((Int.toNat ⌊x⌋ : Nat) : Real) = (⌊x⌋ : Int) := by exact_mod_cast Int.toNat_of_nonneg hfloor0 simp only [k0] change ((Int.toNat ⌊x⌋ : Nat) : Real) ≤ x rw [hcast] exact Int.floor_le x
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.k0_upper_quarter · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridBlockCalibration.lean:153
theorem pow_tail_test_of_log

Turning the logarithmic tail exponent into the exact rational-power test used in the finite calibration predicate. the stated conditions the stated conclusion.

Formal statement
n k :
b :
hn :
1 ≤ n
hb :
0 < b
hlog :
12 * binLen n ≤ (k : Real) * log b
(n : Real) ^ 12 ≤ b ^ k
Proof (Lean source)
lemma pow_tail_test_of_log {n k : Nat} {b : Real} (hn : 1 ≤ n) (hb : 0 < b) (hlog : 12 * binLen n ≤ (k : Real) * log b) : (n : Real) ^ 12 ≤ b ^ k := by have hnR : (0 : Real) < n := by positivity have hlogn : log (n : Real) ≤ binLen n := by have h := logEN_le_binLen n hn have hs : logEN n = 1 + log (n : Real) := by rw [logEN, Real.log_mul (by positivity : exp 1 ≠ 0) hnR.ne'] simp rw [hs] at h linarith rw [← Real.log_le_log_iff (pow_pos hnR _) (pow_pos hb _)] rw [Real.log_pow, Real.log_pow] push_cast nlinarith
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.pow_tail_test_of_log · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridBlockCalibration.lean:174
theorem Bscale_bounds

Exact two-sided bandwidth comparison (C33). the stated conditions the stated conclusion.

Formal statement
n m :
eps :
hn :
24 ≤ n
conclusion 1
32 * Hconst eps * Ldeg n / (3 * (n + m : Nat)) ≤ Bscale n m eps
conclusion 2
Bscale n m eps ≤ 32 * Hconst eps * Ldeg n / (n + m : Nat)
Proof (Lean source)
lemma Bscale_bounds (n m : Nat) (eps : Real) (hn : 24 ≤ n) : 32 * Hconst eps * Ldeg n / (3 * (n + m : Nat)) ≤ Bscale n m eps ∧ Bscale n m eps ≤ 32 * Hconst eps * Ldeg n / (n + m : Nat) := by have hr := blockSizes_intensity_ratios n m hn dsimp only at hr rcases hr with ⟨_, _, hp0, hp1, hf0, hf1, _, _⟩ let N : Real := n + m let tp : Real := ((blockSizes n m).np + (blockSizes n m).mp : Nat) / 8 let t : Real := ((blockSizes n m).nf + (blockSizes n m).mf : Nat) / 8 have hN : 0 < N := by dsimp [N]; positivity have hp0' : 1 / 32 ≤ tp / N := by simpa [tp, N, Nat.cast_add] using hp0 have hp1' : tp / N ≤ 3 / 32 := by simpa [tp, N, Nat.cast_add] using hp1 have hf0' : 1 / 32 ≤ t / N := by simpa [t, N, Nat.cast_add] using hf0 have hf1' : t / N ≤ 3 / 32 := by simpa [t, N, Nat.cast_add] using hf1 have htp0 : N / 32 ≤ tp := by have hx := (le_div_iff₀ hN).1 hp0' nlinarith have htp1 : tp ≤ 3 * N / 32 := by apply (div_le_iff₀ hN).mp at hp1' nlinarith have ht0 : N / 32 ≤ t := by have hx := (le_div_iff₀ hN).1 hf0' nlinarith have ht1 : t ≤ 3 * N / 32 := by apply (div_le_iff₀ hN).mp at hf1' nlinarith have hmin0 : 0 < min tp t := lt_of_lt_of_le (by positivity : 0 < N / 32) (le_min htp0 ht0) have hHL : 0 ≤ (Hconst eps : Real) * Ldeg n := by positivity have hminlo : N / 32 ≤ min tp t := le_min htp0 ht0 have hminhi : min tp t ≤ 3 * N / 32 := (min_le_left _ _).trans htp1 simp only [Bscale, Nat.cast_add] dsimp [N, tp, t] at hN hmin0 hminlo hminhi ⊢ norm_num [Nat.cast_add] at hmin0 hminlo hminhi ⊢ let q : Real := min ((((blockSizes n m).np : Real) + (blockSizes n m).mp) / 8) ((((blockSizes n m).nf : Real) + (blockSizes n m).mf) / 8) have hq0 : 0 < q := by dsimp [q] exact lt_min (div_pos hmin0.1 (by norm_num)) (div_pos hmin0.2 (by norm_num)) have hqlo : (n + m : Real) / 32 ≤ q := by dsimp [q] exact le_min hminlo.1 hminlo.2 have hqhi : q ≤ 3 * (n + m : Real) / 32 := by dsimp [q] rcases hminhi with h | h · exact (min_le_left _ _).trans h · exact (min_le_right _ _).trans h change 32 * (Hconst eps : Real) * Ldeg n / (3 * (n + m : Real)) ≤ (Hconst eps : Real) * Ldeg n / q ∧ (Hconst eps : Real) * Ldeg n / q ≤ 32 * (Hconst eps : Real) * Ldeg n / (n + m : Real) constructor · field_simp [hN.ne', hq0.ne'] have := mul_nonneg (sub_nonneg.mpr hqhi) hHL nlinarith · field_simp [hN.ne', hq0.ne'] have := mul_nonneg (sub_nonneg.mpr hqlo) hHL nlinarith
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.Bscale_bounds · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridBlockCalibration.lean:192
CausalSmith.Stat.STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research.Helpers.HybridBranchMeanAggregate 1 declarations Aggregate branch-mean comparison for light cells.

Aggregate branch-mean comparison for light cells.

theorem sum_light_branchMean_sq_le Lemma 7 in the paper ↗

C31, with explicit overlap-dependent constants. the stated conditions the stated conclusion.

Formal statement
d :
eps B :
L :
P :
hP :
ModelClass d eps P
u t :
hu :
0 < u
ht :
0 < t
heps :
0 < eps
hB :
0 < B
hL :
2 ≤ L
muE :
fun x : Fin d ↦ ((Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (u * markedMass P x a))).prod (Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (t * armMass P x a))))
(∑ x ∈ Finset.univ.filter (fun x : Fin d ↦ cellMass P x ≤ B), ((∫ W, hybridLightPools L B u t W ∂muE x) - ∫ W, hybridHeavyPools u W ∂muE x) ^ 2)
≤ 8 * d * B ^ 2 / (eps ^ 2 * (L : Real) ^ 4) + 4 / (eps * t)
Proof (Lean source)
lemma sum_light_branchMean_sq_le {d : Nat} {eps B : Real} {L : Nat} (P : DiscreteLaw d) (hP : ModelClass d eps P) {u t : Real} (hu : 0 < u) (ht : 0 < t) (heps : 0 < eps) (hB : 0 < B) (hL : 2 ≤ L) : let muE := fun x : Fin d ↦ ((Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (u * markedMass P x a))).prod (Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (t * armMass P x a)))) (∑ x ∈ Finset.univ.filter (fun x : Fin d ↦ cellMass P x ≤ B), ((∫ W, hybridLightPools L B u t W ∂muE x) - ∫ W, hybridHeavyPools u W ∂muE x) ^ 2) ≤ 8 * d * B ^ 2 / (eps ^ 2 * (L : Real) ^ 4) + 4 / (eps * t) := by dsimp only classical let S : Finset (Fin d) := Finset.univ.filter fun x ↦ cellMass P x ≤ B let muE := fun x : Fin d ↦ ((Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (u * markedMass P x a))).prod (Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (t * armMass P x a)))) let theta := fun x : Fin d ↦ cellMass P x * (outcomeMean P true x - outcomeMean P false x) let EL := fun x : Fin d ↦ ∫ W, hybridLightPools L B u t W ∂muE x let EH := fun x : Fin d ↦ ∫ W, hybridHeavyPools u W ∂muE x have hp0 (x : Fin d) : 0 ≤ cellMass P x := (cellMass_mem_unitInterval P x).1 have hsum : ∑ x : Fin d, cellMass P x = 1 := cellMass_sum_eq_one_annotation P have hpoint (x : Fin d) (hx : x ∈ S) : (EL x - EH x) ^ 2 ≤ 8 * B ^ 2 / (eps ^ 2 * (L : Real) ^ 4) + 8 * cellMass P x ^ 2 * exp (-2 * eps * t * cellMass P x) := by have hcell : cellMass P x ≤ B := by simpa [S] using (Finset.mem_filter.mp hx).2 have hlight : |EL x - theta x| ≤ 2 * B / (eps * (L : Real) ^ 2) := by dsimp [EL, theta, muE] rw [integral_hybridLightPools P hu ht hB L x] exact light_exact_mean_bias_le P hP x heps hB hL hcell have hheavy : |EH x - theta x| ≤ 2 * cellMass P x * exp (-eps * t * cellMass P x) := by exact integral_hybridHeavyPools_bias_le P hP x hu ht heps have hA0 : 0 ≤ 2 * B / (eps * (L : Real) ^ 2) := by positivity have hD0 : 0 ≤ 2 * cellMass P x * exp (-eps * t * cellMass P x) := mul_nonneg (mul_nonneg (by norm_num) (hp0 x)) (Real.exp_pos _).le rcases (abs_le.mp hlight) with ⟨hlow, hupp⟩ rcases (abs_le.mp hheavy) with ⟨hhlow, hhup⟩ have hid : EL x - EH x = (EL x - theta x) - (EH x - theta x) := by ring rw [hid] have hsquare : ((EL x - theta x) - (EH x - theta x)) ^ 2 ≤ 2 * (2 * B / (eps * (L : Real) ^ 2)) ^ 2 + 2 * (2 * cellMass P x * exp (-eps * t * cellMass P x)) ^ 2 := by nlinarith [sq_nonneg ((EL x - theta x) + (EH x - theta x))] calc _ ≤ _ := hsquare _ = _ := by have hexpsq : exp (-eps * t * cellMass P x) ^ 2 = exp (-2 * eps * t * cellMass P x) := by rw [pow_two, ← Real.exp_add] congr 1 ring simp only [mul_pow] rw [hexpsq] field_simp [heps.ne', ht.ne'] ring have htail (x : Fin d) : cellMass P x ^ 2 * exp (-2 * eps * t * cellMass P x) ≤ cellMass P x / (2 * eps * exp 1 * t) := by have henv := poisson_bias_envelope (eps := 2 * eps) (t := t) (z := cellMass P x) (by positivity) ht (hp0 x) have hp0' := hp0 x have hexp0 : 0 ≤ exp (-2 * eps * t * cellMass P x) := Real.exp_pos _ |>.le calc _ = cellMass P x * (cellMass P x * exp (-(2 * eps) * t * cellMass P x)) := by ring _ ≤ cellMass P x * (1 / (2 * eps * exp 1 * t)) := mul_le_mul_of_nonneg_left henv hp0' _ = _ := by ring change (∑ x ∈ S, (EL x - EH x) ^ 2) ≤ _ calc _ ≤ ∑ x ∈ S, (8 * B ^ 2 / (eps ^ 2 * (L : Real) ^ 4) + 8 * cellMass P x ^ 2 * exp (-2 * eps * t * cellMass P x)) := Finset.sum_le_sum fun x hx ↦ hpoint x hx _ ≤ ∑ x ∈ S, (8 * B ^ 2 / (eps ^ 2 * (L : Real) ^ 4) + 8 * (cellMass P x / (2 * eps * exp 1 * t))) := by apply Finset.sum_le_sum intro x _ nlinarith [mul_le_mul_of_nonneg_left (htail x) (by norm_num : (0 : Real) ≤ 8)] _ ≤ 8 * d * B ^ 2 / (eps ^ 2 * (L : Real) ^ 4) + 4 / (eps * t) := by have hcard : (S.card : Real) ≤ d := by exact_mod_cast (by simpa using S.card_le_univ : S.card ≤ d) have hsumS : ∑ x ∈ S, cellMass P x ≤ 1 := by rw [← hsum] exact Finset.sum_le_sum_of_subset_of_nonneg (by simp [S]) (fun _ _ _ ↦ hp0 _) rw [Finset.sum_add_distrib] simp only [Finset.sum_const, nsmul_eq_mul] have hcoef0 : 0 ≤ 8 * B ^ 2 / (eps ^ 2 * (L : Real) ^ 4) := by positivity have hden : 0 < eps * exp 1 * t := by positivity rw [← Finset.mul_sum] have hsumdiv : (∑ x ∈ S, cellMass P x / (2 * eps * exp 1 * t)) = (∑ x ∈ S, cellMass P x) / (2 * eps * exp 1 * t) := by rw [Finset.sum_div] have hrewrite : 8 * (∑ x ∈ S, cellMass P x / (2 * eps * exp 1 * t)) = (8 / (2 * eps * exp 1 * t)) * (∑ x ∈ S, cellMass P x) := by rw [hsumdiv] ring rw [hrewrite] have hfirst := mul_le_mul_of_nonneg_right hcard hcoef0 have hsecond := mul_le_mul_of_nonneg_left hsumS (show 0 ≤ 8 / (2 * eps * exp 1 * t) by positivity) have heone : (1 : Real) ≤ exp 1 := Real.one_le_exp zero_le_one have hlast : 8 / (2 * eps * exp 1 * t) ≤ 4 / (eps * t) := by apply (div_le_div_iff₀ (by positivity) (by positivity)).2 nlinarith have hfirst' : (S.card : Real) * (8 * B ^ 2 / (eps ^ 2 * (L : Real) ^ 4)) ≤ 8 * d * B ^ 2 / (eps ^ 2 * (L : Real) ^ 4) := by calc _ ≤ (d : Real) * (8 * B ^ 2 / (eps ^ 2 * (L : Real) ^ 4)) := hfirst _ = _ := by ring have hsecond' : (8 / (2 * eps * exp 1 * t)) * (∑ x ∈ S, cellMass P x) ≤ 4 / (eps * t) := hsecond.trans (by simpa using hlast) linarith
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.sum_light_branchMean_sq_le · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridBranchMeanAggregate.lean:12
CausalSmith.Stat.STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research.Helpers.HybridCalibrationConstants 7 declarations Existence and readback facts for the paper's least calibration constants.

Existence and readback facts for the paper's least calibration constants.

theorem dyadicIndex_set_nonempty

The dyadic search set is inhabited for every admissible overlap. the stated conditions the stated conclusion.

Formal statement
eps :
heps :
0 < eps
heps2 :
eps < 1 / 2
Nonempty {j : Nat | 1 ≤ j ∧ (2 : Real) ^ (-(j : Int)) ≤ eps}
Proof (Lean source)
lemma dyadicIndex_set_nonempty {eps : Real} (heps : 0 < eps) (heps2 : eps < 1 / 2) : Nonempty {j : Nat | 1 ≤ j ∧ (2 : Real) ^ (-(j : Int)) ≤ eps} := by obtain ⟨j, hj, _⟩ := exists_nat_pow_near_of_lt_one heps (by linarith) (by norm_num : (0 : Real) < 1 / 2) (by norm_num : (1 : Real) / 2 < 1) refine ⟨j + 1, by omega, ?_⟩ have heq : (2 : Real) ^ (-((j + 1 : Nat) : Int)) = ((1 : Real) / 2) ^ (j + 1) := by rw [zpow_neg, zpow_natCast, one_div_pow] simp [one_div] rw [heq] exact hj.le
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.dyadicIndex_set_nonempty · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridCalibrationConstants.lean:11
theorem dyadicIndex_spec

The least dyadic index satisfies its defining inequalities. the stated conditions the stated conclusion.

Formal statement
eps :
heps :
0 < eps
heps2 :
eps < 1 / 2
conclusion 1
1 ≤ dyadicIndex eps
conclusion 2
barEps eps ≤ eps
Proof (Lean source)
lemma dyadicIndex_spec {eps : Real} (heps : 0 < eps) (heps2 : eps < 1 / 2) : 1 ≤ dyadicIndex eps ∧ barEps eps ≤ eps := by simpa [dyadicIndex, barEps] using Nat.sInf_mem (dyadicIndex_set_nonempty heps heps2)
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.dyadicIndex_spec · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridCalibrationConstants.lean:25
theorem barEps_pos

The formal statement establishes the stated conclusion.

Formal statement
eps :
0 < barEps eps
Proof (Lean source)
lemma barEps_pos (eps : Real) : 0 < barEps eps := by unfold barEps positivity
theorem Hconst_set_nonempty

The integer search defining Hconst is inhabited. the stated conditions the stated conclusion.

Formal statement
eps :
heps :
0 < eps
Nonempty {H : Nat | 4 ≤ H ∧ 15 + 24 / cCirc ≤ (H : Real) / 4 ∧ 672 ≤ (H : Real) * cCirc * barEps eps ∧ 24 ≤ (H : Real) * cCirc * barEps eps}
Proof (Lean source)
lemma Hconst_set_nonempty {eps : Real} (heps : 0 < eps) : Nonempty {H : Nat | 4 ≤ H ∧ 15 + 24 / cCirc ≤ (H : Real) / 4 ∧ 672 ≤ (H : Real) * cCirc * barEps eps ∧ 24 ≤ (H : Real) * cCirc * barEps eps} := by let R : Real := max 4 (max (4 * (15 + 24 / cCirc)) (max (672 / (cCirc * barEps eps)) (24 / (cCirc * barEps eps)))) obtain ⟨H, hH⟩ := exists_nat_ge R refine ⟨H, ?_⟩ have hc : 0 < cCirc := by norm_num [cCirc] have hb : 0 < barEps eps := barEps_pos eps have h4 : (4 : Real) ≤ H := (le_max_left _ _).trans hH have hfirst : 4 * (15 + 24 / cCirc) ≤ (H : Real) := (le_max_left _ _).trans (le_max_right 4 _ |>.trans hH) have h672 : 672 / (cCirc * barEps eps) ≤ (H : Real) := (le_max_left _ _).trans (le_max_right (4 * (15 + 24 / cCirc)) _ |>.trans (le_max_right 4 _ |>.trans hH)) have h24 : 24 / (cCirc * barEps eps) ≤ (H : Real) := (le_max_right _ _).trans (le_max_right (4 * (15 + 24 / cCirc)) _ |>.trans (le_max_right 4 _ |>.trans hH)) constructor · exact_mod_cast h4 constructor · linarith constructor · simpa [mul_assoc] using (div_le_iff₀ (mul_pos hc hb)).mp h672 · simpa [mul_assoc] using (div_le_iff₀ (mul_pos hc hb)).mp h24
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.Hconst_set_nonempty · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridCalibrationConstants.lean:36
theorem Hconst_spec

All four numerical properties can be read back from the least integer. the stated conditions the stated conclusion.

Formal statement
eps :
heps :
0 < eps
conclusion 1
4 ≤ Hconst eps
conclusion 2
15 + 24 / cCirc ≤ (Hconst eps : Real) / 4
conclusion 3
672 ≤ (Hconst eps : Real) * cCirc * barEps eps
conclusion 4
24 ≤ (Hconst eps : Real) * cCirc * barEps eps
Proof (Lean source)
lemma Hconst_spec {eps : Real} (heps : 0 < eps) : 4 ≤ Hconst eps ∧ 15 + 24 / cCirc ≤ (Hconst eps : Real) / 4 ∧ 672 ≤ (Hconst eps : Real) * cCirc * barEps eps ∧ 24 ≤ (Hconst eps : Real) * cCirc * barEps eps := by simpa [Hconst] using Nat.sInf_mem (Hconst_set_nonempty heps)
theorem Ldeg_ge_two

Every sample size has polynomial degree proxy at least two.

Formal statement
n :
2 ≤ Ldeg n
Proof (Lean source)
@[simp] lemma Ldeg_ge_two (n : Nat) : 2 ≤ Ldeg n := by simp [Ldeg]
theorem calibrationPredicate_positive_parameters

Positivity facts needed by every probabilistic leaf follow directly from the finite calibration predicate. the stated conditions the stated conclusion.

Formal statement
n m :
eps :
hcal :
bs :
N :
n + m (: Nat)
u :
bs.M0 / 8 (: Real)
tp :
(bs.np + bs.mp : Nat) / 8 (: Real)
t :
(bs.nf + bs.mf : Nat) / 8 (: Real)
B :
Bscale n m eps
0 < u
0 < tp
0 < t
0 < B
Proof (Lean source)
lemma calibrationPredicate_positive_parameters {n m : Nat} {eps : Real} (hcal : calibrationPredicate n m eps) : let bs := blockSizes n m let N : Nat := n + m let u : Real := bs.M0 / 8 let tp : Real := (bs.np + bs.mp : Nat) / 8 let t : Real := (bs.nf + bs.mf : Nat) / 8 let B := Bscale n m eps 0 < u ∧ 0 < tp ∧ 0 < t ∧ 0 < B := by dsimp only simp only [calibrationPredicate] at hcal rcases hcal with ⟨hn, hu0, _hu1, htp0, _htp1, ht0, _ht1, _hr0, _hr1, _hL, htpB, _hLB, _hm4, _hm6, _htail1, _htail2, _htail3⟩ have hnR : (0 : Real) < n := by exact_mod_cast (by omega : 0 < n) have hNR : (0 : Real) < n + m := by positivity have hu : 0 < ((blockSizes n m).M0 : Real) / 8 := by have : 0 < (((blockSizes n m).M0 : Real) / 8) / n := lt_of_lt_of_le (by norm_num : (0 : Real) < 1 / 32) hu0 rcases (div_pos_iff.mp this) with h | h · exact h.1 · linarith have htp : 0 < (((blockSizes n m).np + (blockSizes n m).mp : Nat) : Real) / 8 := by have : 0 < ((((blockSizes n m).np + (blockSizes n m).mp : Nat) : Real) / 8) / (n + m : Nat) := lt_of_lt_of_le (by norm_num : (0 : Real) < 1 / 32) htp0 rcases (div_pos_iff.mp this) with h | h · exact h.1 · linarith have ht : 0 < (((blockSizes n m).nf + (blockSizes n m).mf : Nat) : Real) / 8 := by have : 0 < ((((blockSizes n m).nf + (blockSizes n m).mf : Nat) : Real) / 8) / (n + m : Nat) := lt_of_lt_of_le (by norm_num : (0 : Real) < 1 / 32) ht0 rcases (div_pos_iff.mp this) with h | h · exact h.1 · linarith have hB : 0 < Bscale n m eps := by have : 0 < ((((blockSizes n m).np + (blockSizes n m).mp : Nat) : Real) / 8) * Bscale n m eps := lt_of_lt_of_le (by norm_num : (0 : Real) < 8) htpB rcases (mul_pos_iff.mp this) with h | h · exact h.2 · linarith exact ⟨hu, htp, ht, hB⟩
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.calibrationPredicate_positive_parameters · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridCalibrationConstants.lean:79
CausalSmith.Stat.STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research.Helpers.HybridCellAnalysis 20 declarations Per-cell analysis for the unequal-information Poisson hybrid.

Per-cell analysis for the unequal-information Poisson hybrid.

def HybridPoissonCounts

Independent outcome, pilot, and factorial counts for every arm and cell. the stated conditions the stated conclusion.

Definition (Lean source)
d :
HybridPoissonCounts d :
Type
Fin d → Bool → Nat × (Nat × Nat)
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.HybridPoissonCounts · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridCellAnalysis.lean:21
def hybridPoissonCountLaw

The three-pool marked Poisson law used in the hybrid analysis. the stated conditions the stated conclusion.

Definition (Lean source)
d :
P :
u tp t :
hybridPoissonCountLaw P u tp t :
pi fun x
=> pi fun arm => (poissonMeasure (toNNReal (u * markedMass P x arm))).prod ((poissonMeasure (toNNReal (tp * armMass P x arm))).prod (poissonMeasure (toNNReal (t * armMass P x arm))))
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.hybridPoissonCountLaw · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridCellAnalysis.lean:23
def hybridLightCell

Polynomial statistic in one cell, excluding the pilot decision. the stated conditions the stated conclusion.

Definition (Lean source)
L :
B u t :
Z :
Bool → Nat × (Nat × Nat)
hybridLightCell L B u t Z :
(Z true).1 / u * factorialLift true L B t (Z false).2.2 (Z true).2.2
- (Z false).1 / u * factorialLift false L B t (Z false).2.2 (Z true).2.2
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.hybridLightCell · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridCellAnalysis.lean:33
def hybridHeavyCell

Inverse-count statistic in one cell, excluding the pilot decision. the stated conditions the stated conclusion.

Definition (Lean source)
u :
Z :
Bool → Nat × (Nat × Nat)
hybridHeavyCell u Z :
(Z true).1 / u * ((Z false).2.2 + (Z true).2.2 + 1 : Nat) / ((Z true).2.2 + 1 : Nat)
- (Z false).1 / u * ((Z false).2.2 + (Z true).2.2 + 1 : Nat) / ((Z false).2.2 + 1 : Nat)
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.hybridHeavyCell · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridCellAnalysis.lean:39
def hybridSelectedCell

Pilot-selected contribution of one covariate cell. the stated conditions the stated conclusion.

Definition (Lean source)
threshold L :
B u t :
Z :
Bool → Nat × (Nat × Nat)
hybridSelectedCell threshold L B u t Z :
if (Z false).2.1 + (Z true).2.1
≤ threshold then hybridLightCell L B u t Z else hybridHeavyCell u Z
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.hybridSelectedCell · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridCellAnalysis.lean:47
def hybridPilotEvent

Pilot-count configurations selecting the polynomial branch. the stated conditions the stated conclusion.

Definition (Lean source)
threshold :
hybridPilotEvent threshold :
Set (Bool → Nat)
{J | J false + J true ≤ threshold}
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.hybridPilotEvent · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridCellAnalysis.lean:54
theorem hybridPilotEvent_measurable

The formal statement establishes the stated conclusion.

Formal statement
threshold :
Proof (Lean source)
lemma hybridPilotEvent_measurable (threshold : Nat) : MeasurableSet (hybridPilotEvent threshold) := by exact measurableSet_Iic.preimage (measurable_of_countable (fun J : Bool → Nat ↦ J false + J true))
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.hybridPilotEvent_measurable · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridCellAnalysis.lean:57
def hybridLightPools

Polynomial cell statistic after separating outcome and factorial pools. the stated conditions the stated conclusion.

Definition (Lean source)
L :
B u t :
W :
(Bool → Nat) × (Bool → Nat)
hybridLightPools L B u t W :
W.1 true / u * factorialLift true L B t (W.2 false) (W.2 true)
- W.1 false / u * factorialLift false L B t (W.2 false) (W.2 true)
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.hybridLightPools · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridCellAnalysis.lean:64
def hybridHeavyPools

Inverse-count cell statistic after separating outcome and factorial pools. the stated conditions the stated conclusion.

Definition (Lean source)
u :
W :
(Bool → Nat) × (Bool → Nat)
hybridHeavyPools u W :
W.1 true / u * (W.2 false + W.2 true + 1 : Nat) / (W.2 true + 1 : Nat)
- W.1 false / u * (W.2 false + W.2 true + 1 : Nat) / (W.2 false + 1 : Nat)
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.hybridHeavyPools · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridCellAnalysis.lean:70
theorem hybridLightPools_memLp

The polynomial branch is square-integrable under its independent outcome and factorial Poisson pools. the stated conclusion.

Formal statement
d :
P :
u t B :
L :
x :
Fin d
MemLp (hybridLightPools L B u t) 2 ((Measure.pi fun arm : Bool => poissonMeasure (toNNReal (u * markedMass P x arm))).prod (Measure.pi fun arm : Bool => poissonMeasure (toNNReal (t * armMass P x arm))))
Proof (Lean source)
lemma hybridLightPools_memLp {d : Nat} (P : DiscreteLaw d) (u t B : Real) (L : Nat) (x : Fin d) : MemLp (hybridLightPools L B u t) 2 ((Measure.pi fun arm : Bool => poissonMeasure (toNNReal (u * markedMass P x arm))).prod (Measure.pi fun arm : Bool => poissonMeasure (toNNReal (t * armMass P x arm)))) := by let muS : Bool → Measure Nat := fun arm ↦ poissonMeasure (toNNReal (u * markedMass P x arm)) let muK : Bool → Measure Nat := fun arm ↦ poissonMeasure (toNNReal (t * armMass P x arm)) have hS (a : Bool) : MemLp (fun S : Bool → Nat ↦ (S a : Real) / u) 2 (Measure.pi muS) := by have hbase := (memLp_descFactorial_poisson (toNNReal (u * markedMass P x a)) 1).const_mul u⁻¹ have hpull := hbase.comp_measurePreserving (measurePreserving_eval muS a) convert hpull using 1 funext S simp only [Nat.descFactorial_one, Function.comp_apply] ring have hK (a : Bool) : MemLp (fun K : Bool → Nat ↦ factorialLift a L B t (K false) (K true)) 2 (Measure.pi muK) := by have hpair := factorialLift_memLp a L B t (armMass P x false) (armMass P x true) have hpull := hpair.comp_measurePreserving (boolPair_measurePreserving muK) unfold boolPair at hpull change MemLp (fun K : Bool → Nat ↦ factorialLift a L B t (K false) (K true)) 2 (Measure.pi muK) at hpull exact hpull have htrue := memLp_mul_prod_two (hS true) (hK true) have hfalse := memLp_mul_prod_two (hS false) (hK false) convert htrue.sub hfalse using 1 funext W rfl
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.hybridLightPools_memLp · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridCellAnalysis.lean:78
theorem hybridHeavyPools_memLp

The inverse-count branch is square-integrable under its independent outcome and factorial Poisson pools. the stated conclusion.

Formal statement
d :
P :
u t :
x :
Fin d
MemLp (hybridHeavyPools u) 2 ((Measure.pi fun arm : Bool => poissonMeasure (toNNReal (u * markedMass P x arm))).prod (Measure.pi fun arm : Bool => poissonMeasure (toNNReal (t * armMass P x arm))))
Proof (Lean source)
lemma hybridHeavyPools_memLp {d : Nat} (P : DiscreteLaw d) (u t : Real) (x : Fin d) : MemLp (hybridHeavyPools u) 2 ((Measure.pi fun arm : Bool => poissonMeasure (toNNReal (u * markedMass P x arm))).prod (Measure.pi fun arm : Bool => poissonMeasure (toNNReal (t * armMass P x arm)))) := by let muS : Bool → Measure Nat := fun arm ↦ poissonMeasure (toNNReal (u * markedMass P x arm)) let muK : Bool → Measure Nat := fun arm ↦ poissonMeasure (toNNReal (t * armMass P x arm)) have hS (a : Bool) : MemLp (fun S : Bool → Nat ↦ (S a : Real) / u) 2 (Measure.pi muS) := by have hbase := (memLp_descFactorial_poisson (toNNReal (u * markedMass P x a)) 1).const_mul u⁻¹ have hpull := hbase.comp_measurePreserving (measurePreserving_eval muS a) convert hpull using 1 funext S simp only [Nat.descFactorial_one, Function.comp_apply] ring have hKcoord (a : Bool) : MemLp (fun K : Bool → Nat ↦ (K a : Real)) 2 (Measure.pi muK) := by have hbase := memLp_descFactorial_poisson (toNNReal (t * armMass P x a)) 1 have hpull := hbase.comp_measurePreserving (measurePreserving_eval muK a) convert hpull using 1 funext K simp only [Nat.descFactorial_one, Function.comp_apply] have hKtotal : MemLp (fun K : Bool → Nat ↦ ((K false + K true + 1 : Nat) : Real)) 2 (Measure.pi muK) := by convert ((hKcoord false).add (hKcoord true)).add (memLp_const (1 : Real)) using 1 funext K push_cast rfl have hArm (a : Bool) : MemLp (fun W : (Bool → Nat) × (Bool → Nat) ↦ (W.1 a : Real) / u * ((W.2 false + W.2 true + 1 : Nat) : Real) / ((W.2 a + 1 : Nat) : Real)) 2 ((Measure.pi muS).prod (Measure.pi muK)) := by have hdom := memLp_mul_prod_two (hS a) hKtotal apply hdom.mono (measurable_of_countable _).aestronglyMeasurable filter_upwards [] with W rw [Real.norm_eq_abs, Real.norm_eq_abs, abs_div] have hn : 1 ≤ W.2 a + 1 := by omega have hden : (1 : Real) ≤ ((W.2 a + 1 : Nat) : Real) := by exact_mod_cast hn have habs : |((W.2 a + 1 : Nat) : Real)| = ((W.2 a + 1 : Nat) : Real) := abs_of_nonneg (by linarith [hden]) rw [habs] exact div_le_self (abs_nonneg _) hden convert (hArm true).sub (hArm false) using 1 funext W rfl
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.hybridHeavyPools_memLp · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridCellAnalysis.lean:117
theorem hybridSelectedCell_eq_eventSelectedMixture

The formal statement establishes the stated conclusion.

Formal statement
threshold L :
B u t :
Z :
Bool → Nat × (Nat × Nat)
Proof (Lean source)
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.hybridSelectedCell_eq_eventSelectedMixture · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridCellAnalysis.lean:172
theorem hybridCellLaw_pilotFirst_measurePreserving

Exact product-law transport which makes the pilot independent of the two estimator pools in a fixed cell. the stated conclusion.

Formal statement
d :
P :
u tp t :
x :
Fin d
MeasurePreserving pilotFirstSplitHybridPools (Measure.pi fun arm : Bool => (poissonMeasure (toNNReal (u * markedMass P x arm))).prod ((poissonMeasure (toNNReal (tp * armMass P x arm))).prod (poissonMeasure (toNNReal (t * armMass P x arm))))) ((Measure.pi fun arm : Bool => poissonMeasure (toNNReal (tp * armMass P x arm))).prod ((Measure.pi fun arm : Bool => poissonMeasure (toNNReal (u * markedMass P x arm))).prod (Measure.pi fun arm : Bool => poissonMeasure (toNNReal (t * armMass P x arm)))))
Proof (Lean source)
lemma hybridCellLaw_pilotFirst_measurePreserving {d : Nat} (P : DiscreteLaw d) (u tp t : Real) (x : Fin d) : MeasurePreserving pilotFirstSplitHybridPools (Measure.pi fun arm : Bool => (poissonMeasure (toNNReal (u * markedMass P x arm))).prod ((poissonMeasure (toNNReal (tp * armMass P x arm))).prod (poissonMeasure (toNNReal (t * armMass P x arm))))) ((Measure.pi fun arm : Bool => poissonMeasure (toNNReal (tp * armMass P x arm))).prod ((Measure.pi fun arm : Bool => poissonMeasure (toNNReal (u * markedMass P x arm))).prod (Measure.pi fun arm : Bool => poissonMeasure (toNNReal (t * armMass P x arm))))) := by exact pilotFirstSplitHybridPools_measurePreserving _ _ _
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.hybridCellLaw_pilotFirst_measurePreserving · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridCellAnalysis.lean:185
theorem integral_hybridSelectedCell

Exact per-cell mean decomposition after separating the pilot pool. the stated conditions the stated conclusion.

Formal statement
d :
P :
u tp t B :
threshold L :
x :
Fin d
hLight :
Integrable (hybridLightPools L B u t) ((Measure.pi fun arm : Bool => poissonMeasure (toNNReal (u * markedMass P x arm))).prod (Measure.pi fun arm : Bool => poissonMeasure (toNNReal (t * armMass P x arm))))
hHeavy :
Integrable (hybridHeavyPools u) ((Measure.pi fun arm : Bool => poissonMeasure (toNNReal (u * markedMass P x arm))).prod (Measure.pi fun arm : Bool => poissonMeasure (toNNReal (t * armMass P x arm))))
(∫ Z, hybridSelectedCell threshold L B u t Z ∂ (Measure.pi fun arm : Bool => (poissonMeasure (toNNReal (u * markedMass P x arm))).prod ((poissonMeasure (toNNReal (tp * armMass P x arm))).prod (poissonMeasure (toNNReal (t * armMass P x arm))))))
= let muJ := Measure.pi fun arm : Bool => poissonMeasure (toNNReal (tp * armMass P x arm)) let muE := (Measure.pi fun arm : Bool => poissonMeasure (toNNReal (u * markedMass P x arm))).prod (Measure.pi fun arm : Bool => poissonMeasure (toNNReal (t * armMass P x arm))) muJ.real (hybridPilotEvent threshold) * (∫ W, hybridLightPools L B u t W ∂muE)
+ (1 - muJ.real (hybridPilotEvent threshold)) * (∫ W, hybridHeavyPools u W ∂muE)
Proof (Lean source)
lemma integral_hybridSelectedCell {d : Nat} (P : DiscreteLaw d) (u tp t B : Real) (threshold L : Nat) (x : Fin d) (hLight : Integrable (hybridLightPools L B u t) ((Measure.pi fun arm : Bool => poissonMeasure (toNNReal (u * markedMass P x arm))).prod (Measure.pi fun arm : Bool => poissonMeasure (toNNReal (t * armMass P x arm))))) (hHeavy : Integrable (hybridHeavyPools u) ((Measure.pi fun arm : Bool => poissonMeasure (toNNReal (u * markedMass P x arm))).prod (Measure.pi fun arm : Bool => poissonMeasure (toNNReal (t * armMass P x arm))))) : (∫ Z, hybridSelectedCell threshold L B u t Z ∂ (Measure.pi fun arm : Bool => (poissonMeasure (toNNReal (u * markedMass P x arm))).prod ((poissonMeasure (toNNReal (tp * armMass P x arm))).prod (poissonMeasure (toNNReal (t * armMass P x arm)))))) = let muJ := Measure.pi fun arm : Bool => poissonMeasure (toNNReal (tp * armMass P x arm)) let muE := (Measure.pi fun arm : Bool => poissonMeasure (toNNReal (u * markedMass P x arm))).prod (Measure.pi fun arm : Bool => poissonMeasure (toNNReal (t * armMass P x arm))) muJ.real (hybridPilotEvent threshold) * (∫ W, hybridLightPools L B u t W ∂muE) + (1 - muJ.real (hybridPilotEvent threshold)) * (∫ W, hybridHeavyPools u W ∂muE) := by let muJ := Measure.pi fun arm : Bool => poissonMeasure (toNNReal (tp * armMass P x arm)) let muE := (Measure.pi fun arm : Bool => poissonMeasure (toNNReal (u * markedMass P x arm))).prod (Measure.pi fun arm : Bool => poissonMeasure (toNNReal (t * armMass P x arm))) let muZ := Measure.pi fun arm : Bool => (poissonMeasure (toNNReal (u * markedMass P x arm))).prod ((poissonMeasure (toNNReal (tp * armMass P x arm))).prod (poissonMeasure (toNNReal (t * armMass P x arm)))) let F := eventSelectedMixture (hybridPilotEvent threshold) (hybridLightPools L B u t) (hybridHeavyPools u) have hmp : MeasurePreserving pilotFirstSplitHybridPools muZ (muJ.prod muE) := hybridCellLaw_pilotFirst_measurePreserving P u tp t x have htransport : (∫ Z, F (pilotFirstSplitHybridPools Z) ∂muZ) = ∫ W, F W ∂muJ.prod muE := by rw [← hmp.map_eq] exact (integral_map hmp.aemeasurable (measurable_of_countable F).aestronglyMeasurable).symm rw [show (∫ Z, hybridSelectedCell threshold L B u t Z ∂muZ) = ∫ Z, F (pilotFirstSplitHybridPools Z) ∂muZ by apply integral_congr_ae filter_upwards [] with Z exact hybridSelectedCell_eq_eventSelectedMixture threshold L B u t Z, htransport] exact integral_eventSelectedMixture muJ muE _ (hybridPilotEvent_measurable threshold) _ _ hLight hHeavy
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.integral_hybridSelectedCell · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridCellAnalysis.lean:202
theorem variance_hybridSelectedCell

Exact per-cell conditional-mixture variance decomposition. the stated conditions the stated conclusion.

Formal statement
d :
P :
u tp t B :
threshold L :
x :
Fin d
hLight :
MemLp (hybridLightPools L B u t) 2 ((Measure.pi fun arm : Bool => poissonMeasure (toNNReal (u * markedMass P x arm))).prod (Measure.pi fun arm : Bool => poissonMeasure (toNNReal (t * armMass P x arm))))
hHeavy :
MemLp (hybridHeavyPools u) 2 ((Measure.pi fun arm : Bool => poissonMeasure (toNNReal (u * markedMass P x arm))).prod (Measure.pi fun arm : Bool => poissonMeasure (toNNReal (t * armMass P x arm))))
Var[hybridSelectedCell threshold L B u t; Measure.pi fun arm : Bool => (poissonMeasure (toNNReal (u * markedMass P x arm))).prod ((poissonMeasure (toNNReal (tp * armMass P x arm))).prod (poissonMeasure (toNNReal (t * armMass P x arm))))]
= let muJ := Measure.pi fun arm : Bool => poissonMeasure (toNNReal (tp * armMass P x arm)) let muE := (Measure.pi fun arm : Bool => poissonMeasure (toNNReal (u * markedMass P x arm))).prod (Measure.pi fun arm : Bool => poissonMeasure (toNNReal (t * armMass P x arm))) let pi := muJ.real (hybridPilotEvent threshold) pi * Var[hybridLightPools L B u t; muE]
+ (1 - pi) * Var[hybridHeavyPools u; muE]
+ pi * (1 - pi) * ((∫ W, hybridLightPools L B u t W ∂muE) - ∫ W, hybridHeavyPools u W ∂muE) ^ 2
Proof (Lean source)
lemma variance_hybridSelectedCell {d : Nat} (P : DiscreteLaw d) (u tp t B : Real) (threshold L : Nat) (x : Fin d) (hLight : MemLp (hybridLightPools L B u t) 2 ((Measure.pi fun arm : Bool => poissonMeasure (toNNReal (u * markedMass P x arm))).prod (Measure.pi fun arm : Bool => poissonMeasure (toNNReal (t * armMass P x arm))))) (hHeavy : MemLp (hybridHeavyPools u) 2 ((Measure.pi fun arm : Bool => poissonMeasure (toNNReal (u * markedMass P x arm))).prod (Measure.pi fun arm : Bool => poissonMeasure (toNNReal (t * armMass P x arm))))) : Var[hybridSelectedCell threshold L B u t; Measure.pi fun arm : Bool => (poissonMeasure (toNNReal (u * markedMass P x arm))).prod ((poissonMeasure (toNNReal (tp * armMass P x arm))).prod (poissonMeasure (toNNReal (t * armMass P x arm))))] = let muJ := Measure.pi fun arm : Bool => poissonMeasure (toNNReal (tp * armMass P x arm)) let muE := (Measure.pi fun arm : Bool => poissonMeasure (toNNReal (u * markedMass P x arm))).prod (Measure.pi fun arm : Bool => poissonMeasure (toNNReal (t * armMass P x arm))) let pi := muJ.real (hybridPilotEvent threshold) pi * Var[hybridLightPools L B u t; muE] + (1 - pi) * Var[hybridHeavyPools u; muE] + pi * (1 - pi) * ((∫ W, hybridLightPools L B u t W ∂muE) - ∫ W, hybridHeavyPools u W ∂muE) ^ 2 := by let muJ := Measure.pi fun arm : Bool => poissonMeasure (toNNReal (tp * armMass P x arm)) let muE := (Measure.pi fun arm : Bool => poissonMeasure (toNNReal (u * markedMass P x arm))).prod (Measure.pi fun arm : Bool => poissonMeasure (toNNReal (t * armMass P x arm))) let muZ := Measure.pi fun arm : Bool => (poissonMeasure (toNNReal (u * markedMass P x arm))).prod ((poissonMeasure (toNNReal (tp * armMass P x arm))).prod (poissonMeasure (toNNReal (t * armMass P x arm)))) let F := eventSelectedMixture (hybridPilotEvent threshold) (hybridLightPools L B u t) (hybridHeavyPools u) have hmp : MeasurePreserving pilotFirstSplitHybridPools muZ (muJ.prod muE) := hybridCellLaw_pilotFirst_measurePreserving P u tp t x rw [show Var[hybridSelectedCell threshold L B u t; muZ] = Var[fun Z => F (pilotFirstSplitHybridPools Z); muZ] by apply variance_congr filter_upwards [] with Z exact hybridSelectedCell_eq_eventSelectedMixture threshold L B u t Z, hmp.variance_fun_comp (measurable_of_countable F).aemeasurable] exact variance_eventSelectedMixture muJ muE _ (hybridPilotEvent_measurable threshold) _ _ hLight hHeavy
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.variance_hybridSelectedCell · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridCellAnalysis.lean:262
theorem hybridSelectedCell_memLp

Each pilot-selected cell contribution has a finite second moment. the stated conclusion.

Formal statement
d :
P :
u tp t B :
threshold L :
x :
Fin d
MemLp (hybridSelectedCell threshold L B u t) 2 (Measure.pi fun arm : Bool => (poissonMeasure (toNNReal (u * markedMass P x arm))).prod ((poissonMeasure (toNNReal (tp * armMass P x arm))).prod (poissonMeasure (toNNReal (t * armMass P x arm)))))
Proof (Lean source)
lemma hybridSelectedCell_memLp {d : Nat} (P : DiscreteLaw d) (u tp t B : Real) (threshold L : Nat) (x : Fin d) : MemLp (hybridSelectedCell threshold L B u t) 2 (Measure.pi fun arm : Bool => (poissonMeasure (toNNReal (u * markedMass P x arm))).prod ((poissonMeasure (toNNReal (tp * armMass P x arm))).prod (poissonMeasure (toNNReal (t * armMass P x arm))))) := by let muJ := Measure.pi fun arm : Bool => poissonMeasure (toNNReal (tp * armMass P x arm)) let muE := (Measure.pi fun arm : Bool => poissonMeasure (toNNReal (u * markedMass P x arm))).prod (Measure.pi fun arm : Bool => poissonMeasure (toNNReal (t * armMass P x arm))) let muZ := Measure.pi fun arm : Bool => (poissonMeasure (toNNReal (u * markedMass P x arm))).prod ((poissonMeasure (toNNReal (tp * armMass P x arm))).prod (poissonMeasure (toNNReal (t * armMass P x arm)))) let F := eventSelectedMixture (hybridPilotEvent threshold) (hybridLightPools L B u t) (hybridHeavyPools u) have hF : MemLp F 2 (muJ.prod muE) := memLp_eventSelectedMixture muJ muE _ (hybridPilotEvent_measurable threshold) _ _ (hybridLightPools_memLp P u t B L x) (hybridHeavyPools_memLp P u t x) have hmp : MeasurePreserving pilotFirstSplitHybridPools muZ (muJ.prod muE) := hybridCellLaw_pilotFirst_measurePreserving P u tp t x have hpull := hF.comp_measurePreserving hmp convert hpull using 1 funext Z simpa [F, Function.comp_apply] using hybridSelectedCell_eq_eventSelectedMixture threshold L B u t Z
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.hybridSelectedCell_memLp · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridCellAnalysis.lean:319
theorem variance_sum_hybridSelectedCell

Independence across covariate cells turns the variance of the un-clipped hybrid sum into the sum of its cell variances. the stated conclusion.

Formal statement
d :
P :
u tp t B :
threshold L :
Var[(fun K : HybridPoissonCounts d ↦ ∑ x : Fin d, hybridSelectedCell threshold L B u t (K x)); hybridPoissonCountLaw P u tp t]
= ∑ x : Fin d, Var[hybridSelectedCell threshold L B u t; Measure.pi fun arm : Bool => (poissonMeasure (toNNReal (u * markedMass P x arm))).prod ((poissonMeasure (toNNReal (tp * armMass P x arm))).prod (poissonMeasure (toNNReal (t * armMass P x arm))))]
Proof (Lean source)
lemma variance_sum_hybridSelectedCell {d : Nat} (P : DiscreteLaw d) (u tp t B : Real) (threshold L : Nat) : Var[(fun K : HybridPoissonCounts d ↦ ∑ x : Fin d, hybridSelectedCell threshold L B u t (K x)); hybridPoissonCountLaw P u tp t] = ∑ x : Fin d, Var[hybridSelectedCell threshold L B u t; Measure.pi fun arm : Bool => (poissonMeasure (toNNReal (u * markedMass P x arm))).prod ((poissonMeasure (toNNReal (tp * armMass P x arm))).prod (poissonMeasure (toNNReal (t * armMass P x arm))))] := by have h := variance_sum_pi (μ := fun x : Fin d ↦ Measure.pi fun arm : Bool => (poissonMeasure (toNNReal (u * markedMass P x arm))).prod ((poissonMeasure (toNNReal (tp * armMass P x arm))).prod (poissonMeasure (toNNReal (t * armMass P x arm))))) (X := fun x Z ↦ hybridSelectedCell threshold L B u t Z) (fun x ↦ hybridSelectedCell_memLp P u tp t B threshold L x) change Var[(fun K : HybridPoissonCounts d ↦ ∑ x : Fin d, hybridSelectedCell threshold L B u t (K x)); Measure.pi fun x : Fin d ↦ Measure.pi fun arm : Bool => (poissonMeasure (toNNReal (u * markedMass P x arm))).prod ((poissonMeasure (toNNReal (tp * armMass P x arm))).prod (poissonMeasure (toNNReal (t * armMass P x arm))))] = _ calc _ = Var[∑ x : Fin d, fun K : HybridPoissonCounts d ↦ hybridSelectedCell threshold L B u t (K x); Measure.pi fun x : Fin d ↦ Measure.pi fun arm : Bool => (poissonMeasure (toNNReal (u * markedMass P x arm))).prod ((poissonMeasure (toNNReal (tp * armMass P x arm))).prod (poissonMeasure (toNNReal (t * armMass P x arm))))] := by apply variance_congr filter_upwards [] with K simp only [Finset.sum_apply] _ = _ := h
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.variance_sum_hybridSelectedCell · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridCellAnalysis.lean:353
theorem integral_hybridSelectedCell_exact

Unconditional exact per-cell mean formula, with integrability supplied by the explicit Poisson-polynomial bounds above. the stated conclusion.

Formal statement
d :
P :
u tp t B :
threshold L :
x :
Fin d
(∫ Z, hybridSelectedCell threshold L B u t Z ∂ (Measure.pi fun arm : Bool => (poissonMeasure (toNNReal (u * markedMass P x arm))).prod ((poissonMeasure (toNNReal (tp * armMass P x arm))).prod (poissonMeasure (toNNReal (t * armMass P x arm))))))
= let muJ := Measure.pi fun arm : Bool => poissonMeasure (toNNReal (tp * armMass P x arm)) let muE := (Measure.pi fun arm : Bool => poissonMeasure (toNNReal (u * markedMass P x arm))).prod (Measure.pi fun arm : Bool => poissonMeasure (toNNReal (t * armMass P x arm))) muJ.real (hybridPilotEvent threshold) * (∫ W, hybridLightPools L B u t W ∂muE)
+ (1 - muJ.real (hybridPilotEvent threshold)) * (∫ W, hybridHeavyPools u W ∂muE)
Proof (Lean source)
lemma integral_hybridSelectedCell_exact {d : Nat} (P : DiscreteLaw d) (u tp t B : Real) (threshold L : Nat) (x : Fin d) : (∫ Z, hybridSelectedCell threshold L B u t Z ∂ (Measure.pi fun arm : Bool => (poissonMeasure (toNNReal (u * markedMass P x arm))).prod ((poissonMeasure (toNNReal (tp * armMass P x arm))).prod (poissonMeasure (toNNReal (t * armMass P x arm)))))) = let muJ := Measure.pi fun arm : Bool => poissonMeasure (toNNReal (tp * armMass P x arm)) let muE := (Measure.pi fun arm : Bool => poissonMeasure (toNNReal (u * markedMass P x arm))).prod (Measure.pi fun arm : Bool => poissonMeasure (toNNReal (t * armMass P x arm))) muJ.real (hybridPilotEvent threshold) * (∫ W, hybridLightPools L B u t W ∂muE) + (1 - muJ.real (hybridPilotEvent threshold)) * (∫ W, hybridHeavyPools u W ∂muE) := by apply integral_hybridSelectedCell P u tp t B threshold L x · exact (hybridLightPools_memLp P u t B L x).integrable one_le_two · exact (hybridHeavyPools_memLp P u t x).integrable one_le_two
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.integral_hybridSelectedCell_exact · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridCellAnalysis.lean:389
theorem variance_hybridSelectedCell_exact

Unconditional exact C27 variance formula for one hybrid cell. the stated conclusion.

Formal statement
d :
P :
u tp t B :
threshold L :
x :
Fin d
Var[hybridSelectedCell threshold L B u t; Measure.pi fun arm : Bool => (poissonMeasure (toNNReal (u * markedMass P x arm))).prod ((poissonMeasure (toNNReal (tp * armMass P x arm))).prod (poissonMeasure (toNNReal (t * armMass P x arm))))]
= let muJ := Measure.pi fun arm : Bool => poissonMeasure (toNNReal (tp * armMass P x arm)) let muE := (Measure.pi fun arm : Bool => poissonMeasure (toNNReal (u * markedMass P x arm))).prod (Measure.pi fun arm : Bool => poissonMeasure (toNNReal (t * armMass P x arm))) let pi := muJ.real (hybridPilotEvent threshold) pi * Var[hybridLightPools L B u t; muE]
+ (1 - pi) * Var[hybridHeavyPools u; muE]
+ pi * (1 - pi) * ((∫ W, hybridLightPools L B u t W ∂muE) - ∫ W, hybridHeavyPools u W ∂muE) ^ 2
Proof (Lean source)
lemma variance_hybridSelectedCell_exact {d : Nat} (P : DiscreteLaw d) (u tp t B : Real) (threshold L : Nat) (x : Fin d) : Var[hybridSelectedCell threshold L B u t; Measure.pi fun arm : Bool => (poissonMeasure (toNNReal (u * markedMass P x arm))).prod ((poissonMeasure (toNNReal (tp * armMass P x arm))).prod (poissonMeasure (toNNReal (t * armMass P x arm))))] = let muJ := Measure.pi fun arm : Bool => poissonMeasure (toNNReal (tp * armMass P x arm)) let muE := (Measure.pi fun arm : Bool => poissonMeasure (toNNReal (u * markedMass P x arm))).prod (Measure.pi fun arm : Bool => poissonMeasure (toNNReal (t * armMass P x arm))) let pi := muJ.real (hybridPilotEvent threshold) pi * Var[hybridLightPools L B u t; muE] + (1 - pi) * Var[hybridHeavyPools u; muE] + pi * (1 - pi) * ((∫ W, hybridLightPools L B u t W ∂muE) - ∫ W, hybridHeavyPools u W ∂muE) ^ 2 := by exact variance_hybridSelectedCell P u tp t B threshold L x (hybridLightPools_memLp P u t B L x) (hybridHeavyPools_memLp P u t x)
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.variance_hybridSelectedCell_exact · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridCellAnalysis.lean:413
theorem integral_hybridLightPools

Exact light-branch mean in a cell. the stated conditions the stated conclusion.

Formal statement
d :
P :
u t B :
hu :
0 < u
ht :
0 < t
hB :
0 < B
L :
x :
Fin d
(∫ W, hybridLightPools L B u t W ∂ ((Measure.pi fun a : Bool => poissonMeasure (toNNReal (u * markedMass P x a))).prod (Measure.pi fun a : Bool => poissonMeasure (toNNReal (t * armMass P x a)))))
= markedMass P x true * (cellMass P x / B) * (chebG L).eval (armMass P x true / B)
- markedMass P x false * (cellMass P x / B) * (chebG L).eval (armMass P x false / B)
Proof (Lean source)
lemma integral_hybridLightPools {d : Nat} (P : DiscreteLaw d) {u t B : Real} (hu : 0 < u) (ht : 0 < t) (hB : 0 < B) (L : Nat) (x : Fin d) : (∫ W, hybridLightPools L B u t W ∂ ((Measure.pi fun a : Bool => poissonMeasure (toNNReal (u * markedMass P x a))).prod (Measure.pi fun a : Bool => poissonMeasure (toNNReal (t * armMass P x a))))) = markedMass P x true * (cellMass P x / B) * (chebG L).eval (armMass P x true / B) - markedMass P x false * (cellMass P x / B) * (chebG L).eval (armMass P x false / B) := by let muS : Bool → Measure Nat := fun a ↦ poissonMeasure (toNNReal (u * markedMass P x a)) let muK : Bool → Measure Nat := fun a ↦ poissonMeasure (toNNReal (t * armMass P x a)) let armStat (a : Bool) (W : (Bool → Nat) × (Bool → Nat)) := (W.1 a : Real) / u * factorialLift a L B t (W.2 false) (W.2 true) have hs (a : Bool) : 0 ≤ armMass P x a := Finset.sum_nonneg fun y _ ↦ (jointMass_mem_unitInterval P x a y).1 have hArm (a : Bool) : (∫ W, armStat a W ∂(Measure.pi muS).prod (Measure.pi muK)) = markedMass P x a * (cellMass P x / B) * (chebG L).eval (armMass P x a / B) := by let e (W : (Bool → Nat) × (Bool → Nat)) := (W.1 a, boolPair W.2) have hmp : MeasurePreserving e ((Measure.pi muS).prod (Measure.pi muK)) ((muS a).prod ((muK false).prod (muK true))) := (measurePreserving_eval muS a).prod (boolPair_measurePreserving muK) calc _ = ∫ Z, lightArmCell a L B u t Z ∂ (muS a).prod ((muK false).prod (muK true)) := by rw [← hmp.map_eq] exact (integral_map hmp.aemeasurable (measurable_of_countable (lightArmCell a L B u t)).aestronglyMeasurable).symm _ = _ := by simp only [muS, muK] rw [integral_lightArmCell a L (marked := markedMass P x a) (s0 := armMass P x false) (s1 := armMass P x true) hu ht hB (jointMass_mem_unitInterval P x a true).1 (hs false) (hs true)] rw [show armMass P x false + armMass P x true = cellMass P x by simp [armMass, cellMass]; ring] cases a <;> simp have hLp := hybridLightPools_memLp P u t B L x have htrue : Integrable (armStat true) ((Measure.pi muS).prod (Measure.pi muK)) := by have hs := ((memLp_descFactorial_poisson (toNNReal (u * markedMass P x true)) 1).const_mul u⁻¹).comp_measurePreserving (measurePreserving_eval muS true) have hk := (factorialLift_memLp true L B t (armMass P x false) (armMass P x true)).comp_measurePreserving (boolPair_measurePreserving muK) apply ((memLp_mul_prod_two hs hk).integrable one_le_two).congr filter_upwards [] with W simp only [Function.comp_apply, Nat.descFactorial_one] unfold boolPair dsimp [armStat] ring rw [show hybridLightPools L B u t = armStat true - armStat false by rfl] change (∫ W, armStat true W - armStat false W ∂ (Measure.pi muS).prod (Measure.pi muK)) = _ rw [integral_sub] · exact congrArg₂ (· - ·) (hArm true) (hArm false) · exact htrue · have hfull := hLp.integrable one_le_two apply (htrue.sub hfull).congr filter_upwards [] with W simp only [Pi.sub_apply] dsimp [armStat, hybridLightPools] ring
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.integral_hybridLightPools · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridCellAnalysis.lean:437
CausalSmith.Stat.STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research.Helpers.HybridDeterministicAbsorption 2 declarations Deterministic C33--C36 absorption of the calibrated hybrid envelope.

Deterministic C33--C36 absorption of the calibrated hybrid envelope.

theorem hybrid_deterministic_envelope_le

A purely real-variable version of the final calibrated envelope bound. the stated conditions the stated conclusion.

Formal statement
eps C0 H nr N dr q L A B u t inv12 :
heps :
0 < eps
hC0 :
0 ≤ C0
hH :
0 ≤ H
hn :
1 ≤ nr
hN :
nr ≤ N
hd :
1 ≤ dr
hq :
1 ≤ q
hL :
0 < L
hA :
0 ≤ A
hB :
0 ≤ B
hu :
nr / 32 ≤ u
ht :
N / 32 ≤ t
hBup :
B ≤ 32 * H * L / N
hqL :
q ≤ 512 * L
hR :
(L ^ 3 * A) ^ 2 ≤ nr
hinv12 :
inv12 ≤ 1 / nr
hinv120 :
0 ≤ inv12
4 * A * (min 1 (dr * B) / u + dr * B ^ 2)
+ C0 * (u⁻¹ + t⁻¹)
+ 8 * dr * B ^ 2 / (eps ^ 2 * L ^ 4)
+ 4 / (eps * t)
+ 414 * inv12
+ (2 * dr * B / (eps * L ^ 2) + 6 * inv12) ^ 2
≤ (4096 * H * 512 ^ 2 + 4096 * H ^ 2 * 512 + 64 * C0 + 8192 * H ^ 2 * 512 ^ 2 / eps ^ 2 + 128 / eps + 414 + 2 * (64 * H * 512 / eps) ^ 2 + 72) * (1 / nr + dr ^ 2 / (N ^ 2 * q ^ 2))
Proof (Lean source)
lemma hybrid_deterministic_envelope_le {eps C0 H nr N dr q L A B u t inv12 : Real} (heps : 0 < eps) (hC0 : 0 ≤ C0) (hH : 0 ≤ H) (hn : 1 ≤ nr) (hN : nr ≤ N) (hd : 1 ≤ dr) (hq : 1 ≤ q) (hL : 0 < L) (hA : 0 ≤ A) (hB : 0 ≤ B) (hu : nr / 32 ≤ u) (ht : N / 32 ≤ t) (hBup : B ≤ 32 * H * L / N) (hqL : q ≤ 512 * L) (hR : (L ^ 3 * A) ^ 2 ≤ nr) (hinv12 : inv12 ≤ 1 / nr) (hinv120 : 0 ≤ inv12) : 4 * A * (min 1 (dr * B) / u + dr * B ^ 2) + C0 * (u⁻¹ + t⁻¹) + 8 * dr * B ^ 2 / (eps ^ 2 * L ^ 4) + 4 / (eps * t) + 414 * inv12 + (2 * dr * B / (eps * L ^ 2) + 6 * inv12) ^ 2 ≤ (4096 * H * 512 ^ 2 + 4096 * H ^ 2 * 512 + 64 * C0 + 8192 * H ^ 2 * 512 ^ 2 / eps ^ 2 + 128 / eps + 414 + 2 * (64 * H * 512 / eps) ^ 2 + 72) * (1 / nr + dr ^ 2 / (N ^ 2 * q ^ 2)) := by have hnr : 0 < nr := lt_of_lt_of_le zero_lt_one hn have hNp : 0 < N := hnr.trans_le hN have hdr : 0 ≤ dr := zero_le_one.trans hd have hqp : 0 < q := zero_lt_one.trans_le hq have hup : 0 < u := lt_of_lt_of_le (div_pos hnr (by norm_num)) hu have htp : 0 < t := lt_of_lt_of_le (div_pos hNp (by norm_num)) ht let R := L ^ 3 * A let rate := 1 / nr + dr ^ 2 / (N ^ 2 * q ^ 2) have hR0 : 0 ≤ R := by dsimp [R]; positivity have hR2 : R ^ 2 ≤ nr := by simpa [R] using hR have hyr : R * dr / (N * nr * q) ≤ rate / 2 := by simpa [rate] using normalized_young hnr hNp hqp hR2 (dr := dr) have hr0 : 0 ≤ rate := by dsimp [rate]; positivity have hq2 := inverse_square_schedule hqp hL hqL have hq1 := inverse_schedule hqp hL hqL have hinvu : u⁻¹ ≤ 32 / nr := by rw [inv_eq_one_div] apply (div_le_div_iff₀ hup hnr).2 linarith have hinvt : t⁻¹ ≤ 32 / nr := by have hnt : nr / 32 ≤ t := (div_le_div_of_nonneg_right hN (by norm_num : (0 : Real) ≤ 32)).trans ht rw [inv_eq_one_div] apply (div_le_div_iff₀ htp hnr).2 nlinarith have hsimple : C0 * (u⁻¹ + t⁻¹) + 4 / (eps * t) + 414 * inv12 ≤ (64 * C0 + 128 / eps + 414) * rate := by have h1 : C0 * (u⁻¹ + t⁻¹) ≤ 64 * C0 * (1 / nr) := by have := mul_le_mul_of_nonneg_left (add_le_add hinvu hinvt) hC0 calc _ ≤ C0 * (32 / nr + 32 / nr) := this _ = _ := by ring have h2 : 4 / (eps * t) ≤ (128 / eps) * (1 / nr) := by calc _ = (4 / eps) * t⁻¹ := by field_simp [heps.ne', htp.ne'] _ ≤ (4 / eps) * (32 / nr) := mul_le_mul_of_nonneg_left hinvt (by positivity) _ = _ := by ring have h3 : 414 * inv12 ≤ 414 * (1 / nr) := mul_le_mul_of_nonneg_left hinv12 (by norm_num) have hir : 1 / nr ≤ rate := by dsimp [rate] exact le_add_of_nonneg_right (by positivity) have := mul_le_mul_of_nonneg_left hir (show 0 ≤ 64 * C0 + 128 / eps + 414 by positivity) nlinarith have hcoreL2 : R * dr / (N * nr * L ^ 2) ≤ 512 ^ 2 * (rate / 2) := by calc _ = (R * dr / (N * nr)) * (1 / L ^ 2) := by field_simp [hnr.ne', hNp.ne', hL.ne'] _ ≤ (R * dr / (N * nr)) * (512 ^ 2 / q ^ 2) := mul_le_mul_of_nonneg_left hq2 (by positivity) _ ≤ (R * dr / (N * nr)) * (512 ^ 2 / q) := by apply mul_le_mul_of_nonneg_left _ (by positivity) apply mul_le_mul_of_nonneg_left _ (by norm_num) simpa [one_div] using one_div_le_one_div_of_le hqp (by nlinarith [mul_nonneg hqp.le (sub_nonneg.mpr hq)] : q ≤ q ^ 2) _ = 512 ^ 2 * (R * dr / (N * nr * q)) := by field_simp [hnr.ne', hNp.ne', hqp.ne'] _ ≤ _ := mul_le_mul_of_nonneg_left hyr (by positivity) have hcoreL1 : R * dr / (N ^ 2 * L) ≤ 512 * (rate / 2) := by calc _ = (R * dr / N ^ 2) * (1 / L) := by field_simp [hNp.ne', hL.ne'] _ ≤ (R * dr / N ^ 2) * (512 / q) := mul_le_mul_of_nonneg_left hq1 (by positivity) _ ≤ (R * dr / (N * nr)) * (512 / q) := by gcongr simpa [pow_two] using mul_le_mul_of_nonneg_left hN hNp.le _ = 512 * (R * dr / (N * nr * q)) := by field_simp [hnr.ne', hNp.ne', hqp.ne'] _ ≤ _ := mul_le_mul_of_nonneg_left hyr (by norm_num) have hlight1 : 4 * A * (min 1 (dr * B) / u) ≤ (4096 * H * 512 ^ 2) * (rate / 2) := by calc _ ≤ 4 * A * ((dr * B) / u) := by gcongr exact min_le_right _ _ _ ≤ 4 * A * ((dr * (32 * H * L / N)) / (nr / 32)) := by gcongr _ = 4096 * H * (R * dr / (N * nr * L ^ 2)) := by dsimp [R] field_simp [hnr.ne', hNp.ne', hL.ne'] ring _ ≤ _ := by simpa [mul_assoc] using mul_le_mul_of_nonneg_left hcoreL2 (show 0 ≤ 4096 * H by positivity) have hlight2 : 4 * A * (dr * B ^ 2) ≤ (4096 * H ^ 2 * 512) * (rate / 2) := by calc _ ≤ 4 * A * (dr * (32 * H * L / N) ^ 2) := by gcongr _ = 4096 * H ^ 2 * (R * dr / (N ^ 2 * L)) := by dsimp [R] field_simp [hNp.ne', hL.ne'] ring _ ≤ _ := by simpa [mul_assoc] using mul_le_mul_of_nonneg_left hcoreL1 (show 0 ≤ 4096 * H ^ 2 by positivity) have hdim : dr ^ 2 / (N ^ 2 * q ^ 2) ≤ rate := by dsimp [rate] exact le_add_of_nonneg_left (by positivity) have hvpoly : 8 * dr * B ^ 2 / (eps ^ 2 * L ^ 4) ≤ (8192 * H ^ 2 * 512 ^ 2 / eps ^ 2) * rate := by have hdr2 : dr ≤ dr ^ 2 := by calc dr = dr * 1 := by ring _ ≤ dr * dr := mul_le_mul_of_nonneg_left hd hdr _ = dr ^ 2 := by ring have hfrac : dr / (N ^ 2 * L ^ 2) ≤ dr ^ 2 * (512 ^ 2 / q ^ 2) / N ^ 2 := by calc _ = (dr / N ^ 2) * (1 / L ^ 2) := by field_simp [hNp.ne', hL.ne'] _ ≤ (dr / N ^ 2) * (512 ^ 2 / q ^ 2) := mul_le_mul_of_nonneg_left hq2 (by positivity) _ ≤ (dr ^ 2 / N ^ 2) * (512 ^ 2 / q ^ 2) := by gcongr _ = _ := by ring calc _ ≤ 8 * dr * (32 * H * L / N) ^ 2 / (eps ^ 2 * L ^ 4) := by gcongr _ = (8192 * H ^ 2 / eps ^ 2) * (dr / (N ^ 2 * L ^ 2)) := by field_simp [heps.ne', hNp.ne', hL.ne'] ring _ ≤ (8192 * H ^ 2 / eps ^ 2) * (dr ^ 2 * (512 ^ 2 / q ^ 2) / N ^ 2) := mul_le_mul_of_nonneg_left hfrac (by positivity) _ = (8192 * H ^ 2 * 512 ^ 2 / eps ^ 2) * (dr ^ 2 / (N ^ 2 * q ^ 2)) := by field_simp [heps.ne', hNp.ne', hqp.ne'] _ ≤ _ := mul_le_mul_of_nonneg_left hdim (by positivity) have hbmain : 2 * dr * B / (eps * L ^ 2) ≤ (64 * H * 512 / eps) * (dr / (N * q)) := by calc _ ≤ 2 * dr * (32 * H * L / N) / (eps * L ^ 2) := by gcongr _ = (64 * H / eps) * (dr / (N * L)) := by field_simp [heps.ne', hNp.ne', hL.ne'] ring _ ≤ (64 * H / eps) * (dr * (512 / q) / N) := by apply mul_le_mul_of_nonneg_left _ (by positivity) calc dr / (N * L) = (dr / N) * (1 / L) := by field_simp [hNp.ne', hL.ne'] _ ≤ (dr / N) * (512 / q) := mul_le_mul_of_nonneg_left hq1 (by positivity) _ = dr * (512 / q) / N := by ring _ = _ := by ring have hbmainSq : (2 * dr * B / (eps * L ^ 2)) ^ 2 ≤ (64 * H * 512 / eps) ^ 2 * rate := by have hs := mul_self_le_mul_self (by positivity) hbmain have : (dr / (N * q)) ^ 2 = dr ^ 2 / (N ^ 2 * q ^ 2) := by field_simp [hNp.ne', hqp.ne'] calc _ ≤ ((64 * H * 512 / eps) * (dr / (N * q))) ^ 2 := by simpa [pow_two] using hs _ = (64 * H * 512 / eps) ^ 2 * (dr ^ 2 / (N ^ 2 * q ^ 2)) := by rw [mul_pow, this] _ ≤ _ := mul_le_mul_of_nonneg_left hdim (sq_nonneg _) have htailSq : (6 * inv12) ^ 2 ≤ 36 * (1 / nr) := by have hi1 : inv12 ≤ 1 := hinv12.trans (by rw [div_le_one hnr] exact hn) nlinarith [mul_nonneg hinv120 (sub_nonneg.mpr hi1), mul_le_mul_of_nonneg_left hinv12 (by norm_num : (0 : Real) ≤ 36)] have hbias : (2 * dr * B / (eps * L ^ 2) + 6 * inv12) ^ 2 ≤ (2 * (64 * H * 512 / eps) ^ 2 + 72) * rate := by have hs : (2 * dr * B / (eps * L ^ 2) + 6 * inv12) ^ 2 ≤ 2 * (2 * dr * B / (eps * L ^ 2)) ^ 2 + 2 * (6 * inv12) ^ 2 := sq_add_le_two _ _ have hir : 1 / nr ≤ rate := by dsimp [rate] exact le_add_of_nonneg_right (by positivity) have ht' := htailSq.trans (mul_le_mul_of_nonneg_left hir (by norm_num : (0 : Real) ≤ 36)) linarith [mul_le_mul_of_nonneg_left hbmainSq (by norm_num : (0 : Real) ≤ 2), mul_le_mul_of_nonneg_left ht' (by norm_num : (0 : Real) ≤ 2)] have hlight : 4 * A * (min 1 (dr * B) / u + dr * B ^ 2) ≤ (4096 * H * 512 ^ 2 + 4096 * H ^ 2 * 512) * rate := by have hc1 : 0 ≤ 4096 * H * 512 ^ 2 := by positivity have hc2 : 0 ≤ 4096 * H ^ 2 * 512 := by positivity calc _ = 4 * A * (min 1 (dr * B) / u) + 4 * A * (dr * B ^ 2) := by ring _ ≤ (4096 * H * 512 ^ 2) * (rate / 2) + (4096 * H ^ 2 * 512) * (rate / 2) := add_le_add hlight1 hlight2 _ = (4096 * H * 512 ^ 2 + 4096 * H ^ 2 * 512) * (rate / 2) := by ring _ ≤ (4096 * H * 512 ^ 2 + 4096 * H ^ 2 * 512) * rate := mul_le_mul_of_nonneg_left (half_le_self hr0) (add_nonneg hc1 hc2) let cL := 4096 * H * 512 ^ 2 + 4096 * H ^ 2 * 512 let cS := 64 * C0 + 128 / eps + 414 let cV := 8192 * H ^ 2 * 512 ^ 2 / eps ^ 2 let cB := 2 * (64 * H * 512 / eps) ^ 2 + 72 calc _ = (4 * A * (min 1 (dr * B) / u + dr * B ^ 2)) + (C0 * (u⁻¹ + t⁻¹) + 4 / (eps * t) + 414 * inv12) + (8 * dr * B ^ 2 / (eps ^ 2 * L ^ 4)) + ((2 * dr * B / (eps * L ^ 2) + 6 * inv12) ^ 2) := by ring _ ≤ cL * rate + cS * rate + cV * rate + cB * rate := add_le_add (add_le_add (add_le_add hlight (by simpa [cS] using hsimple)) (by simpa [cV] using hvpoly)) (by simpa [cB] using hbias) _ = _ := by dsimp [cL, cS, cV, cB]; ring
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.hybrid_deterministic_envelope_le · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridDeterministicAbsorption.lean:44
theorem calibrated_envelope_absorption_exists Lemma 6 in the paper ↗

Concrete calibrated C33--C36 absorption. the stated conditions the stated conclusion.

Formal statement
eps C0 :
heps :
0 < eps
hC0 :
0 < C0
∃ C : Real,
0 < C
conclusion 1
n m d :
1 ≤ n
2 ≤ d
bs :
u :
bs.M0 / 8 (: Real)
t :
(bs.nf + bs.mf : Nat) / 8 (: Real)
4 * starA ^ Ldeg n * (min 1 ((d : Real) * Bscale n m eps) / u + (d : Real) * Bscale n m eps ^ 2)
+ C0 * (u⁻¹ + t⁻¹)
+ 8 * d * Bscale n m eps ^ 2 / (eps ^ 2 * (Ldeg n : Real) ^ 4)
+ 4 / (eps * t)
+ 414 * ((n : Real) ^ 12)⁻¹
+ (2 * d * Bscale n m eps / (eps * (Ldeg n : Real) ^ 2) + 6 * ((n : Real) ^ 12)⁻¹) ^ 2
≤ C * (1 / (n : Real) + (d : Real) ^ 2 / (((n + m : Nat) : Real) ^ 2 * logEN n ^ 2))
Proof (Lean source)
lemma calibrated_envelope_absorption_exists {eps C0 : Real} (heps : 0 < eps) (hC0 : 0 < C0) : ∃ C : Real, 0 < C ∧ ∀ (n m d : Nat), 1 ≤ n → 2 ≤ d → calibrationPredicate n m eps → let bs := blockSizes n m let u : Real := bs.M0 / 8 let t : Real := (bs.nf + bs.mf : Nat) / 8 4 * starA ^ Ldeg n * (min 1 ((d : Real) * Bscale n m eps) / u + (d : Real) * Bscale n m eps ^ 2) + C0 * (u⁻¹ + t⁻¹) + 8 * d * Bscale n m eps ^ 2 / (eps ^ 2 * (Ldeg n : Real) ^ 4) + 4 / (eps * t) + 414 * ((n : Real) ^ 12)⁻¹ + (2 * d * Bscale n m eps / (eps * (Ldeg n : Real) ^ 2) + 6 * ((n : Real) ^ 12)⁻¹) ^ 2 ≤ C * (1 / (n : Real) + (d : Real) ^ 2 / (((n + m : Nat) : Real) ^ 2 * logEN n ^ 2)) := by let H : Real := Hconst eps let C : Real := 1 + (4096 * H * 512 ^ 2 + 4096 * H ^ 2 * 512 + 64 * C0 + 8192 * H ^ 2 * 512 ^ 2 / eps ^ 2 + 128 / eps + 414 + 2 * (64 * H * 512 / eps) ^ 2 + 72) have hC : 0 < C := by dsimp [C, H]; positivity refine ⟨C, hC, ?_⟩ intro n m d hn hd hcal dsimp only let nr : Real := n let N : Real := n + m let dr : Real := d let q := logEN n let L : Real := Ldeg n let A : Real := starA ^ Ldeg n let B := Bscale n m eps let u : Real := (blockSizes n m).M0 / 8 let t : Real := ((blockSizes n m).nf + (blockSizes n m).mf : Nat) / 8 have hnr : 1 ≤ nr := by dsimp [nr]; exact_mod_cast hn have hN : nr ≤ N := by dsimp [nr, N]; exact_mod_cast Nat.le_add_right n m have hdr : 1 ≤ dr := by dsimp [dr]; exact_mod_cast (by omega : 1 ≤ d) have hq : 1 ≤ q := by have hnp : (0 : Real) < n := by positivity dsimp [q, logEN] rw [Real.log_mul (Real.exp_ne_zero 1) hnp.ne', Real.log_exp] exact le_add_of_nonneg_right (Real.log_nonneg (by exact_mod_cast hn)) have hL : 0 < L := by dsimp [L] exact_mod_cast (lt_of_lt_of_le (by norm_num : 0 < 2) (Ldeg_ge_two n)) have hA : 0 ≤ A := by dsimp [A]; positivity obtain ⟨_hu, _htp, _ht, hBp⟩ := calibrationPredicate_positive_parameters hcal have hB : 0 ≤ B := by simpa [B] using hBp.le have hcal' := hcal simp only [calibrationPredicate] at hcal' rcases hcal' with ⟨hn24, hu0, _hu1, _hp0, _hp1, ht0, _ht1, _hr0, _hr1, hLbin, _htpB, _htB, hm4, hm6, _tail1, _tail2, _tail3⟩ have hu : nr / 32 ≤ u := by have hnp : (0 : Real) < nr := lt_of_lt_of_le zero_lt_one hnr have := (le_div_iff₀ hnp).1 hu0 dsimp [nr, u] nlinarith have ht : N / 32 ≤ t := by have hNp : (0 : Real) < N := lt_of_lt_of_le zero_lt_one (hnr.trans hN) have ht0' : 1 / 32 ≤ t / N := by simpa [t, N] using ht0 have := (le_div_iff₀ hNp).1 ht0' simpa [div_eq_mul_inv, mul_comm] using this have hBup : B ≤ 32 * H * L / N := by simpa [B, H, L, N] using (Bscale_bounds n m eps hn24).2 have hqL : q ≤ 512 * L := by have hlog := logEN_le_binLen n hn norm_num [cCirc] at hLbin dsimp [q, L] nlinarith have hR : (L ^ 3 * A) ^ 2 ≤ nr := by have hm := (moment_tests_square_forms hm4 hm6).2 simpa [L, A, nr] using hm have hinv0 : 0 ≤ ((n : Real) ^ 12)⁻¹ := by positivity have hinv : ((n : Real) ^ 12)⁻¹ ≤ 1 / nr := by have hnp : (0 : Real) < n := by positivity have hp : (n : Real) ≤ (n : Real) ^ 12 := by calc (n : Real) = (n : Real) ^ 1 := by ring _ ≤ _ := pow_le_pow_right₀ (by exact_mod_cast hn) (by omega) dsimp [nr] simpa [one_div] using inv_anti₀ hnp hp have hmain := hybrid_deterministic_envelope_le heps hC0.le (show 0 ≤ H by dsimp [H]; positivity) hnr hN hdr hq hL hA hB hu ht hBup hqL hR hinv hinv0 have hr0 : 0 ≤ 1 / nr + dr ^ 2 / (N ^ 2 * q ^ 2) := by positivity have hcoef : 4096 * H * 512 ^ 2 + 4096 * H ^ 2 * 512 + 64 * C0 + 8192 * H ^ 2 * 512 ^ 2 / eps ^ 2 + 128 / eps + 414 + 2 * (64 * H * 512 / eps) ^ 2 + 72 ≤ C := by dsimp [C] linarith have hout := hmain.trans (mul_le_mul_of_nonneg_right hcoef hr0) simpa only [nr, N, dr, q, L, A, B, u, t, Nat.cast_add] using hout
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.calibrated_envelope_absorption_exists · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridDeterministicAbsorption.lean:263
CausalSmith.Stat.STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research.Helpers.HybridEventualCalibration 3 declarations Uniform eventual validity of the finite hybrid calibration predicate.

Uniform eventual validity of the finite hybrid calibration predicate.

theorem log_one_add_barEps_div_three_lower

The elementary logarithmic lower bound used for the rational pilot tail. the stated conditions the stated conclusion.

Formal statement
eps :
heps :
0 < eps
heps2 :
eps < 1 / 2
2 * barEps eps / 7 ≤ log (1 + barEps eps / 3)
Proof (Lean source)
lemma log_one_add_barEps_div_three_lower {eps : Real} (heps : 0 < eps) (heps2 : eps < 1 / 2) : 2 * barEps eps / 7 ≤ log (1 + barEps eps / 3) := by have hb : 0 < barEps eps := barEps_pos eps have hbe : barEps eps ≤ eps := (dyadicIndex_spec heps heps2).2 have hhalf : barEps eps < 1 / 2 := hbe.trans_lt heps2 have hlog := Real.le_log_one_add_of_nonneg (show 0 ≤ barEps eps / 3 by positivity) calc 2 * barEps eps / 7 ≤ 2 * (barEps eps / 3) / (barEps eps / 3 + 2) := by field_simp nlinarith _ ≤ log (1 + barEps eps / 3) := hlog
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.log_one_add_barEps_div_three_lower · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridEventualCalibration.lean:10
theorem calibrationPredicate_eventually_uniform

Every deterministic calibration test holds for all auxiliary sizes once the labeled size is sufficiently large. the stated conditions the stated conclusion.

Formal statement
eps :
heps :
0 < eps
heps2 :
eps < 1 / 2
∀ᶠ n : Nat in atTop, ∀ m : Nat, calibrationPredicate n m eps
Proof (Lean source)
lemma calibrationPredicate_eventually_uniform {eps : Real} (heps : 0 < eps) (heps2 : eps < 1 / 2) : ∀ᶠ n : Nat in atTop, ∀ m : Nat, calibrationPredicate n m eps := by filter_upwards [Filter.eventually_ge_atTop 24, eventually_two_le_cCirc_binLen, eventually_factorial_moment_tests] with n hn hdeg hmom intro m let bs := blockSizes n m let N : Nat := n + m let u : Real := bs.M0 / 8 let tp : Real := (bs.np + bs.mp : Nat) / 8 let t : Real := (bs.nf + bs.mf : Nat) / 8 let L : Nat := Ldeg n let B : Real := Bscale n m eps have hr := blockSizes_intensity_ratios n m hn change 1 / 32 ≤ u / n ∧ u / n ≤ 1 / 24 ∧ 1 / 32 ≤ tp / N ∧ tp / N ≤ 3 / 32 ∧ 1 / 32 ≤ t / N ∧ t / N ≤ 3 / 32 ∧ 1 / 3 ≤ t / tp ∧ t / tp ≤ 3 at hr rcases hr with ⟨hu0, hu1, hp0, hp1, hf0, hf1, hratio0, hratio1⟩ have hLbounds := Ldeg_bounds hdeg change cCirc * binLen n / 2 ≤ (L : Real) ∧ (L : Real) ≤ cCirc * binLen n at hLbounds have hBL := blockSizes_mul_Bscale_lower n m eps hn change (Hconst eps : Real) * L ≤ tp * B ∧ (Hconst eps : Real) * L ≤ t * B at hBL rcases hBL with ⟨htpBL, htBL⟩ rcases Hconst_spec heps with ⟨hH4, hHtail, hH672, hH24⟩ have hLR : (2 : Real) ≤ L := by exact_mod_cast Ldeg_ge_two n have hH4R : (4 : Real) ≤ Hconst eps := by exact_mod_cast hH4 have htpB8 : 8 ≤ tp * B := by nlinarith have htBL' : (L : Real) ≤ t * B := by nlinarith have htail1 : 15 * (L : Real) + 12 * binLen n ≤ tp * B / 4 := by have hc : 0 < cCirc := by norm_num [cCirc] have hbin : (12 : Real) * binLen n ≤ 24 / cCirc * L := by rw [div_mul_eq_mul_div] apply (le_div_iff₀ hc).2 nlinarith [hLbounds.1] have : (15 + 24 / cCirc) * L ≤ tp * B / 4 := by calc (15 + 24 / cCirc) * L ≤ ((Hconst eps : Real) / 4) * L := mul_le_mul_of_nonneg_right hHtail (by positivity) _ ≤ tp * B / 4 := by linarith nlinarith have htail3 : 12 * binLen n ≤ barEps eps * t * B := by have hnonneg : 0 ≤ (binLen n : Real) := by positivity have hscaled : 12 * binLen n ≤ ((Hconst eps : Real) * cCirc * barEps eps / 2) * binLen n := by have : (12 : Real) ≤ (Hconst eps : Real) * cCirc * barEps eps / 2 := by linarith exact mul_le_mul_of_nonneg_right this hnonneg calc 12 * binLen n ≤ ((Hconst eps : Real) * cCirc * barEps eps / 2) * binLen n := hscaled _ ≤ barEps eps * ((Hconst eps : Real) * L) := by have hb := (barEps_pos eps).le have h := mul_le_mul_of_nonneg_left hLbounds.1 (mul_nonneg (by positivity : 0 ≤ (Hconst eps : Real)) hb) nlinarith _ ≤ barEps eps * (t * B) := mul_le_mul_of_nonneg_left htBL (barEps_pos eps).le _ = barEps eps * t * B := by ring have hk : (Hconst eps : Real) * L / 8 ≤ (k0 n m eps : Real) := by calc (Hconst eps : Real) * L / 8 ≤ tp * B / 8 := by exact div_le_div_of_nonneg_right htpBL (by norm_num) _ ≤ (k0 n m eps : Real) := k0_lower_eighth n m eps htpB8 have hb := barEps_pos eps have hlog0 := log_one_add_barEps_div_three_lower heps heps2 have hbase : 1 + barEps eps / 3 ≤ 1 + barEps eps * t / tp := by have := mul_le_mul_of_nonneg_left hratio0 hb.le simpa [div_eq_mul_inv, mul_assoc] using add_le_add_left this 1 have hbase0 : 0 < 1 + barEps eps / 3 := by positivity have hbase1 : 0 < 1 + barEps eps * t / tp := hbase0.trans_le hbase have hlogmono : log (1 + barEps eps / 3) ≤ log (1 + barEps eps * t / tp) := Real.strictMonoOn_log.monotoneOn hbase0 hbase1 hbase have hklog : 12 * binLen n ≤ (k0 n m eps : Real) * log (1 + barEps eps * t / tp) := by have hbin0 : 0 ≤ (binLen n : Real) := by positivity have hstart : 12 * binLen n ≤ ((Hconst eps : Real) * cCirc * barEps eps / 56) * binLen n := by have : (12 : Real) ≤ (Hconst eps : Real) * cCirc * barEps eps / 56 := by nlinarith exact mul_le_mul_of_nonneg_right this hbin0 have hmid : ((Hconst eps : Real) * cCirc * barEps eps / 56) * binLen n ≤ ((Hconst eps : Real) * L / 8) * (2 * barEps eps / 7) := by have h := mul_le_mul_of_nonneg_left hLbounds.1 (mul_nonneg (by positivity : 0 ≤ (Hconst eps : Real)) hb.le) nlinarith calc 12 * binLen n ≤ ((Hconst eps : Real) * cCirc * barEps eps / 56) * binLen n := hstart _ ≤ ((Hconst eps : Real) * L / 8) * (2 * barEps eps / 7) := hmid _ ≤ (k0 n m eps : Real) * (2 * barEps eps / 7) := mul_le_mul_of_nonneg_right hk (by positivity) _ ≤ (k0 n m eps : Real) * log (1 + barEps eps / 3) := mul_le_mul_of_nonneg_left hlog0 (by positivity) _ ≤ (k0 n m eps : Real) * log (1 + barEps eps * t / tp) := mul_le_mul_of_nonneg_left hlogmono (by positivity) have htail2 : (n : Real) ^ 12 ≤ (1 + barEps eps * t / tp) ^ k0 n m eps := pow_tail_test_of_log (by omega) hbase1 hklog change calibrationPredicate n m eps simp only [calibrationPredicate] change 24 ≤ n ∧ 1 / 32 ≤ u / n ∧ u / n ≤ 1 / 24 ∧ 1 / 32 ≤ tp / N ∧ tp / N ≤ 3 / 32 ∧ 1 / 32 ≤ t / N ∧ t / N ≤ 3 / 32 ∧ 1 / 3 ≤ t / tp ∧ t / tp ≤ 3 ∧ cCirc * binLen n / 2 ≤ L ∧ 8 ≤ tp * B ∧ (L : Real) ≤ t * B ∧ (L : Real) ^ 4 * starA ^ (2 * L) ≤ n ∧ (L : Real) ^ 6 * starA ^ (2 * L) ≤ n ∧ 15 * L + 12 * binLen n ≤ tp * B / 4 ∧ (n : Real) ^ 12 ≤ (1 + barEps eps * t / tp) ^ k0 n m eps ∧ 12 * binLen n ≤ barEps eps * t * B exact ⟨hn, hu0, hu1, hp0, hp1, hf0, hf1, hratio0, hratio1, hLbounds.1, htpB8, htBL', hmom.1, hmom.2, htail1, htail2, htail3⟩
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.calibrationPredicate_eventually_uniform · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridEventualCalibration.lean:24
theorem calibrationPredicate_failure_bounded

A single finite labeled-size threshold contains every possible calibration failure, uniformly over the auxiliary sample size. the stated conditions the stated conclusion.

Formal statement
eps :
heps :
0 < eps
heps2 :
eps < 1 / 2
∃ n0 : Nat,
1 ≤ n0
conclusion 1
n m :
n < n0
Proof (Lean source)
lemma calibrationPredicate_failure_bounded {eps : Real} (heps : 0 < eps) (heps2 : eps < 1 / 2) : ∃ n0 : Nat, 1 ≤ n0 ∧ ∀ n m : Nat, ¬ calibrationPredicate n m eps → n < n0 := by have hev := calibrationPredicate_eventually_uniform heps heps2 rw [Filter.eventually_atTop] at hev obtain ⟨N, hN⟩ := hev refine ⟨max 1 N, by simp, ?_⟩ intro n m hfail by_contra hn have hNn : N ≤ n := le_trans (le_max_right 1 N) (le_of_not_gt hn) exact hfail (hN n hNn m)
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.calibrationPredicate_failure_bounded · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridEventualCalibration.lean:143
CausalSmith.Stat.STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research.Helpers.HybridExponentialAbsorption 3 declarations Deterministic exponential absorption for heavy cells.

Deterministic exponential absorption for heavy cells.

theorem log_starA_le_thirteen

A convenient explicit logarithmic bound for the factorial constant. the stated conclusion.

Formal statement
log (starA : Real) ≤ 13
Proof (Lean source)
lemma log_starA_le_thirteen : log (starA : Real) ≤ 13 := by have hbase : (starA : Real) ≤ (2 : Real) ^ 13 := by norm_num [starA] have hApos : (0 : Real) < starA := by norm_num [starA] have hpowpos : (0 : Real) < 2 ^ 13 := pow_pos (by norm_num) _ have hlog := Real.strictMonoOn_log.monotoneOn hApos hpowpos hbase rw [Real.log_pow] at hlog have := log_two_le_one norm_num at hlog nlinarith
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.log_starA_le_thirteen · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridExponentialAbsorption.lean:10
theorem factorial_growth_mul_heavy_exp_le

C22 with the explicit constants chosen by the calibration. the stated conditions the stated conclusion.

Formal statement
eps y :
L :
heps :
0 < eps
hy :
1 ≤ y
(starA : Real) ^ L * (1 + y) ^ (2 * L) * exp (-(Hconst eps : Real) * L * y / 4)
≤ exp (-24 * L * y / cCirc)
Proof (Lean source)
lemma factorial_growth_mul_heavy_exp_le {eps y : Real} {L : Nat} (heps : 0 < eps) (hy : 1 ≤ y) : (starA : Real) ^ L * (1 + y) ^ (2 * L) * exp (-(Hconst eps : Real) * L * y / 4) ≤ exp (-24 * L * y / cCirc) := by have hA : (0 : Real) < starA := by norm_num [starA] have hypos : 0 < 1 + y := by linarith have hlogy : log (1 + y) ≤ y := by have := Real.log_le_sub_one_of_pos hypos linarith have hH := (Hconst_spec heps).2.1 have hc : 0 < cCirc := by norm_num [cCirc] have hL0 : 0 ≤ (L : Real) := by positivity have hy0 : 0 ≤ y := le_trans (by norm_num) hy have hexponent : (L : Real) * log (starA : Real) + (2 * L : Nat) * log (1 + y) - (Hconst eps : Real) * L * y / 4 ≤ -24 * L * y / cCirc := by norm_num [cCirc, Nat.cast_mul] at hH ⊢ have hAlog := log_starA_le_thirteen have hLy : (L : Real) ≤ L * y := by nlinarith have h1 := mul_le_mul_of_nonneg_left hAlog hL0 have h2 := mul_le_mul_of_nonneg_left hlogy (show (0 : Real) ≤ 2 * L by positivity) nlinarith [mul_nonneg hL0 hy0, mul_nonneg (sub_nonneg.mpr hH) (mul_nonneg hL0 hy0)] rw [show (starA : Real) ^ L = exp ((L : Real) * log (starA : Real)) by rw [Real.exp_nat_mul, Real.exp_log hA], show (1 + y) ^ (2 * L) = exp (((2 * L : Nat) : Real) * log (1 + y)) by rw [Real.exp_nat_mul, Real.exp_log hypos], ← Real.exp_add, ← Real.exp_add] apply Real.exp_le_exp.mpr convert hexponent using 1 <;> norm_num [Nat.cast_mul] <;> ring
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.factorial_growth_mul_heavy_exp_le · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridExponentialAbsorption.lean:22
theorem moment_tests_square_forms

Polynomial forms of the two square-root comparisons in C34. the stated conditions the stated conclusion.

Formal statement
n L :
h4 :
(L : Real) ^ 4 * starA ^ (2 * L) ≤ n
h6 :
(L : Real) ^ 6 * starA ^ (2 * L) ≤ n
conclusion 1
((L : Real) ^ 2 * starA ^ L) ^ 2 ≤ n
conclusion 2
((L : Real) ^ 3 * starA ^ L) ^ 2 ≤ n
Proof (Lean source)
lemma moment_tests_square_forms {n L : Nat} (h4 : (L : Real) ^ 4 * starA ^ (2 * L) ≤ n) (h6 : (L : Real) ^ 6 * starA ^ (2 * L) ≤ n) : (((L : Real) ^ 2 * starA ^ L) ^ 2 ≤ n) ∧ (((L : Real) ^ 3 * starA ^ L) ^ 2 ≤ n) := by constructor · simpa [mul_pow, ← pow_mul, Nat.mul_comm, Nat.mul_left_comm, Nat.mul_assoc] using h4 · simpa [mul_pow, ← pow_mul, Nat.mul_comm, Nat.mul_left_comm, Nat.mul_assoc] using h6
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.moment_tests_square_forms · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridExponentialAbsorption.lean:60
CausalSmith.Stat.STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research.Helpers.HybridHeavyAggregate 3 declarations Aggregate identities and the C30 variance domination for the heavy branch.

Aggregate identities and the C30 variance domination for the heavy branch.

theorem variance_separatedInverseCountStatistic_eq_sum

The all-heavy variance is the sum of the independent cell variances. the stated conclusion.

Formal statement
d :
P :
u t :
= ∑ x : Fin d, Var[hybridHeavyPools u; ((Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (u * markedMass P x a))).prod (Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (t * armMass P x a))))]
Proof (Lean source)
lemma variance_separatedInverseCountStatistic_eq_sum {d : Nat} (P : DiscreteLaw d) (u t : Real) : Var[separatedInverseCountStatistic u; separatedPoissonCountLaw P u t] = ∑ x : Fin d, Var[hybridHeavyPools u; ((Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (u * markedMass P x a))).prod (Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (t * armMass P x a))))] := by let mu : Fin d → Measure ((Bool → Nat) × (Bool → Nat)) := fun x ↦ (Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (u * markedMass P x a))).prod (Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (t * armMass P x a))) have h := variance_sum_pi (μ := mu) (X := fun x W ↦ hybridHeavyPools u W) (fun x ↦ hybridHeavyPools_memLp P u t x) change Var[(fun W ↦ ∑ x : Fin d, hybridHeavyPools u (W x)); Measure.pi mu] = _ calc _ = Var[∑ x : Fin d, fun W : SeparatedPoissonCounts d ↦ hybridHeavyPools u (W x); Measure.pi mu] := by apply variance_congr filter_upwards [] with W simp only [Finset.sum_apply] _ = ∑ x : Fin d, Var[hybridHeavyPools u; mu x] := h _ = _ := by rfl
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.variance_separatedInverseCountStatistic_eq_sum · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridHeavyAggregate.lean:13
theorem sum_pilotHeavy_mul_variance_heavy_le

C30: pilot downweighting can only reduce the all-heavy variance sum. the stated conditions the stated conclusion.

Formal statement
d :
P :
u tp t C :
threshold :
(∑ x : Fin d, hybridPilotHeavyProbability P tp threshold x * Var[hybridHeavyPools u; ((Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (u * markedMass P x a))).prod (Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (t * armMass P x a))))])
≤ C
Proof (Lean source)
lemma sum_pilotHeavy_mul_variance_heavy_le {d : Nat} (P : DiscreteLaw d) {u tp t C : Real} {threshold : Nat} (hvar : Var[separatedInverseCountStatistic u; separatedPoissonCountLaw P u t] ≤ C) : (∑ x : Fin d, hybridPilotHeavyProbability P tp threshold x * Var[hybridHeavyPools u; ((Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (u * markedMass P x a))).prod (Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (t * armMass P x a))))]) ≤ C := by calc _ ≤ ∑ x : Fin d, Var[hybridHeavyPools u; ((Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (u * markedMass P x a))).prod (Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (t * armMass P x a))))] := by apply Finset.sum_le_sum intro x _ exact mul_le_of_le_one_left (variance_nonneg _ _) (measureReal_le_one (μ := Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (tp * armMass P x a))) (s := (hybridPilotEvent threshold)ᶜ)) _ = Var[separatedInverseCountStatistic u; separatedPoissonCountLaw P u t] := (variance_separatedInverseCountStatistic_eq_sum P u t).symm _ ≤ C := hvar
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.sum_pilotHeavy_mul_variance_heavy_le · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridHeavyAggregate.lean:41
theorem pilotHeavy_variance_bound_exists

C30 with the overlap-dependent constant supplied by the all-heavy risk theorem. the stated conditions the stated conclusion.

Formal statement
eps :
heps :
0 < eps
heps2 :
eps < 1 / 2
∃ C : Real,
0 < C
conclusion 1
d :
P :
hP :
ModelClass d eps P
u tp t :
hu :
0 < u
ht :
0 < t
threshold :
(∑ x : Fin d, hybridPilotHeavyProbability P tp threshold x * Var[hybridHeavyPools u; ((Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (u * markedMass P x a))).prod (Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (t * armMass P x a))))])
≤ C * (u⁻¹ + t⁻¹)
Proof (Lean source)
lemma pilotHeavy_variance_bound_exists {eps : Real} (heps : 0 < eps) (heps2 : eps < 1 / 2) : ∃ C : Real, 0 < C ∧ ∀ (d : Nat) (P : DiscreteLaw d) (hP : ModelClass d eps P) {u tp t : Real} (hu : 0 < u) (ht : 0 < t) (threshold : Nat), (∑ x : Fin d, hybridPilotHeavyProbability P tp threshold x * Var[hybridHeavyPools u; ((Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (u * markedMass P x a))).prod (Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (t * armMass P x a))))]) ≤ C * (u⁻¹ + t⁻¹) := by obtain ⟨C, hC, hheavy⟩ := separated_inverse_count_risk heps heps2 refine ⟨C, hC, ?_⟩ intro d P hP u tp t hu ht threshold exact sum_pilotHeavy_mul_variance_heavy_le P (hheavy d u t hu ht P hP).2
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.pilotHeavy_variance_bound_exists · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridHeavyAggregate.lean:70
CausalSmith.Stat.STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research.Helpers.HybridHeavyLightTail 5 declarations The heavy-cell contribution of the mistakenly selected light branch.

The heavy-cell contribution of the mistakenly selected light branch.

theorem abs_chebG_eval_le

Coefficient-L1 control of the Chebyshev continuation outside its fitting interval. the stated conditions the stated conclusion.

Formal statement
L :
hL :
2 ≤ L
z y :
hz :
0 ≤ z
hzy :
z ≤ y
hy :
0 ≤ y
|(chebG L).eval z| ≤ coefficientL1 (chebG L) * (1 + y) ^ L
Proof (Lean source)
lemma abs_chebG_eval_le {L : Nat} (hL : 2 ≤ L) {z y : Real} (hz : 0 ≤ z) (hzy : z ≤ y) (hy : 0 ≤ y) : |(chebG L).eval z| ≤ coefficientL1 (chebG L) * (1 + y) ^ L := by obtain ⟨_A, _hA, hcert⟩ := chebyshev_factorial_certificate have hdeg := (hcert L hL).1 rw [Polynomial.eval_eq_sum] change |∑ i ∈ (chebG L).support, (chebG L).coeff i * z ^ i| ≤ _ calc _ ≤ ∑ i ∈ (chebG L).support, |(chebG L).coeff i * z ^ i| := Finset.abs_sum_le_sum_abs _ _ _ ≤ ∑ i ∈ (chebG L).support, |(chebG L).coeff i| * (1 + y) ^ L := by apply Finset.sum_le_sum intro i hi rw [abs_mul, abs_of_nonneg (pow_nonneg hz _)] apply mul_le_mul_of_nonneg_left _ (abs_nonneg _) have hiz : i ≤ (chebG L).natDegree := Polynomial.le_natDegree_of_ne_zero (Polynomial.mem_support_iff.mp hi) have hiL : i ≤ L := hiz.trans (hdeg.trans (sub_le L 2)) exact (pow_le_pow_left₀ hz (by linarith) i).trans (pow_le_pow_right₀ (by linarith) hiL) _ = _ := by rw [← Finset.sum_mul] rfl
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.abs_chebG_eval_le · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridHeavyLightTail.lean:15
theorem abs_integral_hybridLightPools_heavy_le

C20, in a form whose extra continuation power is absorbed by C22. the stated conditions the stated conclusion.

Formal statement
d :
P :
x :
Fin d
u t B :
L :
hu :
0 < u
ht :
0 < t
hB :
0 < B
hL :
2 ≤ L
hp :
B < cellMass P x
|∫ W, hybridLightPools L B u t W ∂ ((Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (u * markedMass P x a))).prod (Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (t * armMass P x a))))|
≤ cellMass P x * 14 ^ L * (1 + cellMass P x / B) ^ (2 * L)
Proof (Lean source)
lemma abs_integral_hybridLightPools_heavy_le {d : Nat} (P : DiscreteLaw d) (x : Fin d) {u t B : Real} {L : Nat} (hu : 0 < u) (ht : 0 < t) (hB : 0 < B) (hL : 2 ≤ L) (hp : B < cellMass P x) : |∫ W, hybridLightPools L B u t W ∂ ((Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (u * markedMass P x a))).prod (Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (t * armMass P x a))))| ≤ cellMass P x * 14 ^ L * (1 + cellMass P x / B) ^ (2 * L) := by have hp0 := (cellMass_mem_unitInterval P x).1 have hs0 : 0 ≤ armMass P x false := Finset.sum_nonneg fun y _ ↦ (jointMass_mem_unitInterval P x false y).1 have hs1 : 0 ≤ armMass P x true := Finset.sum_nonneg fun y _ ↦ (jointMass_mem_unitInterval P x true y).1 have hsum : armMass P x false + armMass P x true = cellMass P x := by simp [armMass, cellMass] ring have hsle (a : Bool) : armMass P x a ≤ cellMass P x := by cases a <;> rw [← hsum] <;> linarith have hmle (a : Bool) : markedMass P x a ≤ cellMass P x := by calc markedMass P x a ≤ armMass P x a := by simp [markedMass, armMass] exact (jointMass_mem_unitInterval P x a false).1 _ ≤ cellMass P x := hsle a have hG (a : Bool) : |(chebG L).eval (armMass P x a / B)| ≤ coefficientL1 (chebG L) * (1 + cellMass P x / B) ^ L := abs_chebG_eval_le hL (div_nonneg (by cases a <;> assumption) hB.le) (div_le_div_of_nonneg_right (hsle a) hB.le) (div_nonneg hp0 hB.le) have hcoef := (explicit_chebyshev_calibration L hL).2.1 rw [integral_hybridLightPools P hu ht hB L x] have hy0 : 0 ≤ cellMass P x / B := div_nonneg hp0 hB.le have hy1 : cellMass P x / B ≤ (1 + cellMass P x / B) ^ L := by have hybase : cellMass P x / B ≤ 1 + cellMass P x / B := by linarith exact hybase.trans (by have : 1 ≤ L := by omega simpa using pow_le_pow_right₀ (by linarith : 1 ≤ 1 + cellMass P x / B) this) have hm0 : 0 ≤ markedMass P x false := (jointMass_mem_unitInterval P x false true).1 have hm1 : 0 ≤ markedMass P x true := (jointMass_mem_unitInterval P x true true).1 calc |_ - _| ≤ |markedMass P x true * (cellMass P x / B) * (chebG L).eval (armMass P x true / B)| + |markedMass P x false * (cellMass P x / B) * (chebG L).eval (armMass P x false / B)| := abs_sub _ _ _ ≤ 2 * cellMass P x * (cellMass P x / B) * (coefficientL1 (chebG L) * (1 + cellMass P x / B) ^ L) := by rw [abs_mul, abs_mul, abs_mul, abs_mul, abs_of_nonneg hm0, abs_of_nonneg hm1, abs_of_nonneg hy0] have htrue : markedMass P x true * (cellMass P x / B) * |(chebG L).eval (armMass P x true / B)| ≤ cellMass P x * (cellMass P x / B) * (coefficientL1 (chebG L) * (1 + cellMass P x / B) ^ L) := by gcongr · exact hmle true · exact hG true have hfalse : markedMass P x false * (cellMass P x / B) * |(chebG L).eval (armMass P x false / B)| ≤ cellMass P x * (cellMass P x / B) * (coefficientL1 (chebG L) * (1 + cellMass P x / B) ^ L) := by gcongr · exact hmle false · exact hG false linarith _ ≤ cellMass P x * 14 ^ L * (1 + cellMass P x / B) ^ (2 * L) := by have hpcoef : 2 * coefficientL1 (chebG L) ≤ 14 ^ L := hcoef have hcoef0 : 0 ≤ coefficientL1 (chebG L) := by unfold coefficientL1 exact Finset.sum_nonneg fun i _ ↦ abs_nonneg _ have hpow0 : 0 ≤ (1 + cellMass P x / B) ^ L := by positivity rw [show 2 * L = L + L by omega, pow_add] calc 2 * cellMass P x * (cellMass P x / B) * (coefficientL1 (chebG L) * (1 + cellMass P x / B) ^ L) = cellMass P x * (cellMass P x / B) * (2 * coefficientL1 (chebG L)) * (1 + cellMass P x / B) ^ L := by ring _ ≤ cellMass P x * (1 + cellMass P x / B) ^ L * (14 ^ L) * (1 + cellMass P x / B) ^ L := by gcongr _ = _ := by ring
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.abs_integral_hybridLightPools_heavy_le · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridHeavyLightTail.lean:41
theorem calibrated_heavy_cell_light_mean_le

C23 mean part, cellwise: the wrong-light mean retains a factor of cell mass. the stated conditions the stated conclusion.

Formal statement
d :
P :
n m :
eps :
heps :
0 < eps
hn :
1 ≤ n
hcal :
x :
Fin d
hp :
Bscale n m eps < cellMass P x
bs :
u :
bs.M0 / 8 (: Real)
tp :
(bs.np + bs.mp : Nat) / 8 (: Real)
t :
(bs.nf + bs.mf : Nat) / 8 (: Real)
hybridPilotLightProbability P tp (k0 n m eps) x * |∫ W, hybridLightPools (Ldeg n) (Bscale n m eps) u t W ∂ ((Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (u * markedMass P x a))).prod (Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (t * armMass P x a))))|
≤ cellMass P x * ((n : Real) ^ 12)⁻¹
Proof (Lean source)
lemma calibrated_heavy_cell_light_mean_le {d : Nat} (P : DiscreteLaw d) {n m : Nat} {eps : Real} (heps : 0 < eps) (hn : 1 ≤ n) (hcal : calibrationPredicate n m eps) (x : Fin d) (hp : Bscale n m eps < cellMass P x) : let bs := blockSizes n m let u : Real := bs.M0 / 8 let tp : Real := (bs.np + bs.mp : Nat) / 8 let t : Real := (bs.nf + bs.mf : Nat) / 8 hybridPilotLightProbability P tp (k0 n m eps) x * |∫ W, hybridLightPools (Ldeg n) (Bscale n m eps) u t W ∂ ((Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (u * markedMass P x a))).prod (Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (t * armMass P x a))))| ≤ cellMass P x * ((n : Real) ^ 12)⁻¹ := by dsimp only let u : Real := (blockSizes n m).M0 / 8 let tp : Real := ((blockSizes n m).np + (blockSizes n m).mp : Nat) / 8 let t : Real := ((blockSizes n m).nf + (blockSizes n m).mf : Nat) / 8 obtain ⟨hu, htp, ht, hB⟩ := calibrationPredicate_positive_parameters hcal have hL : 2 ≤ Ldeg n := Ldeg_ge_two n have hcal' := hcal simp only [calibrationPredicate] at hcal' rcases hcal' with ⟨hn24, _hu0, _hu1, _hp0, _hp1, _hf0, _hf1, _hr0, _hr1, hLbin, _htpB, _htB, _hm4, _hm6, _htail, _hrat, _hlast⟩ let p := cellMass P x let B := Bscale n m eps let y := p / B have hy : 1 ≤ y := by dsimp [y, p, B] apply (le_div_iff₀ hB).2 simpa using hp.le have hpi := hybridPilotLightProbability_le_exp P (k0 n m eps) x htp hp (k0_upper_quarter n m eps (mul_nonneg htp.le hB.le)) have hmean := abs_integral_hybridLightPools_heavy_le P x hu ht hB hL hp have htpBL := (blockSizes_mul_Bscale_lower n m eps hn24).1 have hexp : exp (-(tp * p) / 4) ≤ exp (-(Hconst eps : Real) * Ldeg n * y / 4) := by apply Real.exp_le_exp.mpr have hmul := mul_le_mul_of_nonneg_right htpBL (show 0 ≤ y by linarith) have hp_eq : p = B * y := by dsimp [y, p, B] field_simp [hB.ne'] rw [hp_eq] dsimp [tp, B] nlinarith [hmul] have h14 : (14 : Real) ^ Ldeg n ≤ starA ^ Ldeg n := by exact pow_le_pow_left₀ (by norm_num) (by norm_num [starA]) _ have hcancel := factorial_growth_mul_heavy_exp_le (L := Ldeg n) heps hy have hdecay : exp (-24 * (Ldeg n : Real) * y / cCirc) ≤ ((n : Real) ^ 12)⁻¹ := by have hc : 0 < cCirc := by norm_num [cCirc] have hraw : 12 * binLen n ≤ 24 * (Ldeg n : Real) * y / cCirc := by have hmul := mul_le_mul_of_nonneg_right hLbin (show 0 ≤ y by linarith) apply (le_div_iff₀ hc).2 nlinarith [mul_nonneg (show 0 ≤ (binLen n : Real) by positivity) (show 0 ≤ y by linarith)] have h12 := exp_neg_twelve_binLen_le n hn norm_num only [neg_mul] at h12 ⊢ simpa only [neg_mul, neg_div] using (Real.exp_le_exp.mpr (neg_le_neg hraw)).trans h12 have hfactor : (14 : Real) ^ Ldeg n * (1 + p / B) ^ (2 * Ldeg n) * exp (-(tp * p) / 4) ≤ ((n : Real) ^ 12)⁻¹ := by calc _ ≤ starA ^ Ldeg n * (1 + y) ^ (2 * Ldeg n) * exp (-(Hconst eps : Real) * Ldeg n * y / 4) := by dsimp [y, p, B] gcongr _ ≤ exp (-24 * (Ldeg n : Real) * y / cCirc) := hcancel _ ≤ _ := hdecay have hpi0 : 0 ≤ hybridPilotLightProbability P tp (k0 n m eps) x := measureReal_nonneg have hp0 := (cellMass_mem_unitInterval P x).1 calc _ ≤ hybridPilotLightProbability P tp (k0 n m eps) x * (p * 14 ^ Ldeg n * (1 + p / B) ^ (2 * Ldeg n)) := mul_le_mul_of_nonneg_left hmean hpi0 _ ≤ exp (-(tp * p) / 4) * (p * 14 ^ Ldeg n * (1 + p / B) ^ (2 * Ldeg n)) := by gcongr _ ≤ p * ((n : Real) ^ 12)⁻¹ := by have := mul_le_mul_of_nonneg_left hfactor hp0 nlinarith
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.calibrated_heavy_cell_light_mean_le · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridHeavyLightTail.lean:127
theorem calibrated_heavy_cell_light_secondMoment_le

C23, cellwise form: the pilot exponential cancels the polynomial growth. the stated conditions the stated conclusion.

Formal statement
d :
P :
n m :
eps :
heps :
0 < eps
hn :
1 ≤ n
hcal :
x :
Fin d
hp :
Bscale n m eps < cellMass P x
bs :
u :
bs.M0 / 8 (: Real)
tp :
(bs.np + bs.mp : Nat) / 8 (: Real)
t :
(bs.nf + bs.mf : Nat) / 8 (: Real)
hybridPilotLightProbability P tp (k0 n m eps) x * (∫ W, hybridLightPools (Ldeg n) (Bscale n m eps) u t W ^ 2 ∂ ((Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (u * markedMass P x a))).prod (Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (t * armMass P x a)))))
≤ 4 * (cellMass P x / u + cellMass P x ^ 2) * ((n : Real) ^ 12)⁻¹
Proof (Lean source)
lemma calibrated_heavy_cell_light_secondMoment_le {d : Nat} (P : DiscreteLaw d) {n m : Nat} {eps : Real} (heps : 0 < eps) (hn : 1 ≤ n) (hcal : calibrationPredicate n m eps) (x : Fin d) (hp : Bscale n m eps < cellMass P x) : let bs := blockSizes n m let u : Real := bs.M0 / 8 let tp : Real := (bs.np + bs.mp : Nat) / 8 let t : Real := (bs.nf + bs.mf : Nat) / 8 hybridPilotLightProbability P tp (k0 n m eps) x * (∫ W, hybridLightPools (Ldeg n) (Bscale n m eps) u t W ^ 2 ∂ ((Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (u * markedMass P x a))).prod (Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (t * armMass P x a))))) ≤ 4 * (cellMass P x / u + cellMass P x ^ 2) * ((n : Real) ^ 12)⁻¹ := by dsimp only let u : Real := (blockSizes n m).M0 / 8 let tp : Real := ((blockSizes n m).np + (blockSizes n m).mp : Nat) / 8 let t : Real := ((blockSizes n m).nf + (blockSizes n m).mf : Nat) / 8 obtain ⟨hu_pos, htp_pos, ht_pos, hB⟩ := calibrationPredicate_positive_parameters hcal have hL : 2 ≤ Ldeg n := Ldeg_ge_two n simp only [calibrationPredicate] at hcal rcases hcal with ⟨hn24, _hu0, _hu1, _hp0, _hp1, _hf0, _hf1, _hr0, _hr1, _hL, _htpB, htB, _hm4, _hm6, _htail, _hrat, _hlast⟩ let p := cellMass P x let B := Bscale n m eps let y := p / B have hy : 1 ≤ y := by dsimp [y, p, B] exact (le_div_iff₀ hB).2 (by linarith) have hpi := hybridPilotLightProbability_le_exp P (k0 n m eps) x htp_pos hp (k0_upper_quarter n m eps (mul_nonneg htp_pos.le hB.le)) have hsecond := integral_hybridLightPools_sq_le P x hu_pos ht_pos hB hL htB have htpBL := (blockSizes_mul_Bscale_lower n m eps hn24).1 have hexp : exp (-(tp * p) / 4) ≤ exp (-(Hconst eps : Real) * Ldeg n * y / 4) := by apply Real.exp_le_exp.mpr have hmul := mul_le_mul_of_nonneg_right htpBL (show 0 ≤ y by linarith) have hp_eq : p = B * y := by dsimp [y, p, B] field_simp [hB.ne'] rw [hp_eq] have hneg := neg_le_neg hmul have hdiv := div_le_div_of_nonneg_right hneg (by norm_num : (0 : Real) ≤ 4) dsimp [tp, B] nlinarith [hdiv] have hcancel := factorial_growth_mul_heavy_exp_le (L := Ldeg n) heps hy have hdecay : exp (-24 * (Ldeg n : Real) * y / cCirc) ≤ ((n : Real) ^ 12)⁻¹ := by have hLbin : cCirc * binLen n / 2 ≤ (Ldeg n : Real) := by simpa only [calibrationPredicate] using _hL have hc : 0 < cCirc := by norm_num [cCirc] have hbin0 : 0 ≤ (binLen n : Real) := by positivity have hraw : 12 * binLen n ≤ 24 * (Ldeg n : Real) * y / cCirc := by have := mul_le_mul_of_nonneg_right hLbin (show 0 ≤ y by linarith) apply (le_div_iff₀ hc).2 nlinarith [mul_nonneg hbin0 (show 0 ≤ y by linarith)] have h12 := exp_neg_twelve_binLen_le n hn norm_num only [neg_mul] at h12 ⊢ simpa only [neg_mul, neg_div] using (Real.exp_le_exp.mpr (neg_le_neg hraw)).trans h12 have hfactor : (starA : Real) ^ Ldeg n * (1 + p / B) ^ (2 * Ldeg n) * exp (-(tp * p) / 4) ≤ ((n : Real) ^ 12)⁻¹ := by calc _ ≤ (starA : Real) ^ Ldeg n * (1 + y) ^ (2 * Ldeg n) * exp (-(Hconst eps : Real) * Ldeg n * y / 4) := by dsimp [y, p, B] exact mul_le_mul_of_nonneg_left hexp (mul_nonneg (pow_nonneg (by positivity) _) (pow_nonneg (by positivity) _)) _ ≤ exp (-24 * (Ldeg n : Real) * y / cCirc) := hcancel _ ≤ _ := hdecay have hpi0 : 0 ≤ hybridPilotLightProbability P tp (k0 n m eps) x := MeasureTheory.measureReal_nonneg have hbase0 : 0 ≤ 4 * (p / u + p ^ 2) := by have hp0 := (cellMass_mem_unitInterval P x).1 positivity calc _ ≤ hybridPilotLightProbability P tp (k0 n m eps) x * (4 * (p / u + p ^ 2) * ((starA : Real) ^ Ldeg n * (1 + p / B) ^ (2 * Ldeg n))) := mul_le_mul_of_nonneg_left hsecond hpi0 _ ≤ exp (-(tp * p) / 4) * (4 * (p / u + p ^ 2) * ((starA : Real) ^ Ldeg n * (1 + p / B) ^ (2 * Ldeg n))) := mul_le_mul_of_nonneg_right hpi (mul_nonneg hbase0 (mul_nonneg (pow_nonneg (by positivity) _) (pow_nonneg (by positivity) _))) _ ≤ 4 * (p / u + p ^ 2) * ((n : Real) ^ 12)⁻¹ := by nlinarith [mul_le_mul_of_nonneg_left hfactor hbase0]
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.calibrated_heavy_cell_light_secondMoment_le · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridHeavyLightTail.lean:213
theorem sum_heavy_light_secondMoment_le Lemma 9 in the paper ↗

C23 summed over the truly heavy cells, without an alphabet-size factor. the stated conditions the stated conclusion.

Formal statement
d :
P :
n m :
eps :
heps :
0 < eps
hn :
1 ≤ n
hcal :
bs :
u :
bs.M0 / 8 (: Real)
tp :
(bs.np + bs.mp : Nat) / 8 (: Real)
t :
(bs.nf + bs.mf : Nat) / 8 (: Real)
(∑ x ∈ Finset.univ.filter (fun x : Fin d ↦ Bscale n m eps < cellMass P x), hybridPilotLightProbability P tp (k0 n m eps) x * (∫ W, hybridLightPools (Ldeg n) (Bscale n m eps) u t W ^ 2 ∂ ((Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (u * markedMass P x a))).prod (Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (t * armMass P x a))))))
≤ 132 * ((n : Real) ^ 12)⁻¹
Proof (Lean source)
lemma sum_heavy_light_secondMoment_le {d : Nat} (P : DiscreteLaw d) {n m : Nat} {eps : Real} (heps : 0 < eps) (hn : 1 ≤ n) (hcal : calibrationPredicate n m eps) : let bs := blockSizes n m let u : Real := bs.M0 / 8 let tp : Real := (bs.np + bs.mp : Nat) / 8 let t : Real := (bs.nf + bs.mf : Nat) / 8 (∑ x ∈ Finset.univ.filter (fun x : Fin d ↦ Bscale n m eps < cellMass P x), hybridPilotLightProbability P tp (k0 n m eps) x * (∫ W, hybridLightPools (Ldeg n) (Bscale n m eps) u t W ^ 2 ∂ ((Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (u * markedMass P x a))).prod (Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (t * armMass P x a)))))) ≤ 132 * ((n : Real) ^ 12)⁻¹ := by dsimp only classical let S : Finset (Fin d) := Finset.univ.filter (fun x ↦ Bscale n m eps < cellMass P x) let u : Real := (blockSizes n m).M0 / 8 obtain ⟨hu, _htp, _ht, _hB⟩ := calibrationPredicate_positive_parameters hcal have hnR : (0 : Real) < n := by positivity have hp0 (x : Fin d) : 0 ≤ cellMass P x := (cellMass_mem_unitInterval P x).1 have hsumAll : ∑ x : Fin d, cellMass P x = 1 := cellMass_sum_eq_one_annotation P have hsum1 : ∑ x ∈ S, cellMass P x ≤ 1 := by rw [← hsumAll] exact Finset.sum_le_sum_of_subset_of_nonneg (by simp [S]) (fun _ _ _ ↦ hp0 _) have hsq : ∑ x ∈ S, cellMass P x ^ 2 ≤ 1 := by calc _ ≤ ∑ x ∈ S, cellMass P x := Finset.sum_le_sum fun x _ ↦ by have hp1 := (cellMass_mem_unitInterval P x).2 nlinarith [mul_nonneg (hp0 x) (sub_nonneg.mpr hp1)] _ ≤ 1 := hsum1 simp only [calibrationPredicate] at hcal have hu_ratio := hcal.2.1 have hnu : (n : Real) / 32 ≤ u := by have := (le_div_iff₀ hnR).1 hu_ratio dsimp [u] nlinarith have huinv : u⁻¹ ≤ 32 := by have hu32 : (1 : Real) / 32 ≤ u := by have hn1 : (1 : Real) ≤ n := by exact_mod_cast hn nlinarith calc u⁻¹ ≤ ((1 : Real) / 32)⁻¹ := inv_anti₀ (by norm_num) hu32 _ = 32 := by norm_num have hpoint (x : Fin d) (hx : x ∈ S) := calibrated_heavy_cell_light_secondMoment_le P heps hn (show calibrationPredicate n m eps from by simpa only [calibrationPredicate] using hcal) x (by simpa [S] using (Finset.mem_filter.mp hx).2) change (∑ x ∈ S, _) ≤ _ calc _ ≤ ∑ x ∈ S, 4 * (cellMass P x / u + cellMass P x ^ 2) * ((n : Real) ^ 12)⁻¹ := Finset.sum_le_sum fun x hx ↦ hpoint x hx _ = 4 * (((∑ x ∈ S, cellMass P x) / u) + ∑ x ∈ S, cellMass P x ^ 2) * ((n : Real) ^ 12)⁻¹ := by have hdivsum : (∑ x ∈ S, cellMass P x / u) = (∑ x ∈ S, cellMass P x) / u := by rw [Finset.sum_div] rw [← hdivsum, ← Finset.sum_add_distrib, Finset.mul_sum, Finset.sum_mul] _ ≤ 132 * ((n : Real) ^ 12)⁻¹ := by have hinv0 : 0 ≤ ((n : Real) ^ 12)⁻¹ := by positivity have hsum0 : 0 ≤ ∑ x ∈ S, cellMass P x := Finset.sum_nonneg fun x _ ↦ hp0 x have hdiv : (∑ x ∈ S, cellMass P x) / u ≤ 32 := by rw [div_eq_mul_inv] calc _ ≤ 1 * u⁻¹ := mul_le_mul hsum1 le_rfl (by positivity) (by positivity) _ ≤ 1 * 32 := mul_le_mul_of_nonneg_left huinv zero_le_one _ = 32 := by norm_num nlinarith
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.sum_heavy_light_secondMoment_le · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridHeavyLightTail.lean:308
CausalSmith.Stat.STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research.Helpers.HybridHeavyMean 4 declarations Exact one-cell expectation and bias bounds for the heavy branch.

Exact one-cell expectation and bias bounds for the heavy branch.

theorem hybridHeavyArmPools_memLp

One arm of the inverse-count statistic has finite second moment. the stated conclusion.

Formal statement
d :
P :
u t :
x :
Fin d
a :
MemLp (fun W : (Bool → Nat) × (Bool → Nat) ↦ (W.1 a : Real) / u * ((W.2 false + W.2 true + 1 : Nat) : Real) / ((W.2 a + 1 : Nat) : Real)) 2 ((Measure.pi fun b : Bool ↦ poissonMeasure (toNNReal (u * markedMass P x b))).prod (Measure.pi fun b : Bool ↦ poissonMeasure (toNNReal (t * armMass P x b))))
Proof (Lean source)
lemma hybridHeavyArmPools_memLp {d : Nat} (P : DiscreteLaw d) (u t : Real) (x : Fin d) (a : Bool) : MemLp (fun W : (Bool → Nat) × (Bool → Nat) ↦ (W.1 a : Real) / u * ((W.2 false + W.2 true + 1 : Nat) : Real) / ((W.2 a + 1 : Nat) : Real)) 2 ((Measure.pi fun b : Bool ↦ poissonMeasure (toNNReal (u * markedMass P x b))).prod (Measure.pi fun b : Bool ↦ poissonMeasure (toNNReal (t * armMass P x b)))) := by let muS : Bool → Measure Nat := fun b ↦ poissonMeasure (toNNReal (u * markedMass P x b)) let muK : Bool → Measure Nat := fun b ↦ poissonMeasure (toNNReal (t * armMass P x b)) have hS : MemLp (fun S : Bool → Nat ↦ (S a : Real) / u) 2 (Measure.pi muS) := by have hbase := (memLp_descFactorial_poisson (toNNReal (u * markedMass P x a)) 1).const_mul u⁻¹ have hpull := hbase.comp_measurePreserving (measurePreserving_eval muS a) convert hpull using 1 funext S simp only [Nat.descFactorial_one, Function.comp_apply] ring have hKcoord (b : Bool) : MemLp (fun K : Bool → Nat ↦ (K b : Real)) 2 (Measure.pi muK) := by have hpull := (memLp_descFactorial_poisson (toNNReal (t * armMass P x b)) 1).comp_measurePreserving (measurePreserving_eval muK b) convert hpull using 1 funext K simp only [Nat.descFactorial_one, Function.comp_apply] have hKtotal : MemLp (fun K : Bool → Nat ↦ ((K false + K true + 1 : Nat) : Real)) 2 (Measure.pi muK) := by convert ((hKcoord false).add (hKcoord true)).add (memLp_const (1 : Real)) using 1 funext K push_cast rfl have hdom := memLp_mul_prod_two hS hKtotal apply hdom.mono (measurable_of_countable _).aestronglyMeasurable filter_upwards [] with W rw [Real.norm_eq_abs, Real.norm_eq_abs, abs_div] have hden : (1 : Real) ≤ ((W.2 a + 1 : Nat) : Real) := by exact_mod_cast Nat.le_add_left 1 (W.2 a) rw [abs_of_nonneg (by positivity : 0 ≤ ((W.2 a + 1 : Nat) : Real))] exact div_le_self (abs_nonneg _) hden
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.hybridHeavyArmPools_memLp · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridHeavyMean.lean:25
theorem integral_hybridHeavyPools_eq_armMeans

Exact one-cell identification extracted from the arm calculation in the all-heavy expectation proof. the stated conditions the stated conclusion.

Formal statement
d :
P :
x :
Fin d
u t :
hu :
0 < u
(∫ W, hybridHeavyPools u W ∂ ((Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (u * markedMass P x a))).prod (Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (t * armMass P x a)))))
Proof (Lean source)
lemma integral_hybridHeavyPools_eq_armMeans {d : Nat} (P : DiscreteLaw d) (x : Fin d) {u t : Real} (hu : 0 < u) : (∫ W, hybridHeavyPools u W ∂ ((Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (u * markedMass P x a))).prod (Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (t * armMass P x a))))) = poissonInverseArmMean P u t x true - poissonInverseArmMean P u t x false := by let muS : Bool → Measure Nat := fun a ↦ poissonMeasure (toNNReal (u * markedMass P x a)) let muK : Bool → Measure Nat := fun a ↦ poissonMeasure (toNNReal (t * armMass P x a)) let muE := (Measure.pi muS).prod (Measure.pi muK) let muPair := Measure.pi fun a : Bool ↦ (muS a).prod (muK a) let armStat (a : Bool) (W : (Bool → Nat) × (Bool → Nat)) : Real := (W.1 a : Real) / u * ((W.2 false + W.2 true + 1 : Nat) : Real) / ((W.2 a + 1 : Nat) : Real) let pairedArm (a : Bool) (K : Bool → Nat × Nat) : Real := ((K a).1 : Real) / u * (((K false).2 + (K true).2 + 1 : Nat) : Real) / (((K a).2 + 1 : Nat) : Real) have hmp : MeasurePreserving mergePairedPools muE muPair := mergePairedPools_measurePreserving muS muK have hArm (a : Bool) : (∫ W, armStat a W ∂muE) = poissonInverseArmMean P u t x a := by have htransport : (∫ W, armStat a W ∂muE) = ∫ K, pairedArm a K ∂muPair := by rw [← hmp.map_eq] rw [integral_map hmp.aemeasurable (measurable_of_countable (pairedArm a)).aestronglyMeasurable] apply integral_congr_ae filter_upwards [] with W rfl rw [htransport] let lambdaS : Bool → NNReal := fun b ↦ toNNReal (u * markedMass P x b) let lambdaK : Bool → NNReal := fun b ↦ toNNReal (t * armMass P x b) have hbase : Integrable (fun K : Bool → Nat × Nat ↦ ((K a).1 : Real) / u) muPair := by have h := (memLp_descFactorial_poisson (lambdaS a) 1).const_mul u⁻¹ have heval := measurePreserving_eval (fun b : Bool ↦ (poissonMeasure (lambdaS b)).prod (poissonMeasure (lambdaK b))) a have hp := h.comp_measurePreserving ((measurePreserving_fst (μ := poissonMeasure (lambdaS a)) (ν := poissonMeasure (lambdaK a))).comp heval) apply (hp.integrable one_le_two).congr filter_upwards [] with K simp only [Function.comp_apply, Nat.descFactorial_one, div_eq_mul_inv] ring have hfull : Integrable (pairedArm a) muPair := by have hs := hybridHeavyArmPools_memLp P u t x a have hsplit := measurePreserving_arrowProdEquivProdArrow Nat Nat Bool muS muK exact ((hs.comp_measurePreserving hsplit).integrable one_le_two).congr (by filter_upwards [] with K rfl) have hcross : Integrable (fun K : Bool → Nat × Nat ↦ ((K a).1 : Real) / u * ((K (!a)).2 : Real) * (((K a).2 + 1 : Nat) : Real)⁻¹) muPair := by apply (hfull.sub hbase).congr filter_upwards [] with K dsimp [pairedArm] cases a <;> simp only [Bool.not_false, Bool.not_true] all_goals push_cast; field_simp [hu.ne']; ring have hout := poisson_inverse_outcome_mean lambdaS lambdaK u a have hcrossMean := poisson_inverse_cross_moment lambdaS lambdaK u a rw [poissonInverseArmMean] change (∫ K, pairedArm a K ∂muPair) = _ calc _ = (∫ K, ((K a).1 : Real) / u ∂muPair) + ∫ K, ((K a).1 : Real) / u * ((K (!a)).2 : Real) * (((K a).2 + 1 : Nat) : Real)⁻¹ ∂muPair := by rw [← integral_add hbase hcross] apply integral_congr_ae filter_upwards [] with K dsimp [pairedArm] cases a <;> simp only [Bool.not_false, Bool.not_true] all_goals push_cast; field_simp [hu.ne']; ring _ = _ := by change _ = ((lambdaS a : Real) / u) * (∫ z : Nat × Nat, 1 + (z.2 : Real) * (((z.1 + 1 : Nat) : Real))⁻¹ ∂(poissonMeasure (lambdaK a)).prod (poissonMeasure (lambdaK (!a)))) rw [hout, hcrossMean, poisson_inverse_weight_mean] ring change (∫ W, armStat true W - armStat false W ∂muE) = _ rw [integral_sub ((hybridHeavyArmPools_memLp P u t x true).integrable one_le_two) ((hybridHeavyArmPools_memLp P u t x false).integrable one_le_two), hArm true, hArm false]
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.integral_hybridHeavyPools_eq_armMeans · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridHeavyMean.lean:72
theorem integral_hybridHeavyPools_bias_le

C18 in the separated-pool notation. the stated conditions the stated conclusion.

Formal statement
d :
eps :
P :
hP :
ModelClass d eps P
x :
Fin d
u t :
hu :
0 < u
ht :
0 < t
heps :
0 < eps
|(∫ W, hybridHeavyPools u W ∂ ((Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (u * markedMass P x a))).prod (Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (t * armMass P x a)))))
- cellMass P x * (outcomeMean P true x - outcomeMean P false x)|
≤ 2 * cellMass P x * exp (-eps * t * cellMass P x)
Proof (Lean source)
lemma integral_hybridHeavyPools_bias_le {d : Nat} {eps : Real} (P : DiscreteLaw d) (hP : ModelClass d eps P) (x : Fin d) {u t : Real} (hu : 0 < u) (ht : 0 < t) (heps : 0 < eps) : |(∫ W, hybridHeavyPools u W ∂ ((Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (u * markedMass P x a))).prod (Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (t * armMass P x a))))) - cellMass P x * (outcomeMean P true x - outcomeMean P false x)| ≤ 2 * cellMass P x * exp (-eps * t * cellMass P x) := by rw [integral_hybridHeavyPools_eq_armMeans P x hu] have h1 : |poissonInverseArmMean P u t x true - cellMass P x * outcomeMean P true x| ≤ cellMass P x * exp (-eps * t * cellMass P x) := by simpa [poissonInverseArmMean] using poisson_inverse_arm_mean_envelope P hP x true hu ht heps have h0 : |poissonInverseArmMean P u t x false - cellMass P x * outcomeMean P false x| ≤ cellMass P x * exp (-eps * t * cellMass P x) := by simpa [poissonInverseArmMean] using poisson_inverse_arm_mean_envelope P hP x false hu ht heps calc |poissonInverseArmMean P u t x true - poissonInverseArmMean P u t x false - cellMass P x * (outcomeMean P true x - outcomeMean P false x)| = |(poissonInverseArmMean P u t x true - cellMass P x * outcomeMean P true x) - (poissonInverseArmMean P u t x false - cellMass P x * outcomeMean P false x)| := by congr 1 <;> ring _ ≤ |poissonInverseArmMean P u t x true - cellMass P x * outcomeMean P true x| + |poissonInverseArmMean P u t x false - cellMass P x * outcomeMean P false x| := abs_sub _ _ _ ≤ _ := by nlinarith
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.integral_hybridHeavyPools_bias_le · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridHeavyMean.lean:165
theorem abs_integral_hybridHeavyPools_le_three_cellMass

The heavy-cell mean is at most three times the cell mass in absolute value. the stated conditions the stated conclusion.

Formal statement
d :
eps :
P :
hP :
ModelClass d eps P
x :
Fin d
u t :
hu :
0 < u
ht :
0 < t
heps :
0 < eps
muE :
((Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (u * markedMass P x a))).prod (Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (t * armMass P x a))))
abs (∫ W, hybridHeavyPools u W ∂muE) ≤ 3 * cellMass P x
Proof (Lean source)
lemma abs_integral_hybridHeavyPools_le_three_cellMass {d : Nat} {eps : Real} (P : DiscreteLaw d) (hP : ModelClass d eps P) (x : Fin d) {u t : Real} (hu : 0 < u) (ht : 0 < t) (heps : 0 < eps) : let muE := ((Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (u * markedMass P x a))).prod (Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (t * armMass P x a)))) abs (∫ W, hybridHeavyPools u W ∂muE) ≤ 3 * cellMass P x := by dsimp only let muE := ((Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (u * markedMass P x a))).prod (Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (t * armMass P x a)))) change abs (∫ W, hybridHeavyPools u W ∂muE) ≤ 3 * cellMass P x let theta := cellMass P x * (outcomeMean P true x - outcomeMean P false x) have hb := integral_hybridHeavyPools_bias_le P hP x hu ht heps have hp0 := (cellMass_mem_unitInterval P x).1 have htheta : |theta| ≤ cellMass P x := by dsimp [theta] rw [abs_mul, abs_of_nonneg hp0] apply mul_le_of_le_one_right hp0 rw [abs_le] rcases outcomeMean_mem_unitInterval P true x with ⟨h10, h11⟩ rcases outcomeMean_mem_unitInterval P false x with ⟨h00, h01⟩ constructor <;> linarith have hexp : exp (-eps * t * cellMass P x) ≤ 1 := by rw [← Real.exp_zero] apply Real.exp_le_exp.mpr have := mul_nonneg (mul_nonneg heps.le ht.le) hp0 linarith have htri : abs (∫ W, hybridHeavyPools u W ∂muE) ≤ abs ((∫ W, hybridHeavyPools u W ∂muE) - theta) + |theta| := by calc abs _ = abs (((_ - theta) + theta)) := by congr 1 <;> ring _ ≤ _ := abs_add_le _ _ change abs ((∫ W, hybridHeavyPools u W ∂muE) - theta) ≤ 2 * cellMass P x * exp (-eps * t * cellMass P x) at hb have hprod : 2 * cellMass P x * exp (-eps * t * cellMass P x) ≤ 2 * cellMass P x := by nlinarith [mul_le_mul_of_nonneg_left hexp (show 0 ≤ 2 * cellMass P x by positivity)] linarith
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.abs_integral_hybridHeavyPools_le_three_cellMass · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridHeavyMean.lean:200
CausalSmith.Stat.STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research.Helpers.HybridHeavyTransport 8 declarations Transport of the all-heavy statistic to separated arm-count pools.

Transport of the all-heavy statistic to separated arm-count pools.

def SeparatedPoissonCounts

The outcome and marginal counts separated within every covariate cell. the stated conditions the stated conclusion.

Definition (Lean source)
d :
SeparatedPoissonCounts d :
Type
Fin d → (Bool → Nat) × (Bool → Nat)
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.SeparatedPoissonCounts · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridHeavyTransport.lean:13
def separatedPoissonCountLaw

Product law of the separated outcome and marginal pools. the stated conditions the stated conclusion.

Definition (Lean source)
d :
P :
u t :
separatedPoissonCountLaw P u t :
Measure.pi fun x : Fin d ↦ (Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (u * markedMass P x a))).prod (Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (t * armMass P x a)))
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.separatedPoissonCountLaw · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridHeavyTransport.lean:17
def separatedInverseCountStatistic

All-heavy inverse-count statistic written on separated pools. the stated conditions the stated conclusion.

Definition (Lean source)
separatedInverseCountStatistic u W :
∑ x : Fin d, ((W x).1 true / u * ((W x).2 false + (W x).2 true + 1 : Nat) / ((W x).2 true + 1 : Nat) - (W x).1 false / u * ((W x).2 false + (W x).2 true + 1 : Nat) / ((W x).2 false + 1 : Nat))
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.separatedInverseCountStatistic · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridHeavyTransport.lean:26
theorem separatedInverseCountStatistic_split_apply

The formal statement establishes the stated conclusion.

Formal statement
Proof (Lean source)
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.separatedInverseCountStatistic_split_apply · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridHeavyTransport.lean:34
theorem poissonCountLaw_split_measurePreserving

Splitting paired counts identifies the heavy product experiment. the stated conclusion.

Formal statement
d :
P :
u t :
Proof (Lean source)
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.poissonCountLaw_split_measurePreserving · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridHeavyTransport.lean:42
theorem integral_separatedInverseCountStatistic

The formal statement establishes the stated conclusion.

Formal statement
d :
P :
u t :
(∫ W, separatedInverseCountStatistic u W ∂separatedPoissonCountLaw P u t)
Proof (Lean source)
lemma integral_separatedInverseCountStatistic {d : Nat} (P : DiscreteLaw d) (u t : Real) : (∫ W, separatedInverseCountStatistic u W ∂separatedPoissonCountLaw P u t) = expectationUnder (poissonCountLaw P u t) (inverseCountStatistic u) := by let hmp := poissonCountLaw_split_measurePreserving P u t rw [← hmp.map_eq] rw [integral_map hmp.aemeasurable (measurable_of_countable (separatedInverseCountStatistic u)).aestronglyMeasurable] simp_rw [separatedInverseCountStatistic_split_apply] rfl
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.integral_separatedInverseCountStatistic · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridHeavyTransport.lean:49
theorem variance_separatedInverseCountStatistic

The formal statement establishes the stated conclusion.

Formal statement
Proof (Lean source)
lemma variance_separatedInverseCountStatistic {d : Nat} (P : DiscreteLaw d) (u t : Real) : Var[separatedInverseCountStatistic u; separatedPoissonCountLaw P u t] = varianceUnder (poissonCountLaw P u t) (inverseCountStatistic u) := by let hmp := poissonCountLaw_split_measurePreserving P u t rw [← hmp.variance_fun_comp (measurable_of_countable (separatedInverseCountStatistic u)).aemeasurable] rw [show (fun ω ↦ separatedInverseCountStatistic u (splitPairedCellPools ω)) = inverseCountStatistic u by funext K exact separatedInverseCountStatistic_split_apply u K] exact (varianceUnder_eq_variance _ _ (measurable_of_countable _).aemeasurable).symm
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.variance_separatedInverseCountStatistic · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridHeavyTransport.lean:62
theorem separated_inverse_count_risk

Existing all-heavy risk control, transported to separated pools. the stated conditions the stated conclusion.

Formal statement
eps :
heps :
0 < eps
heps2 :
eps < 1 / 2
∃ C : Real,
0 < C
conclusion 1
d :
u t :
0 < u
0 < t
P :
ModelClass d eps P
|(∫ W, separatedInverseCountStatistic u W ∂separatedPoissonCountLaw P u t)
≤ C * min 1 (d / t)
Var[separatedInverseCountStatistic u; separatedPoissonCountLaw P u t] ≤ C * (u⁻¹ + t⁻¹)
Proof (Lean source)
lemma separated_inverse_count_risk {eps : Real} (heps : 0 < eps) (heps2 : eps < 1 / 2) : ∃ C : Real, 0 < C ∧ ∀ (d : Nat) (u t : Real), 0 < u → 0 < t → ∀ P : DiscreteLaw d, ModelClass d eps P → |(∫ W, separatedInverseCountStatistic u W ∂separatedPoissonCountLaw P u t) - ateFunctional P| ≤ C * min 1 (d / t) ∧ Var[separatedInverseCountStatistic u; separatedPoissonCountLaw P u t] ≤ C * (u⁻¹ + t⁻¹) := by obtain ⟨C, hC, h⟩ := poisson_inverse_count_risk heps heps2 refine ⟨C, hC, ?_⟩ intro d u t hu ht P hP simpa [integral_separatedInverseCountStatistic, variance_separatedInverseCountStatistic] using h d u t hu ht P hP
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.separated_inverse_count_risk · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridHeavyTransport.lean:77
CausalSmith.Stat.STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research.Helpers.HybridLightAggregate 3 declarations Aggregate-ready second-moment bound for a light cell.

Aggregate-ready second-moment bound for a light cell.

theorem integral_hybridLightPools_sq_le_of_cellMass_le

C28 specialized to a cell below the bandwidth. the stated conditions the stated conclusion.

Formal statement
d :
P :
x :
Fin d
u t B :
L :
hu :
0 < u
ht :
0 < t
hB :
0 < B
hL :
2 ≤ L
htB :
(L : Real) ≤ t * B
hcell :
cellMass P x ≤ B
(∫ W, hybridLightPools L B u t W ^ 2 ∂ ((Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (u * markedMass P x a))).prod (Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (t * armMass P x a)))))
≤ 4 * (cellMass P x / u + cellMass P x ^ 2) * starA ^ L
Proof (Lean source)
lemma integral_hybridLightPools_sq_le_of_cellMass_le {d : Nat} (P : DiscreteLaw d) (x : Fin d) {u t B : Real} {L : Nat} (hu : 0 < u) (ht : 0 < t) (hB : 0 < B) (hL : 2 ≤ L) (htB : (L : Real) ≤ t * B) (hcell : cellMass P x ≤ B) : (∫ W, hybridLightPools L B u t W ^ 2 ∂ ((Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (u * markedMass P x a))).prod (Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (t * armMass P x a))))) ≤ 4 * (cellMass P x / u + cellMass P x ^ 2) * starA ^ L := by have hs0 : 0 ≤ armMass P x false := Finset.sum_nonneg fun y _ ↦ (jointMass_mem_unitInterval P x false y).1 have hs1 : 0 ≤ armMass P x true := Finset.sum_nonneg fun y _ ↦ (jointMass_mem_unitInterval P x true y).1 have hsum : armMass P x false + armMass P x true = cellMass P x := by simp [armMass, cellMass] ring apply integral_hybridLightPools_sq_le_of_moment P x hu (by positivity) intro a have h := (explicit_chebyshev_calibration L hL).2.2.1 a t B (armMass P x false) (armMass P x true) ht hB hs0 hs1 htB have hpB : armMass P x false + armMass P x true ≤ B := by rw [hsum] exact hcell simpa [starA] using h.2 hpB
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.integral_hybridLightPools_sq_le_of_cellMass_le · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridLightAggregate.lean:108
theorem integral_hybridLightPools_sq_le

C21 in the exact separated-pool notation. the stated conditions the stated conclusion.

Formal statement
d :
P :
x :
Fin d
u t B :
L :
hu :
0 < u
ht :
0 < t
hB :
0 < B
hL :
2 ≤ L
htB :
(L : Real) ≤ t * B
(∫ W, hybridLightPools L B u t W ^ 2 ∂ ((Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (u * markedMass P x a))).prod (Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (t * armMass P x a)))))
≤ 4 * (cellMass P x / u + cellMass P x ^ 2) * (starA ^ L * (1 + cellMass P x / B) ^ (2 * L))
Proof (Lean source)
lemma integral_hybridLightPools_sq_le {d : Nat} (P : DiscreteLaw d) (x : Fin d) {u t B : Real} {L : Nat} (hu : 0 < u) (ht : 0 < t) (hB : 0 < B) (hL : 2 ≤ L) (htB : (L : Real) ≤ t * B) : (∫ W, hybridLightPools L B u t W ^ 2 ∂ ((Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (u * markedMass P x a))).prod (Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (t * armMass P x a))))) ≤ 4 * (cellMass P x / u + cellMass P x ^ 2) * (starA ^ L * (1 + cellMass P x / B) ^ (2 * L)) := by have hs0 : 0 ≤ armMass P x false := Finset.sum_nonneg fun y _ ↦ (jointMass_mem_unitInterval P x false y).1 have hs1 : 0 ≤ armMass P x true := Finset.sum_nonneg fun y _ ↦ (jointMass_mem_unitInterval P x true y).1 have hsum : armMass P x false + armMass P x true = cellMass P x := by simp [armMass, cellMass] ring apply integral_hybridLightPools_sq_le_of_moment P x hu (mul_nonneg (pow_nonneg (by positivity) _) (pow_nonneg (add_nonneg zero_le_one (div_nonneg (cellMass_mem_unitInterval P x).1 hB.le)) _)) intro a have h := (explicit_chebyshev_calibration L hL).2.2.1 a t B (armMass P x false) (armMass P x true) ht hB hs0 hs1 htB simpa [starA, hsum] using h.1
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.integral_hybridLightPools_sq_le · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridLightAggregate.lean:135
theorem sum_light_secondMoment_le

Summed C29 envelope over all cells whose mass is at most the bandwidth. the stated conditions the stated conclusion.

Formal statement
d :
P :
u t B :
L :
hu :
0 < u
ht :
0 < t
hB :
0 < B
hL :
2 ≤ L
htB :
(L : Real) ≤ t * B
(∑ x ∈ Finset.univ.filter (fun x : Fin d ↦ cellMass P x ≤ B), ∫ W, hybridLightPools L B u t W ^ 2 ∂ ((Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (u * markedMass P x a))).prod (Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (t * armMass P x a)))))
≤ 4 * starA ^ L * (min 1 ((d : Real) * B) / u + (d : Real) * B ^ 2)
Proof (Lean source)
lemma sum_light_secondMoment_le {d : Nat} (P : DiscreteLaw d) {u t B : Real} {L : Nat} (hu : 0 < u) (ht : 0 < t) (hB : 0 < B) (hL : 2 ≤ L) (htB : (L : Real) ≤ t * B) : (∑ x ∈ Finset.univ.filter (fun x : Fin d ↦ cellMass P x ≤ B), ∫ W, hybridLightPools L B u t W ^ 2 ∂ ((Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (u * markedMass P x a))).prod (Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (t * armMass P x a))))) ≤ 4 * starA ^ L * (min 1 ((d : Real) * B) / u + (d : Real) * B ^ 2) := by classical let S : Finset (Fin d) := Finset.univ.filter fun x ↦ cellMass P x ≤ B have hp0 (x : Fin d) : 0 ≤ cellMass P x := (cellMass_mem_unitInterval P x).1 have hsumAll : ∑ x : Fin d, cellMass P x = 1 := cellMass_sum_eq_one_annotation P have hsum0 : 0 ≤ ∑ x ∈ S, cellMass P x := Finset.sum_nonneg fun x _ ↦ hp0 x have hsum1 : ∑ x ∈ S, cellMass P x ≤ 1 := by rw [← hsumAll] exact Finset.sum_le_sum_of_subset_of_nonneg (by simp [S]) (fun _ _ _ ↦ hp0 _) have hsumB : ∑ x ∈ S, cellMass P x ≤ (d : Real) * B := by calc _ ≤ ∑ _x ∈ S, B := Finset.sum_le_sum fun x hx ↦ by simpa [S] using (Finset.mem_filter.mp hx).2 _ = (S.card : Real) * B := by simp _ ≤ (d : Real) * B := by exact mul_le_mul_of_nonneg_right (by exact_mod_cast (by simpa using S.card_le_univ : S.card ≤ d)) hB.le have hsumMin : ∑ x ∈ S, cellMass P x ≤ min 1 ((d : Real) * B) := le_min hsum1 hsumB have hsq : ∑ x ∈ S, cellMass P x ^ 2 ≤ (d : Real) * B ^ 2 := by calc _ ≤ ∑ _x ∈ S, B ^ 2 := Finset.sum_le_sum fun x hx ↦ by have hle : cellMass P x ≤ B := by simpa [S] using (Finset.mem_filter.mp hx).2 nlinarith [mul_nonneg (sub_nonneg.mpr hle) (add_nonneg hB.le (hp0 x))] _ = (S.card : Real) * B ^ 2 := by simp _ ≤ (d : Real) * B ^ 2 := by exact mul_le_mul_of_nonneg_right (by exact_mod_cast (by simpa using S.card_le_univ : S.card ≤ d)) (sq_nonneg B) have hpoint (x : Fin d) (hx : x ∈ S) : (∫ W, hybridLightPools L B u t W ^ 2 ∂ ((Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (u * markedMass P x a))).prod (Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (t * armMass P x a))))) ≤ 4 * (cellMass P x / u + cellMass P x ^ 2) * starA ^ L := by apply integral_hybridLightPools_sq_le_of_cellMass_le P x hu ht hB hL htB simpa [S] using (Finset.mem_filter.mp hx).2 change (∑ x ∈ S, _) ≤ _ calc _ ≤ ∑ x ∈ S, 4 * (cellMass P x / u + cellMass P x ^ 2) * starA ^ L := Finset.sum_le_sum fun x hx ↦ hpoint x hx _ = 4 * starA ^ L * ((∑ x ∈ S, cellMass P x) / u + ∑ x ∈ S, cellMass P x ^ 2) := by have hdivsum : (∑ x ∈ S, cellMass P x / u) = (∑ x ∈ S, cellMass P x) / u := by rw [Finset.sum_div] rw [← hdivsum, ← Finset.sum_add_distrib, Finset.mul_sum] apply Finset.sum_congr rfl intro x _ ring _ ≤ 4 * starA ^ L * (min 1 ((d : Real) * B) / u + (d : Real) * B ^ 2) := by apply mul_le_mul_of_nonneg_left _ (by positivity) exact add_le_add (div_le_div_of_nonneg_right hsumMin hu.le) hsq
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.sum_light_secondMoment_le · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridLightAggregate.lean:163
CausalSmith.Stat.STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research.Helpers.HybridLightBounds 3 declarations Deterministic and moment bounds for one polynomial (light-cell) branch.

Deterministic and moment bounds for one polynomial (light-cell) branch.

theorem light_mean_error_identity

The exact algebraic form of (C16), separated from the probabilistic factorial-moment calculation. the stated conditions the stated conclusion.

Formal statement
p B s0 s1 mu0 mu1 e0 e1 g0 g1 :
hp :
p = s0 + s1
h0 :
s0 / B * g0 + e0 = 1
h1 :
s1 / B * g1 + e1 = 1
s1 * mu1 * (p / B) * g1 - s0 * mu0 * (p / B) * g0
= p * (mu1 - mu0) - p * (mu1 * e1 - mu0 * e0)
Proof (Lean source)
lemma light_mean_error_identity {p B s0 s1 mu0 mu1 e0 e1 g0 g1 : Real} (hp : p = s0 + s1) (h0 : s0 / B * g0 + e0 = 1) (h1 : s1 / B * g1 + e1 = 1) : s1 * mu1 * (p / B) * g1 - s0 * mu0 * (p / B) * g0 = p * (mu1 - mu0) - p * (mu1 * e1 - mu0 * e0) := by rw [hp] linear_combination (s0 + s1) * mu1 * h1 - (s0 + s1) * mu0 * h0
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.light_mean_error_identity · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridLightBounds.lean:13
theorem light_arm_bias_le

One arm of the light-cell approximation error, after using overlap to cancel the cell mass against the Chebyshev reciprocal bound. the stated conditions the stated conclusion.

Formal statement
eps p B s e :
L :
heps :
0 < eps
hp :
0 ≤ p
hB :
0 < B
hL :
0 < L
hs :
eps * p ≤ s
he :
0 ≤ e
heInv :
e ≤ (((L : Real) ^ 2 * (s / B))⁻¹)
p * e ≤ B / (eps * (L : Real) ^ 2)
Proof (Lean source)
lemma light_arm_bias_le {eps p B s e : Real} {L : Nat} (heps : 0 < eps) (hp : 0 ≤ p) (hB : 0 < B) (hL : 0 < L) (hs : eps * p ≤ s) (he : 0 ≤ e) (heInv : e ≤ (((L : Real) ^ 2 * (s / B))⁻¹)) : p * e ≤ B / (eps * (L : Real) ^ 2) := by by_cases hp0 : p = 0 · simp [hp0, div_nonneg hB.le (mul_nonneg heps.le (sq_nonneg _))] have hpPos : 0 < p := lt_of_le_of_ne hp (Ne.symm hp0) have hsPos : 0 < s := lt_of_lt_of_le (mul_pos heps hpPos) hs have hLReal : 0 < (L : Real) := by exact_mod_cast hL have hden : 0 < (L : Real) ^ 2 * (s / B) := by positivity have heScaled : e * ((L : Real) ^ 2 * (s / B)) ≤ 1 := by rw [inv_eq_one_div] at heInv exact (le_div_iff₀ hden).mp heInv have hraw : e * (L : Real) ^ 2 * s ≤ B := by calc e * (L : Real) ^ 2 * s = (e * ((L : Real) ^ 2 * (s / B))) * B := by field_simp _ ≤ 1 * B := mul_le_mul_of_nonneg_right heScaled hB.le _ = B := one_mul B have hoverlap : e * (L : Real) ^ 2 * (eps * p) ≤ e * (L : Real) ^ 2 * s := by gcongr apply (le_div_iff₀ (mul_pos heps (sq_pos_of_pos hLReal))).2 nlinarith [hoverlap.trans hraw]
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.light_arm_bias_le · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridLightBounds.lean:25
theorem light_cell_bias_abs_le

Two-arm form of (C17). the stated conditions the stated conclusion.

Formal statement
eps p B s0 s1 mu0 mu1 e0 e1 :
L :
heps :
0 < eps
hp :
0 ≤ p
hB :
0 < B
hL :
0 < L
hs0 :
eps * p ≤ s0
hs1 :
eps * p ≤ s1
hmu0 :
mu0 ∈ Icc (0 : Real) 1
hmu1 :
mu1 ∈ Icc (0 : Real) 1
he0 :
0 ≤ e0
he1 :
0 ≤ e1
heInv0 :
e0 ≤ (((L : Real) ^ 2 * (s0 / B))⁻¹)
heInv1 :
e1 ≤ (((L : Real) ^ 2 * (s1 / B))⁻¹)
|p * (mu1 * e1 - mu0 * e0)| ≤ 2 * B / (eps * (L : Real) ^ 2)
Proof (Lean source)
lemma light_cell_bias_abs_le {eps p B s0 s1 mu0 mu1 e0 e1 : Real} {L : Nat} (heps : 0 < eps) (hp : 0 ≤ p) (hB : 0 < B) (hL : 0 < L) (hs0 : eps * p ≤ s0) (hs1 : eps * p ≤ s1) (hmu0 : mu0 ∈ Icc (0 : Real) 1) (hmu1 : mu1 ∈ Icc (0 : Real) 1) (he0 : 0 ≤ e0) (he1 : 0 ≤ e1) (heInv0 : e0 ≤ (((L : Real) ^ 2 * (s0 / B))⁻¹)) (heInv1 : e1 ≤ (((L : Real) ^ 2 * (s1 / B))⁻¹)) : |p * (mu1 * e1 - mu0 * e0)| ≤ 2 * B / (eps * (L : Real) ^ 2) := by have h0 := light_arm_bias_le heps hp hB hL hs0 he0 heInv0 have h1 := light_arm_bias_le heps hp hB hL hs1 he1 heInv1 let R := B / (eps * (L : Real) ^ 2) have hR : 0 ≤ R := by dsimp [R]; positivity have hm0 : 0 ≤ p * (mu0 * e0) := mul_nonneg hp (mul_nonneg hmu0.1 he0) have hm1 : 0 ≤ p * (mu1 * e1) := mul_nonneg hp (mul_nonneg hmu1.1 he1) have hb0 : p * (mu0 * e0) ≤ R := by calc p * (mu0 * e0) = mu0 * (p * e0) := by ring _ ≤ 1 * R := mul_le_mul hmu0.2 h0 (mul_nonneg hp he0) (by norm_num) _ = R := one_mul R have hb1 : p * (mu1 * e1) ≤ R := by calc p * (mu1 * e1) = mu1 * (p * e1) := by ring _ ≤ 1 * R := mul_le_mul hmu1.2 h1 (mul_nonneg hp he1) (by norm_num) _ = R := one_mul R calc |p * (mu1 * e1 - mu0 * e0)| = |p * (mu1 * e1) - p * (mu0 * e0)| := by ring_nf _ ≤ |p * (mu1 * e1)| + |p * (mu0 * e0)| := abs_sub _ _ _ = p * (mu1 * e1) + p * (mu0 * e0) := by rw [abs_of_nonneg hm1, abs_of_nonneg hm0] _ ≤ 2 * R := by linarith _ = 2 * B / (eps * (L : Real) ^ 2) := by dsimp [R]; ring
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.light_cell_bias_abs_le · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridLightBounds.lean:54
CausalSmith.Stat.STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research.Helpers.HybridLightMoments 5 declarations Exact one-cell identities for the light factorial branch.

Exact one-cell identities for the light factorial branch.

theorem factorialLift_memLp

The finite factorial polynomial has a finite second moment under two independent Poisson counts. the stated conclusion.

Formal statement
a :
L :
B t s0 s1 :
MemLp (fun K : Nat × Nat ↦ factorialLift a L B t K.1 K.2) 2 ((poissonMeasure (toNNReal (t * s0))).prod (poissonMeasure (toNNReal (t * s1))))
Proof (Lean source)
lemma factorialLift_memLp (a : Bool) (L : Nat) (B t s0 s1 : Real) : MemLp (fun K : Nat × Nat ↦ factorialLift a L B t K.1 K.2) 2 ((poissonMeasure (toNNReal (t * s0))).prod (poissonMeasure (toNNReal (t * s1)))) := by unfold factorialLift apply memLp_finsetSum intro j hj let mu0 := poissonMeasure (toNNReal (t * s0)) let mu1 := poissonMeasure (toNNReal (t * s1)) cases a · have hmain := memLp_mul_prod_nat (memLp_descFactorial_poisson (toNNReal (t * s0)) (j + 1)) (memLp_const (1 : Real) : MemLp (fun _ : Nat ↦ (1 : Real)) 2 mu1) have hcross := memLp_mul_prod_nat (memLp_descFactorial_poisson (toNNReal (t * s0)) j) (memLp_descFactorial_poisson (toNNReal (t * s1)) 1) convert (hmain.add hcross).const_mul ((chebG L).coeff j / (t * B) ^ (j + 1)) using 1 funext K simp only [Bool.false_eq_true, ↓reduceIte, Nat.descFactorial_one, Pi.add_apply, Nat.add_comm] ring · have hmain := memLp_mul_prod_nat (memLp_const (1 : Real) : MemLp (fun _ : Nat ↦ (1 : Real)) 2 mu0) (memLp_descFactorial_poisson (toNNReal (t * s1)) (j + 1)) have hcross := memLp_mul_prod_nat (memLp_descFactorial_poisson (toNNReal (t * s0)) 1) (memLp_descFactorial_poisson (toNNReal (t * s1)) j) convert (hmain.add hcross).const_mul ((chebG L).coeff j / (t * B) ^ (j + 1)) using 1 funext K simp only [↓reduceIte, Nat.descFactorial_one, Pi.add_apply, Nat.add_comm] ring
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.factorialLift_memLp · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridLightMoments.lean:22
theorem integral_factorialLift

The factorial lift is unbiased for the polynomial light-cell continuation. the stated conditions the stated conclusion.

Formal statement
a :
L :
B t s0 s1 :
ht :
0 < t
hB :
0 < B
hs0 :
0 ≤ s0
hs1 :
0 ≤ s1
(∫ K : Nat × Nat, factorialLift a L B t K.1 K.2 ∂ (poissonMeasure (toNNReal (t * s0))).prod (poissonMeasure (toNNReal (t * s1))))
= (s0 + s1) / B * (chebG L).eval ((if a then s1 else s0) / B)
Proof (Lean source)
lemma integral_factorialLift (a : Bool) (L : Nat) {B t s0 s1 : Real} (ht : 0 < t) (hB : 0 < B) (hs0 : 0 ≤ s0) (hs1 : 0 ≤ s1) : (∫ K : Nat × Nat, factorialLift a L B t K.1 K.2 ∂ (poissonMeasure (toNNReal (t * s0))).prod (poissonMeasure (toNNReal (t * s1)))) = (s0 + s1) / B * (chebG L).eval ((if a then s1 else s0) / B) := by unfold factorialLift rw [integral_finset_sum] · rw [eval_eq_sum] simp only [Polynomial.sum, Finset.mul_sum] apply Finset.sum_congr rfl intro j hj rw [integral_const_mul] cases a · simp only [Bool.false_eq_true, ↓reduceIte] have hterm := integral_factorialLift_term (B := B) false j ht hs0 hs1 simp only [Bool.false_eq_true, ↓reduceIte] at hterm rw [hterm] simp only [div_pow] rw [pow_succ] field_simp [ne_of_gt ht, ne_of_gt hB] ring · simp only [↓reduceIte] have hterm := integral_factorialLift_term (B := B) true j ht hs0 hs1 simp only [↓reduceIte] at hterm rw [hterm] simp only [div_pow] rw [pow_succ] field_simp [ne_of_gt ht, ne_of_gt hB] ring · intro j hj cases a · apply (factorialLift_term_integrable (L := L) (s0 := s0) (s1 := s1) false j ht hB).congr filter_upwards with K simp only [Bool.false_eq_true, ↓reduceIte] ring · apply (factorialLift_term_integrable (L := L) (s0 := s0) (s1 := s1) true j ht hB).congr filter_upwards with K simp only [↓reduceIte] ring
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.integral_factorialLift · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridLightMoments.lean:178
def lightArmCell

One arm's light contribution, separating its marked count from the two factorial arm counts. the stated conditions the stated conclusion.

Definition (Lean source)
a :
L :
B u t :
Z :
Nat × (Nat × Nat)
lightArmCell a L B u t Z :
(Z.1 : Real) / u * factorialLift a L B t Z.2.1 Z.2.2
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.lightArmCell · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridLightMoments.lean:222
theorem integral_lightArmCell

Exact mean of one light arm contribution. the stated conditions the stated conclusion.

Formal statement
a :
L :
B u t marked s0 s1 :
hu :
0 < u
ht :
0 < t
hB :
0 < B
hmarked :
0 ≤ marked
hs0 :
0 ≤ s0
hs1 :
0 ≤ s1
(∫ Z : Nat × (Nat × Nat), lightArmCell a L B u t Z ∂ (poissonMeasure (toNNReal (u * marked))).prod ((poissonMeasure (toNNReal (t * s0))).prod (poissonMeasure (toNNReal (t * s1)))))
= marked * ((s0 + s1) / B) * (chebG L).eval ((if a then s1 else s0) / B)
Proof (Lean source)
lemma integral_lightArmCell (a : Bool) (L : Nat) {B u t marked s0 s1 : Real} (hu : 0 < u) (ht : 0 < t) (hB : 0 < B) (hmarked : 0 ≤ marked) (hs0 : 0 ≤ s0) (hs1 : 0 ≤ s1) : (∫ Z : Nat × (Nat × Nat), lightArmCell a L B u t Z ∂ (poissonMeasure (toNNReal (u * marked))).prod ((poissonMeasure (toNNReal (t * s0))).prod (poissonMeasure (toNNReal (t * s1))))) = marked * ((s0 + s1) / B) * (chebG L).eval ((if a then s1 else s0) / B) := by rw [show (∫ Z : Nat × (Nat × Nat), lightArmCell a L B u t Z ∂ (poissonMeasure (toNNReal (u * marked))).prod ((poissonMeasure (toNNReal (t * s0))).prod (poissonMeasure (toNNReal (t * s1))))) = (∫ S : Nat, (S : Real) / u ∂poissonMeasure (toNNReal (u * marked))) * ∫ K : Nat × Nat, factorialLift a L B t K.1 K.2 ∂ (poissonMeasure (toNNReal (t * s0))).prod (poissonMeasure (toNNReal (t * s1))) by exact integral_prod_mul (fun S : Nat ↦ (S : Real) / u) (fun K : Nat × Nat ↦ factorialLift a L B t K.1 K.2)] rw [integral_div] have hfirst : (∫ S : Nat, (S : Real) ∂poissonMeasure (toNNReal (u * marked))) = (toNNReal (u * marked) : Real) := by simpa using integral_descFactorial_poisson (toNNReal (u * marked)) 1 rw [hfirst, integral_factorialLift a L ht hB hs0 hs1] rw [Real.coe_toNNReal _ (mul_nonneg hu.le hmarked)] field_simp
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.integral_lightArmCell · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridLightMoments.lean:228
theorem integral_lightArmCell_sq

Exact second-moment factorization for one light arm contribution. the stated conditions the stated conclusion.

Formal statement
a :
L :
B u t marked s0 s1 :
hu :
0 < u
hmarked :
0 ≤ marked
(∫ Z : Nat × (Nat × Nat), lightArmCell a L B u t Z ^ 2 ∂ (poissonMeasure (toNNReal (u * marked))).prod ((poissonMeasure (toNNReal (t * s0))).prod (poissonMeasure (toNNReal (t * s1)))))
= (marked / u + marked ^ 2) * factorialLiftSecondMoment a L B t s0 s1
Proof (Lean source)
lemma integral_lightArmCell_sq (a : Bool) (L : Nat) {B u t marked s0 s1 : Real} (hu : 0 < u) (hmarked : 0 ≤ marked) : (∫ Z : Nat × (Nat × Nat), lightArmCell a L B u t Z ^ 2 ∂ (poissonMeasure (toNNReal (u * marked))).prod ((poissonMeasure (toNNReal (t * s0))).prod (poissonMeasure (toNNReal (t * s1))))) = (marked / u + marked ^ 2) * factorialLiftSecondMoment a L B t s0 s1 := by rw [show (∫ Z : Nat × (Nat × Nat), lightArmCell a L B u t Z ^ 2 ∂ (poissonMeasure (toNNReal (u * marked))).prod ((poissonMeasure (toNNReal (t * s0))).prod (poissonMeasure (toNNReal (t * s1))))) = (∫ S : Nat, ((S : Real) / u) ^ 2 ∂ poissonMeasure (toNNReal (u * marked))) * ∫ K : Nat × Nat, factorialLift a L B t K.1 K.2 ^ 2 ∂ (poissonMeasure (toNNReal (t * s0))).prod (poissonMeasure (toNNReal (t * s1))) by simpa [lightArmCell, mul_pow] using integral_prod_mul (fun S : Nat ↦ ((S : Real) / u) ^ 2) (fun K : Nat × Nat ↦ factorialLift a L B t K.1 K.2 ^ 2)] rw [show (∫ S : Nat, ((S : Real) / u) ^ 2 ∂ poissonMeasure (toNNReal (u * marked))) = ∫ S : Nat, (S : Real) ^ 2 / u ^ 2 ∂ poissonMeasure (toNNReal (u * marked)) by congr 1 funext S ring] rw [integral_div, integral_natCast_sq_poisson] unfold factorialLiftSecondMoment rw [Real.coe_toNNReal _ (mul_nonneg hu.le hmarked)] field_simp
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.integral_lightArmCell_sq · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridLightMoments.lean:256
CausalSmith.Stat.STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research.Helpers.HybridLogSchedule 10 declarations Logarithmic comparisons for the paper's binary degree schedule.

Logarithmic comparisons for the paper's binary degree schedule.

theorem log_two_le_one

The formal statement establishes the stated conclusion.

Formal statement
log (2 : Real) ≤ 1
Proof (Lean source)
lemma log_two_le_one : log (2 : Real) ≤ 1 := by rw [← Real.log_exp 1] exact Real.strictMonoOn_log.monotoneOn (by norm_num) (Real.exp_pos 1) (by nlinarith [Real.exp_one_gt_d9])
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.log_two_le_one · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridLogSchedule.lean:9
theorem logEN_le_binLen

The binary length dominates the natural logarithmic scale. the stated conditions the stated conclusion.

Formal statement
n :
hn :
1 ≤ n
logEN n ≤ binLen n
Proof (Lean source)
lemma logEN_le_binLen (n : Nat) (hn : 1 ≤ n) : logEN n ≤ binLen n := by have hnR : (0 : Real) < n := by exact_mod_cast (lt_of_lt_of_le Nat.zero_lt_one hn) have hpow : n ≤ 2 ^ Nat.clog 2 n := Nat.le_pow_clog (by omega) n have hpowpos : 0 < ((2 : Real) ^ Nat.clog 2 n) := pow_pos (by norm_num) _ have hlog : log (n : Real) ≤ log ((2 : Real) ^ Nat.clog 2 n) := Real.strictMonoOn_log.monotoneOn hnR hpowpos (by exact_mod_cast hpow) rw [Real.log_pow] at hlog have hc : 0 ≤ (Nat.clog 2 n : Real) := by positivity have hmul : (Nat.clog 2 n : Real) * log 2 ≤ Nat.clog 2 n := by nlinarith [log_two_le_one] rw [logEN, Real.log_mul (by positivity : exp 1 ≠ 0) hnR.ne'] simp only [Real.log_exp] norm_num [binLen] linarith
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.logEN_le_binLen · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridLogSchedule.lean:16
theorem binLen_le_three_logEN

Conversely, binary length is at most a fixed multiple of log(e n). the stated conditions the stated conclusion.

Formal statement
n :
hn :
1 ≤ n
(binLen n : Real) ≤ 3 * logEN n
Proof (Lean source)
lemma binLen_le_three_logEN (n : Nat) (hn : 1 ≤ n) : (binLen n : Real) ≤ 3 * logEN n := by by_cases hn1 : n = 1 · subst n norm_num [binLen, logEN] have hn2 : 2 ≤ n := by omega have hcpos : 0 < Nat.clog 2 n := Nat.clog_pos (by omega) (by omega) have hpow := Nat.pow_pred_clog_lt_self (by omega : 1 < 2) (by omega : 1 < n) have hpowR : (0 : Real) < (2 ^ (Nat.clog 2 n - 1) : Nat) := by positivity have hnR : (0 : Real) < n := by positivity have hlog : log ((2 ^ (Nat.clog 2 n - 1) : Nat) : Real) < log (n : Real) := Real.strictMonoOn_log hpowR hnR (by exact_mod_cast hpow) rw [show (((2 ^ (Nat.clog 2 n - 1) : Nat) : Real)) = (2 : Real) ^ (Nat.clog 2 n - 1) by norm_num, Real.log_pow] at hlog have hlog2 : (1 / 2 : Real) < log 2 := by nlinarith [Real.log_two_gt_d9] have hcR : (1 : Real) ≤ Nat.clog 2 n := by exact_mod_cast hcpos have hscale : logEN n = 1 + log (n : Real) := by rw [logEN, Real.log_mul (by positivity : exp 1 ≠ 0) hnR.ne'] simp norm_num [binLen] rw [hscale] rw [Nat.cast_sub (by omega : 1 ≤ Nat.clog 2 n)] at hlog push_cast at hlog nlinarith
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.binLen_le_three_logEN · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridLogSchedule.lean:34
theorem Ldeg_eq_floor

Once the unrounded target degree exceeds two, Ldeg is the floor branch. the stated conditions the stated conclusion.

Formal statement
n :
h :
2 ≤ cCirc * binLen n
Ldeg n = toNat ⌊cCirc * binLen n⌋
Proof (Lean source)
lemma Ldeg_eq_floor {n : Nat} (h : 2 ≤ cCirc * binLen n) : Ldeg n = toNat ⌊cCirc * binLen n⌋ := by rw [Ldeg, max_eq_right] have hi : (2 : Int) ≤ ⌊cCirc * binLen n⌋ := by rw [Int.le_floor] exact_mod_cast h simpa using Int.toNat_le_toNat hi
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.Ldeg_eq_floor · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridLogSchedule.lean:61
theorem Ldeg_bounds

Elementary lower and upper bounds for the rounded degree. the stated conditions the stated conclusion.

Formal statement
n :
h :
2 ≤ cCirc * binLen n
conclusion 1
cCirc * binLen n / 2 ≤ (Ldeg n : Real)
conclusion 2
(Ldeg n : Real) ≤ cCirc * binLen n
Proof (Lean source)
lemma Ldeg_bounds {n : Nat} (h : 2 ≤ cCirc * binLen n) : cCirc * binLen n / 2 ≤ (Ldeg n : Real) ∧ (Ldeg n : Real) ≤ cCirc * binLen n := by have hf2 : (2 : Int) ≤ ⌊cCirc * binLen n⌋ := by rw [Int.le_floor] exact_mod_cast h have hf0 : (0 : Int) ≤ ⌊cCirc * binLen n⌋ := le_trans (by norm_num) hf2 have hcast : ((toNat ⌊cCirc * binLen n⌋ : Nat) : Real) = ((⌊cCirc * binLen n⌋ : Int) : Real) := by exact_mod_cast Int.toNat_of_nonneg hf0 rw [Ldeg_eq_floor h, hcast] constructor · have hfloor := Int.lt_floor_add_one (cCirc * binLen n) have hx : (2 : Real) ≤ cCirc * binLen n := h have hfloorR : cCirc * binLen n < ((⌊cCirc * binLen n⌋ : Int) : Real) + 1 := by exact_mod_cast hfloor linarith · exact Int.floor_le _
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.Ldeg_bounds · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridLogSchedule.lean:70
theorem eventually_two_le_cCirc_binLen

The target degree scale eventually exceeds the max/floor transition. the stated conclusion.

Formal statement
∀ᶠ n : Nat in atTop, 2 ≤ cCirc * binLen n
Proof (Lean source)
lemma eventually_two_le_cCirc_binLen : ∀ᶠ n : Nat in atTop, 2 ≤ cCirc * binLen n := by filter_upwards [Filter.eventually_ge_atTop (2 ^ 512 : Nat)] with n hn have hclog : 512 ≤ Nat.clog 2 n := by calc 512 = Nat.clog 2 (2 ^ 512) := (Nat.clog_pow 2 512 (by omega)).symm _ ≤ Nat.clog 2 n := Nat.clog_mono_right 2 hn have hclogR : (512 : Real) ≤ Nat.clog 2 n := by exact_mod_cast hclog norm_num [cCirc, binLen] linarith
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.eventually_two_le_cCirc_binLen · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridLogSchedule.lean:90
theorem eventually_logEN_pow_twelve_le

A twelfth power of the logarithmic schedule is eventually dominated by the sample size. the stated conclusion.

Formal statement
∀ᶠ n : Nat in atTop, logEN n ^ 12 ≤ (n : Real)
Proof (Lean source)
lemma eventually_logEN_pow_twelve_le : ∀ᶠ n : Nat in atTop, logEN n ^ 12 ≤ (n : Real) := by have hsmall : ∀ᶠ n : Nat in atTop, |log (n : Real) ^ 12| ≤ (1 / 4096 : Real) * |(n : Real)| := by have hreal := (Real.isLittleO_pow_log_id_atTop (n := 12)).bound (by norm_num : (0 : Real) < 1 / 4096) exact tendsto_natCast_atTop_atTop.eventually hreal filter_upwards [Filter.eventually_ge_atTop 3, hsmall] with n hn hlog have hnR : (0 : Real) < n := by positivity have hlogn : 1 ≤ log (n : Real) := by rw [← Real.log_exp 1] apply Real.strictMonoOn_log.monotoneOn (Real.exp_pos 1) hnR have hn3 : (3 : Real) ≤ n := by exact_mod_cast hn nlinarith [Real.exp_one_lt_d9] have hscale : logEN n = 1 + log (n : Real) := by rw [logEN, Real.log_mul (by positivity : exp 1 ≠ 0) hnR.ne'] simp have htwo : logEN n ≤ 2 * log (n : Real) := by rw [hscale]; linarith have hnonneg : 0 ≤ logEN n := by rw [hscale]; positivity have hp := pow_le_pow_left₀ hnonneg htwo 12 rw [mul_pow] at hp norm_num at hp have hn1 : (1 : Real) ≤ n := by exact_mod_cast (by omega : 1 ≤ n) rw [abs_of_nonneg (pow_nonneg (Real.log_nonneg hn1) _), abs_of_nonneg hnR.le] at hlog calc logEN n ^ 12 ≤ 4096 * log (n : Real) ^ 12 := hp _ ≤ (n : Real) := by nlinarith
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.eventually_logEN_pow_twelve_le · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridLogSchedule.lean:102
theorem eventually_Ldeg_pow_twelve_le

Consequently the rounded degree has polynomial powers negligible against the sample size. the stated conclusion.

Formal statement
∀ᶠ n : Nat in atTop, (Ldeg n : Real) ^ 12 ≤ n
Proof (Lean source)
lemma eventually_Ldeg_pow_twelve_le : ∀ᶠ n : Nat in atTop, (Ldeg n : Real) ^ 12 ≤ n := by filter_upwards [eventually_two_le_cCirc_binLen, eventually_logEN_pow_twelve_le, Filter.eventually_ge_atTop 1] with n hdeg hlog hn have hL := (Ldeg_bounds hdeg).2 have hbin := binLen_le_three_logEN n hn have hnonneg : 0 ≤ (Ldeg n : Real) := by positivity have htarget : (Ldeg n : Real) ≤ logEN n := by have hlog0 : 0 ≤ logEN n := by rw [logEN] apply (Real.log_pos ?_).le have hnR : (1 : Real) ≤ n := by exact_mod_cast hn calc 1 < exp 1 := by linarith [Real.exp_one_gt_d9] _ ≤ exp 1 * n := (le_mul_iff_one_le_right (Real.exp_pos 1)).2 hnR rw [cCirc] at hL nlinarith exact (pow_le_pow_left₀ hnonneg htarget 12).trans hlog
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.eventually_Ldeg_pow_twelve_le · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridLogSchedule.lean:133
theorem starA_pow_four_Ldeg_lt

The deliberately small degree constant makes four powers of the factorial-moment base fit below the sample size. the stated conditions the stated conclusion.

Formal statement
n :
hdeg :
2 ≤ cCirc * binLen n
(starA : Real) ^ (4 * Ldeg n) < n
Proof (Lean source)
lemma starA_pow_four_Ldeg_lt {n : Nat} (hdeg : 2 ≤ cCirc * binLen n) : (starA : Real) ^ (4 * Ldeg n) < n := by have hn2 : 2 ≤ n := by by_contra hn interval_cases n <;> norm_num [binLen, cCirc] at hdeg have hL := (Ldeg_bounds hdeg).2 have hclog : 52 * Ldeg n ≤ Nat.clog 2 n - 1 := by have hb : (512 : Real) ≤ binLen n := by rw [cCirc] at hdeg nlinarith have hc : ((Nat.clog 2 n : Nat) : Real) = binLen n - 1 := by simp [binLen] rw [cCirc] at hL have hcpos : 1 ≤ Nat.clog 2 n := Nat.one_le_iff_ne_zero.mpr (by exact ne_of_gt (Nat.clog_pos (by omega) (by omega))) have hr : ((52 * Ldeg n : Nat) : Real) ≤ ((Nat.clog 2 n - 1 : Nat) : Real) := by rw [Nat.cast_sub hcpos] push_cast rw [hc] nlinarith exact_mod_cast hr have hbase : (starA : Real) ≤ 2 ^ 13 := by norm_num [starA] have hpow : (starA : Real) ^ (4 * Ldeg n) ≤ (2 : Real) ^ (52 * Ldeg n) := by calc (starA : Real) ^ (4 * Ldeg n) ≤ (2 ^ 13 : Real) ^ (4 * Ldeg n) := by exact pow_le_pow_left₀ (by positivity) hbase _ _ = (2 : Real) ^ (52 * Ldeg n) := by rw [← pow_mul]; congr 1; omega have hmono : (2 : Real) ^ (52 * Ldeg n) ≤ (2 : Real) ^ (Nat.clog 2 n - 1) := by exact pow_le_pow_right₀ (by norm_num) hclog have hlast : (2 : Real) ^ (Nat.clog 2 n - 1) < n := by exact_mod_cast Nat.pow_pred_clog_lt_self (by omega : 1 < 2) (by omega : 1 < n) exact hpow.trans_lt (hmono.trans_lt hlast)
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.starA_pow_four_Ldeg_lt · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridLogSchedule.lean:155
theorem eventually_factorial_moment_tests

C5's two moment tests hold eventually. the stated conclusion.

Formal statement
∀ᶠ n : Nat in atTop, (Ldeg n : Real) ^ 4 * starA ^ (2 * Ldeg n)
≤ n ∧ (Ldeg n : Real) ^ 6 * starA ^ (2 * Ldeg n) ≤ n
Proof (Lean source)
lemma eventually_factorial_moment_tests : ∀ᶠ n : Nat in atTop, (Ldeg n : Real) ^ 4 * starA ^ (2 * Ldeg n) ≤ n ∧ (Ldeg n : Real) ^ 6 * starA ^ (2 * Ldeg n) ≤ n := by filter_upwards [eventually_two_le_cCirc_binLen, eventually_Ldeg_pow_twelve_le] with n hdeg hL12 have hA4 := (starA_pow_four_Ldeg_lt hdeg).le let X : Real := (Ldeg n : Real) ^ 6 let Y : Real := (starA : Real) ^ (2 * Ldeg n) have hX0 : 0 ≤ X := by dsimp [X]; positivity have hY0 : 0 ≤ Y := by dsimp [Y]; positivity have hn0 : 0 ≤ (n : Real) := by positivity have hXsq : X ^ 2 ≤ n := by simpa [X, ← pow_mul] using hL12 have hYsq : Y ^ 2 ≤ n := by dsimp [Y] rw [← pow_mul] rw [show 2 * Ldeg n * 2 = 4 * Ldeg n by omega] exact hA4 have hXY : X * Y ≤ n := by nlinarith [sq_nonneg (X - Y), sq_nonneg (X * Y - n)] constructor · have hL46 : (Ldeg n : Real) ^ 4 ≤ (Ldeg n : Real) ^ 6 := by have hL1 : (1 : Real) ≤ Ldeg n := by exact_mod_cast (show 1 ≤ Ldeg n by exact (by omega : 1 ≤ 2).trans (Ldeg_ge_two n)) exact pow_le_pow_right₀ hL1 (by omega) exact (mul_le_mul_of_nonneg_right hL46 hY0).trans (by simpa [X, Y] using hXY) · simpa [X, Y] using hXY
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.eventually_factorial_moment_tests · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridLogSchedule.lean:194
CausalSmith.Stat.STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research.Helpers.HybridMeanAssembly 3 declarations Algebraic assembly of the calibrated hybrid mean.

Algebraic assembly of the calibrated hybrid mean.

def hybridSelectedCellMean

the stated conditions defines the specified object.

Definition (Lean source)
d :
P :
u tp t B :
threshold L :
x :
Fin d
hybridSelectedCellMean P u tp t B threshold L x :
∫ Z, hybridSelectedCell threshold L B u t Z ∂ (Measure.pi fun arm : Bool ↦ (poissonMeasure (toNNReal (u * markedMass P x arm))).prod ((poissonMeasure (toNNReal (tp * armMass P x arm))).prod (poissonMeasure (toNNReal (t * armMass P x arm)))))
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.hybridSelectedCellMean · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridMeanAssembly.lean:12
theorem hybridSelectedCellMean_eq_mixture

The formal statement establishes the stated conclusion.

Formal statement
d :
P :
u tp t B :
threshold L :
x :
Fin d
muE :
((Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (u * markedMass P x a))).prod (Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (t * armMass P x a))))
hybridSelectedCellMean P u tp t B threshold L x
= hybridPilotLightProbability P tp threshold x * (∫ W, hybridLightPools L B u t W ∂muE)
+ hybridPilotHeavyProbability P tp threshold x * (∫ W, hybridHeavyPools u W ∂muE)
Proof (Lean source)
lemma hybridSelectedCellMean_eq_mixture {d : Nat} (P : DiscreteLaw d) (u tp t B : Real) (threshold L : Nat) (x : Fin d) : let muE := ((Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (u * markedMass P x a))).prod (Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (t * armMass P x a)))) hybridSelectedCellMean P u tp t B threshold L x = hybridPilotLightProbability P tp threshold x * (∫ W, hybridLightPools L B u t W ∂muE) + hybridPilotHeavyProbability P tp threshold x * (∫ W, hybridHeavyPools u W ∂muE) := by dsimp only rw [hybridSelectedCellMean, integral_hybridSelectedCell_exact] rw [hybridPilotHeavyProbability_eq_one_sub_light] rfl
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.hybridSelectedCellMean_eq_mixture · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridMeanAssembly.lean:21
theorem calibrated_hybrid_mean_bias_le Lemma 12 in the paper ↗

C26 with explicit constants. the stated conditions the stated conclusion.

Formal statement
eps :
heps :
0 < eps
heps2 :
eps < 1 / 2
n m d :
P :
1 ≤ n
ModelClass d eps P
bs :
u :
bs.M0 / 8 (: Real)
tp :
(bs.np + bs.mp : Nat) / 8 (: Real)
t :
(bs.nf + bs.mf : Nat) / 8 (: Real)
|(∑ x : Fin d, hybridSelectedCellMean P u tp t (Bscale n m eps) (k0 n m eps) (Ldeg n) x)
≤ 2 * d * Bscale n m eps / (eps * (Ldeg n : Real) ^ 2) + 6 * ((n : Real) ^ 12)⁻¹
Proof (Lean source)
lemma calibrated_hybrid_mean_bias_le {eps : Real} (heps : 0 < eps) (heps2 : eps < 1 / 2) : ∀ (n m d : Nat) (P : DiscreteLaw d), 1 ≤ n → ModelClass d eps P → calibrationPredicate n m eps → let bs := blockSizes n m let u : Real := bs.M0 / 8 let tp : Real := (bs.np + bs.mp : Nat) / 8 let t : Real := (bs.nf + bs.mf : Nat) / 8 |(∑ x : Fin d, hybridSelectedCellMean P u tp t (Bscale n m eps) (k0 n m eps) (Ldeg n) x) - ateFunctional P| ≤ 2 * d * Bscale n m eps / (eps * (Ldeg n : Real) ^ 2) + 6 * ((n : Real) ^ 12)⁻¹ := by intro n m d P hn hP hcal dsimp only classical let u : Real := (blockSizes n m).M0 / 8 let tp : Real := ((blockSizes n m).np + (blockSizes n m).mp : Nat) / 8 let t : Real := ((blockSizes n m).nf + (blockSizes n m).mf : Nat) / 8 let B := Bscale n m eps let L := Ldeg n let invn := ((n : Real) ^ 12)⁻¹ let theta := fun x : Fin d ↦ cellMass P x * (outcomeMean P true x - outcomeMean P false x) let EL := fun x : Fin d ↦ ∫ W, hybridLightPools L B u t W ∂ ((Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (u * markedMass P x a))).prod (Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (t * armMass P x a)))) let EH := fun x : Fin d ↦ ∫ W, hybridHeavyPools u W ∂ ((Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (u * markedMass P x a))).prod (Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (t * armMass P x a)))) let pi := fun x : Fin d ↦ hybridPilotLightProbability P tp (k0 n m eps) x let eta := fun x : Fin d ↦ hybridPilotHeavyProbability P tp (k0 n m eps) x obtain ⟨hu, _htp, ht, hB⟩ := calibrationPredicate_positive_parameters hcal have hL : 2 ≤ L := Ldeg_ge_two n have hp0 (x : Fin d) := (cellMass_mem_unitInterval P x).1 have hsum : ∑ x : Fin d, cellMass P x = 1 := cellMass_sum_eq_one_annotation P have hmix (x : Fin d) : hybridSelectedCellMean P u tp t B (k0 n m eps) L x = pi x * EL x + eta x * EH x := hybridSelectedCellMean_eq_mixture P u tp t B (k0 n m eps) L x have heta (x : Fin d) : eta x = 1 - pi x := hybridPilotHeavyProbability_eq_one_sub_light P tp (k0 n m eps) x have hpi0 (x : Fin d) : 0 ≤ pi x := measureReal_nonneg have hpile (x : Fin d) : pi x ≤ 1 := measureReal_le_one have heta0 (x : Fin d) : 0 ≤ eta x := measureReal_nonneg have hetale (x : Fin d) : eta x ≤ 1 := measureReal_le_one have htheta (x : Fin d) : |theta x| ≤ cellMass P x := by dsimp [theta] rw [abs_mul, abs_of_nonneg (hp0 x)] apply mul_le_of_le_one_right (hp0 x) rw [abs_le] rcases outcomeMean_mem_unitInterval P true x with ⟨h10, h11⟩ rcases outcomeMean_mem_unitInterval P false x with ⟨h00, h01⟩ constructor <;> nlinarith have hpoint (x : Fin d) : |hybridSelectedCellMean P u tp t B (k0 n m eps) L x - theta x| ≤ if cellMass P x ≤ B then 2 * B / (eps * (L : Real) ^ 2) + 2 * cellMass P x * invn else 4 * cellMass P x * invn := by rw [hmix] by_cases hx : cellMass P x ≤ B · rw [if_pos hx] have hlight : |EL x - theta x| ≤ 2 * B / (eps * (L : Real) ^ 2) := by dsimp [EL, theta, B, L, u, t] rw [integral_hybridLightPools P hu ht hB (Ldeg n) x] exact light_exact_mean_bias_le P hP x heps hB hL hx have hheavy := integral_hybridHeavyPools_bias_le P hP x hu ht heps have hwrong := calibrated_light_cell_heavy_probability_mul_exp_le P heps heps2 hcal x have hid : pi x * EL x + eta x * EH x - theta x = pi x * (EL x - theta x) + eta x * (EH x - theta x) := by rw [heta] ring rw [hid] calc |_ + _| ≤ |pi x * (EL x - theta x)| + |eta x * (EH x - theta x)| := abs_add_le _ _ _ ≤ pi x * |EL x - theta x| + eta x * |EH x - theta x| := by rw [abs_mul, abs_mul, abs_of_nonneg (hpi0 x), abs_of_nonneg (heta0 x)] _ ≤ 2 * B / (eps * (L : Real) ^ 2) + 2 * cellMass P x * invn := by have hfirst := mul_le_mul (hpile x) hlight (abs_nonneg _) (by positivity) have hsecond := mul_le_mul_of_nonneg_left hheavy (heta0 x) dsimp [eta, invn, t] at hwrong dsimp [eta, t] at hsecond nlinarith [mul_le_mul_of_nonneg_left hwrong (show 0 ≤ 2 * cellMass P x by exact mul_nonneg (by norm_num) (hp0 x))] · rw [if_neg hx] have hp : B < cellMass P x := lt_of_not_ge hx have hmean := calibrated_heavy_cell_light_mean_le P heps hn hcal x hp have hpip := calibrated_heavy_cell_pilot_le P hn hcal x hp have hheavy := integral_hybridHeavyPools_bias_le P hP x hu ht heps have hexp := calibrated_heavy_cell_bias_exp_le P heps heps2 hn hcal x hp have hid : pi x * EL x + eta x * EH x - theta x = pi x * EL x - pi x * theta x + eta x * (EH x - theta x) := by rw [heta] ring rw [hid] calc |_ + _| ≤ |pi x * EL x - pi x * theta x| + |eta x * (EH x - theta x)| := abs_add_le _ _ _ ≤ pi x * |EL x| + pi x * |theta x| + eta x * |EH x - theta x| := by calc _ ≤ (|pi x * EL x| + |pi x * theta x|) + |eta x * (EH x - theta x)| := add_le_add (abs_sub _ _) le_rfl _ = _ := by rw [abs_mul (pi x) (EL x), abs_mul (pi x) (theta x), abs_mul (eta x) (EH x - theta x), abs_of_nonneg (hpi0 x), abs_of_nonneg (heta0 x)] _ ≤ 4 * cellMass P x * invn := by have hinv : 0 ≤ invn := by dsimp [invn]; positivity have hthetaTerm : pi x * |theta x| ≤ cellMass P x * invn := by calc _ = |theta x| * pi x := by ring _ ≤ |theta x| * invn := mul_le_mul_of_nonneg_left (by simpa [pi, tp, invn] using hpip) (abs_nonneg _) _ ≤ cellMass P x * invn := mul_le_mul_of_nonneg_right (htheta x) hinv have hheavyTerm : eta x * |EH x - theta x| ≤ 2 * cellMass P x * invn := by calc _ ≤ eta x * (2 * cellMass P x * exp (-eps * t * cellMass P x)) := by exact mul_le_mul_of_nonneg_left (by simpa [EH, theta, u, t] using hheavy) (heta0 x) _ ≤ 1 * (2 * cellMass P x * exp (-eps * t * cellMass P x)) := mul_le_mul_of_nonneg_right (hetale x) (mul_nonneg (mul_nonneg (by norm_num) (hp0 x)) (Real.exp_nonneg _)) _ ≤ 2 * cellMass P x * invn := by have := mul_le_mul_of_nonneg_left (by simpa [t, invn] using hexp) (show 0 ≤ 2 * cellMass P x by exact mul_nonneg (by norm_num) (hp0 x)) nlinarith have hmean' : pi x * |EL x| ≤ cellMass P x * invn := by simpa [pi, EL, u, tp, t, invn] using hmean linarith rw [ateFunctional, ← Finset.sum_sub_distrib] calc |∑ x, (hybridSelectedCellMean P u tp t B (k0 n m eps) L x - theta x)| ≤ ∑ x, |hybridSelectedCellMean P u tp t B (k0 n m eps) L x - theta x| := Finset.abs_sum_le_sum_abs _ _ _ ≤ ∑ x, (if cellMass P x ≤ B then 2 * B / (eps * (L : Real) ^ 2) + 2 * cellMass P x * invn else 4 * cellMass P x * invn) := Finset.sum_le_sum fun x _ ↦ hpoint x _ ≤ 2 * d * B / (eps * (L : Real) ^ 2) + 6 * invn := by have hbase0 : 0 ≤ 2 * B / (eps * (L : Real) ^ 2) := by positivity calc _ ≤ ∑ x, (2 * B / (eps * (L : Real) ^ 2) + 4 * cellMass P x * invn) := Finset.sum_le_sum fun x _ ↦ by split_ifs · have hi : 0 ≤ invn := by dsimp [invn]; positivity nlinarith [mul_nonneg (hp0 x) hi] · exact le_add_of_nonneg_left hbase0 _ = d * (2 * B / (eps * (L : Real) ^ 2)) + 4 * (∑ x, cellMass P x) * invn := by rw [Finset.sum_add_distrib, Finset.sum_const, nsmul_eq_mul, Finset.mul_sum, Finset.sum_mul] simp only [Finset.card_univ, Fintype.card_fin] _ ≤ _ := by rw [hsum] have hi : 0 ≤ invn := by dsimp [invn]; positivity have heq : (d : Real) * (2 * B / (eps * (L : Real) ^ 2)) = 2 * d * B / (eps * (L : Real) ^ 2) := by ring rw [heq] linarith
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.calibrated_hybrid_mean_bias_le · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridMeanAssembly.lean:40
CausalSmith.Stat.STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research.Helpers.HybridPilotAggregate 11 declarations Quantitative pilot-selection probabilities in the exact cell product law.

Quantitative pilot-selection probabilities in the exact cell product law.

def hybridPilotLightProbability

Probability that the pilot declares one cell light. the stated conditions the stated conclusion.

Definition (Lean source)
d :
P :
tp :
threshold :
x :
Fin d
hybridPilotLightProbability P tp threshold x :
(Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (tp * armMass P x a))).real (hybridPilotEvent threshold)
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.hybridPilotLightProbability · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridPilotAggregate.lean:13
def hybridPilotHeavyProbability

Probability that the pilot declares one cell heavy. the stated conditions the stated conclusion.

Definition (Lean source)
d :
P :
tp :
threshold :
x :
Fin d
hybridPilotHeavyProbability P tp threshold x :
(Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (tp * armMass P x a))).real (hybridPilotEvent threshold)ᶜ
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.hybridPilotHeavyProbability · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridPilotAggregate.lean:20
theorem hybridPilotHeavyProbability_eq_one_sub_light

The formal statement establishes the stated conclusion.

Formal statement
d :
P :
tp :
threshold :
x :
Fin d
= 1 - hybridPilotLightProbability P tp threshold x
Proof (Lean source)
lemma hybridPilotHeavyProbability_eq_one_sub_light {d : Nat} (P : DiscreteLaw d) (tp : Real) (threshold : Nat) (x : Fin d) : hybridPilotHeavyProbability P tp threshold x = 1 - hybridPilotLightProbability P tp threshold x := by rw [hybridPilotHeavyProbability, hybridPilotLightProbability, measureReal_compl (Set.to_countable (hybridPilotEvent threshold)).measurableSet] simp
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.hybridPilotHeavyProbability_eq_one_sub_light · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridPilotAggregate.lean:26
theorem hybridPilotLightProbability_eq_prod

Exact two-coordinate representation of the pilot probability. the stated conclusion.

Formal statement
d :
P :
tp :
threshold :
x :
Fin d
= ((poissonMeasure (toNNReal (tp * armMass P x false))).prod (poissonMeasure (toNNReal (tp * armMass P x true)))).real {z : Nat × Nat | z.1 + z.2 ≤ threshold}
Proof (Lean source)
lemma hybridPilotLightProbability_eq_prod {d : Nat} (P : DiscreteLaw d) (tp : Real) (threshold : Nat) (x : Fin d) : hybridPilotLightProbability P tp threshold x = ((poissonMeasure (toNNReal (tp * armMass P x false))).prod (poissonMeasure (toNNReal (tp * armMass P x true)))).real {z : Nat × Nat | z.1 + z.2 ≤ threshold} := by let mu : Bool → Measure Nat := fun a ↦ poissonMeasure (toNNReal (tp * armMass P x a)) let A : Set (Nat × Nat) := {z | z.1 + z.2 ≤ threshold} have hA : MeasurableSet A := (Set.to_countable A).measurableSet have hmap := (boolPair_measurePreserving mu).map_eq have heq : (Measure.pi mu) (hybridPilotEvent threshold) = ((Measure.pi mu).map boolPair) A := by rw [Measure.map_apply (by fun_prop) hA] rfl rw [hybridPilotLightProbability, MeasureTheory.measureReal_def, MeasureTheory.measureReal_def, heq, hmap]
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.hybridPilotLightProbability_eq_prod · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridPilotAggregate.lean:36
theorem hybridPilotHeavyProbability_eq_prod

Exact two-coordinate representation of the complementary pilot event. the stated conclusion.

Formal statement
d :
P :
tp :
threshold :
x :
Fin d
= ((poissonMeasure (toNNReal (tp * armMass P x false))).prod (poissonMeasure (toNNReal (tp * armMass P x true)))).real {z : Nat × Nat | threshold < z.1 + z.2}
Proof (Lean source)
lemma hybridPilotHeavyProbability_eq_prod {d : Nat} (P : DiscreteLaw d) (tp : Real) (threshold : Nat) (x : Fin d) : hybridPilotHeavyProbability P tp threshold x = ((poissonMeasure (toNNReal (tp * armMass P x false))).prod (poissonMeasure (toNNReal (tp * armMass P x true)))).real {z : Nat × Nat | threshold < z.1 + z.2} := by let mu : Bool → Measure Nat := fun a ↦ poissonMeasure (toNNReal (tp * armMass P x a)) let A : Set (Nat × Nat) := {z | threshold < z.1 + z.2} have hA : MeasurableSet A := (Set.to_countable A).measurableSet have hmap := (boolPair_measurePreserving mu).map_eq have heq : (Measure.pi mu) (hybridPilotEvent threshold)ᶜ = ((Measure.pi mu).map boolPair) A := by rw [Measure.map_apply (by fun_prop) hA] apply congrArg ext J simp only [Set.mem_preimage, Set.mem_compl_iff] exact Nat.not_le rw [hybridPilotHeavyProbability, MeasureTheory.measureReal_def, MeasureTheory.measureReal_def, heq, hmap]
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.hybridPilotHeavyProbability_eq_prod · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridPilotAggregate.lean:55
theorem hybridPilotLightProbability_le_exp

C19 before its deterministic exponential absorption. the stated conditions the stated conclusion.

Formal statement
d :
P :
tp B :
threshold :
x :
Fin d
htp :
0 < tp
hp :
B < cellMass P x
hk :
(threshold : Real) ≤ tp * B / 4
hybridPilotLightProbability P tp threshold x ≤ exp (-(tp * cellMass P x) / 4)
Proof (Lean source)
lemma hybridPilotLightProbability_le_exp {d : Nat} (P : DiscreteLaw d) {tp B : Real} (threshold : Nat) (x : Fin d) (htp : 0 < tp) (hp : B < cellMass P x) (hk : (threshold : Real) ≤ tp * B / 4) : hybridPilotLightProbability P tp threshold x ≤ exp (-(tp * cellMass P x) / 4) := by have hs0 : 0 ≤ armMass P x false := Finset.sum_nonneg fun y _ ↦ (jointMass_mem_unitInterval P x false y).1 have hs1 : 0 ≤ armMass P x true := Finset.sum_nonneg fun y _ ↦ (jointMass_mem_unitInterval P x true y).1 have hsum : armMass P x false + armMass P x true = cellMass P x := by simp [armMass, cellMass] ring have hcut : (threshold : Real) < tp * (armMass P x false + armMass P x true) / 4 := by rw [hsum] have := mul_lt_mul_of_pos_left hp htp nlinarith rw [hybridPilotLightProbability_eq_prod] have h := pilot_light_probability_le threshold htp.le hs0 hs1 hcut rw [hsum] at h have htop : ofReal (exp (-(tp * cellMass P x) / 4)) ≠ ⊤ := by simp have hreal : (((poissonMeasure (toNNReal (tp * armMass P x false))).prod (poissonMeasure (toNNReal (tp * armMass P x true)))) {z : Nat × Nat | z.1 + z.2 ≤ threshold}).toReal ≤ (ofReal (exp (-(tp * cellMass P x) / 4))).toReal := ENNReal.toReal_mono htop h rw [MeasureTheory.measureReal_def] calc _ ≤ (ofReal (exp (-(tp * cellMass P x) / 4))).toReal := hreal _ = exp (-(tp * cellMass P x) / 4) := ENNReal.toReal_ofReal (Real.exp_nonneg _)
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.hybridPilotLightProbability_le_exp · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridPilotAggregate.lean:77
theorem hybridPilotHeavyProbability_mul_exp_le_inv_pow

C24 in the exact cell-product notation. the stated conditions the stated conclusion.

Formal statement
d :
P :
tp r :
threshold :
x :
Fin d
htp :
0 ≤ tp
hr :
0 ≤ r
hybridPilotHeavyProbability P tp threshold x * exp (-r * (tp * cellMass P x))
≤ ((1 + r) ^ threshold)⁻¹
Proof (Lean source)
lemma hybridPilotHeavyProbability_mul_exp_le_inv_pow {d : Nat} (P : DiscreteLaw d) {tp r : Real} (threshold : Nat) (x : Fin d) (htp : 0 ≤ tp) (hr : 0 ≤ r) : hybridPilotHeavyProbability P tp threshold x * exp (-r * (tp * cellMass P x)) ≤ ((1 + r) ^ threshold)⁻¹ := by have hs0 : 0 ≤ armMass P x false := Finset.sum_nonneg fun y _ ↦ (jointMass_mem_unitInterval P x false y).1 have hs1 : 0 ≤ armMass P x true := Finset.sum_nonneg fun y _ ↦ (jointMass_mem_unitInterval P x true y).1 have hsum : armMass P x false + armMass P x true = cellMass P x := by simp [armMass, cellMass] ring rw [hybridPilotHeavyProbability_eq_prod, ← hsum] exact pilot_heavy_probability_mul_exp_le_inv_pow threshold htp hs0 hs1 hr
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.hybridPilotHeavyProbability_mul_exp_le_inv_pow · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridPilotAggregate.lean:112
theorem exp_neg_twelve_binLen_le

Exponential decay on the binary schedule is at most the corresponding inverse sample-size power. the stated conditions the stated conclusion.

Formal statement
n :
hn :
1 ≤ n
exp (-12 * binLen n) ≤ ((n : Real) ^ 12)⁻¹
Proof (Lean source)
lemma exp_neg_twelve_binLen_le (n : Nat) (hn : 1 ≤ n) : exp (-12 * binLen n) ≤ ((n : Real) ^ 12)⁻¹ := by have hnR : (0 : Real) < n := by positivity have hlogn : log (n : Real) ≤ binLen n := by have h := logEN_le_binLen n hn have hs : logEN n = 1 + log (n : Real) := by rw [logEN, Real.log_mul (by positivity : exp 1 ≠ 0) hnR.ne'] simp rw [hs] at h linarith calc exp (-12 * binLen n) ≤ exp (-12 * log (n : Real)) := by exact Real.exp_le_exp.mpr (by nlinarith) _ = ((n : Real) ^ 12)⁻¹ := by rw [show -12 * log (n : Real) = -((12 : Nat) * log (n : Real)) by push_cast; ring, Real.exp_neg, Real.exp_nat_mul, Real.exp_log hnR]
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.exp_neg_twelve_binLen_le · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridPilotAggregate.lean:128
theorem calibrated_heavy_cell_pilot_le

Under the finite predicate, every truly heavy cell is sent to the light branch with probability at most n⁻¹². the stated conditions the stated conclusion.

Formal statement
d :
P :
n m :
eps :
hn :
1 ≤ n
hcal :
x :
Fin d
hp :
Bscale n m eps < cellMass P x
bs :
tp :
(bs.np + bs.mp : Nat) / 8 (: Real)
hybridPilotLightProbability P tp (k0 n m eps) x ≤ ((n : Real) ^ 12)⁻¹
Proof (Lean source)
lemma calibrated_heavy_cell_pilot_le {d : Nat} (P : DiscreteLaw d) {n m : Nat} {eps : Real} (hn : 1 ≤ n) (hcal : calibrationPredicate n m eps) (x : Fin d) (hp : Bscale n m eps < cellMass P x) : let bs := blockSizes n m let tp : Real := (bs.np + bs.mp : Nat) / 8 hybridPilotLightProbability P tp (k0 n m eps) x ≤ ((n : Real) ^ 12)⁻¹ := by dsimp only obtain ⟨_hu, htp, _ht, hB⟩ := calibrationPredicate_positive_parameters hcal simp only [calibrationPredicate] at hcal rcases hcal with ⟨_hn24, _hu0, _hu1, _hp0, _hp1, _hf0, _hf1, _hr0, _hr1, _hL, _htpB, _htB, _hm4, _hm6, htail, _hrat, _hlast⟩ let tp : Real := (((blockSizes n m).np + (blockSizes n m).mp : Nat) : Real) / 8 let B := Bscale n m eps have hk : (k0 n m eps : Real) ≤ tp * B / 4 := by exact k0_upper_quarter n m eps (mul_nonneg htp.le hB.le) have hpilot := hybridPilotLightProbability_le_exp P (k0 n m eps) x htp hp hk have hexp : exp (-(tp * cellMass P x) / 4) ≤ exp (-12 * binLen n) := by apply Real.exp_le_exp.mpr have hmass := mul_lt_mul_of_pos_left hp htp change 15 * (Ldeg n : Real) + 12 * binLen n ≤ tp * B / 4 at htail nlinarith [show 0 ≤ (Ldeg n : Real) by positivity] exact hpilot.trans (hexp.trans (exp_neg_twelve_binLen_le n hn))
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.calibrated_heavy_cell_pilot_le · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridPilotAggregate.lean:147
theorem calibrated_light_cell_heavy_probability_mul_exp_le

C25: after multiplication by the heavy-branch bias exponential, the opposite pilot error is uniformly at most n⁻¹². the stated conditions the stated conclusion.

Formal statement
d :
P :
n m :
eps :
heps :
0 < eps
heps2 :
eps < 1 / 2
hcal :
x :
Fin d
bs :
tp :
(bs.np + bs.mp : Nat) / 8 (: Real)
t :
(bs.nf + bs.mf : Nat) / 8 (: Real)
hybridPilotHeavyProbability P tp (k0 n m eps) x * exp (-eps * t * cellMass P x)
≤ ((n : Real) ^ 12)⁻¹
Proof (Lean source)
lemma calibrated_light_cell_heavy_probability_mul_exp_le {d : Nat} (P : DiscreteLaw d) {n m : Nat} {eps : Real} (heps : 0 < eps) (heps2 : eps < 1 / 2) (hcal : calibrationPredicate n m eps) (x : Fin d) : let bs := blockSizes n m let tp : Real := (bs.np + bs.mp : Nat) / 8 let t : Real := (bs.nf + bs.mf : Nat) / 8 hybridPilotHeavyProbability P tp (k0 n m eps) x * exp (-eps * t * cellMass P x) ≤ ((n : Real) ^ 12)⁻¹ := by dsimp only obtain ⟨_hu, htp, ht, _hB⟩ := calibrationPredicate_positive_parameters hcal have hb_le : barEps eps ≤ eps := (dyadicIndex_spec heps heps2).2 have hr : 0 ≤ eps * ((((blockSizes n m).nf + (blockSizes n m).mf : Nat) : Real) / 8) / ((((blockSizes n m).np + (blockSizes n m).mp : Nat) : Real) / 8) := by positivity have hraw := hybridPilotHeavyProbability_mul_exp_le_inv_pow P (k0 n m eps) x htp.le hr have hexp : -(eps * (((blockSizes n m).nf + (blockSizes n m).mf : Nat) / 8) / (((blockSizes n m).np + (blockSizes n m).mp : Nat) / 8)) * ((((blockSizes n m).np + (blockSizes n m).mp : Nat) : Real) / 8 * cellMass P x) = -eps * (((blockSizes n m).nf + (blockSizes n m).mf : Nat) / 8) * cellMass P x := by norm_num [Nat.cast_add] at htp ⊢ field_simp [htp.ne'] rw [hexp] at hraw simp only [calibrationPredicate] at hcal rcases hcal with ⟨hncal, _hu0, _hu1, _hp0, _hp1, _hf0, _hf1, hratio, _hratio1, _hL, _htpB, _htB, _hm4, _hm6, _htail, hpow, _hlast⟩ let ratio : Real := (((blockSizes n m).nf + (blockSizes n m).mf : Nat) : Real) / 8 / ((((blockSizes n m).np + (blockSizes n m).mp : Nat) : Real) / 8) have hratio0 : 0 ≤ ratio := by dsimp [ratio]; positivity have hbase : 1 + barEps eps * ratio ≤ 1 + eps * ratio := by simpa [add_comm] using add_le_add_left (mul_le_mul_of_nonneg_right hb_le hratio0) 1 have hpowmono : (1 + barEps eps * ratio) ^ k0 n m eps ≤ (1 + eps * ratio) ^ k0 n m eps := by exact pow_le_pow_left₀ (by nlinarith [mul_nonneg heps.le hratio0]) hbase _ have hpow' : (n : Real) ^ 12 ≤ (1 + barEps eps * ratio) ^ k0 n m eps := by convert hpow using 1 <;> dsimp [ratio] <;> ring have hden : 0 < (n : Real) ^ 12 := by have : 0 < n := by omega positivity have hinv : ((1 + eps * ratio) ^ k0 n m eps)⁻¹ ≤ ((n : Real) ^ 12)⁻¹ := inv_anti₀ hden (hpow'.trans hpowmono) exact hraw.trans (by simpa only [ratio, div_eq_mul_inv, mul_assoc] using hinv)
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.calibrated_light_cell_heavy_probability_mul_exp_le · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridPilotAggregate.lean:175
theorem calibrated_heavy_cell_bias_exp_le

On a truly heavy cell, the intrinsic inverse-count bias exponential is also at most the scheduled inverse power. the stated conditions the stated conclusion.

Formal statement
d :
P :
n m :
eps :
heps :
0 < eps
heps2 :
eps < 1 / 2
hn :
1 ≤ n
hcal :
x :
Fin d
hp :
Bscale n m eps < cellMass P x
exp (-eps * (((blockSizes n m).nf + (blockSizes n m).mf : Nat) / 8) * cellMass P x)
≤ ((n : Real) ^ 12)⁻¹
Proof (Lean source)
lemma calibrated_heavy_cell_bias_exp_le {d : Nat} (P : DiscreteLaw d) {n m : Nat} {eps : Real} (heps : 0 < eps) (heps2 : eps < 1 / 2) (hn : 1 ≤ n) (hcal : calibrationPredicate n m eps) (x : Fin d) (hp : Bscale n m eps < cellMass P x) : exp (-eps * (((blockSizes n m).nf + (blockSizes n m).mf : Nat) / 8) * cellMass P x) ≤ ((n : Real) ^ 12)⁻¹ := by have hbar := (dyadicIndex_spec heps heps2).2 have ht : 0 < (((blockSizes n m).nf + (blockSizes n m).mf : Nat) : Real) / 8 := (calibrationPredicate_positive_parameters hcal).2.2.1 have hB := (calibrationPredicate_positive_parameters hcal).2.2.2 have hcal' := hcal simp only [calibrationPredicate] at hcal' rcases hcal' with ⟨_hn24, _hu0, _hu1, _hp0, _hp1, _hf0, _hf1, _hr0, _hr1, _hL, _htpB, _htB, _hm4, _hm6, _htail, _hrat, hlast⟩ have hprod : 12 * binLen n ≤ eps * (((blockSizes n m).nf + (blockSizes n m).mf : Nat) / 8) * cellMass P x := by have h1 := mul_le_mul_of_nonneg_right hbar (mul_nonneg ht.le hB.le) have h2 := mul_le_mul_of_nonneg_left hp.le (mul_nonneg heps.le ht.le) nlinarith calc _ ≤ exp (-12 * binLen n) := Real.exp_le_exp.mpr (by nlinarith) _ ≤ _ := exp_neg_twelve_binLen_le n hn
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.calibrated_heavy_cell_bias_exp_le · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridPilotAggregate.lean:231
CausalSmith.Stat.STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research.Helpers.HybridPilotTails 4 declarations Poisson lower-tail leaves for the independent pilot branch.

Poisson lower-tail leaves for the independent pilot branch.

theorem map_add_prod_poisson

Adding the two arm counts in a pilot cell produces the Poisson law with the summed rate. the stated conclusion.

Formal statement
lambda0 lambda1 :
Measure.map (fun z : Nat × Nat ↦ z.1 + z.2) ((poissonMeasure lambda0).prod (poissonMeasure lambda1))
= poissonMeasure (lambda0 + lambda1)
Proof (Lean source)
lemma map_add_prod_poisson (lambda0 lambda1 : NNReal) : Measure.map (fun z : Nat × Nat ↦ z.1 + z.2) ((poissonMeasure lambda0).prod (poissonMeasure lambda1)) = poissonMeasure (lambda0 + lambda1) := by simpa [Measure.conv] using poissonMeasure_conv_poissonMeasure lambda0 lambda1
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.map_add_prod_poisson · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridPilotTails.lean:16
theorem pilot_light_probability_le

Product-law form of the light-selection error bound, at the two arm rates appearing in one pilot cell. the stated conditions the stated conclusion.

Formal statement
tp s0 s1 :
k :
htp :
0 ≤ tp
hs0 :
0 ≤ s0
hs1 :
0 ≤ s1
hk :
(k : Real) < tp * (s0 + s1) / 4
((poissonMeasure (toNNReal (tp * s0))).prod (poissonMeasure (toNNReal (tp * s1)))) {z : Nat × Nat | z.1 + z.2 ≤ k}
≤ ofReal (exp (-(tp * (s0 + s1)) / 4))
Proof (Lean source)
lemma pilot_light_probability_le {tp s0 s1 : Real} (k : Nat) (htp : 0 ≤ tp) (hs0 : 0 ≤ s0) (hs1 : 0 ≤ s1) (hk : (k : Real) < tp * (s0 + s1) / 4) : ((poissonMeasure (toNNReal (tp * s0))).prod (poissonMeasure (toNNReal (tp * s1)))) {z : Nat × Nat | z.1 + z.2 ≤ k} ≤ ofReal (exp (-(tp * (s0 + s1)) / 4)) := by let lambda0 := toNNReal (tp * s0) let lambda1 := toNNReal (tp * s1) have hr0 : (lambda0 : Real) = tp * s0 := by simp [lambda0, mul_nonneg htp hs0] have hr1 : (lambda1 : Real) = tp * s1 := by simp [lambda1, mul_nonneg htp hs1] have hsum : ((lambda0 + lambda1 : NNReal) : Real) = tp * (s0 + s1) := by rw [NNReal.coe_add, hr0, hr1] ring let S : Set Nat := {w : Nat | w ≤ k} have hS : MeasurableSet S := measurableSet_Iic calc ((poissonMeasure lambda0).prod (poissonMeasure lambda1)) {z : Nat × Nat | z.1 + z.2 ≤ k} = (Measure.map (fun z : Nat × Nat ↦ z.1 + z.2) ((poissonMeasure lambda0).prod (poissonMeasure lambda1))) S := by rw [Measure.map_apply (by fun_prop) hS] rfl _ = poissonMeasure (lambda0 + lambda1) S := by rw [map_add_prod_poisson] _ ≤ ofReal (exp (-((lambda0 + lambda1 : NNReal) : Real) / 4)) := poisson_le_cutoff_of_cutoff_lt_quarter (lambda0 + lambda1) k (by rw [hsum] exact hk) _ = ofReal (exp (-(tp * (s0 + s1)) / 4)) := by rw [hsum]
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.pilot_light_probability_le · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridPilotTails.lean:25
theorem pilot_heavy_probability_mul_exp_le

Two-arm pilot-product form of the wrong-heavy-branch estimate. the stated conditions the stated conclusion.

Formal statement
tp s0 s1 r :
k :
htp :
0 ≤ tp
hs0 :
0 ≤ s0
hs1 :
0 ≤ s1
hr :
0 ≤ r
((poissonMeasure (toNNReal (tp * s0))).prod (poissonMeasure (toNNReal (tp * s1)))).real {z : Nat × Nat | k < z.1 + z.2} * exp (-r * (tp * (s0 + s1)))
≤ exp (-log (1 + r) * (k : Real))
Proof (Lean source)
lemma pilot_heavy_probability_mul_exp_le {tp s0 s1 r : Real} (k : Nat) (htp : 0 ≤ tp) (hs0 : 0 ≤ s0) (hs1 : 0 ≤ s1) (hr : 0 ≤ r) : ((poissonMeasure (toNNReal (tp * s0))).prod (poissonMeasure (toNNReal (tp * s1)))).real {z : Nat × Nat | k < z.1 + z.2} * exp (-r * (tp * (s0 + s1))) ≤ exp (-log (1 + r) * (k : Real)) := by let lambda0 := toNNReal (tp * s0) let lambda1 := toNNReal (tp * s1) have hr0 : (lambda0 : Real) = tp * s0 := by simp [lambda0, mul_nonneg htp hs0] have hr1 : (lambda1 : Real) = tp * s1 := by simp [lambda1, mul_nonneg htp hs1] have hsum : ((lambda0 + lambda1 : NNReal) : Real) = tp * (s0 + s1) := by rw [NNReal.coe_add, hr0, hr1] ring have hprob : ((poissonMeasure lambda0).prod (poissonMeasure lambda1)).real {z : Nat × Nat | k < z.1 + z.2} = (poissonMeasure (lambda0 + lambda1)).real {w : Nat | k < w} := by simp only [MeasureTheory.measureReal_def] congr 1 calc ((poissonMeasure lambda0).prod (poissonMeasure lambda1)) {z : Nat × Nat | k < z.1 + z.2} = (Measure.map (fun z : Nat × Nat ↦ z.1 + z.2) ((poissonMeasure lambda0).prod (poissonMeasure lambda1))) {w : Nat | k < w} := by symm convert (Measure.map_apply (μ := (poissonMeasure lambda0).prod (poissonMeasure lambda1)) (f := fun z : Nat × Nat ↦ z.1 + z.2) (by fun_prop) (measurableSet_Ioi : MeasurableSet {w : Nat | k < w})) using 1 · congr 1 · congr 1 _ = poissonMeasure (lambda0 + lambda1) {w : Nat | k < w} := by rw [map_add_prod_poisson] rw [hprob, ← hsum] exact poisson_upper_tail_mul_exp_le (lambda0 + lambda1) k hr
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.pilot_heavy_probability_mul_exp_le · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridPilotTails.lean:60
theorem pilot_heavy_probability_mul_exp_le_inv_pow

Reciprocal-power statement of the wrong-heavy-branch estimate (C24). the stated conditions the stated conclusion.

Formal statement
tp s0 s1 r :
k :
htp :
0 ≤ tp
hs0 :
0 ≤ s0
hs1 :
0 ≤ s1
hr :
0 ≤ r
((poissonMeasure (toNNReal (tp * s0))).prod (poissonMeasure (toNNReal (tp * s1)))).real {z : Nat × Nat | k < z.1 + z.2} * exp (-r * (tp * (s0 + s1)))
≤ ((1 + r) ^ k)⁻¹
Proof (Lean source)
lemma pilot_heavy_probability_mul_exp_le_inv_pow {tp s0 s1 r : Real} (k : Nat) (htp : 0 ≤ tp) (hs0 : 0 ≤ s0) (hs1 : 0 ≤ s1) (hr : 0 ≤ r) : ((poissonMeasure (toNNReal (tp * s0))).prod (poissonMeasure (toNNReal (tp * s1)))).real {z : Nat × Nat | k < z.1 + z.2} * exp (-r * (tp * (s0 + s1))) ≤ ((1 + r) ^ k)⁻¹ := by rw [← exp_neg_log_mul_nat_eq_inv_pow hr] exact pilot_heavy_probability_mul_exp_le k htp hs0 hs1 hr
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.pilot_heavy_probability_mul_exp_le_inv_pow · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridPilotTails.lean:101
CausalSmith.Stat.STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research.Helpers.HybridPoolReindex 10 declarations Reindexing the three independent Poisson pools inside one hybrid cell.

Reindexing the three independent Poisson pools inside one hybrid cell.

def boolPair

Evaluate a Boolean-indexed vector in the order false, true. the stated conditions the stated conclusion.

Definition (Lean source)
X :
Type*
f :
Bool → X
boolPair f :
X × X
(f false, f true)
theorem boolPair_measurePreserving

The two-coordinate finite product is the ordinary product under boolPair. the stated conclusion.

Formal statement
X :
mu :
∀ a, IsProbabilityMeasure (mu a)
MeasurePreserving boolPair (Measure.pi mu) ((mu false).prod (mu true))
Proof (Lean source)
lemma boolPair_measurePreserving {X : Type*} [MeasurableSpace X] (mu : Bool → Measure X) [∀ a, IsProbabilityMeasure (mu a)] : MeasurePreserving boolPair (Measure.pi mu) ((mu false).prod (mu true)) := by let e := MeasurableEquiv.piCongrLeft (fun _ : Bool ↦ X) finTwoEquiv have h₁ : MeasurePreserving e (Measure.pi fun i : Fin 2 ↦ mu (finTwoEquiv i)) (Measure.pi mu) := measurePreserving_piCongrLeft mu finTwoEquiv have h₂ := measurePreserving_piFinTwo (fun i : Fin 2 ↦ mu (finTwoEquiv i)) let eTotal := e.symm.trans (MeasurableEquiv.piFinTwo (fun _ : Fin 2 ↦ X)) have h := h₂.comp h₁.symm have he : (eTotal : (Bool → X) → X × X) = boolPair := by funext f apply Prod.ext · change f (finTwoEquiv 0) = f false rfl · change f (finTwoEquiv 1) = f true rfl rw [← he] exact h
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.boolPair_measurePreserving · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridPoolReindex.lean:15
def splitPairedCellPools

Split every cell's Boolean-indexed paired coordinates into two Boolean-indexed pools. the stated conditions the stated conclusion.

Definition (Lean source)
I X Y :
Type*
z :
I → Bool → X × Y
splitPairedCellPools z :
I → (Bool → X) × (Bool → Y)
fun i ↦ (fun a ↦ (z i a).1, fun a ↦ (z i a).2)
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.splitPairedCellPools · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridPoolReindex.lean:38
theorem splitPairedCellPools_measurePreserving

Coordinatewise finite-product reindexing for paired arm counts. the stated conclusion.

Formal statement
mu :
I → Bool → Measure X
nu :
I → Bool → Measure Y
∀ i a, IsProbabilityMeasure (mu i a)
∀ i a, IsProbabilityMeasure (nu i a)
MeasurePreserving splitPairedCellPools (Measure.pi fun i ↦ Measure.pi fun a ↦ (mu i a).prod (nu i a)) (Measure.pi fun i ↦ (Measure.pi (mu i)).prod (Measure.pi (nu i)))
Proof (Lean source)
lemma splitPairedCellPools_measurePreserving {I X Y : Type*} [Fintype I] [MeasurableSpace X] [MeasurableSpace Y] (mu : I → Bool → Measure X) (nu : I → Bool → Measure Y) [∀ i a, IsProbabilityMeasure (mu i a)] [∀ i a, IsProbabilityMeasure (nu i a)] : MeasurePreserving splitPairedCellPools (Measure.pi fun i ↦ Measure.pi fun a ↦ (mu i a).prod (nu i a)) (Measure.pi fun i ↦ (Measure.pi (mu i)).prod (Measure.pi (nu i))) := by have h := measurePreserving_pi (fun i ↦ Measure.pi fun a ↦ (mu i a).prod (nu i a)) (fun i ↦ (Measure.pi (mu i)).prod (Measure.pi (nu i))) (fun i ↦ measurePreserving_arrowProdEquivProdArrow X Y Bool (mu i) (nu i)) change MeasurePreserving (fun (z : I → Bool → X × Y) i ↦ (fun a ↦ (z i a).1, fun a ↦ (z i a).2)) _ _ simpa [MeasurableEquiv.arrowProdEquivProdArrow] using h
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.splitPairedCellPools_measurePreserving · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridPoolReindex.lean:44
def splitHybridPools

Separate a function of arm-indexed triples into its outcome, pilot, and factorial coordinate functions. the stated conditions the stated conclusion.

Definition (Lean source)
Z :
Bool → Nat × (Nat × Nat)
splitHybridPools Z :
(Bool → Nat) × ((Bool → Nat) × (Bool → Nat))
(fun a ↦ (Z a).1, fun a ↦ (Z a).2.1, fun a ↦ (Z a).2.2)
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.splitHybridPools · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridPoolReindex.lean:62
def pilotFirstPools

Move the middle (pilot) pool in front, leaving outcome and factorial pools together as the estimator input. the stated conditions the stated conclusion.

Definition (Lean source)
S J K :
Type*
z :
S × (J × K)
pilotFirstPools z :
J × (S × K)
(z.2.1, z.1, z.2.2)
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.pilotFirstPools · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridPoolReindex.lean:68
def pilotFirstSplitHybridPools

Split the three armwise pools and put the independent pilot pool first. the stated conditions the stated conclusion.

Definition (Lean source)
Z :
Bool → Nat × (Nat × Nat)
pilotFirstSplitHybridPools Z :
(Bool → Nat) × ((Bool → Nat) × (Bool → Nat))
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.pilotFirstSplitHybridPools · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridPoolReindex.lean:73
theorem pilotFirstPools_measurePreserving

The middle-first permutation preserves the correspondingly permuted three-factor product law. the stated conclusion.

Formal statement
muS :
muJ :
muK :
MeasurePreserving pilotFirstPools (muS.prod (muJ.prod muK)) (muJ.prod (muS.prod muK))
Proof (Lean source)
lemma pilotFirstPools_measurePreserving {S J K : Type*} [MeasurableSpace S] [MeasurableSpace J] [MeasurableSpace K] (muS : Measure S) (muJ : Measure J) (muK : Measure K) [SFinite muS] [SFinite muJ] [SFinite muK] : MeasurePreserving pilotFirstPools (muS.prod (muJ.prod muK)) (muJ.prod (muS.prod muK)) := by let hUnassoc := MeasurePreserving.symm MeasurableEquiv.prodAssoc (measurePreserving_prodAssoc muS muJ muK) let hSwap : MeasurePreserving (map swap id) ((muS.prod muJ).prod muK) ((muJ.prod muS).prod muK) := Measure.measurePreserving_swap.prod (MeasurePreserving.id muK) let hAssoc := measurePreserving_prodAssoc muJ muS muK have h := hAssoc.comp (hSwap.comp hUnassoc) change MeasurePreserving (fun z : S × (J × K) ↦ (z.2.1, (z.1, z.2.2))) (muS.prod (muJ.prod muK)) (muJ.prod (muS.prod muK)) simpa [Function.comp_def, MeasurableEquiv.prodAssoc] using h
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.pilotFirstPools_measurePreserving · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridPoolReindex.lean:78
theorem splitHybridPools_measurePreserving

Finite-product reindexing proves that the outcome, pilot, and factorial pools in one cell are mutually independent. the stated conclusion.

Formal statement
muS muJ muK :
∀ a, IsProbabilityMeasure (muS a)
∀ a, IsProbabilityMeasure (muJ a)
∀ a, IsProbabilityMeasure (muK a)
MeasurePreserving splitHybridPools (Measure.pi fun a : Bool ↦ (muS a).prod ((muJ a).prod (muK a))) ((Measure.pi muS).prod ((Measure.pi muJ).prod (Measure.pi muK)))
Proof (Lean source)
lemma splitHybridPools_measurePreserving (muS muJ muK : Bool → Measure Nat) [∀ a, IsProbabilityMeasure (muS a)] [∀ a, IsProbabilityMeasure (muJ a)] [∀ a, IsProbabilityMeasure (muK a)] : MeasurePreserving splitHybridPools (Measure.pi fun a : Bool ↦ (muS a).prod ((muJ a).prod (muK a))) ((Measure.pi muS).prod ((Measure.pi muJ).prod (Measure.pi muK))) := by let hOuter := measurePreserving_arrowProdEquivProdArrow Nat (Nat × Nat) Bool muS (fun a ↦ (muJ a).prod (muK a)) let hInner := measurePreserving_arrowProdEquivProdArrow Nat Nat Bool muJ muK have hProduct : MeasurePreserving (map id (MeasurableEquiv.arrowProdEquivProdArrow Nat Nat Bool)) ((Measure.pi muS).prod (Measure.pi fun a : Bool ↦ (muJ a).prod (muK a))) ((Measure.pi muS).prod ((Measure.pi muJ).prod (Measure.pi muK))) := (MeasurePreserving.id (Measure.pi muS)).prod hInner have hComp := hProduct.comp hOuter unfold splitHybridPools simpa [Function.comp_def, MeasurableEquiv.arrowProdEquivProdArrow] using hComp
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.splitHybridPools_measurePreserving · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridPoolReindex.lean:98
theorem pilotFirstSplitHybridPools_measurePreserving

Combined armwise splitting and middle-pool permutation. the stated conclusion.

Formal statement
muS muJ muK :
∀ a, IsProbabilityMeasure (muS a)
∀ a, IsProbabilityMeasure (muJ a)
∀ a, IsProbabilityMeasure (muK a)
MeasurePreserving pilotFirstSplitHybridPools (Measure.pi fun a : Bool ↦ (muS a).prod ((muJ a).prod (muK a))) ((Measure.pi muJ).prod ((Measure.pi muS).prod (Measure.pi muK)))
Proof (Lean source)
lemma pilotFirstSplitHybridPools_measurePreserving (muS muJ muK : Bool → Measure Nat) [∀ a, IsProbabilityMeasure (muS a)] [∀ a, IsProbabilityMeasure (muJ a)] [∀ a, IsProbabilityMeasure (muK a)] : MeasurePreserving pilotFirstSplitHybridPools (Measure.pi fun a : Bool ↦ (muS a).prod ((muJ a).prod (muK a))) ((Measure.pi muJ).prod ((Measure.pi muS).prod (Measure.pi muK))) := by have h := (pilotFirstPools_measurePreserving (Measure.pi muS) (Measure.pi muJ) (Measure.pi muK)).comp (splitHybridPools_measurePreserving muS muJ muK) change MeasurePreserving (fun Z ↦ pilotFirstPools (splitHybridPools Z)) (Measure.pi fun a : Bool ↦ (muS a).prod ((muJ a).prod (muK a))) ((Measure.pi muJ).prod ((Measure.pi muS).prod (Measure.pi muK))) exact h
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.pilotFirstSplitHybridPools_measurePreserving · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridPoolReindex.lean:123
CausalSmith.Stat.STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research.Helpers.HybridQuantitativeArithmetic 1 declarations Paper-local deterministic inequalities for the hybrid risk assembly.

Paper-local deterministic inequalities for the hybrid risk assembly.

theorem light_exact_mean_bias_le

C17, stated for the exact light mean produced by the Poisson calculation. the stated conditions the stated conclusion.

Formal statement
d :
eps B :
L :
P :
hP :
ModelClass d eps P
x :
Fin d
heps :
0 < eps
hB :
0 < B
hL :
2 ≤ L
hcell :
cellMass P x ≤ B
|markedMass P x true * (cellMass P x / B) * (chebG L).eval (armMass P x true / B)
- markedMass P x false * (cellMass P x / B) * (chebG L).eval (armMass P x false / B)
- cellMass P x * (outcomeMean P true x - outcomeMean P false x)|
≤ 2 * B / (eps * (L : Real) ^ 2)
Proof (Lean source)
lemma light_exact_mean_bias_le {d : Nat} {eps B : Real} {L : Nat} (P : DiscreteLaw d) (hP : ModelClass d eps P) (x : Fin d) (heps : 0 < eps) (hB : 0 < B) (hL : 2 ≤ L) (hcell : cellMass P x ≤ B) : |markedMass P x true * (cellMass P x / B) * (chebG L).eval (armMass P x true / B) - markedMass P x false * (cellMass P x / B) * (chebG L).eval (armMass P x false / B) - cellMass P x * (outcomeMean P true x - outcomeMean P false x)| ≤ 2 * B / (eps * (L : Real) ^ 2) := by let p := cellMass P x let s0 := armMass P x false let s1 := armMass P x true let mu0 := outcomeMean P false x let mu1 := outcomeMean P true x let e0 := (chebE L).eval (s0 / B) let e1 := (chebE L).eval (s1 / B) have hp : 0 ≤ p := (cellMass_mem_unitInterval P x).1 have hs0 : 0 ≤ s0 := Finset.sum_nonneg fun y _ ↦ (jointMass_mem_unitInterval P x false y).1 have hs1 : 0 ≤ s1 := Finset.sum_nonneg fun y _ ↦ (jointMass_mem_unitInterval P x true y).1 have hs0p : s0 ≤ p := by have hsum : s0 + s1 = p := by simp [s0, s1, p, armMass, cellMass] ring linarith have hs1p : s1 ≤ p := by have hsum : s0 + s1 = p := by simp [s0, s1, p, armMass, cellMass] ring linarith by_cases hpzero : p = 0 · have hs0zero : s0 = 0 := le_antisymm (by simpa [hpzero] using hs0p) hs0 have hs1zero : s1 = 0 := le_antisymm (by simpa [hpzero] using hs1p) hs1 have hm0 : markedMass P x false = 0 := by rw [markedMass_eq_armMass_mul_outcomeMean] simpa [s0] using congrArg (fun z : Real ↦ z * outcomeMean P false x) hs0zero have hm1 : markedMass P x true = 0 := by rw [markedMass_eq_armMass_mul_outcomeMean] simpa [s1] using congrArg (fun z : Real ↦ z * outcomeMean P true x) hs1zero have hpx : cellMass P x = 0 := by simpa [p] using hpzero simp [hm0, hm1, hpx] positivity have hppos : 0 < p := lt_of_le_of_ne hp (Ne.symm hpzero) have hz0 : s0 / B ∈ Icc (0 : Real) 1 := ⟨div_nonneg hs0 hB.le, (div_le_one hB).2 (hs0p.trans hcell)⟩ have hz1 : s1 / B ∈ Icc (0 : Real) 1 := ⟨div_nonneg hs1 hB.le, (div_le_one hB).2 (hs1p.trans hcell)⟩ obtain ⟨_A, _hA, hcert⟩ := chebyshev_factorial_certificate rcases (hcert L hL).2.1 (s0 / B) hz0 with ⟨he00, _he01, he0inv, hid0⟩ rcases (hcert L hL).2.1 (s1 / B) hz1 with ⟨he10, _he11, he1inv, hid1⟩ have hover0 : eps * p ≤ s0 := by simpa [p, s0] using (overlap_armMass_bounds P hP.overlap x false).1 have hover1 : eps * p ≤ s1 := by simpa [p, s1] using (overlap_armMass_bounds P hP.overlap x true).1 have he0b : e0 ≤ (((L : Real) ^ 2 * (s0 / B))⁻¹) := by dsimp [e0] exact he0inv (div_pos (lt_of_lt_of_le (mul_pos heps hppos) hover0) hB) have he1b : e1 ≤ (((L : Real) ^ 2 * (s1 / B))⁻¹) := by dsimp [e1] exact he1inv (div_pos (lt_of_lt_of_le (mul_pos heps hppos) hover1) hB) have hb := light_cell_bias_abs_le heps hp hB (by omega : 0 < L) hover0 hover1 (outcomeMean_mem_unitInterval P false x) (outcomeMean_mem_unitInterval P true x) he00 he10 he0b he1b have hmarked0 := markedMass_eq_armMass_mul_outcomeMean P x false have hmarked1 := markedMass_eq_armMass_mul_outcomeMean P x true have hmean := light_mean_error_identity (p := p) (B := B) (s0 := s0) (s1 := s1) (mu0 := mu0) (mu1 := mu1) (e0 := e0) (e1 := e1) (g0 := (chebG L).eval (s0 / B)) (g1 := (chebG L).eval (s1 / B)) (by simp [p, s0, s1, cellMass, armMass]; ring) (by simpa [e0] using hid0) (by simpa [e1] using hid1) dsimp [p, s0, s1, mu0, mu1, e0, e1] at hb hmean ⊢ rw [hmarked0, hmarked1] rw [hmean] simpa [abs_neg] using hb
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.light_exact_mean_bias_le · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridQuantitativeArithmetic.lean:14
CausalSmith.Stat.STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research.Helpers.HybridThreePoolPoissonLaw 2 declarations Histogram law of the generic three independent Poisson prefixes.

Histogram law of the generic three independent Poisson prefixes.

theorem hybridPrefixCounts_map_independentPoissonPrefixLaw

Mapping the three generic prefixes to the paper's count tensor gives three independent Poisson histograms in every (x,a) cell. the stated conclusion.

Formal statement
d :
P :
u tp t :
Measure.map hybridPrefixCounts (independentPoissonPrefixLaw (threePoolObservationLaw (obsLaw P) (auxMarginal P).toMeasure) (threePoolIntensity u tp t))
= Measure.pi fun x : Fin d => Measure.pi fun a : Bool => (poissonMeasure (u * ((obsLaw P) ({(x, a, true)} : Set (Obs d))).toNNReal)).prod ((poissonMeasure (tp * ((auxMarginal P).toMeasure ({(x, a)} : Set (AuxObs d))).toNNReal)).prod (poissonMeasure (t * ((auxMarginal P).toMeasure ({(x, a)} : Set (AuxObs d))).toNNReal)))
Proof (Lean source)
lemma hybridPrefixCounts_map_independentPoissonPrefixLaw {d : Nat} (P : DiscreteLaw d) (u tp t : NNReal) : Measure.map hybridPrefixCounts (independentPoissonPrefixLaw (threePoolObservationLaw (obsLaw P) (auxMarginal P).toMeasure) (threePoolIntensity u tp t)) = Measure.pi fun x : Fin d => Measure.pi fun a : Bool => (poissonMeasure (u * ((obsLaw P) ({(x, a, true)} : Set (Obs d))).toNNReal)).prod ((poissonMeasure (tp * ((auxMarginal P).toMeasure ({(x, a)} : Set (AuxObs d))).toNNReal)).prod (poissonMeasure (t * ((auxMarginal P).toMeasure ({(x, a)} : Set (AuxObs d))).toNNReal))) := by let h0 : FiniteSample (Obs d) → (Obs d → Nat) := fun s ↦ finiteSampleHistogram s.points let hp : FiniteSample (AuxObs d) → (AuxObs d → Nat) := fun s ↦ finiteSampleHistogram s.points let hf : FiniteSample (AuxObs d) → (AuxObs d → Nat) := fun s ↦ finiteSampleHistogram s.points let extract : (Obs d → Nat) → (AuxObs d → Nat) := fun h xa ↦ h (xa.1, xa.2, true) let pairPF : (AuxObs d → Nat) × (AuxObs d → Nat) → (AuxObs d → Nat × Nat) := fun z xa ↦ (z.1 xa, z.2 xa) let pairAll : (AuxObs d → Nat) × (AuxObs d → Nat × Nat) → (AuxObs d → Nat × (Nat × Nat)) := fun z xa ↦ (z.1 xa, z.2 xa) let curryCounts : (AuxObs d → Nat × (Nat × Nat)) → HybridPoissonCounts d := fun z x a ↦ z (x, a) let mu0 := Measure.pi fun z : Obs d => poissonMeasure (u * ((obsLaw P) {z}).toNNReal) let mup := Measure.pi fun z : AuxObs d => poissonMeasure (tp * ((auxMarginal P).toMeasure {z}).toNNReal) let muf := Measure.pi fun z : AuxObs d => poissonMeasure (t * ((auxMarginal P).toMeasure {z}).toNNReal) let mu0' := Measure.pi fun xa : AuxObs d => poissonMeasure (u * ((obsLaw P) {(xa.1, xa.2, true)}).toNNReal) let mupf := Measure.pi fun xa : AuxObs d => (poissonMeasure (tp * ((auxMarginal P).toMeasure {xa}).toNNReal)).prod (poissonMeasure (t * ((auxMarginal P).toMeasure {xa}).toNNReal)) let muAll := Measure.pi fun xa : AuxObs d => (poissonMeasure (u * ((obsLaw P) {(xa.1, xa.2, true)}).toNNReal)).prod ((poissonMeasure (tp * ((auxMarginal P).toMeasure {xa}).toNNReal)).prod (poissonMeasure (t * ((auxMarginal P).toMeasure {xa}).toNNReal))) have hhist0 := finitePoissonSampleLaw_map_histogram (obsLaw P) u have hhistp := finitePoissonSampleLaw_map_histogram (auxMarginal P).toMeasure tp have hhistf := finitePoissonSampleLaw_map_histogram (auxMarginal P).toMeasure t have hextract : Measure.map extract mu0 = mu0' := by exact map_pi_finProjection _ (fun xa : AuxObs d ↦ (xa.1, xa.2, true)) (by intro x y h apply Prod.ext · simpa only using congrArg fst h · simpa only using congrArg (fun z : Obs d ↦ z.2.1) h) have hpairPF : Measure.map pairPF (mup.prod muf) = mupf := map_prod_pi_pointwisePair _ _ have hpairAll : Measure.map pairAll (mu0'.prod mupf) = muAll := map_prod_pi_pointwisePair _ _ have hcurry : Measure.map curryCounts muAll = Measure.pi fun x : Fin d => Measure.pi fun a : Bool => (poissonMeasure (u * ((obsLaw P) {(x, a, true)}).toNNReal)).prod ((poissonMeasure (tp * ((auxMarginal P).toMeasure {(x, a)}).toNNReal)).prod (poissonMeasure (t * ((auxMarginal P).toMeasure {(x, a)}).toNNReal))) := by change Measure.map (MeasurableEquiv.curry (Fin d) Bool (Nat × (Nat × Nat))) muAll = _ simpa only [Measure.infinitePi_eq_pi, muAll] using Measure.infinitePi_map_curry (fun x : Fin d => fun a : Bool => (poissonMeasure (u * ((obsLaw P) {(x, a, true)}).toNNReal)).prod ((poissonMeasure (tp * ((auxMarginal P).toMeasure {(x, a)}).toNNReal)).prod (poissonMeasure (t * ((auxMarginal P).toMeasure {(x, a)}).toNNReal)))) let source0 := finitePoissonSampleLaw (obsLaw P) u let sourcep := finitePoissonSampleLaw (auxMarginal P).toMeasure tp let sourcef := finitePoissonSampleLaw (auxMarginal P).toMeasure t have hsource : Measure.map unpackThreePool (independentPoissonPrefixLaw (threePoolObservationLaw (obsLaw P) (auxMarginal P).toMeasure) (threePoolIntensity u tp t)) = source0.prod (sourcep.prod sourcef) := by unfold independentPoissonPrefixLaw simpa [threePoolObservationLaw, threePoolIntensity, source0, sourcep, sourcef] using map_unpackThreePool_pi (mu := fun i ↦ finitePoissonSampleLaw (threePoolObservationLaw (obsLaw P) (auxMarginal P).toMeasure i) (threePoolIntensity u tp t i)) let histThree := fun z : FiniteSample (Obs d) × (FiniteSample (AuxObs d) × FiniteSample (AuxObs d)) ↦ (h0 z.1, hp z.2.1, hf z.2.2) have hhist : Measure.map histThree (source0.prod (sourcep.prod sourcef)) = mu0.prod (mup.prod muf) := by change Measure.map (Prod.map h0 (Prod.map hp hf)) (source0.prod (sourcep.prod sourcef)) = _ rw [← Measure.map_prod_map _ _ (by fun_prop : Measurable h0) (by fun_prop), ← Measure.map_prod_map _ _ (by fun_prop : Measurable hp) (by fun_prop : Measurable hf), hhist0, hhistp, hhistf] let finish := curryCounts ∘ pairAll ∘ Prod.map extract pairPF have hfinish : Measure.map finish (mu0.prod (mup.prod muf)) = Measure.pi fun x : Fin d => Measure.pi fun a : Bool => (poissonMeasure (u * ((obsLaw P) {(x, a, true)}).toNNReal)).prod ((poissonMeasure (tp * ((auxMarginal P).toMeasure {(x, a)}).toNNReal)).prod (poissonMeasure (t * ((auxMarginal P).toMeasure {(x, a)}).toNNReal))) := by rw [show Measure.map finish (mu0.prod (mup.prod muf)) = Measure.map curryCounts (Measure.map pairAll (Measure.map (Prod.map extract pairPF) (mu0.prod (mup.prod muf)))) by rw [Measure.map_map (by fun_prop) (by fun_prop), Measure.map_map (by fun_prop) (by fun_prop)] rfl] rw [← Measure.map_prod_map _ _ (by fun_prop : Measurable extract) (by fun_prop : Measurable pairPF), hextract, hpairPF, hpairAll, hcurry] have hfun : hybridPrefixCounts = finish ∘ histThree ∘ unpackThreePool := by funext z rfl rw [hfun] change Measure.map ((finish ∘ histThree) ∘ unpackThreePool) (independentPoissonPrefixLaw (threePoolObservationLaw (obsLaw P) (auxMarginal P).toMeasure) (threePoolIntensity u tp t)) = _ calc _ = Measure.map finish (Measure.map histThree (Measure.map unpackThreePool (independentPoissonPrefixLaw (threePoolObservationLaw (obsLaw P) (auxMarginal P).toMeasure) (threePoolIntensity u tp t)))) := by rw [Measure.map_map (by fun_prop) (by fun_prop), Measure.map_map (by fun_prop) (by fun_prop)] _ = Measure.map finish (Measure.map histThree (source0.prod (sourcep.prod sourcef))) := by rw [hsource] _ = Measure.map finish (mu0.prod (mup.prod muf) ) := by rw [hhist] _ = _ := hfinish
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.hybridPrefixCounts_map_independentPoissonPrefixLaw · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridThreePoolPoissonLaw.lean:15
theorem hybridPrefixCounts_map_eq_hybridPoissonCountLaw

The preceding histogram law in the paper's markedMass/armMass parameterization. the stated conditions the stated conclusion.

Formal statement
d :
P :
u tp t :
hu :
0 ≤ u
htp :
0 ≤ tp
ht :
0 ≤ t
Measure.map hybridPrefixCounts (independentPoissonPrefixLaw (threePoolObservationLaw (obsLaw P) (auxMarginal P).toMeasure) (threePoolIntensity (toNNReal u) (toNNReal tp) (toNNReal t)))
Proof (Lean source)
lemma hybridPrefixCounts_map_eq_hybridPoissonCountLaw {d : Nat} (P : DiscreteLaw d) (u tp t : Real) (hu : 0 ≤ u) (htp : 0 ≤ tp) (ht : 0 ≤ t) : Measure.map hybridPrefixCounts (independentPoissonPrefixLaw (threePoolObservationLaw (obsLaw P) (auxMarginal P).toMeasure) (threePoolIntensity (toNNReal u) (toNNReal tp) (toNNReal t))) = hybridPoissonCountLaw P u tp t := by rw [hybridPrefixCounts_map_independentPoissonPrefixLaw] unfold hybridPoissonCountLaw congr 1 funext x congr 1 funext a have haux : (auxMarginal P (x, a)).toReal = armMass P x a := by unfold auxMarginal armMass jointMass rw [PMF.map_apply, tsum_fintype] cases a <;> simp only [Fintype.sum_prod_type] <;> simp all_goals rw [ENNReal.toReal_add (PMF.apply_ne_top _ _) (PMF.apply_ne_top _ _)] have hauxNN : ((auxMarginal P).toMeasure ({(x, a)} : Set (AuxObs d))).toNNReal = (armMass P x a).toNNReal := by rw [PMF.toMeasure_apply_singleton _ _ (measurableSet_singleton _)] apply NNReal.eq have harm : 0 ≤ armMass P x a := by unfold armMass jointMass positivity rw [ENNReal.coe_toNNReal_eq_toReal, Real.coe_toNNReal _ harm] exact haux congr 1 · congr 1 unfold obsLaw markedMass jointMass rw [PMF.toMeasure_apply_singleton _ _ (measurableSet_singleton _), Real.toNNReal_mul hu] congr 1 apply NNReal.eq simpa [Real.coe_toNNReal] using ENNReal.coe_toNNReal_eq_toReal (P.pmf (x, a, true)) · congr 1 · congr 1 rw [Real.toNNReal_mul htp] rw [hauxNN] · congr 1 rw [Real.toNNReal_mul ht] rw [hauxNN]
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.hybridPrefixCounts_map_eq_hybridPoissonCountLaw · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridThreePoolPoissonLaw.lean:156
CausalSmith.Stat.STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research.Helpers.HybridThreePoolPrefix 22 declarations The paper's fixed blocks and finite-prefix statistic in the generic three-pool format.

The paper's fixed blocks and finite-prefix statistic in the generic three-pool format.

def unpackThreePool

Forget the dependent-function presentation of three coordinates. the stated conditions the stated conclusion.

Definition (Lean source)
X :
ThreePoolIndex → Type*
z :
(i : ThreePoolIndex) → X i
unpackThreePool z :
X .complete × (X .sharedLeft × X .sharedRight)
(z .complete, z .sharedLeft, z .sharedRight)
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.unpackThreePool · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridThreePoolPrefix.lean:17
theorem measurable_unpackThreePool

Converting a dependent three-pool family to a nested product is measurable.

Formal statement
X :
ThreePoolIndex → Type*
∀ i, MeasurableSpace (X i)
Proof (Lean source)
@[fun_prop] lemma measurable_unpackThreePool {X : ThreePoolIndex → Type*} [∀ i, MeasurableSpace (X i)] : Measurable (unpackThreePool (X := X)) := by exact (measurable_pi_apply ThreePoolIndex.complete).prodMk ((measurable_pi_apply ThreePoolIndex.sharedLeft).prodMk (measurable_pi_apply ThreePoolIndex.sharedRight))
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.measurable_unpackThreePool · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridThreePoolPrefix.lean:23
theorem map_unpackThreePool_pi

A three-coordinate product measure becomes a nested ordinary product. the stated conclusion.

Formal statement
X :
ThreePoolIndex → Type*
∀ i, MeasurableSpace (X i)
mu :
(i : ThreePoolIndex) → Measure (X i)
∀ i, IsProbabilityMeasure (mu i)
Measure.map unpackThreePool (Measure.pi mu)
= (mu .complete).prod ((mu .sharedLeft).prod (mu .sharedRight))
Proof (Lean source)
lemma map_unpackThreePool_pi {X : ThreePoolIndex → Type*} [∀ i, MeasurableSpace (X i)] (mu : (i : ThreePoolIndex) → Measure (X i)) [∀ i, IsProbabilityMeasure (mu i)] : Measure.map unpackThreePool (Measure.pi mu) = (mu .complete).prod ((mu .sharedLeft).prod (mu .sharedRight)) := by let J := Unit ⊕ (Unit ⊕ Unit) let e : J ≃ ThreePoolIndex := { toFun := fun j => match j with | .inl _ => .complete | .inr (.inl _) => .sharedLeft | .inr (.inr _) => .sharedRight invFun := fun i => match i with | .complete => .inl () | .sharedLeft => .inr (.inl ()) | .sharedRight => .inr (.inr ()) left_inv := by intro j; rcases j with _ | (_ | _) <;> rfl right_inv := by intro i; cases i <;> rfl } let reindex := MeasurableEquiv.piCongrLeft X e let split0 := MeasurableEquiv.sumPiEquivProdPi (fun j : J => X (e j)) let split1 := MeasurableEquiv.sumPiEquivProdPi (fun j : Unit ⊕ Unit => X (e (.inr j))) let one0 := MeasurableEquiv.piUnique (fun _ : Unit => X .complete) let one1 := MeasurableEquiv.piUnique (fun _ : Unit => X .sharedLeft) let one2 := MeasurableEquiv.piUnique (fun _ : Unit => X .sharedRight) let finish := MeasurableEquiv.prodCongr one0 (MeasurableEquiv.prodCongr one1 one2) let total := reindex.symm.trans <| split0.trans <| (MeasurableEquiv.prodCongr (MeasurableEquiv.refl _) split1).trans finish have htotal : MeasurePreserving total (Measure.pi mu) ((mu .complete).prod ((mu .sharedLeft).prod (mu .sharedRight))) := by have hr := (measurePreserving_piCongrLeft mu e).symm have hs0 := measurePreserving_sumPiEquivProdPi (fun j : J => mu (e j)) have hs1 := measurePreserving_sumPiEquivProdPi (fun j : Unit ⊕ Unit => mu (e (.inr j))) have hu0 := measurePreserving_piUnique (fun _ : Unit => mu .complete) have hu1 := measurePreserving_piUnique (fun _ : Unit => mu .sharedLeft) have hu2 := measurePreserving_piUnique (fun _ : Unit => mu .sharedRight) exact (hu0.prod (hu1.prod hu2)).comp (((MeasurePreserving.id _).prod hs1).comp (hs0.comp hr)) have hfun : (total : ((i : ThreePoolIndex) → X i) → _) = unpackThreePool := by funext z apply Prod.ext · rfl · apply Prod.ext <;> rfl rw [← hfun] exact htotal.map_eq
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.map_unpackThreePool_pi · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridThreePoolPrefix.lean:31
def splitThreeBlocks

Split an array into three consecutive blocks. the stated conditions the stated conclusion.

Definition (Lean source)
X :
Type*
a b c :
z :
Fin (a + (b + c)) → X
splitThreeBlocks a b c z :
(Fin a → X) × ((Fin b → X) × (Fin c → X))
e :
(Equiv.sumCongr (Equiv.refl _) finSumFinEquiv).trans finSumFinEquiv (: Fin a ⊕ (Fin b ⊕ Fin c) ≃ Fin (a + (b + c)))
(fun i ↦ z (e (.inl i)), fun i ↦ z (e (.inr (.inl i))), fun i ↦ z (e (.inr (.inr i))))
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.splitThreeBlocks · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridThreePoolPrefix.lean:82
theorem splitThreeBlocks_fst_apply

For lengths a, b, and c, the first block of an array at an index is its entry at that index.

Formal statement
X :
Type*
a b c :
z :
Fin (a + (b + c)) → X
i :
Fin a
(splitThreeBlocks a b c z).1 i = z ⟨i.1, by omega⟩
Proof (Lean source)
@[simp] lemma splitThreeBlocks_fst_apply {X : Type*} (a b c : Nat) (z : Fin (a + (b + c)) → X) (i : Fin a) : (splitThreeBlocks a b c z).1 i = z ⟨i.1, by omega⟩ := by rfl
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.splitThreeBlocks_fst_apply · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridThreePoolPrefix.lean:92
theorem splitThreeBlocks_mid_apply

For lengths a, b, and c, the middle block of an array at an index is its entry offset by the first block length.

Formal statement
X :
Type*
a b c :
z :
Fin (a + (b + c)) → X
i :
Fin b
(splitThreeBlocks a b c z).2.1 i = z ⟨a + i.1, by omega⟩
Proof (Lean source)
@[simp] lemma splitThreeBlocks_mid_apply {X : Type*} (a b c : Nat) (z : Fin (a + (b + c)) → X) (i : Fin b) : (splitThreeBlocks a b c z).2.1 i = z ⟨a + i.1, by omega⟩ := by rfl
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.splitThreeBlocks_mid_apply · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridThreePoolPrefix.lean:98
theorem splitThreeBlocks_last_apply

For lengths a, b, and c, the last block of an array at an index is its entry offset by the first two block lengths.

Formal statement
X :
Type*
a b c :
z :
Fin (a + (b + c)) → X
i :
Fin c
(splitThreeBlocks a b c z).2.2 i = z ⟨a + b + i.1, by omega⟩
Proof (Lean source)
@[simp] lemma splitThreeBlocks_last_apply {X : Type*} (a b c : Nat) (z : Fin (a + (b + c)) → X) (i : Fin c) : (splitThreeBlocks a b c z).2.2 i = z ⟨a + b + i.1, by omega⟩ := by change z (((Equiv.sumCongr (Equiv.refl (Fin a)) finSumFinEquiv).trans finSumFinEquiv) (.inr (.inr i))) = _ apply congrArg z apply Fin.ext simp omega
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.splitThreeBlocks_last_apply · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridThreePoolPrefix.lean:104
theorem measurable_splitThreeBlocks

Splitting an array into blocks of lengths a, b, and c is measurable.

Formal statement
X :
a b c :
Measurable (splitThreeBlocks (X := X) a b c)
Proof (Lean source)
@[fun_prop] lemma measurable_splitThreeBlocks {X : Type*} [MeasurableSpace X] (a b c : Nat) : Measurable (splitThreeBlocks (X := X) a b c) := by unfold splitThreeBlocks fun_prop
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.measurable_splitThreeBlocks · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridThreePoolPrefix.lean:115
theorem map_pi_splitThreeBlocks

Three consecutive blocks of an iid array are independent iid arrays. the stated conclusion.

Formal statement
X :
a b c :
Measure.map (splitThreeBlocks (X := X) a b c) (Measure.pi fun _ : Fin (a + (b + c)) ↦ mu)
= (Measure.pi fun _ : Fin a ↦ mu).prod ((Measure.pi fun _ : Fin b ↦ mu).prod (Measure.pi fun _ : Fin c ↦ mu))
Proof (Lean source)
lemma map_pi_splitThreeBlocks {X : Type*} [MeasurableSpace X] (mu : Measure X) [IsProbabilityMeasure mu] (a b c : Nat) : Measure.map (splitThreeBlocks (X := X) a b c) (Measure.pi fun _ : Fin (a + (b + c)) ↦ mu) = (Measure.pi fun _ : Fin a ↦ mu).prod ((Measure.pi fun _ : Fin b ↦ mu).prod (Measure.pi fun _ : Fin c ↦ mu)) := by let I := Fin a ⊕ (Fin b ⊕ Fin c) let e : I ≃ Fin (a + (b + c)) := (Equiv.sumCongr (Equiv.refl _) finSumFinEquiv).trans finSumFinEquiv let reindex := MeasurableEquiv.piCongrLeft (fun _ : Fin (a + (b + c)) ↦ X) e let splitA := MeasurableEquiv.sumPiEquivProdPi (fun _ : Fin a ⊕ (Fin b ⊕ Fin c) ↦ X) let splitBC := MeasurableEquiv.sumPiEquivProdPi (fun _ : Fin b ⊕ Fin c ↦ X) let total := reindex.symm.trans <| splitA.trans <| MeasurableEquiv.prodCongr (MeasurableEquiv.refl _) splitBC have htotal : MeasurePreserving total (Measure.pi fun _ : Fin (a + (b + c)) ↦ mu) ((Measure.pi fun _ : Fin a ↦ mu).prod ((Measure.pi fun _ : Fin b ↦ mu).prod (Measure.pi fun _ : Fin c ↦ mu))) := by exact ((MeasurePreserving.id _).prod (measurePreserving_sumPiEquivProdPi (fun _ : Fin b ⊕ Fin c ↦ mu))).comp ((measurePreserving_sumPiEquivProdPi (fun _ : Fin a ⊕ (Fin b ⊕ Fin c) ↦ mu)).comp (measurePreserving_piCongrLeft (fun _ : Fin (a + (b + c)) ↦ mu) e).symm) have hfun : (total : (Fin (a + (b + c)) → X) → _) = splitThreeBlocks a b c := by funext z apply Prod.ext · funext i rfl · apply Prod.ext <;> funext i · rfl · rfl rw [← hfun] exact htotal.map_eq
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.map_pi_splitThreeBlocks · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridThreePoolPrefix.lean:122
theorem map_pairByPool

Regroup two independent families by pool and apply each pool map. the stated conditions the stated conclusion.

Formal statement
mu0 :
mu1 :
mu2 :
nu1 :
nu2 :
f1 :
A1 × B1 → C1
f2 :
A2 × B2 → C2
rho1 :
rho2 :
hf1 :
MeasurePreserving f1 (mu1.prod nu1) rho1
hf2 :
MeasurePreserving f2 (mu2.prod nu2) rho2
Measure.map (fun z : (A0 × (A1 × A2)) × (B1 × B2) ↦ (z.1.1, f1 (z.1.2.1, z.2.1), f2 (z.1.2.2, z.2.2))) ((mu0.prod (mu1.prod mu2)).prod (nu1.prod nu2))
= mu0.prod (rho1.prod rho2)
Proof (Lean source)
lemma map_pairByPool {A0 A1 A2 B1 B2 C1 C2 : Type*} [MeasurableSpace A0] [MeasurableSpace A1] [MeasurableSpace A2] [MeasurableSpace B1] [MeasurableSpace B2] [MeasurableSpace C1] [MeasurableSpace C2] (mu0 : Measure A0) (mu1 : Measure A1) (mu2 : Measure A2) (nu1 : Measure B1) (nu2 : Measure B2) [IsProbabilityMeasure mu0] [IsProbabilityMeasure mu1] [IsProbabilityMeasure mu2] [IsProbabilityMeasure nu1] [IsProbabilityMeasure nu2] (f1 : A1 × B1 → C1) (f2 : A2 × B2 → C2) {rho1 : Measure C1} {rho2 : Measure C2} (hf1 : MeasurePreserving f1 (mu1.prod nu1) rho1) (hf2 : MeasurePreserving f2 (mu2.prod nu2) rho2) : Measure.map (fun z : (A0 × (A1 × A2)) × (B1 × B2) ↦ (z.1.1, f1 (z.1.2.1, z.2.1), f2 (z.1.2.2, z.2.2))) ((mu0.prod (mu1.prod mu2)).prod (nu1.prod nu2)) = mu0.prod (rho1.prod rho2) := by let hInner0 := measurePreserving_prodAssoc mu1 mu2 (nu1.prod nu2) let hMove0 := (measurePreserving_prodAssoc mu2 nu1 nu2).symm let hSwap : MeasurePreserving swap (mu2.prod nu1) (nu1.prod mu2) := Measure.measurePreserving_swap let hMove1 := measurePreserving_prodAssoc nu1 mu2 nu2 let hMiddle := hMove1.comp (((hSwap.prod (MeasurePreserving.id nu2))).comp hMove0) let hInner1 := ((MeasurePreserving.id mu1).prod hMiddle).comp hInner0 let hInner := (measurePreserving_prodAssoc mu1 nu1 (mu2.prod nu2)).symm.comp hInner1 let hOuter := ((MeasurePreserving.id mu0).prod hInner).comp (measurePreserving_prodAssoc mu0 (mu1.prod mu2) (nu1.prod nu2)) let hFinal := ((MeasurePreserving.id mu0).prod (hf1.prod hf2)).comp hOuter let g := fun z : (A0 × (A1 × A2)) × (B1 × B2) ↦ (z.1.1, f1 (z.1.2.1, z.2.1), f2 (z.1.2.2, z.2.2)) change MeasurePreserving g ((mu0.prod (mu1.prod mu2)).prod (nu1.prod nu2)) (mu0.prod (rho1.prod rho2)) at hFinal exact hFinal.map_eq
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.map_pairByPool · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridThreePoolPrefix.lean:164
def unpackHybridPools

Explicit tuple projection for the paper's three fixed pool sizes. the stated conditions the stated conclusion.

Definition (Lean source)
n m d :
z :
FixedPools (ThreePoolAlphabet (Obs d) (AuxObs d)) (threePoolCapacity (blockSizes n m).M0 ((blockSizes n m).np + (blockSizes n m).mp) ((blockSizes n m).nf + (blockSizes n m).mf))
unpackHybridPools z :
(Fin (blockSizes n m).M0 → Obs d) × ((Fin ((blockSizes n m).np + (blockSizes n m).mp) → AuxObs d) × (Fin ((blockSizes n m).nf + (blockSizes n m).mf) → AuxObs d))
(z .complete, z .sharedLeft, z .sharedRight)
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.unpackHybridPools · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridThreePoolPrefix.lean:204
theorem measurable_unpackHybridPools

Unpacking hybrid pools for labeled size, auxiliary size, and dimension is measurable.

Formal statement
n m d :
Measurable (unpackHybridPools (n := n) (m := m) (d := d))
Proof (Lean source)
@[fun_prop] lemma measurable_unpackHybridPools (n m d : Nat) : Measurable (unpackHybridPools (n := n) (m := m) (d := d)) := by exact (measurable_pi_apply ThreePoolIndex.complete).prodMk ((measurable_pi_apply ThreePoolIndex.sharedLeft).prodMk (measurable_pi_apply ThreePoolIndex.sharedRight))
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.measurable_unpackHybridPools · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridThreePoolPrefix.lean:215
def unpackHybridPoolsEquiv

This declaration defines the specified object.

Definition (Lean source)
n m d :
unpackHybridPoolsEquiv :
FixedPools (ThreePoolAlphabet (Obs d) (AuxObs d)) (threePoolCapacity (blockSizes n m).M0 ((blockSizes n m).np + (blockSizes n m).mp) ((blockSizes n m).nf + (blockSizes n m).mf)) ≃ᵐ (Fin (blockSizes n m).M0 → Obs d) × ((Fin ((blockSizes n m).np + (blockSizes n m).mp) → AuxObs d) × (Fin ((blockSizes n m).nf + (blockSizes n m).mf) → AuxObs d))
clause 1
clause 2
invFun z i := by cases i with | complete
=> exact z.1 | sharedLeft => exact z.2.1 | sharedRight => exact z.2.2
clause 3
left_inv z := by funext i; cases i <;> rfl
clause 4
right_inv z := by rcases z with ⟨z0, z1, z2⟩; rfl
clause 5
measurable_toFun := measurable_unpackHybridPools _ _ _
clause 6
measurable_invFun := by apply measurable_pi_lambda intro i cases i · exact measurable_fst · exact measurable_fst.comp measurable_snd · exact measurable_snd.comp measurable_snd
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.unpackHybridPoolsEquiv · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridThreePoolPrefix.lean:221
theorem map_unpackHybridPools_fixedPoolsLaw

The formal statement establishes the stated conclusion.

Formal statement
n m d :
P :
Measure.map unpackHybridPools (fixedPoolsLaw (threePoolObservationLaw (obsLaw P) (auxMarginal P).toMeasure) (threePoolCapacity (blockSizes n m).M0 ((blockSizes n m).np + (blockSizes n m).mp) ((blockSizes n m).nf + (blockSizes n m).mf)))
= (Measure.pi fun _ : Fin (blockSizes n m).M0 ↦ obsLaw P).prod ((Measure.pi fun _ : Fin ((blockSizes n m).np + (blockSizes n m).mp) ↦ (auxMarginal P).toMeasure).prod (Measure.pi fun _ : Fin ((blockSizes n m).nf + (blockSizes n m).mf) ↦ (auxMarginal P).toMeasure))
Proof (Lean source)
lemma map_unpackHybridPools_fixedPoolsLaw {n m d : Nat} (P : DiscreteLaw d) : Measure.map unpackHybridPools (fixedPoolsLaw (threePoolObservationLaw (obsLaw P) (auxMarginal P).toMeasure) (threePoolCapacity (blockSizes n m).M0 ((blockSizes n m).np + (blockSizes n m).mp) ((blockSizes n m).nf + (blockSizes n m).mf))) = (Measure.pi fun _ : Fin (blockSizes n m).M0 ↦ obsLaw P).prod ((Measure.pi fun _ : Fin ((blockSizes n m).np + (blockSizes n m).mp) ↦ (auxMarginal P).toMeasure).prod (Measure.pi fun _ : Fin ((blockSizes n m).nf + (blockSizes n m).mf) ↦ (auxMarginal P).toMeasure)) := by let X := fun i ↦ Fin (threePoolCapacity (blockSizes n m).M0 ((blockSizes n m).np + (blockSizes n m).mp) ((blockSizes n m).nf + (blockSizes n m).mf) i) → ThreePoolAlphabet (Obs d) (AuxObs d) i have hfun : (unpackHybridPools (n := n) (m := m) (d := d)) = unpackThreePool (X := X) := by rfl rw [hfun] unfold fixedPoolsLaw exact map_unpackThreePool_pi (mu := fun i ↦ Measure.pi fun _ : Fin (threePoolCapacity (blockSizes n m).M0 ((blockSizes n m).np + (blockSizes n m).mp) ((blockSizes n m).nf + (blockSizes n m).mf) i) ↦ threePoolObservationLaw (obsLaw P) (auxMarginal P).toMeasure i)
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.map_unpackHybridPools_fixedPoolsLaw · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridThreePoolPrefix.lean:247
def hybridFixedPools

The complete, pilot, and factorial fixed blocks extracted from the two samples. the stated conditions the stated conclusion.

Definition (Lean source)
n m d :
sample :
Sample n m d
hybridFixedPools sample :
FixedPools (ThreePoolAlphabet (Obs d) (AuxObs d)) (threePoolCapacity (blockSizes n m).M0 ((blockSizes n m).np + (blockSizes n m).mp) ((blockSizes n m).nf + (blockSizes n m).mf))
by let bs := blockSizes n m have hn : bs.M0 + (bs.np + bs.nf)
= n := by dsimp [bs, blockSizes] omega have hm : 0
+ (bs.mp + bs.mf)
= m := by dsimp [bs, blockSizes] omega let labeled := splitThreeBlocks bs.M0 bs.np bs.nf (fun i ↦ sample.1 (cast hn i)) let auxiliary := splitThreeBlocks 0 bs.mp bs.mf (fun i ↦ sample.2 (cast hm i)) let project : Obs d → AuxObs d := fun z ↦ (z.1, z.2.1) intro i cases i with | complete => change Fin bs.M0 → Obs d exact labeled.1 | sharedLeft => change Fin (bs.np + bs.mp) → AuxObs d exact append (fun j ↦ project (labeled.2.1 j)) auxiliary.2.1 | sharedRight => change Fin (bs.nf + bs.mf) → AuxObs d exact append (fun j ↦ project (labeled.2.2 j)) auxiliary.2.2
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.hybridFixedPools · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridThreePoolPrefix.lean:279
theorem measurable_hybridFixedPools

Selecting the three hybrid pools for labeled size, auxiliary size, and dimension is measurable.

Formal statement
n m d :
Measurable (hybridFixedPools (n := n) (m := m) (d := d))
Proof (Lean source)
@[fun_prop] lemma measurable_hybridFixedPools (n m d : Nat) : Measurable (hybridFixedPools (n := n) (m := m) (d := d)) := by apply measurable_pi_lambda intro i cases i <;> simp only [hybridFixedPools] all_goals fun_prop
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.measurable_hybridFixedPools · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridThreePoolPrefix.lean:309
def hybridPrefixCounts

Histograms of a three-pool finite prefix, arranged as the hybrid count tensor. the stated conditions the stated conclusion.

Definition (Lean source)
d :
hybridPrefixCounts s :
h0 :
hp :
hf :
finiteSampleHistogram (s .sharedRight).points
fun x a => (h0 (x, a, true), hp (x, a), hf (x, a))
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.hybridPrefixCounts · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridThreePoolPrefix.lean:317
theorem measurable_hybridPrefixCounts

Forming hybrid count tensors from three finite prefixes is measurable.

Formal statement
d :
Proof (Lean source)
@[fun_prop] lemma measurable_hybridPrefixCounts {d : Nat} : Measurable (hybridPrefixCounts (d := d)) := by have h0 : Measurable (fun s : PrefixFamily (ThreePoolAlphabet (Obs d) (AuxObs d)) ↦ finiteSampleHistogram (s ThreePoolIndex.complete).points) := measurable_finiteSampleHistogram.comp (measurable_pi_apply ThreePoolIndex.complete) have hp : Measurable (fun s : PrefixFamily (ThreePoolAlphabet (Obs d) (AuxObs d)) ↦ finiteSampleHistogram (s ThreePoolIndex.sharedLeft).points) := measurable_finiteSampleHistogram.comp (measurable_pi_apply ThreePoolIndex.sharedLeft) have hf : Measurable (fun s : PrefixFamily (ThreePoolAlphabet (Obs d) (AuxObs d)) ↦ finiteSampleHistogram (s ThreePoolIndex.sharedRight).points) := measurable_finiteSampleHistogram.comp (measurable_pi_apply ThreePoolIndex.sharedRight) exact measurable_pi_lambda _ fun x ↦ measurable_pi_lambda _ fun a ↦ ((measurable_pi_apply (x, a, true)).comp h0).prodMk (((measurable_pi_apply (x, a)).comp hp).prodMk ((measurable_pi_apply (x, a)).comp hf))
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.measurable_hybridPrefixCounts · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridThreePoolPrefix.lean:326
def finitePrefixHybridStatistic

The clipped hybrid statistic viewed as a statistic of three finite prefixes. the stated conditions the stated conclusion.

Definition (Lean source)
d :
n m :
eps :
finitePrefixHybridStatistic n m eps s :
bs :
hybridPoissonStatistic n m eps (bs.M0 / 8) ((bs.nf + bs.mf : Nat) / 8) (hybridPrefixCounts s)
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.finitePrefixHybridStatistic · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridThreePoolPrefix.lean:349
theorem measurable_finitePrefixHybridStatistic

The finite-prefix hybrid statistic at labeled size, auxiliary size, and overlap level is measurable.

Formal statement
d :
n m :
eps :
Proof (Lean source)
@[fun_prop] lemma measurable_finitePrefixHybridStatistic {d : Nat} (n m : Nat) (eps : Real) : Measurable (finitePrefixHybridStatistic (d := d) n m eps) := by unfold finitePrefixHybridStatistic have hs : Measurable (hybridPoissonStatistic (d := d) n m eps ((blockSizes n m).M0 / 8) (((blockSizes n m).nf + (blockSizes n m).mf : Nat) / 8)) := measurable_of_countable _ exact hs.comp measurable_hybridPrefixCounts
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.measurable_finitePrefixHybridStatistic · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridThreePoolPrefix.lean:357
theorem finitePrefixHybridStatistic_mem_Icc

The formal statement establishes the stated conclusion.

Formal statement
d :
n m :
eps :
finitePrefixHybridStatistic n m eps s ∈ Icc (-1 : Real) 1
Proof (Lean source)
lemma finitePrefixHybridStatistic_mem_Icc {d : Nat} (n m : Nat) (eps : Real) (s : PrefixFamily (ThreePoolAlphabet (Obs d) (AuxObs d))) : finitePrefixHybridStatistic n m eps s ∈ Icc (-1 : Real) 1 := by exact hybridPoissonStatistic_mem_Icc n m eps _ _ _
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.finitePrefixHybridStatistic_mem_Icc · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridThreePoolPrefix.lean:367
theorem hybridFixedPools_map_annotationLaw

The extracted fixed blocks have exactly the generic three-pool iid law. the stated conclusion.

Formal statement
n m d :
P :
Measure.map (hybridFixedPools (n := n) (m := m) (d := d)) (annotationLaw P n m)
= fixedPoolsLaw (threePoolObservationLaw (obsLaw P) (auxMarginal P).toMeasure) (threePoolCapacity (blockSizes n m).M0 ((blockSizes n m).np + (blockSizes n m).mp) ((blockSizes n m).nf + (blockSizes n m).mf))
Proof (Lean source)
lemma hybridFixedPools_map_annotationLaw {n m d : Nat} (P : DiscreteLaw d) : Measure.map (hybridFixedPools (n := n) (m := m) (d := d)) (annotationLaw P n m) = fixedPoolsLaw (threePoolObservationLaw (obsLaw P) (auxMarginal P).toMeasure) (threePoolCapacity (blockSizes n m).M0 ((blockSizes n m).np + (blockSizes n m).mp) ((blockSizes n m).nf + (blockSizes n m).mf)) := by let bs := blockSizes n m have hn : bs.M0 + (bs.np + bs.nf) = n := by dsimp [bs, blockSizes] omega have hm : 0 + (bs.mp + bs.mf) = m := by dsimp [bs, blockSizes] omega let castL : (Fin n → Obs d) → Fin (bs.M0 + (bs.np + bs.nf)) → Obs d := fun z i ↦ z (cast hn i) let castA : (Fin m → AuxObs d) → Fin (0 + (bs.mp + bs.mf)) → AuxObs d := fun z i ↦ z (cast hm i) let lab := splitThreeBlocks bs.M0 bs.np bs.nf ∘ castL let aux := (fun z ↦ z.2) ∘ splitThreeBlocks 0 bs.mp bs.mf ∘ castA let mu0 := Measure.pi fun _ : Fin bs.M0 ↦ obsLaw P let muP := Measure.pi fun _ : Fin bs.np ↦ obsLaw P let muF := Measure.pi fun _ : Fin bs.nf ↦ obsLaw P let nuP := Measure.pi fun _ : Fin bs.mp ↦ (auxMarginal P).toMeasure let nuF := Measure.pi fun _ : Fin bs.mf ↦ (auxMarginal P).toMeasure let rhoP := Measure.pi fun _ : Fin (bs.np + bs.mp) ↦ (auxMarginal P).toMeasure let rhoF := Measure.pi fun _ : Fin (bs.nf + bs.mf) ↦ (auxMarginal P).toMeasure have hcastL : Measure.map castL (labeledProductLaw P n) = Measure.pi fun _ : Fin (bs.M0 + (bs.np + bs.nf)) ↦ obsLaw P := (measurePreserving_piCongrLeft (fun _ : Fin (bs.M0 + (bs.np + bs.nf)) ↦ obsLaw P) (finCongr hn).symm).map_eq have hcastA : Measure.map castA (auxProductLaw P m) = Measure.pi fun _ : Fin (0 + (bs.mp + bs.mf)) ↦ (auxMarginal P).toMeasure := (measurePreserving_piCongrLeft (fun _ : Fin (0 + (bs.mp + bs.mf)) ↦ (auxMarginal P).toMeasure) (finCongr hm).symm).map_eq have hlab : Measure.map lab (labeledProductLaw P n) = mu0.prod (muP.prod muF) := by rw [show Measure.map lab (labeledProductLaw P n) = Measure.map (splitThreeBlocks bs.M0 bs.np bs.nf) (Measure.map castL (labeledProductLaw P n)) by rw [Measure.map_map (measurable_splitThreeBlocks _ _ _) (by fun_prop)] ] rw [hcastL, map_pi_splitThreeBlocks] have haux : Measure.map aux (auxProductLaw P m) = nuP.prod nuF := by rw [show Measure.map aux (auxProductLaw P m) = Measure.map snd (Measure.map (splitThreeBlocks 0 bs.mp bs.mf) (Measure.map castA (auxProductLaw P m))) by rw [Measure.map_map (measurable_splitThreeBlocks _ _ _) (by fun_prop), Measure.map_map measurable_snd ((measurable_splitThreeBlocks _ _ _).comp (by fun_prop))] ] rw [hcastA, map_pi_splitThreeBlocks] exact MeasureTheory.measurePreserving_snd.map_eq let project : Obs d → AuxObs d := fun z ↦ (z.1, z.2.1) have hproject : Measure.map project (obsLaw P) = (auxMarginal P).toMeasure := PMF.toMeasure_map (p := P.pmf) (f := project) (by fun_prop) let fP : (Fin bs.np → Obs d) × (Fin bs.mp → AuxObs d) → (Fin (bs.np + bs.mp) → AuxObs d) := fun z ↦ append (fun i ↦ project (z.1 i)) z.2 let fF : (Fin bs.nf → Obs d) × (Fin bs.mf → AuxObs d) → (Fin (bs.nf + bs.mf) → AuxObs d) := fun z ↦ append (fun i ↦ project (z.1 i)) z.2 have hfpMap : Measure.map fP (muP.prod nuP) = rhoP := by let coord := fun z : Fin bs.np → Obs d ↦ fun i ↦ project (z i) have hc : Measure.map coord muP = Measure.pi fun _ : Fin bs.np ↦ (auxMarginal P).toMeasure := by rw [map_pi_finCoordinatewise bs.np (obsLaw P) (by fun_prop)] simp [hproject] rw [show Measure.map fP (muP.prod nuP) = Measure.map (fun z ↦ append z.1 z.2) (Measure.map (map coord id) (muP.prod nuP)) by rw [Measure.map_map (by fun_prop) (by fun_prop)] rfl] rw [← Measure.map_prod_map _ _ (by fun_prop : Measurable coord) measurable_id, hc, Measure.map_id, map_prod_finAppend] have hffMap : Measure.map fF (muF.prod nuF) = rhoF := by let coord := fun z : Fin bs.nf → Obs d ↦ fun i ↦ project (z i) have hc : Measure.map coord muF = Measure.pi fun _ : Fin bs.nf ↦ (auxMarginal P).toMeasure := by rw [map_pi_finCoordinatewise bs.nf (obsLaw P) (by fun_prop)] simp [hproject] rw [show Measure.map fF (muF.prod nuF) = Measure.map (fun z ↦ append z.1 z.2) (Measure.map (map coord id) (muF.prod nuF)) by rw [Measure.map_map (by fun_prop) (by fun_prop)] rfl] rw [← Measure.map_prod_map _ _ (by fun_prop : Measurable coord) measurable_id, hc, Measure.map_id, map_prod_finAppend] have hfp : MeasurePreserving fP (muP.prod nuP) rhoP := ⟨by fun_prop, hfpMap⟩ have hff : MeasurePreserving fF (muF.prod nuF) rhoF := ⟨by fun_prop, hffMap⟩ let stage := map lab aux let finish := fun z : ((Fin bs.M0 → Obs d) × ((Fin bs.np → Obs d) × (Fin bs.nf → Obs d))) × ((Fin bs.mp → AuxObs d) × (Fin bs.mf → AuxObs d)) ↦ (z.1.1, fP (z.1.2.1, z.2.1), fF (z.1.2.2, z.2.2)) have hsource : Measure.map stage (annotationLaw P n m) = (mu0.prod (muP.prod muF)).prod (nuP.prod nuF) := by unfold annotationLaw rw [← Measure.map_prod_map _ _ (by fun_prop : Measurable lab) (by fun_prop : Measurable aux), hlab, haux] have hfinish : Measure.map finish ((mu0.prod (muP.prod muF)).prod (nuP.prod nuF)) = mu0.prod (rhoP.prod rhoF) := map_pairByPool mu0 muP muF nuP nuF fP fF hfp hff have hlhs : Measure.map (unpackHybridPools (n := n) (m := m) (d := d)) (Measure.map hybridFixedPools (annotationLaw P n m)) = mu0.prod (rhoP.prod rhoF) := by have hmap0 : Measure.map unpackHybridPools (Measure.map hybridFixedPools (annotationLaw P n m)) = Measure.map (unpackHybridPools ∘ hybridFixedPools) (annotationLaw P n m) := Measure.map_map (measurable_unpackHybridPools n m d) (measurable_hybridFixedPools n m d) calc _ = Measure.map (unpackHybridPools ∘ hybridFixedPools) (annotationLaw P n m) := hmap0 _ = Measure.map (finish ∘ stage) (annotationLaw P n m) := by rfl _ = Measure.map finish (Measure.map stage (annotationLaw P n m)) := (Measure.map_map (by fun_prop : Measurable finish) (by fun_prop : Measurable stage)).symm _ = Measure.map finish ((mu0.prod (muP.prod muF)).prod (nuP.prod nuF)) := by rw [hsource] _ = _ := hfinish apply ((unpackHybridPoolsEquiv (n := n) (m := m) (d := d)).measurableEmbedding.map_injective) change Measure.map unpackHybridPools (Measure.map hybridFixedPools (annotationLaw P n m)) = Measure.map unpackHybridPools (fixedPoolsLaw (threePoolObservationLaw (obsLaw P) (auxMarginal P).toMeasure) (threePoolCapacity (blockSizes n m).M0 ((blockSizes n m).np + (blockSizes n m).mp) ((blockSizes n m).nf + (blockSizes n m).mf))) rw [hlhs] simpa only [mu0, rhoP, rhoF] using (map_unpackHybridPools_fixedPoolsLaw (n := n) (m := m) P).symm
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.hybridFixedPools_map_annotationLaw · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridThreePoolPrefix.lean:375
CausalSmith.Stat.STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research.Helpers.HybridThreePoolRaoBlackwell 1 declarations Explicit evaluation of the paper's three-pool Rao--Blackwell statistic.

Explicit evaluation of the paper's three-pool Rao--Blackwell statistic.

theorem prefixRaoBlackwellStatistic_hybridFixedPools

On calibration, the abstract three-pool conditional expectation is exactly the displayed finite weighted sum defining mixedEstimator. the stated conditions the stated conclusion.

Formal statement
n m d :
eps :
hcal :
sample :
Sample n m d
prefixRaoBlackwellStatistic (threePoolIntensity (toNNReal ((blockSizes n m).M0 / 8 : Real)) (toNNReal (((blockSizes n m).np + (blockSizes n m).mp : Nat) / 8 : Real)) (toNNReal (((blockSizes n m).nf + (blockSizes n m).mf : Nat) / 8 : Real))) (finitePrefixHybridStatistic n m eps) 0 (hybridFixedPools sample)
= mixedEstimator n m d eps sample
Proof (Lean source)
lemma prefixRaoBlackwellStatistic_hybridFixedPools {n m d : Nat} (eps : Real) (hcal : calibrationPredicate n m eps) (sample : Sample n m d) : prefixRaoBlackwellStatistic (threePoolIntensity (toNNReal ((blockSizes n m).M0 / 8 : Real)) (toNNReal (((blockSizes n m).np + (blockSizes n m).mp : Nat) / 8 : Real)) (toNNReal (((blockSizes n m).nf + (blockSizes n m).mf : Nat) / 8 : Real))) (finitePrefixHybridStatistic n m eps) 0 (hybridFixedPools sample) = mixedEstimator n m d eps sample := by classical let bs := blockSizes n m let u : Real := bs.M0 / 8 let tp : Real := (bs.np + bs.mp : Nat) / 8 let t : Real := (bs.nf + bs.mf : Nat) / 8 let T := finitePrefixHybridStatistic (d := d) n m eps let lam := threePoolIntensity (toNNReal u) (toNNReal tp) (toNNReal t) let pools := hybridFixedPools sample rw [prefixRaoBlackwellStatistic_eq_integral lam T (measurable_finitePrefixHybridStatistic n m eps) 0 pools] let f : (ThreePoolIndex → Nat) → Real := fun counts ↦ cappedPrefixStatistic T 0 (fun i ↦ (pools i, counts i)) let g : Nat × (Nat × Nat) → Real := fun counts ↦ f (packThreeNat counts) have hfg : f = g ∘ unpackThreePool := by funext counts simp only [Function.comp_apply, g, packThreeNat_unpack] change (∫ counts, f counts ∂Measure.pi (fun i ↦ poissonMeasure (lam i))) = _ rw [hfg] have hg : AEStronglyMeasurable g (Measure.map unpackThreePool (Measure.pi (fun i ↦ poissonMeasure (lam i)))) := (measurable_of_countable _).aestronglyMeasurable have hIntegral : (∫ counts, (g ∘ unpackThreePool) counts ∂Measure.pi (fun i ↦ poissonMeasure (lam i))) = ∫ z, g z ∂Measure.map unpackThreePool (Measure.pi (fun i ↦ poissonMeasure (lam i))) := (integral_map measurable_unpackThreePool.aemeasurable hg).symm rw [hIntegral] rw [map_unpackThreePool_pi] simp only [lam, threePoolIntensity] have hgBound (z : Nat × (Nat × Nat)) : ‖g z‖ ≤ 1 := by rw [Real.norm_eq_abs] by_cases hz : ∀ i, (packThreeNat z i) ≤ threePoolCapacity (blockSizes n m).M0 ((blockSizes n m).np + (blockSizes n m).mp) ((blockSizes n m).nf + (blockSizes n m).mf) i · rw [show g z = T (fun i ↦ prefixOfLE (pools i) (packThreeNat z i) (hz i)) by simp only [g, f, cappedPrefixStatistic, dif_pos hz]] exact abs_le.2 (finitePrefixHybridStatistic_mem_Icc n m eps _) · simp only [g, f, cappedPrefixStatistic, dif_neg hz, abs_zero] norm_num have hint : Integrable g ((poissonMeasure (toNNReal u)).prod ((poissonMeasure (toNNReal tp)).prod (poissonMeasure (toNNReal t)))) := by apply Integrable.of_bound (measurable_of_countable _).aestronglyMeasurable 1 filter_upwards [] with z exact hgBound z rw [integral_prod _ hint, integral_poissonMeasure] simp only [smul_eq_mul] rw [tsum_eq_sum (s := range (bs.M0 + 1))] · simp only [mixedEstimator, hcal, if_true] apply Finset.sum_congr rfl intro r0 hr0 have hr0le : r0 ≤ bs.M0 := Nat.lt_succ_iff.mp (Finset.mem_range.mp hr0) have hintPF : Integrable (fun z : Nat × Nat ↦ g (r0, z)) ((poissonMeasure (toNNReal tp)).prod (poissonMeasure (toNNReal t))) := by apply Integrable.of_bound (measurable_of_countable _).aestronglyMeasurable 1 filter_upwards [] with z exact hgBound (r0, z) rw [integral_prod _ hintPF, integral_poissonMeasure] simp only [smul_eq_mul] rw [tsum_eq_sum (s := range (bs.np + bs.mp + 1))] · rw [Finset.mul_sum] apply Finset.sum_congr rfl intro rp hrp have hrple : rp ≤ bs.np + bs.mp := Nat.lt_succ_iff.mp (Finset.mem_range.mp hrp) rw [integral_poissonMeasure] simp only [smul_eq_mul] rw [tsum_eq_sum (s := range (bs.nf + bs.mf + 1))] · simp only [mixedEstimator, hcal, if_true, bs, u, tp, t] rw [Finset.mul_sum, Finset.mul_sum] apply Finset.sum_congr rfl intro rf hrf have hrfle : rf ≤ bs.nf + bs.mf := Nat.lt_succ_iff.mp (Finset.mem_range.mp hrf) rw [show g (r0, rp, rf) = prefixOutput eps sample r0 rp rf by have hz : ∀ i, packThreeNat (r0, rp, rf) i ≤ threePoolCapacity (blockSizes n m).M0 ((blockSizes n m).np + (blockSizes n m).mp) ((blockSizes n m).nf + (blockSizes n m).mf) i := by intro i cases i <;> assumption simp only [g, f, cappedPrefixStatistic, dif_pos hz] exact finitePrefixHybridStatistic_fixedPools eps sample r0 rp rf hr0le hrple hrfle] simp only [ProbabilityTheory.poissonMeasure_singleton, MeasureTheory.measureReal_def] rw [ENNReal.toReal_ofReal (by positivity), ENNReal.toReal_ofReal (by positivity), ENNReal.toReal_ofReal (by positivity)] ring · intro rf hrf have hn : ¬ rf ≤ bs.nf + bs.mf := fun h ↦ hrf (Finset.mem_range.mpr (Nat.lt_succ_iff.mpr h)) have hz : ¬ ∀ i, packThreeNat (r0, rp, rf) i ≤ threePoolCapacity (blockSizes n m).M0 ((blockSizes n m).np + (blockSizes n m).mp) ((blockSizes n m).nf + (blockSizes n m).mf) i := fun h ↦ hn (h .sharedRight) simp [g, f, cappedPrefixStatistic, hz] · intro rp hrp have hn : ¬ rp ≤ bs.np + bs.mp := fun h ↦ hrp (Finset.mem_range.mpr (Nat.lt_succ_iff.mpr h)) have hzero (rf : Nat) : g (r0, rp, rf) = 0 := by have hz : ¬ ∀ i, packThreeNat (r0, rp, rf) i ≤ threePoolCapacity (blockSizes n m).M0 ((blockSizes n m).np + (blockSizes n m).mp) ((blockSizes n m).nf + (blockSizes n m).mf) i := fun h ↦ hn (h .sharedLeft) simp [g, f, cappedPrefixStatistic, hz] simp_rw [hzero] simp · intro r0 hr0 have hn : ¬ r0 ≤ bs.M0 := fun h ↦ hr0 (Finset.mem_range.mpr (Nat.lt_succ_iff.mpr h)) have hzero (z : Nat × Nat) : g (r0, z) = 0 := by have hz : ¬ ∀ i, packThreeNat (r0, z) i ≤ threePoolCapacity (blockSizes n m).M0 ((blockSizes n m).np + (blockSizes n m).mp) ((blockSizes n m).nf + (blockSizes n m).mf) i := fun h ↦ hn (h .complete) simp [g, f, cappedPrefixStatistic, hz] simp_rw [hzero] simp
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.prefixRaoBlackwellStatistic_hybridFixedPools · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridThreePoolRaoBlackwell.lean:32
CausalSmith.Stat.STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research.Helpers.HybridThreePoolReadback 1 declarations Readback of the generic three finite prefixes as the paper's block counts.

Readback of the generic three finite prefixes as the paper's block counts.

theorem finitePrefixHybridStatistic_fixedPools

The three retained generic prefixes read back as exactly the paper's complete, pilot, and factorial block counts. the stated conditions the stated conclusion.

Formal statement
n m d :
eps :
sample :
Sample n m d
r0 rp rf :
hr0 :
r0 ≤ (blockSizes n m).M0
hrp :
rp ≤ (blockSizes n m).np + (blockSizes n m).mp
hrf :
rf ≤ (blockSizes n m).nf + (blockSizes n m).mf
finitePrefixHybridStatistic n m eps (fun i ↦ match i with | ThreePoolIndex.complete => prefixOfLE (hybridFixedPools sample .complete) r0 hr0 | ThreePoolIndex.sharedLeft => prefixOfLE (hybridFixedPools sample .sharedLeft) rp hrp | ThreePoolIndex.sharedRight => prefixOfLE (hybridFixedPools sample .sharedRight) rf hrf)
= prefixOutput eps sample r0 rp rf
Proof (Lean source)
lemma finitePrefixHybridStatistic_fixedPools {n m d : Nat} (eps : Real) (sample : Sample n m d) (r0 rp rf : Nat) (hr0 : r0 ≤ (blockSizes n m).M0) (hrp : rp ≤ (blockSizes n m).np + (blockSizes n m).mp) (hrf : rf ≤ (blockSizes n m).nf + (blockSizes n m).mf) : finitePrefixHybridStatistic n m eps (fun i ↦ match i with | ThreePoolIndex.complete => prefixOfLE (hybridFixedPools sample .complete) r0 hr0 | ThreePoolIndex.sharedLeft => prefixOfLE (hybridFixedPools sample .sharedLeft) rp hrp | ThreePoolIndex.sharedRight => prefixOfLE (hybridFixedPools sample .sharedRight) rf hrf) = prefixOutput eps sample r0 rp rf := by classical let bs := blockSizes n m simp only [threePoolCapacity, ThreePoolAlphabet] at hr0 hrp hrf ⊢ change r0 ≤ bs.M0 at hr0 change rp ≤ bs.np + bs.mp at hrp change rf ≤ bs.nf + bs.mf at hrf have hmarked (x : Fin d) (a : Bool) : finiteSampleHistogram (prefixOfLE (hybridFixedPools sample .complete) r0 hr0).points (x, a, true) = labeledBlockCount sample.1 0 r0 x a true := by simp only [hybridFixedPools, threePoolCapacity, ThreePoolAlphabet, id_eq] rw [histogram_prefix_eq_filter] unfold labeledBlockCount have h := card_prefix_offset_eq_filter sample.1 (offset := 0) (L := bs.M0) (r := r0) (by dsimp [bs, blockSizes]; omega) hr0 (x, a, true) simpa [hybridFixedPools, bs] using h have hp (x : Fin d) (a : Bool) : finiteSampleHistogram (prefixOfLE (hybridFixedPools sample .sharedLeft) rp hrp).points (x, a) = pooledArmCount sample bs.M0 bs.np 0 rp x a := by simp only [hybridFixedPools, threePoolCapacity, ThreePoolAlphabet, id_eq] rw [histogram_prefix_append, histogram_prefix_forgetOutcome, histogram_prefix_eq_filter, histogram_prefix_eq_filter, histogram_prefix_eq_filter] unfold pooledArmCount labeledArmBlockCount labeledBlockCount auxiliaryBlockCount have hL0 := card_prefix_offset_eq_filter sample.1 (offset := bs.M0) (L := bs.np) (r := min rp bs.np) (by dsimp [bs, blockSizes]; omega) (Nat.min_le_right _ _) (x, a, false) have hL1 := card_prefix_offset_eq_filter sample.1 (offset := bs.M0) (L := bs.np) (r := min rp bs.np) (by dsimp [bs, blockSizes]; omega) (Nat.min_le_right _ _) (x, a, true) have hA := card_prefix_offset_eq_filter sample.2 (offset := 0) (L := bs.mp) (r := rp - bs.np) (by dsimp [bs, blockSizes]; omega) (by omega) (x, a) simpa [hybridFixedPools, bs] using (congrArg₂ (fun p q : Nat ↦ p + q) (congrArg₂ (fun p q : Nat ↦ p + q) hL0 hL1) hA) have hf (x : Fin d) (a : Bool) : finiteSampleHistogram (prefixOfLE (hybridFixedPools sample .sharedRight) rf hrf).points (x, a) = pooledArmCount sample (bs.M0 + bs.np) bs.nf bs.mp rf x a := by simp only [hybridFixedPools, threePoolCapacity, ThreePoolAlphabet, id_eq] rw [histogram_prefix_append, histogram_prefix_forgetOutcome, histogram_prefix_eq_filter, histogram_prefix_eq_filter, histogram_prefix_eq_filter] unfold pooledArmCount labeledArmBlockCount labeledBlockCount auxiliaryBlockCount have hL0 := card_prefix_offset_eq_filter sample.1 (offset := bs.M0 + bs.np) (L := bs.nf) (r := min rf bs.nf) (by dsimp [bs, blockSizes]; omega) (Nat.min_le_right _ _) (x, a, false) have hL1 := card_prefix_offset_eq_filter sample.1 (offset := bs.M0 + bs.np) (L := bs.nf) (r := min rf bs.nf) (by dsimp [bs, blockSizes]; omega) (Nat.min_le_right _ _) (x, a, true) have hA := card_prefix_offset_eq_filter sample.2 (offset := bs.mp) (L := bs.mf) (r := rf - bs.nf) (by dsimp [bs, blockSizes]; omega) (by omega) (x, a) simpa [hybridFixedPools, bs] using (congrArg₂ (fun p q : Nat ↦ p + q) (congrArg₂ (fun p q : Nat ↦ p + q) hL0 hL1) hA) simp only [hybridFixedPools, threePoolCapacity, ThreePoolAlphabet, id_eq] at hmarked hp hf ⊢ unfold finitePrefixHybridStatistic prefixOutput hybridPrefixCounts simp_rw [hmarked, hp, hf] rfl
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.finitePrefixHybridStatistic_fixedPools · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridThreePoolReadback.lean:169
CausalSmith.Stat.STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research.Helpers.HybridVarianceAlgebra 2 declarations Algebraic variance identities for the pilot-selected hybrid statistic.

Algebraic variance identities for the pilot-selected hybrid statistic.

theorem sq_sub_le_two_sq_add_two_sq

A difference of two arm contributions costs at most twice the sum of their squared contributions. the stated conclusion.

Formal statement
x y :
(x - y) ^ 2 ≤ 2 * x ^ 2 + 2 * y ^ 2
Proof (Lean source)
lemma sq_sub_le_two_sq_add_two_sq (x y : Real) : (x - y) ^ 2 ≤ 2 * x ^ 2 + 2 * y ^ 2 := by nlinarith [sq_nonneg (x + y)]
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.sq_sub_le_two_sq_add_two_sq · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridVarianceAlgebra.lean:15
theorem hybrid_clipUnit_sq_sub_le

Clipping to [-1,1] contracts squared loss for a target in that interval. the stated conditions the stated conclusion.

Formal statement
z theta :
htheta :
theta ∈ Icc (-1 : Real) 1
(clipUnit z - theta) ^ 2 ≤ (z - theta) ^ 2
Proof (Lean source)
lemma hybrid_clipUnit_sq_sub_le (z theta : Real) (htheta : theta ∈ Icc (-1 : Real) 1) : (clipUnit z - theta) ^ 2 ≤ (z - theta) ^ 2 := by rcases htheta with ⟨htheta0, htheta1⟩ simp only [clipUnit] by_cases hz0 : z < -1 · rw [min_eq_right (by linarith), max_eq_left hz0.le] nlinarith [sq_nonneg (z - theta)] · have hm0 : -1 ≤ min 1 z := by simp [le_min_iff, le_of_not_gt hz0] rw [max_eq_right hm0] by_cases hz1 : 1 < z · rw [min_eq_left hz1.le] nlinarith [sq_nonneg (z - theta)] · rw [min_eq_right (le_of_not_gt hz1)]
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.hybrid_clipUnit_sq_sub_le · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridVarianceAlgebra.lean:21
CausalSmith.Stat.STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research.Helpers.HybridVarianceAssembly 2 declarations Algebraic assembly of the calibrated hybrid variance.

Algebraic assembly of the calibrated hybrid variance.

theorem sum_heavy_branchMean_sq_le Lemma 10 in the paper ↗

The branch-mean part of C27 on heavy cells is negligible. the stated conditions the stated conclusion.

Formal statement
d :
eps :
P :
hP :
ModelClass d eps P
n m :
heps :
0 < eps
hn :
1 ≤ n
hcal :
bs :
u :
bs.M0 / 8 (: Real)
tp :
(bs.np + bs.mp : Nat) / 8 (: Real)
t :
(bs.nf + bs.mf : Nat) / 8 (: Real)
muE :
fun x : Fin d ↦ ((Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (u * markedMass P x a))).prod (Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (t * armMass P x a))))
(∑ x ∈ Finset.univ.filter (fun x : Fin d ↦ Bscale n m eps < cellMass P x), hybridPilotLightProbability P tp (k0 n m eps) x * hybridPilotHeavyProbability P tp (k0 n m eps) x * ((∫ W, hybridLightPools (Ldeg n) (Bscale n m eps) u t W ∂muE x) - ∫ W, hybridHeavyPools u W ∂muE x) ^ 2)
≤ 282 * ((n : Real) ^ 12)⁻¹
Proof (Lean source)
lemma sum_heavy_branchMean_sq_le {d : Nat} {eps : Real} (P : DiscreteLaw d) (hP : ModelClass d eps P) {n m : Nat} (heps : 0 < eps) (hn : 1 ≤ n) (hcal : calibrationPredicate n m eps) : let bs := blockSizes n m let u : Real := bs.M0 / 8 let tp : Real := (bs.np + bs.mp : Nat) / 8 let t : Real := (bs.nf + bs.mf : Nat) / 8 let muE := fun x : Fin d ↦ ((Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (u * markedMass P x a))).prod (Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (t * armMass P x a)))) (∑ x ∈ Finset.univ.filter (fun x : Fin d ↦ Bscale n m eps < cellMass P x), hybridPilotLightProbability P tp (k0 n m eps) x * hybridPilotHeavyProbability P tp (k0 n m eps) x * ((∫ W, hybridLightPools (Ldeg n) (Bscale n m eps) u t W ∂muE x) - ∫ W, hybridHeavyPools u W ∂muE x) ^ 2) ≤ 282 * ((n : Real) ^ 12)⁻¹ := by dsimp only classical let S : Finset (Fin d) := Finset.univ.filter (fun x ↦ Bscale n m eps < cellMass P x) let u : Real := (blockSizes n m).M0 / 8 let tp : Real := ((blockSizes n m).np + (blockSizes n m).mp : Nat) / 8 let t : Real := ((blockSizes n m).nf + (blockSizes n m).mf : Nat) / 8 let EL := fun x : Fin d ↦ ∫ W, hybridLightPools (Ldeg n) (Bscale n m eps) u t W ∂ ((Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (u * markedMass P x a))).prod (Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (t * armMass P x a)))) let EH := fun x : Fin d ↦ ∫ W, hybridHeavyPools u W ∂ ((Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (u * markedMass P x a))).prod (Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (t * armMass P x a)))) let pi := fun x : Fin d ↦ hybridPilotLightProbability P tp (k0 n m eps) x let eta := fun x : Fin d ↦ hybridPilotHeavyProbability P tp (k0 n m eps) x obtain ⟨hu, _htp, ht, _hB⟩ := calibrationPredicate_positive_parameters hcal have hp0 (x : Fin d) := (cellMass_mem_unitInterval P x).1 have hsum : ∑ x : Fin d, cellMass P x = 1 := cellMass_sum_eq_one_annotation P have hsumS : ∑ x ∈ S, cellMass P x ≤ 1 := by rw [← hsum] exact Finset.sum_le_sum_of_subset_of_nonneg (by simp [S]) (fun _ _ _ ↦ hp0 _) have hpi0 (x : Fin d) : 0 ≤ pi x := measureReal_nonneg have heta0 (x : Fin d) : 0 ≤ eta x := measureReal_nonneg have hetale (x : Fin d) : eta x ≤ 1 := measureReal_le_one have hpoint (x : Fin d) (hx : x ∈ S) : pi x * eta x * (EL x - EH x) ^ 2 ≤ 2 * pi x * (EL x) ^ 2 + 18 * cellMass P x * ((n : Real) ^ 12)⁻¹ := by have hp : Bscale n m eps < cellMass P x := by simpa [S] using (Finset.mem_filter.mp hx).2 have hpile := calibrated_heavy_cell_pilot_le P hn hcal x hp have hEH := abs_integral_hybridHeavyPools_le_three_cellMass P hP x hu ht heps have hEH' : |EH x| ≤ 3 * cellMass P x := by simpa [EH, u, t] using hEH have hp1 := (cellMass_mem_unitInterval P x).2 have hsq : (EL x - EH x) ^ 2 ≤ 2 * (EL x) ^ 2 + 2 * (EH x) ^ 2 := sq_sub_le_two_sq_add_two_sq _ _ have hEHsq : (EH x) ^ 2 ≤ 9 * cellMass P x ^ 2 := by rw [← sq_abs] nlinarith [sq_nonneg (3 * cellMass P x - |EH x|), abs_nonneg (EH x)] have hpi : pi x ≤ ((n : Real) ^ 12)⁻¹ := by simpa [pi, tp] using hpile have hinv0 : 0 ≤ ((n : Real) ^ 12)⁻¹ := by positivity calc _ = eta x * (pi x * (EL x - EH x) ^ 2) := by ring _ ≤ pi x * (EL x - EH x) ^ 2 := mul_le_of_le_one_left (mul_nonneg (hpi0 x) (sq_nonneg _)) (hetale x) _ ≤ pi x * (2 * (EL x) ^ 2 + 2 * (EH x) ^ 2) := mul_le_mul_of_nonneg_left hsq (hpi0 x) _ = 2 * pi x * (EL x) ^ 2 + 2 * pi x * (EH x) ^ 2 := by ring _ ≤ 2 * pi x * (EL x) ^ 2 + 18 * cellMass P x * ((n : Real) ^ 12)⁻¹ := by have htail1 : 2 * pi x * (EH x) ^ 2 ≤ 18 * pi x * cellMass P x ^ 2 := by nlinarith [mul_le_mul_of_nonneg_left hEHsq (mul_nonneg (by norm_num : (0 : Real) ≤ 2) (hpi0 x))] have htail2 : 18 * pi x * cellMass P x ^ 2 ≤ 18 * ((n : Real) ^ 12)⁻¹ * cellMass P x ^ 2 := by exact mul_le_mul_of_nonneg_right (mul_le_mul_of_nonneg_left hpi (by norm_num)) (sq_nonneg _) have hpSq : cellMass P x ^ 2 ≤ cellMass P x := by nlinarith [mul_nonneg (hp0 x) (sub_nonneg.mpr hp1)] have htail3 := mul_le_mul_of_nonneg_right hpSq (mul_nonneg (by norm_num : (0 : Real) ≤ 18) hinv0) nlinarith change (∑ x ∈ S, pi x * eta x * (EL x - EH x) ^ 2) ≤ _ calc _ ≤ ∑ x ∈ S, (2 * pi x * (EL x) ^ 2 + 18 * cellMass P x * ((n : Real) ^ 12)⁻¹) := Finset.sum_le_sum fun x hx ↦ hpoint x hx _ = 2 * (∑ x ∈ S, pi x * (EL x) ^ 2) + 18 * (∑ x ∈ S, cellMass P x) * ((n : Real) ^ 12)⁻¹ := by rw [Finset.sum_add_distrib] congr 1 · rw [Finset.mul_sum] apply Finset.sum_congr rfl intro x _ ring · rw [Finset.mul_sum, Finset.sum_mul] _ ≤ 2 * (132 * ((n : Real) ^ 12)⁻¹) + 18 * 1 * ((n : Real) ^ 12)⁻¹ := by have hlight := sum_heavy_light_secondMoment_le P heps hn hcal have hlight' : (∑ x ∈ S, pi x * (EL x) ^ 2) ≤ 132 * ((n : Real) ^ 12)⁻¹ := by have hmeanSq (x : Fin d) : (EL x) ^ 2 ≤ ∫ W, hybridLightPools (Ldeg n) (Bscale n m eps) u t W ^ 2 ∂ ((Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (u * markedMass P x a))).prod (Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (t * armMass P x a)))) := by have hv := variance_nonneg (hybridLightPools (Ldeg n) (Bscale n m eps) u t) ((Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (u * markedMass P x a))).prod (Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (t * armMass P x a)))) rw [variance_eq_sub (hybridLightPools_memLp P u t (Bscale n m eps) (Ldeg n) x)] at hv exact sub_nonneg.mp hv calc _ ≤ ∑ x ∈ S, pi x * (∫ W, hybridLightPools (Ldeg n) (Bscale n m eps) u t W ^ 2 ∂ ((Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (u * markedMass P x a))).prod (Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (t * armMass P x a))))) := Finset.sum_le_sum fun x _ ↦ mul_le_mul_of_nonneg_left (hmeanSq x) (hpi0 x) _ ≤ _ := by simpa [S, pi, u, tp, t] using hlight exact add_le_add (mul_le_mul_of_nonneg_left hlight' (by norm_num)) (by have h := mul_le_mul_of_nonneg_left hsumS (by norm_num : (0 : Real) ≤ 18) exact mul_le_mul_of_nonneg_right h (by positivity)) _ = _ := by ring
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.sum_heavy_branchMean_sq_le · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridVarianceAssembly.lean:13
theorem calibrated_hybrid_variance_le Lemma 11 in the paper ↗

C27--C32, retaining the deterministic quantities used in the final absorption. the stated conditions the stated conclusion.

Formal statement
eps :
heps :
0 < eps
heps2 :
eps < 1 / 2
∃ C : Real,
0 < C
conclusion 1
n m d :
P :
1 ≤ n
ModelClass d eps P
bs :
u :
bs.M0 / 8 (: Real)
tp :
(bs.np + bs.mp : Nat) / 8 (: Real)
t :
(bs.nf + bs.mf : Nat) / 8 (: Real)
Var[(fun K : HybridPoissonCounts d ↦ ∑ x : Fin d, hybridSelectedCell (k0 n m eps) (Ldeg n) (Bscale n m eps) u t (K x)); hybridPoissonCountLaw P u tp t]
≤ 4 * starA ^ Ldeg n * (min 1 ((d : Real) * Bscale n m eps) / u + (d : Real) * Bscale n m eps ^ 2)
+ C * (u⁻¹ + t⁻¹)
+ 8 * d * Bscale n m eps ^ 2 / (eps ^ 2 * (Ldeg n : Real) ^ 4)
+ 4 / (eps * t)
+ 414 * ((n : Real) ^ 12)⁻¹
Proof (Lean source)
lemma calibrated_hybrid_variance_le {eps : Real} (heps : 0 < eps) (heps2 : eps < 1 / 2) : ∃ C : Real, 0 < C ∧ ∀ (n m d : Nat) (P : DiscreteLaw d), 1 ≤ n → ModelClass d eps P → calibrationPredicate n m eps → let bs := blockSizes n m let u : Real := bs.M0 / 8 let tp : Real := (bs.np + bs.mp : Nat) / 8 let t : Real := (bs.nf + bs.mf : Nat) / 8 Var[(fun K : HybridPoissonCounts d ↦ ∑ x : Fin d, hybridSelectedCell (k0 n m eps) (Ldeg n) (Bscale n m eps) u t (K x)); hybridPoissonCountLaw P u tp t] ≤ 4 * starA ^ Ldeg n * (min 1 ((d : Real) * Bscale n m eps) / u + (d : Real) * Bscale n m eps ^ 2) + C * (u⁻¹ + t⁻¹) + 8 * d * Bscale n m eps ^ 2 / (eps ^ 2 * (Ldeg n : Real) ^ 4) + 4 / (eps * t) + 414 * ((n : Real) ^ 12)⁻¹ := by obtain ⟨C, hC, hheavy⟩ := pilotHeavy_variance_bound_exists heps heps2 refine ⟨C, hC, ?_⟩ intro n m d P hn hP hcal dsimp only classical let u : Real := (blockSizes n m).M0 / 8 let tp : Real := ((blockSizes n m).np + (blockSizes n m).mp : Nat) / 8 let t : Real := ((blockSizes n m).nf + (blockSizes n m).mf : Nat) / 8 let B := Bscale n m eps let L := Ldeg n let muE := fun x : Fin d ↦ ((Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (u * markedMass P x a))).prod (Measure.pi fun a : Bool ↦ poissonMeasure (toNNReal (t * armMass P x a)))) let pi := fun x : Fin d ↦ hybridPilotLightProbability P tp (k0 n m eps) x let eta := fun x : Fin d ↦ hybridPilotHeavyProbability P tp (k0 n m eps) x let EL := fun x : Fin d ↦ ∫ W, hybridLightPools L B u t W ∂muE x let EH := fun x : Fin d ↦ ∫ W, hybridHeavyPools u W ∂muE x let VL := fun x : Fin d ↦ Var[hybridLightPools L B u t; muE x] let VH := fun x : Fin d ↦ Var[hybridHeavyPools u; muE x] let S : Finset (Fin d) := Finset.univ.filter fun x ↦ cellMass P x ≤ B obtain ⟨hu, _htp, ht, hB⟩ := calibrationPredicate_positive_parameters hcal have hL : 2 ≤ L := Ldeg_ge_two n have hcal' := hcal simp only [calibrationPredicate] at hcal' have htB : (L : Real) ≤ t * B := by simpa [L, t, B] using hcal'.2.2.2.2.2.2.2.2.2.2.2.1 have hpi0 (x : Fin d) : 0 ≤ pi x := measureReal_nonneg have hpile (x : Fin d) : pi x ≤ 1 := measureReal_le_one have heta0 (x : Fin d) : 0 ≤ eta x := measureReal_nonneg have heta (x : Fin d) : eta x = 1 - pi x := by exact hybridPilotHeavyProbability_eq_one_sub_light P tp (k0 n m eps) x have hVL (x : Fin d) : VL x ≤ ∫ W, hybridLightPools L B u t W ^ 2 ∂muE x := by exact variance_le_expectation_sq (hybridLightPools_memLp P u t B L x).aestronglyMeasurable have hcell (x : Fin d) : Var[hybridSelectedCell (k0 n m eps) L B u t; Measure.pi fun arm : Bool ↦ (poissonMeasure (toNNReal (u * markedMass P x arm))).prod ((poissonMeasure (toNNReal (tp * armMass P x arm))).prod (poissonMeasure (toNNReal (t * armMass P x arm))))] = pi x * VL x + eta x * VH x + pi x * eta x * (EL x - EH x) ^ 2 := by rw [variance_hybridSelectedCell_exact] change pi x * VL x + (1 - pi x) * VH x + pi x * (1 - pi x) * (EL x - EH x) ^ 2 = _ rw [← heta x] have hlightVar : (∑ x : Fin d, pi x * VL x) ≤ 4 * starA ^ L * (min 1 ((d : Real) * B) / u + (d : Real) * B ^ 2) + 132 * ((n : Real) ^ 12)⁻¹ := by rw [← Finset.sum_filter_add_sum_filter_not univ (fun x : Fin d ↦ cellMass P x ≤ B) (fun x ↦ pi x * VL x)] have hSc : Finset.univ.filter (fun x : Fin d ↦ ¬ cellMass P x ≤ B) = Finset.univ.filter (fun x : Fin d ↦ B < cellMass P x) := by ext x simp only [mem_filter, Finset.mem_univ, true_and] exact not_le rw [hSc] apply add_le_add · calc _ ≤ ∑ x ∈ S, ∫ W, hybridLightPools L B u t W ^ 2 ∂muE x := by apply Finset.sum_le_sum intro x hx exact (mul_le_of_le_one_left (variance_nonneg _ _) (hpile x)).trans (hVL x) _ ≤ _ := by simpa [S, L, B, u, t, muE] using sum_light_secondMoment_le P hu ht hB hL htB · calc _ ≤ ∑ x ∈ Finset.univ.filter (fun x : Fin d ↦ B < cellMass P x), pi x * (∫ W, hybridLightPools L B u t W ^ 2 ∂muE x) := by apply Finset.sum_le_sum intro x hx have hx' : x ∈ Finset.univ.filter (fun x : Fin d ↦ B < cellMass P x) := by simpa [S] using hx exact mul_le_mul_of_nonneg_left (hVL x) (hpi0 x) _ ≤ _ := by simpa [pi, L, B, u, tp, t, muE] using sum_heavy_light_secondMoment_le P heps hn hcal have hheavyVar : (∑ x : Fin d, eta x * VH x) ≤ C * (u⁻¹ + t⁻¹) := by simpa [eta, VH, u, tp, t, muE] using hheavy d P hP hu ht (k0 n m eps) have hbranch : (∑ x : Fin d, pi x * eta x * (EL x - EH x) ^ 2) ≤ 8 * d * B ^ 2 / (eps ^ 2 * (L : Real) ^ 4) + 4 / (eps * t) + 282 * ((n : Real) ^ 12)⁻¹ := by rw [← Finset.sum_filter_add_sum_filter_not univ (fun x : Fin d ↦ cellMass P x ≤ B) (fun x ↦ pi x * eta x * (EL x - EH x) ^ 2)] have hSc : Finset.univ.filter (fun x : Fin d ↦ ¬ cellMass P x ≤ B) = Finset.univ.filter (fun x : Fin d ↦ B < cellMass P x) := by ext x simp only [mem_filter, Finset.mem_univ, true_and] exact not_le rw [hSc] calc _ ≤ (8 * d * B ^ 2 / (eps ^ 2 * (L : Real) ^ 4) + 4 / (eps * t)) + 282 * ((n : Real) ^ 12)⁻¹ := add_le_add (by calc _ ≤ ∑ x ∈ S, (EL x - EH x) ^ 2 := by apply Finset.sum_le_sum intro x _ have hprod : pi x * eta x ≤ 1 := by calc _ ≤ pi x * 1 := mul_le_mul_of_nonneg_left measureReal_le_one (hpi0 x) _ ≤ 1 := by simpa using hpile x exact mul_le_of_le_one_left (sq_nonneg _) hprod _ ≤ _ := by simpa [S, EL, EH, L, B, u, t, muE] using sum_light_branchMean_sq_le P hP hu ht heps hB hL) (by simpa [pi, eta, EL, EH, L, B, u, tp, t, muE] using sum_heavy_branchMean_sq_le P hP heps hn hcal) _ = _ := by ring change Var[(fun K : HybridPoissonCounts d ↦ ∑ x : Fin d, hybridSelectedCell (k0 n m eps) L B u t (K x)); hybridPoissonCountLaw P u tp t] ≤ 4 * starA ^ L * (min 1 ((d : Real) * B) / u + (d : Real) * B ^ 2) + C * (u⁻¹ + t⁻¹) + 8 * d * B ^ 2 / (eps ^ 2 * (L : Real) ^ 4) + 4 / (eps * t) + 414 * ((n : Real) ^ 12)⁻¹ calc _ = ∑ x : Fin d, (pi x * VL x + eta x * VH x + pi x * eta x * (EL x - EH x) ^ 2) := by rw [variance_sum_hybridSelectedCell] exact Finset.sum_congr rfl (fun x _ ↦ hcell x) _ = (∑ x : Fin d, pi x * VL x) + (∑ x : Fin d, eta x * VH x) + ∑ x : Fin d, pi x * eta x * (EL x - EH x) ^ 2 := by rw [Finset.sum_add_distrib, Finset.sum_add_distrib] _ ≤ _ := by linarith
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.calibrated_hybrid_variance_le · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/HybridVarianceAssembly.lean:156
CausalSmith.Stat.STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research.Helpers.IndependentOuterBlocks 6 declarations Law of two outer blocks selected from a finite iid array.

Law of two outer blocks selected from a finite iid array.

def independentOuterBlocks

Keep the first and last blocks of an array split into lengths a,b,c. the stated conditions the stated conclusion.

Definition (Lean source)
X :
Type*
a b c :
z :
Fin (a + (b + c)) → X
independentOuterBlocks a b c z :
(Fin a → X) × (Fin c → X)
e :
(Equiv.sumCongr (Equiv.refl _) finSumFinEquiv).trans finSumFinEquiv (: Fin a ⊕ (Fin b ⊕ Fin c) ≃ Fin (a + (b + c)))
zs :
Equiv.piCongrLeft (fun _ : Fin a ⊕ (Fin b ⊕ Fin c) ↦ X) e.symm z
(fun i ↦ zs (.inl i), fun i ↦ zs (.inr (.inr i)))
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.independentOuterBlocks · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/IndependentOuterBlocks.lean:12
theorem independentOuterBlocks_fst_apply

For block lengths a, b, and c, the first outer block of an array at an index is the array entry at that index.

Formal statement
X :
Type*
a b c :
z :
Fin (a + (b + c)) → X
i :
Fin a
(independentOuterBlocks a b c z).1 i = z ⟨i.1, by omega⟩
Proof (Lean source)
@[simp] theorem independentOuterBlocks_fst_apply {X : Type*} (a b c : Nat) (z : Fin (a + (b + c)) → X) (i : Fin a) : (independentOuterBlocks a b c z).1 i = z ⟨i.1, by omega⟩ := by let e : Fin a ⊕ (Fin b ⊕ Fin c) ≃ Fin (a + (b + c)) := (Equiv.sumCongr (Equiv.refl _) finSumFinEquiv).trans finSumFinEquiv change (Equiv.piCongrLeft (fun _ : Fin a ⊕ (Fin b ⊕ Fin c) => X) e.symm z) (.inl i) = _ rw [Equiv.piCongrLeft_apply] rw [eqRec_eq_cast, cast_eq] apply congrArg z apply Fin.ext rfl
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.independentOuterBlocks_fst_apply · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/IndependentOuterBlocks.lean:20
theorem independentOuterBlocks_snd_apply

For block lengths a, b, and c, the second outer block of an array at an index is the array entry offset by the first two block lengths.

Formal statement
X :
Type*
a b c :
z :
Fin (a + (b + c)) → X
i :
Fin c
(independentOuterBlocks a b c z).2 i = z ⟨a + b + i.1, by omega⟩
Proof (Lean source)
@[simp] theorem independentOuterBlocks_snd_apply {X : Type*} (a b c : Nat) (z : Fin (a + (b + c)) → X) (i : Fin c) : (independentOuterBlocks a b c z).2 i = z ⟨a + b + i.1, by omega⟩ := by let e : Fin a ⊕ (Fin b ⊕ Fin c) ≃ Fin (a + (b + c)) := (Equiv.sumCongr (Equiv.refl _) finSumFinEquiv).trans finSumFinEquiv change (Equiv.piCongrLeft (fun _ : Fin a ⊕ (Fin b ⊕ Fin c) => X) e.symm z) (.inr (.inr i)) = _ rw [Equiv.piCongrLeft_apply] rw [eqRec_eq_cast, cast_eq] apply congrArg z apply Fin.ext simp [e] omega
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.independentOuterBlocks_snd_apply · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/IndependentOuterBlocks.lean:35
theorem measurable_independentOuterBlocks

Selecting outer blocks with lengths a, b, and c is measurable.

Formal statement
X :
a b c :
Proof (Lean source)
@[fun_prop] theorem measurable_independentOuterBlocks {X : Type*} [MeasurableSpace X] (a b c : Nat) : Measurable (independentOuterBlocks (X := X) a b c) := by unfold independentOuterBlocks let e : Fin a ⊕ (Fin b ⊕ Fin c) ≃ Fin (a + (b + c)) := (Equiv.sumCongr (Equiv.refl _) finSumFinEquiv).trans finSumFinEquiv let reindex := MeasurableEquiv.piCongrLeft (fun _ : Fin a ⊕ (Fin b ⊕ Fin c) ↦ X) e.symm exact (measurable_pi_lambda _ fun i => (measurable_pi_apply (.inl i)).comp reindex.measurable).prodMk (measurable_pi_lambda _ fun i => (measurable_pi_apply (.inr (.inr i))).comp reindex.measurable)
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.measurable_independentOuterBlocks · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/IndependentOuterBlocks.lean:51
theorem map_pi_independentOuterBlocks

The formal statement establishes the stated conclusion.

Formal statement
X :
a b c :
Measure.map (independentOuterBlocks (X := X) a b c) (Measure.pi fun _ : Fin (a + (b + c)) ↦ mu)
= (Measure.pi fun _ : Fin a ↦ mu).prod (Measure.pi fun _ : Fin c ↦ mu)
Proof (Lean source)
theorem map_pi_independentOuterBlocks {X : Type*} [MeasurableSpace X] (mu : Measure X) [IsProbabilityMeasure mu] (a b c : Nat) : Measure.map (independentOuterBlocks (X := X) a b c) (Measure.pi fun _ : Fin (a + (b + c)) ↦ mu) = (Measure.pi fun _ : Fin a ↦ mu).prod (Measure.pi fun _ : Fin c ↦ mu) := by let I := Fin a ⊕ (Fin b ⊕ Fin c) let e : I ≃ Fin (a + (b + c)) := (Equiv.sumCongr (Equiv.refl _) finSumFinEquiv).trans finSumFinEquiv let reindex := MeasurableEquiv.piCongrLeft (fun _ : I ↦ X) e.symm let splitA := MeasurableEquiv.sumPiEquivProdPi (fun _ : Fin a ⊕ (Fin b ⊕ Fin c) ↦ X) let splitBC := MeasurableEquiv.sumPiEquivProdPi (fun _ : Fin b ⊕ Fin c ↦ X) let muA := Measure.pi fun _ : Fin a ↦ mu let muB := Measure.pi fun _ : Fin b ↦ mu let muC := Measure.pi fun _ : Fin c ↦ mu have hreindex : Measure.map reindex (Measure.pi fun _ : Fin (a + (b + c)) ↦ mu) = Measure.pi fun _ : I ↦ mu := by exact (MeasureTheory.measurePreserving_piCongrLeft (fun _ : I ↦ mu) e.symm).map_eq have hsplitA : Measure.map splitA (Measure.pi fun _ : I ↦ mu) = muA.prod (Measure.pi fun _ : Fin b ⊕ Fin c ↦ mu) := by exact (MeasureTheory.measurePreserving_sumPiEquivProdPi (fun _ : I ↦ mu)).map_eq have hsplitBC : Measure.map splitBC (Measure.pi fun _ : Fin b ⊕ Fin c ↦ mu) = muB.prod muC := by exact (MeasureTheory.measurePreserving_sumPiEquivProdPi (fun _ : Fin b ⊕ Fin c ↦ mu)).map_eq have htriple : Measure.map (fun z : I → X => ((fun i => z (.inl i)), ((fun i => z (.inr (.inl i))), (fun i => z (.inr (.inr i)))))) (Measure.pi fun _ : I ↦ mu) = muA.prod (muB.prod muC) := by calc _ = Measure.map (map id splitBC) (Measure.map splitA (Measure.pi fun _ : I ↦ mu)) := by rw [Measure.map_map (by fun_prop) (by fun_prop)] rfl _ = Measure.map (map id splitBC) (muA.prod (Measure.pi fun _ : Fin b ⊕ Fin c ↦ mu)) := by rw [hsplitA] _ = muA.prod (muB.prod muC) := by rw [← Measure.map_prod_map _ _ measurable_id splitBC.measurable, Measure.map_id, hsplitBC] calc Measure.map (independentOuterBlocks (X := X) a b c) (Measure.pi fun _ : Fin (a + (b + c)) ↦ mu) = Measure.map (fun z => (z.1, z.2.2)) (Measure.map (fun z : I → X => ((fun i => z (.inl i)), ((fun i => z (.inr (.inl i))), (fun i => z (.inr (.inr i)))))) (Measure.map reindex (Measure.pi fun _ : Fin (a + (b + c)) ↦ mu))) := by rw [Measure.map_map (by fun_prop) (by fun_prop), Measure.map_map (by fun_prop) (by fun_prop)] rfl _ = Measure.map (fun z => (z.1, z.2.2)) (muA.prod (muB.prod muC)) := by rw [hreindex, htriple] _ = muA.prod muC := by change Measure.map (map id snd) (muA.prod (muB.prod muC)) = _ rw [← Measure.map_prod_map _ _ measurable_id measurable_snd, Measure.map_id] exact congrArg (muA.prod ·) MeasureTheory.measurePreserving_snd.map_eq
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.map_pi_independentOuterBlocks · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/IndependentOuterBlocks.lean:64
theorem map_prod_finAppend

Concatenating two independent iid arrays gives the iid law on their summed length. the stated conclusion.

Formal statement
X :
a b :
Measure.map (fun z : (Fin a → X) × (Fin b → X) => append z.1 z.2) ((Measure.pi fun _ : Fin a ↦ mu).prod (Measure.pi fun _ : Fin b ↦ mu))
= Measure.pi fun _ : Fin (a + b) ↦ mu
Proof (Lean source)
theorem map_prod_finAppend {X : Type*} [MeasurableSpace X] (mu : Measure X) [IsProbabilityMeasure mu] (a b : Nat) : Measure.map (fun z : (Fin a → X) × (Fin b → X) => append z.1 z.2) ((Measure.pi fun _ : Fin a ↦ mu).prod (Measure.pi fun _ : Fin b ↦ mu)) = Measure.pi fun _ : Fin (a + b) ↦ mu := by let joinSum := (MeasurableEquiv.sumPiEquivProdPi (fun _ : Fin a ⊕ Fin b ↦ X)).symm let reindex := MeasurableEquiv.piCongrLeft (fun _ : Fin (a + b) ↦ X) finSumFinEquiv have hjoin : Measure.map joinSum ((Measure.pi fun _ : Fin a ↦ mu).prod (Measure.pi fun _ : Fin b ↦ mu)) = Measure.pi fun _ : Fin a ⊕ Fin b ↦ mu := (MeasureTheory.measurePreserving_sumPiEquivProdPi (fun _ : Fin a ⊕ Fin b ↦ mu)).symm.map_eq calc _ = Measure.map reindex (Measure.map joinSum ((Measure.pi fun _ : Fin a ↦ mu).prod (Measure.pi fun _ : Fin b ↦ mu))) := by symm rw [Measure.map_map reindex.measurable joinSum.measurable] apply congrArg (fun f => Measure.map f ((Measure.pi fun _ : Fin a ↦ mu).prod (Measure.pi fun _ : Fin b ↦ mu))) funext z i obtain ⟨j | j, rfl⟩ := finSumFinEquiv.surjective i · dsimp [reindex, joinSum, Function.comp_def, MeasurableEquiv.piCongrLeft, MeasurableEquiv.sumPiEquivProdPi] rw [Equiv.piCongrLeft_apply] simp [reindex, joinSum, MeasurableEquiv.piCongrLeft, MeasurableEquiv.sumPiEquivProdPi, Equiv.sumPiEquivProdPi, Equiv.piCongrLeft_apply_apply] · dsimp [reindex, joinSum, Function.comp_def, MeasurableEquiv.piCongrLeft, MeasurableEquiv.sumPiEquivProdPi] rw [Equiv.piCongrLeft_apply] simp [reindex, joinSum, MeasurableEquiv.piCongrLeft, MeasurableEquiv.sumPiEquivProdPi, Equiv.sumPiEquivProdPi, Equiv.piCongrLeft_apply_apply] _ = Measure.map reindex (Measure.pi fun _ : Fin a ⊕ Fin b ↦ mu) := by rw [hjoin] _ = Measure.pi fun _ : Fin (a + b) ↦ mu := (MeasureTheory.measurePreserving_piCongrLeft (fun _ : Fin (a + b) ↦ mu) finSumFinEquiv).map_eq
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.map_prod_finAppend · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/IndependentOuterBlocks.lean:134
CausalSmith.Stat.STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research.Helpers.IndependentPoissonHistogram 6 declarations Local finite-Poisson histogram transport for the inverse-count proof.

Local finite-Poisson histogram transport for the inverse-count proof.

def mapFiniteSample

Apply a measurable map to every point of a dependent finite sample. the stated conditions the stated conclusion.

Definition (Lean source)
f :
X → Y
s :
mapFiniteSample f s :
⟨s.count, fun i => f (s.points i)⟩
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.mapFiniteSample · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/IndependentPoissonHistogram.lean:16
theorem measurable_mapFiniteSample

Applying a map that is measurable to every point of a finite sample is measurable.

Formal statement
f :
X → Y
hf :
Proof (Lean source)
@[fun_prop] lemma measurable_mapFiniteSample {X Y : Type*} [MeasurableSpace X] [MeasurableSpace Y] (f : X → Y) (hf : Measurable f) : Measurable (mapFiniteSample f) := by intro s hs rw [MeasurableSpace.measurableSet_iInf] at hs change @MeasurableSet (FiniteSample X) (⨅ n, MeasurableSpace.map (Sigma.mk n) (inferInstance : MeasurableSpace (Fin n → X))) (mapFiniteSample f ⁻¹' s) rw [MeasurableSpace.measurableSet_iInf] intro n change MeasurableSet ((fun z : Fin n → X => fun i => f (z i)) ⁻¹' (fixedSizeEmbed (X := Y) n ⁻¹' s)) have hc : Measurable (fun z : Fin n → X => fun i => f (z i)) := measurable_pi_lambda _ fun _ => hf.comp (measurable_pi_apply _) have he : @Measurable (Fin n → Y) (FiniteSample Y) (inferInstance : MeasurableSpace (Fin n → Y)) (MeasurableSpace.map (Sigma.mk n) (inferInstance : MeasurableSpace (Fin n → Y))) (fixedSizeEmbed (X := Y) n) := by apply Measurable.of_le_map exact le_rfl exact (hs n).preimage (he.comp hc)
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.measurable_mapFiniteSample · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/IndependentPoissonHistogram.lean:21
theorem mapFiniteSample_finitePoissonSampleLaw

Finite Poisson samples commute with a measurable pushforward of their observation law. the stated conditions the stated conclusion.

Formal statement
lam :
f :
X → Y
hf :
Measure.map (mapFiniteSample f) (finitePoissonSampleLaw P lam)
= @finitePoissonSampleLaw Y _ (Measure.map f P) (Measure.isProbabilityMeasure_map hf.aemeasurable) lam
Proof (Lean source)
lemma mapFiniteSample_finitePoissonSampleLaw {X Y : Type*} [MeasurableSpace X] [MeasurableSpace Y] (P : Measure X) [IsProbabilityMeasure P] (lam : NNReal) (f : X → Y) (hf : Measurable f) : Measure.map (mapFiniteSample f) (finitePoissonSampleLaw P lam) = @finitePoissonSampleLaw Y _ (Measure.map f P) (Measure.isProbabilityMeasure_map hf.aemeasurable) lam := by letI : IsProbabilityMeasure (Measure.map f P) := Measure.isProbabilityMeasure_map hf.aemeasurable unfold finitePoissonSampleLaw poissonIIDStreamLaw iidStreamLaw rw [Measure.map_map (measurable_mapFiniteSample f hf) measurable_streamToFiniteSample] rw [show mapFiniteSample f ∘ streamToFiniteSample = streamToFiniteSample ∘ (map id (fun z : Nat → X => fun i => f (z i))) by rfl] rw [← Measure.map_map measurable_streamToFiniteSample (by fun_prop)] rw [← Measure.map_prod_map _ _ measurable_id (by fun_prop), Measure.map_id] rw [Measure.infinitePi_map_pi (μ := fun _ : Nat => P) (f := fun _ => f) (fun _ => hf)]
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.mapFiniteSample_finitePoissonSampleLaw · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/IndependentPoissonHistogram.lean:45
theorem finitePoissonSampleLaw_map_histogram

On a finite alphabet, the histogram of a finite Poisson sample consists of independent Poisson cell counts. the stated conclusion.

Formal statement
Measure.map (fun s : FiniteSample X => finiteSampleHistogram s.points) (finitePoissonSampleLaw P lam)
= Measure.pi fun x : X => poissonMeasure (lam * (P {x}).toNNReal)
Proof (Lean source)
lemma finitePoissonSampleLaw_map_histogram {X : Type*} [Fintype X] [MeasurableSpace X] [MeasurableSingletonClass X] [DecidableEq X] [StandardBorelSpace X] (P : Measure X) [IsProbabilityMeasure P] (lam : NNReal) : Measure.map (fun s : FiniteSample X => finiteSampleHistogram s.points) (finitePoissonSampleLaw P lam) = Measure.pi fun x : X => poissonMeasure (lam * (P {x}).toNNReal) := by classical let R : Measure Real := Measure.dirac 0 let p : FiniteMeasurablePartition X X := ⟨id, measurable_id⟩ let erase : FiniteSample (X × Real) → FiniteSample X := mapFiniteSample Prod.fst let counts : FiniteSample (X × Real) → (X → Nat) := fun s x => (p.restrictCell x s).count have hbase : Measure.map Prod.fst (P.prod R) = P := by dsimp [R] rw [Measure.map_fst_prod, measure_univ, one_smul] have herase : Measure.map erase (finiteMarkedPoissonSampleLaw P R lam) = finitePoissonSampleLaw P lam := by dsimp [erase] change Measure.map (mapFiniteSample Prod.fst) (finitePoissonSampleLaw (P.prod R) lam) = _ rw [mapFiniteSample_finitePoissonSampleLaw (P.prod R) lam Prod.fst measurable_fst] simpa only [hbase] have hcounts : counts = (fun q : X → FiniteSample (X × Real) => fun x => (q x).count) ∘ p.restrictPartition := by rfl have hsplit := p.map_restrictPartition_finiteMarkedPoissonSampleLaw P R lam have hmapCounts : Measure.map counts (finiteMarkedPoissonSampleLaw P R lam) = Measure.pi fun x : X => poissonMeasure (lam * p.cellMass P x) := by rw [hcounts, ← Measure.map_map (by fun_prop) p.measurable_restrictPartition, hsplit, Measure.pi_map_pi (fun _ => measurable_finiteSample_count.aemeasurable)] congr 1 funext x exact finiteMarkedPoissonSampleLaw_map_count (p.cellObservationLaw P x) R (lam * p.cellMass P x) have hhist : (fun s : FiniteSample X => finiteSampleHistogram s.points) ∘ erase = counts := by funext s x change finiteSampleHistogram (fun i => (s.points i).1) x = (p.restrictCell x s).count simp only [finiteSampleHistogram, FiniteMeasurablePartition.restrictCell, FiniteMeasurablePartition.cellIndices, FiniteSample.count, FiniteSample.points, p, id_eq] convert Fintype.card_subtype (fun i : Fin s.1 => (s.2 i).1 = x) using 1 all_goals first | rfl | exact congrArg card (Finset.filter_congr_decidable univ (fun i : Fin s.1 => (s.2 i).1 = x) _) calc Measure.map (fun s : FiniteSample X => finiteSampleHistogram s.points) (finitePoissonSampleLaw P lam) = Measure.map (fun s : FiniteSample X => finiteSampleHistogram s.points) (Measure.map erase (finiteMarkedPoissonSampleLaw P R lam)) := by rw [herase] _ = Measure.map counts (finiteMarkedPoissonSampleLaw P R lam) := by rw [Measure.map_map measurable_finiteSampleHistogram (measurable_mapFiniteSample Prod.fst measurable_fst), hhist] _ = Measure.pi fun x : X => poissonMeasure (lam * p.cellMass P x) := hmapCounts _ = Measure.pi fun x : X => poissonMeasure (lam * (P {x}).toNNReal) := by congr 1
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.finitePoissonSampleLaw_map_histogram · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/IndependentPoissonHistogram.lean:67
theorem map_pi_finProjection

Selecting distinct coordinates from a finite product measure retains the corresponding independent product law. the stated conditions the stated conclusion.

Formal statement
I J :
Type*
I → Type*
∀ i, MeasurableSpace (X i)
mu :
(i : I) → Measure (X i)
∀ i, IsProbabilityMeasure (mu i)
e :
J → I
he :
Measure.map (fun z => fun j => z (e j)) (Measure.pi mu) = Measure.pi fun j => mu (e j)
Proof (Lean source)
lemma map_pi_finProjection {I J : Type*} [Fintype I] [Fintype J] {X : I → Type*} [∀ i, MeasurableSpace (X i)] (mu : (i : I) → Measure (X i)) [∀ i, IsProbabilityMeasure (mu i)] (e : J → I) (he : Injective e) : Measure.map (fun z => fun j => z (e j)) (Measure.pi mu) = Measure.pi fun j => mu (e j) := by classical have hi : iIndepFun (fun i z => z i) (Measure.pi mu) := iIndepFun_pi (X := fun _ => id) (fun _ => aemeasurable_id) have hj := hi.precomp he have hmap := hj.map_fun_eq_pi_map (fun _ => (measurable_pi_apply _).aemeasurable) have heval (j : J) : Measure.map (fun z => z (e j)) (Measure.pi mu) = mu (e j) := by simpa using Measure.pi_map_eval mu (e j) simp_rw [heval] at hmap exact hmap
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.map_pi_finProjection · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/IndependentPoissonHistogram.lean:136
theorem map_prod_pi_pointwisePair

The formal statement establishes the stated conclusion.

Formal statement
mu :
I → Measure A
nu :
I → Measure B
∀ i, IsProbabilityMeasure (mu i)
∀ i, IsProbabilityMeasure (nu i)
Measure.map (fun z : (I → A) × (I → B) => fun i => (z.1 i, z.2 i)) ((Measure.pi mu).prod (Measure.pi nu))
= Measure.pi fun i => (mu i).prod (nu i)
Proof (Lean source)
lemma map_prod_pi_pointwisePair {I A B : Type*} [Fintype I] [MeasurableSpace A] [MeasurableSpace B] (mu : I → Measure A) (nu : I → Measure B) [∀ i, IsProbabilityMeasure (mu i)] [∀ i, IsProbabilityMeasure (nu i)] : Measure.map (fun z : (I → A) × (I → B) => fun i => (z.1 i, z.2 i)) ((Measure.pi mu).prod (Measure.pi nu)) = Measure.pi fun i => (mu i).prod (nu i) := by let e := MeasurableEquiv.arrowProdEquivProdArrow A B I exact (measurePreserving_arrowProdEquivProdArrow A B I mu nu).symm e |>.map_eq
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.map_prod_pi_pointwisePair · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/IndependentPoissonHistogram.lean:155
CausalSmith.Stat.STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research.Helpers.KnownMarginalBoundary 23 declarations Finite-sample ingredients for the exact-known-marginal benchmark.

Finite-sample ingredients for the exact-known-marginal benchmark.

def knownMarginalScore

The inverse-propensity score, written directly in terms of the supplied table. the stated conditions the stated conclusion.

Definition (Lean source)
d :
table :
z :
Obs d
knownMarginalScore table z :
p :
table (z.1, false) + table (z.1, true)
if z.2.2 then if z.2.1 then p / table (z.1, true) else -(p / table (z.1, false)) else 0
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.knownMarginalScore · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/KnownMarginalBoundary.lean:16

The clipped empirical mean of the known-marginal inverse-propensity score. the stated conditions the stated conclusion.

Definition (Lean source)
n d :
knownMarginalEstimator n d :
fun z => clipAte ((n : Real)⁻¹ * ∑ i, knownMarginalScore z.2 (z.1 i))
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.knownMarginalEstimator · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/KnownMarginalBoundary.lean:24
theorem measurable_auxTable_sample_eval Lemma measurable_auxTable_sample_eval in the paper ↗

The formal statement establishes the stated conclusion.

Formal statement
n d :
i :
Fin n
a :
Measurable fun z : KnownSample n d => z.2 ((z.1 i).1, a)
Proof (Lean source)
lemma measurable_auxTable_sample_eval {n d : Nat} (i : Fin n) (a : Bool) : Measurable fun z : KnownSample n d => z.2 ((z.1 i).1, a) := by classical rw [show (fun z : KnownSample n d => z.2 ((z.1 i).1, a)) = fun z => ∑ q : AuxObs d, if ((z.1 i).1, a) = q then z.2 q else 0 by funext z simp] apply Finset.measurable_sum intro q hq apply Measurable.ite · apply measurableSet_eq_fun · fun_prop · fun_prop · exact (measurable_pi_apply q).comp measurable_snd · fun_prop
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.measurable_auxTable_sample_eval · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/KnownMarginalBoundary.lean:29
theorem knownMarginalScore_sample_measurable

The formal statement establishes the stated conclusion.

Formal statement
n d :
i :
Fin n
Measurable fun z : KnownSample n d => knownMarginalScore z.2 (z.1 i)
Proof (Lean source)
lemma knownMarginalScore_sample_measurable {n d : Nat} (i : Fin n) : Measurable fun z : KnownSample n d => knownMarginalScore z.2 (z.1 i) := by unfold knownMarginalScore apply Measurable.ite · apply measurableSet_eq_fun <;> fun_prop · apply Measurable.ite · apply measurableSet_eq_fun <;> fun_prop · exact ((measurable_auxTable_sample_eval i false).add (measurable_auxTable_sample_eval i true)).div (measurable_auxTable_sample_eval i true) · exact (((measurable_auxTable_sample_eval i false).add (measurable_auxTable_sample_eval i true)).div (measurable_auxTable_sample_eval i false)).neg · fun_prop
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.knownMarginalScore_sample_measurable · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/KnownMarginalBoundary.lean:47
theorem knownMarginalEstimator_measurable

The formal statement establishes the stated conclusion.

Formal statement
n d :
Proof (Lean source)
lemma knownMarginalEstimator_measurable (n d : Nat) : Measurable (knownMarginalEstimator n d) := by unfold knownMarginalEstimator clipAte apply measurable_const.max apply measurable_const.min apply measurable_const.mul exact Finset.measurable_sum _ fun i _ => knownMarginalScore_sample_measurable i
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.knownMarginalEstimator_measurable · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/KnownMarginalBoundary.lean:64
theorem knownMarginalEstimator_mem

The formal statement establishes the stated conclusion.

Formal statement
n d :
z :
knownMarginalEstimator n d z ∈ Icc (-1 : Real) 1
Proof (Lean source)
lemma knownMarginalEstimator_mem (n d : Nat) (z : KnownSample n d) : knownMarginalEstimator n d z ∈ Icc (-1 : Real) 1 := by constructor <;> simp [knownMarginalEstimator, clipAte, max_le_iff]
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.knownMarginalEstimator_mem · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/KnownMarginalBoundary.lean:74
theorem cellMass_eq_armMass_add

The formal statement establishes the stated conclusion.

Formal statement
d :
P :
x :
Fin d
cellMass P x = armMass P x false + armMass P x true
Proof (Lean source)
lemma cellMass_eq_armMass_add {d : Nat} (P : DiscreteLaw d) (x : Fin d) : cellMass P x = armMass P x false + armMass P x true := by simp [cellMass, armMass] ring
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.cellMass_eq_armMass_add · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/KnownMarginalBoundary.lean:80
theorem jointMass_nonneg

The formal statement establishes the stated conclusion.

Formal statement
d :
P :
x :
Fin d
a y :
0 ≤ jointMass P x a y
Proof (Lean source)
lemma jointMass_nonneg {d : Nat} (P : DiscreteLaw d) (x : Fin d) (a y : Bool) : 0 ≤ jointMass P x a y := by exact ENNReal.toReal_nonneg
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.jointMass_nonneg · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/KnownMarginalBoundary.lean:87
theorem armMass_nonneg

The formal statement establishes the stated conclusion.

Formal statement
d :
P :
x :
Fin d
a :
0 ≤ armMass P x a
Proof (Lean source)
lemma armMass_nonneg {d : Nat} (P : DiscreteLaw d) (x : Fin d) (a : Bool) : 0 ≤ armMass P x a := by exact Finset.sum_nonneg fun _ _ => jointMass_nonneg P x a _
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.armMass_nonneg · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/KnownMarginalBoundary.lean:93
theorem cellMass_nonneg

The formal statement establishes the stated conclusion.

Formal statement
d :
P :
x :
Fin d
0 ≤ cellMass P x
Proof (Lean source)
lemma cellMass_nonneg {d : Nat} (P : DiscreteLaw d) (x : Fin d) : 0 ≤ cellMass P x := by rw [cellMass_eq_armMass_add] exact add_nonneg (armMass_nonneg P x false) (armMass_nonneg P x true)
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.cellMass_nonneg · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/KnownMarginalBoundary.lean:99
theorem jointMass_le_armMass

The formal statement establishes the stated conclusion.

Formal statement
d :
P :
x :
Fin d
a y :
jointMass P x a y ≤ armMass P x a
Proof (Lean source)
lemma jointMass_le_armMass {d : Nat} (P : DiscreteLaw d) (x : Fin d) (a y : Bool) : jointMass P x a y ≤ armMass P x a := by simp [armMass] cases y <;> linarith [jointMass_nonneg P x a false, jointMass_nonneg P x a true]
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.jointMass_le_armMass · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/KnownMarginalBoundary.lean:106
theorem cellMass_sum_eq_one

The formal statement establishes the stated conclusion.

Formal statement
d :
P :
∑ x : Fin d, cellMass P x = 1
Proof (Lean source)
lemma cellMass_sum_eq_one {d : Nat} (P : DiscreteLaw d) : ∑ x : Fin d, cellMass P x = 1 := by classical have h := PMF.integral_eq_sum P.pmf (fun _ : Obs d => (1 : Real)) rw [integral_const, probReal_univ, one_smul] at h simpa [cellMass, jointMass, Fintype.sum_prod_type] using h.symm
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.cellMass_sum_eq_one · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/KnownMarginalBoundary.lean:113
theorem knownMarginal_arm_bounds

the stated conditions establishes the stated conclusion.

Formal statement
d :
eps :
P :
hP :
ModelClass d eps P
x :
Fin d
hx :
0 < cellMass P x
conclusion 1
eps * cellMass P x ≤ armMass P x true
conclusion 2
eps * cellMass P x ≤ armMass P x false
Proof (Lean source)
lemma knownMarginal_arm_bounds {d : Nat} {eps : Real} (P : DiscreteLaw d) (hP : ModelClass d eps P) (x : Fin d) (hx : 0 < cellMass P x) : eps * cellMass P x ≤ armMass P x true ∧ eps * cellMass P x ≤ armMass P x false := by have hp := hP.overlap x hx have hne : cellMass P x ≠ 0 := ne_of_gt hx have ht : armMass P x true = propensity P x * cellMass P x := by rw [propensity] field_simp constructor · rw [ht] exact mul_le_mul_of_nonneg_right hp.1 hx.le · have hcell := cellMass_eq_armMass_add P x have hf : armMass P x false = (1 - propensity P x) * cellMass P x := by rw [ht] at hcell linarith calc eps * cellMass P x ≤ (1 - propensity P x) * cellMass P x := mul_le_mul_of_nonneg_right (by linarith [hp.2]) hx.le _ = armMass P x false := hf.symm
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.knownMarginal_arm_bounds · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/KnownMarginalBoundary.lean:122
theorem knownMarginalScore_mean

the stated conditions establishes the stated conclusion.

Formal statement
d :
eps :
P :
hP :
ModelClass d eps P
∫ z, knownMarginalScore (auxTableOf P) z ∂obsLaw P = ateFunctional P
Proof (Lean source)
lemma knownMarginalScore_mean {d : Nat} {eps : Real} (P : DiscreteLaw d) (hP : ModelClass d eps P) : ∫ z, knownMarginalScore (auxTableOf P) z ∂obsLaw P = ateFunctional P := by classical rw [show obsLaw P = P.pmf.toMeasure by rfl, PMF.integral_eq_sum] simp only [Fintype.sum_prod_type] simp only [smul_eq_mul] rw [ateFunctional] apply Finset.sum_congr rfl intro x hxmem exact show ∑ a : Bool, ∑ y : Bool, (P.pmf (x, a, y)).toReal * knownMarginalScore (auxTableOf P) (x, a, y) = cellMass P x * (outcomeMean P true x - outcomeMean P false x) from by simp [knownMarginalScore, auxTableOf, jointMass] by_cases hx : 0 < cellMass P x · obtain ⟨ht, hf⟩ := knownMarginal_arm_bounds P hP x hx have he : 0 < eps := hP.eps_pos have ht0 : armMass P x true ≠ 0 := ne_of_gt (lt_of_lt_of_le (mul_pos he hx) ht) have hf0 : armMass P x false ≠ 0 := ne_of_gt (lt_of_lt_of_le (mul_pos he hx) hf) rw [← cellMass_eq_armMass_add P x] simp [outcomeMean] field_simp [ht0, hf0] change jointMass P x true true * armMass P x false - armMass P x true * jointMass P x false true = _ ring · have hx0 : cellMass P x = 0 := le_antisymm (not_lt.mp hx) (cellMass_nonneg P x) have ha0 (a : Bool) : armMass P x a = 0 := by have ha := armMass_nonneg P x a rw [cellMass_eq_armMass_add] at hx0 cases a <;> linarith [armMass_nonneg P x false, armMass_nonneg P x true] simp [hx0, ha0]
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.knownMarginalScore_mean · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/KnownMarginalBoundary.lean:145
theorem knownMarginalScore_sq_integral_le

the stated conditions establishes the stated conclusion.

Formal statement
d :
eps :
P :
hP :
ModelClass d eps P
∫ z, knownMarginalScore (auxTableOf P) z ^ 2 ∂obsLaw P ≤ 2 * eps⁻¹
Proof (Lean source)
lemma knownMarginalScore_sq_integral_le {d : Nat} {eps : Real} (P : DiscreteLaw d) (hP : ModelClass d eps P) : ∫ z, knownMarginalScore (auxTableOf P) z ^ 2 ∂obsLaw P ≤ 2 * eps⁻¹ := by classical rw [show obsLaw P = P.pmf.toMeasure by rfl, PMF.integral_eq_sum] simp only [Fintype.sum_prod_type] calc ∑ x : Fin d, ∑ a : Bool, ∑ y : Bool, (P.pmf (x, a, y)).toReal * knownMarginalScore (auxTableOf P) (x, a, y) ^ 2 ≤ ∑ x : Fin d, 2 * eps⁻¹ * cellMass P x := by apply Finset.sum_le_sum intro x hxmem by_cases hx : 0 < cellMass P x · obtain ⟨ht, hf⟩ := knownMarginal_arm_bounds P hP x hx have he : 0 < eps := hP.eps_pos have ht0 : 0 < armMass P x true := lt_of_lt_of_le (mul_pos he hx) ht have hf0 : 0 < armMass P x false := lt_of_lt_of_le (mul_pos he hx) hf have hrt : cellMass P x / armMass P x true ≤ eps⁻¹ := by calc cellMass P x / armMass P x true ≤ (armMass P x true / eps) / armMass P x true := div_le_div_of_nonneg_right ((le_div_iff₀ he).2 (by simpa [mul_comm] using ht)) ht0.le _ = eps⁻¹ := by field_simp have hrf : cellMass P x / armMass P x false ≤ eps⁻¹ := by calc cellMass P x / armMass P x false ≤ (armMass P x false / eps) / armMass P x false := div_le_div_of_nonneg_right ((le_div_iff₀ he).2 (by simpa [mul_comm] using hf)) hf0.le _ = eps⁻¹ := by field_simp simp [knownMarginalScore, auxTableOf] have hyt := jointMass_le_armMass P x true true have hyf := jointMass_le_armMass P x false true have hct := cellMass_nonneg P x have hit : 0 ≤ eps⁻¹ := inv_nonneg.mpr he.le change jointMass P x true true * ((armMass P x false + armMass P x true) / armMass P x true) ^ 2 + jointMass P x false true * ((armMass P x false + armMass P x true) / armMass P x false) ^ 2 ≤ 2 * eps⁻¹ * cellMass P x rw [← cellMass_eq_armMass_add P x] calc jointMass P x true true * (cellMass P x / armMass P x true) ^ 2 + jointMass P x false true * (cellMass P x / armMass P x false) ^ 2 ≤ armMass P x false * (cellMass P x / armMass P x false) ^ 2 + armMass P x true * (cellMass P x / armMass P x true) ^ 2 := by nlinarith [sq_nonneg (cellMass P x / armMass P x false), sq_nonneg (cellMass P x / armMass P x true)] _ = cellMass P x * (cellMass P x / armMass P x false) + cellMass P x * (cellMass P x / armMass P x true) := by field_simp [ne_of_gt ht0, ne_of_gt hf0] _ ≤ cellMass P x * eps⁻¹ + cellMass P x * eps⁻¹ := by gcongr _ = 2 * eps⁻¹ * cellMass P x := by ring · have hx0 : cellMass P x = 0 := le_antisymm (not_lt.mp hx) (cellMass_nonneg P x) have ha0 (a : Bool) : armMass P x a = 0 := by rw [cellMass_eq_armMass_add] at hx0 cases a <;> linarith [armMass_nonneg P x false, armMass_nonneg P x true] simp [knownMarginalScore, auxTableOf, jointMass, hx0, ha0] _ = 2 * eps⁻¹ := by rw [← Finset.mul_sum, cellMass_sum_eq_one P, mul_one]
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.knownMarginalScore_sq_integral_le · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/KnownMarginalBoundary.lean:179
theorem knownMarginalScore_variance_le

the stated conditions establishes the stated conclusion.

Formal statement
d :
eps :
P :
hP :
ModelClass d eps P
variance (knownMarginalScore (auxTableOf P)) (obsLaw P) ≤ 2 * eps⁻¹
Proof (Lean source)
lemma knownMarginalScore_variance_le {d : Nat} {eps : Real} (P : DiscreteLaw d) (hP : ModelClass d eps P) : variance (knownMarginalScore (auxTableOf P)) (obsLaw P) ≤ 2 * eps⁻¹ := by rw [variance_eq_sub (MemLp.of_discrete : MemLp (knownMarginalScore (auxTableOf P)) 2 (obsLaw P))] exact (sub_le_self _ (sq_nonneg _)).trans (knownMarginalScore_sq_integral_le P hP)
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.knownMarginalScore_variance_le · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/KnownMarginalBoundary.lean:240

the stated conditions defines the specified object.

Definition (Lean source)
n d :
knownMarginalRawEstimator n d :
fun z => (n : Real)⁻¹ * ∑ i, knownMarginalScore z.2 (z.1 i)
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.knownMarginalRawEstimator · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/KnownMarginalBoundary.lean:249
theorem knownMarginalRawEstimator_measurable

The formal statement establishes the stated conclusion.

Formal statement
n d :
Proof (Lean source)
lemma knownMarginalRawEstimator_measurable (n d : Nat) : Measurable (knownMarginalRawEstimator n d) := by unfold knownMarginalRawEstimator apply measurable_const.mul exact Finset.measurable_sum _ fun i _ => knownMarginalScore_sample_measurable i
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.knownMarginalRawEstimator_measurable · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/KnownMarginalBoundary.lean:254
theorem knownMarginalRawEstimator_mean

the stated conditions establishes the stated conclusion.

Formal statement
n d :
eps :
P :
hP :
ModelClass d eps P
hn :
0 < n
∫ sample, knownMarginalRawEstimator n d (sample, auxTableOf P) ∂labeledProductLaw P n
Proof (Lean source)
lemma knownMarginalRawEstimator_mean {n d : Nat} {eps : Real} (P : DiscreteLaw d) (hP : ModelClass d eps P) (hn : 0 < n) : ∫ sample, knownMarginalRawEstimator n d (sample, auxTableOf P) ∂labeledProductLaw P n = ateFunctional P := by rw [show labeledProductLaw P n = Measure.pi (fun _ : Fin n => obsLaw P) by rfl] unfold knownMarginalRawEstimator change ∫ sample, (n : Real)⁻¹ * ∑ i, knownMarginalScore (auxTableOf P) (sample i) ∂Measure.pi (fun _ => obsLaw P) = _ rw [iid_average_integral (obsLaw P) n hn (knownMarginalScore (auxTableOf P)) Integrable.of_finite] exact knownMarginalScore_mean P hP
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.knownMarginalRawEstimator_mean · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/KnownMarginalBoundary.lean:262
theorem knownMarginalRawEstimator_variance_le

the stated conditions establishes the stated conclusion.

Formal statement
n d :
eps :
P :
hP :
ModelClass d eps P
hn :
0 < n
variance (fun sample => knownMarginalRawEstimator n d (sample, auxTableOf P)) (labeledProductLaw P n)
≤ 2 * eps⁻¹ / n
Proof (Lean source)
lemma knownMarginalRawEstimator_variance_le {n d : Nat} {eps : Real} (P : DiscreteLaw d) (hP : ModelClass d eps P) (hn : 0 < n) : variance (fun sample => knownMarginalRawEstimator n d (sample, auxTableOf P)) (labeledProductLaw P n) ≤ 2 * eps⁻¹ / n := by rw [show labeledProductLaw P n = Measure.pi (fun _ : Fin n => obsLaw P) by rfl] unfold knownMarginalRawEstimator rw [iid_average_variance (obsLaw P) n (knownMarginalScore (auxTableOf P)) MemLp.of_discrete] calc (n : Real)⁻¹ * variance (knownMarginalScore (auxTableOf P)) (obsLaw P) ≤ (n : Real)⁻¹ * (2 * eps⁻¹) := by gcongr exact knownMarginalScore_variance_le P hP _ = 2 * eps⁻¹ / n := by ring
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.knownMarginalRawEstimator_variance_le · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/KnownMarginalBoundary.lean:276
theorem integral_sq_error_eq_variance_of_mean_eq Lemma integral_sq_error_eq_variance_of_mean_eq in the paper ↗

the stated conditions establishes the stated conclusion.

Formal statement
α :
f :
α → Real
target :
hmean :
∫ x, f x ∂mu = target
∫ x, (f x - target) ^ 2 ∂mu = variance f mu
Proof (Lean source)
lemma integral_sq_error_eq_variance_of_mean_eq {α : Type*} [MeasurableSpace α] [DiscreteMeasurableSpace α] [Finite α] (mu : Measure α) [IsProbabilityMeasure mu] (f : α → Real) (target : Real) (hmean : ∫ x, f x ∂mu = target) : ∫ x, (f x - target) ^ 2 ∂mu = variance f mu := by have hf : MemLp f 2 mu := MemLp.of_discrete rw [variance_eq_sub hf] have hsq := hf.integrable_sq have hint := hf.integrable one_le_two have hlinear : Integrable (fun x => 2 * target * f x) mu := hint.const_mul _ have hpow : (∫ x, (f ^ 2) x ∂mu) = ∫ x, f x ^ 2 ∂mu := by rfl calc ∫ x, (f x - target) ^ 2 ∂mu = ∫ x, f x ^ 2 - 2 * target * f x + target ^ 2 ∂mu := by apply integral_congr_ae filter_upwards with x ring _ = (∫ x, f x ^ 2 - 2 * target * f x ∂mu) + (∫ _x, target ^ 2 ∂mu) := integral_add (hsq.sub hlinear) (integrable_const _) _ = (∫ x, f x ^ 2 ∂mu) - (∫ x, 2 * target * f x ∂mu) + target ^ 2 := by rw [integral_sub hsq hlinear, integral_const, probReal_univ, one_smul] _ = (∫ x, f x ^ 2 ∂mu) - 2 * target * (∫ x, f x ∂mu) + target ^ 2 := by rw [integral_const_mul] _ = (∫ x, (f ^ 2) x ∂mu) - (∫ x, f x ∂mu) ^ 2 := by rw [hpow, hmean] ring
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.integral_sq_error_eq_variance_of_mean_eq · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/KnownMarginalBoundary.lean:293
theorem knownMarginalRisk_upper

the stated conditions establishes the stated conclusion.

Formal statement
eps :
heps :
0 < eps
n d :
1 ≤ n
2 ≤ d
knownMarginalRisk n d eps ≤ 2 * eps⁻¹ / n
Proof (Lean source)
lemma knownMarginalRisk_upper {eps : Real} (heps : 0 < eps) : ∀ (n d : Nat), 1 ≤ n → 2 ≤ d → knownMarginalRisk n d eps ≤ 2 * eps⁻¹ / n := by intro n d hn hd let raw := knownMarginalRawEstimator n d obtain ⟨clipped, hclip⟩ := exists_clipped_knownMarginalEstimator n d raw (knownMarginalRawEstimator_measurable n d) unfold knownMarginalRisk have hbInf : BddBelow (range (fun est : {f : KnownSample n d → Real // Measurable f ∧ ∀ z, f z ∈ Icc (-1 : Real) 1} => ⨆ P : ClassLaw d eps, ∫ x, (est.1 (x, auxTableOf P.1) - ateFunctional P.1) ^ 2 ∂labeledProductLaw P.1 n)) := by refine ⟨0, ?_⟩ rintro _ ⟨est, rfl⟩ exact Real.iSup_nonneg fun P => integral_nonneg fun x => sq_nonneg _ apply ciInf_le_of_le hbInf clipped apply Real.iSup_le · intro P letI : IsProbabilityMeasure (labeledProductLaw P.1 n) := by unfold labeledProductLaw infer_instance calc ∫ x, (clipped.1 (x, auxTableOf P.1) - ateFunctional P.1) ^ 2 ∂labeledProductLaw P.1 n ≤ ∫ x, (raw (x, auxTableOf P.1) - ateFunctional P.1) ^ 2 ∂labeledProductLaw P.1 n := integral_mono_ae Integrable.of_finite Integrable.of_finite <| ae_of_all _ fun x => hclip (x, auxTableOf P.1) _ (ateFunctional_mem_Icc_neg_one_one P.1 P.2.overlap) _ = variance (fun x => raw (x, auxTableOf P.1)) (labeledProductLaw P.1 n) := integral_sq_error_eq_variance_of_mean_eq _ _ _ (knownMarginalRawEstimator_mean P.1 P.2 (by omega)) _ ≤ 2 * eps⁻¹ / n := knownMarginalRawEstimator_variance_le P.1 P.2 (by omega) · positivity
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.knownMarginalRisk_upper · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/KnownMarginalBoundary.lean:323
theorem knownMarginalRisk_ge_two_model_tv

the stated conditions establishes the stated conclusion.

Formal statement
n d :
eps s :
P0 P1 :
ClassLaw d eps
htable :
hs :
0 ≤ s
hsep :
2 * s ≤ |ateFunctional P0.1 - ateFunctional P1.1|
htv :
tvDist (labeledProductLaw P0.1 n) (labeledProductLaw P1.1 n) ≤ 1 / 2
s ^ 2 / 4 ≤ knownMarginalRisk n d eps
Proof (Lean source)
lemma knownMarginalRisk_ge_two_model_tv {n d : Nat} {eps s : Real} (P0 P1 : ClassLaw d eps) (htable : auxTableOf P0.1 = auxTableOf P1.1) (hs : 0 ≤ s) (hsep : 2 * s ≤ |ateFunctional P0.1 - ateFunctional P1.1|) (htv : tvDist (labeledProductLaw P0.1 n) (labeledProductLaw P1.1 n) ≤ 1 / 2) : s ^ 2 / 4 ≤ knownMarginalRisk n d eps := by classical letI : IsProbabilityMeasure (labeledProductLaw P0.1 n) := by unfold labeledProductLaw infer_instance letI : IsProbabilityMeasure (labeledProductLaw P1.1 n) := by unfold labeledProductLaw infer_instance letI : Nonempty {f : KnownSample n d → Real // Measurable f ∧ ∀ z, f z ∈ Icc (-1 : Real) 1} := ⟨⟨fun _ => 0, measurable_const, fun _ => by constructor <;> norm_num⟩⟩ unfold knownMarginalRisk apply le_ciInf intro est let f : (Fin n → Obs d) → Real := fun x => est.1 (x, auxTableOf P0.1) have hf : Measurable f := est.2.1.comp (measurable_id.prodMk measurable_const) have ht := two_point_lower_bound_of_tvDist_le (P₀ := labeledProductLaw P0.1 n) (P₁ := labeledProductLaw P1.1 n) hf (θ₀ := ateFunctional P0.1) (θ₁ := ateFunctional P1.1) (s := s) (c := (1 / 2 : Real)) hsep htv have hp : 1 / 4 ≤ max ((labeledProductLaw P0.1 n).real {z | s ≤ |f z - ateFunctional P0.1|}) ((labeledProductLaw P1.1 n).real {z | s ≤ |f z - ateFunctional P1.1|}) := by convert ht using 1 <;> norm_num have hrisk (P : ClassLaw d eps) (htableP : auxTableOf P.1 = auxTableOf P0.1) : s ^ 2 * (labeledProductLaw P.1 n).real {z | s ≤ |f z - ateFunctional P.1|} ≤ ∫ z, (est.1 (z, auxTableOf P.1) - ateFunctional P.1) ^ 2 ∂labeledProductLaw P.1 n := by letI : IsProbabilityMeasure (labeledProductLaw P.1 n) := by unfold labeledProductLaw infer_instance have hmarkov := mul_meas_ge_le_integral_of_nonneg (μ := labeledProductLaw P.1 n) (f := fun z => (est.1 (z, auxTableOf P.1) - ateFunctional P.1) ^ 2) (ae_of_all _ fun z => sq_nonneg _) Integrable.of_finite (s ^ 2) have he : {z | s ≤ |f z - ateFunctional P.1|} = {z | s ^ 2 ≤ (est.1 (z, auxTableOf P.1) - ateFunctional P.1) ^ 2} := by ext z change s ≤ |f z - ateFunctional P.1| ↔ s ^ 2 ≤ (est.1 (z, auxTableOf P.1) - ateFunctional P.1) ^ 2 rw [show f z = est.1 (z, auxTableOf P.1) by simp only [f] rw [htableP]] simpa [abs_of_nonneg hs, sq_abs] using (sq_le_sq₀ hs (abs_nonneg (est.1 (z, auxTableOf P.1) - ateFunctional P.1))).symm rw [he] simpa using hmarkov have hb : BddAbove (range (fun P : ClassLaw d eps => ∫ z, (est.1 (z, auxTableOf P.1) - ateFunctional P.1) ^ 2 ∂labeledProductLaw P.1 n)) := by refine ⟨4, ?_⟩ rintro _ ⟨P, rfl⟩ letI : IsProbabilityMeasure (labeledProductLaw P.1 n) := by unfold labeledProductLaw infer_instance calc ∫ z, (est.1 (z, auxTableOf P.1) - ateFunctional P.1) ^ 2 ∂labeledProductLaw P.1 n ≤ ∫ _z, (4 : Real) ∂labeledProductLaw P.1 n := by apply integral_mono_ae Integrable.of_finite Integrable.of_finite filter_upwards with z rcases est.2.2 (z, auxTableOf P.1) with ⟨he0, he1⟩ rcases ateFunctional_mem_Icc_neg_one_one P.1 P.2.overlap with ⟨ht0, ht1⟩ nlinarith [sq_nonneg (est.1 (z, auxTableOf P.1) - ateFunctional P.1 - 2), sq_nonneg (est.1 (z, auxTableOf P.1) - ateFunctional P.1 + 2)] _ = 4 := by simp have hm : s ^ 2 / 4 ≤ max (∫ z, (est.1 (z, auxTableOf P0.1) - ateFunctional P0.1) ^ 2 ∂labeledProductLaw P0.1 n) (∫ z, (est.1 (z, auxTableOf P1.1) - ateFunctional P1.1) ^ 2 ∂labeledProductLaw P1.1 n) := by calc s ^ 2 / 4 = s ^ 2 * (1 / 4) := by ring _ ≤ s ^ 2 * max ((labeledProductLaw P0.1 n).real {z | s ≤ |f z - ateFunctional P0.1|}) ((labeledProductLaw P1.1 n).real {z | s ≤ |f z - ateFunctional P1.1|}) := by gcongr _ = max (s ^ 2 * (labeledProductLaw P0.1 n).real {z | s ≤ |f z - ateFunctional P0.1|}) (s ^ 2 * (labeledProductLaw P1.1 n).real {z | s ≤ |f z - ateFunctional P1.1|}) := by rw [mul_max_of_nonneg _ _ (sq_nonneg s)] _ ≤ _ := max_le_max (hrisk P0 rfl) (hrisk P1 htable.symm) exact hm.trans (max_le (le_ciSup hb P0) (le_ciSup hb P1))
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.knownMarginalRisk_ge_two_model_tv · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/KnownMarginalBoundary.lean:357
CausalSmith.Stat.STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research.Helpers.KnownMarginalLimit 31 declarations This file reparameterizes overlap laws by cell probabilities, propensities, and outcome regressions.

The finite-coordinate bridge for the known-marginal limit

This file reparameterizes overlap laws by cell probabilities, propensities, and outcome regressions. In these coordinates all probabilities and the ATE are polynomial, including at null cells.

def KnownMarginalParam

Compact variation-independent coordinates for a finite overlap law. the stated conditions the stated conclusion.

Definition (Lean source)
d :
eps :
KnownMarginalParam d eps :
Type
FinitePmf (Fin d) × (Fin d → Icc eps (1 - eps)) × (Bool → Fin d → Icc (0 : Real) 1)
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.KnownMarginalParam · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/KnownMarginalLimit.lean:22
def knownMarginalAtom

The observed atom probability represented by variation-independent coordinates. the stated conditions the stated conclusion.

Definition (Lean source)
d :
eps :
theta :
z :
Obs d
knownMarginalAtom theta z :
theta.1.1 z.1 * (if z.2.1 then (theta.2.1 z.1 : Real) else 1 - (theta.2.1 z.1 : Real)) * (if z.2.2 then (theta.2.2 z.2.1 z.1 : Real) else 1 - (theta.2.2 z.2.1 z.1 : Real))
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.knownMarginalAtom · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/KnownMarginalLimit.lean:28
theorem knownMarginalAtom_sum

the stated conditions establishes the stated conclusion.

Formal statement
d :
eps :
theta :
heps :
0 ≤ eps
∑ z : Obs d, ofReal (knownMarginalAtom theta z) = 1
Proof (Lean source)
lemma knownMarginalAtom_sum {d : Nat} {eps : Real} (theta : KnownMarginalParam d eps) (heps : 0 ≤ eps) : ∑ z : Obs d, ofReal (knownMarginalAtom theta z) = 1 := by rw [← ENNReal.ofReal_sum_of_nonneg (fun z _ ↦ knownMarginalAtom_nonneg theta heps z)] simp only [Fintype.sum_prod_type, Fintype.sum_bool, knownMarginalAtom] simp ring_nf rw [theta.1.2.2]
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.knownMarginalAtom_sum · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/KnownMarginalLimit.lean:47
def knownMarginalLaw

The discrete law generated by compact overlap coordinates. the stated conditions the stated conclusion.

Definition (Lean source)
d :
eps :
theta :
heps :
0 ≤ eps
knownMarginalLaw theta heps :
⟨PMF.ofFintype (fun z ↦ ofReal (knownMarginalAtom theta z)) (knownMarginalAtom_sum theta heps)⟩
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.knownMarginalLaw · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/KnownMarginalLimit.lean:58
theorem knownMarginalLaw_jointMass

the stated conditions establishes the stated conclusion.

Formal statement
d :
eps :
theta :
heps :
0 ≤ eps
x :
Fin d
a y :
jointMass (knownMarginalLaw theta heps) x a y = knownMarginalAtom theta (x, a, y)
Proof (Lean source)
lemma knownMarginalLaw_jointMass {d : Nat} {eps : Real} (theta : KnownMarginalParam d eps) (heps : 0 ≤ eps) (x : Fin d) (a y : Bool) : jointMass (knownMarginalLaw theta heps) x a y = knownMarginalAtom theta (x, a, y) := by rw [jointMass, knownMarginalLaw, PMF.ofFintype_apply, ENNReal.toReal_ofReal (knownMarginalAtom_nonneg theta heps _)]
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.knownMarginalLaw_jointMass · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/KnownMarginalLimit.lean:63
theorem knownMarginalLaw_cellMass

the stated conditions establishes the stated conclusion.

Formal statement
d :
eps :
theta :
heps :
0 ≤ eps
x :
Fin d
cellMass (knownMarginalLaw theta heps) x = theta.1.1 x
Proof (Lean source)
lemma knownMarginalLaw_cellMass {d : Nat} {eps : Real} (theta : KnownMarginalParam d eps) (heps : 0 ≤ eps) (x : Fin d) : cellMass (knownMarginalLaw theta heps) x = theta.1.1 x := by simp [cellMass, knownMarginalLaw_jointMass, knownMarginalAtom, Fintype.sum_bool] ring
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.knownMarginalLaw_cellMass · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/KnownMarginalLimit.lean:70
theorem knownMarginalLaw_armMass

the stated conditions establishes the stated conclusion.

Formal statement
d :
eps :
theta :
heps :
0 ≤ eps
x :
Fin d
a :
armMass (knownMarginalLaw theta heps) x a
= theta.1.1 x * (if a then (theta.2.1 x : Real) else 1 - (theta.2.1 x : Real))
Proof (Lean source)
lemma knownMarginalLaw_armMass {d : Nat} {eps : Real} (theta : KnownMarginalParam d eps) (heps : 0 ≤ eps) (x : Fin d) (a : Bool) : armMass (knownMarginalLaw theta heps) x a = theta.1.1 x * (if a then (theta.2.1 x : Real) else 1 - (theta.2.1 x : Real)) := by simp [armMass, knownMarginalLaw_jointMass, knownMarginalAtom, Fintype.sum_bool] cases a <;> simp <;> ring
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.knownMarginalLaw_armMass · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/KnownMarginalLimit.lean:77
theorem knownMarginalLaw_outcomeMean_of_pos

the stated conditions establishes the stated conclusion.

Formal statement
d :
eps :
theta :
x :
Fin d
a :
hcell :
0 < theta.1.1 x
heps :
0 < eps
outcomeMean (knownMarginalLaw theta heps.le) a x = theta.2.2 a x
Proof (Lean source)
lemma knownMarginalLaw_outcomeMean_of_pos {d : Nat} {eps : Real} (theta : KnownMarginalParam d eps) (x : Fin d) (a : Bool) (hcell : 0 < theta.1.1 x) (heps : 0 < eps) : outcomeMean (knownMarginalLaw theta heps.le) a x = theta.2.2 a x := by have he : 0 < (if a then (theta.2.1 x : Real) else 1 - theta.2.1 x) := by split_ifs · exact heps.trans_le (theta.2.1 x).2.1 · linarith [(theta.2.1 x).2.2] have hne : theta.1.1 x ≠ 0 := ne_of_gt hcell rw [outcomeMean, knownMarginalLaw_armMass, knownMarginalLaw_jointMass, knownMarginalAtom] cases a · simp at he ⊢ exact mul_div_cancel_left₀ _ (mul_ne_zero hne (sub_ne_zero.mpr (ne_of_gt he))) · simp at he ⊢ exact mul_div_cancel_left₀ _ (mul_ne_zero hne (ne_of_gt he))
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.knownMarginalLaw_outcomeMean_of_pos · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/KnownMarginalLimit.lean:86
theorem knownMarginalLaw_ate

the stated conditions establishes the stated conclusion.

Formal statement
d :
eps :
theta :
heps :
0 < eps
= ∑ x, theta.1.1 x * ((theta.2.2 true x : Real) - theta.2.2 false x)
Proof (Lean source)
lemma knownMarginalLaw_ate {d : Nat} {eps : Real} (theta : KnownMarginalParam d eps) (heps : 0 < eps) : ateFunctional (knownMarginalLaw theta heps.le) = ∑ x, theta.1.1 x * ((theta.2.2 true x : Real) - theta.2.2 false x) := by rw [ateFunctional] apply Finset.sum_congr rfl intro x _ rw [knownMarginalLaw_cellMass] by_cases hx : theta.1.1 x = 0 · simp [hx] · have hxpos : 0 < theta.1.1 x := lt_of_le_of_ne (theta.1.2.1 x) (Ne.symm hx) rw [knownMarginalLaw_outcomeMean_of_pos theta x true hxpos heps, knownMarginalLaw_outcomeMean_of_pos theta x false hxpos heps]
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.knownMarginalLaw_ate · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/KnownMarginalLimit.lean:105
def knownMarginalParamToClass

Compact coordinates generate a member of the paper's overlap class. the stated conditions the stated conclusion.

Definition (Lean source)
d :
eps :
hd :
2 ≤ d
heps :
0 < eps
heps2 :
eps < 1 / 2
theta :
knownMarginalParamToClass hd heps heps2 theta :
ClassLaw d eps
by refine ⟨knownMarginalLaw theta heps.le, hd, heps, heps2, ?_⟩ intro x hx rw [propensity, knownMarginalLaw_armMass, knownMarginalLaw_cellMass] have hne : theta.1.1 x
≠ 0 := ne_of_gt (by simpa [knownMarginalLaw_cellMass] using hx) rw [mul_div_cancel_left₀ _ hne] exact (theta.2.1 x).2
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.knownMarginalParamToClass · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/KnownMarginalLimit.lean:121
theorem knownMarginalParamToClass_surjective

Every overlap law is represented by the compact variation-independent coordinates. the stated conditions the stated conclusion.

Formal statement
d :
eps :
hd :
2 ≤ d
heps :
0 < eps
heps2 :
eps < 1 / 2
Proof (Lean source)
theorem knownMarginalParamToClass_surjective {d : Nat} {eps : Real} (hd : 2 ≤ d) (heps : 0 < eps) (heps2 : eps < 1 / 2) : Surjective (knownMarginalParamToClass hd heps heps2) := by classical intro P let p : FinitePmf (Fin d) := ⟨fun x ↦ cellMass P.1 x, ⟨fun x ↦ (cellMass_mem_unitInterval P.1 x).1, cellMass_sum_eq_one_local P.1⟩⟩ let e : Fin d → Icc eps (1 - eps) := fun x ↦ if hx : cellMass P.1 x = 0 then ⟨eps, le_rfl, by linarith⟩ else ⟨propensity P.1 x, P.2.overlap x (lt_of_le_of_ne (cellMass_mem_unitInterval P.1 x).1 (Ne.symm hx))⟩ let mu : Bool → Fin d → Icc (0 : Real) 1 := fun a x ↦ ⟨outcomeMean P.1 a x, outcomeMean_mem_unitInterval P.1 a x⟩ let theta : KnownMarginalParam d eps := (p, e, mu) refine ⟨theta, Subtype.ext ?_⟩ cases P with | mk law hP => cases law with | mk P => dsimp only at * change DiscreteLaw.mk _ = DiscreteLaw.mk P congr 1 apply PMF.ext intro z apply (ENNReal.toReal_eq_toReal_iff' (PMF.apply_ne_top _ _) (PMF.apply_ne_top _ _)).mp rw [PMF.ofFintype_apply, ENNReal.toReal_ofReal (knownMarginalAtom_nonneg theta heps.le z)] change knownMarginalAtom theta z = jointMass ⟨P⟩ z.1 z.2.1 z.2.2 rcases z with ⟨x, a, y⟩ by_cases hx : cellMass ⟨P⟩ x = 0 · have h00 : 0 ≤ jointMass ⟨P⟩ x false false := (jointMass_mem_unitInterval ⟨P⟩ x false false).1 have h01 : 0 ≤ jointMass ⟨P⟩ x false true := (jointMass_mem_unitInterval ⟨P⟩ x false true).1 have h10 : 0 ≤ jointMass ⟨P⟩ x true false := (jointMass_mem_unitInterval ⟨P⟩ x true false).1 have h11 : 0 ≤ jointMass ⟨P⟩ x true true := (jointMass_mem_unitInterval ⟨P⟩ x true true).1 have hz : jointMass ⟨P⟩ x a y = 0 := by simp only [cellMass, Fintype.sum_bool] at hx cases a <;> cases y <;> nlinarith simp [knownMarginalAtom, theta, p, hx, hz] · have hxpos : 0 < cellMass ⟨P⟩ x := lt_of_le_of_ne (cellMass_mem_unitInterval ⟨P⟩ x).1 (Ne.symm hx) have hov := hP.overlap x hxpos have htpos : 0 < armMass ⟨P⟩ x true := by have := lt_of_lt_of_le heps hov.1 rw [propensity] at this rcases div_pos_iff.mp this with h | h · exact h.1 · linarith have hfpos : 0 < armMass ⟨P⟩ x false := by have hdecomp : cellMass ⟨P⟩ x = armMass ⟨P⟩ x false + armMass ⟨P⟩ x true := by simp [cellMass, armMass, Fintype.sum_bool] ring have hlt : propensity ⟨P⟩ x < 1 := lt_of_le_of_lt hov.2 (by linarith) rw [propensity, div_lt_one hxpos] at hlt linarith have heval : (e x : Real) = propensity ⟨P⟩ x := by simp [e, hx] cases a <;> cases y <;> simp only [knownMarginalAtom, theta, p, mu, fst, snd, Bool.false_eq_true, Bool.true_eq, if_false, if_true, Subtype.coe_mk] <;> rw [heval] <;> simp only [propensity, outcomeMean] <;> field_simp [ne_of_gt hxpos, ne_of_gt htpos, ne_of_gt hfpos] <;> simp [armMass, cellMass, Fintype.sum_bool] <;> ring
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.knownMarginalParamToClass_surjective · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/KnownMarginalLimit.lean:137
def knownMarginalObsPmf

The simplex of complete-record atom probabilities in compact coordinates. the stated conditions the stated conclusion.

Definition (Lean source)
d :
eps :
theta :
heps :
0 ≤ eps
knownMarginalObsPmf theta heps :
FinitePmf (Obs d)
⟨knownMarginalAtom theta, by constructor · exact fun z ↦ knownMarginalAtom_nonneg theta heps z · simp only [Fintype.sum_prod_type, Fintype.sum_bool, knownMarginalAtom] simp ring_nf exact theta.1.2.2⟩
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.knownMarginalObsPmf · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/KnownMarginalLimit.lean:209
def knownMarginalLabelProb

Labeled-sample atom probabilities in compact coordinates. the stated conditions the stated conclusion.

Definition (Lean source)
n d :
eps :
theta :
heps :
0 ≤ eps
sample :
Fin n → Obs d
knownMarginalLabelProb theta heps sample :
productProbability (Obs d) (knownMarginalObsPmf theta heps) sample
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.knownMarginalLabelProb · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/KnownMarginalLimit.lean:220
def knownMarginalAuxProb

Auxiliary atom probabilities in compact coordinates. the stated conditions the stated conclusion.

Definition (Lean source)
d :
eps :
theta :
z :
knownMarginalAuxProb theta z :
∑ y : Bool, knownMarginalAtom theta (z.1, z.2, y)
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.knownMarginalAuxProb · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/KnownMarginalLimit.lean:226
def knownMarginalTarget

The ATE coordinate, polynomial even at null covariate cells. the stated conditions the stated conclusion.

Definition (Lean source)
d :
eps :
theta :
knownMarginalTarget theta :
∑ x, theta.1.1 x * ((theta.2.2 true x : Real) - theta.2.2 false x)
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.knownMarginalTarget · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/KnownMarginalLimit.lean:231
theorem knownMarginalLabelProb_simplex

the stated conditions establishes the stated conclusion.

Formal statement
n d :
eps :
theta :
heps :
0 ≤ eps
knownMarginalLabelProb theta heps ∈ stdSimplex Real (Fin n → Obs d)
Proof (Lean source)
lemma knownMarginalLabelProb_simplex {n d : Nat} {eps : Real} (theta : KnownMarginalParam d eps) (heps : 0 ≤ eps) : knownMarginalLabelProb theta heps ∈ stdSimplex Real (Fin n → Obs d) := by exact ⟨fun z ↦ productProbability_nonneg _ _ _, sum_productProbability _ _⟩
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.knownMarginalLabelProb_simplex · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/KnownMarginalLimit.lean:235
theorem knownMarginalAuxProb_simplex

the stated conditions establishes the stated conclusion.

Formal statement
d :
eps :
theta :
heps :
0 ≤ eps
Proof (Lean source)
lemma knownMarginalAuxProb_simplex {d : Nat} {eps : Real} (theta : KnownMarginalParam d eps) (heps : 0 ≤ eps) : knownMarginalAuxProb theta ∈ stdSimplex Real (AuxObs d) := by constructor · intro z exact Finset.sum_nonneg fun y _ ↦ knownMarginalAtom_nonneg theta heps _ · simp only [knownMarginalAuxProb, Fintype.sum_prod_type, Fintype.sum_bool, knownMarginalAtom] simp ring_nf exact theta.1.2.2
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.knownMarginalAuxProb_simplex · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/KnownMarginalLimit.lean:241
theorem continuous_knownMarginalLabelProb

the stated conditions establishes the stated conclusion.

Formal statement
n d :
eps :
heps :
0 ≤ eps
sample :
Fin n → Obs d
Continuous (fun theta : KnownMarginalParam d eps ↦ knownMarginalLabelProb theta heps sample)
Proof (Lean source)
lemma continuous_knownMarginalLabelProb {n d : Nat} {eps : Real} (heps : 0 ≤ eps) (sample : Fin n → Obs d) : Continuous (fun theta : KnownMarginalParam d eps ↦ knownMarginalLabelProb theta heps sample) := by unfold knownMarginalLabelProb productProbability knownMarginalObsPmf apply continuous_finsetProd intro i _ exact continuous_knownMarginalAtom (sample i)
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.continuous_knownMarginalLabelProb · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/KnownMarginalLimit.lean:272
theorem continuous_knownMarginalAuxProb

The formal statement establishes the stated conclusion.

Formal statement
d :
eps :
z :
Continuous (fun theta : KnownMarginalParam d eps ↦ knownMarginalAuxProb theta z)
Proof (Lean source)
lemma continuous_knownMarginalAuxProb {d : Nat} {eps : Real} (z : AuxObs d) : Continuous (fun theta : KnownMarginalParam d eps ↦ knownMarginalAuxProb theta z) := by unfold knownMarginalAuxProb knownMarginalAtom apply continuous_finsetSum intro y _ exact continuous_knownMarginalAtom _
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.continuous_knownMarginalAuxProb · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/KnownMarginalLimit.lean:282
theorem continuous_knownMarginalTarget

The formal statement establishes the stated conclusion.

Formal statement
d :
eps :
Continuous (knownMarginalTarget : KnownMarginalParam d eps → Real)
Proof (Lean source)
lemma continuous_knownMarginalTarget {d : Nat} {eps : Real} : Continuous (knownMarginalTarget : KnownMarginalParam d eps → Real) := by unfold knownMarginalTarget apply continuous_finsetSum intro x _ have hp : Continuous (fun theta : KnownMarginalParam d eps ↦ (theta.1.1 x : Real)) := (continuous_apply x).comp (continuous_subtype_val.comp continuous_fst) have hmu (a : Bool) : Continuous (fun theta : KnownMarginalParam d eps ↦ (theta.2.2 a x : Real)) := continuous_subtype_val.comp ((continuous_apply x).comp ((continuous_apply a).comp (continuous_snd.comp continuous_snd))) exact hp.mul ((hmu true).sub (hmu false))
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.continuous_knownMarginalTarget · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/KnownMarginalLimit.lean:290
theorem knownMarginalTarget_mem

The formal statement establishes the stated conclusion.

Formal statement
d :
eps :
theta :
knownMarginalTarget theta ∈ Icc (-1 : Real) 1
Proof (Lean source)
lemma knownMarginalTarget_mem {d : Nat} {eps : Real} (theta : KnownMarginalParam d eps) : knownMarginalTarget theta ∈ Icc (-1 : Real) 1 := by have hp := theta.1.2 constructor · calc (-1 : Real) = ∑ x, theta.1.1 x * (-1) := by rw [← Finset.sum_mul, hp.2]; ring _ ≤ knownMarginalTarget theta := by apply Finset.sum_le_sum intro x _ apply mul_le_mul_of_nonneg_left _ (hp.1 x) rcases (theta.2.2 true x).2 with ⟨h1lo, h1hi⟩ rcases (theta.2.2 false x).2 with ⟨h0lo, h0hi⟩ linarith · calc knownMarginalTarget theta ≤ ∑ x, theta.1.1 x * 1 := by apply Finset.sum_le_sum intro x _ apply mul_le_mul_of_nonneg_left _ (hp.1 x) rcases (theta.2.2 true x).2 with ⟨h1lo, h1hi⟩ rcases (theta.2.2 false x).2 with ⟨h0lo, h0hi⟩ linarith _ = 1 := by rw [← Finset.sum_mul, hp.2]; ring
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.knownMarginalTarget_mem · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/KnownMarginalLimit.lean:304
theorem knownMarginalGeneric_tendsto Lemma 27 in the paper ↗

The generic finite-side-information values converge on the compact paper coordinates. the stated conditions the stated conclusion.

Formal statement
eps :
heps :
0 < eps
heps2 :
eps < 1 / 2
n d :
hd :
2 ≤ d
Tendsto (fun m : Nat ↦ empiricalSideMinimaxValue (fun theta : KnownMarginalParam d eps ↦ knownMarginalLabelProb (n := n) theta heps.le) (knownMarginalAuxProb (d := d)) (fun theta : KnownMarginalParam d eps ↦ knownMarginalAuxProb_simplex theta heps.le) (knownMarginalTarget (d := d)) (-1) 1 m) atTop (nhds (exactSideMinimaxValue (fun theta : KnownMarginalParam d eps ↦ knownMarginalLabelProb (n := n) theta heps.le) (knownMarginalAuxProb (d := d)) (fun theta : KnownMarginalParam d eps ↦ knownMarginalAuxProb_simplex theta heps.le) (knownMarginalTarget (d := d)) (-1) 1))
Proof (Lean source)
theorem knownMarginalGeneric_tendsto {eps : Real} (heps : 0 < eps) (heps2 : eps < 1 / 2) (n d : Nat) (hd : 2 ≤ d) : Tendsto (fun m : Nat ↦ empiricalSideMinimaxValue (fun theta : KnownMarginalParam d eps ↦ knownMarginalLabelProb (n := n) theta heps.le) (knownMarginalAuxProb (d := d)) (fun theta : KnownMarginalParam d eps ↦ knownMarginalAuxProb_simplex theta heps.le) (knownMarginalTarget (d := d)) (-1) 1 m) atTop (nhds (exactSideMinimaxValue (fun theta : KnownMarginalParam d eps ↦ knownMarginalLabelProb (n := n) theta heps.le) (knownMarginalAuxProb (d := d)) (fun theta : KnownMarginalParam d eps ↦ knownMarginalAuxProb_simplex theta heps.le) (knownMarginalTarget (d := d)) (-1) 1)) := by letI : Nonempty (Fin d) := Fin.pos_iff_nonempty.mp (lt_of_lt_of_le (by omega) hd) letI : Nonempty (Icc eps (1 - eps)) := ⟨⟨eps, le_rfl, by linarith⟩⟩ letI : Nonempty (KnownMarginalParam d eps) := inferInstance apply finiteSideInfo_minimax_tendsto (fun theta : KnownMarginalParam d eps ↦ knownMarginalLabelProb (n := n) theta heps.le) (knownMarginalAuxProb (d := d)) (knownMarginalTarget (d := d)) (fun theta ↦ knownMarginalLabelProb_simplex theta heps.le) (fun theta ↦ knownMarginalAuxProb_simplex theta heps.le) (continuous_knownMarginalLabelProb heps.le) continuous_knownMarginalAuxProb continuous_knownMarginalTarget (by norm_num) knownMarginalTarget_mem
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.knownMarginalGeneric_tendsto · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/KnownMarginalLimit.lean:329
theorem finitePmfMeasure_knownMarginalObsPmf

the stated conditions establishes the stated conclusion.

Formal statement
d :
eps :
theta :
heps :
0 ≤ eps
finitePmfMeasure (knownMarginalObsPmf theta heps) = obsLaw (knownMarginalLaw theta heps)
Proof (Lean source)
lemma finitePmfMeasure_knownMarginalObsPmf {d : Nat} {eps : Real} (theta : KnownMarginalParam d eps) (heps : 0 ≤ eps) : finitePmfMeasure (knownMarginalObsPmf theta heps) = obsLaw (knownMarginalLaw theta heps) := by apply Measure.ext_of_singleton intro z unfold finitePmfMeasure obsLaw rw [FiniteDesign.toMeasure_apply] simp [finitePmfMeasure, finitePmfDesign, knownMarginalObsPmf, knownMarginalLaw, PMF.toMeasure_apply_singleton, knownMarginalAtom_nonneg theta heps] rw [Finset.sum_eq_single z] · simp · intro z' _ hz' simp [Pi.single_apply, Ne.symm hz'] · intro hz simp at hz
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.finitePmfMeasure_knownMarginalObsPmf · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/KnownMarginalLimit.lean:357
theorem knownMarginalAuxProb_eq_table

the stated conditions establishes the stated conclusion.

Formal statement
d :
eps :
theta :
heps :
0 ≤ eps
Proof (Lean source)
lemma knownMarginalAuxProb_eq_table {d : Nat} {eps : Real} (theta : KnownMarginalParam d eps) (heps : 0 ≤ eps) : knownMarginalAuxProb theta = auxTableOf (knownMarginalLaw theta heps) := by funext z simp [knownMarginalAuxProb, auxTableOf, armMass, knownMarginalLaw_jointMass]
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.knownMarginalAuxProb_eq_table · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/KnownMarginalLimit.lean:376
theorem knownMarginalTarget_eq_ate

the stated conditions establishes the stated conclusion.

Formal statement
d :
eps :
theta :
heps :
0 < eps
Proof (Lean source)
lemma knownMarginalTarget_eq_ate {d : Nat} {eps : Real} (theta : KnownMarginalParam d eps) (heps : 0 < eps) : knownMarginalTarget theta = ateFunctional (knownMarginalLaw theta heps.le) := by exact (knownMarginalLaw_ate theta heps).symm
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.knownMarginalTarget_eq_ate · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/KnownMarginalLimit.lean:383
def knownEstimatorEquivAmbient

Bounded measurable estimators on the paper's known-table sample space are equivalent to the promoted measurable ambient exact-table procedures. the stated conditions the stated conclusion.

Definition (Lean source)
n d :
knownEstimatorEquivAmbient n d :
{f : KnownSample n d → Real // Measurable f ∧ ∀ z, f z ∈ Icc (-1 : Real) 1} ≃ MeasurableAmbientExactSideProcedure (Fin n → Obs d) (AuxObs d) (-1) 1
clause 1
toFun est := ⟨fun x w ↦ ⟨est.1 (x, w), est.2.2 (x, w)⟩, by intro x apply Measurable.subtype_mk exact est.2.1.comp (measurable_const.prodMk measurable_id)⟩
clause 2
invFun proc := ⟨fun z ↦ proc.1 z.1 z.2, (measurable_uncurry_of_continuous_of_measurable (fun w ↦ continuous_of_discreteTopology) proc.2).subtype_val, fun z ↦ (proc.1 z.1 z.2).2⟩
clause 3
left_inv est := by ext z; rfl
clause 4
right_inv proc := by ext x w; rfl
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.knownEstimatorEquivAmbient · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/KnownMarginalLimit.lean:390
theorem knownMarginal_integral_eq_tableRisk

the stated conditions establishes the stated conclusion.

Formal statement
n d :
eps :
theta :
heps :
0 < eps
proc :
(∫ x, ((proc.1 x (auxTableOf (knownMarginalLaw theta heps.le)) : Real) - ateFunctional (knownMarginalLaw theta heps.le)) ^ 2 ∂(labeledProductLaw (knownMarginalLaw theta heps.le) n))
= measurableExactTableRisk (fun theta : KnownMarginalParam d eps ↦ knownMarginalLabelProb (n := n) theta heps.le) (knownMarginalAuxProb (d := d)) (knownMarginalTarget (d := d)) proc theta
Proof (Lean source)
lemma knownMarginal_integral_eq_tableRisk {n d : Nat} {eps : Real} (theta : KnownMarginalParam d eps) (heps : 0 < eps) (proc : MeasurableAmbientExactSideProcedure (Fin n → Obs d) (AuxObs d) (-1) 1) : (∫ x, ((proc.1 x (auxTableOf (knownMarginalLaw theta heps.le)) : Real) - ateFunctional (knownMarginalLaw theta heps.le)) ^ 2 ∂(labeledProductLaw (knownMarginalLaw theta heps.le) n)) = measurableExactTableRisk (fun theta : KnownMarginalParam d eps ↦ knownMarginalLabelProb (n := n) theta heps.le) (knownMarginalAuxProb (d := d)) (knownMarginalTarget (d := d)) proc theta := by rw [labeledProductLaw, ← finitePmfMeasure_knownMarginalObsPmf theta heps.le, integral_pi_finitePmfMeasure_eq_sum_productProbability] unfold measurableExactTableRisk knownMarginalLabelProb rw [knownMarginalAuxProb_eq_table theta heps.le, knownMarginalTarget_eq_ate theta heps]
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.knownMarginal_integral_eq_tableRisk · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/KnownMarginalLimit.lean:407
theorem knownMarginalRisk_eq_measurableValue

The paper's known-marginal minimax risk is exactly the promoted measurable ambient exact-table value in compact coordinates. the stated conditions the stated conclusion.

Formal statement
eps :
heps :
0 < eps
heps2 :
eps < 1 / 2
n d :
hd :
2 ≤ d
= measurableExactTableMinimaxValue (fun theta : KnownMarginalParam d eps ↦ knownMarginalLabelProb (n := n) theta heps.le) (knownMarginalAuxProb (d := d)) (knownMarginalTarget (d := d)) (-1) 1
Proof (Lean source)
theorem knownMarginalRisk_eq_measurableValue {eps : Real} (heps : 0 < eps) (heps2 : eps < 1 / 2) (n d : Nat) (hd : 2 ≤ d) : knownMarginalRisk n d eps = measurableExactTableMinimaxValue (fun theta : KnownMarginalParam d eps ↦ knownMarginalLabelProb (n := n) theta heps.le) (knownMarginalAuxProb (d := d)) (knownMarginalTarget (d := d)) (-1) 1 := by let paperRisk := fun (est : {f : KnownSample n d → Real // Measurable f ∧ ∀ z, f z ∈ Icc (-1 : Real) 1}) (P : ClassLaw d eps) ↦ ∫ x, (est.1 (x, auxTableOf P.1) - ateFunctional P.1) ^ 2 ∂(labeledProductLaw P.1 n) let phi := knownMarginalParamToClass hd heps heps2 have hsurj : Surjective phi := knownMarginalParamToClass_surjective hd heps heps2 rw [show knownMarginalRisk n d eps = minimaxValueReal paperRisk by rfl] rw [← minimaxValueReal_comp_surjective paperRisk phi hsurj] unfold minimaxValueReal rw [← (knownEstimatorEquivAmbient n d).symm.iInf_comp] apply iInf_congr intro proc unfold worstCaseRiskReal congr 1 funext theta change (∫ x, ((proc.1 x (auxTableOf (knownMarginalLaw theta heps.le)) : Real) - ateFunctional (knownMarginalLaw theta heps.le)) ^ 2 ∂(labeledProductLaw (knownMarginalLaw theta heps.le) n)) = _ exact knownMarginal_integral_eq_tableRisk theta heps proc
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.knownMarginalRisk_eq_measurableValue · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/KnownMarginalLimit.lean:426
theorem finitePmfMeasure_knownMarginalAuxPmf

the stated conditions establishes the stated conclusion.

Formal statement
d :
eps :
theta :
heps :
0 ≤ eps
finitePmfMeasure ⟨knownMarginalAuxProb theta, knownMarginalAuxProb_simplex theta heps⟩
= (auxMarginal (knownMarginalLaw theta heps)).toMeasure
Proof (Lean source)
lemma finitePmfMeasure_knownMarginalAuxPmf {d : Nat} {eps : Real} (theta : KnownMarginalParam d eps) (heps : 0 ≤ eps) : finitePmfMeasure ⟨knownMarginalAuxProb theta, knownMarginalAuxProb_simplex theta heps⟩ = (auxMarginal (knownMarginalLaw theta heps)).toMeasure := by apply Measure.ext_of_singleton intro z unfold finitePmfMeasure rw [FiniteDesign.toMeasure_apply, PMF.toMeasure_apply_singleton] simp only [finitePmfDesign, FiniteDesign.p, Measure.dirac_apply' _ (MeasurableSet.singleton _), if_pos] rw [Finset.sum_eq_single z] · rw [Set.indicator_of_mem (Set.mem_singleton z)] simp only [Pi.one_apply, mul_one] apply (ENNReal.toReal_eq_toReal_iff' (ENNReal.ofReal_ne_top) (PMF.apply_ne_top _ _)).mp rw [ENNReal.toReal_ofReal ((knownMarginalAuxProb_simplex theta heps).1 z), auxMarginal_toReal, knownMarginalAuxProb_eq_table theta heps] · intro z' _ hz' simp [Pi.single_apply, Ne.symm hz'] · intro hz simp at hz · exact MeasurableSet.singleton z
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.finitePmfMeasure_knownMarginalAuxPmf · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/KnownMarginalLimit.lean:467
theorem twoSampleMSE_eq_empiricalSideRisk

the stated conditions establishes the stated conclusion.

Formal statement
n m d :
eps :
theta :
heps :
0 < eps
est :
EmpiricalSideProcedure (Fin n → Obs d) (AuxObs d) m (-1) 1
twoSampleMSE (annotationLaw (knownMarginalLaw theta heps.le) n m) (fun z ↦ (est z.1 z.2 : Real)) (ateFunctional (knownMarginalLaw theta heps.le))
= empiricalSideRisk (fun theta : KnownMarginalParam d eps ↦ knownMarginalLabelProb (n := n) theta heps.le) (knownMarginalAuxProb (d := d)) (fun theta : KnownMarginalParam d eps ↦ knownMarginalAuxProb_simplex theta heps.le) (knownMarginalTarget (d := d)) m est theta
Proof (Lean source)
lemma twoSampleMSE_eq_empiricalSideRisk {n m d : Nat} {eps : Real} (theta : KnownMarginalParam d eps) (heps : 0 < eps) (est : EmpiricalSideProcedure (Fin n → Obs d) (AuxObs d) m (-1) 1) : twoSampleMSE (annotationLaw (knownMarginalLaw theta heps.le) n m) (fun z ↦ (est z.1 z.2 : Real)) (ateFunctional (knownMarginalLaw theta heps.le)) = empiricalSideRisk (fun theta : KnownMarginalParam d eps ↦ knownMarginalLabelProb (n := n) theta heps.le) (knownMarginalAuxProb (d := d)) (fun theta : KnownMarginalParam d eps ↦ knownMarginalAuxProb_simplex theta heps.le) (knownMarginalTarget (d := d)) m est theta := by letI : IsProbabilityMeasure (labeledProductLaw (knownMarginalLaw theta heps.le) n) := by unfold labeledProductLaw infer_instance letI : IsProbabilityMeasure (auxProductLaw (knownMarginalLaw theta heps.le) m) := by unfold auxProductLaw infer_instance unfold twoSampleMSE annotationLaw rw [MeasureTheory.integral_prod _ Integrable.of_finite] unfold labeledProductLaw auxProductLaw rw [← finitePmfMeasure_knownMarginalObsPmf theta heps.le, ← finitePmfMeasure_knownMarginalAuxPmf theta heps.le] simp_rw [integral_pi_finitePmfMeasure_eq_sum_productProbability] unfold empiricalSideRisk knownMarginalLabelProb rw [knownMarginalTarget_eq_ate theta heps] rfl
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.twoSampleMSE_eq_empiricalSideRisk · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/KnownMarginalLimit.lean:492
theorem minimaxRisk_eq_empiricalValue

The paper's two-sample minimax risk is exactly the generic empirical-side minimax value in compact coordinates. the stated conditions the stated conclusion.

Formal statement
eps :
heps :
0 < eps
heps2 :
eps < 1 / 2
n m d :
hd :
2 ≤ d
minimaxRisk n m d eps
= empiricalSideMinimaxValue (fun theta : KnownMarginalParam d eps ↦ knownMarginalLabelProb (n := n) theta heps.le) (knownMarginalAuxProb (d := d)) (fun theta : KnownMarginalParam d eps ↦ knownMarginalAuxProb_simplex theta heps.le) (knownMarginalTarget (d := d)) (-1) 1 m
Proof (Lean source)
theorem minimaxRisk_eq_empiricalValue {eps : Real} (heps : 0 < eps) (heps2 : eps < 1 / 2) (n m d : Nat) (hd : 2 ≤ d) : minimaxRisk n m d eps = empiricalSideMinimaxValue (fun theta : KnownMarginalParam d eps ↦ knownMarginalLabelProb (n := n) theta heps.le) (knownMarginalAuxProb (d := d)) (fun theta : KnownMarginalParam d eps ↦ knownMarginalAuxProb_simplex theta heps.le) (knownMarginalTarget (d := d)) (-1) 1 m := by letI : Nonempty (Fin d) := Fin.pos_iff_nonempty.mp (lt_of_lt_of_le (by omega) hd) letI : Nonempty (Icc eps (1 - eps)) := ⟨⟨eps, le_rfl, by linarith⟩⟩ letI : Nonempty (KnownMarginalParam d eps) := inferInstance letI : Nonempty (EmpiricalSideProcedure (Fin n → Obs d) (AuxObs d) m (-1) 1) := ⟨fun _ _ ↦ ⟨0, by norm_num⟩⟩ let paperRisk := fun (est : {f : Sample n m d → Real // Measurable f}) (P : ClassLaw d eps) ↦ twoSampleMSE (annotationLaw P.1 n m) est.1 (ateFunctional P.1) let paramRisk := fun (est : {f : Sample n m d → Real // Measurable f}) (theta : KnownMarginalParam d eps) ↦ paperRisk est (knownMarginalParamToClass hd heps heps2 theta) let genericRisk : EmpiricalSideProcedure (Fin n → Obs d) (AuxObs d) m (-1) 1 → KnownMarginalParam d eps → Real := empiricalSideRisk (fun theta : KnownMarginalParam d eps ↦ knownMarginalLabelProb (n := n) theta heps.le) (knownMarginalAuxProb (d := d)) (fun theta : KnownMarginalParam d eps ↦ knownMarginalAuxProb_simplex theta heps.le) (knownMarginalTarget (d := d)) m have hsurj := knownMarginalParamToClass_surjective hd heps heps2 rw [show minimaxRisk n m d eps = minimaxValueReal paperRisk by rfl] rw [← minimaxValueReal_comp_surjective paperRisk (knownMarginalParamToClass hd heps heps2) hsurj] change minimaxValueReal paramRisk = minimaxValueReal genericRisk apply le_antisymm · apply minimaxValue_le_minimaxValue (bddBelow_range_worstCaseRisk (fun est theta ↦ integral_nonneg fun z ↦ sq_nonneg _)) intro est refine ⟨paperEstimatorOfEmpirical est, ?_⟩ unfold worstCaseRiskReal apply le_of_eq congr 1 funext theta exact twoSampleMSE_eq_empiricalSideRisk theta heps est · letI : Nonempty {f : Sample n m d → Real // Measurable f} := ⟨⟨fun _ ↦ 0, measurable_const⟩⟩ apply minimaxValue_le_minimaxValue (bddBelow_range_worstCaseRisk (fun est theta ↦ empiricalSideRisk_nonneg _ _ (fun theta ↦ knownMarginalLabelProb_simplex theta heps.le) (fun theta ↦ knownMarginalAuxProb_simplex theta heps.le) _ _ _ _)) intro est refine ⟨clippedEmpiricalOfPaper est, ?_⟩ apply worstCaseRisk_le intro theta rw [← twoSampleMSE_eq_empiricalSideRisk theta heps] letI : IsProbabilityMeasure (annotationLaw (knownMarginalLaw theta heps.le) n m) := by unfold annotationLaw labeledProductLaw auxProductLaw infer_instance have hclip : twoSampleMSE (annotationLaw (knownMarginalLaw theta heps.le) n m) (fun z ↦ (clippedEmpiricalOfPaper est z.1 z.2 : Real)) (ateFunctional (knownMarginalLaw theta heps.le)) ≤ paramRisk est theta := by apply integral_mono_ae Integrable.of_finite Integrable.of_finite exact ae_of_all _ fun z ↦ clippedEmpirical_sq_le est z _ (ateFunctional_mem_Icc_neg_one_one _ (knownMarginalParamToClass hd heps heps2 theta).2.overlap) refine hclip.trans (le_worstCaseRisk ?_ theta) let B : Real := ∑ z : Sample n m d, (|est.1 z| + 1) ^ 2 refine ⟨B, ?_⟩ rintro _ ⟨theta', rfl⟩ letI : IsProbabilityMeasure (annotationLaw (knownMarginalLaw theta' heps.le) n m) := by unfold annotationLaw labeledProductLaw auxProductLaw infer_instance change twoSampleMSE (annotationLaw (knownMarginalLaw theta' heps.le) n m) est.1 (ateFunctional (knownMarginalLaw theta' heps.le)) ≤ B calc twoSampleMSE (annotationLaw (knownMarginalLaw theta' heps.le) n m) est.1 (ateFunctional (knownMarginalLaw theta' heps.le)) ≤ ∫ _z, B ∂(annotationLaw (knownMarginalLaw theta' heps.le) n m) := by unfold twoSampleMSE apply integral_mono_ae Integrable.of_finite Integrable.of_finite exact ae_of_all _ fun z ↦ by have ht := ateFunctional_mem_Icc_neg_one_one _ (knownMarginalParamToClass hd heps heps2 theta').2.overlap have habs : |ateFunctional (knownMarginalLaw theta' heps.le)| ≤ 1 := abs_le.mpr ht have hs : (est.1 z - ateFunctional (knownMarginalLaw theta' heps.le)) ^ 2 ≤ (|est.1 z| + 1) ^ 2 := by apply sq_le_sq.mpr have htri : |est.1 z - ateFunctional (knownMarginalLaw theta' heps.le)| ≤ |est.1 z| + |ateFunctional (knownMarginalLaw theta' heps.le)| := by simpa using abs_sub_le (est.1 z) 0 (ateFunctional (knownMarginalLaw theta' heps.le)) refine htri.trans ?_ simpa [abs_of_nonneg (by positivity : 0 ≤ |est.1 z| + 1)] using (add_le_add_left habs |est.1 z|) exact hs.trans (Finset.single_le_sum (fun w _ ↦ sq_nonneg (|est.1 w| + 1)) (Finset.mem_univ z)) _ = B := by simp
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.minimaxRisk_eq_empiricalValue · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/KnownMarginalLimit.lean:545
CausalSmith.Stat.STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research.Helpers.ParametricCommonMarginalRecipe 8 declarations This file supplies the low-dimensional branch of the common-marginal recipe.

Parametric common-marginal recipe

This file supplies the low-dimensional branch of the common-marginal recipe. Both laws put all covariate mass on the reservoir cell, use propensity one half, and differ only in the treated outcome mean.

def parametricRareCell

the stated conditions defines the specified object.

Definition (Lean source)
d k :
hk :
k ≤ d - 1
i :
Fin k
parametricRareCell hk i :
Fin d
⟨i.1 + 1, by omega⟩
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.parametricRareCell · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/ParametricCommonMarginalRecipe.lean:22
theorem parametricRareCell_injective

the stated conditions establishes the stated conclusion.

Formal statement
d k :
hk :
k ≤ d - 1
Proof (Lean source)
lemma parametricRareCell_injective {d k : Nat} (hk : k ≤ d - 1) : Injective (parametricRareCell hk) := by intro i j hij apply Fin.ext simpa [parametricRareCell] using congrArg val hij
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.parametricRareCell_injective · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/ParametricCommonMarginalRecipe.lean:26
theorem parametricReservoir_ne_rare

the stated conditions establishes the stated conclusion.

Formal statement
d k :
r :
Fin d
hr :
r.1 = 0
hk :
k ≤ d - 1
i :
Fin k
Proof (Lean source)
lemma parametricReservoir_ne_rare {d k : Nat} (r : Fin d) (hr : r.1 = 0) (hk : k ≤ d - 1) (i : Fin k) : r ≠ parametricRareCell hk i := by intro h have := congrArg val h simp [parametricRareCell, hr] at this
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.parametricReservoir_ne_rare · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/ParametricCommonMarginalRecipe.lean:33
def reservoirPmf

the stated conditions defines the specified object.

Definition (Lean source)
d :
r :
Fin d
reservoirPmf r :
⟨fun x
=> if x = r then 1 else 0, by constructor · intro x by_cases hx : x = r <;> simp [hx] · simp⟩
def parametricTheta

the stated conditions defines the specified object.

Definition (Lean source)
d :
eps g :
_heps :
0 < eps
heps2 :
eps < 1 / 2
r :
Fin d
hg :
g ∈ Icc (0 : Real) 1
parametricTheta _heps heps2 r hg :
(reservoirPmf r, fun _ => ⟨1 / 2, le_of_lt heps2, by linarith⟩, fun arm _ => if arm then ⟨g, hg⟩ else ⟨0, by norm_num⟩)
def parametricReservoirLaw

the stated conditions defines the specified object.

Definition (Lean source)
d :
eps g :
heps :
0 < eps
heps2 :
eps < 1 / 2
r :
Fin d
hg :
g ∈ Icc (0 : Real) 1
parametricReservoirLaw heps heps2 r hg :
knownMarginalLaw (parametricTheta heps heps2 r hg) heps.le
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.parametricReservoirLaw · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/ParametricCommonMarginalRecipe.lean:57
def parametricCommonMarginalRecipe

In the parametric regime, a single occupied reservoir cell gives a common-marginal recipe whose treated means differ by twice the calibrated root-n shift. the stated conditions the stated conclusion.

Definition (Lean source)
eps :
calibration :
n m d L :
B a :
k :
hd :
2 ≤ d
hn :
1 ≤ n
heps :
0 < eps
heps2 :
eps < 1 / 2
hk :
k ≤ d - 1
hgap :
calibration.dualGap / Real.sqrt n ≤ 1 / 4
parametricCommonMarginalRecipe calibration n m d L B a k hd hn heps heps2 hk hgap :
CommonMarginalRecipe calibration n m d L B a k
by let r : Fin d := ⟨0, by omega⟩ let delta : Real := calibration.dualGap / Real.sqrt n have hnR : (0 : Real) < n := by exact_mod_cast (lt_of_lt_of_le Nat.zero_lt_one hn) have hsqrt : 0 < Real.sqrt n := Real.sqrt_pos.2 hnR have hdelta0 : 0
≤ delta := by dsimp [delta] exact div_nonneg calibration.dualGap_pos.le hsqrt.le have hg0 : 1 / 2
- delta ∈ Icc (0 : Real) 1 := by constructor <;> dsimp [delta] at hgap ⊢ <;> linarith have hg1 : 1 / 2
+ delta ∈ Icc (0 : Real) 1 := by constructor <;> dsimp [delta] at hgap ⊢ <;> linarith let P0 := parametricReservoirLaw heps heps2 r hg0 let P1 := parametricReservoirLaw heps heps2 r hg1 let generator : Measure (Fin k → Real) := Measure.pi (fun _ : Fin k => Measure.dirac 0) let sigma : SignedMeasure Real := (Measure.dirac 0).toSignedMeasure let nu : Measure Real := Measure.dirac 0 let dual : Measure Real := Measure.dirac 0 let lawOf : Bool → (Fin k → Real) → DiscreteLaw d := fun branch _
=> if branch then P1 else P0 let prior0 : Measure (DiscreteLaw d) := Measure.dirac P0 let prior1 : Measure (DiscreteLaw d) := Measure.dirac P1 let experimentKernel : Kernel (DiscreteLaw d) (RawPoissonCounts d) := { toFun := fun P => rawPoissonLaw P 1 0 0 measurable' := measurable_from_top } refine { finiteAtomConstruction := False kappa := (1 - 2 * eps) / eps degree_ge_two := False.elim bandwidth_pos := False.elim shift_eq := False.elim kappa_eq := rfl rareCount_le := hk reservoir := r reservoir_is_first := rfl rareCell := parametricRareCell hk rareCell_injective := parametricRareCell_injective hk reservoir_ne_rare := parametricReservoir_ne_rare r rfl hk outcomeSign := fun _ => 1 outcomeSign_mem := by intro; norm_num generator := generator generatorProbability := by dsimp [generator]; infer_instance sigma := sigma sigmaVariationProbability := by dsimp [sigma] simpa only [Measure.variation_toSignedMeasure] using (inferInstance : IsProbabilityMeasure (Measure.dirac (0 : Real))) sigma_support := False.elim outcomeSign_integrable := by dsimp [sigma] simp sigma_density := by dsimp [sigma] rw [Measure.variation_toSignedMeasure] ext s hs rw [Measure.toSignedMeasure_apply_measurable hs, withDensityᵥ_apply (by simp) hs] simp [Measure.real, hs] nu := nu nuProbability := by dsimp [nu]; infer_instance nu_eq := False.elim generator_eq_iid := by dsimp [generator, nu] generator_support := False.elim dual0 := dual dual1 := dual dualProbability0 := by dsimp [dual]; infer_instance dualProbability1 := by dsimp [dual]; infer_instance dualSupport0 := False.elim dualSupport1 := False.elim dualMomentMatch := False.elim dualSeparation := False.elim sigmaMomentZero := False.elim sigmaSeparation := False.elim lawOf := lawOf lawOf_measurable := by intro branch; fun_prop rawMass := fun _ x => if x = r then 1 else 0 rawTotalMass := fun _ => 1 rawTarget := fun branch _ => ateFunctional (if branch then P1 else P0) rawMass_sum := by exact Filter.Eventually.of_forall fun _ => by simp rawMass_pos := by exact Filter.Eventually.of_forall fun _ => by simp rareRawMass := False.elim reservoirRawMass := False.elim unusedRawMass := by apply Filter.Eventually.of_forall intro _ x hx _ simp [hx] normalization := by intro branch apply Filter.Eventually.of_forall intro _ x cases branch <;> simp [lawOf, P0, P1, parametricReservoirLaw_cellMass] rawTarget_formula := by intro branch exact Filter.Eventually.of_forall fun _ => by simp [lawOf] rawScale := fun _ => 1 rawScale_measurable := measurable_const rawScale_lawOf := by intro branch exact Filter.Eventually.of_forall fun _ => by simp commonTable_pointwise := by apply Filter.Eventually.of_forall intro _ dsimp [lawOf, P0, P1] exact parametricReservoirLaw_auxTable_eq heps heps2 r hg0 hg1 rareTreatmentMass := False.elim reservoirPropensity := by intro branch apply Filter.Eventually.of_forall intro _ cases branch <;> simp [lawOf, P0, P1, parametricReservoirLaw_propensity] controlOutcomeZero := by intro branch apply Filter.Eventually.of_forall intro _ x cases branch <;> simp [lawOf, P0, P1, parametricReservoirLaw_outcomeMean] reservoirTreatedOutcomeZero := False.elim rareOutcomeMeans := False.elim parametricShape := by intro _ apply Filter.Eventually.of_forall intro _ refine ⟨hgap, ?_⟩ simp [lawOf, P0, P1, parametricReservoirLaw_cellMass, parametricReservoirLaw_outcomeMean, delta] model0 := by apply Filter.Eventually.of_forall intro _ simpa [lawOf, P0] using parametricReservoirLaw_model hd heps heps2 r hg0 model1 := by apply Filter.Eventually.of_forall intro _ simpa [lawOf, P1] using parametricReservoirLaw_model hd heps heps2 r hg1 prior0 := prior0 prior1 := prior1 prior0_eq := by simp [prior0, generator, lawOf] prior1_eq := by simp [prior1, generator, lawOf] probability0 := by dsimp [prior0]; infer_instance probability1 := by dsimp [prior1]; infer_instance priorModel0 := by simp only [prior0, MeasureTheory.ae_dirac_eq, Filter.eventually_pure] exact parametricReservoirLaw_model hd heps heps2 r hg0 priorModel1 := by simp only [prior1, MeasureTheory.ae_dirac_eq, Filter.eventually_pure] exact parametricReservoirLaw_model hd heps heps2 r hg1 labeledIntensity := 0 auxiliaryIntensity := 0 experimentKernel := experimentKernel experimentKernel_eq := by intro P; rfl rawExperiment0 := priorPredictive prior0 experimentKernel rawExperiment1 := priorPredictive prior1 experimentKernel rawExperiment0_eq := rfl rawExperiment1_eq := rfl }
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.parametricCommonMarginalRecipe · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/ParametricCommonMarginalRecipe.lean:119
def parametricCommonMarginalPriorHandle

The single-reservoir recipe, specialized to the four paper-facing scales, populates a prior handle whenever the parametric branch condition and root-n shift bound hold. the stated conditions the stated conclusion.

Definition (Lean source)
eps :
calibration :
n m d :
hd :
2 ≤ d
hn :
1 ≤ n
heps :
0 < eps
heps2 :
eps < 1 / 2
hreg :
hgap :
calibration.dualGap / sqrt n ≤ 1 / 4
parametricCommonMarginalPriorHandle calibration n m d hd hn heps heps2 hreg hgap :
CommonMarginalPriorHandle calibration n m d
by let L := ceil (calibration.degreeConstant * logEN n) let B := calibration.bandwidthConstant * L / (n + m : Nat) let a := calibration.gamma * B / (L : Real) ^ 2 let k := min (d - 1) ⌊calibration.rareCountConstant * (n + m : Nat) * L⌋₊ have hk : k
≤ d
- 1 := by dsimp [k] exact min_le_left _ _ let recipe := parametricCommonMarginalRecipe calibration n m d L B a k hd hn heps heps2 hk hgap refine { L := L B := B a := a k := k recipe := recipe branchCondition := by change False ↔ ¬commonMarginalParametricRegime calibration n m d simp [hreg] degree_eq := rfl bandwidth_eq := rfl shift_eq := rfl rareCount_eq := rfl }
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.parametricCommonMarginalPriorHandle · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/ParametricCommonMarginalRecipe.lean:281
CausalSmith.Stat.STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research.Helpers.ParametricLabelFloor 11 declarations The label-gated parametric 1/n minimax lower bound.

The label-gated parametric 1/n minimax lower bound.

def parametricFloorNullLaw

From a valid null parametric data-generating process, define its finite discrete observation law.

Definition (Lean source)
d :
Nonempty (Fin d)
g :
hv :
ValidDGP (mC (C := Fin d) (1 / 2)) (gNull (C := Fin d) g g)
parametricFloorNullLaw hv :
⟨Causalean.Estimation.MinimaxATE.obsPMF hv⟩
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.parametricFloorNullLaw · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/ParametricLabelFloor.lean:17
def parametricFloorPertLaw

From a valid perturbed parametric data-generating process, define its finite discrete observation law.

Definition (Lean source)
d :
Nonempty (Fin d)
g delta :
hv :
ValidDGP (mC (C := Fin d) (1 / 2)) (gPert (C := Fin d) g g delta)
parametricFloorPertLaw hv :
⟨Causalean.Estimation.MinimaxATE.obsPMF hv⟩
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.parametricFloorPertLaw · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/ParametricLabelFloor.lean:25
theorem parametricFloorNullLaw_jointMass

For a valid null process, covariate cell, treatment arm and outcome, the induced joint mass equals the parametric observation mass.

Formal statement
d :
Nonempty (Fin d)
g :
hv :
ValidDGP (mC (C := Fin d) (1 / 2)) (gNull (C := Fin d) g g)
x :
Fin d
a y :
jointMass (parametricFloorNullLaw hv) x a y
= obsReal (mC (C := Fin d) (1 / 2)) (gNull (C := Fin d) g g) (x, a, y)
Proof (Lean source)
lemma parametricFloorNullLaw_jointMass {d : Nat} [Nonempty (Fin d)] {g : Real} (hv : ValidDGP (mC (C := Fin d) (1 / 2)) (gNull (C := Fin d) g g)) (x : Fin d) (a y : Bool) : jointMass (parametricFloorNullLaw hv) x a y = obsReal (mC (C := Fin d) (1 / 2)) (gNull (C := Fin d) g g) (x, a, y) := by simp [jointMass, parametricFloorNullLaw, obsPMF] simpa [one_div] using obsReal_nonneg hv (x, a, y)
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.parametricFloorNullLaw_jointMass · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/ParametricLabelFloor.lean:33
theorem parametricFloorPertLaw_jointMass

For a valid perturbed process, covariate cell, treatment arm and outcome, the induced joint mass equals the perturbed parametric observation mass.

Formal statement
d :
Nonempty (Fin d)
g delta :
hv :
ValidDGP (mC (C := Fin d) (1 / 2)) (gPert (C := Fin d) g g delta)
x :
Fin d
a y :
jointMass (parametricFloorPertLaw hv) x a y
= obsReal (mC (C := Fin d) (1 / 2)) (gPert (C := Fin d) g g delta) (x, a, y)
Proof (Lean source)
lemma parametricFloorPertLaw_jointMass {d : Nat} [Nonempty (Fin d)] {g delta : Real} (hv : ValidDGP (mC (C := Fin d) (1 / 2)) (gPert (C := Fin d) g g delta)) (x : Fin d) (a y : Bool) : jointMass (parametricFloorPertLaw hv) x a y = obsReal (mC (C := Fin d) (1 / 2)) (gPert (C := Fin d) g g delta) (x, a, y) := by simp [jointMass, parametricFloorPertLaw, obsPMF] simpa [one_div] using obsReal_nonneg hv (x, a, y)
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.parametricFloorPertLaw_jointMass · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/ParametricLabelFloor.lean:47
theorem parametricFloorNullLaw_model

If the dimension is at least two, overlap is positive and below one half, then a valid null process induces a law in the overlap model class.

Formal statement
d :
Nonempty (Fin d)
eps g :
hd :
2 ≤ d
heps :
0 < eps
heps2 :
eps < 1 / 2
hv :
ValidDGP (mC (C := Fin d) (1 / 2)) (gNull (C := Fin d) g g)
Proof (Lean source)
lemma parametricFloorNullLaw_model {d : Nat} [Nonempty (Fin d)] {eps g : Real} (hd : 2 ≤ d) (heps : 0 < eps) (heps2 : eps < 1 / 2) (hv : ValidDGP (mC (C := Fin d) (1 / 2)) (gNull (C := Fin d) g g)) : ModelClass d eps (parametricFloorNullLaw hv) := by refine ⟨hd, heps, heps2, ?_⟩ intro x hx have hc : (card (Fin d) : Real) ≠ 0 := Nat.cast_ne_zero.mpr Fintype.card_ne_zero have hp : propensity (parametricFloorNullLaw hv) x = 1 / 2 := by simp [propensity, cellMass, armMass, parametricFloorNullLaw_jointMass, obsReal, mC, gNull] field_simp [hc] ring rw [hp] constructor <;> linarith
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.parametricFloorNullLaw_model · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/ParametricLabelFloor.lean:61
theorem parametricFloorPertLaw_model

If the dimension is at least two, overlap is positive and below one half, then a valid perturbed process induces a law in the overlap model class.

Formal statement
d :
Nonempty (Fin d)
eps g delta :
hd :
2 ≤ d
heps :
0 < eps
heps2 :
eps < 1 / 2
hv :
ValidDGP (mC (C := Fin d) (1 / 2)) (gPert (C := Fin d) g g delta)
Proof (Lean source)
lemma parametricFloorPertLaw_model {d : Nat} [Nonempty (Fin d)] {eps g delta : Real} (hd : 2 ≤ d) (heps : 0 < eps) (heps2 : eps < 1 / 2) (hv : ValidDGP (mC (C := Fin d) (1 / 2)) (gPert (C := Fin d) g g delta)) : ModelClass d eps (parametricFloorPertLaw hv) := by refine ⟨hd, heps, heps2, ?_⟩ intro x hx have hc : (card (Fin d) : Real) ≠ 0 := Nat.cast_ne_zero.mpr Fintype.card_ne_zero have hp : propensity (parametricFloorPertLaw hv) x = 1 / 2 := by simp [propensity, cellMass, armMass, parametricFloorPertLaw_jointMass, obsReal, mC, gPert] field_simp [hc] ring rw [hp] constructor <;> linarith
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.parametricFloorPertLaw_model · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/ParametricLabelFloor.lean:82
theorem parametricFloorNullLaw_ate

For a valid null process, the induced average treatment effect is zero.

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 parametricFloorNullLaw_ate {d : Nat} [Nonempty (Fin d)] {g : Real} (hv : ValidDGP (mC (C := Fin d) (1 / 2)) (gNull (C := Fin d) g g)) : ateFunctional (parametricFloorNullLaw hv) = 0 := by apply Finset.sum_eq_zero intro x hx have hc : (card (Fin d) : Real) ≠ 0 := Nat.cast_ne_zero.mpr Fintype.card_ne_zero have hd : (d : Real) ≠ 0 := by simpa using hc have hm (a : Bool) : outcomeMean (parametricFloorNullLaw hv) a x = g := by cases a <;> simp [outcomeMean, armMass, parametricFloorNullLaw_jointMass, obsReal, mC, gNull] <;> field_simp [hc, hd] <;> ring simp [ateFunctional, hm]
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.parametricFloorNullLaw_ate · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/ParametricLabelFloor.lean:103
theorem parametricFloorPertLaw_ate

For a valid perturbed process, the induced average treatment effect equals the perturbation.

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 parametricFloorPertLaw_ate {d : Nat} [Nonempty (Fin d)] {g delta : Real} (hv : ValidDGP (mC (C := Fin d) (1 / 2)) (gPert (C := Fin d) g g delta)) : ateFunctional (parametricFloorPertLaw hv) = delta := by have hc : (card (Fin d) : Real) ≠ 0 := Nat.cast_ne_zero.mpr Fintype.card_ne_zero have hd : (d : Real) ≠ 0 := by simpa using hc have hm (a : Bool) (x : Fin d) : outcomeMean (parametricFloorPertLaw hv) a x = if a then g + delta else g := by cases a <;> simp [outcomeMean, armMass, parametricFloorPertLaw_jointMass, obsReal, mC, gPert] <;> field_simp [hc, hd] <;> ring simp_rw [ateFunctional, hm true, hm false] simp [cellMass, parametricFloorPertLaw_jointMass, obsReal, mC, gPert] field_simp [hd] ring
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.parametricFloorPertLaw_ate · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/ParametricLabelFloor.lean:121
theorem parametricFloor_auxMarginal_eq

A valid null process and its valid perturbation induce identical auxiliary-data marginals.

Formal statement
d :
Nonempty (Fin d)
g delta :
hv0 :
ValidDGP (mC (C := Fin d) (1 / 2)) (gNull (C := Fin d) g g)
hv1 :
ValidDGP (mC (C := Fin d) (1 / 2)) (gPert (C := Fin d) g g delta)
Proof (Lean source)
lemma parametricFloor_auxMarginal_eq {d : Nat} [Nonempty (Fin d)] {g delta : Real} (hv0 : ValidDGP (mC (C := Fin d) (1 / 2)) (gNull (C := Fin d) g g)) (hv1 : ValidDGP (mC (C := Fin d) (1 / 2)) (gPert (C := Fin d) g g delta)) : auxMarginal (parametricFloorNullLaw hv0) = auxMarginal (parametricFloorPertLaw hv1) := by classical apply PMF.ext rintro ⟨x, a⟩ unfold auxMarginal rw [PMF.map_apply, PMF.map_apply] simp only [tsum_fintype, Fintype.sum_prod_type] cases a <;> simp [parametricFloorNullLaw, parametricFloorPertLaw, obsPMF, obsReal, mC, gNull, gPert] obtain ⟨hg0, hg1⟩ := hv0.g_mem true x obtain ⟨hgd0, hgd1⟩ := hv1.g_mem true x have hg0' : 0 ≤ g := by simpa [gNull] using hg0 have hgd0' : 0 ≤ g + delta := by simpa [gPert] using hgd0 have hg1' : g ≤ 1 := by simpa [gNull] using hg1 have hgd1' : g + delta ≤ 1 := by simpa [gPert] using hgd1 rw [← mul_add, ← mul_add, ← ENNReal.ofReal_add hg0', show g + (1 - g) = 1 by ring, ← ENNReal.ofReal_add hgd0', show g + delta + (1 - (g + delta)) = 1 by ring] <;> linarith
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.parametricFloor_auxMarginal_eq · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/ParametricLabelFloor.lean:144
theorem annotationMinimaxRisk_ge_two_model_tv

the stated conditions establishes the stated conclusion.

Formal statement
n m d :
eps s :
P0 P1 :
ClassLaw d eps
hs :
0 ≤ s
hsep :
2 * s ≤ |ateFunctional P0.1 - ateFunctional P1.1|
htv :
tvDist (annotationLaw P0.1 n m) (annotationLaw P1.1 n m) ≤ 1 / 2
s ^ 2 / 4 ≤ minimaxRisk n m d eps
Proof (Lean source)
lemma annotationMinimaxRisk_ge_two_model_tv {n m d : Nat} {eps s : Real} (P0 P1 : ClassLaw d eps) (hs : 0 ≤ s) (hsep : 2 * s ≤ |ateFunctional P0.1 - ateFunctional P1.1|) (htv : tvDist (annotationLaw P0.1 n m) (annotationLaw P1.1 n m) ≤ 1 / 2) : s ^ 2 / 4 ≤ minimaxRisk n m d eps := by classical have hprob (P : DiscreteLaw d) : IsProbabilityMeasure (annotationLaw P n m) := by unfold annotationLaw labeledProductLaw auxProductLaw infer_instance letI : IsProbabilityMeasure (annotationLaw P0.1 n m) := hprob P0.1 letI : IsProbabilityMeasure (annotationLaw P1.1 n m) := hprob P1.1 letI : Nonempty {f : Sample n m d → Real // Measurable f} := ⟨⟨fun _ => 0, measurable_const⟩⟩ unfold minimaxRisk apply le_ciInf intro est have ht := two_point_lower_bound_of_tvDist_le (P₀ := annotationLaw P0.1 n m) (P₁ := annotationLaw P1.1 n m) est.2 (θ₀ := ateFunctional P0.1) (θ₁ := ateFunctional P1.1) (s := s) (c := (1 / 2 : Real)) hsep htv have hp : 1 / 4 ≤ max ((annotationLaw P0.1 n m).real {z | s ≤ |est.1 z - ateFunctional P0.1|}) ((annotationLaw P1.1 n m).real {z | s ≤ |est.1 z - ateFunctional P1.1|}) := by convert ht using 1 <;> norm_num have hrisk (P : ClassLaw d eps) : s ^ 2 * (annotationLaw P.1 n m).real {z | s ≤ |est.1 z - ateFunctional P.1|} ≤ twoSampleMSE (annotationLaw P.1 n m) est.1 (ateFunctional P.1) := by letI : IsProbabilityMeasure (annotationLaw P.1 n m) := hprob P.1 unfold twoSampleMSE let f : Sample n m d → Real := fun z => (est.1 z - ateFunctional P.1) ^ 2 have hmarkov := mul_meas_ge_le_integral_of_nonneg (μ := annotationLaw P.1 n m) (f := f) (ae_of_all _ fun z => sq_nonneg _) Integrable.of_finite (s ^ 2) have he : {z | s ≤ |est.1 z - ateFunctional P.1|} = {z | s ^ 2 ≤ f z} := by ext z simpa [f, abs_of_nonneg hs, sq_abs] using (sq_le_sq₀ hs (abs_nonneg (est.1 z - ateFunctional P.1))).symm rw [he] simpa using hmarkov have hb : BddAbove (range (fun P : ClassLaw d eps => twoSampleMSE (annotationLaw P.1 n m) est.1 (ateFunctional P.1))) := by refine ⟨((∑ z : Sample n m d, |est.1 z|) + 1) ^ 2, ?_⟩ rintro _ ⟨P, rfl⟩ letI : IsProbabilityMeasure (annotationLaw P.1 n m) := hprob P.1 unfold twoSampleMSE let B : Real := ((∑ z : Sample n m d, |est.1 z|) + 1) ^ 2 have hpoint : ∀ z, (est.1 z - ateFunctional P.1) ^ 2 ≤ B := by intro z have htarget := ateFunctional_mem_Icc_neg_one_one P.1 P.2.overlap have hz : |est.1 z| ≤ ∑ w : Sample n m d, |est.1 w| := Finset.single_le_sum (s := univ) (f := fun w : Sample n m d => |est.1 w|) (fun _ _ => abs_nonneg _) (Finset.mem_univ z) rcases htarget with ⟨ht0, ht1⟩ dsimp [B] nlinarith [le_abs_self (est.1 z), neg_le_of_abs_le hz] calc ∫ z, (est.1 z - ateFunctional P.1) ^ 2 ∂annotationLaw P.1 n m ≤ ∫ _z, B ∂annotationLaw P.1 n m := integral_mono_ae Integrable.of_finite Integrable.of_finite (ae_of_all _ hpoint) _ = B := by simp have hm : s ^ 2 / 4 ≤ max (twoSampleMSE (annotationLaw P0.1 n m) est.1 (ateFunctional P0.1)) (twoSampleMSE (annotationLaw P1.1 n m) est.1 (ateFunctional P1.1)) := by calc s ^ 2 / 4 = s ^ 2 * (1 / 4) := by ring _ ≤ s ^ 2 * max ((annotationLaw P0.1 n m).real {z | s ≤ |est.1 z - ateFunctional P0.1|}) ((annotationLaw P1.1 n m).real {z | s ≤ |est.1 z - ateFunctional P1.1|}) := by gcongr _ = max (s ^ 2 * (annotationLaw P0.1 n m).real {z | s ≤ |est.1 z - ateFunctional P0.1|}) (s ^ 2 * (annotationLaw P1.1 n m).real {z | s ≤ |est.1 z - ateFunctional P1.1|}) := by rw [mul_max_of_nonneg _ _ (sq_nonneg s)] _ ≤ _ := max_le_max (hrisk P0) (hrisk P1) exact hm.trans (max_le (le_ciSup hb P0) (le_ciSup hb P1))
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.annotationMinimaxRisk_ge_two_model_tv · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/ParametricLabelFloor.lean:180
theorem parametric_label_floor Lemma 22 in the paper ↗

The formal statement establishes the stated conclusion.

Formal statement
∃ c : Real,
0 < c
conclusion 1
eps :
0 < eps
eps < 1 / 2
n m d :
1 ≤ n
2 ≤ d
c / n ≤ minimaxRisk n m d eps
Proof (Lean source)
lemma parametric_label_floor : ∃ c : Real, 0 < c ∧ ∀ (eps : Real), 0 < eps → eps < 1 / 2 → ∀ (n m d : Nat), 1 ≤ n → 2 ≤ d → c / n ≤ minimaxRisk n m d eps := by refine ⟨1 / 100, by norm_num, ?_⟩ intro eps heps heps2 n m d hn hd letI : Nonempty (Fin d) := ⟨⟨0, lt_of_lt_of_le Nat.zero_lt_two hd⟩⟩ let delta : Real := (2 / 5) / Real.sqrt n have hnR : (0 : Real) < n := by exact_mod_cast hn have hd0 : 0 ≤ delta := by dsimp [delta]; positivity have hdsq : delta ^ 2 = 4 / (25 * (n : Real)) := by dsimp [delta]; rw [div_pow, Real.sq_sqrt hnR.le]; ring let hv0 := validDGP_null (C := Fin d) (m₀ := (1 / 2 : Real)) (g₀ := (1 / 2 : Real)) (g₁ := (1 / 2 : Real)) (by norm_num) (by norm_num) (by norm_num) (by norm_num) (by norm_num) (by norm_num) have hdu : (1 / 2 : Real) + delta ≤ 1 := by have hs : 1 ≤ Real.sqrt (n : Real) := Real.one_le_sqrt.mpr (by exact_mod_cast hn) have : delta ≤ 2 / 5 := by dsimp [delta]; exact div_le_self (by norm_num) hs linarith let hv1 := validDGP_pert (C := Fin d) (m₀ := (1 / 2 : Real)) (g₀ := (1 / 2 : Real)) (g₁ := (1 / 2 : Real)) (δ := delta) (by norm_num) (by norm_num) (by norm_num) (by norm_num) (by norm_num) hd0 hdu let P0 := parametricFloorNullLaw hv0 let P1 := parametricFloorPertLaw hv1 let MP0 : ClassLaw d eps := ⟨P0, parametricFloorNullLaw_model hd heps heps2 hv0⟩ let MP1 : ClassLaw d eps := ⟨P1, parametricFloorPertLaw_model hd heps heps2 hv1⟩ have hreg : (n : Real) * ((1 / 2 : Real) * delta ^ 2 / ((1 / 2 : Real) * (1 - 1 / 2))) ≤ log 2 := by rw [hdsq] have hlog : (8 / 25 : Real) ≤ log 2 := le_trans (by norm_num) (le_of_lt Real.log_two_gt_d9) convert hlog using 1 <;> field_simp [hnR.ne'] <;> ring have htvL : tvDist (labeledProductLaw P0 n) (labeledProductLaw P1 n) ≤ 1 / 2 := by simpa [P0, P1, parametricFloorNullLaw, parametricFloorPertLaw, labeledProductLaw, 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) have haux : auxProductLaw P0 m = auxProductLaw P1 m := by unfold auxProductLaw rw [parametricFloor_auxMarginal_eq hv0 hv1] have htv : tvDist (annotationLaw P0 n m) (annotationLaw P1 n m) ≤ 1 / 2 := by haveI : IsProbabilityMeasure (labeledProductLaw P0 n) := by unfold labeledProductLaw; infer_instance haveI : IsProbabilityMeasure (labeledProductLaw P1 n) := by unfold labeledProductLaw; infer_instance haveI : IsProbabilityMeasure (auxProductLaw P1 m) := by unfold auxProductLaw; infer_instance rw [annotationLaw, haux] calc _ ≤ tvDist (labeledProductLaw P0 n) (labeledProductLaw P1 n) + tvDist (auxProductLaw P1 m) (auxProductLaw P1 m) := tvDist_prod_le_add _ _ _ _ _ ≤ 1 / 2 := by have hz : tvDist (auxProductLaw P1 m) (auxProductLaw P1 m) = 0 := by apply le_antisymm · unfold tvDist exact ciSup_le fun A => by simp · exact tvDist_nonneg rw [hz] linarith have hsep : 2 * (delta / 2) ≤ |ateFunctional MP0.1 - ateFunctional MP1.1| := by rw [show ateFunctional MP0.1 = 0 by simpa [MP0, P0] using parametricFloorNullLaw_ate hv0, show ateFunctional MP1.1 = delta by simpa [MP1, P1] using parametricFloorPertLaw_ate hv1] rw [show 2 * (delta / 2) = delta by ring, zero_sub, abs_neg, abs_of_nonneg hd0] have hlow := annotationMinimaxRisk_ge_two_model_tv MP0 MP1 (s := delta / 2) (by positivity) hsep htv calc 1 / 100 / (n : Real) = (delta / 2) ^ 2 / 4 := by rw [show (delta / 2) ^ 2 = delta ^ 2 / 4 by ring, hdsq] ring _ ≤ minimaxRisk n m d eps := hlow
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.parametric_label_floor · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/ParametricLabelFloor.lean:256
CausalSmith.Stat.STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research.Helpers.PoissonFallingFactorial 11 declarations Paper-local aliases for the raw Poisson falling-factorial identities.

Paper-local aliases for the raw Poisson falling-factorial identities.

theorem integral_descFactorial_poisson

A Poisson falling factorial is unbiased for the corresponding power. the stated conclusion.

Formal statement
lambda :
r :
∫ N : Nat, (N.descFactorial r : Real) ∂poissonMeasure lambda = (lambda : Real) ^ r
Proof (Lean source)
lemma integral_descFactorial_poisson (lambda : NNReal) (r : Nat) : ∫ N : Nat, (N.descFactorial r : Real) ∂poissonMeasure lambda = (lambda : Real) ^ r := by simpa [fallingFactorial, CausalSmith.Stat.DiscreteOptimalValueMinimaxMatched.fallingFactorial_eq_descFactorial] using CausalSmith.Stat.DiscreteOptimalValueMinimaxMatched.integral_fallingFactorial_poisson lambda r
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.integral_descFactorial_poisson · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/PoissonFallingFactorial.lean:16
theorem integrable_descFactorial_poisson

A scalar Poisson falling factorial is integrable. the stated conclusion.

Formal statement
lambda :
r :
Integrable (fun N : Nat ↦ (N.descFactorial r : Real)) (poissonMeasure lambda)
Proof (Lean source)
lemma integrable_descFactorial_poisson (lambda : NNReal) (r : Nat) : Integrable (fun N : Nat ↦ (N.descFactorial r : Real)) (poissonMeasure lambda) := by simpa [fallingFactorial, CausalSmith.Stat.DiscreteOptimalValueMinimaxMatched.fallingFactorial_eq_descFactorial] using CausalSmith.Stat.DiscreteOptimalValueMinimaxMatched.integrable_fallingFactorial_poisson lambda r
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.integrable_descFactorial_poisson · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/PoissonFallingFactorial.lean:25
theorem integral_descFactorial_mul_poisson

Exact second cross-moment of two Poisson falling factorials. the stated conclusion.

Formal statement
lambda :
r v :
(∫ N : Nat, (N.descFactorial r : Real) * N.descFactorial v ∂poissonMeasure lambda)
= ∑ h ∈ range (min r v + 1), (Nat.choose r h : Real) * Nat.choose v h * factorial h * (lambda : Real) ^ (r + v - h)
Proof (Lean source)
lemma integral_descFactorial_mul_poisson (lambda : NNReal) (r v : Nat) : (∫ N : Nat, (N.descFactorial r : Real) * N.descFactorial v ∂poissonMeasure lambda) = ∑ h ∈ range (min r v + 1), (Nat.choose r h : Real) * Nat.choose v h * factorial h * (lambda : Real) ^ (r + v - h) := by simpa [fallingFactorial, CausalSmith.Stat.DiscreteOptimalValueMinimaxMatched.fallingFactorial_eq_descFactorial] using CausalSmith.Stat.DiscreteOptimalValueMinimaxMatched.integral_fallingFactorial_mul_poisson lambda r v
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.integral_descFactorial_mul_poisson · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/PoissonFallingFactorial.lean:34
theorem integral_natCast_sq_poisson

Exact scalar Poisson second moment. the stated conclusion.

Formal statement
lambda :
(∫ N : Nat, (N : Real) ^ 2 ∂poissonMeasure lambda) = (lambda : Real) + (lambda : Real) ^ 2
Proof (Lean source)
lemma integral_natCast_sq_poisson (lambda : NNReal) : (∫ N : Nat, (N : Real) ^ 2 ∂poissonMeasure lambda) = (lambda : Real) + (lambda : Real) ^ 2 := by have h := integral_descFactorial_mul_poisson lambda 1 1 norm_num [Finset.sum_range_succ] at h simpa [pow_two, add_comm] using h
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.integral_natCast_sq_poisson · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/PoissonFallingFactorial.lean:46
theorem integrable_descFactorial_mul_poisson

Products of Poisson falling factorials are integrable. the stated conclusion.

Formal statement
lambda :
r v :
Integrable (fun N : Nat ↦ (N.descFactorial r : Real) * N.descFactorial v) (poissonMeasure lambda)
Proof (Lean source)
lemma integrable_descFactorial_mul_poisson (lambda : NNReal) (r v : Nat) : Integrable (fun N : Nat ↦ (N.descFactorial r : Real) * N.descFactorial v) (poissonMeasure lambda) := by simpa [fallingFactorial, CausalSmith.Stat.DiscreteOptimalValueMinimaxMatched.fallingFactorial_eq_descFactorial] using CausalSmith.Stat.DiscreteOptimalValueMinimaxMatched.integrable_fallingFactorial_mul_poisson lambda r v
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.integrable_descFactorial_mul_poisson · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/PoissonFallingFactorial.lean:54
theorem memLp_descFactorial_poisson

A Poisson falling factorial has every fixed finite second moment. the stated conclusion.

Formal statement
lambda :
r :
MemLp (fun N : Nat ↦ (N.descFactorial r : Real)) 2 (poissonMeasure lambda)
Proof (Lean source)
lemma memLp_descFactorial_poisson (lambda : NNReal) (r : Nat) : MemLp (fun N : Nat ↦ (N.descFactorial r : Real)) 2 (poissonMeasure lambda) := by apply (memLp_two_iff_integrable_sq (measurable_of_countable _).aestronglyMeasurable).2 convert integrable_descFactorial_mul_poisson lambda r r using 1 funext N ring
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.memLp_descFactorial_poisson · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/PoissonFallingFactorial.lean:64
theorem choose_choose_factorial_div_le

The overlap coefficient in a joint falling-factorial moment has the exponential-series bound used by the paper. the stated conditions the stated conclusion.

Formal statement
L r v h :
hr :
r ≤ L
hv :
v ≤ L
(Nat.choose r h : Real) * Nat.choose v h * factorial h / (L : Real) ^ h
≤ (L : Real) ^ h / factorial h
Proof (Lean source)
lemma choose_choose_factorial_div_le {L r v h : Nat} (hr : r ≤ L) (hv : v ≤ L) : (Nat.choose r h : Real) * Nat.choose v h * factorial h / (L : Real) ^ h ≤ (L : Real) ^ h / factorial h := by by_cases hL0 : L = 0 · subst L have : r = 0 ∧ v = 0 := ⟨Nat.eq_zero_of_le_zero hr, Nat.eq_zero_of_le_zero hv⟩ rcases this with ⟨rfl, rfl⟩ cases h <;> norm_num have hLp : (0 : Real) < L := by exact_mod_cast Nat.pos_of_ne_zero hL0 by_cases hh : h ≤ r ∧ h ≤ v · have hfac : (0 : Real) < factorial h := by positivity have hcr : (Nat.choose r h : Real) ≤ (r : Real) ^ h / factorial h := Nat.choose_le_pow_div h r have hcv : (Nat.choose v h : Real) ≤ (v : Real) ^ h / factorial h := Nat.choose_le_pow_div h v have hrL : (r : Real) ≤ L := by exact_mod_cast hr have hvL : (v : Real) ≤ L := by exact_mod_cast hv have hrpow : (r : Real) ^ h ≤ (L : Real) ^ h := pow_le_pow_left₀ (by positivity) hrL h have hvpow : (v : Real) ^ h ≤ (L : Real) ^ h := pow_le_pow_left₀ (by positivity) hvL h have hcr' : (Nat.choose r h : Real) ≤ (L : Real) ^ h / factorial h := hcr.trans (div_le_div_of_nonneg_right hrpow hfac.le) have hcv' : (Nat.choose v h : Real) ≤ (L : Real) ^ h / factorial h := hcv.trans (div_le_div_of_nonneg_right hvpow hfac.le) have hc0 : (0 : Real) ≤ Nat.choose r h := by positivity have hv0 : (0 : Real) ≤ Nat.choose v h := by positivity calc (Nat.choose r h : Real) * Nat.choose v h * factorial h / (L : Real) ^ h ≤ (((L : Real) ^ h / factorial h) * ((L : Real) ^ h / factorial h) * factorial h) / (L : Real) ^ h := by gcongr _ = (L : Real) ^ h / factorial h := by field_simp · rcases not_and_or.mp hh with hh | hh · rw [Nat.choose_eq_zero_of_lt (Nat.lt_of_not_ge hh)] simp exact div_nonneg (pow_nonneg (show (0 : Real) ≤ L by positivity) _) (show (0 : Real) ≤ factorial h by positivity) · rw [Nat.choose_eq_zero_of_lt (Nat.lt_of_not_ge hh)] simp exact div_nonneg (pow_nonneg (show (0 : Real) ≤ L by positivity) _) (show (0 : Real) ≤ factorial h by positivity)
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.choose_choose_factorial_div_le · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/PoissonFallingFactorial.lean:74
theorem sum_pow_div_factorial_le_three_pow

A finite initial segment of the exponential series at a natural argument is bounded by 3^L. the stated conclusion.

Formal statement
L :
∑ h ∈ range (L + 1), (L : Real) ^ h / factorial h ≤ (3 : Real) ^ L
Proof (Lean source)
lemma sum_pow_div_factorial_le_three_pow (L : Nat) : ∑ h ∈ range (L + 1), (L : Real) ^ h / factorial h ≤ (3 : Real) ^ L := by calc ∑ h ∈ range (L + 1), (L : Real) ^ h / factorial h ≤ exp (L : Real) := by simpa using Real.sum_le_exp_of_nonneg (show (0 : Real) ≤ L by positivity) (L + 1) _ ≤ exp (log 3 * L) := by apply Real.exp_le_exp.mpr have hlog : (1 : Real) ≤ log 3 := by apply Real.exp_le_exp.mp rw [Real.exp_log (by norm_num : (0 : Real) < 3)] exact Real.exp_one_lt_three.le nlinarith _ = (3 : Real) ^ L := by rw [Real.exp_mul, Real.exp_log (by norm_num)] norm_num
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.sum_pow_div_factorial_le_three_pow · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/PoissonFallingFactorial.lean:122
theorem normalized_overlap_term_le

One overlap layer of a normalized joint factorial moment is bounded by the corresponding exponential-series layer. the stated conditions the stated conclusion.

Formal statement
L r v h :
D z :
hD :
0 < D
hz :
0 ≤ z
hLD :
(L : Real) ≤ D
hr :
r ≤ L
hv :
v ≤ L
hh :
h ≤ min r v
((Nat.choose r h : Real) * Nat.choose v h * factorial h * (D * z) ^ (r + v - h)) / D ^ (r + v)
≤ ((L : Real) ^ h / factorial h) * (1 + z) ^ (r + v)
Proof (Lean source)
lemma normalized_overlap_term_le {L r v h : Nat} {D z : Real} (hD : 0 < D) (hz : 0 ≤ z) (hLD : (L : Real) ≤ D) (hr : r ≤ L) (hv : v ≤ L) (hh : h ≤ min r v) : ((Nat.choose r h : Real) * Nat.choose v h * factorial h * (D * z) ^ (r + v - h)) / D ^ (r + v) ≤ ((L : Real) ^ h / factorial h) * (1 + z) ^ (r + v) := by by_cases hL0 : L = 0 · subst L have hr0 : r = 0 := Nat.eq_zero_of_le_zero hr have hv0 : v = 0 := Nat.eq_zero_of_le_zero hv subst r subst v have hh0 : h = 0 := by simpa using hh subst h norm_num have hhR : h ≤ r := hh.trans (min_le_left _ _) have hhV : h ≤ v := hh.trans (min_le_right _ _) have hhSum : h ≤ r + v := hhR.trans (le_add_right r v) have hLpos : 0 < L := Nat.pos_of_ne_zero hL0 have hLr : (0 : Real) < L := by exact_mod_cast hLpos have hDpow : (L : Real) ^ h ≤ D ^ h := pow_le_pow_left₀ hLr.le hLD h have hcoef0 : 0 ≤ (Nat.choose r h : Real) * Nat.choose v h * factorial h := by positivity have hcoefD : (Nat.choose r h : Real) * Nat.choose v h * factorial h / D ^ h ≤ (Nat.choose r h : Real) * Nat.choose v h * factorial h / (L : Real) ^ h := by exact div_le_div_of_nonneg_left hcoef0 (pow_pos hLr h) hDpow have hcoef := hcoefD.trans (choose_choose_factorial_div_le hr hv) have hzbase : z ≤ 1 + z := by linarith have hzpow : z ^ (r + v - h) ≤ (1 + z) ^ (r + v) := by calc z ^ (r + v - h) ≤ (1 + z) ^ (r + v - h) := pow_le_pow_left₀ hz hzbase _ _ ≤ (1 + z) ^ (r + v) := pow_le_pow_right₀ (by linarith) (sub_le _ _) have hid : ((Nat.choose r h : Real) * Nat.choose v h * factorial h * (D * z) ^ (r + v - h)) / D ^ (r + v) = ((Nat.choose r h : Real) * Nat.choose v h * factorial h / D ^ h) * z ^ (r + v - h) := by rw [mul_pow] field_simp have hp : D ^ (r + v - h) * D ^ h = D ^ (r + v) := by rw [← pow_add] congr 1 omega calc (Nat.choose r h : Real) * Nat.choose v h * D ^ (r + v - h) * z ^ (r + v - h) * D ^ h = ((Nat.choose r h : Real) * Nat.choose v h) * (D ^ (r + v - h) * D ^ h) * z ^ (r + v - h) := by ring _ = ((Nat.choose r h : Real) * Nat.choose v h) * D ^ (r + v) * z ^ (r + v - h) := by rw [hp] _ = (Nat.choose r h : Real) * Nat.choose v h * z ^ (r + v - h) * D ^ (r + v) := by ring rw [hid] exact mul_le_mul hcoef hzpow (pow_nonneg hz _) (by positivity)
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.normalized_overlap_term_le · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/PoissonFallingFactorial.lean:141
theorem normalized_overlap_sum_le

Uniform normalized cross-moment sum for orders at most L. the stated conditions the stated conclusion.

Formal statement
L r v :
D z :
hD :
0 < D
hz :
0 ≤ z
hLD :
(L : Real) ≤ D
hr :
r ≤ L
hv :
v ≤ L
∑ h ∈ range (min r v + 1), ((Nat.choose r h : Real) * Nat.choose v h * factorial h * (D * z) ^ (r + v - h)) / D ^ (r + v)
≤ (3 : Real) ^ L * (1 + z) ^ (r + v)
Proof (Lean source)
lemma normalized_overlap_sum_le {L r v : Nat} {D z : Real} (hD : 0 < D) (hz : 0 ≤ z) (hLD : (L : Real) ≤ D) (hr : r ≤ L) (hv : v ≤ L) : ∑ h ∈ range (min r v + 1), ((Nat.choose r h : Real) * Nat.choose v h * factorial h * (D * z) ^ (r + v - h)) / D ^ (r + v) ≤ (3 : Real) ^ L * (1 + z) ^ (r + v) := by calc ∑ h ∈ range (min r v + 1), ((Nat.choose r h : Real) * Nat.choose v h * factorial h * (D * z) ^ (r + v - h)) / D ^ (r + v) ≤ ∑ h ∈ range (min r v + 1), ((L : Real) ^ h / factorial h) * (1 + z) ^ (r + v) := by apply Finset.sum_le_sum intro h hh exact normalized_overlap_term_le hD hz hLD hr hv (le_of_lt_succ (Finset.mem_range.mp hh)) _ ≤ ∑ h ∈ range (L + 1), ((L : Real) ^ h / factorial h) * (1 + z) ^ (r + v) := by apply Finset.sum_le_sum_of_subset_of_nonneg · intro h hh simp only [Finset.mem_range] at hh ⊢ omega · intro h _ _ positivity _ = (∑ h ∈ range (L + 1), (L : Real) ^ h / factorial h) * (1 + z) ^ (r + v) := by rw [Finset.sum_mul] _ ≤ (3 : Real) ^ L * (1 + z) ^ (r + v) := by gcongr exact sum_pow_div_factorial_le_three_pow L
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.normalized_overlap_sum_le · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/PoissonFallingFactorial.lean:204
theorem integral_normalized_descFactorial_cross_le

Product-Poisson L² control for two normalized falling factorials. the stated conditions the stated conclusion.

Formal statement
L r v :
D z :
hD :
0 < D
hz :
0 ≤ z
hLD :
(L : Real) ≤ D
hr :
r ≤ L
hv :
v ≤ L
(∫ N : Nat, ((N.descFactorial r : Real) * N.descFactorial v) / D ^ (r + v) ∂poissonMeasure (toNNReal (D * z)))
≤ (3 : Real) ^ L * (1 + z) ^ (r + v)
Proof (Lean source)
lemma integral_normalized_descFactorial_cross_le {L r v : Nat} {D z : Real} (hD : 0 < D) (hz : 0 ≤ z) (hLD : (L : Real) ≤ D) (hr : r ≤ L) (hv : v ≤ L) : (∫ N : Nat, ((N.descFactorial r : Real) * N.descFactorial v) / D ^ (r + v) ∂poissonMeasure (toNNReal (D * z))) ≤ (3 : Real) ^ L * (1 + z) ^ (r + v) := by rw [integral_div] rw [integral_descFactorial_mul_poisson] have hDz : 0 ≤ D * z := mul_nonneg hD.le hz rw [Real.coe_toNNReal _ hDz] rw [Finset.sum_div] exact normalized_overlap_sum_le hD hz hLD hr hv
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.integral_normalized_descFactorial_cross_le · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/PoissonFallingFactorial.lean:236
CausalSmith.Stat.STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research.Helpers.PoissonHybridRisk 6 declarations The unequal-information Poisson hybrid risk bound.

The unequal-information Poisson hybrid risk bound.

def hybridPoissonStatistic

The displayed light/heavy statistic on the three independent count pools. the stated conditions the stated conclusion.

Definition (Lean source)
d :
n m :
eps u t :
hybridPoissonStatistic n m eps u t K :
clipUnit <| ∑ x : Fin d, let jx := (K x false).2.1
+ (K x true).2.1 let s0 : Real := (K x false).1 let s1 : Real := (K x true).1 let k0' := (K x false).2.2 let k1 := (K x true).2.2 if jx
≤ k0 n m eps then s1 / u * factorialLift true (Ldeg n) (Bscale n m eps) t k0' k1
- s0 / u * factorialLift false (Ldeg n) (Bscale n m eps) t k0' k1 else s1 / u * (k0' + k1 + 1 : Nat) / (k1 + 1 : Nat)
- s0 / u * (k0' + k1 + 1 : Nat) / (k0' + 1 : Nat)
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.hybridPoissonStatistic · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/PoissonHybridRisk.lean:26
def poissonHybridMSE

Squared error of the calibrated Poisson hybrid, represented on the explicit independent cell-count experiment. the stated conditions the stated conclusion.

Definition (Lean source)
d :
P :
n m :
eps :
poissonHybridMSE P n m eps :
bs :
u :
bs.M0 / 8 (: Real)
tp :
(bs.np + bs.mp : Nat) / 8 (: Real)
t :
(bs.nf + bs.mf : Nat) / 8 (: Real)
if calibrationPredicate n m eps then ∫ K, (hybridPoissonStatistic n m eps u t K - ateFunctional P) ^ 2 ∂ hybridPoissonCountLaw P u tp t else ateFunctional P ^ 2
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.poissonHybridMSE · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/PoissonHybridRisk.lean:42
theorem hybridPoissonStatistic_mem_Icc

The formal statement establishes the stated conclusion.

Formal statement
d :
n m :
eps u t :
hybridPoissonStatistic n m eps u t K ∈ Icc (-1 : Real) 1
Proof (Lean source)
lemma hybridPoissonStatistic_mem_Icc {d : Nat} (n m : Nat) (eps u t : Real) (K : HybridPoissonCounts d) : hybridPoissonStatistic n m eps u t K ∈ Icc (-1 : Real) 1 := by dsimp [hybridPoissonStatistic, clipUnit] exact ⟨le_max_left _ _, max_le (by norm_num) (min_le_left _ _)⟩
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.hybridPoissonStatistic_mem_Icc · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/PoissonHybridRisk.lean:54
theorem poissonHybridMSE_le_four

the stated conditions establishes the stated conclusion.

Formal statement
d :
P :
n m :
eps :
hP :
ModelClass d eps P
poissonHybridMSE P n m eps ≤ 4
Proof (Lean source)
lemma poissonHybridMSE_le_four {d : Nat} (P : DiscreteLaw d) (n m : Nat) (eps : Real) (hP : ModelClass d eps P) : poissonHybridMSE P n m eps ≤ 4 := by have htheta := ateFunctional_mem_Icc_neg_one_one P hP.overlap by_cases hcal : calibrationPredicate n m eps · simp only [poissonHybridMSE, hcal, if_pos] let bs := blockSizes n m let u : Real := bs.M0 / 8 let tp : Real := (bs.np + bs.mp : Nat) / 8 let t : Real := (bs.nf + bs.mf : Nat) / 8 let mu := hybridPoissonCountLaw P u tp t letI : IsProbabilityMeasure mu := ⟨by simp [mu, hybridPoissonCountLaw]⟩ change (∫ K, (hybridPoissonStatistic n m eps u t K - ateFunctional P) ^ 2 ∂mu) ≤ 4 rcases htheta with ⟨htlo, hthi⟩ calc _ ≤ ∫ _K, (4 : Real) ∂mu := by apply integral_mono · apply Integrable.of_bound ((measurable_of_countable _).aestronglyMeasurable) 4 filter_upwards [] with K rw [Real.norm_eq_abs, abs_of_nonneg (sq_nonneg _)] rcases hybridPoissonStatistic_mem_Icc n m eps u t K with ⟨hKlo, hKhi⟩ nlinarith [sq_nonneg (hybridPoissonStatistic n m eps u t K - ateFunctional P)] · exact integrable_const 4 intro K rcases hybridPoissonStatistic_mem_Icc n m eps u t K with ⟨hKlo, hKhi⟩ nlinarith [sq_nonneg (hybridPoissonStatistic n m eps u t K - ateFunctional P)] _ = 4 := by simp · simp [poissonHybridMSE, hcal] rcases htheta with ⟨htlo, hthi⟩ nlinarith [sq_nonneg (ateFunctional P)]
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.poissonHybridMSE_le_four · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/PoissonHybridRisk.lean:61
theorem poissonHybridMSE_le_variance_add_bias_sq

Clipping and the bias--variance identity reduce calibrated risk to the explicit variance and mean envelopes. the stated conditions the stated conclusion.

Formal statement
eps :
heps :
0 < eps
heps2 :
eps < 1 / 2
n m d :
P :
hn :
1 ≤ n
hP :
ModelClass d eps P
hcal :
bs :
u :
bs.M0 / 8 (: Real)
tp :
(bs.np + bs.mp : Nat) / 8 (: Real)
t :
(bs.nf + bs.mf : Nat) / 8 (: Real)
≤ Var[(fun K : HybridPoissonCounts d ↦ ∑ x : Fin d, hybridSelectedCell (k0 n m eps) (Ldeg n) (Bscale n m eps) u t (K x)); hybridPoissonCountLaw P u tp t]
+ (2 * d * Bscale n m eps / (eps * (Ldeg n : Real) ^ 2) + 6 * ((n : Real) ^ 12)⁻¹) ^ 2
Proof (Lean source)
lemma poissonHybridMSE_le_variance_add_bias_sq {eps : Real} (heps : 0 < eps) (heps2 : eps < 1 / 2) {n m d : Nat} (P : DiscreteLaw d) (hn : 1 ≤ n) (hP : ModelClass d eps P) (hcal : calibrationPredicate n m eps) : let bs := blockSizes n m let u : Real := bs.M0 / 8 let tp : Real := (bs.np + bs.mp : Nat) / 8 let t : Real := (bs.nf + bs.mf : Nat) / 8 poissonHybridMSE P n m eps ≤ Var[(fun K : HybridPoissonCounts d ↦ ∑ x : Fin d, hybridSelectedCell (k0 n m eps) (Ldeg n) (Bscale n m eps) u t (K x)); hybridPoissonCountLaw P u tp t] + (2 * d * Bscale n m eps / (eps * (Ldeg n : Real) ^ 2) + 6 * ((n : Real) ^ 12)⁻¹) ^ 2 := by dsimp only classical let u : Real := (blockSizes n m).M0 / 8 let tp : Real := ((blockSizes n m).np + (blockSizes n m).mp : Nat) / 8 let t : Real := ((blockSizes n m).nf + (blockSizes n m).mf : Nat) / 8 let mu := hybridPoissonCountLaw P u tp t let raw := fun K : HybridPoissonCounts d ↦ ∑ x : Fin d, hybridSelectedCell (k0 n m eps) (Ldeg n) (Bscale n m eps) u t (K x) letI : IsProbabilityMeasure mu := by dsimp [mu, hybridPoissonCountLaw] infer_instance have hraw : MemLp raw 2 mu := by let muc := fun x : Fin d ↦ Measure.pi fun arm : Bool ↦ (poissonMeasure (toNNReal (u * markedMass P x arm))).prod ((poissonMeasure (toNNReal (tp * armMass P x arm))).prod (poissonMeasure (toNNReal (t * armMass P x arm)))) have hx (x : Fin d) : MemLp (fun K : HybridPoissonCounts d ↦ hybridSelectedCell (k0 n m eps) (Ldeg n) (Bscale n m eps) u t (K x)) 2 (Measure.pi muc) := (hybridSelectedCell_memLp P u tp t (Bscale n m eps) (k0 n m eps) (Ldeg n) x).comp_measurePreserving (measurePreserving_eval muc x) change MemLp (fun K : HybridPoissonCounts d ↦ ∑ x : Fin d, hybridSelectedCell (k0 n m eps) (Ldeg n) (Bscale n m eps) u t (K x)) 2 (Measure.pi muc) exact memLp_finset_sum _ (fun x _ ↦ hx x) have hmean : (∫ K, raw K ∂mu) = ∑ x : Fin d, hybridSelectedCellMean P u tp t (Bscale n m eps) (k0 n m eps) (Ldeg n) x := by have hx (x : Fin d) : Integrable (fun K : HybridPoissonCounts d ↦ hybridSelectedCell (k0 n m eps) (Ldeg n) (Bscale n m eps) u t (K x)) mu := ((hybridSelectedCell_memLp P u tp t (Bscale n m eps) (k0 n m eps) (Ldeg n) x).comp_measurePreserving (measurePreserving_eval (fun x : Fin d ↦ Measure.pi fun arm : Bool ↦ (poissonMeasure (toNNReal (u * markedMass P x arm))).prod ((poissonMeasure (toNNReal (tp * armMass P x arm))).prod (poissonMeasure (toNNReal (t * armMass P x arm))))) x)).integrable one_le_two change (∫ K, ∑ x : Fin d, hybridSelectedCell (k0 n m eps) (Ldeg n) (Bscale n m eps) u t (K x) ∂mu) = _ rw [integral_finset_sum _ (fun x _ ↦ hx x)] apply Finset.sum_congr rfl intro x _ exact integral_comp_eval (measurable_of_countable _).aestronglyMeasurable have hbias := calibrated_hybrid_mean_bias_le heps heps2 n m d P hn hP hcal have htheta := ateFunctional_mem_Icc_neg_one_one P hP.overlap have hsquare : (∫ K, (raw K - ateFunctional P) ^ 2 ∂mu) = Var[raw; mu] + ((∫ K, raw K ∂mu) - ateFunctional P) ^ 2 := by rw [variance_eq_sub hraw] have hs := hraw.integrable_sq have hi := hraw.integrable one_le_two calc _ = (∫ K, raw K ^ 2 ∂mu) - 2 * ateFunctional P * (∫ K, raw K ∂mu) + ateFunctional P ^ 2 := by calc _ = ∫ K, (raw K ^ 2 - 2 * ateFunctional P * raw K) + ateFunctional P ^ 2 ∂mu := by apply integral_congr_ae filter_upwards [] with K ring _ = (∫ K, raw K ^ 2 - 2 * ateFunctional P * raw K ∂mu) + ∫ _K, ateFunctional P ^ 2 ∂mu := integral_add (hs.sub (hi.const_mul _)) (integrable_const _) _ = _ := by rw [integral_sub hs (hi.const_mul _), integral_const_mul, integral_const, probReal_univ, one_smul] _ = _ := by change (∫ K, raw K ^ 2 ∂mu) - 2 * ateFunctional P * (∫ K, raw K ∂mu) + ateFunctional P ^ 2 = (∫ K, raw K ^ 2 ∂mu) - (∫ K, raw K ∂mu) ^ 2 + ((∫ K, raw K ∂mu) - ateFunctional P) ^ 2 ring change poissonHybridMSE P n m eps ≤ Var[raw; mu] + (2 * d * Bscale n m eps / (eps * (Ldeg n : Real) ^ 2) + 6 * ((n : Real) ^ 12)⁻¹) ^ 2 simp only [poissonHybridMSE, hcal, if_pos] change (∫ K, (clipUnit (raw K) - ateFunctional P) ^ 2 ∂mu) ≤ _ have hclipInt : Integrable (fun K ↦ (clipUnit (raw K) - ateFunctional P) ^ 2) mu := by apply Integrable.of_bound (measurable_of_countable _).aestronglyMeasurable 4 filter_upwards [] with K rw [Real.norm_eq_abs, abs_of_nonneg (sq_nonneg _)] have hc := hybridPoissonStatistic_mem_Icc n m eps u t K change clipUnit (raw K) ∈ Icc (-1 : Real) 1 at hc rcases hc with ⟨hlo, hhi⟩ rcases htheta with ⟨htlo, hthi⟩ nlinarith [sq_nonneg (clipUnit (raw K) - ateFunctional P)] calc _ ≤ ∫ K, (raw K - ateFunctional P) ^ 2 ∂mu := by apply integral_mono · exact hclipInt · exact (hraw.sub (memLp_const _)).integrable_sq intro K exact hybrid_clipUnit_sq_sub_le _ _ htheta _ = Var[raw; mu] + ((∫ K, raw K ∂mu) - ateFunctional P) ^ 2 := hsquare _ ≤ Var[raw; mu] + (2 * d * Bscale n m eps / (eps * (Ldeg n : Real) ^ 2) + 6 * ((n : Real) ^ 12)⁻¹) ^ 2 := by rw [hmean] have henv0 : 0 ≤ 2 * d * Bscale n m eps / (eps * (Ldeg n : Real) ^ 2) + 6 * ((n : Real) ^ 12)⁻¹ := by obtain ⟨_, _, _, hB⟩ := calibrationPredicate_positive_parameters hcal positivity apply add_le_add le_rfl rw [← sq_abs] exact (sq_le_sq₀ (abs_nonneg _) henv0).2 hbias
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.poissonHybridMSE_le_variance_add_bias_sq · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/PoissonHybridRisk.lean:99
theorem poisson_hybrid_risk Lemma 13 in the paper ↗

One constant depending only on overlap controls the calibrated hybrid risk simultaneously for all sample sizes and alphabets. the stated conditions the stated conclusion.

Formal statement
eps :
heps :
0 < eps
heps2 :
eps < 1 / 2
∃ C : Real,
0 < C
conclusion 1
n m d :
P :
1 ≤ n
2 ≤ d
ModelClass d eps P
poissonHybridMSE P n m eps ≤ C * frontierRate n m d
Proof (Lean source)
lemma poisson_hybrid_risk {eps : Real} (heps : 0 < eps) (heps2 : eps < 1 / 2) : ∃ C : Real, 0 < C ∧ ∀ (n m d : Nat) (P : DiscreteLaw d), 1 ≤ n → 2 ≤ d → ModelClass d eps P → poissonHybridMSE P n m eps ≤ C * frontierRate n m d := by obtain ⟨Ccal, hCcal, hcalrisk⟩ : ∃ Ccal : Real, 0 < Ccal ∧ ∀ (n m d : Nat) (P : DiscreteLaw d), 1 ≤ n → 2 ≤ d → ModelClass d eps P → calibrationPredicate n m eps → poissonHybridMSE P n m eps ≤ Ccal * frontierRate n m d := by obtain ⟨Cvar, hCvar, hvar⟩ := calibrated_hybrid_variance_le heps heps2 obtain ⟨Cabs, hCabs, habs⟩ := calibrated_envelope_absorption_exists heps hCvar refine ⟨max 4 Cabs, lt_of_lt_of_le (by norm_num) (le_max_left _ _), ?_⟩ intro n m d P hn hd hP hcal let r : Real := 1 / (n : Real) + (d : Real) ^ 2 / (((n + m : Nat) : Real) ^ 2 * logEN n ^ 2) have hr0 : 0 ≤ r := by dsimp [r]; positivity by_cases hr : 1 ≤ r · have hfront : frontierRate n m d = 1 := by rw [frontierRate, min_eq_left] simpa [r, Nat.cast_add, one_div] using hr rw [hfront] calc poissonHybridMSE P n m eps ≤ 4 := poissonHybridMSE_le_four P n m eps hP _ ≤ max 4 Cabs * 1 := by simpa using (le_max_left (4 : Real) Cabs) · have hrle : r ≤ 1 := le_of_not_ge hr have hfront : frontierRate n m d = r := by rw [frontierRate, min_eq_right] simpa [r, Nat.cast_add, one_div] using hrle rw [hfront] have hmse := poissonHybridMSE_le_variance_add_bias_sq heps heps2 P hn hP hcal have hv := hvar n m d P hn hP hcal have ha := habs n m d hn hd hcal calc poissonHybridMSE P n m eps ≤ Var[(fun K : HybridPoissonCounts d ↦ ∑ x : Fin d, hybridSelectedCell (k0 n m eps) (Ldeg n) (Bscale n m eps) ((blockSizes n m).M0 / 8) (((blockSizes n m).nf + (blockSizes n m).mf : Nat) / 8) (K x)); hybridPoissonCountLaw P ((blockSizes n m).M0 / 8) (((blockSizes n m).np + (blockSizes n m).mp : Nat) / 8) (((blockSizes n m).nf + (blockSizes n m).mf : Nat) / 8)] + (2 * d * Bscale n m eps / (eps * (Ldeg n : Real) ^ 2) + 6 * ((n : Real) ^ 12)⁻¹) ^ 2 := by simpa only using hmse _ ≤ 4 * starA ^ Ldeg n * (min 1 ((d : Real) * Bscale n m eps) / ((blockSizes n m).M0 / 8) + (d : Real) * Bscale n m eps ^ 2) + Cvar * (((blockSizes n m).M0 / 8 : Real)⁻¹ + (((blockSizes n m).nf + (blockSizes n m).mf : Nat) / 8 : Real)⁻¹) + 8 * d * Bscale n m eps ^ 2 / (eps ^ 2 * (Ldeg n : Real) ^ 4) + 4 / (eps * (((blockSizes n m).nf + (blockSizes n m).mf : Nat) / 8)) + 414 * ((n : Real) ^ 12)⁻¹ + (2 * d * Bscale n m eps / (eps * (Ldeg n : Real) ^ 2) + 6 * ((n : Real) ^ 12)⁻¹) ^ 2 := by exact add_le_add hv le_rfl _ ≤ Cabs * r := by simpa only [r] using ha _ ≤ max 4 Cabs * r := mul_le_mul_of_nonneg_right (le_max_right _ _) hr0 obtain ⟨n0, hn0, hfail⟩ := calibrationPredicate_failure_bounded heps heps2 refine ⟨max Ccal (4 * n0), lt_of_lt_of_le hCcal (le_max_left _ _), ?_⟩ intro n m d P hn hd hP by_cases hcal : calibrationPredicate n m eps · exact (hcalrisk n m d P hn hd hP hcal).trans (mul_le_mul_of_nonneg_right (le_max_left _ _) (frontierRate_mem_Ioc_zero_one n m d hn).1.le) · have hnlt : n < n0 := hfail n m hcal have hnleR : (n : Real) ≤ n0 := by exact_mod_cast (le_of_lt hnlt) have hnR : (0 : Real) < n := by exact_mod_cast (lt_of_lt_of_le Nat.zero_lt_one hn) have hrpos := (frontierRate_mem_Ioc_zero_one n m d hn).1 have hinv := inv_n_le_frontierRate n m d hn have hone : (1 : Real) ≤ n0 * frontierRate n m d := by have hnr : (1 : Real) ≤ n * frontierRate n m d := by apply (div_le_iff₀ hnR).1 at hinv simpa [mul_comm] using hinv exact hnr.trans (mul_le_mul_of_nonneg_right hnleR hrpos.le) calc poissonHybridMSE P n m eps ≤ 4 := poissonHybridMSE_le_four P n m eps hP _ ≤ (4 * n0) * frontierRate n m d := by nlinarith _ ≤ max Ccal (4 * n0) * frontierRate n m d := mul_le_mul_of_nonneg_right (le_max_right _ _) hrpos.le
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.poisson_hybrid_risk · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/PoissonHybridRisk.lean:226
CausalSmith.Stat.STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research.Helpers.PoissonInverseCount 13 declarations Bias and variance of the all-heavy Poisson inverse-count statistic.

Bias and variance of the all-heavy Poisson inverse-count statistic.

def PoissonCounts

Per-cell, per-arm outcome and marginal counts. the stated conditions the stated conclusion.

Definition (Lean source)
d :
PoissonCounts d :
Type
Fin d → Bool → Nat × Nat
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.PoissonCounts · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/PoissonInverseCount.lean:20
def poissonCountLaw

Independent outcome/marginal Poisson count law. the stated conditions the stated conclusion.

Definition (Lean source)
d :
P :
u t :
poissonCountLaw P u t :
Measure.pi fun x : Fin d
=> Measure.pi fun a : Bool => (poissonMeasure (toNNReal (u * markedMass P x a))).prod (poissonMeasure (toNNReal (t * armMass P x a)))
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.poissonCountLaw · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/PoissonInverseCount.lean:23
def inverseCountStatistic

The all-heavy inverse-count statistic. the stated conditions the stated conclusion.

Definition (Lean source)
d :
u :
inverseCountStatistic u K :
∑ x : Fin d, ((K x true).1 / u * ((K x false).2 + (K x true).2 + 1 : Nat) / ((K x true).2 + 1 : Nat) - (K x false).1 / u * ((K x false).2 + (K x true).2 + 1 : Nat) / ((K x false).2 + 1 : Nat))
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.inverseCountStatistic · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/PoissonInverseCount.lean:30
def expectationUnder

Expectation of a statistic under a supplied law. the stated conditions the stated conclusion.

Definition (Lean source)
α :
mu :
f :
α → Real
expectationUnder mu f :
∫ z, f z ∂mu
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.expectationUnder · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/PoissonInverseCount.lean:38
def varianceUnder

Centered second moment under a supplied law. the stated conditions the stated conclusion.

Definition (Lean source)
α :
mu :
f :
α → Real
varianceUnder mu f :
∫ z, (f z - expectationUnder mu f) ^ 2 ∂mu
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.varianceUnder · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/PoissonInverseCount.lean:42
theorem markedMass_eq_armMass_mul_outcomeMean

The marked mass factors into arm mass and the corresponding outcome mean, including at zero-mass arm cells. the stated conclusion.

Formal statement
d :
P :
x :
Fin d
a :
markedMass P x a = armMass P x a * outcomeMean P a x
Proof (Lean source)
lemma markedMass_eq_armMass_mul_outcomeMean {d : Nat} (P : DiscreteLaw d) (x : Fin d) (a : Bool) : markedMass P x a = armMass P x a * outcomeMean P a x := by rw [markedMass, outcomeMean] by_cases h : armMass P x a = 0 · have hj_nonneg := (jointMass_mem_unitInterval P x a true).1 have hj_le : jointMass P x a true ≤ armMass P x a := by simp [armMass] exact (jointMass_mem_unitInterval P x a false).1 have hj : jointMass P x a true = 0 := by linarith simp [h, hj] · field_simp
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.markedMass_eq_armMass_mul_outcomeMean · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/PoissonInverseCount.lean:48
theorem cellMass_sum_eq_one_annotation

The covariate cell masses sum to one. the stated conclusion.

Formal statement
d :
P :
∑ x : Fin d, cellMass P x = 1
Proof (Lean source)
lemma cellMass_sum_eq_one_annotation {d : Nat} (P : DiscreteLaw d) : ∑ x : Fin d, cellMass P x = 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 : Real))).symm calc ∑ x : Fin d, cellMass P x = ∑ z : Obs d, (P.pmf z).toReal := by simp [cellMass, jointMass, Fintype.sum_prod_type] _ = 1 := htotal
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.cellMass_sum_eq_one_annotation · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/PoissonInverseCount.lean:64
theorem overlap_armMass_bounds

Occupied-cell overlap gives the two arm-mass comparisons used in the inverse-count moment calculation. the stated conditions the stated conclusion.

Formal statement
d :
eps :
P :
hP :
Overlap eps P
x :
Fin d
a :
conclusion 1
eps * cellMass P x ≤ armMass P x a
conclusion 2
armMass P x a ≤ (1 - eps) * cellMass P x
Proof (Lean source)
lemma overlap_armMass_bounds {d : Nat} {eps : Real} (P : DiscreteLaw d) (hP : Overlap eps P) (x : Fin d) (a : Bool) : eps * cellMass P x ≤ armMass P x a ∧ armMass P x a ≤ (1 - eps) * cellMass P x := by have hcell := (cellMass_mem_unitInterval P x).1 by_cases hz : cellMass P x = 0 · have harm_nonneg : 0 ≤ armMass P x a := by exact Finset.sum_nonneg fun y _ ↦ (jointMass_mem_unitInterval P x a y).1 have harm_le : armMass P x a ≤ cellMass P x := by have hsum : armMass P x false + armMass P x true = cellMass P x := by simp [armMass, cellMass] ring cases a · linarith [show 0 ≤ armMass P x true from Finset.sum_nonneg fun y _ ↦ (jointMass_mem_unitInterval P x true y).1] · linarith [show 0 ≤ armMass P x false from Finset.sum_nonneg fun y _ ↦ (jointMass_mem_unitInterval P x false y).1] have harm : armMass P x a = 0 := by linarith simp [hz, harm] · have hcpos : 0 < cellMass P x := lt_of_le_of_ne hcell (Ne.symm hz) have hov := hP x hcpos have hfactor : armMass P x true = cellMass P x * propensity P x := by rw [propensity] field_simp cases a · have hsum : armMass P x false + armMass P x true = cellMass P x := by simp [armMass, cellMass] ring constructor · rw [hfactor] at hsum nlinarith [mul_le_mul_of_nonneg_left hov.2 hcell] · rw [hfactor] at hsum nlinarith [mul_le_mul_of_nonneg_left hov.1 hcell] · rw [hfactor] constructor · simpa [mul_comm] using mul_le_mul_of_nonneg_left hov.1 hcell · simpa [mul_comm] using mul_le_mul_of_nonneg_left hov.2 hcell
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.overlap_armMass_bounds · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/PoissonInverseCount.lean:75

The elementary exponential envelope used to sum the inverse-count bias over cells without imposing a minimum cell mass. the stated conditions the stated conclusion.

Formal statement
eps t z :
heps :
0 < eps
ht :
0 < t
_hz :
0 ≤ z
z * exp (-eps * t * z) ≤ 1 / (eps * exp 1 * t)
Proof (Lean source)
lemma poisson_bias_envelope {eps t z : Real} (heps : 0 < eps) (ht : 0 < t) (_hz : 0 ≤ z) : z * exp (-eps * t * z) ≤ 1 / (eps * exp 1 * t) := by have hc : 0 < eps * t := mul_pos heps ht have hbase : exp 1 * (eps * t * z) ≤ exp (eps * t * z) := Real.exp_one_mul_le_exp have hmul := mul_le_mul_of_nonneg_right hbase (Real.exp_pos (-(eps * t * z))).le have hprod : exp 1 * (eps * t * z) * exp (-(eps * t * z)) ≤ 1 := by calc _ ≤ exp (eps * t * z) * exp (-(eps * t * z)) := hmul _ = 1 := by rw [← Real.exp_add]; ring_nf; simp apply (le_div_iff₀ (by positivity : 0 < eps * exp 1 * t)).2 calc z * exp (-eps * t * z) * (eps * exp 1 * t) = exp 1 * (eps * t * z) * exp (-(eps * t * z)) := by ring _ ≤ 1 := hprod
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.poisson_bias_envelope · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/PoissonInverseCount.lean:116

Summing the exponential envelope gives the dimension-over-intensity part of the inverse-count bias bound. the stated conditions the stated conclusion.

Formal statement
d :
p :
Fin d → Real
eps t :
heps :
0 < eps
ht :
0 < t
hp :
∀ x, 0 ≤ p x
(∑ x, p x * exp (-eps * t * p x)) ≤ d / (eps * exp 1 * t)
Proof (Lean source)
lemma poisson_bias_sum_le {d : Nat} (p : Fin d → Real) {eps t : Real} (heps : 0 < eps) (ht : 0 < t) (hp : ∀ x, 0 ≤ p x) : (∑ x, p x * exp (-eps * t * p x)) ≤ d / (eps * exp 1 * t) := by calc (∑ x, p x * exp (-eps * t * p x)) ≤ ∑ _x : Fin d, 1 / (eps * exp 1 * t) := Finset.sum_le_sum fun x _ ↦ poisson_bias_envelope heps ht (hp x) _ = d / (eps * exp 1 * t) := by simp [div_eq_mul_inv]
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.poisson_bias_sum_le · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/PoissonInverseCount.lean:136
theorem poisson_bias_sum_le_min Lemma poisson_bias_sum_le_min in the paper ↗

The same cellwise sum also has its probability-mass cap, yielding exactly the minimum used in the uniform bias estimate. the stated conditions the stated conclusion.

Formal statement
d :
p :
Fin d → Real
eps t :
heps :
0 < eps
ht :
0 < t
hp :
∀ x, 0 ≤ p x
hsum :
∑ x, p x = 1
(∑ x, p x * exp (-eps * t * p x)) ≤ min 1 (d / (eps * exp 1 * t))
Proof (Lean source)
lemma poisson_bias_sum_le_min {d : Nat} (p : Fin d → Real) {eps t : Real} (heps : 0 < eps) (ht : 0 < t) (hp : ∀ x, 0 ≤ p x) (hsum : ∑ x, p x = 1) : (∑ x, p x * exp (-eps * t * p x)) ≤ min 1 (d / (eps * exp 1 * t)) := by apply le_min · calc (∑ x, p x * exp (-eps * t * p x)) ≤ ∑ x, p x := by apply Finset.sum_le_sum intro x _ apply mul_le_of_le_one_right (hp x) rw [Real.exp_le_one_iff] have hx : 0 ≤ eps * t * p x := mul_nonneg (mul_nonneg heps.le ht.le) (hp x) nlinarith _ = 1 := hsum · exact poisson_bias_sum_le p heps ht hp
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.poisson_bias_sum_le_min · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/PoissonInverseCount.lean:150
theorem poisson_bias_min_rescale Lemma poisson_bias_min_rescale in the paper ↗

Absorb the overlap factor in the exponential-envelope bound into a constant depending only on eps, leaving the paper's min 1 (d / t) rate. the stated conditions the stated conclusion.

Formal statement
d :
eps t :
heps :
0 < eps
ht :
0 < t
2 * min 1 (d / (eps * exp 1 * t)) ≤ (2 * max 1 (eps * exp 1)⁻¹) * min 1 (d / t)
Proof (Lean source)
lemma poisson_bias_min_rescale (d : Nat) {eps t : Real} (heps : 0 < eps) (ht : 0 < t) : 2 * min 1 (d / (eps * exp 1 * t)) ≤ (2 * max 1 (eps * exp 1)⁻¹) * min 1 (d / t) := by let x : Real := d / t let a : Real := eps * exp 1 have hx : 0 ≤ x := by dsimp [x]; positivity have ha : 0 < a := by dsimp [a]; positivity have hrewrite : d / (eps * exp 1 * t) = x / a := by dsimp [x, a] field_simp rw [hrewrite] by_cases hx1 : x ≤ 1 · rw [min_eq_right hx1] have hxa : min 1 (x / a) ≤ x / a := min_le_right _ _ have hainv : a⁻¹ ≤ max 1 a⁻¹ := le_max_right _ _ have hscale : x / a ≤ max 1 a⁻¹ * x := by rw [div_eq_mul_inv, mul_comm] exact mul_le_mul_of_nonneg_right hainv hx nlinarith · have hx1' : 1 ≤ x := le_of_not_ge hx1 rw [min_eq_left hx1'] have hmin : min 1 (x / a) ≤ 1 := min_le_left _ _ have hmax : 1 ≤ max 1 a⁻¹ := le_max_left _ _ nlinarith
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.poisson_bias_min_rescale · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/PoissonInverseCount.lean:171
theorem inverse_count_bias_aggregate

Once each arm/cell mean has the Poisson missing-cell envelope, summing the two arm errors gives the complete inverse-count bias bound. the stated conditions the stated conclusion.

Formal statement
d :
P :
eps t :
heps :
0 < eps
ht :
0 < t
g :
Fin d → Bool → Real
hg :
∀ x a,
|g x a - cellMass P x * outcomeMean P a x|
≤ cellMass P x * exp (-eps * t * cellMass P x)
|∑ x, (g x true - g x false) - ateFunctional P| ≤ 2 * min 1 (d / (eps * exp 1 * t))
Proof (Lean source)
lemma inverse_count_bias_aggregate {d : Nat} (P : DiscreteLaw d) {eps t : Real} (heps : 0 < eps) (ht : 0 < t) (g : Fin d → Bool → Real) (hg : ∀ x a, |g x a - cellMass P x * outcomeMean P a x| ≤ cellMass P x * exp (-eps * t * cellMass P x)) : |∑ x, (g x true - g x false) - ateFunctional P| ≤ 2 * min 1 (d / (eps * exp 1 * t)) := by have hp (x : Fin d) : 0 ≤ cellMass P x := (cellMass_mem_unitInterval P x).1 have hsum := poisson_bias_sum_le_min (fun x ↦ cellMass P x) heps ht hp (cellMass_sum_eq_one_annotation P) rw [ateFunctional, ← Finset.sum_sub_distrib] calc |∑ x, ((g x true - g x false) - cellMass P x * (outcomeMean P true x - outcomeMean P false x))| = |∑ x, ((g x true - cellMass P x * outcomeMean P true x) - (g x false - cellMass P x * outcomeMean P false x))| := by congr 1 apply Finset.sum_congr rfl intro x _ ring _ ≤ ∑ x, |(g x true - cellMass P x * outcomeMean P true x) - (g x false - cellMass P x * outcomeMean P false x)| := Finset.abs_sum_le_sum_abs _ _ _ ≤ ∑ x, (|g x true - cellMass P x * outcomeMean P true x| + |g x false - cellMass P x * outcomeMean P false x|) := by apply Finset.sum_le_sum intro x _ exact abs_sub _ _ _ ≤ ∑ x, (2 * (cellMass P x * exp (-eps * t * cellMass P x))) := by apply Finset.sum_le_sum intro x _ nlinarith [hg x true, hg x false] _ = 2 * ∑ x, cellMass P x * exp (-eps * t * cellMass P x) := by rw [Finset.mul_sum] _ ≤ 2 * min 1 (d / (eps * exp 1 * t)) := by gcongr
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.inverse_count_bias_aggregate · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/PoissonInverseCount.lean:200
CausalSmith.Stat.STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research.Helpers.PoissonInverseCountAssembly 16 declarations Product-measure identities used to assemble the inverse-count risk bound.

Product-measure identities used to assemble the inverse-count risk bound.

theorem poissonCountLaw_eq_nestedPairedPoissonMeasure

The paper-facing count law is definitionally the nested paired-Poisson product used by the tensorized Poincare and factorization lemmas. the stated conclusion.

Formal statement
d :
P :
u t :
= nestedPairedPoissonMeasure (fun x a => toNNReal (u * markedMass P x a)) (fun x a => toNNReal (t * armMass P x a))
Proof (Lean source)
lemma poissonCountLaw_eq_nestedPairedPoissonMeasure {d : Nat} (P : DiscreteLaw d) (u t : Real) : poissonCountLaw P u t = nestedPairedPoissonMeasure (fun x a => toNNReal (u * markedMass P x a)) (fun x a => toNNReal (t * armMass P x a)) := by rfl
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.poissonCountLaw_eq_nestedPairedPoissonMeasure · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/PoissonInverseCountAssembly.lean:16
theorem varianceUnder_eq_variance Lemma varianceUnder_eq_variance in the paper ↗

The local centered-second-moment wrapper agrees with Mathlib's variance for measurable real statistics. the stated conditions the stated conclusion.

Formal statement
alpha :
Type*
mu :
Measure alpha
f :
alpha -> Real
hf :
Proof (Lean source)
lemma varianceUnder_eq_variance {alpha : Type*} [MeasurableSpace alpha] (mu : Measure alpha) (f : alpha -> Real) (hf : AEMeasurable f mu) : varianceUnder mu f = variance f mu := by rw [variance_eq_integral hf] rfl
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.varianceUnder_eq_variance · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/PoissonInverseCountAssembly.lean:27
theorem poissonCountLaw_integral_cell

An integrand depending on one covariate cell can be integrated against the corresponding inner arm-product law. the stated conclusion.

Formal statement
d :
P :
u t :
x :
Fin d
F :
(Bool -> Nat × Nat) -> Real
(∫ K, F (K x) ∂poissonCountLaw P u t)
= ∫ k, F k ∂Measure.pi (fun a : Bool => (poissonMeasure (toNNReal (u * markedMass P x a))).prod (poissonMeasure (toNNReal (t * armMass P x a))) )
Proof (Lean source)
lemma poissonCountLaw_integral_cell {d : Nat} (P : DiscreteLaw d) (u t : Real) (x : Fin d) (F : (Bool -> Nat × Nat) -> Real) : (∫ K, F (K x) ∂poissonCountLaw P u t) = ∫ k, F k ∂Measure.pi (fun a : Bool => (poissonMeasure (toNNReal (u * markedMass P x a))).prod (poissonMeasure (toNNReal (t * armMass P x a))) ) := by rw [poissonCountLaw_eq_nestedPairedPoissonMeasure] exact integral_comp_eval (measurable_of_countable _).aestronglyMeasurable
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.poissonCountLaw_integral_cell · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/PoissonInverseCountAssembly.lean:36
theorem poissonCountLaw_integral_arm

A one-arm integrand further reduces to the scalar pair of independent outcome and marginal Poisson counts. the stated conclusion.

Formal statement
d :
P :
u t :
x :
Fin d
a :
F :
Nat × Nat -> Real
(∫ K, F (K x a) ∂poissonCountLaw P u t)
= ∫ z, F z ∂ (poissonMeasure (toNNReal (u * markedMass P x a))).prod (poissonMeasure (toNNReal (t * armMass P x a)))
Proof (Lean source)
lemma poissonCountLaw_integral_arm {d : Nat} (P : DiscreteLaw d) (u t : Real) (x : Fin d) (a : Bool) (F : Nat × Nat -> Real) : (∫ K, F (K x a) ∂poissonCountLaw P u t) = ∫ z, F z ∂ (poissonMeasure (toNNReal (u * markedMass P x a))).prod (poissonMeasure (toNNReal (t * armMass P x a))) := by calc _ = ∫ k, F (k a) ∂Measure.pi (fun b : Bool => (poissonMeasure (toNNReal (u * markedMass P x b))).prod (poissonMeasure (toNNReal (t * armMass P x b)))) := poissonCountLaw_integral_cell P u t x (fun k => F (k a)) _ = _ := integral_comp_eval (measurable_of_countable _).aestronglyMeasurable
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.poissonCountLaw_integral_arm · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/PoissonInverseCountAssembly.lean:48
theorem poisson_inverse_cross_moment_true Lemma poisson_inverse_cross_moment_true in the paper ↗

Factorization of the three independent scalar counts in the treated-arm cross term of an inverse-count weight. the stated conclusion.

Formal statement
lambdaS lambdaK :
u :
(∫ k : Bool -> Nat × Nat, ((k true).1 : Real) / u * ((k false).2 : Real) * (((k true).2 + 1 : Nat) : Real)⁻¹ ∂Measure.pi (fun a : Bool => (poissonMeasure (lambdaS a)).prod (poissonMeasure (lambdaK a))))
= ((lambdaS true : Real) / u) * (lambdaK false : Real) * (∫ n : Nat, (((n + 1 : Nat) : Real))⁻¹ ∂poissonMeasure (lambdaK true))
Proof (Lean source)
lemma poisson_inverse_cross_moment_true (lambdaS lambdaK : Bool -> NNReal) (u : Real) : (∫ k : Bool -> Nat × Nat, ((k true).1 : Real) / u * ((k false).2 : Real) * (((k true).2 + 1 : Nat) : Real)⁻¹ ∂Measure.pi (fun a : Bool => (poissonMeasure (lambdaS a)).prod (poissonMeasure (lambdaK a)))) = ((lambdaS true : Real) / u) * (lambdaK false : Real) * (∫ n : Nat, (((n + 1 : Nat) : Real))⁻¹ ∂poissonMeasure (lambdaK true)) := by let f : Bool -> (Nat × Nat) -> Real := fun b z => if b then ((z.1 : Real) / u) * (((z.2 + 1 : Nat) : Real))⁻¹ else (z.2 : Real) have hfun : (fun k : Bool -> Nat × Nat => ((k true).1 : Real) / u * ((k false).2 : Real) * (((k true).2 + 1 : Nat) : Real)⁻¹) = fun k => ∏ b, f b (k b) := by funext k simp [f, mul_assoc, mul_comm] rw [hfun, integral_fintype_prod_eq_prod] simp only [Fintype.prod_bool, f, Bool.false_eq_true, ↓reduceIte] rw [show (∫ x : Nat × Nat, ((x.1 : Real) / u) * (((x.2 + 1 : Nat) : Real))⁻¹ ∂(poissonMeasure (lambdaS true)).prod (poissonMeasure (lambdaK true))) = (∫ n : Nat, (n : Real) / u ∂poissonMeasure (lambdaS true)) * ∫ n : Nat, (((n + 1 : Nat) : Real))⁻¹ ∂poissonMeasure (lambdaK true) by exact integral_prod_mul (μ := poissonMeasure (lambdaS true)) (ν := poissonMeasure (lambdaK true)) (fun n : Nat => (n : Real) / u) (fun n : Nat => (((n + 1 : Nat) : Real))⁻¹), show (∫ x : Nat × Nat, (x.2 : Real) ∂(poissonMeasure (lambdaS false)).prod (poissonMeasure (lambdaK false))) = (∫ _n : Nat, (1 : Real) ∂poissonMeasure (lambdaS false)) * ∫ n : Nat, (n : Real) ∂poissonMeasure (lambdaK false) by simpa using integral_prod_mul (μ := poissonMeasure (lambdaS false)) (ν := poissonMeasure (lambdaK false)) (fun _n : Nat => (1 : Real)) (fun n : Nat => (n : Real)), integral_div] rw [poisson_natCast_first_moment, poisson_natCast_first_moment] simp ring
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.poisson_inverse_cross_moment_true · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/PoissonInverseCountAssembly.lean:64
theorem poisson_inverse_cross_moment_false Lemma poisson_inverse_cross_moment_false in the paper ↗

Control-arm counterpart of poisson_inverse_cross_moment_true. the stated conclusion.

Formal statement
lambdaS lambdaK :
u :
(∫ k : Bool -> Nat × Nat, ((k false).1 : Real) / u * ((k true).2 : Real) * (((k false).2 + 1 : Nat) : Real)⁻¹ ∂Measure.pi (fun a : Bool => (poissonMeasure (lambdaS a)).prod (poissonMeasure (lambdaK a))))
= ((lambdaS false : Real) / u) * (lambdaK true : Real) * (∫ n : Nat, (((n + 1 : Nat) : Real))⁻¹ ∂poissonMeasure (lambdaK false))
Proof (Lean source)
lemma poisson_inverse_cross_moment_false (lambdaS lambdaK : Bool -> NNReal) (u : Real) : (∫ k : Bool -> Nat × Nat, ((k false).1 : Real) / u * ((k true).2 : Real) * (((k false).2 + 1 : Nat) : Real)⁻¹ ∂Measure.pi (fun a : Bool => (poissonMeasure (lambdaS a)).prod (poissonMeasure (lambdaK a)))) = ((lambdaS false : Real) / u) * (lambdaK true : Real) * (∫ n : Nat, (((n + 1 : Nat) : Real))⁻¹ ∂poissonMeasure (lambdaK false)) := by let f : Bool -> (Nat × Nat) -> Real := fun b z => if b then (z.2 : Real) else ((z.1 : Real) / u) * (((z.2 + 1 : Nat) : Real))⁻¹ have hfun : (fun k : Bool -> Nat × Nat => ((k false).1 : Real) / u * ((k true).2 : Real) * (((k false).2 + 1 : Nat) : Real)⁻¹) = fun k => ∏ b, f b (k b) := by funext k simp [f] ring rw [hfun, integral_fintype_prod_eq_prod] simp only [Fintype.prod_bool, f, Bool.false_eq_true, ↓reduceIte] rw [show (∫ x : Nat × Nat, ((x.1 : Real) / u) * (((x.2 + 1 : Nat) : Real))⁻¹ ∂(poissonMeasure (lambdaS false)).prod (poissonMeasure (lambdaK false))) = (∫ n : Nat, (n : Real) / u ∂poissonMeasure (lambdaS false)) * ∫ n : Nat, (((n + 1 : Nat) : Real))⁻¹ ∂poissonMeasure (lambdaK false) by exact integral_prod_mul (μ := poissonMeasure (lambdaS false)) (ν := poissonMeasure (lambdaK false)) (fun n : Nat => (n : Real) / u) (fun n : Nat => (((n + 1 : Nat) : Real))⁻¹), show (∫ x : Nat × Nat, (x.2 : Real) ∂(poissonMeasure (lambdaS true)).prod (poissonMeasure (lambdaK true))) = (∫ _n : Nat, (1 : Real) ∂poissonMeasure (lambdaS true)) * ∫ n : Nat, (n : Real) ∂poissonMeasure (lambdaK true) by simpa using integral_prod_mul (μ := poissonMeasure (lambdaS true)) (ν := poissonMeasure (lambdaK true)) (fun _n : Nat => (1 : Real)) (fun n : Nat => (n : Real)), integral_div] rw [poisson_natCast_first_moment, poisson_natCast_first_moment] simp ring
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.poisson_inverse_cross_moment_false · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/PoissonInverseCountAssembly.lean:112
theorem poisson_inverse_cross_moment Lemma poisson_inverse_cross_moment in the paper ↗

Uniform arm-indexed form of the inverse-count cross-moment identity. the stated conclusion.

Formal statement
lambdaS lambdaK :
u :
a :
(∫ k : Bool -> Nat × Nat, ((k a).1 : Real) / u * ((k (!a)).2 : Real) * (((k a).2 + 1 : Nat) : Real)⁻¹ ∂Measure.pi (fun b : Bool => (poissonMeasure (lambdaS b)).prod (poissonMeasure (lambdaK b))))
= ((lambdaS a : Real) / u) * (lambdaK (!a) : Real) * (∫ n : Nat, (((n + 1 : Nat) : Real))⁻¹ ∂poissonMeasure (lambdaK a))
Proof (Lean source)
lemma poisson_inverse_cross_moment (lambdaS lambdaK : Bool -> NNReal) (u : Real) (a : Bool) : (∫ k : Bool -> Nat × Nat, ((k a).1 : Real) / u * ((k (!a)).2 : Real) * (((k a).2 + 1 : Nat) : Real)⁻¹ ∂Measure.pi (fun b : Bool => (poissonMeasure (lambdaS b)).prod (poissonMeasure (lambdaK b)))) = ((lambdaS a : Real) / u) * (lambdaK (!a) : Real) * (∫ n : Nat, (((n + 1 : Nat) : Real))⁻¹ ∂poissonMeasure (lambdaK a)) := by cases a · simpa using poisson_inverse_cross_moment_false lambdaS lambdaK u · simpa using poisson_inverse_cross_moment_true lambdaS lambdaK u
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.poisson_inverse_cross_moment · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/PoissonInverseCountAssembly.lean:160
theorem poisson_inverse_outcome_mean Lemma poisson_inverse_outcome_mean in the paper ↗

The outcome-count part of one arm's inverse-count summand has its Poisson mean divided by the outcome intensity. the stated conclusion.

Formal statement
lambdaS lambdaK :
u :
a :
(∫ k : Bool -> Nat × Nat, ((k a).1 : Real) / u ∂Measure.pi (fun b : Bool => (poissonMeasure (lambdaS b)).prod (poissonMeasure (lambdaK b))))
= (lambdaS a : Real) / u
Proof (Lean source)
lemma poisson_inverse_outcome_mean (lambdaS lambdaK : Bool -> NNReal) (u : Real) (a : Bool) : (∫ k : Bool -> Nat × Nat, ((k a).1 : Real) / u ∂Measure.pi (fun b : Bool => (poissonMeasure (lambdaS b)).prod (poissonMeasure (lambdaK b)))) = (lambdaS a : Real) / u := by calc _ = ∫ z : Nat × Nat, (z.1 : Real) / u ∂(poissonMeasure (lambdaS a)).prod (poissonMeasure (lambdaK a)) := integral_comp_eval (μ := fun b : Bool => (poissonMeasure (lambdaS b)).prod (poissonMeasure (lambdaK b))) (i := a) (f := fun z : Nat × Nat => (z.1 : Real) / u) (measurable_of_countable _).aestronglyMeasurable _ = (∫ n : Nat, (n : Real) / u ∂poissonMeasure (lambdaS a)) * ∫ _n : Nat, (1 : Real) ∂poissonMeasure (lambdaK a) := by simpa using integral_prod_mul (μ := poissonMeasure (lambdaS a)) (ν := poissonMeasure (lambdaK a)) (fun n : Nat => (n : Real) / u) (fun _n : Nat => (1 : Real)) _ = _ := by rw [integral_div, poisson_natCast_first_moment] simp
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.poisson_inverse_outcome_mean · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/PoissonInverseCountAssembly.lean:176
theorem inverse_count_outcome_addOne Lemma inverse_count_outcome_addOne in the paper ↗

Adding one outcome-success count changes only its arm's summand, by the corresponding inverse-count weight. the stated conditions the stated conclusion.

Formal statement
d :
u :
hu :
u ≠ 0
x :
Fin d
a :
= (if a then 1 else -1) / u * (((K x false).2 + (K x true).2 + 1 : Nat) : Real) / (((K x a).2 + 1 : Nat) : Real)
Proof (Lean source)
lemma inverse_count_outcome_addOne {d : Nat} (u : Real) (hu : u ≠ 0) (x : Fin d) (a : Bool) (K : PoissonCounts d) : nestedPairAddOneFst x a (inverseCountStatistic u) K = (if a then 1 else -1) / u * (((K x false).2 + (K x true).2 + 1 : Nat) : Real) / (((K x a).2 + 1 : Nat) : Real) := by classical simp only [nestedPairAddOneFst, inverseCountStatistic] rw [← Finset.sum_sub_distrib, Finset.sum_eq_single x] · cases a <;> simp [update, hu] <;> field_simp <;> ring · intro y _ hy simp [update, hy] · simp
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.inverse_count_outcome_addOne · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/PoissonInverseCountAssembly.lean:202
theorem inverse_count_marginal_addOne Lemma inverse_count_marginal_addOne in the paper ↗

Adding one marginal count has the two reciprocal increments displayed in the Poincare calculation. the stated conditions the stated conclusion.

Formal statement
d :
u :
hu :
u ≠ 0
x :
Fin d
a :
= if a then -((K x true).1 : Real) / u * ((K x false).2 : Real) / ((((K x true).2 + 1 : Nat) : Real) * (((K x true).2 + 2 : Nat) : Real))
- ((K x false).1 : Real) / u / (((K x false).2 + 1 : Nat) : Real) else ((K x true).1 : Real) / u / (((K x true).2 + 1 : Nat) : Real)
+ ((K x false).1 : Real) / u * ((K x true).2 : Real) / ((((K x false).2 + 1 : Nat) : Real) * (((K x false).2 + 2 : Nat) : Real))
Proof (Lean source)
lemma inverse_count_marginal_addOne {d : Nat} (u : Real) (hu : u ≠ 0) (x : Fin d) (a : Bool) (K : PoissonCounts d) : nestedPairAddOneSnd x a (inverseCountStatistic u) K = if a then -((K x true).1 : Real) / u * ((K x false).2 : Real) / ((((K x true).2 + 1 : Nat) : Real) * (((K x true).2 + 2 : Nat) : Real)) - ((K x false).1 : Real) / u / (((K x false).2 + 1 : Nat) : Real) else ((K x true).1 : Real) / u / (((K x true).2 + 1 : Nat) : Real) + ((K x false).1 : Real) / u * ((K x true).2 : Real) / ((((K x false).2 + 1 : Nat) : Real) * (((K x false).2 + 2 : Nat) : Real)) := by classical simp only [nestedPairAddOneSnd, inverseCountStatistic] rw [← Finset.sum_sub_distrib, Finset.sum_eq_single x] · cases a <;> simp [update, hu] <;> field_simp <;> ring · intro y _ hy simp [update, hy] · simp
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.inverse_count_marginal_addOne · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/PoissonInverseCountAssembly.lean:219
theorem poisson_inverse_weight_mean_mul_rate Lemma poisson_inverse_weight_mean_mul_rate in the paper ↗

The exact mean of 1 + V / (K + 1), in a multiplied form that remains valid when the denominator-count rate is zero. the stated conclusion.

Formal statement
lambda nu :
(lambda : Real) * (∫ z : Nat × Nat, (1 + (z.2 : Real) * (((z.1 + 1 : Nat) : Real))⁻¹) ∂(poissonMeasure lambda).prod (poissonMeasure nu))
= (lambda : Real) + (nu : Real) * (1 - exp (-(lambda : Real)))
Proof (Lean source)
lemma poisson_inverse_weight_mean_mul_rate (lambda nu : NNReal) : (lambda : Real) * (∫ z : Nat × Nat, (1 + (z.2 : Real) * (((z.1 + 1 : Nat) : Real))⁻¹) ∂(poissonMeasure lambda).prod (poissonMeasure nu)) = (lambda : Real) + (nu : Real) * (1 - exp (-(lambda : Real))) := by let r : Nat → Real := fun k ↦ (((k + 1 : Nat) : Real))⁻¹ have hr : Integrable r (poissonMeasure lambda) := (shifted_reciprocal_memLp_two lambda).integrable (by norm_num) have hk : Integrable (fun k : Nat ↦ (k : Real)) (poissonMeasure nu) := (poisson_natCast_memLp_two nu).integrable (by norm_num) have hmean : (∫ k : Nat, (k : Real) ∂poissonMeasure nu) = (nu : Real) := Causalean.Mathlib.Probability.Poisson.poisson_natCast_first_moment nu have hprod : (∫ z : Nat × Nat, (z.2 : Real) * r z.1 ∂(poissonMeasure lambda).prod (poissonMeasure nu)) = (∫ k : Nat, r k ∂poissonMeasure lambda) * ∫ v : Nat, (v : Real) ∂poissonMeasure nu := by simpa [mul_comm] using (integral_prod_mul (μ := poissonMeasure lambda) (ν := poissonMeasure nu) r (fun v : Nat ↦ (v : Real))) have hcross : Integrable (fun z : Nat × Nat ↦ (z.2 : Real) * r z.1) ((poissonMeasure lambda).prod (poissonMeasure nu)) := by apply (hr.mul_prod hk).congr filter_upwards with z simp [mul_comm] rw [integral_add (integrable_const 1) hcross] rw [hprod, hmean] simp only [integral_const] have huniv : ((poissonMeasure lambda).prod (poissonMeasure nu)).real univ = 1 := by simp [Measure.real] rw [huniv] norm_num rw [mul_add, mul_one] congr 1 calc (lambda : Real) * ((∫ k : Nat, r k ∂poissonMeasure lambda) * (nu : Real)) = (nu : Real) * ((lambda : Real) * ∫ k : Nat, r k ∂poissonMeasure lambda) := by ring _ = (nu : Real) * (1 - exp (-(lambda : Real))) := by rw [shifted_reciprocal_first_moment]
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.poisson_inverse_weight_mean_mul_rate · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/PoissonInverseCountAssembly.lean:245
theorem poisson_inverse_arm_expectation_scalar Lemma poisson_inverse_arm_expectation_scalar in the paper ↗

Algebraic form of the per-arm expectation calculation. The multiplied reciprocal identity is enough even when the arm mass s vanishes. the stated conditions the stated conclusion.

Formal statement
p s mu t w :
ht :
0 < t
hmean :
(t * s) * w = t * s + t * (p - s) * (1 - exp (-(t * s)))
(s * mu) * w = p * mu - (p - s) * mu * exp (-(t * s))
Proof (Lean source)
lemma poisson_inverse_arm_expectation_scalar {p s mu t w : Real} (ht : 0 < t) (hmean : (t * s) * w = t * s + t * (p - s) * (1 - exp (-(t * s)))) : (s * mu) * w = p * mu - (p - s) * mu * exp (-(t * s)) := by have hscaled : s * w = s + (p - s) * (1 - exp (-(t * s))) := by apply (mul_left_cancel₀ ht.ne') nlinarith calc (s * mu) * w = mu * (s * w) := by ring _ = mu * (s + (p - s) * (1 - exp (-(t * s)))) := by rw [hscaled] _ = p * mu - (p - s) * mu * exp (-(t * s)) := by ring
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.poisson_inverse_arm_expectation_scalar · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/PoissonInverseCountAssembly.lean:290
theorem poisson_inverse_arm_bias_envelope Lemma poisson_inverse_arm_bias_envelope in the paper ↗

Overlap turns the exact missing-cell term for one arm into the exponential cell-mass envelope used by inverse_count_bias_aggregate. the stated conditions the stated conclusion.

Formal statement
p s mu eps t mean :
ht :
0 < t
hp :
0 ≤ p
hs_nonneg :
0 ≤ s
hs_le :
s ≤ p
hmu :
mu ∈ Icc (0 : Real) 1
hlower :
eps * p ≤ s
hmean :
mean = p * mu - (p - s) * mu * exp (-(t * s))
|mean - p * mu| ≤ p * exp (-eps * t * p)
Proof (Lean source)
lemma poisson_inverse_arm_bias_envelope {p s mu eps t mean : Real} (ht : 0 < t) (hp : 0 ≤ p) (hs_nonneg : 0 ≤ s) (hs_le : s ≤ p) (hmu : mu ∈ Icc (0 : Real) 1) (hlower : eps * p ≤ s) (hmean : mean = p * mu - (p - s) * mu * exp (-(t * s))) : |mean - p * mu| ≤ p * exp (-eps * t * p) := by have hexp : exp (-(t * s)) ≤ exp (-eps * t * p) := by apply Real.exp_le_exp.mpr nlinarith [mul_le_mul_of_nonneg_left hlower ht.le] rw [hmean] have hnonneg : 0 ≤ (p - s) * mu * exp (-(t * s)) := mul_nonneg (mul_nonneg (sub_nonneg.mpr hs_le) hmu.1) (Real.exp_pos _).le rw [show p * mu - (p - s) * mu * exp (-(t * s)) - p * mu = -((p - s) * mu * exp (-(t * s))) by ring, abs_neg, abs_of_nonneg hnonneg] calc (p - s) * mu * exp (-(t * s)) ≤ (p - s) * 1 * exp (-(t * s)) := by gcongr exact hmu.2 _ ≤ p * 1 * exp (-(t * s)) := by nlinarith [Real.exp_pos (-(t * s))] _ ≤ p * 1 * exp (-eps * t * p) := by gcongr _ = p * exp (-eps * t * p) := by ring
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.poisson_inverse_arm_bias_envelope · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/PoissonInverseCountAssembly.lean:307
theorem poisson_cell_variance_sum_bound Lemma poisson_cell_variance_sum_bound in the paper ↗

The cellwise variance remainder sums at the marginal-information rate, without any minimum-cell-mass assumption. the stated conditions the stated conclusion.

Formal statement
d :
p :
Fin d → Real
t :
ht :
0 < t
hp :
∀ x, 0 ≤ p x
hsum :
∑ x, p x = 1
(∑ x, p x ^ 2 / (1 + t * p x)) ≤ t⁻¹
Proof (Lean source)
lemma poisson_cell_variance_sum_bound {d : Nat} (p : Fin d → Real) {t : Real} (ht : 0 < t) (hp : ∀ x, 0 ≤ p x) (hsum : ∑ x, p x = 1) : (∑ x, p x ^ 2 / (1 + t * p x)) ≤ t⁻¹ := by calc (∑ x, p x ^ 2 / (1 + t * p x)) ≤ ∑ x, p x / t := by apply Finset.sum_le_sum intro x _ have htp : 0 ≤ t * p x := mul_nonneg ht.le (hp x) have hden : 0 < 1 + t * p x := by linarith apply (div_le_div_iff₀ hden ht).2 nlinarith [hp x] _ = t⁻¹ := by rw [← Finset.sum_div, hsum] simp [one_div]
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.poisson_cell_variance_sum_bound · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/PoissonInverseCountAssembly.lean:334
theorem inverse_count_variance_aggregate Lemma inverse_count_variance_aggregate in the paper ↗

Aggregate the two armwise cell variance bounds after the product-measure calculation. The marked masses consume the outcome-information budget, while the squared cell masses consume the marginal-information budget. the stated conditions the stated conclusion.

Formal statement
d :
p q0 q1 v0 v1 :
Fin d → Real
u t A B V :
hu :
0 < u
ht :
0 < t
hA :
0 ≤ A
hB :
0 ≤ B
hp :
∀ x, 0 ≤ p x
hsump :
∑ x, p x = 1
hq0 :
∀ x, 0 ≤ q0 x
hq1 :
∀ x, 0 ≤ q1 x
hsumq :
∑ x, (q0 x + q1 x) ≤ 1
hv :
∀ x (a : Bool),
(if a then v1 x else v0 x)
≤ A * (if a then q1 x else q0 x) * u⁻¹ + B * p x ^ 2 / (1 + t * p x)
hV :
V ≤ 2 * ∑ x, (v0 x + v1 x)
V ≤ 4 * max A B * (u⁻¹ + t⁻¹)
Proof (Lean source)
lemma inverse_count_variance_aggregate {d : Nat} (p q0 q1 v0 v1 : Fin d → Real) {u t A B V : Real} (hu : 0 < u) (ht : 0 < t) (hA : 0 ≤ A) (hB : 0 ≤ B) (hp : ∀ x, 0 ≤ p x) (hsump : ∑ x, p x = 1) (hq0 : ∀ x, 0 ≤ q0 x) (hq1 : ∀ x, 0 ≤ q1 x) (hsumq : ∑ x, (q0 x + q1 x) ≤ 1) (hv : ∀ x (a : Bool), (if a then v1 x else v0 x) ≤ A * (if a then q1 x else q0 x) * u⁻¹ + B * p x ^ 2 / (1 + t * p x)) (hV : V ≤ 2 * ∑ x, (v0 x + v1 x)) : V ≤ 4 * max A B * (u⁻¹ + t⁻¹) := by have hcell := poisson_cell_variance_sum_bound p ht hp hsump have hsumarms : (∑ x, (v0 x + v1 x)) ≤ A * u⁻¹ * (∑ x, (q0 x + q1 x)) + 2 * B * (∑ x, p x ^ 2 / (1 + t * p x)) := by calc (∑ x, (v0 x + v1 x)) ≤ ∑ x, ((A * q0 x * u⁻¹ + B * p x ^ 2 / (1 + t * p x)) + (A * q1 x * u⁻¹ + B * p x ^ 2 / (1 + t * p x))) := by apply Finset.sum_le_sum intro x _ exact add_le_add (by simpa using hv x false) (by simpa using hv x true) _ = A * u⁻¹ * (∑ x, (q0 x + q1 x)) + 2 * B * (∑ x, p x ^ 2 / (1 + t * p x)) := by rw [Finset.mul_sum, Finset.mul_sum] rw [← Finset.sum_add_distrib] apply Finset.sum_congr rfl intro x _ ring have hAu : 0 ≤ A * u⁻¹ := mul_nonneg hA (inv_nonneg.mpr hu.le) have hBt : 0 ≤ 2 * B := by positivity have hsumarms' : (∑ x, (v0 x + v1 x)) ≤ A * u⁻¹ + 2 * B * t⁻¹ := by calc _ ≤ A * u⁻¹ * (∑ x, (q0 x + q1 x)) + 2 * B * (∑ x, p x ^ 2 / (1 + t * p x)) := hsumarms _ ≤ A * u⁻¹ * 1 + 2 * B * t⁻¹ := add_le_add (mul_le_mul_of_nonneg_left hsumq hAu) (mul_le_mul_of_nonneg_left hcell hBt) _ = A * u⁻¹ + 2 * B * t⁻¹ := by ring have hAle : A ≤ max A B := le_max_left _ _ have hBle : B ≤ max A B := le_max_right _ _ have huinv : 0 ≤ u⁻¹ := inv_nonneg.mpr hu.le have htinv : 0 ≤ t⁻¹ := inv_nonneg.mpr ht.le calc V ≤ 2 * ∑ x, (v0 x + v1 x) := hV _ ≤ 2 * (A * u⁻¹ + 2 * B * t⁻¹) := by gcongr _ ≤ 4 * max A B * (u⁻¹ + t⁻¹) := by nlinarith [mul_le_mul_of_nonneg_right hAle huinv, mul_le_mul_of_nonneg_right hBle htinv]
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.inverse_count_variance_aggregate · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/PoissonInverseCountAssembly.lean:353
theorem inverseCountStatistic_memLp_and_addOne

The inverse-count statistic and all of its coordinate add-one increments are square-integrable under the nested Poisson law. This packages the polynomial-growth side conditions needed by the tensorized Poincare theorem. the stated conditions the stated conclusion.

Formal statement
d :
P :
u t :
hu :
0 < u
lambda₁ :
fun x a ↦ toNNReal (u * markedMass P x a) (: Fin d → Bool → NNReal)
lambda₂ :
fun x a ↦ toNNReal (t * armMass P x a) (: Fin d → Bool → NNReal)
Proof (Lean source)
lemma inverseCountStatistic_memLp_and_addOne {d : Nat} (P : DiscreteLaw d) {u t : Real} (hu : 0 < u) : let lambda₁ : Fin d → Bool → NNReal := fun x a ↦ toNNReal (u * markedMass P x a) let lambda₂ : Fin d → Bool → NNReal := fun x a ↦ toNNReal (t * armMass P x a) MemLp (inverseCountStatistic u) 2 (nestedPairedPoissonMeasure lambda₁ lambda₂) ∧ (∀ x a, MemLp (nestedPairAddOneFst x a (inverseCountStatistic u)) 2 (nestedPairedPoissonMeasure lambda₁ lambda₂)) ∧ (∀ x a, MemLp (nestedPairAddOneSnd x a (inverseCountStatistic u)) 2 (nestedPairedPoissonMeasure lambda₁ lambda₂)) := by classical dsimp only let total : PoissonCounts d → Real := fun K ↦ (nestedPairedTotalCount K : Real) have hcoord (K : PoissonCounts d) (x : Fin d) (a : Bool) : ((K x a).1 : Real) ≤ total K := by dsimp [total, nestedPairedTotalCount] have hnat : (K x a).1 ≤ ∑ i, ∑ b, ((K i b).1 + (K i b).2) := by calc (K x a).1 ≤ (K x a).1 + (K x a).2 := le_add_right _ _ _ ≤ ∑ b, ((K x b).1 + (K x b).2) := by exact Finset.single_le_sum (f := fun b : Bool ↦ (K x b).1 + (K x b).2) (fun _ _ ↦ zero_le _) (Finset.mem_univ a) _ ≤ ∑ i, ∑ b, ((K i b).1 + (K i b).2) := by exact Finset.single_le_sum (f := fun i : Fin d ↦ ∑ b, ((K i b).1 + (K i b).2)) (fun _ _ ↦ Finset.sum_nonneg fun _ _ ↦ zero_le _) (Finset.mem_univ x) exact_mod_cast hnat have hmarg (K : PoissonCounts d) (x : Fin d) (a : Bool) : ((K x a).2 : Real) ≤ total K := by dsimp [total, nestedPairedTotalCount] have hnat : (K x a).2 ≤ ∑ i, ∑ b, ((K i b).1 + (K i b).2) := by calc (K x a).2 ≤ (K x a).1 + (K x a).2 := Nat.le_add_left _ _ _ ≤ ∑ b, ((K x b).1 + (K x b).2) := by exact Finset.single_le_sum (f := fun b : Bool ↦ (K x b).1 + (K x b).2) (fun _ _ ↦ zero_le _) (Finset.mem_univ a) _ ≤ ∑ i, ∑ b, ((K i b).1 + (K i b).2) := by exact Finset.single_le_sum (f := fun i : Fin d ↦ ∑ b, ((K i b).1 + (K i b).2)) (fun _ _ ↦ Finset.sum_nonneg fun _ _ ↦ zero_le _) (Finset.mem_univ x) exact_mod_cast hnat have hbound (K : PoissonCounts d) : |inverseCountStatistic u K| ≤ ((4 * d : Nat) : Real) * |u⁻¹| * (1 + total K) ^ 2 := by rw [inverseCountStatistic] apply le_trans (Finset.abs_sum_le_sum_abs _ _) apply le_trans (Finset.sum_le_sum fun x _ ↦ abs_sub _ _) have htotal : 0 ≤ total K := by dsimp [total]; positivity have hone : 0 ≤ 1 + total K := by positivity have harm (x : Fin d) (a : Bool) : |((K x a).1 : Real) / u * (((K x false).2 + (K x true).2 + 1 : Nat) : Real) / (((K x a).2 + 1 : Nat) : Real)| ≤ 2 * |u⁻¹| * (1 + total K) ^ 2 := by have hden : (1 : Real) ≤ (((K x a).2 + 1 : Nat) : Real) := by exact_mod_cast Nat.le_add_left 1 (K x a).2 have hnum : (((K x false).2 + (K x true).2 + 1 : Nat) : Real) ≤ 1 + 2 * total K := by norm_num [Nat.cast_add] nlinarith [hmarg K x false, hmarg K x true] simp only [div_eq_mul_inv, abs_mul] rw [abs_of_nonneg (show 0 ≤ ((K x a).1 : Real) by positivity), abs_of_nonneg (show 0 ≤ (((K x false).2 + (K x true).2 + 1 : Nat) : Real) by positivity)] have hdinv : ((((K x a).2 + 1 : Nat) : Real))⁻¹ ≤ 1 := inv_le_one_of_one_le₀ hden have hdinvAbs : |((((K x a).2 + 1 : Nat) : Real))⁻¹| ≤ 1 := by rw [abs_of_nonneg (inv_nonneg.mpr (by positivity))] exact hdinv have hfirst : ((K x a).1 : Real) ≤ total K := hcoord K x a have hinv0 : 0 ≤ |u⁻¹| := abs_nonneg _ have hcast0 : 0 ≤ ((K x a).1 : Real) := by positivity have hnum0 : 0 ≤ (((K x false).2 + (K x true).2 + 1 : Nat) : Real) := by positivity have hdinv0 : 0 ≤ ((((K x a).2 + 1 : Nat) : Real))⁻¹ := by positivity calc ((K x a).1 : Real) * |u⁻¹| * (((K x false).2 + (K x true).2 + 1 : Nat) : Real) * |((((K x a).2 + 1 : Nat) : Real))⁻¹| ≤ total K * |u⁻¹| * (1 + 2 * total K) * 1 := by gcongr _ ≤ 2 * |u⁻¹| * (1 + total K) ^ 2 := by have hpoly : total K * (1 + 2 * total K) ≤ 2 * (1 + total K) ^ 2 := by nlinarith [sq_nonneg (total K)] nlinarith [mul_le_mul_of_nonneg_left hpoly hinv0] calc ∑ x, (|((K x true).1 : Real) / u * (((K x false).2 + (K x true).2 + 1 : Nat) : Real) / (((K x true).2 + 1 : Nat) : Real)| + |((K x false).1 : Real) / u * (((K x false).2 + (K x true).2 + 1 : Nat) : Real) / (((K x false).2 + 1 : Nat) : Real)|) ≤ ∑ _x : Fin d, (4 * |u⁻¹| * (1 + total K) ^ 2) := by apply Finset.sum_le_sum intro x _ nlinarith [harm x true, harm x false] _ = ((4 * d : Nat) : Real) * |u⁻¹| * (1 + total K) ^ 2 := by simp push_cast ring exact memLp_nestedPairedPoisson_and_addOne_of_polynomial_bound (fun x a ↦ toNNReal (u * markedMass P x a)) (fun x a ↦ toNNReal (t * armMass P x a)) (inverseCountStatistic u) (measurable_of_countable _) (((4 * d : Nat) : Real) * |u⁻¹|) 2 (by positivity) (by intro K simpa [total] using hbound K)
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.inverseCountStatistic_memLp_and_addOne · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/PoissonInverseCountAssembly.lean:410
CausalSmith.Stat.STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research.Helpers.PoissonInverseCountMarginalEnergy 6 declarations Marginal-count energy and final Poincare assembly for the inverse-count statistic.

Marginal-count energy and final Poincare assembly for the inverse-count statistic.

theorem poisson_inverse_marginal_cross_square_moment Lemma poisson_inverse_marginal_cross_square_moment in the paper ↗

Factor the squared three-coordinate term in a marginal-count add-one increment. the stated conclusion.

Formal statement
lambdaS lambdaK :
u :
a :
(∫ k : Bool → Nat × Nat, ((((k a).1 : Real) / u * ((k (!a)).2 : Real) / ((((k a).2 + 1 : Nat) : Real) * (((k a).2 + 2 : Nat) : Real))) ^ 2) ∂Measure.pi (fun b : Bool ↦ (poissonMeasure (lambdaS b)).prod (poissonMeasure (lambdaK b))))
= ((∫ n : Nat, ((n : Real) / u) ^ 2 ∂poissonMeasure (lambdaS a)) * ∫ n : Nat, (((((n + 1 : Nat) : Real) * ((n + 2 : Nat) : Real)))⁻¹) ^ 2 ∂poissonMeasure (lambdaK a)) * ∫ n : Nat, (n : Real) ^ 2 ∂poissonMeasure (lambdaK (!a))
Proof (Lean source)
lemma poisson_inverse_marginal_cross_square_moment (lambdaS lambdaK : Bool → NNReal) (u : Real) (a : Bool) : (∫ k : Bool → Nat × Nat, ((((k a).1 : Real) / u * ((k (!a)).2 : Real) / ((((k a).2 + 1 : Nat) : Real) * (((k a).2 + 2 : Nat) : Real))) ^ 2) ∂Measure.pi (fun b : Bool ↦ (poissonMeasure (lambdaS b)).prod (poissonMeasure (lambdaK b)))) = ((∫ n : Nat, ((n : Real) / u) ^ 2 ∂poissonMeasure (lambdaS a)) * ∫ n : Nat, (((((n + 1 : Nat) : Real) * ((n + 2 : Nat) : Real)))⁻¹) ^ 2 ∂poissonMeasure (lambdaK a)) * ∫ n : Nat, (n : Real) ^ 2 ∂poissonMeasure (lambdaK (!a)) := by let f : Bool → (Nat × Nat) → Real := fun b z ↦ if b = a then ((z.1 : Real) / u) ^ 2 * (((((z.2 + 1 : Nat) : Real) * ((z.2 + 2 : Nat) : Real)))⁻¹) ^ 2 else (z.2 : Real) ^ 2 have hpair (b : Bool) : (∫ z : Nat × Nat, ((z.1 : Real) / u) ^ 2 * (((((z.2 + 1 : Nat) : Real) * ((z.2 + 2 : Nat) : Real)))⁻¹) ^ 2 ∂(poissonMeasure (lambdaS b)).prod (poissonMeasure (lambdaK b))) = (∫ n : Nat, ((n : Real) / u) ^ 2 ∂poissonMeasure (lambdaS b)) * ∫ n : Nat, (((((n + 1 : Nat) : Real) * ((n + 2 : Nat) : Real)))⁻¹) ^ 2 ∂poissonMeasure (lambdaK b) := by exact integral_prod_mul (μ := poissonMeasure (lambdaS b)) (ν := poissonMeasure (lambdaK b)) (fun n : Nat ↦ ((n : Real) / u) ^ 2) (fun n : Nat ↦ (((((n + 1 : Nat) : Real) * ((n + 2 : Nat) : Real)))⁻¹) ^ 2) have hop (b : Bool) : (∫ z : Nat × Nat, (z.2 : Real) ^ 2 ∂(poissonMeasure (lambdaS b)).prod (poissonMeasure (lambdaK b))) = ∫ n : Nat, (n : Real) ^ 2 ∂poissonMeasure (lambdaK b) := by calc _ = (∫ _n : Nat, (1 : Real) ∂poissonMeasure (lambdaS b)) * ∫ n : Nat, (n : Real) ^ 2 ∂poissonMeasure (lambdaK b) := by simpa using integral_prod_mul (μ := poissonMeasure (lambdaS b)) (ν := poissonMeasure (lambdaK b)) (fun _n : Nat ↦ (1 : Real)) (fun n : Nat ↦ (n : Real) ^ 2) _ = _ := by simp rw [show (fun k : Bool → Nat × Nat ↦ (((k a).1 : Real) / u * ((k (!a)).2 : Real) / ((((k a).2 + 1 : Nat) : Real) * (((k a).2 + 2 : Nat) : Real))) ^ 2) = fun k ↦ ∏ b, f b (k b) by funext k cases a <;> simp [f, div_eq_mul_inv] <;> ring, integral_fintype_prod_eq_prod] cases a · rw [Fintype.prod_bool] change (∫ z : Nat × Nat, (z.2 : Real) ^ 2 ∂(poissonMeasure (lambdaS true)).prod (poissonMeasure (lambdaK true))) * (∫ z : Nat × Nat, ((z.1 : Real) / u) ^ 2 * (((((z.2 + 1 : Nat) : Real) * ((z.2 + 2 : Nat) : Real)))⁻¹) ^ 2 ∂(poissonMeasure (lambdaS false)).prod (poissonMeasure (lambdaK false))) = _ rw [hpair false, hop true] simp only [Bool.not_false] ring · rw [Fintype.prod_bool] change (∫ z : Nat × Nat, ((z.1 : Real) / u) ^ 2 * (((((z.2 + 1 : Nat) : Real) * ((z.2 + 2 : Nat) : Real)))⁻¹) ^ 2 ∂(poissonMeasure (lambdaS true)).prod (poissonMeasure (lambdaK true))) * (∫ z : Nat × Nat, (z.2 : Real) ^ 2 ∂(poissonMeasure (lambdaS false)).prod (poissonMeasure (lambdaK false))) = _ rw [hop false, hpair true] simp only [Bool.not_true]
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.poisson_inverse_marginal_cross_square_moment · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/PoissonInverseCountMarginalEnergy.lean:14
theorem poisson_inverse_marginal_reciprocal_square_moment Lemma poisson_inverse_marginal_reciprocal_square_moment in the paper ↗

Factor the one-arm reciprocal term in a marginal-count add-one increment. the stated conclusion.

Formal statement
lambdaS lambdaK :
u :
a :
(∫ k : Bool → Nat × Nat, ((((k a).1 : Real) / u / (((k a).2 + 1 : Nat) : Real)) ^ 2) ∂Measure.pi (fun b : Bool ↦ (poissonMeasure (lambdaS b)).prod (poissonMeasure (lambdaK b))))
= (∫ n : Nat, ((n : Real) / u) ^ 2 ∂poissonMeasure (lambdaS a)) * ∫ n : Nat, (((n + 1 : Nat) : Real)⁻¹) ^ 2 ∂poissonMeasure (lambdaK a)
Proof (Lean source)
lemma poisson_inverse_marginal_reciprocal_square_moment (lambdaS lambdaK : Bool → NNReal) (u : Real) (a : Bool) : (∫ k : Bool → Nat × Nat, ((((k a).1 : Real) / u / (((k a).2 + 1 : Nat) : Real)) ^ 2) ∂Measure.pi (fun b : Bool ↦ (poissonMeasure (lambdaS b)).prod (poissonMeasure (lambdaK b)))) = (∫ n : Nat, ((n : Real) / u) ^ 2 ∂poissonMeasure (lambdaS a)) * ∫ n : Nat, (((n + 1 : Nat) : Real)⁻¹) ^ 2 ∂poissonMeasure (lambdaK a) := by calc _ = ∫ z : Nat × Nat, (((z.1 : Real) / u / (((z.2 + 1 : Nat) : Real))) ^ 2) ∂(poissonMeasure (lambdaS a)).prod (poissonMeasure (lambdaK a)) := integral_comp_eval (μ := fun b : Bool ↦ (poissonMeasure (lambdaS b)).prod (poissonMeasure (lambdaK b))) (i := a) (f := fun z : Nat × Nat ↦ (((z.1 : Real) / u / (((z.2 + 1 : Nat) : Real))) ^ 2)) (measurable_of_countable _).aestronglyMeasurable _ = _ := by rw [show (fun z : Nat × Nat ↦ (((z.1 : Real) / u / (((z.2 + 1 : Nat) : Real))) ^ 2)) = fun z ↦ ((z.1 : Real) / u) ^ 2 * ((((z.2 + 1 : Nat) : Real)⁻¹) ^ 2) by funext z simp only [div_eq_mul_inv, mul_pow]] exact integral_prod_mul (μ := poissonMeasure (lambdaS a)) (ν := poissonMeasure (lambdaK a)) (fun n : Nat ↦ ((n : Real) / u) ^ 2) (fun n : Nat ↦ ((((n + 1 : Nat) : Real)⁻¹) ^ 2))
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.poisson_inverse_marginal_reciprocal_square_moment · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/PoissonInverseCountMarginalEnergy.lean:80
theorem poisson_inverse_bidirectional_poincare_energy_scalar Lemma poisson_inverse_bidirectional_poincare_energy_scalar in the paper ↗

Add the two arm orientations of the scalar marginal-count energy bound. the stated conditions the stated conclusion.

Formal statement
eps w lambda nu r2l r2n r4l r4n :
heps :
0 < eps
heps1 :
eps ≤ 1
hw :
0 ≤ w
hlambda :
0 ≤ lambda
hnu :
0 ≤ nu
hllower :
eps * w ≤ lambda
hnlower :
eps * w ≤ nu
hlupper :
lambda ≤ w
hnupper :
nu ≤ w
hr2l :
0 ≤ r2l
hr2lrate :
(1 + lambda) ^ 2 * r2l ≤ 8
hr2n :
0 ≤ r2n
hr2nrate :
(1 + nu) ^ 2 * r2n ≤ 8
hr4l :
0 ≤ r4l
hr4lrate :
(1 + lambda) ^ 4 * r4l ≤ 96
hr4n :
0 ≤ r4n
hr4nrate :
(1 + nu) ^ 4 * r4n ≤ 96
(lambda * (nu + nu ^ 2) * r4l + nu * r2l)
+ (nu * (lambda + lambda ^ 2) * r4n + lambda * r2n)
≤ 2 * (8 * eps⁻¹ ^ 2 + 96 * (eps⁻¹ ^ 2 + eps⁻¹ ^ 3)) / (1 + w)
Proof (Lean source)
lemma poisson_inverse_bidirectional_poincare_energy_scalar {eps w lambda nu r2l r2n r4l r4n : Real} (heps : 0 < eps) (heps1 : eps ≤ 1) (hw : 0 ≤ w) (hlambda : 0 ≤ lambda) (hnu : 0 ≤ nu) (hllower : eps * w ≤ lambda) (hnlower : eps * w ≤ nu) (hlupper : lambda ≤ w) (hnupper : nu ≤ w) (hr2l : 0 ≤ r2l) (hr2lrate : (1 + lambda) ^ 2 * r2l ≤ 8) (hr2n : 0 ≤ r2n) (hr2nrate : (1 + nu) ^ 2 * r2n ≤ 8) (hr4l : 0 ≤ r4l) (hr4lrate : (1 + lambda) ^ 4 * r4l ≤ 96) (hr4n : 0 ≤ r4n) (hr4nrate : (1 + nu) ^ 4 * r4n ≤ 96) : (lambda * (nu + nu ^ 2) * r4l + nu * r2l) + (nu * (lambda + lambda ^ 2) * r4n + lambda * r2n) ≤ 2 * (8 * eps⁻¹ ^ 2 + 96 * (eps⁻¹ ^ 2 + eps⁻¹ ^ 3)) / (1 + w) := by let C := 8 * eps⁻¹ ^ 2 + 96 * (eps⁻¹ ^ 2 + eps⁻¹ ^ 3) have h₁ := Causalean.Mathlib.Probability.Poisson.poisson_inverse_weight_poincare_energy_scalar heps heps1 hw hlambda hnu hllower hnupper hr2l hr2lrate hr4l hr4lrate have h₂ := Causalean.Mathlib.Probability.Poisson.poisson_inverse_weight_poincare_energy_scalar heps heps1 hw hnu hlambda hnlower hlupper hr2n hr2nrate hr4n hr4nrate have hden : 0 < 1 + w := by linarith apply (le_div_iff₀ hden).2 nlinarith
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.poisson_inverse_bidirectional_poincare_energy_scalar · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/PoissonInverseCountMarginalEnergy.lean:114
theorem poisson_inverse_marginal_energy_with_outcome_rates Lemma poisson_inverse_marginal_energy_with_outcome_rates in the paper ↗

Insert outcome moments into the bidirectional marginal energy estimate. the stated conditions the stated conclusion.

Formal statement
eps p u w lambda nu ql qn r2l r2n r4l r4n :
hu :
0 < u
hp :
0 ≤ p
hql :
0 ≤ ql
hqn :
0 ≤ qn
hqlp :
ql ≤ p
hqnp :
qn ≤ p
heps :
0 < eps
heps1 :
eps ≤ 1
hw :
0 ≤ w
hlambda :
0 ≤ lambda
hnu :
0 ≤ nu
hllower :
eps * w ≤ lambda
hnlower :
eps * w ≤ nu
hlupper :
lambda ≤ w
hnupper :
nu ≤ w
hr2l :
0 ≤ r2l
hr2lrate :
(1 + lambda) ^ 2 * r2l ≤ 8
hr2n :
0 ≤ r2n
hr2nrate :
(1 + nu) ^ 2 * r2n ≤ 8
hr4l :
0 ≤ r4l
hr4lrate :
(1 + lambda) ^ 4 * r4l ≤ 96
hr4n :
0 ≤ r4n
hr4nrate :
(1 + nu) ^ 4 * r4n ≤ 96
lambda * ((ql * u⁻¹ + ql ^ 2) * (nu + nu ^ 2) * r4l + (qn * u⁻¹ + qn ^ 2) * r2n)
+ nu * ((qn * u⁻¹ + qn ^ 2) * (lambda + lambda ^ 2) * r4n + (ql * u⁻¹ + ql ^ 2) * r2l)
≤ (p * u⁻¹ + p ^ 2) * (2 * (8 * eps⁻¹ ^ 2 + 96 * (eps⁻¹ ^ 2 + eps⁻¹ ^ 3)) / (1 + w))
Proof (Lean source)
lemma poisson_inverse_marginal_energy_with_outcome_rates {eps p u w lambda nu ql qn r2l r2n r4l r4n : Real} (hu : 0 < u) (hp : 0 ≤ p) (hql : 0 ≤ ql) (hqn : 0 ≤ qn) (hqlp : ql ≤ p) (hqnp : qn ≤ p) (heps : 0 < eps) (heps1 : eps ≤ 1) (hw : 0 ≤ w) (hlambda : 0 ≤ lambda) (hnu : 0 ≤ nu) (hllower : eps * w ≤ lambda) (hnlower : eps * w ≤ nu) (hlupper : lambda ≤ w) (hnupper : nu ≤ w) (hr2l : 0 ≤ r2l) (hr2lrate : (1 + lambda) ^ 2 * r2l ≤ 8) (hr2n : 0 ≤ r2n) (hr2nrate : (1 + nu) ^ 2 * r2n ≤ 8) (hr4l : 0 ≤ r4l) (hr4lrate : (1 + lambda) ^ 4 * r4l ≤ 96) (hr4n : 0 ≤ r4n) (hr4nrate : (1 + nu) ^ 4 * r4n ≤ 96) : lambda * ((ql * u⁻¹ + ql ^ 2) * (nu + nu ^ 2) * r4l + (qn * u⁻¹ + qn ^ 2) * r2n) + nu * ((qn * u⁻¹ + qn ^ 2) * (lambda + lambda ^ 2) * r4n + (ql * u⁻¹ + ql ^ 2) * r2l) ≤ (p * u⁻¹ + p ^ 2) * (2 * (8 * eps⁻¹ ^ 2 + 96 * (eps⁻¹ ^ 2 + eps⁻¹ ^ 3)) / (1 + w)) := by have huinv : 0 ≤ u⁻¹ := inv_nonneg.mpr hu.le have hMl : ql * u⁻¹ + ql ^ 2 ≤ p * u⁻¹ + p ^ 2 := by nlinarith [mul_le_mul_of_nonneg_right hqlp huinv, sq_nonneg (p - ql)] have hMn : qn * u⁻¹ + qn ^ 2 ≤ p * u⁻¹ + p ^ 2 := by nlinarith [mul_le_mul_of_nonneg_right hqnp huinv, sq_nonneg (p - qn)] have hM0 : 0 ≤ p * u⁻¹ + p ^ 2 := by positivity have hbase := poisson_inverse_bidirectional_poincare_energy_scalar heps heps1 hw hlambda hnu hllower hnlower hlupper hnupper hr2l hr2lrate hr2n hr2nrate hr4l hr4lrate hr4n hr4nrate calc _ ≤ (p * u⁻¹ + p ^ 2) * ((lambda * (nu + nu ^ 2) * r4l + nu * r2l) + (nu * (lambda + lambda ^ 2) * r4n + lambda * r2n)) := by have hnu2 : 0 ≤ nu + nu ^ 2 := by positivity have hlambda2 : 0 ≤ lambda + lambda ^ 2 := by positivity nlinarith [mul_le_mul_of_nonneg_right hMl (mul_nonneg (mul_nonneg hlambda hnu2) hr4l), mul_le_mul_of_nonneg_right hMn (mul_nonneg hlambda hr2n), mul_le_mul_of_nonneg_right hMn (mul_nonneg (mul_nonneg hnu hlambda2) hr4n), mul_le_mul_of_nonneg_right hMl (mul_nonneg hnu hr2l)] _ ≤ _ := mul_le_mul_of_nonneg_left hbase hM0
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.poisson_inverse_marginal_energy_with_outcome_rates · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/PoissonInverseCountMarginalEnergy.lean:138
theorem poisson_inverse_marginal_cell_energy_bound

Rate-weighted marginal-count energy in one covariate cell. the stated conditions the stated conclusion.

Formal statement
d :
eps :
P :
hP :
ModelClass d eps P
u t :
hu :
0 < u
ht :
0 < t
heps :
0 < eps
heps1 :
eps ≤ 1
x :
Fin d
(∑ a : Bool, ((toNNReal (t * armMass P x a) : NNReal) : Real) * ∫ K, (nestedPairAddOneSnd x a (inverseCountStatistic u) K) ^ 2 ∂poissonCountLaw P u t)
≤ 4 * (8 * eps⁻¹ ^ 2 + 96 * (eps⁻¹ ^ 2 + eps⁻¹ ^ 3)) * (cellMass P x * u⁻¹ + cellMass P x ^ 2) / (1 + t * cellMass P x)
Proof (Lean source)
lemma poisson_inverse_marginal_cell_energy_bound {d : Nat} {eps : Real} (P : DiscreteLaw d) (hP : ModelClass d eps P) {u t : Real} (hu : 0 < u) (ht : 0 < t) (heps : 0 < eps) (heps1 : eps ≤ 1) (x : Fin d) : (∑ a : Bool, ((toNNReal (t * armMass P x a) : NNReal) : Real) * ∫ K, (nestedPairAddOneSnd x a (inverseCountStatistic u) K) ^ 2 ∂poissonCountLaw P u t) ≤ 4 * (8 * eps⁻¹ ^ 2 + 96 * (eps⁻¹ ^ 2 + eps⁻¹ ^ 3)) * (cellMass P x * u⁻¹ + cellMass P x ^ 2) / (1 + t * cellMass P x) := by classical let lS : Bool → NNReal := fun a ↦ toNNReal (u * markedMass P x a) let lK : Bool → NNReal := fun a ↦ toNNReal (t * armMass P x a) let r2 : Bool → Real := fun a ↦ ∫ n : Nat, ((((n + 1 : Nat) : Real)⁻¹) ^ 2) ∂poissonMeasure (lK a) let r4 : Bool → Real := fun a ↦ ∫ n : Nat, (((((n + 1 : Nat) : Real) * ((n + 2 : Nat) : Real)))⁻¹) ^ 2 ∂poissonMeasure (lK a) have hp0 : 0 ≤ cellMass P x := (cellMass_mem_unitInterval P x).1 have hs0 (a : Bool) : 0 ≤ armMass P x a := Finset.sum_nonneg fun y _ ↦ (jointMass_mem_unitInterval P x a y).1 have hsle (a : Bool) : armMass P x a ≤ cellMass P x := by have hsplit : armMass P x a + armMass P x (!a) = cellMass P x := by cases a <;> simp [armMass, cellMass] <;> ring linarith [hs0 (!a)] have hq0 (a : Bool) : 0 ≤ markedMass P x a := (jointMass_mem_unitInterval P x a true).1 have hqle (a : Bool) : markedMass P x a ≤ cellMass P x := by calc markedMass P x a ≤ armMass P x a := by simp [markedMass, armMass] exact (jointMass_mem_unitInterval P x a false).1 _ ≤ cellMass P x := hsle a have hlS (a : Bool) : ((lS a : NNReal) : Real) = u * markedMass P x a := by rw [Real.coe_toNNReal] exact mul_nonneg hu.le (hq0 a) have hlK (a : Bool) : ((lK a : NNReal) : Real) = t * armMass P x a := by rw [Real.coe_toNNReal] exact mul_nonneg ht.le (hs0 a) have hw : 0 ≤ t * cellMass P x := mul_nonneg ht.le hp0 have hKl (a : Bool) : eps * (t * cellMass P x) ≤ (lK a : Real) := by rw [hlK] have h := (overlap_armMass_bounds P hP.overlap x a).1 nlinarith [mul_le_mul_of_nonneg_left h ht.le] have hKu (a : Bool) : (lK a : Real) ≤ t * cellMass P x := by rw [hlK] exact mul_le_mul_of_nonneg_left (hsle a) ht.le have hr20 (a : Bool) : 0 ≤ r2 a := integral_nonneg fun _ ↦ sq_nonneg _ have hr40 (a : Bool) : 0 ≤ r4 a := integral_nonneg fun _ ↦ sq_nonneg _ have hr2rate (a : Bool) : (1 + (lK a : Real)) ^ 2 * r2 a ≤ 8 := by simpa [r2] using shifted_reciprocal_sq_bound (lK a) have hr4rate (a : Bool) : (1 + (lK a : Real)) ^ 4 * r4 a ≤ 96 := by simpa [r4] using shifted_reciprocal_pair_sq_bound (lK a) have hscalar := poisson_inverse_marginal_energy_with_outcome_rates (p := cellMass P x) (u := u) (w := t * cellMass P x) (lambda := (lK true : Real)) (nu := (lK false : Real)) (ql := markedMass P x true) (qn := markedMass P x false) (r2l := r2 true) (r2n := r2 false) (r4l := r4 true) (r4n := r4 false) hu hp0 (hq0 true) (hq0 false) (hqle true) (hqle false) heps heps1 hw (lK true).coe_nonneg (lK false).coe_nonneg (hKl true) (hKl false) (hKu true) (hKu false) (hr20 true) (hr2rate true) (hr20 false) (hr2rate false) (hr40 true) (hr4rate true) (hr40 false) (hr4rate false) have hmem := inverseCountStatistic_memLp_and_addOne P (t := t) hu have hD (a : Bool) : MemLp (nestedPairAddOneSnd x a (inverseCountStatistic u)) 2 (poissonCountLaw P u t) := by rw [poissonCountLaw_eq_nestedPairedPoissonMeasure] exact hmem.2.2 x a let cross : Bool → PoissonCounts d → Real := fun a K ↦ ((K x a).1 : Real) / u * ((K x (!a)).2 : Real) / ((((K x a).2 + 1 : Nat) : Real) * (((K x a).2 + 2 : Nat) : Real)) let recip : Bool → PoissonCounts d → Real := fun a K ↦ ((K x a).1 : Real) / u / (((K x a).2 + 1 : Nat) : Real) have hparts (a : Bool) (K : PoissonCounts d) : nestedPairAddOneSnd x a (inverseCountStatistic u) K = if a then -(cross true K + recip false K) else cross false K + recip true K := by rw [inverse_count_marginal_addOne u hu.ne' x a K] cases a <;> simp [cross, recip] <;> ring have hcross0 (a : Bool) (K : PoissonCounts d) : 0 ≤ cross a K := by dsimp [cross] positivity have hrecip0 (a : Bool) (K : PoissonCounts d) : 0 ≤ recip a K := by dsimp [recip] positivity have hcrossLp (a : Bool) : MemLp (cross a) 2 (poissonCountLaw P u t) := by refine (hD a).mono (measurable_of_countable _).aestronglyMeasurable ?_ filter_upwards with K rw [hparts] cases a <;> simp only [Bool.false_eq_true, ↓reduceIte, Bool.true_eq_false, norm_neg, Real.norm_eq_abs] · rw [abs_of_nonneg (hcross0 false K), abs_of_nonneg (add_nonneg (hcross0 false K) (hrecip0 true K))] linarith [hrecip0 true K] · rw [abs_of_nonneg (hcross0 true K), abs_of_nonneg (add_nonneg (hcross0 true K) (hrecip0 false K))] linarith [hrecip0 false K] have hrecipLp (a : Bool) : MemLp (recip a) 2 (poissonCountLaw P u t) := by refine (hD (!a)).mono (measurable_of_countable _).aestronglyMeasurable ?_ filter_upwards with K rw [hparts] cases a <;> simp only [Bool.not_false, Bool.not_true, Bool.false_eq_true, ↓reduceIte, Bool.true_eq_false, norm_neg, Real.norm_eq_abs] · rw [abs_of_nonneg (hrecip0 false K), abs_of_nonneg (add_nonneg (hcross0 true K) (hrecip0 false K))] linarith [hcross0 true K] · rw [abs_of_nonneg (hrecip0 true K), abs_of_nonneg (add_nonneg (hcross0 false K) (hrecip0 true K))] linarith [hcross0 false K] have hE (a : Bool) : (∫ K, (nestedPairAddOneSnd x a (inverseCountStatistic u) K) ^ 2 ∂poissonCountLaw P u t) ≤ 2 * ((∫ K, (cross a K) ^ 2 ∂poissonCountLaw P u t) + ∫ K, (recip (!a) K) ^ 2 ∂poissonCountLaw P u t) := by calc _ ≤ ∫ K, 2 * ((cross a K) ^ 2 + (recip (!a) K) ^ 2) ∂poissonCountLaw P u t := by apply integral_mono_ae (hD a).integrable_sq (((hcrossLp a).integrable_sq.add (hrecipLp (!a)).integrable_sq).const_mul 2) filter_upwards with K rw [hparts] cases a <;> simp only [Bool.not_false, Bool.not_true, Bool.false_eq_true, ↓reduceIte, Bool.true_eq_false, neg_sq] · exact add_sq_le · exact add_sq_le _ = _ := by rw [integral_const_mul, integral_add (hcrossLp a).integrable_sq (hrecipLp (!a)).integrable_sq] have hMS (a : Bool) : (∫ n : Nat, ((n : Real) / u) ^ 2 ∂poissonMeasure (lS a)) ≤ markedMass P x a * u⁻¹ + markedMass P x a ^ 2 := by have hm := poisson_natCast_second_moment_le (lS a) rw [show (fun n : Nat ↦ ((n : Real) / u) ^ 2) = fun n : Nat ↦ u⁻¹ ^ 2 * (n : Real) ^ 2 by funext n simp only [div_eq_mul_inv, mul_pow, inv_pow] ring, integral_const_mul] rw [hlS] at hm have huinv2 : 0 ≤ u⁻¹ ^ 2 := sq_nonneg _ calc u⁻¹ ^ 2 * ∫ n : Nat, (n : Real) ^ 2 ∂poissonMeasure (lS a) ≤ u⁻¹ ^ 2 * (u * markedMass P x a + (u * markedMass P x a) ^ 2) := mul_le_mul_of_nonneg_left hm huinv2 _ = markedMass P x a * u⁻¹ + markedMass P x a ^ 2 := by field_simp have hcrossMoment (a : Bool) : (∫ K, (cross a K) ^ 2 ∂poissonCountLaw P u t) = (∫ n : Nat, ((n : Real) / u) ^ 2 ∂poissonMeasure (lS a)) * (∫ n : Nat, (((((n + 1 : Nat) : Real) * ((n + 2 : Nat) : Real)))⁻¹) ^ 2 ∂poissonMeasure (lK a)) * ∫ n : Nat, (n : Real) ^ 2 ∂poissonMeasure (lK (!a)) := by calc _ = ∫ k : Bool → Nat × Nat, ((((k a).1 : Real) / u * ((k (!a)).2 : Real) / ((((k a).2 + 1 : Nat) : Real) * (((k a).2 + 2 : Nat) : Real))) ^ 2) ∂Measure.pi (fun b : Bool ↦ (poissonMeasure (lS b)).prod (poissonMeasure (lK b))) := by simpa [cross, lS, lK] using poissonCountLaw_integral_cell P u t x (fun k : Bool → Nat × Nat ↦ ((((k a).1 : Real) / u * ((k (!a)).2 : Real) / ((((k a).2 + 1 : Nat) : Real) * (((k a).2 + 2 : Nat) : Real))) ^ 2)) _ = _ := poisson_inverse_marginal_cross_square_moment lS lK u a have hrecipMoment (a : Bool) : (∫ K, (recip a K) ^ 2 ∂poissonCountLaw P u t) = (∫ n : Nat, ((n : Real) / u) ^ 2 ∂poissonMeasure (lS a)) * r2 a := by calc _ = ∫ k : Bool → Nat × Nat, ((((k a).1 : Real) / u / (((k a).2 + 1 : Nat) : Real)) ^ 2) ∂Measure.pi (fun b : Bool ↦ (poissonMeasure (lS b)).prod (poissonMeasure (lK b))) := by simpa [recip, lS, lK] using poissonCountLaw_integral_cell P u t x (fun k : Bool → Nat × Nat ↦ ((((k a).1 : Real) / u / (((k a).2 + 1 : Nat) : Real)) ^ 2)) _ = _ := by simpa [r2] using poisson_inverse_marginal_reciprocal_square_moment lS lK u a have hK2 (a : Bool) : (∫ n : Nat, (n : Real) ^ 2 ∂poissonMeasure (lK a)) ≤ (lK a : Real) + (lK a : Real) ^ 2 := poisson_natCast_second_moment_le (lK a) have hEa (a : Bool) : (∫ K, (nestedPairAddOneSnd x a (inverseCountStatistic u) K) ^ 2 ∂poissonCountLaw P u t) ≤ 2 * (((markedMass P x a * u⁻¹ + markedMass P x a ^ 2) * ((lK (!a) : Real) + (lK (!a) : Real) ^ 2) * r4 a) + (markedMass P x (!a) * u⁻¹ + markedMass P x (!a) ^ 2) * r2 (!a)) := by refine hE a |>.trans ?_ rw [hcrossMoment, hrecipMoment] have hMS0 (b : Bool) : 0 ≤ ∫ n : Nat, ((n : Real) / u) ^ 2 ∂poissonMeasure (lS b) := integral_nonneg fun _ ↦ sq_nonneg _ have hK20 (b : Bool) : 0 ≤ ∫ n : Nat, (n : Real) ^ 2 ∂poissonMeasure (lK b) := integral_nonneg fun _ ↦ sq_nonneg _ have hM0 (b : Bool) : 0 ≤ markedMass P x b * u⁻¹ + markedMass P x b ^ 2 := by exact add_nonneg (mul_nonneg (hq0 b) (inv_nonneg.mpr hu.le)) (sq_nonneg _) have hcross₁ : ((∫ n : Nat, ((n : Real) / u) ^ 2 ∂poissonMeasure (lS a)) * r4 a) * (∫ n : Nat, (n : Real) ^ 2 ∂poissonMeasure (lK (!a))) ≤ ((markedMass P x a * u⁻¹ + markedMass P x a ^ 2) * r4 a) * ((lK (!a) : Real) + (lK (!a) : Real) ^ 2) := by calc _ ≤ ((markedMass P x a * u⁻¹ + markedMass P x a ^ 2) * r4 a) * (∫ n : Nat, (n : Real) ^ 2 ∂poissonMeasure (lK (!a))) := by exact mul_le_mul_of_nonneg_right (mul_le_mul_of_nonneg_right (hMS a) (hr40 a)) (hK20 (!a)) _ ≤ _ := by exact mul_le_mul_of_nonneg_left (hK2 (!a)) (mul_nonneg (hM0 a) (hr40 a)) have hrecip₁ : (∫ n : Nat, ((n : Real) / u) ^ 2 ∂poissonMeasure (lS (!a))) * r2 (!a) ≤ (markedMass P x (!a) * u⁻¹ + markedMass P x (!a) ^ 2) * r2 (!a) := by exact mul_le_mul_of_nonneg_right (hMS (!a)) (hr20 (!a)) nlinarith [hcross₁, hrecip₁] change (∑ a : Bool, (lK a : Real) * ∫ K, (nestedPairAddOneSnd x a (inverseCountStatistic u) K) ^ 2 ∂poissonCountLaw P u t) ≤ _ rw [Fintype.sum_bool] have hrate0 (a : Bool) : 0 ≤ (lK a : Real) := (lK a).coe_nonneg calc (lK true : Real) * (∫ K, (nestedPairAddOneSnd x true (inverseCountStatistic u) K) ^ 2 ∂poissonCountLaw P u t) + (lK false : Real) * (∫ K, (nestedPairAddOneSnd x false (inverseCountStatistic u) K) ^ 2 ∂poissonCountLaw P u t) ≤ (lK true : Real) * (2 * (((markedMass P x true * u⁻¹ + markedMass P x true ^ 2) * ((lK false : Real) + (lK false : Real) ^ 2) * r4 true) + (markedMass P x false * u⁻¹ + markedMass P x false ^ 2) * r2 false)) + (lK false : Real) * (2 * (((markedMass P x false * u⁻¹ + markedMass P x false ^ 2) * ((lK true : Real) + (lK true : Real) ^ 2) * r4 false) + (markedMass P x true * u⁻¹ + markedMass P x true ^ 2) * r2 true)) := by gcongr · exact hEa true · exact hEa false _ ≤ 2 * ((cellMass P x * u⁻¹ + cellMass P x ^ 2) * (2 * (8 * eps⁻¹ ^ 2 + 96 * (eps⁻¹ ^ 2 + eps⁻¹ ^ 3)) / (1 + t * cellMass P x))) := by nlinarith [hscalar] _ = _ := by ring
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.poisson_inverse_marginal_cell_energy_bound · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/PoissonInverseCountMarginalEnergy.lean:184
theorem poisson_inverse_count_risk Lemma 2 in the paper ↗

Uniform bias and variance bounds for the independent Poisson inverse-count statistic. the stated conditions the stated conclusion.

Formal statement
eps :
heps :
0 < eps
heps2 :
eps < 1 / 2
∃ C : Real,
0 < C
conclusion 1
d :
u t :
0 < u
0 < t
P :
ModelClass d eps P
varianceUnder (poissonCountLaw P u t) (inverseCountStatistic u) ≤ C * (u⁻¹ + t⁻¹)
Proof (Lean source)
lemma poisson_inverse_count_risk {eps : Real} (heps : 0 < eps) (heps2 : eps < 1 / 2) : ∃ C : Real, 0 < C ∧ ∀ (d : Nat) (u t : Real), 0 < u → 0 < t → ∀ (P : DiscreteLaw d), ModelClass d eps P → |expectationUnder (poissonCountLaw P u t) (inverseCountStatistic u) - ateFunctional P| ≤ C * min 1 (d / t) ∧ varianceUnder (poissonCountLaw P u t) (inverseCountStatistic u) ≤ C * (u⁻¹ + t⁻¹) := by let A : Real := 1 + 10 * eps⁻¹ + 8 * eps⁻¹ ^ 2 let B : Real := 8 * eps⁻¹ ^ 2 + 96 * (eps⁻¹ ^ 2 + eps⁻¹ ^ 3) let D : Real := 2 * max 1 (eps * exp 1)⁻¹ let C : Real := D + A + 4 * B + 1 have heps1 : eps ≤ 1 := by linarith have hepsinv : 0 < eps⁻¹ := inv_pos.mpr heps have hA : 0 < A := by dsimp [A]; positivity have hB : 0 < B := by dsimp [B]; positivity have hD : 0 < D := by dsimp [D] have : 0 < max 1 (eps * exp 1)⁻¹ := lt_of_lt_of_le zero_lt_one (le_max_left _ _) positivity refine ⟨C, by dsimp [C]; positivity, ?_⟩ intro d u t hu ht P hP constructor · calc |expectationUnder (poissonCountLaw P u t) (inverseCountStatistic u) - ateFunctional P| ≤ 2 * min 1 (d / (eps * exp 1 * t)) := poisson_inverse_count_bias_of_expectation_eq P hP hu ht heps (poisson_inverse_count_expectation_eq_arm_means P hu) _ ≤ D * min 1 (d / t) := by exact poisson_bias_min_rescale d heps ht _ ≤ C * min 1 (d / t) := by have hmin : 0 ≤ min 1 ((d : Real) / t) := by positivity apply mul_le_mul_of_nonneg_right _ hmin dsimp [C] nlinarith [hA, hB] · let lambdaS : Fin d → Bool → NNReal := fun x a ↦ toNNReal (u * markedMass P x a) let lambdaK : Fin d → Bool → NNReal := fun x a ↦ toNNReal (t * armMass P x a) have hmem := inverseCountStatistic_memLp_and_addOne P (t := t) hu have hpoinc := nestedPairedPoisson_addOne_poincare lambdaS lambdaK (inverseCountStatistic u) hmem.1 hmem.2.1 hmem.2.2 have hF : MemLp (inverseCountStatistic u) 2 (poissonCountLaw P u t) := by rw [poissonCountLaw_eq_nestedPairedPoissonMeasure] exact hmem.1 have hvar : varianceUnder (poissonCountLaw P u t) (inverseCountStatistic u) ≤ ∑ x : Fin d, ∑ a : Bool, (((lambdaS x a : NNReal) : Real) * ∫ K, (nestedPairAddOneFst x a (inverseCountStatistic u) K) ^ 2 ∂poissonCountLaw P u t + ((lambdaK x a : NNReal) : Real) * ∫ K, (nestedPairAddOneSnd x a (inverseCountStatistic u) K) ^ 2 ∂poissonCountLaw P u t) := by rw [varianceUnder_eq_variance _ _ hF.aemeasurable, poissonCountLaw_eq_nestedPairedPoissonMeasure] simpa [lambdaS, lambdaK] using hpoinc have hmarkedCell (x : Fin d) : (∑ a : Bool, markedMass P x a) ≤ cellMass P x := by simp [markedMass, cellMass] nlinarith [show 0 ≤ jointMass P x false false from (jointMass_mem_unitInterval P x false false).1, show 0 ≤ jointMass P x true false from (jointMass_mem_unitInterval P x true false).1] have hmarkedSum : (∑ x : Fin d, ∑ a : Bool, markedMass P x a) ≤ 1 := by calc _ ≤ ∑ x : Fin d, cellMass P x := Finset.sum_le_sum fun x _ ↦ hmarkedCell x _ = 1 := cellMass_sum_eq_one_annotation P have houtcome : (∑ x : Fin d, ∑ a : Bool, ((lambdaS x a : NNReal) : Real) * ∫ K, (nestedPairAddOneFst x a (inverseCountStatistic u) K) ^ 2 ∂poissonCountLaw P u t) ≤ A * u⁻¹ := by calc _ ≤ ∑ x : Fin d, ∑ a : Bool, A * markedMass P x a * u⁻¹ := by apply Finset.sum_le_sum intro x _ apply Finset.sum_le_sum intro a _ exact poisson_inverse_outcome_coordinate_energy_bound P hP hu ht heps x a _ = A * u⁻¹ * (∑ x : Fin d, ∑ a : Bool, markedMass P x a) := by rw [Finset.mul_sum] apply Finset.sum_congr rfl intro x _ rw [Finset.mul_sum] apply Finset.sum_congr rfl intro a _ ring _ ≤ A * u⁻¹ := by have hAu : 0 ≤ A * u⁻¹ := mul_nonneg hA.le (inv_nonneg.mpr hu.le) nlinarith [mul_le_mul_of_nonneg_left hmarkedSum hAu] have hmarginalCell (x : Fin d) : (∑ a : Bool, ((lambdaK x a : NNReal) : Real) * ∫ K, (nestedPairAddOneSnd x a (inverseCountStatistic u) K) ^ 2 ∂poissonCountLaw P u t) ≤ 4 * B * (cellMass P x * u⁻¹ + cellMass P x ^ 2) / (1 + t * cellMass P x) := by simpa [lambdaK, B] using poisson_inverse_marginal_cell_energy_bound P hP hu ht heps heps1 x have hp (x : Fin d) : 0 ≤ cellMass P x := (cellMass_mem_unitInterval P x).1 have hcell := poisson_cell_variance_sum_bound (fun x : Fin d ↦ cellMass P x) ht hp (cellMass_sum_eq_one_annotation P) have hmarginal : (∑ x : Fin d, ∑ a : Bool, ((lambdaK x a : NNReal) : Real) * ∫ K, (nestedPairAddOneSnd x a (inverseCountStatistic u) K) ^ 2 ∂poissonCountLaw P u t) ≤ 4 * B * (u⁻¹ + t⁻¹) := by calc _ ≤ ∑ x : Fin d, 4 * B * (cellMass P x * u⁻¹ + cellMass P x ^ 2) / (1 + t * cellMass P x) := Finset.sum_le_sum fun x _ ↦ hmarginalCell x _ ≤ ∑ x : Fin d, 4 * B * (cellMass P x * u⁻¹ + cellMass P x ^ 2 / (1 + t * cellMass P x)) := by apply Finset.sum_le_sum intro x _ have hden : 1 ≤ 1 + t * cellMass P x := by nlinarith [mul_nonneg ht.le (hp x)] have hpu : 0 ≤ cellMass P x * u⁻¹ := mul_nonneg (hp x) (inv_nonneg.mpr hu.le) have hfrac : (cellMass P x * u⁻¹ + cellMass P x ^ 2) / (1 + t * cellMass P x) ≤ cellMass P x * u⁻¹ + cellMass P x ^ 2 / (1 + t * cellMass P x) := by rw [add_div] have := div_le_self hpu hden linarith calc 4 * B * (cellMass P x * u⁻¹ + cellMass P x ^ 2) / (1 + t * cellMass P x) = 4 * B * ((cellMass P x * u⁻¹ + cellMass P x ^ 2) / (1 + t * cellMass P x)) := by ring _ ≤ _ := mul_le_mul_of_nonneg_left hfrac (by positivity) _ = 4 * B * (u⁻¹ * (∑ x : Fin d, cellMass P x) + ∑ x : Fin d, cellMass P x ^ 2 / (1 + t * cellMass P x)) := by rw [← Finset.mul_sum, Finset.sum_add_distrib] congr 2 rw [Finset.mul_sum] apply Finset.sum_congr rfl intro x _ ring _ ≤ 4 * B * (u⁻¹ + t⁻¹) := by rw [cellMass_sum_eq_one_annotation P, mul_one] apply mul_le_mul_of_nonneg_left _ (by positivity) simpa [add_comm] using add_le_add_left hcell u⁻¹ calc varianceUnder (poissonCountLaw P u t) (inverseCountStatistic u) ≤ (∑ x : Fin d, ∑ a : Bool, ((lambdaS x a : NNReal) : Real) * ∫ K, (nestedPairAddOneFst x a (inverseCountStatistic u) K) ^ 2 ∂poissonCountLaw P u t) + (∑ x : Fin d, ∑ a : Bool, ((lambdaK x a : NNReal) : Real) * ∫ K, (nestedPairAddOneSnd x a (inverseCountStatistic u) K) ^ 2 ∂poissonCountLaw P u t) := by refine hvar.trans_eq ?_ rw [← Finset.sum_add_distrib] apply Finset.sum_congr rfl intro x _ rw [← Finset.sum_add_distrib] _ ≤ A * u⁻¹ + 4 * B * (u⁻¹ + t⁻¹) := add_le_add houtcome hmarginal _ ≤ C * (u⁻¹ + t⁻¹) := by have huinv : 0 ≤ u⁻¹ := inv_nonneg.mpr hu.le have htinv : 0 ≤ t⁻¹ := inv_nonneg.mpr ht.le dsimp [C] nlinarith [hD, hA, hB]
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.poisson_inverse_count_risk · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/PoissonInverseCountMarginalEnergy.lean:436
CausalSmith.Stat.STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research.Helpers.PoissonInverseCountRiskAssembly 13 declarations Final expectation and variance assembly for the inverse-count statistic.

Final expectation and variance assembly for the inverse-count statistic.

theorem poisson_inverse_arm_mean_formula Lemma 8 in the paper ↗

Exact model-specific mean of one arm's inverse-count contribution. the stated conditions the stated conclusion.

Formal statement
d :
P :
x :
Fin d
a :
u t :
hu :
0 < u
ht :
0 < t
lambdaS :
fun b ↦ toNNReal (u * markedMass P x b) (: Bool → NNReal)
lambdaK :
fun b ↦ toNNReal (t * armMass P x b) (: Bool → NNReal)
((lambdaS a : Real) / u) * (∫ z : Nat × Nat, (1 + (z.2 : Real) * (((z.1 + 1 : Nat) : Real))⁻¹) ∂(poissonMeasure (lambdaK a)).prod (poissonMeasure (lambdaK (!a))))
= cellMass P x * outcomeMean P a x
- (cellMass P x - armMass P x a) * outcomeMean P a x * exp (-(t * armMass P x a))
Proof (Lean source)
lemma poisson_inverse_arm_mean_formula {d : Nat} (P : DiscreteLaw d) (x : Fin d) (a : Bool) {u t : Real} (hu : 0 < u) (ht : 0 < t) : let lambdaS : Bool → NNReal := fun b ↦ toNNReal (u * markedMass P x b) let lambdaK : Bool → NNReal := fun b ↦ toNNReal (t * armMass P x b) ((lambdaS a : Real) / u) * (∫ z : Nat × Nat, (1 + (z.2 : Real) * (((z.1 + 1 : Nat) : Real))⁻¹) ∂(poissonMeasure (lambdaK a)).prod (poissonMeasure (lambdaK (!a)))) = cellMass P x * outcomeMean P a x - (cellMass P x - armMass P x a) * outcomeMean P a x * exp (-(t * armMass P x a)) := by dsimp only have hs0 : 0 ≤ armMass P x a := by exact Finset.sum_nonneg fun y _ ↦ (jointMass_mem_unitInterval P x a y).1 have hso0 : 0 ≤ armMass P x (!a) := by exact Finset.sum_nonneg fun y _ ↦ (jointMass_mem_unitInterval P x (!a) y).1 have hq0 : 0 ≤ markedMass P x a := (jointMass_mem_unitInterval P x a true).1 have hp_split : armMass P x a + armMass P x (!a) = cellMass P x := by cases a <;> simp [armMass, cellMass] <;> ring have hrateS : ((toNNReal (u * markedMass P x a) : NNReal) : Real) = u * markedMass P x a := by rw [Real.coe_toNNReal] positivity have hrateK : ((toNNReal (t * armMass P x a) : NNReal) : Real) = t * armMass P x a := by rw [Real.coe_toNNReal] positivity have hrateKo : ((toNNReal (t * armMass P x (!a)) : NNReal) : Real) = t * armMass P x (!a) := by rw [Real.coe_toNNReal] positivity let w : Real := ∫ z : Nat × Nat, (1 + (z.2 : Real) * (((z.1 + 1 : Nat) : Real))⁻¹) ∂(poissonMeasure (toNNReal (t * armMass P x a))).prod (poissonMeasure (toNNReal (t * armMass P x (!a)))) have hw : (t * armMass P x a) * w = t * armMass P x a + t * (cellMass P x - armMass P x a) * (1 - exp (-(t * armMass P x a))) := by have h := poisson_inverse_weight_mean_mul_rate (toNNReal (t * armMass P x a)) (toNNReal (t * armMass P x (!a))) rw [hrateK, hrateKo] at h dsimp [w] rw [← hp_split] convert h using 1 <;> ring rw [hrateS] rw [markedMass_eq_armMass_mul_outcomeMean] change (u * (armMass P x a * outcomeMean P a x) / u) * w = _ rw [mul_div_cancel_left₀ _ hu.ne'] exact poisson_inverse_arm_expectation_scalar ht hw
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.poisson_inverse_arm_mean_formula · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/PoissonInverseCountRiskAssembly.lean:15
theorem poisson_inverse_arm_mean_envelope

The exact arm mean has the exponential missing-cell envelope under overlap. the stated conditions the stated conclusion.

Formal statement
d :
eps :
P :
hP :
ModelClass d eps P
x :
Fin d
a :
u t :
hu :
0 < u
ht :
0 < t
heps :
0 < eps
lambdaS :
fun b ↦ toNNReal (u * markedMass P x b) (: Bool → NNReal)
lambdaK :
fun b ↦ toNNReal (t * armMass P x b) (: Bool → NNReal)
|((lambdaS a : Real) / u) * (∫ z : Nat × Nat, (1 + (z.2 : Real) * (((z.1 + 1 : Nat) : Real))⁻¹) ∂(poissonMeasure (lambdaK a)).prod (poissonMeasure (lambdaK (!a))))
- cellMass P x * outcomeMean P a x|
≤ cellMass P x * exp (-eps * t * cellMass P x)
Proof (Lean source)
lemma poisson_inverse_arm_mean_envelope {d : Nat} {eps : Real} (P : DiscreteLaw d) (hP : ModelClass d eps P) (x : Fin d) (a : Bool) {u t : Real} (hu : 0 < u) (ht : 0 < t) (heps : 0 < eps) : let lambdaS : Bool → NNReal := fun b ↦ toNNReal (u * markedMass P x b) let lambdaK : Bool → NNReal := fun b ↦ toNNReal (t * armMass P x b) |((lambdaS a : Real) / u) * (∫ z : Nat × Nat, (1 + (z.2 : Real) * (((z.1 + 1 : Nat) : Real))⁻¹) ∂(poissonMeasure (lambdaK a)).prod (poissonMeasure (lambdaK (!a)))) - cellMass P x * outcomeMean P a x| ≤ cellMass P x * exp (-eps * t * cellMass P x) := by dsimp only have hb := overlap_armMass_bounds P hP.overlap x a have hp0 := (cellMass_mem_unitInterval P x).1 have hs0 : 0 ≤ armMass P x a := by exact Finset.sum_nonneg fun y _ ↦ (jointMass_mem_unitInterval P x a y).1 have hsle : armMass P x a ≤ cellMass P x := by nlinarith [hb.2] apply poisson_inverse_arm_bias_envelope ht hp0 hs0 hsle (outcomeMean_mem_unitInterval P a x) hb.1 exact poisson_inverse_arm_mean_formula P x a hu ht
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.poisson_inverse_arm_mean_envelope · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/PoissonInverseCountRiskAssembly.lean:70
theorem poisson_inverse_arm_means_bias_aggregate

Summing the exact arm means gives the paper's uniform inverse-count bias bound before the overlap-dependent factor is absorbed into the final constant. the stated conditions the stated conclusion.

Formal statement
d :
eps :
P :
hP :
ModelClass d eps P
u t :
hu :
0 < u
ht :
0 < t
heps :
0 < eps
armMean :
fun x a ↦ let lambdaS : Bool → NNReal := fun b ↦ toNNReal (u * markedMass P x b) let lambdaK : Bool → NNReal := fun b ↦ toNNReal (t * armMass P x b) ((lambdaS a : Real) / u) * (∫ z : Nat × Nat, (1 + (z.2 : Real) * (((z.1 + 1 : Nat) : Real))⁻¹) ∂(poissonMeasure (lambdaK a)).prod (poissonMeasure (lambdaK (!a)))) (: Fin d → Bool → Real)
|∑ x, (armMean x true - armMean x false) - ateFunctional P|
≤ 2 * min 1 (d / (eps * exp 1 * t))
Proof (Lean source)
lemma poisson_inverse_arm_means_bias_aggregate {d : Nat} {eps : Real} (P : DiscreteLaw d) (hP : ModelClass d eps P) {u t : Real} (hu : 0 < u) (ht : 0 < t) (heps : 0 < eps) : let armMean : Fin d → Bool → Real := fun x a ↦ let lambdaS : Bool → NNReal := fun b ↦ toNNReal (u * markedMass P x b) let lambdaK : Bool → NNReal := fun b ↦ toNNReal (t * armMass P x b) ((lambdaS a : Real) / u) * (∫ z : Nat × Nat, (1 + (z.2 : Real) * (((z.1 + 1 : Nat) : Real))⁻¹) ∂(poissonMeasure (lambdaK a)).prod (poissonMeasure (lambdaK (!a)))) |∑ x, (armMean x true - armMean x false) - ateFunctional P| ≤ 2 * min 1 (d / (eps * exp 1 * t)) := by dsimp only let g : Fin d → Bool → Real := fun x a ↦ ((toNNReal (u * markedMass P x a) : NNReal) : Real) / u * (∫ z : Nat × Nat, (1 + (z.2 : Real) * (((z.1 + 1 : Nat) : Real))⁻¹) ∂(poissonMeasure (toNNReal (t * armMass P x a))).prod (poissonMeasure (toNNReal (t * armMass P x (!a))))) have hg : ∀ x a, |g x a - cellMass P x * outcomeMean P a x| ≤ cellMass P x * exp (-eps * t * cellMass P x) := by intro x a exact poisson_inverse_arm_mean_envelope P hP x a hu ht heps simpa [g] using inverse_count_bias_aggregate P heps ht g hg
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.poisson_inverse_arm_means_bias_aggregate · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/PoissonInverseCountRiskAssembly.lean:96
def poissonInverseArmMean

The scalar arm contribution appearing in the exact expectation assembly. the stated conditions the stated conclusion.

Definition (Lean source)
d :
P :
u t :
x :
Fin d
a :
poissonInverseArmMean P u t x a :
lambdaS :
fun b ↦ toNNReal (u * markedMass P x b) (: Bool → NNReal)
lambdaK :
fun b ↦ toNNReal (t * armMass P x b) (: Bool → NNReal)
((lambdaS a : Real) / u) * (∫ z : Nat × Nat, (1 + (z.2 : Real) * (((z.1 + 1 : Nat) : Real))⁻¹) ∂(poissonMeasure (lambdaK a)).prod (poissonMeasure (lambdaK (!a))))
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.poissonInverseArmMean · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/PoissonInverseCountRiskAssembly.lean:127
theorem nestedPaired_count_fst_le_total_annotation Lemma nestedPaired_count_fst_le_total_annotation in the paper ↗

The formal statement establishes the stated conclusion.

Formal statement
d :
x :
Fin d
a :
(K x a).1 ≤ nestedPairedTotalCount K
Proof (Lean source)
lemma nestedPaired_count_fst_le_total_annotation {d : Nat} (K : PoissonCounts d) (x : Fin d) (a : Bool) : (K x a).1 ≤ nestedPairedTotalCount K := by dsimp [nestedPairedTotalCount] calc (K x a).1 ≤ (K x a).1 + (K x a).2 := le_add_right _ _ _ ≤ ∑ b, ((K x b).1 + (K x b).2) := Finset.single_le_sum (f := fun b : Bool ↦ (K x b).1 + (K x b).2) (fun _ _ ↦ zero_le _) (Finset.mem_univ a) _ ≤ ∑ i, ∑ b, ((K i b).1 + (K i b).2) := Finset.single_le_sum (f := fun i : Fin d ↦ ∑ b, ((K i b).1 + (K i b).2)) (fun _ _ ↦ Finset.sum_nonneg fun _ _ ↦ zero_le _) (Finset.mem_univ x)
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.nestedPaired_count_fst_le_total_annotation · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/PoissonInverseCountRiskAssembly.lean:140
theorem nestedPaired_count_snd_le_total_annotation Lemma nestedPaired_count_snd_le_total_annotation in the paper ↗

The formal statement establishes the stated conclusion.

Formal statement
d :
x :
Fin d
a :
(K x a).2 ≤ nestedPairedTotalCount K
Proof (Lean source)
lemma nestedPaired_count_snd_le_total_annotation {d : Nat} (K : PoissonCounts d) (x : Fin d) (a : Bool) : (K x a).2 ≤ nestedPairedTotalCount K := by dsimp [nestedPairedTotalCount] calc (K x a).2 ≤ (K x a).1 + (K x a).2 := Nat.le_add_left _ _ _ ≤ ∑ b, ((K x b).1 + (K x b).2) := Finset.single_le_sum (f := fun b : Bool ↦ (K x b).1 + (K x b).2) (fun _ _ ↦ zero_le _) (Finset.mem_univ a) _ ≤ ∑ i, ∑ b, ((K i b).1 + (K i b).2) := Finset.single_le_sum (f := fun i : Fin d ↦ ∑ b, ((K i b).1 + (K i b).2)) (fun _ _ ↦ Finset.sum_nonneg fun _ _ ↦ zero_le _) (Finset.mem_univ x)
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.nestedPaired_count_snd_le_total_annotation · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/PoissonInverseCountRiskAssembly.lean:157
theorem poisson_inverse_weight_mean Lemma poisson_inverse_weight_mean in the paper ↗

The formal statement establishes the stated conclusion.

Formal statement
lambda nu :
(∫ z : Nat × Nat, (1 + (z.2 : Real) * (((z.1 + 1 : Nat) : Real))⁻¹) ∂(poissonMeasure lambda).prod (poissonMeasure nu))
= 1 + (nu : Real) * ∫ k : Nat, (((k + 1 : Nat) : Real))⁻¹ ∂poissonMeasure lambda
Proof (Lean source)
lemma poisson_inverse_weight_mean (lambda nu : NNReal) : (∫ z : Nat × Nat, (1 + (z.2 : Real) * (((z.1 + 1 : Nat) : Real))⁻¹) ∂(poissonMeasure lambda).prod (poissonMeasure nu)) = 1 + (nu : Real) * ∫ k : Nat, (((k + 1 : Nat) : Real))⁻¹ ∂poissonMeasure lambda := by let r : Nat → Real := fun k ↦ (((k + 1 : Nat) : Real))⁻¹ have hr : Integrable r (poissonMeasure lambda) := (shifted_reciprocal_memLp_two lambda).integrable (by norm_num) have hk : Integrable (fun k : Nat ↦ (k : Real)) (poissonMeasure nu) := (poisson_natCast_memLp_two nu).integrable (by norm_num) have hcross : Integrable (fun z : Nat × Nat ↦ (z.2 : Real) * r z.1) ((poissonMeasure lambda).prod (poissonMeasure nu)) := by apply (hr.mul_prod hk).congr filter_upwards with z simp [mul_comm] rw [integral_add (integrable_const 1) hcross] rw [show (∫ z : Nat × Nat, (z.2 : Real) * r z.1 ∂(poissonMeasure lambda).prod (poissonMeasure nu)) = (∫ k, r k ∂poissonMeasure lambda) * ∫ k : Nat, (k : Real) ∂poissonMeasure nu by simpa [mul_comm] using integral_prod_mul r (fun k : Nat ↦ (k : Real))] rw [poisson_natCast_first_moment] simp simpa [r, Nat.cast_add, Nat.cast_one] using mul_comm (∫ k : Nat, (((k : Real) + 1))⁻¹ ∂poissonMeasure lambda) (nu : Real)
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.poisson_inverse_weight_mean · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/PoissonInverseCountRiskAssembly.lean:174
theorem poisson_inverse_count_expectation_eq_arm_means

Product-measure factorization identifies the expectation of the full inverse-count statistic with the sum of its scalar arm means. the stated conditions establishes the stated conclusion.

Formal statement
d :
P :
u t :
hu :
0 < u
Proof (Lean source)
-- @node: poisson_inverse_count_expectation_eq_arm_means lemma poisson_inverse_count_expectation_eq_arm_means {d : Nat} (P : DiscreteLaw d) {u t : Real} (hu : 0 < u) : expectationUnder (poissonCountLaw P u t) (inverseCountStatistic u) = ∑ x, (poissonInverseArmMean P u t x true - poissonInverseArmMean P u t x false) := by classical let lambdaS : Fin d → Bool → NNReal := fun x a ↦ toNNReal (u * markedMass P x a) let lambdaK : Fin d → Bool → NNReal := fun x a ↦ toNNReal (t * armMass P x a) have hbaseInt (x : Fin d) (a : Bool) : Integrable (fun K : PoissonCounts d ↦ ((K x a).1 : Real) / u) (poissonCountLaw P u t) := by rw [poissonCountLaw_eq_nestedPairedPoissonMeasure] letI : IsProbabilityMeasure (nestedPairedPoissonMeasure (fun x a ↦ toNNReal (u * markedMass P x a)) (fun x a ↦ toNNReal (t * armMass P x a))) := by unfold nestedPairedPoissonMeasure infer_instance apply (memLp_nestedPairedPoisson_of_polynomial_bound (fun x a ↦ toNNReal (u * markedMass P x a)) (fun x a ↦ toNNReal (t * armMass P x a)) (fun K : PoissonCounts d ↦ ((K x a).1 : Real) / u) (measurable_of_countable _) |u⁻¹| 2 ?_).integrable (by norm_num) intro K have hcoord : ((K x a).1 : Real) ≤ nestedPairedTotalCount K := by exact_mod_cast nestedPaired_count_fst_le_total_annotation K x a have htotal : 0 ≤ (nestedPairedTotalCount K : Real) := by positivity rw [div_eq_mul_inv, abs_mul, abs_of_nonneg (by positivity : 0 ≤ ((K x a).1 : Real))] have hpoly : (nestedPairedTotalCount K : Real) ≤ (1 + (nestedPairedTotalCount K : Real)) ^ 2 := by nlinarith [sq_nonneg (nestedPairedTotalCount K : Real)] calc ((K x a).1 : Real) * |u⁻¹| ≤ (nestedPairedTotalCount K : Real) * |u⁻¹| := by gcongr _ ≤ |u⁻¹| * (1 + (nestedPairedTotalCount K : Real)) ^ 2 := by rw [mul_comm] exact mul_le_mul_of_nonneg_left hpoly (abs_nonneg _) have hcrossInt (x : Fin d) (a : Bool) : Integrable (fun K : PoissonCounts d ↦ ((K x a).1 : Real) / u * ((K x (!a)).2 : Real) * (((K x a).2 + 1 : Nat) : Real)⁻¹) (poissonCountLaw P u t) := by rw [poissonCountLaw_eq_nestedPairedPoissonMeasure] letI : IsProbabilityMeasure (nestedPairedPoissonMeasure (fun x a ↦ toNNReal (u * markedMass P x a)) (fun x a ↦ toNNReal (t * armMass P x a))) := by unfold nestedPairedPoissonMeasure infer_instance apply (memLp_nestedPairedPoisson_of_polynomial_bound (fun x a ↦ toNNReal (u * markedMass P x a)) (fun x a ↦ toNNReal (t * armMass P x a)) (fun K : PoissonCounts d ↦ ((K x a).1 : Real) / u * ((K x (!a)).2 : Real) * (((K x a).2 + 1 : Nat) : Real)⁻¹) (measurable_of_countable _) |u⁻¹| 2 ?_).integrable (by norm_num) intro K have hfst : ((K x a).1 : Real) ≤ nestedPairedTotalCount K := by exact_mod_cast nestedPaired_count_fst_le_total_annotation K x a have hsnd : ((K x (!a)).2 : Real) ≤ nestedPairedTotalCount K := by exact_mod_cast nestedPaired_count_snd_le_total_annotation K x (!a) have htotal : 0 ≤ (nestedPairedTotalCount K : Real) := by positivity have hinv : |((((K x a).2 + 1 : Nat) : Real))⁻¹| ≤ 1 := by rw [abs_of_nonneg (inv_nonneg.mpr (by positivity))] exact inv_le_one_of_one_le₀ (by exact_mod_cast Nat.le_add_left 1 (K x a).2) simp only [div_eq_mul_inv, abs_mul] rw [abs_of_nonneg (by positivity : 0 ≤ ((K x a).1 : Real)), abs_of_nonneg (by positivity : 0 ≤ ((K x (!a)).2 : Real))] calc ((K x a).1 : Real) * |u⁻¹| * ((K x (!a)).2 : Real) * |((((K x a).2 + 1 : Nat) : Real))⁻¹| ≤ (nestedPairedTotalCount K : Real) * |u⁻¹| * (nestedPairedTotalCount K : Real) * 1 := by gcongr _ ≤ |u⁻¹| * (1 + (nestedPairedTotalCount K : Real)) ^ 2 := by have hsq : (nestedPairedTotalCount K : Real) ^ 2 ≤ (1 + (nestedPairedTotalCount K : Real)) ^ 2 := by nlinarith rw [mul_one] calc (nestedPairedTotalCount K : Real) * |u⁻¹| * (nestedPairedTotalCount K : Real) = |u⁻¹| * (nestedPairedTotalCount K : Real) ^ 2 := by ring _ ≤ _ := mul_le_mul_of_nonneg_left hsq (abs_nonneg _) have harmInt (x : Fin d) (a : Bool) : Integrable (fun K : PoissonCounts d ↦ ((K x a).1 : Real) / u * (((K x false).2 + (K x true).2 + 1 : Nat) : Real) / (((K x a).2 + 1 : Nat) : Real)) (poissonCountLaw P u t) := by refine ((hbaseInt x a).add (hcrossInt x a)).congr ?_ filter_upwards with K cases a <;> simp only [Bool.not_false, Bool.not_true] all_goals change ((K x _).1 : Real) / u + ((K x _).1 : Real) / u * ((K x _).2 : Real) * (((K x _).2 + 1 : Nat) : Real)⁻¹ = _ push_cast field_simp [hu.ne'] ring have harm (x : Fin d) (a : Bool) : (∫ K, ((K x a).1 : Real) / u * (((K x false).2 + (K x true).2 + 1 : Nat) : Real) / (((K x a).2 + 1 : Nat) : Real) ∂poissonCountLaw P u t) = poissonInverseArmMean P u t x a := by have hout := poisson_inverse_outcome_mean (lambdaS x) (lambdaK x) u a have hcross := poisson_inverse_cross_moment (lambdaS x) (lambdaK x) u a simp only [lambdaS, lambdaK] at hout hcross rw [poissonInverseArmMean] calc (∫ K, ((K x a).1 : Real) / u * (((K x false).2 + (K x true).2 + 1 : Nat) : Real) / (((K x a).2 + 1 : Nat) : Real) ∂poissonCountLaw P u t) = (∫ K, ((K x a).1 : Real) / u ∂poissonCountLaw P u t) + ∫ K, ((K x a).1 : Real) / u * ((K x (!a)).2 : Real) * (((K x a).2 + 1 : Nat) : Real)⁻¹ ∂poissonCountLaw P u t := by rw [← integral_add (hbaseInt x a) (hcrossInt x a)] apply integral_congr_ae filter_upwards with K cases a <;> simp only [Bool.not_false, Bool.not_true] all_goals push_cast; field_simp <;> ring _ = _ := by have hb := poissonCountLaw_integral_cell P u t x (fun k : Bool → Nat × Nat ↦ ((k a).1 : Real) / u) have hc := poissonCountLaw_integral_cell P u t x (fun k : Bool → Nat × Nat ↦ ((k a).1 : Real) / u * ((k (!a)).2 : Real) * (((k a).2 + 1 : Nat) : Real)⁻¹) rw [hb, hc, hout, hcross, poisson_inverse_weight_mean] ring change (∫ K, ∑ x : Fin d, (((K x true).1 : Real) / u * (((K x false).2 + (K x true).2 + 1 : Nat) : Real) / (((K x true).2 + 1 : Nat) : Real) - ((K x false).1 : Real) / u * (((K x false).2 + (K x true).2 + 1 : Nat) : Real) / (((K x false).2 + 1 : Nat) : Real)) ∂poissonCountLaw P u t) = _ rw [integral_finset_sum] · exact Finset.sum_congr rfl fun x _ ↦ by rw [integral_sub (harmInt x true) (harmInt x false), harm x true, harm x false] · intro x _ exact (harmInt x true).sub (harmInt x false)
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.poisson_inverse_count_expectation_eq_arm_means · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/PoissonInverseCountRiskAssembly.lean:202
theorem poisson_inverse_count_bias_of_expectation_eq

Once product-measure factorization identifies the statistic's expectation with its scalar arm means, the already-proved cell envelopes give the complete uniform bias bound. the stated conditions the stated conclusion.

Formal statement
d :
eps :
P :
hP :
ModelClass d eps P
u t :
hu :
0 < u
ht :
0 < t
heps :
0 < eps
≤ 2 * min 1 (d / (eps * exp 1 * t))
Proof (Lean source)
lemma poisson_inverse_count_bias_of_expectation_eq {d : Nat} {eps : Real} (P : DiscreteLaw d) (hP : ModelClass d eps P) {u t : Real} (hu : 0 < u) (ht : 0 < t) (heps : 0 < eps) (hmean : expectationUnder (poissonCountLaw P u t) (inverseCountStatistic u) = ∑ x, (poissonInverseArmMean P u t x true - poissonInverseArmMean P u t x false)) : |expectationUnder (poissonCountLaw P u t) (inverseCountStatistic u) - ateFunctional P| ≤ 2 * min 1 (d / (eps * exp 1 * t)) := by rw [hmean] simpa [poissonInverseArmMean] using poisson_inverse_arm_means_bias_aggregate P hP hu ht heps
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.poisson_inverse_count_bias_of_expectation_eq · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/PoissonInverseCountRiskAssembly.lean:342
theorem poisson_natCast_second_moment_le Lemma poisson_natCast_second_moment_le in the paper ↗

The scalar Poisson second moment bound used in the inverse-weight calculation. It follows directly from the add-one Poincare inequality. the stated conclusion.

Formal statement
lambda :
(∫ k : Nat, (k : Real) ^ 2 ∂poissonMeasure lambda) ≤ (lambda : Real) + (lambda : Real) ^ 2
Proof (Lean source)
lemma poisson_natCast_second_moment_le (lambda : NNReal) : (∫ k : Nat, (k : Real) ^ 2 ∂poissonMeasure lambda) ≤ (lambda : Real) + (lambda : Real) ^ 2 := by let f : Nat → Real := fun k ↦ (k : Real) have hf : MemLp f 2 (poissonMeasure lambda) := Causalean.Mathlib.Probability.Poisson.poisson_natCast_memLp_two lambda have hdf : MemLp (addOne f) 2 (poissonMeasure lambda) := by apply MemLp.of_bound (measurable_of_countable _).aestronglyMeasurable 1 filter_upwards with k simp [addOne, f] have hp := poisson_addOne_poincare lambda f hf hdf have hvar : variance f (poissonMeasure lambda) ≤ (lambda : Real) := by simpa [addOne, f] using hp rw [variance_eq_sub hf, show (∫ k : Nat, f k ∂poissonMeasure lambda) = (lambda : Real) by simpa [f] using poisson_natCast_first_moment lambda] at hvar simpa [f] using hvar
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.poisson_natCast_second_moment_le · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/PoissonInverseCountRiskAssembly.lean:359
theorem poisson_inverse_weight_second_moment_bound Lemma poisson_inverse_weight_second_moment_bound in the paper ↗

Under the arm-overlap rate comparison, the inverse-count weight has a uniform second moment. the stated conditions the stated conclusion.

Formal statement
eps :
heps :
0 < eps
lambda nu :
hoverlap :
eps * (nu : Real) ≤ (lambda : Real)
(∫ z : Nat × Nat, (1 + (z.2 : Real) * (((z.1 + 1 : Nat) : Real))⁻¹) ^ 2 ∂(poissonMeasure lambda).prod (poissonMeasure nu))
≤ 1 + 10 * eps⁻¹ + 8 * eps⁻¹ ^ 2
Proof (Lean source)
lemma poisson_inverse_weight_second_moment_bound {eps : Real} (heps : 0 < eps) (lambda nu : NNReal) (hoverlap : eps * (nu : Real) ≤ (lambda : Real)) : (∫ z : Nat × Nat, (1 + (z.2 : Real) * (((z.1 + 1 : Nat) : Real))⁻¹) ^ 2 ∂(poissonMeasure lambda).prod (poissonMeasure nu)) ≤ 1 + 10 * eps⁻¹ + 8 * eps⁻¹ ^ 2 := by let r : Nat → Real := fun k ↦ (((k + 1 : Nat) : Real))⁻¹ let r1 : Real := ∫ k, r k ∂poissonMeasure lambda let r2 : Real := ∫ k, (r k) ^ 2 ∂poissonMeasure lambda have hr : MemLp r 2 (poissonMeasure lambda) := by simpa [r] using Causalean.Mathlib.Probability.Poisson.shifted_reciprocal_memLp_two lambda have hv : MemLp (fun k : Nat ↦ (k : Real)) 2 (poissonMeasure nu) := Causalean.Mathlib.Probability.Poisson.poisson_natCast_memLp_two nu have hcross : Integrable (fun z : Nat × Nat ↦ 2 * ((z.2 : Real) * r z.1)) ((poissonMeasure lambda).prod (poissonMeasure nu)) := by exact ((hr.integrable (by norm_num)).mul_prod (hv.integrable (by norm_num))).const_mul 2 |>.congr (by filter_upwards with z ring) have hsq : Integrable (fun z : Nat × Nat ↦ (z.2 : Real) ^ 2 * (r z.1) ^ 2) ((poissonMeasure lambda).prod (poissonMeasure nu)) := by exact (hr.integrable_sq.mul_prod hv.integrable_sq).congr (by filter_upwards with z ring) have hr1_nonneg : 0 ≤ r1 := by exact integral_nonneg fun k ↦ inv_nonneg.mpr (by positivity) have hr1rate : (lambda : Real) * r1 ≤ 1 := by have h := shifted_reciprocal_first_moment lambda dsimp [r1, r] at * rw [h] linarith [Real.exp_pos (-(lambda : Real))] have hr2_nonneg : 0 ≤ r2 := integral_nonneg fun _ ↦ sq_nonneg _ have hr2rate : (1 + (lambda : Real)) ^ 2 * r2 ≤ 8 := by simpa [r2, r] using shifted_reciprocal_sq_bound lambda have hscalar := Causalean.Mathlib.Probability.Poisson.poisson_inverse_weight_second_moment_scalar heps lambda.coe_nonneg nu.coe_nonneg hoverlap hr1_nonneg hr1rate hr2_nonneg hr2rate have hmeanNu : (∫ k : Nat, (k : Real) ∂poissonMeasure nu) = (nu : Real) := Causalean.Mathlib.Probability.Poisson.poisson_natCast_first_moment nu have hsecondNu : (∫ k : Nat, (k : Real) ^ 2 ∂poissonMeasure nu) ≤ (nu : Real) + (nu : Real) ^ 2 := poisson_natCast_second_moment_le nu calc (∫ z : Nat × Nat, (1 + (z.2 : Real) * (((z.1 + 1 : Nat) : Real))⁻¹) ^ 2 ∂(poissonMeasure lambda).prod (poissonMeasure nu)) = 1 + 2 * r1 * (nu : Real) + r2 * (∫ k : Nat, (k : Real) ^ 2 ∂poissonMeasure nu) := by rw [show (fun z : Nat × Nat ↦ (1 + (z.2 : Real) * (((z.1 + 1 : Nat) : Real))⁻¹) ^ 2) = fun z ↦ 1 + 2 * ((z.2 : Real) * r z.1) + (z.2 : Real) ^ 2 * (r z.1) ^ 2 by funext z simp only [r] ring] have hsplit : (∫ z : Nat × Nat, 1 + 2 * ((z.2 : Real) * r z.1) + (z.2 : Real) ^ 2 * (r z.1) ^ 2 ∂(poissonMeasure lambda).prod (poissonMeasure nu)) = (∫ z : Nat × Nat, 1 + 2 * ((z.2 : Real) * r z.1) ∂(poissonMeasure lambda).prod (poissonMeasure nu)) + ∫ z : Nat × Nat, (z.2 : Real) ^ 2 * (r z.1) ^ 2 ∂(poissonMeasure lambda).prod (poissonMeasure nu) := integral_add ((integrable_const 1).add hcross) hsq have hsplit' : (∫ z : Nat × Nat, 1 + 2 * ((z.2 : Real) * r z.1) ∂(poissonMeasure lambda).prod (poissonMeasure nu)) = (∫ _z : Nat × Nat, (1 : Real) ∂(poissonMeasure lambda).prod (poissonMeasure nu)) + ∫ z : Nat × Nat, 2 * ((z.2 : Real) * r z.1) ∂(poissonMeasure lambda).prod (poissonMeasure nu) := integral_add (integrable_const 1) hcross rw [hsplit, hsplit'] rw [show (∫ z : Nat × Nat, 2 * ((z.2 : Real) * r z.1) ∂(poissonMeasure lambda).prod (poissonMeasure nu)) = 2 * (r1 * (nu : Real)) by rw [integral_const_mul] rw [show (∫ z : Nat × Nat, (z.2 : Real) * r z.1 ∂(poissonMeasure lambda).prod (poissonMeasure nu)) = r1 * ∫ k : Nat, (k : Real) ∂poissonMeasure nu by simpa [mul_comm] using integral_prod_mul (μ := poissonMeasure lambda) (ν := poissonMeasure nu) r (fun k : Nat ↦ (k : Real))] rw [hmeanNu], show (∫ z : Nat × Nat, (z.2 : Real) ^ 2 * (r z.1) ^ 2 ∂(poissonMeasure lambda).prod (poissonMeasure nu)) = r2 * ∫ k : Nat, (k : Real) ^ 2 ∂poissonMeasure nu by calc _ = ∫ z : Nat × Nat, (r z.1) ^ 2 * (z.2 : Real) ^ 2 ∂(poissonMeasure lambda).prod (poissonMeasure nu) := by apply integral_congr_ae filter_upwards with z ring _ = (∫ k : Nat, (r k) ^ 2 ∂poissonMeasure lambda) * ∫ k : Nat, (k : Real) ^ 2 ∂poissonMeasure nu := integral_prod_mul (μ := poissonMeasure lambda) (ν := poissonMeasure nu) (fun k : Nat ↦ (r k) ^ 2) (fun k : Nat ↦ (k : Real) ^ 2) _ = _ := by rfl] simp [r1] ring _ ≤ 1 + 2 * (nu : Real) * r1 + ((nu : Real) + (nu : Real) ^ 2) * r2 := by have hr20 : 0 ≤ r2 := hr2_nonneg nlinarith [mul_le_mul_of_nonneg_left hsecondNu hr20] _ ≤ 1 + 10 * eps⁻¹ + 8 * eps⁻¹ ^ 2 := by simpa [mul_comm] using hscalar
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.poisson_inverse_weight_second_moment_bound · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/PoissonInverseCountRiskAssembly.lean:380
theorem poisson_inverse_weight_second_moment_cell Lemma poisson_inverse_weight_second_moment_cell in the paper ↗

Integrating out the outcome-count coordinates leaves exactly the two marginal Poisson counts in the inverse weight. the stated conclusion.

Formal statement
lambdaS lambdaK :
a :
(∫ k : Bool → Nat × Nat, (1 + ((k (!a)).2 : Real) * ((((k a).2 + 1 : Nat) : Real))⁻¹) ^ 2 ∂Measure.pi (fun b : Bool ↦ (poissonMeasure (lambdaS b)).prod (poissonMeasure (lambdaK b))))
= ∫ z : Nat × Nat, (1 + (z.2 : Real) * (((z.1 + 1 : Nat) : Real))⁻¹) ^ 2 ∂(poissonMeasure (lambdaK a)).prod (poissonMeasure (lambdaK (!a)))
Proof (Lean source)
lemma poisson_inverse_weight_second_moment_cell (lambdaS lambdaK : Bool → NNReal) (a : Bool) : (∫ k : Bool → Nat × Nat, (1 + ((k (!a)).2 : Real) * ((((k a).2 + 1 : Nat) : Real))⁻¹) ^ 2 ∂Measure.pi (fun b : Bool ↦ (poissonMeasure (lambdaS b)).prod (poissonMeasure (lambdaK b)))) = ∫ z : Nat × Nat, (1 + (z.2 : Real) * (((z.1 + 1 : Nat) : Real))⁻¹) ^ 2 ∂(poissonMeasure (lambdaK a)).prod (poissonMeasure (lambdaK (!a))) := by let mu : Bool → Measure (Nat × Nat) := fun b ↦ (poissonMeasure (lambdaS b)).prod (poissonMeasure (lambdaK b)) let e := MeasurableEquiv.piCongrLeft (fun _ : Bool ↦ Nat × Nat) finTwoEquiv have hmp₁ : MeasurePreserving e (Measure.pi fun i : Fin 2 ↦ mu (finTwoEquiv i)) (Measure.pi mu) := measurePreserving_piCongrLeft mu finTwoEquiv have hmp₂ := measurePreserving_piFinTwo (fun i : Fin 2 ↦ mu (finTwoEquiv i)) let eTotal := e.symm.trans (MeasurableEquiv.piFinTwo (fun _ : Fin 2 ↦ Nat × Nat)) have hmp : MeasurePreserving eTotal (Measure.pi mu) ((mu false).prod (mu true)) := hmp₂.comp hmp₁.symm have hmpK : MeasurePreserving (fun z : (Nat × Nat) × (Nat × Nat) ↦ (z.1.2, z.2.2)) ((mu false).prod (mu true)) ((poissonMeasure (lambdaK false)).prod (poissonMeasure (lambdaK true))) := (measurePreserving_snd (μ := poissonMeasure (lambdaS false)) (ν := poissonMeasure (lambdaK false))).prod (measurePreserving_snd (μ := poissonMeasure (lambdaS true)) (ν := poissonMeasure (lambdaK true))) have hmpKswap : MeasurePreserving (fun z : (Nat × Nat) × (Nat × Nat) ↦ (z.2.2, z.1.2)) ((mu false).prod (mu true)) ((poissonMeasure (lambdaK true)).prod (poissonMeasure (lambdaK false))) := (Measure.measurePreserving_swap (μ := poissonMeasure (lambdaK false)) (ν := poissonMeasure (lambdaK true))).comp hmpK cases a · calc _ = ∫ y : (Nat × Nat) × (Nat × Nat), (1 + (y.2.2 : Real) * (((y.1.2 + 1 : Nat) : Real))⁻¹) ^ 2 ∂((mu false).prod (mu true)) := by rw [← hmp.integral_comp'] apply integral_congr_ae filter_upwards with k change _ = (1 + ((e.symm k 1).2 : Real) * ((((e.symm k 0).2 + 1 : Nat) : Real))⁻¹) ^ 2 congr 3 <;> rfl _ = _ := by simp only [Bool.not_false] dsimp [mu] at hmpK ⊢ rw [← hmpK.map_eq, integral_map hmpK.measurable.aemeasurable (measurable_of_countable _).aestronglyMeasurable] · calc _ = ∫ y : (Nat × Nat) × (Nat × Nat), (1 + (y.1.2 : Real) * (((y.2.2 + 1 : Nat) : Real))⁻¹) ^ 2 ∂((mu false).prod (mu true)) := by rw [← hmp.integral_comp'] apply integral_congr_ae filter_upwards with k change _ = (1 + ((e.symm k 0).2 : Real) * ((((e.symm k 1).2 + 1 : Nat) : Real))⁻¹) ^ 2 congr 3 <;> rfl _ = _ := by simp only [Bool.not_true] dsimp [mu] at hmpKswap ⊢ rw [← hmpKswap.map_eq, integral_map hmpKswap.measurable.aemeasurable (measurable_of_countable _).aestronglyMeasurable]
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.poisson_inverse_weight_second_moment_cell · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/PoissonInverseCountRiskAssembly.lean:493
theorem poisson_inverse_outcome_coordinate_energy_bound

Each outcome-count add-one energy is controlled by its marked mass and the outcome-information scale. the stated conditions the stated conclusion.

Formal statement
d :
eps :
P :
hP :
ModelClass d eps P
u t :
hu :
0 < u
ht :
0 < t
heps :
0 < eps
x :
Fin d
a :
((toNNReal (u * markedMass P x a) : NNReal) : Real) * (∫ K, (nestedPairAddOneFst x a (inverseCountStatistic u) K) ^ 2 ∂poissonCountLaw P u t)
≤ (1 + 10 * eps⁻¹ + 8 * eps⁻¹ ^ 2) * markedMass P x a * u⁻¹
Proof (Lean source)
lemma poisson_inverse_outcome_coordinate_energy_bound {d : Nat} {eps : Real} (P : DiscreteLaw d) (hP : ModelClass d eps P) {u t : Real} (hu : 0 < u) (ht : 0 < t) (heps : 0 < eps) (x : Fin d) (a : Bool) : ((toNNReal (u * markedMass P x a) : NNReal) : Real) * (∫ K, (nestedPairAddOneFst x a (inverseCountStatistic u) K) ^ 2 ∂poissonCountLaw P u t) ≤ (1 + 10 * eps⁻¹ + 8 * eps⁻¹ ^ 2) * markedMass P x a * u⁻¹ := by let lambdaS : Bool → NNReal := fun b ↦ toNNReal (u * markedMass P x b) let lambdaK : Bool → NNReal := fun b ↦ toNNReal (t * armMass P x b) have hrateS : ((lambdaS a : NNReal) : Real) = u * markedMass P x a := by rw [Real.coe_toNNReal] exact mul_nonneg hu.le (jointMass_mem_unitInterval P x a true).1 have hrateKa : ((lambdaK a : NNReal) : Real) = t * armMass P x a := by rw [Real.coe_toNNReal] exact mul_nonneg ht.le (Finset.sum_nonneg fun y _ ↦ (jointMass_mem_unitInterval P x a y).1) have hrateKo : ((lambdaK (!a) : NNReal) : Real) = t * armMass P x (!a) := by rw [Real.coe_toNNReal] exact mul_nonneg ht.le (Finset.sum_nonneg fun y _ ↦ (jointMass_mem_unitInterval P x (!a) y).1) have hoverlap : eps * ((lambdaK (!a) : NNReal) : Real) ≤ ((lambdaK a : NNReal) : Real) := by rw [hrateKa, hrateKo] have ha := (overlap_armMass_bounds P hP.overlap x a).1 have ho0 : 0 ≤ armMass P x a := Finset.sum_nonneg fun y _ ↦ (jointMass_mem_unitInterval P x a y).1 have hsplit : armMass P x a + armMass P x (!a) = cellMass P x := by cases a <;> simp [armMass, cellMass] <;> ring have ho : armMass P x (!a) ≤ cellMass P x := by linarith calc eps * (t * armMass P x (!a)) = t * (eps * armMass P x (!a)) := by ring _ ≤ t * (eps * cellMass P x) := by gcongr _ ≤ t * armMass P x a := by gcongr have hw := poisson_inverse_weight_second_moment_bound heps (lambdaK a) (lambdaK (!a)) hoverlap have hcell : (∫ K, (nestedPairAddOneFst x a (inverseCountStatistic u) K) ^ 2 ∂poissonCountLaw P u t) = u⁻¹ ^ 2 * (∫ z : Nat × Nat, (1 + (z.2 : Real) * (((z.1 + 1 : Nat) : Real))⁻¹) ^ 2 ∂(poissonMeasure (lambdaK a)).prod (poissonMeasure (lambdaK (!a)))) := by rw [show (fun K : PoissonCounts d ↦ (nestedPairAddOneFst x a (inverseCountStatistic u) K) ^ 2) = fun K ↦ u⁻¹ ^ 2 * (1 + ((K x (!a)).2 : Real) * ((((K x a).2 + 1 : Nat) : Real))⁻¹) ^ 2 by funext K rw [inverse_count_outcome_addOne u hu.ne' x a K] cases a <;> simp <;> field_simp <;> ring] rw [integral_const_mul] congr 1 calc _ = ∫ k, (1 + ((k (!a)).2 : Real) * ((((k a).2 + 1 : Nat) : Real))⁻¹) ^ 2 ∂Measure.pi (fun b : Bool ↦ (poissonMeasure (toNNReal (u * markedMass P x b))).prod (poissonMeasure (toNNReal (t * armMass P x b)))) := poissonCountLaw_integral_cell P u t x _ _ = _ := poisson_inverse_weight_second_moment_cell lambdaS lambdaK a rw [hcell, hrateS] have hmark : 0 ≤ markedMass P x a := (jointMass_mem_unitInterval P x a true).1 have huinv : 0 ≤ u⁻¹ := inv_nonneg.mpr hu.le let W2 : Real := ∫ z : Nat × Nat, (1 + (z.2 : Real) * (((z.1 + 1 : Nat) : Real))⁻¹) ^ 2 ∂(poissonMeasure (lambdaK a)).prod (poissonMeasure (lambdaK (!a))) change (u * markedMass P x a) * (u⁻¹ ^ 2 * W2) ≤ _ have hw' : W2 ≤ 1 + 10 * eps⁻¹ + 8 * eps⁻¹ ^ 2 := hw calc (u * markedMass P x a) * (u⁻¹ ^ 2 * W2) = markedMass P x a * u⁻¹ * W2 := by rw [inv_pow] field_simp _ ≤ markedMass P x a * u⁻¹ * (1 + 10 * eps⁻¹ + 8 * eps⁻¹ ^ 2) := by gcongr _ = _ := by ring
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.poisson_inverse_outcome_coordinate_energy_bound · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/PoissonInverseCountRiskAssembly.lean:560
CausalSmith.Stat.STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research.Helpers.StrictImprovement 6 declarations Numerical strict-improvement characterization for the annotation frontier.

Numerical strict-improvement characterization for the annotation frontier.

theorem positive_two_sided_bounds_isTheta Lemma positive_two_sided_bounds_isTheta in the paper ↗

the stated conditions establishes the stated conclusion.

Formal statement
alpha :
Type*
Filter alpha
f g :
alpha → Real
c C :
hc :
0 < c
hC :
0 < C
hf :
∀ᶠ x in l, 0 ≤ f x
hg :
∀ᶠ x in l, 0 ≤ g x
hlo :
∀ᶠ x in l, c * g x ≤ f x
hhi :
∀ᶠ x in l, f x ≤ C * g x
f =Θ[l] g
Proof (Lean source)
lemma positive_two_sided_bounds_isTheta {alpha : Type*} {l : Filter alpha} (f g : alpha → Real) {c C : Real} (hc : 0 < c) (hC : 0 < C) (hf : ∀ᶠ x in l, 0 ≤ f x) (hg : ∀ᶠ x in l, 0 ≤ g x) (hlo : ∀ᶠ x in l, c * g x ≤ f x) (hhi : ∀ᶠ x in l, f x ≤ C * g x) : f =Θ[l] g := by apply IsBigO.antisymm · apply IsBigO.of_bound C filter_upwards [hf, hg, hhi] with x hfx hgx hx simpa [Real.norm_eq_abs, abs_of_nonneg hfx, abs_of_nonneg hgx] using hx · apply IsBigO.of_bound c⁻¹ filter_upwards [hf, hg, hlo] with x hfx hgx hx rw [Real.norm_eq_abs, Real.norm_eq_abs, abs_of_nonneg hgx, abs_of_nonneg hfx] have hc0 : c ≠ 0 := ne_of_gt hc calc g x = c⁻¹ * (c * g x) := by field_simp _ ≤ c⁻¹ * f x := mul_le_mul_of_nonneg_left hx (inv_nonneg.mpr hc.le)
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.positive_two_sided_bounds_isTheta · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/StrictImprovement.lean:14
theorem minimaxRisk_le_measurable_estimator

the stated conditions establishes the stated conclusion.

Formal statement
n m d :
eps :
est :
Sample n m d → Real
hest :
minimaxRisk n m d eps
≤ ⨆ P : ClassLaw d eps, twoSampleMSE (annotationLaw P.1 n m) est (ateFunctional P.1)
Proof (Lean source)
lemma minimaxRisk_le_measurable_estimator {n m d : Nat} {eps : Real} (est : Sample n m d → Real) (hest : Measurable est) : minimaxRisk n m d eps ≤ ⨆ P : ClassLaw d eps, twoSampleMSE (annotationLaw P.1 n m) est (ateFunctional P.1) := by unfold minimaxRisk have hnonneg (e : {f : Sample n m d → Real // Measurable f}) : 0 ≤ ⨆ P : ClassLaw d eps, twoSampleMSE (annotationLaw P.1 n m) e.1 (ateFunctional P.1) := by cases isEmpty_or_nonempty (ClassLaw d eps) with | inl hempty => letI := hempty simp | inr hnonempty => letI := hnonempty by_cases hb : BddAbove (range (fun P : ClassLaw d eps ↦ twoSampleMSE (annotationLaw P.1 n m) e.1 (ateFunctional P.1))) · exact (integral_nonneg fun z ↦ sq_nonneg (e.1 z - ateFunctional (Classical.arbitrary (ClassLaw d eps)).1)).trans (le_ciSup hb (Classical.arbitrary _)) · rw [show (⨆ P : ClassLaw d eps, twoSampleMSE (annotationLaw P.1 n m) e.1 (ateFunctional P.1)) = sSup ∅ from csSup_of_not_bddAbove hb] simp have hb : BddBelow (range (fun e : {f : Sample n m d → Real // Measurable f} ↦ ⨆ P : ClassLaw d eps, twoSampleMSE (annotationLaw P.1 n m) e.1 (ateFunctional P.1))) := by refine ⟨0, ?_⟩ rintro _ ⟨e, rfl⟩ exact hnonneg e exact ciInf_le hb ⟨est, hest⟩
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.minimaxRisk_le_measurable_estimator · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/StrictImprovement.lean:33

the stated conditions establishes the stated conclusion.

Formal statement
x :
hx :
0 ≤ x
(min 1 x) ^ 2 = min 1 (x ^ 2)
Proof (Lean source)
lemma min_one_sq_nonnegative {x : Real} (hx : 0 ≤ x) : (min 1 x) ^ 2 = min 1 (x ^ 2) := by by_cases h : x ≤ 1 · rw [min_eq_right h, min_eq_right] nlinarith · have h1 : 1 ≤ x := le_of_not_ge h rw [min_eq_left h1, min_eq_left (by nlinarith [sq_nonneg (x - 1)])] norm_num
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.min_one_sq_nonnegative · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/StrictImprovement.lean:68
theorem strict_min_rates_iff_ratios Lemma strict_min_rates_iff_ratios in the paper ↗

the stated conditions establishes the stated conclusion.

Formal statement
alpha :
Type*
Filter alpha
i a b :
alpha → Real
hi0 :
∀ᶠ x in l, 0 < i x
hi1 :
∀ᶠ x in l, i x ≤ 1
ha :
∀ᶠ x in l, 0 < a x
hb :
∀ᶠ x in l, 0 ≤ b x
hba :
∀ᶠ x in l, b x ≤ a x
(fun x ↦ min 1 (i x + b x ^ 2))
=o[l] (fun x ↦ min 1 (i x + a x ^ 2)) ↔ Tendsto (fun x ↦ i x / min 1 (i x + a x ^ 2)) l (nhds 0) ∧
Tendsto (fun x ↦ b x / min 1 (a x)) l (nhds 0)
Proof (Lean source)
lemma strict_min_rates_iff_ratios {alpha : Type*} {l : Filter alpha} (i a b : alpha → Real) (hi0 : ∀ᶠ x in l, 0 < i x) (hi1 : ∀ᶠ x in l, i x ≤ 1) (ha : ∀ᶠ x in l, 0 < a x) (hb : ∀ᶠ x in l, 0 ≤ b x) (hba : ∀ᶠ x in l, b x ≤ a x) : (fun x ↦ min 1 (i x + b x ^ 2)) =o[l] (fun x ↦ min 1 (i x + a x ^ 2)) ↔ Tendsto (fun x ↦ i x / min 1 (i x + a x ^ 2)) l (nhds 0) ∧ Tendsto (fun x ↦ b x / min 1 (a x)) l (nhds 0) := by let r := fun x ↦ min 1 (i x + b x ^ 2) let r₀ := fun x ↦ min 1 (i x + a x ^ 2) let h := fun x ↦ min 1 (a x) have hr0 : ∀ᶠ x in l, 0 ≤ r x := by filter_upwards [hi0] with x hx dsimp [r] exact le_min (by norm_num) (add_pos_of_pos_of_nonneg hx (sq_nonneg _)).le have hr₀0 : ∀ᶠ x in l, 0 < r₀ x := by filter_upwards [hi0] with x hx dsimp [r₀] exact lt_min (by norm_num) (add_pos_of_pos_of_nonneg hx (sq_nonneg _)) have hrle : ∀ᶠ x in l, r x ≤ r₀ x := by filter_upwards [hba, hb] with x hba' hb' dsimp [r, r₀] gcongr have hir : ∀ᶠ x in l, i x ≤ r x := by filter_upwards [hi0, hi1] with x hi hi' dsimp [r] apply le_min hi' exact le_add_of_nonneg_right (sq_nonneg _) have hh0 : ∀ᶠ x in l, 0 < h x := by filter_upwards [ha] with x hax dsimp [h] exact lt_min (by norm_num) hax constructor · intro ho have hratio : Tendsto (fun x ↦ r x / r₀ x) l (nhds 0) := by exact ho.tendsto_div_nhds_zero have hiratio : Tendsto (fun x ↦ i x / r₀ x) l (nhds 0) := by apply squeeze_zero' (g := fun x ↦ r x / r₀ x) · filter_upwards [hi0, hr₀0] with x hx hrx positivity · filter_upwards [hir, hr₀0] with x hx hrx exact div_le_div_of_nonneg_right hx hrx.le · exact hratio refine ⟨by simpa [r₀] using hiratio, ?_⟩ have hratiolt : ∀ᶠ x in l, r x / r₀ x < 1 := (tendsto_order.1 hratio).2 1 (by norm_num) have hr_eq : ∀ᶠ x in l, r x = i x + b x ^ 2 := by filter_upwards [hratiolt, hr₀0] with x hx hrx have hlt : r x < 1 := lt_of_lt_of_le ((div_lt_one hrx).mp hx) (min_le_left _ _) dsimp [r] at hlt ⊢ exact min_eq_right (le_of_not_gt fun hsum ↦ by rw [min_eq_left (le_of_lt hsum)] at hlt exact (lt_irrefl 1 hlt).elim) have hb2ratio : Tendsto (fun x ↦ b x ^ 2 / r₀ x) l (nhds 0) := by apply squeeze_zero' (g := fun x ↦ r x / r₀ x) · filter_upwards [hr₀0] with x hx positivity · filter_upwards [hr_eq, hr₀0, hi0] with x hx hrx hix rw [hx] exact div_le_div_of_nonneg_right (le_add_of_nonneg_left hix.le) hrx.le · exact hratio have hihr : Tendsto (fun x ↦ i x / h x ^ 2) l (nhds 0) := by let q := fun x ↦ i x / r₀ x have hq : Tendsto q l (nhds 0) := by simpa [q] using hiratio have hfrac : Tendsto (fun x ↦ q x / (1 - q x)) l (nhds 0) := by have hden : Tendsto (fun x ↦ 1 - q x) l (nhds 1) := by convert tendsto_const_nhds.sub hq using 1 <;> norm_num change Tendsto (q / (fun x ↦ 1 - q x)) l (nhds 0) simpa only [zero_div] using hq.div hden (by norm_num) apply squeeze_zero' (g := fun x ↦ q x / (1 - q x)) · filter_upwards [hi0, hh0] with x hix hhx positivity · filter_upwards [hi0, hi1, ha, hr₀0, hh0, (tendsto_order.1 hq).2 1 (by norm_num)] with x hix hi1x hax hrx hhx hqx have hq0 : 0 ≤ q x := by dsimp [q]; positivity have hden : 0 < 1 - q x := sub_pos.mpr hqx have hrupper : r₀ x ≤ i x + h x ^ 2 := by dsimp [r₀, h] rw [min_one_sq_nonnegative hax.le] by_cases ha1 : a x ^ 2 ≤ 1 · rw [min_eq_right ha1] exact min_le_right _ _ · rw [min_eq_left (le_of_not_ge ha1)] exact (min_le_left _ _).trans (by linarith) rw [div_le_div_iff₀ (sq_pos_of_pos hhx) hden] dsimp [q] have hrne : r₀ x ≠ 0 := ne_of_gt hrx field_simp [hrne] nlinarith · exact hfrac have hrh : Tendsto (fun x ↦ r₀ x / h x ^ 2) l (nhds 1) := by apply tendsto_const_nhds.squeeze' (show Tendsto (fun x ↦ 1 + i x / h x ^ 2) l (nhds 1) by convert tendsto_const_nhds.add hihr using 1 <;> norm_num) · filter_upwards [ha, hi0, hi1, hh0] with x hax hix hi1x hhx have hh : h x ^ 2 ≤ r₀ x := by dsimp [h, r₀] rw [min_one_sq_nonnegative hax.le] exact min_le_min le_rfl (le_add_of_nonneg_left hix.le) exact (le_div_iff₀ (sq_pos_of_pos hhx)).2 (by simpa using hh) · filter_upwards [ha, hi0, hi1, hh0] with x hax hix hi1x hhx have hrupper : r₀ x ≤ i x + h x ^ 2 := by dsimp [r₀, h] rw [min_one_sq_nonnegative hax.le] by_cases ha1 : a x ^ 2 ≤ 1 · rw [min_eq_right ha1] exact min_le_right _ _ · rw [min_eq_left (le_of_not_ge ha1)] exact (min_le_left _ _).trans (by linarith) rw [div_le_iff₀ (sq_pos_of_pos hhx)] calc r₀ x ≤ i x + h x ^ 2 := hrupper _ = (1 + i x / h x ^ 2) * h x ^ 2 := by field_simp; ring have hb2h : Tendsto (fun x ↦ b x ^ 2 / h x ^ 2) l (nhds 0) := by have hp := hb2ratio.mul hrh simpa only [zero_mul] using hp.congr' (by filter_upwards [hr₀0, hh0] with x hrx hhx field_simp) have hsqrt := Real.continuous_sqrt.continuousAt.tendsto.comp hb2h simpa only [Function.comp_apply, Real.sqrt_zero, h] using hsqrt.congr' (by filter_upwards [hb, hh0] with x hbx hhx change sqrt (b x ^ 2 / h x ^ 2) = b x / h x rw [show b x ^ 2 / h x ^ 2 = (b x / h x) ^ 2 by field_simp, Real.sqrt_sq_eq_abs, abs_of_nonneg (div_nonneg hbx hhx.le)]) · rintro ⟨hiratio, hbhratio⟩ have hb2h : Tendsto (fun x ↦ b x ^ 2 / h x ^ 2) l (nhds 0) := by have hp := hbhratio.pow 2 simpa only [zero_pow (by omega : 2 ≠ 0)] using hp.congr' (by filter_upwards [hh0] with x hhx dsimp [h] field_simp) have hb2r : Tendsto (fun x ↦ b x ^ 2 / r₀ x) l (nhds 0) := by apply squeeze_zero' (g := fun x ↦ b x ^ 2 / h x ^ 2) · filter_upwards [hr₀0] with x hx positivity · filter_upwards [ha, hi0, hr₀0, hh0] with x hax hix hrx hhx apply div_le_div_of_nonneg_left (sq_nonneg _) (sq_pos_of_pos hhx) dsimp [h, r₀] rw [min_one_sq_nonnegative hax.le] exact min_le_min le_rfl (le_add_of_nonneg_left hix.le) · exact hb2h have hsum := hiratio.add hb2r have hrat : Tendsto (fun x ↦ r x / r₀ x) l (nhds 0) := by apply squeeze_zero' (g := fun x ↦ i x / r₀ x + b x ^ 2 / r₀ x) · filter_upwards [hr0, hr₀0] with x hx hrx positivity · filter_upwards [hr₀0] with x hrx dsimp [r] rw [← add_div] exact div_le_div_of_nonneg_right (min_le_right _ _) hrx.le · simpa [r₀] using hsum apply isLittleO_of_tendsto' · filter_upwards [hr₀0] with x hx intro hzero exact (hx.ne' hzero).elim · simpa [r, r₀] using hrat
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.strict_min_rates_iff_ratios · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/StrictImprovement.lean:79
theorem supervised_floor_ratio_iff

the stated conditions establishes the stated conclusion.

Formal statement
dSeq :
Nat → Nat
hd :
∀ n
if
1 ≤ n
then
2 ≤ dSeq n
Tendsto (fun n : Nat ↦ (1 / (n : Real)) / frontierRate n 0 (dSeq n)) atTop (nhds 0)
↔ Tendsto (fun n ↦ (dSeq n : Real) / (sqrt n * logEN n)) atTop atTop
Proof (Lean source)
lemma supervised_floor_ratio_iff (dSeq : Nat → Nat) (hd : ∀ n, 1 ≤ n → 2 ≤ dSeq n) : Tendsto (fun n : Nat ↦ (1 / (n : Real)) / frontierRate n 0 (dSeq n)) atTop (nhds 0) ↔ Tendsto (fun n ↦ (dSeq n : Real) / (sqrt n * logEN n)) atTop atTop := by let i : Nat → Real := fun n ↦ 1 / (n : Real) let a : Nat → Real := fun n ↦ (dSeq n : Real) / ((n : Real) * logEN n) let s : Nat → Real := fun n ↦ (dSeq n : Real) / (sqrt n * logEN n) let r₀ : Nat → Real := fun n ↦ frontierRate n 0 (dSeq n) have hformula : ∀ n, r₀ n = min 1 (i n + a n ^ 2) := by intro n simpa [r₀, i, a] using frontierRate_sequence_formula (fun _ ↦ 0) dSeq n have hpoint : ∀ n, 1 ≤ n → i n / (i n + a n ^ 2) = 1 / (1 + s n ^ 2) := by intro n hn have hnR : (0 : Real) < n := by exact_mod_cast hn have hsqrt : 0 < sqrt (n : Real) := Real.sqrt_pos.2 hnR have hlog := logEN_pos_of_one_le n hn have hdR : (0 : Real) < dSeq n := by exact_mod_cast lt_of_lt_of_le (by omega : 0 < 2) (hd n hn) dsimp [i, a, s] field_simp [hnR.ne', hsqrt.ne', hlog.ne', hdR.ne'] rw [Real.sq_sqrt hnR.le] ring have hipos : ∀ᶠ n in atTop, 0 < i n := by filter_upwards [eventually_ge_atTop 1] with n hn dsimp [i] positivity have hapos : ∀ᶠ n in atTop, 0 < a n := by filter_upwards [eventually_ge_atTop 1] with n hn dsimp [a] exact div_pos (by exact_mod_cast (lt_of_lt_of_le (by omega : 0 < 2) (hd n hn))) (mul_pos (by exact_mod_cast hn) (logEN_pos_of_one_le n hn)) have hrpos : ∀ᶠ n in atTop, 0 < r₀ n := by filter_upwards [eventually_ge_atTop 1] with n hn exact (frontierRate_mem_Ioc_zero_one n 0 (dSeq n) hn).1 constructor · intro hq have hq' : Tendsto (fun n ↦ i n / r₀ n) atTop (nhds 0) := by simpa [i, r₀] using hq rw [Filter.tendsto_atTop] intro M let K : Real := max M 0 + 1 have hK : 0 < K := by dsimp [K]; linarith [le_max_right M 0] have hthreshold : 0 < 1 / (1 + K ^ 2) := by positivity have hevent : ∀ᶠ n in atTop, i n / r₀ n < 1 / (1 + K ^ 2) := (tendsto_order.1 hq').2 _ hthreshold filter_upwards [eventually_ge_atTop 1, hevent] with n hn hsmall have hi : 0 < i n := by dsimp [i]; positivity have hr : 0 < r₀ n := (frontierRate_mem_Ioc_zero_one n 0 (dSeq n) hn).1 have ha0 : 0 ≤ a n := by dsimp [a] exact div_nonneg (Nat.cast_nonneg _) (mul_nonneg (Nat.cast_nonneg _) (logEN_pos_of_one_le n hn).le) have hrupper : r₀ n ≤ i n + a n ^ 2 := by rw [hformula] exact min_le_right _ _ have hlower : 1 / (1 + s n ^ 2) ≤ i n / r₀ n := by rw [← hpoint n hn] exact div_le_div_of_nonneg_left hi.le hr hrupper by_contra hMs have hsK : s n < K := (lt_of_not_ge hMs).trans_le (by dsimp [K] linarith [le_max_left M 0]) have hs0 : 0 ≤ s n := by dsimp [s] exact div_nonneg (Nat.cast_nonneg _) (mul_nonneg (Real.sqrt_nonneg _) (logEN_pos_of_one_le n hn).le) have hden : 1 + s n ^ 2 < 1 + K ^ 2 := by nlinarith have hinv : 1 / (1 + K ^ 2) < 1 / (1 + s n ^ 2) := by exact one_div_lt_one_div_of_lt (by positivity) hden linarith · intro hs have hiZero : Tendsto i atTop (nhds 0) := by dsimp [i] simpa [one_div, Function.comp_def] using tendsto_inv_atTop_zero.comp tendsto_natCast_atTop_atTop have hsSq : Tendsto (fun n ↦ s n ^ 2) atTop atTop := by simpa [s, pow_two, Function.comp_def] using Filter.tendsto_mul_self_atTop.comp hs have hsInv : Tendsto (fun n ↦ 1 / s n ^ 2) atTop (nhds 0) := by simpa [one_div, Function.comp_def] using tendsto_inv_atTop_zero.comp hsSq have hbound : ∀ᶠ n in atTop, i n / r₀ n ≤ i n + 1 / s n ^ 2 := by filter_upwards [eventually_ge_atTop 1, hipos, hapos, hrpos] with n hn hi ha hr have hs0 : 0 < s n := by dsimp [s] exact div_pos (by exact_mod_cast (lt_of_lt_of_le (by omega : 0 < 2) (hd n hn))) (mul_pos (Real.sqrt_pos.2 (by exact_mod_cast hn)) (logEN_pos_of_one_le n hn)) rw [hformula] let h : Real := min 1 (a n) have hh : 0 < h := lt_min (by norm_num) ha have hhRate : h ^ 2 ≤ min 1 (i n + a n ^ 2) := by dsimp [h] rw [min_one_sq_nonnegative ha.le] exact min_le_min le_rfl (le_add_of_nonneg_left hi.le) have hfirst : i n / min 1 (i n + a n ^ 2) ≤ i n / h ^ 2 := div_le_div_of_nonneg_left hi.le (sq_pos_of_pos hh) hhRate apply hfirst.trans by_cases ha1 : a n ≤ 1 · have hhEq : h = a n := min_eq_right ha1 rw [hhEq] have heq : i n / a n ^ 2 = 1 / s n ^ 2 := by have hnR : (0 : Real) < n := by exact_mod_cast hn have hsqrt := Real.sqrt_pos.2 hnR have hlog := logEN_pos_of_one_le n hn have hdR : (0 : Real) < dSeq n := by exact_mod_cast lt_of_lt_of_le (by omega : 0 < 2) (hd n hn) dsimp [i, a, s] field_simp [hnR.ne', hsqrt.ne', hlog.ne', hdR.ne'] rw [Real.sq_sqrt hnR.le] rw [heq] exact le_add_of_nonneg_left hi.le · have hhEq : h = 1 := min_eq_left (le_of_not_ge ha1) simp only [hhEq, one_pow, div_one] exact le_add_of_nonneg_right (one_div_nonneg.mpr (sq_nonneg (s n))) have hnonneg : ∀ᶠ n in atTop, 0 ≤ i n / r₀ n := by filter_upwards [hipos, hrpos] with n hi hr positivity have hzero : Tendsto (fun n ↦ i n / r₀ n) atTop (nhds 0) := by apply squeeze_zero' hnonneg hbound convert hiZero.add hsInv using 1 <;> norm_num simpa [i, r₀] using hzero
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.supervised_floor_ratio_iff · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/StrictImprovement.lean:239
theorem annotation_frontier_strict_improvement_iff Lemma 29 in the paper ↗

the stated conditions establishes the stated conclusion.

Formal statement
mSeq dSeq :
Nat → Nat
hd :
∀ n
if
1 ≤ n
then
2 ≤ dSeq n
(fun n ↦ frontierRate n (mSeq n) (dSeq n))
=o[atTop] (fun n ↦ frontierRate n 0 (dSeq n)) ↔ Tendsto (fun n ↦ (dSeq n : Real) / (sqrt n * logEN n)) atTop atTop ∧
Tendsto (fun n ↦ ((dSeq n : Real) / (((n + mSeq n : Nat) : Real) * logEN n)) / min 1 ((dSeq n : Real) / ((n : Real) * logEN n))) atTop (nhds 0)
Proof (Lean source)
lemma annotation_frontier_strict_improvement_iff (mSeq dSeq : Nat → Nat) (hd : ∀ n, 1 ≤ n → 2 ≤ dSeq n) : (fun n ↦ frontierRate n (mSeq n) (dSeq n)) =o[atTop] (fun n ↦ frontierRate n 0 (dSeq n)) ↔ Tendsto (fun n ↦ (dSeq n : Real) / (sqrt n * logEN n)) atTop atTop ∧ Tendsto (fun n ↦ ((dSeq n : Real) / (((n + mSeq n : Nat) : Real) * logEN n)) / min 1 ((dSeq n : Real) / ((n : Real) * logEN n))) atTop (nhds 0) := by let i : Nat → Real := fun n ↦ 1 / (n : Real) let a : Nat → Real := fun n ↦ (dSeq n : Real) / ((n : Real) * logEN n) let b : Nat → Real := fun n ↦ (dSeq n : Real) / (((n + mSeq n : Nat) : Real) * logEN n) have hi0 : ∀ᶠ n in atTop, 0 < i n := by filter_upwards [eventually_ge_atTop 1] with n hn dsimp [i] positivity have hi1 : ∀ᶠ n in atTop, i n ≤ 1 := by filter_upwards [eventually_ge_atTop 1] with n hn dsimp [i] exact (div_le_one (by positivity)).2 (by exact_mod_cast hn) have ha : ∀ᶠ n in atTop, 0 < a n := by filter_upwards [eventually_ge_atTop 1] with n hn dsimp [a] exact div_pos (by exact_mod_cast (lt_of_lt_of_le (by omega : 0 < 2) (hd n hn))) (mul_pos (by exact_mod_cast hn) (logEN_pos_of_one_le n hn)) have hb : ∀ᶠ n in atTop, 0 ≤ b n := by filter_upwards [eventually_ge_atTop 1] with n hn dsimp [b] have hN : (0 : Real) < (n + mSeq n : Nat) := by exact_mod_cast (lt_of_lt_of_le (by omega : 0 < n) (le_add_right n _)) exact div_nonneg (Nat.cast_nonneg _) (mul_nonneg hN.le (logEN_pos_of_one_le n hn).le) have hba : ∀ᶠ n in atTop, b n ≤ a n := by filter_upwards [eventually_ge_atTop 1] with n hn dsimp [a, b] have hnpos : (0 : Real) < n := by exact_mod_cast hn have hlog := logEN_pos_of_one_le n hn have hN : (n : Real) ≤ (n + mSeq n : Nat) := by exact_mod_cast le_add_right n (mSeq n) exact div_le_div_of_nonneg_left (Nat.cast_nonneg _) (mul_pos hnpos hlog) (mul_le_mul_of_nonneg_right hN hlog.le) have hgeneric := strict_min_rates_iff_ratios i a b hi0 hi1 ha hb hba rw [show (fun n ↦ frontierRate n (mSeq n) (dSeq n)) = (fun n ↦ min 1 (i n + b n ^ 2)) by funext n; exact frontierRate_sequence_formula mSeq dSeq n, show (fun n ↦ frontierRate n 0 (dSeq n)) = (fun n ↦ min 1 (i n + a n ^ 2)) by funext n simpa [i, a] using frontierRate_sequence_formula (fun _ ↦ 0) dSeq n] rw [hgeneric] have hfloorEq : (fun n ↦ i n / min 1 (i n + a n ^ 2)) = (fun n : Nat ↦ (1 / (n : Real)) / frontierRate n 0 (dSeq n)) := by funext n simp only [i, a] rw [frontierRate] simp only [Nat.add_zero] congr 2 ring constructor · rintro ⟨hfloor, haux⟩ refine ⟨(supervised_floor_ratio_iff dSeq hd).1 ?_, ?_⟩ · rw [← hfloorEq] exact hfloor · simpa [a, b] using haux · rintro ⟨hfloor, haux⟩ refine ⟨?_, ?_⟩ · rw [hfloorEq] exact (supervised_floor_ratio_iff dSeq hd).2 hfloor · simpa [a, b] using haux
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.annotation_frontier_strict_improvement_iff · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/Helpers/StrictImprovement.lean:366
CausalSmith.Stat.STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research.T_BinaryAlphabetParametricRate 1 declarations The binary-covariate parametric endpoint.

The binary-covariate parametric endpoint.

theorem binary_alphabet_parametric_rate Theorem 7 in the paper ↗

At alphabet size two, auxiliary annotation cannot improve the parametric order. the stated conditions the stated conclusion.

Formal statement
eps :
heps :
0 < eps
heps2 :
eps < 1 / 2
∃ c C : Real,
0 < c
c ≤ C
conclusion 1
n m :
1 ≤ n
c / n ≤ minimaxRisk n m 2 eps
minimaxRisk n m 2 eps ≤ C / n
Proof (Lean source)
theorem binary_alphabet_parametric_rate {eps : Real} (heps : 0 < eps) (heps2 : eps < 1 / 2) : ∃ c C : Real, 0 < c ∧ c ≤ C ∧ ∀ (n m : Nat), 1 ≤ n → c / n ≤ minimaxRisk n m 2 eps ∧ minimaxRisk n m 2 eps ≤ C / n := by obtain ⟨c, hc, hlower⟩ := parametric_label_floor obtain ⟨C, hC, hupper⟩ := inverse_count_baseline heps heps2 refine ⟨c, max c (5 * C), hc, le_max_left _ _, ?_⟩ intro n m hn constructor · exact hlower eps heps heps2 n m 2 hn (by omega) · have hu := (hupper n m 2 hn (by omega)).2.2 have hn0 : (0 : Real) < n := by exact_mod_cast (show 0 < n by omega) have hnm : (n : Real) ≤ (n + m : Nat) := by exact_mod_cast Nat.le_add_right n m have hnm0 : (0 : Real) < (n + m : Nat) := lt_of_lt_of_le hn0 hnm have hn_one : (1 : Real) ≤ n := by exact_mod_cast hn have hnm_one : (1 : Real) ≤ (n + m : Nat) := le_trans hn_one hnm calc minimaxRisk n m 2 eps ≤ C * min 1 (1 / (n : Real) + (2 : Real) ^ 2 / ((n + m : Nat) : Real) ^ 2) := hu _ ≤ C * (1 / (n : Real) + (2 : Real) ^ 2 / ((n + m : Nat) : Real) ^ 2) := mul_le_mul_of_nonneg_left (min_le_right _ _) hC.le _ ≤ C * (5 / (n : Real)) := by apply mul_le_mul_of_nonneg_left _ hC.le rw [show (2 : Real) ^ 2 = 4 by norm_num] have hsquare : (n : Real) ≤ ((n + m : Nat) : Real) ^ 2 := by have hprod := mul_nonneg hnm0.le (sub_nonneg.mpr hnm_one) nlinarith have hdiv : 4 / ((n + m : Nat) : Real) ^ 2 ≤ 4 / (n : Real) := by exact (div_le_div_iff_of_pos_left (by norm_num) (sq_pos_of_pos hnm0) hn0).2 hsquare calc 1 / (n : Real) + 4 / ((n + m : Nat) : Real) ^ 2 ≤ 1 / (n : Real) + 4 / (n : Real) := by linarith _ = 5 / (n : Real) := by ring _ = (5 * C) / n := by ring _ ≤ max c (5 * C) / n := by exact (div_le_div_iff_of_pos_right hn0).2 (le_max_right _ _)
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.binary_alphabet_parametric_rate · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/T_BinaryAlphabetParametricRate.lean:13
CausalSmith.Stat.STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research.T_CommonMarginalConverse 1 declarations The common-treatment-marginal minimax converse.

The common-treatment-marginal minimax converse.

theorem common_marginal_converse Theorem 3 in the paper ↗

Explicit fuzzy priors with the same entire random (X,A) table force the annotation-frontier lower bound, including the constant-risk regime. The canonical certificate and its fixed transfer constants are consumed internally; the public conclusion exposes only the positive epsilon-dependent constant, the regime-dependent prior handle, equality of its random table laws, and the headline minimax lower bound. the stated conditions the stated conclusion.

Formal statement
eps :
heps :
0 < eps
heps2 :
eps < 1 / 2
∃ c : Real,
conclusion 1
0 < c
conclusion 2
∃ calibration : CommonMarginalCalibration eps,
∀ (n m d : Nat),
1
≤ n → 2 ≤ d → ∃ H : CommonMarginalPriorHandle calibration n m d, randomAuxTableLaw (commonMarginalPriorOf H false) = randomAuxTableLaw (commonMarginalPriorOf H true) ∧ c * frontierRate n m d ≤ minimaxRisk n m d eps
Proof (Lean source)
theorem common_marginal_converse {eps : Real} (heps : 0 < eps) (heps2 : eps < 1 / 2) : ∃ c : Real, 0 < c ∧ -- @realizes \(c_\epsilon\)(positive; depends only on epsilon) ∃ calibration : CommonMarginalCalibration eps, ∀ (n m d : Nat), 1 ≤ n → 2 ≤ d → ∃ H : CommonMarginalPriorHandle calibration n m d, randomAuxTableLaw (commonMarginalPriorOf H false) = randomAuxTableLaw (commonMarginalPriorOf H true) ∧ c * frontierRate n m d ≤ minimaxRisk n m d eps := by -- Obtain the fixed transfer rule and the inhabited certificate family from -- `common_marginal_canonical_certificate_family`. Its transfer-rule -- conjunct is the exact rule of `fixed_sample_common_marginal_transfer`. -- Both that rule and this conclusion use `H.recipe`; no second recipe is -- frozen or substituted. rcases common_marginal_canonical_certificate_family with ⟨Cfixed, cRisk, hCfixed, hcRisk, hfamily⟩ rcases hfamily eps heps heps2 with ⟨calibration, CBound, rho, cSmall, cFloor, hCBound, hrho, hcSmall, hcFloor, hcFloorRisk, htransfer, hconstruct⟩ let c := min (cFloor / 2) (min (calibration.dimensionConstant / 2) (cFloor * calibration.dimensionConstant / 2)) have hc : 0 < c := by dsimp [c] exact lt_min (half_pos hcFloor) (lt_min (half_pos calibration.dimensionConstant_pos) (half_pos (mul_pos hcFloor calibration.dimensionConstant_pos))) refine ⟨c, hc, calibration, ?_⟩ intro n m d hn hd rcases hconstruct n m d hn hd with ⟨H, hcert⟩ have hexact : H.recipe.finiteAtomConstruction → CommonMarginalExactPoissonPriorWitness calibration.bandwidthConstant (n + m : Nat) H.recipe (u := commonMarginalLabeledIntensity Cfixed n) (v := commonMarginalAuxiliaryIntensity Cfixed n m) (C := CBound) (rho := rho) := hcert.poissonPriorWitness have hfixed : H.recipe.finiteAtomConstruction → cRisk * commonMarginalDelta H ^ 2 ≤ minimaxRisk n m d eps := by intro hfinite have hwitness := hexact hfinite have ha : 0 < H.a := by rw [hwitness.shift_eq] have hL : (0 : Real) < H.L := by exact_mod_cast (lt_of_lt_of_le (by omega : 0 < 2) hwitness.degree_ge_two) exact div_pos (mul_pos calibration.gamma_pos hwitness.bandwidth_pos) (sq_pos_of_pos hL) have hlower : 0 ≤ commonMarginalDelta H := by exact mul_nonneg (mul_nonneg calibration.dualGap_pos.le (Nat.cast_nonneg _)) ha.le have hsep := hcert.centerSeparation hfinite have hvarianceActual : H.k * H.B * H.a ≤ cSmall * |rawPriorCenter H.recipe true - rawPriorCenter H.recipe false| ^ 2 := (hcert.varianceAbsorption hfinite).trans (mul_le_mul_of_nonneg_left ((sq_le_sq₀ hlower (abs_nonneg _)).2 hsep) hcSmall.le) have hactual := htransfer n m d H hn hd hwitness (hcert.mixtureTV hfinite) hvarianceActual exact (mul_le_mul_of_nonneg_left ((sq_le_sq₀ hlower (abs_nonneg _)).2 hsep) hcRisk.le).trans hactual refine ⟨H, hcert.sameTable, ?_⟩ let q : Real := (d : Real) ^ 2 / (((n + m : Nat) : Real) ^ 2 * logEN n ^ 2) have hq : 0 ≤ q := by dsimp [q] positivity have hnpos : (0 : Real) < n := by exact_mod_cast hn have hinv : 0 ≤ 1 / (n : Real) := (one_div_nonneg.mpr hnpos.le) have hdim : 0 ≤ commonMarginalDimensionTerm n m d := by rw [commonMarginalDimensionTerm] exact le_min (by norm_num) hq have hfront : frontierRate n m d ≤ 1 / (n : Real) + commonMarginalDimensionTerm n m d := by rw [frontierRate, commonMarginalDimensionTerm] change min 1 (1 / (n : Real) + q) ≤ 1 / (n : Real) + min 1 q by_cases hq1 : q ≤ 1 · rw [min_eq_right hq1] exact min_le_right _ _ · rw [min_eq_left (le_of_lt (lt_of_not_ge hq1))] exact (min_le_left _ _).trans (by linarith) have hcFloor_nonneg : 0 ≤ cFloor := hcFloor.le have hc_left : c ≤ cFloor / 2 := by exact min_le_left _ _ have hc_dim : c ≤ calibration.dimensionConstant / 2 := by exact (min_le_right _ _).trans (min_le_left _ _) have hc_product : c ≤ cFloor * calibration.dimensionConstant / 2 := by exact (min_le_right _ _).trans (min_le_right _ _) have hfloor : cFloor * (1 / (n : Real)) ≤ minimaxRisk n m d eps := by simpa [div_eq_mul_inv] using hcert.floorRisk by_cases hfinite : H.recipe.finiteAtomConstruction · have hdimensionRisk : cFloor * (calibration.dimensionConstant * commonMarginalDimensionTerm n m d) ≤ minimaxRisk n m d eps := by calc cFloor * (calibration.dimensionConstant * commonMarginalDimensionTerm n m d) ≤ cFloor * commonMarginalDelta H ^ 2 := by gcongr exact hcert.dimensionNonparametric hfinite _ ≤ minimaxRisk n m d eps := hcert.transferredRisk hfinite calc c * frontierRate n m d ≤ c * (1 / (n : Real) + commonMarginalDimensionTerm n m d) := by gcongr _ = c * (1 / (n : Real)) + c * commonMarginalDimensionTerm n m d := by ring _ ≤ (cFloor / 2) * (1 / (n : Real)) + (cFloor * calibration.dimensionConstant / 2) * commonMarginalDimensionTerm n m d := by exact add_le_add (mul_le_mul_of_nonneg_right hc_left hinv) (mul_le_mul_of_nonneg_right hc_product hdim) _ = (cFloor * (1 / (n : Real)) + cFloor * (calibration.dimensionConstant * commonMarginalDimensionTerm n m d)) / 2 := by ring _ ≤ (minimaxRisk n m d eps + minimaxRisk n m d eps) / 2 := by gcongr _ = minimaxRisk n m d eps := by ring · calc c * frontierRate n m d ≤ c * (1 / (n : Real) + commonMarginalDimensionTerm n m d) := by gcongr _ = c * (1 / (n : Real)) + c * commonMarginalDimensionTerm n m d := by ring _ ≤ (cFloor / 2) * (1 / (n : Real)) + (calibration.dimensionConstant / 2) * commonMarginalDimensionTerm n m d := by exact add_le_add (mul_le_mul_of_nonneg_right hc_left hinv) (mul_le_mul_of_nonneg_right hc_dim hdim) _ = (cFloor * (1 / (n : Real)) + calibration.dimensionConstant * commonMarginalDimensionTerm n m d) / 2 := by ring _ ≤ (cFloor * (1 / (n : Real)) + cFloor * (1 / (n : Real))) / 2 := by apply div_le_div_of_nonneg_right _ (by norm_num) apply add_le_add le_rfl simpa [div_eq_mul_inv] using hcert.dimensionParametric hfinite _ = cFloor / n := by ring _ ≤ minimaxRisk n m d eps := hcert.floorRisk
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.common_marginal_converse · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/T_CommonMarginalConverse.lean:15
CausalSmith.Stat.STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research.T_InverseCountBaseline 26 declarations The clipped all-heavy inverse-count upper bound.

The clipped all-heavy inverse-count upper bound.

theorem sqRisk_eq_varianceUnder_add_bias_sq Lemma sqRisk_eq_varianceUnder_add_bias_sq in the paper ↗

Bias--variance decomposition for the paper's explicit expectation and variance wrappers. This is the analytic assembly used after transporting the Poisson inverse-count statistic to fixed prefixes. the stated conditions the stated conclusion.

Formal statement
α :
f :
α → Real
theta :
hf :
MemLp f 2 μ
(∫ z, (f z - theta) ^ 2 ∂μ) = varianceUnder μ f + (expectationUnder μ f - theta) ^ 2
Proof (Lean source)
lemma sqRisk_eq_varianceUnder_add_bias_sq {α : Type*} [MeasurableSpace α] (μ : Measure α) [IsProbabilityMeasure μ] (f : α → Real) (theta : Real) (hf : MemLp f 2 μ) : (∫ z, (f z - theta) ^ 2 ∂μ) = varianceUnder μ f + (expectationUnder μ f - theta) ^ 2 := by have hf_int : Integrable f μ := hf.integrable (by norm_num) have hf_sq : Integrable (fun z => f z ^ 2) μ := by simpa [Pi.pow_apply] using hf.integrable_sq rw [varianceUnder, expectationUnder] have hleft : (fun z => (f z - theta) ^ 2) = fun z => f z ^ 2 - 2 * theta * f z + theta ^ 2 := by funext z ring have hcenter : (fun z => (f z - ∫ y, f y ∂μ) ^ 2) = fun z => f z ^ 2 - 2 * (∫ y, f y ∂μ) * f z + (∫ y, f y ∂μ) ^ 2 := by funext z ring rw [hleft, hcenter] integral_linearity simp ring
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.sqRisk_eq_varianceUnder_add_bias_sq · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/T_InverseCountBaseline.lean:23
theorem poisson_inverse_count_sqRisk_bound

The bias and variance conclusions of poisson_inverse_count_risk assemble into the squared-risk bound needed by the fixed-prefix transfer. the stated conditions the stated conclusion.

Formal statement
eps :
heps :
0 < eps
heps2 :
eps < 1 / 2
∃ C : Real,
0 < C
conclusion 1
d :
u t :
0 < u
0 < t
P :
ModelClass d eps P
(∫ K, (inverseCountStatistic u K - ateFunctional P) ^ 2 ∂poissonCountLaw P u t)
≤ C * (u⁻¹ + t⁻¹) + C ^ 2 * (min 1 ((d : Real) / t)) ^ 2
Proof (Lean source)
lemma poisson_inverse_count_sqRisk_bound {eps : Real} (heps : 0 < eps) (heps2 : eps < 1 / 2) : ∃ C : Real, 0 < C ∧ ∀ (d : Nat) (u t : Real), 0 < u → 0 < t → ∀ (P : DiscreteLaw d), ModelClass d eps P → (∫ K, (inverseCountStatistic u K - ateFunctional P) ^ 2 ∂poissonCountLaw P u t) ≤ C * (u⁻¹ + t⁻¹) + C ^ 2 * (min 1 ((d : Real) / t)) ^ 2 := by obtain ⟨C, hC, hbound⟩ := poisson_inverse_count_risk heps heps2 refine ⟨C, hC, ?_⟩ intro d u t hu ht P hP rcases hbound d u t hu ht P hP with ⟨hbias, hvar⟩ letI : IsProbabilityMeasure (poissonCountLaw P u t) := ⟨by simp [poissonCountLaw]⟩ letI : IsFiniteMeasure (nestedPairedPoissonMeasure (fun x a => toNNReal (u * markedMass P x a)) (fun x a => toNNReal (t * armMass P x a))) := by change IsFiniteMeasure (poissonCountLaw P u t) infer_instance have hf : MemLp (inverseCountStatistic u) 2 (poissonCountLaw P u t) := (inverseCountStatistic_memLp_and_addOne P (t := t) hu).1 rw [sqRisk_eq_varianceUnder_add_bias_sq (poissonCountLaw P u t) (inverseCountStatistic u) (ateFunctional P) hf] apply add_le_add hvar rw [← sq_abs] simpa [mul_pow] using pow_le_pow_left₀ (abs_nonneg _) hbias 2
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.poisson_inverse_count_sqRisk_bound · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/T_InverseCountBaseline.lean:50
def inverseCountPrefixOutput

Valid-prefix all-heavy statistic using the disjoint outcome and factorial blocks and their fixed Poisson intensities. the stated conditions the stated conclusion.

Definition (Lean source)
n m d :
sample :
Sample n m d
r0 rf :
inverseCountPrefixOutput sample r0 rf :
bs :
u :
bs.M0 / 8 (: Real)
clipUnit <| ∑ x : Fin d, let s1 : Real := labeledBlockCount sample.1 0 r0 x true true let s0 : Real := labeledBlockCount sample.1 0 r0 x false true let k1 := pooledArmCount sample (bs.M0 + bs.np) bs.nf bs.mp rf x true let k0 := pooledArmCount sample (bs.M0 + bs.np) bs.nf bs.mp rf x false s1 / u * (k0 + k1 + 1 : Nat) / (k1 + 1 : Nat)
- s0 / u * (k0 + k1 + 1 : Nat) / (k0 + 1 : Nat)
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.inverseCountPrefixOutput · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/T_InverseCountBaseline.lean:81

Clipped, derandomized Poisson-prefix inverse-count estimator. the stated conditions the stated conclusion.

Definition (Lean source)
n m d :
inverseCountEstimator n m d :
Sample n m d → Real
fun sample
=> let bs := blockSizes n m let u : Real := bs.M0 / 8 let t : Real := (bs.nf + bs.mf : Nat) / 8 ∑ r0 ∈ range (bs.M0 + 1), ∑ rf ∈ range (bs.nf + bs.mf + 1), (poissonMeasure (toNNReal u)).real {r0} * (poissonMeasure (toNNReal t)).real {rf} * inverseCountPrefixOutput sample r0 rf
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.inverseCountEstimator · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/T_InverseCountBaseline.lean:95
theorem measurable_inverseCountEstimator

The formal statement establishes the stated conclusion.

Formal statement
n m d :
Proof (Lean source)
lemma measurable_inverseCountEstimator (n m d : Nat) : Measurable (inverseCountEstimator n m d) := by fun_prop
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.measurable_inverseCountEstimator · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/T_InverseCountBaseline.lean:106
theorem inverseCountPrefixOutput_mem_Icc

The formal statement establishes the stated conclusion.

Formal statement
n m d :
sample :
Sample n m d
r0 rf :
inverseCountPrefixOutput sample r0 rf ∈ Icc (-1 : Real) 1
Proof (Lean source)
lemma inverseCountPrefixOutput_mem_Icc {n m d : Nat} (sample : Sample n m d) (r0 rf : Nat) : inverseCountPrefixOutput sample r0 rf ∈ Icc (-1 : Real) 1 := by dsimp [inverseCountPrefixOutput, clipUnit] exact ⟨le_max_left _ _, max_le (by norm_num) (min_le_left _ _)⟩
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.inverseCountPrefixOutput_mem_Icc · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/T_InverseCountBaseline.lean:111
theorem inverseCountEstimator_mem_Icc

The formal statement establishes the stated conclusion.

Formal statement
n m d :
sample :
Sample n m d
inverseCountEstimator n m d sample ∈ Icc (-1 : Real) 1
Proof (Lean source)
lemma inverseCountEstimator_mem_Icc (n m d : Nat) (sample : Sample n m d) : inverseCountEstimator n m d sample ∈ Icc (-1 : Real) 1 := by let bs := blockSizes n m let u : Real := bs.M0 / 8 let t : Real := (bs.nf + bs.mf : Nat) / 8 let w0 : Nat → Real := fun r => (poissonMeasure (toNNReal u)).real {r} let wf : Nat → Real := fun r => (poissonMeasure (toNNReal t)).real {r} have hw0 (r : Nat) : 0 ≤ w0 r := MeasureTheory.measureReal_nonneg have hwf (r : Nat) : 0 ≤ wf r := MeasureTheory.measureReal_nonneg have hm0 : ∑ r ∈ range (bs.M0 + 1), w0 r ≤ 1 := poissonPrefixMass_le_one _ _ have hmf : ∑ r ∈ range (bs.nf + bs.mf + 1), wf r ≤ 1 := poissonPrefixMass_le_one _ _ have hmass : (∑ r ∈ range (bs.M0 + 1), w0 r) * (∑ r ∈ range (bs.nf + bs.mf + 1), wf r) ≤ 1 := by have hf0 : 0 ≤ ∑ r ∈ range (bs.nf + bs.mf + 1), wf r := Finset.sum_nonneg fun _ _ => hwf _ have hprod := mul_nonneg (sub_nonneg.mpr hm0) hf0 nlinarith have hweights : (∑ r0 ∈ range (bs.M0 + 1), ∑ rf ∈ range (bs.nf + bs.mf + 1), w0 r0 * wf rf) = (∑ r ∈ range (bs.M0 + 1), w0 r) * (∑ r ∈ range (bs.nf + bs.mf + 1), wf r) := by rw [Finset.sum_mul] apply Finset.sum_congr rfl intro r0 _ rw [Finset.mul_sum] change (∑ r0 ∈ range (bs.M0 + 1), ∑ rf ∈ range (bs.nf + bs.mf + 1), w0 r0 * wf rf * inverseCountPrefixOutput sample r0 rf) ∈ Icc (-1 : Real) 1 constructor · calc (-1 : Real) ≤ -((∑ r ∈ range (bs.M0 + 1), w0 r) * (∑ r ∈ range (bs.nf + bs.mf + 1), wf r)) := neg_le_neg hmass _ = ∑ r0 ∈ range (bs.M0 + 1), ∑ rf ∈ range (bs.nf + bs.mf + 1), w0 r0 * wf rf * (-1 : Real) := by rw [← hweights] simp only [mul_neg, mul_one, Finset.sum_neg_distrib] _ ≤ _ := by gcongr exact (inverseCountPrefixOutput_mem_Icc sample _ _).1 · calc _ ≤ ∑ r0 ∈ range (bs.M0 + 1), ∑ rf ∈ range (bs.nf + bs.mf + 1), w0 r0 * wf rf * (1 : Real) := by gcongr exact (inverseCountPrefixOutput_mem_Icc sample _ _).2 _ = (∑ r ∈ range (bs.M0 + 1), w0 r) * (∑ r ∈ range (bs.nf + bs.mf + 1), wf r) := by simpa using hweights _ ≤ 1 := hmass
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.inverseCountEstimator_mem_Icc · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/T_InverseCountBaseline.lean:118
def finitePrefixInverseCountStatistic

The clipped inverse-count statistic on two unordered finite Poisson prefixes: complete observations supply the marked numerator counts, while auxiliary observations supply the arm-denominator counts. the stated conditions the stated conclusion.

Definition (Lean source)
d :
u :
s :
finitePrefixInverseCountStatistic u s :
histL :
histA :
clipUnit (inverseCountStatistic u fun x a => (histL (x, a, true), histA (x, a)))
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.finitePrefixInverseCountStatistic · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/T_InverseCountBaseline.lean:179
theorem measurable_finitePrefixInverseCountStatistic

The formal statement establishes the stated conclusion.

Formal statement
d :
u :
Proof (Lean source)
lemma measurable_finitePrefixInverseCountStatistic {d : Nat} (u : Real) : Measurable (finitePrefixInverseCountStatistic (d := d) u) := by unfold finitePrefixInverseCountStatistic have hclip : Measurable clipUnit := by unfold clipUnit fun_prop have hinv : Measurable (inverseCountStatistic (d := d) u) := measurable_of_countable _ let counts : FiniteSample (Obs d) × FiniteSample (AuxObs d) → PoissonCounts d := fun s x a => (finiteSampleHistogram s.1.points (x, a, true), finiteSampleHistogram s.2.points (x, a)) have hcounts : Measurable counts := by have hL : Measurable (fun s : FiniteSample (Obs d) × FiniteSample (AuxObs d) => finiteSampleHistogram s.1.points) := measurable_finiteSampleHistogram.comp measurable_fst have hA : Measurable (fun s : FiniteSample (Obs d) × FiniteSample (AuxObs d) => finiteSampleHistogram s.2.points) := measurable_finiteSampleHistogram.comp measurable_snd exact measurable_pi_lambda _ fun x => measurable_pi_lambda _ fun a => ((measurable_pi_apply (x, a, true)).comp hL).prodMk ((measurable_pi_apply (x, a)).comp hA) change Measurable (clipUnit ∘ inverseCountStatistic u ∘ counts) exact hclip.comp (hinv.comp hcounts)
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.measurable_finitePrefixInverseCountStatistic · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/T_InverseCountBaseline.lean:192
theorem finitePrefixInverseCountStatistic_mem_Icc

The formal statement establishes the stated conclusion.

Formal statement
d :
u :
s :
Proof (Lean source)
lemma finitePrefixInverseCountStatistic_mem_Icc {d : Nat} (u : Real) (s : FiniteSample (Obs d) × FiniteSample (AuxObs d)) : finitePrefixInverseCountStatistic u s ∈ Icc (-1 : Real) 1 := by dsimp [finitePrefixInverseCountStatistic, clipUnit] exact ⟨le_max_left _ _, max_le (by norm_num) (min_le_left _ _)⟩
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.finitePrefixInverseCountStatistic_mem_Icc · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/T_InverseCountBaseline.lean:217
def finitePrefixCounts

the stated conditions defines the specified object.

Definition (Lean source)
d :
s :
finitePrefixCounts s :
histL :
histA :
fun x a => (histL (x, a, true), histA (x, a))
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.finitePrefixCounts · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/T_InverseCountBaseline.lean:224
theorem measurable_finitePrefixCounts

Forming inverse-count histograms from finite prefixes is measurable.

Formal statement
d :
Proof (Lean source)
@[fun_prop] lemma measurable_finitePrefixCounts {d : Nat} : Measurable (finitePrefixCounts (d := d)) := by unfold finitePrefixCounts have hL : Measurable (fun s : FiniteSample (Obs d) × FiniteSample (AuxObs d) => finiteSampleHistogram s.1.points) := measurable_finiteSampleHistogram.comp measurable_fst have hA : Measurable (fun s : FiniteSample (Obs d) × FiniteSample (AuxObs d) => finiteSampleHistogram s.2.points) := measurable_finiteSampleHistogram.comp measurable_snd exact measurable_pi_lambda _ fun x => measurable_pi_lambda _ fun a => ((measurable_pi_apply (x, a, true)).comp hL).prodMk ((measurable_pi_apply (x, a)).comp hA)
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.measurable_finitePrefixCounts · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/T_InverseCountBaseline.lean:232
theorem finitePrefixInverseCountStatistic_eq

The formal statement establishes the stated conclusion.

Formal statement
d :
u :
Proof (Lean source)
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.finitePrefixInverseCountStatistic_eq · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/T_InverseCountBaseline.lean:245
theorem finitePrefixCounts_map_independentPoissonPrefixLaw

The formal statement establishes the stated conclusion.

Formal statement
d :
P :
u t :
Measure.map finitePrefixCounts (independentPoissonPrefixLaw (obsLaw P) (auxMarginal P).toMeasure u t)
= Measure.pi fun x : Fin d => Measure.pi fun a : Bool => (poissonMeasure (u * ((obsLaw P) ({(x, a, true)} : Set (Obs d))).toNNReal)).prod (poissonMeasure (t * ((auxMarginal P).toMeasure ({(x, a)} : Set (AuxObs d))).toNNReal))
Proof (Lean source)
lemma finitePrefixCounts_map_independentPoissonPrefixLaw {d : Nat} (P : DiscreteLaw d) (u t : NNReal) : Measure.map finitePrefixCounts (independentPoissonPrefixLaw (obsLaw P) (auxMarginal P).toMeasure u t) = Measure.pi fun x : Fin d => Measure.pi fun a : Bool => (poissonMeasure (u * ((obsLaw P) ({(x, a, true)} : Set (Obs d))).toNNReal)).prod (poissonMeasure (t * ((auxMarginal P).toMeasure ({(x, a)} : Set (AuxObs d))).toNNReal)) := by let histL : FiniteSample (Obs d) → (Obs d → Nat) := fun s => finiteSampleHistogram s.points let histA : FiniteSample (AuxObs d) → (AuxObs d → Nat) := fun s => finiteSampleHistogram s.points let extractL : (Obs d → Nat) → (AuxObs d → Nat) := fun h xa => h (xa.1, xa.2, true) let pairFlat : (AuxObs d → Nat) × (AuxObs d → Nat) → (AuxObs d → Nat × Nat) := fun z xa => (z.1 xa, z.2 xa) let curryCounts : (AuxObs d → Nat × Nat) → PoissonCounts d := fun z x a => z (x, a) have hL := finitePoissonSampleLaw_map_histogram (obsLaw P) u have hA := finitePoissonSampleLaw_map_histogram (auxMarginal P).toMeasure t have hextract : Measure.map extractL (Measure.pi fun z : Obs d => poissonMeasure (u * ((obsLaw P) {z}).toNNReal)) = Measure.pi fun xa : AuxObs d => poissonMeasure (u * ((obsLaw P) {(xa.1, xa.2, true)}).toNNReal) := by exact map_pi_finProjection _ (fun xa : AuxObs d => (xa.1, xa.2, true)) (by intro x y h apply Prod.ext · simpa only using congrArg fst h · simpa only using congrArg (fun z : Obs d => z.2.1) h) have hpair := map_prod_pi_pointwisePair (fun xa : AuxObs d => poissonMeasure (u * ((obsLaw P) {(xa.1, xa.2, true)}).toNNReal)) (fun xa : AuxObs d => poissonMeasure (t * ((auxMarginal P).toMeasure {xa}).toNNReal)) have hcurry : Measure.map curryCounts (Measure.pi fun xa : AuxObs d => (poissonMeasure (u * ((obsLaw P) {(xa.1, xa.2, true)}).toNNReal)).prod (poissonMeasure (t * ((auxMarginal P).toMeasure {xa}).toNNReal))) = Measure.pi fun x : Fin d => Measure.pi fun a : Bool => (poissonMeasure (u * ((obsLaw P) {(x, a, true)}).toNNReal)).prod (poissonMeasure (t * ((auxMarginal P).toMeasure {(x, a)}).toNNReal)) := by change Measure.map (MeasurableEquiv.curry (Fin d) Bool (Nat × Nat)) (Measure.pi fun xa : AuxObs d => (poissonMeasure (u * ((obsLaw P) {(xa.1, xa.2, true)}).toNNReal)).prod (poissonMeasure (t * ((auxMarginal P).toMeasure {xa}).toNNReal))) = _ simpa only [Measure.infinitePi_eq_pi] using Measure.infinitePi_map_curry (fun x : Fin d => fun a : Bool => (poissonMeasure (u * ((obsLaw P) {(x, a, true)}).toNNReal)).prod (poissonMeasure (t * ((auxMarginal P).toMeasure {(x, a)}).toNNReal))) unfold independentPoissonPrefixLaw let source := (finitePoissonSampleLaw (obsLaw P) u).prod (finitePoissonSampleLaw (auxMarginal P).toMeasure t) have hhistL : Measurable histL := measurable_finiteSampleHistogram have hhistA : Measurable histA := measurable_finiteSampleHistogram have hhistPair : Measurable (map histL histA) := (hhistL.comp measurable_fst).prodMk (hhistA.comp measurable_snd) change Measure.map (curryCounts ∘ pairFlat ∘ map extractL id ∘ map histL histA) source = _ calc _ = Measure.map curryCounts (Measure.map pairFlat (Measure.map (map extractL id) (Measure.map (map histL histA) source))) := by rw [Measure.map_map (measurable_of_countable _) (measurable_of_countable _), Measure.map_map (measurable_of_countable _) (measurable_of_countable _), Measure.map_map (measurable_of_countable _) hhistPair] rfl _ = Measure.map curryCounts (Measure.map pairFlat (Measure.map (map extractL id) ((Measure.map histL (finitePoissonSampleLaw (obsLaw P) u)).prod (Measure.map histA (finitePoissonSampleLaw (auxMarginal P).toMeasure t))))) := by rw [Measure.map_prod_map _ _ hhistL hhistA] _ = Measure.map curryCounts (Measure.map pairFlat (Measure.map (map extractL id) ((Measure.pi fun z : Obs d => poissonMeasure (u * ((obsLaw P) {z}).toNNReal)).prod (Measure.pi fun z : AuxObs d => poissonMeasure (t * ((auxMarginal P).toMeasure {z}).toNNReal))))) := by rw [hL, hA] _ = Measure.map curryCounts (Measure.map pairFlat ((Measure.map extractL (Measure.pi fun z : Obs d => poissonMeasure (u * ((obsLaw P) {z}).toNNReal))).prod (Measure.map id (Measure.pi fun z : AuxObs d => poissonMeasure (t * ((auxMarginal P).toMeasure {z}).toNNReal))))) := by rw [Measure.map_prod_map _ _ (measurable_of_countable _) (measurable_of_countable _)] _ = Measure.map curryCounts (Measure.map pairFlat ((Measure.pi fun xa : AuxObs d => poissonMeasure (u * ((obsLaw P) {(xa.1, xa.2, true)}).toNNReal)).prod (Measure.pi fun z : AuxObs d => poissonMeasure (t * ((auxMarginal P).toMeasure {z}).toNNReal)))) := by rw [hextract, Measure.map_id] _ = Measure.map curryCounts (Measure.pi fun i : AuxObs d => (poissonMeasure (u * ((obsLaw P) {(i.1, i.2, true)}).toNNReal)).prod (poissonMeasure (t * ((auxMarginal P).toMeasure {i}).toNNReal))) := by rw [hpair] _ = _ := hcurry
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.finitePrefixCounts_map_independentPoissonPrefixLaw · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/T_InverseCountBaseline.lean:251
theorem finitePrefixCounts_map_eq_poissonCountLaw Lemma 3 in the paper ↗

the stated conditions establishes the stated conclusion.

Formal statement
d :
P :
u t :
hu :
0 ≤ u
ht :
0 ≤ t
Measure.map finitePrefixCounts (independentPoissonPrefixLaw (obsLaw P) (auxMarginal P).toMeasure (toNNReal u) (toNNReal t))
Proof (Lean source)
lemma finitePrefixCounts_map_eq_poissonCountLaw {d : Nat} (P : DiscreteLaw d) (u t : Real) (hu : 0 ≤ u) (ht : 0 ≤ t) : Measure.map finitePrefixCounts (independentPoissonPrefixLaw (obsLaw P) (auxMarginal P).toMeasure (toNNReal u) (toNNReal t)) = poissonCountLaw P u t := by rw [finitePrefixCounts_map_independentPoissonPrefixLaw] unfold poissonCountLaw congr 1 funext x congr 1 funext a congr 1 · congr 1 unfold obsLaw markedMass jointMass rw [PMF.toMeasure_apply_singleton _ _ (measurableSet_singleton _)] rw [Real.toNNReal_mul hu] congr 1 apply NNReal.eq simpa [Real.coe_toNNReal] using ENNReal.coe_toNNReal_eq_toReal (P.pmf (x, a, true)) · congr 1 have haux : (auxMarginal P (x, a)).toReal = armMass P x a := by unfold auxMarginal armMass jointMass rw [PMF.map_apply, tsum_fintype] cases a <;> simp only [Fintype.sum_prod_type] <;> simp all_goals rw [ENNReal.toReal_add (PMF.apply_ne_top _ _) (PMF.apply_ne_top _ _)] unfold armMass jointMass rw [PMF.toMeasure_apply_singleton _ _ (measurableSet_singleton _)] rw [Real.toNNReal_mul ht] congr 1 apply NNReal.eq rw [ENNReal.coe_toNNReal_eq_toReal] have hsum : 0 ≤ ∑ y : Bool, (P.pmf (x, a, y)).toReal := Finset.sum_nonneg fun _ _ => ENNReal.toReal_nonneg rw [Real.coe_toNNReal _ hsum] exact haux
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.finitePrefixCounts_map_eq_poissonCountLaw · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/T_InverseCountBaseline.lean:369
theorem clipUnit_sq_sub_le

the stated conditions establishes the stated conclusion.

Formal statement
z theta :
htheta :
theta ∈ Icc (-1 : Real) 1
(clipUnit z - theta) ^ 2 ≤ (z - theta) ^ 2
Proof (Lean source)
lemma clipUnit_sq_sub_le (z theta : Real) (htheta : theta ∈ Icc (-1 : Real) 1) : (clipUnit z - theta) ^ 2 ≤ (z - theta) ^ 2 := by unfold clipUnit rcases htheta with ⟨htlo, hthi⟩ by_cases hzlo : z < -1 · rw [min_eq_right (by linarith), max_eq_left (by linarith)] nlinarith [sq_nonneg (z - theta), sq_nonneg (-1 - theta)] · by_cases hzhi : 1 < z · rw [min_eq_left (by linarith), max_eq_right (by norm_num)] nlinarith [sq_nonneg (z - theta), sq_nonneg (1 - theta)] · rw [min_eq_right (by linarith), max_eq_right (by linarith)]
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.clipUnit_sq_sub_le · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/T_InverseCountBaseline.lean:409
theorem finitePrefixInverseCountStatistic_risk_le_poissonCount

the stated conditions establishes the stated conclusion.

Formal statement
d :
P :
u t theta :
hu :
0 < u
ht :
0 ≤ t
htheta :
theta ∈ Icc (-1 : Real) 1
sqRisk (independentPoissonPrefixLaw (obsLaw P) (auxMarginal P).toMeasure (toNNReal u) (toNNReal t)) (finitePrefixInverseCountStatistic u) theta
≤ ∫ K, (inverseCountStatistic u K - theta) ^ 2 ∂poissonCountLaw P u t
Proof (Lean source)
lemma finitePrefixInverseCountStatistic_risk_le_poissonCount {d : Nat} (P : DiscreteLaw d) (u t theta : Real) (hu : 0 < u) (ht : 0 ≤ t) (htheta : theta ∈ Icc (-1 : Real) 1) : sqRisk (independentPoissonPrefixLaw (obsLaw P) (auxMarginal P).toMeasure (toNNReal u) (toNNReal t)) (finitePrefixInverseCountStatistic u) theta ≤ ∫ K, (inverseCountStatistic u K - theta) ^ 2 ∂poissonCountLaw P u t := by let mu := independentPoissonPrefixLaw (obsLaw P) (auxMarginal P).toMeasure (toNNReal u) (toNNReal t) letI : IsProbabilityMeasure mu := ⟨by simp [mu, independentPoissonPrefixLaw]⟩ letI : IsProbabilityMeasure (poissonCountLaw P u t) := ⟨by simp [poissonCountLaw]⟩ letI : IsFiniteMeasure (nestedPairedPoissonMeasure (fun x a => toNNReal (u * markedMass P x a)) (fun x a => toNNReal (t * armMass P x a))) := by change IsFiniteMeasure (poissonCountLaw P u t) infer_instance have hmap := finitePrefixCounts_map_eq_poissonCountLaw P u t hu.le ht have hleft : Integrable (fun s => (finitePrefixInverseCountStatistic u s - theta) ^ 2) mu := by apply Integrable.of_bound (((measurable_finitePrefixInverseCountStatistic u).sub measurable_const).pow_const 2 ).aestronglyMeasurable ((1 + |theta|) ^ 2) filter_upwards [] with s rw [Real.norm_eq_abs, abs_of_nonneg (sq_nonneg _), sq_le_sq, abs_of_nonneg (add_nonneg (by norm_num) (abs_nonneg theta))] exact (abs_sub _ _).trans (add_le_add (abs_le.2 (finitePrefixInverseCountStatistic_mem_Icc u s)) le_rfl) have hright : Integrable (fun K => (inverseCountStatistic u K - theta) ^ 2) (poissonCountLaw P u t) := (((inverseCountStatistic_memLp_and_addOne P (t := t) hu).1.sub (memLp_const theta)).integrable_sq) have hclipright : Integrable (fun K => (clipUnit (inverseCountStatistic u K) - theta) ^ 2) (poissonCountLaw P u t) := by apply Integrable.of_bound ((measurable_of_countable _).aestronglyMeasurable) ((1 + |theta|) ^ 2) filter_upwards [] with K rw [Real.norm_eq_abs, abs_of_nonneg (sq_nonneg _), sq_le_sq, abs_of_nonneg (add_nonneg (by norm_num) (abs_nonneg theta))] have hclip : clipUnit (inverseCountStatistic u K) ∈ Icc (-1 : Real) 1 := by simp [clipUnit] exact (abs_sub _ _).trans (add_le_add (abs_le.2 hclip) le_rfl) have hclipmap : Integrable (fun K => (clipUnit (inverseCountStatistic u K) - theta) ^ 2) (Measure.map finitePrefixCounts mu) := by rw [hmap] exact hclipright unfold sqRisk rw [finitePrefixInverseCountStatistic_eq] change (∫ z, (clipUnit (inverseCountStatistic u (finitePrefixCounts z)) - theta) ^ 2 ∂mu) ≤ _ rw [← integral_map (f := fun K => (clipUnit (inverseCountStatistic u K) - theta) ^ 2) measurable_finitePrefixCounts.aemeasurable hclipmap.aestronglyMeasurable, hmap] exact integral_mono hclipright hright (fun K => clipUnit_sq_sub_le _ _ htheta)
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.finitePrefixInverseCountStatistic_risk_le_poissonCount · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/T_InverseCountBaseline.lean:423
def inverseCountFixedPools

The two disjoint fixed pools actually used by the inverse-count estimator. the stated conditions the stated conclusion.

Definition (Lean source)
n m d :
sample :
Sample n m d
inverseCountFixedPools sample :
(Fin (blockSizes n m).M0 → Obs d) × (Fin ((blockSizes n m).nf + (blockSizes n m).mf) → AuxObs d)
by let bs := blockSizes n m have hn : bs.M0 + (bs.np + bs.nf)
= n := by dsimp [bs, blockSizes] omega have hm : 0
+ (bs.mp + bs.mf)
= m := by dsimp [bs, blockSizes] omega let labeled := independentOuterBlocks bs.M0 bs.np bs.nf (fun i => sample.1 (cast hn i)) let auxiliary := independentOuterBlocks 0 bs.mp bs.mf (fun i => sample.2 (cast hm i)) exact (labeled.1, append (fun i => ((labeled.2 i).1, (labeled.2 i).2.1)) auxiliary.2)
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.inverseCountFixedPools · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/T_InverseCountBaseline.lean:490
theorem measurable_inverseCountFixedPools

Extracting inverse-count pools for labeled size, auxiliary size, and dimension is measurable.

Formal statement
n m d :
Measurable (inverseCountFixedPools (n := n) (m := m) (d := d))
Proof (Lean source)
@[fun_prop] lemma measurable_inverseCountFixedPools (n m d : Nat) : Measurable (inverseCountFixedPools (n := n) (m := m) (d := d)) := by unfold inverseCountFixedPools fun_prop
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.measurable_inverseCountFixedPools · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/T_InverseCountBaseline.lean:508
theorem inverseCountFixedPools_map_annotationLaw

The formal statement establishes the stated conclusion.

Formal statement
n m d :
P :
Measure.map (inverseCountFixedPools (n := n) (m := m) (d := d)) (annotationLaw P n m)
= fixedPoolsLaw (obsLaw P) (auxMarginal P).toMeasure (blockSizes n m).M0 ((blockSizes n m).nf + (blockSizes n m).mf)
Proof (Lean source)
lemma inverseCountFixedPools_map_annotationLaw {n m d : Nat} (P : DiscreteLaw d) : Measure.map (inverseCountFixedPools (n := n) (m := m) (d := d)) (annotationLaw P n m) = fixedPoolsLaw (obsLaw P) (auxMarginal P).toMeasure (blockSizes n m).M0 ((blockSizes n m).nf + (blockSizes n m).mf) := by let bs := blockSizes n m have hn : bs.M0 + (bs.np + bs.nf) = n := by dsimp [bs, blockSizes] omega have hm : 0 + (bs.mp + bs.mf) = m := by dsimp [bs, blockSizes] omega let castL : (Fin n → Obs d) → Fin (bs.M0 + (bs.np + bs.nf)) → Obs d := fun z i => z (cast hn i) let castA : (Fin m → AuxObs d) → Fin (0 + (bs.mp + bs.mf)) → AuxObs d := fun z i => z (cast hm i) let outerL := independentOuterBlocks bs.M0 bs.np bs.nf ∘ castL let outerA := independentOuterBlocks 0 bs.mp bs.mf ∘ castA have hcastL : Measure.map castL (labeledProductLaw P n) = Measure.pi fun _ : Fin (bs.M0 + (bs.np + bs.nf)) => obsLaw P := by exact (MeasureTheory.measurePreserving_piCongrLeft (fun _ : Fin (bs.M0 + (bs.np + bs.nf)) => obsLaw P) (finCongr hn).symm).map_eq have hcastA : Measure.map castA (auxProductLaw P m) = Measure.pi fun _ : Fin (0 + (bs.mp + bs.mf)) => (auxMarginal P).toMeasure := by exact (MeasureTheory.measurePreserving_piCongrLeft (fun _ : Fin (0 + (bs.mp + bs.mf)) => (auxMarginal P).toMeasure) (finCongr hm).symm).map_eq have houterL : Measure.map outerL (labeledProductLaw P n) = (Measure.pi fun _ : Fin bs.M0 => obsLaw P).prod (Measure.pi fun _ : Fin bs.nf => obsLaw P) := by dsimp [outerL] rw [← Measure.map_map (measurable_independentOuterBlocks bs.M0 bs.np bs.nf) (by fun_prop), hcastL] exact map_pi_independentOuterBlocks (obsLaw P) bs.M0 bs.np bs.nf have houterA : Measure.map outerA (auxProductLaw P m) = (Measure.pi fun _ : Fin 0 => (auxMarginal P).toMeasure).prod (Measure.pi fun _ : Fin bs.mf => (auxMarginal P).toMeasure) := by dsimp [outerA] rw [← Measure.map_map (measurable_independentOuterBlocks 0 bs.mp bs.mf) (by fun_prop), hcastA] exact map_pi_independentOuterBlocks (auxMarginal P).toMeasure 0 bs.mp bs.mf let project : Obs d → AuxObs d := fun z => (z.1, z.2.1) have hproject : Measure.map project (obsLaw P) = (auxMarginal P).toMeasure := by exact PMF.toMeasure_map (p := P.pmf) (f := project) (by fun_prop) have hprojectPi : Measure.map (fun z : Fin bs.nf → Obs d => fun i => project (z i)) (Measure.pi fun _ : Fin bs.nf => obsLaw P) = Measure.pi fun _ : Fin bs.nf => (auxMarginal P).toMeasure := by rw [map_pi_finCoordinatewise bs.nf (obsLaw P) (by fun_prop : Measurable project)] simp [hproject] unfold annotationLaw change Measure.map _ ((labeledProductLaw P n).prod (auxProductLaw P m)) = _ let stage1 := map outerL outerA let stage2 := fun z : ((Fin bs.M0 → Obs d) × (Fin bs.nf → Obs d)) × ((Fin 0 → AuxObs d) × (Fin bs.mf → AuxObs d)) => (z.1.1, append (fun i => project (z.1.2 i)) z.2.2) rw [show inverseCountFixedPools = stage2 ∘ stage1 by funext sample simp [inverseCountFixedPools, stage1, stage2, outerL, outerA, castL, castA, bs, project, Function.comp_def]] rw [← Measure.map_map (by fun_prop : Measurable stage2) (by fun_prop : Measurable stage1)] rw [← Measure.map_prod_map _ _ (by fun_prop : Measurable outerL) (by fun_prop : Measurable outerA)] rw [houterL, houterA] let muA := Measure.pi fun _ : Fin bs.M0 => obsLaw P let muL := Measure.pi fun _ : Fin bs.nf => obsLaw P let muZ := Measure.pi fun _ : Fin 0 => (auxMarginal P).toMeasure let muF := Measure.pi fun _ : Fin bs.mf => (auxMarginal P).toMeasure let coord := fun z : Fin bs.nf → Obs d => fun i => project (z i) let assoc : (((Fin bs.M0 → Obs d) × (Fin bs.nf → Obs d)) × ((Fin 0 → AuxObs d) × (Fin bs.mf → AuxObs d))) ≃ᵐ ((Fin bs.M0 → Obs d) × ((Fin bs.nf → Obs d) × ((Fin 0 → AuxObs d) × (Fin bs.mf → AuxObs d)))) := MeasurableEquiv.prodAssoc let drop := fun z : (Fin bs.M0 → Obs d) × ((Fin bs.nf → Obs d) × ((Fin 0 → AuxObs d) × (Fin bs.mf → AuxObs d))) => (z.1, (z.2.1, z.2.2.2)) let recode : (Fin bs.M0 → Obs d) × ((Fin bs.nf → Obs d) × (Fin bs.mf → AuxObs d)) → (Fin bs.M0 → Obs d) × ((Fin bs.nf → AuxObs d) × (Fin bs.mf → AuxObs d)) := fun z => (z.1, (coord z.2.1, z.2.2)) let join : (Fin bs.M0 → Obs d) × ((Fin bs.nf → AuxObs d) × (Fin bs.mf → AuxObs d)) → (Fin bs.M0 → Obs d) × (Fin (bs.nf + bs.mf) → AuxObs d) := fun z => (z.1, append z.2.1 z.2.2) have hdrop : Measure.map drop (muA.prod (muL.prod (muZ.prod muF))) = muA.prod (muL.prod muF) := by change Measure.map (map id (map id snd)) (muA.prod (muL.prod (muZ.prod muF))) = _ rw [← Measure.map_prod_map _ _ measurable_id (by fun_prop), Measure.map_id] rw [← Measure.map_prod_map _ _ measurable_id measurable_snd, Measure.map_id, MeasureTheory.measurePreserving_snd.map_eq] have hrecode : Measure.map recode (muA.prod (muL.prod muF)) = muA.prod ((Measure.pi fun _ : Fin bs.nf => (auxMarginal P).toMeasure).prod muF) := by change Measure.map (map (id : (Fin bs.M0 → Obs d) → (Fin bs.M0 → Obs d)) (map coord (id : (Fin bs.mf → AuxObs d) → (Fin bs.mf → AuxObs d)))) (muA.prod (muL.prod muF)) = _ rw [← Measure.map_prod_map _ _ measurable_id (by fun_prop), Measure.map_id] rw [← Measure.map_prod_map _ _ (by fun_prop : Measurable coord) measurable_id, Measure.map_id] exact congrArg (muA.prod ·) (congrArg (·.prod muF) hprojectPi) have hjoin : Measure.map join (muA.prod ((Measure.pi fun _ : Fin bs.nf => (auxMarginal P).toMeasure).prod muF)) = muA.prod (Measure.pi fun _ : Fin (bs.nf + bs.mf) => (auxMarginal P).toMeasure) := by change Measure.map (map (id : (Fin bs.M0 → Obs d) → (Fin bs.M0 → Obs d)) (fun z : (Fin bs.nf → AuxObs d) × (Fin bs.mf → AuxObs d) => append z.1 z.2)) (muA.prod ((Measure.pi fun _ : Fin bs.nf => (auxMarginal P).toMeasure).prod muF)) = _ rw [← Measure.map_prod_map _ _ measurable_id (by fun_prop), Measure.map_id] exact congrArg (muA.prod ·) (map_prod_finAppend (auxMarginal P).toMeasure bs.nf bs.mf) unfold fixedPoolsLaw change Measure.map stage2 ((muA.prod muL).prod (muZ.prod muF)) = _ have hassoc : Measurable assoc := assoc.measurable have hdrop_meas : Measurable drop := by fun_prop have hrecode_meas : Measurable recode := by fun_prop have hjoin_meas : Measurable join := by fun_prop have hcomp_meas : Measurable (join ∘ recode ∘ drop) := hjoin_meas.comp (hrecode_meas.comp hdrop_meas) calc _ = Measure.map join (Measure.map recode (Measure.map drop (Measure.map assoc ((muA.prod muL).prod (muZ.prod muF))))) := by rw [Measure.map_map hrecode_meas hdrop_meas, Measure.map_map hjoin_meas (hrecode_meas.comp hdrop_meas), Measure.map_map hcomp_meas hassoc] apply congrArg (fun f => Measure.map f ((muA.prod muL).prod (muZ.prod muF))) funext z rfl _ = Measure.map join (Measure.map recode (Measure.map drop (muA.prod (muL.prod (muZ.prod muF))))) := by rw [Measure.prodAssoc_prod] _ = Measure.map join (Measure.map recode (muA.prod (muL.prod muF))) := by rw [hdrop] _ = Measure.map join (muA.prod ((Measure.pi fun _ : Fin bs.nf => (auxMarginal P).toMeasure).prod muF)) := by rw [hrecode] _ = _ := hjoin
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.inverseCountFixedPools_map_annotationLaw · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/T_InverseCountBaseline.lean:513
theorem finitePrefixInverseCountStatistic_fixedPools

the stated conditions establishes the stated conclusion.

Formal statement
n m d :
sample :
Sample n m d
r0 rf :
hr0 :
r0 ≤ (blockSizes n m).M0
hrf :
rf ≤ (blockSizes n m).nf + (blockSizes n m).mf
Proof (Lean source)
lemma finitePrefixInverseCountStatistic_fixedPools {n m d : Nat} (sample : Sample n m d) (r0 rf : Nat) (hr0 : r0 ≤ (blockSizes n m).M0) (hrf : rf ≤ (blockSizes n m).nf + (blockSizes n m).mf) : finitePrefixInverseCountStatistic ((blockSizes n m).M0 / 8 : Real) (prefixOfLE (inverseCountFixedPools sample).1 r0 hr0, prefixOfLE (inverseCountFixedPools sample).2 rf hrf) = inverseCountPrefixOutput sample r0 rf := by classical have hmarked (x : Fin d) (a : Bool) : finiteSampleHistogram (prefixOfLE (inverseCountFixedPools sample).1 r0 hr0).points (x, a, true) = labeledBlockCount sample.1 0 r0 x a true := by rw [finiteSampleHistogram_prefixOfLE_eq_filter] unfold labeledBlockCount have h := card_prefix_offset_eq_filter sample.1 (offset := 0) (L := (blockSizes n m).M0) (r := r0) (by dsimp [blockSizes]; omega) hr0 (x, a, true) simpa [inverseCountFixedPools] using h have hpooled (x : Fin d) (a : Bool) : finiteSampleHistogram (prefixOfLE (inverseCountFixedPools sample).2 rf hrf).points (x, a) = pooledArmCount sample ((blockSizes n m).M0 + (blockSizes n m).np) (blockSizes n m).nf (blockSizes n m).mp rf x a := by dsimp only [inverseCountFixedPools] rw [finiteSampleHistogram_prefix_append] rw [finiteSampleHistogram_prefix_forgetOutcome] rw [finiteSampleHistogram_prefixOfLE_eq_filter, finiteSampleHistogram_prefixOfLE_eq_filter, finiteSampleHistogram_prefixOfLE_eq_filter] unfold pooledArmCount labeledArmBlockCount labeledBlockCount auxiliaryBlockCount have hL0 := card_prefix_offset_eq_filter sample.1 (offset := (blockSizes n m).M0 + (blockSizes n m).np) (L := (blockSizes n m).nf) (r := min rf (blockSizes n m).nf) (by dsimp [blockSizes]; omega) (Nat.min_le_right _ _) (x, a, false) have hL1 := card_prefix_offset_eq_filter sample.1 (offset := (blockSizes n m).M0 + (blockSizes n m).np) (L := (blockSizes n m).nf) (r := min rf (blockSizes n m).nf) (by dsimp [blockSizes]; omega) (Nat.min_le_right _ _) (x, a, true) have hA := card_prefix_offset_eq_filter sample.2 (offset := (blockSizes n m).mp) (L := (blockSizes n m).mf) (r := rf - (blockSizes n m).nf) (by dsimp [blockSizes]; omega) (by omega) (x, a) simpa [inverseCountFixedPools] using (congrArg₂ (fun p q : Nat => p + q) (congrArg₂ (fun p q : Nat => p + q) hL0 hL1) hA) unfold finitePrefixInverseCountStatistic inverseCountPrefixOutput apply congrArg clipUnit unfold inverseCountStatistic simp_rw [hmarked, hpooled]
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.finitePrefixInverseCountStatistic_fixedPools · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/T_InverseCountBaseline.lean:857
theorem independentPrefixInverseCountStatistic_fixedPools

The formal statement establishes the stated conclusion.

Formal statement
n m d :
sample :
Sample n m d
Proof (Lean source)
lemma independentPrefixInverseCountStatistic_fixedPools {n m d : Nat} (sample : Sample n m d) : independentPrefixRaoBlackwellStatistic (toNNReal ((blockSizes n m).M0 / 8 : Real)) (toNNReal (((blockSizes n m).nf + (blockSizes n m).mf : Nat) / 8 : Real)) (finitePrefixInverseCountStatistic ((blockSizes n m).M0 / 8 : Real)) 0 (inverseCountFixedPools sample) = inverseCountEstimator n m d sample := by classical let bs := blockSizes n m let u : Real := bs.M0 / 8 let t : Real := (bs.nf + bs.mf : Nat) / 8 let T := finitePrefixInverseCountStatistic (d := d) u rw [independentPrefixRaoBlackwellStatistic_eq_integral _ _ T (measurable_finitePrefixInverseCountStatistic u) 0] have hint : Integrable (fun counts : Nat × Nat => cappedPrefixStatistic T 0 (((inverseCountFixedPools sample).1, counts.1), ((inverseCountFixedPools sample).2, counts.2))) ((poissonMeasure (toNNReal u)).prod (poissonMeasure (toNNReal t))) := by apply Integrable.of_bound ((measurable_cappedPrefixStatistic (measurable_finitePrefixInverseCountStatistic u) 0).comp (by fun_prop)).aestronglyMeasurable 1 filter_upwards [] with z rw [Real.norm_eq_abs] by_cases h0 : z.1 ≤ bs.M0 · by_cases hf : z.2 ≤ bs.nf + bs.mf · simp only [Function.comp_apply, cappedPrefixStatistic, bs, h0, hf, dite_true] exact abs_le.2 (finitePrefixInverseCountStatistic_mem_Icc u _) · simp [cappedPrefixStatistic, bs, h0, hf] · simp [cappedPrefixStatistic, bs, h0] rw [MeasureTheory.integral_prod _ hint] rw [integral_poissonMeasure] simp only [smul_eq_mul] rw [tsum_eq_sum (s := range (bs.M0 + 1))] · apply Finset.sum_congr rfl intro r0 hr0 have hr0le : r0 ≤ bs.M0 := Nat.lt_succ_iff.mp (Finset.mem_range.mp hr0) rw [integral_poissonMeasure] simp only [smul_eq_mul] rw [tsum_eq_sum (s := range (bs.nf + bs.mf + 1))] · simp only [inverseCountEstimator, bs, u, t] rw [Finset.mul_sum] apply Finset.sum_congr rfl intro rf hrf have hrfle : rf ≤ bs.nf + bs.mf := Nat.lt_succ_iff.mp (Finset.mem_range.mp hrf) rw [show cappedPrefixStatistic T 0 (((inverseCountFixedPools sample).1, r0), ((inverseCountFixedPools sample).2, rf)) = inverseCountPrefixOutput sample r0 rf by simp only [cappedPrefixStatistic, bs, hr0le, hrfle, dite_true] exact finitePrefixInverseCountStatistic_fixedPools sample r0 rf hr0le hrfle] simp only [ProbabilityTheory.poissonMeasure_singleton, MeasureTheory.measureReal_def] rw [ENNReal.toReal_ofReal (by positivity), ENNReal.toReal_ofReal (by positivity)] ring · intro rf hrf have hnot : ¬ rf ≤ bs.nf + bs.mf := fun h => hrf (Finset.mem_range.mpr (Nat.lt_succ_iff.mpr h)) simp [cappedPrefixStatistic, bs, hr0le, hnot] · intro r0 hr0 have hnot : ¬ r0 ≤ bs.M0 := fun h => hr0 (Finset.mem_range.mpr (Nat.lt_succ_iff.mpr h)) simp [cappedPrefixStatistic, bs, hnot]
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.independentPrefixInverseCountStatistic_fixedPools · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/T_InverseCountBaseline.lean:909
theorem inverseCountEstimator_risk_le_poissonPrefixes Lemma 4 in the paper ↗

the stated conditions establishes the stated conclusion.

Formal statement
n m d :
eps :
P :
hP :
ModelClass d eps P
≤ sqRisk (independentPoissonPrefixLaw (obsLaw P) (auxMarginal P).toMeasure (toNNReal ((blockSizes n m).M0 / 8 : Real)) (toNNReal (((blockSizes n m).nf + (blockSizes n m).mf : Nat) / 8 : Real))) (finitePrefixInverseCountStatistic ((blockSizes n m).M0 / 8 : Real)) (ateFunctional P)
+ 4 * ((poissonMeasure (toNNReal ((blockSizes n m).M0 / 8 : Real))).real (Ioi (blockSizes n m).M0) + (poissonMeasure (toNNReal (((blockSizes n m).nf + (blockSizes n m).mf : Nat) / 8 : Real))).real (Ioi ((blockSizes n m).nf + (blockSizes n m).mf)))
Proof (Lean source)
lemma inverseCountEstimator_risk_le_poissonPrefixes {n m d : Nat} (eps : Real) (P : DiscreteLaw d) (hP : ModelClass d eps P) : twoSampleMSE (annotationLaw P n m) (inverseCountEstimator n m d) (ateFunctional P) ≤ sqRisk (independentPoissonPrefixLaw (obsLaw P) (auxMarginal P).toMeasure (toNNReal ((blockSizes n m).M0 / 8 : Real)) (toNNReal (((blockSizes n m).nf + (blockSizes n m).mf : Nat) / 8 : Real))) (finitePrefixInverseCountStatistic ((blockSizes n m).M0 / 8 : Real)) (ateFunctional P) + 4 * ((poissonMeasure (toNNReal ((blockSizes n m).M0 / 8 : Real))).real (Ioi (blockSizes n m).M0) + (poissonMeasure (toNNReal (((blockSizes n m).nf + (blockSizes n m).mf : Nat) / 8 : Real))).real (Ioi ((blockSizes n m).nf + (blockSizes n m).mf))) := by let bs := blockSizes n m let u : NNReal := toNNReal (bs.M0 / 8 : Real) let t : NNReal := toNNReal ((bs.nf + bs.mf : Nat) / 8 : Real) let T := finitePrefixInverseCountStatistic (d := d) (bs.M0 / 8 : Real) let RB := independentPrefixRaoBlackwellStatistic (NX := bs.M0) (NY := bs.nf + bs.mf) u t T 0 have htransfer := finiteAlphabet_independentUnequalPrefix_risk_le (obsLaw P) (auxMarginal P).toMeasure u t bs.M0 (bs.nf + bs.mf) (T := T) (measurable_finitePrefixInverseCountStatistic _) (a := (-1 : Real)) (b := 1) (theta := ateFunctional P) (zOver := 0) (by norm_num) (finitePrefixInverseCountStatistic_mem_Icc _) (ateFunctional_mem_Icc_neg_one_one P hP.overlap) (by norm_num) have hRB : inverseCountEstimator n m d = RB ∘ inverseCountFixedPools := by funext sample exact (independentPrefixInverseCountStatistic_fixedPools sample).symm unfold twoSampleMSE rw [hRB] change (∫ z, (RB (inverseCountFixedPools z) - ateFunctional P) ^ 2 ∂annotationLaw P n m) ≤ _ have hf : AEStronglyMeasurable (fun z : FixedPools bs.M0 (bs.nf + bs.mf) => (RB z - ateFunctional P) ^ 2) (Measure.map inverseCountFixedPools (annotationLaw P n m)) := (measurable_of_countable _).aestronglyMeasurable rw [← integral_map (f := fun z : FixedPools bs.M0 (bs.nf + bs.mf) => (RB z - ateFunctional P) ^ 2) (measurable_inverseCountFixedPools n m d).aemeasurable hf] rw [inverseCountFixedPools_map_annotationLaw P] convert htransfer using 1 <;> norm_num [sqRisk, bs, u, t, T, RB]
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.inverseCountEstimator_risk_le_poissonPrefixes · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/T_InverseCountBaseline.lean:982
theorem poisson_eighth_overflow_le_inv

the stated conditions establishes the stated conclusion.

Formal statement
N :
hN :
0 < N
(poissonMeasure (toNNReal ((N : Real) / 8))).real (Ioi N) ≤ 8 / (N : Real)
Proof (Lean source)
lemma poisson_eighth_overflow_le_inv (N : Nat) (hN : 0 < N) : (poissonMeasure (toNNReal ((N : Real) / 8))).real (Ioi N) ≤ 8 / (N : Real) := by have hNR : 0 < (N : Real) := by exact_mod_cast hN have hN8 : 0 ≤ (N : Real) / 8 := by positivity have hlam : toNNReal ((N : Real) / 8) = (N : NNReal) / 8 := by ext simp [hN8] rw [hlam] have hsqrt : sqrt (2 * ((((N : NNReal) / 8 : NNReal) : Real)) * ((N : Real) / 4)) = (N : Real) / 4 := by rw [show 2 * ((((N : NNReal) / 8 : NNReal) : Real)) * ((N : Real) / 4) = ((N : Real) / 4) ^ 2 by norm_num; ring] rw [Real.sqrt_sq_eq_abs, abs_of_nonneg] positivity have hsubset : Ioi N ⊆ {w : Nat | (w : Real) - ((((N : NNReal) / 8 : NNReal) : Real)) > sqrt (2 * ((((N : NNReal) / 8 : NNReal) : Real)) * ((N : Real) / 4)) + 2 * ((N : Real) / 4)} := by intro w hw simp only [Set.mem_Ioi] at hw ⊢ have hwR : (N : Real) < w := by exact_mod_cast hw rw [hsqrt] norm_num linarith have hbern := poisson_upper_bernstein ((N : NNReal) / 8) (z := (N : Real) / 4) (by positivity) have hmono : poissonMeasure ((N : NNReal) / 8) (Ioi N) ≤ poissonMeasure ((N : NNReal) / 8) {w : Nat | (w : Real) - ((((N : NNReal) / 8 : NNReal) : Real)) > sqrt (2 * ((((N : NNReal) / 8 : NNReal) : Real)) * ((N : Real) / 4)) + 2 * ((N : Real) / 4)} := measure_mono hsubset have hexp : (poissonMeasure ((N : NNReal) / 8)).real (Ioi N) ≤ exp (-(N : Real) / 4) := by simpa only [Measure.real_def, ENNReal.toReal_ofReal (Real.exp_pos _).le, neg_div] using ENNReal.toReal_mono ENNReal.ofReal_ne_top (hmono.trans hbern) calc _ ≤ exp (-(N : Real) / 4) := hexp _ = 1 / exp ((N : Real) / 4) := by rw [show -(N : Real) / 4 = -((N : Real) / 4) by ring, Real.exp_neg, one_div] _ ≤ 1 / ((N : Real) / 4) := by exact one_div_le_one_div_of_le (by positivity) (by linarith [Real.add_one_le_exp ((N : Real) / 4)]) _ = 4 / (N : Real) := by field_simp _ ≤ 8 / (N : Real) := by exact mul_le_mul_of_nonneg_right (by norm_num) (inv_nonneg.mpr hNR.le)
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.poisson_eighth_overflow_le_inv · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/T_InverseCountBaseline.lean:1033
theorem inverseCountEstimator_mse_le_four

the stated conditions establishes the stated conclusion.

Formal statement
n m d :
eps :
P :
hP :
ModelClass d eps P
Proof (Lean source)
lemma inverseCountEstimator_mse_le_four {n m d : Nat} {eps : Real} (P : DiscreteLaw d) (hP : ModelClass d eps P) : twoSampleMSE (annotationLaw P n m) (inverseCountEstimator n m d) (ateFunctional P) ≤ 4 := by unfold twoSampleMSE letI : IsProbabilityMeasure (annotationLaw P n m) := by unfold annotationLaw labeledProductLaw auxProductLaw infer_instance have htheta := ateFunctional_mem_Icc_neg_one_one P hP.overlap calc _ ≤ ∫ _z, (4 : Real) ∂annotationLaw P n m := by apply integral_mono (Integrable.of_finite) (integrable_const 4) intro z have hz := inverseCountEstimator_mem_Icc n m d z rcases htheta with ⟨htlo, hthi⟩ rcases hz with ⟨hzlo, hzhi⟩ nlinarith [sq_nonneg (inverseCountEstimator n m d z - ateFunctional P)] _ = 4 := by simp
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.inverseCountEstimator_mse_le_four · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/T_InverseCountBaseline.lean:1086
theorem inverse_count_baseline Theorem 6 in the paper ↗

The displayed clipped inverse-count estimator, and hence minimax risk, obey the baseline 1/n+d²/(n+m)² bound. the stated conditions the stated conclusion.

Formal statement
eps :
heps :
0 < eps
heps2 :
eps < 1 / 2
∃ C : Real,
0 < C
conclusion 1
n m d :
1 ≤ n
2 ≤ d
(⨆ P : ClassLaw d eps, twoSampleMSE (annotationLaw P.1 n m) (inverseCountEstimator n m d) (ateFunctional P.1))
≤ C * min 1 (1 / (n : Real) + (d : Real) ^ 2 / ((n + m : Nat) : Real) ^ 2)
minimaxRisk n m d eps
≤ C * min 1 (1 / (n : Real) + (d : Real) ^ 2 / ((n + m : Nat) : Real) ^ 2)
Proof (Lean source)
theorem inverse_count_baseline {eps : Real} (heps : 0 < eps) (heps2 : eps < 1 / 2) : ∃ C : Real, 0 < C ∧ ∀ (n m d : Nat), 1 ≤ n → 2 ≤ d → Measurable (inverseCountEstimator n m d) ∧ (⨆ P : ClassLaw d eps, twoSampleMSE (annotationLaw P.1 n m) (inverseCountEstimator n m d) (ateFunctional P.1)) ≤ C * min 1 (1 / (n : Real) + (d : Real) ^ 2 / ((n + m : Nat) : Real) ^ 2) ∧ minimaxRisk n m d eps ≤ C * min 1 (1 / (n : Real) + (d : Real) ^ 2 / ((n + m : Nat) : Real) ^ 2) := by obtain ⟨C₀, hC₀, hpoisson⟩ := poisson_inverse_count_sqRisk_bound heps heps2 let C : Real := 100000 * (1 + C₀ + C₀ ^ 2) have hC : 0 < C := by dsimp [C]; positivity refine ⟨C, hC, ?_⟩ intro n m d hn hd letI : Nonempty (Fin d) := ⟨⟨0, lt_of_lt_of_le Nat.zero_lt_two hd⟩⟩ let hv0 := validDGP_null (C := Fin d) (m₀ := (1 / 2 : Real)) (g₀ := (1 / 2 : Real)) (g₁ := (1 / 2 : Real)) (by norm_num) (by norm_num) (by norm_num) (by norm_num) (by norm_num) (by norm_num) letI : Nonempty (ClassLaw d eps) := ⟨⟨parametricFloorNullLaw hv0, parametricFloorNullLaw_model hd heps heps2 hv0⟩⟩ have hmeas := measurable_inverseCountEstimator n m d have hfixed : (⨆ P : ClassLaw d eps, twoSampleMSE (annotationLaw P.1 n m) (inverseCountEstimator n m d) (ateFunctional P.1)) ≤ C * min 1 (1 / (n : Real) + (d : Real) ^ 2 / ((n + m : Nat) : Real) ^ 2) := by apply ciSup_le intro P let bs := blockSizes n m let u : Real := bs.M0 / 8 let t : Real := (bs.nf + bs.mf : Nat) / 8 let q : Real := 1 / (n : Real) + (d : Real) ^ 2 / ((n + m : Nat) : Real) ^ 2 have hq0 : 0 ≤ q := by dsimp [q]; positivity have hmse4 := inverseCountEstimator_mse_le_four (n := n) (m := m) P.1 P.2 by_cases hn24 : 24 ≤ n · have hM0nat : n ≤ 4 * bs.M0 := by dsimp [bs, blockSizes] omega have hFnat : n + m ≤ 4 * (bs.nf + bs.mf) := by dsimp [bs, blockSizes] omega have hM0pos : 0 < bs.M0 := by dsimp [bs, blockSizes] omega have hFpos : 0 < bs.nf + bs.mf := by omega have hnR : 0 < (n : Real) := by positivity have hNR : 0 < ((n + m : Nat) : Real) := by positivity have hu : 0 < u := by dsimp [u]; positivity have ht : 0 < t := by dsimp [t]; positivity have huLower : (n : Real) / 32 ≤ u := by have hc : (n : Real) ≤ 4 * (bs.M0 : Real) := by exact_mod_cast hM0nat dsimp [u] linarith have htLower : ((n + m : Nat) : Real) / 32 ≤ t := by have hc : ((n + m : Nat) : Real) ≤ 4 * ((bs.nf + bs.mf : Nat) : Real) := by exact_mod_cast hFnat dsimp [t] norm_num at hc ⊢ linarith have huInv : u⁻¹ ≤ 32 / (n : Real) := by rw [show 32 / (n : Real) = ((n : Real) / 32)⁻¹ by field_simp] exact (inv_le_inv₀ (a := u) (b := (n : Real) / 32) hu (by positivity)).2 huLower have htInv : t⁻¹ ≤ 32 / ((n + m : Nat) : Real) := by rw [show 32 / ((n + m : Nat) : Real) = (((n + m : Nat) : Real) / 32)⁻¹ by field_simp] exact (inv_le_inv₀ (a := t) (b := ((n + m : Nat) : Real) / 32) ht (by positivity)).2 htLower have hdt : (d : Real) / t ≤ 32 * (d : Real) / ((n + m : Nat) : Real) := by rw [div_eq_mul_inv, div_eq_mul_inv] calc (d : Real) * t⁻¹ ≤ (d : Real) * (32 * ((n + m : Nat) : Real)⁻¹) := mul_le_mul_of_nonneg_left htInv (by positivity) _ = 32 * (d : Real) * ((n + m : Nat) : Real)⁻¹ := by ring have hdt0 : 0 ≤ (d : Real) / t := by positivity have hdtSq : (min 1 ((d : Real) / t)) ^ 2 ≤ 1024 * (d : Real) ^ 2 / ((n + m : Nat) : Real) ^ 2 := by calc _ ≤ ((d : Real) / t) ^ 2 := by gcongr exact min_le_right _ _ _ ≤ (32 * (d : Real) / ((n + m : Nat) : Real)) ^ 2 := pow_le_pow_left₀ hdt0 hdt 2 _ = _ := by ring have htail0 := poisson_eighth_overflow_le_inv bs.M0 hM0pos have htailf := poisson_eighth_overflow_le_inv (bs.nf + bs.mf) hFpos have hM0Inv : 8 / (bs.M0 : Real) ≤ 32 / (n : Real) := by apply (div_le_div_iff₀ (by positivity) hnR).2 have hc : (n : Real) ≤ 4 * (bs.M0 : Real) := by exact_mod_cast hM0nat nlinarith have hFInv : 8 / ((bs.nf + bs.mf : Nat) : Real) ≤ 32 / ((n + m : Nat) : Real) := by apply (div_le_div_iff₀ (by positivity) hNR).2 have hc : ((n + m : Nat) : Real) ≤ 4 * ((bs.nf + bs.mf : Nat) : Real) := by exact_mod_cast hFnat norm_num at hc ⊢ nlinarith have hNInv : 32 / ((n + m : Nat) : Real) ≤ 32 / (n : Real) := by apply (div_le_div_iff₀ hNR hnR).2 have hc : (n : Real) ≤ ((n + m : Nat) : Real) := by exact_mod_cast le_add_right n m nlinarith have htransfer := inverseCountEstimator_risk_le_poissonPrefixes (n := n) (m := m) (d := d) eps P.1 P.2 have hclip := finitePrefixInverseCountStatistic_risk_le_poissonCount P.1 u t (ateFunctional P.1) hu ht.le (ateFunctional_mem_Icc_neg_one_one P.1 P.2.overlap) have hp := hpoisson d u t hu ht P.1 P.2 have hquant : twoSampleMSE (annotationLaw P.1 n m) (inverseCountEstimator n m d) (ateFunctional P.1) ≤ (64 * C₀ + 1024 * C₀ ^ 2 + 256) * q := by calc _ ≤ sqRisk (independentPoissonPrefixLaw (obsLaw P.1) (auxMarginal P.1).toMeasure (toNNReal u) (toNNReal t)) (finitePrefixInverseCountStatistic u) (ateFunctional P.1) + 4 * ((poissonMeasure (toNNReal u)).real (Ioi bs.M0) + (poissonMeasure (toNNReal t)).real (Ioi (bs.nf + bs.mf))) := by simpa [bs, u, t] using htransfer _ ≤ (∫ K, (inverseCountStatistic u K - ateFunctional P.1) ^ 2 ∂poissonCountLaw P.1 u t) + 4 * ((poissonMeasure (toNNReal u)).real (Ioi bs.M0) + (poissonMeasure (toNNReal t)).real (Ioi (bs.nf + bs.mf))) := add_le_add hclip le_rfl _ ≤ (C₀ * (u⁻¹ + t⁻¹) + C₀ ^ 2 * (min 1 ((d : Real) / t)) ^ 2) + 4 * (8 / (bs.M0 : Real) + 8 / ((bs.nf + bs.mf : Nat) : Real)) := by gcongr _ ≤ (64 * C₀ + 1024 * C₀ ^ 2 + 256) * q := by have hC0nonneg := hC₀.le have hvarTerm : C₀ * (u⁻¹ + t⁻¹) ≤ 64 * C₀ * (1 / (n : Real)) := by have htN : t⁻¹ ≤ 32 / (n : Real) := htInv.trans hNInv calc _ ≤ C₀ * (32 / (n : Real) + 32 / (n : Real)) := by gcongr _ = _ := by ring have hbiasTerm : C₀ ^ 2 * (min 1 ((d : Real) / t)) ^ 2 ≤ 1024 * C₀ ^ 2 * ((d : Real) ^ 2 / ((n + m : Nat) : Real) ^ 2) := by calc _ ≤ C₀ ^ 2 * (1024 * (d : Real) ^ 2 / ((n + m : Nat) : Real) ^ 2) := by gcongr _ = _ := by ring have htailTerm : 4 * (8 / (bs.M0 : Real) + 8 / ((bs.nf + bs.mf : Nat) : Real)) ≤ 256 * (1 / (n : Real)) := by have hfN : 8 / ((bs.nf + bs.mf : Nat) : Real) ≤ 32 / (n : Real) := hFInv.trans hNInv calc _ ≤ 4 * (32 / (n : Real) + 32 / (n : Real)) := by gcongr _ = _ := by ring dsimp [q] have hA : 0 ≤ 1 / (n : Real) := by positivity have hB : 0 ≤ (d : Real) ^ 2 / ((n + m : Nat) : Real) ^ 2 := by positivity calc _ ≤ (64 * C₀ * (1 / (n : Real)) + 1024 * C₀ ^ 2 * ((d : Real) ^ 2 / ((n + m : Nat) : Real) ^ 2)) + 256 * (1 / (n : Real)) := add_le_add (add_le_add hvarTerm hbiasTerm) htailTerm _ ≤ (64 * C₀ + 1024 * C₀ ^ 2 + 256) * (1 / (n : Real) + (d : Real) ^ 2 / ((n + m : Nat) : Real) ^ 2) := by nlinarith [mul_nonneg hC0nonneg hA, mul_nonneg (sq_nonneg C₀) hB] have hAleC : 64 * C₀ + 1024 * C₀ ^ 2 + 256 ≤ C := by dsimp [C] nlinarith [sq_nonneg C₀] by_cases hq : q ≤ 1 · rw [min_eq_right hq] exact hquant.trans (mul_le_mul_of_nonneg_right hAleC hq0) · rw [min_eq_left (le_of_not_ge hq)] exact hmse4.trans (by dsimp [C] nlinarith [sq_nonneg C₀]) · have hnle : n ≤ 23 := by omega have hnR : 0 < (n : Real) := by positivity have hinv : (1 : Real) / 23 ≤ 1 / (n : Real) := by apply one_div_le_one_div_of_le hnR exact_mod_cast hnle have hqLower : (1 : Real) / 23 ≤ min 1 q := by apply le_min (by norm_num) exact hinv.trans (by dsimp [q] exact le_add_of_nonneg_right (by positivity)) exact hmse4.trans (by have hCle : 92 ≤ C := by dsimp [C] nlinarith [sq_nonneg C₀] nlinarith) refine ⟨hmeas, hfixed, ?_⟩ unfold minimaxRisk have hnonneg (est : {f : Sample n m d → Real // Measurable f}) : 0 ≤ ⨆ P : ClassLaw d eps, twoSampleMSE (annotationLaw P.1 n m) est.1 (ateFunctional P.1) := by cases isEmpty_or_nonempty (ClassLaw d eps) with | inl hempty => letI := hempty simp | inr hnonempty => letI := hnonempty by_cases hb : BddAbove (range (fun P : ClassLaw d eps => twoSampleMSE (annotationLaw P.1 n m) est.1 (ateFunctional P.1))) · exact (integral_nonneg fun z => sq_nonneg (est.1 z - ateFunctional (Classical.arbitrary (ClassLaw d eps)).1)).trans (le_ciSup hb (Classical.arbitrary _)) · rw [show (⨆ P : ClassLaw d eps, twoSampleMSE (annotationLaw P.1 n m) est.1 (ateFunctional P.1)) = sSup ∅ from csSup_of_not_bddAbove hb] simp have hb : BddBelow (range (fun est : {f : Sample n m d → Real // Measurable f} => ⨆ P : ClassLaw d eps, twoSampleMSE (annotationLaw P.1 n m) est.1 (ateFunctional P.1))) := by refine ⟨0, ?_⟩ rintro _ ⟨est, rfl⟩ exact hnonneg est exact (ciInf_le hb ⟨inverseCountEstimator n m d, hmeas⟩).trans hfixed
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.inverse_count_baseline · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/T_InverseCountBaseline.lean:1108
CausalSmith.Stat.STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research.T_KnownMarginalBoundary 1 declarations The parametric boundary of the exact-known-marginal experiment.

The parametric boundary of the exact-known-marginal experiment.

theorem known_marginal_boundary Theorem 1 in the paper ↗

The known-marginal minimax risk is uniformly of order 1/n. the stated conditions the stated conclusion.

Formal statement
eps :
heps :
0 < eps
heps2 :
eps < 1 / 2
∃ c C : Real,
0 < c
c ≤ C
conclusion 1
n d :
1 ≤ n
2 ≤ d
c / n ≤ knownMarginalRisk n d eps
knownMarginalRisk n d eps ≤ C / n
Proof (Lean source)
theorem known_marginal_boundary {eps : Real} (heps : 0 < eps) (heps2 : eps < 1 / 2) : ∃ c C : Real, 0 < c ∧ c ≤ C ∧ -- @realizes c_\epsilon(positive lower constant depending only on epsilon) -- @realizes C_\epsilon(finite upper constant depending only on epsilon) ∀ (n d : Nat), 1 ≤ n → 2 ≤ d → c / n ≤ knownMarginalRisk n d eps ∧ knownMarginalRisk n d eps ≤ C / n := by refine ⟨1 / 100, 2 * eps⁻¹, by norm_num, ?_, ?_⟩ · rw [← div_eq_mul_inv] exact (le_div_iff₀ heps).2 (by nlinarith) · intro n d hn hd constructor · letI : Nonempty (Fin d) := ⟨⟨0, lt_of_lt_of_le Nat.zero_lt_two hd⟩⟩ let delta : Real := (2 / 5) / Real.sqrt n have hnR : (0 : Real) < n := by exact_mod_cast hn have hd0 : 0 ≤ delta := by dsimp [delta]; positivity have hdsq : delta ^ 2 = 4 / (25 * (n : Real)) := by dsimp [delta] rw [div_pow, Real.sq_sqrt hnR.le] ring let hv0 := validDGP_null (C := Fin d) (m₀ := (1 / 2 : Real)) (g₀ := (1 / 2 : Real)) (g₁ := (1 / 2 : Real)) (by norm_num) (by norm_num) (by norm_num) (by norm_num) (by norm_num) (by norm_num) have hdu : (1 / 2 : Real) + delta ≤ 1 := by have hs : 1 ≤ Real.sqrt (n : Real) := Real.one_le_sqrt.mpr (by exact_mod_cast hn) have : delta ≤ 2 / 5 := by dsimp [delta] exact div_le_self (by norm_num) hs linarith let hv1 := validDGP_pert (C := Fin d) (m₀ := (1 / 2 : Real)) (g₀ := (1 / 2 : Real)) (g₁ := (1 / 2 : Real)) (δ := delta) (by norm_num) (by norm_num) (by norm_num) (by norm_num) (by norm_num) hd0 hdu let P0 := parametricFloorNullLaw hv0 let P1 := parametricFloorPertLaw hv1 let MP0 : ClassLaw d eps := ⟨P0, parametricFloorNullLaw_model hd heps heps2 hv0⟩ let MP1 : ClassLaw d eps := ⟨P1, parametricFloorPertLaw_model hd heps heps2 hv1⟩ have hreg : (n : Real) * ((1 / 2 : Real) * delta ^ 2 / ((1 / 2 : Real) * (1 - 1 / 2))) ≤ log 2 := by rw [hdsq] have hlog : (8 / 25 : Real) ≤ log 2 := le_trans (by norm_num) (le_of_lt Real.log_two_gt_d9) convert hlog using 1 <;> field_simp [hnR.ne'] <;> ring have htv : tvDist (labeledProductLaw P0 n) (labeledProductLaw P1 n) ≤ 1 / 2 := by simpa [P0, P1, parametricFloorNullLaw, parametricFloorPertLaw, labeledProductLaw, 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) have htable : auxTableOf P0 = auxTableOf P1 := by funext z rcases z with ⟨x, a⟩ cases a <;> simp [auxTableOf, armMass, P0, P1, parametricFloorNullLaw_jointMass, parametricFloorPertLaw_jointMass, obsReal, mC, gNull, gPert] all_goals ring have hsep : 2 * (delta / 2) ≤ |ateFunctional MP0.1 - ateFunctional MP1.1| := by rw [show ateFunctional MP0.1 = 0 by simpa [MP0, P0] using parametricFloorNullLaw_ate hv0, show ateFunctional MP1.1 = delta by simpa [MP1, P1] using parametricFloorPertLaw_ate hv1] rw [show 2 * (delta / 2) = delta by ring, zero_sub, abs_neg, abs_of_nonneg hd0] have hlow := knownMarginalRisk_ge_two_model_tv MP0 MP1 (by simpa [MP0, MP1] using htable) (s := delta / 2) (by positivity) hsep (by simpa [MP0, MP1] using htv) calc 1 / 100 / (n : Real) = (delta / 2) ^ 2 / 4 := by rw [show (delta / 2) ^ 2 = delta ^ 2 / 4 by ring, hdsq] ring _ ≤ knownMarginalRisk n d eps := hlow · have hu := knownMarginalRisk_upper heps n d hn hd simpa [div_eq_mul_inv] using hu
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.known_marginal_boundary · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/T_KnownMarginalBoundary.lean:16
CausalSmith.Stat.STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research.T_KnownMarginalLimit 1 declarations Convergence to the exact-known-treatment-marginal experiment.

Convergence to the exact-known-treatment-marginal experiment.

theorem known_marginal_limit Theorem 5 in the paper ↗

For fixed labeled size and alphabet, the minimax risk converges to the risk with the exact treatment-covariate table supplied. the stated conditions the stated conclusion.

Formal statement
eps :
heps :
0 < eps
heps2 :
eps < 1 / 2
n d :
hn :
1 ≤ n
hd :
2 ≤ d
Tendsto (fun m => minimaxRisk n m d eps) atTop (nhds (knownMarginalRisk n d eps))
Proof (Lean source)
theorem known_marginal_limit {eps : Real} (heps : 0 < eps) (heps2 : eps < 1 / 2) (n d : Nat) (hn : 1 ≤ n) (hd : 2 ≤ d) : Tendsto (fun m => minimaxRisk n m d eps) atTop (nhds (knownMarginalRisk n d eps)) := by letI : Nonempty (Fin d) := Fin.pos_iff_nonempty.mp (lt_of_lt_of_le (by omega) hd) letI : Nonempty (Icc eps (1 - eps)) := ⟨⟨eps, le_rfl, by linarith⟩⟩ letI : Nonempty (KnownMarginalParam d eps) := inferInstance let p := fun theta : KnownMarginalParam d eps ↦ knownMarginalLabelProb (n := n) theta heps.le let q := knownMarginalAuxProb (d := d) (eps := eps) let hq := fun theta : KnownMarginalParam d eps ↦ knownMarginalAuxProb_simplex theta heps.le let tau := knownMarginalTarget (d := d) (eps := eps) have hgeneric := knownMarginalGeneric_tendsto heps heps2 n d hd have hmeasurable : measurableExactTableMinimaxValue p q tau (-1) 1 = exactSideMinimaxValue p q hq tau (-1) 1 := by apply measurableExactTableMinimaxValue_eq_of_tendsto p q tau (fun theta ↦ knownMarginalLabelProb_simplex theta heps.le) hq (by norm_num) knownMarginalTarget_mem exact hgeneric have hlimit : knownMarginalRisk n d eps = exactSideMinimaxValue p q hq tau (-1) 1 := (knownMarginalRisk_eq_measurableValue heps heps2 n d hd).trans hmeasurable have hseq : (fun m ↦ minimaxRisk n m d eps) = (fun m ↦ empiricalSideMinimaxValue p q hq tau (-1) 1 m) := by funext m exact minimaxRisk_eq_empiricalValue heps heps2 n m d hd rw [hseq, hlimit] exact hgeneric
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.known_marginal_limit · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/T_KnownMarginalLimit.lean:15
CausalSmith.Stat.STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research.T_SharpAnnotationFrontier 2 declarations Sharp finite-sample and asymptotic annotation-frontier consequences.

Sharp finite-sample and asymptotic annotation-frontier consequences.

The complete finite-sample bracket, known-marginal limit, and three sequence characterizations asserted by the headline theorem. the stated conditions the stated conclusion.

Definition (Lean source)
eps c C :
AnnotationFrontierConsequences eps c C :
Prop
clause 1
n m d :
1 ≤ n
2 ≤ d
c * frontierRate n m d ≤ minimaxRisk n m d eps
minimaxRisk n m d eps ≤ C * frontierRate n m d
clause 2
n d :
1 ≤ n
= min 1 (1 / (n : Real) + (d : Real) ^ 2 / ((n : Real) ^ 2 * logEN n ^ 2))
clause 3
n d :
1 ≤ n
2 ≤ d
Tendsto (fun m => minimaxRisk n m d eps) atTop (nhds (knownMarginalRisk n d eps))
clause 4
mSeq dSeq :
Nat → Nat
(∀ n, 1 ≤ n → 2 ≤ dSeq n)
Tendsto (fun n => minimaxRisk n (mSeq n) (dSeq n) eps) atTop (nhds 0)
↔ Tendsto (fun n => (dSeq n : Real) / (((n + mSeq n : Nat) : Real) * logEN n)) atTop (nhds 0)
(fun n => minimaxRisk n (mSeq n) (dSeq n) eps)
=O[atTop] (fun n => 1 / (n : Real)) ↔ (fun n => (dSeq n : Real)) =O[atTop] (fun n => ((n + mSeq n : Nat) : Real) * logEN n / sqrt n)
(fun n => minimaxRisk n (mSeq n) (dSeq n) eps)
=o[atTop] (fun n => minimaxRisk n 0 (dSeq n) eps) ↔ Tendsto (fun n => (dSeq n : Real) / (sqrt n * logEN n)) atTop atTop ∧
Tendsto (fun n => ((dSeq n : Real) / (((n + mSeq n : Nat) : Real) * logEN n)) / min 1 ((dSeq n : Real) / ((n : Real) * logEN n))) atTop (nhds 0)
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.AnnotationFrontierConsequences · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/T_SharpAnnotationFrontier.lean:19
theorem sharp_annotation_frontier Theorem 4 in the paper ↗

The minimax risk has the sharp annotation-frontier rate and exactly the stated known-marginal and sequence-regime consequences. the stated conditions the stated conclusion.

Formal statement
eps :
heps :
0 < eps
heps2 :
eps < 1 / 2
∃ c C : Real,
conclusion 1
0 < c
conclusion 2
c ≤ C
conclusion 3
Proof (Lean source)
theorem sharp_annotation_frontier {eps : Real} (heps : 0 < eps) (heps2 : eps < 1 / 2) : ∃ c C : Real, 0 < c ∧ -- @realizes c_\epsilon(positive two-sided lower constant depending only on epsilon) c ≤ C ∧ -- @realizes C_\epsilon(finite two-sided upper constant depending only on epsilon) AnnotationFrontierConsequences eps c C := by obtain ⟨c, hc, calibration, hlower⟩ := common_marginal_converse heps heps2 obtain ⟨C₀, hC₀, hupper⟩ := uniform_mixed_upper heps heps2 let C := max c C₀ have hC : 0 < C := hc.trans_le (le_max_left _ _) refine ⟨c, C, hc, le_max_left _ _, ?_, ?_, ?_, ?_⟩ · intro n m d hn hd constructor · exact (hlower n m d hn hd).choose_spec.2 · calc minimaxRisk n m d eps ≤ ⨆ P : ClassLaw d eps, twoSampleMSE (annotationLaw P.1 n m) (mixedEstimator n m d eps) (ateFunctional P.1) := minimaxRisk_le_measurable_estimator _ (measurable_mixedEstimator n m d eps) _ ≤ C₀ * frontierRate n m d := hupper n m d hn hd _ ≤ C * frontierRate n m d := by exact mul_le_mul_of_nonneg_right (le_max_right c C₀) (frontierRate_mem_Ioc_zero_one n m d hn).1.le · intro n d hn rw [frontierRate] norm_num · intro n d hn hd exact known_marginal_limit heps heps2 n d hn hd · intro mSeq dSeq hd let risk : Nat → Real := fun n ↦ minimaxRisk n (mSeq n) (dSeq n) eps let rate : Nat → Real := fun n ↦ frontierRate n (mSeq n) (dSeq n) let risk₀ : Nat → Real := fun n ↦ minimaxRisk n 0 (dSeq n) eps let rate₀ : Nat → Real := fun n ↦ frontierRate n 0 (dSeq n) have htheta : risk =Θ[atTop] rate := by apply positive_two_sided_bounds_isTheta risk rate hc hC · exact Filter.Eventually.of_forall fun n ↦ (minimaxRisk_mem_Icc_zero_one _ _ _ _).1 · filter_upwards [eventually_ge_atTop 1] with n hn exact (frontierRate_mem_Ioc_zero_one _ _ _ hn).1.le · filter_upwards [eventually_ge_atTop 1] with n hn exact (hlower n (mSeq n) (dSeq n) hn (hd n hn)).choose_spec.2 · filter_upwards [eventually_ge_atTop 1] with n hn dsimp [risk, rate] calc minimaxRisk n (mSeq n) (dSeq n) eps ≤ C₀ * frontierRate n (mSeq n) (dSeq n) := by exact (minimaxRisk_le_measurable_estimator _ (measurable_mixedEstimator n (mSeq n) (dSeq n) eps)).trans (hupper n (mSeq n) (dSeq n) hn (hd n hn)) _ ≤ C * frontierRate n (mSeq n) (dSeq n) := by exact mul_le_mul_of_nonneg_right (le_max_right c C₀) (frontierRate_mem_Ioc_zero_one n (mSeq n) (dSeq n) hn).1.le have htheta₀ : risk₀ =Θ[atTop] rate₀ := by apply positive_two_sided_bounds_isTheta risk₀ rate₀ hc hC · exact Filter.Eventually.of_forall fun n ↦ (minimaxRisk_mem_Icc_zero_one _ _ _ _).1 · filter_upwards [eventually_ge_atTop 1] with n hn exact (frontierRate_mem_Ioc_zero_one _ _ _ hn).1.le · filter_upwards [eventually_ge_atTop 1] with n hn exact (hlower n 0 (dSeq n) hn (hd n hn)).choose_spec.2 · filter_upwards [eventually_ge_atTop 1] with n hn dsimp [risk₀, rate₀] calc minimaxRisk n 0 (dSeq n) eps ≤ C₀ * frontierRate n 0 (dSeq n) := by exact (minimaxRisk_le_measurable_estimator _ (measurable_mixedEstimator n 0 (dSeq n) eps)).trans (hupper n 0 (dSeq n) hn (hd n hn)) _ ≤ C * frontierRate n 0 (dSeq n) := by exact mul_le_mul_of_nonneg_right (le_max_right c C₀) (frontierRate_mem_Ioc_zero_one n 0 (dSeq n) hn).1.le constructor · constructor · intro hrisk apply annotation_frontier_consistency_iff mSeq dSeq hd |>.1 exact htheta.isBigO_symm.trans_tendsto hrisk · intro hrate apply htheta.isBigO.trans_tendsto exact (annotation_frontier_consistency_iff mSeq dSeq hd).2 hrate · constructor · exact htheta.isBigO_congr_left.trans (annotation_frontier_parametric_iff mSeq dSeq hd) · exact htheta.isLittleO_congr_left.trans <| htheta₀.isLittleO_congr_right.trans <| annotation_frontier_strict_improvement_iff mSeq dSeq hd
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.sharp_annotation_frontier · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/T_SharpAnnotationFrontier.lean:50
CausalSmith.Stat.STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research.T_UniformMixedUpper 1 declarations Uniform risk bound for the mixed-information hybrid.

Uniform risk bound for the mixed-information hybrid.

theorem uniform_mixed_upper Theorem 2 in the paper ↗

One overlap-dependent constant bounds the hybrid's worst-case MSE by the annotation-frontier rate for all n,m,d. the stated conditions the stated conclusion.

Formal statement
eps :
heps :
0 < eps
heps2 :
eps < 1 / 2
∃ C : Real,
0 < C
conclusion 1
n m d :
1 ≤ n
2 ≤ d
(⨆ P : ClassLaw d eps, twoSampleMSE (annotationLaw P.1 n m) (mixedEstimator n m d eps) (ateFunctional P.1))
≤ C * frontierRate n m d
Proof (Lean source)
theorem uniform_mixed_upper {eps : Real} (heps : 0 < eps) (heps2 : eps < 1 / 2) : ∃ C : Real, 0 < C ∧ ∀ (n m d : Nat), 1 ≤ n → 2 ≤ d → (⨆ P : ClassLaw d eps, twoSampleMSE (annotationLaw P.1 n m) (mixedEstimator n m d eps) (ateFunctional P.1)) ≤ C * frontierRate n m d := by obtain ⟨C₁, hC₁, htransfer⟩ := fixed_sample_hybrid_transfer obtain ⟨C₂, hC₂, hpoisson⟩ := poisson_hybrid_risk heps heps2 refine ⟨2 * C₂ + C₁, by positivity, ?_⟩ intro n m d hn hd apply Real.iSup_le · intro P have hfixed := (htransfer eps heps heps2 n m d hn hd P.1 P.2).2 have hpois := hpoisson n m d P.1 hn hd P.2 have hinv := inv_n_le_frontierRate n m d hn calc twoSampleMSE (annotationLaw P.1 n m) (mixedEstimator n m d eps) (ateFunctional P.1) ≤ 2 * poissonHybridMSE P.1 n m eps + C₁ / n := hfixed _ ≤ 2 * (C₂ * frontierRate n m d) + C₁ * frontierRate n m d := by rw [div_eq_mul_inv] gcongr simpa [one_div] using hinv _ = (2 * C₂ + C₁) * frontierRate n m d := by ring · have hr := (frontierRate_mem_Ioc_zero_one n m d hn).1 positivity
CausalSmith.Stat.SemisupervisedDiscreteAteAnnotationFrontier.uniform_mixed_upper · CausalSmith/Stat/STAT_SemisupervisedDiscreteAteAnnotationFrontier_Research/T_UniformMixedUpper.lean:13