Formalization: Minimax Estimation and Honest Inference in Randomized Experiments with Missing Outcomes

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 (d07574d) — statements may have moved since the audit.

CausalSmith.Stat.STAT_MarNearcompleteFrontier_Research.Basic 64 declarations The full law retains observed and potential coordinates separately, making consistency a substantive condition.

Finite randomized MAR experiment

The full law retains observed and potential coordinates separately, making consistency a substantive condition. The finite PMF model is used because the paper's risks range over explicit observed-data laws, rather than regime-indexed potential-outcome kernels.

structure PotentialAtom Definition 1 in the paper ↗

Baseline and potential coordinates.

Definition (Lean source)
structure PotentialAtom (d : ℕ) where X : Fin d -- @realizes X(carrier Fin d) S0 : Bool -- @realizes S0(carrier Bool) S1 : Bool -- @realizes S1(carrier Bool) Y0 : Bool -- @realizes Y0(carrier Bool) Y1 : Bool -- @realizes Y1(carrier Bool) deriving DecidableEq, Fintype
CausalSmith.Stat.MarNearcompleteFrontier.PotentialAtom · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Basic.lean:25
instance instDecidableEqPotentialAtom

Potential-data atoms have decidable equality for the given covariate dimension.

Definition (Lean source)
deriving DecidableEq, Fintype
CausalSmith.Stat.MarNearcompleteFrontier.instDecidableEqPotentialAtom · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Basic.lean:32
instance instFintypePotentialAtom

Potential-data atoms have a finite enumeration for the given covariate dimension.

Definition (Lean source)
deriving DecidableEq, Fintype
CausalSmith.Stat.MarNearcompleteFrontier.instFintypePotentialAtom · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Basic.lean:32

Full-data atom with separate observed and potential outcomes.

Definition (Lean source)
structure FullAtom (d : ℕ) where potential : PotentialAtom d A : Bool -- @realizes A(carrier Bool) S : Bool -- @realizes S(carrier Bool) Y : Bool -- @realizes Y(carrier Bool) R : Bool -- @realizes R(carrier Bool) deriving DecidableEq, Fintype
CausalSmith.Stat.MarNearcompleteFrontier.FullAtom · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Basic.lean:40
instance instDecidableEqFullAtom

Full-data atoms have decidable equality for the given covariate dimension.

Definition (Lean source)
deriving DecidableEq, Fintype
CausalSmith.Stat.MarNearcompleteFrontier.instDecidableEqFullAtom · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Basic.lean:47
instance instFintypeFullAtom

Full-data atoms have a finite enumeration for the given covariate dimension.

Definition (Lean source)
deriving DecidableEq, Fintype
CausalSmith.Stat.MarNearcompleteFrontier.instFintypeFullAtom · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Basic.lean:47
def X

The baseline covariate of a full-data atom is inherited from the supplied atom.

Definition (Lean source)
d :
ℕ
w :
X w :
Fin d
w.potential.X
CausalSmith.Stat.MarNearcompleteFrontier.FullAtom.X · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Basic.lean:55
def S0

The control-arm arrival indicator of a full-data atom is inherited from the supplied atom.

Definition (Lean source)
d :
ℕ
w :
S0 w :
w.potential.S0
CausalSmith.Stat.MarNearcompleteFrontier.FullAtom.S0 · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Basic.lean:57
def S1

The treated-arm arrival indicator of a full-data atom is inherited from the supplied atom.

Definition (Lean source)
d :
ℕ
w :
S1 w :
w.potential.S1
CausalSmith.Stat.MarNearcompleteFrontier.FullAtom.S1 · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Basic.lean:59
def Y0

The control potential outcome of a full-data atom is inherited from the supplied atom.

Definition (Lean source)
d :
ℕ
w :
Y0 w :
w.potential.Y0
CausalSmith.Stat.MarNearcompleteFrontier.FullAtom.Y0 · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Basic.lean:61
def Y1

The treated potential outcome of a full-data atom is inherited from the supplied atom.

Definition (Lean source)
d :
ℕ
w :
Y1 w :
w.potential.Y1
CausalSmith.Stat.MarNearcompleteFrontier.FullAtom.Y1 · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Basic.lean:63

The record visible to the statistician; the last coordinate is R Y.

Definition (Lean source)
structure Obs (d : ℕ) where X : Fin d -- @realizes O(first coordinate X) A : Bool -- @realizes O(second coordinate A) S : Bool -- @realizes O(third coordinate S) R : Bool -- @realizes O(fourth coordinate R) RY : Bool -- @realizes O(fifth coordinate RY) deriving DecidableEq, Fintype
CausalSmith.Stat.MarNearcompleteFrontier.Obs · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Basic.lean:66
instance instDecidableEqObs

Observed-data atoms have decidable equality for the given covariate dimension.

Definition (Lean source)
deriving DecidableEq, Fintype
CausalSmith.Stat.MarNearcompleteFrontier.instDecidableEqObs · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Basic.lean:73
instance instFintypeObs

Observed-data atoms have a finite enumeration for the given covariate dimension.

Definition (Lean source)
deriving DecidableEq, Fintype
CausalSmith.Stat.MarNearcompleteFrontier.instFintypeObs · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Basic.lean:73
instance instMeasurableSpaceObs

The measurable structure on observed atoms is the discrete structure for the given covariate dimension.

Definition (Lean source)
instance (d : ℕ) : MeasurableSpace (Obs d) := ⊤
CausalSmith.Stat.MarNearcompleteFrontier.instMeasurableSpaceObs · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Basic.lean:81
instance instMeasurableSingletonClassObs

Every singleton observed atom is measurable for the given covariate dimension.

Definition (Lean source)
instance (d : ℕ) : MeasurableSingletonClass (Obs d) := ⟨fun _ => trivial⟩
CausalSmith.Stat.MarNearcompleteFrontier.instMeasurableSingletonClassObs · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Basic.lean:83

Superpopulation distribution on full-data atoms.

Definition (Lean source)
d :
ℕ
pmf :
CausalSmith.Stat.MarNearcompleteFrontier.FullLaw · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Basic.lean:86
def observe

Deterministic observation, with a zero outcome mark when the outcome does not arrive.

Definition (Lean source)
d :
ℕ
w :
observe w :
Obs d
⟨w.X, w.A, w.S, w.R, w.R && w.Y⟩
CausalSmith.Stat.MarNearcompleteFrontier.observe · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Basic.lean:90
def observedLaw

Observed-data marginal of the superpopulation law.

Definition (Lean source)
d :
ℕ
P :
observedLaw P :
PMF (Obs d)
P.pmf.map observe
CausalSmith.Stat.MarNearcompleteFrontier.observedLaw · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Basic.lean:95
def fullMass

Real mass of a full-data atom.

Definition (Lean source)
d :
ℕ
P :
w :
fullMass P w :
ℝ
(P.pmf w).toReal
CausalSmith.Stat.MarNearcompleteFrontier.fullMass · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Basic.lean:99
def massOf

Probability of a full-data event.

Definition (Lean source)
d :
ℕ
P :
E :
FullAtom d → Prop
massOf P E :
ℝ
by classical exact ∑ w : FullAtom d, if E w then fullMass P w else 0
CausalSmith.Stat.MarNearcompleteFrontier.massOf · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Basic.lean:103
def obsMass

Probability of an observed atom.

Definition (Lean source)
d :
ℕ
p :
PMF (Obs d)
o :
Obs d
obsMass p o :
ℝ
(p o).toReal
CausalSmith.Stat.MarNearcompleteFrontier.obsMass · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Basic.lean:108
def armMass

Marginal mass of a treatment arm.

Definition (Lean source)
d :
ℕ
P :
a :
armMass P a :
ℝ
massOf P (fun w => w.A = a)
CausalSmith.Stat.MarNearcompleteFrontier.armMass · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Basic.lean:112
def cellMass

Mass of an occupied (X,A,S) cell.

Definition (Lean source)
d :
ℕ
P :
x :
Fin d
a s :
cellMass P x a s :
ℝ
massOf P (fun w => w.X = x ∧ w.A = a ∧ w.S = s)
CausalSmith.Stat.MarNearcompleteFrontier.cellMass · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Basic.lean:116
def arrivalProb

The arrival probability, totalized to zero on null cells.

Definition (Lean source)
d :
ℕ
P :
x :
Fin d
a s :
arrivalProb P x a s :
ℝ
massOf P (fun w => w.X = x ∧ w.A = a ∧ w.S = s ∧ w.R = true) / cellMass P x a s
CausalSmith.Stat.MarNearcompleteFrontier.arrivalProb · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Basic.lean:121
def outcomeMean

Arrived-outcome regression calculated solely from the observed distribution.

Definition (Lean source)
d :
ℕ
p :
PMF (Obs d)
x :
Fin d
a s :
outcomeMean p x a s :
ℝ
(∑ o : Obs d, if o.X = x ∧ o.A = a ∧ o.S = s ∧ o.R = true ∧ o.RY = true then obsMass p o else 0) / (∑ o : Obs d, if o.X = x ∧ o.A = a ∧ o.S = s ∧ o.R = true then obsMass p o else 0)
CausalSmith.Stat.MarNearcompleteFrontier.outcomeMean · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Basic.lean:128

Superpopulation ATE.

Definition (Lean source)
d :
ℕ
P :
tau P :
ℝ
∑ w : FullAtom d, fullMass P w * ((if w.Y1 then 1 else 0) - (if w.Y0 then 1 else 0))
CausalSmith.Stat.MarNearcompleteFrontier.tau · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Basic.lean:137
def RandomizedIndependence

Randomization factors the treatment from all baseline and potential coordinates. Given the specified input P, the stated mathematical conclusion holds.

Definition (Lean source)
d :
ℕ
shared
P :
a x s0 s1 y0 y1 :
RandomizedIndependence P :
Prop
massOf P (fun w => w.A = a ∧ w.X = x ∧ w.S0 = s0 ∧ w.S1 = s1 ∧ w.Y0 = y0 ∧ w.Y1 = y1)
= armMass P a * massOf P (fun w => w.X = x ∧ w.S0 = s0 ∧ w.S1 = s1 ∧ w.Y0 = y0 ∧ w.Y1 = y1)
CausalSmith.Stat.MarNearcompleteFrontier.RandomizedIndependence · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Basic.lean:147
def BalancedRandomization

Balanced Bernoulli treatment allocation. Given the specified input P, the stated mathematical conclusion holds.

Definition (Lean source)
d :
ℕ
shared
P :
BalancedRandomization P :
Prop
armMass P true = (1 : ℝ) / 2
CausalSmith.Stat.MarNearcompleteFrontier.BalancedRandomization · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Basic.lean:156
def Consistency

Observed outcomes equal their treatment-selected potential outcomes almost surely. Given the specified input P, the stated mathematical conclusion holds.

Definition (Lean source)
d :
ℕ
shared
P :
w :
w.S ≠ (if w.A then w.S1 else w.S0) ∨ w.Y ≠ (if w.A then w.Y1 else w.Y0)
Consistency P :
Prop
fullMass P w = 0
CausalSmith.Stat.MarNearcompleteFrontier.Consistency · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Basic.lean:161
def MissingAtRandom

Cross-multiplied conditional independence of arrival and realized outcome. Given the specified input P, the stated mathematical conclusion holds.

Definition (Lean source)
d :
ℕ
shared
P :
x a s r y :
MissingAtRandom P :
Prop
massOf P (fun w => w.X = x ∧ w.A = a ∧ w.S = s ∧ w.R = r ∧ w.Y = y) * cellMass P x a s
= massOf P (fun w => w.X = x ∧ w.A = a ∧ w.S = s ∧ w.R = r) * massOf P (fun w => w.X = x ∧ w.A = a ∧ w.S = s ∧ w.Y = y)
CausalSmith.Stat.MarNearcompleteFrontier.MissingAtRandom · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Basic.lean:170
def ArrivalFloor

Uniform arrival floor on occupied cells. Given the specified input q, the specified input P, the stated mathematical conclusion holds.

Definition (Lean source)
d :
ℕ
shared
q :
ℝ
P :
x a s :
0 < cellMass P x a s
ArrivalFloor q P :
Prop
q ≤ arrivalProb P x a s
CausalSmith.Stat.MarNearcompleteFrontier.ArrivalFloor · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Basic.lean:179
structure LawClass

The randomized finite-cell MAR law class. Given the specified input d, the specified input q, the specified input P, the stated mathematical conclusion holds.

Definition (Lean source)
d :
ℕ
q :
ℝ
P :
randomized :
balanced :
consistency :
Consistency P
mar :
floor :
CausalSmith.Stat.MarNearcompleteFrontier.LawClass · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Basic.lean:185

A law with its certificate of membership in the MAR class.

Definition (Lean source)
d :
ℕ
q :
ℝ
ClassLaw d q :
Type
{P : FullLaw d // LawClass d q P}
CausalSmith.Stat.MarNearcompleteFrontier.ClassLaw · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Basic.lean:194
def condCellMass

Treatment-conditional (X,S) mass computed from the observed law.

Definition (Lean source)
d :
ℕ
p :
PMF (Obs d)
x :
Fin d
a s :
condCellMass p x a s :
ℝ
(∑ o : Obs d, if o.X = x ∧ o.A = a ∧ o.S = s then obsMass p o else 0) / (∑ o : Obs d, if o.A = a then obsMass p o else 0)
CausalSmith.Stat.MarNearcompleteFrontier.condCellMass · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Basic.lean:197
def psi

Observed-data MAR identifying functional, with totalized null-cell terms. Given the specified input d, the stated mathematical conclusion holds. Given the specified input p.

Definition (Lean source)
d :
ℕ
p :
PMF (Obs d)
psi p :
ℝ
∑ x : Fin d, ∑ s : Bool, (condCellMass p x true s * outcomeMean p x true s - condCellMass p x false s * outcomeMean p x false s)
CausalSmith.Stat.MarNearcompleteFrontier.psi · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Basic.lean:204
def delta

The missingness envelope.

Definition (Lean source)
q :
ℝ
delta q :
ℝ
1 - q
CausalSmith.Stat.MarNearcompleteFrontier.delta · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Basic.lean:211
def ell

Logarithmic moment scale.

Definition (Lean source)
n :
ℕ
ell n :
ℝ
log (exp 1 + n)
CausalSmith.Stat.MarNearcompleteFrontier.ell · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Basic.lean:214

Half-separation scale.

Definition (Lean source)
n d :
ℕ
q :
ℝ
gScale n d q :
ℝ
delta q * min 1 ((d : ℝ) / ((n : ℝ) * ell n))
CausalSmith.Stat.MarNearcompleteFrontier.gScale · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Basic.lean:218

Near-complete minimax squared-error rate. Given the specified input n, the specified input d, the specified input q, the stated mathematical conclusion holds.

Definition (Lean source)
n d :
ℕ
q :
ℝ
rate n d q :
ℝ
1 / (n : ℝ) + gScale n d q ^ 2
CausalSmith.Stat.MarNearcompleteFrontier.rate · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Basic.lean:224
def samplePi

Canonical iid law of the observed sample.

Definition (Lean source)
d :
ℕ
P :
n :
ℕ
samplePi P n :
Measure (Fin n → Obs d)
Measure.pi (fun _ : Fin n => (observedLaw P).toMeasure)
CausalSmith.Stat.MarNearcompleteFrontier.samplePi · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Basic.lean:232
def IidSample

A supplied sample law equals the iid observed-data product law. Given the specified input d, the specified input P, the specified input n, the stated mathematical conclusion holds. Given the specified input μ.

Definition (Lean source)
d :
ℕ
P :
n :
ℕ
μ :
Measure (Fin n → Obs d)
IidSample P n μ :
Prop
μ = samplePi P n
CausalSmith.Stat.MarNearcompleteFrontier.IidSample · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Basic.lean:237

Total measurable observed-data estimator with range in [-1,1].

Definition (Lean source)
n d :
ℕ
toFun :
(Fin n → Obs d) → ℝ
measurable :
range :
∀ o, toFun o ∈ Icc (-1) 1
CausalSmith.Stat.MarNearcompleteFrontier.Estimator · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Basic.lean:241
instance instCoeFunEstimatorForallForallFinObsReal

An estimator acts as its sample-to-real function for the sample size and covariate dimension.

Definition (Lean source)
instance (n d : ℕ) : CoeFun (Estimator n d) (fun _ => (Fin n → Obs d) → ℝ) := ⟨Estimator.toFun⟩
CausalSmith.Stat.MarNearcompleteFrontier.instCoeFunEstimatorForallForallFinObsReal · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Basic.lean:247
def pointMinimaxRisk Definition 9 in the paper ↗

All-procedure finite-sample minimax squared risk. Given the specified input n, the specified input d, the specified input q, the stated mathematical conclusion holds.

Definition (Lean source)
n d :
ℕ
q :
ℝ
pointMinimaxRisk n d q :
ℝ
⨅ T : Estimator n d, ⨆ P : ClassLaw d q, ∫ o, (T o - tau P.val) ^ 2 ∂ samplePi P.val n
CausalSmith.Stat.MarNearcompleteFrontier.pointMinimaxRisk · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Basic.lean:252

A measurable closed interval inside [-1,1].

Definition (Lean source)
n d :
ℕ
lo :
(Fin n → Obs d) → ℝ
hi :
(Fin n → Obs d) → ℝ
lo_measurable :
hi_measurable :
bounds :
∀ o, -1 ≤ lo o ∧ lo o ≤ hi o ∧ hi o ≤ 1
CausalSmith.Stat.MarNearcompleteFrontier.IntervalProc · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Basic.lean:258

Uniform coverage over the legal law class.

Definition (Lean source)
n d :
ℕ
q α :
ℝ
I :
P :
Honest n d q α I :
Prop
1 - α ≤ (samplePi P.val n).real {o | tau P.val ∈ Icc (I.lo o) (I.hi o)}
CausalSmith.Stat.MarNearcompleteFrontier.Honest · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Basic.lean:266
def HonestIntervalClass

Honest connected confidence intervals at noncoverage level α. Given the specified input n, the specified input d, the specified input q, the stated mathematical conclusion holds. Given the specified input α.

Definition (Lean source)
n d :
ℕ
q α :
ℝ
HonestIntervalClass n d q α :
Type
{I : IntervalProc n d // Honest n d q α I}
CausalSmith.Stat.MarNearcompleteFrontier.HonestIntervalClass · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Basic.lean:273
def lengthMinimaxRisk Definition 11 in the paper ↗

Minimax worst-law expected interval length. Given the specified input n, the specified input d, the specified input q, the stated mathematical conclusion holds. Given the specified input α.

Definition (Lean source)
n d :
ℕ
q α :
ℝ
lengthMinimaxRisk n d q α :
ℝ
⨅ I : HonestIntervalClass n d q α, ⨆ P : ClassLaw d q, ∫ o, (I.val.hi o - I.val.lo o) ∂ samplePi P.val n
CausalSmith.Stat.MarNearcompleteFrontier.lengthMinimaxRisk · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Basic.lean:279
theorem obsMass_sum_event

Observed event masses are the pushforwards of their full-data preimages. Given the specified input d, the specified input P, the specified input E, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
P :
E :
Obs d → Prop
(∑ o : Obs d, if E o then obsMass (observedLaw P) o else 0)
= massOf P (fun w => E (observe w))
Proof (Lean source)
-- @node: obsMass_sum_event lemma obsMass_sum_event {d : ℕ} (P : FullLaw d) (E : Obs d → Prop) [DecidablePred E] : (∑ o : Obs d, if E o then obsMass (observedLaw P) o else 0) = massOf P (fun w => E (observe w)) := by classical have hmass (o : Obs d) : obsMass (observedLaw P) o = ∑ w : FullAtom d, if observe w = o then fullMass P w else 0 := by simp only [obsMass, observedLaw, PMF.map_apply, tsum_fintype] rw [ENNReal.toReal_sum] · simp only [fullMass, apply_ite, ENNReal.toReal_zero] apply Finset.sum_congr rfl intro w hw split_ifs <;> simp_all [eq_comm] · intro w hw split · exact PMF.apply_ne_top P.pmf w · simp simp only [hmass, massOf] calc (∑ o : Obs d, if E o then ∑ w : FullAtom d, if observe w = o then fullMass P w else 0 else 0) = ∑ o : Obs d, ∑ w : FullAtom d, if E o ∧ observe w = o then fullMass P w else 0 := by apply Finset.sum_congr rfl intro o ho by_cases hE : E o <;> simp [hE] _ = _ := by rw [Finset.sum_comm] apply Finset.sum_congr rfl intro w hw by_cases hE : E (observe w) · rw [if_pos hE] conv_rhs => rw [← show (if E (observe w) ∧ observe w = observe w then fullMass P w else 0) = fullMass P w from by simp [hE]] apply Finset.sum_eq_single (observe w) · intro o ho hne simp [Ne.symm hne] · intro hn simp at hn · rw [if_neg hE] apply Finset.sum_eq_zero intro o ho by_cases heq : observe w = o · subst o simp [hE] · simp [heq]
CausalSmith.Stat.MarNearcompleteFrontier.obsMass_sum_event · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Basic.lean:285
theorem observed_arm_mass

Given the specified input d, the specified input P, the specified input a, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
P :
a :
(∑ o : Obs d, if o.A = a then obsMass (observedLaw P) o else 0) = armMass P a
Proof (Lean source)
lemma observed_arm_mass {d : ℕ} (P : FullLaw d) (a : Bool) : (∑ o : Obs d, if o.A = a then obsMass (observedLaw P) o else 0) = armMass P a := by classical simpa [armMass, observe] using (obsMass_sum_event P (fun o : Obs d => o.A = a))
CausalSmith.Stat.MarNearcompleteFrontier.observed_arm_mass · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Basic.lean:336
theorem observed_cell_mass

Given the specified input d, the specified input P, the specified input x, the specified input a, the specified input s, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
P :
x :
Fin d
a s :
(∑ o : Obs d, if o.X = x ∧ o.A = a ∧ o.S = s then obsMass (observedLaw P) o else 0)
= cellMass P x a s
Proof (Lean source)
lemma observed_cell_mass {d : ℕ} (P : FullLaw d) (x : Fin d) (a s : Bool) : (∑ o : Obs d, if o.X = x ∧ o.A = a ∧ o.S = s then obsMass (observedLaw P) o else 0) = cellMass P x a s := by classical simpa [cellMass, observe] using (obsMass_sum_event P (fun o : Obs d => o.X = x ∧ o.A = a ∧ o.S = s))
CausalSmith.Stat.MarNearcompleteFrontier.observed_cell_mass · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Basic.lean:345
theorem observed_arrived_mass

Given the specified input d, the specified input P, the specified input x, the specified input a, the specified input s, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
P :
x :
Fin d
a s :
(∑ o : Obs d, if o.X = x ∧ o.A = a ∧ o.S = s ∧ o.R = true then obsMass (observedLaw P) o else 0)
= massOf P (fun w => w.X = x ∧ w.A = a ∧ w.S = s ∧ w.R = true)
Proof (Lean source)
lemma observed_arrived_mass {d : ℕ} (P : FullLaw d) (x : Fin d) (a s : Bool) : (∑ o : Obs d, if o.X = x ∧ o.A = a ∧ o.S = s ∧ o.R = true then obsMass (observedLaw P) o else 0) = massOf P (fun w => w.X = x ∧ w.A = a ∧ w.S = s ∧ w.R = true) := by classical simpa [observe] using (obsMass_sum_event P (fun o : Obs d => o.X = x ∧ o.A = a ∧ o.S = s ∧ o.R = true))
CausalSmith.Stat.MarNearcompleteFrontier.observed_arrived_mass · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Basic.lean:354
theorem observed_arrived_outcome_mass

Given the specified input d, the specified input P, the specified input x, the specified input a, the specified input s, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
P :
x :
Fin d
a s :
(∑ o : Obs d, if o.X = x ∧ o.A = a ∧ o.S = s ∧ o.R = true ∧ o.RY = true then obsMass (observedLaw P) o else 0)
= massOf P (fun w => w.X = x ∧ w.A = a ∧ w.S = s ∧ w.R = true ∧ w.Y = true)
Proof (Lean source)
lemma observed_arrived_outcome_mass {d : ℕ} (P : FullLaw d) (x : Fin d) (a s : Bool) : (∑ o : Obs d, if o.X = x ∧ o.A = a ∧ o.S = s ∧ o.R = true ∧ o.RY = true then obsMass (observedLaw P) o else 0) = massOf P (fun w => w.X = x ∧ w.A = a ∧ w.S = s ∧ w.R = true ∧ w.Y = true) := by classical simpa [observe, Bool.and_eq_true] using (obsMass_sum_event P (fun o : Obs d => o.X = x ∧ o.A = a ∧ o.S = s ∧ o.R = true ∧ o.RY = true))
CausalSmith.Stat.MarNearcompleteFrontier.observed_arrived_outcome_mass · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Basic.lean:365
theorem condCellMass_observed

Given the specified input d, the specified input P, the specified input x, the specified input a, the specified input s, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
P :
x :
Fin d
a s :
condCellMass (observedLaw P) x a s = cellMass P x a s / armMass P a
Proof (Lean source)
lemma condCellMass_observed {d : ℕ} (P : FullLaw d) (x : Fin d) (a s : Bool) : condCellMass (observedLaw P) x a s = cellMass P x a s / armMass P a := by simp only [condCellMass, observed_cell_mass, observed_arm_mass]
CausalSmith.Stat.MarNearcompleteFrontier.condCellMass_observed · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Basic.lean:376
theorem outcomeMean_observed

Given the specified input d, the specified input P, the specified input x, the specified input a, the specified input s, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
P :
x :
Fin d
a s :
outcomeMean (observedLaw P) x a s
= massOf P (fun w => w.X = x ∧ w.A = a ∧ w.S = s ∧ w.R = true ∧ w.Y = true) / massOf P (fun w => w.X = x ∧ w.A = a ∧ w.S = s ∧ w.R = true)
Proof (Lean source)
lemma outcomeMean_observed {d : ℕ} (P : FullLaw d) (x : Fin d) (a s : Bool) : outcomeMean (observedLaw P) x a s = massOf P (fun w => w.X = x ∧ w.A = a ∧ w.S = s ∧ w.R = true ∧ w.Y = true) / massOf P (fun w => w.X = x ∧ w.A = a ∧ w.S = s ∧ w.R = true) := by simp only [outcomeMean, observed_arrived_outcome_mass, observed_arrived_mass]
CausalSmith.Stat.MarNearcompleteFrontier.outcomeMean_observed · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Basic.lean:382
theorem arrivalMass_pos

Given the specified input d, the specified input q, the specified input P, the specified input h, the specified input x, the specified input a, the specified input s, the specified input hc, the stated mathematical conclusion holds. Given the specified input hq.

Formal statement
d :
ℕ
q :
ℝ
P :
h :
LawClass d q P
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
x :
Fin d
a s :
hc :
0 < cellMass P x a s
0 < massOf P (fun w => w.X = x ∧ w.A = a ∧ w.S = s ∧ w.R = true)
Proof (Lean source)
lemma arrivalMass_pos {d : ℕ} {q : ℝ} (P : FullLaw d) (h : LawClass d q P) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (x : Fin d) (a s : Bool) (hc : 0 < cellMass P x a s) : 0 < massOf P (fun w => w.X = x ∧ w.A = a ∧ w.S = s ∧ w.R = true) := by have hf := h.floor x a s hc have hq0 : 0 < q := by rcases hq with ⟨hl, _⟩; linarith simp only [arrivalProb] at hf exact (div_pos_iff_of_pos_right hc).mp (lt_of_lt_of_le hq0 hf)
CausalSmith.Stat.MarNearcompleteFrontier.arrivalMass_pos · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Basic.lean:390
theorem outcomeMean_identified_cell

Given the specified input d, the specified input q, the specified input P, the specified input h, the specified input x, the specified input a, the specified input s, the specified input hc, the stated mathematical conclusion holds. Given the specified input hq.

Formal statement
d :
ℕ
q :
ℝ
P :
h :
LawClass d q P
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
x :
Fin d
a s :
hc :
0 < cellMass P x a s
outcomeMean (observedLaw P) x a s
= massOf P (fun w => w.X = x ∧ w.A = a ∧ w.S = s ∧ w.Y = true) / cellMass P x a s
Proof (Lean source)
lemma outcomeMean_identified_cell {d : ℕ} {q : ℝ} (P : FullLaw d) (h : LawClass d q P) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (x : Fin d) (a s : Bool) (hc : 0 < cellMass P x a s) : outcomeMean (observedLaw P) x a s = massOf P (fun w => w.X = x ∧ w.A = a ∧ w.S = s ∧ w.Y = true) / cellMass P x a s := by rw [outcomeMean_observed] have hr := arrivalMass_pos P h hq x a s hc have hm := h.mar x a s true true apply (div_eq_div_iff (ne_of_gt hr) (ne_of_gt hc)).mpr simpa [mul_comm] using hm
CausalSmith.Stat.MarNearcompleteFrontier.outcomeMean_identified_cell · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Basic.lean:401
theorem cellMass_nonneg

Given the specified input d, the specified input P, the specified input x, the specified input a, the specified input s, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
P :
x :
Fin d
a s :
0 ≤ cellMass P x a s
Proof (Lean source)
lemma cellMass_nonneg {d : ℕ} (P : FullLaw d) (x : Fin d) (a s : Bool) : 0 ≤ cellMass P x a s := by unfold cellMass massOf apply Finset.sum_nonneg intro w hw split_ifs <;> simp [fullMass]
CausalSmith.Stat.MarNearcompleteFrontier.cellMass_nonneg · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Basic.lean:415
theorem cellMass_le_armMass

Given the specified input d, the specified input P, the specified input x, the specified input a, the specified input s, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
P :
x :
Fin d
a s :
cellMass P x a s ≤ armMass P a
Proof (Lean source)
lemma cellMass_le_armMass {d : ℕ} (P : FullLaw d) (x : Fin d) (a s : Bool) : cellMass P x a s ≤ armMass P a := by unfold cellMass armMass massOf apply Finset.sum_le_sum intro w hw by_cases hc : w.X = x ∧ w.A = a ∧ w.S = s · simp [hc] · simp only [hc, ↓reduceIte] split_ifs <;> simp [fullMass]
CausalSmith.Stat.MarNearcompleteFrontier.cellMass_le_armMass · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Basic.lean:424
theorem cellOutcome_nonneg

Given the specified input d, the specified input P, the specified input x, the specified input a, the specified input s, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
P :
x :
Fin d
a s :
0 ≤ massOf P (fun w => w.X = x ∧ w.A = a ∧ w.S = s ∧ w.Y = true)
Proof (Lean source)
lemma cellOutcome_nonneg {d : ℕ} (P : FullLaw d) (x : Fin d) (a s : Bool) : 0 ≤ massOf P (fun w => w.X = x ∧ w.A = a ∧ w.S = s ∧ w.Y = true) := by unfold massOf apply Finset.sum_nonneg intro w hw split_ifs <;> simp [fullMass]
CausalSmith.Stat.MarNearcompleteFrontier.cellOutcome_nonneg · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Basic.lean:436
theorem cellOutcome_le_cell

Given the specified input d, the specified input P, the specified input x, the specified input a, the specified input s, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
P :
x :
Fin d
a s :
massOf P (fun w => w.X = x ∧ w.A = a ∧ w.S = s ∧ w.Y = true) ≤ cellMass P x a s
Proof (Lean source)
lemma cellOutcome_le_cell {d : ℕ} (P : FullLaw d) (x : Fin d) (a s : Bool) : massOf P (fun w => w.X = x ∧ w.A = a ∧ w.S = s ∧ w.Y = true) ≤ cellMass P x a s := by unfold cellMass massOf apply Finset.sum_le_sum intro w hw by_cases hc : w.X = x ∧ w.A = a ∧ w.S = s ∧ w.Y = true · simp [hc] · simp only [hc, ↓reduceIte] split_ifs <;> simp [fullMass]
CausalSmith.Stat.MarNearcompleteFrontier.cellOutcome_le_cell · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Basic.lean:445
theorem cellContribution_identified

Given the specified input d, the specified input q, the specified input P, the specified input h, the specified input x, the specified input a, the specified input s, the stated mathematical conclusion holds. Given the specified input hq.

Formal statement
d :
ℕ
q :
ℝ
P :
h :
LawClass d q P
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
x :
Fin d
a s :
condCellMass (observedLaw P) x a s * outcomeMean (observedLaw P) x a s
= massOf P (fun w => w.X = x ∧ w.A = a ∧ w.S = s ∧ w.Y = true) / armMass P a
Proof (Lean source)
lemma cellContribution_identified {d : ℕ} {q : ℝ} (P : FullLaw d) (h : LawClass d q P) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (x : Fin d) (a s : Bool) : condCellMass (observedLaw P) x a s * outcomeMean (observedLaw P) x a s = massOf P (fun w => w.X = x ∧ w.A = a ∧ w.S = s ∧ w.Y = true) / armMass P a := by rw [condCellMass_observed] have hc0 := cellMass_nonneg P x a s by_cases hc : cellMass P x a s = 0 · have hy0 := cellOutcome_nonneg P x a s have hyle := cellOutcome_le_cell P x a s have hy : massOf P (fun w => w.X = x ∧ w.A = a ∧ w.S = s ∧ w.Y = true) = 0 := by linarith simp [hc, hy] · have hcpos : 0 < cellMass P x a s := lt_of_le_of_ne hc0 (Ne.symm hc) have ha : 0 < armMass P a := lt_of_lt_of_le hcpos (cellMass_le_armMass P x a s) rw [outcomeMean_identified_cell P h hq x a s hcpos] field_simp
CausalSmith.Stat.MarNearcompleteFrontier.cellContribution_identified · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Basic.lean:458
theorem cellOutcome_sum

Given the specified input d, the specified input P, the specified input a, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
P :
a :
(∑ x : Fin d, ∑ s : Bool, massOf P (fun w => w.X = x ∧ w.A = a ∧ w.S = s ∧ w.Y = true))
= massOf P (fun w => w.A = a ∧ w.Y = true)
Proof (Lean source)
lemma cellOutcome_sum {d : ℕ} (P : FullLaw d) (a : Bool) : (∑ x : Fin d, ∑ s : Bool, massOf P (fun w => w.X = x ∧ w.A = a ∧ w.S = s ∧ w.Y = true)) = massOf P (fun w => w.A = a ∧ w.Y = true) := by classical rw [← Fintype.sum_prod_type'] simp only [massOf] rw [Finset.sum_comm] apply Finset.sum_congr rfl intro w hw by_cases ha : w.A = a · by_cases hy : w.Y = true · simp only [ha, hy, and_true, true_and, ↓reduceIte] rw [Fintype.sum_prod_type' (fun x : Fin d => fun s : Bool => if w.X = x ∧ w.S = s then fullMass P w else 0)] cases w.S <;> simp · simp [ha, hy] · simp [ha]
CausalSmith.Stat.MarNearcompleteFrontier.cellOutcome_sum · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Basic.lean:478
CausalSmith.Stat.STAT_MarNearcompleteFrontier_Research.Helpers.Converse.Interpolation 3 declarations Lagrange moment cancellation for the paired latent distribution

Lagrange moment cancellation for the paired latent distribution

Given the specified input n, the stated mathematical conclusion holds.

Formal statement
n :
ℕ
2 ≤ priorK n
Proof (Lean source)
lemma priorK_ge_two (n : ℕ) : 2 ≤ priorK n := by have he : (exp 1 : ℝ) ≤ exp 1 + n := le_add_of_nonneg_right (Nat.cast_nonneg _) have hl : 1 ≤ ell n := by unfold ell calc 1 = log (exp 1) := (Real.log_exp _).symm _ ≤ log (exp 1 + n) := Real.log_le_log (Real.exp_pos _) he have hk : 8 * ell n ≤ (priorK n : ℝ) := by unfold priorK exact Nat.le_ceil _ exact_mod_cast (show (2 : ℝ) ≤ priorK n by linarith)
theorem interpolationNode_injective Lemma interpolationNode_injective in the paper ↗

Given the specified input n, the stated mathematical conclusion holds.

Formal statement
n :
ℕ
Proof (Lean source)
lemma interpolationNode_injective (n : ℕ) : Injective (interpolationNode n) := by intro i j hij have hk := priorK_ge_two n have hh : priorH n < 1 := by unfold priorH have hkr : (2 : ℝ) ≤ priorK n := by exact_mod_cast hk have hi : (priorK n : ℝ)⁻¹ ≤ 1 / 2 := by rw [inv_eq_one_div] apply (div_le_iff₀ (by linarith : (0 : ℝ) < priorK n)).mpr nlinarith have hnonneg : (0 : ℝ) ≤ (priorK n : ℝ)⁻¹ := by positivity nlinarith have hden : (0 : ℝ) < ((priorK n - 1 : ℕ) : ℝ) := by exact_mod_cast (show 0 < priorK n - 1 by omega) have hangle (i : Fin (priorK n)) : (i : ℝ) * pi / ((priorK n - 1 : ℕ) : ℝ) ∈ Icc 0 pi := by constructor · positivity · have hi : i.val ≤ priorK n - 1 := by omega have hir : (i : ℝ) ≤ ((priorK n - 1 : ℕ) : ℝ) := by exact_mod_cast hi apply (div_le_iff₀ hden).mpr simpa only [mul_comm] using mul_le_mul_of_nonneg_right hir Real.pi_nonneg have hcos : cos ((i : ℝ) * pi / ((priorK n - 1 : ℕ) : ℝ)) = cos ((j : ℝ) * pi / ((priorK n - 1 : ℕ) : ℝ)) := by unfold interpolationNode at hij have hc : (1 - priorH n) / 2 ≠ 0 := by linarith have hm : (1 - priorH n) / 2 * cos ((i : ℝ) * pi / ((priorK n - 1 : ℕ) : ℝ)) = (1 - priorH n) / 2 * cos ((j : ℝ) * pi / ((priorK n - 1 : ℕ) : ℝ)) := by exact add_left_cancel hij exact mul_left_cancel₀ hc hm have ha := Real.injOn_cos (hangle i) (hangle j) hcos have hcast : (i : ℝ) = (j : ℝ) := by field_simp [ne_of_gt hden, ne_of_gt Real.pi_pos] at ha exact ha exact Fin.ext (by exact_mod_cast hcast)
CausalSmith.Stat.MarNearcompleteFrontier.interpolationNode_injective · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/Converse/Interpolation.lean:26
theorem signedNodeWeight_moment_zero

For a positive moment order below the number of interpolation nodes, the signed interpolation weights have zero moment of that order.

Formal statement
n t :
ℕ
ht :
0 < t
hdegree :
t < priorK n
(∑ i : Fin (priorK n), signedNodeWeight n i * interpolationNode n i ^ t) = 0
Proof (Lean source)
lemma signedNodeWeight_moment_zero (n t : ℕ) (ht : 0 < t) (hdegree : t < priorK n) : (∑ i : Fin (priorK n), signedNodeWeight n i * interpolationNode n i ^ t) = 0 := by have hpoly : (Polynomial.X : ℝ[X]) ^ t = Lagrange.interpolate Finset.univ (interpolationNode n) (fun i => interpolationNode n i ^ t) := by have hi : InjOn (interpolationNode n) (Finset.univ : Finset (Fin (priorK n))) := by intro i _ j _ hij exact interpolationNode_injective n hij have hd : ((Polynomial.X : ℝ[X]) ^ t).degree < (Finset.univ : Finset (Fin (priorK n))).card := by simpa [Polynomial.degree_X_pow] using hdegree simpa only [Polynomial.eval_pow, Polynomial.eval_X] using (Lagrange.eq_interpolate (f := (Polynomial.X : ℝ[X]) ^ t) hi hd) have hsum : (∑ i : Fin (priorK n), lagrangeAtZero n i * interpolationNode n i ^ t) = 0 := by have heval := congrArg (fun p : ℝ[X] => p.eval 0) hpoly simp only [Polynomial.eval_pow, Polynomial.eval_X, zero_pow (Nat.ne_of_gt ht), Lagrange.interpolate_apply, Polynomial.eval_finsetSum, Polynomial.eval_mul, Polynomial.eval_C] at heval simpa only [lagrangeAtZero, mul_comm] using heval.symm unfold signedNodeWeight simp_rw [div_mul_eq_mul_div] rw [← Finset.sum_div] simp [hsum]
CausalSmith.Stat.MarNearcompleteFrontier.signedNodeWeight_moment_zero · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/Converse/Interpolation.lean:65
CausalSmith.Stat.STAT_MarNearcompleteFrontier_Research.Helpers.Converse.PairTV 2 declarations Nonnegative eight-atom Poisson intensity obligations

Nonnegative eight-atom Poisson intensity obligations

theorem pairObservedCoeff_nonneg

All four possible observed coefficients of an oriented pair are nonnegative. Given the specified input q, the specified input z, the specified input u, the specified input o, the specified input hz, the specified input hu, the stated mathematical conclusion holds. Given the specified input σ, the specified input hσ. Given the specified input hq.

Formal statement
d :
ℕ
shared
q σ z u :
ℝ
o :
Obs d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
hσ :
σ = -1 ∨ σ = 1
hz :
z = -1 ∨ z = 1
hu :
u = -1 ∨ u = 1
0 ≤ pairObservedCoeff q σ z u o
Proof (Lean source)
-- @node: pairObservedCoeff_nonneg lemma pairObservedCoeff_nonneg (q σ z u : ℝ) (o : Obs d) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (hσ : σ = -1 ∨ σ = 1) (hz : z = -1 ∨ z = 1) (hu : u = -1 ∨ u = 1) : 0 ≤ pairObservedCoeff q σ z u o := by have hdlo : 0 ≤ delta q := by unfold delta; linarith [hq.2] have hdhi : delta q ≤ 1 / 2 := by unfold delta; linarith [hq.1] rcases hσ with hσ | hσ <;> rcases hz with hz | hz <;> rcases hu with hu | hu <;> subst σ <;> subst z <;> subst u <;> simp only [pairObservedCoeff] <;> split_ifs <;> norm_num [delta] at * <;> linarith
CausalSmith.Stat.MarNearcompleteFrontier.pairObservedCoeff_nonneg · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/Converse/PairTV.lean:9
theorem countAtomMass_nonneg

Every observed count atom has a nonnegative unnormalized intensity. Given the specified input n, the specified input d, the specified input q, the specified input hn, the specified input hd, the specified input o, the stated mathematical conclusion holds. Given the specified input σ, the specified input θ, the specified input hσ. Given the specified input hq.

Formal statement
n d :
ℕ
q σ :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
θ :
Theta n d
o :
Obs d
hσ :
σ = -1 ∨ σ = 1
0 ≤ countAtomMass n d q σ hd θ o
Proof (Lean source)
-- @node: countAtomMass_nonneg lemma countAtomMass_nonneg (n d : ℕ) (q σ : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (θ : Theta n d) (o : Obs d) (hσ : σ = -1 ∨ σ = 1) : 0 ≤ countAtomMass n d q σ hd θ o := by have hnpos : (0 : ℝ) < n := by exact_mod_cast hn have hL := ell_pos_for_normalization n have hK := priorK_lower_for_normalization n have hKpos : (0 : ℝ) < priorK n := by linarith have hM : (pairCount n d : ℝ) ≤ (n : ℝ) * ell n := by have hm : pairCount n d ≤ floor ((n : ℝ) * ell n) := by unfold pairCount exact min_le_right _ _ have hf : ((floor ((n : ℝ) * ell n) : ℕ) : ℝ) ≤ (n : ℝ) * ell n := Nat.floor_le (le_of_lt (mul_pos hnpos hL)) exact (Nat.cast_le.mpr hm).trans hf have hbound : 8 * (pairCount n d : ℝ) ≤ (n : ℝ) * priorK n := by nlinarith [mul_nonneg (le_of_lt hnpos) (sub_nonneg.mpr hK)] have hsmall : (pairCount n d : ℝ) / (512 * n * priorK n) < 1 := by apply (div_lt_iff₀ (by positivity)).mpr nlinarith have hrewrite : 2 * (pairCount n d : ℝ) * priorH n * priorB n = (pairCount n d : ℝ) / (512 * n * priorK n) := by unfold priorH priorB field_simp <;> ring have hf : 0 ≤ fillerMass n d := by unfold fillerMass rw [hrewrite] linarith have hcoeff : 0 ≤ fillerObservedCoeff q o := by have hb := baseMean_mem_unit q hq rcases hb with ⟨hb0, hb1⟩ unfold fillerObservedCoeff split_ifs <;> nlinarith have hp (j : Fin (pairCount n d)) : 0 ≤ latentP n (θ.1 j) := by unfold latentP split · exact mul_nonneg (by unfold priorB; positivity) (interpolationNode_nonneg_for_normalization n _) · positivity have hpair (j : Fin (pairCount n d)) (side : Bool) : 0 ≤ pairObservedCoeff q σ (latentZ n (θ.1 j)) (orientation θ j side) o := by apply pairObservedCoeff_nonneg q σ _ _ o hq hσ · unfold latentZ split <;> (try split_ifs) <;> simp · unfold orientation split_ifs <;> simp unfold countAtomMass apply add_nonneg · split_ifs <;> positivity · apply Finset.sum_nonneg intro j _ apply Finset.sum_nonneg intro side _ split_ifs · exact mul_nonneg (hp j) (hpair j side) · exact le_refl 0
CausalSmith.Stat.MarNearcompleteFrontier.countAtomMass_nonneg · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/Converse/PairTV.lean:21
CausalSmith.Stat.STAT_MarNearcompleteFrontier_Research.Helpers.Converse.SmallN 1 declarations Small-sample two-point comparison

Small-sample two-point comparison

theorem converse_smallN_separation

The Bernoulli perturbation dominates the requested scale at bounded sample sizes. Given the specified input a, the specified input c, the specified input N, the specified input n, the specified input d, the specified input q, the specified input ha, the specified input hc, the specified input hcn, the specified input hn, the specified input hN, the stated mathematical conclusion holds. Given the specified input hq.

Formal statement
a c :
ℝ
N n d :
ℕ
q :
ℝ
ha :
0 < a
hc :
0 ≤ c
hcn :
c ≤ 2 * a / sqrt N
hn :
1 ≤ n
hN :
n < N
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
c * gScale n d q ≤ a / sqrt n
Proof (Lean source)
lemma converse_smallN_separation (a c : ℝ) (N n d : ℕ) (q : ℝ) (ha : 0 < a) (hc : 0 ≤ c) (hcn : c ≤ 2 * a / sqrt N) (hn : 1 ≤ n) (hN : n < N) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) : c * gScale n d q ≤ a / sqrt n := by have hnpos : (0 : ℝ) < n := by exact_mod_cast hn have hNpos : (0 : ℝ) < N := by exact_mod_cast (by omega : 0 < N) have hrootn : 0 < sqrt (n : ℝ) := Real.sqrt_pos.2 hnpos have hrootN : 0 < sqrt (N : ℝ) := Real.sqrt_pos.2 hNpos have hroots : sqrt (n : ℝ) ≤ sqrt (N : ℝ) := by apply Real.sqrt_le_sqrt exact_mod_cast (le_of_lt hN) have hdelta : 0 ≤ delta q := by simp only [delta] linarith [hq.2] have hscale : gScale n d q ≤ 1 / 2 := by unfold gScale have hmin : min 1 ((d : ℝ) / ((n : ℝ) * ell n)) ≤ 1 := min_le_left _ _ have h := mul_le_mul_of_nonneg_left hmin hdelta dsimp [delta] at h ⊢ linarith [hq.1] have hcle : c * gScale n d q ≤ c / 2 := by nlinarith [mul_le_mul_of_nonneg_left hscale hc] have hca : c / 2 ≤ a / sqrt N := by calc c / 2 ≤ (2 * a / sqrt N) / 2 := div_le_div_of_nonneg_right hcn (by norm_num) _ = a / sqrt N := by ring have hdiv : a / sqrt N ≤ a / sqrt n := by exact div_le_div_of_nonneg_left (le_of_lt ha) hrootn hroots exact hcle.trans (hca.trans hdiv)
CausalSmith.Stat.MarNearcompleteFrontier.converse_smallN_separation · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/Converse/SmallN.lean:11
CausalSmith.Stat.STAT_MarNearcompleteFrontier_Research.Helpers.Converse.Target 1 declarations ATE target properties of the normalized pair

ATE target properties of the normalized pair

theorem tau_range

A binary-outcome ATE is in the unit interval for every full law. Given the specified input d, the specified input P, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
P :
tau P ∈ Icc (-1) 1
Proof (Lean source)
lemma tau_range {d : ℕ} (P : FullLaw d) : tau P ∈ Icc (-1) 1 := by classical have hsum : (∑ w : FullAtom d, fullMass P w) = 1 := by unfold fullMass rw [← ENNReal.toReal_sum (fun w _ => P.pmf.apply_ne_top w)] rw [← tsum_fintype (L := unconditional (FullAtom d)), P.pmf.tsum_coe] norm_num have hnonneg (w : FullAtom d) : 0 ≤ fullMass P w := ENNReal.toReal_nonneg have hterm (w : FullAtom d) : -(fullMass P w) ≤ fullMass P w * ((if w.Y1 then (1 : ℝ) else 0) - (if w.Y0 then 1 else 0)) ∧ fullMass P w * ((if w.Y1 then (1 : ℝ) else 0) - (if w.Y0 then 1 else 0)) ≤ fullMass P w := by cases w.Y1 <;> cases w.Y0 <;> simp_all unfold tau constructor · have h := Finset.sum_le_sum (s := univ) (fun w _ => (hterm w).1) simp only [Finset.sum_neg_distrib, hsum] at h exact h · have h := Finset.sum_le_sum (s := univ) (fun w _ => (hterm w).2) simpa [hsum] using h
CausalSmith.Stat.STAT_MarNearcompleteFrontier_Research.Helpers.Estimator 26 declarations All Poisson and four-stream randomization is averaged out by a finite sum.

Missing-membership estimator and clipped interval

All Poisson and four-stream randomization is averaged out by a finite sum. The N > n Poisson tail has value zero, so the displayed finite sum is the unconditional auxiliary expectation. The polynomial coefficients are taken from the exact Chebyshev quotient.

def clipUnit

Projection onto the estimator and estimand range.

Definition (Lean source)
z :
ℝ
clipUnit z :
ℝ
max (-1) (min 1 z)
def polyDegree

The degree used in the light-cell correction.

Definition (Lean source)
n :
ℕ
polyDegree n :
ℕ
max 1 (floor (ell n / 64))
CausalSmith.Stat.MarNearcompleteFrontier.polyDegree · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/Estimator.lean:24
def polyThreshold

The polynomial threshold.

Definition (Lean source)
n :
ℕ
polyThreshold n :
ℝ
256 * ell n
CausalSmith.Stat.MarNearcompleteFrontier.polyThreshold · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/Estimator.lean:27
def qPoly

The Chebyshev quotient Q_k, with removable value one at zero.

Definition (Lean source)
n :
ℕ
qPoly n :
ℝ[X]
(1 - (T ℝ (k : ℤ)).comp (1 - C (2 / B) * X)).divX * C (B / (2 * (k : ℝ) ^ 2))
def correctionCoeff

Coefficient a_v of 1-Q_k.

Definition (Lean source)
n v :
ℕ
correctionCoeff n v :
ℝ
(1 - qPoly n).coeff v
CausalSmith.Stat.MarNearcompleteFrontier.correctionCoeff · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/Estimator.lean:39
def shiftedFalling

Falling factorial (C-1)_{v-1} for a positive index v.

Definition (Lean source)
C :
ℝ
v :
ℕ
shiftedFalling C v :
ℝ
∏ t ∈ range (v - 1), (C - 1 - (t : ℝ))
CausalSmith.Stat.MarNearcompleteFrontier.shiftedFalling · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/Estimator.lean:43
def inCell

A record belongs to the specified observed cell.

Definition (Lean source)
d :
ℕ
o :
Obs d
x :
Fin d
a s :
inCell o x a s :
Prop
clause 1
o.X = x
clause 2
o.A = a
clause 3
o.S = s
def streamCount

Count observations in an auxiliary stream satisfying a given condition.

Definition (Lean source)
n d N :
ℕ
sample :
Fin n → Obs d
hN :
N ≤ n
labels :
Fin N → Fin 4
stream :
Fin 4
E :
Obs d → Prop
streamCount sample hN labels stream E :
ℝ
by classical exact ∑ i : Fin N, if labels i = stream ∧
E (sample ⟨i.val, lt_of_lt_of_le i.isLt hN⟩) then 1 else 0
CausalSmith.Stat.MarNearcompleteFrontier.streamCount · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/Estimator.lean:51
def lightCorrection

Light-cell factorial-polynomial correction.

Definition (Lean source)
n :
ℕ
C U :
ℝ
lightCorrection n C U :
ℝ
∑ t ∈ range (polyDegree n - 1), correctionCoeff n (t + 1) * (U - C / 2) * shiftedFalling C (t + 1)
CausalSmith.Stat.MarNearcompleteFrontier.lightCorrection · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/Estimator.lean:60
def heavyCorrection

Heavy-cell plug-in correction.

Definition (Lean source)
C U :
ℝ
heavyCorrection C U :
ℝ
if 0 < C then U / C - 1 / 2 else 0
CausalSmith.Stat.MarNearcompleteFrontier.heavyCorrection · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/Estimator.lean:65
def cellCorrection

One cell's missing-membership correction using streams two through four.

Definition (Lean source)
n d N :
ℕ
sample :
Fin n → Obs d
hN :
N ≤ n
labels :
Fin N → Fin 4
x :
Fin d
a s :
cellCorrection sample hN labels x a s :
ℝ
m :
(n : ℝ) / 8 (: ℝ)
V :
streamCount sample hN labels 1 (fun o => inCell o x a s ∧ o.R = false) / m
Cpilot :
streamCount sample hN labels 2 (fun o => inCell o x a s ∧ o.R = true)
C :
streamCount sample hN labels 3 (fun o => inCell o x a s ∧ o.R = true)
U :
streamCount sample hN labels 3 (fun o => inCell o x a s ∧ o.RY = true)
V * (if Cpilot ≤ polyThreshold n / 4 then lightCorrection n C U else heavyCorrection C U)
CausalSmith.Stat.MarNearcompleteFrontier.cellCorrection · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/Estimator.lean:69
def randomizedEstimate

One four-stream randomized estimate, already clipped to [-1,1].

Definition (Lean source)
n d N :
ℕ
sample :
Fin n → Obs d
hN :
N ≤ n
labels :
Fin N → Fin 4
randomizedEstimate sample hN labels :
ℝ
m :
(n : ℝ) / 8 (: ℝ)
clipUnit ( 2 / m * (∑ i : Fin N, if labels i = 0 then (if (sample ⟨i.val, lt_of_lt_of_le i.isLt hN⟩).A then (1 : ℝ) else -1) * (if (sample ⟨i.val, lt_of_lt_of_le i.isLt hN⟩).R then (1 : ℝ) else 0) * ((if (sample ⟨i.val, lt_of_lt_of_le i.isLt hN⟩).RY then (1 : ℝ) else 0) - 1 / 2) else 0) + 2 * (∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, (if a then (1 : ℝ) else -1) * cellCorrection sample hN labels x a s))
CausalSmith.Stat.MarNearcompleteFrontier.randomizedEstimate · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/Estimator.lean:84
def auxiliaryCountMass

Auxiliary Poisson probability for the uncapped count.

Definition (Lean source)
n N :
ℕ
auxiliaryCountMass n N :
ℝ
exp (-(n : ℝ) / 2) * ((n : ℝ) / 2) ^ N / (Nat.factorial N : ℝ)
CausalSmith.Stat.MarNearcompleteFrontier.auxiliaryCountMass · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/Estimator.lean:98
def conditionalStreamAverage

Averaging all iid uniform four-stream assignments at a fixed count.

Definition (Lean source)
n d :
ℕ
sample :
Fin n → Obs d
N :
ℕ
hN :
N ≤ n
conditionalStreamAverage sample N hN :
ℝ
(∑ labels : Fin N → Fin 4, randomizedEstimate sample hN labels) / (4 : ℝ) ^ N
CausalSmith.Stat.MarNearcompleteFrontier.conditionalStreamAverage · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/Estimator.lean:102
def completeHT

Projected complete-outcome Horvitz--Thompson randomized difference.

Definition (Lean source)
n d :
ℕ
sample :
Fin n → Obs d
completeHT sample :
ℝ
clipUnit (2 / (n : ℝ) * ∑ i : Fin n, (if (sample i).A then (1 : ℝ) else -1) * (if (sample i).RY then (1 : ℝ) else 0))
def fallbackHT

Projected centered arrived-outcome fallback.

Definition (Lean source)
n d :
ℕ
sample :
Fin n → Obs d
fallbackHT sample :
ℝ
clipUnit (2 / (n : ℝ) * ∑ i : Fin n, (if (sample i).A then (1 : ℝ) else -1) * (if (sample i).R then (1 : ℝ) else 0) * ((if (sample i).RY then (1 : ℝ) else 0) - 1 / 2))
def tauhatMM

The total missing-membership estimator for sample size, baseline dimension, known arrival floor, and observed sample. On the full Cartesian record space, Yobs is the supplied fifth coordinate RY. Stream four's U count uses the supplied mark RY=true; on the observation-map support this is the arrived-success count. The estimator averages the clipped four-stream estimate over Poisson(n/2) counts and uniform stream labels, returning zero for N>n. Its q=1 branch is the projected complete-outcome difference using Yobs; the small-logarithm or large-dimension fallback is the projected centered arrived-outcome difference using R(Yobs-1/2).

Definition (Lean source)
n d :
ℕ
q :
ℝ
sample :
Fin n → Obs d
tauhatMM n d q sample :
ℝ
if q
= 1 then completeHT sample else if ell n < 128 ∨ (d : ℝ) ≥ (n : ℝ) * ell n then fallbackHT sample else ∑ N : Fin (n + 1), auxiliaryCountMass n N.val * conditionalStreamAverage sample N.val (le_of_lt_succ N.isLt)
theorem measurable_tauhatMM

For a sample size, a covariate dimension, and an arrival floor, the missing-membership estimator is measurable as a function of the observed sample.

Formal statement
n d :
ℕ
q :
ℝ
Proof (Lean source)
lemma measurable_tauhatMM (n d : ℕ) (q : ℝ) : Measurable (tauhatMM n d q) := by fun_prop
CausalSmith.Stat.MarNearcompleteFrontier.measurable_tauhatMM · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/Estimator.lean:137
theorem tauhatMM_range

For an observed sample, the missing-membership estimate lies in the treatment-effect interval from minus one to one.

Formal statement
n d :
ℕ
q :
ℝ
o :
Fin n → Obs d
tauhatMM n d q o ∈ Icc (-1) 1
Proof (Lean source)
lemma tauhatMM_range (n d : ℕ) (q : ℝ) (o : Fin n → Obs d) : tauhatMM n d q o ∈ Icc (-1) 1 := by have clip_range (z : ℝ) : clipUnit z ∈ Icc (-1) 1 := by simp only [clipUnit, Set.mem_Icc] constructor · exact le_max_left _ _ · exact max_le (by norm_num) (min_le_left _ _) by_cases hq : q = 1 · simp only [tauhatMM, hq, ↓reduceIte, completeHT] exact clip_range _ by_cases hb : ell n < 128 ∨ (d : ℝ) ≥ (n : ℝ) * ell n · simp only [tauhatMM, hq, ↓reduceIte, hb, fallbackHT] exact clip_range _ have hterm (N : Fin (n + 1)) : 0 ≤ auxiliaryCountMass n N.val := by unfold auxiliaryCountMass positivity have hsum : (∑ N : Fin (n + 1), auxiliaryCountMass n N.val) ≤ 1 := by let r : NNReal := ⟨(n : ℝ) / 2, by positivity⟩ have heq (k : ℕ) : auxiliaryCountMass n k = poissonPMFReal r k := by change _ = exp (-((n : ℝ) / 2)) * ((n : ℝ) / 2) ^ k / (Nat.factorial k : ℝ) simp only [auxiliaryCountMass] ring rw [Fin.sum_univ_eq_sum_range] simp_rw [heq] exact sum_le_hasSum (range (n + 1)) (fun k _ => poissonPMFReal_nonneg) (poissonPMFRealSum r) have havg (N : Fin (n + 1)) : conditionalStreamAverage o N.val (Nat.le_of_lt_succ N.isLt) ∈ Icc (-1) 1 := by let hN := Nat.le_of_lt_succ N.isLt have hp : (0 : ℝ) < 4 ^ N.val := pow_pos (by norm_num) _ have hcount : (∑ labels : Fin N.val → Fin 4, (1 : ℝ)) = 4 ^ N.val := by simp [Fintype.card_fun] have hupper : (∑ labels : Fin N.val → Fin 4, randomizedEstimate o hN labels) ≤ 4 ^ N.val := by calc _ ≤ ∑ labels : Fin N.val → Fin 4, (1 : ℝ) := by apply Finset.sum_le_sum intro labels _ exact (clip_range _).2 _ = _ := hcount have hlower : -(4 : ℝ) ^ N.val ≤ ∑ labels : Fin N.val → Fin 4, randomizedEstimate o hN labels := by calc _ = -(∑ labels : Fin N.val → Fin 4, (1 : ℝ)) := by rw [hcount] _ = ∑ labels : Fin N.val → Fin 4, (-1 : ℝ) := by simp _ ≤ _ := by apply Finset.sum_le_sum intro labels _ exact (clip_range _).1 change -1 ≤ (∑ labels : Fin N.val → Fin 4, randomizedEstimate o hN labels) / (4 : ℝ) ^ N.val ∧ (∑ labels : Fin N.val → Fin 4, randomizedEstimate o hN labels) / (4 : ℝ) ^ N.val ≤ 1 constructor · exact (le_div_iff₀ hp).2 (by nlinarith) · exact (div_le_iff₀ hp).2 (by nlinarith) have hlo : -(∑ N : Fin (n + 1), auxiliaryCountMass n N.val) ≤ ∑ N : Fin (n + 1), auxiliaryCountMass n N.val * conditionalStreamAverage o N.val (Nat.le_of_lt_succ N.isLt) := by rw [← Finset.sum_neg_distrib] apply Finset.sum_le_sum intro N _ have h := (havg N).1 have hp := hterm N nlinarith have hhi : (∑ N : Fin (n + 1), auxiliaryCountMass n N.val * conditionalStreamAverage o N.val (Nat.le_of_lt_succ N.isLt)) ≤ ∑ N : Fin (n + 1), auxiliaryCountMass n N.val := by apply Finset.sum_le_sum intro N _ have h := (havg N).2 have hp := hterm N nlinarith simp only [tauhatMM, hq, ↓reduceIte, hb, Set.mem_Icc] constructor <;> linarith
CausalSmith.Stat.MarNearcompleteFrontier.tauhatMM_range · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/Estimator.lean:140
def UpperRiskCertificate

A numerical constant certifying the estimator's uniform upper risk.

Definition (Lean source)
CU :
ℝ
UpperRiskCertificate CU :
Prop
clause 1
0 < CU
clause 2
n d :
ℕ
q :
ℝ
1 ≤ n
1 ≤ d
q ∈ Icc ((1 : ℝ) / 2) 1
P :
μ :
Measure (Fin n → Obs d)
IidSample P.val n μ
(∫ o, (tauhatMM n d q o - tau P.val) ^ 2 ∂μ) ≤ CU * rate n d q
CausalSmith.Stat.MarNearcompleteFrontier.UpperRiskCertificate · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/Estimator.lean:217
def intervalRadius

The upper-risk constant is an explicit input to the confidence radius.

Definition (Lean source)
n d :
ℕ
q α CU :
ℝ
intervalRadius n d q α CU :
ℝ
min 2 (sqrt (CU * rate n d q / α))
CausalSmith.Stat.MarNearcompleteFrontier.intervalRadius · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/Estimator.lean:226
theorem intervalRadius_nonneg

For the specified sample size, dimension, arrival floor, confidence level, and risk constant, the confidence-interval radius is nonnegative.

Formal statement
n d :
ℕ
q α CU :
ℝ
0 ≤ intervalRadius n d q α CU
Proof (Lean source)
lemma intervalRadius_nonneg (n d : ℕ) (q α CU : ℝ) : 0 ≤ intervalRadius n d q α CU := by unfold intervalRadius exact le_min (by norm_num) (Real.sqrt_nonneg _)
CausalSmith.Stat.MarNearcompleteFrontier.intervalRadius_nonneg · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/Estimator.lean:231
theorem measurable_intervalLo

For the specified sample size, dimension, arrival floor, confidence level, and risk constant, the lower endpoint of the confidence interval is measurable.

Formal statement
n d :
ℕ
q α CU :
ℝ
Measurable (fun o : Fin n → Obs d => max (-1) (tauhatMM n d q o - intervalRadius n d q α CU))
Proof (Lean source)
lemma measurable_intervalLo (n d : ℕ) (q α CU : ℝ) : Measurable (fun o : Fin n → Obs d => max (-1) (tauhatMM n d q o - intervalRadius n d q α CU)) := by fun_prop
CausalSmith.Stat.MarNearcompleteFrontier.measurable_intervalLo · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/Estimator.lean:237
theorem measurable_intervalHi

For the specified sample size, dimension, arrival floor, confidence level, and risk constant, the upper endpoint of the confidence interval is measurable.

Formal statement
n d :
ℕ
q α CU :
ℝ
Measurable (fun o : Fin n → Obs d => min 1 (tauhatMM n d q o + intervalRadius n d q α CU))
Proof (Lean source)
lemma measurable_intervalHi (n d : ℕ) (q α CU : ℝ) : Measurable (fun o : Fin n → Obs d => min 1 (tauhatMM n d q o + intervalRadius n d q α CU)) := by fun_prop
CausalSmith.Stat.MarNearcompleteFrontier.measurable_intervalHi · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/Estimator.lean:242
theorem interval_bounds

When the interval radius is nonnegative, every resulting confidence interval is ordered and contained in the feasible treatment-effect interval.

Formal statement
n d :
ℕ
q α CU :
ℝ
hr :
0 ≤ intervalRadius n d q α CU
o :
Fin n → Obs d
conclusion 1
-1 ≤ max (-1) (tauhatMM n d q o - intervalRadius n d q α CU)
conclusion 2
max (-1) (tauhatMM n d q o - intervalRadius n d q α CU)
≤ min 1 (tauhatMM n d q o + intervalRadius n d q α CU)
conclusion 3
min 1 (tauhatMM n d q o + intervalRadius n d q α CU) ≤ 1
Proof (Lean source)
lemma interval_bounds (n d : ℕ) (q α CU : ℝ) (hr : 0 ≤ intervalRadius n d q α CU) : ∀ o : Fin n → Obs d, -1 ≤ max (-1) (tauhatMM n d q o - intervalRadius n d q α CU) ∧ max (-1) (tauhatMM n d q o - intervalRadius n d q α CU) ≤ min 1 (tauhatMM n d q o + intervalRadius n d q α CU) ∧ min 1 (tauhatMM n d q o + intervalRadius n d q α CU) ≤ 1 := by intro o have hrange := tauhatMM_range n d q o rcases hrange with ⟨hlo, hhi⟩ constructor · exact le_max_left _ _ constructor · apply max_le · exact le_min (by norm_num) (by linarith) · exact le_min (by linarith) (by linarith) · exact min_le_left _ _
CausalSmith.Stat.MarNearcompleteFrontier.interval_bounds · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/Estimator.lean:247
def intervalMM

Clipped connected interval around the total estimator. Given the specified input n, the specified input d, the specified input q, the specified input CU, the stated mathematical conclusion holds. Given the specified input α.

Definition (Lean source)
n d :
ℕ
q α CU :
ℝ
intervalMM n d q α CU _hCU :
{ lo := fun o => max (-1) (tauhatMM n d q o - intervalRadius n d q α CU) hi := fun o => min 1 (tauhatMM n d q o + intervalRadius n d q α CU) lo_measurable := measurable_intervalLo n d q α CU hi_measurable := measurable_intervalHi n d q α CU bounds := interval_bounds n d q α CU (intervalRadius_nonneg n d q α CU) }
CausalSmith.Stat.STAT_MarNearcompleteFrontier_Research.Helpers.Identification 8 declarations Finite-law randomization and MAR identification.

Finite-law randomization and MAR identification.

theorem massOf_potential_partition

Given the specified input d, the specified input P, the specified input E, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
P :
E :
FullAtom d → Prop
massOf P E = ∑ z : PotentialAtom d, massOf P (fun w => E w ∧ w.potential = z)
Proof (Lean source)
lemma massOf_potential_partition {d : ℕ} (P : FullLaw d) (E : FullAtom d → Prop) : massOf P E = ∑ z : PotentialAtom d, massOf P (fun w => E w ∧ w.potential = z) := by classical unfold massOf rw [Finset.sum_comm] apply Finset.sum_congr rfl intro w hw by_cases he : E w · simp [he] · simp [he]
CausalSmith.Stat.MarNearcompleteFrontier.massOf_potential_partition · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/Identification.lean:12
theorem randomized_potential_event

Given the specified input d, the specified input P, the specified input hR, the specified input a, the specified input F, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
P :
a :
F :
PotentialAtom d → Prop
massOf P (fun w => w.A = a ∧ F w.potential)
= armMass P a * massOf P (fun w => F w.potential)
Proof (Lean source)
lemma randomized_potential_event {d : ℕ} (P : FullLaw d) (hR : RandomizedIndependence P) (a : Bool) (F : PotentialAtom d → Prop) : massOf P (fun w => w.A = a ∧ F w.potential) = armMass P a * massOf P (fun w => F w.potential) := by classical have hpoint (z : PotentialAtom d) : massOf P (fun w => w.A = a ∧ w.potential = z) = armMass P a * massOf P (fun w => w.potential = z) := by obtain ⟨x, s0, s1, y0, y1⟩ := z have key (w : FullAtom d) : w.potential = { X := x, S0 := s0, S1 := s1, Y0 := y0, Y1 := y1 } ↔ w.X = x ∧ w.S0 = s0 ∧ w.S1 = s1 ∧ w.Y0 = y0 ∧ w.Y1 = y1 := by constructor · intro hw simpa [FullAtom.X, FullAtom.S0, FullAtom.S1, FullAtom.Y0, FullAtom.Y1, hw] · rintro ⟨hx, hs0, hs1, hy0, hy1⟩ cases hp : w.potential with | mk wx ws0 ws1 wy0 wy1 => simp only [FullAtom.X, FullAtom.S0, FullAtom.S1, FullAtom.Y0, FullAtom.Y1, hp] at hx hs0 hs1 hy0 hy1 simp [hp, hx, hs0, hs1, hy0, hy1] simpa only [key] using hR a x s0 s1 y0 y1 calc massOf P (fun w => w.A = a ∧ F w.potential) = ∑ z : PotentialAtom d, if F z then massOf P (fun w => w.A = a ∧ w.potential = z) else 0 := by rw [massOf_potential_partition] apply Finset.sum_congr rfl intro z hz by_cases hF : F z · simp only [hF, if_pos] unfold massOf apply Finset.sum_congr rfl intro w hw' by_cases hwz : w.potential = z <;> simp [hwz, hF, and_assoc] · simp only [hF, if_neg] unfold massOf apply Finset.sum_eq_zero intro w hw' by_cases hwz : w.potential = z <;> simp [hwz, hF] _ = ∑ z : PotentialAtom d, if F z then armMass P a * massOf P (fun w => w.potential = z) else 0 := by apply Finset.sum_congr rfl intro z hz rw [hpoint] _ = armMass P a * (∑ z : PotentialAtom d, if F z then massOf P (fun w => w.potential = z) else 0) := by rw [Finset.mul_sum] apply Finset.sum_congr rfl intro z hz by_cases hF : F z <;> simp [hF] _ = armMass P a * massOf P (fun w => F w.potential) := by congr 1 rw [massOf_potential_partition] apply Finset.sum_congr rfl intro z hz by_cases hF : F z · simp only [hF, if_pos] unfold massOf apply Finset.sum_congr rfl intro w hw' by_cases hwz : w.potential = z <;> simp [hwz, hF] · simp only [hF, ↓reduceIte] unfold massOf symm apply Finset.sum_eq_zero intro w hw' by_cases hwz : w.potential = z <;> simp [hwz, hF]
CausalSmith.Stat.MarNearcompleteFrontier.randomized_potential_event · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/Identification.lean:26
theorem massOf_univ_eq_one

Given the specified input d, the specified input P, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
P :
massOf P (fun _ => True) = 1
Proof (Lean source)
lemma massOf_univ_eq_one {d : ℕ} (P : FullLaw d) : massOf P (fun _ => True) = 1 := by classical simp only [massOf, if_true] have htop (w : FullAtom d) : P.pmf w ≠ ⊤ := PMF.apply_ne_top P.pmf w simp only [fullMass] rw [← ENNReal.toReal_sum (fun w _ => htop w)] have h := PMF.tsum_coe P.pmf rw [tsum_fintype] at h rw [h] norm_num
CausalSmith.Stat.MarNearcompleteFrontier.massOf_univ_eq_one · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/Identification.lean:99
theorem armMass_false_eq_half

Given the specified input d, the specified input P, the specified input hB, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
P :
armMass P false = 1 / 2
Proof (Lean source)
lemma armMass_false_eq_half {d : ℕ} (P : FullLaw d) (hB : BalancedRandomization P) : armMass P false = 1 / 2 := by have hs : armMass P true + armMass P false = 1 := by rw [← massOf_univ_eq_one P] simp only [armMass, massOf] rw [← Finset.sum_add_distrib] apply Finset.sum_congr rfl intro w hw rcases w with ⟨p, A, S, Y, R⟩ cases A <;> simp unfold BalancedRandomization at hB linarith
CausalSmith.Stat.MarNearcompleteFrontier.armMass_false_eq_half · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/Identification.lean:113
theorem armOutcome_consistency

Given the specified input d, the specified input P, the specified input hC, the specified input a, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
P :
hC :
Consistency P
a :
massOf P (fun w => w.A = a ∧ w.Y = true)
= massOf P (fun w => w.A = a ∧ (if a then w.Y1 else w.Y0) = true)
Proof (Lean source)
lemma armOutcome_consistency {d : ℕ} (P : FullLaw d) (hC : Consistency P) (a : Bool) : massOf P (fun w => w.A = a ∧ w.Y = true) = massOf P (fun w => w.A = a ∧ (if a then w.Y1 else w.Y0) = true) := by classical unfold massOf apply Finset.sum_congr rfl intro w hw by_cases hm : fullMass P w = 0 · simp [hm] have hY : w.Y = if w.A then w.Y1 else w.Y0 := by by_contra hn exact hm (hC w (inr hn)) by_cases ha : w.A = a · subst a simp [hY] · simp [ha]
CausalSmith.Stat.MarNearcompleteFrontier.armOutcome_consistency · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/Identification.lean:128
theorem tau_eq_potential_mass

Given the specified input d, the specified input P, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
P :
tau P = massOf P (fun w => w.Y1 = true) - massOf P (fun w => w.Y0 = true)
Proof (Lean source)
lemma tau_eq_potential_mass {d : ℕ} (P : FullLaw d) : tau P = massOf P (fun w => w.Y1 = true) - massOf P (fun w => w.Y0 = true) := by classical unfold tau massOf rw [← Finset.sum_sub_distrib] apply Finset.sum_congr rfl intro w hw split_ifs <;> ring
CausalSmith.Stat.MarNearcompleteFrontier.tau_eq_potential_mass · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/Identification.lean:148
theorem randomized_arm_outcome

Given the specified input d, the specified input P, the specified input hR, the specified input hB, the specified input hC, the specified input a, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
P :
hC :
Consistency P
a :
2 * massOf P (fun w => w.A = a ∧ w.Y = true)
= massOf P (fun w => (if a then w.Y1 else w.Y0) = true)
Proof (Lean source)
lemma randomized_arm_outcome {d : ℕ} (P : FullLaw d) (hR : RandomizedIndependence P) (hB : BalancedRandomization P) (hC : Consistency P) (a : Bool) : 2 * massOf P (fun w => w.A = a ∧ w.Y = true) = massOf P (fun w => (if a then w.Y1 else w.Y0) = true) := by rw [armOutcome_consistency P hC a] have hr := randomized_potential_event P hR a (fun z : PotentialAtom d => (if a then z.Y1 else z.Y0) = true) have ha : armMass P a = 1 / 2 := by cases a with | true => exact hB | false => exact armMass_false_eq_half P hB calc 2 * massOf P (fun w => w.A = a ∧ (if a then w.Y1 else w.Y0) = true) = 2 * (armMass P a * massOf P (fun w => (if a then w.Y1 else w.Y0) = true)) := congrArg (fun z : ℝ => 2 * z) hr _ = _ := by rw [ha]; ring
CausalSmith.Stat.MarNearcompleteFrontier.randomized_arm_outcome · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/Identification.lean:160
theorem tau_eq_psi

Randomization, consistency and MAR identify the original superpopulation ATE. Given the specified input d, the specified input q, the specified input P, the specified input h, the stated mathematical conclusion holds. Given the specified input hq.

Formal statement
d :
ℕ
q :
ℝ
P :
h :
LawClass d q P
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
tau P = psi (observedLaw P)
Proof (Lean source)
lemma tau_eq_psi {d : ℕ} {q : ℝ} (P : FullLaw d) (h : LawClass d q P) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) : tau P = psi (observedLaw P) := by have htrue := randomized_arm_outcome P h.randomized h.balanced h.consistency true have hfalse := randomized_arm_outcome P h.randomized h.balanced h.consistency false rw [tau_eq_potential_mass] have htrue' : 2 * massOf P (fun w => w.A = true ∧ w.Y = true) = massOf P (fun w => w.Y1 = true) := by simpa using htrue have hfalse' : 2 * massOf P (fun w => w.A = false ∧ w.Y = true) = massOf P (fun w => w.Y0 = true) := by simpa using hfalse unfold psi simp_rw [cellContribution_identified P h hq] simp_rw [Finset.sum_sub_distrib] simp_rw [← Finset.sum_div] rw [cellOutcome_sum P true, cellOutcome_sum P false] have ha_true : armMass P true = 1 / 2 := h.balanced have ha_false : armMass P false = 1 / 2 := armMass_false_eq_half P h.balanced rw [ha_true, ha_false] rw [← htrue', ← hfalse'] ring
CausalSmith.Stat.STAT_MarNearcompleteFrontier_Research.Helpers.LowerBound.CountMixture.AssembledTail 8 declarations Split a count vector into its disjoint pair blocks and its common residual block.

Assembly of independent count blocks

Split a count vector into its disjoint pair blocks and its common residual block. This injection transfers the normalized product L1 bound to the original count alphabet without counting any atom twice.

def pairCountRestriction

Given the specified input n, the specified input d, the specified input hd, the specified input counts, the specified input o, the stated mathematical conclusion holds. Given the specified input j.

Definition (Lean source)
n d :
ℕ
hd :
1 ≤ d
counts :
Obs d → ℕ
j :
o :
Obs d
pairCountRestriction n d hd counts j o :
ℕ
by classical exact if ∃ side : Bool, o.X = pairLabel n d hd j side then counts o else 0
def residualCountRestriction

Given the specified input n, the specified input d, the specified input hd, the specified input counts, the specified input o, the stated mathematical conclusion holds.

Definition (Lean source)
n d :
ℕ
hd :
1 ≤ d
counts :
Obs d → ℕ
o :
Obs d
residualCountRestriction n d hd counts o :
ℕ
by classical exact if ∃ j : Fin (pairCount n d), ∃ side : Bool, o.X
= pairLabel n d hd j side then 0 else counts o
theorem splitCountBlocks_injective

Given the specified input n, the specified input d, the specified input hd, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
hd :
1 ≤ d
Injective (fun counts : Obs d → ℕ => (residualCountRestriction n d hd counts, pairCountRestriction n d hd counts))
Proof (Lean source)
lemma splitCountBlocks_injective (n d : ℕ) (hd : 1 ≤ d) : Injective (fun counts : Obs d → ℕ => (residualCountRestriction n d hd counts, pairCountRestriction n d hd counts)) := by classical intro a b h funext o by_cases hp : ∃ j : Fin (pairCount n d), ∃ side : Bool, o.X = pairLabel n d hd j side · obtain ⟨j, side, hs⟩ := hp have hj := congrFun (congrFun (congrArg snd h) j) o simpa [pairCountRestriction, show ∃ side : Bool, o.X = pairLabel n d hd j side from ⟨side, hs⟩] using hj · have hr := congrFun (congrArg fst h) o simpa only [residualCountRestriction, if_neg hp] using hr
theorem pairMixtureFactor_restrict

Restricting the count vector to its pair does not alter the local factor. Given the specified input n, the specified input d, the specified input q, the specified input hd, the specified input counts, the stated mathematical conclusion holds. Given the specified input σ. Given the specified input j.

Formal statement
n d :
ℕ
q σ :
ℝ
hd :
1 ≤ d
j :
counts :
Obs d → ℕ
pairMixtureFactor n d q σ hd j (pairCountRestriction n d hd counts j)
= pairMixtureFactor n d q σ hd j counts
Proof (Lean source)
-- @node: pairMixtureFactor_restrict lemma pairMixtureFactor_restrict (n d : ℕ) (q σ : ℝ) (hd : 1 ≤ d) (j : Fin (pairCount n d)) (counts : Obs d → ℕ) : pairMixtureFactor n d q σ hd j (pairCountRestriction n d hd counts j) = pairMixtureFactor n d q σ hd j counts := by classical have he (side : Bool) (o : Obs d) (ho : o.X = pairLabel n d hd j side) : pairCountRestriction n d hd counts j o = counts o := by simp [pairCountRestriction, show ∃ side : Bool, o.X = pairLabel n d hd j side from ⟨side, ho⟩] have hc : pairBlockCount n d hd (pairCountRestriction n d hd counts j) j = pairBlockCount n d hd counts j := by unfold pairBlockCount apply Finset.sum_congr rfl intro side _ apply Finset.sum_congr rfl intro o _ by_cases ho : o.X = pairLabel n d hd j side <;> simp [ho, he side o] have hf : pairBlockFactorial n d hd j (pairCountRestriction n d hd counts j) = pairBlockFactorial n d hd j counts := by unfold pairBlockFactorial pairLabelFactorial apply Finset.prod_congr rfl intro side _ apply Finset.prod_congr rfl intro o _ by_cases ho : o.X = pairLabel n d hd j side <;> simp [ho, he side o] have hm (z : ℝ) : pairBlockMarkAverage n d q σ z hd j (pairCountRestriction n d hd counts j) = pairBlockMarkAverage n d q σ z hd j counts := by unfold pairBlockMarkAverage pairObservedMonomial apply Finset.sum_congr rfl intro base _ apply Finset.prod_congr rfl intro side _ apply Finset.prod_congr rfl intro o _ by_cases ho : o.X = pairLabel n d hd j side <;> simp [ho, he side o] unfold pairMixtureFactor simp_rw [hc, hf, hm]
theorem pairMarkedMixtureFactor_restrict

Given the specified input n, the specified input d, the specified input q, the specified input hd, the specified input counts, the stated mathematical conclusion holds. Given the specified input σ. Given the specified input j.

Formal statement
n d :
ℕ
q σ :
ℝ
hd :
1 ≤ d
j :
counts :
Obs d → ℕ
pairMarkedMixtureFactor n d q σ hd j (pairCountRestriction n d hd counts j)
= pairMixtureFactor n d q σ hd j counts
Proof (Lean source)
lemma pairMarkedMixtureFactor_restrict (n d : ℕ) (q σ : ℝ) (hd : 1 ≤ d) (j : Fin (pairCount n d)) (counts : Obs d → ℕ) : pairMarkedMixtureFactor n d q σ hd j (pairCountRestriction n d hd counts j) = pairMixtureFactor n d q σ hd j counts := by classical rw [pairMarkedMixtureFactor_eq_local_of_supported] · exact pairMixtureFactor_restrict n d q σ hd j counts · intro o ho simp [pairCountRestriction, not_exists.mpr ho]
CausalSmith.Stat.MarNearcompleteFrontier.pairMarkedMixtureFactor_restrict · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/AssembledTail.lean:91
theorem residualPoissonFactor_eq_common

The residual restriction carries the filler likelihood and all forced zeros on unused labels, exactly the common factor in the full experiment. Given the specified input n, the specified input d, the specified input q, the specified input hn, the specified input hd, the specified input counts, the stated mathematical conclusion holds. Given the specified input hq.

Formal statement
n d :
ℕ
q :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
counts :
Obs d → ℕ
(∏ o : Obs d, exp (-(fillerMarkedRate n d q hd o : ℝ)) * (fillerMarkedRate n d q hd o : ℝ) ^ residualCountRestriction n d hd counts o / (residualCountRestriction n d hd counts o).factorial)
= commonCountFactor n d q hd counts
Proof (Lean source)
-- @node: residualPoissonFactor_eq_common lemma residualPoissonFactor_eq_common (n d : ℕ) (q : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (counts : Obs d → ℕ) : (∏ o : Obs d, exp (-(fillerMarkedRate n d q hd o : ℝ)) * (fillerMarkedRate n d q hd o : ℝ) ^ residualCountRestriction n d hd counts o / (residualCountRestriction n d hd counts o).factorial) = commonCountFactor n d q hd counts := by classical have hfill (o : Obs d) (ho : o.X = fillerLabel d hd) : residualCountRestriction n d hd counts o = counts o := by have hp : ¬ ∃ j : Fin (pairCount n d), ∃ side : Bool, o.X = pairLabel n d hd j side := by rintro ⟨j, side, h⟩ exact fillerLabel_ne_pairLabel n d hd j side (ho.symm.trans h) simp only [residualCountRestriction, if_neg hp] have hpair (j : Fin (pairCount n d)) (side : Bool) (o : Obs d) (ho : o.X = pairLabel n d hd j side) : residualCountRestriction n d hd counts o = 0 := by simp only [residualCountRestriction, if_pos (show ∃ j : Fin (pairCount n d), ∃ side : Bool, o.X = pairLabel n d hd j side from ⟨j, side, ho⟩)] have hunused (x : Fin d) (hx : x ∈ univ \ activeBaselineLabels n d hd) (o : Obs d) (ho : o.X = x) : residualCountRestriction n d hd counts o = counts o ∧ o.X ≠ fillerLabel d hd := by have hxnot := (Finset.mem_sdiff.mp hx).2 have hp : ¬ ∃ j : Fin (pairCount n d), ∃ side : Bool, o.X = pairLabel n d hd j side := by rintro ⟨j, side, hs⟩ apply hxnot unfold activeBaselineLabels apply Finset.mem_insert_of_mem exact Finset.mem_image.mpr ⟨(j, side), Finset.mem_univ _, (ho.symm.trans hs).symm⟩ constructor · simp only [residualCountRestriction, if_neg hp] · intro hf apply hxnot rw [← ho, hf] exact Finset.mem_insert_self _ _ rw [obsProd_split_filler_pairs_unused n d hd] have hf : (∏ o : Obs d, if o.X = fillerLabel d hd then exp (-(fillerMarkedRate n d q hd o : ℝ)) * (fillerMarkedRate n d q hd o : ℝ) ^ residualCountRestriction n d hd counts o / (residualCountRestriction n d hd counts o).factorial else 1) = exp (-4 * (n : ℝ) * fillerMass n d) * ∏ o : Obs d, if o.X = fillerLabel d hd then (4 * (n : ℝ) * (fillerMass n d * fillerObservedCoeff q o)) ^ counts o / (counts o).factorial else 1 := by rw [← fillerMarkedPoissonFactor_eq n d q hn hd hq counts] apply Finset.prod_congr rfl intro o _ by_cases ho : o.X = fillerLabel d hd <;> simp [ho, hfill o] rw [hf] have hp : (∏ js : Fin (pairCount n d) × Bool, ∏ o : Obs d, if o.X = pairLabel n d hd js.1 js.2 then exp (-(fillerMarkedRate n d q hd o : ℝ)) * (fillerMarkedRate n d q hd o : ℝ) ^ residualCountRestriction n d hd counts o / (residualCountRestriction n d hd counts o).factorial else 1) = 1 := by apply Finset.prod_eq_one intro js _ apply Finset.prod_eq_one intro o _ by_cases ho : o.X = pairLabel n d hd js.1 js.2 · have hne : o.X ≠ fillerLabel d hd := by rw [ho]; exact (fillerLabel_ne_pairLabel n d hd js.1 js.2).symm simp only [if_pos ho, hpair js.1 js.2 o ho, fillerMarkedRate_coe n d q hn hd hq o, if_neg hne] norm_num · simp [ho] rw [hp, mul_one] unfold commonCountFactor congr 1 apply Finset.prod_congr rfl intro x hx apply Finset.prod_congr rfl intro o _ by_cases ho : o.X = x · obtain ⟨hc, hne⟩ := hunused x hx o ho simp only [if_pos ho, hc, fillerMarkedRate_coe n d q hn hd hq o, if_neg hne] simp [zero_rate_factor_eq_indicator] · simp [ho]
CausalSmith.Stat.MarNearcompleteFrontier.residualPoissonFactor_eq_common · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/AssembledTail.lean:102
theorem mixedCountLaw_singleton_l1_le_factorial_tail

The singleton-mass ℓ¹ discrepancy of the two count mixtures is bounded by twice the pair count times the unmatched factorial-series tail. Given the specified input n, the specified input d, the specified input q, the specified input hn, the specified input hd, the stated mathematical conclusion holds. Given the specified input hq.

Formal statement
n d :
ℕ
q :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
(∑' counts : Obs d → ℕ, |(mixedCountLaw n d q (-1) hn hd hq).real {counts} - (mixedCountLaw n d q 1 hn hd hq).real {counts}|)
≤ 2 * (pairCount n d : ℝ) * exponentialSeriesTail (priorK n) (16 * (n : ℝ) * priorB n)
Proof (Lean source)
-- @node: mixedCountLaw_singleton_l1_le_factorial_tail lemma mixedCountLaw_singleton_l1_le_factorial_tail (n d : ℕ) (q : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) : (∑' counts : Obs d → ℕ, |(mixedCountLaw n d q (-1) hn hd hq).real {counts} - (mixedCountLaw n d q 1 hn hd hq).real {counts}|) ≤ 2 * (pairCount n d : ℝ) * exponentialSeriesTail (priorK n) (16 * (n : ℝ) * priorB n) := by classical let F : (Obs d → ℕ) → ℝ := fun counts => ∏ o : Obs d, exp (-(fillerMarkedRate n d q hd o : ℝ)) * (fillerMarkedRate n d q hd o : ℝ) ^ counts o / (counts o).factorial let A : (Fin (pairCount n d) → (Obs d → ℕ)) → ℝ := fun counts => ∏ j : Fin (pairCount n d), pairMarkedMixtureFactor n d q (-1) hd j (counts j) let B : (Fin (pairCount n d) → (Obs d → ℕ)) → ℝ := fun counts => ∏ j : Fin (pairCount n d), pairMarkedMixtureFactor n d q 1 hd j (counts j) have hF := summable_poissonFactorial_countVector (fillerMarkedRate n d q hd) have hF0 : ∀ counts, 0 ≤ F counts := by intro counts exact Finset.prod_nonneg (fun o _ => by positivity) have hA := normalized_likelihood_fin_product_hasSum_one (pairCount n d) (fun j => pairMarkedMixtureFactor n d q (-1) hd j) (fun j => pairMarkedMixtureFactor_hasSum_one n d q (-1) hn hd hq (inl rfl) j) (fun j counts => pairMarkedMixtureFactor_nonneg n d q (-1) hd hq (inl rfl) j counts) have hB := normalized_likelihood_fin_product_hasSum_one (pairCount n d) (fun j => pairMarkedMixtureFactor n d q 1 hd j) (fun j => pairMarkedMixtureFactor_hasSum_one n d q 1 hn hd hq (inr rfl) j) (fun j counts => pairMarkedMixtureFactor_nonneg n d q 1 hd hq (inr rfl) j counts) have hA0 : ∀ counts, 0 ≤ A counts := fun counts => Finset.prod_nonneg (fun j _ => pairMarkedMixtureFactor_nonneg n d q (-1) hd hq (inl rfl) j (counts j)) have hB0 : ∀ counts, 0 ≤ B counts := fun counts => Finset.prod_nonneg (fun j _ => pairMarkedMixtureFactor_nonneg n d q 1 hd hq (inr rfl) j (counts j)) have hgap := normalized_likelihood_abs_gap_summable A B hA.summable hB.summable hA0 hB0 let G : (Obs d → ℕ) × (Fin (pairCount n d) → (Obs d → ℕ)) → ℝ := fun x => F x.1 * |A x.2 - B x.2| have hG : Summable G := hF.mul_of_nonneg hgap hF0 (fun _ => abs_nonneg _) have hG0 : ∀ x, 0 ≤ G x := fun x => mul_nonneg (hF0 x.1) (abs_nonneg _) calc _ = ∑' counts : Obs d → ℕ, G (residualCountRestriction n d hd counts, pairCountRestriction n d hd counts) := by apply tsum_congr intro counts rw [mixedCountLaw_singleton_factorization n d q (-1) hn hd hq (inl rfl), mixedCountLaw_singleton_factorization n d q 1 hn hd hq (inr rfl)] change |commonCountFactor n d q hd counts * _ - commonCountFactor n d q hd counts * _| = F (residualCountRestriction n d hd counts) * |A (pairCountRestriction n d hd counts) - B (pairCountRestriction n d hd counts)| dsimp only [F, A, B] rw [residualPoissonFactor_eq_common n d q hn hd hq] simp_rw [pairMarkedMixtureFactor_restrict] rw [← mul_sub, abs_mul, abs_of_nonneg] rw [← residualPoissonFactor_eq_common n d q hn hd hq] exact hF0 _ _ ≤ ∑' x, G x := tsum_comp_le_tsum_of_inj hG hG0 (splitCountBlocks_injective n d hd) _ = ∑' counts : Fin (pairCount n d) → (Obs d → ℕ), |A counts - B counts| := by rw [← hF.tsum_mul_tsum hgap hG, poissonFactorial_countVector_tsum_one, one_mul] _ ≤ _ := pairMarkedMixture_product_l1_le_factorial_tail n d q hn hd hq
CausalSmith.Stat.MarNearcompleteFrontier.mixedCountLaw_singleton_l1_le_factorial_tail · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/AssembledTail.lean:182
theorem mixedCountLaw_tv_le_factorial_tail Lemma mixedCountLaw_tv_le_factorial_tail in the paper ↗

The two count mixtures differ only through unmatched pair-block degrees; their total variation is bounded by the pair count times the exponential series tail from paper equation (35). Given the specified input n, the specified input d, the specified input q, the specified input hn, the specified input hd, the stated mathematical conclusion holds. Given the specified input hq.

Formal statement
n d :
ℕ
q :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
tvDist (mixedCountLaw n d q (-1) hn hd hq) (mixedCountLaw n d q 1 hn hd hq)
≤ (pairCount n d : ℝ) * exponentialSeriesTail (priorK n) (16 * (n : ℝ) * priorB n)
Proof (Lean source)
-- @node: mixedCountLaw_tv_le_factorial_tail lemma mixedCountLaw_tv_le_factorial_tail (n d : ℕ) (q : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) : tvDist (mixedCountLaw n d q (-1) hn hd hq) (mixedCountLaw n d q 1 hn hd hq) ≤ (pairCount n d : ℝ) * exponentialSeriesTail (priorK n) (16 * (n : ℝ) * priorB n) := by letI : IsProbabilityMeasure (mixedCountLaw n d q (-1) hn hd hq) := by constructor unfold mixedCountLaw rw [Measure.coe_finsetSum, Finset.sum_apply] have hc (θ : Theta n d) : conditionalCountLaw n d q (-1) hd θ univ = 1 := by letI : IsProbabilityMeasure (conditionalCountLaw n d q (-1) hd θ) := by unfold conditionalCountLaw infer_instance exact measure_univ simp_rw [Measure.smul_apply, hc, smul_eq_mul, mul_one] simpa using (thetaLaw n d q hn hd hq).tsum_coe letI : IsProbabilityMeasure (mixedCountLaw n d q 1 hn hd hq) := by constructor unfold mixedCountLaw rw [Measure.coe_finsetSum, Finset.sum_apply] have hc (θ : Theta n d) : conditionalCountLaw n d q 1 hd θ univ = 1 := by letI : IsProbabilityMeasure (conditionalCountLaw n d q 1 hd θ) := by unfold conditionalCountLaw infer_instance exact measure_univ simp_rw [Measure.smul_apply, hc, smul_eq_mul, mul_one] simpa using (thetaLaw n d q hn hd hq).tsum_coe calc _ ≤ (1 / 2 : ℝ) * ∑' counts : Obs d → ℕ, |(mixedCountLaw n d q (-1) hn hd hq).real {counts} - (mixedCountLaw n d q 1 hn hd hq).real {counts}| := tvDist_le_half_tsum_singleton_abs _ _ _ ≤ (1 / 2 : ℝ) * (2 * (pairCount n d : ℝ) * exponentialSeriesTail (priorK n) (16 * (n : ℝ) * priorB n)) := mul_le_mul_of_nonneg_left (mixedCountLaw_singleton_l1_le_factorial_tail n d q hn hd hq) (by norm_num) _ = _ := by ring
CausalSmith.Stat.MarNearcompleteFrontier.mixedCountLaw_tv_le_factorial_tail · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/AssembledTail.lean:244
CausalSmith.Stat.STAT_MarNearcompleteFrontier_Research.Helpers.LowerBound.CountMixture.Basic 18 declarations Basic for the paired count-mixture comparison

Basic for the paired count-mixture comparison

The random count normalizer is uniformly at least one half. Given the specified input n, the specified input d, the specified input hn, the stated mathematical conclusion holds. Given the specified input θ.

Formal statement
n d :
ℕ
θ :
Theta n d
hn :
1 ≤ n
(1 / 2 : ℝ) ≤ normalizationJ n d θ
Proof (Lean source)
lemma normalizationJ_ge_half (n d : ℕ) (θ : Theta n d) (hn : 1 ≤ n) : (1 / 2 : ℝ) ≤ normalizationJ n d θ := by have hnpos : (0 : ℝ) < n := by exact_mod_cast hn have hL := ell_pos_for_normalization n have hK := priorK_lower_for_normalization n have hKpos : (0 : ℝ) < priorK n := by linarith have hM : (pairCount n d : ℝ) ≤ (n : ℝ) * ell n := by have hm : pairCount n d ≤ floor ((n : ℝ) * ell n) := by unfold pairCount exact min_le_right _ _ have hf : ((floor ((n : ℝ) * ell n) : ℕ) : ℝ) ≤ (n : ℝ) * ell n := Nat.floor_le (le_of_lt (mul_pos hnpos hL)) exact (Nat.cast_le.mpr hm).trans hf have hbound : 8 * (pairCount n d : ℝ) ≤ (n : ℝ) * priorK n := by nlinarith [mul_nonneg (le_of_lt hnpos) (sub_nonneg.mpr hK)] have hrewrite : 2 * (pairCount n d : ℝ) * priorH n * priorB n = (pairCount n d : ℝ) / (512 * n * priorK n) := by unfold priorH priorB field_simp <;> ring have hsmall : (pairCount n d : ℝ) / (512 * n * priorK n) ≤ 1 / 2 := by apply (div_le_iff₀ (by positivity)).2 nlinarith have hsum : 0 ≤ ∑ j : Fin (pairCount n d), latentP n (θ.1 j) := by exact Finset.sum_nonneg fun j _ => latentP_nonneg n (θ.1 j) unfold normalizationJ fillerMass rw [hrewrite] linarith
theorem normalization_count_poisson_tail Lemma normalization_count_poisson_tail in the paper ↗

The conditional total-count Poisson rate generated by the paired prior has a uniformly small lower tail. Given the specified input n, the specified input d, the specified input hn, the stated mathematical conclusion holds. Given the specified input θ.

Formal statement
n d :
ℕ
θ :
Theta n d
hn :
1 ≤ n
(poissonMeasure (toNNReal (4 * (n : ℝ) * normalizationJ n d θ)) (Iio n)).toReal
≤ 8 / (n : ℝ)
Proof (Lean source)
lemma normalization_count_poisson_tail (n d : ℕ) (θ : Theta n d) (hn : 1 ≤ n) : (poissonMeasure (toNNReal (4 * (n : ℝ) * normalizationJ n d θ)) (Iio n)).toReal ≤ 8 / (n : ℝ) := by apply poisson_lower_tail_of_two_mul_le n _ hn have hJ := normalizationJ_ge_half n d θ hn have hx0 : 0 ≤ 4 * (n : ℝ) * normalizationJ n d θ := by have : 0 ≤ normalizationJ n d θ := le_trans (by norm_num) hJ positivity rw [Real.coe_toNNReal _ hx0] nlinarith
CausalSmith.Stat.MarNearcompleteFrontier.normalization_count_poisson_tail · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/Basic.lean:62
theorem normalization_count_poisson_tail_eventual Lemma normalization_count_poisson_tail_eventual in the paper ↗

Uniformly over every latent parameter and dimension, the conditional short-count probability is eventually below any positive tolerance. the stated mathematical conclusion holds. Given the specified input β, the specified input hβ.

Formal statement
β :
ℝ
hβ :
0 < β
∃ N : ℕ,
1 ≤ N
conclusion 1
n d :
ℕ
N ≤ n
θ :
Theta n d
(poissonMeasure (toNNReal (4 * (n : ℝ) * normalizationJ n d θ)) (Iio n)).toReal
≤ β
Proof (Lean source)
lemma normalization_count_poisson_tail_eventual (β : ℝ) (hβ : 0 < β) : ∃ N : ℕ, 1 ≤ N ∧ ∀ (n d : ℕ), N ≤ n → ∀ θ : Theta n d, (poissonMeasure (toNNReal (4 * (n : ℝ) * normalizationJ n d θ)) (Iio n)).toReal ≤ β := by obtain ⟨N₀, hN₀⟩ := exists_nat_gt (8 / β) refine ⟨max N₀ 1, le_max_right _ _, ?_⟩ intro n d hn θ have hn1 : 1 ≤ n := le_trans (le_max_right _ _) hn have hnN : N₀ ≤ n := le_trans (le_max_left _ _) hn have hnR : 8 / β < (n : ℝ) := lt_of_lt_of_le hN₀ (by exact_mod_cast hnN) calc _ ≤ 8 / (n : ℝ) := normalization_count_poisson_tail n d θ hn1 _ ≤ β := by apply (div_le_iff₀ (by positivity : (0 : ℝ) < n)).2 have := (div_lt_iff₀ hβ).1 hnR nlinarith
CausalSmith.Stat.MarNearcompleteFrontier.normalization_count_poisson_tail_eventual · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/Basic.lean:78
theorem thetaLaw_normalization_count_poisson_tail Lemma thetaLaw_normalization_count_poisson_tail in the paper ↗

Averaging over the latent prior preserves the uniform 8 / n short-count bound required by random-scale transfer. Given the specified input n, the specified input d, the specified input q, the specified input hn, the specified input hd, the stated mathematical conclusion holds. Given the specified input hq.

Formal statement
n d :
ℕ
q :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
(∫ θ, (poissonMeasure (toNNReal (4 * (n : ℝ) * normalizationJ n d θ)) (Iio n)).toReal ∂(thetaLaw n d q hn hd hq).toMeasure)
≤ 8 / (n : ℝ)
Proof (Lean source)
lemma thetaLaw_normalization_count_poisson_tail (n d : ℕ) (q : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) : (∫ θ, (poissonMeasure (toNNReal (4 * (n : ℝ) * normalizationJ n d θ)) (Iio n)).toReal ∂(thetaLaw n d q hn hd hq).toMeasure) ≤ 8 / (n : ℝ) := by letI : IsProbabilityMeasure (thetaLaw n d q hn hd hq).toMeasure := inferInstance calc _ ≤ ∫ _θ : Theta n d, 8 / (n : ℝ) ∂(thetaLaw n d q hn hd hq).toMeasure := integral_mono_of_nonneg (Filter.Eventually.of_forall fun _ => ENNReal.toReal_nonneg) (integrable_const _) (Filter.Eventually.of_forall fun θ => normalization_count_poisson_tail n d θ hn) _ = _ := by simp
CausalSmith.Stat.MarNearcompleteFrontier.thetaLaw_normalization_count_poisson_tail · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/Basic.lean:99
theorem sum_fillerObservedCoeff_at_label

At any fixed baseline label, the filler observed coefficients have total mass one. Given the specified input d, the specified input q, the specified input x, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
q :
ℝ
x :
Fin d
(∑ o : Obs d, if o.X = x then fillerObservedCoeff q o else 0) = 1
Proof (Lean source)
lemma sum_fillerObservedCoeff_at_label (d : ℕ) (q : ℝ) (x : Fin d) : (∑ o : Obs d, if o.X = x then fillerObservedCoeff q o else 0) = 1 := by rw [Fintype.sum_equiv (obsTupleEquiv d) (fun o => if o.X = x then fillerObservedCoeff q o else 0) (fun t => if ((obsTupleEquiv d).symm t).X = x then fillerObservedCoeff q ((obsTupleEquiv d).symm t) else 0) (by intro o; simp)] simp only [Fintype.sum_prod_type] simp [obsTupleEquiv, fillerObservedCoeff] ring
CausalSmith.Stat.MarNearcompleteFrontier.sum_fillerObservedCoeff_at_label · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/Basic.lean:127
theorem sum_pairObservedCoeff_at_label

At any fixed baseline label, each oriented pair's observed coefficients have total mass one. Given the specified input d, the specified input q, the specified input z, the specified input u, the specified input x, the stated mathematical conclusion holds. Given the specified input σ.

Formal statement
d :
ℕ
q σ z u :
ℝ
x :
Fin d
(∑ o : Obs d, if o.X = x then pairObservedCoeff q σ z u o else 0) = 1
Proof (Lean source)
lemma sum_pairObservedCoeff_at_label (d : ℕ) (q σ z u : ℝ) (x : Fin d) : (∑ o : Obs d, if o.X = x then pairObservedCoeff q σ z u o else 0) = 1 := by rw [Fintype.sum_equiv (obsTupleEquiv d) (fun o => if o.X = x then pairObservedCoeff q σ z u o else 0) (fun t => if ((obsTupleEquiv d).symm t).X = x then pairObservedCoeff q σ z u ((obsTupleEquiv d).symm t) else 0) (by intro o; simp)] simp only [Fintype.sum_prod_type] simp [obsTupleEquiv, pairObservedCoeff] ring
CausalSmith.Stat.MarNearcompleteFrontier.sum_pairObservedCoeff_at_label · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/Basic.lean:141
theorem countAtomMass_sum

The unnormalized count-cell intensities sum exactly to the random normalizer, independently of the sign parameter. Given the specified input n, the specified input d, the specified input q, the specified input hd, the stated mathematical conclusion holds. Given the specified input σ, the specified input θ.

Formal statement
n d :
ℕ
q σ :
ℝ
hd :
1 ≤ d
θ :
Theta n d
(∑ o : Obs d, countAtomMass n d q σ hd θ o) = normalizationJ n d θ
Proof (Lean source)
lemma countAtomMass_sum (n d : ℕ) (q σ : ℝ) (hd : 1 ≤ d) (θ : Theta n d) : (∑ o : Obs d, countAtomMass n d q σ hd θ o) = normalizationJ n d θ := by classical have hfiller : (∑ o : Obs d, if o.X = fillerLabel d hd then fillerMass n d * fillerObservedCoeff q o else 0) = fillerMass n d := by calc _ = fillerMass n d * (∑ o : Obs d, if o.X = fillerLabel d hd then fillerObservedCoeff q o else 0) := by rw [Finset.mul_sum] apply Finset.sum_congr rfl intro o _ split_ifs <;> ring _ = _ := by rw [sum_fillerObservedCoeff_at_label]; ring have hpair (j : Fin (pairCount n d)) (side : Bool) : (∑ o : Obs d, if o.X = pairLabel n d hd j side then latentP n (θ.1 j) * pairObservedCoeff q σ (latentZ n (θ.1 j)) (orientation θ j side) o else 0) = latentP n (θ.1 j) := by calc _ = latentP n (θ.1 j) * (∑ o : Obs d, if o.X = pairLabel n d hd j side then pairObservedCoeff q σ (latentZ n (θ.1 j)) (orientation θ j side) o else 0) := by rw [Finset.mul_sum] apply Finset.sum_congr rfl intro o _ split_ifs <;> ring _ = _ := by rw [sum_pairObservedCoeff_at_label]; ring unfold countAtomMass normalizationJ rw [Finset.sum_add_distrib, hfiller] have hreorder : (∑ o : Obs d, ∑ j : Fin (pairCount n d), ∑ side : Bool, if o.X = pairLabel n d hd j side then latentP n (θ.1 j) * pairObservedCoeff q σ (latentZ n (θ.1 j)) (orientation θ j side) o else 0) = ∑ j : Fin (pairCount n d), ∑ side : Bool, ∑ o : Obs d, if o.X = pairLabel n d hd j side then latentP n (θ.1 j) * pairObservedCoeff q σ (latentZ n (θ.1 j)) (orientation θ j side) o else 0 := by rw [Finset.sum_comm] apply Finset.sum_congr rfl intro j _ rw [Finset.sum_comm] rw [hreorder] simp_rw [hpair] simp rw [Finset.mul_sum]
theorem pairObservedCoeff_sign_flip

Flipping the experiment sign is exactly the same as flipping the latent sign in every oriented pair coefficient. Given the specified input q, the specified input z, the specified input u, the specified input o, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
shared
q z u :
ℝ
o :
Obs d
pairObservedCoeff q (-1) z u o = pairObservedCoeff q 1 (-z) u o
Proof (Lean source)
lemma pairObservedCoeff_sign_flip (q z u : ℝ) (o : Obs d) : pairObservedCoeff q (-1) z u o = pairObservedCoeff q 1 (-z) u o := by simp only [pairObservedCoeff] split_ifs <;> ring
CausalSmith.Stat.MarNearcompleteFrontier.pairObservedCoeff_sign_flip · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/Basic.lean:208
theorem pairObservedCoeff_orientation_linear_cancel

After averaging the two opposite orientations, every degree-one observed coefficient is independent of the experiment sign. Given the specified input n, the specified input d, the specified input q, the specified input z, the specified input o, the stated mathematical conclusion holds. Given the specified input θ. Given the specified input j.

Formal statement
n d :
ℕ
q z :
ℝ
θ :
Theta n d
j :
o :
Obs d
(∑ side : Bool, pairObservedCoeff q (-1) z (orientation θ j side) o)
= ∑ side : Bool, pairObservedCoeff q 1 z (orientation θ j side) o
Proof (Lean source)
lemma pairObservedCoeff_orientation_linear_cancel (n d : ℕ) (q z : ℝ) (θ : Theta n d) (j : Fin (pairCount n d)) (o : Obs d) : (∑ side : Bool, pairObservedCoeff q (-1) z (orientation θ j side) o) = ∑ side : Bool, pairObservedCoeff q 1 z (orientation θ j side) o := by cases hside : θ.2 j <;> simp [orientation, hside, pairObservedCoeff] <;> split_ifs <;> ring
CausalSmith.Stat.MarNearcompleteFrontier.pairObservedCoeff_orientation_linear_cancel · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/Basic.lean:216
theorem pairObservedCoeff_bool_orientation_linear_cancel

Explicit averaging over the base orientation removes every degree-one experiment-sign dependence. Given the specified input q, the specified input z, the specified input target, the specified input o, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
shared
q z :
ℝ
target :
o :
Obs d
(∑ base : Bool, pairObservedCoeff q (-1) z (if base == target then 1 else -1) o)
= ∑ base : Bool, pairObservedCoeff q 1 z (if base == target then 1 else -1) o
Proof (Lean source)
lemma pairObservedCoeff_bool_orientation_linear_cancel (q z : ℝ) (target : Bool) (o : Obs d) : (∑ base : Bool, pairObservedCoeff q (-1) z (if base == target then 1 else -1) o) = ∑ base : Bool, pairObservedCoeff q 1 z (if base == target then 1 else -1) o := by cases target <;> simp [pairObservedCoeff] <;> split_ifs <;> ring
CausalSmith.Stat.MarNearcompleteFrontier.pairObservedCoeff_bool_orientation_linear_cancel · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/Basic.lean:228
theorem pairObservedCoeff_orientation_square_gap

At the treated observed-failure mark, the orientation-averaged quadratic coefficient has a nonzero signed-latent gap. This is the first term for which moment cancellation is needed. Given the specified input n, the specified input d, the specified input q, the specified input z, the specified input o, the specified input hA, the specified input hS, the specified input hR, the specified input hRY, the stated mathematical conclusion holds. Given the specified input θ. Given the specified input j.

Formal statement
n d :
ℕ
q z :
ℝ
θ :
Theta n d
j :
o :
Obs d
hA :
o.A = true
hS :
o.S = false
hR :
o.R = true
hRY :
o.RY = false
(∑ side : Bool, pairObservedCoeff q (-1) z (orientation θ j side) o ^ 2)
- (∑ side : Bool, pairObservedCoeff q 1 z (orientation θ j side) o ^ 2)
= -delta q * z / 16
Proof (Lean source)
lemma pairObservedCoeff_orientation_square_gap (n d : ℕ) (q z : ℝ) (θ : Theta n d) (j : Fin (pairCount n d)) (o : Obs d) (hA : o.A = true) (hS : o.S = false) (hR : o.R = true) (hRY : o.RY = false) : (∑ side : Bool, pairObservedCoeff q (-1) z (orientation θ j side) o ^ 2) - (∑ side : Bool, pairObservedCoeff q 1 z (orientation θ j side) o ^ 2) = -delta q * z / 16 := by cases hside : θ.2 j <;> simp [orientation, hside, pairObservedCoeff, hA, hS, hR, hRY] <;> ring
CausalSmith.Stat.MarNearcompleteFrontier.pairObservedCoeff_orientation_square_gap · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/Basic.lean:240
theorem pairObservedCoeff_le_one

Every legal oriented-pair observed coefficient is at most one. Given the specified input q, the specified input z, the specified input u, the specified input o, the specified input hz, the specified input hu, the stated mathematical conclusion holds. Given the specified input σ, the specified input hσ. Given the specified input hq.

Formal statement
d :
ℕ
shared
q σ z u :
ℝ
o :
Obs d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
hσ :
σ = -1 ∨ σ = 1
hz :
z = -1 ∨ z = 1
hu :
u = -1 ∨ u = 1
pairObservedCoeff q σ z u o ≤ 1
Proof (Lean source)
lemma pairObservedCoeff_le_one (q σ z u : ℝ) (o : Obs d) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (hσ : σ = -1 ∨ σ = 1) (hz : z = -1 ∨ z = 1) (hu : u = -1 ∨ u = 1) : pairObservedCoeff q σ z u o ≤ 1 := by have hdlo : 0 ≤ delta q := by unfold delta; linarith [hq.2] have hdhi : delta q ≤ 1 / 2 := by unfold delta; linarith [hq.1] rcases hσ with rfl | rfl <;> rcases hz with rfl | rfl <;> rcases hu with rfl | rfl all_goals simp only [pairObservedCoeff] <;> split_ifs <;> norm_num <;> linarith
CausalSmith.Stat.MarNearcompleteFrontier.pairObservedCoeff_le_one · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/Basic.lean:256
theorem conditionalCountLaw_singleton_product

The singleton likelihood of a conditional count vector is the finite product of its scalar Poisson probabilities. Given the specified input n, the specified input d, the specified input q, the specified input hd, the specified input counts, the stated mathematical conclusion holds. Given the specified input σ, the specified input θ.

Formal statement
n d :
ℕ
q σ :
ℝ
hd :
1 ≤ d
θ :
Theta n d
counts :
Obs d → ℕ
(conditionalCountLaw n d q σ hd θ).real {counts}
= ∏ o : Obs d, exp (-(toNNReal (4 * (n : ℝ) * countAtomMass n d q σ hd θ o) : ℝ)) * (toNNReal (4 * (n : ℝ) * countAtomMass n d q σ hd θ o) : ℝ) ^ counts o / (counts o).factorial
Proof (Lean source)
lemma conditionalCountLaw_singleton_product (n d : ℕ) (q σ : ℝ) (hd : 1 ≤ d) (θ : Theta n d) (counts : Obs d → ℕ) : (conditionalCountLaw n d q σ hd θ).real {counts} = ∏ o : Obs d, exp (-(toNNReal (4 * (n : ℝ) * countAtomMass n d q σ hd θ o) : ℝ)) * (toNNReal (4 * (n : ℝ) * countAtomMass n d q σ hd θ o) : ℝ) ^ counts o / (counts o).factorial := by unfold conditionalCountLaw rw [Measure.real_def, Measure.pi_singleton, ENNReal.toReal_prod] apply Finset.prod_congr rfl intro o _ rw [poissonMeasure_singleton, ENNReal.toReal_ofReal] positivity
CausalSmith.Stat.MarNearcompleteFrontier.conditionalCountLaw_singleton_product · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/Basic.lean:269
theorem conditionalCountLaw_singleton_likelihood

In the legal sign regime, the conditional count-vector likelihood has one shared exponential factor determined by normalizationJ. Given the specified input n, the specified input d, the specified input q, the specified input hn, the specified input hd, the specified input counts, the stated mathematical conclusion holds. Given the specified input σ, the specified input hσ, the specified input θ. Given the specified input hq.

Formal statement
n d :
ℕ
q σ :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
hσ :
σ = -1 ∨ σ = 1
θ :
Theta n d
counts :
Obs d → ℕ
(conditionalCountLaw n d q σ hd θ).real {counts}
= exp (-4 * (n : ℝ) * normalizationJ n d θ) * ∏ o : Obs d, (4 * (n : ℝ) * countAtomMass n d q σ hd θ o) ^ counts o / (counts o).factorial
Proof (Lean source)
lemma conditionalCountLaw_singleton_likelihood (n d : ℕ) (q σ : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (hσ : σ = -1 ∨ σ = 1) (θ : Theta n d) (counts : Obs d → ℕ) : (conditionalCountLaw n d q σ hd θ).real {counts} = exp (-4 * (n : ℝ) * normalizationJ n d θ) * ∏ o : Obs d, (4 * (n : ℝ) * countAtomMass n d q σ hd θ o) ^ counts o / (counts o).factorial := by rw [conditionalCountLaw_singleton_product n d q σ hd θ counts] have hmass (o : Obs d) : 0 ≤ 4 * (n : ℝ) * countAtomMass n d q σ hd θ o := mul_nonneg (mul_nonneg (by norm_num) (Nat.cast_nonneg _)) (countAtomMass_nonneg n d q σ hn hd hq θ o hσ) simp_rw [Real.coe_toNNReal _ (hmass _)] rw [show (∏ o : Obs d, exp (-(4 * (n : ℝ) * countAtomMass n d q σ hd θ o)) * (4 * (n : ℝ) * countAtomMass n d q σ hd θ o) ^ counts o / (counts o).factorial) = ∏ o : Obs d, exp (-(4 * (n : ℝ) * countAtomMass n d q σ hd θ o)) * ((4 * (n : ℝ) * countAtomMass n d q σ hd θ o) ^ counts o / (counts o).factorial) by apply Finset.prod_congr rfl intro o _ ring] rw [Finset.prod_mul_distrib, ← Real.exp_sum] rw [show (∑ o : Obs d, -(4 * (n : ℝ) * countAtomMass n d q σ hd θ o)) = -4 * (n : ℝ) * normalizationJ n d θ by rw [show (fun o : Obs d => -(4 * (n : ℝ) * countAtomMass n d q σ hd θ o)) = fun o => (-4 * (n : ℝ)) * countAtomMass n d q σ hd θ o by funext o ring, ← Finset.mul_sum, countAtomMass_sum]]
CausalSmith.Stat.MarNearcompleteFrontier.conditionalCountLaw_singleton_likelihood · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/Basic.lean:288
theorem mixedCountLaw_singleton_likelihood

The mixed count-vector likelihood is the finite latent average of the conditional product likelihood, with a sign-independent exponential factor. Given the specified input n, the specified input d, the specified input q, the specified input hn, the specified input hd, the specified input counts, the stated mathematical conclusion holds. Given the specified input σ, the specified input hσ. Given the specified input hq.

Formal statement
n d :
ℕ
q σ :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
hσ :
σ = -1 ∨ σ = 1
counts :
Obs d → ℕ
(mixedCountLaw n d q σ hn hd hq).real {counts}
= ∑ θ : Theta n d, (thetaLaw n d q hn hd hq θ).toReal * (exp (-4 * (n : ℝ) * normalizationJ n d θ) * ∏ o : Obs d, (4 * (n : ℝ) * countAtomMass n d q σ hd θ o) ^ counts o / (counts o).factorial)
Proof (Lean source)
lemma mixedCountLaw_singleton_likelihood (n d : ℕ) (q σ : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (hσ : σ = -1 ∨ σ = 1) (counts : Obs d → ℕ) : (mixedCountLaw n d q σ hn hd hq).real {counts} = ∑ θ : Theta n d, (thetaLaw n d q hn hd hq θ).toReal * (exp (-4 * (n : ℝ) * normalizationJ n d θ) * ∏ o : Obs d, (4 * (n : ℝ) * countAtomMass n d q σ hd θ o) ^ counts o / (counts o).factorial) := by unfold mixedCountLaw rw [Measure.real, Measure.coe_finsetSum, Finset.sum_apply, ENNReal.toReal_sum] · apply Finset.sum_congr rfl intro θ _ rw [Measure.smul_apply, smul_eq_mul, ENNReal.toReal_mul] congr 1 exact conditionalCountLaw_singleton_likelihood n d q σ hn hd hq hσ θ counts · intro θ _ apply ENNReal.mul_ne_top (PMF.apply_ne_top _ _) letI : IsProbabilityMeasure (conditionalCountLaw n d q σ hd θ) := by unfold conditionalCountLaw infer_instance exact measure_ne_top _ _
CausalSmith.Stat.MarNearcompleteFrontier.mixedCountLaw_singleton_likelihood · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/Basic.lean:327
theorem countAtomMass_at_pair_label

At a paired baseline label, exactly one pair component contributes to the unnormalized observed-atom mass. Given the specified input n, the specified input d, the specified input q, the specified input hd, the specified input o, the specified input side, the specified input ho, the stated mathematical conclusion holds. Given the specified input σ, the specified input θ. Given the specified input j.

Formal statement
n d :
ℕ
q σ :
ℝ
hd :
1 ≤ d
θ :
Theta n d
o :
Obs d
j :
side :
ho :
o.X = pairLabel n d hd j side
countAtomMass n d q σ hd θ o
= latentP n (θ.1 j) * pairObservedCoeff q σ (latentZ n (θ.1 j)) (orientation θ j side) o
Proof (Lean source)
lemma countAtomMass_at_pair_label (n d : ℕ) (q σ : ℝ) (hd : 1 ≤ d) (θ : Theta n d) (o : Obs d) (j : Fin (pairCount n d)) (side : Bool) (ho : o.X = pairLabel n d hd j side) : countAtomMass n d q σ hd θ o = latentP n (θ.1 j) * pairObservedCoeff q σ (latentZ n (θ.1 j)) (orientation θ j side) o := by unfold countAtomMass have hfiller : o.X ≠ fillerLabel d hd := by rw [ho] exact (fillerLabel_ne_pairLabel n d hd j side).symm rw [if_neg hfiller] simp only [zero_add] rw [Finset.sum_eq_single j] · rw [Finset.sum_eq_single side] · rw [if_pos ho] · intro side' _ hside' rw [if_neg] intro hlabel exact hside' (pairLabel_injective n d hd j j side' side (hlabel.symm.trans ho)).2 · simp · intro k _ hkj apply Finset.sum_eq_zero intro side' _ rw [if_neg] intro hlabel exact hkj (pairLabel_injective n d hd k j side' side (hlabel.symm.trans ho)).1 · simp
CausalSmith.Stat.MarNearcompleteFrontier.countAtomMass_at_pair_label · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/Basic.lean:355
theorem countAtomMass_at_filler_label

At the filler baseline label, every paired component vanishes. Given the specified input n, the specified input d, the specified input q, the specified input hd, the specified input o, the specified input ho, the stated mathematical conclusion holds. Given the specified input σ, the specified input θ.

Formal statement
n d :
ℕ
q σ :
ℝ
hd :
1 ≤ d
θ :
Theta n d
o :
Obs d
ho :
o.X = fillerLabel d hd
countAtomMass n d q σ hd θ o = fillerMass n d * fillerObservedCoeff q o
Proof (Lean source)
lemma countAtomMass_at_filler_label (n d : ℕ) (q σ : ℝ) (hd : 1 ≤ d) (θ : Theta n d) (o : Obs d) (ho : o.X = fillerLabel d hd) : countAtomMass n d q σ hd θ o = fillerMass n d * fillerObservedCoeff q o := by unfold countAtomMass rw [if_pos ho] suffices (∑ j : Fin (pairCount n d), ∑ side : Bool, if o.X = pairLabel n d hd j side then latentP n (θ.1 j) * pairObservedCoeff q σ (latentZ n (θ.1 j)) (orientation θ j side) o else 0) = 0 by linarith apply Finset.sum_eq_zero intro j _ apply Finset.sum_eq_zero intro side _ rw [if_neg] rw [ho] exact fillerLabel_ne_pairLabel n d hd j side
CausalSmith.Stat.MarNearcompleteFrontier.countAtomMass_at_filler_label · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/Basic.lean:388
theorem prod_by_observed_label

A finite product over observed atoms factors into products over baseline labels. Given the specified input f, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
shared
f :
Obs d → ℝ
(∏ o : Obs d, f o) = ∏ x : Fin d, ∏ o : Obs d, if o.X = x then f o else 1
Proof (Lean source)
lemma prod_by_observed_label (f : Obs d → ℝ) : (∏ o : Obs d, f o) = ∏ x : Fin d, ∏ o : Obs d, if o.X = x then f o else 1 := by classical symm calc _ = ∏ x : Fin d, ∏ o ∈ (Finset.univ : Finset (Obs d)) with o.X = x, f o := by apply Finset.prod_congr rfl intro x _ simpa using (Finset.prod_filter (s := (Finset.univ : Finset (Obs d))) (fun o : Obs d => o.X = x) f).symm _ = ∏ o ∈ (Finset.univ : Finset (Obs d)), f o := Finset.prod_fiberwise (Finset.univ : Finset (Obs d)) (fun o => o.X) f _ = _ := by simp
CausalSmith.Stat.STAT_MarNearcompleteFrontier_Research.Helpers.LowerBound.CountMixture.CountDegree 10 declarations The multinomial identity sums all observed marks before bounding the latent mass.

Summing marked likelihoods at a fixed count degree

The multinomial identity sums all observed marks before bounding the latent mass. This preserves the pair's total intensity and avoids a factor depending on the number of mark configurations in the unmatched Taylor tail.

theorem pairMarkedIntensity_fixed_degree_sum

For a sample multiplier, alphabet size, total count degree, arrival parameter, sign, latent orientation, latent mass, positive-alphabet witness, pair index, and base orientation, summing the factorial-normalized products of the marked intensities over all count vectors of that degree gives the corresponding Poisson-series coefficient.

Formal statement
n d r :
ℕ
q σ z p :
ℝ
hd :
1 ≤ d
j :
base :
(∑ counts ∈ (Finset.univ : Finset (Obs d)).piAntidiag r, ∏ o : Obs d, pairMarkedIntensity n d q σ z p hd j base o ^ counts o / (counts o).factorial)
= (8 * (n : ℝ) * p) ^ r / (r.factorial : ℝ)
Proof (Lean source)
-- @node: pairMarkedIntensity_fixed_degree_sum lemma pairMarkedIntensity_fixed_degree_sum (n d r : ℕ) (q σ z p : ℝ) (hd : 1 ≤ d) (j : Fin (pairCount n d)) (base : Bool) : (∑ counts ∈ (Finset.univ : Finset (Obs d)).piAntidiag r, ∏ o : Obs d, pairMarkedIntensity n d q σ z p hd j base o ^ counts o / (counts o).factorial) = (8 * (n : ℝ) * p) ^ r / (r.factorial : ℝ) := by rw [factorial_countVector_fixed_degree_sum, pairMarkedIntensity_sum]
CausalSmith.Stat.MarNearcompleteFrontier.pairMarkedIntensity_fixed_degree_sum · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/CountDegree.lean:20
theorem pairMarkedIntensity_average_fixed_degree_sum

Fairly averaging the orientations leaves the same fixed-degree mass. Given the specified input n, the specified input d, the specified input r, the specified input q, the specified input z, the specified input p, the specified input hd, the stated mathematical conclusion holds. Given the specified input σ. Given the specified input j.

Formal statement
n d r :
ℕ
q σ z p :
ℝ
hd :
1 ≤ d
j :
(∑ counts ∈ (Finset.univ : Finset (Obs d)).piAntidiag r, ∑ base : Bool, (1 / 2 : ℝ) * ∏ o : Obs d, pairMarkedIntensity n d q σ z p hd j base o ^ counts o / (counts o).factorial)
= (8 * (n : ℝ) * p) ^ r / (r.factorial : ℝ)
Proof (Lean source)
-- @node: pairMarkedIntensity_average_fixed_degree_sum lemma pairMarkedIntensity_average_fixed_degree_sum (n d r : ℕ) (q σ z p : ℝ) (hd : 1 ≤ d) (j : Fin (pairCount n d)) : (∑ counts ∈ (Finset.univ : Finset (Obs d)).piAntidiag r, ∑ base : Bool, (1 / 2 : ℝ) * ∏ o : Obs d, pairMarkedIntensity n d q σ z p hd j base o ^ counts o / (counts o).factorial) = (8 * (n : ℝ) * p) ^ r / (r.factorial : ℝ) := by rw [Finset.sum_comm] simp_rw [← Finset.mul_sum, pairMarkedIntensity_fixed_degree_sum] simp
CausalSmith.Stat.MarNearcompleteFrontier.pairMarkedIntensity_average_fixed_degree_sum · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/CountDegree.lean:36
theorem pairMarkedIntensity_gap_fixed_degree_l1

The fixed-degree signed orientation average is bounded in total absolute mass by the sum of its two nonnegative marked likelihoods. Given the specified input n, the specified input d, the specified input r, the specified input q, the specified input z, the specified input p, the specified input hd, the specified input hz, the specified input hp, the stated mathematical conclusion holds. Given the specified input hq, the specified input j.

Formal statement
n d r :
ℕ
q z p :
ℝ
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
hz :
z = -1 ∨ z = 1
hp :
0 ≤ p
j :
(∑ counts ∈ (Finset.univ : Finset (Obs d)).piAntidiag r, |(∑ base : Bool, (1 / 2 : ℝ) * ∏ o : Obs d, pairMarkedIntensity n d q (-1) z p hd j base o ^ counts o / (counts o).factorial) - ∑ base : Bool, (1 / 2 : ℝ) * ∏ o : Obs d, pairMarkedIntensity n d q 1 z p hd j base o ^ counts o / (counts o).factorial|)
≤ 2 * (8 * (n : ℝ) * p) ^ r / (r.factorial : ℝ)
Proof (Lean source)
-- @node: pairMarkedIntensity_gap_fixed_degree_l1 lemma pairMarkedIntensity_gap_fixed_degree_l1 (n d r : ℕ) (q z p : ℝ) (hd : 1 ≤ d) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (hz : z = -1 ∨ z = 1) (hp : 0 ≤ p) (j : Fin (pairCount n d)) : (∑ counts ∈ (Finset.univ : Finset (Obs d)).piAntidiag r, |(∑ base : Bool, (1 / 2 : ℝ) * ∏ o : Obs d, pairMarkedIntensity n d q (-1) z p hd j base o ^ counts o / (counts o).factorial) - ∑ base : Bool, (1 / 2 : ℝ) * ∏ o : Obs d, pairMarkedIntensity n d q 1 z p hd j base o ^ counts o / (counts o).factorial|) ≤ 2 * (8 * (n : ℝ) * p) ^ r / (r.factorial : ℝ) := by have hnonneg (σ : ℝ) (hσ : σ = -1 ∨ σ = 1) (counts : Obs d → ℕ) : 0 ≤ ∑ base : Bool, (1 / 2 : ℝ) * ∏ o : Obs d, pairMarkedIntensity n d q σ z p hd j base o ^ counts o / (counts o).factorial := by apply Finset.sum_nonneg intro base _ apply mul_nonneg (by norm_num) apply Finset.prod_nonneg intro o _ exact div_nonneg (pow_nonneg (pairMarkedIntensity_nonneg n d q σ z p hd hq hσ hz hp j base o) _) (by positivity) calc _ ≤ ∑ counts ∈ (Finset.univ : Finset (Obs d)).piAntidiag r, ((∑ base : Bool, (1 / 2 : ℝ) * ∏ o : Obs d, pairMarkedIntensity n d q (-1) z p hd j base o ^ counts o / (counts o).factorial) + ∑ base : Bool, (1 / 2 : ℝ) * ∏ o : Obs d, pairMarkedIntensity n d q 1 z p hd j base o ^ counts o / (counts o).factorial) := by apply Finset.sum_le_sum intro counts _ exact abs_le.mpr ⟨by linarith [hnonneg (-1) (inl rfl) counts], by linarith [hnonneg 1 (inr rfl) counts]⟩ _ = _ := by rw [Finset.sum_add_distrib, pairMarkedIntensity_average_fixed_degree_sum, pairMarkedIntensity_average_fixed_degree_sum] ring
CausalSmith.Stat.MarNearcompleteFrontier.pairMarkedIntensity_gap_fixed_degree_l1 · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/CountDegree.lean:49
theorem pairMarkedIntensity_prod_eq_local_of_supported

For a positive covariate dimension and a count vector supported on the selected pair, the full marked factorial likelihood equals the label-restricted local likelihood.

Formal statement
n d :
ℕ
q σ z p :
ℝ
hd :
1 ≤ d
j :
base :
counts :
Obs d → ℕ
hsupport :
∀ o : Obs d
if
(∀ side : Bool, o.X ≠ pairLabel n d hd j side)
then
counts o = 0
(∏ o : Obs d, pairMarkedIntensity n d q σ z p hd j base o ^ counts o / (counts o).factorial)
= pairMarkedLocalFactor n d q σ z p hd j base counts
Proof (Lean source)
-- @node: pairMarkedIntensity_prod_eq_local_of_supported lemma pairMarkedIntensity_prod_eq_local_of_supported (n d : ℕ) (q σ z p : ℝ) (hd : 1 ≤ d) (j : Fin (pairCount n d)) (base : Bool) (counts : Obs d → ℕ) (hsupport : ∀ o : Obs d, (∀ side : Bool, o.X ≠ pairLabel n d hd j side) → counts o = 0) : (∏ o : Obs d, pairMarkedIntensity n d q σ z p hd j base o ^ counts o / (counts o).factorial) = pairMarkedLocalFactor n d q σ z p hd j base counts := by classical unfold pairMarkedLocalFactor rw [Finset.prod_comm] apply Finset.prod_congr rfl intro o _ by_cases hlabel : ∃ side : Bool, o.X = pairLabel n d hd j side · obtain ⟨side, ho⟩ := hlabel rw [Finset.prod_eq_single side] · rw [if_pos ho] · intro side' _ hne rw [if_neg] intro ho' exact hne (pairLabel_injective n d hd j j side' side (ho'.symm.trans ho)).2 · simp · have ho : ∀ side : Bool, o.X ≠ pairLabel n d hd j side := by simpa using hlabel have hc := hsupport o ho simp [hc]
CausalSmith.Stat.MarNearcompleteFrontier.pairMarkedIntensity_prod_eq_local_of_supported · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/CountDegree.lean:93
theorem pairMarkedIntensity_prod_eq_zero_of_unsupported

A positive count outside both labels of the pair makes its full marked likelihood zero. Given the specified input n, the specified input d, the specified input q, the specified input z, the specified input p, the specified input hd, the specified input base, the specified input counts, the specified input o, the specified input ho, the specified input hc, the stated mathematical conclusion holds. Given the specified input σ. Given the specified input j.

Formal statement
n d :
ℕ
q σ z p :
ℝ
hd :
1 ≤ d
j :
base :
counts :
Obs d → ℕ
o :
Obs d
ho :
∀ side : Bool, o.X ≠ pairLabel n d hd j side
hc :
counts o ≠ 0
(∏ o' : Obs d, pairMarkedIntensity n d q σ z p hd j base o' ^ counts o' / (counts o').factorial)
= 0
Proof (Lean source)
-- @node: pairMarkedIntensity_prod_eq_zero_of_unsupported lemma pairMarkedIntensity_prod_eq_zero_of_unsupported (n d : ℕ) (q σ z p : ℝ) (hd : 1 ≤ d) (j : Fin (pairCount n d)) (base : Bool) (counts : Obs d → ℕ) (o : Obs d) (ho : ∀ side : Bool, o.X ≠ pairLabel n d hd j side) (hc : counts o ≠ 0) : (∏ o' : Obs d, pairMarkedIntensity n d q σ z p hd j base o' ^ counts o' / (counts o').factorial) = 0 := by apply Finset.prod_eq_zero (Finset.mem_univ o) have hrate : pairMarkedIntensity n d q σ z p hd j base o = 0 := by simp [pairMarkedIntensity, ho] simp [hrate, hc]
CausalSmith.Stat.MarNearcompleteFrontier.pairMarkedIntensity_prod_eq_zero_of_unsupported · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/CountDegree.lean:120
theorem pairBlockCount_eq_total_of_supported

For a positive covariate dimension and a count vector supported on the selected pair, the pair block count equals the total observed count.

Formal statement
n d :
ℕ
hd :
1 ≤ d
j :
counts :
Obs d → ℕ
hsupport :
∀ o : Obs d
if
(∀ side : Bool, o.X ≠ pairLabel n d hd j side)
then
counts o = 0
pairBlockCount n d hd counts j = ∑ o : Obs d, counts o
Proof (Lean source)
-- @node: pairBlockCount_eq_total_of_supported lemma pairBlockCount_eq_total_of_supported (n d : ℕ) (hd : 1 ≤ d) (j : Fin (pairCount n d)) (counts : Obs d → ℕ) (hsupport : ∀ o : Obs d, (∀ side : Bool, o.X ≠ pairLabel n d hd j side) → counts o = 0) : pairBlockCount n d hd counts j = ∑ o : Obs d, counts o := by classical unfold pairBlockCount rw [Finset.sum_comm] apply Finset.sum_congr rfl intro o _ by_cases hlabel : ∃ side : Bool, o.X = pairLabel n d hd j side · obtain ⟨side, ho⟩ := hlabel rw [Finset.sum_eq_single side] · simp [ho] · intro side' _ hne rw [if_neg] intro ho' exact hne (pairLabel_injective n d hd j j side' side (ho'.symm.trans ho)).2 · simp · have ho : ∀ side : Bool, o.X ≠ pairLabel n d hd j side := by simpa using hlabel simp [ho, hsupport o ho]
CausalSmith.Stat.MarNearcompleteFrontier.pairBlockCount_eq_total_of_supported · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/CountDegree.lean:134
def pairMarkedDegreeGap

The signed fair-orientation likelihood on the full observed alphabet, with zero rates enforcing zero counts outside the selected pair. Given the specified input n, the specified input d, the specified input q, the specified input z, the specified input p, the specified input hd, the specified input counts, the stated mathematical conclusion holds. Given the specified input j.

Definition (Lean source)
n d :
ℕ
q z p :
ℝ
hd :
1 ≤ d
j :
counts :
Obs d → ℕ
pairMarkedDegreeGap n d q z p hd j counts :
ℝ
(∑ base : Bool, (1 / 2 : ℝ) * ∏ o : Obs d, pairMarkedIntensity n d q (-1) z p hd j base o ^ counts o / (counts o).factorial)
- ∑ base : Bool, (1 / 2 : ℝ) * ∏ o : Obs d, pairMarkedIntensity n d q 1 z p hd j base o ^ counts o / (counts o).factorial
theorem pairMarkedDegreeGap_eq_local_of_supported

For a positive covariate dimension and a count vector supported on the selected pair, the signed marked likelihood has its local scalar-power representation.

Formal statement
n d :
ℕ
q z p :
ℝ
hd :
1 ≤ d
j :
counts :
Obs d → ℕ
hsupport :
∀ o : Obs d
if
(∀ side : Bool, o.X ≠ pairLabel n d hd j side)
then
counts o = 0
pairMarkedDegreeGap n d q z p hd j counts
= (4 * (n : ℝ) * p) ^ pairBlockCount n d hd counts j / pairBlockFactorial n d hd j counts * ((1 / 2 : ℝ) * pairBlockMarkAverage n d q (-1) z hd j counts - (1 / 2 : ℝ) * pairBlockMarkAverage n d q 1 z hd j counts)
Proof (Lean source)
-- @node: pairMarkedDegreeGap_eq_local_of_supported lemma pairMarkedDegreeGap_eq_local_of_supported (n d : ℕ) (q z p : ℝ) (hd : 1 ≤ d) (j : Fin (pairCount n d)) (counts : Obs d → ℕ) (hsupport : ∀ o : Obs d, (∀ side : Bool, o.X ≠ pairLabel n d hd j side) → counts o = 0) : pairMarkedDegreeGap n d q z p hd j counts = (4 * (n : ℝ) * p) ^ pairBlockCount n d hd counts j / pairBlockFactorial n d hd j counts * ((1 / 2 : ℝ) * pairBlockMarkAverage n d q (-1) z hd j counts - (1 / 2 : ℝ) * pairBlockMarkAverage n d q 1 z hd j counts) := by unfold pairMarkedDegreeGap simp_rw [pairMarkedIntensity_prod_eq_local_of_supported n d q _ z p hd j _ counts hsupport] rw [← half_pairBlockMarkAverage_eq_average_localFactor, ← half_pairBlockMarkAverage_eq_average_localFactor] ring
CausalSmith.Stat.MarNearcompleteFrontier.pairMarkedDegreeGap_eq_local_of_supported · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/CountDegree.lean:171
def pairMarkedTaylorCoefficient

The latent-averaged signed Taylor coefficient on the full observed alphabet, including the count-support constraint outside the selected pair. Given the specified input n, the specified input d, the specified input t, the specified input q, the specified input hd, the specified input counts, the stated mathematical conclusion holds. Given the specified input j.

Definition (Lean source)
n d t :
ℕ
q :
ℝ
hd :
1 ≤ d
j :
counts :
Obs d → ℕ
pairMarkedTaylorCoefficient n d t q hd j counts :
ℝ
∑ z : Latent n, latentWeight n z * ((-8 * (n : ℝ) * latentP n z) ^ t / (t.factorial : ℝ)) * pairMarkedDegreeGap n d q (latentZ n z) (latentP n z) hd j counts
theorem pairMarkedTaylorCoefficient_fixed_degree_l1

Summing the absolute signed Taylor coefficient over all marks of degree r gives the two-factor factorial envelope at the maximal latent intensity. This is the marked multinomial step in the one-pair tail comparison. Given the specified input n, the specified input d, the specified input r, the specified input t, the specified input q, the specified input hn, the specified input hd, the stated mathematical conclusion holds. Given the specified input hq, the specified input j.

Formal statement
n d r t :
ℕ
q :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
j :
(∑ counts ∈ (Finset.univ : Finset (Obs d)).piAntidiag r, |pairMarkedTaylorCoefficient n d t q hd j counts|)
≤ 2 * ((8 * (n : ℝ) * priorB n) ^ t / (t.factorial : ℝ)) * ((8 * (n : ℝ) * priorB n) ^ r / (r.factorial : ℝ))
Proof (Lean source)
-- @node: pairMarkedTaylorCoefficient_fixed_degree_l1 lemma pairMarkedTaylorCoefficient_fixed_degree_l1 (n d r t : ℕ) (q : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (j : Fin (pairCount n d)) : (∑ counts ∈ (Finset.univ : Finset (Obs d)).piAntidiag r, |pairMarkedTaylorCoefficient n d t q hd j counts|) ≤ 2 * ((8 * (n : ℝ) * priorB n) ^ t / (t.factorial : ℝ)) * ((8 * (n : ℝ) * priorB n) ^ r / (r.factorial : ℝ)) := by classical have hB0 : 0 ≤ priorB n := by unfold priorB; positivity have hscalar (z : Latent n) : |(-8 * (n : ℝ) * latentP n z) ^ t / (t.factorial : ℝ)| = (8 * (n : ℝ) * latentP n z) ^ t / (t.factorial : ℝ) := by have hp := latentP_nonneg n z rw [abs_div, abs_pow, abs_of_pos (by positivity : (0 : ℝ) < t.factorial)] rw [show -8 * (n : ℝ) * latentP n z = -(8 * (n : ℝ) * latentP n z) by ring, abs_neg, abs_of_nonneg (by positivity)] have hpoint (counts : Obs d → ℕ) : |pairMarkedTaylorCoefficient n d t q hd j counts| ≤ ∑ z : Latent n, latentWeight n z * ((8 * (n : ℝ) * latentP n z) ^ t / (t.factorial : ℝ)) * |pairMarkedDegreeGap n d q (latentZ n z) (latentP n z) hd j counts| := by unfold pairMarkedTaylorCoefficient refine (Finset.abs_sum_le_sum_abs _ _).trans_eq ?_ apply Finset.sum_congr rfl intro z _ rw [abs_mul, abs_mul, abs_of_nonneg (latentWeight_nonneg_count n z), hscalar] calc _ ≤ ∑ counts ∈ (Finset.univ : Finset (Obs d)).piAntidiag r, ∑ z : Latent n, latentWeight n z * ((8 * (n : ℝ) * latentP n z) ^ t / (t.factorial : ℝ)) * |pairMarkedDegreeGap n d q (latentZ n z) (latentP n z) hd j counts| := Finset.sum_le_sum (fun counts _ => hpoint counts) _ = ∑ z : Latent n, latentWeight n z * ((8 * (n : ℝ) * latentP n z) ^ t / (t.factorial : ℝ)) * ∑ counts ∈ (Finset.univ : Finset (Obs d)).piAntidiag r, |pairMarkedDegreeGap n d q (latentZ n z) (latentP n z) hd j counts| := by rw [Finset.sum_comm] simp_rw [Finset.mul_sum] _ ≤ ∑ z : Latent n, latentWeight n z * ((8 * (n : ℝ) * latentP n z) ^ t / (t.factorial : ℝ)) * (2 * (8 * (n : ℝ) * latentP n z) ^ r / (r.factorial : ℝ)) := by apply Finset.sum_le_sum intro z _ apply mul_le_mul_of_nonneg_left (pairMarkedIntensity_gap_fixed_degree_l1 n d r q (latentZ n z) (latentP n z) hd hq (latentZ_eq_neg_one_or_one n z) (latentP_nonneg n z) j) have hp := latentP_nonneg n z exact mul_nonneg (latentWeight_nonneg_count n z) (by positivity) _ ≤ ∑ z : Latent n, latentWeight n z * (((8 * (n : ℝ) * priorB n) ^ t / (t.factorial : ℝ)) * (2 * (8 * (n : ℝ) * priorB n) ^ r / (r.factorial : ℝ))) := by apply Finset.sum_le_sum intro z _ rw [mul_assoc] have hp := latentP_nonneg n z have hw := latentWeight_nonneg_count n z have hB := latentP_le_priorB_count n z gcongr _ = _ := by rw [← Finset.sum_mul, latentWeight_sum_real_count n d q hn hd hq] ring
CausalSmith.Stat.MarNearcompleteFrontier.pairMarkedTaylorCoefficient_fixed_degree_l1 · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/CountDegree.lean:197
CausalSmith.Stat.STAT_MarNearcompleteFrontier_Research.Helpers.LowerBound.CountMixture.Eventual 3 declarations Eventual for the paired count-mixture comparison

Eventual for the paired count-mixture comparison

theorem countMixture_exponential_tail_le Lemma countMixture_exponential_tail_le in the paper ↗

Exponential tilting bounds the unmatched factorial tail, without needing an asymptotic approximation to the factorial. Given the specified input K, the specified input z, the specified input hz, the stated mathematical conclusion holds.

Formal statement
K :
ℕ
z :
ℝ
hz :
0 ≤ z
≤ exp (-(K : ℝ) + exp 1 * z)
Proof (Lean source)
-- @node: countMixture_exponential_tail_le lemma countMixture_exponential_tail_le (K : ℕ) (z : ℝ) (hz : 0 ≤ z) : exponentialSeriesTail K z ≤ exp (-(K : ℝ) + exp 1 * z) := by let f : ℕ → ℝ := fun t => if K < t then z ^ t / (t.factorial : ℝ) else 0 let g : ℕ → ℝ := fun t => exp (-(K : ℝ)) * ((exp 1 * z) ^ t / (t.factorial : ℝ)) have hg : Summable g := (Real.summable_pow_div_factorial (exp 1 * z)).mul_left _ have hle (t : ℕ) : f t ≤ g t := by dsimp [f, g] split_ifs with ht · have hKt : (K : ℝ) ≤ t := by exact_mod_cast ht.le have hscale : 1 ≤ exp (-(K : ℝ)) * exp 1 ^ t := by rw [← Real.exp_nat_mul, mul_one, ← Real.exp_add] exact Real.one_le_exp (by linarith) have hterm : 0 ≤ z ^ t / (t.factorial : ℝ) := by positivity calc _ ≤ (exp (-(K : ℝ)) * exp 1 ^ t) * (z ^ t / (t.factorial : ℝ)) := le_mul_of_one_le_left hterm hscale _ = _ := by rw [mul_pow]; ring · positivity have hf : Summable f := Summable.of_nonneg_of_le (fun t => by dsimp [f]; positivity) hle hg calc _ ≤ ∑' t, g t := hf.tsum_le_tsum hle hg _ = exp (-(K : ℝ)) * exp (exp 1 * z) := by rw [show (∑' t, g t) = exp (-(K : ℝ)) * ∑' t : ℕ, (exp 1 * z) ^ t / (t.factorial : ℝ) by simp [g, tsum_mul_left]] congr 1 simpa only [← Real.exp_eq_exp_ℝ] using (NormedSpace.expSeries_div_hasSum_exp (exp 1 * z)).tsum_eq _ = _ := (Real.exp_add _ _).symm
CausalSmith.Stat.MarNearcompleteFrontier.countMixture_exponential_tail_le · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/Eventual.lean:14
theorem countMixture_factorial_tail_budget Lemma countMixture_factorial_tail_budget in the paper ↗

The prior's logarithmic matched degree makes the whole pair-count tail at most the reciprocal sample size, uniformly in the dimension. Given the specified input n, the specified input d, the specified input hn, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
hn :
1 ≤ n
(pairCount n d : ℝ) * exponentialSeriesTail (priorK n) (16 * (n : ℝ) * priorB n)
≤ 1 / (n : ℝ)
Proof (Lean source)
-- @node: countMixture_factorial_tail_budget lemma countMixture_factorial_tail_budget (n d : ℕ) (hn : 1 ≤ n) : (pairCount n d : ℝ) * exponentialSeriesTail (priorK n) (16 * (n : ℝ) * priorB n) ≤ 1 / (n : ℝ) := by have hnpos : (0 : ℝ) < n := by positivity have hK0 : 0 ≤ (priorK n : ℝ) := Nat.cast_nonneg _ have hz : 16 * (n : ℝ) * priorB n = (priorK n : ℝ) / 64 := by unfold priorB field_simp <;> ring have ht := countMixture_exponential_tail_le (priorK n) ((priorK n : ℝ) / 64) (by positivity) have ht' : exponentialSeriesTail (priorK n) ((priorK n : ℝ) / 64) ≤ exp (-4 * ell n) := by apply ht.trans apply Real.exp_le_exp.mpr have hK := priorK_lower_for_normalization n have he : exp 1 ≤ 3 := Real.exp_one_lt_three.le have hm := mul_le_mul_of_nonneg_right he (show 0 ≤ (priorK n : ℝ) / 64 by positivity) linarith have hell : 0 ≤ ell n := (one_le_ell_scale n).trans' (by norm_num) have hM : (pairCount n d : ℝ) ≤ (n : ℝ) * ell n := by have hm : pairCount n d ≤ floor ((n : ℝ) * ell n) := by unfold pairCount exact min_le_right _ _ exact (Nat.cast_le.mpr hm).trans (Nat.floor_le (by positivity)) have hexp : exp (ell n) = exp 1 + n := by unfold ell rw [Real.exp_log (by positivity)] have hnexp : (n : ℝ) ≤ exp (ell n) := by rw [hexp] linarith [Real.exp_pos 1] have hLexp : ell n ≤ exp (ell n) := by linarith [Real.add_one_le_exp (ell n)] calc _ ≤ (n : ℝ) * ell n * exp (-4 * ell n) := by rw [hz] exact (mul_le_mul_of_nonneg_left ht' (Nat.cast_nonneg _)).trans (mul_le_mul_of_nonneg_right hM (Real.exp_pos _).le) _ ≤ (exp (ell n) * exp (ell n)) * exp (-4 * ell n) := by gcongr _ = exp (-2 * ell n) := by rw [← Real.exp_add, ← Real.exp_add] congr 1 ring _ ≤ exp (-ell n) := Real.exp_le_exp.mpr (by linarith) _ ≤ 1 / (n : ℝ) := by rw [Real.exp_neg, inv_eq_one_div] exact one_div_le_one_div_of_le hnpos hnexp
CausalSmith.Stat.MarNearcompleteFrontier.countMixture_factorial_tail_budget · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/Eventual.lean:50
theorem mixedCountLaw_tv_eventual

Count-mixture half of the large-sample comparison. Moment cancellation in latent_signed_power_moment_zero removes degrees two through priorK; the remaining Poisson likelihood tail must be summed over the independent pairs. the stated mathematical conclusion holds. Given the specified input β, the specified input hβ.

Formal statement
β :
ℝ
hβ :
0 < β
∃ N : ℕ,
2 ≤ N
conclusion 1
n d :
ℕ
q :
ℝ
N ≤ n
hn :
1 ≤ n
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
gScale n d q ^ 2 ≥ 1 / (n : ℝ)
tvDist (mixedCountLaw n d q (-1) hn hd hq) (mixedCountLaw n d q 1 hn hd hq)
≤ β / 2
Proof (Lean source)
lemma mixedCountLaw_tv_eventual (β : ℝ) (hβ : 0 < β) : ∃ N : ℕ, 2 ≤ N ∧ ∀ (n d : ℕ) (q : ℝ), N ≤ n → ∀ (hn : 1 ≤ n) (hd : 1 ≤ d) (hq : q ∈ Icc ((1 : ℝ) / 2) 1), gScale n d q ^ 2 ≥ 1 / (n : ℝ) → tvDist (mixedCountLaw n d q (-1) hn hd hq) (mixedCountLaw n d q 1 hn hd hq) ≤ β / 2 := by obtain ⟨N₀, hN₀⟩ := exists_nat_gt (2 / β) refine ⟨max N₀ 2, le_max_right _ _, ?_⟩ intro n d q hnN hn hd hq _hreg have hn0 : N₀ ≤ n := le_trans (le_max_left _ _) hnN have hnR : 2 / β < (n : ℝ) := lt_of_lt_of_le hN₀ (by exact_mod_cast hn0) calc _ ≤ _ := mixedCountLaw_tv_le_factorial_tail n d q hn hd hq _ ≤ 1 / (n : ℝ) := countMixture_factorial_tail_budget n d hn _ ≤ β / 2 := by apply (div_le_iff₀ (by positivity : (0 : ℝ) < n)).mpr have h := (div_lt_iff₀ hβ).mp hnR linarith
CausalSmith.Stat.STAT_MarNearcompleteFrontier_Research.Helpers.LowerBound.CountMixture.Factorization 16 declarations Factorization for the paired count-mixture comparison

Factorization for the paired count-mixture comparison

def pairLabelFactorial

Product of count factorials at one paired baseline label. Given the specified input n, the specified input d, the specified input hd, the specified input side, the specified input counts, the stated mathematical conclusion holds. Given the specified input j.

Definition (Lean source)
n d :
ℕ
hd :
1 ≤ d
j :
side :
counts :
Obs d → ℕ
pairLabelFactorial n d hd j side counts :
ℝ
∏ o : Obs d, if o.X = pairLabel n d hd j side then ((counts o).factorial : ℝ) else 1
theorem pair_label_poisson_power_factorization

The full power/factorial contribution at one paired label separates into its scalar pair mass, observed-mark monomial, and count factorials. Given the specified input n, the specified input d, the specified input q, the specified input hd, the specified input counts, the specified input side, the stated mathematical conclusion holds. Given the specified input σ, the specified input θ. Given the specified input j.

Formal statement
n d :
ℕ
q σ :
ℝ
hd :
1 ≤ d
θ :
Theta n d
counts :
Obs d → ℕ
j :
side :
(∏ o : Obs d, if o.X = pairLabel n d hd j side then (4 * (n : ℝ) * countAtomMass n d q σ hd θ o) ^ counts o / (counts o).factorial else 1)
= (4 * (n : ℝ) * latentP n (θ.1 j)) ^ (∑ o : Obs d, if o.X = pairLabel n d hd j side then counts o else 0) * pairObservedMonomial q σ (latentZ n (θ.1 j)) (orientation θ j side) (pairLabel n d hd j side) counts / pairLabelFactorial n d hd j side counts
Proof (Lean source)
lemma pair_label_poisson_power_factorization (n d : ℕ) (q σ : ℝ) (hd : 1 ≤ d) (θ : Theta n d) (counts : Obs d → ℕ) (j : Fin (pairCount n d)) (side : Bool) : (∏ o : Obs d, if o.X = pairLabel n d hd j side then (4 * (n : ℝ) * countAtomMass n d q σ hd θ o) ^ counts o / (counts o).factorial else 1) = (4 * (n : ℝ) * latentP n (θ.1 j)) ^ (∑ o : Obs d, if o.X = pairLabel n d hd j side then counts o else 0) * pairObservedMonomial q σ (latentZ n (θ.1 j)) (orientation θ j side) (pairLabel n d hd j side) counts / pairLabelFactorial n d hd j side counts := by unfold pairLabelFactorial pairObservedMonomial rw [show (∏ o : Obs d, if o.X = pairLabel n d hd j side then (4 * (n : ℝ) * countAtomMass n d q σ hd θ o) ^ counts o / (counts o).factorial else 1) = (∏ o : Obs d, if o.X = pairLabel n d hd j side then (4 * (n : ℝ) * countAtomMass n d q σ hd θ o) ^ counts o else 1) / ∏ o : Obs d, if o.X = pairLabel n d hd j side then ((counts o).factorial : ℝ) else 1 by rw [← Finset.prod_div_distrib] apply Finset.prod_congr rfl intro o _ by_cases ho : o.X = pairLabel n d hd j side <;> simp [ho]] congr 1 rw [← Finset.prod_pow_eq_pow_sum (Finset.univ : Finset (Obs d)) (fun o => if o.X = pairLabel n d hd j side then counts o else 0) (4 * (n : ℝ) * latentP n (θ.1 j)), ← Finset.prod_mul_distrib] apply Finset.prod_congr rfl intro o _ by_cases ho : o.X = pairLabel n d hd j side · simp only [ho, ↓reduceIte, countAtomMass_at_pair_label n d q σ hd θ o j side ho, mul_pow] ring · simp [ho]
CausalSmith.Stat.MarNearcompleteFrontier.pair_label_poisson_power_factorization · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/Factorization.lean:21
def pairBlockFactorial

Given the specified input n, the specified input d, the specified input hd, the specified input counts, the stated mathematical conclusion holds. Given the specified input j.

Definition (Lean source)
n d :
ℕ
hd :
1 ≤ d
j :
counts :
Obs d → ℕ
pairBlockFactorial n d hd j counts :
ℝ
∏ side : Bool, pairLabelFactorial n d hd j side counts
theorem pair_block_poisson_power_factorization

Multiplying the two labels of one pair combines their scalar mass powers to pairBlockCount and their marks to the pair-block monomial. Given the specified input n, the specified input d, the specified input q, the specified input hd, the specified input counts, the stated mathematical conclusion holds. Given the specified input σ, the specified input θ. Given the specified input j.

Formal statement
n d :
ℕ
q σ :
ℝ
hd :
1 ≤ d
θ :
Theta n d
counts :
Obs d → ℕ
j :
(∏ side : Bool, ∏ o : Obs d, if o.X = pairLabel n d hd j side then (4 * (n : ℝ) * countAtomMass n d q σ hd θ o) ^ counts o / (counts o).factorial else 1)
= (4 * (n : ℝ) * latentP n (θ.1 j)) ^ pairBlockCount n d hd counts j * (∏ side : Bool, pairObservedMonomial q σ (latentZ n (θ.1 j)) (orientation θ j side) (pairLabel n d hd j side) counts) / pairBlockFactorial n d hd j counts
Proof (Lean source)
lemma pair_block_poisson_power_factorization (n d : ℕ) (q σ : ℝ) (hd : 1 ≤ d) (θ : Theta n d) (counts : Obs d → ℕ) (j : Fin (pairCount n d)) : (∏ side : Bool, ∏ o : Obs d, if o.X = pairLabel n d hd j side then (4 * (n : ℝ) * countAtomMass n d q σ hd θ o) ^ counts o / (counts o).factorial else 1) = (4 * (n : ℝ) * latentP n (θ.1 j)) ^ pairBlockCount n d hd counts j * (∏ side : Bool, pairObservedMonomial q σ (latentZ n (θ.1 j)) (orientation θ j side) (pairLabel n d hd j side) counts) / pairBlockFactorial n d hd j counts := by simp_rw [pair_label_poisson_power_factorization n d q σ hd θ counts j] unfold pairBlockFactorial pairBlockCount rw [Finset.prod_div_distrib, Finset.prod_mul_distrib, Finset.prod_pow_eq_pow_sum]
CausalSmith.Stat.MarNearcompleteFrontier.pair_block_poisson_power_factorization · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/Factorization.lean:66
def pairMarkedLocalFactor

Factorial likelihood contribution restricted to the two labels of one marked pair. Given the specified input n, the specified input d, the specified input q, the specified input z, the specified input p, the specified input hd, the specified input base, the specified input counts, the stated mathematical conclusion holds. Given the specified input σ. Given the specified input j.

Definition (Lean source)
n d :
ℕ
q σ z p :
ℝ
hd :
1 ≤ d
j :
base :
counts :
Obs d → ℕ
pairMarkedLocalFactor n d q σ z p hd j base counts :
ℝ
∏ side : Bool, ∏ o : Obs d, if o.X
= pairLabel n d hd j side then pairMarkedIntensity n d q σ z p hd j base o ^ counts o / (counts o).factorial else 1
theorem pairMarkedLocalFactor_eq

The local marked-pair factorial likelihood is the scalar pair-count power times its observed-mark monomial divided by the block factorial. Given the specified input n, the specified input d, the specified input q, the specified input z, the specified input p, the specified input hd, the specified input base, the specified input counts, the stated mathematical conclusion holds. Given the specified input σ. Given the specified input j.

Formal statement
n d :
ℕ
q σ z p :
ℝ
hd :
1 ≤ d
j :
base :
counts :
Obs d → ℕ
pairMarkedLocalFactor n d q σ z p hd j base counts
= (4 * (n : ℝ) * p) ^ pairBlockCount n d hd counts j * (∏ side : Bool, pairObservedMonomial q σ z (if base == side then 1 else -1) (pairLabel n d hd j side) counts) / pairBlockFactorial n d hd j counts
Proof (Lean source)
lemma pairMarkedLocalFactor_eq (n d : ℕ) (q σ z p : ℝ) (hd : 1 ≤ d) (j : Fin (pairCount n d)) (base : Bool) (counts : Obs d → ℕ) : pairMarkedLocalFactor n d q σ z p hd j base counts = (4 * (n : ℝ) * p) ^ pairBlockCount n d hd counts j * (∏ side : Bool, pairObservedMonomial q σ z (if base == side then 1 else -1) (pairLabel n d hd j side) counts) / pairBlockFactorial n d hd j counts := by unfold pairMarkedLocalFactor pairBlockFactorial pairBlockCount have hlabel (side : Bool) : (∏ o : Obs d, if o.X = pairLabel n d hd j side then pairMarkedIntensity n d q σ z p hd j base o ^ counts o / (counts o).factorial else 1) = (4 * (n : ℝ) * p) ^ (∑ o : Obs d, if o.X = pairLabel n d hd j side then counts o else 0) * pairObservedMonomial q σ z (if base == side then 1 else -1) (pairLabel n d hd j side) counts / pairLabelFactorial n d hd j side counts := by unfold pairObservedMonomial pairLabelFactorial rw [show (∏ o : Obs d, if o.X = pairLabel n d hd j side then pairMarkedIntensity n d q σ z p hd j base o ^ counts o / (counts o).factorial else 1) = (∏ o : Obs d, if o.X = pairLabel n d hd j side then pairMarkedIntensity n d q σ z p hd j base o ^ counts o else 1) / ∏ o : Obs d, if o.X = pairLabel n d hd j side then ((counts o).factorial : ℝ) else 1 by rw [← Finset.prod_div_distrib] apply Finset.prod_congr rfl intro o _ by_cases ho : o.X = pairLabel n d hd j side <;> simp [ho]] congr 1 rw [← Finset.prod_pow_eq_pow_sum (Finset.univ : Finset (Obs d)) (fun o => if o.X = pairLabel n d hd j side then counts o else 0) (4 * (n : ℝ) * p), ← Finset.prod_mul_distrib] apply Finset.prod_congr rfl intro o _ by_cases ho : o.X = pairLabel n d hd j side · simp only [ho, ↓reduceIte, pairMarkedIntensity_at_label n d q σ z p hd j base side o ho, mul_pow] · simp [ho] simp_rw [hlabel] rw [Finset.prod_div_distrib, Finset.prod_mul_distrib, Finset.prod_pow_eq_pow_sum]
theorem half_pairBlockMarkAverage_eq_average_localFactor

The fair orientation-averaged raw block likelihood is exactly the fair average of the two fixed-base marked local factors. Given the specified input n, the specified input d, the specified input q, the specified input z, the specified input p, the specified input hd, the specified input counts, the stated mathematical conclusion holds. Given the specified input σ. Given the specified input j.

Formal statement
n d :
ℕ
q σ z p :
ℝ
hd :
1 ≤ d
j :
counts :
Obs d → ℕ
(4 * (n : ℝ) * p) ^ pairBlockCount n d hd counts j / pairBlockFactorial n d hd j counts * ((1 / 2 : ℝ) * pairBlockMarkAverage n d q σ z hd j counts)
= ∑ base : Bool, (1 / 2 : ℝ) * pairMarkedLocalFactor n d q σ z p hd j base counts
Proof (Lean source)
lemma half_pairBlockMarkAverage_eq_average_localFactor (n d : ℕ) (q σ z p : ℝ) (hd : 1 ≤ d) (j : Fin (pairCount n d)) (counts : Obs d → ℕ) : (4 * (n : ℝ) * p) ^ pairBlockCount n d hd counts j / pairBlockFactorial n d hd j counts * ((1 / 2 : ℝ) * pairBlockMarkAverage n d q σ z hd j counts) = ∑ base : Bool, (1 / 2 : ℝ) * pairMarkedLocalFactor n d q σ z p hd j base counts := by simp_rw [pairMarkedLocalFactor_eq n d q σ z p hd j] unfold pairBlockMarkAverage rw [Finset.mul_sum, Finset.mul_sum] apply Finset.sum_congr rfl intro base _ ring
CausalSmith.Stat.MarNearcompleteFrontier.half_pairBlockMarkAverage_eq_average_localFactor · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/Factorization.lean:147
theorem pairSidePoissonFactor_eq

The normalized Poisson factor on one side of a marked pair is its raw marked likelihood times the exponential of the side's total rate. Given the specified input n, the specified input d, the specified input q, the specified input z, the specified input p, the specified input hd, the specified input hz, the specified input hp, the specified input base, the specified input side, the specified input counts, the stated mathematical conclusion holds. Given the specified input σ, the specified input hσ. Given the specified input hq, the specified input j.

Formal statement
n d :
ℕ
q σ z p :
ℝ
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
hσ :
σ = -1 ∨ σ = 1
hz :
z = -1 ∨ z = 1
hp :
0 ≤ p
j :
base side :
counts :
Obs d → ℕ
(∏ o : Obs d, if o.X = pairLabel n d hd j side then exp (-(pairSideMarkedRate n d q σ z p hd j base side o : ℝ)) * (pairSideMarkedRate n d q σ z p hd j base side o : ℝ) ^ counts o / (counts o).factorial else 1)
= exp (-4 * (n : ℝ) * p) * ∏ o : Obs d, if o.X = pairLabel n d hd j side then pairMarkedIntensity n d q σ z p hd j base o ^ counts o / (counts o).factorial else 1
Proof (Lean source)
lemma pairSidePoissonFactor_eq (n d : ℕ) (q σ z p : ℝ) (hd : 1 ≤ d) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (hσ : σ = -1 ∨ σ = 1) (hz : z = -1 ∨ z = 1) (hp : 0 ≤ p) (j : Fin (pairCount n d)) (base side : Bool) (counts : Obs d → ℕ) : (∏ o : Obs d, if o.X = pairLabel n d hd j side then exp (-(pairSideMarkedRate n d q σ z p hd j base side o : ℝ)) * (pairSideMarkedRate n d q σ z p hd j base side o : ℝ) ^ counts o / (counts o).factorial else 1) = exp (-4 * (n : ℝ) * p) * ∏ o : Obs d, if o.X = pairLabel n d hd j side then pairMarkedIntensity n d q σ z p hd j base o ^ counts o / (counts o).factorial else 1 := by rw [poissonFactor_extract_exponential (fun o => (pairSideMarkedRate n d q σ z p hd j base side o : ℝ)) counts (fun o => o.X = pairLabel n d hd j side)] congr 1 · apply congrArg exp have hsum := pairSideMarkedRate_sum n d q σ z p hd hq hσ hz hp j base side have hrestricted : (∑ o : Obs d, if o.X = pairLabel n d hd j side then (pairSideMarkedRate n d q σ z p hd j base side o : ℝ) else 0) = ∑ o : Obs d, (pairSideMarkedRate n d q σ z p hd j base side o : ℝ) := by apply Finset.sum_congr rfl intro o _ by_cases ho : o.X = pairLabel n d hd j side · simp [ho] · rw [pairSideMarkedRate_coe n d q σ z p hd hq hσ hz hp j base side o] simp [ho] rw [hrestricted, hsum] ring · apply Finset.prod_congr rfl intro o _ by_cases ho : o.X = pairLabel n d hd j side · simp only [ho, beq_self_eq_true, ↓reduceIte] rw [pairSideMarkedRate_coe n d q σ z p hd hq hσ hz hp j base side o, if_pos ho, pairMarkedIntensity_at_label n d q σ z p hd j base side o ho] · simp [ho]
theorem pairMarkedPoissonFactor_eq

Multiplying the two normalized side factors yields the normalized marked pair likelihood with total exponential rate 8 * n * p. Given the specified input n, the specified input d, the specified input q, the specified input z, the specified input p, the specified input hd, the specified input hz, the specified input hp, the specified input base, the specified input counts, the stated mathematical conclusion holds. Given the specified input σ, the specified input hσ. Given the specified input hq, the specified input j.

Formal statement
n d :
ℕ
q σ z p :
ℝ
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
hσ :
σ = -1 ∨ σ = 1
hz :
z = -1 ∨ z = 1
hp :
0 ≤ p
j :
base :
counts :
Obs d → ℕ
(∏ side : Bool, ∏ o : Obs d, if o.X = pairLabel n d hd j side then exp (-(pairSideMarkedRate n d q σ z p hd j base side o : ℝ)) * (pairSideMarkedRate n d q σ z p hd j base side o : ℝ) ^ counts o / (counts o).factorial else 1)
= exp (-8 * (n : ℝ) * p) * pairMarkedLocalFactor n d q σ z p hd j base counts
Proof (Lean source)
lemma pairMarkedPoissonFactor_eq (n d : ℕ) (q σ z p : ℝ) (hd : 1 ≤ d) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (hσ : σ = -1 ∨ σ = 1) (hz : z = -1 ∨ z = 1) (hp : 0 ≤ p) (j : Fin (pairCount n d)) (base : Bool) (counts : Obs d → ℕ) : (∏ side : Bool, ∏ o : Obs d, if o.X = pairLabel n d hd j side then exp (-(pairSideMarkedRate n d q σ z p hd j base side o : ℝ)) * (pairSideMarkedRate n d q σ z p hd j base side o : ℝ) ^ counts o / (counts o).factorial else 1) = exp (-8 * (n : ℝ) * p) * pairMarkedLocalFactor n d q σ z p hd j base counts := by simp_rw [pairSidePoissonFactor_eq n d q σ z p hd hq hσ hz hp j base] unfold pairMarkedLocalFactor rw [Finset.prod_mul_distrib, ← Real.exp_sum] congr 2 norm_num ring
def pairMixtureFactor

One pair's latent-and-orientation averaged marked-Poisson likelihood factor. Given the specified input n, the specified input d, the specified input q, the specified input hd, the specified input counts, the stated mathematical conclusion holds. Given the specified input σ. Given the specified input j.

Definition (Lean source)
n d :
ℕ
q σ :
ℝ
hd :
1 ≤ d
j :
counts :
Obs d → ℕ
pairMixtureFactor n d q σ hd j counts :
ℝ
∑ z : Latent n, latentWeight n z * (exp (-8 * (n : ℝ) * latentP n z) * (4 * (n : ℝ) * latentP n z) ^ pairBlockCount n d hd counts j / pairBlockFactorial n d hd j counts * ((1 / 2 : ℝ) * pairBlockMarkAverage n d q σ (latentZ n z) hd j counts))
theorem pairMixtureFactor_nonneg

Every legal one-pair averaged marked-Poisson likelihood factor is nonnegative. Given the specified input n, the specified input d, the specified input q, the specified input hd, the specified input counts, the stated mathematical conclusion holds. Given the specified input σ, the specified input hσ. Given the specified input hq, the specified input j.

Formal statement
n d :
ℕ
q σ :
ℝ
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
hσ :
σ = -1 ∨ σ = 1
j :
counts :
Obs d → ℕ
0 ≤ pairMixtureFactor n d q σ hd j counts
Proof (Lean source)
lemma pairMixtureFactor_nonneg (n d : ℕ) (q σ : ℝ) (hd : 1 ≤ d) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (hσ : σ = -1 ∨ σ = 1) (j : Fin (pairCount n d)) (counts : Obs d → ℕ) : 0 ≤ pairMixtureFactor n d q σ hd j counts := by unfold pairMixtureFactor apply Finset.sum_nonneg intro z _ have hw := latentWeight_nonneg_count n z have hp := latentP_nonneg n z have hz : latentZ n z = -1 ∨ latentZ n z = 1 := by have h := latentZ_abs_one n z rw [abs_eq (by norm_num : (0 : ℝ) ≤ 1)] at h exact h.elim inr inl have hm := (half_pairBlockMarkAverage_mem_unit n d q σ (latentZ n z) hd j counts hq hσ hz).1 have hbase : 0 ≤ 4 * (n : ℝ) * latentP n z := by positivity have hpow : 0 ≤ (4 * (n : ℝ) * latentP n z) ^ pairBlockCount n d hd counts j := pow_nonneg hbase _ have hfac : 0 ≤ pairBlockFactorial n d hd j counts := by unfold pairBlockFactorial pairLabelFactorial positivity exact mul_nonneg hw (mul_nonneg (div_nonneg (mul_nonneg (Real.exp_pos _).le hpow) hfac) hm)
theorem theta_pair_likelihood_factorization

Averaging the product of conditional pair-block likelihoods under thetaLaw gives the product of the one-pair mixture factors. Given the specified input n, the specified input d, the specified input q, the specified input hn, the specified input hd, the specified input counts, the stated mathematical conclusion holds. Given the specified input σ. Given the specified input hq.

Formal statement
n d :
ℕ
q σ :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
counts :
Obs d → ℕ
(∑ θ : Theta n d, (thetaLaw n d q hn hd hq θ).toReal * ∏ j : Fin (pairCount n d), (exp (-8 * (n : ℝ) * latentP n (θ.1 j)) * (4 * (n : ℝ) * latentP n (θ.1 j)) ^ pairBlockCount n d hd counts j / pairBlockFactorial n d hd j counts * ∏ side : Bool, pairObservedMonomial q σ (latentZ n (θ.1 j)) (orientation θ j side) (pairLabel n d hd j side) counts))
= ∏ j : Fin (pairCount n d), pairMixtureFactor n d q σ hd j counts
Proof (Lean source)
lemma theta_pair_likelihood_factorization (n d : ℕ) (q σ : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (counts : Obs d → ℕ) : (∑ θ : Theta n d, (thetaLaw n d q hn hd hq θ).toReal * ∏ j : Fin (pairCount n d), (exp (-8 * (n : ℝ) * latentP n (θ.1 j)) * (4 * (n : ℝ) * latentP n (θ.1 j)) ^ pairBlockCount n d hd counts j / pairBlockFactorial n d hd j counts * ∏ side : Bool, pairObservedMonomial q σ (latentZ n (θ.1 j)) (orientation θ j side) (pairLabel n d hd j side) counts)) = ∏ j : Fin (pairCount n d), pairMixtureFactor n d q σ hd j counts := by simp only [orientation] rw [thetaLaw_product_factorization n d q hn hd hq (fun j z base => exp (-8 * (n : ℝ) * latentP n z) * (4 * (n : ℝ) * latentP n z) ^ pairBlockCount n d hd counts j / pairBlockFactorial n d hd j counts * ∏ side : Bool, pairObservedMonomial q σ (latentZ n z) (if base == side then 1 else -1) (pairLabel n d hd j side) counts)] apply Finset.prod_congr rfl intro j _ unfold pairMixtureFactor pairBlockMarkAverage apply Finset.sum_congr rfl intro z _ let A : ℝ := exp (-8 * (n : ℝ) * latentP n z) * (4 * (n : ℝ) * latentP n z) ^ pairBlockCount n d hd counts j / pairBlockFactorial n d hd j counts let M : Bool → ℝ := fun base => ∏ side : Bool, pairObservedMonomial q σ (latentZ n z) (if base == side then 1 else -1) (pairLabel n d hd j side) counts change latentWeight n z * (∑ base : Bool, (1 / 2 : ℝ) * (A * M base)) = latentWeight n z * (A * ((1 / 2 : ℝ) * ∑ base : Bool, M base)) congr 1 calc _ = ∑ base : Bool, ((1 / 2 : ℝ) * A) * M base := by apply Finset.sum_congr rfl intro base _ ring _ = ((1 / 2 : ℝ) * A) * ∑ base : Bool, M base := by rw [Finset.mul_sum] _ = _ := by ring
CausalSmith.Stat.MarNearcompleteFrontier.theta_pair_likelihood_factorization · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/Factorization.lean:267
def commonCountFactor

The sign-independent filler and forced-zero contribution to a count-vector likelihood. Given the specified input n, the specified input d, the specified input q, the specified input hd, the specified input counts, the stated mathematical conclusion holds.

Definition (Lean source)
n d :
ℕ
q :
ℝ
hd :
1 ≤ d
counts :
Obs d → ℕ
commonCountFactor n d q hd counts :
ℝ
exp (-4 * (n : ℝ) * fillerMass n d) * (∏ o : Obs d, if o.X = fillerLabel d hd then (4 * (n : ℝ) * (fillerMass n d * fillerObservedCoeff q o)) ^ counts o / (counts o).factorial else 1) * ∏ x ∈ (univ \ activeBaselineLabels n d hd), ∏ o : Obs d, if o.X
= x then (if counts o = 0 then 1 else 0) else 1
theorem markedComponent_countVector_tsum_one

Every fixed choice of pair masses, signs, and base orientations gives a normalized full observed count-vector likelihood. Given the specified input n, the specified input d, the specified input q, the specified input hn, the specified input hd, the specified input hp, the specified input hz, the stated mathematical conclusion holds. Given the specified input σ, the specified input hσ. Given the specified input hq, the specified input p, the specified input z, the specified input base.

Formal statement
n d :
ℕ
q σ :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
hσ :
σ = -1 ∨ σ = 1
p :
Fin (pairCount n d) → ℝ
z :
Fin (pairCount n d) → ℝ
base :
Fin (pairCount n d) → Bool
hp :
∀ j, 0 ≤ p j
hz :
∀ j, z j = -1 ∨ z j = 1
(∑' counts : Obs d → ℕ, commonCountFactor n d q hd counts * ∏ j : Fin (pairCount n d), exp (-8 * (n : ℝ) * p j) * pairMarkedLocalFactor n d q σ (z j) (p j) hd j (base j) counts)
= 1
Proof (Lean source)
lemma markedComponent_countVector_tsum_one (n d : ℕ) (q σ : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (hσ : σ = -1 ∨ σ = 1) (p : Fin (pairCount n d) → ℝ) (z : Fin (pairCount n d) → ℝ) (base : Fin (pairCount n d) → Bool) (hp : ∀ j, 0 ≤ p j) (hz : ∀ j, z j = -1 ∨ z j = 1) : (∑' counts : Obs d → ℕ, commonCountFactor n d q hd counts * ∏ j : Fin (pairCount n d), exp (-8 * (n : ℝ) * p j) * pairMarkedLocalFactor n d q σ (z j) (p j) hd j (base j) counts) = 1 := by rw [show (∑' counts : Obs d → ℕ, _) = ∑' counts : Obs d → ℕ, (∏ o : Obs d, if o.X = fillerLabel d hd then exp (-(fillerMarkedRate n d q hd o : ℝ)) * (fillerMarkedRate n d q hd o : ℝ) ^ counts o / (counts o).factorial else 1) * (∏ js : Fin (pairCount n d) × Bool, ∏ o : Obs d, if o.X = pairLabel n d hd js.1 js.2 then exp (-(pairSideMarkedRate n d q σ (z js.1) (p js.1) hd js.1 (base js.1) js.2 o : ℝ)) * (pairSideMarkedRate n d q σ (z js.1) (p js.1) hd js.1 (base js.1) js.2 o : ℝ) ^ counts o / (counts o).factorial else 1) * ∏ x ∈ (univ \ activeBaselineLabels n d hd), ∏ o : Obs d, if o.X = x then (if counts o = 0 then 1 else 0) else 1 by apply tsum_congr intro counts rw [fillerMarkedPoissonFactor_eq n d q hn hd hq counts] simp_rw [Fintype.prod_prod_type, pairMarkedPoissonFactor_eq n d q σ _ _ hd hq hσ (hz _) (hp _)] unfold commonCountFactor ring] exact partitionedLocalPoisson_countVector_tsum_one n d hd (fillerMarkedRate n d q hd) (fun j side => pairSideMarkedRate n d q σ (z j) (p j) hd j (base j) side)
CausalSmith.Stat.MarNearcompleteFrontier.markedComponent_countVector_tsum_one · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/Factorization.lean:328
theorem thetaMarkedComponent_countVector_tsum_one

The fixed latent component used by the paired prior is a normalized full count-vector likelihood. Given the specified input n, the specified input d, the specified input q, the specified input hn, the specified input hd, the stated mathematical conclusion holds. Given the specified input σ, the specified input hσ, the specified input θ. Given the specified input hq.

Formal statement
n d :
ℕ
q σ :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
hσ :
σ = -1 ∨ σ = 1
θ :
Theta n d
(∑' counts : Obs d → ℕ, commonCountFactor n d q hd counts * ∏ j : Fin (pairCount n d), exp (-8 * (n : ℝ) * latentP n (θ.1 j)) * pairMarkedLocalFactor n d q σ (latentZ n (θ.1 j)) (latentP n (θ.1 j)) hd j (θ.2 j) counts)
= 1
Proof (Lean source)
lemma thetaMarkedComponent_countVector_tsum_one (n d : ℕ) (q σ : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (hσ : σ = -1 ∨ σ = 1) (θ : Theta n d) : (∑' counts : Obs d → ℕ, commonCountFactor n d q hd counts * ∏ j : Fin (pairCount n d), exp (-8 * (n : ℝ) * latentP n (θ.1 j)) * pairMarkedLocalFactor n d q σ (latentZ n (θ.1 j)) (latentP n (θ.1 j)) hd j (θ.2 j) counts) = 1 := by apply markedComponent_countVector_tsum_one n d q σ hn hd hq hσ · intro j exact latentP_nonneg n (θ.1 j) · intro j have h := latentZ_abs_one n (θ.1 j) rw [abs_eq (by norm_num : (0 : ℝ) ≤ 1)] at h exact h.elim inr inl
CausalSmith.Stat.MarNearcompleteFrontier.thetaMarkedComponent_countVector_tsum_one · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/Factorization.lean:369
theorem conditional_count_likelihood_block_split

A conditional likelihood splits into a common filler/zero-rate factor and one marked-Poisson factor for each active pair. Given the specified input n, the specified input d, the specified input q, the specified input hd, the specified input counts, the stated mathematical conclusion holds. Given the specified input σ, the specified input θ.

Formal statement
n d :
ℕ
q σ :
ℝ
hd :
1 ≤ d
θ :
Theta n d
counts :
Obs d → ℕ
exp (-4 * (n : ℝ) * normalizationJ n d θ) * (∏ o : Obs d, (4 * (n : ℝ) * countAtomMass n d q σ hd θ o) ^ counts o / (counts o).factorial)
= commonCountFactor n d q hd counts * ∏ j : Fin (pairCount n d), (exp (-8 * (n : ℝ) * latentP n (θ.1 j)) * (4 * (n : ℝ) * latentP n (θ.1 j)) ^ pairBlockCount n d hd counts j / pairBlockFactorial n d hd j counts * ∏ side : Bool, pairObservedMonomial q σ (latentZ n (θ.1 j)) (orientation θ j side) (pairLabel n d hd j side) counts)
Proof (Lean source)
lemma conditional_count_likelihood_block_split (n d : ℕ) (q σ : ℝ) (hd : 1 ≤ d) (θ : Theta n d) (counts : Obs d → ℕ) : exp (-4 * (n : ℝ) * normalizationJ n d θ) * (∏ o : Obs d, (4 * (n : ℝ) * countAtomMass n d q σ hd θ o) ^ counts o / (counts o).factorial) = commonCountFactor n d q hd counts * ∏ j : Fin (pairCount n d), (exp (-8 * (n : ℝ) * latentP n (θ.1 j)) * (4 * (n : ℝ) * latentP n (θ.1 j)) ^ pairBlockCount n d hd counts j / pairBlockFactorial n d hd j counts * ∏ side : Bool, pairObservedMonomial q σ (latentZ n (θ.1 j)) (orientation θ j side) (pairLabel n d hd j side) counts) := by let g : Obs d → ℝ := fun o => (4 * (n : ℝ) * countAtomMass n d q σ hd θ o) ^ counts o / (counts o).factorial have hfiller : (∏ o : Obs d, if o.X = fillerLabel d hd then g o else 1) = ∏ o : Obs d, if o.X = fillerLabel d hd then (4 * (n : ℝ) * (fillerMass n d * fillerObservedCoeff q o)) ^ counts o / (counts o).factorial else 1 := by apply Finset.prod_congr rfl intro o _ by_cases ho : o.X = fillerLabel d hd · simp only [ho, ↓reduceIte, g] rw [countAtomMass_at_filler_label n d q σ hd θ o ho] · simp [ho] have hunused (x : Fin d) (hx : x ∈ (univ \ activeBaselineLabels n d hd)) : (∏ o : Obs d, if o.X = x then g o else 1) = ∏ o : Obs d, if o.X = x then (if counts o = 0 then 1 else 0) else 1 := by apply Finset.prod_congr rfl intro o _ by_cases ho : o.X = x · simp only [ho, ↓reduceIte, g] have hxnot : x ∉ activeBaselineLabels n d hd := (Finset.mem_sdiff.mp hx).2 have hfill : o.X ≠ fillerLabel d hd := by intro h apply hxnot rw [← ho, h] exact Finset.mem_insert_self _ _ have hp (j : Fin (pairCount n d)) (side : Bool) : o.X ≠ pairLabel n d hd j side := by intro h apply hxnot rw [← ho, h] apply Finset.mem_insert_of_mem exact Finset.mem_image.mpr ⟨(j, side), Finset.mem_univ _, rfl⟩ rw [countAtomMass_eq_zero_of_unused n d q σ hd θ o hfill hp, mul_zero, zero_rate_factor_eq_indicator] · simp [ho] have hunusedProd : (∏ x ∈ (univ \ activeBaselineLabels n d hd), ∏ o : Obs d, if o.X = x then g o else 1) = ∏ x ∈ (univ \ activeBaselineLabels n d hd), ∏ o : Obs d, if o.X = x then (if counts o = 0 then 1 else 0) else 1 := by apply Finset.prod_congr rfl intro x hx exact hunused x hx have hexp : exp (-4 * (n : ℝ) * normalizationJ n d θ) = exp (-4 * (n : ℝ) * fillerMass n d) * ∏ j : Fin (pairCount n d), exp (-8 * (n : ℝ) * latentP n (θ.1 j)) := by unfold normalizationJ rw [show -4 * (n : ℝ) * (fillerMass n d + 2 * ∑ j : Fin (pairCount n d), latentP n (θ.1 j)) = -4 * (n : ℝ) * fillerMass n d + ∑ j : Fin (pairCount n d), -8 * (n : ℝ) * latentP n (θ.1 j) by rw [← Finset.mul_sum] ring, Real.exp_add, Real.exp_sum] change exp (-4 * (n : ℝ) * normalizationJ n d θ) * (∏ o : Obs d, g o) = _ rw [obsProd_split_filler_pairs_unused n d hd g, hfiller] rw [hunusedProd] rw [Fintype.prod_prod_type] simp only [g] simp_rw [pair_block_poisson_power_factorization n d q σ hd θ counts] have hreorder (j : Fin (pairCount n d)) : (4 * (n : ℝ) * latentP n (θ.1 j)) ^ pairBlockCount n d hd counts j * (∏ side : Bool, pairObservedMonomial q σ (latentZ n (θ.1 j)) (orientation θ j side) (pairLabel n d hd j side) counts) / pairBlockFactorial n d hd j counts = ((4 * (n : ℝ) * latentP n (θ.1 j)) ^ pairBlockCount n d hd counts j / pairBlockFactorial n d hd j counts) * ∏ side : Bool, pairObservedMonomial q σ (latentZ n (θ.1 j)) (orientation θ j side) (pairLabel n d hd j side) counts := by ring simp_rw [hreorder] rw [Finset.prod_mul_distrib] rw [hexp] unfold commonCountFactor rw [Finset.prod_mul_distrib] have hreorderExp (j : Fin (pairCount n d)) : exp (-8 * (n : ℝ) * latentP n (θ.1 j)) * (4 * (n : ℝ) * latentP n (θ.1 j)) ^ pairBlockCount n d hd counts j / pairBlockFactorial n d hd j counts = exp (-8 * (n : ℝ) * latentP n (θ.1 j)) * ((4 * (n : ℝ) * latentP n (θ.1 j)) ^ pairBlockCount n d hd counts j / pairBlockFactorial n d hd j counts) := by ring simp_rw [hreorderExp] rw [Finset.prod_mul_distrib] ring
CausalSmith.Stat.MarNearcompleteFrontier.conditional_count_likelihood_block_split · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/Factorization.lean:389
CausalSmith.Stat.STAT_MarNearcompleteFrontier_Research.Helpers.LowerBound.CountMixture.MarkedRates 24 declarations MarkedRates for the paired count-mixture comparison

MarkedRates for the paired count-mixture comparison

theorem localLabelPoissonFactor_partitioned_filler

The filler-label local Poisson factor of a partitioned family uses only the supplied filler rate. Given the specified input n, the specified input d, the specified input hd, the specified input fillerRate, the specified input counts, the stated mathematical conclusion holds. Given the specified input pairRate.

Formal statement
n d :
ℕ
hd :
1 ≤ d
fillerRate :
Obs d → ℝ≥0
pairRate :
Fin (pairCount n d) → Bool → Obs d → ℝ≥0
counts :
Obs d → ℕ
localLabelPoissonFactor (partitionedLocalRate n d hd fillerRate pairRate) (fillerLabel d hd) counts
= ∏ o : Obs d, if o.X = fillerLabel d hd then exp (-(fillerRate o : ℝ)) * (fillerRate o : ℝ) ^ counts o / (counts o).factorial else 1
Proof (Lean source)
lemma localLabelPoissonFactor_partitioned_filler (n d : ℕ) (hd : 1 ≤ d) (fillerRate : Obs d → ℝ≥0) (pairRate : Fin (pairCount n d) → Bool → Obs d → ℝ≥0) (counts : Obs d → ℕ) : localLabelPoissonFactor (partitionedLocalRate n d hd fillerRate pairRate) (fillerLabel d hd) counts = ∏ o : Obs d, if o.X = fillerLabel d hd then exp (-(fillerRate o : ℝ)) * (fillerRate o : ℝ) ^ counts o / (counts o).factorial else 1 := by unfold localLabelPoissonFactor apply Finset.prod_congr rfl intro o _ by_cases ho : o.X = fillerLabel d hd · simp only [ho, ↓reduceIte, partitionedLocalRate_filler n d hd fillerRate pairRate o] · simp [ho]
CausalSmith.Stat.MarNearcompleteFrontier.localLabelPoissonFactor_partitioned_filler · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/MarkedRates.lean:15
theorem localLabelPoissonFactor_partitioned_pair

Each active pair-label local Poisson factor of a partitioned family uses only its supplied pair-side rate. Given the specified input n, the specified input d, the specified input hd, the specified input fillerRate, the specified input side, the specified input counts, the stated mathematical conclusion holds. Given the specified input pairRate, the specified input j.

Formal statement
n d :
ℕ
hd :
1 ≤ d
fillerRate :
Obs d → ℝ≥0
pairRate :
Fin (pairCount n d) → Bool → Obs d → ℝ≥0
j :
side :
counts :
Obs d → ℕ
localLabelPoissonFactor (partitionedLocalRate n d hd fillerRate pairRate) (pairLabel n d hd j side) counts
= ∏ o : Obs d, if o.X = pairLabel n d hd j side then exp (-(pairRate j side o : ℝ)) * (pairRate j side o : ℝ) ^ counts o / (counts o).factorial else 1
Proof (Lean source)
lemma localLabelPoissonFactor_partitioned_pair (n d : ℕ) (hd : 1 ≤ d) (fillerRate : Obs d → ℝ≥0) (pairRate : Fin (pairCount n d) → Bool → Obs d → ℝ≥0) (j : Fin (pairCount n d)) (side : Bool) (counts : Obs d → ℕ) : localLabelPoissonFactor (partitionedLocalRate n d hd fillerRate pairRate) (pairLabel n d hd j side) counts = ∏ o : Obs d, if o.X = pairLabel n d hd j side then exp (-(pairRate j side o : ℝ)) * (pairRate j side o : ℝ) ^ counts o / (counts o).factorial else 1 := by unfold localLabelPoissonFactor apply Finset.prod_congr rfl intro o _ by_cases ho : o.X = pairLabel n d hd j side · simp only [ho, ↓reduceIte, partitionedLocalRate_pair n d hd fillerRate pairRate j side o] · simp [ho]
CausalSmith.Stat.MarNearcompleteFrontier.localLabelPoissonFactor_partitioned_pair · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/MarkedRates.lean:35
theorem localLabelPoissonFactor_partitioned_unused

At an unused label, the local Poisson factor is exactly the indicator that all counts at that label vanish. Given the specified input n, the specified input d, the specified input hd, the specified input fillerRate, the specified input x, the specified input hx, the specified input counts, the stated mathematical conclusion holds. Given the specified input pairRate.

Formal statement
n d :
ℕ
hd :
1 ≤ d
fillerRate :
Obs d → ℝ≥0
pairRate :
Fin (pairCount n d) → Bool → Obs d → ℝ≥0
x :
Fin d
hx :
x ∈ univ \ activeBaselineLabels n d hd
counts :
Obs d → ℕ
localLabelPoissonFactor (partitionedLocalRate n d hd fillerRate pairRate) x counts
= ∏ o : Obs d, if o.X = x then (if counts o = 0 then 1 else 0) else 1
Proof (Lean source)
lemma localLabelPoissonFactor_partitioned_unused (n d : ℕ) (hd : 1 ≤ d) (fillerRate : Obs d → ℝ≥0) (pairRate : Fin (pairCount n d) → Bool → Obs d → ℝ≥0) (x : Fin d) (hx : x ∈ univ \ activeBaselineLabels n d hd) (counts : Obs d → ℕ) : localLabelPoissonFactor (partitionedLocalRate n d hd fillerRate pairRate) x counts = ∏ o : Obs d, if o.X = x then (if counts o = 0 then 1 else 0) else 1 := by unfold localLabelPoissonFactor apply Finset.prod_congr rfl intro o _ by_cases ho : o.X = x · rw [if_pos ho, partitionedLocalRate_unused n d hd fillerRate pairRate x hx o] by_cases hc : counts o = 0 <;> simp [ho, hc] · simp [ho]
CausalSmith.Stat.MarNearcompleteFrontier.localLabelPoissonFactor_partitioned_unused · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/MarkedRates.lean:56
theorem partitionedLocalPoisson_countVector_tsum_one

Filler, pair-side, and unused-zero local factors jointly normalize over the full observed count-vector space. Given the specified input n, the specified input d, the specified input hd, the specified input fillerRate, the stated mathematical conclusion holds. Given the specified input pairRate.

Formal statement
n d :
ℕ
hd :
1 ≤ d
fillerRate :
Obs d → ℝ≥0
pairRate :
Fin (pairCount n d) → Bool → Obs d → ℝ≥0
(∑' counts : Obs d → ℕ, (∏ o : Obs d, if o.X = fillerLabel d hd then exp (-(fillerRate o : ℝ)) * (fillerRate o : ℝ) ^ counts o / (counts o).factorial else 1) * (∏ js : Fin (pairCount n d) × Bool, ∏ o : Obs d, if o.X = pairLabel n d hd js.1 js.2 then exp (-(pairRate js.1 js.2 o : ℝ)) * (pairRate js.1 js.2 o : ℝ) ^ counts o / (counts o).factorial else 1) * ∏ x ∈ (univ \ activeBaselineLabels n d hd), ∏ o : Obs d, if o.X = x then (if counts o = 0 then 1 else 0) else 1)
= 1
Proof (Lean source)
lemma partitionedLocalPoisson_countVector_tsum_one (n d : ℕ) (hd : 1 ≤ d) (fillerRate : Obs d → ℝ≥0) (pairRate : Fin (pairCount n d) → Bool → Obs d → ℝ≥0) : (∑' counts : Obs d → ℕ, (∏ o : Obs d, if o.X = fillerLabel d hd then exp (-(fillerRate o : ℝ)) * (fillerRate o : ℝ) ^ counts o / (counts o).factorial else 1) * (∏ js : Fin (pairCount n d) × Bool, ∏ o : Obs d, if o.X = pairLabel n d hd js.1 js.2 then exp (-(pairRate js.1 js.2 o : ℝ)) * (pairRate js.1 js.2 o : ℝ) ^ counts o / (counts o).factorial else 1) * ∏ x ∈ (univ \ activeBaselineLabels n d hd), ∏ o : Obs d, if o.X = x then (if counts o = 0 then 1 else 0) else 1) = 1 := by rw [show (∑' counts : Obs d → ℕ, _) = ∑' counts : Obs d → ℕ, ∏ x : Fin d, localLabelPoissonFactor (partitionedLocalRate n d hd fillerRate pairRate) x counts by apply tsum_congr intro counts rw [prod_split_active_unused_labels n d hd] rw [localLabelPoissonFactor_partitioned_filler] simp_rw [localLabelPoissonFactor_partitioned_pair] apply congrArg₂ (· * ·) rfl apply Finset.prod_congr rfl intro x hx exact (localLabelPoissonFactor_partitioned_unused n d hd fillerRate pairRate x hx counts).symm] exact localLabelPoissonFactor_countVector_tsum_one (partitionedLocalRate n d hd fillerRate pairRate)
CausalSmith.Stat.MarNearcompleteFrontier.partitionedLocalPoisson_countVector_tsum_one · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/MarkedRates.lean:76
theorem zero_rate_factor_eq_indicator Lemma zero_rate_factor_eq_indicator in the paper ↗

A zero-rate Poisson factorial factor forces its count coordinate to zero. Given the specified input k, the stated mathematical conclusion holds.

Formal statement
k :
ℕ
(0 : ℝ) ^ k / (k.factorial : ℝ) = if k = 0 then 1 else 0
Proof (Lean source)
lemma zero_rate_factor_eq_indicator (k : ℕ) : (0 : ℝ) ^ k / (k.factorial : ℝ) = if k = 0 then 1 else 0 := by by_cases hk : k = 0 · simp [hk] · simp [hk]
CausalSmith.Stat.MarNearcompleteFrontier.zero_rate_factor_eq_indicator · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/MarkedRates.lean:111
theorem obsProd_split_filler_pairs_unused

Any product over observed atoms splits exactly into the filler block, one block for every pair and side, and blocks over unused baseline labels. Given the specified input n, the specified input d, the specified input hd, the specified input g, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
hd :
1 ≤ d
g :
Obs d → ℝ
(∏ o : Obs d, g o)
= (∏ o : Obs d, if o.X = fillerLabel d hd then g o else 1) * (∏ js : Fin (pairCount n d) × Bool, ∏ o : Obs d, if o.X = pairLabel n d hd js.1 js.2 then g o else 1) * ∏ x ∈ (univ \ activeBaselineLabels n d hd), ∏ o : Obs d, if o.X = x then g o else 1
Proof (Lean source)
lemma obsProd_split_filler_pairs_unused (n d : ℕ) (hd : 1 ≤ d) (g : Obs d → ℝ) : (∏ o : Obs d, g o) = (∏ o : Obs d, if o.X = fillerLabel d hd then g o else 1) * (∏ js : Fin (pairCount n d) × Bool, ∏ o : Obs d, if o.X = pairLabel n d hd js.1 js.2 then g o else 1) * ∏ x ∈ (univ \ activeBaselineLabels n d hd), ∏ o : Obs d, if o.X = x then g o else 1 := by rw [prod_by_observed_label] exact prod_split_active_unused_labels n d hd (fun x => ∏ o : Obs d, if o.X = x then g o else 1)
CausalSmith.Stat.MarNearcompleteFrontier.obsProd_split_filler_pairs_unused · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/MarkedRates.lean:119
def pairMarkedIntensity

Marked count intensity for one pair at a fixed base orientation. Given the specified input n, the specified input d, the specified input q, the specified input z, the specified input p, the specified input hd, the specified input base, the specified input o, the stated mathematical conclusion holds. Given the specified input σ. Given the specified input j.

Definition (Lean source)
n d :
ℕ
q σ z p :
ℝ
hd :
1 ≤ d
j :
base :
o :
Obs d
pairMarkedIntensity n d q σ z p hd j base o :
ℝ
∑ side : Bool, if o.X
= pairLabel n d hd j side then 4 * (n : ℝ) * p * pairObservedCoeff q σ z (if base == side then 1 else -1) o else 0
theorem pairMarkedIntensity_nonneg

Legal pair marked intensities are nonnegative. Given the specified input n, the specified input d, the specified input q, the specified input z, the specified input p, the specified input hd, the specified input hz, the specified input hp, the specified input base, the specified input o, the stated mathematical conclusion holds. Given the specified input σ, the specified input hσ. Given the specified input hq, the specified input j.

Formal statement
n d :
ℕ
q σ z p :
ℝ
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
hσ :
σ = -1 ∨ σ = 1
hz :
z = -1 ∨ z = 1
hp :
0 ≤ p
j :
base :
o :
Obs d
0 ≤ pairMarkedIntensity n d q σ z p hd j base o
Proof (Lean source)
lemma pairMarkedIntensity_nonneg (n d : ℕ) (q σ z p : ℝ) (hd : 1 ≤ d) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (hσ : σ = -1 ∨ σ = 1) (hz : z = -1 ∨ z = 1) (hp : 0 ≤ p) (j : Fin (pairCount n d)) (base : Bool) (o : Obs d) : 0 ≤ pairMarkedIntensity n d q σ z p hd j base o := by unfold pairMarkedIntensity apply Finset.sum_nonneg intro side _ by_cases ho : o.X = pairLabel n d hd j side · rw [if_pos ho] have hu : (if base == side then (1 : ℝ) else -1) = -1 ∨ (if base == side then (1 : ℝ) else -1) = 1 := by by_cases h : base == side <;> simp [h] have hscale : 0 ≤ 4 * (n : ℝ) * p := mul_nonneg (mul_nonneg (by norm_num) (Nat.cast_nonneg n)) hp exact mul_nonneg hscale (pairObservedCoeff_nonneg q σ z (if base == side then 1 else -1) o hq hσ hz hu) · rw [if_neg ho]
theorem pairMarkedIntensity_at_label

At one of the pair's two labels, the marked intensity is its scalar mass times the corresponding observed-mark coefficient. Given the specified input n, the specified input d, the specified input q, the specified input z, the specified input p, the specified input hd, the specified input base, the specified input side, the specified input o, the specified input ho, the stated mathematical conclusion holds. Given the specified input σ. Given the specified input j.

Formal statement
n d :
ℕ
q σ z p :
ℝ
hd :
1 ≤ d
j :
base side :
o :
Obs d
ho :
o.X = pairLabel n d hd j side
pairMarkedIntensity n d q σ z p hd j base o
= 4 * (n : ℝ) * p * pairObservedCoeff q σ z (if base == side then 1 else -1) o
Proof (Lean source)
lemma pairMarkedIntensity_at_label (n d : ℕ) (q σ z p : ℝ) (hd : 1 ≤ d) (j : Fin (pairCount n d)) (base side : Bool) (o : Obs d) (ho : o.X = pairLabel n d hd j side) : pairMarkedIntensity n d q σ z p hd j base o = 4 * (n : ℝ) * p * pairObservedCoeff q σ z (if base == side then 1 else -1) o := by unfold pairMarkedIntensity rw [Finset.sum_eq_single side] · rw [if_pos ho] · intro side' _ hne rw [if_neg] intro hlabel exact hne (pairLabel_injective n d hd j j side' side (hlabel.symm.trans ho)).2 · simp
CausalSmith.Stat.MarNearcompleteFrontier.pairMarkedIntensity_at_label · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/MarkedRates.lean:166
theorem pairMarkedIntensity_sum

The marked intensities of one pair have total rate 8 * n * p. Given the specified input n, the specified input d, the specified input q, the specified input z, the specified input p, the specified input hd, the specified input base, the stated mathematical conclusion holds. Given the specified input σ. Given the specified input j.

Formal statement
n d :
ℕ
q σ z p :
ℝ
hd :
1 ≤ d
j :
base :
(∑ o : Obs d, pairMarkedIntensity n d q σ z p hd j base o) = 8 * (n : ℝ) * p
Proof (Lean source)
lemma pairMarkedIntensity_sum (n d : ℕ) (q σ z p : ℝ) (hd : 1 ≤ d) (j : Fin (pairCount n d)) (base : Bool) : (∑ o : Obs d, pairMarkedIntensity n d q σ z p hd j base o) = 8 * (n : ℝ) * p := by unfold pairMarkedIntensity rw [Finset.sum_comm] have hside (side : Bool) : (∑ o : Obs d, if o.X = pairLabel n d hd j side then 4 * (n : ℝ) * p * pairObservedCoeff q σ z (if base == side then 1 else -1) o else 0) = 4 * (n : ℝ) * p := by calc _ = 4 * (n : ℝ) * p * (∑ o : Obs d, if o.X = pairLabel n d hd j side then pairObservedCoeff q σ z (if base == side then 1 else -1) o else 0) := by rw [Finset.mul_sum] apply Finset.sum_congr rfl intro o _ split_ifs <;> ring _ = _ := by rw [sum_pairObservedCoeff_at_label] ring simp_rw [hside] norm_num ring
def pairMarkedRate

Nonnegative-real packaging of one pair's marked intensity. Given the specified input n, the specified input d, the specified input q, the specified input z, the specified input p, the specified input hd, the specified input base, the specified input o, the stated mathematical conclusion holds. Given the specified input σ. Given the specified input j.

Definition (Lean source)
n d :
ℕ
q σ z p :
ℝ
hd :
1 ≤ d
j :
base :
o :
Obs d
pairMarkedRate n d q σ z p hd j base o :
ℝ≥0
toNNReal (pairMarkedIntensity n d q σ z p hd j base o)
theorem pairMarkedRate_coe

Under the legal parameter restrictions, coercing pairMarkedRate back to the reals recovers the marked intensity. Given the specified input n, the specified input d, the specified input q, the specified input z, the specified input p, the specified input hd, the specified input hz, the specified input hp, the specified input base, the specified input o, the stated mathematical conclusion holds. Given the specified input σ, the specified input hσ. Given the specified input hq, the specified input j.

Formal statement
n d :
ℕ
q σ z p :
ℝ
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
hσ :
σ = -1 ∨ σ = 1
hz :
z = -1 ∨ z = 1
hp :
0 ≤ p
j :
base :
o :
Obs d
(pairMarkedRate n d q σ z p hd j base o : ℝ) = pairMarkedIntensity n d q σ z p hd j base o
Proof (Lean source)
lemma pairMarkedRate_coe (n d : ℕ) (q σ z p : ℝ) (hd : 1 ≤ d) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (hσ : σ = -1 ∨ σ = 1) (hz : z = -1 ∨ z = 1) (hp : 0 ≤ p) (j : Fin (pairCount n d)) (base : Bool) (o : Obs d) : (pairMarkedRate n d q σ z p hd j base o : ℝ) = pairMarkedIntensity n d q σ z p hd j base o := by exact Real.coe_toNNReal _ (pairMarkedIntensity_nonneg n d q σ z p hd hq hσ hz hp j base o)
theorem pairMarkedRate_sum

The packaged pair marked rate also has total mass 8 * n * p. Given the specified input n, the specified input d, the specified input q, the specified input z, the specified input p, the specified input hd, the specified input hz, the specified input hp, the specified input base, the stated mathematical conclusion holds. Given the specified input σ, the specified input hσ. Given the specified input hq, the specified input j.

Formal statement
n d :
ℕ
q σ z p :
ℝ
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
hσ :
σ = -1 ∨ σ = 1
hz :
z = -1 ∨ z = 1
hp :
0 ≤ p
j :
base :
(∑ o : Obs d, (pairMarkedRate n d q σ z p hd j base o : ℝ)) = 8 * (n : ℝ) * p
Proof (Lean source)
lemma pairMarkedRate_sum (n d : ℕ) (q σ z p : ℝ) (hd : 1 ≤ d) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (hσ : σ = -1 ∨ σ = 1) (hz : z = -1 ∨ z = 1) (hp : 0 ≤ p) (j : Fin (pairCount n d)) (base : Bool) : (∑ o : Obs d, (pairMarkedRate n d q σ z p hd j base o : ℝ)) = 8 * (n : ℝ) * p := by simp_rw [pairMarkedRate_coe n d q σ z p hd hq hσ hz hp j base] exact pairMarkedIntensity_sum n d q σ z p hd j base
theorem pairMarkedRate_factorial_tsum

The raw factorial count series for one oriented marked pair sums to the exponential of its total rate. Given the specified input n, the specified input d, the specified input q, the specified input z, the specified input p, the specified input hd, the specified input hz, the specified input hp, the specified input base, the stated mathematical conclusion holds. Given the specified input σ, the specified input hσ. Given the specified input hq, the specified input j.

Formal statement
n d :
ℕ
q σ z p :
ℝ
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
hσ :
σ = -1 ∨ σ = 1
hz :
z = -1 ∨ z = 1
hp :
0 ≤ p
j :
base :
(∑' counts : Obs d → ℕ, ∏ o : Obs d, (pairMarkedRate n d q σ z p hd j base o : ℝ) ^ counts o / (counts o).factorial)
= exp (8 * (n : ℝ) * p)
Proof (Lean source)
lemma pairMarkedRate_factorial_tsum (n d : ℕ) (q σ z p : ℝ) (hd : 1 ≤ d) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (hσ : σ = -1 ∨ σ = 1) (hz : z = -1 ∨ z = 1) (hp : 0 ≤ p) (j : Fin (pairCount n d)) (base : Bool) : (∑' counts : Obs d → ℕ, ∏ o : Obs d, (pairMarkedRate n d q σ z p hd j base o : ℝ) ^ counts o / (counts o).factorial) = exp (8 * (n : ℝ) * p) := by rw [factorial_countVector_tsum_eq_exp_sum, pairMarkedRate_sum n d q σ z p hd hq hσ hz hp j base]
CausalSmith.Stat.MarNearcompleteFrontier.pairMarkedRate_factorial_tsum · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/MarkedRates.lean:243
def pairSideMarkedRate

Nonnegative marked rate carried by one side label of a pair. Given the specified input n, the specified input d, the specified input q, the specified input z, the specified input p, the specified input hd, the specified input base, the specified input side, the specified input o, the stated mathematical conclusion holds. Given the specified input σ. Given the specified input j.

Definition (Lean source)
n d :
ℕ
q σ z p :
ℝ
hd :
1 ≤ d
j :
base side :
o :
Obs d
pairSideMarkedRate n d q σ z p hd j base side o :
ℝ≥0
toNNReal (if o.X = pairLabel n d hd j side then 4 * (n : ℝ) * p * pairObservedCoeff q σ z (if base == side then 1 else -1) o else 0)
theorem pairSideMarkedRate_coe

A legal pair-side marked rate coerces to its explicit real intensity. Given the specified input n, the specified input d, the specified input q, the specified input z, the specified input p, the specified input hd, the specified input hz, the specified input hp, the specified input base, the specified input side, the specified input o, the stated mathematical conclusion holds. Given the specified input σ, the specified input hσ. Given the specified input hq, the specified input j.

Formal statement
n d :
ℕ
q σ z p :
ℝ
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
hσ :
σ = -1 ∨ σ = 1
hz :
z = -1 ∨ z = 1
hp :
0 ≤ p
j :
base side :
o :
Obs d
(pairSideMarkedRate n d q σ z p hd j base side o : ℝ)
= if o.X = pairLabel n d hd j side then 4 * (n : ℝ) * p * pairObservedCoeff q σ z (if base == side then 1 else -1) o else 0
Proof (Lean source)
lemma pairSideMarkedRate_coe (n d : ℕ) (q σ z p : ℝ) (hd : 1 ≤ d) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (hσ : σ = -1 ∨ σ = 1) (hz : z = -1 ∨ z = 1) (hp : 0 ≤ p) (j : Fin (pairCount n d)) (base side : Bool) (o : Obs d) : (pairSideMarkedRate n d q σ z p hd j base side o : ℝ) = if o.X = pairLabel n d hd j side then 4 * (n : ℝ) * p * pairObservedCoeff q σ z (if base == side then 1 else -1) o else 0 := by apply Real.coe_toNNReal by_cases ho : o.X = pairLabel n d hd j side · rw [if_pos ho] have hu : (if base == side then (1 : ℝ) else -1) = -1 ∨ (if base == side then (1 : ℝ) else -1) = 1 := by by_cases h : base == side <;> simp [h] exact mul_nonneg (mul_nonneg (mul_nonneg (by norm_num) (Nat.cast_nonneg n)) hp) (pairObservedCoeff_nonneg q σ z (if base == side then 1 else -1) o hq hσ hz hu) · rw [if_neg ho]
theorem pairSideMarkedRate_sum

One pair-side marked rate has total mass 4 * n * p. Given the specified input n, the specified input d, the specified input q, the specified input z, the specified input p, the specified input hd, the specified input hz, the specified input hp, the specified input base, the specified input side, the stated mathematical conclusion holds. Given the specified input σ, the specified input hσ. Given the specified input hq, the specified input j.

Formal statement
n d :
ℕ
q σ z p :
ℝ
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
hσ :
σ = -1 ∨ σ = 1
hz :
z = -1 ∨ z = 1
hp :
0 ≤ p
j :
base side :
(∑ o : Obs d, (pairSideMarkedRate n d q σ z p hd j base side o : ℝ)) = 4 * (n : ℝ) * p
Proof (Lean source)
lemma pairSideMarkedRate_sum (n d : ℕ) (q σ z p : ℝ) (hd : 1 ≤ d) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (hσ : σ = -1 ∨ σ = 1) (hz : z = -1 ∨ z = 1) (hp : 0 ≤ p) (j : Fin (pairCount n d)) (base side : Bool) : (∑ o : Obs d, (pairSideMarkedRate n d q σ z p hd j base side o : ℝ)) = 4 * (n : ℝ) * p := by simp_rw [pairSideMarkedRate_coe n d q σ z p hd hq hσ hz hp j base side] calc _ = 4 * (n : ℝ) * p * (∑ o : Obs d, if o.X = pairLabel n d hd j side then pairObservedCoeff q σ z (if base == side then 1 else -1) o else 0) := by rw [Finset.mul_sum] apply Finset.sum_congr rfl intro o _ split_ifs <;> ring _ = _ := by rw [sum_pairObservedCoeff_at_label]; ring
theorem poissonFactor_extract_exponential

A finite Poisson product separates into its common exponential and raw power/factorial factors, even when restricted to a decidable subset. Given the specified input rate, the specified input counts, the specified input keep, the stated mathematical conclusion holds. Given the specified input α.

Formal statement
α :
Type*
rate :
α → ℝ
counts :
α → ℕ
keep :
α → Prop
(∏ a : α, if keep a then exp (-rate a) * rate a ^ counts a / (counts a).factorial else 1)
= exp (-(∑ a : α, if keep a then rate a else 0)) * ∏ a : α, if keep a then rate a ^ counts a / (counts a).factorial else 1
Proof (Lean source)
lemma poissonFactor_extract_exponential {α : Type*} [Fintype α] (rate : α → ℝ) (counts : α → ℕ) (keep : α → Prop) [DecidablePred keep] : (∏ a : α, if keep a then exp (-rate a) * rate a ^ counts a / (counts a).factorial else 1) = exp (-(∑ a : α, if keep a then rate a else 0)) * ∏ a : α, if keep a then rate a ^ counts a / (counts a).factorial else 1 := by rw [show (∏ a : α, if keep a then exp (-rate a) * rate a ^ counts a / (counts a).factorial else 1) = (∏ a : α, exp (-(if keep a then rate a else 0))) * ∏ a : α, if keep a then rate a ^ counts a / (counts a).factorial else 1 by rw [← Finset.prod_mul_distrib] apply Finset.prod_congr rfl intro a _ by_cases h : keep a <;> simp [h] ring] rw [← Real.exp_sum] congr 2 rw [← Finset.sum_neg_distrib]
CausalSmith.Stat.MarNearcompleteFrontier.poissonFactor_extract_exponential · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/MarkedRates.lean:307

The filler mass is nonnegative at every positive sample size. Given the specified input n, the specified input d, the specified input hn, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
hn :
1 ≤ n
0 ≤ fillerMass n d
Proof (Lean source)
lemma fillerMass_nonneg (n d : ℕ) (hn : 1 ≤ n) : 0 ≤ fillerMass n d := by have hnpos : (0 : ℝ) < n := by exact_mod_cast hn have hL := ell_pos_for_normalization n have hK := priorK_lower_for_normalization n have hKpos : (0 : ℝ) < priorK n := by linarith have hM : (pairCount n d : ℝ) ≤ (n : ℝ) * ell n := by have hm : pairCount n d ≤ floor ((n : ℝ) * ell n) := by unfold pairCount exact min_le_right _ _ have hf : ((floor ((n : ℝ) * ell n) : ℕ) : ℝ) ≤ (n : ℝ) * ell n := Nat.floor_le (le_of_lt (mul_pos hnpos hL)) exact (Nat.cast_le.mpr hm).trans hf have hbound : 8 * (pairCount n d : ℝ) ≤ (n : ℝ) * priorK n := by nlinarith [mul_nonneg (le_of_lt hnpos) (sub_nonneg.mpr hK)] have hsmall : (pairCount n d : ℝ) / (512 * n * priorK n) < 1 := by apply (div_lt_iff₀ (by positivity)).mpr nlinarith have hrewrite : 2 * (pairCount n d : ℝ) * priorH n * priorB n = (pairCount n d : ℝ) / (512 * n * priorK n) := by unfold priorH priorB field_simp <;> ring unfold fillerMass rw [hrewrite] linarith
theorem fillerObservedCoeff_nonneg

Every legal filler observed-mark coefficient is nonnegative. Given the specified input q, the specified input o, the stated mathematical conclusion holds. Given the specified input hq.

Formal statement
d :
ℕ
shared
q :
ℝ
o :
Obs d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
Proof (Lean source)
lemma fillerObservedCoeff_nonneg (q : ℝ) (o : Obs d) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) : 0 ≤ fillerObservedCoeff q o := by have hb := baseMean_mem_unit q hq rcases hb with ⟨hb0, hb1⟩ unfold fillerObservedCoeff split_ifs <;> nlinarith
def fillerMarkedRate

Nonnegative-real packaging of the filler-label marked rate. Given the specified input n, the specified input d, the specified input q, the specified input hd, the specified input o, the stated mathematical conclusion holds.

Definition (Lean source)
n d :
ℕ
q :
ℝ
hd :
1 ≤ d
o :
Obs d
fillerMarkedRate n d q hd o :
ℝ≥0
toNNReal (if o.X = fillerLabel d hd then 4 * (n : ℝ) * (fillerMass n d * fillerObservedCoeff q o) else 0)
theorem fillerMarkedRate_coe

A legal filler marked rate coerces to its explicit real intensity. Given the specified input n, the specified input d, the specified input q, the specified input hn, the specified input hd, the specified input o, the stated mathematical conclusion holds. Given the specified input hq.

Formal statement
n d :
ℕ
q :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
o :
Obs d
(fillerMarkedRate n d q hd o : ℝ)
= if o.X = fillerLabel d hd then 4 * (n : ℝ) * (fillerMass n d * fillerObservedCoeff q o) else 0
Proof (Lean source)
lemma fillerMarkedRate_coe (n d : ℕ) (q : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (o : Obs d) : (fillerMarkedRate n d q hd o : ℝ) = if o.X = fillerLabel d hd then 4 * (n : ℝ) * (fillerMass n d * fillerObservedCoeff q o) else 0 := by apply Real.coe_toNNReal by_cases ho : o.X = fillerLabel d hd · rw [if_pos ho] exact mul_nonneg (mul_nonneg (by norm_num) (Nat.cast_nonneg n)) (mul_nonneg (fillerMass_nonneg n d hn) (fillerObservedCoeff_nonneg q o hq)) · rw [if_neg ho]
theorem fillerMarkedRate_sum

Filler marked rates have total mass 4 * n * fillerMass. Given the specified input n, the specified input d, the specified input q, the specified input hn, the specified input hd, the stated mathematical conclusion holds. Given the specified input hq.

Formal statement
n d :
ℕ
q :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
(∑ o : Obs d, (fillerMarkedRate n d q hd o : ℝ)) = 4 * (n : ℝ) * fillerMass n d
Proof (Lean source)
lemma fillerMarkedRate_sum (n d : ℕ) (q : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) : (∑ o : Obs d, (fillerMarkedRate n d q hd o : ℝ)) = 4 * (n : ℝ) * fillerMass n d := by simp_rw [fillerMarkedRate_coe n d q hn hd hq] calc _ = 4 * (n : ℝ) * fillerMass n d * (∑ o : Obs d, if o.X = fillerLabel d hd then fillerObservedCoeff q o else 0) := by rw [Finset.mul_sum] apply Finset.sum_congr rfl intro o _ split_ifs <;> ring _ = _ := by rw [sum_fillerObservedCoeff_at_label]; ring
theorem fillerMarkedPoissonFactor_eq

The normalized local filler Poisson factor equals its raw likelihood times the exponential of the negative filler rate. Given the specified input n, the specified input d, the specified input q, the specified input hn, the specified input hd, the specified input counts, the stated mathematical conclusion holds. Given the specified input hq.

Formal statement
n d :
ℕ
q :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
counts :
Obs d → ℕ
(∏ o : Obs d, if o.X = fillerLabel d hd then exp (-(fillerMarkedRate n d q hd o : ℝ)) * (fillerMarkedRate n d q hd o : ℝ) ^ counts o / (counts o).factorial else 1)
= exp (-4 * (n : ℝ) * fillerMass n d) * ∏ o : Obs d, if o.X = fillerLabel d hd then (4 * (n : ℝ) * (fillerMass n d * fillerObservedCoeff q o)) ^ counts o / (counts o).factorial else 1
Proof (Lean source)
lemma fillerMarkedPoissonFactor_eq (n d : ℕ) (q : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (counts : Obs d → ℕ) : (∏ o : Obs d, if o.X = fillerLabel d hd then exp (-(fillerMarkedRate n d q hd o : ℝ)) * (fillerMarkedRate n d q hd o : ℝ) ^ counts o / (counts o).factorial else 1) = exp (-4 * (n : ℝ) * fillerMass n d) * ∏ o : Obs d, if o.X = fillerLabel d hd then (4 * (n : ℝ) * (fillerMass n d * fillerObservedCoeff q o)) ^ counts o / (counts o).factorial else 1 := by rw [poissonFactor_extract_exponential (fun o => (fillerMarkedRate n d q hd o : ℝ)) counts (fun o => o.X = fillerLabel d hd)] congr 1 · apply congrArg exp have hsum := fillerMarkedRate_sum n d q hn hd hq have hrestricted : (∑ o : Obs d, if o.X = fillerLabel d hd then (fillerMarkedRate n d q hd o : ℝ) else 0) = ∑ o : Obs d, (fillerMarkedRate n d q hd o : ℝ) := by apply Finset.sum_congr rfl intro o _ by_cases ho : o.X = fillerLabel d hd · simp [ho] · rw [fillerMarkedRate_coe n d q hn hd hq o] simp [ho] rw [hrestricted, hsum] ring · apply Finset.prod_congr rfl intro o _ by_cases ho : o.X = fillerLabel d hd · simp only [ho, ↓reduceIte] rw [fillerMarkedRate_coe n d q hn hd hq o, if_pos ho] · simp [ho]
CausalSmith.Stat.MarNearcompleteFrontier.fillerMarkedPoissonFactor_eq · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/MarkedRates.lean:410
CausalSmith.Stat.STAT_MarNearcompleteFrontier_Research.Helpers.LowerBound.CountMixture.PairMarks 22 declarations PairMarks for the paired count-mixture comparison

PairMarks for the paired count-mixture comparison

def pairObservedMonomial

Polynomial likelihood monomial contributed by the observed marks at one paired baseline label. Given the specified input q, the specified input z, the specified input u, the specified input x, the specified input counts, the stated mathematical conclusion holds. Given the specified input σ.

Definition (Lean source)
d :
ℕ
shared
q σ z u :
ℝ
x :
Fin d
counts :
Obs d → ℕ
pairObservedMonomial q σ z u x counts :
ℝ
∏ o : Obs d, if o.X = x then pairObservedCoeff q σ z u o ^ counts o else 1
theorem pair_label_power_factorization

The likelihood powers at one paired label split into a latent-mass power and the observed-mark monomial. Given the specified input n, the specified input d, the specified input q, the specified input hd, the specified input counts, the specified input side, the stated mathematical conclusion holds. Given the specified input σ, the specified input θ. Given the specified input j.

Formal statement
n d :
ℕ
q σ :
ℝ
hd :
1 ≤ d
θ :
Theta n d
counts :
Obs d → ℕ
j :
side :
(∏ o : Obs d, if o.X = pairLabel n d hd j side then countAtomMass n d q σ hd θ o ^ counts o else 1)
= latentP n (θ.1 j) ^ (∑ o : Obs d, if o.X = pairLabel n d hd j side then counts o else 0) * pairObservedMonomial q σ (latentZ n (θ.1 j)) (orientation θ j side) (pairLabel n d hd j side) counts
Proof (Lean source)
lemma pair_label_power_factorization (n d : ℕ) (q σ : ℝ) (hd : 1 ≤ d) (θ : Theta n d) (counts : Obs d → ℕ) (j : Fin (pairCount n d)) (side : Bool) : (∏ o : Obs d, if o.X = pairLabel n d hd j side then countAtomMass n d q σ hd θ o ^ counts o else 1) = latentP n (θ.1 j) ^ (∑ o : Obs d, if o.X = pairLabel n d hd j side then counts o else 0) * pairObservedMonomial q σ (latentZ n (θ.1 j)) (orientation θ j side) (pairLabel n d hd j side) counts := by unfold pairObservedMonomial rw [← Finset.prod_pow_eq_pow_sum (Finset.univ : Finset (Obs d)) (fun o => if o.X = pairLabel n d hd j side then counts o else 0) (latentP n (θ.1 j)), ← Finset.prod_mul_distrib] apply Finset.prod_congr rfl intro o _ by_cases ho : o.X = pairLabel n d hd j side · simp only [ho, ↓reduceIte, countAtomMass_at_pair_label n d q σ hd θ o j side ho, mul_pow] · simp [ho]
CausalSmith.Stat.MarNearcompleteFrontier.pair_label_power_factorization · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/PairMarks.lean:22
theorem pairObservedMonomial_sign_flip

Every one-label likelihood monomial transforms by latent-sign reflection when the experiment sign is flipped. Given the specified input q, the specified input z, the specified input u, the specified input x, the specified input counts, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
shared
q z u :
ℝ
x :
Fin d
counts :
Obs d → ℕ
pairObservedMonomial q (-1) z u x counts = pairObservedMonomial q 1 (-z) u x counts
Proof (Lean source)
lemma pairObservedMonomial_sign_flip (q z u : ℝ) (x : Fin d) (counts : Obs d → ℕ) : pairObservedMonomial q (-1) z u x counts = pairObservedMonomial q 1 (-z) u x counts := by unfold pairObservedMonomial apply Finset.prod_congr rfl intro o _ split_ifs · rw [pairObservedCoeff_sign_flip] · rfl
CausalSmith.Stat.MarNearcompleteFrontier.pairObservedMonomial_sign_flip · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/PairMarks.lean:47
theorem pairObservedMonomial_orientation_sign_flip

Orientation averaging preserves the exact latent-sign reflection of a one-label likelihood monomial. Given the specified input n, the specified input d, the specified input q, the specified input z, the specified input x, the specified input counts, the stated mathematical conclusion holds. Given the specified input θ. Given the specified input j.

Formal statement
n d :
ℕ
q z :
ℝ
x :
Fin d
counts :
Obs d → ℕ
θ :
Theta n d
j :
(∑ side : Bool, pairObservedMonomial q (-1) z (orientation θ j side) x counts)
= ∑ side : Bool, pairObservedMonomial q 1 (-z) (orientation θ j side) x counts
Proof (Lean source)
lemma pairObservedMonomial_orientation_sign_flip (n d : ℕ) (q z : ℝ) (x : Fin d) (counts : Obs d → ℕ) (θ : Theta n d) (j : Fin (pairCount n d)) : (∑ side : Bool, pairObservedMonomial q (-1) z (orientation θ j side) x counts) = ∑ side : Bool, pairObservedMonomial q 1 (-z) (orientation θ j side) x counts := by apply Finset.sum_congr rfl intro side _ exact pairObservedMonomial_sign_flip q z (orientation θ j side) x counts
CausalSmith.Stat.MarNearcompleteFrontier.pairObservedMonomial_orientation_sign_flip · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/PairMarks.lean:61
theorem pairObservedMonomial_mem_unit

Under legal signs, every one-label pair likelihood monomial lies in the unit interval. Given the specified input q, the specified input z, the specified input u, the specified input x, the specified input counts, the specified input hz, the specified input hu, the stated mathematical conclusion holds. Given the specified input σ, the specified input hσ. Given the specified input hq.

Formal statement
d :
ℕ
shared
q σ z u :
ℝ
x :
Fin d
counts :
Obs d → ℕ
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
hσ :
σ = -1 ∨ σ = 1
hz :
z = -1 ∨ z = 1
hu :
u = -1 ∨ u = 1
pairObservedMonomial q σ z u x counts ∈ Icc 0 1
Proof (Lean source)
lemma pairObservedMonomial_mem_unit (q σ z u : ℝ) (x : Fin d) (counts : Obs d → ℕ) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (hσ : σ = -1 ∨ σ = 1) (hz : z = -1 ∨ z = 1) (hu : u = -1 ∨ u = 1) : pairObservedMonomial q σ z u x counts ∈ Icc 0 1 := by unfold pairObservedMonomial have hterm (o : Obs d) : (if o.X = x then pairObservedCoeff q σ z u o ^ counts o else 1) ∈ Icc (0 : ℝ) 1 := by split_ifs · constructor · exact pow_nonneg (pairObservedCoeff_nonneg q σ z u o hq hσ hz hu) _ · exact pow_le_one₀ (pairObservedCoeff_nonneg q σ z u o hq hσ hz hu) (pairObservedCoeff_le_one q σ z u o hq hσ hz hu) · exact Set.right_mem_Icc.mpr zero_le_one exact ⟨Finset.prod_nonneg fun o _ => (hterm o).1, Finset.prod_le_one (fun o _ => (hterm o).1) (fun o _ => (hterm o).2)⟩
CausalSmith.Stat.MarNearcompleteFrontier.pairObservedMonomial_mem_unit · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/PairMarks.lean:75
def pairBlockCount

Total observed count in the two labels belonging to one latent pair. Given the specified input n, the specified input d, the specified input hd, the specified input counts, the stated mathematical conclusion holds. Given the specified input j.

Definition (Lean source)
n d :
ℕ
hd :
1 ≤ d
counts :
Obs d → ℕ
j :
pairBlockCount n d hd counts j :
ℕ
∑ side : Bool, ∑ o : Obs d, if o.X = pairLabel n d hd j side then counts o else 0

A finite family of natural numbers summing to one has a unique unit entry. Given the specified input f, the stated mathematical conclusion holds. Given the specified input α. Given the specified input h.

Formal statement
α :
f :
α → ℕ
h :
(∑ i, f i) = 1
∃ i,
f i = 1
conclusion 1
j :
j ≠ i
f j = 0
Proof (Lean source)
lemma fintype_nat_sum_eq_one {α : Type*} [Fintype α] [DecidableEq α] (f : α → ℕ) (h : (∑ i, f i) = 1) : ∃ i, f i = 1 ∧ ∀ j, j ≠ i → f j = 0 := by let d : α →₀ ℕ := Finsupp.equivFunOnFinite.symm f have hd : d.sum (fun _ n => n) = 1 := by rw [Finsupp.sum_fintype _ _ (by simp)] simpa [d] using h obtain ⟨i, hi⟩ := (Finsupp.sum_eq_one_iff d).mp hd refine ⟨i, ?_, ?_⟩ · have hfun := DFunLike.congr_fun hi i simpa [d] using hfun · intro j hji have hfun := DFunLike.congr_fun hi j simpa [d, hji] using hfun
def pairBlockMarkAverage

Orientation-averaged observed-mark monomial for one pair block, written without reference to the other latent coordinates. Given the specified input n, the specified input d, the specified input q, the specified input z, the specified input hd, the specified input counts, the stated mathematical conclusion holds. Given the specified input σ. Given the specified input j.

Definition (Lean source)
n d :
ℕ
q σ z :
ℝ
hd :
1 ≤ d
j :
counts :
Obs d → ℕ
pairBlockMarkAverage n d q σ z hd j counts :
ℝ
∑ base : Bool, ∏ side : Bool, pairObservedMonomial q σ z (if base == side then 1 else -1) (pairLabel n d hd j side) counts
theorem pairBlockMarkAverage_degree_zero

A block with no observations has the same orientation-averaged mark monomial under both experiment signs. Given the specified input n, the specified input d, the specified input q, the specified input z, the specified input hd, the specified input counts, the specified input hzero, the stated mathematical conclusion holds. Given the specified input j.

Formal statement
n d :
ℕ
q z :
ℝ
hd :
1 ≤ d
j :
counts :
Obs d → ℕ
hzero :
pairBlockCount n d hd counts j = 0
pairBlockMarkAverage n d q (-1) z hd j counts = pairBlockMarkAverage n d q 1 z hd j counts
Proof (Lean source)
lemma pairBlockMarkAverage_degree_zero (n d : ℕ) (q z : ℝ) (hd : 1 ≤ d) (j : Fin (pairCount n d)) (counts : Obs d → ℕ) (hzero : pairBlockCount n d hd counts j = 0) : pairBlockMarkAverage n d q (-1) z hd j counts = pairBlockMarkAverage n d q 1 z hd j counts := by have hcount (side : Bool) (o : Obs d) (ho : o.X = pairLabel n d hd j side) : counts o = 0 := by unfold pairBlockCount at hzero have hs := (Finset.sum_eq_zero_iff.mp hzero) side (Finset.mem_univ side) have ho' := (Finset.sum_eq_zero_iff.mp hs) o (Finset.mem_univ o) simpa [ho] using ho' unfold pairBlockMarkAverage pairObservedMonomial apply Finset.sum_congr rfl intro base _ apply Finset.prod_congr rfl intro side _ apply Finset.prod_congr rfl intro o _ by_cases ho : o.X = pairLabel n d hd j side · simp [ho, hcount side o ho] · simp [ho]
CausalSmith.Stat.MarNearcompleteFrontier.pairBlockMarkAverage_degree_zero · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/PairMarks.lean:131
theorem pairBlockMarkAverage_singleton

If one specified observed atom is the unique record in a pair block, the block mark monomial reduces to its orientation-averaged scalar coefficient. Given the specified input n, the specified input d, the specified input q, the specified input z, the specified input hd, the specified input counts, the specified input target, the specified input o₀, the specified input ho₀, the specified input hone, the stated mathematical conclusion holds. Given the specified input σ. Given the specified input j, the specified input hother.

Formal statement
n d :
ℕ
q σ z :
ℝ
hd :
1 ≤ d
j :
counts :
Obs d → ℕ
target :
o₀ :
Obs d
ho₀ :
o₀.X = pairLabel n d hd j target
hone :
counts o₀ = 1
hother :
∀ side o
if
o.X = pairLabel n d hd j side
and
(side ≠ target ∨ o ≠ o₀)
then
counts o = 0
pairBlockMarkAverage n d q σ z hd j counts
= ∑ base : Bool, pairObservedCoeff q σ z (if base == target then 1 else -1) o₀
Proof (Lean source)
lemma pairBlockMarkAverage_singleton (n d : ℕ) (q σ z : ℝ) (hd : 1 ≤ d) (j : Fin (pairCount n d)) (counts : Obs d → ℕ) (target : Bool) (o₀ : Obs d) (ho₀ : o₀.X = pairLabel n d hd j target) (hone : counts o₀ = 1) (hother : ∀ side o, o.X = pairLabel n d hd j side → (side ≠ target ∨ o ≠ o₀) → counts o = 0) : pairBlockMarkAverage n d q σ z hd j counts = ∑ base : Bool, pairObservedCoeff q σ z (if base == target then 1 else -1) o₀ := by unfold pairBlockMarkAverage apply Finset.sum_congr rfl intro base _ rw [Finset.prod_eq_single target] · unfold pairObservedMonomial rw [Finset.prod_eq_single o₀] · simp [ho₀, hone] · intro o _ hne by_cases ho : o.X = pairLabel n d hd j target · simp [ho, hother target o ho (inr hne)] · simp [ho] · simp · intro side _ hside unfold pairObservedMonomial apply Finset.prod_eq_one intro o _ by_cases ho : o.X = pairLabel n d hd j side · simp [ho, hother side o ho (inl hside)] · simp [ho] · simp
CausalSmith.Stat.MarNearcompleteFrontier.pairBlockMarkAverage_singleton · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/PairMarks.lean:156
theorem pairBlockMarkAverage_degree_one

A block with exactly one observation has the same orientation-averaged mark monomial under both experiment signs. Given the specified input n, the specified input d, the specified input q, the specified input z, the specified input hd, the specified input counts, the specified input hone, the stated mathematical conclusion holds. Given the specified input j.

Formal statement
n d :
ℕ
q z :
ℝ
hd :
1 ≤ d
j :
counts :
Obs d → ℕ
hone :
pairBlockCount n d hd counts j = 1
pairBlockMarkAverage n d q (-1) z hd j counts = pairBlockMarkAverage n d q 1 z hd j counts
Proof (Lean source)
lemma pairBlockMarkAverage_degree_one (n d : ℕ) (q z : ℝ) (hd : 1 ≤ d) (j : Fin (pairCount n d)) (counts : Obs d → ℕ) (hone : pairBlockCount n d hd counts j = 1) : pairBlockMarkAverage n d q (-1) z hd j counts = pairBlockMarkAverage n d q 1 z hd j counts := by let f : Bool × Obs d → ℕ := fun so => if so.2.X = pairLabel n d hd j so.1 then counts so.2 else 0 have hfsum : (∑ so : Bool × Obs d, f so) = 1 := by rw [Fintype.sum_prod_type] simpa [f, pairBlockCount] using hone obtain ⟨⟨target, o₀⟩, hunit, hother⟩ := fintype_nat_sum_eq_one f hfsum have ho₀ : o₀.X = pairLabel n d hd j target := by by_contra ho simp [f, ho] at hunit have hcount₀ : counts o₀ = 1 := by simpa [f, ho₀] using hunit have hcount_other (side : Bool) (o : Obs d) (ho : o.X = pairLabel n d hd j side) (hne : side ≠ target ∨ o ≠ o₀) : counts o = 0 := by have hpair : (side, o) ≠ (target, o₀) := by intro h exact hne.elim (fun hs => hs (congrArg fst h)) (fun hoo => hoo (congrArg snd h)) simpa [f, ho] using hother (side, o) hpair rw [pairBlockMarkAverage_singleton n d q (-1) z hd j counts target o₀ ho₀ hcount₀ hcount_other, pairBlockMarkAverage_singleton n d q 1 z hd j counts target o₀ ho₀ hcount₀ hcount_other] exact pairObservedCoeff_bool_orientation_linear_cancel q z target o₀
CausalSmith.Stat.MarNearcompleteFrontier.pairBlockMarkAverage_degree_one · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/PairMarks.lean:189
theorem pairBlockMarkAverage_gap_le_two

For legal overlap and latent signs, the absolute orientation-averaged mark gap of one pair block is at most two. Given the specified input n, the specified input d, the specified input q, the specified input z, the specified input hd, the specified input counts, the specified input hz, the stated mathematical conclusion holds. Given the specified input j, the specified input hq.

Formal statement
n d :
ℕ
q z :
ℝ
hd :
1 ≤ d
j :
counts :
Obs d → ℕ
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
hz :
z = -1 ∨ z = 1
|pairBlockMarkAverage n d q (-1) z hd j counts
- pairBlockMarkAverage n d q 1 z hd j counts|
≤ 2
Proof (Lean source)
lemma pairBlockMarkAverage_gap_le_two (n d : ℕ) (q z : ℝ) (hd : 1 ≤ d) (j : Fin (pairCount n d)) (counts : Obs d → ℕ) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (hz : z = -1 ∨ z = 1) : |pairBlockMarkAverage n d q (-1) z hd j counts - pairBlockMarkAverage n d q 1 z hd j counts| ≤ 2 := by have hterm (σ : ℝ) (hσ : σ = -1 ∨ σ = 1) (base : Bool) : (∏ side : Bool, pairObservedMonomial q σ z (if base == side then 1 else -1) (pairLabel n d hd j side) counts) ∈ Icc (0 : ℝ) 1 := by have hmono (side : Bool) : pairObservedMonomial q σ z (if base == side then 1 else -1) (pairLabel n d hd j side) counts ∈ Icc (0 : ℝ) 1 := by apply pairObservedMonomial_mem_unit q σ z _ _ counts hq hσ hz split_ifs <;> simp exact ⟨Finset.prod_nonneg fun side _ => (hmono side).1, Finset.prod_le_one (fun side _ => (hmono side).1) (fun side _ => (hmono side).2)⟩ have hsum (σ : ℝ) (hσ : σ = -1 ∨ σ = 1) : pairBlockMarkAverage n d q σ z hd j counts ∈ Icc (0 : ℝ) 2 := by unfold pairBlockMarkAverage constructor · exact Finset.sum_nonneg fun base _ => (hterm σ hσ base).1 · calc _ ≤ ∑ _base : Bool, (1 : ℝ) := Finset.sum_le_sum fun base _ => (hterm σ hσ base).2 _ = 2 := by simp rcases hsum (-1) (inl rfl) with ⟨hm0, hm2⟩ rcases hsum 1 (inr rfl) with ⟨hp0, hp2⟩ rw [abs_le] constructor <;> linarith
CausalSmith.Stat.MarNearcompleteFrontier.pairBlockMarkAverage_gap_le_two · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/PairMarks.lean:221
theorem pairBlockMarkAverage_sign_flip

Flipping the experiment sign is exactly reflection of the scalar latent sign in the orientation-averaged block monomial. Given the specified input n, the specified input d, the specified input q, the specified input z, the specified input hd, the specified input counts, the stated mathematical conclusion holds. Given the specified input j.

Formal statement
n d :
ℕ
q z :
ℝ
hd :
1 ≤ d
j :
counts :
Obs d → ℕ
pairBlockMarkAverage n d q (-1) z hd j counts
= pairBlockMarkAverage n d q 1 (-z) hd j counts
Proof (Lean source)
lemma pairBlockMarkAverage_sign_flip (n d : ℕ) (q z : ℝ) (hd : 1 ≤ d) (j : Fin (pairCount n d)) (counts : Obs d → ℕ) : pairBlockMarkAverage n d q (-1) z hd j counts = pairBlockMarkAverage n d q 1 (-z) hd j counts := by unfold pairBlockMarkAverage apply Finset.sum_congr rfl intro base _ apply Finset.prod_congr rfl intro side _ exact pairObservedMonomial_sign_flip q z _ _ counts
CausalSmith.Stat.MarNearcompleteFrontier.pairBlockMarkAverage_sign_flip · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/PairMarks.lean:255
theorem pairBlockMarkAverage_gap_factor

On the two-point latent-sign support, the signed block gap factors as the latent sign times its value at positive sign. Given the specified input n, the specified input d, the specified input q, the specified input z, the specified input hd, the specified input counts, the specified input hz, the stated mathematical conclusion holds. Given the specified input j.

Formal statement
n d :
ℕ
q z :
ℝ
hd :
1 ≤ d
j :
counts :
Obs d → ℕ
hz :
z = -1 ∨ z = 1
pairBlockMarkAverage n d q (-1) z hd j counts - pairBlockMarkAverage n d q 1 z hd j counts
= z * (pairBlockMarkAverage n d q (-1) 1 hd j counts - pairBlockMarkAverage n d q 1 1 hd j counts)
Proof (Lean source)
lemma pairBlockMarkAverage_gap_factor (n d : ℕ) (q z : ℝ) (hd : 1 ≤ d) (j : Fin (pairCount n d)) (counts : Obs d → ℕ) (hz : z = -1 ∨ z = 1) : pairBlockMarkAverage n d q (-1) z hd j counts - pairBlockMarkAverage n d q 1 z hd j counts = z * (pairBlockMarkAverage n d q (-1) 1 hd j counts - pairBlockMarkAverage n d q 1 1 hd j counts) := by rcases hz with rfl | rfl · rw [pairBlockMarkAverage_sign_flip n d q 1 hd j counts] have h := pairBlockMarkAverage_sign_flip n d q (-1) hd j counts norm_num at h ⊢ rw [h] · ring
CausalSmith.Stat.MarNearcompleteFrontier.pairBlockMarkAverage_gap_factor · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/PairMarks.lean:269

The signed tail after truncating the power series of exp (-x) through the displayed degree. Given the specified input degree, the specified input x, the stated mathematical conclusion holds.

Definition (Lean source)
degree :
ℕ
x :
ℝ
signedExponentialSeriesTail degree x :
ℝ
∑' t : ℕ, if degree < t then (-x) ^ t / (t.factorial : ℝ) else 0
CausalSmith.Stat.MarNearcompleteFrontier.signedExponentialSeriesTail · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/PairMarks.lean:286
theorem exp_neg_eq_truncated_add_signed_tail

Exact Taylor decomposition of the random-normalizer exponential. Given the specified input degree, the specified input x, the stated mathematical conclusion holds.

Formal statement
degree :
ℕ
x :
ℝ
exp (-x)
= (∑ t ∈ range (degree + 1), (-x) ^ t / (t.factorial : ℝ))
Proof (Lean source)
lemma exp_neg_eq_truncated_add_signed_tail (degree : ℕ) (x : ℝ) : exp (-x) = (∑ t ∈ range (degree + 1), (-x) ^ t / (t.factorial : ℝ)) + signedExponentialSeriesTail degree x := by let f : ℕ → ℝ := fun t => (-x) ^ t / (t.factorial : ℝ) let low : ℕ → ℝ := fun t => if t ≤ degree then f t else 0 let high : ℕ → ℝ := fun t => if degree < t then f t else 0 have hf : Summable f := Real.summable_pow_div_factorial (-x) have hlow : Summable low := by simpa only [low, show (fun t => if t ≤ degree then f t else 0) = (Iic degree).indicator f by funext t; simp [indicator]] using hf.indicator (Iic degree) have hhigh : Summable high := by simpa only [high, show (fun t => if degree < t then f t else 0) = (Ioi degree).indicator f by funext t; simp [indicator]] using hf.indicator (Ioi degree) have hsplit : (∑' t, f t) = (∑' t, low t) + ∑' t, high t := by rw [← hlow.tsum_add hhigh] apply tsum_congr intro t simp only [low, high] by_cases ht : t ≤ degree · simp [ht, Nat.not_lt_of_ge ht] · have hdt : degree < t := Nat.lt_of_not_ge ht simp [ht, hdt] rw [Real.exp_eq_exp_ℝ, ← (NormedSpace.expSeries_div_hasSum_exp (-x)).tsum_eq] change (∑' t, f t) = _ rw [hsplit] congr 1 · rw [tsum_eq_sum (s := range (degree + 1))] · apply Finset.sum_congr rfl intro t ht simp only [low] rw [if_pos] exact Nat.lt_succ_iff.mp (Finset.mem_range.mp ht) · intro t ht simp only [low] rw [if_neg] have hge : degree + 1 ≤ t := by simpa only [Finset.mem_range, not_lt] using ht omega
CausalSmith.Stat.MarNearcompleteFrontier.exp_neg_eq_truncated_add_signed_tail · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/PairMarks.lean:292
theorem abs_signedExponentialSeriesTail_le

The signed Taylor remainder is dominated by the ordinary positive exponential-series tail. Given the specified input degree, the specified input x, the specified input hx, the stated mathematical conclusion holds.

Formal statement
degree :
ℕ
x :
ℝ
hx :
0 ≤ x
Proof (Lean source)
lemma abs_signedExponentialSeriesTail_le (degree : ℕ) (x : ℝ) (hx : 0 ≤ x) : |signedExponentialSeriesTail degree x| ≤ Causalean.Stat.Minimax.MomentMatchedMixture.exponentialSeriesTail degree x := by unfold signedExponentialSeriesTail have hnorm : (fun t : ℕ => ‖if degree < t then (-x) ^ t / (t.factorial : ℝ) else 0‖) = fun t => if degree < t then x ^ t / (t.factorial : ℝ) else 0 := by funext t by_cases ht : degree < t · simp [ht, Real.norm_eq_abs, abs_div, abs_pow, abs_of_nonneg hx, show (0 : ℝ) ≤ t.factorial by positivity] · simp [ht] have hsum : Summable (fun t : ℕ => if degree < t then x ^ t / (t.factorial : ℝ) else 0) := by simpa only [show (fun t : ℕ => if degree < t then x ^ t / (t.factorial : ℝ) else 0) = (Ioi degree).indicator (fun t => x ^ t / (t.factorial : ℝ)) by funext t; simp [indicator]] using (Real.summable_pow_div_factorial x).indicator (Ioi degree) calc _ ≤ ∑' t : ℕ, ‖if degree < t then (-x) ^ t / (t.factorial : ℝ) else 0‖ := norm_tsum_le_tsum_norm (by rw [hnorm]; exact hsum) _ = _ := by unfold Causalean.Stat.Minimax.MomentMatchedMixture.exponentialSeriesTail apply tsum_congr intro t by_cases ht : degree < t · simp [ht, Real.norm_eq_abs, abs_div, abs_pow, abs_of_nonneg hx, show (0 : ℝ) ≤ t.factorial by positivity] · simp [ht]
CausalSmith.Stat.MarNearcompleteFrontier.abs_signedExponentialSeriesTail_le · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/PairMarks.lean:336
theorem factorial_series_convolution Lemma factorial_series_convolution in the paper ↗

The factorial-normalized Cauchy coefficient of two exponential series is the corresponding coefficient at the sum of their arguments. Given the specified input a, the specified input b, the specified input s, the stated mathematical conclusion holds.

Formal statement
a b :
ℝ
s :
ℕ
(∑ r ∈ range (s + 1), a ^ r / (r.factorial : ℝ) * (b ^ (s - r) / ((s - r).factorial : ℝ)))
= (a + b) ^ s / (s.factorial : ℝ)
Proof (Lean source)
lemma factorial_series_convolution (a b : ℝ) (s : ℕ) : (∑ r ∈ range (s + 1), a ^ r / (r.factorial : ℝ) * (b ^ (s - r) / ((s - r).factorial : ℝ))) = (a + b) ^ s / (s.factorial : ℝ) := by rw [eq_div_iff (by positivity : (s.factorial : ℝ) ≠ 0)] rw [Finset.sum_mul, add_pow] apply Finset.sum_congr rfl intro r hr have hrs : r ≤ s := le_of_lt_succ (Finset.mem_range.mp hr) rw [Nat.cast_choose ℝ hrs] field_simp
CausalSmith.Stat.MarNearcompleteFrontier.factorial_series_convolution · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/PairMarks.lean:372
theorem exponentialSeriesTail_add_convolution Lemma exponentialSeriesTail_add_convolution in the paper ↗

The unmatched bidegrees of two factorial series regroup into the ordinary exponential tail at the sum of the two arguments. Given the specified input degree, the specified input a, the specified input b, the stated mathematical conclusion holds.

Formal statement
degree :
ℕ
a b :
ℝ
(∑' s : ℕ, if degree < s then ∑ r ∈ range (s + 1), a ^ r / (r.factorial : ℝ) * (b ^ (s - r) / ((s - r).factorial : ℝ)) else 0)
= exponentialSeriesTail degree (a + b)
Proof (Lean source)
lemma exponentialSeriesTail_add_convolution (degree : ℕ) (a b : ℝ) : (∑' s : ℕ, if degree < s then ∑ r ∈ range (s + 1), a ^ r / (r.factorial : ℝ) * (b ^ (s - r) / ((s - r).factorial : ℝ)) else 0) = Causalean.Stat.Minimax.MomentMatchedMixture.exponentialSeriesTail degree (a + b) := by unfold Causalean.Stat.Minimax.MomentMatchedMixture.exponentialSeriesTail apply tsum_congr intro s by_cases hs : degree < s · rw [if_pos hs, if_pos hs, factorial_series_convolution] · rw [if_neg hs, if_neg hs]
CausalSmith.Stat.MarNearcompleteFrontier.exponentialSeriesTail_add_convolution · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/PairMarks.lean:388
theorem latentWeight_nonneg_count Lemma latentWeight_nonneg_count in the paper ↗

Given the specified input n, the specified input z, the stated mathematical conclusion holds.

Formal statement
n :
ℕ
z :
0 ≤ latentWeight n z
Proof (Lean source)
lemma latentWeight_nonneg_count (n : ℕ) (z : Latent n) : 0 ≤ latentWeight n z := by cases z with | inl i => exact div_nonneg (mul_nonneg (by unfold priorH; positivity) (abs_nonneg _)) (le_of_lt (latentWeight_node_pos n i)) | inr _ => simp only [latentWeight] apply sub_nonneg.mpr calc (∑ i : Fin (priorK n), priorH n * |signedNodeWeight n i| / interpolationNode n i) ≤ ∑ i : Fin (priorK n), |signedNodeWeight n i| := by apply Finset.sum_le_sum intro i _ apply (div_le_iff₀ (latentWeight_node_pos n i)).mpr nlinarith [latentWeight_node_lower n i, abs_nonneg (signedNodeWeight n i)] _ ≤ 1 := latentWeight_signed_total_le_one n
theorem oneLatentLaw_toReal_count Lemma oneLatentLaw_toReal_count in the paper ↗

Given the specified input n, the specified input d, the specified input q, the specified input hn, the specified input hd, the specified input z, the stated mathematical conclusion holds. Given the specified input hq.

Formal statement
n d :
ℕ
q :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
z :
(oneLatentLaw n d q hn hd hq z).toReal = latentWeight n z
Proof (Lean source)
lemma oneLatentLaw_toReal_count (n d : ℕ) (q : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (z : Latent n) : (oneLatentLaw n d q hn hd hq z).toReal = latentWeight n z := by rw [oneLatentLaw, PMF.ofFintype_apply, ENNReal.toReal_ofReal (latentWeight_nonneg_count n z)]
theorem thetaLaw_product_factorization Lemma thetaLaw_product_factorization in the paper ↗

The full latent-and-orientation law factors coordinatewise for arbitrary per-pair real statistics. Given the specified input n, the specified input d, the specified input q, the specified input hn, the specified input hd, the stated mathematical conclusion holds. Given the specified input hq, the specified input f.

Formal statement
n d :
ℕ
q :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
f :
Fin (pairCount n d) → Latent n → Bool → ℝ
(∑ θ : Theta n d, (thetaLaw n d q hn hd hq θ).toReal * ∏ j : Fin (pairCount n d), f j (θ.1 j) (θ.2 j))
= ∏ j : Fin (pairCount n d), ∑ z : Latent n, latentWeight n z * ∑ b : Bool, (1 / 2 : ℝ) * f j z b
Proof (Lean source)
lemma thetaLaw_product_factorization (n d : ℕ) (q : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (f : Fin (pairCount n d) → Latent n → Bool → ℝ) : (∑ θ : Theta n d, (thetaLaw n d q hn hd hq θ).toReal * ∏ j : Fin (pairCount n d), f j (θ.1 j) (θ.2 j)) = ∏ j : Fin (pairCount n d), ∑ z : Latent n, latentWeight n z * ∑ b : Bool, (1 / 2 : ℝ) * f j z b := by simp only [thetaLaw, PMF.ofFintype_apply, thetaWeight, ENNReal.toReal_prod, ENNReal.toReal_mul, oneLatentLaw_toReal_count, ENNReal.toReal_inv, ENNReal.toReal_ofNat] rw [Fintype.sum_prod_type] calc _ = ∑ u : Fin (pairCount n d) → Latent n, ∑ s : Fin (pairCount n d) → Bool, ∏ j : Fin (pairCount n d), latentWeight n (u j) * ((1 / 2 : ℝ) * f j (u j) (s j)) := by apply Finset.sum_congr rfl intro u _ apply Finset.sum_congr rfl intro s _ have hhalf : ((1 / 2 : ℝ≥0∞).toReal) = (1 / 2 : ℝ) := by norm_num rw [hhalf] have hleft : (∏ j : Fin (pairCount n d), latentWeight n (u j) * (1 / 2 : ℝ)) = (∏ j, latentWeight n (u j)) * ∏ _j : Fin (pairCount n d), (1 / 2 : ℝ) := Finset.prod_mul_distrib have hright : (∏ j : Fin (pairCount n d), latentWeight n (u j) * ((1 / 2 : ℝ) * f j (u j) (s j))) = (∏ j, latentWeight n (u j)) * ((∏ _j : Fin (pairCount n d), (1 / 2 : ℝ)) * ∏ j, f j (u j) (s j)) := by calc _ = (∏ j, latentWeight n (u j)) * ∏ j, ((1 / 2 : ℝ) * f j (u j) (s j)) := Finset.prod_mul_distrib _ = _ := by rw [Finset.prod_mul_distrib] rw [hleft, hright] ring _ = ∑ u : Fin (pairCount n d) → Latent n, ∏ j : Fin (pairCount n d), ∑ b : Bool, latentWeight n (u j) * ((1 / 2 : ℝ) * f j (u j) b) := by apply Finset.sum_congr rfl intro u _ exact (Fintype.prod_sum (fun j : Fin (pairCount n d) => fun b : Bool => latentWeight n (u j) * ((1 / 2 : ℝ) * f j (u j) b))).symm _ = ∑ u : Fin (pairCount n d) → Latent n, ∏ j : Fin (pairCount n d), latentWeight n (u j) * ∑ b : Bool, (1 / 2 : ℝ) * f j (u j) b := by apply Finset.sum_congr rfl intro u _ apply Finset.prod_congr rfl intro j _ rw [Finset.mul_sum] _ = _ := (Fintype.prod_sum (fun j : Fin (pairCount n d) => fun z : Latent n => latentWeight n z * ∑ b : Bool, (1 / 2 : ℝ) * f j z b)).symm
CausalSmith.Stat.MarNearcompleteFrontier.thetaLaw_product_factorization · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/PairMarks.lean:437
CausalSmith.Stat.STAT_MarNearcompleteFrontier_Research.Helpers.LowerBound.CountMixture.ProductSummation 4 declarations The one-pair factorial tail is combined across independent blocks using normalized nonnegative likelihoods, as in equation (14) of the converse.

Normalization and L1 telescoping for independent paired counts

The one-pair factorial tail is combined across independent blocks using normalized nonnegative likelihoods, as in equation (14) of the converse.

theorem pairMarked_component_eq_poisson

For a sample multiplier, alphabet size, arrival parameter, sign, latent orientation, latent mass, positive-alphabet witness, admissible-arrival witness, admissible-sign witness, admissible-orientation witness, nonnegative-mass witness, pair index, base orientation, and observed count vector, the marked component likelihood equals the product of its coordinatewise Poisson masses.

Formal statement
n d :
ℕ
q σ z p :
ℝ
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
hσ :
σ = -1 ∨ σ = 1
hz :
z = -1 ∨ z = 1
hp :
0 ≤ p
j :
base :
counts :
Obs d → ℕ
exp (-8 * (n : ℝ) * p) * (∏ o : Obs d, pairMarkedIntensity n d q σ z p hd j base o ^ counts o / (counts o).factorial)
= ∏ o : Obs d, exp (-(pairMarkedRate n d q σ z p hd j base o : ℝ)) * (pairMarkedRate n d q σ z p hd j base o : ℝ) ^ counts o / (counts o).factorial
Proof (Lean source)
-- @node: pairMarked_component_eq_poisson lemma pairMarked_component_eq_poisson (n d : ℕ) (q σ z p : ℝ) (hd : 1 ≤ d) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (hσ : σ = -1 ∨ σ = 1) (hz : z = -1 ∨ z = 1) (hp : 0 ≤ p) (j : Fin (pairCount n d)) (base : Bool) (counts : Obs d → ℕ) : exp (-8 * (n : ℝ) * p) * (∏ o : Obs d, pairMarkedIntensity n d q σ z p hd j base o ^ counts o / (counts o).factorial) = ∏ o : Obs d, exp (-(pairMarkedRate n d q σ z p hd j base o : ℝ)) * (pairMarkedRate n d q σ z p hd j base o : ℝ) ^ counts o / (counts o).factorial := by simp_rw [pairMarkedRate_coe n d q σ z p hd hq hσ hz hp j base] rw [show (∏ o : Obs d, exp (-pairMarkedIntensity n d q σ z p hd j base o) * pairMarkedIntensity n d q σ z p hd j base o ^ counts o / (counts o).factorial) = (∏ o : Obs d, exp (-pairMarkedIntensity n d q σ z p hd j base o)) * ∏ o : Obs d, pairMarkedIntensity n d q σ z p hd j base o ^ counts o / (counts o).factorial by rw [← Finset.prod_mul_distrib] apply Finset.prod_congr rfl intro o _ ring] rw [← Real.exp_sum, Finset.sum_neg_distrib, pairMarkedIntensity_sum] congr 2 ring
CausalSmith.Stat.MarNearcompleteFrontier.pairMarked_component_eq_poisson · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/ProductSummation.lean:20
theorem pairMarkedMixtureFactor_nonneg

Given the specified input n, the specified input d, the specified input q, the specified input hd, the specified input counts, the stated mathematical conclusion holds. Given the specified input σ, the specified input hσ. Given the specified input hq, the specified input j.

Formal statement
n d :
ℕ
q σ :
ℝ
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
hσ :
σ = -1 ∨ σ = 1
j :
counts :
Obs d → ℕ
0 ≤ pairMarkedMixtureFactor n d q σ hd j counts
Proof (Lean source)
lemma pairMarkedMixtureFactor_nonneg (n d : ℕ) (q σ : ℝ) (hd : 1 ≤ d) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (hσ : σ = -1 ∨ σ = 1) (j : Fin (pairCount n d)) (counts : Obs d → ℕ) : 0 ≤ pairMarkedMixtureFactor n d q σ hd j counts := by unfold pairMarkedMixtureFactor apply Finset.sum_nonneg intro z _ apply mul_nonneg · exact mul_nonneg (latentWeight_nonneg_count n z) (Real.exp_pos _).le · apply Finset.sum_nonneg intro base _ apply mul_nonneg (by norm_num) apply Finset.prod_nonneg intro o _ exact div_nonneg (pow_nonneg (pairMarkedIntensity_nonneg n d q σ (latentZ n z) (latentP n z) hd hq hσ (latentZ_eq_neg_one_or_one n z) (latentP_nonneg n z) j base o) _) (by positivity)
theorem pairMarkedMixtureFactor_hasSum_one

Averaging the normalized marked components preserves their total mass. Given the specified input n, the specified input d, the specified input q, the specified input hn, the specified input hd, the stated mathematical conclusion holds. Given the specified input σ, the specified input hσ. Given the specified input hq, the specified input j.

Formal statement
n d :
ℕ
q σ :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
hσ :
σ = -1 ∨ σ = 1
j :
Proof (Lean source)
-- @node: pairMarkedMixtureFactor_hasSum_one lemma pairMarkedMixtureFactor_hasSum_one (n d : ℕ) (q σ : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (hσ : σ = -1 ∨ σ = 1) (j : Fin (pairCount n d)) : HasSum (pairMarkedMixtureFactor n d q σ hd j) 1 := by classical have hc (z : Latent n) (base : Bool) : HasSum (fun counts : Obs d → ℕ => exp (-8 * (n : ℝ) * latentP n z) * ∏ o : Obs d, pairMarkedIntensity n d q σ (latentZ n z) (latentP n z) hd j base o ^ counts o / (counts o).factorial) 1 := by simp_rw [pairMarked_component_eq_poisson n d q σ (latentZ n z) (latentP n z) hd hq hσ (latentZ_eq_neg_one_or_one n z) (latentP_nonneg n z) j base] exact (summable_poissonFactorial_countVector _).hasSum_iff.mpr (poissonFactorial_countVector_tsum_one _) have havg (z : Latent n) := hasSum_sum (s := (Finset.univ : Finset Bool)) (fun base _ => (hc z base).mul_left (1 / 2 : ℝ)) have hall := hasSum_sum (s := (Finset.univ : Finset (Latent n))) (fun z _ => (havg z).mul_left (latentWeight n z)) have hfn : (fun counts => ∑ z : Latent n, latentWeight n z * ∑ base : Bool, (1 / 2 : ℝ) * (exp (-8 * (n : ℝ) * latentP n z) * ∏ o : Obs d, pairMarkedIntensity n d q σ (latentZ n z) (latentP n z) hd j base o ^ counts o / (counts o).factorial)) = pairMarkedMixtureFactor n d q σ hd j := by funext counts unfold pairMarkedMixtureFactor apply Finset.sum_congr rfl intro z _ rw [Finset.mul_sum, Finset.mul_sum] apply Finset.sum_congr rfl intro base _ ring rw [hfn] at hall simpa only [mul_one, Finset.sum_const, Finset.card_univ, Fintype.card_bool, Nat.cast_ofNat, nsmul_eq_mul, mul_div_cancel₀ _ (by norm_num : (2 : ℝ) ≠ 0), latentWeight_sum_real_count n d q hn hd hq] using hall
CausalSmith.Stat.MarNearcompleteFrontier.pairMarkedMixtureFactor_hasSum_one · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/ProductSummation.lean:75
theorem pairMarkedMixture_product_l1_le_factorial_tail

Two summable nonnegative likelihoods have a summable absolute gap. Given the specified input A, the specified input a, the specified input b, the specified input ha, the specified input hb, the specified input ha0, the specified input hb0, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
(∑' counts : Fin (pairCount n d) → (Obs d → ℕ), |(∏ j : Fin (pairCount n d), pairMarkedMixtureFactor n d q (-1) hd j (counts j)) - ∏ j : Fin (pairCount n d), pairMarkedMixtureFactor n d q 1 hd j (counts j)|)
≤ 2 * (pairCount n d : ℝ) * exponentialSeriesTail (priorK n) (16 * (n : ℝ) * priorB n)
Proof (Lean source)
-- @node: pairMarkedMixture_product_l1_le_factorial_tail lemma pairMarkedMixture_product_l1_le_factorial_tail (n d : ℕ) (q : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) : (∑' counts : Fin (pairCount n d) → (Obs d → ℕ), |(∏ j : Fin (pairCount n d), pairMarkedMixtureFactor n d q (-1) hd j (counts j)) - ∏ j : Fin (pairCount n d), pairMarkedMixtureFactor n d q 1 hd j (counts j)|) ≤ 2 * (pairCount n d : ℝ) * exponentialSeriesTail (priorK n) (16 * (n : ℝ) * priorB n) := by calc _ ≤ ∑ j : Fin (pairCount n d), ∑' counts : Obs d → ℕ, |pairMarkedMixtureFactor n d q (-1) hd j counts - pairMarkedMixtureFactor n d q 1 hd j counts| := normalized_likelihood_fin_product_l1_le (pairCount n d) _ _ (fun j => pairMarkedMixtureFactor_hasSum_one n d q (-1) hn hd hq (inl rfl) j) (fun j => pairMarkedMixtureFactor_hasSum_one n d q 1 hn hd hq (inr rfl) j) (fun j counts => pairMarkedMixtureFactor_nonneg n d q (-1) hd hq (inl rfl) j counts) (fun j counts => pairMarkedMixtureFactor_nonneg n d q 1 hd hq (inr rfl) j counts) _ ≤ ∑ _j : Fin (pairCount n d), 2 * exponentialSeriesTail (priorK n) (16 * (n : ℝ) * priorB n) := by apply Finset.sum_le_sum intro j _ exact pairMarkedMixtureFactor_l1_le_factorial_tail n d q hn hd hq j _ = _ := by simp; ring
CausalSmith.Stat.MarNearcompleteFrontier.pairMarkedMixture_product_l1_le_factorial_tail · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/ProductSummation.lean:114
CausalSmith.Stat.STAT_MarNearcompleteFrontier_Research.Helpers.LowerBound.CountMixture.Taylor 13 declarations Taylor for the paired count-mixture comparison

Taylor for the paired count-mixture comparison

theorem mixedCountLaw_singleton_factorization

The full mixed singleton likelihood is the common filler/zero-rate factor times the product of the independently averaged pair factors. Given the specified input n, the specified input d, the specified input q, the specified input hn, the specified input hd, the specified input counts, the stated mathematical conclusion holds. Given the specified input σ, the specified input hσ. Given the specified input hq.

Formal statement
n d :
ℕ
q σ :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
hσ :
σ = -1 ∨ σ = 1
counts :
Obs d → ℕ
(mixedCountLaw n d q σ hn hd hq).real {counts}
= commonCountFactor n d q hd counts * ∏ j : Fin (pairCount n d), pairMixtureFactor n d q σ hd j counts
Proof (Lean source)
lemma mixedCountLaw_singleton_factorization (n d : ℕ) (q σ : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (hσ : σ = -1 ∨ σ = 1) (counts : Obs d → ℕ) : (mixedCountLaw n d q σ hn hd hq).real {counts} = commonCountFactor n d q hd counts * ∏ j : Fin (pairCount n d), pairMixtureFactor n d q σ hd j counts := by rw [mixedCountLaw_singleton_likelihood n d q σ hn hd hq hσ counts] simp_rw [conditional_count_likelihood_block_split n d q σ hd] have hreorder (θ : Theta n d) : (thetaLaw n d q hn hd hq θ).toReal * (commonCountFactor n d q hd counts * ∏ j : Fin (pairCount n d), (exp (-8 * (n : ℝ) * latentP n (θ.1 j)) * (4 * (n : ℝ) * latentP n (θ.1 j)) ^ pairBlockCount n d hd counts j / pairBlockFactorial n d hd j counts * ∏ side : Bool, pairObservedMonomial q σ (latentZ n (θ.1 j)) (orientation θ j side) (pairLabel n d hd j side) counts)) = commonCountFactor n d q hd counts * ((thetaLaw n d q hn hd hq θ).toReal * ∏ j : Fin (pairCount n d), (exp (-8 * (n : ℝ) * latentP n (θ.1 j)) * (4 * (n : ℝ) * latentP n (θ.1 j)) ^ pairBlockCount n d hd counts j / pairBlockFactorial n d hd j counts * ∏ side : Bool, pairObservedMonomial q σ (latentZ n (θ.1 j)) (orientation θ j side) (pairLabel n d hd j side) counts)) := by ring simp_rw [hreorder] rw [← Finset.mul_sum] congr 1 exact theta_pair_likelihood_factorization n d q σ hn hd hq counts
CausalSmith.Stat.MarNearcompleteFrontier.mixedCountLaw_singleton_factorization · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/Taylor.lean:16
theorem mixedFactorizedLikelihood_countVector_tsum_one

The factorized mixed likelihood normalizes over every observed count vector; this is the aggregate Tonelli target for the later Taylor envelope. Given the specified input n, the specified input d, the specified input q, the specified input hn, the specified input hd, the stated mathematical conclusion holds. Given the specified input σ, the specified input hσ. Given the specified input hq.

Formal statement
n d :
ℕ
q σ :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
hσ :
σ = -1 ∨ σ = 1
(∑' counts : Obs d → ℕ, commonCountFactor n d q hd counts * ∏ j : Fin (pairCount n d), pairMixtureFactor n d q σ hd j counts)
= 1
Proof (Lean source)
lemma mixedFactorizedLikelihood_countVector_tsum_one (n d : ℕ) (q σ : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (hσ : σ = -1 ∨ σ = 1) : (∑' counts : Obs d → ℕ, commonCountFactor n d q hd counts * ∏ j : Fin (pairCount n d), pairMixtureFactor n d q σ hd j counts) = 1 := by letI : IsProbabilityMeasure (mixedCountLaw n d q σ hn hd hq) := by constructor unfold mixedCountLaw rw [Measure.coe_finsetSum, Finset.sum_apply] have hc (θ : Theta n d) : conditionalCountLaw n d q σ hd θ univ = 1 := by letI : IsProbabilityMeasure (conditionalCountLaw n d q σ hd θ) := by unfold conditionalCountLaw infer_instance exact measure_univ simp_rw [Measure.smul_apply, hc, smul_eq_mul, mul_one] simpa using (thetaLaw n d q hn hd hq).tsum_coe simp_rw [← mixedCountLaw_singleton_factorization n d q σ hn hd hq hσ] exact probability_real_singleton_tsum (mixedCountLaw n d q σ hn hd hq)
CausalSmith.Stat.MarNearcompleteFrontier.mixedFactorizedLikelihood_countVector_tsum_one · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/Taylor.lean:54
theorem pairMixture_product_gap_le_weighted

The product gap between the two experiment signs is bounded by the weighted pair telescope, retaining all non-target pair likelihood factors. Given the specified input n, the specified input d, the specified input q, the specified input hd, the specified input counts, the stated mathematical conclusion holds. Given the specified input hq.

Formal statement
n d :
ℕ
q :
ℝ
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
counts :
Obs d → ℕ
|(∏ j : Fin (pairCount n d), pairMixtureFactor n d q (-1) hd j counts)
- ∏ j : Fin (pairCount n d), pairMixtureFactor n d q 1 hd j counts|
≤ weightedProductTelescopeAbs (fun j : Fin (pairCount n d) => pairMixtureFactor n d q (-1) hd j counts) (fun j : Fin (pairCount n d) => pairMixtureFactor n d q 1 hd j counts) Finset.univ.toList
Proof (Lean source)
lemma pairMixture_product_gap_le_weighted (n d : ℕ) (q : ℝ) (hd : 1 ≤ d) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (counts : Obs d → ℕ) : |(∏ j : Fin (pairCount n d), pairMixtureFactor n d q (-1) hd j counts) - ∏ j : Fin (pairCount n d), pairMixtureFactor n d q 1 hd j counts| ≤ weightedProductTelescopeAbs (fun j : Fin (pairCount n d) => pairMixtureFactor n d q (-1) hd j counts) (fun j : Fin (pairCount n d) => pairMixtureFactor n d q 1 hd j counts) Finset.univ.toList := by apply abs_fintype_prod_sub_prod_le_weighted · intro j exact pairMixtureFactor_nonneg n d q (-1) hd hq (inl rfl) j counts · intro j exact pairMixtureFactor_nonneg n d q 1 hd hq (inr rfl) j counts
CausalSmith.Stat.MarNearcompleteFrontier.pairMixture_product_gap_le_weighted · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/Taylor.lean:78
theorem latent_signed_power_moment_zero Lemma latent_signed_power_moment_zero in the paper ↗

The signed latent mass cancels every power from degree two through the interpolation-node count. The nonzero first moment is the target signal. Given the specified input n, the specified input t, the specified input ht, the specified input hK, the stated mathematical conclusion holds.

Formal statement
n t :
ℕ
ht :
2 ≤ t
hK :
t ≤ priorK n
(∑ z : Latent n, latentWeight n z * latentZ n z * latentP n z ^ t) = 0
Proof (Lean source)
lemma latent_signed_power_moment_zero (n t : ℕ) (ht : 2 ≤ t) (hK : t ≤ priorK n) : (∑ z : Latent n, latentWeight n z * latentZ n z * latentP n z ^ t) = 0 := by rw [Fintype.sum_sum_type] simp only [Fintype.sum_unique, latentWeight, latentZ, latentP, mul_zero, zero_pow (by omega : t ≠ 0), add_zero] calc (∑ i : Fin (priorK n), (priorH n * |signedNodeWeight n i| / interpolationNode n i) * (if 0 ≤ signedNodeWeight n i then 1 else -1) * (priorB n * interpolationNode n i) ^ t) = priorH n * priorB n ^ t * (∑ i : Fin (priorK n), signedNodeWeight n i * interpolationNode n i ^ (t - 1)) := by rw [Finset.mul_sum] apply Finset.sum_congr rfl intro i _ have hx : interpolationNode n i ≠ 0 := ne_of_gt (latentWeight_node_pos n i) have hpow : interpolationNode n i ^ t = interpolationNode n i * interpolationNode n i ^ (t - 1) := by conv_lhs => rw [show t = (t - 1) + 1 by omega, pow_succ] ring by_cases hw : 0 ≤ signedNodeWeight n i · simp only [if_pos hw, abs_of_nonneg hw] rw [mul_pow, hpow] field_simp [hx] · have hw' : signedNodeWeight n i ≤ 0 := le_of_not_ge hw simp only [if_neg hw, abs_of_nonpos hw'] rw [mul_pow, hpow] field_simp [hx] _ = 0 := by rw [signedNodeWeight_moment_zero n (t - 1) (by omega) (by omega)] ring
CausalSmith.Stat.MarNearcompleteFrontier.latent_signed_power_moment_zero · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/Taylor.lean:98
theorem latentZ_eq_neg_one_or_one Lemma latentZ_eq_neg_one_or_one in the paper ↗

Given the specified input n, the specified input z, the stated mathematical conclusion holds.

Formal statement
n :
ℕ
z :
latentZ n z = -1 ∨ latentZ n z = 1
Proof (Lean source)
lemma latentZ_eq_neg_one_or_one (n : ℕ) (z : Latent n) : latentZ n z = -1 ∨ latentZ n z = 1 := by have h := latentZ_abs_one n z rw [abs_eq (by norm_num : (0 : ℝ) ≤ 1)] at h exact h.elim inr inl
CausalSmith.Stat.MarNearcompleteFrontier.latentZ_eq_neg_one_or_one · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/Taylor.lean:137
theorem pairBlock_taylor_coefficient_cancel

A one-pair signed likelihood coefficient vanishes whenever its observed degree plus exponential Taylor degree lies in the matched-moment range. Given the specified input n, the specified input d, the specified input r, the specified input t, the specified input q, the specified input hd, the specified input counts, the specified input hlo, the specified input hhi, the stated mathematical conclusion holds. Given the specified input j.

Formal statement
n d r t :
ℕ
q :
ℝ
hd :
1 ≤ d
j :
counts :
Obs d → ℕ
hlo :
2 ≤ r + t
hhi :
r + t ≤ priorK n
(∑ z : Latent n, latentWeight n z * ((-8 * (n : ℝ) * latentP n z) ^ t * (4 * (n : ℝ) * latentP n z) ^ r * (pairBlockMarkAverage n d q (-1) (latentZ n z) hd j counts - pairBlockMarkAverage n d q 1 (latentZ n z) hd j counts)))
= 0
Proof (Lean source)
lemma pairBlock_taylor_coefficient_cancel (n d r t : ℕ) (q : ℝ) (hd : 1 ≤ d) (j : Fin (pairCount n d)) (counts : Obs d → ℕ) (hlo : 2 ≤ r + t) (hhi : r + t ≤ priorK n) : (∑ z : Latent n, latentWeight n z * ((-8 * (n : ℝ) * latentP n z) ^ t * (4 * (n : ℝ) * latentP n z) ^ r * (pairBlockMarkAverage n d q (-1) (latentZ n z) hd j counts - pairBlockMarkAverage n d q 1 (latentZ n z) hd j counts))) = 0 := by let C : ℝ := pairBlockMarkAverage n d q (-1) 1 hd j counts - pairBlockMarkAverage n d q 1 1 hd j counts have hgap (z : Latent n) : pairBlockMarkAverage n d q (-1) (latentZ n z) hd j counts - pairBlockMarkAverage n d q 1 (latentZ n z) hd j counts = latentZ n z * C := by exact pairBlockMarkAverage_gap_factor n d q (latentZ n z) hd j counts (latentZ_eq_neg_one_or_one n z) simp_rw [hgap] calc _ = ((-8 * (n : ℝ)) ^ t * (4 * (n : ℝ)) ^ r * C) * ∑ z : Latent n, latentWeight n z * latentZ n z * latentP n z ^ (r + t) := by rw [Finset.mul_sum] apply Finset.sum_congr rfl intro z _ rw [mul_pow, mul_pow, show latentP n z ^ (r + t) = latentP n z ^ r * latentP n z ^ t by rw [pow_add]] ring _ = 0 := by rw [latent_signed_power_moment_zero n (r + t) hlo hhi] ring
CausalSmith.Stat.MarNearcompleteFrontier.pairBlock_taylor_coefficient_cancel · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/Taylor.lean:145
theorem pairBlock_low_total_coefficient_cancel

Every Taylor/observed coefficient through the matched degree vanishes: degrees zero and one use direct mark cancellation, while higher degrees use the signed latent moments. Given the specified input n, the specified input d, the specified input r, the specified input t, the specified input q, the specified input hd, the specified input counts, the specified input hr, the specified input hhi, the stated mathematical conclusion holds. Given the specified input j.

Formal statement
n d r t :
ℕ
q :
ℝ
hd :
1 ≤ d
j :
counts :
Obs d → ℕ
hr :
pairBlockCount n d hd counts j = r
hhi :
r + t ≤ priorK n
(∑ z : Latent n, latentWeight n z * ((-8 * (n : ℝ) * latentP n z) ^ t * (4 * (n : ℝ) * latentP n z) ^ r * (pairBlockMarkAverage n d q (-1) (latentZ n z) hd j counts - pairBlockMarkAverage n d q 1 (latentZ n z) hd j counts)))
= 0
Proof (Lean source)
lemma pairBlock_low_total_coefficient_cancel (n d r t : ℕ) (q : ℝ) (hd : 1 ≤ d) (j : Fin (pairCount n d)) (counts : Obs d → ℕ) (hr : pairBlockCount n d hd counts j = r) (hhi : r + t ≤ priorK n) : (∑ z : Latent n, latentWeight n z * ((-8 * (n : ℝ) * latentP n z) ^ t * (4 * (n : ℝ) * latentP n z) ^ r * (pairBlockMarkAverage n d q (-1) (latentZ n z) hd j counts - pairBlockMarkAverage n d q 1 (latentZ n z) hd j counts))) = 0 := by by_cases hlo : 2 ≤ r + t · exact pairBlock_taylor_coefficient_cancel n d r t q hd j counts hlo hhi · have hsmall : r + t = 0 ∨ r + t = 1 := by omega rcases hsmall with hzero | hone · have hr0 : r = 0 := by omega have hblock : pairBlockCount n d hd counts j = 0 := hr.trans hr0 have hgap (z : Latent n) : pairBlockMarkAverage n d q (-1) (latentZ n z) hd j counts - pairBlockMarkAverage n d q 1 (latentZ n z) hd j counts = 0 := by rw [pairBlockMarkAverage_degree_zero n d q (latentZ n z) hd j counts hblock] ring simp_rw [hgap, mul_zero, Finset.sum_const_zero] · by_cases hr0 : r = 0 · have hblock : pairBlockCount n d hd counts j = 0 := hr.trans hr0 have hgap (z : Latent n) : pairBlockMarkAverage n d q (-1) (latentZ n z) hd j counts - pairBlockMarkAverage n d q 1 (latentZ n z) hd j counts = 0 := by rw [pairBlockMarkAverage_degree_zero n d q (latentZ n z) hd j counts hblock] ring simp_rw [hgap, mul_zero, Finset.sum_const_zero] · have hr1 : r = 1 := by omega have hblock : pairBlockCount n d hd counts j = 1 := hr.trans hr1 have hgap (z : Latent n) : pairBlockMarkAverage n d q (-1) (latentZ n z) hd j counts - pairBlockMarkAverage n d q 1 (latentZ n z) hd j counts = 0 := by rw [pairBlockMarkAverage_degree_one n d q (latentZ n z) hd j counts hblock] ring simp_rw [hgap, mul_zero, Finset.sum_const_zero]
CausalSmith.Stat.MarNearcompleteFrontier.pairBlock_low_total_coefficient_cancel · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/Taylor.lean:179
theorem interpolationNode_le_one_count Lemma interpolationNode_le_one_count in the paper ↗

Given the specified input n, the stated mathematical conclusion holds. Given the specified input i.

Formal statement
n :
ℕ
i :
Proof (Lean source)
lemma interpolationNode_le_one_count (n : ℕ) (i : Fin (priorK n)) : interpolationNode n i ≤ 1 := by have hh := priorH_le_one_for_normalization n have hc := Real.cos_le_one ((i : ℝ) * pi / ((priorK n - 1 : ℕ) : ℝ)) unfold interpolationNode nlinarith
CausalSmith.Stat.MarNearcompleteFrontier.interpolationNode_le_one_count · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/Taylor.lean:221
theorem latentP_le_priorB_count Lemma latentP_le_priorB_count in the paper ↗

Given the specified input n, the specified input z, the stated mathematical conclusion holds.

Formal statement
n :
ℕ
z :
latentP n z ≤ priorB n
Proof (Lean source)
lemma latentP_le_priorB_count (n : ℕ) (z : Latent n) : latentP n z ≤ priorB n := by cases z with | inl i => simp only [latentP] exact mul_le_of_le_one_right (by unfold priorB; positivity) (interpolationNode_le_one_count n i) | inr u => simp only [latentP] unfold priorB positivity
theorem latentWeight_sum_real_count Lemma latentWeight_sum_real_count in the paper ↗

Given the specified input n, the specified input d, the specified input q, the specified input hn, the specified input hd, the stated mathematical conclusion holds. Given the specified input hq.

Formal statement
n d :
ℕ
q :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
∑ z : Latent n, latentWeight n z = 1
Proof (Lean source)
lemma latentWeight_sum_real_count (n d : ℕ) (q : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) : ∑ z : Latent n, latentWeight n z = 1 := by have h := congrArg toReal (latentWeight_sum n d q hn hd hq) rw [ENNReal.toReal_sum (fun _ _ => ENNReal.ofReal_ne_top)] at h simpa only [ENNReal.toReal_one, ENNReal.toReal_ofReal (latentWeight_nonneg_count n _)] using h
CausalSmith.Stat.MarNearcompleteFrontier.latentWeight_sum_real_count · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/Taylor.lean:245
theorem pairBlock_taylor_coefficient_abs_le

Every one-pair Taylor coefficient has the uniform absolute envelope used for the unmatched factorial tail. Given the specified input n, the specified input d, the specified input r, the specified input t, the specified input q, the specified input hn, the specified input hd, the specified input counts, the stated mathematical conclusion holds. Given the specified input hq, the specified input j.

Formal statement
n d r t :
ℕ
q :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
j :
counts :
Obs d → ℕ
|∑ z : Latent n, latentWeight n z * ((-8 * (n : ℝ) * latentP n z) ^ t * (4 * (n : ℝ) * latentP n z) ^ r * (pairBlockMarkAverage n d q (-1) (latentZ n z) hd j counts - pairBlockMarkAverage n d q 1 (latentZ n z) hd j counts))|
≤ 2 * (8 * (n : ℝ) * priorB n) ^ t * (4 * (n : ℝ) * priorB n) ^ r
Proof (Lean source)
lemma pairBlock_taylor_coefficient_abs_le (n d r t : ℕ) (q : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (j : Fin (pairCount n d)) (counts : Obs d → ℕ) : |∑ z : Latent n, latentWeight n z * ((-8 * (n : ℝ) * latentP n z) ^ t * (4 * (n : ℝ) * latentP n z) ^ r * (pairBlockMarkAverage n d q (-1) (latentZ n z) hd j counts - pairBlockMarkAverage n d q 1 (latentZ n z) hd j counts))| ≤ 2 * (8 * (n : ℝ) * priorB n) ^ t * (4 * (n : ℝ) * priorB n) ^ r := by calc _ ≤ ∑ z : Latent n, |latentWeight n z * ((-8 * (n : ℝ) * latentP n z) ^ t * (4 * (n : ℝ) * latentP n z) ^ r * (pairBlockMarkAverage n d q (-1) (latentZ n z) hd j counts - pairBlockMarkAverage n d q 1 (latentZ n z) hd j counts))| := Finset.abs_sum_le_sum_abs _ _ _ ≤ ∑ _z : Latent n, latentWeight n _z * ((8 * (n : ℝ) * priorB n) ^ t * (4 * (n : ℝ) * priorB n) ^ r * 2) := by apply Finset.sum_le_sum intro z _ have hw := latentWeight_nonneg_count n z have hp0 := latentP_nonneg n z have hpB := latentP_le_priorB_count n z have hgap := pairBlockMarkAverage_gap_le_two n d q (latentZ n z) hd j counts hq (latentZ_eq_neg_one_or_one n z) rw [abs_mul, abs_mul, abs_mul, abs_pow, abs_pow, abs_of_nonneg hw] have hn0 : (0 : ℝ) ≤ n := Nat.cast_nonneg n have hB0 : 0 ≤ priorB n := by unfold priorB; positivity have habsneg : |-8 * (n : ℝ) * latentP n z| = 8 * (n : ℝ) * latentP n z := by rw [abs_of_nonpos] · ring · exact mul_nonpos_of_nonpos_of_nonneg (mul_nonpos_of_nonpos_of_nonneg (by norm_num) hn0) hp0 have habspos : |4 * (n : ℝ) * latentP n z| = 4 * (n : ℝ) * latentP n z := by rw [abs_of_nonneg] exact mul_nonneg (mul_nonneg (by norm_num) hn0) hp0 rw [habsneg, habspos] gcongr _ = _ := by rw [← Finset.sum_mul, latentWeight_sum_real_count n d q hn hd hq] ring
CausalSmith.Stat.MarNearcompleteFrontier.pairBlock_taylor_coefficient_abs_le · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/Taylor.lean:255
theorem pairBlock_taylor_coefficient_marked_envelope

The absolute Taylor coefficient is dominated by a positive envelope that retains both legal marked likelihoods. This form can be summed by the marked component normalization without paying for the number of observed marks. Given the specified input n, the specified input d, the specified input r, the specified input t, the specified input q, the specified input hd, the specified input counts, the stated mathematical conclusion holds. Given the specified input hq, the specified input j.

Formal statement
n d r t :
ℕ
q :
ℝ
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
j :
counts :
Obs d → ℕ
|∑ z : Latent n, latentWeight n z * ((-8 * (n : ℝ) * latentP n z) ^ t * (4 * (n : ℝ) * latentP n z) ^ r * (pairBlockMarkAverage n d q (-1) (latentZ n z) hd j counts - pairBlockMarkAverage n d q 1 (latentZ n z) hd j counts))|
≤ ∑ z : Latent n, latentWeight n z * ((8 * (n : ℝ) * latentP n z) ^ t * (4 * (n : ℝ) * latentP n z) ^ r * (pairBlockMarkAverage n d q (-1) (latentZ n z) hd j counts + pairBlockMarkAverage n d q 1 (latentZ n z) hd j counts))
Proof (Lean source)
lemma pairBlock_taylor_coefficient_marked_envelope (n d r t : ℕ) (q : ℝ) (hd : 1 ≤ d) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (j : Fin (pairCount n d)) (counts : Obs d → ℕ) : |∑ z : Latent n, latentWeight n z * ((-8 * (n : ℝ) * latentP n z) ^ t * (4 * (n : ℝ) * latentP n z) ^ r * (pairBlockMarkAverage n d q (-1) (latentZ n z) hd j counts - pairBlockMarkAverage n d q 1 (latentZ n z) hd j counts))| ≤ ∑ z : Latent n, latentWeight n z * ((8 * (n : ℝ) * latentP n z) ^ t * (4 * (n : ℝ) * latentP n z) ^ r * (pairBlockMarkAverage n d q (-1) (latentZ n z) hd j counts + pairBlockMarkAverage n d q 1 (latentZ n z) hd j counts)) := by calc _ ≤ ∑ z : Latent n, |latentWeight n z * ((-8 * (n : ℝ) * latentP n z) ^ t * (4 * (n : ℝ) * latentP n z) ^ r * (pairBlockMarkAverage n d q (-1) (latentZ n z) hd j counts - pairBlockMarkAverage n d q 1 (latentZ n z) hd j counts))| := Finset.abs_sum_le_sum_abs _ _ _ ≤ _ := by apply Finset.sum_le_sum intro z _ have hw := latentWeight_nonneg_count n z have hp := latentP_nonneg n z have hz := latentZ_eq_neg_one_or_one n z have hmneg := (half_pairBlockMarkAverage_mem_unit n d q (-1) (latentZ n z) hd j counts hq (inl rfl) hz).1 have hmpos := (half_pairBlockMarkAverage_mem_unit n d q 1 (latentZ n z) hd j counts hq (inr rfl) hz).1 have hmneg0 : 0 ≤ pairBlockMarkAverage n d q (-1) (latentZ n z) hd j counts := by linarith have hmpos0 : 0 ≤ pairBlockMarkAverage n d q 1 (latentZ n z) hd j counts := by linarith rw [abs_mul, abs_mul, abs_mul, abs_pow, abs_pow, abs_of_nonneg hw] have hn0 : (0 : ℝ) ≤ n := Nat.cast_nonneg n have habsneg : |-8 * (n : ℝ) * latentP n z| = 8 * (n : ℝ) * latentP n z := by rw [abs_of_nonpos] · ring · exact mul_nonpos_of_nonpos_of_nonneg (mul_nonpos_of_nonpos_of_nonneg (by norm_num) hn0) hp have habspos : |4 * (n : ℝ) * latentP n z| = 4 * (n : ℝ) * latentP n z := by rw [abs_of_nonneg] positivity rw [habsneg, habspos] gcongr calc |pairBlockMarkAverage n d q (-1) (latentZ n z) hd j counts - pairBlockMarkAverage n d q 1 (latentZ n z) hd j counts| = |pairBlockMarkAverage n d q (-1) (latentZ n z) hd j counts + -pairBlockMarkAverage n d q 1 (latentZ n z) hd j counts| := by ring_nf _ ≤ |pairBlockMarkAverage n d q (-1) (latentZ n z) hd j counts| + |-pairBlockMarkAverage n d q 1 (latentZ n z) hd j counts| := abs_add_le _ _ _ = _ := by rw [abs_of_nonneg hmneg0, abs_neg, abs_of_nonneg hmpos0]
CausalSmith.Stat.MarNearcompleteFrontier.pairBlock_taylor_coefficient_marked_envelope · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/Taylor.lean:305
theorem pairBlock_normalized_taylor_coefficient_marked_envelope

After factorial normalization, a pair Taylor coefficient is dominated by positive normalized marked-pair factors times the compensating positive Taylor weight. Given the specified input n, the specified input d, the specified input t, the specified input q, the specified input hd, the specified input counts, the stated mathematical conclusion holds. Given the specified input hq, the specified input j.

Formal statement
n d t :
ℕ
q :
ℝ
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
j :
counts :
Obs d → ℕ
|(∑ z : Latent n, latentWeight n z * ((-8 * (n : ℝ) * latentP n z) ^ t * (4 * (n : ℝ) * latentP n z) ^ pairBlockCount n d hd counts j * (pairBlockMarkAverage n d q (-1) (latentZ n z) hd j counts - pairBlockMarkAverage n d q 1 (latentZ n z) hd j counts))) / (2 * (t.factorial : ℝ) * pairBlockFactorial n d hd j counts)|
≤ ∑ z : Latent n, latentWeight n z * (exp (8 * (n : ℝ) * latentP n z) * (8 * (n : ℝ) * latentP n z) ^ t / (t.factorial : ℝ)) * (exp (-8 * (n : ℝ) * latentP n z) * (∑ base : Bool, (1 / 2 : ℝ) * pairMarkedLocalFactor n d q (-1) (latentZ n z) (latentP n z) hd j base counts) + exp (-8 * (n : ℝ) * latentP n z) * (∑ base : Bool, (1 / 2 : ℝ) * pairMarkedLocalFactor n d q 1 (latentZ n z) (latentP n z) hd j base counts))
Proof (Lean source)
lemma pairBlock_normalized_taylor_coefficient_marked_envelope (n d t : ℕ) (q : ℝ) (hd : 1 ≤ d) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (j : Fin (pairCount n d)) (counts : Obs d → ℕ) : |(∑ z : Latent n, latentWeight n z * ((-8 * (n : ℝ) * latentP n z) ^ t * (4 * (n : ℝ) * latentP n z) ^ pairBlockCount n d hd counts j * (pairBlockMarkAverage n d q (-1) (latentZ n z) hd j counts - pairBlockMarkAverage n d q 1 (latentZ n z) hd j counts))) / (2 * (t.factorial : ℝ) * pairBlockFactorial n d hd j counts)| ≤ ∑ z : Latent n, latentWeight n z * (exp (8 * (n : ℝ) * latentP n z) * (8 * (n : ℝ) * latentP n z) ^ t / (t.factorial : ℝ)) * (exp (-8 * (n : ℝ) * latentP n z) * (∑ base : Bool, (1 / 2 : ℝ) * pairMarkedLocalFactor n d q (-1) (latentZ n z) (latentP n z) hd j base counts) + exp (-8 * (n : ℝ) * latentP n z) * (∑ base : Bool, (1 / 2 : ℝ) * pairMarkedLocalFactor n d q 1 (latentZ n z) (latentP n z) hd j base counts)) := by have hfac : 0 < pairBlockFactorial n d hd j counts := by unfold pairBlockFactorial pairLabelFactorial positivity have hden : 0 < 2 * (t.factorial : ℝ) * pairBlockFactorial n d hd j counts := by positivity rw [abs_div, abs_of_pos hden] calc _ ≤ (∑ z : Latent n, latentWeight n z * ((8 * (n : ℝ) * latentP n z) ^ t * (4 * (n : ℝ) * latentP n z) ^ pairBlockCount n d hd counts j * (pairBlockMarkAverage n d q (-1) (latentZ n z) hd j counts + pairBlockMarkAverage n d q 1 (latentZ n z) hd j counts))) / (2 * (t.factorial : ℝ) * pairBlockFactorial n d hd j counts) := by apply div_le_div_of_nonneg_right (pairBlock_taylor_coefficient_marked_envelope n d (pairBlockCount n d hd counts j) t q hd hq j counts) hden.le _ = _ := by rw [Finset.sum_div] apply Finset.sum_congr rfl intro z _ rw [← half_pairBlockMarkAverage_eq_average_localFactor n d q (-1) (latentZ n z) (latentP n z) hd j counts, ← half_pairBlockMarkAverage_eq_average_localFactor n d q 1 (latentZ n z) (latentP n z) hd j counts] rw [show -8 * (n : ℝ) * latentP n z = -(8 * (n : ℝ) * latentP n z) by ring, Real.exp_neg] field_simp
CausalSmith.Stat.MarNearcompleteFrontier.pairBlock_normalized_taylor_coefficient_marked_envelope · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/Taylor.lean:368
CausalSmith.Stat.STAT_MarNearcompleteFrontier_Research.Helpers.LowerBound.CountMixture.TaylorRemainder 12 declarations The exponential expansion is summed before taking absolute values.

Convergent unmatched Taylor remainder for one paired count block

The exponential expansion is summed before taking absolute values. All matched coefficients cancel by the latent signed moments and the low-degree mark identities.

def pairBlockTaylorCoefficient

The factorial-normalized signed coefficient of one paired count block. Given the specified input n, the specified input d, the specified input t, the specified input q, the specified input hd, the specified input counts, the stated mathematical conclusion holds. Given the specified input j.

Definition (Lean source)
n d t :
ℕ
q :
ℝ
hd :
1 ≤ d
j :
counts :
Obs d → ℕ
pairBlockTaylorCoefficient n d t q hd j counts :
ℝ
(∑ z : Latent n, latentWeight n z * ((-8 * (n : ℝ) * latentP n z) ^ t * (4 * (n : ℝ) * latentP n z) ^ pairBlockCount n d hd counts j * (pairBlockMarkAverage n d q (-1) (latentZ n z) hd j counts - pairBlockMarkAverage n d q 1 (latentZ n z) hd j counts))) / (2 * (t.factorial : ℝ) * pairBlockFactorial n d hd j counts)
theorem pairMarkedTaylorCoefficient_eq_local_of_supported

The coefficient on the full marked alphabet agrees with the original block coefficient whenever the count vector is supported on that pair. For a positive covariate dimension and a count vector supported on the selected pair, the marked Taylor coefficient equals the local block coefficient.

Formal statement
n d t :
ℕ
q :
ℝ
hd :
1 ≤ d
j :
counts :
Obs d → ℕ
hsupport :
∀ o : Obs d
if
(∀ side : Bool, o.X ≠ pairLabel n d hd j side)
then
counts o = 0
pairMarkedTaylorCoefficient n d t q hd j counts
= pairBlockTaylorCoefficient n d t q hd j counts
Proof (Lean source)
-- @node: pairMarkedTaylorCoefficient_eq_local_of_supported lemma pairMarkedTaylorCoefficient_eq_local_of_supported (n d t : ℕ) (q : ℝ) (hd : 1 ≤ d) (j : Fin (pairCount n d)) (counts : Obs d → ℕ) (hsupport : ∀ o : Obs d, (∀ side : Bool, o.X ≠ pairLabel n d hd j side) → counts o = 0) : pairMarkedTaylorCoefficient n d t q hd j counts = pairBlockTaylorCoefficient n d t q hd j counts := by unfold pairMarkedTaylorCoefficient pairBlockTaylorCoefficient rw [Finset.sum_div] apply Finset.sum_congr rfl intro z _ rw [pairMarkedDegreeGap_eq_local_of_supported n d q (latentZ n z) (latentP n z) hd j counts hsupport] ring
CausalSmith.Stat.MarNearcompleteFrontier.pairMarkedTaylorCoefficient_eq_local_of_supported · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/TaylorRemainder.lean:26
theorem pairMarkedTaylorCoefficient_eq_zero_of_unsupported

For a positive covariate dimension, if an observed atom lies outside the selected pair and has positive count, its signed marked Taylor coefficient is zero.

Formal statement
n d t :
ℕ
q :
ℝ
hd :
1 ≤ d
j :
counts :
Obs d → ℕ
o :
Obs d
ho :
∀ side : Bool, o.X ≠ pairLabel n d hd j side
hc :
counts o ≠ 0
pairMarkedTaylorCoefficient n d t q hd j counts = 0
Proof (Lean source)
-- @node: pairMarkedTaylorCoefficient_eq_zero_of_unsupported lemma pairMarkedTaylorCoefficient_eq_zero_of_unsupported (n d t : ℕ) (q : ℝ) (hd : 1 ≤ d) (j : Fin (pairCount n d)) (counts : Obs d → ℕ) (o : Obs d) (ho : ∀ side : Bool, o.X ≠ pairLabel n d hd j side) (hc : counts o ≠ 0) : pairMarkedTaylorCoefficient n d t q hd j counts = 0 := by unfold pairMarkedTaylorCoefficient pairMarkedDegreeGap simp_rw [pairMarkedIntensity_prod_eq_zero_of_unsupported n d q _ _ _ hd j _ counts o ho hc] simp
CausalSmith.Stat.MarNearcompleteFrontier.pairMarkedTaylorCoefficient_eq_zero_of_unsupported · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/TaylorRemainder.lean:43
theorem pairMixtureFactor_gap_hasSum

The signed pair likelihood has a convergent exponential Taylor expansion, with the finite latent average interchanged with the series. Given the specified input n, the specified input d, the specified input q, the specified input hd, the specified input counts, the stated mathematical conclusion holds. Given the specified input j.

Formal statement
n d :
ℕ
q :
ℝ
hd :
1 ≤ d
j :
counts :
Obs d → ℕ
HasSum (fun t => pairBlockTaylorCoefficient n d t q hd j counts) (pairMixtureFactor n d q (-1) hd j counts - pairMixtureFactor n d q 1 hd j counts)
Proof (Lean source)
-- @node: pairMixtureFactor_gap_hasSum lemma pairMixtureFactor_gap_hasSum (n d : ℕ) (q : ℝ) (hd : 1 ≤ d) (j : Fin (pairCount n d)) (counts : Obs d → ℕ) : HasSum (fun t => pairBlockTaylorCoefficient n d t q hd j counts) (pairMixtureFactor n d q (-1) hd j counts - pairMixtureFactor n d q 1 hd j counts) := by have hz (z : Latent n) : HasSum (fun t : ℕ => ((-8 * (n : ℝ) * latentP n z) ^ t / (t.factorial : ℝ)) * (latentWeight n z * (4 * (n : ℝ) * latentP n z) ^ pairBlockCount n d hd counts j * (pairBlockMarkAverage n d q (-1) (latentZ n z) hd j counts - pairBlockMarkAverage n d q 1 (latentZ n z) hd j counts) / (2 * pairBlockFactorial n d hd j counts))) (exp (-8 * (n : ℝ) * latentP n z) * (latentWeight n z * (4 * (n : ℝ) * latentP n z) ^ pairBlockCount n d hd counts j * (pairBlockMarkAverage n d q (-1) (latentZ n z) hd j counts - pairBlockMarkAverage n d q 1 (latentZ n z) hd j counts) / (2 * pairBlockFactorial n d hd j counts))) := by simpa only [Real.exp_eq_exp_ℝ] using (NormedSpace.expSeries_div_hasSum_exp (-8 * (n : ℝ) * latentP n z)).mul_right (latentWeight n z * (4 * (n : ℝ) * latentP n z) ^ pairBlockCount n d hd counts j * (pairBlockMarkAverage n d q (-1) (latentZ n z) hd j counts - pairBlockMarkAverage n d q 1 (latentZ n z) hd j counts) / (2 * pairBlockFactorial n d hd j counts)) have hs := hasSum_sum (s := (Finset.univ : Finset (Latent n))) (fun z _ => hz z) have hterm (t : ℕ) : pairBlockTaylorCoefficient n d t q hd j counts = ∑ z : Latent n, ((-8 * (n : ℝ) * latentP n z) ^ t / (t.factorial : ℝ)) * (latentWeight n z * (4 * (n : ℝ) * latentP n z) ^ pairBlockCount n d hd counts j * (pairBlockMarkAverage n d q (-1) (latentZ n z) hd j counts - pairBlockMarkAverage n d q 1 (latentZ n z) hd j counts) / (2 * pairBlockFactorial n d hd j counts)) := by unfold pairBlockTaylorCoefficient rw [Finset.sum_div] apply Finset.sum_congr rfl intro z _ ring have hsum : (∑ z : Latent n, exp (-8 * (n : ℝ) * latentP n z) * (latentWeight n z * (4 * (n : ℝ) * latentP n z) ^ pairBlockCount n d hd counts j * (pairBlockMarkAverage n d q (-1) (latentZ n z) hd j counts - pairBlockMarkAverage n d q 1 (latentZ n z) hd j counts) / (2 * pairBlockFactorial n d hd j counts))) = pairMixtureFactor n d q (-1) hd j counts - pairMixtureFactor n d q 1 hd j counts := by unfold pairMixtureFactor rw [← Finset.sum_sub_distrib] apply Finset.sum_congr rfl intro z _ ring rw [hsum] at hs exact hs.congr_fun hterm
theorem pairBlockTaylorCoefficient_eq_zero_of_matched

Every coefficient whose combined count and Taylor degree is matched is zero. Given the specified input n, the specified input d, the specified input t, the specified input q, the specified input hd, the specified input counts, the specified input hmatch, the stated mathematical conclusion holds. Given the specified input j.

Formal statement
n d t :
ℕ
q :
ℝ
hd :
1 ≤ d
j :
counts :
Obs d → ℕ
hmatch :
pairBlockCount n d hd counts j + t ≤ priorK n
pairBlockTaylorCoefficient n d t q hd j counts = 0
Proof (Lean source)
-- @node: pairBlockTaylorCoefficient_eq_zero_of_matched lemma pairBlockTaylorCoefficient_eq_zero_of_matched (n d t : ℕ) (q : ℝ) (hd : 1 ≤ d) (j : Fin (pairCount n d)) (counts : Obs d → ℕ) (hmatch : pairBlockCount n d hd counts j + t ≤ priorK n) : pairBlockTaylorCoefficient n d t q hd j counts = 0 := by unfold pairBlockTaylorCoefficient rw [pairBlock_low_total_coefficient_cancel n d (pairBlockCount n d hd counts j) t q hd j counts rfl hmatch, zero_div]
CausalSmith.Stat.MarNearcompleteFrontier.pairBlockTaylorCoefficient_eq_zero_of_matched · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/TaylorRemainder.lean:116
theorem pairMarkedTaylorCoefficient_eq_zero_of_matched

After including the zero-rate support constraint, every coefficient of matched total observed and Taylor degree vanishes on the full alphabet. For a positive covariate dimension, if the total count plus Taylor degree is within the matching range, the signed marked Taylor coefficient is zero.

Formal statement
n d t :
ℕ
q :
ℝ
hd :
1 ≤ d
j :
counts :
Obs d → ℕ
hmatch :
(∑ o : Obs d, counts o) + t ≤ priorK n
pairMarkedTaylorCoefficient n d t q hd j counts = 0
Proof (Lean source)
-- @node: pairMarkedTaylorCoefficient_eq_zero_of_matched lemma pairMarkedTaylorCoefficient_eq_zero_of_matched (n d t : ℕ) (q : ℝ) (hd : 1 ≤ d) (j : Fin (pairCount n d)) (counts : Obs d → ℕ) (hmatch : (∑ o : Obs d, counts o) + t ≤ priorK n) : pairMarkedTaylorCoefficient n d t q hd j counts = 0 := by classical by_cases hs : ∀ o : Obs d, (∀ side : Bool, o.X ≠ pairLabel n d hd j side) → counts o = 0 · rw [pairMarkedTaylorCoefficient_eq_local_of_supported n d t q hd j counts hs] apply pairBlockTaylorCoefficient_eq_zero_of_matched rw [pairBlockCount_eq_total_of_supported n d hd j counts hs] exact hmatch · push Not at hs obtain ⟨o, ho, hc⟩ := hs exact pairMarkedTaylorCoefficient_eq_zero_of_unsupported n d t q hd j counts o ho hc
CausalSmith.Stat.MarNearcompleteFrontier.pairMarkedTaylorCoefficient_eq_zero_of_matched · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/TaylorRemainder.lean:126
theorem pairMixtureFactor_gap_eq_unmatched_tsum

The full signed pair likelihood is exactly its unmatched Taylor remainder; no absolute-value relaxation is made until after the moment cancellations. Given the specified input n, the specified input d, the specified input q, the specified input hd, the specified input counts, the stated mathematical conclusion holds. Given the specified input j.

Formal statement
n d :
ℕ
q :
ℝ
hd :
1 ≤ d
j :
counts :
Obs d → ℕ
pairMixtureFactor n d q (-1) hd j counts - pairMixtureFactor n d q 1 hd j counts
= ∑' t : ℕ, if priorK n < pairBlockCount n d hd counts j
+ t then pairBlockTaylorCoefficient n d t q hd j counts else 0
Proof (Lean source)
-- @node: pairMixtureFactor_gap_eq_unmatched_tsum lemma pairMixtureFactor_gap_eq_unmatched_tsum (n d : ℕ) (q : ℝ) (hd : 1 ≤ d) (j : Fin (pairCount n d)) (counts : Obs d → ℕ) : pairMixtureFactor n d q (-1) hd j counts - pairMixtureFactor n d q 1 hd j counts = ∑' t : ℕ, if priorK n < pairBlockCount n d hd counts j + t then pairBlockTaylorCoefficient n d t q hd j counts else 0 := by rw [← (pairMixtureFactor_gap_hasSum n d q hd j counts).tsum_eq] apply tsum_congr intro t split_ifs with h · rfl · exact pairBlockTaylorCoefficient_eq_zero_of_matched n d t q hd j counts (Nat.le_of_not_gt h)
CausalSmith.Stat.MarNearcompleteFrontier.pairMixtureFactor_gap_eq_unmatched_tsum · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/TaylorRemainder.lean:144
theorem pairMixtureFactor_gap_abs_le_unmatched_tsum

The absolute pair likelihood gap is bounded by the absolutely convergent unmatched coefficient series. Given the specified input n, the specified input d, the specified input q, the specified input hd, the specified input counts, the stated mathematical conclusion holds. Given the specified input j.

Formal statement
n d :
ℕ
q :
ℝ
hd :
1 ≤ d
j :
counts :
Obs d → ℕ
|pairMixtureFactor n d q (-1) hd j counts - pairMixtureFactor n d q 1 hd j counts|
≤ ∑' t : ℕ, if priorK n < pairBlockCount n d hd counts j
+ t then |pairBlockTaylorCoefficient n d t q hd j counts| else 0
Proof (Lean source)
-- @node: pairMixtureFactor_gap_abs_le_unmatched_tsum lemma pairMixtureFactor_gap_abs_le_unmatched_tsum (n d : ℕ) (q : ℝ) (hd : 1 ≤ d) (j : Fin (pairCount n d)) (counts : Obs d → ℕ) : |pairMixtureFactor n d q (-1) hd j counts - pairMixtureFactor n d q 1 hd j counts| ≤ ∑' t : ℕ, if priorK n < pairBlockCount n d hd counts j + t then |pairBlockTaylorCoefficient n d t q hd j counts| else 0 := by let E : Set ℕ := {t | priorK n < pairBlockCount n d hd counts j + t} have hs := (pairMixtureFactor_gap_hasSum n d q hd j counts).summable.indicator E rw [pairMixtureFactor_gap_eq_unmatched_tsum] have hn := norm_tsum_le_tsum_norm hs.norm simpa only [Real.norm_eq_abs, indicator, E, Set.mem_ofPred_eq, apply_ite abs, abs_zero] using hn
CausalSmith.Stat.MarNearcompleteFrontier.pairMixtureFactor_gap_abs_le_unmatched_tsum · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/TaylorRemainder.lean:161
theorem pairBlockTaylorCoefficient_abs_le_factorial

Each normalized coefficient has a factorial envelope, uniform over the legal arrival floor and over all latent nodes. Given the specified input n, the specified input d, the specified input t, the specified input q, the specified input hn, the specified input hd, the specified input counts, the stated mathematical conclusion holds. Given the specified input hq, the specified input j.

Formal statement
n d t :
ℕ
q :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
j :
counts :
Obs d → ℕ
|pairBlockTaylorCoefficient n d t q hd j counts|
≤ ((8 * (n : ℝ) * priorB n) ^ t / (t.factorial : ℝ)) * ((4 * (n : ℝ) * priorB n) ^ pairBlockCount n d hd counts j / pairBlockFactorial n d hd j counts)
Proof (Lean source)
-- @node: pairBlockTaylorCoefficient_abs_le_factorial lemma pairBlockTaylorCoefficient_abs_le_factorial (n d t : ℕ) (q : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (j : Fin (pairCount n d)) (counts : Obs d → ℕ) : |pairBlockTaylorCoefficient n d t q hd j counts| ≤ ((8 * (n : ℝ) * priorB n) ^ t / (t.factorial : ℝ)) * ((4 * (n : ℝ) * priorB n) ^ pairBlockCount n d hd counts j / pairBlockFactorial n d hd j counts) := by have hfac : 0 < pairBlockFactorial n d hd j counts := by unfold pairBlockFactorial pairLabelFactorial positivity have hden : 0 < 2 * (t.factorial : ℝ) * pairBlockFactorial n d hd j counts := by positivity unfold pairBlockTaylorCoefficient rw [abs_div, abs_of_pos hden] calc _ ≤ (2 * (8 * (n : ℝ) * priorB n) ^ t * (4 * (n : ℝ) * priorB n) ^ pairBlockCount n d hd counts j) / (2 * (t.factorial : ℝ) * pairBlockFactorial n d hd j counts) := div_le_div_of_nonneg_right (pairBlock_taylor_coefficient_abs_le n d (pairBlockCount n d hd counts j) t q hn hd hq j counts) hden.le _ = _ := by ring
CausalSmith.Stat.MarNearcompleteFrontier.pairBlockTaylorCoefficient_abs_le_factorial · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/TaylorRemainder.lean:177
theorem pairMixtureFactor_gap_abs_le_factorial_remainder

For a fixed observed block, only Taylor terms above the matched combined degree contribute to the signed likelihood gap. Given the specified input n, the specified input d, the specified input q, the specified input hn, the specified input hd, the specified input counts, the stated mathematical conclusion holds. Given the specified input hq, the specified input j.

Formal statement
n d :
ℕ
q :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
j :
counts :
Obs d → ℕ
|pairMixtureFactor n d q (-1) hd j counts - pairMixtureFactor n d q 1 hd j counts|
≤ ∑' t : ℕ, if priorK n < pairBlockCount n d hd counts j
+ t then ((8 * (n : ℝ) * priorB n) ^ t / (t.factorial : ℝ)) * ((4 * (n : ℝ) * priorB n) ^ pairBlockCount n d hd counts j / pairBlockFactorial n d hd j counts) else 0
Proof (Lean source)
-- @node: pairMixtureFactor_gap_abs_le_factorial_remainder lemma pairMixtureFactor_gap_abs_le_factorial_remainder (n d : ℕ) (q : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (j : Fin (pairCount n d)) (counts : Obs d → ℕ) : |pairMixtureFactor n d q (-1) hd j counts - pairMixtureFactor n d q 1 hd j counts| ≤ ∑' t : ℕ, if priorK n < pairBlockCount n d hd counts j + t then ((8 * (n : ℝ) * priorB n) ^ t / (t.factorial : ℝ)) * ((4 * (n : ℝ) * priorB n) ^ pairBlockCount n d hd counts j / pairBlockFactorial n d hd j counts) else 0 := by let E : Set ℕ := {t | priorK n < pairBlockCount n d hd counts j + t} have hleft := (pairMixtureFactor_gap_hasSum n d q hd j counts).summable.norm.indicator E have hright := ((Real.summable_pow_div_factorial (8 * (n : ℝ) * priorB n)).mul_right ((4 * (n : ℝ) * priorB n) ^ pairBlockCount n d hd counts j / pairBlockFactorial n d hd j counts)).indicator E refine (pairMixtureFactor_gap_abs_le_unmatched_tsum n d q hd j counts).trans ?_ apply Summable.tsum_le_tsum · intro t split_ifs · exact pairBlockTaylorCoefficient_abs_le_factorial n d t q hn hd hq j counts · rfl · exact hleft.congr (fun t => by simp [indicator, E, Real.norm_eq_abs]) · exact hright.congr (fun t => by simp [indicator, E])
CausalSmith.Stat.MarNearcompleteFrontier.pairMixtureFactor_gap_abs_le_factorial_remainder · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/TaylorRemainder.lean:203
theorem pairMarkedTaylorCoefficient_total_degree_l1

At each combined degree, the matched coefficients vanish and the unmatched marked coefficients have the factorial envelope at twice the maximal pair intensity. Given the specified input n, the specified input d, the specified input s, the specified input q, the specified input hn, the specified input hd, the stated mathematical conclusion holds. Given the specified input hq, the specified input j.

Formal statement
n d s :
ℕ
q :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
j :
(∑ r ∈ range (s + 1), ∑ counts ∈ (Finset.univ : Finset (Obs d)).piAntidiag r, |pairMarkedTaylorCoefficient n d (s - r) q hd j counts|)
≤ if priorK n < s then 2 * (16 * (n : ℝ) * priorB n) ^ s / (s.factorial : ℝ) else 0
Proof (Lean source)
-- @node: pairMarkedTaylorCoefficient_total_degree_l1 lemma pairMarkedTaylorCoefficient_total_degree_l1 (n d s : ℕ) (q : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (j : Fin (pairCount n d)) : (∑ r ∈ range (s + 1), ∑ counts ∈ (Finset.univ : Finset (Obs d)).piAntidiag r, |pairMarkedTaylorCoefficient n d (s - r) q hd j counts|) ≤ if priorK n < s then 2 * (16 * (n : ℝ) * priorB n) ^ s / (s.factorial : ℝ) else 0 := by classical by_cases hs : priorK n < s · rw [if_pos hs] calc _ ≤ ∑ r ∈ range (s + 1), 2 * ((8 * (n : ℝ) * priorB n) ^ (s - r) / ((s - r).factorial : ℝ)) * ((8 * (n : ℝ) * priorB n) ^ r / (r.factorial : ℝ)) := by apply Finset.sum_le_sum intro r _ exact pairMarkedTaylorCoefficient_fixed_degree_l1 n d r (s - r) q hn hd hq j _ = 2 * ∑ r ∈ range (s + 1), ((8 * (n : ℝ) * priorB n) ^ r / (r.factorial : ℝ)) * ((8 * (n : ℝ) * priorB n) ^ (s - r) / ((s - r).factorial : ℝ)) := by rw [Finset.mul_sum] apply Finset.sum_congr rfl intro r _ ring _ = _ := by rw [factorial_series_convolution] rw [show 8 * (n : ℝ) * priorB n + 8 * (n : ℝ) * priorB n = 16 * (n : ℝ) * priorB n by ring] ring · rw [if_neg hs] apply le_of_eq apply Finset.sum_eq_zero intro r hr have hrs : r ≤ s := le_of_lt_succ (Finset.mem_range.mp hr) apply Finset.sum_eq_zero intro counts hc have hcount : ∑ o : Obs d, counts o = r := (Finset.mem_piAntidiag.mp hc).1 rw [pairMarkedTaylorCoefficient_eq_zero_of_matched, abs_zero] rw [hcount, Nat.add_sub_of_le hrs] exact Nat.le_of_not_gt hs
CausalSmith.Stat.MarNearcompleteFrontier.pairMarkedTaylorCoefficient_total_degree_l1 · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/TaylorRemainder.lean:231
theorem pairMarkedTaylorCoefficient_degree_tsum_le_factorial_tail

The absolutely summed marked Taylor coefficients are bounded by twice the unmatched exponential-series tail. Matched degrees have been removed using the signed latent moments before this summation. Given the specified input n, the specified input d, the specified input q, the specified input hn, the specified input hd, the stated mathematical conclusion holds. Given the specified input hq, the specified input j.

Formal statement
n d :
ℕ
q :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
j :
(∑' s : ℕ, ∑ r ∈ range (s + 1), ∑ counts ∈ (Finset.univ : Finset (Obs d)).piAntidiag r, |pairMarkedTaylorCoefficient n d (s - r) q hd j counts|)
≤ 2 * exponentialSeriesTail (priorK n) (16 * (n : ℝ) * priorB n)
Proof (Lean source)
-- @node: pairMarkedTaylorCoefficient_degree_tsum_le_factorial_tail lemma pairMarkedTaylorCoefficient_degree_tsum_le_factorial_tail (n d : ℕ) (q : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (j : Fin (pairCount n d)) : (∑' s : ℕ, ∑ r ∈ range (s + 1), ∑ counts ∈ (Finset.univ : Finset (Obs d)).piAntidiag r, |pairMarkedTaylorCoefficient n d (s - r) q hd j counts|) ≤ 2 * exponentialSeriesTail (priorK n) (16 * (n : ℝ) * priorB n) := by classical let f : ℕ → ℝ := fun s => ∑ r ∈ range (s + 1), ∑ counts ∈ (Finset.univ : Finset (Obs d)).piAntidiag r, |pairMarkedTaylorCoefficient n d (s - r) q hd j counts| let g : ℕ → ℝ := fun s => if priorK n < s then 2 * (16 * (n : ℝ) * priorB n) ^ s / (s.factorial : ℝ) else 0 have hle (s : ℕ) : f s ≤ g s := pairMarkedTaylorCoefficient_total_degree_l1 n d s q hn hd hq j have hg : Summable g := by have h := ((Real.summable_pow_div_factorial (16 * (n : ℝ) * priorB n)).mul_left 2).indicator {s : ℕ | priorK n < s} exact h.congr (fun s => by simp [g, indicator, mul_div_assoc]) have hf : Summable f := Summable.of_nonneg_of_le (fun s => Finset.sum_nonneg (fun r _ => Finset.sum_nonneg (fun counts _ => abs_nonneg _))) hle hg calc _ ≤ ∑' s : ℕ, g s := hf.tsum_le_tsum hle hg _ = _ := by unfold exponentialSeriesTail rw [← tsum_mul_left] apply tsum_congr intro s by_cases hs : priorK n < s <;> simp [g, hs, mul_div_assoc]
CausalSmith.Stat.MarNearcompleteFrontier.pairMarkedTaylorCoefficient_degree_tsum_le_factorial_tail · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/TaylorRemainder.lean:277
CausalSmith.Stat.STAT_MarNearcompleteFrontier_Research.Helpers.LowerBound.CountMixture.TaylorSummation 9 declarations Reindex the Taylor degree and observed counts by their combined degree.

Absolute summation of the marked Taylor series

Reindex the Taylor degree and observed counts by their combined degree. This turns the finite multinomial coefficient bounds into an absolutely convergent series on the full count alphabet.

theorem pairMarkedTaylorCoefficient_degree_summable

For a sample size, alphabet size, arrival parameter, positive-sample witness, positive-alphabet witness, admissible-arrival witness, and pair index, the sequence of absolute marked Taylor coefficients grouped by combined Taylor and count degree is summable.

Formal statement
n d :
ℕ
q :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
j :
Summable (fun s : ℕ => ∑ r ∈ range (s + 1), ∑ counts ∈ (Finset.univ : Finset (Obs d)).piAntidiag r, |pairMarkedTaylorCoefficient n d (s - r) q hd j counts|)
Proof (Lean source)
-- @node: pairMarkedTaylorCoefficient_degree_summable lemma pairMarkedTaylorCoefficient_degree_summable (n d : ℕ) (q : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (j : Fin (pairCount n d)) : Summable (fun s : ℕ => ∑ r ∈ range (s + 1), ∑ counts ∈ (Finset.univ : Finset (Obs d)).piAntidiag r, |pairMarkedTaylorCoefficient n d (s - r) q hd j counts|) := by classical let g : ℕ → ℝ := fun s => if priorK n < s then 2 * (16 * (n : ℝ) * priorB n) ^ s / (s.factorial : ℝ) else 0 have hg : Summable g := by have h := ((Real.summable_pow_div_factorial (16 * (n : ℝ) * priorB n)).mul_left 2).indicator {s : ℕ | priorK n < s} exact h.congr (fun s => by simp [g, indicator, mul_div_assoc]) exact Summable.of_nonneg_of_le (fun s => Finset.sum_nonneg (fun r _ => Finset.sum_nonneg (fun counts _ => abs_nonneg _))) (fun s => pairMarkedTaylorCoefficient_total_degree_l1 n d s q hn hd hq j) hg
CausalSmith.Stat.MarNearcompleteFrontier.pairMarkedTaylorCoefficient_degree_summable · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/TaylorSummation.lean:19
theorem pairMarkedTaylorCoefficient_joint_summable

The marked coefficients are absolutely summable jointly over Taylor degree and all observed count vectors. Given the specified input n, the specified input d, the specified input q, the specified input hn, the specified input hd, the stated mathematical conclusion holds. Given the specified input hq, the specified input j.

Formal statement
n d :
ℕ
q :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
j :
Summable (fun x : ℕ × (Obs d → ℕ) => |pairMarkedTaylorCoefficient n d x.1 q hd j x.2|)
Proof (Lean source)
-- @node: pairMarkedTaylorCoefficient_joint_summable lemma pairMarkedTaylorCoefficient_joint_summable (n d : ℕ) (q : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (j : Fin (pairCount n d)) : Summable (fun x : ℕ × (Obs d → ℕ) => |pairMarkedTaylorCoefficient n d x.1 q hd j x.2|) := by classical exact summable_countTaylor_of_degree (I := Obs d) (fun t counts => |pairMarkedTaylorCoefficient n d t q hd j counts|) (fun _ _ => abs_nonneg _) (pairMarkedTaylorCoefficient_degree_summable n d q hn hd hq j)
CausalSmith.Stat.MarNearcompleteFrontier.pairMarkedTaylorCoefficient_joint_summable · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/TaylorSummation.lean:43
theorem pairMarkedTaylorCoefficient_joint_tsum_le_factorial_tail

The full absolute Taylor/count sum obeys the same unmatched factorial tail as the finite combined-degree sums. Given the specified input n, the specified input d, the specified input q, the specified input hn, the specified input hd, the stated mathematical conclusion holds. Given the specified input hq, the specified input j.

Formal statement
n d :
ℕ
q :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
j :
(∑' x : ℕ × (Obs d → ℕ), |pairMarkedTaylorCoefficient n d x.1 q hd j x.2|)
≤ 2 * exponentialSeriesTail (priorK n) (16 * (n : ℝ) * priorB n)
Proof (Lean source)
-- @node: pairMarkedTaylorCoefficient_joint_tsum_le_factorial_tail lemma pairMarkedTaylorCoefficient_joint_tsum_le_factorial_tail (n d : ℕ) (q : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (j : Fin (pairCount n d)) : (∑' x : ℕ × (Obs d → ℕ), |pairMarkedTaylorCoefficient n d x.1 q hd j x.2|) ≤ 2 * exponentialSeriesTail (priorK n) (16 * (n : ℝ) * priorB n) := by classical rw [tsum_countTaylor_eq_degree (I := Obs d) (fun t counts => |pairMarkedTaylorCoefficient n d t q hd j counts|) (pairMarkedTaylorCoefficient_joint_summable n d q hn hd hq j)] exact pairMarkedTaylorCoefficient_degree_tsum_le_factorial_tail n d q hn hd hq j
CausalSmith.Stat.MarNearcompleteFrontier.pairMarkedTaylorCoefficient_joint_tsum_le_factorial_tail · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/TaylorSummation.lean:57
def pairMarkedMixtureFactor

The one-pair mixture likelihood on the full observed count alphabet, including the zero rates outside that pair. Given the specified input n, the specified input d, the specified input q, the specified input hd, the specified input counts, the stated mathematical conclusion holds. Given the specified input σ. Given the specified input j.

Definition (Lean source)
n d :
ℕ
q σ :
ℝ
hd :
1 ≤ d
j :
counts :
Obs d → ℕ
pairMarkedMixtureFactor n d q σ hd j counts :
ℝ
∑ z : Latent n, latentWeight n z * exp (-8 * (n : ℝ) * latentP n z) * ∑ base : Bool, (1 / 2 : ℝ) * ∏ o : Obs d, pairMarkedIntensity n d q σ (latentZ n z) (latentP n z) hd j base o ^ counts o / (counts o).factorial
theorem pairMarkedMixtureFactor_eq_local_of_supported

For a positive covariate dimension and a count vector supported on the selected pair, the full-alphabet pair mixture likelihood equals its local counterpart.

Formal statement
n d :
ℕ
q σ :
ℝ
hd :
1 ≤ d
j :
counts :
Obs d → ℕ
hs :
∀ o : Obs d
if
(∀ side : Bool, o.X ≠ pairLabel n d hd j side)
then
counts o = 0
pairMarkedMixtureFactor n d q σ hd j counts = pairMixtureFactor n d q σ hd j counts
Proof (Lean source)
-- @node: pairMarkedMixtureFactor_eq_local_of_supported lemma pairMarkedMixtureFactor_eq_local_of_supported (n d : ℕ) (q σ : ℝ) (hd : 1 ≤ d) (j : Fin (pairCount n d)) (counts : Obs d → ℕ) (hs : ∀ o : Obs d, (∀ side : Bool, o.X ≠ pairLabel n d hd j side) → counts o = 0) : pairMarkedMixtureFactor n d q σ hd j counts = pairMixtureFactor n d q σ hd j counts := by unfold pairMarkedMixtureFactor pairMixtureFactor apply Finset.sum_congr rfl intro z _ simp_rw [pairMarkedIntensity_prod_eq_local_of_supported n d q σ (latentZ n z) (latentP n z) hd j _ counts hs] rw [← half_pairBlockMarkAverage_eq_average_localFactor] ring
CausalSmith.Stat.MarNearcompleteFrontier.pairMarkedMixtureFactor_eq_local_of_supported · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/TaylorSummation.lean:83
theorem pairMarkedMixtureFactor_eq_zero_of_unsupported

A count at a zero-rate atom makes the full pair likelihood vanish. Given the specified input n, the specified input d, the specified input q, the specified input hd, the specified input counts, the specified input o, the specified input ho, the specified input hc, the stated mathematical conclusion holds. Given the specified input σ. Given the specified input j.

Formal statement
n d :
ℕ
q σ :
ℝ
hd :
1 ≤ d
j :
counts :
Obs d → ℕ
o :
Obs d
ho :
∀ side : Bool, o.X ≠ pairLabel n d hd j side
hc :
counts o ≠ 0
pairMarkedMixtureFactor n d q σ hd j counts = 0
Proof (Lean source)
-- @node: pairMarkedMixtureFactor_eq_zero_of_unsupported lemma pairMarkedMixtureFactor_eq_zero_of_unsupported (n d : ℕ) (q σ : ℝ) (hd : 1 ≤ d) (j : Fin (pairCount n d)) (counts : Obs d → ℕ) (o : Obs d) (ho : ∀ side : Bool, o.X ≠ pairLabel n d hd j side) (hc : counts o ≠ 0) : pairMarkedMixtureFactor n d q σ hd j counts = 0 := by unfold pairMarkedMixtureFactor simp_rw [pairMarkedIntensity_prod_eq_zero_of_unsupported n d q σ _ _ hd j _ counts o ho hc] simp
CausalSmith.Stat.MarNearcompleteFrontier.pairMarkedMixtureFactor_eq_zero_of_unsupported · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/TaylorSummation.lean:99
theorem pairMarkedMixtureFactor_gap_hasSum

The full marked likelihood gap is the sum of its Taylor coefficients; unsupported count vectors have both sides zero. Given the specified input n, the specified input d, the specified input q, the specified input hd, the specified input counts, the stated mathematical conclusion holds. Given the specified input j.

Formal statement
n d :
ℕ
q :
ℝ
hd :
1 ≤ d
j :
counts :
Obs d → ℕ
HasSum (fun t => pairMarkedTaylorCoefficient n d t q hd j counts) (pairMarkedMixtureFactor n d q (-1) hd j counts - pairMarkedMixtureFactor n d q 1 hd j counts)
Proof (Lean source)
-- @node: pairMarkedMixtureFactor_gap_hasSum lemma pairMarkedMixtureFactor_gap_hasSum (n d : ℕ) (q : ℝ) (hd : 1 ≤ d) (j : Fin (pairCount n d)) (counts : Obs d → ℕ) : HasSum (fun t => pairMarkedTaylorCoefficient n d t q hd j counts) (pairMarkedMixtureFactor n d q (-1) hd j counts - pairMarkedMixtureFactor n d q 1 hd j counts) := by classical by_cases hs : ∀ o : Obs d, (∀ side : Bool, o.X ≠ pairLabel n d hd j side) → counts o = 0 · simp_rw [pairMarkedTaylorCoefficient_eq_local_of_supported n d _ q hd j counts hs] rw [pairMarkedMixtureFactor_eq_local_of_supported n d q (-1) hd j counts hs, pairMarkedMixtureFactor_eq_local_of_supported n d q 1 hd j counts hs] exact pairMixtureFactor_gap_hasSum n d q hd j counts · push Not at hs obtain ⟨o, ho, hc⟩ := hs simp_rw [pairMarkedTaylorCoefficient_eq_zero_of_unsupported n d _ q hd j counts o ho hc] rw [pairMarkedMixtureFactor_eq_zero_of_unsupported n d q (-1) hd j counts o ho hc, pairMarkedMixtureFactor_eq_zero_of_unsupported n d q 1 hd j counts o ho hc, sub_self] exact hasSum_zero
CausalSmith.Stat.MarNearcompleteFrontier.pairMarkedMixtureFactor_gap_hasSum · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/TaylorSummation.lean:111
theorem pairMarkedMixtureFactor_gap_abs_le_tsum

The one-pair likelihood gap is bounded by the absolute coefficient series. Given the specified input n, the specified input d, the specified input q, the specified input hd, the specified input counts, the stated mathematical conclusion holds. Given the specified input j.

Formal statement
n d :
ℕ
q :
ℝ
hd :
1 ≤ d
j :
counts :
Obs d → ℕ
|pairMarkedMixtureFactor n d q (-1) hd j counts
- pairMarkedMixtureFactor n d q 1 hd j counts|
≤ ∑' t : ℕ, |pairMarkedTaylorCoefficient n d t q hd j counts|
Proof (Lean source)
-- @node: pairMarkedMixtureFactor_gap_abs_le_tsum lemma pairMarkedMixtureFactor_gap_abs_le_tsum (n d : ℕ) (q : ℝ) (hd : 1 ≤ d) (j : Fin (pairCount n d)) (counts : Obs d → ℕ) : |pairMarkedMixtureFactor n d q (-1) hd j counts - pairMarkedMixtureFactor n d q 1 hd j counts| ≤ ∑' t : ℕ, |pairMarkedTaylorCoefficient n d t q hd j counts| := by have hs := pairMarkedMixtureFactor_gap_hasSum n d q hd j counts rw [← hs.tsum_eq] simpa only [Real.norm_eq_abs] using norm_tsum_le_tsum_norm hs.summable.norm
CausalSmith.Stat.MarNearcompleteFrontier.pairMarkedMixtureFactor_gap_abs_le_tsum · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/TaylorSummation.lean:133
theorem pairMarkedMixtureFactor_l1_le_factorial_tail

Summing every count vector yields the paper's one-pair L1 bound. The matched moments have already canceled before any absolute summation. Given the specified input n, the specified input d, the specified input q, the specified input hn, the specified input hd, the stated mathematical conclusion holds. Given the specified input hq, the specified input j.

Formal statement
n d :
ℕ
q :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
j :
(∑' counts : Obs d → ℕ, |pairMarkedMixtureFactor n d q (-1) hd j counts - pairMarkedMixtureFactor n d q 1 hd j counts|)
≤ 2 * exponentialSeriesTail (priorK n) (16 * (n : ℝ) * priorB n)
Proof (Lean source)
-- @node: pairMarkedMixtureFactor_l1_le_factorial_tail lemma pairMarkedMixtureFactor_l1_le_factorial_tail (n d : ℕ) (q : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (j : Fin (pairCount n d)) : (∑' counts : Obs d → ℕ, |pairMarkedMixtureFactor n d q (-1) hd j counts - pairMarkedMixtureFactor n d q 1 hd j counts|) ≤ 2 * exponentialSeriesTail (priorK n) (16 * (n : ℝ) * priorB n) := by have hs := pairMarkedTaylorCoefficient_joint_summable n d q hn hd hq j have ht : Summable (fun x : (Obs d → ℕ) × ℕ => |pairMarkedTaylorCoefficient n d x.2 q hd j x.1|) := hs.prod_symm have he := ht.prod have hpoint := pairMarkedMixtureFactor_gap_abs_le_tsum n d q hd j have hg : Summable (fun counts : Obs d → ℕ => |pairMarkedMixtureFactor n d q (-1) hd j counts - pairMarkedMixtureFactor n d q 1 hd j counts|) := Summable.of_nonneg_of_le (fun counts => abs_nonneg (pairMarkedMixtureFactor n d q (-1) hd j counts - pairMarkedMixtureFactor n d q 1 hd j counts)) hpoint he calc _ ≤ ∑' counts : Obs d → ℕ, ∑' t : ℕ, |pairMarkedTaylorCoefficient n d t q hd j counts| := hg.tsum_le_tsum hpoint he _ = ∑' x : ℕ × (Obs d → ℕ), |pairMarkedTaylorCoefficient n d x.1 q hd j x.2| := by rw [← ht.tsum_prod] exact (Equiv.prodComm (Obs d → ℕ) ℕ).tsum_eq (fun x : ℕ × (Obs d → ℕ) => |pairMarkedTaylorCoefficient n d x.1 q hd j x.2|) _ ≤ _ := pairMarkedTaylorCoefficient_joint_tsum_le_factorial_tail n d q hn hd hq j
CausalSmith.Stat.MarNearcompleteFrontier.pairMarkedMixtureFactor_l1_le_factorial_tail · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/TaylorSummation.lean:144
CausalSmith.Stat.STAT_MarNearcompleteFrontier_Research.Helpers.LowerBound.CountMixture.Telescope 16 declarations Telescope for the paired count-mixture comparison

Telescope for the paired count-mixture comparison

def labelPoissonFactor

Product-Poisson likelihood factor restricted to one baseline label. Given the specified input rate, the specified input x, the specified input counts, the stated mathematical conclusion holds.

Definition (Lean source)
d :
ℕ
shared
rate :
Obs d → ℝ≥0
x :
Fin d
counts :
Obs d → ℕ
labelPoissonFactor rate x counts :
ℝ
∏ o : Obs d, if o.X
= x then exp (-(rate o : ℝ)) * (rate o : ℝ) ^ counts o / (counts o).factorial else 1
theorem prod_labelPoissonFactor

Multiplying all baseline-label-local Poisson factors recovers the full observed-coordinate product likelihood. Given the specified input rate, the specified input counts, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
shared
rate :
Obs d → ℝ≥0
counts :
Obs d → ℕ
(∏ x : Fin d, labelPoissonFactor rate x counts)
= ∏ o : Obs d, exp (-(rate o : ℝ)) * (rate o : ℝ) ^ counts o / (counts o).factorial
Proof (Lean source)
lemma prod_labelPoissonFactor (rate : Obs d → ℝ≥0) (counts : Obs d → ℕ) : (∏ x : Fin d, labelPoissonFactor rate x counts) = ∏ o : Obs d, exp (-(rate o : ℝ)) * (rate o : ℝ) ^ counts o / (counts o).factorial := by unfold labelPoissonFactor exact (prod_by_observed_label fun o : Obs d => exp (-(rate o : ℝ)) * (rate o : ℝ) ^ counts o / (counts o).factorial).symm
theorem labelPoissonFactor_countVector_tsum_one

The product of all local baseline-label Poisson factors sums to one over the full observed count-vector space. Given the specified input rate, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
shared
rate :
Obs d → ℝ≥0
(∑' counts : Obs d → ℕ, ∏ x : Fin d, labelPoissonFactor rate x counts) = 1
Proof (Lean source)
lemma labelPoissonFactor_countVector_tsum_one (rate : Obs d → ℝ≥0) : (∑' counts : Obs d → ℕ, ∏ x : Fin d, labelPoissonFactor rate x counts) = 1 := by rw [show (∑' counts : Obs d → ℕ, ∏ x : Fin d, labelPoissonFactor rate x counts) = ∑' counts : Obs d → ℕ, ∏ o : Obs d, exp (-(rate o : ℝ)) * (rate o : ℝ) ^ counts o / (counts o).factorial by apply tsum_congr exact prod_labelPoissonFactor rate] exact poissonFactorial_countVector_tsum_one rate
CausalSmith.Stat.MarNearcompleteFrontier.labelPoissonFactor_countVector_tsum_one · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/Telescope.lean:43
def assembledLabelRate

Global observed-coordinate rate assembled from one local rate family per baseline label. Given the specified input localRate, the specified input o, the stated mathematical conclusion holds.

Definition (Lean source)
d :
ℕ
shared
localRate :
Fin d → Obs d → ℝ≥0
o :
Obs d
assembledLabelRate localRate o :
ℝ≥0
localRate o.X o
def localLabelPoissonFactor

Poisson factor at one baseline label using that label's member of a local rate family. Given the specified input localRate, the specified input x, the specified input counts, the stated mathematical conclusion holds.

Definition (Lean source)
d :
ℕ
shared
localRate :
Fin d → Obs d → ℝ≥0
x :
Fin d
counts :
Obs d → ℕ
localLabelPoissonFactor localRate x counts :
ℝ
∏ o : Obs d, if o.X
= x then exp (-(localRate x o : ℝ)) * (localRate x o : ℝ) ^ counts o / (counts o).factorial else 1
theorem localLabelPoissonFactor_eq_assembled

At each label, the local-family factor agrees with the corresponding factor of the globally assembled rate. Given the specified input localRate, the specified input x, the specified input counts, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
shared
localRate :
Fin d → Obs d → ℝ≥0
x :
Fin d
counts :
Obs d → ℕ
localLabelPoissonFactor localRate x counts
= labelPoissonFactor (assembledLabelRate localRate) x counts
Proof (Lean source)
lemma localLabelPoissonFactor_eq_assembled (localRate : Fin d → Obs d → ℝ≥0) (x : Fin d) (counts : Obs d → ℕ) : localLabelPoissonFactor localRate x counts = labelPoissonFactor (assembledLabelRate localRate) x counts := by unfold localLabelPoissonFactor labelPoissonFactor assembledLabelRate apply Finset.prod_congr rfl intro o _ by_cases ho : o.X = x · subst x simp · simp [ho]
CausalSmith.Stat.MarNearcompleteFrontier.localLabelPoissonFactor_eq_assembled · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/Telescope.lean:74
theorem localLabelPoissonFactor_countVector_tsum_one

Arbitrary nonnegative local rate families normalize jointly after their disjoint baseline-label supports are assembled. Given the specified input localRate, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
shared
localRate :
Fin d → Obs d → ℝ≥0
(∑' counts : Obs d → ℕ, ∏ x : Fin d, localLabelPoissonFactor localRate x counts) = 1
Proof (Lean source)
lemma localLabelPoissonFactor_countVector_tsum_one (localRate : Fin d → Obs d → ℝ≥0) : (∑' counts : Obs d → ℕ, ∏ x : Fin d, localLabelPoissonFactor localRate x counts) = 1 := by simp_rw [localLabelPoissonFactor_eq_assembled] exact labelPoissonFactor_countVector_tsum_one (assembledLabelRate localRate)
CausalSmith.Stat.MarNearcompleteFrontier.localLabelPoissonFactor_countVector_tsum_one · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/Telescope.lean:90
theorem half_pairBlockMarkAverage_mem_unit

The fair-orientation average of a legal pair-block mark likelihood lies in the unit interval, as required by the product telescoping bound. Given the specified input n, the specified input d, the specified input q, the specified input z, the specified input hd, the specified input counts, the specified input hz, the stated mathematical conclusion holds. Given the specified input σ, the specified input hσ. Given the specified input j, the specified input hq.

Formal statement
n d :
ℕ
q σ z :
ℝ
hd :
1 ≤ d
j :
counts :
Obs d → ℕ
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
hσ :
σ = -1 ∨ σ = 1
hz :
z = -1 ∨ z = 1
(1 / 2 : ℝ) * pairBlockMarkAverage n d q σ z hd j counts ∈ Icc 0 1
Proof (Lean source)
lemma half_pairBlockMarkAverage_mem_unit (n d : ℕ) (q σ z : ℝ) (hd : 1 ≤ d) (j : Fin (pairCount n d)) (counts : Obs d → ℕ) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (hσ : σ = -1 ∨ σ = 1) (hz : z = -1 ∨ z = 1) : (1 / 2 : ℝ) * pairBlockMarkAverage n d q σ z hd j counts ∈ Icc 0 1 := by have hterm (base : Bool) : (∏ side : Bool, pairObservedMonomial q σ z (if base == side then 1 else -1) (pairLabel n d hd j side) counts) ∈ Icc (0 : ℝ) 1 := by have hmono (side : Bool) := pairObservedMonomial_mem_unit q σ z (if base == side then 1 else -1) (pairLabel n d hd j side) counts hq hσ hz (by split_ifs <;> simp) exact ⟨Finset.prod_nonneg fun side _ => (hmono side).1, Finset.prod_le_one (fun side _ => (hmono side).1) (fun side _ => (hmono side).2)⟩ unfold pairBlockMarkAverage constructor · exact mul_nonneg (by norm_num) (Finset.sum_nonneg fun base _ => (hterm base).1) · calc (1 / 2 : ℝ) * ∑ base : Bool, ∏ side : Bool, pairObservedMonomial q σ z (if base == side then 1 else -1) (pairLabel n d hd j side) counts ≤ (1 / 2 : ℝ) * ∑ _base : Bool, (1 : ℝ) := by gcongr with base exact (hterm base).2 _ = 1 := by norm_num
CausalSmith.Stat.MarNearcompleteFrontier.half_pairBlockMarkAverage_mem_unit · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/Telescope.lean:108

Baseline labels carrying nonzero construction mass: the filler and the two labels of every active latent pair. Given the specified input n, the specified input d, the specified input hd, the stated mathematical conclusion holds.

Definition (Lean source)
n d :
ℕ
hd :
1 ≤ d
activeBaselineLabels n d hd :
insert (fillerLabel d hd) (Finset.univ.image fun js : Fin (pairCount n d) × Bool => pairLabel n d hd js.1 js.2)
theorem countAtomMass_eq_zero_of_unused

Every baseline label outside the filler and paired-label image has exactly zero conditional atom mass for all observed marks. Given the specified input n, the specified input d, the specified input q, the specified input hd, the specified input o, the specified input hf, the stated mathematical conclusion holds. Given the specified input σ, the specified input θ. Given the specified input hp.

Formal statement
n d :
ℕ
q σ :
ℝ
hd :
1 ≤ d
θ :
Theta n d
o :
Obs d
hf :
o.X ≠ fillerLabel d hd
hp :
∀ j : Fin (pairCount n d), ∀ side : Bool, o.X ≠ pairLabel n d hd j side
countAtomMass n d q σ hd θ o = 0
Proof (Lean source)
lemma countAtomMass_eq_zero_of_unused (n d : ℕ) (q σ : ℝ) (hd : 1 ≤ d) (θ : Theta n d) (o : Obs d) (hf : o.X ≠ fillerLabel d hd) (hp : ∀ j : Fin (pairCount n d), ∀ side : Bool, o.X ≠ pairLabel n d hd j side) : countAtomMass n d q σ hd θ o = 0 := by unfold countAtomMass rw [if_neg hf] simp only [zero_add] apply Finset.sum_eq_zero intro j _ apply Finset.sum_eq_zero intro side _ rw [if_neg (hp j side)]
CausalSmith.Stat.MarNearcompleteFrontier.countAtomMass_eq_zero_of_unused · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/Telescope.lean:147
def partitionedLocalRate

Local rate family assembled from one filler rate, one rate for every pair side, and zero on unused baseline labels. Given the specified input n, the specified input d, the specified input hd, the specified input fillerRate, the specified input x, the specified input o, the stated mathematical conclusion holds. Given the specified input pairRate.

Definition (Lean source)
n d :
ℕ
hd :
1 ≤ d
fillerRate :
Obs d → ℝ≥0
pairRate :
Fin (pairCount n d) → Bool → Obs d → ℝ≥0
x :
Fin d
o :
Obs d
partitionedLocalRate n d hd fillerRate pairRate x o :
ℝ≥0
if x
= fillerLabel d hd then fillerRate o else ∑ j : Fin (pairCount n d), ∑ side : Bool, if x = pairLabel n d hd j side then pairRate j side o else 0
theorem partitionedLocalRate_filler

At the filler label, the partitioned local family selects the filler rate. Given the specified input n, the specified input d, the specified input hd, the specified input fillerRate, the specified input o, the stated mathematical conclusion holds. Given the specified input pairRate.

Formal statement
n d :
ℕ
hd :
1 ≤ d
fillerRate :
Obs d → ℝ≥0
pairRate :
Fin (pairCount n d) → Bool → Obs d → ℝ≥0
o :
Obs d
partitionedLocalRate n d hd fillerRate pairRate (fillerLabel d hd) o = fillerRate o
Proof (Lean source)
lemma partitionedLocalRate_filler (n d : ℕ) (hd : 1 ≤ d) (fillerRate : Obs d → ℝ≥0) (pairRate : Fin (pairCount n d) → Bool → Obs d → ℝ≥0) (o : Obs d) : partitionedLocalRate n d hd fillerRate pairRate (fillerLabel d hd) o = fillerRate o := by simp [partitionedLocalRate]
CausalSmith.Stat.MarNearcompleteFrontier.partitionedLocalRate_filler · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/Telescope.lean:176
theorem partitionedLocalRate_pair

At an active pair label, the partitioned local family selects exactly its corresponding pair-side rate. Given the specified input n, the specified input d, the specified input hd, the specified input fillerRate, the specified input side, the specified input o, the stated mathematical conclusion holds. Given the specified input pairRate, the specified input j.

Formal statement
n d :
ℕ
hd :
1 ≤ d
fillerRate :
Obs d → ℝ≥0
pairRate :
Fin (pairCount n d) → Bool → Obs d → ℝ≥0
j :
side :
o :
Obs d
partitionedLocalRate n d hd fillerRate pairRate (pairLabel n d hd j side) o
= pairRate j side o
Proof (Lean source)
lemma partitionedLocalRate_pair (n d : ℕ) (hd : 1 ≤ d) (fillerRate : Obs d → ℝ≥0) (pairRate : Fin (pairCount n d) → Bool → Obs d → ℝ≥0) (j : Fin (pairCount n d)) (side : Bool) (o : Obs d) : partitionedLocalRate n d hd fillerRate pairRate (pairLabel n d hd j side) o = pairRate j side o := by unfold partitionedLocalRate rw [if_neg (fillerLabel_ne_pairLabel n d hd j side).symm] rw [Finset.sum_eq_single j] · rw [Finset.sum_eq_single side] · simp · intro side' _ hne rw [if_neg] intro hlabel exact hne (pairLabel_injective n d hd j j side' side hlabel.symm).2 · simp · intro k _ hne apply Finset.sum_eq_zero intro side' _ rw [if_neg] intro hlabel exact hne (pairLabel_injective n d hd k j side' side hlabel.symm).1 · simp
theorem partitionedLocalRate_unused

The partitioned local family vanishes at every unused baseline label. Given the specified input n, the specified input d, the specified input hd, the specified input fillerRate, the specified input x, the specified input hx, the specified input o, the stated mathematical conclusion holds. Given the specified input pairRate.

Formal statement
n d :
ℕ
hd :
1 ≤ d
fillerRate :
Obs d → ℝ≥0
pairRate :
Fin (pairCount n d) → Bool → Obs d → ℝ≥0
x :
Fin d
hx :
x ∈ univ \ activeBaselineLabels n d hd
o :
Obs d
partitionedLocalRate n d hd fillerRate pairRate x o = 0
Proof (Lean source)
lemma partitionedLocalRate_unused (n d : ℕ) (hd : 1 ≤ d) (fillerRate : Obs d → ℝ≥0) (pairRate : Fin (pairCount n d) → Bool → Obs d → ℝ≥0) (x : Fin d) (hx : x ∈ univ \ activeBaselineLabels n d hd) (o : Obs d) : partitionedLocalRate n d hd fillerRate pairRate x o = 0 := by have hxnot := (Finset.mem_sdiff.mp hx).2 have hfill : x ≠ fillerLabel d hd := by intro h apply hxnot rw [h] exact Finset.mem_insert_self _ _ unfold partitionedLocalRate rw [if_neg hfill] apply Finset.sum_eq_zero intro j _ apply Finset.sum_eq_zero intro side _ rw [if_neg] intro h apply hxnot rw [h] apply Finset.mem_insert_of_mem exact Finset.mem_image.mpr ⟨(j, side), Finset.mem_univ _, rfl⟩
CausalSmith.Stat.MarNearcompleteFrontier.partitionedLocalRate_unused · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/Telescope.lean:213
theorem prod_activeBaselineLabels

A product over active baseline labels reindexes exactly into the filler factor followed by one factor for each pair and side. Given the specified input n, the specified input d, the specified input hd, the specified input f, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
hd :
1 ≤ d
f :
Fin d → ℝ
(∏ x ∈ activeBaselineLabels n d hd, f x)
= f (fillerLabel d hd) * ∏ js : Fin (pairCount n d) × Bool, f (pairLabel n d hd js.1 js.2)
Proof (Lean source)
lemma prod_activeBaselineLabels (n d : ℕ) (hd : 1 ≤ d) (f : Fin d → ℝ) : (∏ x ∈ activeBaselineLabels n d hd, f x) = f (fillerLabel d hd) * ∏ js : Fin (pairCount n d) × Bool, f (pairLabel n d hd js.1 js.2) := by unfold activeBaselineLabels rw [Finset.prod_insert] · congr 1 apply Finset.prod_image intro a _ b _ hab rcases pairLabel_injective n d hd a.1 b.1 a.2 b.2 hab with ⟨h₁, h₂⟩ exact Prod.ext h₁ h₂ · simp only [mem_image, Finset.mem_univ, true_and, not_exists] intro js exact (fillerLabel_ne_pairLabel n d hd js.1 js.2).symm
theorem prod_split_active_unused_labels

Every baseline-label product splits exactly into filler, active pair labels, and the complement of unused zero-rate labels. Given the specified input n, the specified input d, the specified input hd, the specified input f, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
hd :
1 ≤ d
f :
Fin d → ℝ
(∏ x : Fin d, f x)
= f (fillerLabel d hd) * (∏ js : Fin (pairCount n d) × Bool, f (pairLabel n d hd js.1 js.2)) * ∏ x ∈ (univ \ activeBaselineLabels n d hd), f x
Proof (Lean source)
lemma prod_split_active_unused_labels (n d : ℕ) (hd : 1 ≤ d) (f : Fin d → ℝ) : (∏ x : Fin d, f x) = f (fillerLabel d hd) * (∏ js : Fin (pairCount n d) × Bool, f (pairLabel n d hd js.1 js.2)) * ∏ x ∈ (Finset.univ \ activeBaselineLabels n d hd), f x := by have hs : activeBaselineLabels n d hd ⊆ (Finset.univ : Finset (Fin d)) := Finset.subset_univ _ have hsplit := Finset.prod_sdiff (f := f) hs rw [prod_activeBaselineLabels n d hd f] at hsplit calc (∏ x : Fin d, f x) = ∏ x ∈ (Finset.univ : Finset (Fin d)), f x := by rfl _ = _ := by rw [← hsplit]; ring
CausalSmith.Stat.MarNearcompleteFrontier.prod_split_active_unused_labels · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/CountMixture/Telescope.lean:258
CausalSmith.Stat.STAT_MarNearcompleteFrontier_Research.Helpers.LowerBound.Decision 3 declarations Decision theoretic reductions for the one cell lower bound

Decision theoretic reductions for the one cell lower bound

theorem parametric_point_pair_lower

A hard separated pair gives a uniform squared risk lower bound. Given the specified input n, the specified input d, the specified input q, the specified input u, the specified input P₀, the specified input P₁, the specified input hu, the specified input htau₀, the specified input htau₁, the stated mathematical conclusion holds. Given the specified input htv.

Formal statement
n d :
ℕ
q u :
ℝ
P₀ P₁ :
hu :
0 < u
htau₀ :
tau P₀.val = 1 / 2
htau₁ :
tau P₁.val = 1 / 2 + u
htv :
tvDist (samplePi P₁.val n) (samplePi P₀.val n) ≤ 1 / 2
u ^ 2 / 16 ≤ pointMinimaxRisk n d q
Proof (Lean source)
lemma parametric_point_pair_lower {n d : ℕ} {q u : ℝ} (P₀ P₁ : ClassLaw d q) (hu : 0 < u) (htau₀ : tau P₀.val = 1 / 2) (htau₁ : tau P₁.val = 1 / 2 + u) (htv : tvDist (samplePi P₁.val n) (samplePi P₀.val n) ≤ 1 / 2) : u ^ 2 / 16 ≤ pointMinimaxRisk n d q := by letI : Nonempty (Estimator n d) := ⟨⟨fun _ => 0, measurable_const, fun _ => by constructor <;> norm_num⟩⟩ unfold pointMinimaxRisk refine le_ciInf fun T => ?_ letI : IsProbabilityMeasure (samplePi P₀.val n) := by unfold samplePi; infer_instance letI : IsProbabilityMeasure (samplePi P₁.val n) := by unfold samplePi; infer_instance have hprob := two_point_lower_bound_of_tvDist_le (P₀ := samplePi P₀.val n) (P₁ := samplePi P₁.val n) T.measurable (s := u / 2) (c := 1 / 2) (θ₀ := tau P₀.val) (θ₁ := tau P₁.val) (by rw [htau₀, htau₁]; simp [abs_of_pos hu]; linarith) (by simpa [tvDist_symm] using htv) have hrisk (P : ClassLaw d q) : (u / 2) ^ 2 * (samplePi P.val n).real {o | u / 2 ≤ |T o - tau P.val|} ≤ ∫ o, (T o - tau P.val) ^ 2 ∂samplePi P.val n := by letI : IsProbabilityMeasure (samplePi P.val n) := by unfold samplePi; infer_instance have hset : {o | u / 2 ≤ |T o - tau P.val|} = {o | (u / 2) ^ 2 ≤ (T o - tau P.val) ^ 2} := by ext o simp only [Set.mem_setOf_eq] rw [sq_le_sq, abs_of_pos (half_pos hu)] rw [hset] exact mul_meas_ge_le_integral_of_nonneg (Filter.Eventually.of_forall fun o => sq_nonneg (T o - tau P.val)) (μ := samplePi P.val n) Integrable.of_finite ((u / 2) ^ 2) have hpair : u ^ 2 / 16 ≤ max (∫ o, (T o - tau P₀.val) ^ 2 ∂samplePi P₀.val n) (∫ o, (T o - tau P₁.val) ^ 2 ∂samplePi P₁.val n) := by have h0 := hrisk P₀ have h1 := hrisk P₁ by_cases hle : (samplePi P₀.val n).real {o | u / 2 ≤ |T o - tau P₀.val|} ≤ (samplePi P₁.val n).real {o | u / 2 ≤ |T o - tau P₁.val|} · rw [max_eq_right hle] at hprob calc u ^ 2 / 16 ≤ (u / 2) ^ 2 * (samplePi P₁.val n).real {o | u / 2 ≤ |T o - tau P₁.val|} := by nlinarith [sq_nonneg u] _ ≤ _ := h1.trans (le_max_right _ _) · have hle' := le_of_not_ge hle rw [max_eq_left hle'] at hprob calc u ^ 2 / 16 ≤ (u / 2) ^ 2 * (samplePi P₀.val n).real {o | u / 2 ≤ |T o - tau P₀.val|} := by nlinarith [sq_nonneg u] _ ≤ _ := h0.trans (le_max_left _ _) have hb : BddAbove (Set.range fun P : ClassLaw d q => ∫ o, (T o - tau P.val) ^ 2 ∂samplePi P.val n) := by refine ⟨4, ?_⟩ rintro z ⟨P, rfl⟩ haveI : IsProbabilityMeasure (samplePi P.val n) := by unfold samplePi; infer_instance have hrange (o : Fin n → Obs d) : (T o - tau P.val) ^ 2 ≤ 4 := by rcases T.range o with ⟨hT0, hT1⟩ rcases tau_range P.val with ⟨hτ0, hτ1⟩ nlinarith [sq_nonneg (T o + 1), sq_nonneg (1 - T o), sq_nonneg (tau P.val + 1), sq_nonneg (1 - tau P.val)] have hInt : Integrable (fun o : Fin n → Obs d => (T o - tau P.val) ^ 2) (samplePi P.val n) := Integrable.of_finite simpa using (integral_mono hInt (integrable_const 4) hrange) exact hpair.trans (max_le (le_ciSup hb P₀) (le_ciSup hb P₁))
CausalSmith.Stat.MarNearcompleteFrontier.parametric_point_pair_lower · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/Decision.lean:16
theorem parametric_length_lower_of_law

A fixed legal law transfers a length lower bound through the minimax extrema. Given the specified input n, the specified input d, the specified input q, the specified input c, the specified input P, the stated mathematical conclusion holds. Given the specified input α, the specified input hα. Given the specified input h.

Formal statement
n d :
ℕ
q α c :
ℝ
P :
hα :
0 ≤ α
h :
∀ I : HonestIntervalClass n d q α, c ≤ ∫ o, (I.val.hi o - I.val.lo o) ∂samplePi P.val n
c ≤ lengthMinimaxRisk n d q α
Proof (Lean source)
lemma parametric_length_lower_of_law {n d : ℕ} {q α c : ℝ} (P : ClassLaw d q) (hα : 0 ≤ α) (h : ∀ I : HonestIntervalClass n d q α, c ≤ ∫ o, (I.val.hi o - I.val.lo o) ∂samplePi P.val n) : c ≤ lengthMinimaxRisk n d q α := by let Iall : IntervalProc n d := ⟨fun _ => -1, fun _ => 1, measurable_const, measurable_const, fun _ => by constructor <;> norm_num⟩ letI : Nonempty (HonestIntervalClass n d q α) := ⟨⟨Iall, fun P' => by haveI : IsProbabilityMeasure (samplePi P'.val n) := by unfold samplePi; infer_instance have hevent : {o : Fin n → Obs d | tau P'.val ∈ Icc (Iall.lo o) (Iall.hi o)} = univ := by ext o simp [Iall, tau_range P'.val] rw [hevent, probReal_univ] linarith⟩⟩ unfold lengthMinimaxRisk refine le_ciInf fun I => ?_ have hb : BddAbove (Set.range fun P' : ClassLaw d q => ∫ o, (I.val.hi o - I.val.lo o) ∂samplePi P'.val n) := by refine ⟨2, ?_⟩ rintro z ⟨P', rfl⟩ haveI : IsProbabilityMeasure (samplePi P'.val n) := by unfold samplePi; infer_instance have hrange (o : Fin n → Obs d) : I.val.hi o - I.val.lo o ≤ 2 := by rcases I.val.bounds o with ⟨hlo, _, hhi⟩ linarith have hInt : Integrable (fun o => I.val.hi o - I.val.lo o) (samplePi P'.val n) := Integrable.of_finite simpa using (integral_mono hInt (integrable_const 2) hrange) exact (h I).trans (le_ciSup hb P)
CausalSmith.Stat.MarNearcompleteFrontier.parametric_length_lower_of_law · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/Decision.lean:85
theorem parametric_interval_pair_lower

Coverage under a TV close pair forces expected interval length. Given the specified input n, the specified input d, the specified input q, the specified input u, the specified input P₀, the specified input P₁, the specified input hu, the specified input htau₀, the specified input htau₁, the stated mathematical conclusion holds. Given the specified input α, the specified input hα. Given the specified input htv.

Formal statement
n d :
ℕ
q α u :
ℝ
P₀ P₁ :
hu :
0 < u
hα :
0 ≤ α
htau₀ :
tau P₀.val = 1 / 2
htau₁ :
tau P₁.val = 1 / 2 + u
htv :
tvDist (samplePi P₀.val n) (samplePi P₁.val n) ≤ (1 - 2 * α) / 2
u * (1 - 2 * α) / 2 ≤ lengthMinimaxRisk n d q α
Proof (Lean source)
lemma parametric_interval_pair_lower {n d : ℕ} {q α u : ℝ} (P₀ P₁ : ClassLaw d q) (hu : 0 < u) (hα : 0 ≤ α) (htau₀ : tau P₀.val = 1 / 2) (htau₁ : tau P₁.val = 1 / 2 + u) (htv : tvDist (samplePi P₀.val n) (samplePi P₁.val n) ≤ (1 - 2 * α) / 2) : u * (1 - 2 * α) / 2 ≤ lengthMinimaxRisk n d q α := by apply parametric_length_lower_of_law P₀ hα intro I let μ₀ := samplePi P₀.val n let μ₁ := samplePi P₁.val n let E₀ := {o | tau P₀.val ∈ Icc (I.val.lo o) (I.val.hi o)} let E₁ := {o | tau P₁.val ∈ Icc (I.val.lo o) (I.val.hi o)} haveI : IsProbabilityMeasure μ₀ := by dsimp [μ₀]; unfold samplePi; infer_instance haveI : IsProbabilityMeasure μ₁ := by dsimp [μ₁]; unfold samplePi; infer_instance have hE₀ : MeasurableSet E₀ := Set.toFinite E₀ |>.measurableSet have hE₁ : MeasurableSet E₁ := Set.toFinite E₁ |>.measurableSet have hcov₀ : 1 - α ≤ μ₀.real E₀ := I.property P₀ have hcov₁ : 1 - α ≤ μ₁.real E₁ := I.property P₁ have htvE := abs_measureReal_sub_le_tvDist (μ := μ₀) (ν := μ₁) hE₁ have htransfer : 1 - α - (1 - 2 * α) / 2 ≤ μ₀.real E₁ := by have hd := (abs_le.mp htvE).1 dsimp [μ₀, μ₁] at hd linarith have hinter : (1 - 2 * α) / 2 ≤ μ₀.real (E₀ ∩ E₁) := by have hc₀ : μ₀.real E₀ᶜ ≤ α := by rw [probReal_compl_eq_one_sub hE₀] linarith have hc₁ : μ₀.real E₁ᶜ ≤ α + (1 - 2 * α) / 2 := by rw [probReal_compl_eq_one_sub hE₁] linarith have hu' := measureReal_union_le (μ := μ₀) E₀ᶜ E₁ᶜ have heq : E₀ ∩ E₁ = (E₀ᶜ ∪ E₁ᶜ)ᶜ := by ext o; simp rw [heq, probReal_compl_eq_one_sub (hE₀.compl.union hE₁.compl)] linarith have hsubset : E₀ ∩ E₁ ⊆ {o | u ≤ I.val.hi o - I.val.lo o} := by intro o ho change (tau P₀.val ∈ Icc (I.val.lo o) (I.val.hi o)) ∧ (tau P₁.val ∈ Icc (I.val.lo o) (I.val.hi o)) at ho rcases ho with ⟨⟨hlo₀, hhi₀⟩, ⟨hlo₁, hhi₁⟩⟩ rw [htau₀] at hlo₀ hhi₀ rw [htau₁] at hlo₁ hhi₁ change u ≤ I.val.hi o - I.val.lo o linarith only [hlo₀, hhi₁] have hmass : μ₀.real (E₀ ∩ E₁) ≤ μ₀.real {o | u ≤ I.val.hi o - I.val.lo o} := measureReal_mono hsubset have hthreshold : u * μ₀.real {o | u ≤ I.val.hi o - I.val.lo o} ≤ ∫ o, (I.val.hi o - I.val.lo o) ∂μ₀ := by exact mul_meas_ge_le_integral_of_nonneg (Filter.Eventually.of_forall fun o => sub_nonneg.mpr (I.val.bounds o).2.1) (μ := μ₀) Integrable.of_finite u calc u * (1 - 2 * α) / 2 ≤ u * μ₀.real (E₀ ∩ E₁) := by nlinarith [mul_le_mul_of_nonneg_left hinter (le_of_lt hu)] _ ≤ u * μ₀.real {o | u ≤ I.val.hi o - I.val.lo o} := mul_le_mul_of_nonneg_left hmass (le_of_lt hu) _ ≤ _ := hthreshold
CausalSmith.Stat.MarNearcompleteFrontier.parametric_interval_pair_lower · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/Decision.lean:119
CausalSmith.Stat.STAT_MarNearcompleteFrontier_Research.Helpers.LowerBound.NormalizedGlue 4 declarations Glue interface for the two branches of the normalized converse

Glue interface for the two branches of the normalized converse

The paired-prior conclusion at fixed parameters and separation constant. Given the specified input n, the specified input d, the specified input q, the specified input c, the stated mathematical conclusion holds. Given the specified input β.

Definition (Lean source)
n d :
ℕ
q β c :
ℝ
NormalizedCertificate n d q β c :
Prop
∃ πminus πplus : PMF (ClassLaw d q),
tvDist (priorPredictive n d q πminus) (priorPredictive n d q πplus) ≤ β
clause 1
∃ m0 : ℝ,
1 - β ≤ priorEventMass d q πminus (fun P => tau P.val ≤ m0 - c * gScale n d q)
1 - β ≤ priorEventMass d q πplus (fun P => m0 + c * gScale n d q ≤ tau P.val)
CausalSmith.Stat.MarNearcompleteFrontier.NormalizedCertificate · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/NormalizedGlue.lean:13

The exact remaining large-sample obligation: a uniform certificate after a threshold depending only on the fixed testing tolerance. the stated mathematical conclusion holds. Given the specified input β.

Definition (Lean source)
β :
ℝ
EventualNormalizedCertificate β :
Prop
∃ N : ℕ,
2 ≤ N
clause 1
∃ cLarge : ℝ,
0 < cLarge
n d :
ℕ
q :
ℝ
N ≤ n
1 ≤ d
q ∈ Icc ((1 : ℝ) / 2) 1
gScale n d q ^ 2 ≥ 1 / (n : ℝ)
NormalizedCertificate n d q β cLarge
CausalSmith.Stat.MarNearcompleteFrontier.EventualNormalizedCertificate · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/NormalizedGlue.lean:26
theorem normalizedCertificate_mono

A certificate remains valid after decreasing its separation constant. Given the specified input n, the specified input d, the specified input q, the specified input c, the specified input c', the specified input hc, the specified input hcc, the specified input h, the stated mathematical conclusion holds. Given the specified input β. Given the specified input hq.

Formal statement
n d :
ℕ
q β c c' :
ℝ
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
hc :
0 ≤ c
hcc :
c ≤ c'
h :
Proof (Lean source)
lemma normalizedCertificate_mono {n d : ℕ} {q β c c' : ℝ} (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (hc : 0 ≤ c) (hcc : c ≤ c') (h : NormalizedCertificate n d q β c') : NormalizedCertificate n d q β c := by have hdelta : 0 ≤ delta q := by simp [delta]; linarith [hq.2] have hratio : 0 ≤ (d : ℝ) / ((n : ℝ) * ell n) := by exact div_nonneg (Nat.cast_nonneg _) (mul_nonneg (Nat.cast_nonneg _) (le_of_lt (ell_pos_for_normalization n))) have hg : 0 ≤ gScale n d q := by exact mul_nonneg hdelta (le_min (by norm_num) hratio) obtain ⟨πminus, πplus, htv, m0, hminus, hplus⟩ := h refine ⟨πminus, πplus, htv, m0, ?_, ?_⟩ · apply hminus.trans unfold priorEventMass refine measureReal_mono ?_ (by finiteness) intro P hP dsimp at hP ⊢ nlinarith [mul_le_mul_of_nonneg_right hcc hg] · apply hplus.trans unfold priorEventMass refine measureReal_mono ?_ (by finiteness) intro P hP dsimp at hP ⊢ nlinarith [mul_le_mul_of_nonneg_right hcc hg]
CausalSmith.Stat.MarNearcompleteFrontier.normalizedCertificate_mono · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/NormalizedGlue.lean:36
theorem normalized_converse_of_eventual_certificate

An eventual uniform certificate and the parametric finite branch imply the full normalized converse. Given the specified input hlarge, the stated mathematical conclusion holds. Given the specified input β. Given the specified input hβ.

Formal statement
β :
ℝ
hβ :
β ∈ Ioo 0 ((1 : ℝ) / 4)
∃ cβ : ℝ,
0 < cβ
conclusion 1
n d :
ℕ
q :
ℝ
1 ≤ n
1 ≤ d
q ∈ Icc ((1 : ℝ) / 2) 1
gScale n d q ^ 2 ≥ 1 / (n : ℝ)
Proof (Lean source)
lemma normalized_converse_of_eventual_certificate (β : ℝ) (hβ : β ∈ Ioo 0 ((1 : ℝ) / 4)) (hlarge : EventualNormalizedCertificate β) : ∃ cβ : ℝ, 0 < cβ ∧ ∀ (n d : ℕ) (q : ℝ), 1 ≤ n → 1 ≤ d → q ∈ Icc ((1 : ℝ) / 2) 1 → gScale n d q ^ 2 ≥ 1 / (n : ℝ) → NormalizedCertificate n d q β cβ := by obtain ⟨N, hN, cLarge, hcLarge, hlarge⟩ := hlarge have hb : 0 < 2 * β := by linarith [hβ.1] obtain ⟨a, ha, hbudget⟩ := parametric_radius_budget_at_tolerance (2 * β) hb have hNpos : (0 : ℝ) < N := by exact_mod_cast (by omega : 0 < N) have hrootN : 0 < sqrt (N : ℝ) := Real.sqrt_pos.2 hNpos let cSmall := a / sqrt N let cβ := min cLarge cSmall have hcSmall : 0 < cSmall := by dsimp [cSmall]; positivity have hcβ : 0 < cβ := by exact lt_min hcLarge hcSmall refine ⟨cβ, hcβ, ?_⟩ intro n d q hn hd hq hg by_cases hnLarge : N ≤ n · apply normalizedCertificate_mono hq (le_of_lt hcβ) (min_le_left _ _) exact hlarge n d q hnLarge hd hq hg · have hnSmall : n < N := Nat.lt_of_not_ge hnLarge apply normalizedCertificate_mono hq (le_of_lt hcβ) (min_le_right _ _) exact normalized_converse_smallN hβ.1 ha hbudget hn hnSmall hd hq
CausalSmith.Stat.MarNearcompleteFrontier.normalized_converse_of_eventual_certificate · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/NormalizedGlue.lean:63
CausalSmith.Stat.STAT_MarNearcompleteFrontier_Research.Helpers.LowerBound.NormalizedLagrange 2 declarations Exterior Lagrange mass for the normalized paired prior

Exterior Lagrange mass for the normalized paired prior

theorem lagrangeNorm_eq_abs_chebyshev Lemma lagrangeNorm_eq_abs_chebyshev in the paper ↗

The qid's Lagrange normalization is exactly its calibrated exterior Chebyshev value. Given the specified input n, the stated mathematical conclusion holds.

Formal statement
n :
ℕ
= |(T ℝ ((priorK n - 1 : ℕ) : ℤ)).eval (-(1 + priorH n) / (1 - priorH n))|
Proof (Lean source)
lemma lagrangeNorm_eq_abs_chebyshev (n : ℕ) : lagrangeNorm n = |(T ℝ ((priorK n - 1 : ℕ) : ℤ)).eval (-(1 + priorH n) / (1 - priorH n))| := by have hK := priorK_ge_two n have ha0 : 0 < priorH n := by unfold priorH positivity have ha1 : priorH n < 1 := by have hk : (1 : ℝ) < priorK n := by exact_mod_cast (show 1 < priorK n by omega) have hi : (priorK n : ℝ)⁻¹ < 1 := inv_lt_one_of_one_lt₀ hk have hi0 : (0 : ℝ) < (priorK n : ℝ)⁻¹ := by positivity unfold priorH nlinarith have hcard : priorK n - 1 + 1 = priorK n := by omega have h := shifted_chebyshev_lagrange_abs_sum (priorK n - 1) (priorH n) ha0 ha1 rw [hcard] at h have hnodes : interpolationNode n = (fun j : Fin (priorK n) => (1 + priorH n) / 2 + (1 - priorH n) / 2 * cos ((j : ℝ) * pi / ((priorK n - 1 : ℕ) : ℝ))) := by rfl rw [lagrangeNorm] simp only [lagrangeAtZero, hnodes] simpa [node] using h
CausalSmith.Stat.MarNearcompleteFrontier.lagrangeNorm_eq_abs_chebyshev · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/NormalizedLagrange.lean:26
theorem lagrangeNorm_le_cosh_two Lemma lagrangeNorm_le_cosh_two in the paper ↗

Uniform exterior mass bound for the normalized paired prior. Given the specified input n, the stated mathematical conclusion holds.

Formal statement
n :
ℕ
Proof (Lean source)
CausalSmith.Stat.MarNearcompleteFrontier.lagrangeNorm_le_cosh_two · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/NormalizedLagrange.lean:55
CausalSmith.Stat.STAT_MarNearcompleteFrontier_Research.Helpers.LowerBound.NormalizedLargeN 5 declarations Remaining large-sample normalized certificate

Remaining large-sample normalized certificate

theorem pairedPrior_minus_event_mass_eq

A minus-prior event is the corresponding latent event under thetaLaw. Given the specified input n, the specified input d, the specified input q, the specified input hn, the specified input hd, the specified input E, the stated mathematical conclusion holds. Given the specified input hq.

Formal statement
n d :
ℕ
q :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
E :
ClassLaw d q → Prop
priorEventMass d q (pairedPrior n d q hn hd hq).1 E
= (thetaLaw n d q hn hd hq).toMeasure.real {θ | E (pairedClassLaw n d q (-1) hn hd hq (by norm_num) θ)}
Proof (Lean source)
lemma pairedPrior_minus_event_mass_eq (n d : ℕ) (q : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (E : ClassLaw d q → Prop) : priorEventMass d q (pairedPrior n d q hn hd hq).1 E = (thetaLaw n d q hn hd hq).toMeasure.real {θ | E (pairedClassLaw n d q (-1) hn hd hq (by norm_num) θ)} := by unfold priorEventMass change ((thetaLaw n d q hn hd hq).map (pairedClassLaw n d q (-1) hn hd hq (by norm_num))).toMeasure.real {P | E P} = _ rw [← PMF.toMeasure_map _ _ (measurable_of_finite _)] simp only [measureReal_def] rw [Measure.map_apply] rfl · exact measurable_of_finite (pairedClassLaw n d q (-1) hn hd hq (by norm_num)) · trivial
CausalSmith.Stat.MarNearcompleteFrontier.pairedPrior_minus_event_mass_eq · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/NormalizedLargeN.lean:16
theorem pairedPrior_plus_event_mass_eq

A plus-prior event is the corresponding latent event under thetaLaw. Given the specified input n, the specified input d, the specified input q, the specified input hn, the specified input hd, the specified input E, the stated mathematical conclusion holds. Given the specified input hq.

Formal statement
n d :
ℕ
q :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
E :
ClassLaw d q → Prop
priorEventMass d q (pairedPrior n d q hn hd hq).2 E
= (thetaLaw n d q hn hd hq).toMeasure.real {θ | E (pairedClassLaw n d q 1 hn hd hq (by norm_num) θ)}
Proof (Lean source)
lemma pairedPrior_plus_event_mass_eq (n d : ℕ) (q : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (E : ClassLaw d q → Prop) : priorEventMass d q (pairedPrior n d q hn hd hq).2 E = (thetaLaw n d q hn hd hq).toMeasure.real {θ | E (pairedClassLaw n d q 1 hn hd hq (by norm_num) θ)} := by unfold priorEventMass change ((thetaLaw n d q hn hd hq).map (pairedClassLaw n d q 1 hn hd hq (by norm_num))).toMeasure.real {P | E P} = _ rw [← PMF.toMeasure_map _ _ (measurable_of_finite _)] simp only [measureReal_def] rw [Measure.map_apply] rfl · exact measurable_of_finite (pairedClassLaw n d q 1 hn hd hq (by norm_num)) · trivial
CausalSmith.Stat.MarNearcompleteFrontier.pairedPrior_plus_event_mass_eq · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/NormalizedLargeN.lean:35
theorem pairedPrior_target_events_eventual

The concentration certificate transfers to both target events of the legal pushed-forward priors. the stated mathematical conclusion holds. Given the specified input β, the specified input hβ.

Formal statement
β :
ℝ
hβ :
0 < β
∃ N : ℕ,
2 ≤ N
conclusion 1
∃ c : ℝ,
0 < c
n d :
ℕ
q :
ℝ
hnN :
N ≤ n
hn :
1 ≤ n
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
gScale n d q ^ 2 ≥ 1 / (n : ℝ)
∃ m0 : ℝ,
1 - β
≤ priorEventMass d q (pairedPrior n d q hn hd hq).1 (fun P => tau P.val ≤ m0 - c * gScale n d q)
1 - β
≤ priorEventMass d q (pairedPrior n d q hn hd hq).2 (fun P => m0 + c * gScale n d q ≤ tau P.val)
Proof (Lean source)
lemma pairedPrior_target_events_eventual (β : ℝ) (hβ : 0 < β) : ∃ N : ℕ, 2 ≤ N ∧ ∃ c : ℝ, 0 < c ∧ ∀ (n d : ℕ) (q : ℝ), ∀ (hnN : N ≤ n) (hn : 1 ≤ n) (hd : 1 ≤ d) (hq : q ∈ Icc ((1 : ℝ) / 2) 1), gScale n d q ^ 2 ≥ 1 / (n : ℝ) → ∃ m0 : ℝ, 1 - β ≤ priorEventMass d q (pairedPrior n d q hn hd hq).1 (fun P => tau P.val ≤ m0 - c * gScale n d q) ∧ 1 - β ≤ priorEventMass d q (pairedPrior n d q hn hd hq).2 (fun P => m0 + c * gScale n d q ≤ tau P.val) := by obtain ⟨N, hN2, c, hc, hgood⟩ := paired_target_good_event_eventual β hβ refine ⟨N, hN2, c, hc, ?_⟩ intro n d q hnN hn hd hq hreg refine ⟨baseMean q, ?_, ?_⟩ · rw [pairedPrior_minus_event_mass_eq n d q hn hd hq] apply (hgood n d q hnN hn hd hq hreg).trans refine measureReal_mono ?_ (by finiteness) intro θ hθ exact (pairedFullLaw_tau_separated n d q c hn hd hq θ hθ).1 · rw [pairedPrior_plus_event_mass_eq n d q hn hd hq] apply (hgood n d q hnN hn hd hq hreg).trans refine measureReal_mono ?_ (by finiteness) intro θ hθ exact (pairedFullLaw_tau_separated n d q c hn hd hq θ hθ).2
CausalSmith.Stat.MarNearcompleteFrontier.pairedPrior_target_events_eventual · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/NormalizedLargeN.lean:54
theorem paired_count_to_predictive_tv_eventual

Remaining parameter-independent prefix-transfer leaf. Eventually, transfer from the random-scale count experiment costs at most half the requested TV budget, uniformly over the exact normalized paired construction. the stated mathematical conclusion holds. Given the specified input β, the specified input hβ.

Formal statement
β :
ℝ
hβ :
0 < β
∃ N : ℕ,
2 ≤ N
conclusion 1
n d :
ℕ
q :
ℝ
N ≤ n
hn :
1 ≤ n
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
gScale n d q ^ 2 ≥ 1 / (n : ℝ)
tvDist (priorPredictive n d q (pairedPrior n d q hn hd hq).1) (priorPredictive n d q (pairedPrior n d q hn hd hq).2)
≤ tvDist (mixedCountLaw n d q (-1) hn hd hq) (mixedCountLaw n d q 1 hn hd hq)
+ β / 2
Proof (Lean source)
lemma paired_count_to_predictive_tv_eventual (β : ℝ) (hβ : 0 < β) : ∃ N : ℕ, 2 ≤ N ∧ ∀ (n d : ℕ) (q : ℝ), N ≤ n → ∀ (hn : 1 ≤ n) (hd : 1 ≤ d) (hq : q ∈ Icc ((1 : ℝ) / 2) 1), gScale n d q ^ 2 ≥ 1 / (n : ℝ) → tvDist (priorPredictive n d q (pairedPrior n d q hn hd hq).1) (priorPredictive n d q (pairedPrior n d q hn hd hq).2) ≤ tvDist (mixedCountLaw n d q (-1) hn hd hq) (mixedCountLaw n d q 1 hn hd hq) + β / 2 := by obtain ⟨N₀, hN₀⟩ := exists_nat_gt (32 / β) refine ⟨max N₀ 2, le_max_right _ _, ?_⟩ intro n d q hnN hn hd hq _hreg have hn0 : N₀ ≤ n := le_trans (le_max_left _ _) hnN have hnR : 32 / β < (n : ℝ) := lt_of_lt_of_le hN₀ (by exact_mod_cast hn0) have hnpos : (0 : ℝ) < n := by exact_mod_cast hn have hbudget : 16 / (n : ℝ) ≤ β / 2 := by apply (div_le_iff₀ hnpos).mpr have h := (div_lt_iff₀ hβ).mp hnR linarith exact (paired_predictive_tv_le_count_tv_add_inverse n d q hn hd hq).trans (add_le_add le_rfl hbudget)
CausalSmith.Stat.MarNearcompleteFrontier.paired_count_to_predictive_tv_eventual · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/NormalizedLargeN.lean:82
theorem paired_predictive_tv_eventual

The count-mixture comparison and random-scale prefix transfer imply the eventual fixed-size predictive TV bound. the stated mathematical conclusion holds. Given the specified input β, the specified input hβ.

Formal statement
β :
ℝ
hβ :
0 < β
∃ N : ℕ,
2 ≤ N
conclusion 1
n d :
ℕ
q :
ℝ
N ≤ n
hn :
1 ≤ n
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
gScale n d q ^ 2 ≥ 1 / (n : ℝ)
tvDist (priorPredictive n d q (pairedPrior n d q hn hd hq).1) (priorPredictive n d q (pairedPrior n d q hn hd hq).2)
≤ β
Proof (Lean source)
lemma paired_predictive_tv_eventual (β : ℝ) (hβ : 0 < β) : ∃ N : ℕ, 2 ≤ N ∧ ∀ (n d : ℕ) (q : ℝ), N ≤ n → ∀ (hn : 1 ≤ n) (hd : 1 ≤ d) (hq : q ∈ Icc ((1 : ℝ) / 2) 1), gScale n d q ^ 2 ≥ 1 / (n : ℝ) → tvDist (priorPredictive n d q (pairedPrior n d q hn hd hq).1) (priorPredictive n d q (pairedPrior n d q hn hd hq).2) ≤ β := by obtain ⟨NC, hNC2, hcount⟩ := mixedCountLaw_tv_eventual β hβ obtain ⟨NT, hNT2, htransfer⟩ := paired_count_to_predictive_tv_eventual β hβ refine ⟨max NC NT, le_max_of_le_left hNC2, ?_⟩ intro n d q hnN hn hd hq hreg have hnC : NC ≤ n := le_trans (le_max_left _ _) hnN have hnT : NT ≤ n := le_trans (le_max_right _ _) hnN have hC := hcount n d q hnC hn hd hq hreg have hT := htransfer n d q hnT hn hd hq hreg linarith
CausalSmith.Stat.MarNearcompleteFrontier.paired_predictive_tv_eventual · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/NormalizedLargeN.lean:111
CausalSmith.Stat.STAT_MarNearcompleteFrontier_Research.Helpers.LowerBound.NormalizedScale 10 declarations Scale arithmetic for normalized paired concentration

Scale arithmetic for normalized paired concentration

Given the specified input n, the stated mathematical conclusion holds.

Formal statement
n :
ℕ
1 ≤ ell n
Proof (Lean source)
lemma one_le_ell_scale (n : ℕ) : 1 ≤ ell n := by unfold ell calc 1 = log (exp 1) := (Real.log_exp _).symm _ ≤ log (exp 1 + n) := Real.log_le_log (Real.exp_pos _) (le_add_of_nonneg_right (Nat.cast_nonneg _))

Given the specified input n, the stated mathematical conclusion holds.

Formal statement
n :
ℕ
(priorK n : ℝ) ≤ 9 * ell n
Proof (Lean source)
lemma priorK_le_nine_ell (n : ℕ) : (priorK n : ℝ) ≤ 9 * ell n := by have hell := one_le_ell_scale n have hceil := Nat.ceil_lt_add_one (show 0 ≤ 8 * ell n by positivity) change (priorK n : ℝ) < 8 * ell n + 1 at hceil linarith [one_le_ell_scale n]

Given the specified input d, the specified input hd, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
hd :
3 ≤ d
(d : ℝ) / 4 ≤ (((d - 1) / 2 : ℕ) : ℝ)
Proof (Lean source)
lemma nat_half_sub_one_lower {d : ℕ} (hd : 3 ≤ d) : (d : ℝ) / 4 ≤ (((d - 1) / 2 : ℕ) : ℝ) := by have hnat : d ≤ 4 * ((d - 1) / 2) := by omega apply (div_le_iff₀ (by norm_num : (0 : ℝ) < 4)).2 exact_mod_cast (show d ≤ ((d - 1) / 2) * 4 by simpa [mul_comm] using hnat)
CausalSmith.Stat.MarNearcompleteFrontier.nat_half_sub_one_lower · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/NormalizedScale.lean:29

Given the specified input x, the specified input hx, the stated mathematical conclusion holds.

Formal statement
x :
ℝ
hx :
2 ≤ x
x / 2 ≤ (Nat.floor x : ℝ)
Proof (Lean source)
lemma floor_half_lower {x : ℝ} (hx : 2 ≤ x) : x / 2 ≤ (Nat.floor x : ℝ) := by have hfloor := Nat.sub_one_lt_floor x linarith
theorem pairCount_lower_quarter Lemma pairCount_lower_quarter in the paper ↗

Given the specified input n, the specified input d, the specified input hd, the specified input n, the stated mathematical conclusion holds. Given the specified input hnell.

Formal statement
n d :
ℕ
hd :
3 ≤ d
hnell :
2 ≤ (n : ℝ) * ell n
(1 / 4 : ℝ) * min (d : ℝ) ((n : ℝ) * ell n) ≤ pairCount n d
Proof (Lean source)
lemma pairCount_lower_quarter (n d : ℕ) (hd : 3 ≤ d) (hnell : 2 ≤ (n : ℝ) * ell n) : (1 / 4 : ℝ) * min (d : ℝ) ((n : ℝ) * ell n) ≤ pairCount n d := by have hA := nat_half_sub_one_lower hd have hB := floor_half_lower hnell unfold pairCount push_cast apply le_min · calc (1 / 4 : ℝ) * min (d : ℝ) ((n : ℝ) * ell n) ≤ (d : ℝ) / 4 := by have := min_le_left (d : ℝ) ((n : ℝ) * ell n) linarith _ ≤ _ := hA · calc (1 / 4 : ℝ) * min (d : ℝ) ((n : ℝ) * ell n) ≤ ((n : ℝ) * ell n) / 4 := by have := min_le_right (d : ℝ) ((n : ℝ) * ell n) linarith _ ≤ ((n : ℝ) * ell n) / 2 := by nlinarith _ ≤ _ := hB
CausalSmith.Stat.MarNearcompleteFrontier.pairCount_lower_quarter · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/NormalizedScale.lean:43
theorem regime_dimension_ge_three

Given the specified input n, the specified input d, the specified input q, the specified input hn, the specified input n, the stated mathematical conclusion holds. Given the specified input hq, the specified input hreg.

Formal statement
n d :
ℕ
q :
ℝ
hn :
2 ≤ n
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
hreg :
gScale n d q ^ 2 ≥ 1 / (n : ℝ)
3 ≤ d
Proof (Lean source)
lemma regime_dimension_ge_three (n d : ℕ) (q : ℝ) (hn : 2 ≤ n) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (hreg : gScale n d q ^ 2 ≥ 1 / (n : ℝ)) : 3 ≤ d := by by_contra hd have hd2 : d ≤ 2 := by omega have hnpos : (0 : ℝ) < n := by positivity have hell := one_le_ell_scale n have hden : 0 < (n : ℝ) * ell n := mul_pos hnpos (lt_of_lt_of_le zero_lt_one hell) have hfrac0 : 0 ≤ (d : ℝ) / ((n : ℝ) * ell n) := div_nonneg (Nat.cast_nonneg _) hden.le have hr0 : 0 ≤ min 1 ((d : ℝ) / ((n : ℝ) * ell n)) := le_min (by norm_num) hfrac0 have hrle : min 1 ((d : ℝ) / ((n : ℝ) * ell n)) ≤ 2 / ((n : ℝ) * ell n) := by calc _ ≤ (d : ℝ) / ((n : ℝ) * ell n) := min_le_right _ _ _ ≤ 2 / ((n : ℝ) * ell n) := by gcongr; exact_mod_cast hd2 have hδ0 : 0 ≤ delta q := by unfold delta; linarith [hq.2] have hδle : delta q ≤ 1 / 2 := by unfold delta; linarith [hq.1] have hg0 : 0 ≤ gScale n d q := mul_nonneg hδ0 hr0 have hgle : gScale n d q ≤ 1 / (n : ℝ) := by unfold gScale calc delta q * min 1 ((d : ℝ) / ((n : ℝ) * ell n)) ≤ (1 / 2 : ℝ) * (2 / ((n : ℝ) * ell n)) := by have h1 := mul_nonneg (sub_nonneg.mpr hδle) hr0 have h2 := mul_nonneg (show (0 : ℝ) ≤ 1 / 2 by norm_num) (sub_nonneg.mpr hrle) nlinarith _ ≤ 1 / (n : ℝ) := by rw [show (1 / 2 : ℝ) * (2 / ((n : ℝ) * ell n)) = 1 / ((n : ℝ) * ell n) by ring] exact one_div_le_one_div_of_le hnpos (by nlinarith) have hsquare : gScale n d q ^ 2 ≤ (1 / (n : ℝ)) ^ 2 := by nlinarith have hstrict : (1 / (n : ℝ)) ^ 2 < 1 / (n : ℝ) := by have : (1 : ℝ) < n := by exact_mod_cast hn have hinv : 0 < 1 / (n : ℝ) := by positivity have hinv1 : 1 / (n : ℝ) < 1 := (div_lt_one hnpos).2 this nlinarith linarith
CausalSmith.Stat.MarNearcompleteFrontier.regime_dimension_ge_three · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/NormalizedScale.lean:66
theorem pairCount_scale_lower

Given the specified input n, the specified input d, the specified input q, the specified input hn, the specified input n, the stated mathematical conclusion holds. Given the specified input hq, the specified input hreg.

Formal statement
n d :
ℕ
q :
ℝ
hn :
2 ≤ n
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
hreg :
gScale n d q ^ 2 ≥ 1 / (n : ℝ)
(1 / 36 : ℝ) * min 1 ((d : ℝ) / ((n : ℝ) * ell n))
≤ (pairCount n d : ℝ) / ((n : ℝ) * (priorK n : ℝ))
Proof (Lean source)
lemma pairCount_scale_lower (n d : ℕ) (q : ℝ) (hn : 2 ≤ n) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (hreg : gScale n d q ^ 2 ≥ 1 / (n : ℝ)) : (1 / 36 : ℝ) * min 1 ((d : ℝ) / ((n : ℝ) * ell n)) ≤ (pairCount n d : ℝ) / ((n : ℝ) * (priorK n : ℝ)) := by have hd := regime_dimension_ge_three n d q hn hq hreg have hell := one_le_ell_scale n have hnreal : (2 : ℝ) ≤ n := by exact_mod_cast hn have hnell : 2 ≤ (n : ℝ) * ell n := by nlinarith have hm := pairCount_lower_quarter n d hd hnell have hk := priorK_le_nine_ell n have hnpos : (0 : ℝ) < n := by positivity have hellpos : 0 < ell n := lt_of_lt_of_le zero_lt_one hell have hK := priorK_ge_two n have hkpos : (0 : ℝ) < priorK n := by exact_mod_cast (show 0 < priorK n by omega) have hidentity : min (d : ℝ) ((n : ℝ) * ell n) = (n : ℝ) * ell n * min 1 ((d : ℝ) / ((n : ℝ) * ell n)) := by rw [mul_min_of_nonneg _ _ (mul_nonneg hnpos.le hellpos.le)] field_simp [hnpos.ne', hellpos.ne'] rw [min_comm] rw [hidentity] at hm apply (le_div_iff₀ (mul_pos hnpos hkpos)).2 have hr0 : 0 ≤ min 1 ((d : ℝ) / ((n : ℝ) * ell n)) := by positivity calc (1 / 36 : ℝ) * min 1 ((d : ℝ) / ((n : ℝ) * ell n)) * ((n : ℝ) * (priorK n : ℝ)) ≤ (1 / 4 : ℝ) * ((n : ℝ) * ell n * min 1 ((d : ℝ) / ((n : ℝ) * ell n))) := by nlinarith [mul_le_mul_of_nonneg_left hk (mul_nonneg hnpos.le hr0)] _ ≤ _ := hm

the stated mathematical conclusion holds. Given the specified input ε, the specified input hε.

Formal statement
ε :
ℝ
hε :
0 < ε
∃ N : ℕ, ∀ n : ℕ, N ≤ n → ell n ^ 2 ≤ ε * (n : ℝ)
Proof (Lean source)
lemma eventually_ell_sq_le (ε : ℝ) (hε : 0 < ε) : ∃ N : ℕ, ∀ n : ℕ, N ≤ n → ell n ^ 2 ≤ ε * (n : ℝ) := by open Filter in let C : ℝ := exp 1 + 1 have hC : 0 < C := by dsimp [C]; positivity have hsmall : 0 < ε / C := div_pos hε hC have hbound := (Real.isLittleO_pow_log_id_atTop (n := 2)).bound hsmall have ht : Tendsto (fun n : ℕ => exp 1 + (n : ℝ)) atTop atTop := by exact tendsto_const_nhds.add_atTop tendsto_natCast_atTop_atTop have he : ∀ᶠ n : ℕ in atTop, ell n ^ 2 ≤ (ε / C) * (exp 1 + (n : ℝ)) := by filter_upwards [hbound.filter_mono ht] with n hn have hx0 : 0 ≤ exp 1 + (n : ℝ) := by positivity have hlog0 : 0 ≤ log (exp 1 + (n : ℝ)) := Real.log_nonneg (by have := Real.one_lt_exp_iff.mpr (show (0 : ℝ) < 1 by norm_num) have hnnon : (0 : ℝ) ≤ (n : ℝ) := Nat.cast_nonneg n linarith) simpa [ell, Real.norm_eq_abs, abs_of_nonneg hlog0, abs_of_nonneg hx0, div_eq_mul_inv] using hn rw [eventually_atTop] at he obtain ⟨N0, hN0⟩ := he refine ⟨max N0 1, ?_⟩ intro n hn have hn0 : N0 ≤ n := le_trans (Nat.le_max_left _ _) hn have hn1 : 1 ≤ n := le_trans (Nat.le_max_right _ _) hn have hxn : exp 1 + (n : ℝ) ≤ C * (n : ℝ) := by dsimp [C] have hnR : (1 : ℝ) ≤ n := by exact_mod_cast hn1 nlinarith [mul_nonneg (Real.exp_pos 1).le (sub_nonneg.mpr (sub_nonneg.mpr hnR))] calc ell n ^ 2 ≤ (ε / C) * (exp 1 + (n : ℝ)) := hN0 n hn0 _ ≤ (ε / C) * (C * (n : ℝ)) := mul_le_mul_of_nonneg_left hxn (div_nonneg hε.le hC.le) _ = ε * (n : ℝ) := by field_simp [hC.ne']
theorem regime_min_scale_sq_lower

Given the specified input n, the specified input d, the specified input q, the specified input hn, the specified input n, the stated mathematical conclusion holds. Given the specified input hq, the specified input hreg.

Formal statement
n d :
ℕ
q :
ℝ
hn :
1 ≤ n
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
hreg :
gScale n d q ^ 2 ≥ 1 / (n : ℝ)
4 / (n : ℝ) ≤ (min 1 ((d : ℝ) / ((n : ℝ) * ell n))) ^ 2
Proof (Lean source)
lemma regime_min_scale_sq_lower (n d : ℕ) (q : ℝ) (hn : 1 ≤ n) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (hreg : gScale n d q ^ 2 ≥ 1 / (n : ℝ)) : 4 / (n : ℝ) ≤ (min 1 ((d : ℝ) / ((n : ℝ) * ell n))) ^ 2 := by let r := min 1 ((d : ℝ) / ((n : ℝ) * ell n)) have hnpos : (0 : ℝ) < n := by positivity have hellpos : 0 < ell n := lt_of_lt_of_le zero_lt_one (one_le_ell_scale n) have hr0 : 0 ≤ r := by dsimp [r]; positivity have hδ0 : 0 ≤ delta q := by unfold delta; linarith [hq.2] have hδle : delta q ≤ 1 / 2 := by unfold delta; linarith [hq.1] have hδsq : delta q ^ 2 ≤ (1 / 2 : ℝ) ^ 2 := by nlinarith have hgsq : gScale n d q ^ 2 = delta q ^ 2 * r ^ 2 := by simp [gScale, r] ring have hr_sq0 : 0 ≤ r ^ 2 := sq_nonneg _ rw [hgsq] at hreg have hchain : 1 / (n : ℝ) ≤ (1 / 2 : ℝ) ^ 2 * r ^ 2 := le_trans hreg (mul_le_mul_of_nonneg_right hδsq hr_sq0) calc 4 / (n : ℝ) = 4 * (1 / (n : ℝ)) := by ring _ ≤ 4 * ((1 / 2 : ℝ) ^ 2 * r ^ 2) := mul_le_mul_of_nonneg_left hchain (by norm_num) _ = r ^ 2 := by ring
CausalSmith.Stat.MarNearcompleteFrontier.regime_min_scale_sq_lower · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/NormalizedScale.lean:180
theorem eventually_priorK_sq_div_pairCount_le

the stated mathematical conclusion holds. Given the specified input η, the specified input hη.

Formal statement
η :
ℝ
hη :
0 < η
∃ N : ℕ,
2 ≤ N
conclusion 1
n d :
ℕ
q :
ℝ
N ≤ n
q ∈ Icc ((1 : ℝ) / 2) 1
gScale n d q ^ 2 ≥ 1 / (n : ℝ)
(priorK n : ℝ) ^ 2 / (pairCount n d : ℝ) ≤ η
Proof (Lean source)
lemma eventually_priorK_sq_div_pairCount_le (η : ℝ) (hη : 0 < η) : ∃ N : ℕ, 2 ≤ N ∧ ∀ (n d : ℕ) (q : ℝ), N ≤ n → q ∈ Icc ((1 : ℝ) / 2) 1 → gScale n d q ^ 2 ≥ 1 / (n : ℝ) → (priorK n : ℝ) ^ 2 / (pairCount n d : ℝ) ≤ η := by obtain ⟨N0, hN0⟩ := eventually_ell_sq_le (η ^ 2 / 26244) (by positivity) refine ⟨max N0 2, le_max_right _ _, ?_⟩ intro n d q hn hq hreg have hn0 : N0 ≤ n := le_trans (le_max_left _ _) hn have hn2 : 2 ≤ n := le_trans (le_max_right _ _) hn have hnpos : (0 : ℝ) < n := by positivity have hell := one_le_ell_scale n have hell0 : 0 ≤ ell n := le_trans (by norm_num) hell have hr0 : 0 ≤ min 1 ((d : ℝ) / ((n : ℝ) * ell n)) := by positivity have hr2 := regime_min_scale_sq_lower n d q (by omega) hq hreg have hd := regime_dimension_ge_three n d q hn2 hq hreg have hnell : 2 ≤ (n : ℝ) * ell n := by have hnR : (2 : ℝ) ≤ n := by exact_mod_cast hn2 nlinarith have hm := pairCount_lower_quarter n d hd hnell have hidentity : min (d : ℝ) ((n : ℝ) * ell n) = (n : ℝ) * ell n * min 1 ((d : ℝ) / ((n : ℝ) * ell n)) := by rw [mul_min_of_nonneg _ _ (mul_nonneg hnpos.le hell0)] field_simp [hnpos.ne', (lt_of_lt_of_le zero_lt_one hell).ne'] rw [min_comm] rw [hidentity] at hm have hm0 : 0 ≤ (pairCount n d : ℝ) := Nat.cast_nonneg _ have hbase0 : 0 ≤ (1 / 4 : ℝ) * ((n : ℝ) * ell n * min 1 ((d : ℝ) / ((n : ℝ) * ell n))) := by positivity have hm_sq := (sq_le_sq₀ hbase0 hm0).2 hm have hm_sq_lower : (n : ℝ) * ell n ^ 2 / 4 ≤ (pairCount n d : ℝ) ^ 2 := by have hr2' : (4 : ℝ) ≤ (n : ℝ) * min 1 ((d : ℝ) / ((n : ℝ) * ell n)) ^ 2 := by simpa [mul_comm] using (div_le_iff₀ hnpos).mp hr2 calc (n : ℝ) * ell n ^ 2 / 4 ≤ ((1 / 4 : ℝ) * ((n : ℝ) * ell n * min 1 ((d : ℝ) / ((n : ℝ) * ell n)))) ^ 2 := by nlinarith [mul_nonneg (sq_nonneg (ell n)) (sub_nonneg.mpr hr2')] _ ≤ _ := hm_sq have hk := priorK_le_nine_ell n have hk0 : 0 ≤ (priorK n : ℝ) := Nat.cast_nonneg _ have hk_sq : (priorK n : ℝ) ^ 2 ≤ 81 * ell n ^ 2 := by nlinarith have hk_four : ((priorK n : ℝ) ^ 2) ^ 2 ≤ 6561 * (ell n ^ 2) ^ 2 := by have hs := (sq_le_sq₀ (sq_nonneg (priorK n : ℝ)) (mul_nonneg (by norm_num) (sq_nonneg (ell n)))).2 hk_sq nlinarith have heps := hN0 n hn0 have htarget_sq : ((priorK n : ℝ) ^ 2) ^ 2 ≤ η ^ 2 * (pairCount n d : ℝ) ^ 2 := by have hη2 : 0 ≤ η ^ 2 := sq_nonneg _ have hmul := mul_le_mul_of_nonneg_left hm_sq_lower hη2 nlinarith [hk_four, mul_nonneg (sq_nonneg (ell n)) (sub_nonneg.mpr heps)] have hmpos : 0 < (pairCount n d : ℝ) := by have hrpos : 0 < min 1 ((d : ℝ) / ((n : ℝ) * ell n)) := by have hfour : 0 < (4 : ℝ) / (n : ℝ) := div_pos (by norm_num) hnpos have hspos : 0 < min 1 ((d : ℝ) / ((n : ℝ) * ell n)) ^ 2 := lt_of_lt_of_le hfour hr2 nlinarith exact lt_of_lt_of_le (mul_pos (by positivity) (mul_pos (mul_pos hnpos (lt_of_lt_of_le zero_lt_one hell)) hrpos)) hm apply (div_le_iff₀ hmpos).2 nlinarith [mul_nonneg (sub_nonneg.mpr (show (0 : ℝ) ≤ η by linarith)) hm0]
CausalSmith.Stat.MarNearcompleteFrontier.eventually_priorK_sq_div_pairCount_le · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/NormalizedScale.lean:206
CausalSmith.Stat.STAT_MarNearcompleteFrontier_Research.Helpers.LowerBound.NormalizedSmallN 3 declarations Parametric finite-sample branch of the normalized converse

Parametric finite-sample branch of the normalized converse

theorem priorPredictive_pure

The predictive mixture of a point prior is its iid sample law. Given the specified input n, the specified input d, the specified input q, the specified input P, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
P :
priorPredictive n d q (pure P) = samplePi P.val n
Proof (Lean source)
lemma priorPredictive_pure {n d : ℕ} {q : ℝ} (P : ClassLaw d q) : priorPredictive n d q (pure P) = samplePi P.val n := by rw [priorPredictive, PMF.toMeasure_pure] exact Measure.dirac_bind (by intro s hs trivial) P
theorem priorEventMass_pure

A point prior assigns unit mass to every event containing its support point. Given the specified input d, the specified input q, the specified input P, the specified input E, the specified input hE, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
q :
ℝ
P :
E :
ClassLaw d q → Prop
hE :
E P
priorEventMass d q (pure P) E = 1
Proof (Lean source)
lemma priorEventMass_pure {d : ℕ} {q : ℝ} (P : ClassLaw d q) (E : ClassLaw d q → Prop) (hE : E P) : priorEventMass d q (pure P) E = 1 := by simp [priorEventMass, PMF.toMeasure_pure, Measure.real_def, hE]
theorem normalized_converse_smallN

The one-cell pair proves the normalized-converse certificate below any fixed positive sample-size threshold. For a positive tolerance, a positive separation, a scale budget valid at every positive integer, a positive sample size below the threshold, a positive dimension, and an admissible arrival floor, the normalized converse certificate holds.

Formal statement
n d N :
ℕ
q β a :
ℝ
hβ :
0 < β
ha :
0 < a
hbudget :
∀ m : ℕ
if
1 ≤ m
then
0 < a / sqrt m ∧
a / sqrt m ≤ 1 / 4 ∧
16 * (m : ℝ) * (a / sqrt m) ^ 2 ≤ log (1 + (2 * β) ^ 2)
hn :
1 ≤ n
hN :
n < N
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
∃ πminus πplus : PMF (ClassLaw d q),
tvDist (priorPredictive n d q πminus) (priorPredictive n d q πplus) ≤ β
conclusion 1
∃ m0 : ℝ,
1 - β
≤ priorEventMass d q πminus (fun P => tau P.val ≤ m0 - (a / sqrt N) * gScale n d q)
1 - β
≤ priorEventMass d q πplus (fun P => m0 + (a / sqrt N) * gScale n d q ≤ tau P.val)
Proof (Lean source)
lemma normalized_converse_smallN {n d N : ℕ} {q β a : ℝ} (hβ : 0 < β) (ha : 0 < a) (hbudget : ∀ m : ℕ, 1 ≤ m → 0 < a / sqrt m ∧ a / sqrt m ≤ 1 / 4 ∧ 16 * (m : ℝ) * (a / sqrt m) ^ 2 ≤ log (1 + (2 * β) ^ 2)) (hn : 1 ≤ n) (hN : n < N) (hd : 1 ≤ d) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) : ∃ πminus πplus : PMF (ClassLaw d q), tvDist (priorPredictive n d q πminus) (priorPredictive n d q πplus) ≤ β ∧ ∃ m0 : ℝ, 1 - β ≤ priorEventMass d q πminus (fun P => tau P.val ≤ m0 - (a / sqrt N) * gScale n d q) ∧ 1 - β ≤ priorEventMass d q πplus (fun P => m0 + (a / sqrt N) * gScale n d q ≤ tau P.val) := by let u := a / sqrt n have hu := (hbudget n hn).1 have huquarter := (hbudget n hn).2.1 obtain ⟨P₀, P₁, htau₀, htau₁, hac, hchi⟩ := parametric_oneCell_pair hd hq.2 hu huquarter have htv : tvDist (samplePi P₀.val n) (samplePi P₁.val n) ≤ β := by have htv' := parametric_product_tv_at_tolerance_radius (observedLaw P₁.val).toMeasure (observedLaw P₀.val).toMeasure hac a (2 * β) (by positivity) hn hbudget hchi rw [tvDist_symm] simpa [samplePi] using htv' have hsep : (a / sqrt N) * gScale n d q ≤ u / 2 := by have h := converse_smallN_separation (a / 2) (a / sqrt N) N n d q (by positivity) (by positivity) (by ring_nf; exact le_rfl) hn hN hq dsimp [u] convert h using 1 <;> ring refine ⟨PMF.pure P₀, pure P₁, ?_, 1 / 2 + u / 2, ?_, ?_⟩ · simpa [priorPredictive_pure] using htv · rw [priorEventMass_pure] · linarith · rw [htau₀] linarith · rw [priorEventMass_pure] · linarith · rw [htau₁] linarith
CausalSmith.Stat.MarNearcompleteFrontier.normalized_converse_smallN · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/NormalizedSmallN.lean:30
CausalSmith.Stat.STAT_MarNearcompleteFrontier_Research.Helpers.LowerBound.NormalizedTarget 7 declarations Exact target identity for the normalized paired prior

Exact target identity for the normalized paired prior

The signed latent mass in the paired construction.

Definition (Lean source)
n d :
ℕ
θ :
Theta n d
pairedWeightedSign n d θ :
ℝ
∑ j : Fin (pairCount n d), latentP n (θ.1 j) * latentZ n (θ.1 j)
theorem pairedWeightedSign_apply

Given the specified input n, the specified input d, the stated mathematical conclusion holds. Given the specified input θ.

Formal statement
n d :
ℕ
θ :
Theta n d
= ∑ j : Fin (pairCount n d), latentP n (θ.1 j) * latentZ n (θ.1 j)
Proof (Lean source)
lemma pairedWeightedSign_apply (n d : ℕ) (θ : Theta n d) : pairedWeightedSign n d θ = ∑ j : Fin (pairCount n d), latentP n (θ.1 j) * latentZ n (θ.1 j) := rfl
CausalSmith.Stat.MarNearcompleteFrontier.pairedWeightedSign_apply · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/NormalizedTarget.lean:16
theorem fillerAtomWeight_target_sum

The filler component contributes its normalized mass times the filler mean. Given the specified input n, the specified input d, the specified input q, the specified input hd, the stated mathematical conclusion holds. Given the specified input θ.

Formal statement
n d :
ℕ
q :
ℝ
hd :
1 ≤ d
θ :
Theta n d
(∑ w : FullAtom d, fillerAtomWeight n d q hd θ w * ((if w.Y1 then (1 : ℝ) else 0) - (if w.Y0 then 1 else 0)))
Proof (Lean source)
lemma fillerAtomWeight_target_sum (n d : ℕ) (q : ℝ) (hd : 1 ≤ d) (θ : Theta n d) : (∑ w : FullAtom d, fillerAtomWeight n d q hd θ w * ((if w.Y1 then (1 : ℝ) else 0) - (if w.Y0 then 1 else 0))) = fillerMass n d / normalizationJ n d θ * baseMean q := by rw [Fintype.sum_equiv (fullAtomTupleEquiv d) (fun w => fillerAtomWeight n d q hd θ w * ((if w.Y1 then (1 : ℝ) else 0) - (if w.Y0 then 1 else 0))) (fun t => fillerAtomWeight n d q hd θ ((fullAtomTupleEquiv d).symm t) * ((if ((fullAtomTupleEquiv d).symm t).Y1 then (1 : ℝ) else 0) - (if ((fullAtomTupleEquiv d).symm t).Y0 then 1 else 0))) (by intro w; simp)] simp only [Fintype.sum_prod_type] simp [fullAtomTupleEquiv, fillerAtomWeight, bernoulliFactor, fillerLabel, FullAtom.X] rw [Finset.sum_eq_single (⟨0, hd⟩ : Fin d)] · simp only [if_true] ring · intro x _ hx simp [hx] · simp
CausalSmith.Stat.MarNearcompleteFrontier.fillerAtomWeight_target_sum · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/NormalizedTarget.lean:22
theorem pairAtomWeight_target_sum

One oriented paired label contributes its normalized mass times its treated mean. Given the specified input n, the specified input d, the specified input q, the specified input hd, the specified input side, the stated mathematical conclusion holds. Given the specified input σ, the specified input θ. Given the specified input j.

Formal statement
n d :
ℕ
q σ :
ℝ
hd :
1 ≤ d
θ :
Theta n d
j :
side :
(∑ w : FullAtom d, pairAtomWeight n d q σ hd θ j side w * ((if w.Y1 then (1 : ℝ) else 0) - (if w.Y0 then 1 else 0)))
= latentP n (θ.1 j) / normalizationJ n d θ * pairMu q σ (latentZ n (θ.1 j)) (orientation θ j side)
Proof (Lean source)
lemma pairAtomWeight_target_sum (n d : ℕ) (q σ : ℝ) (hd : 1 ≤ d) (θ : Theta n d) (j : Fin (pairCount n d)) (side : Bool) : (∑ w : FullAtom d, pairAtomWeight n d q σ hd θ j side w * ((if w.Y1 then (1 : ℝ) else 0) - (if w.Y0 then 1 else 0))) = latentP n (θ.1 j) / normalizationJ n d θ * pairMu q σ (latentZ n (θ.1 j)) (orientation θ j side) := by rw [Fintype.sum_equiv (fullAtomTupleEquiv d) (fun w => pairAtomWeight n d q σ hd θ j side w * ((if w.Y1 then (1 : ℝ) else 0) - (if w.Y0 then 1 else 0))) (fun t => pairAtomWeight n d q σ hd θ j side ((fullAtomTupleEquiv d).symm t) * ((if ((fullAtomTupleEquiv d).symm t).Y1 then (1 : ℝ) else 0) - (if ((fullAtomTupleEquiv d).symm t).Y0 then 1 else 0))) (by intro w; simp)] simp only [Fintype.sum_prod_type] simp [fullAtomTupleEquiv, pairAtomWeight, bernoulliFactor, FullAtom.X, FullAtom.S0, FullAtom.S1, FullAtom.Y0, FullAtom.Y1] simp_rw [Finset.sum_add_distrib] simp ring
CausalSmith.Stat.MarNearcompleteFrontier.pairAtomWeight_target_sum · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/NormalizedTarget.lean:46

Opposite orientations have the exact filler-centered signed mean shift. Given the specified input q, the specified input z, the specified input u, the specified input hz, the specified input hu, the stated mathematical conclusion holds. Given the specified input σ, the specified input hσ. Given the specified input hq.

Formal statement
q σ z u :
ℝ
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
hσ :
σ = -1 ∨ σ = 1
hz :
z = -1 ∨ z = 1
hu :
u = -1 ∨ u = 1
pairMu q σ z u + pairMu q σ z (-u) = 2 * baseMean q + σ * delta q * z / (16 * q)
Proof (Lean source)
lemma pairMu_opposite_sum (q σ z u : ℝ) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (hσ : σ = -1 ∨ σ = 1) (hz : z = -1 ∨ z = 1) (hu : u = -1 ∨ u = 1) : pairMu q σ z u + pairMu q σ z (-u) = 2 * baseMean q + σ * delta q * z / (16 * q) := by have hq0 : q ≠ 0 := ne_of_gt (lt_of_lt_of_le (by norm_num) hq.1) have hqi : q * q⁻¹ = 1 := mul_inv_cancel₀ hq0 have hq2i : q ^ 2 * q⁻¹ = q := by rw [pow_two, mul_assoc, hqi, mul_one] rcases hσ with rfl | rfl <;> rcases hz with rfl | rfl <;> rcases hu with rfl | rfl all_goals norm_num [pairMu, pairRho, baseMean, delta] all_goals field_simp [hq0] all_goals ring

Summing the two random orientations removes the orientation sign exactly. Given the specified input n, the specified input d, the specified input q, the stated mathematical conclusion holds. Given the specified input σ, the specified input hσ, the specified input θ. Given the specified input hq, the specified input j.

Formal statement
n d :
ℕ
q σ :
ℝ
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
hσ :
σ = -1 ∨ σ = 1
θ :
Theta n d
j :
(∑ side : Bool, pairMu q σ (latentZ n (θ.1 j)) (orientation θ j side))
= 2 * baseMean q + σ * delta q * latentZ n (θ.1 j) / (16 * q)
Proof (Lean source)
lemma pairMu_orientation_sum (n d : ℕ) (q σ : ℝ) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (hσ : σ = -1 ∨ σ = 1) (θ : Theta n d) (j : Fin (pairCount n d)) : (∑ side : Bool, pairMu q σ (latentZ n (θ.1 j)) (orientation θ j side)) = 2 * baseMean q + σ * delta q * latentZ n (θ.1 j) / (16 * q) := by have hzabs := latentZ_abs_one n (θ.1 j) have hz : latentZ n (θ.1 j) = -1 ∨ latentZ n (θ.1 j) = 1 := by rw [abs_eq (by norm_num : (0 : ℝ) ≤ 1)] at hzabs exact hzabs.elim Or.inr Or.inl cases hside : θ.2 j <;> simp [orientation, hside, pairMu_opposite_sum q σ (latentZ n (θ.1 j)) 1 hq hσ hz (Or.inr rfl), pairMu_opposite_sum q σ (latentZ n (θ.1 j)) (-1) hq hσ hz (Or.inl rfl), add_comm]
CausalSmith.Stat.MarNearcompleteFrontier.pairMu_orientation_sum · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/NormalizedTarget.lean:87
theorem pairedFullLaw_tau_exact

The normalized paired law has exactly the filler target plus the signed latent mass shift; normalization creates no additional sign-dependent term. Given the specified input n, the specified input d, the specified input q, the specified input hn, the specified input hd, the stated mathematical conclusion holds. Given the specified input σ, the specified input hσ, the specified input θ. Given the specified input hq.

Formal statement
n d :
ℕ
q σ :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
hσ :
σ = -1 ∨ σ = 1
θ :
Theta n d
tau (pairedFullLaw n d q σ hn hd hq (by rcases hσ with rfl | rfl <;> norm_num) θ)
= baseMean q + σ * delta q / (16 * q) * pairedWeightedSign n d θ / normalizationJ n d θ
Proof (Lean source)
lemma pairedFullLaw_tau_exact (n d : ℕ) (q σ : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (hσ : σ = -1 ∨ σ = 1) (θ : Theta n d) : tau (pairedFullLaw n d q σ hn hd hq (by rcases hσ with rfl | rfl <;> norm_num) θ) = baseMean q + σ * delta q / (16 * q) * pairedWeightedSign n d θ / normalizationJ n d θ := by let hσunit : σ ∈ Icc (-1) 1 := by rcases hσ with rfl | rfl <;> norm_num have hJ : normalizationJ n d θ ≠ 0 := ne_of_gt (normalizationJ_pos n d q hn hd hq θ) unfold tau simp_rw [pairedFullLaw_fullMass n d q σ hn hd hq hσunit θ] calc (∑ w : FullAtom d, pairedAtomWeight n d q σ hd θ w * ((if w.Y1 then (1 : ℝ) else 0) - (if w.Y0 then 1 else 0))) = (∑ w : FullAtom d, fillerAtomWeight n d q hd θ w * ((if w.Y1 then (1 : ℝ) else 0) - (if w.Y0 then 1 else 0))) + ∑ j : Fin (pairCount n d), ∑ side : Bool, ∑ w : FullAtom d, pairAtomWeight n d q σ hd θ j side w * ((if w.Y1 then (1 : ℝ) else 0) - (if w.Y0 then 1 else 0)) := by simp only [pairedAtomWeight, add_mul, Finset.sum_add_distrib] simp_rw [Finset.sum_mul] rw [Finset.sum_comm] congr 1 apply Finset.sum_congr rfl intro j _ rw [Finset.sum_comm] _ = fillerMass n d / normalizationJ n d θ * baseMean q + ∑ j : Fin (pairCount n d), ∑ side : Bool, latentP n (θ.1 j) / normalizationJ n d θ * pairMu q σ (latentZ n (θ.1 j)) (orientation θ j side) := by rw [fillerAtomWeight_target_sum] simp_rw [pairAtomWeight_target_sum] _ = fillerMass n d / normalizationJ n d θ * baseMean q + ∑ j : Fin (pairCount n d), latentP n (θ.1 j) / normalizationJ n d θ * (2 * baseMean q + σ * delta q * latentZ n (θ.1 j) / (16 * q)) := by apply congrArg₂ (· + ·) rfl apply Finset.sum_congr rfl intro j _ rw [← Finset.mul_sum, pairMu_orientation_sum n d q σ hq hσ θ j] _ = baseMean q + σ * delta q / (16 * q) * pairedWeightedSign n d θ / normalizationJ n d θ := by have hq0 : q ≠ 0 := ne_of_gt (lt_of_lt_of_le (by norm_num) hq.1) have hterm (j : Fin (pairCount n d)) : latentP n (θ.1 j) / normalizationJ n d θ * (2 * baseMean q + σ * delta q * latentZ n (θ.1 j) / (16 * q)) = (2 * baseMean q / normalizationJ n d θ) * latentP n (θ.1 j) + (σ * delta q / (16 * q) / normalizationJ n d θ) * (latentP n (θ.1 j) * latentZ n (θ.1 j)) := by ring simp_rw [hterm, Finset.sum_add_distrib, ← Finset.mul_sum] unfold pairedWeightedSign field_simp [hJ, hq0] unfold normalizationJ ring
CausalSmith.Stat.MarNearcompleteFrontier.pairedFullLaw_tau_exact · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/NormalizedTarget.lean:105
CausalSmith.Stat.STAT_MarNearcompleteFrontier_Research.Helpers.LowerBound.NormalizedTargetConcentration 22 declarations Target concentration leaves for the normalized paired prior

Target concentration leaves for the normalized paired prior

The cardinal Lagrange coefficients at zero sum to one. Given the specified input n, the stated mathematical conclusion holds.

Formal statement
n :
ℕ
(∑ i : Fin (priorK n), lagrangeAtZero n i) = 1
Proof (Lean source)
lemma lagrangeAtZero_sum_one (n : ℕ) : (∑ i : Fin (priorK n), lagrangeAtZero n i) = 1 := by have hinj : InjOn (interpolationNode n) (Finset.univ : Finset (Fin (priorK n))) := by intro i _ j _ hij exact interpolationNode_injective n hij have hdegree : ((1 : ℝ[X]).degree < ((Finset.univ : Finset (Fin (priorK n))).card : WithBot ℕ)) := by simp exact lt_of_lt_of_le (by omega) (priorK_ge_two n) have hinterp := Lagrange.eq_interpolate (f := (1 : ℝ[X])) hinj hdegree have heval := congrArg (fun p : ℝ[X] => p.eval 0) hinterp simpa [Lagrange.interpolate_apply, Polynomial.eval_finsetSum, lagrangeAtZero] using heval.symm

The normalized signed interpolation coefficients retain total mass 1 / lagrangeNorm. Given the specified input n, the stated mathematical conclusion holds.

Formal statement
n :
ℕ
(∑ i : Fin (priorK n), signedNodeWeight n i) = 1 / lagrangeNorm n
Proof (Lean source)
lemma signedNodeWeight_sum (n : ℕ) : (∑ i : Fin (priorK n), signedNodeWeight n i) = 1 / lagrangeNorm n := by simp_rw [signedNodeWeight, ← Finset.sum_div] rw [lagrangeAtZero_sum_one]
theorem signedNodeWeight_abs_sum Lemma signedNodeWeight_abs_sum in the paper ↗

The absolute normalized interpolation coefficients have total mass one. Given the specified input n, the stated mathematical conclusion holds.

Formal statement
n :
ℕ
(∑ i : Fin (priorK n), |signedNodeWeight n i|) = 1
Proof (Lean source)
lemma signedNodeWeight_abs_sum (n : ℕ) : (∑ i : Fin (priorK n), |signedNodeWeight n i|) = 1 := by have hnorm : 0 ≤ lagrangeNorm n := by unfold lagrangeNorm positivity have hnorm_ne : lagrangeNorm n ≠ 0 := by intro hz have hsum := lagrangeAtZero_sum_one n have habs : |∑ i : Fin (priorK n), lagrangeAtZero n i| ≤ ∑ i : Fin (priorK n), |lagrangeAtZero n i| := Finset.abs_sum_le_sum_abs _ _ rw [hsum, abs_one] at habs have : (1 : ℝ) ≤ lagrangeNorm n := by simpa [lagrangeNorm] using habs rw [hz] at this norm_num at this simp only [signedNodeWeight, abs_div, abs_of_nonneg hnorm, ← Finset.sum_div] rw [show (∑ i : Fin (priorK n), |lagrangeAtZero n i|) = lagrangeNorm n by rfl] exact div_self hnorm_ne
theorem latentWeightedSign_mean Lemma latentWeightedSign_mean in the paper ↗

The one-pair signed mass has the exact mean used in equation (18). Given the specified input n, the stated mathematical conclusion holds.

Formal statement
n :
ℕ
(∑ z : Latent n, latentWeight n z * (latentP n z * latentZ n z))
Proof (Lean source)
lemma latentWeightedSign_mean (n : ℕ) : (∑ z : Latent n, latentWeight n z * (latentP n z * latentZ n z)) = priorH n * priorB n / lagrangeNorm n := by rw [Fintype.sum_sum_type] simp only [Fintype.sum_unique, latentWeight, latentP, latentZ, zero_mul, mul_zero, add_zero] calc (∑ i : Fin (priorK n), priorH n * |signedNodeWeight n i| / interpolationNode n i * (priorB n * interpolationNode n i * if 0 ≤ signedNodeWeight n i then 1 else -1)) = ∑ i : Fin (priorK n), priorH n * priorB n * signedNodeWeight n i := by apply Finset.sum_congr rfl intro i _ have hnode : interpolationNode n i ≠ 0 := ne_of_gt (latentWeight_node_pos n i) by_cases hw : 0 ≤ signedNodeWeight n i · simp only [if_pos hw, abs_of_nonneg hw] field_simp [hnode] · have hw' : signedNodeWeight n i ≤ 0 := le_of_not_ge hw simp only [if_neg hw, abs_of_nonpos hw'] field_simp [hnode] _ = priorH n * priorB n * (∑ i : Fin (priorK n), signedNodeWeight n i) := by rw [Finset.mul_sum] _ = priorH n * priorB n / lagrangeNorm n := by rw [signedNodeWeight_sum] ring
theorem interpolationNode_le_one_target Lemma interpolationNode_le_one_target in the paper ↗

Every interpolation node is at most the right endpoint one. Given the specified input n, the stated mathematical conclusion holds. Given the specified input i.

Formal statement
n :
ℕ
i :
Proof (Lean source)
lemma interpolationNode_le_one_target (n : ℕ) (i : Fin (priorK n)) : interpolationNode n i ≤ 1 := by have hh := priorH_le_one_for_normalization n have hc := Real.cos_le_one ((i : ℝ) * pi / ((priorK n - 1 : ℕ) : ℝ)) unfold interpolationNode nlinarith
CausalSmith.Stat.MarNearcompleteFrontier.interpolationNode_le_one_target · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/NormalizedTargetConcentration.lean:99
theorem latentWeightedSign_second_moment_le Lemma latentWeightedSign_second_moment_le in the paper ↗

The one-pair signed latent mass has the scale-squared second-moment bound. Given the specified input n, the specified input hn, the stated mathematical conclusion holds.

Formal statement
n :
ℕ
hn :
1 ≤ n
(∑ z : Latent n, latentWeight n z * (latentP n z * latentZ n z) ^ 2)
≤ 1 / (1024 ^ 2 * (n : ℝ) ^ 2)
Proof (Lean source)
lemma latentWeightedSign_second_moment_le (n : ℕ) (hn : 1 ≤ n) : (∑ z : Latent n, latentWeight n z * (latentP n z * latentZ n z) ^ 2) ≤ 1 / (1024 ^ 2 * (n : ℝ) ^ 2) := by rw [Fintype.sum_sum_type] simp only [Fintype.sum_unique, latentWeight, latentP, latentZ, zero_mul, mul_zero, zero_pow (by norm_num : (2 : ℕ) ≠ 0), add_zero] calc (∑ i : Fin (priorK n), priorH n * |signedNodeWeight n i| / interpolationNode n i * (priorB n * interpolationNode n i * (if 0 ≤ signedNodeWeight n i then 1 else -1)) ^ 2) = ∑ i : Fin (priorK n), priorH n * priorB n ^ 2 * |signedNodeWeight n i| * interpolationNode n i := by apply Finset.sum_congr rfl intro i _ have hnode : interpolationNode n i ≠ 0 := ne_of_gt (latentWeight_node_pos n i) split_ifs <;> field_simp [hnode] <;> ring _ ≤ ∑ i : Fin (priorK n), priorH n * priorB n ^ 2 * |signedNodeWeight n i| := by apply Finset.sum_le_sum intro i _ have hh : 0 ≤ priorH n := by unfold priorH positivity have hcoef : 0 ≤ priorH n * priorB n ^ 2 * |signedNodeWeight n i| := mul_nonneg (mul_nonneg hh (sq_nonneg _)) (abs_nonneg _) simpa only [mul_one] using mul_le_mul_of_nonneg_left (interpolationNode_le_one_target n i) hcoef _ = priorH n * priorB n ^ 2 := by rw [← Finset.mul_sum, signedNodeWeight_abs_sum] ring _ = 1 / (1024 ^ 2 * (n : ℝ) ^ 2) := by have hk : (priorK n : ℝ) ≠ 0 := by exact_mod_cast (ne_of_gt (lt_of_lt_of_le (by omega) (priorK_ge_two n))) have hn0 : (n : ℝ) ≠ 0 := by exact_mod_cast (Nat.ne_of_gt hn) unfold priorH priorB field_simp [hk, hn0]
CausalSmith.Stat.MarNearcompleteFrontier.latentWeightedSign_second_moment_le · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/NormalizedTargetConcentration.lean:109

The one-pair latent mass has mean priorH * priorB. Given the specified input n, the stated mathematical conclusion holds.

Formal statement
n :
ℕ
(∑ z : Latent n, latentWeight n z * latentP n z) = priorH n * priorB n
Proof (Lean source)
lemma latentMass_mean (n : ℕ) : (∑ z : Latent n, latentWeight n z * latentP n z) = priorH n * priorB n := by rw [Fintype.sum_sum_type] simp only [Fintype.sum_unique, latentWeight, latentP, mul_zero, add_zero] calc (∑ i : Fin (priorK n), priorH n * |signedNodeWeight n i| / interpolationNode n i * (priorB n * interpolationNode n i)) = ∑ i : Fin (priorK n), priorH n * priorB n * |signedNodeWeight n i| := by apply Finset.sum_congr rfl intro i _ field_simp [ne_of_gt (latentWeight_node_pos n i)] _ = priorH n * priorB n := by rw [← Finset.mul_sum, signedNodeWeight_abs_sum] ring
theorem latentMass_second_moment_le Lemma latentMass_second_moment_le in the paper ↗

The one-pair latent mass has the same scale-squared second-moment envelope. Given the specified input n, the specified input hn, the stated mathematical conclusion holds.

Formal statement
n :
ℕ
hn :
1 ≤ n
(∑ z : Latent n, latentWeight n z * latentP n z ^ 2) ≤ 1 / (1024 ^ 2 * (n : ℝ) ^ 2)
Proof (Lean source)
lemma latentMass_second_moment_le (n : ℕ) (hn : 1 ≤ n) : (∑ z : Latent n, latentWeight n z * latentP n z ^ 2) ≤ 1 / (1024 ^ 2 * (n : ℝ) ^ 2) := by rw [Fintype.sum_sum_type] simp only [Fintype.sum_unique, latentWeight, latentP, zero_pow (by norm_num : (2 : ℕ) ≠ 0), mul_zero, add_zero] calc (∑ i : Fin (priorK n), priorH n * |signedNodeWeight n i| / interpolationNode n i * (priorB n * interpolationNode n i) ^ 2) = ∑ i : Fin (priorK n), priorH n * priorB n ^ 2 * |signedNodeWeight n i| * interpolationNode n i := by apply Finset.sum_congr rfl intro i _ field_simp [ne_of_gt (latentWeight_node_pos n i)] _ ≤ ∑ i : Fin (priorK n), priorH n * priorB n ^ 2 * |signedNodeWeight n i| := by apply Finset.sum_le_sum intro i _ have hh : 0 ≤ priorH n := by unfold priorH; positivity have hcoef : 0 ≤ priorH n * priorB n ^ 2 * |signedNodeWeight n i| := mul_nonneg (mul_nonneg hh (sq_nonneg _)) (abs_nonneg _) simpa only [mul_one] using mul_le_mul_of_nonneg_left (interpolationNode_le_one_target n i) hcoef _ = priorH n * priorB n ^ 2 := by rw [← Finset.mul_sum, signedNodeWeight_abs_sum] ring _ = 1 / (1024 ^ 2 * (n : ℝ) ^ 2) := by have hk : (priorK n : ℝ) ≠ 0 := by exact_mod_cast (ne_of_gt (lt_of_lt_of_le (by omega) (priorK_ge_two n))) have hn0 : (n : ℝ) ≠ 0 := by exact_mod_cast (Nat.ne_of_gt hn) unfold priorH priorB field_simp [hk, hn0]
theorem latentWeight_nonneg_target Lemma latentWeight_nonneg_target in the paper ↗

Every scalar latent weight is nonnegative. Given the specified input n, the specified input z, the stated mathematical conclusion holds.

Formal statement
n :
ℕ
z :
0 ≤ latentWeight n z
Proof (Lean source)
lemma latentWeight_nonneg_target (n : ℕ) (z : Latent n) : 0 ≤ latentWeight n z := by cases z with | inl i => exact div_nonneg (mul_nonneg (by unfold priorH; positivity) (abs_nonneg _)) (le_of_lt (latentWeight_node_pos n i)) | inr _ => simp only [latentWeight] apply sub_nonneg.mpr calc (∑ i : Fin (priorK n), priorH n * |signedNodeWeight n i| / interpolationNode n i) ≤ ∑ i : Fin (priorK n), |signedNodeWeight n i| := by apply Finset.sum_le_sum intro i _ apply (div_le_iff₀ (latentWeight_node_pos n i)).mpr nlinarith [latentWeight_node_lower n i, abs_nonneg (signedNodeWeight n i)] _ = 1 := signedNodeWeight_abs_sum n

The real mass function of the scalar latent PMF is latentWeight. Given the specified input n, the specified input d, the specified input q, the specified input hn, the specified input hd, the specified input z, the stated mathematical conclusion holds. Given the specified input hq.

Formal statement
n d :
ℕ
q :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
z :
(oneLatentLaw n d q hn hd hq z).toReal = latentWeight n z
Proof (Lean source)
lemma oneLatentLaw_toReal (n d : ℕ) (q : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (z : Latent n) : (oneLatentLaw n d q hn hd hq z).toReal = latentWeight n z := by rw [oneLatentLaw, PMF.ofFintype_apply, ENNReal.toReal_ofReal (latentWeight_nonneg_target n z)]
instance latentMeasurableSingletonClass

For a sample size, every singleton latent state is measurable.

Definition (Lean source)
instance latentMeasurableSingletonClass (n : ℕ) : MeasurableSingletonClass (Latent n) where measurableSet_singleton z := by cases z with | inl i => simpa only [Set.image_singleton] using (measurableSet_singleton i).inl_image (β := Unit) | inr u => simpa only [Set.image_singleton] using (measurableSet_singleton u).inr_image (α := Fin (priorK n))

Integrating a statistic of the latent coordinates under thetaLaw reduces to the corresponding finite product-weighted sum. Given the specified input n, the specified input d, the specified input q, the specified input hn, the specified input hd, the stated mathematical conclusion holds. Given the specified input hq, the specified input f.

Formal statement
n d :
ℕ
q :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
f :
(Fin (pairCount n d) → Latent n) → ℝ
(∫ θ, f θ.1 ∂(thetaLaw n d q hn hd hq).toMeasure)
= ∑ u : Fin (pairCount n d) → Latent n, (∏ j : Fin (pairCount n d), latentWeight n (u j)) * f u
Proof (Lean source)
lemma thetaLaw_integral_fst (n d : ℕ) (q : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (f : (Fin (pairCount n d) → Latent n) → ℝ) : (∫ θ, f θ.1 ∂(thetaLaw n d q hn hd hq).toMeasure) = ∑ u : Fin (pairCount n d) → Latent n, (∏ j : Fin (pairCount n d), latentWeight n (u j)) * f u := by rw [PMF.integral_eq_sum] simp only [smul_eq_mul, thetaLaw, PMF.ofFintype_apply, thetaWeight, ENNReal.toReal_prod, ENNReal.toReal_mul, oneLatentLaw_toReal, ENNReal.toReal_inv, ENNReal.toReal_ofNat] rw [Fintype.sum_prod_type] apply Finset.sum_congr rfl intro u _ simp only [Finset.prod_mul_distrib] simp only [Finset.prod_const, Finset.card_univ, Fintype.card_fin] have hsign : (∑ _s : Fin (pairCount n d) → Bool, (1 / 2 : ℝ≥0∞).toReal ^ pairCount n d) = 1 := by simp only [Finset.sum_const, Finset.card_univ, Fintype.card_fun, Fintype.card_bool, nsmul_eq_mul, Nat.cast_pow] norm_num rw [← mul_pow] simp calc (∑ _s : Fin (pairCount n d) → Bool, (∏ x, latentWeight n (u x)) * (1 / 2 : ℝ≥0∞).toReal ^ pairCount n d * f u) = (∑ _s : Fin (pairCount n d) → Bool, (1 / 2 : ℝ≥0∞).toReal ^ pairCount n d) * ((∏ x, latentWeight n (u x)) * f u) := by rw [Finset.sum_mul] apply Finset.sum_congr rfl intro s _ ring _ = _ := by rw [hsign]; ring
theorem pairedFullLaw_tau_separated

A lower bound on the normalized signed latent mass gives the two pointwise target inequalities for the opposite prior signs. Given the specified input n, the specified input d, the specified input q, the specified input c, the specified input hn, the specified input hd, the stated mathematical conclusion holds. Given the specified input θ. Given the specified input hq, the specified input hshift.

Formal statement
n d :
ℕ
q c :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
θ :
Theta n d
hshift :
c * gScale n d q ≤ delta q / (16 * q) * pairedWeightedSign n d θ / normalizationJ n d θ
conclusion 1
tau (pairedFullLaw n d q (-1) hn hd hq (by norm_num) θ) ≤ baseMean q - c * gScale n d q
conclusion 2
baseMean q + c * gScale n d q ≤ tau (pairedFullLaw n d q 1 hn hd hq (by norm_num) θ)
Proof (Lean source)
lemma pairedFullLaw_tau_separated (n d : ℕ) (q c : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (θ : Theta n d) (hshift : c * gScale n d q ≤ delta q / (16 * q) * pairedWeightedSign n d θ / normalizationJ n d θ) : tau (pairedFullLaw n d q (-1) hn hd hq (by norm_num) θ) ≤ baseMean q - c * gScale n d q ∧ baseMean q + c * gScale n d q ≤ tau (pairedFullLaw n d q 1 hn hd hq (by norm_num) θ) := by have hminus := pairedFullLaw_tau_exact n d q (-1) hn hd hq (inl rfl) θ have hplus := pairedFullLaw_tau_exact n d q 1 hn hd hq (inr rfl) θ constructor · rw [hminus] have h := sub_le_sub_left hshift (baseMean q) convert h using 1 <;> ring · rw [hplus] norm_num linarith
theorem pairedWeightedSign_mean

Equation (18), first part: the signed latent mass has the displayed mean. Given the specified input n, the specified input d, the specified input q, the specified input hn, the specified input hd, the stated mathematical conclusion holds. Given the specified input hq.

Formal statement
n d :
ℕ
q :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
∫ θ, pairedWeightedSign n d θ ∂(thetaLaw n d q hn hd hq).toMeasure
= (pairCount n d : ℝ) * priorH n * priorB n / lagrangeNorm n
Proof (Lean source)
lemma pairedWeightedSign_mean (n d : ℕ) (q : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) : ∫ θ, pairedWeightedSign n d θ ∂(thetaLaw n d q hn hd hq).toMeasure = (pairCount n d : ℝ) * priorH n * priorB n / lagrangeNorm n := by let w : Latent n → ℝ := latentWeight n let X : Latent n → ℝ := fun z => latentP n z * latentZ n z have hwsum : ∑ z : Latent n, w z = 1 := by simp only [w, Fintype.sum_sum_type, Fintype.sum_unique, latentWeight] ring have hμ : ∑ z : Latent n, w z * X z = priorH n * priorB n / lagrangeNorm n := by simpa only [w, X] using latentWeightedSign_mean n have hmarg (j : Fin (pairCount n d)) : ∑ u : Fin (pairCount n d) → Latent n, (∏ k : Fin (pairCount n d), w (u k)) * X (u j) = ∑ z : Latent n, w z * X z := by have hfactor (u : Fin (pairCount n d) → Latent n) : (∏ k : Fin (pairCount n d), w (u k)) * X (u j) = ∏ k : Fin (pairCount n d), if k = j then w (u k) * X (u k) else w (u k) := by calc _ = (∏ k : Fin (pairCount n d), w (u k)) * ∏ k : Fin (pairCount n d), if k = j then X (u k) else 1 := by simp _ = ∏ k : Fin (pairCount n d), w (u k) * (if k = j then X (u k) else 1) := by rw [Finset.prod_mul_distrib] _ = _ := by simp calc _ = ∑ u : Fin (pairCount n d) → Latent n, ∏ k : Fin (pairCount n d), if k = j then w (u k) * X (u k) else w (u k) := by apply Finset.sum_congr rfl intro u _ exact hfactor u _ = ∏ k : Fin (pairCount n d), ∑ z : Latent n, if k = j then w z * X z else w z := by exact (Fintype.prod_sum (fun k : Fin (pairCount n d) => fun z : Latent n => if k = j then w z * X z else w z)).symm _ = ∑ z : Latent n, w z * X z := by simp [hwsum, Finset.prod_ite_eq'] rw [show (fun θ : Theta n d => pairedWeightedSign n d θ) = (fun θ => ∑ j : Fin (pairCount n d), latentP n (θ.1 j) * latentZ n (θ.1 j)) by funext θ exact pairedWeightedSign_apply n d θ] rw [thetaLaw_integral_fst n d q hn hd hq (fun u => ∑ j : Fin (pairCount n d), latentP n (u j) * latentZ n (u j))] calc (∑ u : Fin (pairCount n d) → Latent n, (∏ j : Fin (pairCount n d), latentWeight n (u j)) * ∑ j : Fin (pairCount n d), latentP n (u j) * latentZ n (u j)) = ∑ j : Fin (pairCount n d), ∑ u : Fin (pairCount n d) → Latent n, (∏ k : Fin (pairCount n d), w (u k)) * X (u j) := by simp only [w, X, Finset.mul_sum] rw [Finset.sum_comm] _ = ∑ _j : Fin (pairCount n d), (priorH n * priorB n / lagrangeNorm n) := by apply Finset.sum_congr rfl intro j _ rw [hmarg j, hμ] _ = (pairCount n d : ℝ) * priorH n * priorB n / lagrangeNorm n := by simp ring
theorem pairedWeightedSign_variance_bound

Equation (18), second part: the signed latent mass has the required variance bound. Given the specified input n, the specified input d, the specified input q, the specified input hn, the specified input hd, the stated mathematical conclusion holds. Given the specified input hq.

Formal statement
n d :
ℕ
q :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
∫ θ, (pairedWeightedSign n d θ - (pairCount n d : ℝ) * priorH n * priorB n / lagrangeNorm n) ^ 2 ∂(thetaLaw n d q hn hd hq).toMeasure
≤ (pairCount n d : ℝ) / (1024 ^ 2 * (n : ℝ) ^ 2)
Proof (Lean source)
lemma pairedWeightedSign_variance_bound (n d : ℕ) (q : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) : ∫ θ, (pairedWeightedSign n d θ - (pairCount n d : ℝ) * priorH n * priorB n / lagrangeNorm n) ^ 2 ∂(thetaLaw n d q hn hd hq).toMeasure ≤ (pairCount n d : ℝ) / (1024 ^ 2 * (n : ℝ) ^ 2) := by let w : Latent n → ℝ := latentWeight n let X : Latent n → ℝ := fun z => latentP n z * latentZ n z let μ : ℝ := priorH n * priorB n / lagrangeNorm n let c : Latent n → ℝ := fun z => X z - μ have hwsum : ∑ z : Latent n, w z = 1 := by simp only [w, Fintype.sum_sum_type, Fintype.sum_unique, latentWeight] ring have hμ : ∑ z : Latent n, w z * X z = μ := by simpa only [w, X, μ] using latentWeightedSign_mean n have hcenter : ∑ z : Latent n, w z * c z = 0 := by simp only [c, mul_sub, Finset.sum_sub_distrib, ← Finset.sum_mul] rw [hμ, hwsum] ring have hcell : ∑ z : Latent n, w z * c z ^ 2 ≤ 1 / (1024 ^ 2 * (n : ℝ) ^ 2) := by have hpoint (z : Latent n) : w z * c z ^ 2 = w z * X z ^ 2 - 2 * μ * (w z * X z) + μ ^ 2 * w z := by dsimp [c] ring calc _ = (∑ z : Latent n, w z * X z ^ 2) - 2 * μ ^ 2 + μ ^ 2 := by simp_rw [hpoint, Finset.sum_add_distrib, Finset.sum_sub_distrib, ← Finset.mul_sum] rw [hμ, hwsum] ring _ ≤ ∑ z : Latent n, w z * X z ^ 2 := by nlinarith [sq_nonneg μ] _ ≤ 1 / (1024 ^ 2 * (n : ℝ) ^ 2) := by simpa only [w, X] using latentWeightedSign_second_moment_le n hn rw [show (fun θ : Theta n d => (pairedWeightedSign n d θ - (pairCount n d : ℝ) * priorH n * priorB n / lagrangeNorm n) ^ 2) = (fun θ => (∑ j : Fin (pairCount n d), c (θ.1 j)) ^ 2) by funext θ rw [pairedWeightedSign_apply] simp only [c, X, μ, Finset.sum_sub_distrib, Finset.sum_const, Finset.card_univ, Fintype.card_fin, nsmul_eq_mul] ring] rw [thetaLaw_integral_fst n d q hn hd hq (fun u => (∑ j : Fin (pairCount n d), c (u j)) ^ 2)] rw [finiteProduct_centered_sum_sq w c hwsum hcenter] have hmul := mul_le_mul_of_nonneg_left hcell (show 0 ≤ (pairCount n d : ℝ) by positivity) simpa only [Fintype.card_fin, div_eq_mul_inv, one_mul] using hmul
CausalSmith.Stat.MarNearcompleteFrontier.pairedWeightedSign_variance_bound · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/NormalizedTargetConcentration.lean:383

Equation (19): the random normalizer has mean one and controlled variance. Given the specified input n, the specified input d, the specified input q, the specified input hn, the specified input hd, the stated mathematical conclusion holds. Given the specified input hq.

Formal statement
n d :
ℕ
q :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
conclusion 1
(∫ θ, normalizationJ n d θ ∂(thetaLaw n d q hn hd hq).toMeasure) = 1
conclusion 2
(∫ θ, (normalizationJ n d θ - 1) ^ 2 ∂(thetaLaw n d q hn hd hq).toMeasure)
≤ 4 * (pairCount n d : ℝ) / (1024 ^ 2 * (n : ℝ) ^ 2)
Proof (Lean source)
lemma normalizationJ_moments (n d : ℕ) (q : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) : (∫ θ, normalizationJ n d θ ∂(thetaLaw n d q hn hd hq).toMeasure) = 1 ∧ (∫ θ, (normalizationJ n d θ - 1) ^ 2 ∂(thetaLaw n d q hn hd hq).toMeasure) ≤ 4 * (pairCount n d : ℝ) / (1024 ^ 2 * (n : ℝ) ^ 2) := by let w : Latent n → ℝ := latentWeight n let X : Latent n → ℝ := latentP n let μ : ℝ := priorH n * priorB n let c : Latent n → ℝ := fun z => X z - μ have hwsum : ∑ z : Latent n, w z = 1 := by simp only [w, Fintype.sum_sum_type, Fintype.sum_unique, latentWeight] ring have hμ : ∑ z : Latent n, w z * X z = μ := by simpa only [w, X, μ] using latentMass_mean n have hcenter : ∑ z : Latent n, w z * c z = 0 := by simp only [c, mul_sub, Finset.sum_sub_distrib, ← Finset.sum_mul] rw [hμ, hwsum] ring have hcell : ∑ z : Latent n, w z * c z ^ 2 ≤ 1 / (1024 ^ 2 * (n : ℝ) ^ 2) := by have hpoint (z : Latent n) : w z * c z ^ 2 = w z * X z ^ 2 - 2 * μ * (w z * X z) + μ ^ 2 * w z := by dsimp [c] ring calc _ = (∑ z : Latent n, w z * X z ^ 2) - 2 * μ ^ 2 + μ ^ 2 := by simp_rw [hpoint, Finset.sum_add_distrib, Finset.sum_sub_distrib, ← Finset.mul_sum] rw [hμ, hwsum] ring _ ≤ ∑ z : Latent n, w z * X z ^ 2 := by nlinarith [sq_nonneg μ] _ ≤ 1 / (1024 ^ 2 * (n : ℝ) ^ 2) := by simpa only [w, X] using latentMass_second_moment_le n hn have hJfun : (fun θ : Theta n d => normalizationJ n d θ) = (fun θ => 1 + 2 * ∑ j : Fin (pairCount n d), c (θ.1 j)) := by funext θ unfold normalizationJ fillerMass simp only [c, X, μ, Finset.sum_sub_distrib, Finset.sum_const, Finset.card_univ, Fintype.card_fin, nsmul_eq_mul] ring constructor · rw [hJfun] rw [thetaLaw_integral_fst n d q hn hd hq (fun u => 1 + 2 * ∑ j : Fin (pairCount n d), c (u j))] have hprod : (∑ u : Fin (pairCount n d) → Latent n, ∏ j : Fin (pairCount n d), w (u j)) = 1 := by calc _ = ∏ _j : Fin (pairCount n d), ∑ z : Latent n, w z := by exact (Fintype.prod_sum (fun _j : Fin (pairCount n d) => w)).symm _ = 1 := by simp [hwsum] have hsum := finiteProduct_sum_mean (I := Fin (pairCount n d)) (A := Latent n) w c hwsum simp only [Fintype.card_fin, hcenter, mul_zero] at hsum calc (∑ u : Fin (pairCount n d) → Latent n, (∏ j : Fin (pairCount n d), latentWeight n (u j)) * (1 + 2 * ∑ j : Fin (pairCount n d), c (u j))) = (∑ u : Fin (pairCount n d) → Latent n, ∏ j : Fin (pairCount n d), w (u j)) + 2 * ∑ u : Fin (pairCount n d) → Latent n, (∏ j : Fin (pairCount n d), w (u j)) * ∑ j : Fin (pairCount n d), c (u j) := by calc _ = ∑ u : Fin (pairCount n d) → Latent n, ((∏ j : Fin (pairCount n d), w (u j)) + 2 * ((∏ j : Fin (pairCount n d), w (u j)) * ∑ j : Fin (pairCount n d), c (u j))) := by apply Finset.sum_congr rfl intro u _ simp only [w] ring _ = (∑ u : Fin (pairCount n d) → Latent n, ∏ j : Fin (pairCount n d), w (u j)) + ∑ u : Fin (pairCount n d) → Latent n, 2 * ((∏ j : Fin (pairCount n d), w (u j)) * ∑ j : Fin (pairCount n d), c (u j)) := by rw [Finset.sum_add_distrib] _ = _ := by rw [Finset.mul_sum] _ = 1 := by rw [hprod, hsum]; ring · rw [show (fun θ : Theta n d => (normalizationJ n d θ - 1) ^ 2) = (fun θ => (2 * ∑ j : Fin (pairCount n d), c (θ.1 j)) ^ 2) by funext θ rw [congrFun hJfun θ] ring] rw [thetaLaw_integral_fst n d q hn hd hq (fun u => (2 * ∑ j : Fin (pairCount n d), c (u j)) ^ 2)] calc (∑ u : Fin (pairCount n d) → Latent n, (∏ j : Fin (pairCount n d), latentWeight n (u j)) * (2 * ∑ j : Fin (pairCount n d), c (u j)) ^ 2) = 4 * ∑ u : Fin (pairCount n d) → Latent n, (∏ j : Fin (pairCount n d), w (u j)) * (∑ j : Fin (pairCount n d), c (u j)) ^ 2 := by rw [Finset.mul_sum] apply Finset.sum_congr rfl intro u _ simp only [w] ring _ = 4 * (pairCount n d : ℝ) * (∑ z : Latent n, w z * c z ^ 2) := by rw [finiteProduct_centered_sum_sq w c hwsum hcenter] simp only [Fintype.card_fin] ring _ ≤ 4 * (pairCount n d : ℝ) * (1 / (1024 ^ 2 * (n : ℝ) ^ 2)) := by exact mul_le_mul_of_nonneg_left hcell (mul_nonneg (by norm_num) (Nat.cast_nonneg _)) _ = 4 * (pairCount n d : ℝ) / (1024 ^ 2 * (n : ℝ) ^ 2) := by ring

Given the specified input n, the stated mathematical conclusion holds.

Formal statement
n :
ℕ
1 ≤ lagrangeNorm n
Proof (Lean source)
lemma lagrangeNorm_ge_one (n : ℕ) : 1 ≤ lagrangeNorm n := by have habs : |∑ i : Fin (priorK n), lagrangeAtZero n i| ≤ ∑ i : Fin (priorK n), |lagrangeAtZero n i| := Finset.abs_sum_le_sum_abs _ _ rw [lagrangeAtZero_sum_one, abs_one] at habs simpa [lagrangeNorm] using habs
theorem pairedMean_scale_lower

Given the specified input n, the specified input d, the specified input q, the specified input hn, the specified input n, the stated mathematical conclusion holds. Given the specified input hq, the specified input hreg.

Formal statement
n d :
ℕ
q :
ℝ
hn :
2 ≤ n
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
hreg :
gScale n d q ^ 2 ≥ 1 / (n : ℝ)
(1 / (36 * 1024 * cosh 2) : ℝ) * min 1 ((d : ℝ) / ((n : ℝ) * ell n))
≤ (pairCount n d : ℝ) * priorH n * priorB n / lagrangeNorm n
Proof (Lean source)
lemma pairedMean_scale_lower (n d : ℕ) (q : ℝ) (hn : 2 ≤ n) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (hreg : gScale n d q ^ 2 ≥ 1 / (n : ℝ)) : (1 / (36 * 1024 * cosh 2) : ℝ) * min 1 ((d : ℝ) / ((n : ℝ) * ell n)) ≤ (pairCount n d : ℝ) * priorH n * priorB n / lagrangeNorm n := by have hnpos : (0 : ℝ) < n := by positivity have hkNat := priorK_ge_two n have hkpos : (0 : ℝ) < priorK n := by exact_mod_cast (show 0 < priorK n by omega) have hL1 := lagrangeNorm_ge_one n have hLpos : 0 < lagrangeNorm n := lt_of_lt_of_le zero_lt_one hL1 have hCpos : 0 < cosh 2 := Real.cosh_pos 2 have hLC := lagrangeNorm_le_cosh_two n have hm0 : (0 : ℝ) ≤ pairCount n d := Nat.cast_nonneg _ have hp := pairCount_scale_lower n d q hn hq hreg have hHB : priorH n * priorB n = 1 / (1024 * (n : ℝ) * (priorK n : ℝ)) := by unfold priorH priorB field_simp [hnpos.ne', hkpos.ne'] rw [show (pairCount n d : ℝ) * priorH n * priorB n = (pairCount n d : ℝ) * (priorH n * priorB n) by ring, hHB] calc (1 / (36 * 1024 * cosh 2) : ℝ) * min 1 ((d : ℝ) / ((n : ℝ) * ell n)) = ((1 / 36 : ℝ) * min 1 ((d : ℝ) / ((n : ℝ) * ell n))) / (1024 * cosh 2) := by ring _ ≤ ((pairCount n d : ℝ) / ((n : ℝ) * (priorK n : ℝ))) / (1024 * cosh 2) := by gcongr _ ≤ ((pairCount n d : ℝ) / ((n : ℝ) * (priorK n : ℝ))) / (1024 * lagrangeNorm n) := by gcongr _ = (pairCount n d : ℝ) * (1 / (1024 * (n : ℝ) * (priorK n : ℝ))) / lagrangeNorm n := by ring

Given the specified input Q, the specified input F, the stated mathematical conclusion holds. Given the specified input α.

Formal statement
F :
α → ℝ
MemLp F 2 Q
Proof (Lean source)
lemma finite_memLp {α : Type*} [Fintype α] [MeasurableSpace α] [MeasurableSingletonClass α] (Q : Measure α) [IsFiniteMeasure Q] (F : α → ℝ) : MemLp F 2 Q := by apply MemLp.of_bound (measurable_of_finite F).aestronglyMeasurable (∑ x : α, |F x|) filter_upwards [] with x rw [Real.norm_eq_abs] exact Finset.single_le_sum (fun y _ => abs_nonneg (F y)) (Finset.mem_univ x)
theorem pairedWeightedSign_tail_eventual

the stated mathematical conclusion holds. Given the specified input β, the specified input hβ.

Formal statement
β :
ℝ
hβ :
0 < β
∃ N : ℕ,
2 ≤ N
conclusion 1
n d :
ℕ
q :
ℝ
N ≤ n
hn :
1 ≤ n
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
gScale n d q ^ 2 ≥ 1 / (n : ℝ)
(thetaLaw n d q hn hd hq).toMeasure.real {θ | ((pairCount n d : ℝ) * priorH n * priorB n / lagrangeNorm n) / 2 < |pairedWeightedSign n d θ - (pairCount n d : ℝ) * priorH n * priorB n / lagrangeNorm n|}
≤ β / 2
Proof (Lean source)
lemma pairedWeightedSign_tail_eventual (β : ℝ) (hβ : 0 < β) : ∃ N : ℕ, 2 ≤ N ∧ ∀ (n d : ℕ) (q : ℝ), N ≤ n → ∀ (hn : 1 ≤ n) (hd : 1 ≤ d) (hq : q ∈ Icc ((1 : ℝ) / 2) 1), gScale n d q ^ 2 ≥ 1 / (n : ℝ) → (thetaLaw n d q hn hd hq).toMeasure.real {θ | ((pairCount n d : ℝ) * priorH n * priorB n / lagrangeNorm n) / 2 < |pairedWeightedSign n d θ - (pairCount n d : ℝ) * priorH n * priorB n / lagrangeNorm n|} ≤ β / 2 := by let C := cosh 2 have hC : 0 < C := Real.cosh_pos 2 obtain ⟨N0, hN02, hN0⟩ := eventually_priorK_sq_div_pairCount_le (β / (8 * C ^ 2)) (by positivity) refine ⟨N0, hN02, ?_⟩ intro n d q hnN hn hd hq hreg let Q := (thetaLaw n d q hn hd hq).toMeasure let W : Theta n d → ℝ := pairedWeightedSign n d let μ := (pairCount n d : ℝ) * priorH n * priorB n / lagrangeNorm n let v := (pairCount n d : ℝ) / (1024 ^ 2 * (n : ℝ) ^ 2) have hn2 : 2 ≤ n := le_trans hN02 hnN have hnpos : (0 : ℝ) < n := by positivity have hkNat := priorK_ge_two n have hkpos : (0 : ℝ) < priorK n := by exact_mod_cast (show 0 < priorK n by omega) have hL1 := lagrangeNorm_ge_one n have hLpos : 0 < lagrangeNorm n := lt_of_lt_of_le zero_lt_one hL1 have hmratio := hN0 n d q hnN hq hreg have hr2 := regime_min_scale_sq_lower n d q hn hq hreg have hrpos : 0 < min 1 ((d : ℝ) / ((n : ℝ) * ell n)) := by have hfour : 0 < (4 : ℝ) / (n : ℝ) := div_pos (by norm_num) hnpos have hspos := lt_of_lt_of_le hfour hr2 have hellpos : 0 < ell n := lt_of_lt_of_le zero_lt_one (one_le_ell_scale n) have hr0 : 0 ≤ min 1 ((d : ℝ) / ((n : ℝ) * ell n)) := le_min (by norm_num) (div_nonneg (Nat.cast_nonneg _) (mul_pos hnpos hellpos).le) nlinarith have hp := pairCount_scale_lower n d q hn2 hq hreg have hquotpos : 0 < (pairCount n d : ℝ) / ((n : ℝ) * (priorK n : ℝ)) := lt_of_lt_of_le (mul_pos (by norm_num) hrpos) hp have hmpos : 0 < (pairCount n d : ℝ) := by by_contra hm have hmzero : (pairCount n d : ℝ) = 0 := le_antisymm (not_lt.mp hm) (Nat.cast_nonneg _) rw [hmzero] at hquotpos simp at hquotpos have hmulower := pairedMean_scale_lower n d q hn2 hq hreg have hμpos : 0 < μ := by dsimp [μ] exact lt_of_lt_of_le (mul_pos (by positivity) hrpos) hmulower have hmem : MemLp W 2 Q := finite_memLp Q W have hmean : (∫ θ, W θ ∂Q) = μ := by exact pairedWeightedSign_mean n d q hn hd hq have hvar : variance W Q ≤ v := by rw [variance_eq_integral hmem.1.aemeasurable, hmean] exact pairedWeightedSign_variance_bound n d q hn hd hq have hcheb := probability_abs_sub_mean_gt_le Q W μ v (μ / 2) hmem (by positivity) hmean hvar have hratio : v / (μ / 2) ^ 2 = 4 * (priorK n : ℝ) ^ 2 * lagrangeNorm n ^ 2 / (pairCount n d : ℝ) := by dsimp [v, μ] unfold priorH priorB field_simp [hnpos.ne', hkpos.ne', hLpos.ne', hmpos.ne'] ring rw [hratio] at hcheb calc Q.real {θ | μ / 2 < |W θ - μ|} ≤ 4 * (priorK n : ℝ) ^ 2 * lagrangeNorm n ^ 2 / (pairCount n d : ℝ) := hcheb _ ≤ 4 * C ^ 2 * ((priorK n : ℝ) ^ 2 / (pairCount n d : ℝ)) := by have hLC := lagrangeNorm_le_cosh_two n have hLsq : lagrangeNorm n ^ 2 ≤ C ^ 2 := by dsimp [C] nlinarith [sq_nonneg (cosh 2 - lagrangeNorm n)] field_simp [hmpos.ne'] nlinarith [mul_nonneg (sq_nonneg (priorK n : ℝ)) (sub_nonneg.mpr hLsq)] _ ≤ 4 * C ^ 2 * (β / (8 * C ^ 2)) := mul_le_mul_of_nonneg_left hmratio (by positivity) _ = β / 2 := by field_simp [hC.ne']; ring
CausalSmith.Stat.MarNearcompleteFrontier.pairedWeightedSign_tail_eventual · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/NormalizedTargetConcentration.lean:608
theorem normalizationJ_tail_eventual Lemma normalizationJ_tail_eventual in the paper ↗

the stated mathematical conclusion holds. Given the specified input β, the specified input hβ.

Formal statement
β :
ℝ
hβ :
0 < β
∃ N : ℕ,
∀ (n d : ℕ) (q : ℝ),
N
≤ n → ∀ (hn : 1 ≤ n) (hd : 1 ≤ d) (hq : q ∈ Icc ((1 : ℝ) / 2) 1), (thetaLaw n d q hn hd hq).toMeasure.real {θ | (1 / 2 : ℝ) < |normalizationJ n d θ - 1|} ≤ β / 2
Proof (Lean source)
lemma normalizationJ_tail_eventual (β : ℝ) (hβ : 0 < β) : ∃ N : ℕ, ∀ (n d : ℕ) (q : ℝ), N ≤ n → ∀ (hn : 1 ≤ n) (hd : 1 ≤ d) (hq : q ∈ Icc ((1 : ℝ) / 2) 1), (thetaLaw n d q hn hd hq).toMeasure.real {θ | (1 / 2 : ℝ) < |normalizationJ n d θ - 1|} ≤ β / 2 := by obtain ⟨N0, hN0⟩ := eventually_ell_sq_le (β * 1024 ^ 2 / 32) (by positivity) refine ⟨N0, ?_⟩ intro n d q hnN hn hd hq let Q := (thetaLaw n d q hn hd hq).toMeasure let J : Theta n d → ℝ := normalizationJ n d let v := 4 * (pairCount n d : ℝ) / (1024 ^ 2 * (n : ℝ) ^ 2) have hnpos : (0 : ℝ) < n := by positivity have hmem : MemLp J 2 Q := finite_memLp Q J have hmom := normalizationJ_moments n d q hn hd hq have hmean : (∫ θ, J θ ∂Q) = 1 := hmom.1 have hvar : variance J Q ≤ v := by rw [variance_eq_integral hmem.1.aemeasurable, hmean] exact hmom.2 have hcheb := probability_abs_sub_mean_gt_le Q J 1 v (1 / 2) hmem (by norm_num) hmean hvar have hratio : v / (1 / 2) ^ 2 = 16 * (pairCount n d : ℝ) / (1024 ^ 2 * (n : ℝ) ^ 2) := by dsimp [v] ring rw [hratio] at hcheb have hmNat : pairCount n d ≤ floor ((n : ℝ) * ell n) := by exact min_le_right _ _ have hmcast : (pairCount n d : ℝ) ≤ (floor ((n : ℝ) * ell n) : ℕ) := by exact_mod_cast hmNat have hfloor := Nat.floor_le (mul_nonneg (Nat.cast_nonneg n) (le_trans (by norm_num) (one_le_ell_scale n))) have hmle : (pairCount n d : ℝ) ≤ (n : ℝ) * ell n := le_trans hmcast hfloor have hell := one_le_ell_scale n have heps := hN0 n hnN calc Q.real {θ | (1 / 2 : ℝ) < |J θ - 1|} ≤ 16 * (pairCount n d : ℝ) / (1024 ^ 2 * (n : ℝ) ^ 2) := hcheb _ ≤ 16 * ((n : ℝ) * ell n) / (1024 ^ 2 * (n : ℝ) ^ 2) := by gcongr _ = 16 * ell n / (1024 ^ 2 * (n : ℝ)) := by field_simp [hnpos.ne'] _ ≤ 16 * ell n ^ 2 / (1024 ^ 2 * (n : ℝ)) := by gcongr nlinarith _ ≤ β / 2 := by have hden : 0 < (1024 : ℝ) ^ 2 * (n : ℝ) := by positivity apply (div_le_iff₀ hden).2 nlinarith
theorem paired_target_good_event_eventual

Equations (20)--(24): beyond a tolerance-dependent threshold, the normalized signed latent mass dominates a universal multiple of gScale with prior probability at least 1-β. the stated mathematical conclusion holds. Given the specified input β, the specified input hβ.

Formal statement
β :
ℝ
hβ :
0 < β
∃ N : ℕ,
2 ≤ N
conclusion 1
∃ c : ℝ,
0 < c
n d :
ℕ
q :
ℝ
hnN :
N ≤ n
hn :
1 ≤ n
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
gScale n d q ^ 2 ≥ 1 / (n : ℝ)
1 - β
≤ (thetaLaw n d q hn hd hq).toMeasure.real {θ | c * gScale n d q ≤ delta q / (16 * q) * pairedWeightedSign n d θ / normalizationJ n d θ}
Proof (Lean source)
lemma paired_target_good_event_eventual (β : ℝ) (hβ : 0 < β) : ∃ N : ℕ, 2 ≤ N ∧ ∃ c : ℝ, 0 < c ∧ ∀ (n d : ℕ) (q : ℝ), ∀ (hnN : N ≤ n) (hn : 1 ≤ n) (hd : 1 ≤ d) (hq : q ∈ Icc ((1 : ℝ) / 2) 1), gScale n d q ^ 2 ≥ 1 / (n : ℝ) → 1 - β ≤ (thetaLaw n d q hn hd hq).toMeasure.real {θ | c * gScale n d q ≤ delta q / (16 * q) * pairedWeightedSign n d θ / normalizationJ n d θ} := by obtain ⟨NW, hNW2, hWtail⟩ := pairedWeightedSign_tail_eventual β hβ obtain ⟨NJ, hJtail⟩ := normalizationJ_tail_eventual β hβ let C := cosh 2 let c : ℝ := 1 / (36 * 1024 * C * 48) refine ⟨max NW NJ, le_trans hNW2 (le_max_left _ _), c, ?_, ?_⟩ · dsimp [c, C] positivity intro n d q hnN hn hd hq hreg have hnW : NW ≤ n := le_trans (le_max_left _ _) hnN have hnJ : NJ ≤ n := le_trans (le_max_right _ _) hnN have hn2 : 2 ≤ n := le_trans hNW2 hnW let Q := (thetaLaw n d q hn hd hq).toMeasure let W : Theta n d → ℝ := pairedWeightedSign n d let J : Theta n d → ℝ := normalizationJ n d let μ := (pairCount n d : ℝ) * priorH n * priorB n / lagrangeNorm n let G : Set (Theta n d) := {θ | |W θ - μ| ≤ μ / 2 ∧ |J θ - 1| ≤ 1 / 2} let BW : Set (Theta n d) := {θ | μ / 2 < |W θ - μ|} let BJ : Set (Theta n d) := {θ | (1 / 2 : ℝ) < |J θ - 1|} have hWt : Q.real BW ≤ β / 2 := hWtail n d q hnW hn hd hq hreg have hJt : Q.real BJ ≤ β / 2 := hJtail n d q hnJ hn hd hq have hsubcomp : Gᶜ ⊆ BW ∪ BJ := by intro θ hθ simp only [G, BW, BJ, Set.mem_compl_iff, Set.mem_setOf_eq, Set.mem_union] at hθ ⊢ by_cases h1 : |W θ - μ| ≤ μ / 2 · right exact lt_of_not_ge (fun h2 => hθ ⟨h1, h2⟩) · left exact lt_of_not_ge h1 have hGmeas : MeasurableSet G := Set.Finite.measurableSet (Set.toFinite G) have hGcomp : Q.real Gᶜ ≤ β := by calc Q.real Gᶜ ≤ Q.real (BW ∪ BJ) := measureReal_mono hsubcomp _ ≤ Q.real BW + Q.real BJ := measureReal_union_le BW BJ _ ≤ β := by linarith have hGprob : 1 - β ≤ Q.real G := by rw [measureReal_compl hGmeas, probReal_univ] at hGcomp linarith apply le_trans hGprob refine measureReal_mono ?_ (by finiteness) intro θ hθ simp only [G, Set.mem_setOf_eq] at hθ ⊢ have hnpos : (0 : ℝ) < n := by positivity have hr2 := regime_min_scale_sq_lower n d q hn hq hreg have hrpos : 0 < min 1 ((d : ℝ) / ((n : ℝ) * ell n)) := by have hfour : 0 < (4 : ℝ) / (n : ℝ) := div_pos (by norm_num) hnpos have hspos := lt_of_lt_of_le hfour hr2 have hellpos : 0 < ell n := lt_of_lt_of_le zero_lt_one (one_le_ell_scale n) have hr0 : 0 ≤ min 1 ((d : ℝ) / ((n : ℝ) * ell n)) := le_min (by norm_num) (div_nonneg (Nat.cast_nonneg _) (mul_pos hnpos hellpos).le) nlinarith have hmulower := pairedMean_scale_lower n d q hn2 hq hreg have hμpos : 0 < μ := by dsimp [μ] exact lt_of_lt_of_le (mul_pos (by positivity) hrpos) hmulower have hWlower : μ / 2 ≤ W θ := by have habs := (abs_le.mp hθ.1).1 linarith have hJupper : J θ ≤ 3 / 2 := by have habs := (abs_le.mp hθ.2).2 linarith have hJpos : 0 < J θ := normalizationJ_pos n d q hn hd hq θ have hratio : μ / 3 ≤ W θ / J θ := by apply (le_div_iff₀ hJpos).2 have hμ0 : 0 ≤ μ := hμpos.le nlinarith [mul_nonneg hμ0 (sub_nonneg.mpr hJupper)] have hδ0 : 0 ≤ delta q := by unfold delta; linarith [hq.2] have hqpos : 0 < q := lt_of_lt_of_le (by norm_num) hq.1 have hratio0 : 0 ≤ W θ / J θ := le_trans (by positivity : 0 ≤ μ / 3) hratio have hcoef : delta q * μ / 48 ≤ delta q / (16 * q) * W θ / J θ := by calc delta q * μ / 48 = (delta q / 16) * (μ / 3) := by ring _ ≤ (delta q / 16) * (W θ / J θ) := mul_le_mul_of_nonneg_left hratio (by positivity) _ ≤ (delta q / (16 * q)) * (W θ / J θ) := by apply mul_le_mul_of_nonneg_right _ hratio0 apply (div_le_div_iff₀ (by norm_num : (0 : ℝ) < 16) (mul_pos (by norm_num) hqpos)).2 nlinarith [mul_nonneg hδ0 (sub_nonneg.mpr hq.2)] _ = delta q / (16 * q) * W θ / J θ := by ring calc c * gScale n d q = (delta q / 48) * ((1 / (36 * 1024 * C)) * min 1 ((d : ℝ) / ((n : ℝ) * ell n))) := by dsimp [c] simp only [gScale] ring _ ≤ (delta q / 48) * μ := mul_le_mul_of_nonneg_left hmulower (by positivity) _ = delta q * μ / 48 := by ring _ ≤ _ := hcoef
CausalSmith.Stat.MarNearcompleteFrontier.paired_target_good_event_eventual · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/NormalizedTargetConcentration.lean:747
CausalSmith.Stat.STAT_MarNearcompleteFrontier_Research.Helpers.LowerBound.ObservedAtoms 4 declarations The full-data construction marginalizes to the displayed count-experiment coefficients divided by the shared normalizer.

Exact observed-atom masses of the normalized paired construction

The full-data construction marginalizes to the displayed count-experiment coefficients divided by the shared normalizer.

theorem pairAtomWeight_observed_sum

An oriented pair marginalizes to its displayed observed coefficient. Given the specified input n, the specified input d, the specified input q, the specified input hd, the specified input side, the specified input o, the stated mathematical conclusion holds. Given the specified input σ, the specified input θ. Given the specified input j, the specified input hq, the specified input hσ.

Formal statement
n d :
ℕ
q σ :
ℝ
hd :
1 ≤ d
θ :
Theta n d
j :
side :
o :
Obs d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
hσ :
σ ∈ Icc (-1) 1
(∑ w : FullAtom d, if observe w = o then pairAtomWeight n d q σ hd θ j side w else 0)
= if o.X = pairLabel n d hd j side then latentP n (θ.1 j) / normalizationJ n d θ * pairObservedCoeff q σ (latentZ n (θ.1 j)) (orientation θ j side) o else 0
Proof (Lean source)
-- @node: pairAtomWeight_observed_sum lemma pairAtomWeight_observed_sum (n d : ℕ) (q σ : ℝ) (hd : 1 ≤ d) (θ : Theta n d) (j : Fin (pairCount n d)) (side : Bool) (o : Obs d) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (hσ : σ ∈ Icc (-1) 1) : (∑ w : FullAtom d, if observe w = o then pairAtomWeight n d q σ hd θ j side w else 0) = if o.X = pairLabel n d hd j side then latentP n (θ.1 j) / normalizationJ n d θ * pairObservedCoeff q σ (latentZ n (θ.1 j)) (orientation θ j side) o else 0 := by have hρ : pairRho q σ (latentZ n (θ.1 j)) (orientation θ j side) ≠ 0 := by have h := pairRho_mem_unit q σ (latentZ n (θ.1 j)) (orientation θ j side) hq (pair_sign_mem_unit n d σ hσ θ j side) exact ne_of_gt (lt_of_lt_of_le (by linarith [hq.1]) h.1) rw [Fintype.sum_equiv (fullAtomTupleEquiv d) (fun w => if observe w = o then pairAtomWeight n d q σ hd θ j side w else 0) (fun t => if observe ((fullAtomTupleEquiv d).symm t) = o then pairAtomWeight n d q σ hd θ j side ((fullAtomTupleEquiv d).symm t) else 0) (by intro w; simp)] rcases o with ⟨x, a, s, r, y⟩ cases a <;> cases s <;> cases r <;> cases y <;> simp [Fintype.sum_prod_type, fullAtomTupleEquiv, pairAtomWeight, observe, bernoulliFactor, FullAtom.X, FullAtom.S0, FullAtom.S1, FullAtom.Y0, FullAtom.Y1, Obs.mk.injEq, pairObservedCoeff] all_goals by_cases hx : x = pairLabel n d hd j side · simp only [hx, ↓reduceIte] simp only [pairMu] field_simp [hρ] try simp only [pairRho] ring · simp [hx]
CausalSmith.Stat.MarNearcompleteFrontier.pairAtomWeight_observed_sum · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/ObservedAtoms.lean:12
theorem fillerAtomWeight_observed_sum

The filler marginalizes to its common observed coefficient. Given the specified input n, the specified input d, the specified input q, the specified input hd, the specified input o, the stated mathematical conclusion holds. Given the specified input θ.

Formal statement
n d :
ℕ
q :
ℝ
hd :
1 ≤ d
θ :
Theta n d
o :
Obs d
(∑ w : FullAtom d, if observe w = o then fillerAtomWeight n d q hd θ w else 0)
= if o.X = fillerLabel d hd then fillerMass n d / normalizationJ n d θ * fillerObservedCoeff q o else 0
Proof (Lean source)
-- @node: fillerAtomWeight_observed_sum lemma fillerAtomWeight_observed_sum (n d : ℕ) (q : ℝ) (hd : 1 ≤ d) (θ : Theta n d) (o : Obs d) : (∑ w : FullAtom d, if observe w = o then fillerAtomWeight n d q hd θ w else 0) = if o.X = fillerLabel d hd then fillerMass n d / normalizationJ n d θ * fillerObservedCoeff q o else 0 := by rw [Fintype.sum_equiv (fullAtomTupleEquiv d) (fun w => if observe w = o then fillerAtomWeight n d q hd θ w else 0) (fun t => if observe ((fullAtomTupleEquiv d).symm t) = o then fillerAtomWeight n d q hd θ ((fullAtomTupleEquiv d).symm t) else 0) (by intro w; simp)] rcases o with ⟨x, a, s, r, y⟩ cases a <;> cases s <;> cases r <;> cases y <;> simp [Fintype.sum_prod_type, fullAtomTupleEquiv, fillerAtomWeight, observe, bernoulliFactor, FullAtom.X, FullAtom.S0, FullAtom.S1, FullAtom.Y0, FullAtom.Y1, Obs.mk.injEq, fillerObservedCoeff] all_goals by_cases hx : x = fillerLabel d hd · simp only [hx, ↓reduceIte] ring · simp [hx]
CausalSmith.Stat.MarNearcompleteFrontier.fillerAtomWeight_observed_sum · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/ObservedAtoms.lean:44
theorem pairedFullLaw_observed_atom_mass

The normalized observed atom mass is the unnormalized count mass divided by the shared scale. Given the specified input n, the specified input d, the specified input q, the specified input hn, the specified input hd, the specified input o, the stated mathematical conclusion holds. Given the specified input σ, the specified input θ. Given the specified input hq, the specified input hσ.

Formal statement
n d :
ℕ
q σ :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
hσ :
σ ∈ Icc (-1) 1
θ :
Theta n d
o :
Obs d
obsMass (observedLaw (pairedFullLaw n d q σ hn hd hq hσ θ)) o
= countAtomMass n d q σ hd θ o / normalizationJ n d θ
Proof (Lean source)
-- @node: pairedFullLaw_observed_atom_mass lemma pairedFullLaw_observed_atom_mass (n d : ℕ) (q σ : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (hσ : σ ∈ Icc (-1) 1) (θ : Theta n d) (o : Obs d) : obsMass (observedLaw (pairedFullLaw n d q σ hn hd hq hσ θ)) o = countAtomMass n d q σ hd θ o / normalizationJ n d θ := by have hmass : obsMass (observedLaw (pairedFullLaw n d q σ hn hd hq hσ θ)) o = ∑ w : FullAtom d, if observe w = o then pairedAtomWeight n d q σ hd θ w else 0 := by simp only [obsMass, observedLaw, PMF.map_apply, tsum_fintype] rw [ENNReal.toReal_sum (fun w _ => by split_ifs <;> simp [pairedFullLaw])] apply Finset.sum_congr rfl intro w _ by_cases hw : observe w = o · simp [hw, pairedFullLaw, pairedAtomWeight_nonneg n d q σ hn hd hq hσ θ w] · have hwo : ¬ o = observe w := Ne.symm hw simp [hw, hwo] rw [hmass] have hsplit (w : FullAtom d) : (if observe w = o then pairedAtomWeight n d q σ hd θ w else 0) = (if observe w = o then fillerAtomWeight n d q hd θ w else 0) + ∑ j : Fin (pairCount n d), ∑ side : Bool, if observe w = o then pairAtomWeight n d q σ hd θ j side w else 0 := by by_cases hw : observe w = o <;> simp [hw, pairedAtomWeight] simp_rw [hsplit] rw [Finset.sum_add_distrib, fillerAtomWeight_observed_sum] rw [Finset.sum_comm] simp_rw [Finset.sum_comm (s := (Finset.univ : Finset (FullAtom d))) (t := (Finset.univ : Finset Bool))] simp_rw [pairAtomWeight_observed_sum n d q σ hd θ _ _ o hq hσ] unfold countAtomMass rw [add_div, Finset.sum_div] congr 1 · split_ifs <;> (try simp) <;> ring · apply Finset.sum_congr rfl intro j _ rw [Finset.sum_div] apply Finset.sum_congr rfl intro side _ split_ifs <;> (try simp) <;> ring
CausalSmith.Stat.MarNearcompleteFrontier.pairedFullLaw_observed_atom_mass · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/ObservedAtoms.lean:67
theorem conditionalCountLaw_eq_independentPoissonCountLaw Lemma conditionalCountLaw_eq_independentPoissonCountLaw in the paper ↗

The paper's conditional count experiment is the histogram law of the normalized observed distribution at intensity four n times the shared scale. Given the specified input n, the specified input d, the specified input q, the specified input hn, the specified input hd, the stated mathematical conclusion holds. Given the specified input σ, the specified input θ. Given the specified input hq, the specified input hσ.

Formal statement
n d :
ℕ
q σ :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
hσ :
σ ∈ Icc (-1) 1
θ :
Theta n d
conditionalCountLaw n d q σ hd θ
= independentPoissonCountLaw (observedLaw (pairedFullLaw n d q σ hn hd hq hσ θ)).toMeasure (toNNReal (4 * (n : ℝ)) * toNNReal (normalizationJ n d θ))
Proof (Lean source)
-- @node: conditionalCountLaw_eq_independentPoissonCountLaw lemma conditionalCountLaw_eq_independentPoissonCountLaw (n d : ℕ) (q σ : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (hσ : σ ∈ Icc (-1) 1) (θ : Theta n d) : conditionalCountLaw n d q σ hd θ = independentPoissonCountLaw (observedLaw (pairedFullLaw n d q σ hn hd hq hσ θ)).toMeasure (toNNReal (4 * (n : ℝ)) * toNNReal (normalizationJ n d θ)) := by unfold conditionalCountLaw independentPoissonCountLaw congr 1 funext o congr 1 apply NNReal.eq have hJ := normalizationJ_pos n d q hn hd hq θ have hp : 0 ≤ (4 : ℝ) * n := by positivity have hm := pairedFullLaw_observed_atom_mass n d q σ hn hd hq hσ θ o have hm0 : 0 ≤ countAtomMass n d q σ hd θ o := by have : 0 ≤ obsMass (observedLaw (pairedFullLaw n d q σ hn hd hq hσ θ)) o := ENNReal.toReal_nonneg rw [hm] at this have hx := mul_nonneg this hJ.le rw [div_mul_cancel₀ _ (ne_of_gt hJ)] at hx exact hx rw [PMF.toMeasure_apply_singleton _ _ (measurableSet_singleton _)] simp only [NNReal.coe_mul, Real.coe_toNNReal _ hp, Real.coe_toNNReal _ hJ.le, ENNReal.coe_toNNReal] rw [Real.toNNReal_of_nonneg (mul_nonneg hp hm0)] change 4 * (n : ℝ) * countAtomMass n d q σ hd θ o = 4 * (n : ℝ) * normalizationJ n d θ * obsMass (observedLaw (pairedFullLaw n d q σ hn hd hq hσ θ)) o rw [hm] field_simp [ne_of_gt hJ]
CausalSmith.Stat.MarNearcompleteFrontier.conditionalCountLaw_eq_independentPoissonCountLaw · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/ObservedAtoms.lean:110
CausalSmith.Stat.STAT_MarNearcompleteFrontier_Research.Helpers.LowerBound.OneCell 16 declarations This module gives the explicit Bernoulli submodel used for the parametric point-risk and honest-interval floors.

Complete-arrival one-cell submodel

This module gives the explicit Bernoulli submodel used for the parametric point-risk and honest-interval floors.

def parametricAtom

The full-data atom generated from a fair treatment bit and one treated-potential bit.

Definition (Lean source)
d :
ℕ
x :
Fin d
a y :
parametricAtom x a y :
⟨⟨x, false, false, false, y⟩, a, false, (if a then y else false), true⟩
def parametricBoolPMF

Bernoulli PMF written with real-valued success probability.

Definition (Lean source)
p :
ℝ
hp :
p ∈ Icc 0 1
parametricBoolPMF p hp :
PMF.ofFintype (fun b => ofReal (if b then p else 1 - p)) (by have hp' : 0 ≤ 1 - p := sub_nonneg.mpr hp.2 simp only [Fintype.sum_bool, Bool.false_eq_true, if_false, if_true] rw [← ENNReal.ofReal_add hp.1 hp'] norm_num)
CausalSmith.Stat.MarNearcompleteFrontier.parametricBoolPMF · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/OneCell.lean:24
def parametricFullLaw

Complete-arrival one-cell Bernoulli law with treated mean p.

Definition (Lean source)
d :
ℕ
x :
Fin d
p :
ℝ
hp :
p ∈ Icc 0 1
parametricFullLaw x p hp :
⟨(parametricBoolPMF (1 / 2) (by norm_num)).bind fun a
CausalSmith.Stat.MarNearcompleteFrontier.parametricFullLaw · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/OneCell.lean:33
theorem parametricBernoulli_toReal

For a probability in the unit interval and a binary outcome, the Bernoulli point mass equals its usual real-valued probability.

Formal statement
p :
ℝ
hp :
p ∈ Icc 0 1
b :
(parametricBoolPMF p hp b).toReal = if b then p else 1 - p
Proof (Lean source)
lemma parametricBernoulli_toReal (p : ℝ) (hp : p ∈ Icc 0 1) (b : Bool) : (parametricBoolPMF p hp b).toReal = if b then p else 1 - p := by cases b <;> simp [parametricBoolPMF, hp.1, sub_nonneg.mpr hp.2]
CausalSmith.Stat.MarNearcompleteFrontier.parametricBernoulli_toReal · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/OneCell.lean:40
theorem parametricFullLaw_fullMass

For a valid treated success probability and a full-data atom, the one-cell law's atom mass is the sum of its fair-treatment and outcome weights over generating pairs.

Formal statement
d :
ℕ
x :
Fin d
p :
ℝ
hp :
p ∈ Icc 0 1
w :
= ∑ a : Bool, ∑ y : Bool, if w = parametricAtom x a y then (1 / 2 : ℝ) * (if y then p else 1 - p) else 0
Proof (Lean source)
lemma parametricFullLaw_fullMass {d : ℕ} (x : Fin d) (p : ℝ) (hp : p ∈ Icc 0 1) (w : FullAtom d) : fullMass (parametricFullLaw x p hp) w = ∑ a : Bool, ∑ y : Bool, if w = parametricAtom x a y then (1 / 2 : ℝ) * (if y then p else 1 - p) else 0 := by simp only [fullMass, parametricFullLaw, PMF.bind_apply, PMF.map_apply, tsum_fintype] rw [ENNReal.toReal_sum] · apply Finset.sum_congr rfl intro a _ rw [ENNReal.toReal_mul, ENNReal.toReal_sum] · rw [Finset.mul_sum] apply Finset.sum_congr rfl intro y _ by_cases h : w = parametricAtom x a y · subst w simp only [if_true] rw [parametricBernoulli_toReal (1 / 2) (by norm_num) a, parametricBernoulli_toReal p hp y] cases a <;> cases y <;> norm_num · simp [h] · intro y _ split · exact PMF.apply_ne_top _ _ · exact ENNReal.zero_ne_top · intro a _ apply ENNReal.mul_ne_top · exact PMF.apply_ne_top _ _ · rw [ENNReal.sum_ne_top] intro y _ split · exact PMF.apply_ne_top _ _ · exact ENNReal.zero_ne_top
CausalSmith.Stat.MarNearcompleteFrontier.parametricFullLaw_fullMass · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/OneCell.lean:46
theorem parametricFullLaw_massOf

For a valid treated success probability and a decidable event, the one-cell event probability reduces to the four generating treatment-outcome pairs.

Formal statement
d :
ℕ
x :
Fin d
p :
ℝ
hp :
p ∈ Icc 0 1
E :
= ∑ a : Bool, ∑ y : Bool, if E (parametricAtom x a y) then (1 / 2 : ℝ) * (if y then p else 1 - p) else 0
Proof (Lean source)
lemma parametricFullLaw_massOf {d : ℕ} (x : Fin d) (p : ℝ) (hp : p ∈ Icc 0 1) (E : FullAtom d → Prop) [DecidablePred E] : massOf (parametricFullLaw x p hp) E = ∑ a : Bool, ∑ y : Bool, if E (parametricAtom x a y) then (1 / 2 : ℝ) * (if y then p else 1 - p) else 0 := by classical unfold massOf simp_rw [parametricFullLaw_fullMass] calc _ = ∑ w : FullAtom d, ∑ a : Bool, ∑ y : Bool, if E w ∧ w = parametricAtom x a y then (1 / 2 : ℝ) * (if y then p else 1 - p) else 0 := by apply Finset.sum_congr rfl intro w _ by_cases hE : E w <;> simp [hE] _ = _ := by rw [Finset.sum_comm] apply Finset.sum_congr rfl intro a _ rw [Finset.sum_comm] apply Finset.sum_congr rfl intro y _ rw [Finset.sum_eq_single (parametricAtom x a y)] · simp · intro w _ hw by_cases hc : E w ∧ w = parametricAtom x a y · exact (hw hc.2).elim · simp [hc] · simp
CausalSmith.Stat.MarNearcompleteFrontier.parametricFullLaw_massOf · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/OneCell.lean:83
theorem parametricFullLaw_sum

For a valid treated success probability and an outcome function, the one-cell expectation reduces to the four generating treatment-outcome pairs.

Formal statement
d :
ℕ
x :
Fin d
p :
ℝ
hp :
p ∈ Icc 0 1
f :
FullAtom d → ℝ
(∑ w : FullAtom d, fullMass (parametricFullLaw x p hp) w * f w)
= ∑ a : Bool, ∑ y : Bool, ((1 / 2 : ℝ) * (if y then p else 1 - p)) * f (parametricAtom x a y)
Proof (Lean source)
lemma parametricFullLaw_sum {d : ℕ} (x : Fin d) (p : ℝ) (hp : p ∈ Icc 0 1) (f : FullAtom d → ℝ) : (∑ w : FullAtom d, fullMass (parametricFullLaw x p hp) w * f w) = ∑ a : Bool, ∑ y : Bool, ((1 / 2 : ℝ) * (if y then p else 1 - p)) * f (parametricAtom x a y) := by classical simp_rw [parametricFullLaw_fullMass, Finset.sum_mul] rw [Finset.sum_comm] apply Finset.sum_congr rfl intro a _ rw [Finset.sum_comm] apply Finset.sum_congr rfl intro y _ simp
CausalSmith.Stat.MarNearcompleteFrontier.parametricFullLaw_sum · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/OneCell.lean:117
theorem parametricFullLaw_mass_zero_of_not_generated

For a valid treated success probability, if a full-data atom is not one of the generated treatment-outcome atoms, the one-cell law assigns it zero mass.

Formal statement
d :
ℕ
x :
Fin d
p :
ℝ
hp :
p ∈ Icc 0 1
w :
h :
∀ a y : Bool, w ≠ parametricAtom x a y
Proof (Lean source)
lemma parametricFullLaw_mass_zero_of_not_generated {d : ℕ} (x : Fin d) (p : ℝ) (hp : p ∈ Icc 0 1) (w : FullAtom d) (h : ∀ a y : Bool, w ≠ parametricAtom x a y) : fullMass (parametricFullLaw x p hp) w = 0 := by rw [parametricFullLaw_fullMass] simp [h]
CausalSmith.Stat.MarNearcompleteFrontier.parametricFullLaw_mass_zero_of_not_generated · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/OneCell.lean:133
theorem parametricFullLaw_complete

The one-cell family has deterministic outcome arrival. Given the specified input d, the specified input x, the specified input p, the specified input hp, the specified input w, the specified input hR, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
x :
Fin d
p :
ℝ
hp :
p ∈ Icc 0 1
w :
hR :
w.R = false
Proof (Lean source)
lemma parametricFullLaw_complete {d : ℕ} (x : Fin d) (p : ℝ) (hp : p ∈ Icc 0 1) (w : FullAtom d) (hR : w.R = false) : fullMass (parametricFullLaw x p hp) w = 0 := by apply parametricFullLaw_mass_zero_of_not_generated x p hp w intro a y h subst w simp [parametricAtom] at hR
CausalSmith.Stat.MarNearcompleteFrontier.parametricFullLaw_complete · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/OneCell.lean:142
theorem parametricFullLaw_consistency

The one-cell family obeys consistency. Given the specified input d, the specified input x, the specified input p, the specified input hp, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
x :
Fin d
p :
ℝ
hp :
p ∈ Icc 0 1
Consistency (parametricFullLaw x p hp)
Proof (Lean source)
lemma parametricFullLaw_consistency {d : ℕ} (x : Fin d) (p : ℝ) (hp : p ∈ Icc 0 1) : Consistency (parametricFullLaw x p hp) := by intro w hw apply parametricFullLaw_mass_zero_of_not_generated x p hp w intro a y h subst w cases a <;> cases y <;> simp [parametricAtom] at hw
CausalSmith.Stat.MarNearcompleteFrontier.parametricFullLaw_consistency · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/OneCell.lean:152
theorem parametricFullLaw_balanced

The one-cell family is balanced. Given the specified input d, the specified input x, the specified input p, the specified input hp, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
x :
Fin d
p :
ℝ
hp :
p ∈ Icc 0 1
Proof (Lean source)
lemma parametricFullLaw_balanced {d : ℕ} (x : Fin d) (p : ℝ) (hp : p ∈ Icc 0 1) : BalancedRandomization (parametricFullLaw x p hp) := by unfold BalancedRandomization armMass rw [parametricFullLaw_massOf] simp [parametricAtom] ring
CausalSmith.Stat.MarNearcompleteFrontier.parametricFullLaw_balanced · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/OneCell.lean:163
theorem parametricFullLaw_randomized

Treatment is independent of the fixed baseline and potential vector. Given the specified input d, the specified input x, the specified input p, the specified input hp, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
x :
Fin d
p :
ℝ
hp :
p ∈ Icc 0 1
Proof (Lean source)
lemma parametricFullLaw_randomized {d : ℕ} (x : Fin d) (p : ℝ) (hp : p ∈ Icc 0 1) : RandomizedIndependence (parametricFullLaw x p hp) := by intro a x' s0 s1 y0 y1 unfold armMass rw [parametricFullLaw_massOf, parametricFullLaw_massOf, parametricFullLaw_massOf] fin_cases a <;> fin_cases s0 <;> fin_cases s1 <;> fin_cases y0 <;> fin_cases y1 all_goals by_cases hx : x' = x · subst x' simp [parametricAtom] all_goals exact inl (by ring) · have hxx : x ≠ x' := Ne.symm hx simp [parametricAtom, hx, hxx]
CausalSmith.Stat.MarNearcompleteFrontier.parametricFullLaw_randomized · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/OneCell.lean:173
theorem parametricFullLaw_tau

The target of the one-cell family is its treated success probability. Given the specified input d, the specified input x, the specified input p, the specified input hp, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
x :
Fin d
p :
ℝ
hp :
p ∈ Icc 0 1
tau (parametricFullLaw x p hp) = p
Proof (Lean source)
lemma parametricFullLaw_tau {d : ℕ} (x : Fin d) (p : ℝ) (hp : p ∈ Icc 0 1) : tau (parametricFullLaw x p hp) = p := by unfold tau rw [parametricFullLaw_sum] simp [parametricAtom]
CausalSmith.Stat.MarNearcompleteFrontier.parametricFullLaw_tau · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/OneCell.lean:192
theorem parametric_observed_mass

For a valid treated success probability and an observed atom, the one-cell law's observed point mass has the displayed explicit form.

Formal statement
d :
ℕ
x :
Fin d
p :
ℝ
hp :
p ∈ Icc 0 1
o :
Obs d
obsMass (observedLaw (parametricFullLaw x p hp)) o = if o.X = x ∧
o.S = false ∧
o.R
= true then if o.A then (1 / 2 : ℝ) * (if o.RY then p else 1 - p) else if o.RY then 0 else 1 / 2 else 0
Proof (Lean source)
lemma parametric_observed_mass {d : ℕ} (x : Fin d) (p : ℝ) (hp : p ∈ Icc 0 1) (o : Obs d) : obsMass (observedLaw (parametricFullLaw x p hp)) o = if o.X = x ∧ o.S = false ∧ o.R = true then if o.A then (1 / 2 : ℝ) * (if o.RY then p else 1 - p) else if o.RY then 0 else 1 / 2 else 0 := by have h := obsMass_sum_event (parametricFullLaw x p hp) (fun z => z = o) have hsingle : (∑ z : Obs d, if z = o then obsMass (observedLaw (parametricFullLaw x p hp)) z else 0) = obsMass (observedLaw (parametricFullLaw x p hp)) o := by simp rw [hsingle, parametricFullLaw_massOf] at h rw [h] rcases o with ⟨X, A, S, R, RY⟩ by_cases hx : X = x · subst X cases A <;> cases S <;> cases R <;> cases RY <;> simp [observe, parametricAtom] <;> ring · have hxx : x ≠ X := Ne.symm hx cases A <;> cases S <;> cases R <;> cases RY <;> simp [observe, parametricAtom, hx, hxx]
CausalSmith.Stat.MarNearcompleteFrontier.parametric_observed_mass · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/OneCell.lean:200

Every one-cell observed law is dominated by the central one. Given the specified input d, the specified input x, the specified input p, the specified input hp, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
x :
Fin d
p :
ℝ
hp :
p ∈ Icc 0 1
(observedLaw (parametricFullLaw x p hp)).toMeasure ≪ (observedLaw (parametricFullLaw x (1 / 2) (by norm_num))).toMeasure
Proof (Lean source)
lemma parametric_observed_ac {d : ℕ} (x : Fin d) (p : ℝ) (hp : p ∈ Icc 0 1) : (observedLaw (parametricFullLaw x p hp)).toMeasure ≪ (observedLaw (parametricFullLaw x (1 / 2) (by norm_num))).toMeasure := by apply Measure.AbsolutelyContinuous.mk intro s hs hzero let μ := (observedLaw (parametricFullLaw x p hp)).toMeasure let ν := (observedLaw (parametricFullLaw x (1 / 2) (by norm_num))).toMeasure let sf : Finset (Obs d) := (Set.toFinite s).toFinset have hsf : (sf : Set (Obs d)) = s := by simp [sf] have hsumν : (∑ o ∈ sf, ν {o}) = ν s := by rw [sum_measure_singleton, hsf] have hpointν : ∀ o ∈ sf, ν {o} = 0 := by intro o ho have hzsum : ∑ z ∈ sf, ν {z} = 0 := by rw [hsumν]; exact hzero exact (Finset.sum_eq_zero_iff_of_nonneg (fun z _ => bot_le)).mp hzsum o ho have hpointμ : ∀ o ∈ sf, μ {o} = 0 := by intro o ho have hrealν : ν.real {o} = 0 := by rw [measureReal_eq_zero_iff]; exact hpointν o ho have hrealμ : μ.real {o} = 0 := by dsimp [μ, ν] at hrealν ⊢ rw [show (observedLaw (parametricFullLaw x (1 / 2) (by norm_num))).toMeasure.real {o} = obsMass (observedLaw (parametricFullLaw x (1 / 2) (by norm_num))) o by simp [measureReal_def, obsMass]] at hrealν rw [show (observedLaw (parametricFullLaw x p hp)).toMeasure.real {o} = obsMass (observedLaw (parametricFullLaw x p hp)) o by simp [measureReal_def, obsMass]] rw [parametric_observed_mass] at hrealν rw [parametric_observed_mass] rcases o with ⟨X, A, S, R, RY⟩ by_cases hx : X = x <;> cases A <;> cases S <;> cases R <;> cases RY <;> simp [hx] at hrealν ⊢ all_goals norm_num at hrealν rw [measureReal_eq_zero_iff] at hrealμ exact hrealμ rw [← hsf, ← sum_measure_singleton] exact Finset.sum_eq_zero hpointμ
CausalSmith.Stat.MarNearcompleteFrontier.parametric_observed_ac · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/OneCell.lean:224
theorem parametric_observed_chisq Lemma parametric_observed_chisq in the paper ↗

The central one-record chi-square divergence of the one-cell family. Given the specified input d, the specified input x, the specified input p, the specified input hp, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
x :
Fin d
p :
ℝ
hp :
p ∈ Icc 0 1
chiSqDiv (observedLaw (parametricFullLaw x p hp)).toMeasure (observedLaw (parametricFullLaw x (1 / 2) (by norm_num))).toMeasure
= 2 * (p - 1 / 2) ^ 2
Proof (Lean source)
lemma parametric_observed_chisq {d : ℕ} (x : Fin d) (p : ℝ) (hp : p ∈ Icc 0 1) : chiSqDiv (observedLaw (parametricFullLaw x p hp)).toMeasure (observedLaw (parametricFullLaw x (1 / 2) (by norm_num))).toMeasure = 2 * (p - 1 / 2) ^ 2 := by let μ := (observedLaw (parametricFullLaw x p hp)).toMeasure let ν := (observedLaw (parametricFullLaw x (1 / 2) (by norm_num))).toMeasure have hac : μ ≪ ν := parametric_observed_ac x p hp have h := Causalean.Stat.finite_one_add_chiSqDiv μ ν hac let f : Obs d → ℝ := fun o => (μ.real {o}) ^ 2 / ν.real {o} have hmassμ (o : Obs d) : μ.real {o} = obsMass (observedLaw (parametricFullLaw x p hp)) o := by simp [μ, measureReal_def, obsMass] have hmassν (o : Obs d) : ν.real {o} = obsMass (observedLaw (parametricFullLaw x (1 / 2) (by norm_num))) o := by simp [ν, measureReal_def, obsMass] let c : Obs d := ⟨x, false, false, true, false⟩ let e₀ : Obs d := ⟨x, true, false, true, false⟩ let e₁ : Obs d := ⟨x, true, false, true, true⟩ have hsum : (∑ o : Obs d, f o) = ∑ o ∈ ({c, e₀, e₁} : Finset (Obs d)), f o := by symm apply Finset.sum_subset (Finset.subset_univ _) intro o _ ho rcases o with ⟨X, A, S, R, RY⟩ by_cases hx : X = x · subst X cases A <;> cases S <;> cases R <;> cases RY <;> simp [f, hmassμ, hmassν, c, e₀, e₁, parametric_observed_mass] at ho ⊢ · simp [f, hmassμ, hmassν, parametric_observed_mass, hx] have hvalue : (∑ o : Obs d, f o) = 1 + 2 * (p - 1 / 2) ^ 2 := by rw [hsum] simp [f, hmassμ, hmassν, c, e₀, e₁, parametric_observed_mass] ring change 1 + chiSqDiv μ ν = ∑ o : Obs d, f o at h linarith
CausalSmith.Stat.MarNearcompleteFrontier.parametric_observed_chisq · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/OneCell.lean:264
CausalSmith.Stat.STAT_MarNearcompleteFrontier_Research.Helpers.LowerBound.PairedPrefixTransfer 1 declarations The exact observed-atom identity identifies the conditional count law with independent Poisson counts from the normalized marks.

Fixed-size predictive comparison for the normalized paired priors

The exact observed-atom identity identifies the conditional count law with independent Poisson counts from the normalized marks. The shared normalizer is at least one half, so the four-n experiment loses at most sixteen over n when converted to its fixed-size ordered prefix.

theorem paired_predictive_tv_le_count_tv_add_inverse

The exact normalized paired predictives are compared by their count mixtures with a uniform prefix-transfer loss of sixteen divided by n. Given the specified input n, the specified input d, the specified input q, the specified input hn, the specified input hd, the stated mathematical conclusion holds. Given the specified input hq.

Formal statement
n d :
ℕ
q :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
tvDist (priorPredictive n d q (pairedPrior n d q hn hd hq).1) (priorPredictive n d q (pairedPrior n d q hn hd hq).2)
≤ tvDist (mixedCountLaw n d q (-1) hn hd hq) (mixedCountLaw n d q 1 hn hd hq)
+ 16 / (n : ℝ)
Proof (Lean source)
lemma paired_predictive_tv_le_count_tv_add_inverse (n d : ℕ) (q : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) : tvDist (priorPredictive n d q (pairedPrior n d q hn hd hq).1) (priorPredictive n d q (pairedPrior n d q hn hd hq).2) ≤ tvDist (mixedCountLaw n d q (-1) hn hd hq) (mixedCountLaw n d q 1 hn hd hq) + 16 / (n : ℝ) := by letI : MeasurableSpace (Theta n d) := ⊤ letI : MeasurableSingletonClass (Theta n d) := ⟨fun _ => trivial⟩ let π := thetaLaw n d q hn hd hq let P (σ : ℝ) (hσ : σ ∈ Icc (-1) 1) : Kernel (Theta n d) (Obs d) := ⟨fun θ => (observedLaw (pairedFullLaw n d q σ hn hd hq hσ θ)).toMeasure, measurable_of_finite _⟩ haveI (σ : ℝ) (hσ : σ ∈ Icc (-1) 1) (θ : Theta n d) : IsProbabilityMeasure (P σ hσ θ) := by dsimp [P] infer_instance let S : Theta n d → ℝ≥0 := fun θ => toNNReal (normalizationJ n d θ) let u : ℝ≥0 := toNNReal (4 * (n : ℝ)) have hmean (θ : Theta n d) : (2 : ℝ) * n ≤ (u * S θ : ℝ≥0) := by have hJ := normalizationJ_ge_half n d θ hn have hJ0 := normalizationJ_pos n d q hn hd hq θ change 2 * (n : ℝ) ≤ ((toNNReal (4 * (n : ℝ)) * toNNReal (normalizationJ n d θ) : ℝ≥0) : ℝ) rw [NNReal.coe_mul, Real.coe_toNNReal _ (by positivity), Real.coe_toNNReal _ hJ0.le] nlinarith [show (0 : ℝ) ≤ n from Nat.cast_nonneg n] have hfixed (σ : ℝ) (hσ : σ ∈ Icc (-1) 1) : fixedMixture π.toMeasure (P σ hσ) n = pairedPredictive n d q σ hn hd hq hσ := by rw [fixedMixture, pmf_bind_eq_finite_mixture] rfl have hcount (σ : ℝ) (hσ : σ ∈ Icc (-1) 1) : π.toMeasure.bind (fun θ => independentPoissonCountLaw (P σ hσ θ) (u * S θ)) = mixedCountLaw n d q σ hn hd hq := by rw [pmf_bind_eq_finite_mixture] unfold mixedCountLaw apply Finset.sum_congr rfl intro θ _ congr 1 exact (conditionalCountLaw_eq_independentPoissonCountLaw n d q σ hn hd hq hσ θ).symm let fallback : Fin n → Obs d := fun _ => ⟨⟨0, hd⟩, false, false, true, false⟩ have h := randomScale_fixed_tv_le_count_tv_add_inverse π.toMeasure (P (-1) (by norm_num)) (P 1 (by norm_num)) S u n hn fallback hmean rw [hfixed, hfixed, hcount, hcount] at h rw [pairedPredictive_minus_eq, pairedPredictive_plus_eq] at h exact h
CausalSmith.Stat.MarNearcompleteFrontier.paired_predictive_tv_le_count_tv_add_inverse · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/PairedPrefixTransfer.lean:23
CausalSmith.Stat.STAT_MarNearcompleteFrontier_Research.Helpers.LowerBound.PrefixTransfer 1 declarations Histogram reconstruction retains the ordered experiment.

Random-scale prefix comparison through independent Poisson counts

Histogram reconstruction retains the ordered experiment. The shared latent scale need not be constant: only its uniform lower bound enters the short-count loss. These lemmas implement the transfer in equations (15)--(16) of the normalized-converse roadmap.

theorem pmf_bind_eq_finite_mixture Lemma pmf_bind_eq_finite_mixture in the paper ↗

Integrating a measure-valued map against a finite PMF is its finite weighted mixture. Given the specified input X, the specified input f, the stated mathematical conclusion holds. Given the specified input Θ, the specified input π.

Formal statement
π :
PMF Θ
f :
Θ → Measure X
π.toMeasure.bind f = ∑ θ : Θ, π θ • f θ
Proof (Lean source)
lemma pmf_bind_eq_finite_mixture {Θ X : Type*} [Fintype Θ] [MeasurableSpace Θ] [MeasurableSingletonClass Θ] [MeasurableSpace X] (π : PMF Θ) (f : Θ → Measure X) : π.toMeasure.bind f = ∑ θ : Θ, π θ • f θ := by rw [pmf_toMeasure_finset_decomposition, ← Measure.sum_fintype, Measure.bind_sum _ _ (measurable_of_finite _).aemeasurable, Measure.sum_fintype] simp only [Measure.bind_smul, Measure.dirac_bind (measurable_of_finite _)]
CausalSmith.Stat.MarNearcompleteFrontier.pmf_bind_eq_finite_mixture · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/LowerBound/PrefixTransfer.lean:30
CausalSmith.Stat.STAT_MarNearcompleteFrontier_Research.Helpers.PairedPrior 44 declarations Normalized paired prior and count experiment

Normalized paired prior and count experiment

def pairedFullLaw

Full legal law generated by one latent vector and one prior sign.

Definition (Lean source)
n d :
ℕ
q σ :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
hσ :
σ ∈ Icc (-1) 1
θ :
Theta n d
pairedFullLaw n d q σ hn hd hq hσ θ :
⟨PMF.ofFintype (fun w => ofReal (pairedAtomWeight n d q σ hd θ w)) (pairedAtomWeight_sum n d q σ hn hd hq hσ θ)⟩
CausalSmith.Stat.MarNearcompleteFrontier.pairedFullLaw · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/PairedPrior.lean:14
theorem pairedFullLaw_fullMass

The normalized full-law mass is the displayed atom weight. Given the specified input n, the specified input d, the specified input q, the specified input hn, the specified input hd, the specified input w, the stated mathematical conclusion holds. Given the specified input σ, the specified input θ. Given the specified input hq, the specified input hσ.

Formal statement
n d :
ℕ
q σ :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
hσ :
σ ∈ Icc (-1) 1
θ :
Theta n d
w :
fullMass (pairedFullLaw n d q σ hn hd hq hσ θ) w = pairedAtomWeight n d q σ hd θ w
Proof (Lean source)
lemma pairedFullLaw_fullMass (n d : ℕ) (q σ : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (hσ : σ ∈ Icc (-1) 1) (θ : Theta n d) (w : FullAtom d) : fullMass (pairedFullLaw n d q σ hn hd hq hσ θ) w = pairedAtomWeight n d q σ hd θ w := by simp [fullMass, pairedFullLaw, pairedAtomWeight_nonneg n d q σ hn hd hq hσ θ w]
CausalSmith.Stat.MarNearcompleteFrontier.pairedFullLaw_fullMass · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/PairedPrior.lean:22
theorem pairedFullLaw_consistency

All atoms inconsistent with the treatment-selected potential outcomes have zero mass. Given the specified input n, the specified input d, the specified input q, the specified input hn, the specified input hd, the stated mathematical conclusion holds. Given the specified input σ, the specified input θ. Given the specified input hq, the specified input hσ.

Formal statement
n d :
ℕ
q σ :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
hσ :
σ ∈ Icc (-1) 1
θ :
Theta n d
Consistency (pairedFullLaw n d q σ hn hd hq hσ θ)
Proof (Lean source)
lemma pairedFullLaw_consistency (n d : ℕ) (q σ : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (hσ : σ ∈ Icc (-1) 1) (θ : Theta n d) : Consistency (pairedFullLaw n d q σ hn hd hq hσ θ) := by intro w hw rw [pairedFullLaw_fullMass] have hbad (h0 : w.S0 = false) (h1 : w.S1 = false) (hs : w.S = false) (hy : w.Y = (if w.A then w.Y1 else w.Y0)) : False := by rcases hw with h | h · exact h (by simp [h0, h1, hs]) · exact h hy unfold pairedAtomWeight have hf : fillerAtomWeight n d q hd θ w = 0 := by have hc : ¬(w.X = fillerLabel d hd ∧ w.S0 = false ∧ w.S1 = false ∧ w.S = false ∧ w.Y0 = false ∧ w.Y = (if w.A then w.Y1 else w.Y0) ∧ w.R = true) := by rintro ⟨_, h0, h1, hs, _, hy, _⟩ exact hbad h0 h1 hs hy simp only [fillerAtomWeight, if_neg hc] rw [hf, zero_add] apply Finset.sum_eq_zero intro j _ apply Finset.sum_eq_zero intro side _ have hc : ¬(w.X = pairLabel n d hd j side ∧ w.S0 = false ∧ w.S1 = false ∧ w.S = false ∧ w.Y0 = false ∧ w.Y = (if w.A then w.Y1 else w.Y0)) := by rintro ⟨_, h0, h1, hs, _, hy⟩ exact hbad h0 h1 hs hy simp only [pairAtomWeight, if_neg hc]
CausalSmith.Stat.MarNearcompleteFrontier.pairedFullLaw_consistency · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/PairedPrior.lean:32
theorem pairedFullLaw_controlOutcome_zero

The constructed control potential outcome is identically zero. Given the specified input n, the specified input d, the specified input q, the specified input hn, the specified input hd, the specified input w, the specified input hy, the stated mathematical conclusion holds. Given the specified input σ, the specified input θ. Given the specified input hq, the specified input hσ.

Formal statement
n d :
ℕ
q σ :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
hσ :
σ ∈ Icc (-1) 1
θ :
Theta n d
w :
hy :
w.Y0 = true
fullMass (pairedFullLaw n d q σ hn hd hq hσ θ) w = 0
Proof (Lean source)
lemma pairedFullLaw_controlOutcome_zero (n d : ℕ) (q σ : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (hσ : σ ∈ Icc (-1) 1) (θ : Theta n d) (w : FullAtom d) (hy : w.Y0 = true) : fullMass (pairedFullLaw n d q σ hn hd hq hσ θ) w = 0 := by rw [pairedFullLaw_fullMass] simp [pairedAtomWeight, fillerAtomWeight, pairAtomWeight, hy]
CausalSmith.Stat.MarNearcompleteFrontier.pairedFullLaw_controlOutcome_zero · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/PairedPrior.lean:66
theorem pairedFullLaw_balanced

Treatment remains a fair coin after the random cell masses are normalized. Given the specified input n, the specified input d, the specified input q, the specified input hn, the specified input hd, the stated mathematical conclusion holds. Given the specified input σ, the specified input θ. Given the specified input hq, the specified input hσ.

Formal statement
n d :
ℕ
q σ :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
hσ :
σ ∈ Icc (-1) 1
θ :
Theta n d
BalancedRandomization (pairedFullLaw n d q σ hn hd hq hσ θ)
Proof (Lean source)
lemma pairedFullLaw_balanced (n d : ℕ) (q σ : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (hσ : σ ∈ Icc (-1) 1) (θ : Theta n d) : BalancedRandomization (pairedFullLaw n d q σ hn hd hq hσ θ) := by unfold BalancedRandomization armMass massOf simp_rw [pairedFullLaw_fullMass] calc (∑ w : FullAtom d, if w.A = true then pairedAtomWeight n d q σ hd θ w else 0) = (∑ w : FullAtom d, if w.A = true then fillerAtomWeight n d q hd θ w else 0) + ∑ j : Fin (pairCount n d), ∑ side : Bool, ∑ w : FullAtom d, if w.A = true then pairAtomWeight n d q σ hd θ j side w else 0 := by calc _ = ∑ w : FullAtom d, ((if w.A = true then fillerAtomWeight n d q hd θ w else 0) + (∑ j : Fin (pairCount n d), ∑ side : Bool, if w.A = true then pairAtomWeight n d q σ hd θ j side w else 0)) := by apply Finset.sum_congr rfl intro w _ by_cases hw : w.A = true <;> simp [pairedAtomWeight, hw] _ = _ := by rw [Finset.sum_add_distrib] congr 1 rw [Finset.sum_comm] apply Finset.sum_congr rfl intro j _ rw [Finset.sum_comm] _ = fillerMass n d / normalizationJ n d θ / 2 + ∑ j : Fin (pairCount n d), ∑ side : Bool, latentP n (θ.1 j) / normalizationJ n d θ / 2 := by rw [sum_fillerAtomWeight_arm] simp_rw [sum_pairAtomWeight_arm] _ = 1 / 2 := by have hJ : normalizationJ n d θ ≠ 0 := ne_of_gt (normalizationJ_pos n d q hn hd hq θ) simp_rw [Fintype.sum_bool] have hsum : (∑ j : Fin (pairCount n d), (latentP n (θ.1 j) / normalizationJ n d θ / 2 + latentP n (θ.1 j) / normalizationJ n d θ / 2)) = (2 * ∑ j : Fin (pairCount n d), latentP n (θ.1 j)) / normalizationJ n d θ / 2 := by rw [Finset.sum_add_distrib, ← Finset.sum_div, ← Finset.sum_div] ring rw [hsum] calc _ = (fillerMass n d + 2 * ∑ j : Fin (pairCount n d), latentP n (θ.1 j)) / normalizationJ n d θ / 2 := by ring _ = 1 / 2 := by change normalizationJ n d θ / normalizationJ n d θ / 2 = 1 / 2 rw [div_self hJ]
CausalSmith.Stat.MarNearcompleteFrontier.pairedFullLaw_balanced · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/PairedPrior.lean:76
theorem fillerAtomWeight_arm_potential_symmetry

At fixed potential outcomes, the filler weight is equal in both arms. Given the specified input n, the specified input d, the specified input q, the specified input hd, the specified input v, the specified input a, the stated mathematical conclusion holds. Given the specified input θ.

Formal statement
n d :
ℕ
q :
ℝ
hd :
1 ≤ d
θ :
Theta n d
a :
(∑ w : FullAtom d, if w.A = a ∧ w.potential = v then fillerAtomWeight n d q hd θ w else 0)
= (∑ w : FullAtom d, if w.A = !a ∧ w.potential = v then fillerAtomWeight n d q hd θ w else 0)
Proof (Lean source)
lemma fillerAtomWeight_arm_potential_symmetry (n d : ℕ) (q : ℝ) (hd : 1 ≤ d) (θ : Theta n d) (v : PotentialAtom d) (a : Bool) : (∑ w : FullAtom d, if w.A = a ∧ w.potential = v then fillerAtomWeight n d q hd θ w else 0) = (∑ w : FullAtom d, if w.A = !a ∧ w.potential = v then fillerAtomWeight n d q hd θ w else 0) := by rw [Fintype.sum_equiv (fullAtomTupleEquiv d) (fun w => if w.A = a ∧ w.potential = v then fillerAtomWeight n d q hd θ w else 0) (fun t => if ((fullAtomTupleEquiv d).symm t).A = a ∧ ((fullAtomTupleEquiv d).symm t).potential = v then fillerAtomWeight n d q hd θ ((fullAtomTupleEquiv d).symm t) else 0) (by intro w; simp)] rw [Fintype.sum_equiv (fullAtomTupleEquiv d) (fun w => if w.A = !a ∧ w.potential = v then fillerAtomWeight n d q hd θ w else 0) (fun t => if ((fullAtomTupleEquiv d).symm t).A = !a ∧ ((fullAtomTupleEquiv d).symm t).potential = v then fillerAtomWeight n d q hd θ ((fullAtomTupleEquiv d).symm t) else 0) (by intro w; simp)] simp only [Fintype.sum_prod_type] cases a <;> cases v with | mk x s0 s1 y0 y1 => simp [fullAtomTupleEquiv, fillerAtomWeight, bernoulliFactor, fillerLabel, FullAtom.X]
CausalSmith.Stat.MarNearcompleteFrontier.fillerAtomWeight_arm_potential_symmetry · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/PairedPrior.lean:129
theorem pairAtomWeight_arm_potential_symmetry

At fixed potential outcomes, an oriented pair weight is equal in both arms. Given the specified input n, the specified input d, the specified input q, the specified input hd, the specified input side, the specified input v, the specified input a, the stated mathematical conclusion holds. Given the specified input σ, the specified input θ. Given the specified input j.

Formal statement
n d :
ℕ
q σ :
ℝ
hd :
1 ≤ d
θ :
Theta n d
j :
side :
a :
(∑ w : FullAtom d, if w.A = a ∧ w.potential = v then pairAtomWeight n d q σ hd θ j side w else 0)
= (∑ w : FullAtom d, if w.A = !a ∧ w.potential = v then pairAtomWeight n d q σ hd θ j side w else 0)
Proof (Lean source)
lemma pairAtomWeight_arm_potential_symmetry (n d : ℕ) (q σ : ℝ) (hd : 1 ≤ d) (θ : Theta n d) (j : Fin (pairCount n d)) (side : Bool) (v : PotentialAtom d) (a : Bool) : (∑ w : FullAtom d, if w.A = a ∧ w.potential = v then pairAtomWeight n d q σ hd θ j side w else 0) = (∑ w : FullAtom d, if w.A = !a ∧ w.potential = v then pairAtomWeight n d q σ hd θ j side w else 0) := by rw [Fintype.sum_equiv (fullAtomTupleEquiv d) (fun w => if w.A = a ∧ w.potential = v then pairAtomWeight n d q σ hd θ j side w else 0) (fun t => if ((fullAtomTupleEquiv d).symm t).A = a ∧ ((fullAtomTupleEquiv d).symm t).potential = v then pairAtomWeight n d q σ hd θ j side ((fullAtomTupleEquiv d).symm t) else 0) (by intro w; simp)] rw [Fintype.sum_equiv (fullAtomTupleEquiv d) (fun w => if w.A = !a ∧ w.potential = v then pairAtomWeight n d q σ hd θ j side w else 0) (fun t => if ((fullAtomTupleEquiv d).symm t).A = !a ∧ ((fullAtomTupleEquiv d).symm t).potential = v then pairAtomWeight n d q σ hd θ j side ((fullAtomTupleEquiv d).symm t) else 0) (by intro w; simp)] simp only [Fintype.sum_prod_type] cases a <;> cases v with | mk x s0 s1 y0 y1 => simp [fullAtomTupleEquiv, pairAtomWeight, bernoulliFactor, FullAtom.X, FullAtom.S0, FullAtom.S1, FullAtom.Y0, FullAtom.Y1] apply Finset.sum_congr rfl intro x _ split_ifs <;> ring
CausalSmith.Stat.MarNearcompleteFrontier.pairAtomWeight_arm_potential_symmetry · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/PairedPrior.lean:155
theorem pairedFullLaw_arm_potential_symmetry

The complete constructed law has equal arm masses at each potential atom. Given the specified input n, the specified input d, the specified input q, the specified input hn, the specified input hd, the specified input v, the specified input a, the stated mathematical conclusion holds. Given the specified input σ, the specified input θ. Given the specified input hq, the specified input hσ.

Formal statement
n d :
ℕ
q σ :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
hσ :
σ ∈ Icc (-1) 1
θ :
Theta n d
a :
massOf (pairedFullLaw n d q σ hn hd hq hσ θ) (fun w => w.A = a ∧ w.potential = v)
= massOf (pairedFullLaw n d q σ hn hd hq hσ θ) (fun w => w.A = !a ∧ w.potential = v)
Proof (Lean source)
lemma pairedFullLaw_arm_potential_symmetry (n d : ℕ) (q σ : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (hσ : σ ∈ Icc (-1) 1) (θ : Theta n d) (v : PotentialAtom d) (a : Bool) : massOf (pairedFullLaw n d q σ hn hd hq hσ θ) (fun w => w.A = a ∧ w.potential = v) = massOf (pairedFullLaw n d q σ hn hd hq hσ θ) (fun w => w.A = !a ∧ w.potential = v) := by simp only [massOf, pairedFullLaw_fullMass] have hsplit (b : Bool) : (∑ w : FullAtom d, if w.A = b ∧ w.potential = v then pairedAtomWeight n d q σ hd θ w else 0) = (∑ w : FullAtom d, if w.A = b ∧ w.potential = v then fillerAtomWeight n d q hd θ w else 0) + ∑ j : Fin (pairCount n d), ∑ side : Bool, ∑ w : FullAtom d, if w.A = b ∧ w.potential = v then pairAtomWeight n d q σ hd θ j side w else 0 := by calc _ = ∑ w : FullAtom d, ((if w.A = b ∧ w.potential = v then fillerAtomWeight n d q hd θ w else 0) + ∑ j : Fin (pairCount n d), ∑ side : Bool, if w.A = b ∧ w.potential = v then pairAtomWeight n d q σ hd θ j side w else 0) := by apply Finset.sum_congr rfl intro w _ by_cases h : w.A = b ∧ w.potential = v · simp [h, pairedAtomWeight] · simp [h] _ = _ := by rw [Finset.sum_add_distrib, Finset.sum_comm] congr 1 apply Finset.sum_congr rfl intro j _ rw [Finset.sum_comm] rw [hsplit a, hsplit (!a), fillerAtomWeight_arm_potential_symmetry] congr 1 apply Finset.sum_congr rfl intro j _ apply Finset.sum_congr rfl intro side _ exact pairAtomWeight_arm_potential_symmetry n d q σ hd θ j side v a
CausalSmith.Stat.MarNearcompleteFrontier.pairedFullLaw_arm_potential_symmetry · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/PairedPrior.lean:187
theorem pairedFullLaw_randomized

The normalized construction is randomized independently of all potential coordinates. Given the specified input n, the specified input d, the specified input q, the specified input hn, the specified input hd, the stated mathematical conclusion holds. Given the specified input σ, the specified input θ. Given the specified input hq, the specified input hσ.

Formal statement
n d :
ℕ
q σ :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
hσ :
σ ∈ Icc (-1) 1
θ :
Theta n d
RandomizedIndependence (pairedFullLaw n d q σ hn hd hq hσ θ)
Proof (Lean source)
lemma pairedFullLaw_randomized (n d : ℕ) (q σ : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (hσ : σ ∈ Icc (-1) 1) (θ : Theta n d) : RandomizedIndependence (pairedFullLaw n d q σ hn hd hq hσ θ) := by let P := pairedFullLaw n d q σ hn hd hq hσ θ intro a x s0 s1 y0 y1 let v : PotentialAtom d := ⟨x, s0, s1, y0, y1⟩ have hp (w : FullAtom d) : (w.X = x ∧ w.S0 = s0 ∧ w.S1 = s1 ∧ w.Y0 = y0 ∧ w.Y1 = y1) ↔ w.potential = v := by cases w with | mk p A S Y R => cases p simp [v, FullAtom.X, FullAtom.S0, FullAtom.S1, FullAtom.Y0, FullAtom.Y1, PotentialAtom.mk.injEq] simp only [hp] change massOf P (fun w => w.A = a ∧ w.potential = v) = armMass P a * massOf P (fun w => w.potential = v) have hhalf : armMass P a = 1 / 2 := by cases a · exact armMass_false_eq_half P (pairedFullLaw_balanced n d q σ hn hd hq hσ θ) · exact pairedFullLaw_balanced n d q σ hn hd hq hσ θ have hpartition : massOf P (fun w => w.potential = v) = massOf P (fun w => w.A = a ∧ w.potential = v) + massOf P (fun w => w.A = !a ∧ w.potential = v) := by unfold massOf rw [← Finset.sum_add_distrib] apply Finset.sum_congr rfl intro w _ cases w with | mk p aw s y r => cases a <;> cases aw <;> simp have hsym := pairedFullLaw_arm_potential_symmetry n d q σ hn hd hq hσ θ v a rw [hhalf] linarith
CausalSmith.Stat.MarNearcompleteFrontier.pairedFullLaw_randomized · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/PairedPrior.lean:232
theorem pairAtomWeight_arrival_floor_pointwise

At a fixed oriented label and fixed nonarrival coordinates, the arrived atom carries at least the fraction q of the two arrival possibilities. Given the specified input n, the specified input d, the specified input q, the specified input hn, the specified input hd, the specified input side, the specified input v, the specified input a, the specified input s, the specified input y, the stated mathematical conclusion holds. Given the specified input σ, the specified input θ. Given the specified input hq, the specified input hσ, the specified input j.

Formal statement
n d :
ℕ
q σ :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
hσ :
σ ∈ Icc (-1) 1
θ :
Theta n d
j :
side :
a s y :
q * (pairAtomWeight n d q σ hd θ j side ⟨v, a, s, y, true⟩ + pairAtomWeight n d q σ hd θ j side ⟨v, a, s, y, false⟩)
≤ pairAtomWeight n d q σ hd θ j side ⟨v, a, s, y, true⟩
Proof (Lean source)
lemma pairAtomWeight_arrival_floor_pointwise (n d : ℕ) (q σ : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (hσ : σ ∈ Icc (-1) 1) (θ : Theta n d) (j : Fin (pairCount n d)) (side : Bool) (v : PotentialAtom d) (a s y : Bool) : q * (pairAtomWeight n d q σ hd θ j side ⟨v, a, s, y, true⟩ + pairAtomWeight n d q σ hd θ j side ⟨v, a, s, y, false⟩) ≤ pairAtomWeight n d q σ hd θ j side ⟨v, a, s, y, true⟩ := by let w : FullAtom d := ⟨v, a, s, y, true⟩ let w' : FullAtom d := ⟨v, a, s, y, false⟩ have hρ := pairRho_mem_unit q σ (latentZ n (θ.1 j)) (orientation θ j side) hq (pair_sign_mem_unit n d σ hσ θ j side) have hJ := normalizationJ_pos n d q hn hd hq θ have hp : 0 ≤ latentP n (θ.1 j) / normalizationJ n d θ / 2 * bernoulliFactor (pairMu q σ (latentZ n (θ.1 j)) (orientation θ j side)) v.Y1 := by exact mul_nonneg (div_nonneg (div_nonneg (latentP_nonneg n (θ.1 j)) (le_of_lt hJ)) (by norm_num)) (bernoulliFactor_nonneg _ (pairMu_mem_unit q σ (latentZ n (θ.1 j)) (orientation θ j side) hq (abs_le.mp (by rw [orientation_abs_one])) (pair_sign_mem_unit n d σ hσ θ j side)) _) by_cases hsupp : v.X = pairLabel n d hd j side ∧ v.S0 = false ∧ v.S1 = false ∧ s = false ∧ v.Y0 = false ∧ y = (if a then v.Y1 else v.Y0) · simp only [pairAtomWeight, if_pos hsupp] cases a · simp only [Bool.false_eq_true, ↓reduceIte, mul_one, mul_zero, add_zero, ge_iff_le] exact mul_le_of_le_one_left hp hq.2 · cases hY : v.Y1 <;> simp [FullAtom.Y1, bernoulliFactor, hY] at hp ⊢ <;> nlinarith [mul_nonneg hp (sub_nonneg.mpr hρ.1)] · simp [pairAtomWeight, hsupp]
CausalSmith.Stat.MarNearcompleteFrontier.pairAtomWeight_arrival_floor_pointwise · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/PairedPrior.lean:272
theorem fillerAtomWeight_arrival_floor_pointwise

All filler mass has an arrived outcome. Given the specified input n, the specified input d, the specified input q, the specified input hn, the specified input hd, the specified input v, the specified input a, the specified input s, the specified input y, the stated mathematical conclusion holds. Given the specified input θ. Given the specified input hq.

Formal statement
n d :
ℕ
q :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
θ :
Theta n d
a s y :
q * (fillerAtomWeight n d q hd θ ⟨v, a, s, y, true⟩ + fillerAtomWeight n d q hd θ ⟨v, a, s, y, false⟩)
≤ fillerAtomWeight n d q hd θ ⟨v, a, s, y, true⟩
Proof (Lean source)
lemma fillerAtomWeight_arrival_floor_pointwise (n d : ℕ) (q : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (θ : Theta n d) (v : PotentialAtom d) (a s y : Bool) : q * (fillerAtomWeight n d q hd θ ⟨v, a, s, y, true⟩ + fillerAtomWeight n d q hd θ ⟨v, a, s, y, false⟩) ≤ fillerAtomWeight n d q hd θ ⟨v, a, s, y, true⟩ := by have hfalse : fillerAtomWeight n d q hd θ ⟨v, a, s, y, false⟩ = 0 := by simp [fillerAtomWeight] rw [hfalse, add_zero] exact mul_le_of_le_one_left (fillerAtomWeight_nonneg n d q hn hd hq θ ⟨v, a, s, y, true⟩) hq.2
CausalSmith.Stat.MarNearcompleteFrontier.fillerAtomWeight_arrival_floor_pointwise · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/PairedPrior.lean:311
theorem pairedAtomWeight_arrival_floor_pointwise

The normalized atom weights retain the arrival floor after summing labels. Given the specified input n, the specified input d, the specified input q, the specified input hn, the specified input hd, the specified input v, the specified input a, the specified input s, the specified input y, the stated mathematical conclusion holds. Given the specified input σ, the specified input θ. Given the specified input hq, the specified input hσ.

Formal statement
n d :
ℕ
q σ :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
hσ :
σ ∈ Icc (-1) 1
θ :
Theta n d
a s y :
q * (pairedAtomWeight n d q σ hd θ ⟨v, a, s, y, true⟩ + pairedAtomWeight n d q σ hd θ ⟨v, a, s, y, false⟩)
≤ pairedAtomWeight n d q σ hd θ ⟨v, a, s, y, true⟩
Proof (Lean source)
lemma pairedAtomWeight_arrival_floor_pointwise (n d : ℕ) (q σ : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (hσ : σ ∈ Icc (-1) 1) (θ : Theta n d) (v : PotentialAtom d) (a s y : Bool) : q * (pairedAtomWeight n d q σ hd θ ⟨v, a, s, y, true⟩ + pairedAtomWeight n d q σ hd θ ⟨v, a, s, y, false⟩) ≤ pairedAtomWeight n d q σ hd θ ⟨v, a, s, y, true⟩ := by simp only [pairedAtomWeight] have hf := fillerAtomWeight_arrival_floor_pointwise n d q hn hd hq θ v a s y have hp (j : Fin (pairCount n d)) (side : Bool) := pairAtomWeight_arrival_floor_pointwise n d q σ hn hd hq hσ θ j side v a s y calc _ = q * (fillerAtomWeight n d q hd θ ⟨v, a, s, y, true⟩ + fillerAtomWeight n d q hd θ ⟨v, a, s, y, false⟩) + ∑ j : Fin (pairCount n d), ∑ side : Bool, q * (pairAtomWeight n d q σ hd θ j side ⟨v, a, s, y, true⟩ + pairAtomWeight n d q σ hd θ j side ⟨v, a, s, y, false⟩) := by simp only [mul_add, Finset.sum_add_distrib, Finset.mul_sum] ring _ ≤ _ := by apply add_le_add hf apply Finset.sum_le_sum intro j _ apply Finset.sum_le_sum intro side _ exact hp j side
CausalSmith.Stat.MarNearcompleteFrontier.pairedAtomWeight_arrival_floor_pointwise · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/PairedPrior.lean:325
def fullAtomArrivalEquiv

Coordinates arranged with arrival last, for finite-sum calculations. Given the specified input d, the stated mathematical conclusion holds.

Definition (Lean source)
d :
ℕ
fullAtomArrivalEquiv d :
FullAtom d ≃ PotentialAtom d × Bool × Bool × Bool × Bool
clause 1
toFun w := (w.potential, w.A, w.S, w.Y, w.R)
clause 2
invFun t := ⟨t.1, t.2.1, t.2.2.1, t.2.2.2.1, t.2.2.2.2⟩
clause 3
left_inv := by intro w; cases w; rfl
clause 4
right_inv := by intro t; rcases t with ⟨v, a, s, y, r⟩; rfl
CausalSmith.Stat.MarNearcompleteFrontier.fullAtomArrivalEquiv · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/PairedPrior.lean:354
theorem fullAtom_sum_by_arrival

Rewrite a full-atom sum as nested sums, with arrival the innermost bit. Given the specified input d, the specified input f, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
f :
FullAtom d → ℝ
(∑ w : FullAtom d, f w)
= ∑ v : PotentialAtom d, ∑ a : Bool, ∑ s : Bool, ∑ y : Bool, ∑ r : Bool, f ⟨v, a, s, y, r⟩
Proof (Lean source)
lemma fullAtom_sum_by_arrival {d : ℕ} (f : FullAtom d → ℝ) : (∑ w : FullAtom d, f w) = ∑ v : PotentialAtom d, ∑ a : Bool, ∑ s : Bool, ∑ y : Bool, ∑ r : Bool, f ⟨v, a, s, y, r⟩ := by rw [Fintype.sum_equiv (fullAtomArrivalEquiv d) f (fun t => f ((fullAtomArrivalEquiv d).symm t)) (by intro w; rfl)] simp only [Fintype.sum_prod_type, fullAtomArrivalEquiv] rfl
CausalSmith.Stat.MarNearcompleteFrontier.fullAtom_sum_by_arrival · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/PairedPrior.lean:363
theorem pairedFullLaw_floor

The pointwise arrival inequality gives the conditional arrival floor. Given the specified input n, the specified input d, the specified input q, the specified input hn, the specified input hd, the stated mathematical conclusion holds. Given the specified input σ, the specified input θ. Given the specified input hq, the specified input hσ.

Formal statement
n d :
ℕ
q σ :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
hσ :
σ ∈ Icc (-1) 1
θ :
Theta n d
ArrivalFloor q (pairedFullLaw n d q σ hn hd hq hσ θ)
Proof (Lean source)
lemma pairedFullLaw_floor (n d : ℕ) (q σ : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (hσ : σ ∈ Icc (-1) 1) (θ : Theta n d) : ArrivalFloor q (pairedFullLaw n d q σ hn hd hq hσ θ) := by intro x a s hc unfold arrivalProb apply (le_div_iff₀ hc).mpr unfold cellMass massOf rw [fullAtom_sum_by_arrival, fullAtom_sum_by_arrival] simp only [Finset.mul_sum] apply Finset.sum_le_sum intro v _ apply Finset.sum_le_sum intro a' _ apply Finset.sum_le_sum intro s' _ apply Finset.sum_le_sum intro y _ simp only [Fintype.sum_bool] by_cases h : v.X = x ∧ a' = a ∧ s' = s · rcases h with ⟨hv, ha, hs⟩ subst a' subst s' simpa [FullAtom.X, hv, pairedFullLaw_fullMass, mul_add, add_comm] using (pairedAtomWeight_arrival_floor_pointwise n d q σ hn hd hq hσ θ v a s y) · simp [h]
CausalSmith.Stat.MarNearcompleteFrontier.pairedFullLaw_floor · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/PairedPrior.lean:374
theorem mar_of_cellwise_arrival_factor

If each observed cell has an arrival factor depending only on the observed record, the full-data law satisfies missing at random.

Formal statement
d :
ℕ
P :
h :
∀ (x : Fin d) (a s : Bool),
∃ f : Bool → ℝ,
∀ (v : PotentialAtom d) (y r : Bool),
v.X = x → fullMass P ⟨v, a, s, y, r⟩ = f r * ∑ t : Bool, fullMass P ⟨v, a, s, y, t⟩
Proof (Lean source)
lemma mar_of_cellwise_arrival_factor {d : ℕ} (P : FullLaw d) (h : ∀ (x : Fin d) (a s : Bool), ∃ f : Bool → ℝ, ∀ (v : PotentialAtom d) (y r : Bool), v.X = x → fullMass P ⟨v, a, s, y, r⟩ = f r * ∑ t : Bool, fullMass P ⟨v, a, s, y, t⟩) : MissingAtRandom P := by classical intro x a s r y obtain ⟨f, hf⟩ := h x a s have joint (r y : Bool) : massOf P (fun w => w.X = x ∧ w.A = a ∧ w.S = s ∧ w.R = r ∧ w.Y = y) = f r * massOf P (fun w => w.X = x ∧ w.A = a ∧ w.S = s ∧ w.Y = y) := by unfold massOf rw [fullAtom_sum_by_arrival, fullAtom_sum_by_arrival] simp only [Finset.mul_sum] apply Finset.sum_congr rfl intro v _ by_cases hx : v.X = x · cases a <;> cases s <;> cases r <;> cases y <;> simp [FullAtom.X, hx] <;> simpa only [Fintype.sum_bool, mul_add] using (hf v _ _ hx) · simp [FullAtom.X, hx] have marginal (r : Bool) : massOf P (fun w => w.X = x ∧ w.A = a ∧ w.S = s ∧ w.R = r) = f r * cellMass P x a s := by unfold cellMass massOf rw [fullAtom_sum_by_arrival, fullAtom_sum_by_arrival] simp only [Finset.mul_sum] apply Finset.sum_congr rfl intro v _ by_cases hx : v.X = x · cases a <;> cases s <;> cases r <;> simp [FullAtom.X, hx] <;> simp only [Fintype.sum_bool, mul_add] at hf <;> linear_combination (hf v true _ hx) + (hf v false _ hx) · simp [FullAtom.X, hx] rw [joint, marginal] ring
CausalSmith.Stat.MarNearcompleteFrontier.mar_of_cellwise_arrival_factor · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/PairedPrior.lean:403
theorem pairAtomWeight_arrival_factor

One oriented pair has an arrival factor independent of its outcome bit. Given the specified input n, the specified input d, the specified input q, the specified input hd, the specified input side, the specified input v, the specified input a, the specified input s, the specified input y, the specified input r, the stated mathematical conclusion holds. Given the specified input σ, the specified input θ. Given the specified input j.

Formal statement
n d :
ℕ
q σ :
ℝ
hd :
1 ≤ d
θ :
Theta n d
j :
side :
a s y r :
pairAtomWeight n d q σ hd θ j side ⟨v, a, s, y, r⟩
= (if a then bernoulliFactor (pairRho q σ (latentZ n (θ.1 j)) (orientation θ j side)) r else if r then 1 else 0) * ∑ t : Bool, pairAtomWeight n d q σ hd θ j side ⟨v, a, s, y, t⟩
Proof (Lean source)
lemma pairAtomWeight_arrival_factor (n d : ℕ) (q σ : ℝ) (hd : 1 ≤ d) (θ : Theta n d) (j : Fin (pairCount n d)) (side : Bool) (v : PotentialAtom d) (a s y r : Bool) : pairAtomWeight n d q σ hd θ j side ⟨v, a, s, y, r⟩ = (if a then bernoulliFactor (pairRho q σ (latentZ n (θ.1 j)) (orientation θ j side)) r else if r then 1 else 0) * ∑ t : Bool, pairAtomWeight n d q σ hd θ j side ⟨v, a, s, y, t⟩ := by by_cases hsupp : v.X = pairLabel n d hd j side ∧ v.S0 = false ∧ v.S1 = false ∧ s = false ∧ v.Y0 = false ∧ y = (if a then v.Y1 else v.Y0) · simp only [pairAtomWeight, if_pos hsupp] cases a <;> cases r <;> cases hY : v.Y1 <;> simp [bernoulliFactor, FullAtom.Y1, hY] <;> ring · simp [pairAtomWeight, hsupp]
CausalSmith.Stat.MarNearcompleteFrontier.pairAtomWeight_arrival_factor · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/PairedPrior.lean:444
theorem fillerAtomWeight_arrival_factor

The filler component always arrives, independently of its outcome bit. Given the specified input n, the specified input d, the specified input q, the specified input hd, the specified input v, the specified input a, the specified input s, the specified input y, the specified input r, the stated mathematical conclusion holds. Given the specified input θ.

Formal statement
n d :
ℕ
q :
ℝ
hd :
1 ≤ d
θ :
Theta n d
a s y r :
fillerAtomWeight n d q hd θ ⟨v, a, s, y, r⟩
= (if r then (1 : ℝ) else 0) * ∑ t : Bool, fillerAtomWeight n d q hd θ ⟨v, a, s, y, t⟩
Proof (Lean source)
lemma fillerAtomWeight_arrival_factor (n d : ℕ) (q : ℝ) (hd : 1 ≤ d) (θ : Theta n d) (v : PotentialAtom d) (a s y r : Bool) : fillerAtomWeight n d q hd θ ⟨v, a, s, y, r⟩ = (if r then (1 : ℝ) else 0) * ∑ t : Bool, fillerAtomWeight n d q hd θ ⟨v, a, s, y, t⟩ := by cases r <;> simp [fillerAtomWeight]
CausalSmith.Stat.MarNearcompleteFrontier.fillerAtomWeight_arrival_factor · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/PairedPrior.lean:462
theorem pairedAtomWeight_at_filler

Only the filler component contributes at the filler label. Given the specified input n, the specified input d, the specified input q, the specified input hd, the specified input w, the specified input hw, the stated mathematical conclusion holds. Given the specified input σ, the specified input θ.

Formal statement
n d :
ℕ
q σ :
ℝ
hd :
1 ≤ d
θ :
Theta n d
w :
hw :
w.X = fillerLabel d hd
pairedAtomWeight n d q σ hd θ w = fillerAtomWeight n d q hd θ w
Proof (Lean source)
lemma pairedAtomWeight_at_filler (n d : ℕ) (q σ : ℝ) (hd : 1 ≤ d) (θ : Theta n d) (w : FullAtom d) (hw : w.X = fillerLabel d hd) : pairedAtomWeight n d q σ hd θ w = fillerAtomWeight n d q hd θ w := by simp [pairedAtomWeight, pairAtomWeight_filler_zero n d q σ hd θ _ _ w hw]
CausalSmith.Stat.MarNearcompleteFrontier.pairedAtomWeight_at_filler · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/PairedPrior.lean:471
theorem pairedAtomWeight_at_pair

Only its own oriented component contributes at a paired label. Given the specified input n, the specified input d, the specified input q, the specified input hd, the specified input side, the specified input w, the specified input hw, the stated mathematical conclusion holds. Given the specified input σ, the specified input θ. Given the specified input j.

Formal statement
n d :
ℕ
q σ :
ℝ
hd :
1 ≤ d
θ :
Theta n d
j :
side :
w :
hw :
w.X = pairLabel n d hd j side
pairedAtomWeight n d q σ hd θ w = pairAtomWeight n d q σ hd θ j side w
Proof (Lean source)
lemma pairedAtomWeight_at_pair (n d : ℕ) (q σ : ℝ) (hd : 1 ≤ d) (θ : Theta n d) (j : Fin (pairCount n d)) (side : Bool) (w : FullAtom d) (hw : w.X = pairLabel n d hd j side) : pairedAtomWeight n d q σ hd θ w = pairAtomWeight n d q σ hd θ j side w := by unfold pairedAtomWeight rw [fillerAtomWeight_pair_zero n d q hd θ j side w hw, zero_add] calc (∑ k : Fin (pairCount n d), ∑ side' : Bool, pairAtomWeight n d q σ hd θ k side' w) = ∑ side' : Bool, pairAtomWeight n d q σ hd θ j side' w := by apply Finset.sum_eq_single j · intro k _ hne apply Finset.sum_eq_zero intro side' _ exact pairAtomWeight_other_pair_zero n d q σ hd θ k j side' side w hw (inl hne) · simp _ = pairAtomWeight n d q σ hd θ j side w := by apply Finset.sum_eq_single side · intro side' _ hne exact pairAtomWeight_other_pair_zero n d q σ hd θ j j side' side w hw (inr hne) · simp
CausalSmith.Stat.MarNearcompleteFrontier.pairedAtomWeight_at_pair · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/PairedPrior.lean:479
def pairedClassLaw

The normalized law, bundled with its MAR-class certificate.

Definition (Lean source)
n d :
ℕ
q σ :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
hσ :
σ ∈ Icc (-1) 1
θ :
Theta n d
pairedClassLaw n d q σ hn hd hq hσ θ :
⟨pairedFullLaw n d q σ hn hd hq hσ θ, pairedFullLaw_legal n d q σ hn hd hq hσ θ⟩
CausalSmith.Stat.MarNearcompleteFrontier.pairedClassLaw · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/PairedPrior.lean:561
def pairedPrior

The pair of priors on legal normalized MAR laws, indexed by prior sign.

Definition (Lean source)
n d :
ℕ
q :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
pairedPrior n d q hn hd hq :
PMF (ClassLaw d q) × PMF (ClassLaw d q)
π :
thetaLaw n d q hn hd hq
(π.map (pairedClassLaw n d q (-1) hn hd hq (by norm_num : (-1 : ℝ) ∈ Icc (-1) 1)), π.map (pairedClassLaw n d q 1 hn hd hq (by norm_num : (1 : ℝ) ∈ Icc (-1) 1)))
def pairedPredictive

Finite prior-predictive iid mixture for either sign.

Definition (Lean source)
n d :
ℕ
q σ :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
hσ :
σ ∈ Icc (-1) 1
pairedPredictive n d q σ hn hd hq hσ :
Measure (Fin n → Obs d)
∑ θ : Theta n d, (thetaLaw n d q hn hd hq θ) • samplePi (pairedFullLaw n d q σ hn hd hq hσ θ) n
CausalSmith.Stat.MarNearcompleteFrontier.pairedPredictive · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/PairedPrior.lean:580
instance instMeasurableSpaceClassLaw

For a covariate dimension and an arrival floor, the class of legal laws is equipped with the discrete measurable structure.

Definition (Lean source)
instance (d : ℕ) (q : ℝ) : MeasurableSpace (ClassLaw d q) := ⊤
CausalSmith.Stat.MarNearcompleteFrontier.instMeasurableSpaceClassLaw · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/PairedPrior.lean:589
instance instMeasurableSingletonClassClassLaw

For a covariate dimension and an arrival floor, every singleton legal law is measurable.

Definition (Lean source)
instance (d : ℕ) (q : ℝ) : MeasurableSingletonClass (ClassLaw d q) := ⟨fun _ => trivial⟩
CausalSmith.Stat.MarNearcompleteFrontier.instMeasurableSingletonClassClassLaw · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/PairedPrior.lean:591

The complete observed-sample mixture induced by any prior on legal laws.

Definition (Lean source)
n d :
ℕ
q :
ℝ
π :
priorPredictive n d q π :
Measure (Fin n → Obs d)
π.toMeasure.bind (fun P => samplePi P.val n)
CausalSmith.Stat.MarNearcompleteFrontier.priorPredictive · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/PairedPrior.lean:595

Prior probability of a target event.

Definition (Lean source)
d :
ℕ
q :
ℝ
π :
E :
ClassLaw d q → Prop
priorEventMass d q π E :
ℝ
π.toMeasure.real {P | E P}
CausalSmith.Stat.MarNearcompleteFrontier.priorEventMass · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/PairedPrior.lean:600
theorem pmf_toMeasure_finset_decomposition Lemma pmf_toMeasure_finset_decomposition in the paper ↗

the stated mathematical conclusion holds. Given the specified input α, the specified input π.

Formal statement
π.toMeasure = ∑ x : α, (π x) • Measure.dirac x
Proof (Lean source)
lemma pmf_toMeasure_finset_decomposition {α : Type*} [Fintype α] [MeasurableSpace α] [MeasurableSingletonClass α] (π : PMF α) : π.toMeasure = ∑ x : α, (π x) • Measure.dirac x := by classical ext s hs simp [PMF.toMeasure_apply_fintype, Measure.dirac_apply' _ hs, indicator]
CausalSmith.Stat.MarNearcompleteFrontier.pmf_toMeasure_finset_decomposition · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/PairedPrior.lean:606
theorem pairedPredictive_minus_eq

For a sample size of at least one, a positive dimension, and an admissible arrival floor, the negative-sign paired predictive law equals the predictive law of the first paired prior.

Formal statement
n d :
ℕ
q :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
pairedPredictive n d q (-1) hn hd hq (by norm_num : (-1 : ℝ) ∈ Icc (-1) 1)
= priorPredictive n d q (pairedPrior n d q hn hd hq).1
Proof (Lean source)
lemma pairedPredictive_minus_eq (n d : ℕ) (q : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) : pairedPredictive n d q (-1) hn hd hq (by norm_num : (-1 : ℝ) ∈ Icc (-1) 1) = priorPredictive n d q (pairedPrior n d q hn hd hq).1 := by classical letI : MeasurableSpace (Theta n d) := ⊤ letI : MeasurableSingletonClass (Theta n d) := ⟨fun _ => trivial⟩ simp only [pairedPrior, priorPredictive, pairedPredictive] rw [← PMF.toMeasure_map (pairedClassLaw n d q (-1) hn hd hq (by norm_num : (-1 : ℝ) ∈ Icc (-1) 1)) (thetaLaw n d q hn hd hq) (by exact measurable_of_finite _)] simp only [Measure.bind] rw [pmf_toMeasure_finset_decomposition] have hclass : Measurable (pairedClassLaw n d q (-1) hn hd hq (by norm_num : (-1 : ℝ) ∈ Icc (-1) 1)) := measurable_of_finite _ have hsample : Measurable (fun P : ClassLaw d q => samplePi P.val n) := by intro s hs trivial rw [Measure.map_map hsample hclass] rw [Measure.map_finset_sum' (hsample.comp hclass).aemeasurable] conv_rhs => rw [← Measure.sum_fintype, Measure.join_sum, Measure.sum_fintype] simp_rw [Measure.map_smul, Measure.map_dirac' (hsample.comp hclass)] simp [pairedClassLaw]
CausalSmith.Stat.MarNearcompleteFrontier.pairedPredictive_minus_eq · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/PairedPrior.lean:614
theorem pairedPredictive_plus_eq

For a sample size of at least one, a positive dimension, and an admissible arrival floor, the positive-sign paired predictive law equals the predictive law of the second paired prior.

Formal statement
n d :
ℕ
q :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
pairedPredictive n d q 1 hn hd hq (by norm_num : (1 : ℝ) ∈ Icc (-1) 1)
= priorPredictive n d q (pairedPrior n d q hn hd hq).2
Proof (Lean source)
lemma pairedPredictive_plus_eq (n d : ℕ) (q : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) : pairedPredictive n d q 1 hn hd hq (by norm_num : (1 : ℝ) ∈ Icc (-1) 1) = priorPredictive n d q (pairedPrior n d q hn hd hq).2 := by classical letI : MeasurableSpace (Theta n d) := ⊤ letI : MeasurableSingletonClass (Theta n d) := ⟨fun _ => trivial⟩ simp only [pairedPrior, priorPredictive, pairedPredictive] rw [← PMF.toMeasure_map (pairedClassLaw n d q 1 hn hd hq (by norm_num : (1 : ℝ) ∈ Icc (-1) 1)) (thetaLaw n d q hn hd hq) (by exact measurable_of_finite _)] simp only [Measure.bind] rw [pmf_toMeasure_finset_decomposition] have hclass : Measurable (pairedClassLaw n d q 1 hn hd hq (by norm_num : (1 : ℝ) ∈ Icc (-1) 1)) := measurable_of_finite _ have hsample : Measurable (fun P : ClassLaw d q => samplePi P.val n) := by intro s hs trivial rw [Measure.map_map hsample hclass] rw [Measure.map_finset_sum' (hsample.comp hclass).aemeasurable] conv_rhs => rw [← Measure.sum_fintype, Measure.join_sum, Measure.sum_fintype] simp_rw [Measure.map_smul, Measure.map_dirac' (hsample.comp hclass)] simp [pairedClassLaw]
CausalSmith.Stat.MarNearcompleteFrontier.pairedPredictive_plus_eq · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/PairedPrior.lean:638
def pairObservedCoeff

Unnormalized observed atom coefficient of an oriented pair.

Definition (Lean source)
d :
ℕ
shared
q σ z u :
ℝ
o :
Obs d
pairObservedCoeff q σ z u o :
ℝ
if o.S ≠ false then 0 else if o.A = false ∧
o.R = true ∧
o.RY = false then 1 / 2 else if o.A = true ∧
o.R = false ∧
o.RY = false then delta q * (1 + σ * z * u) / 4 else if o.A = true ∧
o.R = true ∧
o.RY = true then (1 - delta q / 2) / 4 + u / 32 else if o.A = true ∧
o.R = true ∧
o.RY = false then (1 - delta q / 2) / 4 - u / 32 - σ * delta q * z * u / 4 else 0
CausalSmith.Stat.MarNearcompleteFrontier.pairObservedCoeff · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/PairedPrior.lean:662
def fillerObservedCoeff

Fixed filler observed-atom coefficient.

Definition (Lean source)
d :
ℕ
shared
q :
ℝ
o :
Obs d
fillerObservedCoeff q o :
ℝ
if o.S ≠ false then 0 else if o.A = false ∧
o.R = true ∧
o.RY = false then 1 / 2 else if o.A = true ∧
o.R = true ∧
o.RY = true then baseMean q / 2 else if o.A = true ∧
o.R = true ∧
o.RY = false then (1 - baseMean q) / 2 else 0
CausalSmith.Stat.MarNearcompleteFrontier.fillerObservedCoeff · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/PairedPrior.lean:674
def countAtomMass

Unnormalized mass at an observed atom in the count experiment.

Definition (Lean source)
n d :
ℕ
q σ :
ℝ
hd :
1 ≤ d
θ :
Theta n d
o :
Obs d
countAtomMass n d q σ hd θ o :
ℝ
(if o.X = fillerLabel d hd then fillerMass n d * fillerObservedCoeff q o else 0)
+ ∑ j : Fin (pairCount n d), ∑ side : Bool, if o.X
= pairLabel n d hd j side then latentP n (θ.1 j) * pairObservedCoeff q σ (latentZ n (θ.1 j)) (orientation θ j side) o else 0
CausalSmith.Stat.MarNearcompleteFrontier.countAtomMass · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/PairedPrior.lean:682
def conditionalCountLaw

Independent Poisson counts with rate 4n times each unnormalized atom mass.

Definition (Lean source)
n d :
ℕ
q σ :
ℝ
hd :
1 ≤ d
θ :
Theta n d
conditionalCountLaw n d q σ hd θ :
Measure (Obs d → ℕ)
Measure.pi (fun o : Obs d => poissonMeasure (toNNReal (4 * (n : ℝ) * countAtomMass n d q σ hd θ o)))
CausalSmith.Stat.MarNearcompleteFrontier.conditionalCountLaw · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/PairedPrior.lean:692
def mixedCountLaw

Latent mixture of the unnormalized count experiment.

Definition (Lean source)
n d :
ℕ
q σ :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
mixedCountLaw n d q σ hn hd hq :
Measure (Obs d → ℕ)
∑ θ : Theta n d, (thetaLaw n d q hn hd hq θ) • conditionalCountLaw n d q σ hd θ
CausalSmith.Stat.MarNearcompleteFrontier.mixedCountLaw · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/PairedPrior.lean:698
def countTotal

The number of records in a finite count vector.

Definition (Lean source)
d :
ℕ
shared
counts :
Obs d → ℕ
countTotal counts :
ℕ
∑ o : Obs d, counts o
def ValidOrdering

An ordering has exactly the specified multiset of records.

Definition (Lean source)
d :
ℕ
shared
counts :
Obs d → ℕ
order :
Fin (countTotal counts) → Obs d
o :
ValidOrdering counts order :
Prop
(Finset.univ.filter (fun i => order i = o)).card = counts o
CausalSmith.Stat.MarNearcompleteFrontier.ValidOrdering · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/PairedPrior.lean:707
def validOrders

For observed-cell counts, the collection of all orderings with exactly those counts is defined.

Definition (Lean source)
d :
ℕ
shared
counts :
Obs d → ℕ
validOrders counts :
Finset (Fin (countTotal counts) → Obs d)
by classical exact Finset.univ.filter (ValidOrdering counts)
theorem uniformOrdering_sum

Given the specified input counts, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
shared
counts :
Obs d → ℕ
∑ order : Fin (countTotal counts) → Obs d, (if order ∈ validOrders counts then (1 / (validOrders counts).card : ℝ≥0∞) else 0)
= 1
Proof (Lean source)
lemma uniformOrdering_sum (counts : Obs d → ℕ) : ∑ order : Fin (countTotal counts) → Obs d, (if order ∈ validOrders counts then (1 / (validOrders counts).card : ℝ≥0∞) else 0) = 1 := by classical have hcard : card (Σ o : Obs d, Fin (counts o)) = countTotal counts := by simp [Fintype.card_sigma, countTotal] let e : Fin (countTotal counts) ≃ Σ o : Obs d, Fin (counts o) := Fintype.equivOfCardEq (by simpa using hcard.symm) let order : Fin (countTotal counts) → Obs d := fun i => (e i).1 have hvalid : ValidOrdering counts order := by intro o let fiberSigma : {s : (Σ o : Obs d, Fin (counts o)) // s.1 = o} ≃ Fin (counts o) := { toFun := fun ⟨⟨o', j⟩, h⟩ => h ▸ j invFun := fun j => ⟨⟨o, j⟩, rfl⟩ left_inv := by intro ⟨⟨o', j⟩, h⟩; cases h; rfl right_inv := by intro j; rfl } let fiber : {i : Fin (countTotal counts) // order i = o} ≃ Fin (counts o) := (e.subtypeEquiv (fun _ => Iff.rfl)).trans fiberSigma calc (Finset.univ.filter (fun i => order i = o)).card = card {i : Fin (countTotal counts) // order i = o} := (Fintype.card_subtype _).symm _ = card (Fin (counts o)) := Fintype.card_congr fiber _ = counts o := Fintype.card_fin _ have hmem : order ∈ validOrders counts := by simp [validOrders, hvalid] have hpos : 0 < (validOrders counts).card := Finset.card_pos.mpr ⟨order, hmem⟩ simp only [Finset.sum_ite, Finset.sum_const_zero, add_zero, Finset.sum_const, nsmul_eq_mul] have hc : (Finset.univ.filter (fun x => x ∈ validOrders counts)) = validOrders counts := by ext; simp rw [hc, one_div] apply ENNReal.mul_inv_cancel · exact_mod_cast hpos.ne' · simp
CausalSmith.Stat.MarNearcompleteFrontier.uniformOrdering_sum · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/PairedPrior.lean:719
def uniformOrdering

Uniform ordering of the finite counted multiset.

Definition (Lean source)
d :
ℕ
shared
counts :
Obs d → ℕ
uniformOrdering counts :
PMF (Fin (countTotal counts) → Obs d)
PMF.ofFintype (fun order => if order ∈ validOrders counts then (1 / (validOrders counts).card : ℝ≥0∞) else 0) (uniformOrdering_sum counts)
CausalSmith.Stat.MarNearcompleteFrontier.uniformOrdering · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/PairedPrior.lean:759
def countOrderingKernel

Uniform ordering followed by first-n truncation, independent of sign and latent draws.

Definition (Lean source)
n d :
ℕ
o_circle :
Obs d
counts :
Obs d → ℕ
countOrderingKernel n d o_circle counts :
PMF (Fin n → Obs d)
(uniformOrdering counts).map (fun order i => if h : n ≤ countTotal counts then order ⟨i.val, lt_of_lt_of_le i.isLt h⟩ else o_circle)
CausalSmith.Stat.MarNearcompleteFrontier.countOrderingKernel · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/PairedPrior.lean:766
structure PairedPriorHandle

The public handle for the normalized paired-prior construction and its associated predictive and count experiments.

Definition (Lean source)
n d :
ℕ
q :
ℝ
priors :
PMF (ClassLaw d q) × PMF (ClassLaw d q)
predictiveMinus :
Measure (Fin n → Obs d)
predictivePlus :
Measure (Fin n → Obs d)
countMinus :
Measure (Obs d → ℕ)
countPlus :
Measure (Obs d → ℕ)
fallback :
Obs d
kernel :
(Obs d → ℕ) → PMF (Fin n → Obs d)
CausalSmith.Stat.MarNearcompleteFrontier.PairedPriorHandle · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/PairedPrior.lean:774
def pairedPriorHandle

The normalized same-experiment paired-prior handle, including the induced sample mixtures, Poisson count experiments, and the fixed-record truncation kernel used to transfer between them. Given the specified input n, the specified input d, the specified input q, the specified input o_circle, the specified input hn, the specified input hd, the stated mathematical conclusion holds. Given the specified input hq.

Definition (Lean source)
n d :
ℕ
q :
ℝ
o_circle :
Obs d
hn :
1 ≤ n
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
pairedPriorHandle n d q o_circle hn hd hq :
clause 1
priors := pairedPrior n d q hn hd hq
clause 2
predictiveMinus := pairedPredictive n d q (-1) hn hd hq (by norm_num : (-1 : ℝ) ∈ Icc (-1) 1)
clause 3
predictivePlus := pairedPredictive n d q 1 hn hd hq (by norm_num : (1 : ℝ) ∈ Icc (-1) 1)
clause 4
countMinus := mixedCountLaw n d q (-1) hn hd hq
clause 5
countPlus := mixedCountLaw n d q 1 hn hd hq
clause 6
fallback := o_circle
clause 7
kernel := countOrderingKernel n d o_circle
CausalSmith.Stat.MarNearcompleteFrontier.pairedPriorHandle · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/PairedPrior.lean:786
CausalSmith.Stat.STAT_MarNearcompleteFrontier_Research.Helpers.PairedPrior.Atoms 49 declarations The latent support, legal full laws, observed mixtures, independent Poisson count experiment and parameter-independent count-ordering kernel are defined here.

Normalized paired prior and count experiment

The latent support, legal full laws, observed mixtures, independent Poisson count experiment and parameter-independent count-ordering kernel are defined here. All normalization and law-class obligations are separately named proof obligations.

def priorK

The interpolation degree is the logarithmic degree selected for the sample size.

Definition (Lean source)
n :
ℕ
priorK n :
ℕ
ceil (8 * ell n)
def priorH

The interpolation lower endpoint is determined by the sample size.

Definition (Lean source)
n :
ℕ
priorH n :
ℝ
(priorK n : ℝ)⁻¹ ^ 2
def priorB

The prior scale is determined by the sample size.

Definition (Lean source)
n :
ℕ
priorB n :
ℝ
(priorK n : ℝ) / (1024 * n)
def pairCount

The number of paired coordinates is determined by the sample size and the covariate dimension.

Definition (Lean source)
n d :
ℕ
pairCount n d :
ℕ
min ((d - 1) / 2) (floor ((n : ℝ) * ell n))
def fillerMass

The residual filler mass is determined by the sample size and the covariate dimension.

Definition (Lean source)
n d :
ℕ
fillerMass n d :
ℝ
1 - 2 * pairCount n d * priorH n * priorB n
def baseMean

The baseline Bernoulli mean is calibrated to the arrival-floor parameter.

Definition (Lean source)
q :
ℝ
baseMean q :
ℝ
(1 - delta q / 2) ^ 2 / (2 * q)
def interpolationNode

Interpolation nodes on [h,1].

Definition (Lean source)
n :
ℕ
i :
interpolationNode n i :
ℝ
(1 + priorH n) / 2
+ (1 - priorH n) / 2 * cos ((i : ℝ) * pi / ((priorK n - 1 : ℕ) : ℝ))
CausalSmith.Stat.MarNearcompleteFrontier.interpolationNode · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/PairedPrior/Atoms.lean:37
def lagrangeAtZero

Cardinal Lagrange coefficient evaluated at zero.

Definition (Lean source)
n :
ℕ
i :
lagrangeAtZero n i :
ℝ
def lagrangeNorm

Total variation of the interpolation coefficients.

Definition (Lean source)
n :
ℕ
lagrangeNorm n :
ℝ
∑ i : Fin (priorK n), |lagrangeAtZero n i|
def signedNodeWeight

Signed normalized interpolation weights.

Definition (Lean source)
n :
ℕ
i :
signedNodeWeight n i :
ℝ
CausalSmith.Stat.MarNearcompleteFrontier.signedNodeWeight · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/PairedPrior/Atoms.lean:50
def Latent

One latent pair is either an interpolation node or the residual zero atom.

Definition (Lean source)
n :
ℕ
Latent n :
Type
Fin (priorK n) ⊕ Unit
def latentP

The latent probability coordinate assigns each atom in the sample-size-dependent support its interpolation value or zero.

Definition (Lean source)
n :
ℕ
latentP n :
Latent n → ℝ
clause 1
| .inl i => priorB n * interpolationNode n i
clause 2
| .inr _ => 0
def latentZ

The latent sign coordinate assigns each atom in the sample-size-dependent support its signed interpolation orientation.

Definition (Lean source)
n :
ℕ
latentZ n :
Latent n → ℝ
clause 1
| .inl i => if 0 ≤ signedNodeWeight n i then 1 else -1
clause 2
| .inr _ => 1
def latentWeight

The latent mixing weight assigns each atom in the sample-size-dependent support its normalized mass.

Definition (Lean source)
n :
ℕ
latentWeight n :
Latent n → ℝ
clause 1
| .inl i => priorH n * |signedNodeWeight n i| / interpolationNode n i
clause 2
| .inr _
=> 1 - ∑ i : Fin (priorK n), priorH n * |signedNodeWeight n i| / interpolationNode n i
theorem latentWeight_node_lower Lemma latentWeight_node_lower in the paper ↗

Given the specified input n, the stated mathematical conclusion holds. Given the specified input i.

Formal statement
n :
ℕ
i :
Proof (Lean source)
lemma latentWeight_node_lower (n : ℕ) (i : Fin (priorK n)) : priorH n ≤ interpolationNode n i := by have hh : priorH n ≤ 1 := by have hk : (1 : ℝ) ≤ priorK n := by have he : (0 : ℝ) < ell n := by unfold ell apply Real.log_pos have h := Real.one_lt_exp_iff.mpr (show (0 : ℝ) < 1 by norm_num) exact lt_of_lt_of_le h (le_add_of_nonneg_right (Nat.cast_nonneg _)) have hc : 8 * ell n ≤ (priorK n : ℝ) := Nat.le_ceil _ have hp : (0 : ℝ) < priorK n := by linarith have hpn : 0 < priorK n := by exact_mod_cast hp exact_mod_cast (show 1 ≤ priorK n by omega) unfold priorH have hi : (priorK n : ℝ)⁻¹ ≤ 1 := inv_le_one_of_one_le₀ hk have hnonneg : (0 : ℝ) ≤ (priorK n : ℝ)⁻¹ := by positivity nlinarith have hc := Real.neg_one_le_cos ((i : ℝ) * pi / ((priorK n - 1 : ℕ) : ℝ)) unfold interpolationNode nlinarith
CausalSmith.Stat.MarNearcompleteFrontier.latentWeight_node_lower · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/PairedPrior/Atoms.lean:74

Given the specified input n, the stated mathematical conclusion holds. Given the specified input i.

Formal statement
n :
ℕ
i :
Proof (Lean source)
lemma latentWeight_node_pos (n : ℕ) (i : Fin (priorK n)) : 0 < interpolationNode n i := by have hk : (0 : ℝ) < priorK n := by have he : (0 : ℝ) < ell n := by unfold ell apply Real.log_pos have h := Real.one_lt_exp_iff.mpr (show (0 : ℝ) < 1 by norm_num) exact lt_of_lt_of_le h (le_add_of_nonneg_right (Nat.cast_nonneg _)) have hc : 8 * ell n ≤ (priorK n : ℝ) := Nat.le_ceil _ linarith have hh : 0 < priorH n := by unfold priorH positivity exact lt_of_lt_of_le hh (latentWeight_node_lower n i)
CausalSmith.Stat.MarNearcompleteFrontier.latentWeight_node_pos · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/PairedPrior/Atoms.lean:98
theorem latentWeight_signed_total_le_one Lemma latentWeight_signed_total_le_one in the paper ↗

Given the specified input n, the stated mathematical conclusion holds.

Formal statement
n :
ℕ
(∑ i : Fin (priorK n), |signedNodeWeight n i|) ≤ 1
Proof (Lean source)
lemma latentWeight_signed_total_le_one (n : ℕ) : (∑ i : Fin (priorK n), |signedNodeWeight n i|) ≤ 1 := by have hnorm : 0 ≤ lagrangeNorm n := by unfold lagrangeNorm positivity by_cases hz : lagrangeNorm n = 0 · simp [signedNodeWeight, hz] · have hp : 0 < lagrangeNorm n := lt_of_le_of_ne hnorm (Ne.symm hz) simp only [signedNodeWeight, abs_div, abs_of_nonneg hnorm, ← Finset.sum_div] rw [show (∑ i : Fin (priorK n), |lagrangeAtZero n i|) = lagrangeNorm n by rfl] simp [hz]
CausalSmith.Stat.MarNearcompleteFrontier.latentWeight_signed_total_le_one · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/PairedPrior/Atoms.lean:115
theorem latentWeight_sum

For a sample size of at least one, a positive dimension, and an admissible arrival floor, the latent weights sum to one.

Formal statement
n d :
ℕ
q :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
∑ z : Latent n, ofReal (latentWeight n z) = 1
Proof (Lean source)
lemma latentWeight_sum (n d : ℕ) (q : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) : ∑ z : Latent n, ofReal (latentWeight n z) = 1 := by classical have hterm (i : Fin (priorK n)) : 0 ≤ priorH n * |signedNodeWeight n i| / interpolationNode n i := by exact div_nonneg (mul_nonneg (by unfold priorH; positivity) (abs_nonneg _)) (le_of_lt (latentWeight_node_pos n i)) have hbound (i : Fin (priorK n)) : priorH n * |signedNodeWeight n i| / interpolationNode n i ≤ |signedNodeWeight n i| := by apply (div_le_iff₀ (latentWeight_node_pos n i)).mpr nlinarith [latentWeight_node_lower n i, abs_nonneg (signedNodeWeight n i)] have hsum : (∑ i : Fin (priorK n), priorH n * |signedNodeWeight n i| / interpolationNode n i) ≤ 1 := by calc _ ≤ ∑ i : Fin (priorK n), |signedNodeWeight n i| := Finset.sum_le_sum (fun i _ => hbound i) _ ≤ 1 := latentWeight_signed_total_le_one n simp only [Fintype.sum_sum_type, Fintype.sum_unique, latentWeight] rw [← ENNReal.ofReal_sum_of_nonneg (fun i _ => hterm i)] rw [← ENNReal.ofReal_add (Finset.sum_nonneg (fun i _ => hterm i)) (sub_nonneg.mpr hsum)] simp
CausalSmith.Stat.MarNearcompleteFrontier.latentWeight_sum · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/PairedPrior/Atoms.lean:129
def oneLatentLaw

Probability law of one latent pair, including the residual atom.

Definition (Lean source)
n d :
ℕ
q :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
oneLatentLaw n d q hn hd hq :
PMF.ofFintype (fun z => ofReal (latentWeight n z)) (latentWeight_sum n d q hn hd hq)
def Theta

Latent draws and independent fair orientation signs for all pairs.

Definition (Lean source)
n d :
ℕ
Theta n d :
Type
(Fin (pairCount n d) → Latent n) × (Fin (pairCount n d) → Bool)
def thetaWeight

Product weight of all independent pair draws and fair signs.

Definition (Lean source)
n d :
ℕ
q :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
θ :
Theta n d
thetaWeight n d q hn hd hq θ :
ℝ≥0∞
∏ j : Fin (pairCount n d), oneLatentLaw n d q hn hd hq (θ.1 j) * (1 / 2 : ℝ≥0∞)
theorem thetaWeight_sum

For a sample size of at least one, a positive dimension, and an admissible arrival floor, the joint weights of latent draws and orientations sum to one.

Formal statement
n d :
ℕ
q :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
∑ θ : Theta n d, thetaWeight n d q hn hd hq θ = 1
Proof (Lean source)
lemma thetaWeight_sum (n d : ℕ) (q : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) : ∑ θ : Theta n d, thetaWeight n d q hn hd hq θ = 1 := by classical simp only [thetaWeight, Fintype.sum_prod_type, Finset.prod_mul_distrib] rw [← Fintype.sum_mul_sum] simp only [← Fintype.prod_sum] have hlat : (∑ z : Latent n, oneLatentLaw n d q hn hd hq z) = 1 := by simpa using (oneLatentLaw n d q hn hd hq).tsum_coe rw [hlat] simp only [Finset.prod_const_one, one_div, Finset.prod_const, Finset.card_univ, Fintype.card_fin, Finset.sum_const, Fintype.card_pi, Fintype.card_bool, nsmul_eq_mul, Nat.cast_pow, Nat.cast_ofNat, one_mul] rw [← mul_pow] rw [ENNReal.mul_inv_cancel (by norm_num) (by norm_num)] simp
def thetaLaw

For a sample size, a positive dimension, and an admissible arrival floor, the probability law of all latent draws and orientations is defined.

Definition (Lean source)
n d :
ℕ
q :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
thetaLaw n d q hn hd hq :
PMF (Theta n d)
PMF.ofFintype (thetaWeight n d q hn hd hq) (thetaWeight_sum n d q hn hd hq)
def normalizationJ

Exact random total mass of the unnormalized filler and pair labels.

Definition (Lean source)
n d :
ℕ
θ :
Theta n d
normalizationJ n d θ :
ℝ
fillerMass n d + 2 * ∑ j : Fin (pairCount n d), latentP n (θ.1 j)
def orientation

The two orientations at a pair are opposite.

Definition (Lean source)
n :
ℕ
shared
d :
ℕ
shared
θ :
Theta n d
j :
side :
orientation θ j side :
ℝ
if θ.2 j == side then 1 else -1
def pairRho

Treatment arrival probability in one oriented pair under sign σ.

Definition (Lean source)
q σ z u :
ℝ
pairRho q σ z u :
ℝ
1 - delta q / 2 * (1 + σ * z * u)
def pairMu

Treatment outcome mean at one pair label.

Definition (Lean source)
q σ z u :
ℝ
pairMu q σ z u :
ℝ
((1 - delta q / 2) / 2 + u / 16) / pairRho q σ z u
theorem pair_labels_fit

For a sample size and a positive dimension, the pair labels and filler label fit within the available covariate labels.

Formal statement
n d :
ℕ
hd :
1 ≤ d
2 * pairCount n d + 1 ≤ d
Proof (Lean source)
lemma pair_labels_fit (n d : ℕ) (hd : 1 ≤ d) : 2 * pairCount n d + 1 ≤ d := by have h : pairCount n d ≤ (d - 1) / 2 := by unfold pairCount exact min_le_left _ _ omega
def fillerLabel

The filler has label zero.

Definition (Lean source)
d :
ℕ
hd :
1 ≤ d
fillerLabel d hd :
Fin d
⟨0, hd⟩
theorem pairLabel_lt

For a pair index, a side of that pair, and a positive dimension, the corresponding pair label is strictly below the dimension.

Formal statement
n d :
ℕ
hd :
1 ≤ d
j :
side :
2 * j.val + (if side then 1 else 2) < d
Proof (Lean source)
lemma pairLabel_lt (n d : ℕ) (hd : 1 ≤ d) (j : Fin (pairCount n d)) (side : Bool) : 2 * j.val + (if side then 1 else 2) < d := by have h := pair_labels_fit n d hd have hj := j.isLt split <;> omega
def pairLabel

Pair labels occupy the next 2M positions.

Definition (Lean source)
n d :
ℕ
hd :
1 ≤ d
j :
side :
pairLabel n d hd j side :
Fin d
⟨2 * j.val + (if side then 1 else 2), pairLabel_lt n d hd j side⟩

A pair index and orientation determine a unique baseline label. Given the specified input n, the specified input d, the specified input hd, the specified input side, the specified input side', the specified input h, the stated mathematical conclusion holds. Given the specified input j, the specified input k.

Formal statement
n d :
ℕ
hd :
1 ≤ d
j k :
side side' :
h :
pairLabel n d hd j side = pairLabel n d hd k side'
conclusion 1
j = k
conclusion 2
side = side'
Proof (Lean source)
lemma pairLabel_injective (n d : ℕ) (hd : 1 ≤ d) (j k : Fin (pairCount n d)) (side side' : Bool) (h : pairLabel n d hd j side = pairLabel n d hd k side') : j = k ∧ side = side' := by have hv : 2 * j.val + (if side then 1 else 2) = 2 * k.val + (if side' then 1 else 2) := congrArg val h cases side <;> cases side' <;> simp_all [pairLabel] <;> omega
CausalSmith.Stat.MarNearcompleteFrontier.pairLabel_injective · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/PairedPrior/Atoms.lean:239
theorem fillerLabel_ne_pairLabel Lemma fillerLabel_ne_pairLabel in the paper ↗

The filler label is disjoint from every paired label. Given the specified input n, the specified input d, the specified input hd, the specified input side, the stated mathematical conclusion holds. Given the specified input j.

Formal statement
n d :
ℕ
hd :
1 ≤ d
j :
side :
fillerLabel d hd ≠ pairLabel n d hd j side
Proof (Lean source)
lemma fillerLabel_ne_pairLabel (n d : ℕ) (hd : 1 ≤ d) (j : Fin (pairCount n d)) (side : Bool) : fillerLabel d hd ≠ pairLabel n d hd j side := by intro h have hv := congrArg val h cases side <;> simp [fillerLabel, pairLabel] at hv
CausalSmith.Stat.MarNearcompleteFrontier.fillerLabel_ne_pairLabel · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/PairedPrior/Atoms.lean:249
def bernoulliFactor

Bernoulli factor, totalized by the real arithmetic of the displayed model.

Definition (Lean source)
p :
ℝ
b :
bernoulliFactor p b :
ℝ
if b then p else 1 - p

Given the specified input p, the stated mathematical conclusion holds.

Formal statement
p :
ℝ
∑ b : Bool, bernoulliFactor p b = 1
Proof (Lean source)
lemma bernoulliFactor_sum (p : ℝ) : ∑ b : Bool, bernoulliFactor p b = 1 := by simp [bernoulliFactor]
CausalSmith.Stat.MarNearcompleteFrontier.bernoulliFactor_sum · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/PairedPrior/Atoms.lean:261

Given the specified input p, the specified input hp, the specified input b, the stated mathematical conclusion holds.

Formal statement
p :
ℝ
hp :
p ∈ Icc 0 1
b :
0 ≤ bernoulliFactor p b
Proof (Lean source)
lemma bernoulliFactor_nonneg (p : ℝ) (hp : p ∈ Icc 0 1) (b : Bool) : 0 ≤ bernoulliFactor p b := by rcases hp with ⟨h0, h1⟩ cases b <;> simp [bernoulliFactor] <;> linarith
CausalSmith.Stat.MarNearcompleteFrontier.bernoulliFactor_nonneg · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/PairedPrior/Atoms.lean:267

Given the specified input q, the specified input z, the specified input u, the stated mathematical conclusion holds. Given the specified input σ. Given the specified input hq, the specified input ht.

Formal statement
q σ z u :
ℝ
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
ht :
σ * z * u ∈ Icc (-1) 1
pairRho q σ z u ∈ Icc q 1
Proof (Lean source)
lemma pairRho_mem_unit (q σ z u : ℝ) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (ht : σ * z * u ∈ Icc (-1) 1) : pairRho q σ z u ∈ Icc q 1 := by rcases hq with ⟨hq0, hq1⟩ rcases ht with ⟨ht0, ht1⟩ unfold pairRho delta constructor <;> nlinarith
CausalSmith.Stat.MarNearcompleteFrontier.pairRho_mem_unit · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/PairedPrior/Atoms.lean:274

Given the specified input q, the specified input z, the specified input u, the stated mathematical conclusion holds. Given the specified input σ. Given the specified input hq, the specified input hu, the specified input ht.

Formal statement
q σ z u :
ℝ
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
hu :
u ∈ Icc (-1) 1
ht :
σ * z * u ∈ Icc (-1) 1
pairMu q σ z u ∈ Icc 0 1
Proof (Lean source)
lemma pairMu_mem_unit (q σ z u : ℝ) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (hu : u ∈ Icc (-1) 1) (ht : σ * z * u ∈ Icc (-1) 1) : pairMu q σ z u ∈ Icc 0 1 := by have hρ := pairRho_mem_unit q σ z u hq ht have hqpos : 0 < q := lt_of_lt_of_le (by norm_num) hq.1 have hρpos : 0 < pairRho q σ z u := lt_of_lt_of_le hqpos hρ.1 unfold pairMu constructor · apply div_nonneg · rcases hq with ⟨hq0, hq1⟩ rcases hu with ⟨hu0, hu1⟩ unfold delta linarith · exact le_of_lt hρpos · apply (div_le_iff₀ hρpos).mpr rcases hq with ⟨hq0, hq1⟩ rcases hu with ⟨hu0, hu1⟩ unfold delta linarith [hρ.1]

Given the specified input n, the specified input z, the stated mathematical conclusion holds.

Formal statement
n :
ℕ
z :
|latentZ n z| = 1
Proof (Lean source)
lemma latentZ_abs_one (n : ℕ) (z : Latent n) : |latentZ n z| = 1 := by cases z with | inl i => simp only [latentZ]; split_ifs <;> norm_num | inr _ => simp [latentZ]

Given the specified input side, the stated mathematical conclusion holds. Given the specified input θ. Given the specified input j.

Formal statement
n :
ℕ
shared
d :
ℕ
shared
θ :
Theta n d
j :
side :
|orientation θ j side| = 1
Proof (Lean source)
lemma orientation_abs_one (θ : Theta n d) (j : Fin (pairCount n d)) (side : Bool) : |orientation θ j side| = 1 := by simp only [orientation] split_ifs <;> norm_num
CausalSmith.Stat.MarNearcompleteFrontier.orientation_abs_one · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/PairedPrior/Atoms.lean:312

Given the specified input n, the specified input d, the specified input side, the stated mathematical conclusion holds. Given the specified input σ, the specified input θ. Given the specified input hσ, the specified input j.

Formal statement
n d :
ℕ
σ :
ℝ
hσ :
σ ∈ Icc (-1) 1
θ :
Theta n d
j :
side :
σ * latentZ n (θ.1 j) * orientation θ j side ∈ Icc (-1) 1
Proof (Lean source)
lemma pair_sign_mem_unit (n d : ℕ) (σ : ℝ) (hσ : σ ∈ Icc (-1) 1) (θ : Theta n d) (j : Fin (pairCount n d)) (side : Bool) : σ * latentZ n (θ.1 j) * orientation θ j side ∈ Icc (-1) 1 := by have hz := latentZ_abs_one n (θ.1 j) have hu := orientation_abs_one θ j side have habsσ : |σ| ≤ 1 := abs_le.mpr hσ have habs : |σ * latentZ n (θ.1 j) * orientation θ j side| ≤ 1 := by rw [abs_mul, abs_mul, hz, hu] simpa using habsσ exact abs_le.mp habs
CausalSmith.Stat.MarNearcompleteFrontier.pair_sign_mem_unit · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/PairedPrior/Atoms.lean:319
def pairAtomWeight

Full atom mass at an oriented pair label, before normalization.

Definition (Lean source)
n d :
ℕ
q σ :
ℝ
hd :
1 ≤ d
θ :
Theta n d
j :
side :
w :
pairAtomWeight n d q σ hd θ j side w :
ℝ
if w.X = pairLabel n d hd j side ∧
w.S0 = false ∧
w.S1 = false ∧
w.S = false ∧
w.Y0 = false ∧
w.Y
= (if w.A then w.Y1 else w.Y0) then let p := latentP n (θ.1 j) let z := latentZ n (θ.1 j) let u := orientation θ j side let ρ := pairRho q σ z u let μ := pairMu q σ z u p / normalizationJ n d θ / 2 * bernoulliFactor μ w.Y1 * (if w.A then bernoulliFactor ρ w.R else if w.R then 1 else 0) else 0
theorem pairAtomWeight_other_pair_zero

A paired component puts no mass on another pair's baseline label. Given the specified input n, the specified input d, the specified input q, the specified input hd, the specified input side, the specified input side', the specified input w, the specified input hw, the specified input hne, the stated mathematical conclusion holds. Given the specified input σ, the specified input θ. Given the specified input j, the specified input k.

Formal statement
n d :
ℕ
q σ :
ℝ
hd :
1 ≤ d
θ :
Theta n d
j k :
side side' :
w :
hw :
w.X = pairLabel n d hd k side'
hne :
j ≠ k ∨ side ≠ side'
pairAtomWeight n d q σ hd θ j side w = 0
Proof (Lean source)
lemma pairAtomWeight_other_pair_zero (n d : ℕ) (q σ : ℝ) (hd : 1 ≤ d) (θ : Theta n d) (j k : Fin (pairCount n d)) (side side' : Bool) (w : FullAtom d) (hw : w.X = pairLabel n d hd k side') (hne : j ≠ k ∨ side ≠ side') : pairAtomWeight n d q σ hd θ j side w = 0 := by have hx : w.X ≠ pairLabel n d hd j side := by intro heq obtain ⟨hjk, hside⟩ := pairLabel_injective n d hd k j side' side (hw.symm.trans heq) exact hne.elim (fun h => h hjk.symm) (fun h => h hside.symm) simp [pairAtomWeight, hx]
CausalSmith.Stat.MarNearcompleteFrontier.pairAtomWeight_other_pair_zero · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/PairedPrior/Atoms.lean:348

Given the specified input n, the specified input z, the stated mathematical conclusion holds.

Formal statement
n :
ℕ
z :
0 ≤ latentP n z
Proof (Lean source)
lemma latentP_nonneg (n : ℕ) (z : Latent n) : 0 ≤ latentP n z := by cases z with | inl i => simp only [latentP] exact mul_nonneg (by unfold priorB; positivity) (le_trans (by unfold priorH; positivity) (latentWeight_node_lower n i)) | inr _ => simp [latentP]
theorem pairAtomWeight_nonneg

Given the specified input n, the specified input d, the specified input q, the specified input hd, the specified input hJ, the specified input side, the specified input w, the stated mathematical conclusion holds. Given the specified input σ, the specified input θ. Given the specified input hq, the specified input hσ, the specified input j.

Formal statement
n d :
ℕ
q σ :
ℝ
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
hσ :
σ ∈ Icc (-1) 1
θ :
Theta n d
hJ :
0 < normalizationJ n d θ
j :
side :
w :
0 ≤ pairAtomWeight n d q σ hd θ j side w
Proof (Lean source)
lemma pairAtomWeight_nonneg (n d : ℕ) (q σ : ℝ) (hd : 1 ≤ d) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (hσ : σ ∈ Icc (-1) 1) (θ : Theta n d) (hJ : 0 < normalizationJ n d θ) (j : Fin (pairCount n d)) (side : Bool) (w : FullAtom d) : 0 ≤ pairAtomWeight n d q σ hd θ j side w := by by_cases h : w.X = pairLabel n d hd j side ∧ w.S0 = false ∧ w.S1 = false ∧ w.S = false ∧ w.Y0 = false ∧ w.Y = (if w.A then w.Y1 else w.Y0) · simp only [pairAtomWeight, if_pos h] have hu : orientation θ j side ∈ Icc (-1) 1 := abs_le.mp (by rw [orientation_abs_one]) have ht := pair_sign_mem_unit n d σ hσ θ j side have hμ := pairMu_mem_unit q σ (latentZ n (θ.1 j)) (orientation θ j side) hq hu ht have hρ := pairRho_mem_unit q σ (latentZ n (θ.1 j)) (orientation θ j side) hq ht have hq0 : 0 ≤ q := le_trans (by norm_num) hq.1 have hlast : 0 ≤ (if w.A then bernoulliFactor (pairRho q σ (latentZ n (θ.1 j)) (orientation θ j side)) w.R else if w.R then (1 : ℝ) else 0) := by split_ifs <;> try positivity exact bernoulliFactor_nonneg _ ⟨hq0.trans hρ.1, hρ.2⟩ _ exact mul_nonneg (mul_nonneg (div_nonneg (div_nonneg (latentP_nonneg n (θ.1 j)) (le_of_lt hJ)) (by norm_num)) (bernoulliFactor_nonneg _ hμ _)) hlast · simp only [pairAtomWeight, if_neg h] norm_num
CausalSmith.Stat.MarNearcompleteFrontier.pairAtomWeight_nonneg · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/PairedPrior/Atoms.lean:371
def fillerAtomWeight

Full atom mass at the fixed filler label, before normalization.

Definition (Lean source)
n d :
ℕ
q :
ℝ
hd :
1 ≤ d
θ :
Theta n d
w :
fillerAtomWeight n d q hd θ w :
ℝ
if w.X = fillerLabel d hd ∧
w.S0 = false ∧
w.S1 = false ∧
w.S = false ∧
w.Y0 = false ∧
w.Y = (if w.A then w.Y1 else w.Y0) ∧
w.R
= true then fillerMass n d / normalizationJ n d θ / 2 * bernoulliFactor (baseMean q) w.Y1 else 0
CausalSmith.Stat.MarNearcompleteFrontier.fillerAtomWeight · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/PairedPrior/Atoms.lean:401
theorem fillerAtomWeight_pair_zero

The filler component puts no mass on a paired baseline label. Given the specified input n, the specified input d, the specified input q, the specified input hd, the specified input side, the specified input w, the specified input hw, the stated mathematical conclusion holds. Given the specified input θ. Given the specified input j.

Formal statement
n d :
ℕ
q :
ℝ
hd :
1 ≤ d
θ :
Theta n d
j :
side :
w :
hw :
w.X = pairLabel n d hd j side
fillerAtomWeight n d q hd θ w = 0
Proof (Lean source)
lemma fillerAtomWeight_pair_zero (n d : ℕ) (q : ℝ) (hd : 1 ≤ d) (θ : Theta n d) (j : Fin (pairCount n d)) (side : Bool) (w : FullAtom d) (hw : w.X = pairLabel n d hd j side) : fillerAtomWeight n d q hd θ w = 0 := by have hx : w.X ≠ fillerLabel d hd := by rw [hw] exact (fillerLabel_ne_pairLabel n d hd j side).symm simp [fillerAtomWeight, hx]
CausalSmith.Stat.MarNearcompleteFrontier.fillerAtomWeight_pair_zero · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/PairedPrior/Atoms.lean:412
theorem pairAtomWeight_filler_zero

Every paired component puts no mass on the filler baseline label. Given the specified input n, the specified input d, the specified input q, the specified input hd, the specified input side, the specified input w, the specified input hw, the stated mathematical conclusion holds. Given the specified input σ, the specified input θ. Given the specified input j.

Formal statement
n d :
ℕ
q σ :
ℝ
hd :
1 ≤ d
θ :
Theta n d
j :
side :
w :
hw :
w.X = fillerLabel d hd
pairAtomWeight n d q σ hd θ j side w = 0
Proof (Lean source)
lemma pairAtomWeight_filler_zero (n d : ℕ) (q σ : ℝ) (hd : 1 ≤ d) (θ : Theta n d) (j : Fin (pairCount n d)) (side : Bool) (w : FullAtom d) (hw : w.X = fillerLabel d hd) : pairAtomWeight n d q σ hd θ j side w = 0 := by have hx : w.X ≠ pairLabel n d hd j side := by rw [hw] exact fillerLabel_ne_pairLabel n d hd j side simp [pairAtomWeight, hx]
CausalSmith.Stat.MarNearcompleteFrontier.pairAtomWeight_filler_zero · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/PairedPrior/Atoms.lean:423
def pairedAtomWeight

Exact mass of a normalized causal full-data atom.

Definition (Lean source)
n d :
ℕ
q σ :
ℝ
hd :
1 ≤ d
θ :
Theta n d
w :
pairedAtomWeight n d q σ hd θ w :
ℝ
fillerAtomWeight n d q hd θ w
+ ∑ j : Fin (pairCount n d), ∑ side : Bool, pairAtomWeight n d q σ hd θ j side w
CausalSmith.Stat.MarNearcompleteFrontier.pairedAtomWeight · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/PairedPrior/Atoms.lean:433
CausalSmith.Stat.STAT_MarNearcompleteFrontier_Research.Helpers.PairedPrior.Normalization 16 declarations Exact normalization and positivity of constructed full laws

Exact normalization and positivity of constructed full laws

theorem ell_pos_for_normalization Lemma ell_pos_for_normalization in the paper ↗

Given the specified input n, the stated mathematical conclusion holds.

Formal statement
n :
ℕ
0 < ell n
Proof (Lean source)
lemma ell_pos_for_normalization (n : ℕ) : 0 < ell n := by unfold ell have h : (1 : ℝ) < exp 1 + n := by have he : (1 : ℝ) < exp 1 := Real.one_lt_exp_iff.mpr (by norm_num) have hn : (0 : ℝ) ≤ n := Nat.cast_nonneg _ linarith exact Real.log_pos h
CausalSmith.Stat.MarNearcompleteFrontier.ell_pos_for_normalization · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/PairedPrior/Normalization.lean:13
theorem priorK_lower_for_normalization Lemma priorK_lower_for_normalization in the paper ↗

Given the specified input n, the stated mathematical conclusion holds.

Formal statement
n :
ℕ
8 * ell n ≤ (priorK n : ℝ)
Proof (Lean source)
lemma priorK_lower_for_normalization (n : ℕ) : 8 * ell n ≤ (priorK n : ℝ) := by unfold priorK exact Nat.le_ceil _
CausalSmith.Stat.MarNearcompleteFrontier.priorK_lower_for_normalization · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/PairedPrior/Normalization.lean:23
theorem priorH_le_one_for_normalization Lemma priorH_le_one_for_normalization in the paper ↗

Given the specified input n, the stated mathematical conclusion holds.

Formal statement
n :
ℕ
priorH n ≤ 1
Proof (Lean source)
lemma priorH_le_one_for_normalization (n : ℕ) : priorH n ≤ 1 := by have h : (1 : ℝ) ≤ priorK n := by have he := ell_pos_for_normalization n have hk := priorK_lower_for_normalization n have hkpos : (0 : ℝ) < priorK n := by linarith have hkposNat : 0 < priorK n := by exact_mod_cast hkpos exact_mod_cast (show 1 ≤ priorK n by omega) unfold priorH have hk : (1 : ℝ) ≤ priorK n := by exact_mod_cast h have hi : (priorK n : ℝ)⁻¹ ≤ 1 := inv_le_one_of_one_le₀ hk have hnonneg : (0 : ℝ) ≤ (priorK n : ℝ)⁻¹ := by positivity nlinarith
CausalSmith.Stat.MarNearcompleteFrontier.priorH_le_one_for_normalization · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/PairedPrior/Normalization.lean:30
theorem interpolationNode_nonneg_for_normalization Lemma interpolationNode_nonneg_for_normalization in the paper ↗

Given the specified input n, the stated mathematical conclusion holds. Given the specified input i.

Formal statement
n :
ℕ
i :
Proof (Lean source)
lemma interpolationNode_nonneg_for_normalization (n : ℕ) (i : Fin (priorK n)) : 0 ≤ interpolationNode n i := by have hh : 0 ≤ priorH n := by unfold priorH; positivity have hh1 := priorH_le_one_for_normalization n have hc := Real.neg_one_le_cos ((i : ℝ) * pi / ((priorK n - 1 : ℕ) : ℝ)) unfold interpolationNode nlinarith
CausalSmith.Stat.MarNearcompleteFrontier.interpolationNode_nonneg_for_normalization · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/PairedPrior/Normalization.lean:45
theorem normalizationJ_pos

For positive sample size, positive covariate dimension, and an arrival floor in the admissible range, the normalization constant is strictly positive.

Formal statement
n d :
ℕ
q :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
θ :
Theta n d
0 < normalizationJ n d θ
Proof (Lean source)
lemma normalizationJ_pos (n d : ℕ) (q : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (θ : Theta n d) : 0 < normalizationJ n d θ := by have hnpos : (0 : ℝ) < n := by exact_mod_cast hn have hL := ell_pos_for_normalization n have hK := priorK_lower_for_normalization n have hKpos : (0 : ℝ) < priorK n := by linarith have hM : (pairCount n d : ℝ) ≤ (n : ℝ) * ell n := by have hm : pairCount n d ≤ floor ((n : ℝ) * ell n) := by unfold pairCount exact min_le_right _ _ have hf : ((floor ((n : ℝ) * ell n) : ℕ) : ℝ) ≤ (n : ℝ) * ell n := Nat.floor_le (le_of_lt (mul_pos hnpos hL)) exact (Nat.cast_le.mpr hm).trans hf have hMnonneg : (0 : ℝ) ≤ pairCount n d := Nat.cast_nonneg _ have hbound : 8 * (pairCount n d : ℝ) ≤ (n : ℝ) * priorK n := by nlinarith [mul_nonneg (le_of_lt hnpos) (sub_nonneg.mpr hK)] have hsmall : (pairCount n d : ℝ) / (512 * n * priorK n) < 1 := by apply (div_lt_iff₀ (by positivity)).mpr nlinarith have hrewrite : 2 * (pairCount n d : ℝ) * priorH n * priorB n = (pairCount n d : ℝ) / (512 * n * priorK n) := by unfold priorH priorB field_simp <;> ring have hfiller : 0 < fillerMass n d := by unfold fillerMass rw [hrewrite] linarith have hsum : 0 ≤ ∑ j : Fin (pairCount n d), latentP n (θ.1 j) := by apply Finset.sum_nonneg intro j hj unfold latentP split · exact mul_nonneg (by unfold priorB; positivity) (interpolationNode_nonneg_for_normalization n _) · positivity unfold normalizationJ nlinarith
theorem baseMean_mem_unit

For an arrival floor in the admissible range, the associated baseline mean lies between zero and one.

Formal statement
q :
ℝ
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
baseMean q ∈ Icc 0 1
Proof (Lean source)
lemma baseMean_mem_unit (q : ℝ) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) : baseMean q ∈ Icc 0 1 := by rcases hq with ⟨hq0, hq1⟩ have hqpos : 0 < q := by linarith unfold baseMean delta constructor · positivity · apply (div_le_iff₀ (by positivity : 0 < 2 * q)).mpr nlinarith [sq_nonneg (q - 1)]
theorem fillerAtomWeight_nonneg

Given the specified input n, the specified input d, the specified input q, the specified input hn, the specified input hd, the specified input w, the stated mathematical conclusion holds. Given the specified input θ. Given the specified input hq.

Formal statement
n d :
ℕ
q :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
θ :
Theta n d
w :
0 ≤ fillerAtomWeight n d q hd θ w
Proof (Lean source)
lemma fillerAtomWeight_nonneg (n d : ℕ) (q : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (θ : Theta n d) (w : FullAtom d) : 0 ≤ fillerAtomWeight n d q hd θ w := by have hJ := normalizationJ_pos n d q hn hd hq θ have hf : 0 ≤ fillerMass n d := by have hnpos : (0 : ℝ) < n := by exact_mod_cast hn have hL := ell_pos_for_normalization n have hK := priorK_lower_for_normalization n have hKpos : (0 : ℝ) < priorK n := by linarith have hM : (pairCount n d : ℝ) ≤ (n : ℝ) * ell n := by have hm : pairCount n d ≤ floor ((n : ℝ) * ell n) := by unfold pairCount exact min_le_right _ _ have hf : ((floor ((n : ℝ) * ell n) : ℕ) : ℝ) ≤ (n : ℝ) * ell n := Nat.floor_le (le_of_lt (mul_pos hnpos hL)) exact (Nat.cast_le.mpr hm).trans hf have hbound : 8 * (pairCount n d : ℝ) ≤ (n : ℝ) * priorK n := by nlinarith [mul_nonneg (le_of_lt hnpos) (sub_nonneg.mpr hK)] have hrewrite : 2 * (pairCount n d : ℝ) * priorH n * priorB n = (pairCount n d : ℝ) / (512 * n * priorK n) := by unfold priorH priorB field_simp <;> ring unfold fillerMass rw [hrewrite] apply sub_nonneg.mpr apply (div_le_iff₀ (by positivity)).mpr nlinarith by_cases h : w.X = fillerLabel d hd ∧ w.S0 = false ∧ w.S1 = false ∧ w.S = false ∧ w.Y0 = false ∧ w.Y = (if w.A then w.Y1 else w.Y0) ∧ w.R = true · simp only [fillerAtomWeight, if_pos h] exact mul_nonneg (div_nonneg (div_nonneg hf (le_of_lt hJ)) (by norm_num)) (bernoulliFactor_nonneg _ (baseMean_mem_unit q hq) _) · simp only [fillerAtomWeight, if_neg h] norm_num
CausalSmith.Stat.MarNearcompleteFrontier.fillerAtomWeight_nonneg · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/PairedPrior/Normalization.lean:109
theorem pairedAtomWeight_nonneg

Given the specified input n, the specified input d, the specified input q, the specified input hn, the specified input hd, the specified input w, the stated mathematical conclusion holds. Given the specified input σ, the specified input θ. Given the specified input hq, the specified input hσ.

Formal statement
n d :
ℕ
q σ :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
hσ :
σ ∈ Icc (-1) 1
θ :
Theta n d
w :
0 ≤ pairedAtomWeight n d q σ hd θ w
Proof (Lean source)
lemma pairedAtomWeight_nonneg (n d : ℕ) (q σ : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (hσ : σ ∈ Icc (-1) 1) (θ : Theta n d) (w : FullAtom d) : 0 ≤ pairedAtomWeight n d q σ hd θ w := by unfold pairedAtomWeight apply add_nonneg (fillerAtomWeight_nonneg n d q hn hd hq θ w) apply Finset.sum_nonneg intro j _ apply Finset.sum_nonneg intro side _ exact pairAtomWeight_nonneg n d q σ hd hq hσ θ (normalizationJ_pos n d q hn hd hq θ) j side w
CausalSmith.Stat.MarNearcompleteFrontier.pairedAtomWeight_nonneg · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/PairedPrior/Normalization.lean:151

Given the specified input d, the stated mathematical conclusion holds.

Definition (Lean source)
d :
ℕ
fullAtomTuple d :
Type
Fin d × Bool × Bool × Bool × Bool × Bool × Bool × Bool × Bool
def fullAtomTupleEquiv

Given the specified input d, the stated mathematical conclusion holds.

Definition (Lean source)
d :
ℕ
fullAtomTupleEquiv d :
clause 1
toFun w := (w.X, w.S0, w.S1, w.Y0, w.Y1, w.A, w.S, w.Y, w.R)
clause 2
invFun t := ⟨⟨t.1, t.2.1, t.2.2.1, t.2.2.2.1, t.2.2.2.2.1⟩, t.2.2.2.2.2.1, t.2.2.2.2.2.2.1, t.2.2.2.2.2.2.2.1, t.2.2.2.2.2.2.2.2⟩
clause 3
left_inv := by intro w; rcases w with ⟨⟨x,s0,s1,y0,y1⟩,a,s,y,r⟩; rfl
clause 4
right_inv := by intro t rcases t with ⟨x,s0,s1,y0,y1,a,s,y,r⟩ rfl
theorem sum_fillerAtomWeight

Given the specified input n, the specified input d, the specified input q, the specified input hd, the stated mathematical conclusion holds. Given the specified input θ.

Formal statement
n d :
ℕ
q :
ℝ
hd :
1 ≤ d
θ :
Theta n d
(∑ w : FullAtom d, fillerAtomWeight n d q hd θ w) = fillerMass n d / normalizationJ n d θ
Proof (Lean source)
lemma sum_fillerAtomWeight (n d : ℕ) (q : ℝ) (hd : 1 ≤ d) (θ : Theta n d) : (∑ w : FullAtom d, fillerAtomWeight n d q hd θ w) = fillerMass n d / normalizationJ n d θ := by rw [Fintype.sum_equiv (fullAtomTupleEquiv d) (fillerAtomWeight n d q hd θ) (fun t => fillerAtomWeight n d q hd θ ((fullAtomTupleEquiv d).symm t)) (by intro w; simp)] simp only [Fintype.sum_prod_type] simp [fullAtomTupleEquiv, fillerAtomWeight, bernoulliFactor, fillerLabel, FullAtom.X] calc _ = ∑ x : Fin d, if x = ⟨0, hd⟩ then fillerMass n d * (normalizationJ n d θ)⁻¹ else 0 := by apply Finset.sum_congr rfl intro x _ by_cases hx : x = ⟨0, hd⟩ <;> simp [hx] <;> ring _ = _ := by simp [div_eq_mul_inv]
theorem sum_pairAtomWeight

Given the specified input n, the specified input d, the specified input q, the specified input hd, the specified input side, the stated mathematical conclusion holds. Given the specified input σ, the specified input θ. Given the specified input j.

Formal statement
n d :
ℕ
q σ :
ℝ
hd :
1 ≤ d
θ :
Theta n d
j :
side :
(∑ w : FullAtom d, pairAtomWeight n d q σ hd θ j side w)
= latentP n (θ.1 j) / normalizationJ n d θ
Proof (Lean source)
lemma sum_pairAtomWeight (n d : ℕ) (q σ : ℝ) (hd : 1 ≤ d) (θ : Theta n d) (j : Fin (pairCount n d)) (side : Bool) : (∑ w : FullAtom d, pairAtomWeight n d q σ hd θ j side w) = latentP n (θ.1 j) / normalizationJ n d θ := by rw [Fintype.sum_equiv (fullAtomTupleEquiv d) (pairAtomWeight n d q σ hd θ j side) (fun t => pairAtomWeight n d q σ hd θ j side ((fullAtomTupleEquiv d).symm t)) (by intro w; simp)] simp only [Fintype.sum_prod_type] simp [fullAtomTupleEquiv, pairAtomWeight, bernoulliFactor, FullAtom.X, FullAtom.S0, FullAtom.S1, FullAtom.Y0, FullAtom.Y1] calc _ = ∑ x : Fin d, if x = pairLabel n d hd j side then latentP n (θ.1 j) / normalizationJ n d θ else 0 := by apply Finset.sum_congr rfl intro x _ by_cases hx : x = pairLabel n d hd j side <;> simp [hx] <;> ring _ = _ := by simp
theorem sum_fillerAtomWeight_arm

Each treatment arm receives half the normalized filler mass. Given the specified input n, the specified input d, the specified input q, the specified input hd, the specified input a, the stated mathematical conclusion holds. Given the specified input θ.

Formal statement
n d :
ℕ
q :
ℝ
hd :
1 ≤ d
θ :
Theta n d
a :
(∑ w : FullAtom d, if w.A = a then fillerAtomWeight n d q hd θ w else 0)
= fillerMass n d / normalizationJ n d θ / 2
Proof (Lean source)
lemma sum_fillerAtomWeight_arm (n d : ℕ) (q : ℝ) (hd : 1 ≤ d) (θ : Theta n d) (a : Bool) : (∑ w : FullAtom d, if w.A = a then fillerAtomWeight n d q hd θ w else 0) = fillerMass n d / normalizationJ n d θ / 2 := by rw [Fintype.sum_equiv (fullAtomTupleEquiv d) (fun w => if w.A = a then fillerAtomWeight n d q hd θ w else 0) (fun t => if ((fullAtomTupleEquiv d).symm t).A = a then fillerAtomWeight n d q hd θ ((fullAtomTupleEquiv d).symm t) else 0) (by intro w; simp)] simp only [Fintype.sum_prod_type] simp [fullAtomTupleEquiv, fillerAtomWeight, bernoulliFactor, fillerLabel, FullAtom.X] cases a <;> simp [Finset.sum_add_distrib] <;> ring
CausalSmith.Stat.MarNearcompleteFrontier.sum_fillerAtomWeight_arm · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/PairedPrior/Normalization.lean:226
theorem sum_pairAtomWeight_arm

Each treatment arm receives half the normalized mass of an oriented pair label. Given the specified input n, the specified input d, the specified input q, the specified input hd, the specified input side, the specified input a, the stated mathematical conclusion holds. Given the specified input σ, the specified input θ. Given the specified input j.

Formal statement
n d :
ℕ
q σ :
ℝ
hd :
1 ≤ d
θ :
Theta n d
j :
side a :
(∑ w : FullAtom d, if w.A = a then pairAtomWeight n d q σ hd θ j side w else 0)
= latentP n (θ.1 j) / normalizationJ n d θ / 2
Proof (Lean source)
lemma sum_pairAtomWeight_arm (n d : ℕ) (q σ : ℝ) (hd : 1 ≤ d) (θ : Theta n d) (j : Fin (pairCount n d)) (side a : Bool) : (∑ w : FullAtom d, if w.A = a then pairAtomWeight n d q σ hd θ j side w else 0) = latentP n (θ.1 j) / normalizationJ n d θ / 2 := by rw [Fintype.sum_equiv (fullAtomTupleEquiv d) (fun w => if w.A = a then pairAtomWeight n d q σ hd θ j side w else 0) (fun t => if ((fullAtomTupleEquiv d).symm t).A = a then pairAtomWeight n d q σ hd θ j side ((fullAtomTupleEquiv d).symm t) else 0) (by intro w; simp)] simp only [Fintype.sum_prod_type] simp [fullAtomTupleEquiv, pairAtomWeight, bernoulliFactor, FullAtom.X, FullAtom.S0, FullAtom.S1, FullAtom.Y0, FullAtom.Y1] cases a <;> simp [Finset.sum_add_distrib] <;> ring
CausalSmith.Stat.MarNearcompleteFrontier.sum_pairAtomWeight_arm · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/PairedPrior/Normalization.lean:242
theorem sum_pairedAtomWeight_real

Given the specified input n, the specified input d, the specified input q, the specified input hn, the specified input hd, the stated mathematical conclusion holds. Given the specified input σ, the specified input θ. Given the specified input hq.

Formal statement
n d :
ℕ
q σ :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
θ :
Theta n d
(∑ w : FullAtom d, pairedAtomWeight n d q σ hd θ w) = 1
Proof (Lean source)
lemma sum_pairedAtomWeight_real (n d : ℕ) (q σ : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (θ : Theta n d) : (∑ w : FullAtom d, pairedAtomWeight n d q σ hd θ w) = 1 := by have hJ : normalizationJ n d θ ≠ 0 := ne_of_gt (normalizationJ_pos n d q hn hd hq θ) calc _ = (∑ w : FullAtom d, fillerAtomWeight n d q hd θ w) + ∑ j : Fin (pairCount n d), ∑ side : Bool, ∑ w : FullAtom d, pairAtomWeight n d q σ hd θ j side w := by simp only [pairedAtomWeight, Finset.sum_add_distrib] rw [Finset.sum_comm] apply congrArg₂ (· + ·) rfl apply Finset.sum_congr rfl intro j _ rw [Finset.sum_comm] _ = fillerMass n d / normalizationJ n d θ + ∑ j : Fin (pairCount n d), ∑ side : Bool, latentP n (θ.1 j) / normalizationJ n d θ := by rw [sum_fillerAtomWeight] simp_rw [sum_pairAtomWeight] _ = 1 := by simp_rw [Fintype.sum_bool] simp_rw [← add_div] rw [← Finset.sum_div, ← add_div] have hsum : (∑ j : Fin (pairCount n d), (latentP n (θ.1 j) + latentP n (θ.1 j))) = 2 * ∑ j : Fin (pairCount n d), latentP n (θ.1 j) := by rw [Finset.sum_add_distrib] ring rw [hsum] change normalizationJ n d θ / normalizationJ n d θ = 1 exact div_self hJ
CausalSmith.Stat.MarNearcompleteFrontier.sum_pairedAtomWeight_real · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/PairedPrior/Normalization.lean:259
theorem pairedAtomWeight_sum

Given the specified input n, the specified input d, the specified input q, the specified input hn, the specified input hd, the stated mathematical conclusion holds. Given the specified input σ, the specified input θ. Given the specified input hq, the specified input hσ.

Formal statement
n d :
ℕ
q σ :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
hσ :
σ ∈ Icc (-1) 1
θ :
Theta n d
(∑ w : FullAtom d, ofReal (pairedAtomWeight n d q σ hd θ w)) = 1
Proof (Lean source)
lemma pairedAtomWeight_sum (n d : ℕ) (q σ : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (hσ : σ ∈ Icc (-1) 1) (θ : Theta n d) : (∑ w : FullAtom d, ofReal (pairedAtomWeight n d q σ hd θ w)) = 1 := by rw [← ENNReal.ofReal_sum_of_nonneg (fun w _ => pairedAtomWeight_nonneg n d q σ hn hd hq hσ θ w)] rw [sum_pairedAtomWeight_real n d q σ hn hd hq θ] norm_num
CausalSmith.Stat.STAT_MarNearcompleteFrontier_Research.Helpers.UpperRisk.BiasVariance 4 declarations Risk integrability for the finite observed-sample experiment

Risk integrability for the finite observed-sample experiment

theorem clipUnit_sq_error_le

When the target lies in the feasible treatment-effect interval, clipping an estimate to that interval cannot increase its squared error.

Formal statement
z t :
ℝ
ht :
t ∈ Icc (-1) 1
(clipUnit z - t) ^ 2 ≤ (z - t) ^ 2
Proof (Lean source)
lemma clipUnit_sq_error_le (z t : ℝ) (ht : t ∈ Icc (-1) 1) : (clipUnit z - t) ^ 2 ≤ (z - t) ^ 2 := by rcases ht with ⟨htlo, hthi⟩ by_cases hzlo : z < -1 · rw [clipUnit, min_eq_right (by linarith), max_eq_left (le_of_lt hzlo)] nlinarith by_cases hzhi : 1 < z · rw [clipUnit, min_eq_left (le_of_lt hzhi), max_eq_right (by norm_num)] nlinarith rw [clipUnit, min_eq_right (by linarith), max_eq_right (by linarith)]
CausalSmith.Stat.MarNearcompleteFrontier.clipUnit_sq_error_le · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/BiasVariance.lean:11
theorem missingWeight_sq_div_one_add_le Lemma missingWeight_sq_div_one_add_le in the paper ↗

The cellwise quadratic missing-mass term in equation (16) is absorbed by its linear missing mass whenever the arrival-floor comparison w ≤ 2 * δ * t holds. Given the specified input w, the specified input t, the specified input m, the specified input hm, the specified input hw, the specified input ht, the specified input hwt, the stated mathematical conclusion holds. Given the specified input δ, the specified input hδ.

Formal statement
w t δ m :
ℝ
hm :
0 < m
hw :
0 ≤ w
ht :
0 ≤ t
hδ :
0 ≤ δ
hwt :
w ≤ 2 * δ * t
w ^ 2 / (1 + m * t) ≤ (2 * δ / m) * w
Proof (Lean source)
lemma missingWeight_sq_div_one_add_le {w t δ m : ℝ} (hm : 0 < m) (hw : 0 ≤ w) (ht : 0 ≤ t) (hδ : 0 ≤ δ) (hwt : w ≤ 2 * δ * t) : w ^ 2 / (1 + m * t) ≤ (2 * δ / m) * w := by have hden : 0 < 1 + m * t := by positivity rw [show (2 * δ / m) * w = (2 * δ * w) / m by ring] rw [div_le_div_iff₀ hden hm] have hmul := mul_le_mul_of_nonneg_left hwt (mul_nonneg hw hm.le) have hlin : 0 ≤ 2 * δ * w := by positivity nlinarith
CausalSmith.Stat.MarNearcompleteFrontier.missingWeight_sq_div_one_add_le · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/BiasVariance.lean:24
theorem missingCellMass_variance_sum_le

For a law in the model class, an admissible arrival floor, and a positive scale, the cellwise quadratic missing-mass terms are bounded by total missing mass and the arrival floor.

Formal statement
d :
ℕ
q :
ℝ
P :
h :
LawClass d q P
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
m :
ℝ
hm :
0 < m
(∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, (missingCellMass P x a s) ^ 2 / (1 + m * arrivedCellMass P x a s))
≤ 2 * (delta q) ^ 2 / m
Proof (Lean source)
lemma missingCellMass_variance_sum_le {d : ℕ} {q : ℝ} (P : FullLaw d) (h : LawClass d q P) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (m : ℝ) (hm : 0 < m) : (∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, (missingCellMass P x a s) ^ 2 / (1 + m * arrivedCellMass P x a s)) ≤ 2 * (delta q) ^ 2 / m := by classical have hδ : 0 ≤ delta q := by unfold delta linarith [hq.2] have hfactor : 0 ≤ 2 * delta q / m := div_nonneg (by positivity) hm.le calc (∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, (missingCellMass P x a s) ^ 2 / (1 + m * arrivedCellMass P x a s)) ≤ ∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, (2 * delta q / m) * missingCellMass P x a s := by apply Finset.sum_le_sum intro x hx apply Finset.sum_le_sum intro a ha apply Finset.sum_le_sum intro s hs have hb := missingCellMass_bounds P h hq x a s exact missingWeight_sq_div_one_add_le hm hb.1 (arrivedCellMass_nonneg P x a s) hδ hb.2.2 _ = (2 * delta q / m) * (∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, missingCellMass P x a s) := by simp only [Finset.mul_sum] _ ≤ (2 * delta q / m) * delta q := mul_le_mul_of_nonneg_left (sum_missingCellMass_le_delta P h hq) hfactor _ = 2 * (delta q) ^ 2 / m := by ring
CausalSmith.Stat.MarNearcompleteFrontier.missingCellMass_variance_sum_le · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/BiasVariance.lean:38
theorem missingCellMass_heavy_variance_budget

The missing-cell terms in the heavy-branch variance sum are bounded by one inverse stream intensity, uniformly over the alphabet. Given the specified input d, the specified input q, the specified input P, the specified input h, the specified input m, the specified input hm, the stated mathematical conclusion holds. Given the specified input hq.

Formal statement
d :
ℕ
q :
ℝ
P :
h :
LawClass d q P
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
m :
ℝ
hm :
0 < m
(∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, (missingCellMass P x a s / m + (missingCellMass P x a s) ^ 2 / (1 + m * arrivedCellMass P x a s)))
≤ 1 / m
Proof (Lean source)
lemma missingCellMass_heavy_variance_budget {d : ℕ} {q : ℝ} (P : FullLaw d) (h : LawClass d q P) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (m : ℝ) (hm : 0 < m) : (∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, (missingCellMass P x a s / m + (missingCellMass P x a s) ^ 2 / (1 + m * arrivedCellMass P x a s))) ≤ 1 / m := by classical have hsum := sum_missingCellMass_le_delta P h hq have hvar := missingCellMass_variance_sum_le P h hq m hm have hδ0 : 0 ≤ delta q := by unfold delta linarith [hq.2] have hδhalf : delta q ≤ 1 / 2 := by unfold delta linarith [hq.1] have hpoly : delta q + 2 * (delta q) ^ 2 ≤ 1 := by nlinarith calc (∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, (missingCellMass P x a s / m + (missingCellMass P x a s) ^ 2 / (1 + m * arrivedCellMass P x a s))) = (∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, missingCellMass P x a s) / m + (∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, (missingCellMass P x a s) ^ 2 / (1 + m * arrivedCellMass P x a s)) := by simp only [Finset.sum_add_distrib, ← Finset.sum_div] _ ≤ delta q / m + 2 * (delta q) ^ 2 / m := add_le_add ((div_le_div_iff_of_pos_right hm).2 hsum) hvar _ = (delta q + 2 * (delta q) ^ 2) / m := by ring _ ≤ 1 / m := (div_le_div_iff_of_pos_right hm).2 hpoly
CausalSmith.Stat.MarNearcompleteFrontier.missingCellMass_heavy_variance_budget · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/BiasVariance.lean:75
CausalSmith.Stat.STAT_MarNearcompleteFrontier_Research.Helpers.UpperRisk.CellBounds 12 declarations This module formalizes equations (1)--(2): arrived and missing cell masses, their arrival-floor bounds, and the exact centered target decomposition.

Cell decomposition for the upper-risk proof

This module formalizes equations (1)--(2): arrived and missing cell masses, their arrival-floor bounds, and the exact centered target decomposition.

def arrivedCellMass

Probability mass in an arrived (X,A,S) cell.

Definition (Lean source)
d :
ℕ
P :
x :
Fin d
a s :
arrivedCellMass P x a s :
ℝ
massOf P (fun w ↦ w.X = x ∧ w.A = a ∧ w.S = s ∧ w.R = true)
def missingCellMass

Probability mass in the missing part of an (X,A,S) cell.

Definition (Lean source)
d :
ℕ
P :
x :
Fin d
a s :
missingCellMass P x a s :
ℝ
cellMass P x a s - arrivedCellMass P x a s
def cellEta

Centered arrived-outcome regression in a cell.

Definition (Lean source)
d :
ℕ
P :
x :
Fin d
a s :
cellEta P x a s :
ℝ
outcomeMean (observedLaw P) x a s - 1 / 2
def treatmentSign

Signed treatment contrast multiplier.

Definition (Lean source)
a :
treatmentSign a :
ℝ
if a then 1 else -1
theorem arrivedCellMass_nonneg

Given the specified input d, the specified input P, the specified input x, the specified input a, the specified input s, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
P :
x :
Fin d
a s :
0 ≤ arrivedCellMass P x a s
Proof (Lean source)
lemma arrivedCellMass_nonneg {d : ℕ} (P : FullLaw d) (x : Fin d) (a s : Bool) : 0 ≤ arrivedCellMass P x a s := by unfold arrivedCellMass massOf apply Finset.sum_nonneg intro w hw split_ifs <;> simp [fullMass]
CausalSmith.Stat.MarNearcompleteFrontier.arrivedCellMass_nonneg · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/CellBounds.lean:36
theorem arrivedCellMass_le_cellMass

Given the specified input d, the specified input P, the specified input x, the specified input a, the specified input s, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
P :
x :
Fin d
a s :
arrivedCellMass P x a s ≤ cellMass P x a s
Proof (Lean source)
lemma arrivedCellMass_le_cellMass {d : ℕ} (P : FullLaw d) (x : Fin d) (a s : Bool) : arrivedCellMass P x a s ≤ cellMass P x a s := by unfold arrivedCellMass cellMass massOf apply Finset.sum_le_sum intro w hw by_cases hc : w.X = x ∧ w.A = a ∧ w.S = s ∧ w.R = true · simp [hc] · simp only [hc, ↓reduceIte] split_ifs <;> simp [fullMass]
CausalSmith.Stat.MarNearcompleteFrontier.arrivedCellMass_le_cellMass · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/CellBounds.lean:45
theorem arrivedCellMass_eq_mul_arrivalProb

Given the specified input d, the specified input P, the specified input x, the specified input a, the specified input s, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
P :
x :
Fin d
a s :
arrivedCellMass P x a s = cellMass P x a s * arrivalProb P x a s
Proof (Lean source)
lemma arrivedCellMass_eq_mul_arrivalProb {d : ℕ} (P : FullLaw d) (x : Fin d) (a s : Bool) : arrivedCellMass P x a s = cellMass P x a s * arrivalProb P x a s := by have hA0 := arrivedCellMass_nonneg P x a s have hAle := arrivedCellMass_le_cellMass P x a s by_cases hc : cellMass P x a s = 0 · have hA : arrivedCellMass P x a s = 0 := by linarith have hmass : massOf P (fun w => w.X = x ∧ w.A = a ∧ w.S = s ∧ w.R = true) = 0 := by simpa only [arrivedCellMass] using hA rw [hA, arrivalProb, hc, hmass] simp · unfold arrivalProb change arrivedCellMass P x a s = cellMass P x a s * (arrivedCellMass P x a s / cellMass P x a s) field_simp
CausalSmith.Stat.MarNearcompleteFrontier.arrivedCellMass_eq_mul_arrivalProb · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/CellBounds.lean:57
theorem missingCellMass_bounds

Given the specified input d, the specified input q, the specified input P, the specified input h, the specified input x, the specified input a, the specified input s, the stated mathematical conclusion holds. Given the specified input hq.

Formal statement
d :
ℕ
q :
ℝ
P :
h :
LawClass d q P
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
x :
Fin d
a s :
conclusion 1
0 ≤ missingCellMass P x a s
conclusion 2
missingCellMass P x a s ≤ delta q * cellMass P x a s
conclusion 3
missingCellMass P x a s ≤ 2 * delta q * arrivedCellMass P x a s
Proof (Lean source)
lemma missingCellMass_bounds {d : ℕ} {q : ℝ} (P : FullLaw d) (h : LawClass d q P) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (x : Fin d) (a s : Bool) : 0 ≤ missingCellMass P x a s ∧ missingCellMass P x a s ≤ delta q * cellMass P x a s ∧ missingCellMass P x a s ≤ 2 * delta q * arrivedCellMass P x a s := by have hA0 := arrivedCellMass_nonneg P x a s have hAle := arrivedCellMass_le_cellMass P x a s have hC0 := cellMass_nonneg P x a s have hqlo := hq.1 have hqhi := hq.2 have hd0 : 0 ≤ delta q := by unfold delta; linarith constructor · unfold missingCellMass linarith by_cases hc : cellMass P x a s = 0 · have hA : arrivedCellMass P x a s = 0 := by linarith simp [missingCellMass, hc, hA] · have hcpos : 0 < cellMass P x a s := lt_of_le_of_ne hC0 (Ne.symm hc) have hf := h.floor x a s hcpos have hqA : q * cellMass P x a s ≤ arrivedCellMass P x a s := by rw [arrivedCellMass_eq_mul_arrivalProb P x a s] simpa [mul_comm] using mul_le_mul_of_nonneg_left hf hC0 have hfirst : missingCellMass P x a s ≤ delta q * cellMass P x a s := by unfold missingCellMass delta nlinarith refine ⟨hfirst, ?_⟩ have hhalf : (1 / 2 : ℝ) * cellMass P x a s ≤ q * cellMass P x a s := mul_le_mul_of_nonneg_right hqlo hC0 have hC2A : cellMass P x a s ≤ 2 * arrivedCellMass P x a s := by linarith calc missingCellMass P x a s ≤ delta q * cellMass P x a s := hfirst _ ≤ delta q * (2 * arrivedCellMass P x a s) := mul_le_mul_of_nonneg_left hC2A hd0 _ = 2 * delta q * arrivedCellMass P x a s := by ring
CausalSmith.Stat.MarNearcompleteFrontier.missingCellMass_bounds · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/CellBounds.lean:76
theorem sum_cellMass_eq_armMass

Given the specified input d, the specified input P, the specified input a, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
P :
a :
(∑ x : Fin d, ∑ s : Bool, cellMass P x a s) = armMass P a
Proof (Lean source)
lemma sum_cellMass_eq_armMass {d : ℕ} (P : FullLaw d) (a : Bool) : (∑ x : Fin d, ∑ s : Bool, cellMass P x a s) = armMass P a := by classical rw [← Fintype.sum_prod_type'] simp only [cellMass, armMass, massOf] rw [Finset.sum_comm] apply Finset.sum_congr rfl intro w hw by_cases ha : w.A = a · simp only [ha, true_and, ↓reduceIte] rw [Fintype.sum_prod_type' (fun x : Fin d => fun s : Bool => if w.X = x ∧ w.S = s then fullMass P w else 0)] cases w.S <;> simp · simp [ha]
CausalSmith.Stat.MarNearcompleteFrontier.sum_cellMass_eq_armMass · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/CellBounds.lean:115
theorem sum_cellMass_eq_one

Given the specified input d, the specified input P, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
P :
(∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, cellMass P x a s) = 1
Proof (Lean source)
lemma sum_cellMass_eq_one {d : ℕ} (P : FullLaw d) : (∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, cellMass P x a s) = 1 := by classical rw [Finset.sum_comm] simp_rw [sum_cellMass_eq_armMass] rw [← massOf_univ_eq_one P] unfold armMass massOf rw [Finset.sum_comm] apply Finset.sum_congr rfl intro w hw cases hwa : w.A <;> simp [hwa]
CausalSmith.Stat.MarNearcompleteFrontier.sum_cellMass_eq_one · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/CellBounds.lean:132
theorem sum_missingCellMass_le_delta

Given the specified input d, the specified input q, the specified input P, the specified input h, the stated mathematical conclusion holds. Given the specified input hq.

Formal statement
d :
ℕ
q :
ℝ
P :
h :
LawClass d q P
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
(∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, missingCellMass P x a s) ≤ delta q
Proof (Lean source)
lemma sum_missingCellMass_le_delta {d : ℕ} {q : ℝ} (P : FullLaw d) (h : LawClass d q P) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) : (∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, missingCellMass P x a s) ≤ delta q := by calc (∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, missingCellMass P x a s) ≤ ∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, delta q * cellMass P x a s := by apply Finset.sum_le_sum intro x hx apply Finset.sum_le_sum intro a ha apply Finset.sum_le_sum intro s hs exact (missingCellMass_bounds P h hq x a s).2.1 _ = delta q * (∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, cellMass P x a s) := by simp only [Finset.mul_sum] _ = delta q := by rw [sum_cellMass_eq_one]; ring
CausalSmith.Stat.MarNearcompleteFrontier.sum_missingCellMass_le_delta · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/CellBounds.lean:146
theorem tau_eq_arrived_missing_cells

Given the specified input d, the specified input q, the specified input P, the specified input h, the stated mathematical conclusion holds. Given the specified input hq.

Formal statement
d :
ℕ
q :
ℝ
P :
h :
LawClass d q P
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
tau P
= 2 * (∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, treatmentSign a * (arrivedCellMass P x a s * cellEta P x a s + missingCellMass P x a s * cellEta P x a s))
Proof (Lean source)
lemma tau_eq_arrived_missing_cells {d : ℕ} {q : ℝ} (P : FullLaw d) (h : LawClass d q P) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) : tau P = 2 * (∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, treatmentSign a * (arrivedCellMass P x a s * cellEta P x a s + missingCellMass P x a s * cellEta P x a s)) := by rw [tau_eq_psi P h hq] unfold psi condCellMass cellEta missingCellMass treatmentSign simp only [observed_cell_mass, observed_arm_mass] have ha_true : armMass P true = (1 : ℝ) / 2 := h.balanced have ha_false : armMass P false = (1 : ℝ) / 2 := armMass_false_eq_half P h.balanced simp only [Fintype.sum_bool, Bool.false_eq_true, ↓reduceIte, ha_true, ha_false] have ht := sum_cellMass_eq_armMass P true have hf := sum_cellMass_eq_armMass P false simp only [Fintype.sum_bool, ha_true] at ht simp only [Fintype.sum_bool, ha_false] at hf rw [Finset.sum_add_distrib] at ht hf have htcenter : (∑ x : Fin d, cellMass P x true true * (-1 / 2 : ℝ)) + ∑ x : Fin d, cellMass P x true false * (-1 / 2 : ℝ) = -1 / 4 := by rw [← Finset.sum_mul, ← Finset.sum_mul, ← add_mul, ht] norm_num have hfcenter : (∑ x : Fin d, cellMass P x false true * (1 / 2 : ℝ)) + ∑ x : Fin d, cellMass P x false false * (1 / 2 : ℝ) = 1 / 4 := by rw [← Finset.sum_mul, ← Finset.sum_mul, ← add_mul, hf] norm_num have hneg (a s : Bool) : (∑ x : Fin d, cellMass P x a s * (-1 / 2 : ℝ)) = -(∑ x : Fin d, cellMass P x a s * (1 / 2 : ℝ)) := by rw [← Finset.sum_mul, ← Finset.sum_mul] ring have hmul (a s : Bool) : (∑ x : Fin d, cellMass P x a s * outcomeMean (observedLaw P) x a s) = ∑ x : Fin d, outcomeMean (observedLaw P) x a s * cellMass P x a s := by apply Finset.sum_congr rfl intro x hx ring have hmul2 (a s : Bool) : (∑ x : Fin d, cellMass P x a s * outcomeMean (observedLaw P) x a s * 2) = (∑ x : Fin d, outcomeMean (observedLaw P) x a s * cellMass P x a s) * 2 := by rw [← Finset.sum_mul, hmul] norm_num at ⊢ ring_nf at ht hf htcenter hfcenter ⊢ simp only [Finset.sum_add_distrib, Finset.sum_sub_distrib] simp_rw [hneg] rw [hneg true true, hneg true false] at htcenter simp_rw [hmul2, hmul] linear_combination -2 * htcenter - 2 * hfcenter
CausalSmith.Stat.MarNearcompleteFrontier.tau_eq_arrived_missing_cells · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/CellBounds.lean:167
CausalSmith.Stat.STAT_MarNearcompleteFrontier_Research.Helpers.UpperRisk.ChebyshevBounds 1 declarations Light-cell Chebyshev calibration obligations

Light-cell Chebyshev calibration obligations

theorem qPoly_eval_formula

For a positive sample size and a nonzero evaluation point, the polynomial quotient equals its displayed Chebyshev formula.

Formal statement
n :
ℕ
_hn :
1 ≤ n
z :
ℝ
hz :
z ≠ 0
(qPoly n).eval z
= (1 - (T ℝ (polyDegree n : ℤ)).eval (1 - 2 * z / polyThreshold n)) / (2 * (polyDegree n : ℝ) ^ 2 * z / polyThreshold n)
Proof (Lean source)
lemma qPoly_eval_formula (n : ℕ) (_hn : 1 ≤ n) (z : ℝ) (hz : z ≠ 0) : (qPoly n).eval z = (1 - (T ℝ (polyDegree n : ℤ)).eval (1 - 2 * z / polyThreshold n)) / (2 * (polyDegree n : ℝ) ^ 2 * z / polyThreshold n) := by let p : Polynomial ℝ := 1 - (T ℝ (polyDegree n : ℤ)).comp (1 - C (2 / polyThreshold n) * X) have hp0 : p.coeff 0 = 0 := by rw [Polynomial.coeff_zero_eq_eval_zero] simp [p, Polynomial.Chebyshev.T_eval_one] have hdiv := Polynomial.divX_mul_X_add p have heval := congrArg (eval z) hdiv simp only [Polynomial.eval_mul, Polynomial.eval_X, hp0, map_zero, add_zero] at heval have hB : polyThreshold n ≠ 0 := by have he : 1 < exp (1 : ℝ) := Real.one_lt_exp_iff.mpr (by norm_num) have he' : 1 < exp (1 : ℝ) + (n : ℝ) := by have hn0 : (0 : ℝ) ≤ n := Nat.cast_nonneg n linarith have hl : 0 < ell n := by exact Real.log_pos (by simpa [ell] using he') unfold polyThreshold positivity have hk : (polyDegree n : ℝ) ≠ 0 := by exact_mod_cast (show polyDegree n ≠ 0 by unfold polyDegree; omega) have hp_eval : p.eval z = 1 - (T ℝ (polyDegree n : ℤ)).eval (1 - 2 * z / polyThreshold n) := by simp [p, Polynomial.eval_sub, Polynomial.eval_comp] congr 1 field_simp change (p.divX * C (polyThreshold n / (2 * (polyDegree n : ℝ) ^ 2))).eval z = _ rw [Polynomial.eval_mul, Polynomial.eval_C] rw [← hp_eval, ← heval] field_simp
CausalSmith.Stat.STAT_MarNearcompleteFrontier_Research.Helpers.UpperRisk.ChebyshevCoefficients 1 declarations This module isolates the shifted Chebyshev recurrence and coefficient bound behind equation (6) of the upper-risk proof.

Coefficient growth of the light-cell Chebyshev correction

This module isolates the shifted Chebyshev recurrence and coefficient bound behind equation (6) of the upper-risk proof.

theorem correctionCoeff_weighted_sum_le Lemma correctionCoeff_weighted_sum_le in the paper ↗

The coefficient budget of the light-cell correction is bounded by the paper's exponential degree factor. Given the specified input n, the stated mathematical conclusion holds.

Formal statement
n :
ℕ
(∑ v ∈ range (polyDegree n - 1), |correctionCoeff n (v + 1)| * (polyThreshold n) ^ (v + 1))
≤ (8 : ℝ) ^ (polyDegree n)
Proof (Lean source)
lemma correctionCoeff_weighted_sum_le (n : ℕ) : (∑ v ∈ range (polyDegree n - 1), |correctionCoeff n (v + 1)| * (polyThreshold n) ^ (v + 1)) ≤ (8 : ℝ) ^ (polyDegree n) := by let k := polyDegree n let B := polyThreshold n have hkNat : 1 ≤ k := by unfold k polyDegree; omega have hk : 0 < (k : ℝ) := by exact_mod_cast hkNat have hB : 0 < B := by have he : 1 < exp (1 : ℝ) := Real.one_lt_exp_iff.mpr (by norm_num) have he' : 1 < exp (1 : ℝ) + (n : ℝ) := by have hn : (0 : ℝ) ≤ n := Nat.cast_nonneg n linarith have hl : 0 < ell n := Real.log_pos (by simpa [ell] using he') unfold B polyThreshold positivity let qB := (qPoly n).comp (C B * X) have hterm (v : ℕ) : |correctionCoeff n (v + 1)| * B ^ (v + 1) = |qB.coeff (v + 1)| := by simp only [correctionCoeff, Polynomial.coeff_sub, Polynomial.coeff_one, if_neg (by omega : v + 1 ≠ 0), zero_sub, abs_neg, qB, Polynomial.comp_C_mul_X_coeff, abs_mul, abs_pow, abs_of_pos hB] calc (∑ v ∈ range (k - 1), |correctionCoeff n (v + 1)| * B ^ (v + 1)) = ∑ v ∈ range (k - 1), |qB.coeff (v + 1)| := by apply Finset.sum_congr rfl intro v _ exact hterm v _ ≤ polynomialCoeffOneNorm qB := by rw [show (∑ v ∈ range (k - 1), |qB.coeff (v + 1)|) = ∑ j ∈ (range (k - 1)).image (fun v => v + 1), |qB.coeff j| by rw [Finset.sum_image] intro a _ b _ hab exact Nat.add_right_cancel hab] exact sum_abs_coeff_le_polynomialCoeffOneNorm _ _ _ = polynomialCoeffOneNorm (((1 - shiftedCheb k).divX) * C (1 / (2 * (k : ℝ) ^ 2))) := by rw [show qB = (qPoly n).comp (C (polyThreshold n) * X) by rfl, qPoly_comp_scale] _ ≤ polynomialCoeffOneNorm ((1 - shiftedCheb k).divX) * polynomialCoeffOneNorm (C (1 / (2 * (k : ℝ) ^ 2))) := polynomialCoeffOneNorm_mul_le _ _ _ ≤ (polynomialCoeffOneNorm (1 - shiftedCheb k)) * |1 / (2 * (k : ℝ) ^ 2)| := by rw [polynomialCoeffOneNorm_C] gcongr exact polynomialCoeffOneNorm_divX_le _ _ ≤ (1 + (7 : ℝ) ^ k) * (1 / (2 * (k : ℝ) ^ 2)) := by have hc : polynomialCoeffOneNorm (1 - shiftedCheb k) ≤ 1 + 7 ^ k := by calc polynomialCoeffOneNorm (1 - shiftedCheb k) ≤ polynomialCoeffOneNorm 1 + polynomialCoeffOneNorm (shiftedCheb k) := polynomialCoeffOneNorm_sub_le _ _ _ ≤ 1 + 7 ^ k := by rw [show (1 : ℝ[X]) = C 1 by simp, polynomialCoeffOneNorm_C] norm_num exact shiftedCheb_coeffL1_le k rw [abs_of_pos (by positivity : 0 < 1 / (2 * (k : ℝ) ^ 2))] gcongr _ ≤ (7 : ℝ) ^ k := by have hpow : 1 ≤ (7 : ℝ) ^ k := one_le_pow₀ (by norm_num) have hkR : (1 : ℝ) ≤ k := by exact_mod_cast hkNat have hk2 : 1 ≤ (k : ℝ) ^ 2 := by nlinarith have hfrac : 1 / (2 * (k : ℝ) ^ 2) ≤ (1 : ℝ) / 2 := by rw [div_le_iff₀ (by positivity)] nlinarith calc (1 + (7 : ℝ) ^ k) * (1 / (2 * (k : ℝ) ^ 2)) ≤ (1 + 7 ^ k) * (1 / 2) := by gcongr _ ≤ 7 ^ k := by nlinarith _ ≤ (8 : ℝ) ^ k := by exact pow_le_pow_left₀ (by norm_num) (by norm_num) k
CausalSmith.Stat.MarNearcompleteFrontier.correctionCoeff_weighted_sum_le · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/ChebyshevCoefficients.lean:121
CausalSmith.Stat.STAT_MarNearcompleteFrontier_Research.Helpers.UpperRisk.ChebyshevRiskBounds 4 declarations These leaves isolate the direct interval consequences of the quotient formula in equation (6) of the upper-risk proof.

Chebyshev quotient bounds for the light-cell correction

These leaves isolate the direct interval consequences of the quotient formula in equation (6) of the upper-risk proof.

The removable value of the Chebyshev quotient at zero is one. Given the specified input n, the stated mathematical conclusion holds.

Formal statement
n :
ℕ
(qPoly n).eval 0 = 1
Proof (Lean source)
lemma upper_qPoly_eval_zero (n : ℕ) : (qPoly n).eval 0 = 1 := by rw [← Polynomial.coeff_zero_eq_eval_zero] exact qPoly_coeff_zero_local n
theorem upper_qPoly_nonneg_on_positive Lemma upper_qPoly_nonneg_on_positive in the paper ↗

The Chebyshev quotient is nonnegative at a positive rate below the polynomial threshold. Given the specified input n, the specified input hn, the specified input z, the specified input hz, the specified input hzB, the stated mathematical conclusion holds.

Formal statement
n :
ℕ
hn :
1 ≤ n
z :
ℝ
hz :
0 < z
hzB :
0 ≤ (qPoly n).eval z
Proof (Lean source)
lemma upper_qPoly_nonneg_on_positive {n : ℕ} (hn : 1 ≤ n) {z : ℝ} (hz : 0 < z) (hzB : z ≤ polyThreshold n) : 0 ≤ (qPoly n).eval z := (qPoly_bounds_on_positive hn hz hzB).1
CausalSmith.Stat.MarNearcompleteFrontier.upper_qPoly_nonneg_on_positive · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/ChebyshevRiskBounds.lean:105

On the light-cell range, rate times the Chebyshev quotient is bounded by the threshold divided by the square of its polynomial degree. Given the specified input n, the specified input hn, the specified input z, the specified input hz, the specified input hzB, the stated mathematical conclusion holds.

Formal statement
n :
ℕ
hn :
1 ≤ n
z :
ℝ
hz :
0 < z
hzB :
z * (qPoly n).eval z ≤ polyThreshold n / (polyDegree n : ℝ) ^ 2
Proof (Lean source)
lemma upper_z_mul_qPoly_le {n : ℕ} (hn : 1 ≤ n) {z : ℝ} (hz : 0 < z) (hzB : z ≤ polyThreshold n) : z * (qPoly n).eval z ≤ polyThreshold n / (polyDegree n : ℝ) ^ 2 := (qPoly_bounds_on_positive hn hz hzB).2
theorem upper_qPoly_le_one_on_positive Lemma upper_qPoly_le_one_on_positive in the paper ↗

The Chebyshev quotient is at most one at a positive rate below the polynomial threshold. Given the specified input n, the specified input hn, the specified input z, the specified input hz, the specified input hzB, the stated mathematical conclusion holds.

Formal statement
n :
ℕ
hn :
1 ≤ n
z :
ℝ
hz :
0 < z
hzB :
(qPoly n).eval z ≤ 1
Proof (Lean source)
lemma upper_qPoly_le_one_on_positive {n : ℕ} (hn : 1 ≤ n) {z : ℝ} (hz : 0 < z) (hzB : z ≤ polyThreshold n) : (qPoly n).eval z ≤ 1 := by let k := polyDegree n let B := polyThreshold n let x₀ : ℝ := 1 - 2 * z / B let T : Polynomial ℝ := T ℝ (k : ℤ) have hB : 0 < B := lt_of_lt_of_le hz hzB have hkNat : 1 ≤ k := by unfold k polyDegree exact le_max_left _ _ have hk : 0 < (k : ℝ) := by exact_mod_cast hkNat have hzdiv : 0 ≤ z / B := div_nonneg hz.le hB.le have hzdiv_le : z / B ≤ 1 := (div_le_one hB).2 hzB have hxabs : |x₀| ≤ 1 := by have hquot : 2 * z / B = 2 * (z / B) := by ring simp only [x₀, hquot, abs_le] constructor <;> nlinarith have hxmem : x₀ ∈ Icc (-1 : ℝ) 1 := Set.mem_Icc.mpr (abs_le.mp hxabs) have hone : (1 : ℝ) ∈ Icc (-1 : ℝ) 1 := by norm_num have hderiv : ∀ y ∈ Icc (-1 : ℝ) 1, ‖deriv (fun u : ℝ => T.eval u) y‖ ≤ (k : ℝ) ^ 2 := by intro y hy rw [Polynomial.deriv, Real.norm_eq_abs] have hyabs : |y| ≤ 1 := abs_le.mpr hy have hcheb := Polynomial.Chebyshev.abs_iterate_derivative_T_real_le (k : ℤ) 1 hyabs simpa only [T, Function.iterate_one, Polynomial.Chebyshev.derivative_T_eval_one, Int.cast_natCast] using hcheb have hmv := Convex.norm_image_sub_le_of_norm_deriv_le (s := Icc (-1 : ℝ) 1) (x := x₀) (y := (1 : ℝ)) (C := (k : ℝ) ^ 2) (fun y hy => T.differentiableAt) hderiv (convex_Icc _ _) hxmem hone have hTx : 1 - T.eval x₀ ≤ (k : ℝ) ^ 2 * (1 - x₀) := by rw [Real.norm_eq_abs, Real.norm_eq_abs] at hmv have hxle : x₀ ≤ 1 := hxmem.2 calc 1 - T.eval x₀ ≤ |1 - T.eval x₀| := le_abs_self _ _ ≤ (k : ℝ) ^ 2 * (1 - x₀) := by simpa only [T, Polynomial.Chebyshev.T_eval_one, abs_of_nonneg (sub_nonneg.mpr hxle)] using hmv have hden : 0 < 2 * (k : ℝ) ^ 2 * z / B := by positivity rw [qPoly_eval_formula n hn z (ne_of_gt hz)] change (1 - T.eval x₀) / (2 * (k : ℝ) ^ 2 * z / B) ≤ 1 apply (div_le_one hden).2 calc 1 - T.eval x₀ ≤ (k : ℝ) ^ 2 * (1 - x₀) := hTx _ = 2 * (k : ℝ) ^ 2 * z / B := by dsimp [x₀] ring
CausalSmith.Stat.MarNearcompleteFrontier.upper_qPoly_le_one_on_positive · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/ChebyshevRiskBounds.lean:122
CausalSmith.Stat.STAT_MarNearcompleteFrontier_Research.Helpers.UpperRisk.CompleteArrivalRisk 21 declarations The complete-outcome score is unbiased at arrival floor one.

Complete-arrival and fallback risk branches

The complete-outcome score is unbiased at arrival floor one. Its iid variance bound and projection close that endpoint independently of the main frontier.

def unprojectedHT

Unprojected complete-outcome randomized difference. Given the specified input n, the specified input d, the specified input sample, the stated mathematical conclusion holds.

Definition (Lean source)
n d :
ℕ
sample :
Fin n → Obs d
unprojectedHT sample :
ℝ
2 / (n : ℝ) * ∑ i : Fin n, (if (sample i).A then (1 : ℝ) else -1) * (if (sample i).RY then (1 : ℝ) else 0)
def completeHTScore

The complete-arrival one-record randomized score. Given the specified input d, the specified input o, the stated mathematical conclusion holds.

Definition (Lean source)
d :
ℕ
o :
Obs d
completeHTScore o :
ℝ
2 * (if o.A then (1 : ℝ) else -1) * (if o.RY then (1 : ℝ) else 0)
theorem completeHTScore_range

Given the specified input d, the specified input o, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
o :
Obs d
completeHTScore o ∈ Icc (-2) 2
Proof (Lean source)
lemma completeHTScore_range {d : ℕ} (o : Obs d) : completeHTScore o ∈ Icc (-2) 2 := by cases hA : o.A <;> cases hRY : o.RY <;> simp [completeHTScore, hA, hRY]
theorem completeHTScore_variance_le

Given the specified input d, the specified input P, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
P :
variance completeHTScore (observedLaw P).toMeasure ≤ 4
Proof (Lean source)
lemma completeHTScore_variance_le {d : ℕ} (P : FullLaw d) : variance completeHTScore (observedLaw P).toMeasure ≤ 4 := by haveI : IsProbabilityMeasure (observedLaw P).toMeasure := inferInstance have hbound : ∀ᵐ o ∂(observedLaw P).toMeasure, completeHTScore o ∈ Icc (-2) 2 := Filter.Eventually.of_forall completeHTScore_range have hmeas : AEMeasurable (completeHTScore (d := d)) (observedLaw P).toMeasure := by fun_prop have h := ProbabilityTheory.variance_le_sq_of_bounded hbound hmeas norm_num at h ⊢ exact h
CausalSmith.Stat.MarNearcompleteFrontier.completeHTScore_variance_le · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/CompleteArrivalRisk.lean:38
theorem unprojectedHT_eq_average

Given the specified input n, the specified input d, the specified input sample, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
sample :
Fin n → Obs d
unprojectedHT sample = (n : ℝ)⁻¹ * ∑ i : Fin n, completeHTScore (sample i)
Proof (Lean source)
lemma unprojectedHT_eq_average {n d : ℕ} (sample : Fin n → Obs d) : unprojectedHT sample = (n : ℝ)⁻¹ * ∑ i : Fin n, completeHTScore (sample i) := by simp only [unprojectedHT, completeHTScore, Finset.mul_sum] apply Finset.sum_congr rfl intro i _ ring
CausalSmith.Stat.MarNearcompleteFrontier.unprojectedHT_eq_average · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/CompleteArrivalRisk.lean:52
theorem completeHTScore_memLp

Given the specified input d, the specified input P, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
P :
MemLp completeHTScore 2 (observedLaw P).toMeasure
Proof (Lean source)
lemma completeHTScore_memLp {d : ℕ} (P : FullLaw d) : MemLp completeHTScore 2 (observedLaw P).toMeasure := by haveI : IsFiniteMeasure (observedLaw P).toMeasure := inferInstance apply (memLp_two_iff_integrable_sq (by fun_prop)).2 exact Integrable.of_finite
theorem completeHTScore_integral_eq_arrived

Given the specified input d, the specified input P, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
P :
(∫ o, completeHTScore o ∂(observedLaw P).toMeasure)
= 2 * (massOf P (fun w => w.A = true ∧ w.R = true ∧ w.Y = true) - massOf P (fun w => w.A = false ∧ w.R = true ∧ w.Y = true))
Proof (Lean source)
lemma completeHTScore_integral_eq_arrived {d : ℕ} (P : FullLaw d) : (∫ o, completeHTScore o ∂(observedLaw P).toMeasure) = 2 * (massOf P (fun w => w.A = true ∧ w.R = true ∧ w.Y = true) - massOf P (fun w => w.A = false ∧ w.R = true ∧ w.Y = true)) := by classical rw [PMF.integral_eq_sum] simp only [smul_eq_mul] have hpoint (o : Obs d) : (observedLaw P o).toReal * completeHTScore o = 2 * (if o.A = true ∧ o.RY = true then obsMass (observedLaw P) o else 0) - 2 * (if o.A = false ∧ o.RY = true then obsMass (observedLaw P) o else 0) := by cases hA : o.A <;> cases hRY : o.RY <;> simp [completeHTScore, obsMass, hA, hRY] <;> ring simp_rw [hpoint] rw [Finset.sum_sub_distrib, ← Finset.mul_sum, ← Finset.mul_sum] rw [obsMass_sum_event P (fun o : Obs d => o.A = true ∧ o.RY = true), obsMass_sum_event P (fun o : Obs d => o.A = false ∧ o.RY = true)] simp only [observe, Bool.and_eq_true, Bool.true_and] ring
CausalSmith.Stat.MarNearcompleteFrontier.completeHTScore_integral_eq_arrived · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/CompleteArrivalRisk.lean:69
theorem complete_arrival_missing_cell_mass_zero

Given the specified input d, the specified input P, the specified input h, the specified input x, the specified input a, the specified input s, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
P :
h :
LawClass d 1 P
x :
Fin d
a s :
massOf P (fun w => w.X = x ∧ w.A = a ∧ w.S = s ∧ w.R = false) = 0
Proof (Lean source)
lemma complete_arrival_missing_cell_mass_zero {d : ℕ} (P : FullLaw d) (h : LawClass d 1 P) (x : Fin d) (a s : Bool) : massOf P (fun w => w.X = x ∧ w.A = a ∧ w.S = s ∧ w.R = false) = 0 := by classical let t := massOf P (fun w => w.X = x ∧ w.A = a ∧ w.S = s ∧ w.R = true) let m := massOf P (fun w => w.X = x ∧ w.A = a ∧ w.S = s ∧ w.R = false) change m = 0 have hpart : cellMass P x a s = t + m := by unfold cellMass t m massOf rw [← Finset.sum_add_distrib] apply Finset.sum_congr rfl intro w _ cases hw : w.R <;> simp [hw] have ht : 0 ≤ t := by unfold t massOf exact Finset.sum_nonneg (fun w _ => by split_ifs <;> simp [fullMass, ENNReal.toReal_nonneg]) have hm : 0 ≤ m := by unfold m massOf exact Finset.sum_nonneg (fun w _ => by split_ifs <;> simp [fullMass, ENNReal.toReal_nonneg]) by_cases hc : cellMass P x a s = 0 · linarith · have hcpos : 0 < cellMass P x a s := by have : 0 ≤ cellMass P x a s := by linarith exact lt_of_le_of_ne this (Ne.symm hc) have hf := h.floor x a s hcpos change 1 ≤ t / cellMass P x a s at hf have hle : cellMass P x a s ≤ t := by have := (le_div_iff₀ hcpos).mp hf linarith linarith
CausalSmith.Stat.MarNearcompleteFrontier.complete_arrival_missing_cell_mass_zero · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/CompleteArrivalRisk.lean:91
theorem complete_arrival_missing_atom_zero

Given the specified input d, the specified input P, the specified input h, the specified input w, the specified input hw, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
P :
h :
LawClass d 1 P
w :
hw :
w.R = false
fullMass P w = 0
Proof (Lean source)
lemma complete_arrival_missing_atom_zero {d : ℕ} (P : FullLaw d) (h : LawClass d 1 P) (w : FullAtom d) (hw : w.R = false) : fullMass P w = 0 := by classical have hcell := complete_arrival_missing_cell_mass_zero P h w.X w.A w.S unfold massOf at hcell have hz := (Finset.sum_eq_zero_iff_of_nonneg (s := univ) (f := fun v : FullAtom d => @ite ℝ (v.X = w.X ∧ v.A = w.A ∧ v.S = w.S ∧ v.R = false) (propDecidable _) (fullMass P v) 0) (by intro v _; split_ifs <;> simp [fullMass, ENNReal.toReal_nonneg])).mp hcell have hwzero := hz w (Finset.mem_univ w) simpa [hw] using hwzero
CausalSmith.Stat.MarNearcompleteFrontier.complete_arrival_missing_atom_zero · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/CompleteArrivalRisk.lean:124
theorem complete_arrival_arrived_outcome_eq

Given the specified input d, the specified input P, the specified input h, the specified input a, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
P :
h :
LawClass d 1 P
a :
massOf P (fun w => w.A = a ∧ w.R = true ∧ w.Y = true)
= massOf P (fun w => w.A = a ∧ w.Y = true)
Proof (Lean source)
lemma complete_arrival_arrived_outcome_eq {d : ℕ} (P : FullLaw d) (h : LawClass d 1 P) (a : Bool) : massOf P (fun w => w.A = a ∧ w.R = true ∧ w.Y = true) = massOf P (fun w => w.A = a ∧ w.Y = true) := by classical unfold massOf apply Finset.sum_congr rfl intro w _ by_cases hr : w.R = true · simp [hr] · have hf : w.R = false := by cases hR : w.R <;> simp_all simp [hf, complete_arrival_missing_atom_zero P h w hf]
CausalSmith.Stat.MarNearcompleteFrontier.complete_arrival_arrived_outcome_eq · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/CompleteArrivalRisk.lean:140
theorem complete_arrival_score_mean

Given the specified input d, the specified input P, the specified input h, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
P :
h :
LawClass d 1 P
(∫ o, completeHTScore o ∂(observedLaw P).toMeasure) = tau P
Proof (Lean source)
lemma complete_arrival_score_mean {d : ℕ} (P : FullLaw d) (h : LawClass d 1 P) : (∫ o, completeHTScore o ∂(observedLaw P).toMeasure) = tau P := by rw [completeHTScore_integral_eq_arrived, complete_arrival_arrived_outcome_eq P h true, complete_arrival_arrived_outcome_eq P h false, tau_eq_potential_mass] have ht := randomized_arm_outcome P h.randomized h.balanced h.consistency true have hf := randomized_arm_outcome P h.randomized h.balanced h.consistency false have ht' : 2 * massOf P (fun w => w.A = true ∧ w.Y = true) = massOf P (fun w => w.Y1 = true) := by simpa using ht have hf' : 2 * massOf P (fun w => w.A = false ∧ w.Y = true) = massOf P (fun w => w.Y0 = true) := by simpa using hf rw [← ht', ← hf'] ring
CausalSmith.Stat.MarNearcompleteFrontier.complete_arrival_score_mean · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/CompleteArrivalRisk.lean:155
theorem complete_arrival_unprojected_risk_of_mean

Given the specified input n, the specified input d, the specified input P, the specified input hn, the stated mathematical conclusion holds. Given the specified input hmean.

Formal statement
n d :
ℕ
P :
hn :
1 ≤ n
hmean :
(∫ o, completeHTScore o ∂(observedLaw P).toMeasure) = tau P
(∫ sample, (unprojectedHT sample - tau P) ^ 2 ∂samplePi P n) ≤ 4 / (n : ℝ)
Proof (Lean source)
lemma complete_arrival_unprojected_risk_of_mean {n d : ℕ} (P : FullLaw d) (hn : 1 ≤ n) (hmean : (∫ o, completeHTScore o ∂(observedLaw P).toMeasure) = tau P) : (∫ sample, (unprojectedHT sample - tau P) ^ 2 ∂samplePi P n) ≤ 4 / (n : ℝ) := by let μ := (observedLaw P).toMeasure let F : Obs d → ℝ := completeHTScore have hF : MemLp F 2 μ := completeHTScore_memLp P have hmeanAve := iid_average_integral μ n hn F (hF.integrable (by norm_num)) have hmeanSample : (∫ sample : Fin n → Obs d, (n : ℝ)⁻¹ * ∑ i, F (sample i) ∂samplePi P n) = tau P := by change (∫ sample : Fin n → Obs d, (n : ℝ)⁻¹ * ∑ i, F (sample i) ∂Measure.pi (fun _ : Fin n => μ)) = tau P exact hmeanAve.trans hmean have hvar := Causalean.Mathlib.Probability.iid_average_variance μ n F hF have hmeas : AEMeasurable (fun sample : Fin n → Obs d => (n : ℝ)⁻¹ * ∑ i, F (sample i)) (samplePi P n) := by exact (measurable_of_finite _).aemeasurable calc (∫ sample, (unprojectedHT sample - tau P) ^ 2 ∂samplePi P n) = variance (fun sample : Fin n → Obs d => (n : ℝ)⁻¹ * ∑ i, F (sample i)) (samplePi P n) := by rw [ProbabilityTheory.variance_eq_integral hmeas] rw [hmeanSample] congr 1 funext sample rw [unprojectedHT_eq_average] _ = (n : ℝ)⁻¹ * variance F μ := by simpa [samplePi, μ, F] using hvar _ ≤ (n : ℝ)⁻¹ * 4 := by exact mul_le_mul_of_nonneg_left (completeHTScore_variance_le P) (by positivity) _ = 4 / (n : ℝ) := by ring
CausalSmith.Stat.MarNearcompleteFrontier.complete_arrival_unprojected_risk_of_mean · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/CompleteArrivalRisk.lean:173
theorem complete_arrival_gScale

Given the specified input n, the specified input d, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
gScale n d 1 = 0
Proof (Lean source)
lemma complete_arrival_gScale (n d : ℕ) : gScale n d 1 = 0 := by simp [gScale, delta]
theorem complete_arrival_rate

Given the specified input n, the specified input d, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
rate n d 1 = 1 / (n : ℝ)
Proof (Lean source)
lemma complete_arrival_rate (n d : ℕ) : rate n d 1 = 1 / (n : ℝ) := by simp [rate, complete_arrival_gScale]
theorem complete_arrival_estimator

Given the specified input n, the specified input d, the specified input sample, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
sample :
Fin n → Obs d
tauhatMM n d 1 sample = completeHT sample
Proof (Lean source)
lemma complete_arrival_estimator (n d : ℕ) (sample : Fin n → Obs d) : tauhatMM n d 1 sample = completeHT sample := by simp [tauhatMM]
CausalSmith.Stat.MarNearcompleteFrontier.complete_arrival_estimator · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/CompleteArrivalRisk.lean:222
theorem complete_arrival_unprojected_eq

Given the specified input n, the specified input d, the specified input sample, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
sample :
Fin n → Obs d
Proof (Lean source)
lemma complete_arrival_unprojected_eq {n d : ℕ} (sample : Fin n → Obs d) : completeHT sample = clipUnit (unprojectedHT sample) := by rfl
CausalSmith.Stat.MarNearcompleteFrontier.complete_arrival_unprojected_eq · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/CompleteArrivalRisk.lean:228

Given the specified input z, the specified input t, the stated mathematical conclusion holds. Given the specified input ht.

Formal statement
z t :
ℝ
ht :
t ∈ Icc (-1) 1
|clipUnit z - t| ≤ |z - t|
Proof (Lean source)
lemma clipUnit_contracts (z t : ℝ) (ht : t ∈ Icc (-1) 1) : |clipUnit z - t| ≤ |z - t| := by rcases ht with ⟨htl, htu⟩ unfold clipUnit rcases le_total z (-1) with h | h · have hz : min 1 z = z := min_eq_right (by linarith) rw [hz, max_eq_left h] rw [abs_of_nonpos (by linarith), abs_of_nonpos (by linarith)] linarith · rcases le_total z 1 with h' | h' · rw [min_eq_right h', max_eq_right h] · rw [min_eq_left h', max_eq_right (by norm_num : (-1 : ℝ) ≤ 1)] rw [abs_of_nonneg (by linarith), abs_of_nonneg (by linarith)] linarith
theorem complete_arrival_projection_error

Given the specified input n, the specified input d, the specified input P, the specified input sample, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
P :
sample :
Fin n → Obs d
|tauhatMM n d 1 sample - tau P| ≤ |unprojectedHT sample - tau P|
Proof (Lean source)
lemma complete_arrival_projection_error {n d : ℕ} (P : FullLaw d) (sample : Fin n → Obs d) : |tauhatMM n d 1 sample - tau P| ≤ |unprojectedHT sample - tau P| := by rw [complete_arrival_estimator, complete_arrival_unprojected_eq] exact clipUnit_contracts _ _ (tau_range P)
CausalSmith.Stat.MarNearcompleteFrontier.complete_arrival_projection_error · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/CompleteArrivalRisk.lean:251
theorem complete_arrival_projection_risk

Given the specified input n, the specified input d, the specified input P, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
P :
(∫ sample, (tauhatMM n d 1 sample - tau P) ^ 2 ∂ samplePi P n)
≤ (∫ sample, (unprojectedHT sample - tau P) ^ 2 ∂ samplePi P n)
Proof (Lean source)
lemma complete_arrival_projection_risk {n d : ℕ} (P : FullLaw d) : (∫ sample, (tauhatMM n d 1 sample - tau P) ^ 2 ∂ samplePi P n) ≤ (∫ sample, (unprojectedHT sample - tau P) ^ 2 ∂ samplePi P n) := by haveI : IsFiniteMeasure (samplePi P n) := by unfold samplePi infer_instance apply integral_mono · exact Integrable.of_finite · exact Integrable.of_finite · intro sample nlinarith [complete_arrival_projection_error P sample, abs_nonneg (tauhatMM n d 1 sample - tau P), abs_nonneg (unprojectedHT sample - tau P), sq_abs (tauhatMM n d 1 sample - tau P), sq_abs (unprojectedHT sample - tau P)]
CausalSmith.Stat.MarNearcompleteFrontier.complete_arrival_projection_risk · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/CompleteArrivalRisk.lean:260
theorem upper_complete_arrival_risk_rate

At complete arrival, the projected estimator has risk at most four over n. Given the specified input n, the specified input d, the specified input hn, the specified input P, the specified input h, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
hn :
0 < n
P :
h :
LawClass d 1 P
(∫ sample, (tauhatMM n d 1 sample - tau P) ^ 2 ∂samplePi P n) ≤ 4 * rate n d 1
Proof (Lean source)
-- @node: upper_complete_arrival_risk_rate lemma upper_complete_arrival_risk_rate {n d : ℕ} (hn : 0 < n) (P : FullLaw d) (h : LawClass d 1 P) : (∫ sample, (tauhatMM n d 1 sample - tau P) ^ 2 ∂samplePi P n) ≤ 4 * rate n d 1 := by have hs := complete_arrival_unprojected_risk_of_mean P hn (complete_arrival_score_mean P h) have hp := complete_arrival_projection_risk (n := n) P simpa only [complete_arrival_rate, mul_one_div] using hp.trans hs
CausalSmith.Stat.MarNearcompleteFrontier.upper_complete_arrival_risk_rate · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/CompleteArrivalRisk.lean:277
theorem upper_fallback_branches_risk_rate

All complete-arrival and fallback regimes share a universal risk constant. Given the specified input n, the specified input d, the specified input q, the specified input hn, the specified input P, the specified input h, the specified input n, the stated mathematical conclusion holds. Given the specified input hq, the specified input hb.

Formal statement
n d :
ℕ
q :
ℝ
hn :
0 < n
P :
h :
LawClass d q P
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
hb :
q = 1 ∨ ell n < 128 ∨ (n : ℝ) * ell n ≤ d
(∫ sample, (tauhatMM n d q sample - tau P) ^ 2 ∂samplePi P n)
≤ (4 * exp 128) * rate n d q
Proof (Lean source)
-- @node: upper_fallback_branches_risk_rate lemma upper_fallback_branches_risk_rate {n d : ℕ} {q : ℝ} (hn : 0 < n) (P : FullLaw d) (h : LawClass d q P) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (hb : q = 1 ∨ ell n < 128 ∨ (n : ℝ) * ell n ≤ d) : (∫ sample, (tauhatMM n d q sample - tau P) ^ 2 ∂samplePi P n) ≤ (4 * exp 128) * rate n d q := by have hr : 0 ≤ rate n d q := by unfold rate positivity have he : (1 : ℝ) ≤ exp 128 := Real.one_le_exp (by norm_num) rcases hb with hcomplete | hsmall | hdim · subst q exact (upper_complete_arrival_risk_rate hn P h).trans (mul_le_mul_of_nonneg_right (by nlinarith : (4 : ℝ) ≤ 4 * exp 128) hr) · exact upper_small_log_risk_rate hn q P hsmall · by_cases hcomplete : q = 1 · subst q exact (upper_complete_arrival_risk_rate hn P h).trans (mul_le_mul_of_nonneg_right (by nlinarith : (4 : ℝ) ≤ 4 * exp 128) hr) · exact (upper_large_dimension_risk_rate hn P h hq hcomplete hdim).trans (mul_le_mul_of_nonneg_right (by nlinarith : (2 : ℝ) ≤ 4 * exp 128) hr)
CausalSmith.Stat.MarNearcompleteFrontier.upper_fallback_branches_risk_rate · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/CompleteArrivalRisk.lean:288
CausalSmith.Stat.STAT_MarNearcompleteFrontier_Research.Helpers.UpperRisk.Fallback 1 declarations Complete-arrival and small-scale estimator branches

Complete-arrival and small-scale estimator branches

theorem tauhatMM_fallback

If arrival is incomplete and the scale is in the fallback regime, the missing-membership estimator equals the fallback estimator.

Formal statement
n d :
ℕ
q :
ℝ
o :
Fin n → Obs d
hq :
q ≠ 1
hsmall :
ell n < 128 ∨ (d : ℝ) ≥ (n : ℝ) * ell n
tauhatMM n d q o = fallbackHT o
Proof (Lean source)
lemma tauhatMM_fallback (n d : ℕ) (q : ℝ) (o : Fin n → Obs d) (hq : q ≠ 1) (hsmall : ell n < 128 ∨ (d : ℝ) ≥ (n : ℝ) * ell n) : tauhatMM n d q o = fallbackHT o := by simp [tauhatMM, hq, hsmall]
CausalSmith.Stat.MarNearcompleteFrontier.tauhatMM_fallback · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/Fallback.lean:9
CausalSmith.Stat.STAT_MarNearcompleteFrontier_Research.Helpers.UpperRisk.FallbackBias 6 declarations The fallback score averages the arrived centered cell contributions.

Population bias and large-dimension fallback risk

The fallback score averages the arrived centered cell contributions. The omitted missing contributions have absolute sum at most the missingness envelope.

theorem upper_arrived_mass_mul_outcomeMean

The arrived regression times its cell mass is the arrived outcome mass, including null arrived cells. Given the specified input d, the specified input P, the specified input x, the specified input a, the specified input s, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
P :
x :
Fin d
a s :
arrivedCellMass P x a s * outcomeMean (observedLaw P) x a s
= massOf P (fun w => w.X = x ∧ w.A = a ∧ w.S = s ∧ w.R = true ∧ w.Y = true)
Proof (Lean source)
-- @node: upper_arrived_mass_mul_outcomeMean lemma upper_arrived_mass_mul_outcomeMean {d : ℕ} (P : FullLaw d) (x : Fin d) (a s : Bool) : arrivedCellMass P x a s * outcomeMean (observedLaw P) x a s = massOf P (fun w => w.X = x ∧ w.A = a ∧ w.S = s ∧ w.R = true ∧ w.Y = true) := by classical let N := massOf P (fun w => w.X = x ∧ w.A = a ∧ w.S = s ∧ w.R = true ∧ w.Y = true) have hN0 : 0 ≤ N := by unfold N massOf apply Finset.sum_nonneg intro w _ split_ifs <;> simp [fullMass] have hND : N ≤ arrivedCellMass P x a s := by unfold N arrivedCellMass massOf apply Finset.sum_le_sum intro w _ by_cases hc : w.X = x ∧ w.A = a ∧ w.S = s ∧ w.R = true ∧ w.Y = true · simp [hc] · simp only [hc, if_false] split_ifs <;> simp [fullMass] rw [outcomeMean_observed] change arrivedCellMass P x a s * (N / arrivedCellMass P x a s) = N by_cases hz : arrivedCellMass P x a s = 0 · have hNz : N = 0 := le_antisymm (hz ▸ hND) hN0 simp [hz, hNz] · field_simp
CausalSmith.Stat.MarNearcompleteFrontier.upper_arrived_mass_mul_outcomeMean · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/FallbackBias.lean:19
theorem upper_fallbackScore_mean

The population fallback score is the arrived part of the centered target. Given the specified input d, the specified input P, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
P :
(∫ o, upper_fallbackScore o ∂(observedLaw P).toMeasure)
= 2 * (∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, treatmentSign a * arrivedCellMass P x a s * cellEta P x a s)
Proof (Lean source)
-- @node: upper_fallbackScore_mean lemma upper_fallbackScore_mean {d : ℕ} (P : FullLaw d) : (∫ o, upper_fallbackScore o ∂(observedLaw P).toMeasure) = 2 * (∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, treatmentSign a * arrivedCellMass P x a s * cellEta P x a s) := by classical rw [PMF.integral_eq_sum] simp only [smul_eq_mul] have hcell (x : Fin d) (a s : Bool) : treatmentSign a * arrivedCellMass P x a s * cellEta P x a s = ∑ o : Obs d, if o.X = x ∧ o.A = a ∧ o.S = s ∧ o.R = true then obsMass (observedLaw P) o * treatmentSign a * ((if o.RY then (1 : ℝ) else 0) - 1 / 2) else 0 := by unfold cellEta rw [mul_sub, mul_assoc (treatmentSign a), upper_arrived_mass_mul_outcomeMean] unfold arrivedCellMass rw [← observed_arrived_outcome_mass, ← observed_arrived_mass] simp only [Finset.mul_sum, Finset.sum_mul, ← Finset.sum_sub_distrib] apply Finset.sum_congr rfl intro o _ by_cases hc : o.X = x ∧ o.A = a ∧ o.S = s ∧ o.R = true · cases hy : o.RY <;> simp [hc, hy] <;> ring · have hn : ¬(o.X = x ∧ o.A = a ∧ o.S = s ∧ o.R = true ∧ o.RY = true) := fun h => hc ⟨h.1, h.2.1, h.2.2.1, h.2.2.2.1⟩ simp [hc, hn] simp_rw [hcell] simp_rw [Finset.sum_comm (s := (Finset.univ : Finset Bool)) (t := (Finset.univ : Finset (Obs d)))] rw [Finset.sum_comm, Finset.mul_sum] apply Finset.sum_congr rfl intro o _ cases hr : o.R <;> cases ha : o.A <;> cases hs : o.S <;> simp [upper_fallbackScore, hr, ha, hs, obsMass, treatmentSign, ← mul_assoc, Finset.sum_ite_eq', and_assoc] <;> ring <;> simp
CausalSmith.Stat.MarNearcompleteFrontier.upper_fallbackScore_mean · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/FallbackBias.lean:50
theorem upper_missing_contrast_abs_le_delta

The missing part of the centered contrast has magnitude at most delta. Given the specified input d, the specified input q, the specified input P, the specified input h, the stated mathematical conclusion holds. Given the specified input hq.

Formal statement
d :
ℕ
q :
ℝ
P :
h :
LawClass d q P
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
|2 * (∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, treatmentSign a * missingCellMass P x a s * cellEta P x a s)|
≤ delta q
Proof (Lean source)
-- @node: upper_missing_contrast_abs_le_delta lemma upper_missing_contrast_abs_le_delta {d : ℕ} {q : ℝ} (P : FullLaw d) (h : LawClass d q P) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) : |2 * (∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, treatmentSign a * missingCellMass P x a s * cellEta P x a s)| ≤ delta q := by have hterm (x : Fin d) (a s : Bool) : |treatmentSign a * missingCellMass P x a s * cellEta P x a s| ≤ missingCellMass P x a s / 2 := by have hw := (missingCellMass_bounds P h hq x a s).1 have he := upper_cellEta_abs_le_half P x a s rw [abs_mul, abs_mul, abs_of_nonneg hw] have hsign : |treatmentSign a| = 1 := by cases a <;> norm_num [treatmentSign] rw [hsign, one_mul, div_eq_mul_one_div] exact mul_le_mul_of_nonneg_left he hw have hs : |∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, treatmentSign a * missingCellMass P x a s * cellEta P x a s| ≤ ∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, missingCellMass P x a s / 2 := by refine (Finset.abs_sum_le_sum_abs _ _).trans ?_ apply Finset.sum_le_sum intro x _ refine (Finset.abs_sum_le_sum_abs _ _).trans ?_ apply Finset.sum_le_sum intro a _ refine (Finset.abs_sum_le_sum_abs _ _).trans ?_ exact Finset.sum_le_sum (fun s _ => hterm x a s) rw [abs_mul, abs_of_nonneg (by norm_num : (0 : ℝ) ≤ 2)] calc _ ≤ 2 * (∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, missingCellMass P x a s / 2) := mul_le_mul_of_nonneg_left hs (by norm_num) _ = ∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, missingCellMass P x a s := by simp only [← Finset.sum_div] ring _ ≤ delta q := sum_missingCellMass_le_delta P h hq
CausalSmith.Stat.MarNearcompleteFrontier.upper_missing_contrast_abs_le_delta · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/FallbackBias.lean:86
theorem upper_fallback_bias_abs_le_delta

The population bias of the fallback estimator is bounded by delta. Given the specified input d, the specified input q, the specified input P, the specified input h, the stated mathematical conclusion holds. Given the specified input hq.

Formal statement
d :
ℕ
q :
ℝ
P :
h :
LawClass d q P
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
|(∫ o, upper_fallbackScore o ∂(observedLaw P).toMeasure) - tau P| ≤ delta q
Proof (Lean source)
-- @node: upper_fallback_bias_abs_le_delta lemma upper_fallback_bias_abs_le_delta {d : ℕ} {q : ℝ} (P : FullLaw d) (h : LawClass d q P) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) : |(∫ o, upper_fallbackScore o ∂(observedLaw P).toMeasure) - tau P| ≤ delta q := by rw [upper_fallbackScore_mean, tau_eq_arrived_missing_cells P h hq] have hid : 2 * (∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, treatmentSign a * arrivedCellMass P x a s * cellEta P x a s) - 2 * (∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, treatmentSign a * (arrivedCellMass P x a s * cellEta P x a s + missingCellMass P x a s * cellEta P x a s)) = -(2 * (∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, treatmentSign a * missingCellMass P x a s * cellEta P x a s)) := by simp only [mul_add, ← mul_assoc, Finset.sum_add_distrib] ring rw [hid, abs_neg] exact upper_missing_contrast_abs_le_delta P h hq
CausalSmith.Stat.MarNearcompleteFrontier.upper_fallback_bias_abs_le_delta · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/FallbackBias.lean:121
theorem upper_fallback_risk_le_delta

The fallback branch has risk at most twice the sampling and missingness budgets. Given the specified input n, the specified input d, the specified input q, the specified input hn, the specified input P, the specified input h, the stated mathematical conclusion holds. Given the specified input hq.

Formal statement
n d :
ℕ
q :
ℝ
hn :
0 < n
P :
h :
LawClass d q P
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
(∫ sample, (fallbackHT sample - tau P) ^ 2 ∂samplePi P n) ≤ 2 / (n : ℝ) + 2 * delta q ^ 2
Proof (Lean source)
-- @node: upper_fallback_risk_le_delta lemma upper_fallback_risk_le_delta {n d : ℕ} {q : ℝ} (hn : 0 < n) (P : FullLaw d) (h : LawClass d q P) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) : (∫ sample, (fallbackHT sample - tau P) ^ 2 ∂samplePi P n) ≤ 2 / (n : ℝ) + 2 * delta q ^ 2 := by have hb := upper_fallback_bias_abs_le_delta P h hq have hd : 0 ≤ delta q := by unfold delta; linarith [hq.2] have hb2 := pow_le_pow_left₀ (abs_nonneg _) hb 2 rw [sq_abs] at hb2 exact (upper_fallback_risk_le_bias hn P).trans (by linarith)
CausalSmith.Stat.MarNearcompleteFrontier.upper_fallback_risk_le_delta · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/FallbackBias.lean:140
theorem upper_large_dimension_risk_rate

When dimension exceeds n log(e+n), the fallback risk is at most twice the rate. Given the specified input n, the specified input d, the specified input q, the specified input hn, the specified input P, the specified input h, the specified input hneq, the specified input n, the stated mathematical conclusion holds. Given the specified input hq, the specified input hd.

Formal statement
n d :
ℕ
q :
ℝ
hn :
0 < n
P :
h :
LawClass d q P
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
hneq :
q ≠ 1
hd :
(n : ℝ) * ell n ≤ d
(∫ sample, (tauhatMM n d q sample - tau P) ^ 2 ∂samplePi P n) ≤ 2 * rate n d q
Proof (Lean source)
-- @node: upper_large_dimension_risk_rate lemma upper_large_dimension_risk_rate {n d : ℕ} {q : ℝ} (hn : 0 < n) (P : FullLaw d) (h : LawClass d q P) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (hneq : q ≠ 1) (hd : (n : ℝ) * ell n ≤ d) : (∫ sample, (tauhatMM n d q sample - tau P) ^ 2 ∂samplePi P n) ≤ 2 * rate n d q := by have hden : 0 < (n : ℝ) * ell n := mul_pos (Nat.cast_pos.mpr hn) (ell_pos_for_normalization n) have hg : gScale n d q = delta q := by unfold gScale rw [min_eq_left ((le_div_iff₀ hden).mpr (by simpa using hd)), mul_one] simp_rw [tauhatMM_fallback n d q _ hneq (inr hd)] have hr := upper_fallback_risk_le_delta hn P h hq simpa only [rate, hg, mul_add, mul_one_div] using hr
CausalSmith.Stat.MarNearcompleteFrontier.upper_large_dimension_risk_rate · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/FallbackBias.lean:152
CausalSmith.Stat.STAT_MarNearcompleteFrontier_Research.Helpers.UpperRisk.FallbackRisk 7 declarations The centered arrived score has second moment at most one.

Sampling risk and the small-log fallback regime

The centered arrived score has second moment at most one. Its empirical mean therefore has parametric sampling error; projection preserves the resulting bias-and-sampling bound. Bounded loss closes the small-log regime uniformly.

def upper_fallbackScore

The centered arrived-outcome score used by the fallback branch. Given the specified input d, the specified input o, the stated mathematical conclusion holds.

Definition (Lean source)
d :
ℕ
o :
Obs d
upper_fallbackScore o :
ℝ
2 * (if o.A then (1 : ℝ) else -1) * (if o.R then (1 : ℝ) else 0) * ((if o.RY then (1 : ℝ) else 0) - 1 / 2)
CausalSmith.Stat.MarNearcompleteFrontier.upper_fallbackScore · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/FallbackRisk.lean:21
theorem upper_fallbackScore_sq_le_one

Every fallback score has squared magnitude at most one. Given the specified input d, the specified input o, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
o :
Obs d
Proof (Lean source)
-- @node: upper_fallbackScore_sq_le_one lemma upper_fallbackScore_sq_le_one {d : ℕ} (o : Obs d) : upper_fallbackScore o ^ 2 ≤ 1 := by cases hA : o.A <;> cases hR : o.R <;> cases hY : o.RY <;> norm_num [upper_fallbackScore, hA, hR, hY]
CausalSmith.Stat.MarNearcompleteFrontier.upper_fallbackScore_sq_le_one · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/FallbackRisk.lean:28
theorem upper_fallbackHT_eq_average

The fallback formula is the projection of the empirical score mean. Given the specified input n, the specified input d, the specified input sample, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
sample :
Fin n → Obs d
fallbackHT sample = clipUnit ((n : ℝ)⁻¹ * ∑ i, upper_fallbackScore (sample i))
Proof (Lean source)
-- @node: upper_fallbackHT_eq_average lemma upper_fallbackHT_eq_average {n d : ℕ} (sample : Fin n → Obs d) : fallbackHT sample = clipUnit ((n : ℝ)⁻¹ * ∑ i, upper_fallbackScore (sample i)) := by simp only [upper_fallbackScore, Finset.mul_sum, fallbackHT] congr 1 apply Finset.sum_congr rfl intro i _ ring
CausalSmith.Stat.MarNearcompleteFrontier.upper_fallbackHT_eq_average · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/FallbackRisk.lean:35
theorem upper_fallback_average_sampling_risk

The iid empirical fallback score mean has sampling error at most one over n. Given the specified input n, the specified input d, the specified input hn, the specified input P, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
hn :
0 < n
P :
(∫ sample, ((n : ℝ)⁻¹ * ∑ i : Fin n, upper_fallbackScore (sample i) - ∫ o, upper_fallbackScore o ∂(observedLaw P).toMeasure) ^ 2 ∂samplePi P n)
≤ 1 / (n : ℝ)
Proof (Lean source)
-- @node: upper_fallback_average_sampling_risk lemma upper_fallback_average_sampling_risk {n d : ℕ} (hn : 0 < n) (P : FullLaw d) : (∫ sample, ((n : ℝ)⁻¹ * ∑ i : Fin n, upper_fallbackScore (sample i) - ∫ o, upper_fallbackScore o ∂(observedLaw P).toMeasure) ^ 2 ∂samplePi P n) ≤ 1 / (n : ℝ) := by have hF : MemLp (upper_fallbackScore (d := d)) 2 (observedLaw P).toMeasure := by apply (memLp_two_iff_integrable_sq (by fun_prop)).mpr exact Integrable.of_finite have hsecond : (∫ o, upper_fallbackScore o ^ 2 ∂(observedLaw P).toMeasure) ≤ 1 := by calc _ ≤ ∫ _ : Obs d, (1 : ℝ) ∂(observedLaw P).toMeasure := integral_mono Integrable.of_finite (integrable_const 1) upper_fallbackScore_sq_le_one _ = 1 := by simp have hi := iid_mean_sq_le (observedLaw P).toMeasure hn upper_fallbackScore hF exact hi.trans (div_le_div_of_nonneg_right hsecond (by positivity))
CausalSmith.Stat.MarNearcompleteFrontier.upper_fallback_average_sampling_risk · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/FallbackRisk.lean:45
theorem upper_fallback_risk_le_bias

Projection and the sampling bound control fallback risk by twice sampling error plus twice its population bias squared. Given the specified input n, the specified input d, the specified input hn, the specified input P, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
hn :
0 < n
P :
(∫ sample, (fallbackHT sample - tau P) ^ 2 ∂samplePi P n)
≤ 2 / (n : ℝ) + 2 * ((∫ o, upper_fallbackScore o ∂(observedLaw P).toMeasure) - tau P) ^ 2
Proof (Lean source)
-- @node: upper_fallback_risk_le_bias lemma upper_fallback_risk_le_bias {n d : ℕ} (hn : 0 < n) (P : FullLaw d) : (∫ sample, (fallbackHT sample - tau P) ^ 2 ∂samplePi P n) ≤ 2 / (n : ℝ) + 2 * ((∫ o, upper_fallbackScore o ∂(observedLaw P).toMeasure) - tau P) ^ 2 := by let : IsProbabilityMeasure (samplePi P n) := by unfold samplePi; infer_instance let b := (∫ o, upper_fallbackScore o ∂(observedLaw P).toMeasure) - tau P let c := ∫ o, upper_fallbackScore o ∂(observedLaw P).toMeasure have hs := upper_fallback_average_sampling_risk hn P calc _ ≤ ∫ sample, (2 * ((n : ℝ)⁻¹ * ∑ i : Fin n, upper_fallbackScore (sample i) - c) ^ 2 + 2 * b ^ 2) ∂samplePi P n := by apply integral_mono Integrable.of_finite Integrable.of_finite intro sample dsimp only rw [upper_fallbackHT_eq_average] have hp := clipUnit_sq_error_le ((n : ℝ)⁻¹ * ∑ i : Fin n, upper_fallbackScore (sample i)) (tau P) (tau_range P) dsimp [b, c] nlinarith [sq_nonneg ((n : ℝ)⁻¹ * ∑ i : Fin n, upper_fallbackScore (sample i) - 2 * c + tau P)] _ = 2 * (∫ sample, ((n : ℝ)⁻¹ * ∑ i : Fin n, upper_fallbackScore (sample i) - c) ^ 2 ∂samplePi P n) + 2 * b ^ 2 := by rw [integral_add Integrable.of_finite (integrable_const _), integral_const_mul] simp _ ≤ 2 * (1 / (n : ℝ)) + 2 * b ^ 2 := add_le_add (mul_le_mul_of_nonneg_left hs (by norm_num : (0 : ℝ) ≤ 2)) le_rfl _ = _ := by dsimp [b]; ring
CausalSmith.Stat.MarNearcompleteFrontier.upper_fallback_risk_le_bias · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/FallbackRisk.lean:65
theorem upper_estimator_risk_le_four

The bounded estimator and target have squared loss at most four. Given the specified input n, the specified input d, the specified input q, the specified input P, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
P :
(∫ sample, (tauhatMM n d q sample - tau P) ^ 2 ∂samplePi P n) ≤ 4
Proof (Lean source)
-- @node: upper_estimator_risk_le_four lemma upper_estimator_risk_le_four {n d : ℕ} (q : ℝ) (P : FullLaw d) : (∫ sample, (tauhatMM n d q sample - tau P) ^ 2 ∂samplePi P n) ≤ 4 := by let : IsProbabilityMeasure (samplePi P n) := by unfold samplePi; infer_instance calc _ ≤ ∫ _ : Fin n → Obs d, (4 : ℝ) ∂samplePi P n := by apply integral_mono Integrable.of_finite (integrable_const _) intro sample have he := tauhatMM_range n d q sample have ht := tau_range P nlinarith [he.1, he.2, ht.1, ht.2] _ = 4 := by simp
CausalSmith.Stat.MarNearcompleteFrontier.upper_estimator_risk_le_four · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/FallbackRisk.lean:97
theorem upper_small_log_risk_rate

When the logarithmic scale is small, bounded loss is already a universal multiple of the inverse-sample-size component of the frontier rate. Given the specified input n, the specified input d, the specified input hn, the specified input q, the specified input P, the specified input hL, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
hn :
0 < n
q :
ℝ
P :
hL :
ell n < 128
(∫ sample, (tauhatMM n d q sample - tau P) ^ 2 ∂samplePi P n)
≤ (4 * exp 128) * rate n d q
Proof (Lean source)
-- @node: upper_small_log_risk_rate lemma upper_small_log_risk_rate {n d : ℕ} (hn : 0 < n) (q : ℝ) (P : FullLaw d) (hL : ell n < 128) : (∫ sample, (tauhatMM n d q sample - tau P) ^ 2 ∂samplePi P n) ≤ (4 * exp 128) * rate n d q := by have hnR : 0 < (n : ℝ) := Nat.cast_pos.mpr hn have hexp : (n : ℝ) < exp 128 := by have h := Real.lt_exp_of_log_lt hL change exp 1 + (n : ℝ) < exp 128 at h linarith [Real.exp_pos 1] have hrate : 1 / (n : ℝ) ≤ rate n d q := by unfold rate linarith [sq_nonneg (gScale n d q)] calc _ ≤ 4 := upper_estimator_risk_le_four q P _ ≤ 4 * exp 128 * (1 / (n : ℝ)) := by rw [mul_one_div, le_div_iff₀ hnR] linarith _ ≤ _ := mul_le_mul_of_nonneg_left hrate (by positivity)
CausalSmith.Stat.MarNearcompleteFrontier.upper_small_log_risk_rate · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/FallbackRisk.lean:111
CausalSmith.Stat.STAT_MarNearcompleteFrontier_Research.Helpers.UpperRisk.LightExponentialBounds 8 declarations The numerical degree and threshold choices turn equation (8) into the small-cell bound (9) and pilot-weighted large-cell decay (11).

Exponential bounds for the light correction

The numerical degree and threshold choices turn equation (8) into the small-cell bound (9) and pilot-weighted large-cell decay (11).

theorem upper_polyDegree_log_upper Lemma upper_polyDegree_log_upper in the paper ↗

Above the fallback cutoff, the degree is at most the logarithmic scale divided by sixty-four. Given the specified input n, the specified input hL, the stated mathematical conclusion holds.

Formal statement
n :
ℕ
hL :
128 ≤ ell n
(polyDegree n : ℝ) ≤ ell n / 64
Proof (Lean source)
-- @node: upper_polyDegree_log_upper lemma upper_polyDegree_log_upper {n : ℕ} (hL : 128 ≤ ell n) : (polyDegree n : ℝ) ≤ ell n / 64 := by have h0 : 0 ≤ ell n / 64 := by linarith have hf := Nat.floor_le h0 unfold polyDegree rw [Nat.cast_max] exact max_le (by norm_num; linarith) hf
CausalSmith.Stat.MarNearcompleteFrontier.upper_polyDegree_log_upper · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/LightExponentialBounds.lean:19

The logarithms of the two fixed numerical bases have simple rational upper bounds. the stated mathematical conclusion holds.

Formal statement
conclusion 1
log 64 ≤ 6
conclusion 2
log 4 ≤ 2
Proof (Lean source)
-- @node: upper_log_bases_le lemma upper_log_bases_le : log 64 ≤ 6 ∧ log 4 ≤ 2 := by have h2 : log 2 ≤ 1 := by have := Real.log_le_sub_one_of_pos (by norm_num : (0 : ℝ) < 2) linarith have h64 : log (64 : ℝ) = 6 * log 2 := by have h := Real.log_pow (2 : ℝ) 6 norm_num at h exact h have h4 : log (4 : ℝ) = 2 * log 2 := by have h := Real.log_pow (2 : ℝ) 2 norm_num at h exact h rw [h64, h4] constructor <;> linarith
theorem upper_sixtyfour_pow_le_exp Lemma upper_sixtyfour_pow_le_exp in the paper ↗

The exponential degree factor in equation (8) is at most exp(6k). Given the specified input k, the stated mathematical conclusion holds.

Formal statement
k :
ℕ
(64 : ℝ) ^ k ≤ exp (6 * (k : ℝ))
Proof (Lean source)
-- @node: upper_sixtyfour_pow_le_exp lemma upper_sixtyfour_pow_le_exp (k : ℕ) : (64 : ℝ) ^ k ≤ exp (6 * (k : ℝ)) := by have h64 : (64 : ℝ) ^ k = exp ((k : ℝ) * log 64) := by rw [Real.exp_nat_mul, Real.exp_log (by norm_num : (0 : ℝ) < 64)] rw [h64] apply Real.exp_le_exp.mpr nlinarith [upper_log_bases_le.1, Nat.cast_nonneg (α := ℝ) k]
CausalSmith.Stat.MarNearcompleteFrontier.upper_sixtyfour_pow_le_exp · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/LightExponentialBounds.lean:48
theorem upper_small_light_growth_le Lemma upper_small_light_growth_le in the paper ↗

In a small cell, the power-growth factor in equation (8) costs at most exp(k); the numerical threshold is much larger than the degree. Given the specified input n, the specified input hL, the specified input z, the specified input hz, the specified input hzB, the stated mathematical conclusion holds.

Formal statement
n :
ℕ
hL :
128 ≤ ell n
z :
ℝ
hz :
0 ≤ z
hzB :
max 1 (((z + (2 * polyDegree n : ℕ)) / polyThreshold n) ^ (2 * polyDegree n))
≤ exp (polyDegree n : ℝ)
Proof (Lean source)
-- @node: upper_small_light_growth_le lemma upper_small_light_growth_le {n : ℕ} (hL : 128 ≤ ell n) {z : ℝ} (hz : 0 ≤ z) (hzB : z ≤ polyThreshold n) : max 1 (((z + (2 * polyDegree n : ℕ)) / polyThreshold n) ^ (2 * polyDegree n)) ≤ exp (polyDegree n : ℝ) := by have hk := upper_polyDegree_log_upper hL have hB : 0 < polyThreshold n := by unfold polyThreshold; linarith have hr0 : 0 ≤ (z + (2 * polyDegree n : ℕ)) / polyThreshold n := by positivity have hr : (z + (2 * polyDegree n : ℕ)) / polyThreshold n ≤ (1 / 2 : ℝ) + 1 := by apply (div_le_iff₀ hB).mpr push_cast unfold polyThreshold at hzB ⊢ linarith have hre : (z + (2 * polyDegree n : ℕ)) / polyThreshold n ≤ exp (1 / 2) := hr.trans (Real.add_one_le_exp _) have hp := pow_le_pow_left₀ hr0 hre (2 * polyDegree n) rw [← Real.exp_nat_mul] at hp have he : ((2 * polyDegree n : ℕ) : ℝ) * (1 / 2 : ℝ) = (polyDegree n : ℝ) := by push_cast ring rw [he] at hp exact max_le (Real.one_le_exp (Nat.cast_nonneg _)) hp
CausalSmith.Stat.MarNearcompleteFrontier.upper_small_light_growth_le · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/LightExponentialBounds.lean:58
theorem upper_streamH_small_second_moment_le

Equation (9), with universal constant one, for the actual fourth-stream light correction. Given the specified input n, the specified input d, the specified input hL, the specified input P, the specified input x, the specified input a, the specified input s, the specified input hzB, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
hL :
128 ≤ ell n
P :
x :
Fin d
a s :
hzB :
streamZ n P x a s ≤ polyThreshold n
(∫ streams, (streamH n d streams x a s) ^ 2 ∂fourStreamLaw n P) ≤ exp (ell n / 8)
Proof (Lean source)
-- @node: upper_streamH_small_second_moment_le lemma upper_streamH_small_second_moment_le {n d : ℕ} (hL : 128 ≤ ell n) (P : FullLaw d) (x : Fin d) (a s : Bool) (hzB : streamZ n P x a s ≤ polyThreshold n) : (∫ streams, (streamH n d streams x a s) ^ 2 ∂fourStreamLaw n P) ≤ exp (ell n / 8) := by have hz : 0 ≤ streamZ n P x a s := by unfold streamZ exact mul_nonneg (by positivity) (arrivedCellMass_nonneg P x a s) have hg := upper_small_light_growth_le hL hz hzB have hk := upper_polyDegree_log_upper hL calc _ ≤ (64 : ℝ) ^ polyDegree n / 2 * max 1 (((streamZ n P x a s + (2 * polyDegree n : ℕ)) / polyThreshold n) ^ (2 * polyDegree n)) := upper_streamH_second_moment_le P x a s _ ≤ (64 : ℝ) ^ polyDegree n * exp (polyDegree n : ℝ) := by have hh := mul_le_mul_of_nonneg_left hg (show 0 ≤ (64 : ℝ) ^ polyDegree n / 2 by positivity) have he := Real.exp_pos (polyDegree n : ℝ) nlinarith [pow_nonneg (by norm_num : (0 : ℝ) ≤ 64) (polyDegree n)] _ ≤ exp (6 * (polyDegree n : ℝ)) * exp (polyDegree n : ℝ) := mul_le_mul_of_nonneg_right (upper_sixtyfour_pow_le_exp _) (Real.exp_pos _).le _ = exp (7 * (polyDegree n : ℝ)) := by rw [← Real.exp_add]; congr 1; ring _ ≤ exp (ell n / 8) := Real.exp_le_exp.mpr (by linarith)
CausalSmith.Stat.MarNearcompleteFrontier.upper_streamH_small_second_moment_le · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/LightExponentialBounds.lean:83
theorem upper_large_light_envelope_le Lemma upper_large_light_envelope_le in the paper ↗

The large-cell polynomial growth is dominated by exp(z/8). This leaves ample decay after multiplying by the pilot lower-tail probability. Given the specified input n, the specified input hL, the specified input z, the specified input hzB, the stated mathematical conclusion holds.

Formal statement
n :
ℕ
hL :
128 ≤ ell n
z :
ℝ
hzB :
(64 : ℝ) ^ polyDegree n * max 1 (((z + (2 * polyDegree n : ℕ)) / polyThreshold n) ^ (2 * polyDegree n))
≤ exp (z / 8)
Proof (Lean source)
-- @node: upper_large_light_envelope_le lemma upper_large_light_envelope_le {n : ℕ} (hL : 128 ≤ ell n) {z : ℝ} (hzB : polyThreshold n ≤ z) : (64 : ℝ) ^ polyDegree n * max 1 (((z + (2 * polyDegree n : ℕ)) / polyThreshold n) ^ (2 * polyDegree n)) ≤ exp (z / 8) := by let k : ℝ := polyDegree n let B : ℝ := polyThreshold n let r : ℝ := (z + 2 * k) / B have hk0 : 0 ≤ k := Nat.cast_nonneg _ have hB : 0 < B := by dsimp [B]; unfold polyThreshold; linarith have hk : k ≤ B / 16384 := by have := upper_polyDegree_log_upper hL dsimp [k, B] unfold polyThreshold linarith have hz : 0 ≤ z := hB.le.trans hzB have h2k : 2 * k ≤ z := by dsimp [B] at hk; nlinarith have hr0 : 0 ≤ r := div_nonneg (by positivity) hB.le have hrB : r * B = z + 2 * k := by dsimp [r] exact div_mul_cancel₀ _ (ne_of_gt hB) have hkr : k * r ≤ z / 8192 := by have hm1 := mul_le_mul_of_nonneg_left h2k hk0 have hm2 := mul_le_mul_of_nonneg_right hk hz have hprod : (k * r - z / 8192) * B ≤ 0 := by nlinarith [mul_nonneg hk0 (show 0 ≤ B from hB.le)] have : k * r - z / 8192 ≤ 0 := nonpos_of_mul_nonpos_left hprod hB linarith have hexponent : 6 * k + 2 * k * r ≤ z / 8 := by have hkz : k ≤ z / 16384 := hk.trans (div_le_div_of_nonneg_right hzB (by norm_num)) linarith have hre : r ≤ exp r := by linarith [Real.add_one_le_exp r] have hp := pow_le_pow_left₀ hr0 hre (2 * polyDegree n) rw [← Real.exp_nat_mul] at hp have heq : ((2 * polyDegree n : ℕ) : ℝ) * r = 2 * k * r := by dsimp [k]; push_cast; ring rw [heq] at hp have hmax : max 1 (r ^ (2 * polyDegree n)) ≤ exp (2 * k * r) := max_le (Real.one_le_exp (by positivity)) hp have hcast : ((2 * polyDegree n : ℕ) : ℝ) = 2 * k := by dsimp [k]; push_cast; rfl simp only [hcast] change (64 : ℝ) ^ polyDegree n * max 1 (r ^ (2 * polyDegree n)) ≤ _ calc _ ≤ (64 : ℝ) ^ polyDegree n * exp (2 * k * r) := mul_le_mul_of_nonneg_left hmax (by positivity) _ ≤ exp (6 * k) * exp (2 * k * r) := mul_le_mul_of_nonneg_right (upper_sixtyfour_pow_le_exp _) (Real.exp_pos _).le _ = exp (6 * k + 2 * k * r) := (Real.exp_add _ _).symm _ ≤ exp (z / 8) := Real.exp_le_exp.mpr hexponent
CausalSmith.Stat.MarNearcompleteFrontier.upper_large_light_envelope_le · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/LightExponentialBounds.lean:111
theorem upper_streamH_large_second_moment_le

The actual light correction's second moment grows slowly enough beyond the threshold to be suppressed by the pilot selection probability. Given the specified input n, the specified input d, the specified input hL, the specified input P, the specified input x, the specified input a, the specified input s, the specified input hzB, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
hL :
128 ≤ ell n
P :
x :
Fin d
a s :
hzB :
polyThreshold n ≤ streamZ n P x a s
(∫ streams, (streamH n d streams x a s) ^ 2 ∂fourStreamLaw n P)
≤ exp (streamZ n P x a s / 8)
Proof (Lean source)
-- @node: upper_streamH_large_second_moment_le lemma upper_streamH_large_second_moment_le {n d : ℕ} (hL : 128 ≤ ell n) (P : FullLaw d) (x : Fin d) (a s : Bool) (hzB : polyThreshold n ≤ streamZ n P x a s) : (∫ streams, (streamH n d streams x a s) ^ 2 ∂fourStreamLaw n P) ≤ exp (streamZ n P x a s / 8) := by apply (upper_streamH_second_moment_le P x a s).trans apply le_trans _ (upper_large_light_envelope_le hL hzB) apply mul_le_mul_of_nonneg_right _ (by positivity) have hp : 0 ≤ (64 : ℝ) ^ polyDegree n := by positivity linarith
CausalSmith.Stat.MarNearcompleteFrontier.upper_streamH_large_second_moment_le · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/LightExponentialBounds.lean:163
theorem upper_streamH_pilot_large_second_moment_le

Equation (11) for the actual light statistic: pilot weighting changes large-cell polynomial growth into exponential decay. Given the specified input n, the specified input d, the specified input hL, the specified input P, the specified input x, the specified input a, the specified input s, the specified input hzB, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
hL :
128 ≤ ell n
P :
x :
Fin d
a s :
hzB :
polyThreshold n ≤ streamZ n P x a s
streamPilotLightProb n P x a s * (∫ streams, (streamH n d streams x a s) ^ 2 ∂fourStreamLaw n P)
≤ exp (-streamZ n P x a s / 8)
Proof (Lean source)
-- @node: upper_streamH_pilot_large_second_moment_le lemma upper_streamH_pilot_large_second_moment_le {n d : ℕ} (hL : 128 ≤ ell n) (P : FullLaw d) (x : Fin d) (a s : Bool) (hzB : polyThreshold n ≤ streamZ n P x a s) : streamPilotLightProb n P x a s * (∫ streams, (streamH n d streams x a s) ^ 2 ∂fourStreamLaw n P) ≤ exp (-streamZ n P x a s / 8) := by have hp0 := (upper_streamPilotLightProb_bounds (n := n) P x a s).1 have hh := upper_streamH_large_second_moment_le hL P x a s hzB have htail := upper_stream_pilot_light_tail (n := n) P x a s have hB : 0 ≤ polyThreshold n := by unfold polyThreshold; linarith calc _ ≤ streamPilotLightProb n P x a s * exp (streamZ n P x a s / 8) := mul_le_mul_of_nonneg_left hh hp0 _ ≤ exp (polyThreshold n * log 4 / 4 - 3 * streamZ n P x a s / 4) * exp (streamZ n P x a s / 8) := mul_le_mul_of_nonneg_right htail (Real.exp_pos _).le _ = exp (polyThreshold n * log 4 / 4 - 3 * streamZ n P x a s / 4 + streamZ n P x a s / 8) := (Real.exp_add _ _).symm _ ≤ exp (-streamZ n P x a s / 8) := by apply Real.exp_le_exp.mpr have := mul_le_mul_of_nonneg_left upper_log_bases_le.2 hB linarith
CausalSmith.Stat.MarNearcompleteFrontier.upper_streamH_pilot_large_second_moment_le · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/LightExponentialBounds.lean:177
CausalSmith.Stat.STAT_MarNearcompleteFrontier_Research.Helpers.UpperRisk.LightSecondMoment 10 declarations Descending factorials and the coefficient budget bound the light correction by a count-power envelope.

Pointwise light-correction second-moment bounds

Descending factorials and the coefficient budget bound the light correction by a count-power envelope. The square envelope holds almost surely for the actual fourth-stream statistic, providing the integrand bound for equation (8).

theorem lightCorrection_abs_le_coeff_sum Lemma lightCorrection_abs_le_coeff_sum in the paper ↗

A centered success count bounded by its containing count yields a coefficient-sum bound for the light correction. Given the specified input n, the specified input C, the specified input U, the specified input hC, the specified input hU0, the specified input hUC, the stated mathematical conclusion holds.

Formal statement
n :
ℕ
C U :
ℝ
hC :
0 ≤ C
hU0 :
0 ≤ U
hUC :
U ≤ C
≤ C / 2 * (∑ t ∈ range (polyDegree n - 1), (|correctionCoeff n (t + 1)| * |shiftedFalling C (t + 1)|))
Proof (Lean source)
lemma lightCorrection_abs_le_coeff_sum (n : ℕ) {C U : ℝ} (hC : 0 ≤ C) (hU0 : 0 ≤ U) (hUC : U ≤ C) : |lightCorrection n C U| ≤ C / 2 * (∑ t ∈ range (polyDegree n - 1), (|correctionCoeff n (t + 1)| * |shiftedFalling C (t + 1)|)) := by have hcenter : |U - C / 2| ≤ C / 2 := by rw [abs_le] constructor <;> linarith calc |lightCorrection n C U| ≤ ∑ t ∈ range (polyDegree n - 1), |correctionCoeff n (t + 1) * (U - C / 2) * shiftedFalling C (t + 1)| := by exact Finset.abs_sum_le_sum_abs _ _ _ ≤ ∑ t ∈ range (polyDegree n - 1), C / 2 * (|correctionCoeff n (t + 1)| * |shiftedFalling C (t + 1)|) := by apply Finset.sum_le_sum intro t ht rw [abs_mul, abs_mul] calc _ = |U - C / 2| * (|correctionCoeff n (t + 1)| * |shiftedFalling C (t + 1)|) := by ring _ ≤ _ := mul_le_mul_of_nonneg_right hcenter (mul_nonneg (abs_nonneg _) (abs_nonneg _)) _ = _ := (Finset.mul_sum _ _ _).symm
CausalSmith.Stat.MarNearcompleteFrontier.lightCorrection_abs_le_coeff_sum · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/LightSecondMoment.lean:21
theorem lightCorrection_sq_le_coeff_sum_sq Lemma lightCorrection_sq_le_coeff_sum_sq in the paper ↗

Squaring the coefficient-sum bound controls a single light correction's second-moment integrand. Given the specified input n, the specified input C, the specified input U, the specified input hC, the specified input hU0, the specified input hUC, the stated mathematical conclusion holds.

Formal statement
n :
ℕ
C U :
ℝ
hC :
0 ≤ C
hU0 :
0 ≤ U
hUC :
U ≤ C
(lightCorrection n C U) ^ 2
≤ (C / 2 * (∑ t ∈ range (polyDegree n - 1), (|correctionCoeff n (t + 1)| * |shiftedFalling C (t + 1)|))) ^ 2
Proof (Lean source)
lemma lightCorrection_sq_le_coeff_sum_sq (n : ℕ) {C U : ℝ} (hC : 0 ≤ C) (hU0 : 0 ≤ U) (hUC : U ≤ C) : (lightCorrection n C U) ^ 2 ≤ (C / 2 * (∑ t ∈ range (polyDegree n - 1), (|correctionCoeff n (t + 1)| * |shiftedFalling C (t + 1)|))) ^ 2 := by have habs := lightCorrection_abs_le_coeff_sum n hC hU0 hUC exact sq_le_sq.mpr (habs.trans (le_abs_self _))
CausalSmith.Stat.MarNearcompleteFrontier.lightCorrection_sq_le_coeff_sum_sq · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/LightSecondMoment.lean:53
theorem upper_centered_shiftedFalling_abs_le Lemma upper_centered_shiftedFalling_abs_le in the paper ↗

A centered success count times the shifted product is at most half the count's descending factorial, including the zero-count case. Given the specified input k, the specified input v, the specified input hv, the specified input U, the specified input hU0, the specified input k, the stated mathematical conclusion holds. Given the specified input hUk.

Formal statement
k v :
ℕ
hv :
1 ≤ v
U :
ℝ
hU0 :
0 ≤ U
hUk :
U ≤ (k : ℝ)
|(U - (k : ℝ) / 2) * shiftedFalling (k : ℝ) v| ≤ (k.descFactorial v : ℝ) / 2
Proof (Lean source)
-- @node: upper_centered_shiftedFalling_abs_le lemma upper_centered_shiftedFalling_abs_le (k v : ℕ) (hv : 1 ≤ v) {U : ℝ} (hU0 : 0 ≤ U) (hUk : U ≤ (k : ℝ)) : |(U - (k : ℝ) / 2) * shiftedFalling (k : ℝ) v| ≤ (k.descFactorial v : ℝ) / 2 := by have hc : |U - (k : ℝ) / 2| ≤ (k : ℝ) / 2 := by rw [abs_le] constructor <;> linarith calc _ = |U - (k : ℝ) / 2| * |shiftedFalling (k : ℝ) v| := abs_mul _ _ _ ≤ ((k : ℝ) / 2) * |shiftedFalling (k : ℝ) v| := mul_le_mul_of_nonneg_right hc (abs_nonneg _) _ = |(k : ℝ) * shiftedFalling (k : ℝ) v| / 2 := by rw [abs_mul] simp only [abs_of_nonneg (show (0 : ℝ) ≤ (k : ℝ) from Nat.cast_nonneg k)] ring _ = (k.descFactorial v : ℝ) / 2 := by rw [upper_shiftedFalling_descFactorial k v hv, abs_of_nonneg (Nat.cast_nonneg _)]
CausalSmith.Stat.MarNearcompleteFrontier.upper_centered_shiftedFalling_abs_le · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/LightSecondMoment.lean:65
theorem upper_lightCorrection_abs_le_factorial_sum Lemma upper_lightCorrection_abs_le_factorial_sum in the paper ↗

The light correction is bounded by half its absolute-coefficient-weighted sum of descending factorials. Given the specified input n, the specified input k, the specified input U, the specified input hU0, the specified input k, the stated mathematical conclusion holds. Given the specified input hUk.

Formal statement
n k :
ℕ
U :
ℝ
hU0 :
0 ≤ U
hUk :
U ≤ (k : ℝ)
|lightCorrection n (k : ℝ) U|
≤ (∑ t ∈ range (polyDegree n - 1), |correctionCoeff n (t + 1)| * (k.descFactorial (t + 1) : ℝ)) / 2
Proof (Lean source)
-- @node: upper_lightCorrection_abs_le_factorial_sum lemma upper_lightCorrection_abs_le_factorial_sum (n k : ℕ) {U : ℝ} (hU0 : 0 ≤ U) (hUk : U ≤ (k : ℝ)) : |lightCorrection n (k : ℝ) U| ≤ (∑ t ∈ range (polyDegree n - 1), |correctionCoeff n (t + 1)| * (k.descFactorial (t + 1) : ℝ)) / 2 := by unfold lightCorrection calc _ ≤ ∑ t ∈ range (polyDegree n - 1), |correctionCoeff n (t + 1) * (U - (k : ℝ) / 2) * shiftedFalling (k : ℝ) (t + 1)| := Finset.abs_sum_le_sum_abs _ _ _ ≤ ∑ t ∈ range (polyDegree n - 1), |correctionCoeff n (t + 1)| * (k.descFactorial (t + 1) : ℝ) / 2 := by apply Finset.sum_le_sum intro t ht rw [mul_assoc, abs_mul] have hb := upper_centered_shiftedFalling_abs_le k (t + 1) (by omega) hU0 hUk simpa only [mul_div_assoc] using mul_le_mul_of_nonneg_left hb (abs_nonneg _) _ = _ := by rw [Finset.sum_div]
CausalSmith.Stat.MarNearcompleteFrontier.upper_lightCorrection_abs_le_factorial_sum · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/LightSecondMoment.lean:87
theorem upper_lightCorrection_abs_le_power_sum Lemma upper_lightCorrection_abs_le_power_sum in the paper ↗

Bounding descending factorials by powers gives the count-power envelope used before taking Poisson moments in equation (8). Given the specified input n, the specified input k, the specified input U, the specified input hU0, the specified input k, the stated mathematical conclusion holds. Given the specified input hUk.

Formal statement
n k :
ℕ
U :
ℝ
hU0 :
0 ≤ U
hUk :
U ≤ (k : ℝ)
|lightCorrection n (k : ℝ) U|
≤ (∑ t ∈ range (polyDegree n - 1), |correctionCoeff n (t + 1)| * (k : ℝ) ^ (t + 1)) / 2
Proof (Lean source)
-- @node: upper_lightCorrection_abs_le_power_sum lemma upper_lightCorrection_abs_le_power_sum (n k : ℕ) {U : ℝ} (hU0 : 0 ≤ U) (hUk : U ≤ (k : ℝ)) : |lightCorrection n (k : ℝ) U| ≤ (∑ t ∈ range (polyDegree n - 1), |correctionCoeff n (t + 1)| * (k : ℝ) ^ (t + 1)) / 2 := by apply (upper_lightCorrection_abs_le_factorial_sum n k hU0 hUk).trans apply div_le_div_of_nonneg_right _ (by norm_num) apply Finset.sum_le_sum intro t ht apply mul_le_mul_of_nonneg_left _ (abs_nonneg _) exact_mod_cast Nat.descFactorial_le_pow k (t + 1)
CausalSmith.Stat.MarNearcompleteFrontier.upper_lightCorrection_abs_le_power_sum · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/LightSecondMoment.lean:111
theorem upper_power_ratio_envelope Lemma upper_power_ratio_envelope in the paper ↗

Powers below a fixed degree are bounded by the larger of one and the highest power of a nonnegative ratio. Given the specified input r, the specified input hr, the specified input v, the specified input K, the specified input hv, the stated mathematical conclusion holds.

Formal statement
r :
ℝ
hr :
0 ≤ r
v K :
ℕ
hv :
v ≤ K
r ^ v ≤ max 1 (r ^ K)
Proof (Lean source)
-- @node: upper_power_ratio_envelope lemma upper_power_ratio_envelope {r : ℝ} (hr : 0 ≤ r) {v K : ℕ} (hv : v ≤ K) : r ^ v ≤ max 1 (r ^ K) := by by_cases hr1 : r ≤ 1 · exact (pow_le_one₀ hr hr1).trans (le_max_left _ _) · exact (pow_le_pow_right₀ (le_of_not_ge hr1) hv).trans (le_max_right _ _)
CausalSmith.Stat.MarNearcompleteFrontier.upper_power_ratio_envelope · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/LightSecondMoment.lean:126
theorem upper_lightCorrection_abs_le_degree_envelope Lemma upper_lightCorrection_abs_le_degree_envelope in the paper ↗

The coefficient budget turns the light correction into a single count-to-threshold power envelope with exponential degree factor. Given the specified input n, the specified input k, the specified input U, the specified input hU0, the specified input k, the stated mathematical conclusion holds. Given the specified input hUk.

Formal statement
n k :
ℕ
U :
ℝ
hU0 :
0 ≤ U
hUk :
U ≤ (k : ℝ)
|lightCorrection n (k : ℝ) U|
≤ (8 : ℝ) ^ polyDegree n / 2 * max 1 (((k : ℝ) / polyThreshold n) ^ polyDegree n)
Proof (Lean source)
-- @node: upper_lightCorrection_abs_le_degree_envelope lemma upper_lightCorrection_abs_le_degree_envelope (n k : ℕ) {U : ℝ} (hU0 : 0 ≤ U) (hUk : U ≤ (k : ℝ)) : |lightCorrection n (k : ℝ) U| ≤ (8 : ℝ) ^ polyDegree n / 2 * max 1 (((k : ℝ) / polyThreshold n) ^ polyDegree n) := by have hB : 0 < polyThreshold n := by have he : 1 < exp (1 : ℝ) + (n : ℝ) := by have he1 := Real.one_lt_exp_iff.mpr (by norm_num : (0 : ℝ) < 1) linarith [Nat.cast_nonneg (α := ℝ) n] have hL : 0 < ell n := Real.log_pos (by simpa [ell] using he) unfold polyThreshold positivity let M := max 1 (((k : ℝ) / polyThreshold n) ^ polyDegree n) have hM : 0 ≤ M := (by norm_num : (0 : ℝ) ≤ 1).trans (le_max_left _ _) have hs : (∑ t ∈ range (polyDegree n - 1), |correctionCoeff n (t + 1)| * (k : ℝ) ^ (t + 1)) ≤ (∑ t ∈ range (polyDegree n - 1), |correctionCoeff n (t + 1)| * polyThreshold n ^ (t + 1)) * M := by rw [Finset.sum_mul] apply Finset.sum_le_sum intro t ht have htK : t + 1 ≤ polyDegree n := by have := Finset.mem_range.mp ht omega have hp := upper_power_ratio_envelope (div_nonneg (Nat.cast_nonneg k) hB.le) htK calc _ = (|correctionCoeff n (t + 1)| * polyThreshold n ^ (t + 1)) * (((k : ℝ) / polyThreshold n) ^ (t + 1)) := by rw [div_pow] field_simp _ ≤ _ := mul_le_mul_of_nonneg_left hp (by positivity) have hb := mul_le_mul_of_nonneg_right (correctionCoeff_weighted_sum_le n) hM calc _ ≤ _ := upper_lightCorrection_abs_le_power_sum n k hU0 hUk _ ≤ ((8 : ℝ) ^ polyDegree n * M) / 2 := by linarith [hs.trans hb] _ = _ := by dsimp [M]; ring
CausalSmith.Stat.MarNearcompleteFrontier.upper_lightCorrection_abs_le_degree_envelope · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/LightSecondMoment.lean:135
theorem upper_lightCorrection_sq_le_degree_envelope Lemma upper_lightCorrection_sq_le_degree_envelope in the paper ↗

Squaring the count-power envelope produces the exponential-degree and power-growth factors of the light second-moment bound. Given the specified input n, the specified input k, the specified input U, the specified input hU0, the specified input k, the stated mathematical conclusion holds. Given the specified input hUk.

Formal statement
n k :
ℕ
U :
ℝ
hU0 :
0 ≤ U
hUk :
U ≤ (k : ℝ)
(lightCorrection n (k : ℝ) U) ^ 2
≤ (64 : ℝ) ^ polyDegree n / 4 * max 1 (((k : ℝ) / polyThreshold n) ^ (2 * polyDegree n))
Proof (Lean source)
-- @node: upper_lightCorrection_sq_le_degree_envelope lemma upper_lightCorrection_sq_le_degree_envelope (n k : ℕ) {U : ℝ} (hU0 : 0 ≤ U) (hUk : U ≤ (k : ℝ)) : (lightCorrection n (k : ℝ) U) ^ 2 ≤ (64 : ℝ) ^ polyDegree n / 4 * max 1 (((k : ℝ) / polyThreshold n) ^ (2 * polyDegree n)) := by have hb := upper_lightCorrection_abs_le_degree_envelope n k hU0 hUk have hs := pow_le_pow_left₀ (abs_nonneg _) hb 2 rw [sq_abs] at hs have hm : (max 1 (((k : ℝ) / polyThreshold n) ^ polyDegree n)) ^ 2 = max 1 (((k : ℝ) / polyThreshold n) ^ (2 * polyDegree n)) := by let r := ((k : ℝ) / polyThreshold n) ^ polyDegree n have hr : 0 ≤ r := by dsimp [r] apply pow_nonneg apply div_nonneg (Nat.cast_nonneg k) have he : 1 < exp (1 : ℝ) + (n : ℝ) := by have he1 := Real.one_lt_exp_iff.mpr (by norm_num : (0 : ℝ) < 1) linarith [Nat.cast_nonneg (α := ℝ) n] have hL : 0 < ell n := Real.log_pos (by simpa [ell] using he) unfold polyThreshold positivity rw [show 2 * polyDegree n = polyDegree n * 2 by omega, pow_mul] change (max 1 r) ^ 2 = max 1 (r ^ 2) by_cases h : 1 ≤ r · rw [max_eq_right h, max_eq_right (by nlinarith)] · rw [max_eq_left (le_of_not_ge h), max_eq_left (by nlinarith)] norm_num have hc : ((8 : ℝ) ^ polyDegree n / 2) ^ 2 = (64 : ℝ) ^ polyDegree n / 4 := by rw [div_pow, ← pow_mul, Nat.mul_comm (polyDegree n) 2, pow_mul] norm_num simpa only [mul_pow, hm, hc] using hs
CausalSmith.Stat.MarNearcompleteFrontier.upper_lightCorrection_sq_le_degree_envelope · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/LightSecondMoment.lean:177
theorem upper_stream_count_support_ae

Almost surely the arrived count is a natural number and the success count lies between zero and that count. Given the specified input n, the specified input d, the specified input P, the specified input x, the specified input a, the specified input s, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
P :
x :
Fin d
a s :
∀ᵐ streams ∂fourStreamLaw n P, ∃ k : ℕ, streamC d streams x a s
= (k : ℝ) ∧ 0 ≤ streamU d streams x a s ∧ streamU d streams x a s ≤ (k : ℝ)
Proof (Lean source)
-- @node: upper_stream_count_support_ae lemma upper_stream_count_support_ae {n d : ℕ} (P : FullLaw d) (x : Fin d) (a s : Bool) : ∀ᵐ streams ∂fourStreamLaw n P, ∃ k : ℕ, streamC d streams x a s = (k : ℝ) ∧ 0 ≤ streamU d streams x a s ∧ streamU d streams x a s ≤ (k : ℝ) := by classical filter_upwards [streamU_eq_arrivedSuccess_ae (n := n) P x a s] with streams hs let z := streams 3 let C := Finset.univ.filter (fun i : Fin z.count => inCell (z.points i) x a s ∧ (z.points i).R = true) let U := Finset.univ.filter (fun i : Fin z.count => inCell (z.points i) x a s ∧ (z.points i).R = true ∧ (z.points i).RY = true) have hC : streamC d streams x a s = (C.card : ℝ) := upper_finiteStreamCount_eq_eventCount z _ have hU : streamU d streams x a s = (U.card : ℝ) := by rw [hs] exact upper_finiteStreamCount_eq_eventCount z _ refine ⟨C.card, hC, ?_, ?_⟩ · rw [hU] positivity · rw [hU] exact_mod_cast (Finset.card_le_card (show U ⊆ C from by intro i hi simp only [U, C, mem_filter, Finset.mem_univ, true_and] at hi ⊢ exact ⟨hi.1, hi.2.1⟩))
CausalSmith.Stat.MarNearcompleteFrontier.upper_stream_count_support_ae · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/LightSecondMoment.lean:213
theorem upper_streamH_sq_le_degree_envelope_ae

The actual light-stream statistic obeys the count-power square envelope almost surely under the ideal experiment. Given the specified input n, the specified input d, the specified input P, the specified input x, the specified input a, the specified input s, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
P :
x :
Fin d
a s :
∀ᵐ streams ∂fourStreamLaw n P, (streamH n d streams x a s) ^ 2
≤ (64 : ℝ) ^ polyDegree n / 4 * max 1 ((streamC d streams x a s / polyThreshold n) ^ (2 * polyDegree n))
Proof (Lean source)
-- @node: upper_streamH_sq_le_degree_envelope_ae lemma upper_streamH_sq_le_degree_envelope_ae {n d : ℕ} (P : FullLaw d) (x : Fin d) (a s : Bool) : ∀ᵐ streams ∂fourStreamLaw n P, (streamH n d streams x a s) ^ 2 ≤ (64 : ℝ) ^ polyDegree n / 4 * max 1 ((streamC d streams x a s / polyThreshold n) ^ (2 * polyDegree n)) := by filter_upwards [upper_stream_count_support_ae (n := n) P x a s] with streams hs obtain ⟨k, hk, hU0, hUk⟩ := hs simpa only [streamH, hk] using upper_lightCorrection_sq_le_degree_envelope n k hU0 hUk
CausalSmith.Stat.MarNearcompleteFrontier.upper_streamH_sq_le_degree_envelope_ae · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/LightSecondMoment.lean:243
CausalSmith.Stat.STAT_MarNearcompleteFrontier_Research.Helpers.UpperRisk.PilotTails 2 declarations The exponential tilt by log 4 gives the light-selection lower tail and the complementary heavy-selection upper tail used in the upper-risk proof.

Poisson tails for pilot selection

The exponential tilt by log 4 gives the light-selection lower tail and the complementary heavy-selection upper tail used in the upper-risk proof.

theorem upper_stream_pilot_light_tail

The light-branch selection probability obeys the Poisson lower-tail estimate at the arrived-cell rate. Given the specified input n, the specified input d, the specified input P, the specified input x, the specified input a, the specified input s, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
P :
x :
Fin d
a s :
≤ exp (polyThreshold n * log 4 / 4 - 3 * streamZ n P x a s / 4)
Proof (Lean source)
lemma upper_stream_pilot_light_tail {n d : ℕ} (P : FullLaw d) (x : Fin d) (a s : Bool) : streamPilotLightProb n P x a s ≤ exp (polyThreshold n * log 4 / 4 - 3 * streamZ n P x a s / 4) := by have hr : ((streamPoissonRate n P x a s : NNReal) : ℝ) = streamZ n P x a s := by unfold streamPoissonRate streamZ change (((n : NNReal) / 8 : NNReal) : ℝ) * arrivedCellMass P x a s = _ rw [NNReal.coe_div, NNReal.coe_natCast, NNReal.coe_ofNat] rw [upper_stream_pilot_light_prob_poisson] simpa only [hr] using poisson_pilot_lower_tail (streamPoissonRate n P x a s) (polyThreshold n)
CausalSmith.Stat.MarNearcompleteFrontier.upper_stream_pilot_light_tail · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/PilotTails.lean:23
theorem upper_stream_pilot_heavy_tail

The heavy-branch selection probability obeys the Poisson upper-tail estimate at the arrived-cell rate. Given the specified input n, the specified input d, the specified input P, the specified input x, the specified input a, the specified input s, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
P :
x :
Fin d
a s :
1 - streamPilotLightProb n P x a s
≤ exp (3 * streamZ n P x a s - polyThreshold n * log 4 / 4)
Proof (Lean source)
lemma upper_stream_pilot_heavy_tail {n d : ℕ} (P : FullLaw d) (x : Fin d) (a s : Bool) : 1 - streamPilotLightProb n P x a s ≤ exp (3 * streamZ n P x a s - polyThreshold n * log 4 / 4) := by have hr : ((streamPoissonRate n P x a s : NNReal) : ℝ) = streamZ n P x a s := by unfold streamPoissonRate streamZ change (((n : NNReal) / 8 : NNReal) : ℝ) * arrivedCellMass P x a s = _ rw [NNReal.coe_div, NNReal.coe_natCast, NNReal.coe_ofNat] let A : Set ℕ := {k : ℕ | (k : ℝ) ≤ polyThreshold n / 4} have hA : MeasurableSet A := by exact measurableSet_le (measurable_of_countable _) measurable_const have hcomp : Aᶜ = {k : ℕ | polyThreshold n / 4 < (k : ℝ)} := by ext k simp only [A, Set.mem_compl_iff, Set.mem_ofPred_eq, not_le] have hp := upper_stream_pilot_light_prob_poisson (n := n) P x a s have hprob : 1 - (poissonMeasure (streamPoissonRate n P x a s)).real A = (poissonMeasure (streamPoissonRate n P x a s)).real Aᶜ := by rw [measureReal_compl hA, probReal_univ] calc 1 - streamPilotLightProb n P x a s = (poissonMeasure (streamPoissonRate n P x a s)).real {k : ℕ | polyThreshold n / 4 < (k : ℝ)} := by rw [hp] change 1 - (poissonMeasure (streamPoissonRate n P x a s)).real A = _ rw [hprob, hcomp] _ ≤ exp (3 * ((streamPoissonRate n P x a s : NNReal) : ℝ) - polyThreshold n * log 4 / 4) := poisson_pilot_upper_tail (streamPoissonRate n P x a s) (polyThreshold n) _ = exp (3 * streamZ n P x a s - polyThreshold n * log 4 / 4) := by rw [hr]
CausalSmith.Stat.MarNearcompleteFrontier.upper_stream_pilot_heavy_tail · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/PilotTails.lean:40
CausalSmith.Stat.STAT_MarNearcompleteFrontier_Research.Helpers.UpperRisk.StreamAggregateVariance 3 declarations Independence of distinct cells turns the selected cell variance sum into the variance of the signed correction aggregate.

Aggregate correction variance and nonfallback risk

Independence of distinct cells turns the selected cell variance sum into the variance of the signed correction aggregate. This finishes the nonfallback risk budget.

theorem upper_streamCorrectionSum_variance_eq

Independence across cells identifies aggregate signed correction variance with the sum of individual selected-product variances. Given the specified input n, the specified input d, the specified input hn, the specified input P, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
hn :
0 < n
P :
variance (fun streams => ∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, treatmentSign a * streamCellCorrection n d streams x a s) (fourStreamLaw n P)
= ∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, variance (fun streams => streamV n d streams x a s * streamG n d streams x a s) (fourStreamLaw n P)
Proof (Lean source)
-- @node: upper_streamCorrectionSum_variance_eq lemma upper_streamCorrectionSum_variance_eq {n d : ℕ} (hn : 0 < n) (P : FullLaw d) : variance (fun streams => ∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, treatmentSign a * streamCellCorrection n d streams x a s) (fourStreamLaw n P) = ∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, variance (fun streams => streamV n d streams x a s * streamG n d streams x a s) (fourStreamLaw n P) := by let X : (Fin d × Bool × Bool) → (Fin 4 → FiniteSample (Obs d)) → ℝ := fun j streams => treatmentSign j.2.1 * streamCellCorrection n d streams j.1 j.2.1 j.2.2 have hm (j : Fin d × Bool × Bool) : MemLp (X j) 2 (fourStreamLaw n P) := (upper_streamVG_memLp_two hn P j.1 j.2.1 j.2.2).const_mul _ have hi : Pairwise (↑(Finset.univ : Finset (Fin d × Bool × Bool))) (fun j k => IndepFun (X j) (X k) (fourStreamLaw n P)) := by intro j hj k hk hjk exact (upper_streamCellCorrection_indepFun P hjk).comp (measurable_const.mul measurable_id) (measurable_const.mul measurable_id) have hv := IndepFun.variance_sum (fun j _ => hm j) hi have hs (j : Fin d × Bool × Bool) : variance (X j) (fourStreamLaw n P) = variance (fun streams => streamV n d streams j.1 j.2.1 j.2.2 * streamG n d streams j.1 j.2.1 j.2.2) (fourStreamLaw n P) := by dsimp [X, streamCellCorrection] rw [variance_const_mul] have hsign : (treatmentSign j.2.1) ^ 2 = 1 := by cases j.2.1 <;> norm_num [treatmentSign] rw [hsign, one_mul] simp only [hs, Fintype.sum_prod_type] at hv simpa only [X, Finset.sum_fn, Finset.sum_apply] using hv
CausalSmith.Stat.MarNearcompleteFrontier.upper_streamCorrectionSum_variance_eq · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamAggregateVariance.lean:18
theorem upper_streamCorrectionSum_variance_rate

The signed aggregate satisfies the universal selected-cell variance budget. Given the specified input n, the specified input d, the specified input q, the specified input hn, the specified input hL, the specified input d, the specified input n, the specified input P, the specified input h, the stated mathematical conclusion holds. Given the specified input hd, the specified input hq.

Formal statement
n d :
ℕ
q :
ℝ
hn :
0 < n
hL :
128 ≤ ell n
hd :
(d : ℝ) < (n : ℝ) * ell n
P :
h :
LawClass d q P
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
variance (fun streams => ∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, treatmentSign a * streamCellCorrection n d streams x a s) (fourStreamLaw n P)
≤ ((201719808 : ℝ) ^ 2 * ((720 * (4 / 3 : ℝ) ^ 6) * (exp 1 + 1)) + 119) * rate n d q
Proof (Lean source)
-- @node: upper_streamCorrectionSum_variance_rate lemma upper_streamCorrectionSum_variance_rate {n d : ℕ} {q : ℝ} (hn : 0 < n) (hL : 128 ≤ ell n) (hd : (d : ℝ) < (n : ℝ) * ell n) (P : FullLaw d) (h : LawClass d q P) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) : variance (fun streams => ∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, treatmentSign a * streamCellCorrection n d streams x a s) (fourStreamLaw n P) ≤ ((201719808 : ℝ) ^ 2 * ((720 * (4 / 3 : ℝ) ^ 6) * (exp 1 + 1)) + 119) * rate n d q := by rw [upper_streamCorrectionSum_variance_eq hn P] have hv := upper_streamVG_variance_sum_rate hn hL P h hq rw [upper_nonfallback_rate_eq hn hL q hd] have hc : 0 ≤ (201719808 : ℝ) ^ 2 * ((720 * (4 / 3 : ℝ) ^ 6) * (exp 1 + 1)) := by positivity have hi : 0 ≤ 1 / (n : ℝ) := by positivity have hx := sq_nonneg (delta q * (d : ℝ) / ((n : ℝ) * ell n)) simp only [div_eq_mul_inv, one_mul] at hv hc hi hx ⊢ nlinarith only [hv, hx, hi, mul_nonneg hc hx]
CausalSmith.Stat.MarNearcompleteFrontier.upper_streamCorrectionSum_variance_rate · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamAggregateVariance.lean:49
theorem upper_nonfallback_risk_rate

The nonfallback estimator has a universal risk constant after the cross-cell variance, projection, capping, and averaging budgets are combined. Given the specified input n, the specified input d, the specified input q, the specified input hn, the specified input P, the specified input h, the specified input hqne, the specified input d, the specified input n, the stated mathematical conclusion holds. Given the specified input hq, the specified input hreg.

Formal statement
n d :
ℕ
q :
ℝ
hn :
0 < n
P :
h :
LawClass d q P
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
hqne :
q ≠ 1
hreg :
¬(ell n < 128 ∨ (d : ℝ) ≥ (n : ℝ) * ell n)
(∫ sample, (tauhatMM n d q sample - tau P) ^ 2 ∂samplePi P n)
≤ (8 * ((201719808 : ℝ) ^ 2 * ((720 * (4 / 3 : ℝ) ^ 6) * (exp 1 + 1)) + 119) + 2 * (268435456 : ℝ) ^ 2 + 104) * rate n d q
Proof (Lean source)
-- @node: upper_nonfallback_risk_rate lemma upper_nonfallback_risk_rate {n d : ℕ} {q : ℝ} (hn : 0 < n) (P : FullLaw d) (h : LawClass d q P) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (hqne : q ≠ 1) (hreg : ¬(ell n < 128 ∨ (d : ℝ) ≥ (n : ℝ) * ell n)) : (∫ sample, (tauhatMM n d q sample - tau P) ^ 2 ∂samplePi P n) ≤ (8 * ((201719808 : ℝ) ^ 2 * ((720 * (4 / 3 : ℝ) ^ 6) * (exp 1 + 1)) + 119) + 2 * (268435456 : ℝ) ^ 2 + 104) * rate n d q := by have hL : 128 ≤ ell n := le_of_not_gt (fun hh => hreg (inl hh)) have hd : (d : ℝ) < (n : ℝ) * ell n := lt_of_not_ge (fun hh => hreg (inr hh)) have ha := upper_nonfallback_risk_le_aggregate hn P h hq hqne hreg have hv := upper_streamCorrectionSum_variance_rate hn hL hd P h hq linarith
CausalSmith.Stat.MarNearcompleteFrontier.upper_nonfallback_risk_rate · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamAggregateVariance.lean:68
CausalSmith.Stat.STAT_MarNearcompleteFrontier_Research.Helpers.UpperRisk.StreamBiasAlgebra 4 declarations The signed treatment contrast in equation (14) is controlled by a weighted sum of cellwise correction biases.

Deterministic aggregation of the pilot correction bias

The signed treatment contrast in equation (14) is controlled by a weighted sum of cellwise correction biases.

theorem upper_cellEta_abs_le_half

A centered Bernoulli outcome regression has absolute value at most one half. Given the specified input d, the specified input P, the specified input x, the specified input a, the specified input s, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
P :
x :
Fin d
a s :
|cellEta P x a s| ≤ 1 / 2
Proof (Lean source)
lemma upper_cellEta_abs_le_half {d : ℕ} (P : FullLaw d) (x : Fin d) (a s : Bool) : |cellEta P x a s| ≤ 1 / 2 := by classical let N : ℝ := ∑ o : Obs d, if o.X = x ∧ o.A = a ∧ o.S = s ∧ o.R = true ∧ o.RY = true then obsMass (observedLaw P) o else 0 let D : ℝ := ∑ o : Obs d, if o.X = x ∧ o.A = a ∧ o.S = s ∧ o.R = true then obsMass (observedLaw P) o else 0 have hN : 0 ≤ N := by apply Finset.sum_nonneg intro o ho split_ifs <;> simp [obsMass] have hD : 0 ≤ D := by apply Finset.sum_nonneg intro o ho split_ifs <;> simp [obsMass] have hND : N ≤ D := by apply Finset.sum_le_sum intro o ho by_cases hn : o.X = x ∧ o.A = a ∧ o.S = s ∧ o.R = true ∧ o.RY = true · simp [hn] · simp only [hn, if_false] split_ifs <;> simp [obsMass] have hratio0 : 0 ≤ N / D := div_nonneg hN hD have hratio1 : N / D ≤ 1 := by by_cases hDz : D = 0 · have hNz : N = 0 := le_antisymm (hDz ▸ hND) hN simp [hNz, hDz] · exact (div_le_one (lt_of_le_of_ne hD (Ne.symm hDz))).2 hND change |N / D - 1 / 2| ≤ 1 / 2 rw [abs_le] constructor <;> linarith
CausalSmith.Stat.MarNearcompleteFrontier.upper_cellEta_abs_le_half · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamBiasAlgebra.lean:20
theorem upper_streamPilotLightProb_bounds

The light-branch pilot selection probability lies in the unit interval. Given the specified input n, the specified input d, the specified input P, the specified input x, the specified input a, the specified input s, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
P :
x :
Fin d
a s :
streamPilotLightProb n P x a s ∈ Icc 0 1
Proof (Lean source)
lemma upper_streamPilotLightProb_bounds {n d : ℕ} (P : FullLaw d) (x : Fin d) (a s : Bool) : streamPilotLightProb n P x a s ∈ Icc 0 1 := by classical let Q := (observedLaw P).toMeasure have hμ : fourStreamLaw n P = Measure.pi (fun i : Fin 4 => finitePoissonSampleLaw Q ((n : NNReal) / 2 * uniformFourMass i)) := by unfold fourStreamLaw Q exact Causalean.Stat.FiniteRaoBlackwell.Poisson.FinitePartition.labeledStreamLaw_eq_independent _ _ _ _ letI : IsProbabilityMeasure (fourStreamLaw n P) := by rw [hμ] infer_instance unfold streamPilotLightProb exact ⟨measureReal_nonneg, measureReal_le_one⟩
CausalSmith.Stat.MarNearcompleteFrontier.upper_streamPilotLightProb_bounds · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamBiasAlgebra.lean:57
theorem upper_stream_pilot_bias_cell_abs_le

The absolute bias of one pilot-selected correction is bounded by its light Chebyshev remainder and heavy empty-count remainder. Given the specified input n, the specified input d, the specified input q, the specified input P, the specified input h, the specified input x, the specified input a, the specified input s, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
P :
h :
LawClass d q P
x :
Fin d
a s :
|(∫ streams, streamG n d streams x a s ∂fourStreamLaw n P) - cellEta P x a s|
≤ (1 / 2 : ℝ) * (streamPilotLightProb n P x a s * |(qPoly n).eval (streamZ n P x a s)| + (1 - streamPilotLightProb n P x a s) * exp (-(streamZ n P x a s)))
Proof (Lean source)
lemma upper_stream_pilot_bias_cell_abs_le {n d : ℕ} {q : ℝ} (P : FullLaw d) (h : LawClass d q P) (x : Fin d) (a s : Bool) : |(∫ streams, streamG n d streams x a s ∂fourStreamLaw n P) - cellEta P x a s| ≤ (1 / 2 : ℝ) * (streamPilotLightProb n P x a s * |(qPoly n).eval (streamZ n P x a s)| + (1 - streamPilotLightProb n P x a s) * exp (-(streamZ n P x a s))) := by have hp := upper_streamPilotLightProb_bounds (n := n) P x a s have hη := upper_cellEta_abs_le_half P x a s have hpn : 0 ≤ 1 - streamPilotLightProb n P x a s := sub_nonneg.mpr hp.2 have hexp : 0 ≤ exp (-(streamZ n P x a s)) := Real.exp_pos _ |>.le have hrhs : 0 ≤ streamPilotLightProb n P x a s * |(qPoly n).eval (streamZ n P x a s)| + (1 - streamPilotLightProb n P x a s) * exp (-(streamZ n P x a s)) := add_nonneg (mul_nonneg hp.1 (abs_nonneg _)) (mul_nonneg hpn hexp) rw [upper_stream_pilot_bias P h x a s, abs_mul, abs_neg] calc |cellEta P x a s| * |streamPilotLightProb n P x a s * (qPoly n).eval (streamZ n P x a s) + (1 - streamPilotLightProb n P x a s) * exp (-(streamZ n P x a s))| ≤ |cellEta P x a s| * (streamPilotLightProb n P x a s * |(qPoly n).eval (streamZ n P x a s)| + (1 - streamPilotLightProb n P x a s) * exp (-(streamZ n P x a s))) := by apply mul_le_mul_of_nonneg_left _ (abs_nonneg _) calc |streamPilotLightProb n P x a s * (qPoly n).eval (streamZ n P x a s) + (1 - streamPilotLightProb n P x a s) * exp (-(streamZ n P x a s))| ≤ |streamPilotLightProb n P x a s * (qPoly n).eval (streamZ n P x a s)| + |(1 - streamPilotLightProb n P x a s) * exp (-(streamZ n P x a s))| := abs_add_le _ _ _ = streamPilotLightProb n P x a s * |(qPoly n).eval (streamZ n P x a s)| + (1 - streamPilotLightProb n P x a s) * exp (-(streamZ n P x a s)) := by rw [abs_mul, abs_mul, abs_of_nonneg hp.1, abs_of_nonneg hpn, abs_of_nonneg hexp] _ ≤ (1 / 2 : ℝ) * (streamPilotLightProb n P x a s * |(qPoly n).eval (streamZ n P x a s)| + (1 - streamPilotLightProb n P x a s) * exp (-(streamZ n P x a s))) := mul_le_mul_of_nonneg_right hη hrhs
CausalSmith.Stat.MarNearcompleteFrontier.upper_stream_pilot_bias_cell_abs_le · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamBiasAlgebra.lean:76
theorem upper_stream_pilot_bias_abs_sum_le

The signed aggregate pilot bias is bounded by the missing-mass-weighted sum of the absolute cell biases. Given the specified input n, the specified input d, the specified input q, the specified input P, the specified input h, the stated mathematical conclusion holds. Given the specified input hq.

Formal statement
n d :
ℕ
q :
ℝ
P :
h :
LawClass d q P
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
|2 * (∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, (treatmentSign a * missingCellMass P x a s * ((∫ streams, streamG n d streams x a s ∂fourStreamLaw n P) - cellEta P x a s)))|
≤ 2 * (∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, (missingCellMass P x a s * |(∫ streams, streamG n d streams x a s ∂fourStreamLaw n P) - cellEta P x a s|))
Proof (Lean source)
lemma upper_stream_pilot_bias_abs_sum_le {n d : ℕ} {q : ℝ} (P : FullLaw d) (h : LawClass d q P) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) : |2 * (∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, (treatmentSign a * missingCellMass P x a s * ((∫ streams, streamG n d streams x a s ∂fourStreamLaw n P) - cellEta P x a s)))| ≤ 2 * (∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, (missingCellMass P x a s * |(∫ streams, streamG n d streams x a s ∂fourStreamLaw n P) - cellEta P x a s|)) := by rw [abs_mul, abs_of_nonneg (by norm_num : (0 : ℝ) ≤ 2)] apply mul_le_mul_of_nonneg_left _ (by norm_num) calc |∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, treatmentSign a * missingCellMass P x a s * ((∫ streams, streamG n d streams x a s ∂fourStreamLaw n P) - cellEta P x a s)| ≤ ∑ x : Fin d, |∑ a : Bool, ∑ s : Bool, treatmentSign a * missingCellMass P x a s * ((∫ streams, streamG n d streams x a s ∂fourStreamLaw n P) - cellEta P x a s)| := Finset.abs_sum_le_sum_abs _ _ _ ≤ ∑ x : Fin d, ∑ a : Bool, |∑ s : Bool, treatmentSign a * missingCellMass P x a s * ((∫ streams, streamG n d streams x a s ∂fourStreamLaw n P) - cellEta P x a s)| := by apply Finset.sum_le_sum intro x hx exact Finset.abs_sum_le_sum_abs _ _ _ ≤ ∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, |treatmentSign a * missingCellMass P x a s * ((∫ streams, streamG n d streams x a s ∂fourStreamLaw n P) - cellEta P x a s)| := by apply Finset.sum_le_sum intro x hx apply Finset.sum_le_sum intro a ha exact Finset.abs_sum_le_sum_abs _ _ _ = ∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, missingCellMass P x a s * |(∫ streams, streamG n d streams x a s ∂fourStreamLaw n P) - cellEta P x a s| := by apply Finset.sum_congr rfl intro x hx apply Finset.sum_congr rfl intro a ha apply Finset.sum_congr rfl intro s hs have hw : 0 ≤ missingCellMass P x a s := (missingCellMass_bounds P h hq x a s).1 simp only [abs_mul, abs_of_nonneg hw] unfold treatmentSign cases a <;> simp
CausalSmith.Stat.MarNearcompleteFrontier.upper_stream_pilot_bias_abs_sum_le · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamBiasAlgebra.lean:134
CausalSmith.Stat.STAT_MarNearcompleteFrontier_Research.Helpers.UpperRisk.StreamBiasRates 5 declarations The arrival-floor comparison converts the Chebyshev quotient rate bound into a missing-mass-weighted cell estimate for equation (13).

Small-cell pilot bias rate bounds

The arrival-floor comparison converts the Chebyshev quotient rate bound into a missing-mass-weighted cell estimate for equation (13).

theorem upper_small_cell_missing_qPoly_le

In a light-rate cell, missing mass times the Chebyshev remainder is controlled by the arrival floor and the quotient rate bound. Given the specified input n, the specified input d, the specified input q, the specified input hn, the specified input P, the specified input h, the specified input x, the specified input a, the specified input s, the specified input hzB, the stated mathematical conclusion holds. Given the specified input hq.

Formal statement
n d :
ℕ
q :
ℝ
hn :
0 < n
P :
h :
LawClass d q P
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
x :
Fin d
a s :
hzB :
streamZ n P x a s ≤ polyThreshold n
missingCellMass P x a s * (qPoly n).eval (streamZ n P x a s)
≤ (2 * delta q / ((n : ℝ) / 8)) * (polyThreshold n / (polyDegree n : ℝ) ^ 2)
Proof (Lean source)
lemma upper_small_cell_missing_qPoly_le {n d : ℕ} {q : ℝ} (hn : 0 < n) (P : FullLaw d) (h : LawClass d q P) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (x : Fin d) (a s : Bool) (hzB : streamZ n P x a s ≤ polyThreshold n) : missingCellMass P x a s * (qPoly n).eval (streamZ n P x a s) ≤ (2 * delta q / ((n : ℝ) / 8)) * (polyThreshold n / (polyDegree n : ℝ) ^ 2) := by have hnR : 0 < (n : ℝ) / 8 := by exact div_pos (by exact_mod_cast hn) (by norm_num) have hnOne : 1 ≤ n := hn have hδ : 0 ≤ delta q := by unfold delta linarith [hq.2] have hB : 0 < polyThreshold n := by have he : 1 < exp (1 : ℝ) + (n : ℝ) := by have hexp : 1 < exp (1 : ℝ) := Real.one_lt_exp_iff.mpr (by norm_num) linarith [hexp, (Nat.cast_nonneg n : (0 : ℝ) ≤ (n : ℝ))] have hell : 0 < ell n := Real.log_pos (by simpa [ell] using he) unfold polyThreshold positivity have hk : 0 < (polyDegree n : ℝ) := by exact_mod_cast (show 0 < polyDegree n by unfold polyDegree; omega) have hb := missingCellMass_bounds P h hq x a s by_cases hz : streamZ n P x a s = 0 · have ha : arrivedCellMass P x a s = 0 := by unfold streamZ at hz exact (mul_eq_zero.mp hz).resolve_left (ne_of_gt hnR) have hw : missingCellMass P x a s = 0 := by have := hb.2.2 rw [ha, mul_zero] at this exact le_antisymm this hb.1 rw [hw, zero_mul] exact mul_nonneg (div_nonneg (mul_nonneg (by norm_num) hδ) hnR.le) (div_nonneg hB.le (sq_nonneg _)) · have hzpos : 0 < streamZ n P x a s := by have hznonneg : 0 ≤ streamZ n P x a s := by unfold streamZ exact mul_nonneg hnR.le (arrivedCellMass_nonneg P x a s) exact lt_of_le_of_ne hznonneg (Ne.symm hz) have hq0 := upper_qPoly_nonneg_on_positive hnOne hzpos hzB have hzq := upper_z_mul_qPoly_le hnOne hzpos hzB calc missingCellMass P x a s * (qPoly n).eval (streamZ n P x a s) ≤ (2 * delta q * arrivedCellMass P x a s) * (qPoly n).eval (streamZ n P x a s) := mul_le_mul_of_nonneg_right hb.2.2 hq0 _ = (2 * delta q / ((n : ℝ) / 8)) * (streamZ n P x a s * (qPoly n).eval (streamZ n P x a s)) := by unfold streamZ field_simp [ne_of_gt hnR] _ ≤ (2 * delta q / ((n : ℝ) / 8)) * (polyThreshold n / (polyDegree n : ℝ) ^ 2) := mul_le_mul_of_nonneg_left hzq (div_nonneg (mul_nonneg (by norm_num) hδ) hnR.le)
CausalSmith.Stat.MarNearcompleteFrontier.upper_small_cell_missing_qPoly_le · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamBiasRates.lean:19
theorem upper_polyDegree_log_lower Lemma upper_polyDegree_log_lower in the paper ↗

In the nonfallback regime the polynomial degree is at least one hundred twenty-eighth of the logarithmic sample scale. Given the specified input n, the specified input hL, the stated mathematical conclusion holds.

Formal statement
n :
ℕ
hL :
128 ≤ ell n
ell n / 128 ≤ (polyDegree n : ℝ)
Proof (Lean source)
lemma upper_polyDegree_log_lower {n : ℕ} (hL : 128 ≤ ell n) : ell n / 128 ≤ (polyDegree n : ℝ) := by have hf := Nat.lt_floor_add_one (ell n / 64) have hm : (floor (ell n / 64) : ℝ) ≤ (polyDegree n : ℝ) := by exact_mod_cast (show floor (ell n / 64) ≤ polyDegree n from le_max_right _ _) linarith
CausalSmith.Stat.MarNearcompleteFrontier.upper_polyDegree_log_lower · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamBiasRates.lean:80
theorem upper_polyThreshold_degree_rate Lemma upper_polyThreshold_degree_rate in the paper ↗

The threshold-to-squared-degree ratio has the inverse logarithmic rate used in the light-cell bias calculation. Given the specified input n, the specified input hL, the stated mathematical conclusion holds.

Formal statement
n :
ℕ
hL :
128 ≤ ell n
polyThreshold n / (polyDegree n : ℝ) ^ 2 ≤ 4194304 / ell n
Proof (Lean source)
lemma upper_polyThreshold_degree_rate {n : ℕ} (hL : 128 ≤ ell n) : polyThreshold n / (polyDegree n : ℝ) ^ 2 ≤ 4194304 / ell n := by have hLpos : 0 < ell n := by linarith have hk := upper_polyDegree_log_lower hL have hkpos : 0 < (polyDegree n : ℝ) := by linarith have hsq : (ell n / 128) ^ 2 ≤ (polyDegree n : ℝ) ^ 2 := pow_le_pow_left₀ (by positivity) hk 2 rw [div_le_div_iff₀ (sq_pos_of_pos hkpos) hLpos] unfold polyThreshold nlinarith
CausalSmith.Stat.MarNearcompleteFrontier.upper_polyThreshold_degree_rate · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamBiasRates.lean:91
theorem upper_small_cell_missing_abs_qPoly_le

The light-cell remainder bound also holds in absolute value, including null arrived cells where the missing mass vanishes. Given the specified input n, the specified input d, the specified input q, the specified input hn, the specified input P, the specified input h, the specified input x, the specified input a, the specified input s, the specified input hzB, the stated mathematical conclusion holds. Given the specified input hq.

Formal statement
n d :
ℕ
q :
ℝ
hn :
0 < n
P :
h :
LawClass d q P
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
x :
Fin d
a s :
hzB :
streamZ n P x a s ≤ polyThreshold n
missingCellMass P x a s * |(qPoly n).eval (streamZ n P x a s)|
≤ (2 * delta q / ((n : ℝ) / 8)) * (polyThreshold n / (polyDegree n : ℝ) ^ 2)
Proof (Lean source)
lemma upper_small_cell_missing_abs_qPoly_le {n d : ℕ} {q : ℝ} (hn : 0 < n) (P : FullLaw d) (h : LawClass d q P) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (x : Fin d) (a s : Bool) (hzB : streamZ n P x a s ≤ polyThreshold n) : missingCellMass P x a s * |(qPoly n).eval (streamZ n P x a s)| ≤ (2 * delta q / ((n : ℝ) / 8)) * (polyThreshold n / (polyDegree n : ℝ) ^ 2) := by by_cases hz : streamZ n P x a s = 0 · have hm : 0 < (n : ℝ) / 8 := by positivity have ha : arrivedCellMass P x a s = 0 := by unfold streamZ at hz exact (mul_eq_zero.mp hz).resolve_left (ne_of_gt hm) have hb := missingCellMass_bounds P h hq x a s have hw : missingCellMass P x a s = 0 := by have hb' := hb.2.2 rw [ha, mul_zero] at hb' exact le_antisymm hb' hb.1 simpa only [hw, zero_mul] using upper_small_cell_missing_qPoly_le hn P h hq x a s hzB · have hzpos : 0 < streamZ n P x a s := by have hnonneg : 0 ≤ streamZ n P x a s := by unfold streamZ exact mul_nonneg (by positivity) (arrivedCellMass_nonneg P x a s) exact lt_of_le_of_ne hnonneg (Ne.symm hz) rw [abs_of_nonneg (upper_qPoly_nonneg_on_positive hn hzpos hzB)] exact upper_small_cell_missing_qPoly_le hn P h hq x a s hzB
CausalSmith.Stat.MarNearcompleteFrontier.upper_small_cell_missing_abs_qPoly_le · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamBiasRates.lean:105
theorem upper_small_cell_pilot_bias_sum_rate

The light-rate cells' pilot-weighted Chebyshev remainders sum to a universal multiple of delta times alphabet size divided by n log(e+n). Given the specified input n, the specified input d, the specified input q, the specified input hn, the specified input hL, the specified input P, the specified input h, the stated mathematical conclusion holds. Given the specified input hq.

Formal statement
n d :
ℕ
q :
ℝ
hn :
0 < n
hL :
128 ≤ ell n
P :
h :
LawClass d q P
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
(∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, if streamZ n P x a s ≤ polyThreshold n then missingCellMass P x a s * streamPilotLightProb n P x a s * |(qPoly n).eval (streamZ n P x a s)| else 0)
≤ 268435456 * (delta q * (d : ℝ) / ((n : ℝ) * ell n))
Proof (Lean source)
lemma upper_small_cell_pilot_bias_sum_rate {n d : ℕ} {q : ℝ} (hn : 0 < n) (hL : 128 ≤ ell n) (P : FullLaw d) (h : LawClass d q P) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) : (∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, if streamZ n P x a s ≤ polyThreshold n then missingCellMass P x a s * streamPilotLightProb n P x a s * |(qPoly n).eval (streamZ n P x a s)| else 0) ≤ 268435456 * (delta q * (d : ℝ) / ((n : ℝ) * ell n)) := by classical have hm : 0 < (n : ℝ) / 8 := by positivity have hδ : 0 ≤ delta q := by unfold delta; linarith [hq.2] have hLpos : 0 < ell n := by linarith let b : ℝ := (2 * delta q / ((n : ℝ) / 8)) * (4194304 / ell n) have hb : 0 ≤ b := by dsimp [b]; positivity have hcell : ∀ x : Fin d, ∀ a s : Bool, (if streamZ n P x a s ≤ polyThreshold n then missingCellMass P x a s * streamPilotLightProb n P x a s * |(qPoly n).eval (streamZ n P x a s)| else 0) ≤ b := by intro x a s split_ifs with hzB · have hw := (missingCellMass_bounds P h hq x a s).1 have hp := (upper_streamPilotLightProb_bounds (n := n) P x a s).2 have hpilot := mul_le_mul_of_nonneg_left hp hw have hsmall := upper_small_cell_missing_abs_qPoly_le hn P h hq x a s hzB calc missingCellMass P x a s * streamPilotLightProb n P x a s * |(qPoly n).eval (streamZ n P x a s)| ≤ missingCellMass P x a s * |(qPoly n).eval (streamZ n P x a s)| := by simpa only [mul_one] using mul_le_mul_of_nonneg_right hpilot (abs_nonneg _) _ ≤ (2 * delta q / ((n : ℝ) / 8)) * (polyThreshold n / (polyDegree n : ℝ) ^ 2) := hsmall _ ≤ b := mul_le_mul_of_nonneg_left (upper_polyThreshold_degree_rate hL) (by positivity) · exact hb calc _ ≤ ∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, b := by apply Finset.sum_le_sum intro x hx apply Finset.sum_le_sum intro a ha apply Finset.sum_le_sum intro s hs exact hcell x a s _ = 268435456 * (delta q * (d : ℝ) / ((n : ℝ) * ell n)) := by simp only [Finset.sum_const, Finset.card_univ, Fintype.card_bool, Fintype.card_fin, nsmul_eq_mul] dsimp [b] ring
CausalSmith.Stat.MarNearcompleteFrontier.upper_small_cell_pilot_bias_sum_rate · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamBiasRates.lean:136
CausalSmith.Stat.STAT_MarNearcompleteFrontier_Research.Helpers.UpperRisk.StreamCellIndependence 15 declarations Singleton histogram counts are independent within each Poisson stream and across the four streams.

Independence of Poisson stream histograms across cells

Singleton histogram counts are independent within each Poisson stream and across the four streams. Disjoint cell coordinates therefore supply independent missing-membership corrections.

def upper_streamHistogram

The singleton counts in each of the four finite Poisson streams. Given the specified input d, the specified input i, the specified input o, the stated mathematical conclusion holds. Given the specified input streams.

Definition (Lean source)
d :
ℕ
streams :
Fin 4 → FiniteSample (Obs d)
i :
Fin 4
o :
Obs d
upper_streamHistogram streams i o :
ℕ
theorem upper_measurable_streamHistogram

Every histogram coordinate is a measurable count statistic. Given the specified input d, the specified input i, the specified input o, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
i :
Fin 4
o :
Obs d
Measurable (fun streams => upper_streamHistogram streams i o)
Proof (Lean source)
-- @node: upper_measurable_streamHistogram lemma upper_measurable_streamHistogram {d : ℕ} (i : Fin 4) (o : Obs d) : Measurable (fun streams => upper_streamHistogram streams i o) := by exact (measurable_pi_apply o).comp (measurable_finiteSampleHistogram.comp (measurable_pi_apply i))
CausalSmith.Stat.MarNearcompleteFrontier.upper_measurable_streamHistogram · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamCellIndependence.lean:29
theorem upper_streamHistogram_law

A stream histogram has the independent singleton Poisson count law. Given the specified input n, the specified input d, the specified input P, the specified input i, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
P :
i :
Fin 4
(fourStreamLaw n P).map (fun streams => upper_streamHistogram streams i)
= independentPoissonCountLaw (observedLaw P).toMeasure (((n : NNReal) / 2) * uniformFourMass i)
Proof (Lean source)
-- @node: upper_streamHistogram_law lemma upper_streamHistogram_law {n d : ℕ} (P : FullLaw d) (i : Fin 4) : (fourStreamLaw n P).map (fun streams => upper_streamHistogram streams i) = independentPoissonCountLaw (observedLaw P).toMeasure (((n : NNReal) / 2) * uniformFourMass i) := by classical let ν : Fin 4 → Measure (FiniteSample (Obs d)) := fun i => finitePoissonSampleLaw (observedLaw P).toMeasure (((n : NNReal) / 2) * uniformFourMass i) have hμ : fourStreamLaw n P = Measure.pi ν := labeledStreamLaw_eq_independent _ _ _ _ have hs : (fourStreamLaw n P).map (fun streams => streams i) = ν i := by rw [hμ] simpa [ν] using Measure.pi_map_eval (μ := ν) i change (fourStreamLaw n P).map ((fun z : FiniteSample (Obs d) => finiteSampleHistogram z.points) ∘ (fun streams => streams i)) = _ rw [← Measure.map_map measurable_finiteSampleHistogram (measurable_pi_apply i), hs] exact finitePoissonSampleLaw_map_histogram _ _
CausalSmith.Stat.MarNearcompleteFrontier.upper_streamHistogram_law · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamCellIndependence.lean:36
theorem upper_streamHistogram_iIndepFun

The entire family of stream-by-atom counts is independent. This combines Poisson splitting within each stream with independence of the four streams. Given the specified input n, the specified input d, the specified input P, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
P :
iIndepFun (fun p : Fin 4 × Obs d => fun streams => upper_streamHistogram streams p.1 p.2) (fourStreamLaw n P)
Proof (Lean source)
-- @node: upper_streamHistogram_iIndepFun lemma upper_streamHistogram_iIndepFun {n d : ℕ} (P : FullLaw d) : iIndepFun (fun p : Fin 4 × Obs d => fun streams => upper_streamHistogram streams p.1 p.2) (fourStreamLaw n P) := by classical let := upper_fourStreamLaw_isProbabilityMeasure (n := n) P let ν : Fin 4 → Measure (FiniteSample (Obs d)) := fun i => finitePoissonSampleLaw (observedLaw P).toMeasure (((n : NNReal) / 2) * uniformFourMass i) have hμ : fourStreamLaw n P = Measure.pi ν := labeledStreamLaw_eq_independent _ _ _ _ apply iIndepFun_uncurry' (fun i o => upper_measurable_streamHistogram i o) · have hi : iIndepFun (fun i (streams : Fin 4 → FiniteSample (Obs d)) => streams i) (fourStreamLaw n P) := by rw [hμ] exact iIndepFun_pi (X := fun _ => id) (fun _ => aemeasurable_id) exact hi.comp (fun _ z => finiteSampleHistogram z.points) (fun _ => measurable_finiteSampleHistogram) · intro i rw [iIndepFun_iff_map_fun_eq_pi_map (fun o => (upper_measurable_streamHistogram i o).aemeasurable), upper_streamHistogram_law] have he (o : Obs d) : (fourStreamLaw n P).map (fun streams => upper_streamHistogram streams i o) = poissonMeasure ((((n : NNReal) / 2) * uniformFourMass i) * (((observedLaw P).toMeasure {o}).toNNReal)) := by change (fourStreamLaw n P).map ((fun counts : Obs d → ℕ => counts o) ∘ (fun streams => upper_streamHistogram streams i)) = _ rw [← Measure.map_map (measurable_pi_apply o) (measurable_pi_lambda _ (upper_measurable_streamHistogram i)), upper_streamHistogram_law] simpa [independentPoissonCountLaw] using (Measure.pi_map_eval (μ := fun o : Obs d => poissonMeasure ((((n : NNReal) / 2) * uniformFourMass i) * (((observedLaw P).toMeasure {o}).toNNReal))) o) simp_rw [he] rfl
CausalSmith.Stat.MarNearcompleteFrontier.upper_streamHistogram_iIndepFun · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamCellIndependence.lean:57
def upper_cellCoordinates

Coordinates belonging to one observed covariate-treatment-surrogate cell. Given the specified input d, the specified input j, the stated mathematical conclusion holds.

Definition (Lean source)
d :
ℕ
j :
Fin d × Bool × Bool
upper_cellCoordinates j :
Finset (Fin 4 × Obs d)
by classical exact Finset.univ.filter (fun p => inCell p.2 j.1 j.2.1 j.2.2)
theorem upper_cellCoordinates_disjoint

Distinct cells use disjoint singleton histogram coordinates. Given the specified input d, the specified input j, the specified input k, the specified input hjk, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
Fin d × Bool × Bool
hjk :
j ≠ k
Proof (Lean source)
-- @node: upper_cellCoordinates_disjoint lemma upper_cellCoordinates_disjoint {d : ℕ} {j k : Fin d × Bool × Bool} (hjk : j ≠ k) : Disjoint (upper_cellCoordinates j) (upper_cellCoordinates k) := by classical apply Finset.disjoint_left.mpr intro p hp hpk have hj : inCell p.2 j.1 j.2.1 j.2.2 := by simpa [upper_cellCoordinates] using hp have hk : inCell p.2 k.1 k.2.1 k.2.2 := by simpa [upper_cellCoordinates] using hpk apply hjk unfold inCell at hj hk exact Prod.ext (hj.1.symm.trans hk.1) (Prod.ext (hj.2.1.symm.trans hk.2.1) (hj.2.2.symm.trans hk.2.2))
CausalSmith.Stat.MarNearcompleteFrontier.upper_cellCoordinates_disjoint · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamCellIndependence.lean:105
theorem upper_cellHistogram_indepFun

The complete count vectors for two distinct cells are independent. Given the specified input n, the specified input d, the specified input P, the specified input j, the specified input k, the specified input hjk, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
P :
j k :
Fin d × Bool × Bool
hjk :
j ≠ k
IndepFun (fun streams (p : upper_cellCoordinates j) => upper_streamHistogram streams p.val.1 p.val.2) (fun streams (p : upper_cellCoordinates k) => upper_streamHistogram streams p.val.1 p.val.2) (fourStreamLaw n P)
Proof (Lean source)
-- @node: upper_cellHistogram_indepFun lemma upper_cellHistogram_indepFun {n d : ℕ} (P : FullLaw d) {j k : Fin d × Bool × Bool} (hjk : j ≠ k) : IndepFun (fun streams (p : upper_cellCoordinates j) => upper_streamHistogram streams p.val.1 p.val.2) (fun streams (p : upper_cellCoordinates k) => upper_streamHistogram streams p.val.1 p.val.2) (fourStreamLaw n P) := by exact (upper_streamHistogram_iIndepFun P).indepFun_finset (upper_cellCoordinates j) (upper_cellCoordinates k) (upper_cellCoordinates_disjoint hjk) (fun p => upper_measurable_streamHistogram p.1 p.2)
CausalSmith.Stat.MarNearcompleteFrontier.upper_cellHistogram_indepFun · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamCellIndependence.lean:121
theorem upper_finiteStreamCount_eq_histogram_sum

An event count is the sum of its singleton histogram counts. Given the specified input d, the specified input E, the stated mathematical conclusion holds. Given the specified input sample.

Formal statement
d :
ℕ
sample :
FiniteSample (Obs d)
E :
Obs d → Prop
= ∑ o : Obs d, @ite ℝ (E o) (propDecidable _) (finiteSampleHistogram sample.points o : ℝ) 0
Proof (Lean source)
-- @node: upper_finiteStreamCount_eq_histogram_sum lemma upper_finiteStreamCount_eq_histogram_sum {d : ℕ} (sample : FiniteSample (Obs d)) (E : Obs d → Prop) : finiteStreamCount sample E = ∑ o : Obs d, @ite ℝ (E o) (propDecidable _) (finiteSampleHistogram sample.points o : ℝ) 0 := by rcases sample with ⟨N, sample⟩ unfold finiteStreamCount finiteSampleHistogram FiniteSample.points change (∑ i : Fin N, @ite ℝ (E (sample i)) (propDecidable _) 1 0) = _ calc _ = ∑ o : Obs d, ∑ i : {i : Fin N // sample i = o}, @ite ℝ (E (sample i)) (propDecidable _) 1 0 := (Fintype.sum_fiberwise sample (fun i ↦ @ite ℝ (E (sample i)) (propDecidable _) 1 0)).symm _ = _ := by apply Finset.sum_congr rfl intro o ho by_cases hE : E o · have hforall : ∀ i : {i : Fin N // sample i = o}, E (sample i) := by intro i rw [i.property] exact hE simp only [hE, if_true, hforall] norm_cast change (∑ _i : {i : Fin N // sample i = o}, (1 : ℕ)) = _ simp rfl · have hforall : ∀ i : {i : Fin N // sample i = o}, ¬E (sample i) := by intro i hi apply hE simpa [i.property] using hi simp only [hE, if_false, hforall] simp
CausalSmith.Stat.MarNearcompleteFrontier.upper_finiteStreamCount_eq_histogram_sum · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamCellIndependence.lean:135
def upper_extendCellHistogram

Extend a cell's count vector by zero outside that cell. Given the specified input d, the specified input j, the specified input v, the specified input i, the specified input o, the stated mathematical conclusion holds.

Definition (Lean source)
d :
ℕ
j :
Fin d × Bool × Bool
v :
i :
Fin 4
o :
Obs d
upper_extendCellHistogram j v i o :
ℕ
by classical exact if hp : (i, o) ∈ upper_cellCoordinates j then v ⟨(i, o), hp⟩ else 0
def upper_cellHistogramCount

Counts formed from the zero extension of a cell histogram. Given the specified input d, the specified input j, the specified input v, the specified input i, the specified input E, the stated mathematical conclusion holds.

Definition (Lean source)
d :
ℕ
j :
Fin d × Bool × Bool
v :
i :
Fin 4
E :
Obs d → Prop
upper_cellHistogramCount j v i E :
ℝ
by classical exact ∑ o : Obs d, if E o then (upper_extendCellHistogram j v i o : ℝ) else 0
theorem upper_cellHistogramCount_eq

Any event supported on a cell can be counted from that cell's histogram. Given the specified input d, the specified input j, the specified input i, the specified input E, the specified input hE, the stated mathematical conclusion holds. Given the specified input streams.

Formal statement
d :
ℕ
j :
Fin d × Bool × Bool
streams :
Fin 4 → FiniteSample (Obs d)
i :
Fin 4
E :
Obs d → Prop
hE :
∀ o
if
E o
then
inCell o j.1 j.2.1 j.2.2
upper_cellHistogramCount j (fun p => upper_streamHistogram streams p.val.1 p.val.2) i E
= finiteStreamCount (streams i) E
Proof (Lean source)
-- @node: upper_cellHistogramCount_eq lemma upper_cellHistogramCount_eq {d : ℕ} (j : Fin d × Bool × Bool) (streams : Fin 4 → FiniteSample (Obs d)) (i : Fin 4) (E : Obs d → Prop) (hE : ∀ o, E o → inCell o j.1 j.2.1 j.2.2) : upper_cellHistogramCount j (fun p => upper_streamHistogram streams p.val.1 p.val.2) i E = finiteStreamCount (streams i) E := by classical rw [upper_finiteStreamCount_eq_histogram_sum] unfold upper_cellHistogramCount apply Finset.sum_congr rfl intro o ho by_cases he : E o · have hp : (i, o) ∈ upper_cellCoordinates j := by simpa [upper_cellCoordinates] using hE o he simp [he, upper_extendCellHistogram, hp, upper_streamHistogram] · simp [he]
CausalSmith.Stat.MarNearcompleteFrontier.upper_cellHistogramCount_eq · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamCellIndependence.lean:184
def upper_cellHistogramCorrection

The selected correction is a function of just one cell's count vector. Given the specified input d, the specified input n, the specified input j, the specified input v, the stated mathematical conclusion holds.

Definition (Lean source)
d :
ℕ
n :
ℕ
j :
Fin d × Bool × Bool
v :
upper_cellHistogramCorrection n j v :
ℝ
M :
upper_cellHistogramCount j v 1 (fun o => inCell o j.1 j.2.1 j.2.2 ∧ o.R = false)
Cp :
upper_cellHistogramCount j v 2 (fun o => inCell o j.1 j.2.1 j.2.2 ∧ o.R = true)
C :
upper_cellHistogramCount j v 3 (fun o => inCell o j.1 j.2.1 j.2.2 ∧ o.R = true)
U :
upper_cellHistogramCount j v 3 (fun o => inCell o j.1 j.2.1 j.2.2 ∧ o.RY = true)
M / ((n : ℝ) / 8) * (if Cp ≤ polyThreshold n / 4 then lightCorrection n C U else heavyCorrection C U)
CausalSmith.Stat.MarNearcompleteFrontier.upper_cellHistogramCorrection · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamCellIndependence.lean:203
theorem upper_cellHistogramCorrection_eq

A cell correction agrees exactly with its histogram representation. Given the specified input n, the specified input d, the specified input j, the stated mathematical conclusion holds. Given the specified input streams.

Formal statement
n d :
ℕ
j :
Fin d × Bool × Bool
streams :
Fin 4 → FiniteSample (Obs d)
upper_cellHistogramCorrection n j (fun p => upper_streamHistogram streams p.val.1 p.val.2)
= streamCellCorrection n d streams j.1 j.2.1 j.2.2
Proof (Lean source)
-- @node: upper_cellHistogramCorrection_eq lemma upper_cellHistogramCorrection_eq {n d : ℕ} (j : Fin d × Bool × Bool) (streams : Fin 4 → FiniteSample (Obs d)) : upper_cellHistogramCorrection n j (fun p => upper_streamHistogram streams p.val.1 p.val.2) = streamCellCorrection n d streams j.1 j.2.1 j.2.2 := by unfold upper_cellHistogramCorrection have hc (i : Fin 4) (F : Obs d → Prop) : upper_cellHistogramCount j (fun p => upper_streamHistogram streams p.val.1 p.val.2) i (fun o => inCell o j.1 j.2.1 j.2.2 ∧ F o) = finiteStreamCount (streams i) (fun o => inCell o j.1 j.2.1 j.2.2 ∧ F o) := upper_cellHistogramCount_eq j streams i _ (fun _ h => h.1) simp only [hc] rfl
CausalSmith.Stat.MarNearcompleteFrontier.upper_cellHistogramCorrection_eq · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamCellIndependence.lean:218
theorem upper_measurable_cellHistogramCorrection

The histogram representation of a cell correction is measurable. Given the specified input n, the specified input d, the specified input j, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
j :
Fin d × Bool × Bool
Proof (Lean source)
CausalSmith.Stat.MarNearcompleteFrontier.upper_measurable_cellHistogramCorrection · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamCellIndependence.lean:235
theorem upper_streamCellCorrection_indepFun

Corrections from distinct cells are independent, even though their pilot and outcome branches within a cell can be dependent. Given the specified input n, the specified input d, the specified input P, the specified input j, the specified input k, the specified input hjk, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
P :
j k :
Fin d × Bool × Bool
hjk :
j ≠ k
IndepFun (fun streams => streamCellCorrection n d streams j.1 j.2.1 j.2.2) (fun streams => streamCellCorrection n d streams k.1 k.2.1 k.2.2) (fourStreamLaw n P)
Proof (Lean source)
-- @node: upper_streamCellCorrection_indepFun lemma upper_streamCellCorrection_indepFun {n d : ℕ} (P : FullLaw d) {j k : Fin d × Bool × Bool} (hjk : j ≠ k) : IndepFun (fun streams => streamCellCorrection n d streams j.1 j.2.1 j.2.2) (fun streams => streamCellCorrection n d streams k.1 k.2.1 k.2.2) (fourStreamLaw n P) := by have hi := (upper_cellHistogram_indepFun (n := n) P hjk).comp (upper_measurable_cellHistogramCorrection (n := n) j) (upper_measurable_cellHistogramCorrection (n := n) k) simpa only [Function.comp_def, upper_cellHistogramCorrection_eq] using hi
CausalSmith.Stat.MarNearcompleteFrontier.upper_streamCellCorrection_indepFun · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamCellIndependence.lean:241
CausalSmith.Stat.STAT_MarNearcompleteFrontier_Research.Helpers.UpperRisk.StreamCorrectionVariance 11 declarations The independent missing-count and fourth-stream correction moments bound the pilot-selected difference from the heavy branch, as in equation (17).

Small-cell correction variance budget

The independent missing-count and fourth-stream correction moments bound the pilot-selected difference from the heavy branch, as in equation (17).

theorem upper_streamV_indep_fourth

The normalized missing stream is independent of every measurable statistic of the fourth stream. Given the specified input n, the specified input d, the specified input P, the specified input x, the specified input a, the specified input s, the specified input hf, the stated mathematical conclusion holds. Given the specified input f.

Formal statement
n d :
ℕ
P :
x :
Fin d
a s :
f :
FiniteSample (Obs d) → ℝ
hf :
IndepFun (fun streams => streamV n d streams x a s) (fun streams => f (streams 3)) (fourStreamLaw n P)
Proof (Lean source)
-- @node: upper_streamV_indep_fourth lemma upper_streamV_indep_fourth {n d : ℕ} (P : FullLaw d) (x : Fin d) (a s : Bool) (f : FiniteSample (Obs d) → ℝ) (hf : Measurable f) : IndepFun (fun streams => streamV n d streams x a s) (fun streams => f (streams 3)) (fourStreamLaw n P) := by classical let M : Set (Obs d) := {o | inCell o x a s ∧ o.R = false} let v : FiniteSample (Obs d) → ℝ := fun z => finiteStreamCount z (fun o => o ∈ M) / ((n : ℝ) / 8) have hM : MeasurableSet M := by measurability have hv : Measurable v := by unfold v fun_prop have hi : iIndepFun (fun i (streams : Fin 4 → FiniteSample (Obs d)) => streams i) (fourStreamLaw n P) := by rw [show fourStreamLaw n P = Measure.pi (fun i : Fin 4 => finitePoissonSampleLaw (observedLaw P).toMeasure ((n : NNReal) / 2 * uniformFourMass i)) from labeledStreamLaw_eq_independent _ _ _ _] exact iIndepFun_pi (X := fun _ => id) (fun _ => aemeasurable_id) exact (hi.indepFun (by decide : (1 : Fin 4) ≠ 3)).comp hv hf
theorem upper_streamHD_memLp_two

The difference between light and heavy corrections is square integrable. Given the specified input n, the specified input d, the specified input P, the specified input x, the specified input a, the specified input s, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
P :
x :
Fin d
a s :
MemLp (fun streams => streamH n d streams x a s - streamD d streams x a s) 2 (fourStreamLaw n P)
Proof (Lean source)
-- @node: upper_streamHD_memLp_two lemma upper_streamHD_memLp_two {n d : ℕ} (P : FullLaw d) (x : Fin d) (a s : Bool) : MemLp (fun streams => streamH n d streams x a s - streamD d streams x a s) 2 (fourStreamLaw n P) := by let := upper_fourStreamLaw_isProbabilityMeasure (n := n) P have hh : MemLp (fun streams => streamH n d streams x a s) 2 (fourStreamLaw n P) := by exact (memLp_two_iff_integrable_sq (upper_measurable_streamH x a s).aestronglyMeasurable).mpr (upper_streamH_sq_integrable (n := n) P x a s) have hd : MemLp (fun streams => streamD d streams x a s) 2 (fourStreamLaw n P) := by apply MemLp.of_bound (upper_measurable_streamD x a s).aestronglyMeasurable (1 / 2) simpa only [Real.norm_eq_abs] using upper_streamD_abs_le_half_ae (n := n) P x a s exact hh.sub hd
theorem upper_streamHD_second_moment_le

Squaring the branch difference costs twice the light second moment and one half for the bounded heavy branch. Given the specified input n, the specified input d, the specified input P, the specified input x, the specified input a, the specified input s, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
P :
x :
Fin d
a s :
(∫ streams, (streamH n d streams x a s - streamD d streams x a s) ^ 2 ∂fourStreamLaw n P)
≤ 2 * (∫ streams, (streamH n d streams x a s) ^ 2 ∂fourStreamLaw n P) + 1 / 2
Proof (Lean source)
-- @node: upper_streamHD_second_moment_le lemma upper_streamHD_second_moment_le {n d : ℕ} (P : FullLaw d) (x : Fin d) (a s : Bool) : (∫ streams, (streamH n d streams x a s - streamD d streams x a s) ^ 2 ∂fourStreamLaw n P) ≤ 2 * (∫ streams, (streamH n d streams x a s) ^ 2 ∂fourStreamLaw n P) + 1 / 2 := by let := upper_fourStreamLaw_isProbabilityMeasure (n := n) P have hi := (upper_streamHD_memLp_two (n := n) P x a s).integrable_sq have he := ((upper_streamH_sq_integrable (n := n) P x a s).const_mul 2).add (integrable_const (1 / 2 : ℝ)) calc _ ≤ ∫ streams, 2 * (streamH n d streams x a s) ^ 2 + (1 / 2 : ℝ) ∂fourStreamLaw n P := by apply integral_mono_ae hi he filter_upwards [upper_streamD_abs_le_half_ae (n := n) P x a s] with streams hd have hd2 : (streamD d streams x a s) ^ 2 ≤ 1 / 4 := by have := pow_le_pow_left₀ (abs_nonneg _) hd 2 norm_num [sq_abs] at this exact this change (streamH n d streams x a s - streamD d streams x a s) ^ 2 ≤ 2 * (streamH n d streams x a s) ^ 2 + 1 / 2 nlinarith [sq_nonneg (streamH n d streams x a s + streamD d streams x a s)] _ = _ := by rw [integral_add ((upper_streamH_sq_integrable (n := n) P x a s).const_mul 2) (integrable_const _), integral_const_mul] simp
CausalSmith.Stat.MarNearcompleteFrontier.upper_streamHD_second_moment_le · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamCorrectionVariance.lean:63
theorem upper_streamVHD_second_moment

Independence supplies both integrability and the exact unselected product second moment needed to dominate the pilot-selected correction. Given the specified input n, the specified input d, the specified input hn, the specified input P, the specified input x, the specified input a, the specified input s, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
hn :
0 < n
P :
x :
Fin d
a s :
conclusion 1
Integrable (fun streams => (streamV n d streams x a s * (streamH n d streams x a s - streamD d streams x a s)) ^ 2) (fourStreamLaw n P)
conclusion 2
(∫ streams, (streamV n d streams x a s * (streamH n d streams x a s - streamD d streams x a s)) ^ 2 ∂fourStreamLaw n P)
= ((missingCellMass P x a s) ^ 2 + missingCellMass P x a s / ((n : ℝ) / 8)) * (∫ streams, (streamH n d streams x a s - streamD d streams x a s) ^ 2 ∂fourStreamLaw n P)
Proof (Lean source)
-- @node: upper_streamVHD_second_moment lemma upper_streamVHD_second_moment {n d : ℕ} (hn : 0 < n) (P : FullLaw d) (x : Fin d) (a s : Bool) : Integrable (fun streams => (streamV n d streams x a s * (streamH n d streams x a s - streamD d streams x a s)) ^ 2) (fourStreamLaw n P) ∧ (∫ streams, (streamV n d streams x a s * (streamH n d streams x a s - streamD d streams x a s)) ^ 2 ∂fourStreamLaw n P) = ((missingCellMass P x a s) ^ 2 + missingCellMass P x a s / ((n : ℝ) / 8)) * (∫ streams, (streamH n d streams x a s - streamD d streams x a s) ^ 2 ∂fourStreamLaw n P) := by classical let B : Set (Obs d) := {o | inCell o x a s ∧ o.R = true} let A : Set (Obs d) := {o | inCell o x a s ∧ o.RY = true} let c : FiniteSample (Obs d) → ℝ := fun z => finiteStreamCount z (fun o => o ∈ B) let u : FiniteSample (Obs d) → ℝ := fun z => finiteStreamCount z (fun o => o ∈ A) let f : FiniteSample (Obs d) → ℝ := fun z => lightCorrection n (c z) (u z) - heavyCorrection (c z) (u z) have hB : MeasurableSet B := by measurability have hA : MeasurableSet A := by measurability have hc : Measurable c := by unfold c; fun_prop have hu : Measurable u := by unfold u; fun_prop have hf : Measurable f := by have hl : Measurable (fun z => lightCorrection n (c z) (u z)) := by unfold lightCorrection shiftedFalling fun_prop have hd : Measurable (fun z => heavyCorrection (c z) (u z)) := by unfold heavyCorrection apply Measurable.ite (measurableSet_lt measurable_const hc) <;> fun_prop exact hl.sub hd have hind := (upper_streamV_indep_fourth (n := n) P x a s f hf).comp (by fun_prop : Measurable (fun v : ℝ => v ^ 2)) (by fun_prop : Measurable (fun v : ℝ => v ^ 2)) have hid : (fun streams => f (streams 3)) = (fun streams => streamH n d streams x a s - streamD d streams x a s) := rfl simp only [Function.comp_def, hid] at hind have hv := (upper_streamV_memLp_two (n := n) P x a s).integrable_sq have hd := (upper_streamHD_memLp_two (n := n) P x a s).integrable_sq constructor · simp_rw [mul_pow] exact hind.integrable_mul hv hd · simp only [mul_pow] rw [hind.integral_fun_mul_eq_mul_integral hv.aestronglyMeasurable hd.aestronglyMeasurable, upper_stream_v_second_moment hn P x a s]
CausalSmith.Stat.MarNearcompleteFrontier.upper_streamVHD_second_moment · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamCorrectionVariance.lean:92
theorem upper_streamVG_sub_VD_sq_le

Pilot selection only removes the branch difference, so its square is bounded by the unselected product square. Given the specified input n, the specified input d, the specified input x, the specified input a, the specified input s, the stated mathematical conclusion holds. Given the specified input streams.

Formal statement
n d :
ℕ
streams :
Fin 4 → FiniteSample (Obs d)
x :
Fin d
a s :
(streamV n d streams x a s * (streamG n d streams x a s - streamD d streams x a s)) ^ 2
≤ (streamV n d streams x a s * (streamH n d streams x a s - streamD d streams x a s)) ^ 2
Proof (Lean source)
-- @node: upper_streamVG_sub_VD_sq_le lemma upper_streamVG_sub_VD_sq_le {n d : ℕ} (streams : Fin 4 → FiniteSample (Obs d)) (x : Fin d) (a s : Bool) : (streamV n d streams x a s * (streamG n d streams x a s - streamD d streams x a s)) ^ 2 ≤ (streamV n d streams x a s * (streamH n d streams x a s - streamD d streams x a s)) ^ 2 := by unfold streamG split_ifs · exact le_rfl · simp only [sub_self, mul_zero, zero_pow (by norm_num : (2 : ℕ) ≠ 0)] exact sq_nonneg _
CausalSmith.Stat.MarNearcompleteFrontier.upper_streamVG_sub_VD_sq_le · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamCorrectionVariance.lean:141
theorem upper_measurable_streamG

The pilot-selected correction is measurable. Given the specified input n, the specified input d, the specified input x, the specified input a, the specified input s, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
x :
Fin d
a s :
Measurable (fun streams : Fin 4 → FiniteSample (Obs d) => streamG n d streams x a s)
Proof (Lean source)
-- @node: upper_measurable_streamG @[fun_prop] lemma upper_measurable_streamG {n d : ℕ} (x : Fin d) (a s : Bool) : Measurable (fun streams : Fin 4 → FiniteSample (Obs d) => streamG n d streams x a s) := by classical let B : Set (Obs d) := {o | inCell o x a s ∧ o.R = true} have hB : MeasurableSet B := by measurability have hp : Measurable (fun streams : Fin 4 → FiniteSample (Obs d) => streamCpilot d streams x a s) := (upper_measurable_finiteStreamCount B hB).comp (measurable_pi_apply 2) unfold streamG apply Measurable.ite (measurableSet_le hp measurable_const) <;> fun_prop
theorem upper_streamVG_sub_VD_sq_integrable

The selected product square is integrable by domination, without additional regularity hypotheses on the estimator. Given the specified input n, the specified input d, the specified input hn, the specified input P, the specified input x, the specified input a, the specified input s, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
hn :
0 < n
P :
x :
Fin d
a s :
Integrable (fun streams => (streamV n d streams x a s * (streamG n d streams x a s - streamD d streams x a s)) ^ 2) (fourStreamLaw n P)
Proof (Lean source)
-- @node: upper_streamVG_sub_VD_sq_integrable lemma upper_streamVG_sub_VD_sq_integrable {n d : ℕ} (hn : 0 < n) (P : FullLaw d) (x : Fin d) (a s : Bool) : Integrable (fun streams => (streamV n d streams x a s * (streamG n d streams x a s - streamD d streams x a s)) ^ 2) (fourStreamLaw n P) := by classical let M : Set (Obs d) := {o | inCell o x a s ∧ o.R = false} have hM : MeasurableSet M := by measurability have hv : Measurable (fun streams : Fin 4 → FiniteSample (Obs d) => streamV n d streams x a s) := by unfold streamV have hm : Measurable (fun streams : Fin 4 → FiniteSample (Obs d) => finiteStreamCount (streams 1) (fun o => o ∈ M)) := (upper_measurable_finiteStreamCount M hM).comp (measurable_pi_apply 1) exact hm.div measurable_const have hm : Measurable (fun streams => (streamV n d streams x a s * (streamG n d streams x a s - streamD d streams x a s)) ^ 2) := by fun_prop apply (upper_streamVHD_second_moment hn P x a s).1.mono' hm.aestronglyMeasurable filter_upwards [] with streams rw [Real.norm_eq_abs, abs_of_nonneg (sq_nonneg _)] exact upper_streamVG_sub_VD_sq_le streams x a s
CausalSmith.Stat.MarNearcompleteFrontier.upper_streamVG_sub_VD_sq_integrable · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamCorrectionVariance.lean:170
theorem upper_streamVG_sub_VD_second_moment_le

Dropping pilot selection and factoring the independent product bounds the actual correction second moment by the two branch moments. Given the specified input n, the specified input d, the specified input hn, the specified input P, the specified input x, the specified input a, the specified input s, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
hn :
0 < n
P :
x :
Fin d
a s :
(∫ streams, (streamV n d streams x a s * (streamG n d streams x a s - streamD d streams x a s)) ^ 2 ∂fourStreamLaw n P)
≤ ((missingCellMass P x a s) ^ 2 + missingCellMass P x a s / ((n : ℝ) / 8)) * (2 * (∫ streams, (streamH n d streams x a s) ^ 2 ∂fourStreamLaw n P) + 1 / 2)
Proof (Lean source)
-- @node: upper_streamVG_sub_VD_second_moment_le lemma upper_streamVG_sub_VD_second_moment_le {n d : ℕ} (hn : 0 < n) (P : FullLaw d) (x : Fin d) (a s : Bool) : (∫ streams, (streamV n d streams x a s * (streamG n d streams x a s - streamD d streams x a s)) ^ 2 ∂fourStreamLaw n P) ≤ ((missingCellMass P x a s) ^ 2 + missingCellMass P x a s / ((n : ℝ) / 8)) * (2 * (∫ streams, (streamH n d streams x a s) ^ 2 ∂fourStreamLaw n P) + 1 / 2) := by have hprod := upper_streamVHD_second_moment hn P x a s calc _ ≤ ∫ streams, (streamV n d streams x a s * (streamH n d streams x a s - streamD d streams x a s)) ^ 2 ∂fourStreamLaw n P := integral_mono_ae (upper_streamVG_sub_VD_sq_integrable hn P x a s) hprod.1 (Filter.Eventually.of_forall fun streams => upper_streamVG_sub_VD_sq_le streams x a s) _ = _ := hprod.2 _ ≤ _ := by apply mul_le_mul_of_nonneg_left (upper_streamHD_second_moment_le P x a s) have hw : 0 ≤ missingCellMass P x a s := sub_nonneg.mpr (arrivedCellMass_le_cellMass P x a s) positivity
CausalSmith.Stat.MarNearcompleteFrontier.upper_streamVG_sub_VD_second_moment_le · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamCorrectionVariance.lean:194
theorem upper_small_missing_second_moment_le

A small cell has a uniformly small missing-count second moment, using the arrival floor rather than any extra moment premise. Given the specified input n, the specified input d, the specified input q, the specified input hn, the specified input P, the specified input h, the specified input x, the specified input a, the specified input s, the specified input hzB, the stated mathematical conclusion holds. Given the specified input hq.

Formal statement
n d :
ℕ
q :
ℝ
hn :
0 < n
P :
h :
LawClass d q P
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
x :
Fin d
a s :
hzB :
streamZ n P x a s ≤ polyThreshold n
(missingCellMass P x a s) ^ 2 + missingCellMass P x a s / ((n : ℝ) / 8)
≤ (4 * (delta q) ^ 2 * (polyThreshold n) ^ 2 + 2 * delta q * polyThreshold n) / ((n : ℝ) / 8) ^ 2
Proof (Lean source)
-- @node: upper_small_missing_second_moment_le lemma upper_small_missing_second_moment_le {n d : ℕ} {q : ℝ} (hn : 0 < n) (P : FullLaw d) (h : LawClass d q P) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (x : Fin d) (a s : Bool) (hzB : streamZ n P x a s ≤ polyThreshold n) : (missingCellMass P x a s) ^ 2 + missingCellMass P x a s / ((n : ℝ) / 8) ≤ (4 * (delta q) ^ 2 * (polyThreshold n) ^ 2 + 2 * delta q * polyThreshold n) / ((n : ℝ) / 8) ^ 2 := by let m : ℝ := (n : ℝ) / 8 let w := missingCellMass P x a s let B := polyThreshold n have hm : 0 < m := by dsimp [m]; positivity have hδ : 0 ≤ delta q := by unfold delta; linarith [hq.2] have hw : 0 ≤ w := (missingCellMass_bounds P h hq x a s).1 have hwB : w * m ≤ 2 * delta q * B := by have hh := mul_le_mul_of_nonneg_right (missingCellMass_bounds P h hq x a s).2.2 hm.le have ht := mul_le_mul_of_nonneg_left hzB (show 0 ≤ 2 * delta q by positivity) dsimp [streamZ] at ht dsimp [w, m, B] at * nlinarith have hwbound : w ≤ 2 * delta q * B / m := (le_div_iff₀ hm).mpr hwB have hright : 0 ≤ 2 * delta q * B / m := hw.trans hwbound have hs := pow_le_pow_left₀ hw hwbound 2 have hl := div_le_div_of_nonneg_right hwbound hm.le calc _ = w ^ 2 + w / m := rfl _ ≤ (2 * delta q * B / m) ^ 2 + (2 * delta q * B / m) / m := add_le_add hs hl _ = _ := by dsimp [B, m]; ring
CausalSmith.Stat.MarNearcompleteFrontier.upper_small_missing_second_moment_le · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamCorrectionVariance.lean:216
theorem upper_stream_small_correction_second_moment_le

Equation (17), cellwise: pilot-selected correction squares in small cells have the exponential light-moment envelope times the missing-count budget. Given the specified input n, the specified input d, the specified input q, the specified input hn, the specified input hL, the specified input P, the specified input h, the specified input x, the specified input a, the specified input s, the specified input hzB, the stated mathematical conclusion holds. Given the specified input hq.

Formal statement
n d :
ℕ
q :
ℝ
hn :
0 < n
hL :
128 ≤ ell n
P :
h :
LawClass d q P
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
x :
Fin d
a s :
hzB :
streamZ n P x a s ≤ polyThreshold n
(∫ streams, (streamV n d streams x a s * (streamG n d streams x a s - streamD d streams x a s)) ^ 2 ∂fourStreamLaw n P)
≤ 3 * exp (ell n / 8) * ((4 * (delta q) ^ 2 * (polyThreshold n) ^ 2 + 2 * delta q * polyThreshold n) / ((n : ℝ) / 8) ^ 2)
Proof (Lean source)
-- @node: upper_stream_small_correction_second_moment_le lemma upper_stream_small_correction_second_moment_le {n d : ℕ} {q : ℝ} (hn : 0 < n) (hL : 128 ≤ ell n) (P : FullLaw d) (h : LawClass d q P) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (x : Fin d) (a s : Bool) (hzB : streamZ n P x a s ≤ polyThreshold n) : (∫ streams, (streamV n d streams x a s * (streamG n d streams x a s - streamD d streams x a s)) ^ 2 ∂fourStreamLaw n P) ≤ 3 * exp (ell n / 8) * ((4 * (delta q) ^ 2 * (polyThreshold n) ^ 2 + 2 * delta q * polyThreshold n) / ((n : ℝ) / 8) ^ 2) := by have hw : 0 ≤ missingCellMass P x a s := (missingCellMass_bounds P h hq x a s).1 have hc : 0 ≤ (missingCellMass P x a s) ^ 2 + missingCellMass P x a s / ((n : ℝ) / 8) := by positivity have he : 1 ≤ exp (ell n / 8) := Real.one_le_exp (by linarith) have hmoment := upper_streamH_small_second_moment_le hL P x a s hzB have hbranch : 2 * (∫ streams, (streamH n d streams x a s) ^ 2 ∂fourStreamLaw n P) + 1 / 2 ≤ 3 * exp (ell n / 8) := by linarith calc _ ≤ _ := upper_streamVG_sub_VD_second_moment_le hn P x a s _ ≤ ((missingCellMass P x a s) ^ 2 + missingCellMass P x a s / ((n : ℝ) / 8)) * (3 * exp (ell n / 8)) := mul_le_mul_of_nonneg_left hbranch hc _ ≤ _ := by rw [mul_comm] exact mul_le_mul_of_nonneg_left (upper_small_missing_second_moment_le hn P h hq x a s hzB) (by positivity)
CausalSmith.Stat.MarNearcompleteFrontier.upper_stream_small_correction_second_moment_le · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamCorrectionVariance.lean:247
theorem upper_stream_small_correction_second_moment_sum_le

Equation (17), aggregated over the at most four times d small cells. Given the specified input n, the specified input d, the specified input q, the specified input hn, the specified input hL, the specified input P, the specified input h, the stated mathematical conclusion holds. Given the specified input hq.

Formal statement
n d :
ℕ
q :
ℝ
hn :
0 < n
hL :
128 ≤ ell n
P :
h :
LawClass d q P
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
(∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, if streamZ n P x a s ≤ polyThreshold n then (∫ streams, (streamV n d streams x a s * (streamG n d streams x a s - streamD d streams x a s)) ^ 2 ∂fourStreamLaw n P) else 0)
≤ 12 * (d : ℝ) * exp (ell n / 8) * ((4 * (delta q) ^ 2 * (polyThreshold n) ^ 2 + 2 * delta q * polyThreshold n) / ((n : ℝ) / 8) ^ 2)
Proof (Lean source)
-- @node: upper_stream_small_correction_second_moment_sum_le lemma upper_stream_small_correction_second_moment_sum_le {n d : ℕ} {q : ℝ} (hn : 0 < n) (hL : 128 ≤ ell n) (P : FullLaw d) (h : LawClass d q P) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) : (∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, if streamZ n P x a s ≤ polyThreshold n then (∫ streams, (streamV n d streams x a s * (streamG n d streams x a s - streamD d streams x a s)) ^ 2 ∂fourStreamLaw n P) else 0) ≤ 12 * (d : ℝ) * exp (ell n / 8) * ((4 * (delta q) ^ 2 * (polyThreshold n) ^ 2 + 2 * delta q * polyThreshold n) / ((n : ℝ) / 8) ^ 2) := by classical let K := 3 * exp (ell n / 8) * ((4 * (delta q) ^ 2 * (polyThreshold n) ^ 2 + 2 * delta q * polyThreshold n) / ((n : ℝ) / 8) ^ 2) have hδ : 0 ≤ delta q := by unfold delta; linarith [hq.2] have hB : 0 ≤ polyThreshold n := by unfold polyThreshold; linarith have hK : 0 ≤ K := by dsimp [K]; positivity calc _ ≤ ∑ _x : Fin d, ∑ _a : Bool, ∑ _s : Bool, K := by apply Finset.sum_le_sum intro x hx apply Finset.sum_le_sum intro a ha apply Finset.sum_le_sum intro s hs split_ifs with hzB · exact upper_stream_small_correction_second_moment_le hn hL P h hq x a s hzB · exact hK _ = _ := by simp [K]; ring
CausalSmith.Stat.MarNearcompleteFrontier.upper_stream_small_correction_second_moment_sum_le · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamCorrectionVariance.lean:275
CausalSmith.Stat.STAT_MarNearcompleteFrontier_Research.Helpers.UpperRisk.StreamCorrections 2 declarations This module proves the light polynomial and heavy ratio branch identities for the four-stream estimator.

Correction branch means for the upper-risk proof

This module proves the light polynomial and heavy ratio branch identities for the four-stream estimator.

theorem upper_stream_light_mean

Equation (5), light branch: the mean polynomial correction is the centered cell outcome mean times one minus the Chebyshev quotient. Given the specified input n, the specified input d, the specified input P, the specified input q, the specified input h, the specified input x, the specified input a, the specified input s, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
P :
q :
ℝ
h :
LawClass d q P
x :
Fin d
a s :
(∫ streams, streamH n d streams x a s ∂fourStreamLaw n P)
= cellEta P x a s * (1 - (qPoly n).eval (streamZ n P x a s))
Proof (Lean source)
lemma upper_stream_light_mean {n d : ℕ} (P : FullLaw d) {q : ℝ} (h : LawClass d q P) (x : Fin d) (a s : Bool) : (∫ streams, streamH n d streams x a s ∂fourStreamLaw n P) = cellEta P x a s * (1 - (qPoly n).eval (streamZ n P x a s)) := by classical unfold streamH lightCorrection rw [integral_finsetSum] swap · intro t ht have hint := upper_stream_factorial_integrable (n := n) (v := t + 1) (by omega) P x a s have hc := hint.const_mul (correctionCoeff n (t + 1)) convert hc using 1 all_goals funext streams ring calc (∑ t ∈ range (polyDegree n - 1), ∫ streams, correctionCoeff n (t + 1) * (streamU d streams x a s - streamC d streams x a s / 2) * shiftedFalling (streamC d streams x a s) (t + 1) ∂fourStreamLaw n P) = ∑ t ∈ range (polyDegree n - 1), correctionCoeff n (t + 1) * (cellEta P x a s * (streamZ n P x a s) ^ (t + 1)) := by apply Finset.sum_congr rfl intro t ht rw [show (fun streams => correctionCoeff n (t + 1) * (streamU d streams x a s - streamC d streams x a s / 2) * shiftedFalling (streamC d streams x a s) (t + 1)) = (fun streams => correctionCoeff n (t + 1) * ((streamU d streams x a s - streamC d streams x a s / 2) * shiftedFalling (streamC d streams x a s) (t + 1))) by funext streams; ring, integral_const_mul, upper_stream_factorial_moment (n := n) (v := t + 1) (by omega) P h x a s] _ = cellEta P x a s * (∑ t ∈ range (polyDegree n - 1), correctionCoeff n (t + 1) * (streamZ n P x a s) ^ (t + 1)) := by rw [Finset.mul_sum] apply Finset.sum_congr rfl intro t ht ring _ = _ := by rw [upper_correctionCoeff_sum] simp [Polynomial.eval_sub]
CausalSmith.Stat.MarNearcompleteFrontier.upper_stream_light_mean · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamCorrections.lean:116
theorem upper_stream_heavy_mean

Equation (5), heavy branch: the plug-in correction has mean equal to the centered cell outcome mean times its nonempty-count probability. Given the specified input n, the specified input d, the specified input P, the specified input q, the specified input h, the specified input x, the specified input a, the specified input s, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
P :
q :
ℝ
h :
LawClass d q P
x :
Fin d
a s :
(∫ streams, streamD d streams x a s ∂fourStreamLaw n P)
= cellEta P x a s * (1 - exp (-(streamZ n P x a s)))
Proof (Lean source)
lemma upper_stream_heavy_mean {n d : ℕ} (P : FullLaw d) {q : ℝ} (h : LawClass d q P) (x : Fin d) (a s : Bool) : (∫ streams, streamD d streams x a s ∂fourStreamLaw n P) = cellEta P x a s * (1 - exp (-(streamZ n P x a s))) := by classical let Q := (observedLaw P).toMeasure let lam : NNReal := (n : NNReal) / 2 * uniformFourMass 3 let A : Set (Obs d) := {o | inCell o x a s ∧ o.R = true ∧ o.RY = true} let B : Set (Obs d) := {o | inCell o x a s ∧ o.R = true} let frac : Set (Obs d) → Set (Obs d) → FiniteSample (Obs d) → ℝ := Causalean.Stat.FiniteRaoBlackwell.Poisson.FinitePartition.NestedEventRatioMean.successFraction have hA : MeasurableSet A := by measurability have hB : MeasurableSet B := by measurability have hAB : A ⊆ B := fun o ho => ⟨ho.1, ho.2.1⟩ have hmap : Measure.map (fun streams => streams 3) (fourStreamLaw n P) = finitePoissonSampleLaw Q lam := by rw [show fourStreamLaw n P = Measure.pi (fun i : Fin 4 => finitePoissonSampleLaw Q ((n : NNReal) / 2 * uniformFourMass i)) by unfold fourStreamLaw Q exact labeledStreamLaw_eq_independent _ _ _ _] simpa [lam] using (measurePreserving_eval (μ := fun i : Fin 4 => finitePoissonSampleLaw Q ((n : NNReal) / 2 * uniformFourMass i)) (3 : Fin 4)).map_eq have hpoint : ∀ᵐ streams ∂fourStreamLaw n P, streamD d streams x a s = frac A B (streams 3) - (1 / 2 : ℝ) * frac B B (streams 3) := by filter_upwards [streamU_eq_arrivedSuccess_ae (n := n) P x a s] with streams hs unfold streamD rw [hs] have hcountA := finiteStreamCount_eq_ratioEventCount (streams 3) (fun o => inCell o x a s ∧ o.R = true ∧ o.RY = true) have hcountB := finiteStreamCount_eq_ratioEventCount (streams 3) (fun o => inCell o x a s ∧ o.R = true) unfold heavyCorrection streamArrivedSuccessCount streamC frac rw [hcountA, hcountB] unfold Causalean.Stat.FiniteRaoBlackwell.Poisson.FinitePartition.NestedEventRatioMean.successFraction by_cases hzero : eventCount B (streams 3) = 0 · simp [B, hzero] · have hpos : 0 < eventCount B (streams 3) := lt_of_le_of_ne (eventCount_bounds B (streams 3)).1 (Ne.symm hzero) simp [B, hzero, hpos] rfl have hfracInt (C D : Set (Obs d)) (hC : MeasurableSet C) (hD : MeasurableSet D) (hCD : C ⊆ D) : Integrable (fun streams => frac C D (streams 3)) (fourStreamLaw n P) := by apply (integrable_map_measure (measurable_successFraction hC hD).aestronglyMeasurable (measurable_pi_apply 3).aemeasurable).mp rw [hmap] exact integrable_successFraction _ hC hD hCD have htransfer (C D : Set (Obs d)) (hC : MeasurableSet C) (hD : MeasurableSet D) : (∫ streams, frac C D (streams 3) ∂fourStreamLaw n P) = ∫ z, frac C D z ∂finitePoissonSampleLaw Q lam := by rw [← hmap] exact (integral_map (measurable_pi_apply 3).aemeasurable (measurable_successFraction hC hD).aestronglyMeasurable).symm have hDmean : (∫ streams, streamD d streams x a s ∂fourStreamLaw n P) = (∫ z, frac A B z ∂finitePoissonSampleLaw Q lam) - (1 / 2 : ℝ) * (∫ z, frac B B z ∂finitePoissonSampleLaw Q lam) := by calc _ = ∫ streams, (frac A B (streams 3) - (1 / 2 : ℝ) * frac B B (streams 3)) ∂fourStreamLaw n P := integral_congr_ae hpoint _ = (∫ streams, frac A B (streams 3) ∂fourStreamLaw n P) - (1 / 2 : ℝ) * (∫ streams, frac B B (streams 3) ∂fourStreamLaw n P) := by rw [integral_sub (hfracInt A B hA hB hAB) ((hfracInt B B hB hB Set.Subset.rfl).const_mul (1 / 2 : ℝ)), integral_const_mul] _ = _ := by rw [htransfer A B hA hB, htransfer B B hB hB] have houtcome : outcomeMean (observedLaw P) x a s = (Q A).toReal / (Q B).toReal := by unfold outcomeMean rw [observed_event_mass_toReal (observedLaw P) (fun o => inCell o x a s ∧ o.R = true ∧ o.RY = true), observed_event_mass_toReal (observedLaw P) (fun o => inCell o x a s ∧ o.R = true)] simp only [inCell, and_assoc] have houtcomeReal : outcomeMean (observedLaw P) x a s = Q.real A / Q.real B := by simpa only [Measure.real] using houtcome have hBmass : (Q B).toReal = arrivedCellMass P x a s := by rw [show (Q B).toReal = ∑ o : Obs d, if inCell o x a s ∧ o.R = true then obsMass (observedLaw P) o else 0 by simpa only [Q, B] using observed_event_mass_toReal (observedLaw P) (fun o => inCell o x a s ∧ o.R = true)] simpa only [inCell, arrivedCellMass, and_assoc] using observed_arrived_mass P x a s have hrate : (lam : ℝ) * (Q B).toReal = streamZ n P x a s := by have hlam : (lam : ℝ) = (n : ℝ) / 8 := by norm_num [lam, uniformFourMass] ring rw [hlam, hBmass] unfold streamZ ring have hrateReal : (lam : ℝ) * Q.real B = streamZ n P x a s := by simpa only [Measure.real] using hrate have hexp : -(lam : ℝ) * Q.real B = -(streamZ n P x a s) := by rw [← hrateReal] ring rw [hDmean] by_cases hQB : (Q B).toReal = 0 · have hQBmeasure : Q B = 0 := (MeasureTheory.measureReal_eq_zero_iff (μ := Q) (s := B)).mp hQB have hzeroAB := finitePoisson_successFraction_mean_of_mass_zero Q lam (A := A) hB hQBmeasure have hzeroBB := finitePoisson_successFraction_mean_of_mass_zero Q lam (A := B) hB hQBmeasure rw [hzeroAB, hzeroBB] have hz : streamZ n P x a s = 0 := by rw [← hrate, hQB, mul_zero] rw [hz] simp · have hQBpos : 0 < Q.real B := lt_of_le_of_ne measureReal_nonneg (Ne.symm hQB) have hQBReal : Q.real B ≠ 0 := ne_of_gt hQBpos have hmeanAB := finitePoisson_successFraction_mean Q lam hA hB hAB hQBpos have hmeanBB := finitePoisson_successFraction_mean Q lam hB hB Set.Subset.rfl hQBpos rw [hmeanAB, hmeanBB, ← houtcomeReal, hexp] unfold cellEta rw [div_self hQBReal] ring
CausalSmith.Stat.MarNearcompleteFrontier.upper_stream_heavy_mean · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamCorrections.lean:168
CausalSmith.Stat.STAT_MarNearcompleteFrontier_Research.Helpers.UpperRisk.StreamCorrectionsBase 6 declarations This module contains the scalar factorial identities, the joint arrived-success moment, and the integrability result used by the correction branch means.

Factorial corrected stream moments

This module contains the scalar factorial identities, the joint arrived-success moment, and the integrability result used by the correction branch means.

theorem upper_shiftedFalling_descFactorial Lemma upper_shiftedFalling_descFactorial in the paper ↗

The paper's shifted product becomes the usual falling factorial after including the leading count. Given the specified input k, the specified input v, the specified input hv, the stated mathematical conclusion holds.

Formal statement
k v :
ℕ
hv :
1 ≤ v
(k : ℝ) * shiftedFalling (k : ℝ) v = (k.descFactorial v : ℝ)
Proof (Lean source)
lemma upper_shiftedFalling_descFactorial (k v : ℕ) (hv : 1 ≤ v) : (k : ℝ) * shiftedFalling (k : ℝ) v = (k.descFactorial v : ℝ) := by obtain ⟨t, rfl⟩ := Nat.exists_eq_succ_of_ne_zero (by omega : v ≠ 0) unfold shiftedFalling simp only [Nat.succ_sub_one] rw [← descPochhammer_eval_eq_prod_range] rw [← descPochhammer_eval_eq_descFactorial (R := ℝ)] rw [descPochhammer_succ_left] simp only [eval_mul, eval_X, eval_comp, eval_sub, eval_one]
CausalSmith.Stat.MarNearcompleteFrontier.upper_shiftedFalling_descFactorial · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamCorrectionsBase.lean:23
theorem upper_poisson_shiftedFalling_moment

The scalar factorial moment needed after conditioning on the arrived count. Given the specified input rate, the specified input v, the specified input hv, the stated mathematical conclusion holds.

Formal statement
rate :
v :
ℕ
hv :
1 ≤ v
(∫ k : ℕ, (k : ℝ) * shiftedFalling (k : ℝ) v ∂poissonMeasure rate) = (rate : ℝ) ^ v
Proof (Lean source)
lemma upper_poisson_shiftedFalling_moment (rate : NNReal) (v : ℕ) (hv : 1 ≤ v) : (∫ k : ℕ, (k : ℝ) * shiftedFalling (k : ℝ) v ∂poissonMeasure rate) = (rate : ℝ) ^ v := by simp_rw [upper_shiftedFalling_descFactorial _ _ hv] exact poisson_descFactorial_moment rate v
CausalSmith.Stat.MarNearcompleteFrontier.upper_poisson_shiftedFalling_moment · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamCorrectionsBase.lean:36
theorem observed_event_mass_toReal

For an observed-data probability mass function and a decidable event, the event probability equals its explicit sum of point masses.

Formal statement
d :
ℕ
p :
PMF (Obs d)
E :
Obs d → Prop
(p.toMeasure {o | E o}).toReal = ∑ o : Obs d, if E o then obsMass p o else 0
Proof (Lean source)
lemma observed_event_mass_toReal {d : ℕ} (p : PMF (Obs d)) (E : Obs d → Prop) [DecidablePred E] : (p.toMeasure {o | E o}).toReal = ∑ o : Obs d, if E o then obsMass p o else 0 := by classical rw [PMF.toMeasure_apply_fintype, ENNReal.toReal_sum] · apply Finset.sum_congr rfl intro o ho by_cases hE : E o <;> simp [indicator, hE, obsMass] · intro o ho by_cases hE : E o <;> simp [indicator, hE, PMF.apply_ne_top]
CausalSmith.Stat.MarNearcompleteFrontier.observed_event_mass_toReal · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamCorrectionsBase.lean:75
theorem upper_stream_success_weighted_mean

In one arrived cell, the success count weighted by a function of the total arrived count has the same mean as the total count weighted by that function, times the totalized arrived-success probability. This is the joint-count step used in equation (4). Given the specified input n, the specified input d, the specified input v, the specified input hv, the specified input P, the specified input x, the specified input a, the specified input s, the stated mathematical conclusion holds.

Formal statement
n d v :
ℕ
hv :
1 ≤ v
P :
x :
Fin d
a s :
(∫ streams, streamU d streams x a s * shiftedFalling (streamC d streams x a s) v ∂fourStreamLaw n P)
= outcomeMean (observedLaw P) x a s * (∫ streams, streamC d streams x a s * shiftedFalling (streamC d streams x a s) v ∂fourStreamLaw n P)
Proof (Lean source)
lemma upper_stream_success_weighted_mean {n d v : ℕ} (hv : 1 ≤ v) (P : FullLaw d) (x : Fin d) (a s : Bool) : (∫ streams, streamU d streams x a s * shiftedFalling (streamC d streams x a s) v ∂fourStreamLaw n P) = outcomeMean (observedLaw P) x a s * (∫ streams, streamC d streams x a s * shiftedFalling (streamC d streams x a s) v ∂fourStreamLaw n P) := by classical let Q := (observedLaw P).toMeasure let lam : NNReal := (n : NNReal) / 2 * uniformFourMass 3 let A : Set (Obs d) := {o | inCell o x a s ∧ o.R = true ∧ o.RY = true} let B : Set (Obs d) := {o | inCell o x a s ∧ o.R = true} have hA : MeasurableSet A := by measurability have hB : MeasurableSet B := by measurability have hAB : A ⊆ B := by intro o ho exact ⟨ho.1, ho.2.1⟩ have hmap : Measure.map (fun streams => streams 3) (fourStreamLaw n P) = finitePoissonSampleLaw Q lam := by rw [show fourStreamLaw n P = Measure.pi (fun i : Fin 4 => finitePoissonSampleLaw Q ((n : NNReal) / 2 * uniformFourMass i)) by unfold fourStreamLaw Q exact labeledStreamLaw_eq_independent _ _ _ _] simpa [lam] using (measurePreserving_eval (μ := fun i : Fin 4 => finitePoissonSampleLaw Q ((n : NNReal) / 2 * uniformFourMass i)) (3 : Fin 4)).map_eq have htransfer (C D : Set (Obs d)) (hC : MeasurableSet C) (hD : MeasurableSet D) (hCD : C ⊆ D) : (∫ streams, weightedFactorial C D v (streams 3) ∂fourStreamLaw n P) = ∫ z, weightedFactorial C D v z ∂finitePoissonSampleLaw Q lam := by rw [← hmap] exact (integral_map (measurable_pi_apply 3).aemeasurable (measurable_weightedFactorial C D hC hD v).aestronglyMeasurable).symm have hleft : (∫ streams, streamU d streams x a s * shiftedFalling (streamC d streams x a s) v ∂fourStreamLaw n P) = ∫ z, weightedFactorial A B v z ∂finitePoissonSampleLaw Q lam := by calc _ = ∫ streams, streamArrivedSuccessCount d streams x a s * shiftedFalling (streamC d streams x a s) v ∂fourStreamLaw n P := by apply integral_congr_ae filter_upwards [streamU_eq_arrivedSuccess_ae P x a s] with streams hs rw [hs] _ = ∫ streams, weightedFactorial A B v (streams 3) ∂fourStreamLaw n P := by apply integral_congr_ae filter_upwards [] with streams simpa only [streamArrivedSuccessCount, streamC, A, B, Set.mem_ofPred_eq] using count_mul_shiftedFalling_eq_weightedFactorial hv A B hAB (streams 3) _ = _ := htransfer A B hA hB hAB have hright : (∫ streams, streamC d streams x a s * shiftedFalling (streamC d streams x a s) v ∂fourStreamLaw n P) = ∫ z, weightedFactorial B B v z ∂finitePoissonSampleLaw Q lam := by calc _ = ∫ streams, weightedFactorial B B v (streams 3) ∂fourStreamLaw n P := by apply integral_congr_ae filter_upwards [] with streams simpa only [streamC, B, Set.mem_ofPred_eq] using count_mul_shiftedFalling_eq_weightedFactorial hv B B (Set.Subset.rfl) (streams 3) _ = _ := htransfer B B hB hB Set.Subset.rfl have houtcome : outcomeMean (observedLaw P) x a s = (Q A).toReal / (Q B).toReal := by unfold outcomeMean rw [observed_event_mass_toReal (observedLaw P) (fun o => inCell o x a s ∧ o.R = true ∧ o.RY = true), observed_event_mass_toReal (observedLaw P) (fun o => inCell o x a s ∧ o.R = true)] simp only [inCell, and_assoc] rw [hleft, hright, houtcome, finitePoisson_nestedEvent_factorialMoment Q lam A B hA hB hAB v hv, finitePoisson_nestedEvent_factorialMoment Q lam B B hB hB Set.Subset.rfl v hv] by_cases hQB : (Q B).toReal = 0 · have hQA : (Q A).toReal = 0 := by have hle : Q A ≤ Q B := measure_mono hAB have hleR : (Q A).toReal ≤ (Q B).toReal := ENNReal.toReal_mono (measure_ne_top Q B) hle exact le_antisymm (hleR.trans (le_of_eq hQB)) ENNReal.toReal_nonneg rw [hQA, hQB] simp · field_simp [hQB]
CausalSmith.Stat.MarNearcompleteFrontier.upper_stream_success_weighted_mean · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamCorrectionsBase.lean:89
theorem upper_stream_factorial_moment

Equation (4): the centered success count times a shifted falling factorial has expectation equal to the centered cell mean times the corresponding Poisson-rate power. Given the specified input n, the specified input d, the specified input v, the specified input hv, the specified input P, the specified input q, the specified input h, the specified input x, the specified input a, the specified input s, the stated mathematical conclusion holds.

Formal statement
n d v :
ℕ
hv :
1 ≤ v
P :
q :
ℝ
h :
LawClass d q P
x :
Fin d
a s :
(∫ streams, (streamU d streams x a s - streamC d streams x a s / 2) * shiftedFalling (streamC d streams x a s) v ∂fourStreamLaw n P)
= cellEta P x a s * (streamZ n P x a s) ^ v
Proof (Lean source)
lemma upper_stream_factorial_moment {n d v : ℕ} (hv : 1 ≤ v) (P : FullLaw d) {q : ℝ} (h : LawClass d q P) (x : Fin d) (a s : Bool) : (∫ streams, (streamU d streams x a s - streamC d streams x a s / 2) * shiftedFalling (streamC d streams x a s) v ∂fourStreamLaw n P) = cellEta P x a s * (streamZ n P x a s) ^ v := by classical let μ := fourStreamLaw n P let rate := streamPoissonRate n P x a s let A : Set (Obs d) := {o | inCell o x a s ∧ o.R = true ∧ o.RY = true} let B : Set (Obs d) := {o | inCell o x a s ∧ o.R = true} have hA : MeasurableSet A := by measurability have hB : MeasurableSet B := by measurability have hAB : A ⊆ B := by intro o ho exact ⟨ho.1, ho.2.1⟩ let countC : (Fin 4 → FiniteSample (Obs d)) → ℝ := fun streams => streamC d streams x a s let f : ℝ → ℝ := fun c => c * shiftedFalling c v have hf : Measurable f := by unfold f shiftedFalling fun_prop have hcountC : Measurable countC := by have hevent : Measurable (fun z : FiniteSample (Obs d) => eventCount z B) := measurable_eventCount B hB have hcast : Measurable (fun k : ℕ => (k : ℝ)) := measurable_of_countable _ rw [show countC = (fun k : ℕ => (k : ℝ)) ∘ (fun z : FiniteSample (Obs d) => eventCount z B) ∘ (fun streams : Fin 4 → FiniteSample (Obs d) => streams 3) by funext streams simpa only [countC, streamC, eventCount, B, Set.mem_ofPred_eq, Function.comp_apply] using upper_finiteStreamCount_eq_eventCount (streams 3) (fun o => inCell o x a s ∧ o.R = true)] exact hcast.comp (hevent.comp (measurable_pi_apply 3)) have hCint : Integrable (fun streams => streamC d streams x a s * shiftedFalling (streamC d streams x a s) v) μ := by have hscalar := Causalean.Stat.Concentration.Poisson.poisson_descFactorial_integrable rate v have hscalar' : Integrable (fun k : ℕ => (k : ℝ) * shiftedFalling (k : ℝ) v) (poissonMeasure rate) := by simpa only [upper_shiftedFalling_descFactorial _ _ hv] using hscalar have hdist := (upper_stream_arrived_count_law (n := n) P x a s).2 change Integrable (f ∘ countC) μ apply (integrable_map_measure hf.aestronglyMeasurable hcountC.aemeasurable).mp rw [show Measure.map countC μ = Measure.map (fun k : ℕ => (k : ℝ)) (poissonMeasure rate) by simpa only [countC, μ, rate] using hdist] exact (integrable_map_measure hf.aestronglyMeasurable (measurable_of_countable _).aemeasurable).mpr (by simpa [f, Function.comp_def] using hscalar') have hUint : Integrable (fun streams => streamU d streams x a s * shiftedFalling (streamC d streams x a s) v) μ := by let Q := (observedLaw P).toMeasure let lam : NNReal := (n : NNReal) / 2 * uniformFourMass 3 have hmap : Measure.map (fun streams => streams 3) μ = finitePoissonSampleLaw Q lam := by rw [show μ = Measure.pi (fun i : Fin 4 => finitePoissonSampleLaw Q ((n : NNReal) / 2 * uniformFourMass i)) by unfold μ fourStreamLaw Q exact labeledStreamLaw_eq_independent _ _ _ _] simpa [lam] using (measurePreserving_eval (μ := fun i : Fin 4 => finitePoissonSampleLaw Q ((n : NNReal) / 2 * uniformFourMass i)) (3 : Fin 4)).map_eq have hw := integrable_weightedFactorial Q lam A B hA hB hAB v hv have hwstreams : Integrable (fun streams => weightedFactorial A B v (streams 3)) μ := by apply (integrable_map_measure (measurable_weightedFactorial A B hA hB v).aestronglyMeasurable (measurable_pi_apply 3).aemeasurable).mp rw [hmap] exact hw apply Integrable.congr hwstreams have hUae := streamU_eq_arrivedSuccess_ae (n := n) P x a s filter_upwards [hUae] with streams hU rw [hU] have hp : streamArrivedSuccessCount d streams x a s * shiftedFalling (streamC d streams x a s) v = weightedFactorial A B v (streams 3) := by simpa only [streamArrivedSuccessCount, streamC, A, B, Set.mem_ofPred_eq] using count_mul_shiftedFalling_eq_weightedFactorial hv A B hAB (streams 3) exact hp.symm have hCmoment : (∫ streams, streamC d streams x a s * shiftedFalling (streamC d streams x a s) v ∂μ) = (streamZ n P x a s) ^ v := by have hdist := (upper_stream_arrived_count_law (n := n) P x a s).2 calc _ = ∫ c : ℝ, f c ∂Measure.map countC μ := by exact (integral_map hcountC.aemeasurable hf.aestronglyMeasurable).symm _ = ∫ c : ℝ, f c ∂Measure.map (fun k : ℕ => (k : ℝ)) (poissonMeasure rate) := by rw [show Measure.map countC μ = _ by simpa only [countC, μ, rate] using hdist] _ = ∫ k : ℕ, (k : ℝ) * shiftedFalling (k : ℝ) v ∂poissonMeasure rate := by rw [integral_map (measurable_of_countable _).aemeasurable hf.aestronglyMeasurable] _ = (rate : ℝ) ^ v := upper_poisson_shiftedFalling_moment rate v hv _ = (streamZ n P x a s) ^ v := by congr 1 rw [show (fun streams => (streamU d streams x a s - streamC d streams x a s / 2) * shiftedFalling (streamC d streams x a s) v) = (fun streams => streamU d streams x a s * shiftedFalling (streamC d streams x a s) v - (1 / 2 : ℝ) * (streamC d streams x a s * shiftedFalling (streamC d streams x a s) v)) by funext streams; ring] rw [integral_sub hUint (hCint.const_mul (1 / 2 : ℝ)), integral_const_mul, upper_stream_success_weighted_mean hv P x a s, hCmoment] unfold cellEta ring
CausalSmith.Stat.MarNearcompleteFrontier.upper_stream_factorial_moment · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamCorrectionsBase.lean:179
theorem upper_stream_factorial_integrable

For a positive factorial order, a full-data law, a covariate cell, and treatment and arrival indicators, the centered factorial stream statistic is integrable under the four-stream law.

Formal statement
n d v :
ℕ
hv :
1 ≤ v
P :
x :
Fin d
a s :
Integrable (fun streams => (streamU d streams x a s - streamC d streams x a s / 2) * shiftedFalling (streamC d streams x a s) v) (fourStreamLaw n P)
Proof (Lean source)
lemma upper_stream_factorial_integrable {n d v : ℕ} (hv : 1 ≤ v) (P : FullLaw d) (x : Fin d) (a s : Bool) : Integrable (fun streams => (streamU d streams x a s - streamC d streams x a s / 2) * shiftedFalling (streamC d streams x a s) v) (fourStreamLaw n P) := by classical let Q := (observedLaw P).toMeasure let lam : NNReal := (n : NNReal) / 2 * uniformFourMass 3 let A : Set (Obs d) := {o | inCell o x a s ∧ o.R = true ∧ o.RY = true} let B : Set (Obs d) := {o | inCell o x a s ∧ o.R = true} have hA : MeasurableSet A := by measurability have hB : MeasurableSet B := by measurability have hAB : A ⊆ B := fun o ho => ⟨ho.1, ho.2.1⟩ have hmap : Measure.map (fun streams => streams 3) (fourStreamLaw n P) = finitePoissonSampleLaw Q lam := by rw [show fourStreamLaw n P = Measure.pi (fun i : Fin 4 => finitePoissonSampleLaw Q ((n : NNReal) / 2 * uniformFourMass i)) by unfold fourStreamLaw Q exact labeledStreamLaw_eq_independent _ _ _ _] simpa [lam] using (measurePreserving_eval (μ := fun i : Fin 4 => finitePoissonSampleLaw Q ((n : NNReal) / 2 * uniformFourMass i)) (3 : Fin 4)).map_eq have hweighted (C D : Set (Obs d)) (hC : MeasurableSet C) (hD : MeasurableSet D) (hCD : C ⊆ D) : Integrable (fun streams => weightedFactorial C D v (streams 3)) (fourStreamLaw n P) := by apply (integrable_map_measure (measurable_weightedFactorial C D hC hD v).aestronglyMeasurable (measurable_pi_apply 3).aemeasurable).mp rw [hmap] exact integrable_weightedFactorial Q lam C D hC hD hCD v hv have hU : Integrable (fun streams => streamU d streams x a s * shiftedFalling (streamC d streams x a s) v) (fourStreamLaw n P) := by apply Integrable.congr (hweighted A B hA hB hAB) filter_upwards [streamU_eq_arrivedSuccess_ae (n := n) P x a s] with streams hs rw [hs] have hp : streamArrivedSuccessCount d streams x a s * shiftedFalling (streamC d streams x a s) v = weightedFactorial A B v (streams 3) := by simpa only [streamArrivedSuccessCount, streamC, A, B, Set.mem_ofPred_eq] using count_mul_shiftedFalling_eq_weightedFactorial hv A B hAB (streams 3) exact hp.symm have hC : Integrable (fun streams => streamC d streams x a s * shiftedFalling (streamC d streams x a s) v) (fourStreamLaw n P) := by apply Integrable.congr (hweighted B B hB hB Set.Subset.rfl) filter_upwards [] with streams have hp : streamC d streams x a s * shiftedFalling (streamC d streams x a s) v = weightedFactorial B B v (streams 3) := by simpa only [streamC, B, Set.mem_ofPred_eq] using count_mul_shiftedFalling_eq_weightedFactorial hv B B Set.Subset.rfl (streams 3) exact hp.symm apply Integrable.congr (hU.sub (hC.const_mul (1 / 2 : ℝ))) filter_upwards [] with streams simp only [Pi.sub_apply] ring
CausalSmith.Stat.MarNearcompleteFrontier.upper_stream_factorial_integrable · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamCorrectionsBase.lean:294
CausalSmith.Stat.STAT_MarNearcompleteFrontier_Research.Helpers.UpperRisk.StreamHeavyBias 7 declarations The second remainder in equation (12) is exponentially small uniformly in the arrived-cell rate.

Heavy-branch empty-count bias

The second remainder in equation (12) is exponentially small uniformly in the arrived-cell rate. Summing against missing mass gives its contribution to equation (14), without a factor depending on the alphabet size.

The logarithmic tilt used for pilot selection is at least one. the stated mathematical conclusion holds.

Formal statement
1 ≤ log (4 : ℝ)
Proof (Lean source)
-- @node: upper_log_four_ge_one lemma upper_log_four_ge_one : 1 ≤ log (4 : ℝ) := by have h := Real.one_sub_inv_le_log_of_pos (by norm_num : (0 : ℝ) < 2) have hp := Real.log_pow (2 : ℝ) 2 norm_num at h hp linarith
CausalSmith.Stat.MarNearcompleteFrontier.upper_log_four_ge_one · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamHeavyBias.lean:20
theorem upper_heavy_empty_remainder_le Lemma upper_heavy_empty_remainder_le in the paper ↗

Splitting at one sixteenth of the threshold makes the heavy-branch empty-count remainder uniformly exponentially small. Given the specified input B, the specified input z, the specified input p, the specified input hB, the specified input hp, the stated mathematical conclusion holds. Given the specified input htail.

Formal statement
B z p :
ℝ
hB :
0 ≤ B
hp :
p ∈ Icc 0 1
htail :
1 - p ≤ exp (3 * z - B * log 4 / 4)
(1 - p) * exp (-z) ≤ exp (-B / 16)
Proof (Lean source)
-- @node: upper_heavy_empty_remainder_le lemma upper_heavy_empty_remainder_le {B z p : ℝ} (hB : 0 ≤ B) (hp : p ∈ Icc 0 1) (htail : 1 - p ≤ exp (3 * z - B * log 4 / 4)) : (1 - p) * exp (-z) ≤ exp (-B / 16) := by by_cases hz : B / 16 ≤ z · calc (1 - p) * exp (-z) ≤ 1 * exp (-z) := mul_le_mul_of_nonneg_right (by linarith [hp.1]) (Real.exp_pos _).le _ ≤ exp (-B / 16) := by rw [one_mul] exact Real.exp_le_exp.mpr (by linarith) · have hlog := mul_le_mul_of_nonneg_left upper_log_four_ge_one hB calc (1 - p) * exp (-z) ≤ exp (3 * z - B * log 4 / 4) * exp (-z) := mul_le_mul_of_nonneg_right htail (Real.exp_pos _).le _ = exp (2 * z - B * log 4 / 4) := by rw [← Real.exp_add] congr 1 ring _ ≤ exp (-B / 16) := Real.exp_le_exp.mpr (by nlinarith)
CausalSmith.Stat.MarNearcompleteFrontier.upper_heavy_empty_remainder_le · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamHeavyBias.lean:28
theorem upper_stream_heavy_empty_remainder_le

The heavy empty-count part of the selected correction bias is uniformly bounded at every cell, including null cells. Given the specified input n, the specified input d, the specified input P, the specified input x, the specified input a, the specified input s, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
P :
x :
Fin d
a s :
(1 - streamPilotLightProb n P x a s) * exp (-streamZ n P x a s)
≤ exp (-polyThreshold n / 16)
Proof (Lean source)
-- @node: upper_stream_heavy_empty_remainder_le lemma upper_stream_heavy_empty_remainder_le {n d : ℕ} (P : FullLaw d) (x : Fin d) (a s : Bool) : (1 - streamPilotLightProb n P x a s) * exp (-streamZ n P x a s) ≤ exp (-polyThreshold n / 16) := by have he : 1 < exp (1 : ℝ) + (n : ℝ) := by have h := Real.one_lt_exp_iff.mpr (by norm_num : (0 : ℝ) < 1) linarith [Nat.cast_nonneg (α := ℝ) n] have hL : 0 < ell n := Real.log_pos (by simpa [ell] using he) have hB : 0 ≤ polyThreshold n := by unfold polyThreshold; positivity exact upper_heavy_empty_remainder_le hB (upper_streamPilotLightProb_bounds P x a s) (upper_stream_pilot_heavy_tail P x a s)
CausalSmith.Stat.MarNearcompleteFrontier.upper_stream_heavy_empty_remainder_le · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamHeavyBias.lean:53
theorem upper_stream_heavy_empty_bias_sum_rate

Summing the heavy empty-count remainder against missing cell mass costs at most delta times exp of minus sixteen logarithmic sample scales. Given the specified input n, the specified input d, the specified input q, the specified input P, the specified input h, the stated mathematical conclusion holds. Given the specified input hq.

Formal statement
n d :
ℕ
q :
ℝ
P :
h :
LawClass d q P
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
(∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, missingCellMass P x a s * (1 - streamPilotLightProb n P x a s) * exp (-streamZ n P x a s))
≤ delta q * exp (-16 * ell n)
Proof (Lean source)
-- @node: upper_stream_heavy_empty_bias_sum_rate lemma upper_stream_heavy_empty_bias_sum_rate {n d : ℕ} {q : ℝ} (P : FullLaw d) (h : LawClass d q P) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) : (∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, missingCellMass P x a s * (1 - streamPilotLightProb n P x a s) * exp (-streamZ n P x a s)) ≤ delta q * exp (-16 * ell n) := by calc _ ≤ ∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, missingCellMass P x a s * exp (-polyThreshold n / 16) := by apply Finset.sum_le_sum intro x hx apply Finset.sum_le_sum intro a ha apply Finset.sum_le_sum intro s hs simpa only [mul_assoc] using mul_le_mul_of_nonneg_left (upper_stream_heavy_empty_remainder_le P x a s) ((missingCellMass_bounds P h hq x a s).1) _ = (∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, missingCellMass P x a s) * exp (-polyThreshold n / 16) := by simp only [Finset.sum_mul] _ ≤ delta q * exp (-polyThreshold n / 16) := mul_le_mul_of_nonneg_right (sum_missingCellMass_le_delta P h hq) (Real.exp_pos _).le _ = delta q * exp (-16 * ell n) := by unfold polyThreshold congr 2 ring
CausalSmith.Stat.MarNearcompleteFrontier.upper_stream_heavy_empty_bias_sum_rate · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamHeavyBias.lean:69
theorem upper_missing_weight_half_bound Lemma upper_missing_weight_half_bound in the paper ↗

Multiplying a half-sum cell bias bound by twice the nonnegative missing mass removes the one-half factor. Given the specified input w, the specified input b, the specified input u, the specified input v, the specified input hw, the stated mathematical conclusion holds. Given the specified input hb.

Formal statement
w b u v :
ℝ
hw :
0 ≤ w
hb :
b ≤ (1 / 2 : ℝ) * (u + v)
2 * (w * b) ≤ w * u + w * v
Proof (Lean source)
-- @node: upper_missing_weight_half_bound lemma upper_missing_weight_half_bound {w b u v : ℝ} (hw : 0 ≤ w) (hb : b ≤ (1 / 2 : ℝ) * (u + v)) : 2 * (w * b) ≤ w * u + w * v := by have hh := mul_le_mul_of_nonneg_left hb (show 0 ≤ 2 * w by positivity) nlinarith only [hh]
CausalSmith.Stat.MarNearcompleteFrontier.upper_missing_weight_half_bound · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamHeavyBias.lean:102
theorem upper_stream_pilot_bias_polynomial_sum_le

The signed correction bias is controlled by the pilot-weighted polynomial remainder plus the now-bounded heavy empty-count remainder. Given the specified input n, the specified input d, the specified input q, the specified input P, the specified input h, the stated mathematical conclusion holds. Given the specified input hq.

Formal statement
n d :
ℕ
q :
ℝ
P :
h :
LawClass d q P
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
|2 * (∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, treatmentSign a * missingCellMass P x a s * ((∫ streams, streamG n d streams x a s ∂fourStreamLaw n P) - cellEta P x a s))|
≤ (∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, missingCellMass P x a s * streamPilotLightProb n P x a s * |(qPoly n).eval (streamZ n P x a s)|)
+ delta q * exp (-16 * ell n)
Proof (Lean source)
-- @node: upper_stream_pilot_bias_polynomial_sum_le lemma upper_stream_pilot_bias_polynomial_sum_le {n d : ℕ} {q : ℝ} (P : FullLaw d) (h : LawClass d q P) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) : |2 * (∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, treatmentSign a * missingCellMass P x a s * ((∫ streams, streamG n d streams x a s ∂fourStreamLaw n P) - cellEta P x a s))| ≤ (∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, missingCellMass P x a s * streamPilotLightProb n P x a s * |(qPoly n).eval (streamZ n P x a s)|) + delta q * exp (-16 * ell n) := by have hcell : ∀ x : Fin d, ∀ a s : Bool, 2 * (missingCellMass P x a s * |(∫ streams, streamG n d streams x a s ∂fourStreamLaw n P) - cellEta P x a s|) ≤ missingCellMass P x a s * streamPilotLightProb n P x a s * |(qPoly n).eval (streamZ n P x a s)| + missingCellMass P x a s * (1 - streamPilotLightProb n P x a s) * exp (-streamZ n P x a s) := by intro x a s have hw := (missingCellMass_bounds P h hq x a s).1 have hbound := upper_stream_pilot_bias_cell_abs_le (n := n) P h x a s have hh := upper_missing_weight_half_bound hw hbound simpa only [mul_assoc] using hh have hb := upper_stream_pilot_bias_abs_sum_le (n := n) P h hq simp only [Finset.mul_sum] at hb have hs : (∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, 2 * (missingCellMass P x a s * |(∫ streams, streamG n d streams x a s ∂fourStreamLaw n P) - cellEta P x a s|)) ≤ ∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, (missingCellMass P x a s * streamPilotLightProb n P x a s * |(qPoly n).eval (streamZ n P x a s)| + missingCellMass P x a s * (1 - streamPilotLightProb n P x a s) * exp (-streamZ n P x a s)) := by apply Finset.sum_le_sum intro x hx apply Finset.sum_le_sum intro a ha apply Finset.sum_le_sum intro s hs exact hcell x a s simp only [Finset.sum_add_distrib] at hs have he := upper_stream_heavy_empty_bias_sum_rate (n := n) P h hq simpa only [Finset.mul_sum] using hb.trans (hs.trans (add_le_add_right he _))
CausalSmith.Stat.MarNearcompleteFrontier.upper_stream_pilot_bias_polynomial_sum_le · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamHeavyBias.lean:111
theorem upper_stream_pilot_bias_large_cell_reduction

In the nonfallback regime the only unbounded part of the signed bias is the polynomial remainder on cells above the threshold. Given the specified input n, the specified input d, the specified input q, the specified input hn, the specified input hL, the specified input P, the specified input h, the stated mathematical conclusion holds. Given the specified input hq.

Formal statement
n d :
ℕ
q :
ℝ
hn :
0 < n
hL :
128 ≤ ell n
P :
h :
LawClass d q P
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
|2 * (∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, treatmentSign a * missingCellMass P x a s * ((∫ streams, streamG n d streams x a s ∂fourStreamLaw n P) - cellEta P x a s))|
≤ 268435456 * (delta q * (d : ℝ) / ((n : ℝ) * ell n))
+ (∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, if polyThreshold n < streamZ n P x a s then missingCellMass P x a s * streamPilotLightProb n P x a s * |(qPoly n).eval (streamZ n P x a s)| else 0)
+ delta q * exp (-16 * ell n)
Proof (Lean source)
-- @node: upper_stream_pilot_bias_large_cell_reduction lemma upper_stream_pilot_bias_large_cell_reduction {n d : ℕ} {q : ℝ} (hn : 0 < n) (hL : 128 ≤ ell n) (P : FullLaw d) (h : LawClass d q P) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) : |2 * (∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, treatmentSign a * missingCellMass P x a s * ((∫ streams, streamG n d streams x a s ∂fourStreamLaw n P) - cellEta P x a s))| ≤ 268435456 * (delta q * (d : ℝ) / ((n : ℝ) * ell n)) + (∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, if polyThreshold n < streamZ n P x a s then missingCellMass P x a s * streamPilotLightProb n P x a s * |(qPoly n).eval (streamZ n P x a s)| else 0) + delta q * exp (-16 * ell n) := by classical have hsplit : (∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, missingCellMass P x a s * streamPilotLightProb n P x a s * |(qPoly n).eval (streamZ n P x a s)|) = (∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, if streamZ n P x a s ≤ polyThreshold n then missingCellMass P x a s * streamPilotLightProb n P x a s * |(qPoly n).eval (streamZ n P x a s)| else 0) + (∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, if polyThreshold n < streamZ n P x a s then missingCellMass P x a s * streamPilotLightProb n P x a s * |(qPoly n).eval (streamZ n P x a s)| else 0) := by rw [← Finset.sum_add_distrib] apply Finset.sum_congr rfl intro x hx rw [← Finset.sum_add_distrib] apply Finset.sum_congr rfl intro a ha rw [← Finset.sum_add_distrib] apply Finset.sum_congr rfl intro s hs by_cases hz : streamZ n P x a s ≤ polyThreshold n · simp only [hz, not_lt_of_ge hz, if_true, if_false, add_zero] · simp only [hz, lt_of_not_ge hz, if_true, if_false, zero_add] have hb := upper_stream_pilot_bias_polynomial_sum_le (n := n) P h hq rw [hsplit] at hb have hs := upper_small_cell_pilot_bias_sum_rate hn hL P h hq linarith only [hb, hs]
CausalSmith.Stat.MarNearcompleteFrontier.upper_stream_pilot_bias_large_cell_reduction · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamHeavyBias.lean:160
CausalSmith.Stat.STAT_MarNearcompleteFrontier_Research.Helpers.UpperRisk.StreamHeavyVariance 6 declarations Square integrability and independent stream moments give the cellwise variance bound and its alphabet-uniform sum in equation (16) of the upper-risk proof.

Heavy correction product variance

Square integrability and independent stream moments give the cellwise variance bound and its alphabet-uniform sum in equation (16) of the upper-risk proof.

theorem upper_fourStreamLaw_isProbabilityMeasure

The ideal four-stream experiment is a probability measure. Given the specified input n, the specified input d, the specified input P, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
P :
Proof (Lean source)
-- @node: upper_fourStreamLaw_isProbabilityMeasure lemma upper_fourStreamLaw_isProbabilityMeasure {n d : ℕ} (P : FullLaw d) : IsProbabilityMeasure (fourStreamLaw n P) := by rw [show fourStreamLaw n P = Measure.pi (fun i : Fin 4 => finitePoissonSampleLaw (observedLaw P).toMeasure ((n : NNReal) / 2 * uniformFourMass i)) from labeledStreamLaw_eq_independent _ _ _ _] infer_instance
CausalSmith.Stat.MarNearcompleteFrontier.upper_fourStreamLaw_isProbabilityMeasure · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamHeavyVariance.lean:21
theorem upper_streamV_memLp_two

The normalized missing-cell count is square integrable, including at zero sample size under the totalized division convention. Given the specified input n, the specified input d, the specified input P, the specified input x, the specified input a, the specified input s, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
P :
x :
Fin d
a s :
MemLp (fun streams => streamV n d streams x a s) 2 (fourStreamLaw n P)
Proof (Lean source)
-- @node: upper_streamV_memLp_two lemma upper_streamV_memLp_two {n d : ℕ} (P : FullLaw d) (x : Fin d) (a s : Bool) : MemLp (fun streams => streamV n d streams x a s) 2 (fourStreamLaw n P) := by classical let μ := fourStreamLaw n P let Q := (observedLaw P).toMeasure let lam : NNReal := ((n : NNReal) / 2) * uniformFourMass 1 let E : Obs d → Bool := fun o => decide (inCell o x a s ∧ o.R = false) let count : (Fin 4 → FiniteSample (Obs d)) → ℕ := fun streams => (Finset.univ.filter (fun i : Fin (streams 1).count => E ((streams 1).points i) = true)).card let rate : NNReal := lam * (Q {o | E o = true}).toNNReal have hstream : Measure.map (fun streams ↦ streams 1) μ = finitePoissonSampleLaw Q lam := by let ν : Fin 4 → Measure (FiniteSample (Obs d)) := fun i ↦ finitePoissonSampleLaw Q (((n : NNReal) / 2) * uniformFourMass i) have (i : Fin 4) : IsProbabilityMeasure (ν i) := by dsimp [ν] infer_instance rw [show μ = Measure.pi ν by unfold μ fourStreamLaw ν exact labeledStreamLaw_eq_independent _ _ _ _] simpa [ν, Q, lam] using (Measure.pi_map_eval (μ := ν) 1) have hcountMeas : Measurable count := (upper_measurable_eventCount E).comp (measurable_pi_apply 1) have hlaw : Measure.map count μ = poissonMeasure rate := by rw [show count = (fun z : FiniteSample (Obs d) => (Finset.univ.filter (fun i : Fin z.count => E (z.points i) = true)).card) ∘ (fun streams => streams 1) by rfl] rw [← Measure.map_map (upper_measurable_eventCount E) (measurable_pi_apply 1), hstream] exact upper_finitePoissonSampleLaw_eventCount Q lam E (measurable_of_countable E) have hcountReal (streams : Fin 4 → FiniteSample (Obs d)) : finiteStreamCount (streams 1) (fun o ↦ inCell o x a s ∧ o.R = false) = (count streams : ℝ) := by simpa only [count, E, decide_eq_true_eq] using upper_finiteStreamCount_eq_eventCount (streams 1) (fun o ↦ inCell o x a s ∧ o.R = false) have hV (streams : Fin 4 → FiniteSample (Obs d)) : streamV n d streams x a s = (count streams : ℝ) / ((n : ℝ) / 8) := by unfold streamV rw [hcountReal] have hp : MemLp (fun k : ℕ => (k : ℝ)) 2 (Measure.map count μ) := by rw [hlaw] exact poisson_natCast_memLp_two rate have hc := hp.comp_of_map hcountMeas.aemeasurable simpa only [Function.comp_apply, ← div_eq_mul_inv, ← hV, μ] using hc.mul_const (((n : ℝ) / 8)⁻¹)
CausalSmith.Stat.MarNearcompleteFrontier.upper_streamV_memLp_two · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamHeavyVariance.lean:31
theorem upper_streamVD_memLp_two

The missing-count times heavy-correction statistic is square integrable: the heavy factor has absolute value at most one half almost surely. Given the specified input n, the specified input d, the specified input P, the specified input x, the specified input a, the specified input s, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
P :
x :
Fin d
a s :
MemLp (fun streams => streamV n d streams x a s * streamD d streams x a s) 2 (fourStreamLaw n P)
Proof (Lean source)
-- @node: upper_streamVD_memLp_two lemma upper_streamVD_memLp_two {n d : ℕ} (P : FullLaw d) (x : Fin d) (a s : Bool) : MemLp (fun streams => streamV n d streams x a s * streamD d streams x a s) 2 (fourStreamLaw n P) := by have hv := upper_streamV_memLp_two (n := n) P x a s have hm := hv.aestronglyMeasurable.mul (upper_measurable_streamD x a s).aestronglyMeasurable apply hv.of_le_mul hm (c := (1 / 2 : ℝ)) filter_upwards [upper_streamD_abs_le_half_ae (n := n) P x a s] with streams hs simp only [Pi.mul_apply, Real.norm_eq_abs, abs_mul] nlinarith [abs_nonneg (streamV n d streams x a s)]
CausalSmith.Stat.MarNearcompleteFrontier.upper_streamVD_memLp_two · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamHeavyVariance.lean:83
theorem upper_streamD_mean_sq_le

The mean of the heavy correction has squared absolute size at most one quarter under its almost-sure centered Bernoulli range. Given the specified input n, the specified input d, the specified input P, the specified input x, the specified input a, the specified input s, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
P :
x :
Fin d
a s :
(∫ streams, streamD d streams x a s ∂fourStreamLaw n P) ^ 2 ≤ (1 / 4 : ℝ)
Proof (Lean source)
-- @node: upper_streamD_mean_sq_le lemma upper_streamD_mean_sq_le {n d : ℕ} (P : FullLaw d) (x : Fin d) (a s : Bool) : (∫ streams, streamD d streams x a s ∂fourStreamLaw n P) ^ 2 ≤ (1 / 4 : ℝ) := by let := upper_fourStreamLaw_isProbabilityMeasure (n := n) P have hm := (upper_measurable_streamD x a s).aestronglyMeasurable (μ := fourStreamLaw n P) have hb := upper_streamD_abs_le_half_ae (n := n) P x a s have hi : Integrable (fun streams => |streamD d streams x a s|) (fourStreamLaw n P) := by apply Integrable.of_bound hm.norm (1 / 2) simpa only [Real.norm_eq_abs, abs_abs] using hb have hbound : |∫ streams, streamD d streams x a s ∂fourStreamLaw n P| ≤ 1 / 2 := by apply abs_integral_le_integral_abs.trans calc _ ≤ ∫ _streams, (1 / 2 : ℝ) ∂fourStreamLaw n P := integral_mono_ae hi (integrable_const _) hb _ = 1 / 2 := by simp have hs := pow_le_pow_left₀ (abs_nonneg _) hbound 2 norm_num only [sq_abs, div_pow] at hs ⊢ exact hs
CausalSmith.Stat.MarNearcompleteFrontier.upper_streamD_mean_sq_le · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamHeavyVariance.lean:98
theorem upper_streamVD_variance_le

Independent stream moments and the inverse-rate heavy variance bound give the cellwise product-variance budget in equation (16). Given the specified input n, the specified input d, the specified input hn, the specified input P, the specified input x, the specified input a, the specified input s, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
hn :
0 < n
P :
x :
Fin d
a s :
variance (fun streams => streamV n d streams x a s * streamD d streams x a s) (fourStreamLaw n P)
≤ 4 * (missingCellMass P x a s) ^ 2 / (1 + streamZ n P x a s)
+ (17 / 4 : ℝ) * (missingCellMass P x a s / ((n : ℝ) / 8))
Proof (Lean source)
-- @node: upper_streamVD_variance_le lemma upper_streamVD_variance_le {n d : ℕ} (hn : 0 < n) (P : FullLaw d) (x : Fin d) (a s : Bool) : variance (fun streams => streamV n d streams x a s * streamD d streams x a s) (fourStreamLaw n P) ≤ 4 * (missingCellMass P x a s) ^ 2 / (1 + streamZ n P x a s) + (17 / 4 : ℝ) * (missingCellMass P x a s / ((n : ℝ) / 8)) := by let := upper_fourStreamLaw_isProbabilityMeasure (n := n) P have hd : MemLp (fun streams => streamD d streams x a s) 2 (fourStreamLaw n P) := by apply MemLp.of_bound (upper_measurable_streamD x a s).aestronglyMeasurable (1 / 2) simpa only [Real.norm_eq_abs] using upper_streamD_abs_le_half_ae (n := n) P x a s have hvar := variance_eq_sub hd have hν : variance (fun streams => streamD d streams x a s) (fourStreamLaw n P) ≤ 4 / (1 + streamZ n P x a s) := by rw [variance_eq_integral hd.aemeasurable] exact upper_stream_heavy_variance_le P x a s rw [variance_eq_sub (upper_streamVD_memLp_two P x a s)] change (∫ streams, (streamV n d streams x a s * streamD d streams x a s) ^ 2 ∂fourStreamLaw n P) - (∫ streams, streamV n d streams x a s * streamD d streams x a s ∂fourStreamLaw n P) ^ 2 ≤ _ rw [upper_stream_vd_second_moment hn, upper_stream_vd_mean hn] have hsecond : (∫ streams, (streamD d streams x a s) ^ 2 ∂fourStreamLaw n P) = variance (fun streams => streamD d streams x a s) (fourStreamLaw n P) + (∫ streams, streamD d streams x a s ∂fourStreamLaw n P) ^ 2 := by change variance (fun streams => streamD d streams x a s) (fourStreamLaw n P) = (∫ streams, (streamD d streams x a s) ^ 2 ∂fourStreamLaw n P) - (∫ streams, streamD d streams x a s ∂fourStreamLaw n P) ^ 2 at hvar linarith rw [hsecond] have hw : 0 ≤ missingCellMass P x a s := by unfold missingCellMass exact sub_nonneg.mpr (arrivedCellMass_le_cellMass P x a s) have hz : 0 ≤ streamZ n P x a s := mul_nonneg (by positivity) (arrivedCellMass_nonneg P x a s) exact heavyProductVariance_algebra_le hw (by positivity) hz hν (upper_streamD_mean_sq_le P x a s)
CausalSmith.Stat.MarNearcompleteFrontier.upper_streamVD_variance_le · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamHeavyVariance.lean:121
theorem upper_streamVD_variance_sum_le

The sum of the actual heavy product variances is bounded by 34 divided by the sample size, uniformly over the alphabet and the legal arrival floors. Given the specified input n, the specified input d, the specified input q, the specified input hn, the specified input P, the specified input h, the stated mathematical conclusion holds. Given the specified input hq.

Formal statement
n d :
ℕ
q :
ℝ
hn :
0 < n
P :
h :
LawClass d q P
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
(∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, variance (fun streams => streamV n d streams x a s * streamD d streams x a s) (fourStreamLaw n P))
≤ 34 / (n : ℝ)
Proof (Lean source)
-- @node: upper_streamVD_variance_sum_le lemma upper_streamVD_variance_sum_le {n d : ℕ} {q : ℝ} (hn : 0 < n) (P : FullLaw d) (h : LawClass d q P) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) : (∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, variance (fun streams => streamV n d streams x a s * streamD d streams x a s) (fourStreamLaw n P)) ≤ 34 / (n : ℝ) := by calc _ ≤ ∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, (4 * (missingCellMass P x a s) ^ 2 / (1 + streamZ n P x a s) + (17 / 4 : ℝ) * (missingCellMass P x a s / ((n : ℝ) / 8))) := by apply Finset.sum_le_sum intro x hx apply Finset.sum_le_sum intro a ha apply Finset.sum_le_sum intro s hs exact upper_streamVD_variance_le hn P x a s _ ≤ 17 / (4 * ((n : ℝ) / 8)) := heavyProductVariance_budget P h hq ((n : ℝ) / 8) (by positivity) _ = 34 / (n : ℝ) := by ring
CausalSmith.Stat.MarNearcompleteFrontier.upper_streamVD_variance_sum_le · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamHeavyVariance.lean:161
CausalSmith.Stat.STAT_MarNearcompleteFrontier_Research.Helpers.UpperRisk.StreamLargeBias 8 declarations The light mean identity and its second moment suppress the large-cell Chebyshev remainder, completing equation (14) of the upper-risk proof.

Large-cell pilot bias and the aggregate bias rate

The light mean identity and its second moment suppress the large-cell Chebyshev remainder, completing equation (14) of the upper-risk proof.

theorem upper_streamH_mean_sq_le

The square of the light correction's mean is bounded by its second moment. Given the specified input n, the specified input d, the specified input P, the specified input x, the specified input a, the specified input s, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
P :
x :
Fin d
a s :
(∫ streams, streamH n d streams x a s ∂fourStreamLaw n P) ^ 2
≤ ∫ streams, (streamH n d streams x a s) ^ 2 ∂fourStreamLaw n P
Proof (Lean source)
-- @node: upper_streamH_mean_sq_le lemma upper_streamH_mean_sq_le {n d : ℕ} (P : FullLaw d) (x : Fin d) (a s : Bool) : (∫ streams, streamH n d streams x a s ∂fourStreamLaw n P) ^ 2 ≤ ∫ streams, (streamH n d streams x a s) ^ 2 ∂fourStreamLaw n P := by let := upper_fourStreamLaw_isProbabilityMeasure (n := n) P have hLp := (memLp_two_iff_integrable_sq (upper_measurable_streamH x a s).aestronglyMeasurable).mpr (upper_streamH_sq_integrable (n := n) P x a s) have hv := variance_nonneg (fun streams => streamH n d streams x a s) (fourStreamLaw n P) rw [variance_eq_sub hLp] at hv exact sub_nonneg.mp hv
CausalSmith.Stat.MarNearcompleteFrontier.upper_streamH_mean_sq_le · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamLargeBias.lean:19
theorem upper_stream_pilot_large_prob_le

In a large cell, the pilot lower tail decays at least as exp(-z/4). Given the specified input n, the specified input d, the specified input hL, the specified input P, the specified input x, the specified input a, the specified input s, the specified input hzB, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
hL :
128 ≤ ell n
P :
x :
Fin d
a s :
hzB :
polyThreshold n ≤ streamZ n P x a s
streamPilotLightProb n P x a s ≤ exp (-streamZ n P x a s / 4)
Proof (Lean source)
-- @node: upper_stream_pilot_large_prob_le lemma upper_stream_pilot_large_prob_le {n d : ℕ} (hL : 128 ≤ ell n) (P : FullLaw d) (x : Fin d) (a s : Bool) (hzB : polyThreshold n ≤ streamZ n P x a s) : streamPilotLightProb n P x a s ≤ exp (-streamZ n P x a s / 4) := by apply (upper_stream_pilot_light_tail (n := n) P x a s).trans apply Real.exp_le_exp.mpr have hB : 0 ≤ polyThreshold n := by unfold polyThreshold; linarith have hh := mul_le_mul_of_nonneg_left upper_log_bases_le.2 hB linarith
CausalSmith.Stat.MarNearcompleteFrontier.upper_stream_pilot_large_prob_le · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamLargeBias.lean:34
theorem upper_streamH_pilot_large_mean_abs_le

Pilot weighting makes the absolute light mean decay at exp(-z/16), by the mean-square inequality and equation (11). Given the specified input n, the specified input d, the specified input hL, the specified input P, the specified input x, the specified input a, the specified input s, the specified input hzB, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
hL :
128 ≤ ell n
P :
x :
Fin d
a s :
hzB :
polyThreshold n ≤ streamZ n P x a s
streamPilotLightProb n P x a s * |∫ streams, streamH n d streams x a s ∂fourStreamLaw n P|
≤ exp (-streamZ n P x a s / 16)
Proof (Lean source)
-- @node: upper_streamH_pilot_large_mean_abs_le lemma upper_streamH_pilot_large_mean_abs_le {n d : ℕ} (hL : 128 ≤ ell n) (P : FullLaw d) (x : Fin d) (a s : Bool) (hzB : polyThreshold n ≤ streamZ n P x a s) : streamPilotLightProb n P x a s * |∫ streams, streamH n d streams x a s ∂fourStreamLaw n P| ≤ exp (-streamZ n P x a s / 16) := by let p := streamPilotLightProb n P x a s let M := ∫ streams, streamH n d streams x a s ∂fourStreamLaw n P let E := ∫ streams, (streamH n d streams x a s) ^ 2 ∂fourStreamLaw n P have hp := upper_streamPilotLightProb_bounds (n := n) P x a s have hM : M ^ 2 ≤ E := upper_streamH_mean_sq_le P x a s have hE : p * E ≤ exp (-streamZ n P x a s / 8) := upper_streamH_pilot_large_second_moment_le hL P x a s hzB have hp2 : p ^ 2 ≤ p := by dsimp [p]; nlinarith [hp.1, hp.2] have hEn : 0 ≤ E := (sq_nonneg M).trans hM have hs : (p * |M|) ^ 2 ≤ exp (-streamZ n P x a s / 8) := by calc (p * |M|) ^ 2 = p ^ 2 * M ^ 2 := by rw [mul_pow, sq_abs] _ ≤ p ^ 2 * E := mul_le_mul_of_nonneg_left hM (sq_nonneg _) _ ≤ p * E := mul_le_mul_of_nonneg_right hp2 hEn _ ≤ _ := hE have hexp : exp (-streamZ n P x a s / 16) ^ 2 = exp (-streamZ n P x a s / 8) := by rw [← Real.exp_nat_mul] congr 1 ring change p * |M| ≤ _ nlinarith [Real.exp_pos (-streamZ n P x a s / 16)]
CausalSmith.Stat.MarNearcompleteFrontier.upper_streamH_pilot_large_mean_abs_le · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamLargeBias.lean:46
theorem upper_stream_large_centered_qPoly_le

Equation (5) turns the light mean bound into a bound for the actual centered Chebyshev remainder, without division by the centered regression. Given the specified input n, the specified input d, the specified input q, the specified input hL, the specified input P, the specified input h, the specified input x, the specified input a, the specified input s, the specified input hzB, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
hL :
128 ≤ ell n
P :
h :
LawClass d q P
x :
Fin d
a s :
hzB :
polyThreshold n ≤ streamZ n P x a s
streamPilotLightProb n P x a s * |cellEta P x a s * (qPoly n).eval (streamZ n P x a s)|
≤ (3 / 2 : ℝ) * exp (-polyThreshold n / 16)
Proof (Lean source)
-- @node: upper_stream_large_centered_qPoly_le lemma upper_stream_large_centered_qPoly_le {n d : ℕ} {q : ℝ} (hL : 128 ≤ ell n) (P : FullLaw d) (h : LawClass d q P) (x : Fin d) (a s : Bool) (hzB : polyThreshold n ≤ streamZ n P x a s) : streamPilotLightProb n P x a s * |cellEta P x a s * (qPoly n).eval (streamZ n P x a s)| ≤ (3 / 2 : ℝ) * exp (-polyThreshold n / 16) := by let p := streamPilotLightProb n P x a s let M := ∫ streams, streamH n d streams x a s ∂fourStreamLaw n P have hrepr : cellEta P x a s * (qPoly n).eval (streamZ n P x a s) = cellEta P x a s - M := by dsimp [M] rw [upper_stream_light_mean P h x a s] ring have hp0 : 0 ≤ p := (upper_streamPilotLightProb_bounds P x a s).1 have hz0 : 0 ≤ streamZ n P x a s := by have hB : 0 ≤ polyThreshold n := by unfold polyThreshold; linarith exact hB.trans hzB have hprob : p ≤ exp (-polyThreshold n / 16) := (upper_stream_pilot_large_prob_le hL P x a s hzB).trans (Real.exp_le_exp.mpr (by linarith)) have hmean : p * |M| ≤ exp (-polyThreshold n / 16) := (upper_streamH_pilot_large_mean_abs_le hL P x a s hzB).trans (Real.exp_le_exp.mpr (by linarith)) rw [hrepr] change p * |cellEta P x a s - M| ≤ _ calc _ ≤ p * (|cellEta P x a s| + |M|) := mul_le_mul_of_nonneg_left (abs_sub _ _) hp0 _ ≤ p * (1 / 2) + p * |M| := by have hh := mul_le_mul_of_nonneg_left (upper_cellEta_abs_le_half P x a s) hp0 linarith _ ≤ _ := by linarith
CausalSmith.Stat.MarNearcompleteFrontier.upper_stream_large_centered_qPoly_le · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamLargeBias.lean:78
theorem upper_stream_pilot_bias_centered_abs_le

The absolute branch bias retains the centered regression in the polynomial term, so the large-cell mean identity can be used directly. Given the specified input n, the specified input d, the specified input q, the specified input P, the specified input h, the specified input x, the specified input a, the specified input s, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
P :
h :
LawClass d q P
x :
Fin d
a s :
|(∫ streams, streamG n d streams x a s ∂fourStreamLaw n P) - cellEta P x a s|
≤ streamPilotLightProb n P x a s * |cellEta P x a s * (qPoly n).eval (streamZ n P x a s)|
+ (1 / 2 : ℝ) * (1 - streamPilotLightProb n P x a s) * exp (-streamZ n P x a s)
Proof (Lean source)
-- @node: upper_stream_pilot_bias_centered_abs_le lemma upper_stream_pilot_bias_centered_abs_le {n d : ℕ} {q : ℝ} (P : FullLaw d) (h : LawClass d q P) (x : Fin d) (a s : Bool) : |(∫ streams, streamG n d streams x a s ∂fourStreamLaw n P) - cellEta P x a s| ≤ streamPilotLightProb n P x a s * |cellEta P x a s * (qPoly n).eval (streamZ n P x a s)| + (1 / 2 : ℝ) * (1 - streamPilotLightProb n P x a s) * exp (-streamZ n P x a s) := by let p := streamPilotLightProb n P x a s let Q := (qPoly n).eval (streamZ n P x a s) let e := exp (-streamZ n P x a s) have hp := upper_streamPilotLightProb_bounds (n := n) P x a s change p ∈ Icc 0 1 at hp have he : 0 ≤ e := (Real.exp_pos _).le have hη := upper_cellEta_abs_le_half P x a s rw [upper_stream_pilot_bias P h x a s] change |-(cellEta P x a s) * (p * Q + (1 - p) * e)| ≤ _ rw [show -(cellEta P x a s) * (p * Q + (1 - p) * e) = -(p * (cellEta P x a s * Q) + (1 - p) * e * cellEta P x a s) by ring, abs_neg] calc _ ≤ |p * (cellEta P x a s * Q)| + |(1 - p) * e * cellEta P x a s| := abs_add_le _ _ _ = p * |cellEta P x a s * Q| + (1 - p) * e * |cellEta P x a s| := by simp only [abs_mul, abs_of_nonneg hp.1, abs_of_nonneg (sub_nonneg.mpr hp.2), abs_of_nonneg he] _ ≤ _ := by have hh := mul_le_mul_of_nonneg_left hη (mul_nonneg (sub_nonneg.mpr hp.2) he) dsimp only [p, Q, e] at * linarith
CausalSmith.Stat.MarNearcompleteFrontier.upper_stream_pilot_bias_centered_abs_le · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamLargeBias.lean:115
theorem upper_stream_pilot_large_bias_abs_le

Large-cell branch bias is exponentially small, including the empty-count heavy remainder. Given the specified input n, the specified input d, the specified input q, the specified input hL, the specified input P, the specified input h, the specified input x, the specified input a, the specified input s, the specified input hzB, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
hL :
128 ≤ ell n
P :
h :
LawClass d q P
x :
Fin d
a s :
hzB :
polyThreshold n ≤ streamZ n P x a s
|(∫ streams, streamG n d streams x a s ∂fourStreamLaw n P) - cellEta P x a s|
≤ 2 * exp (-polyThreshold n / 16)
Proof (Lean source)
-- @node: upper_stream_pilot_large_bias_abs_le lemma upper_stream_pilot_large_bias_abs_le {n d : ℕ} {q : ℝ} (hL : 128 ≤ ell n) (P : FullLaw d) (h : LawClass d q P) (x : Fin d) (a s : Bool) (hzB : polyThreshold n ≤ streamZ n P x a s) : |(∫ streams, streamG n d streams x a s ∂fourStreamLaw n P) - cellEta P x a s| ≤ 2 * exp (-polyThreshold n / 16) := by have hb := upper_stream_pilot_bias_centered_abs_le (n := n) P h x a s have hlight := upper_stream_large_centered_qPoly_le hL P h x a s hzB have hheavy := upper_stream_heavy_empty_remainder_le (n := n) P x a s linarith
CausalSmith.Stat.MarNearcompleteFrontier.upper_stream_pilot_large_bias_abs_le · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamLargeBias.lean:150
theorem upper_stream_pilot_bias_split_weighted_le

Each missing-mass-weighted bias has a small-cell polynomial budget and an exponentially small residual, completing the cellwise split in (14). Given the specified input n, the specified input d, the specified input q, the specified input hL, the specified input P, the specified input h, the specified input x, the specified input a, the specified input s, the stated mathematical conclusion holds. Given the specified input hq.

Formal statement
n d :
ℕ
q :
ℝ
hL :
128 ≤ ell n
P :
h :
LawClass d q P
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
x :
Fin d
a s :
2 * (missingCellMass P x a s * |(∫ streams, streamG n d streams x a s ∂fourStreamLaw n P) - cellEta P x a s|)
≤ (if streamZ n P x a s ≤ polyThreshold n then missingCellMass P x a s * streamPilotLightProb n P x a s * |(qPoly n).eval (streamZ n P x a s)| else 0)
+ 4 * missingCellMass P x a s * exp (-polyThreshold n / 16)
Proof (Lean source)
-- @node: upper_stream_pilot_bias_split_weighted_le lemma upper_stream_pilot_bias_split_weighted_le {n d : ℕ} {q : ℝ} (hL : 128 ≤ ell n) (P : FullLaw d) (h : LawClass d q P) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (x : Fin d) (a s : Bool) : 2 * (missingCellMass P x a s * |(∫ streams, streamG n d streams x a s ∂fourStreamLaw n P) - cellEta P x a s|) ≤ (if streamZ n P x a s ≤ polyThreshold n then missingCellMass P x a s * streamPilotLightProb n P x a s * |(qPoly n).eval (streamZ n P x a s)| else 0) + 4 * missingCellMass P x a s * exp (-polyThreshold n / 16) := by have hw := (missingCellMass_bounds P h hq x a s).1 by_cases hz : streamZ n P x a s ≤ polyThreshold n · rw [if_pos hz] have hb := upper_missing_weight_half_bound hw (upper_stream_pilot_bias_cell_abs_le (n := n) P h x a s) have he := mul_le_mul_of_nonneg_left (upper_stream_heavy_empty_remainder_le (n := n) P x a s) hw have hn : 0 ≤ missingCellMass P x a s * exp (-polyThreshold n / 16) := mul_nonneg hw (Real.exp_pos _).le simp only [mul_assoc] at hb he ⊢ linarith · rw [if_neg hz, zero_add] have hb := mul_le_mul_of_nonneg_left (upper_stream_pilot_large_bias_abs_le hL P h x a s (le_of_lt (lt_of_not_ge hz))) hw linarith
CausalSmith.Stat.MarNearcompleteFrontier.upper_stream_pilot_bias_split_weighted_le · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamLargeBias.lean:164
theorem upper_stream_pilot_bias_sum_rate

Equation (14) for the actual pilot-selected correction: the signed aggregate bias has the desired logarithmic rate plus exponential residual. Given the specified input n, the specified input d, the specified input q, the specified input hn, the specified input hL, the specified input P, the specified input h, the stated mathematical conclusion holds. Given the specified input hq.

Formal statement
n d :
ℕ
q :
ℝ
hn :
0 < n
hL :
128 ≤ ell n
P :
h :
LawClass d q P
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
|2 * (∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, treatmentSign a * missingCellMass P x a s * ((∫ streams, streamG n d streams x a s ∂fourStreamLaw n P) - cellEta P x a s))|
≤ 268435456 * (delta q * (d : ℝ) / ((n : ℝ) * ell n))
+ 4 * delta q * exp (-16 * ell n)
Proof (Lean source)
-- @node: upper_stream_pilot_bias_sum_rate lemma upper_stream_pilot_bias_sum_rate {n d : ℕ} {q : ℝ} (hn : 0 < n) (hL : 128 ≤ ell n) (P : FullLaw d) (h : LawClass d q P) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) : |2 * (∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, treatmentSign a * missingCellMass P x a s * ((∫ streams, streamG n d streams x a s ∂fourStreamLaw n P) - cellEta P x a s))| ≤ 268435456 * (delta q * (d : ℝ) / ((n : ℝ) * ell n)) + 4 * delta q * exp (-16 * ell n) := by classical have hb := upper_stream_pilot_bias_abs_sum_le (n := n) P h hq simp only [Finset.mul_sum] at hb have hs : (∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, 2 * (missingCellMass P x a s * |(∫ streams, streamG n d streams x a s ∂fourStreamLaw n P) - cellEta P x a s|)) ≤ ∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, ((if streamZ n P x a s ≤ polyThreshold n then missingCellMass P x a s * streamPilotLightProb n P x a s * |(qPoly n).eval (streamZ n P x a s)| else 0) + 4 * missingCellMass P x a s * exp (-polyThreshold n / 16)) := by apply Finset.sum_le_sum intro x hx apply Finset.sum_le_sum intro a ha apply Finset.sum_le_sum intro s hs exact upper_stream_pilot_bias_split_weighted_le hL P h hq x a s simp only [Finset.sum_add_distrib] at hs have hsmall := upper_small_cell_pilot_bias_sum_rate hn hL P h hq have hmass := sum_missingCellMass_le_delta P h hq have he : (∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, 4 * missingCellMass P x a s * exp (-polyThreshold n / 16)) ≤ 4 * delta q * exp (-16 * ell n) := by have hexp : -polyThreshold n / 16 = -16 * ell n := by unfold polyThreshold ring rw [hexp] calc _ = 4 * (∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, missingCellMass P x a s) * exp (-16 * ell n) := by simp only [Finset.mul_sum, Finset.sum_mul] _ ≤ _ := mul_le_mul_of_nonneg_right (mul_le_mul_of_nonneg_left hmass (by norm_num)) (Real.exp_pos _).le simpa only [Finset.mul_sum] using hb.trans (hs.trans (add_le_add hsmall he))
CausalSmith.Stat.MarNearcompleteFrontier.upper_stream_pilot_bias_sum_rate · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamLargeBias.lean:194
CausalSmith.Stat.STAT_MarNearcompleteFrontier_Research.Helpers.UpperRisk.StreamLargeVariance 9 declarations Pilot selection is retained in the independent three-stream product, so the large-cell light moment decays exponentially as required by equation (18).

Large-cell correction second moments

Pilot selection is retained in the independent three-stream product, so the large-cell light moment decays exponentially as required by equation (18).

theorem upper_three_stream_product_moment

Three distinct ideal streams factor integrable coordinate products. Given the specified input n, the specified input d, the specified input P, the specified input hf, the specified input hg, the specified input hh, the stated mathematical conclusion holds. Given the specified input f, the specified input g, the specified input h, the specified input hfi, the specified input hgi, the specified input hhi.

Formal statement
n d :
ℕ
P :
f g h :
FiniteSample (Obs d) → ℝ
hf :
hg :
hh :
hfi :
Integrable (fun streams => f (streams 1)) (fourStreamLaw n P)
hgi :
Integrable (fun streams => g (streams 2)) (fourStreamLaw n P)
hhi :
Integrable (fun streams => h (streams 3)) (fourStreamLaw n P)
conclusion 1
Integrable (fun streams => f (streams 1) * g (streams 2) * h (streams 3)) (fourStreamLaw n P)
conclusion 2
(∫ streams, f (streams 1) * g (streams 2) * h (streams 3) ∂fourStreamLaw n P)
= (∫ streams, f (streams 1) ∂fourStreamLaw n P) * (∫ streams, g (streams 2) ∂fourStreamLaw n P) * (∫ streams, h (streams 3) ∂fourStreamLaw n P)
Proof (Lean source)
-- @node: upper_three_stream_product_moment lemma upper_three_stream_product_moment {n d : ℕ} (P : FullLaw d) (f g h : FiniteSample (Obs d) → ℝ) (hf : Measurable f) (hg : Measurable g) (hh : Measurable h) (hfi : Integrable (fun streams => f (streams 1)) (fourStreamLaw n P)) (hgi : Integrable (fun streams => g (streams 2)) (fourStreamLaw n P)) (hhi : Integrable (fun streams => h (streams 3)) (fourStreamLaw n P)) : Integrable (fun streams => f (streams 1) * g (streams 2) * h (streams 3)) (fourStreamLaw n P) ∧ (∫ streams, f (streams 1) * g (streams 2) * h (streams 3) ∂fourStreamLaw n P) = (∫ streams, f (streams 1) ∂fourStreamLaw n P) * (∫ streams, g (streams 2) ∂fourStreamLaw n P) * (∫ streams, h (streams 3) ∂fourStreamLaw n P) := by have hi : iIndepFun (fun i (streams : Fin 4 → FiniteSample (Obs d)) => streams i) (fourStreamLaw n P) := by rw [show fourStreamLaw n P = Measure.pi (fun i : Fin 4 => finitePoissonSampleLaw (observedLaw P).toMeasure ((n : NNReal) / 2 * uniformFourMass i)) from labeledStreamLaw_eq_independent _ _ _ _] exact iIndepFun_pi (X := fun _ => id) (fun _ => aemeasurable_id) have h12 := (hi.indepFun (by decide : (1 : Fin 4) ≠ 2)).comp hf hg have h123 := (hi.indepFun_prodMk (fun i => measurable_pi_apply i) 1 2 3 (by decide) (by decide)).comp (hf.comp measurable_fst |>.mul (hg.comp measurable_snd)) hh simp only [Function.comp_def, Pi.mul_apply] at h12 h123 have h12i := h12.integrable_mul hfi hgi have h12m : Measurable (fun streams : Fin 4 → FiniteSample (Obs d) => f (streams 1) * g (streams 2)) := by fun_prop constructor · exact h123.integrable_mul h12i hhi rw [h123.integral_fun_mul_eq_mul_integral h12m.aestronglyMeasurable (hh.comp (measurable_pi_apply 3)).aestronglyMeasurable, h12.integral_fun_mul_eq_mul_integral (hf.comp (measurable_pi_apply 1)).aestronglyMeasurable (hg.comp (measurable_pi_apply 2)).aestronglyMeasurable]
CausalSmith.Stat.MarNearcompleteFrontier.upper_three_stream_product_moment · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamLargeVariance.lean:21
theorem upper_streamVG_sub_VD_second_moment_eq

The pilot-retained correction square factors into the missing-count second moment, pilot probability, and branch-difference second moment. Given the specified input n, the specified input d, the specified input hn, the specified input P, the specified input x, the specified input a, the specified input s, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
hn :
0 < n
P :
x :
Fin d
a s :
(∫ streams, (streamV n d streams x a s * (streamG n d streams x a s - streamD d streams x a s)) ^ 2 ∂fourStreamLaw n P)
= ((missingCellMass P x a s) ^ 2 + missingCellMass P x a s / ((n : ℝ) / 8)) * streamPilotLightProb n P x a s * (∫ streams, (streamH n d streams x a s - streamD d streams x a s) ^ 2 ∂fourStreamLaw n P)
Proof (Lean source)
-- @node: upper_streamVG_sub_VD_second_moment_eq lemma upper_streamVG_sub_VD_second_moment_eq {n d : ℕ} (hn : 0 < n) (P : FullLaw d) (x : Fin d) (a s : Bool) : (∫ streams, (streamV n d streams x a s * (streamG n d streams x a s - streamD d streams x a s)) ^ 2 ∂fourStreamLaw n P) = ((missingCellMass P x a s) ^ 2 + missingCellMass P x a s / ((n : ℝ) / 8)) * streamPilotLightProb n P x a s * (∫ streams, (streamH n d streams x a s - streamD d streams x a s) ^ 2 ∂fourStreamLaw n P) := by classical let := upper_fourStreamLaw_isProbabilityMeasure (n := n) P let B : Set (Obs d) := {o | inCell o x a s ∧ o.R = true} let A : Set (Obs d) := {o | inCell o x a s ∧ o.RY = true} let M : Set (Obs d) := {o | inCell o x a s ∧ o.R = false} let c : FiniteSample (Obs d) → ℝ := fun z => finiteStreamCount z (fun o => o ∈ B) let u : FiniteSample (Obs d) → ℝ := fun z => finiteStreamCount z (fun o => o ∈ A) let v : FiniteSample (Obs d) → ℝ := fun z => (finiteStreamCount z (fun o => o ∈ M) / ((n : ℝ) / 8)) ^ 2 let p : FiniteSample (Obs d) → ℝ := fun z => if c z ≤ polyThreshold n / 4 then 1 else 0 let f : FiniteSample (Obs d) → ℝ := fun z => (lightCorrection n (c z) (u z) - heavyCorrection (c z) (u z)) ^ 2 have hB : MeasurableSet B := by measurability have hA : MeasurableSet A := by measurability have hM : MeasurableSet M := by measurability have hc : Measurable c := by unfold c; fun_prop have hu : Measurable u := by unfold u; fun_prop have hv : Measurable v := by unfold v; fun_prop have hp : Measurable p := by unfold p apply Measurable.ite (measurableSet_le hc measurable_const) <;> fun_prop have hf : Measurable f := by have hl : Measurable (fun z => lightCorrection n (c z) (u z)) := by unfold lightCorrection shiftedFalling fun_prop have hd : Measurable (fun z => heavyCorrection (c z) (u z)) := by unfold heavyCorrection apply Measurable.ite (measurableSet_lt measurable_const hc) <;> fun_prop exact (hl.sub hd).pow_const 2 have hvi : Integrable (fun streams => v (streams 1)) (fourStreamLaw n P) := (upper_streamV_memLp_two (n := n) P x a s).integrable_sq have hpi : Integrable (fun streams => p (streams 2)) (fourStreamLaw n P) := by apply Integrable.of_bound (hp.comp (measurable_pi_apply 2)).aestronglyMeasurable 1 filter_upwards [] with streams dsimp [p] split_ifs <;> norm_num have hfi : Integrable (fun streams => f (streams 3)) (fourStreamLaw n P) := (upper_streamHD_memLp_two (n := n) P x a s).integrable_sq have hpmean : (∫ streams, p (streams 2) ∂fourStreamLaw n P) = streamPilotLightProb n P x a s := by let E : Set (Fin 4 → FiniteSample (Obs d)) := {streams | c (streams 2) ≤ polyThreshold n / 4} have hE : MeasurableSet E := measurableSet_le (hc.comp (measurable_pi_apply 2)) measurable_const rw [show (fun streams => p (streams 2)) = E.indicator (fun _ => (1 : ℝ)) by funext streams rfl, integral_indicator_const (1 : ℝ) hE] simp only [smul_eq_mul, mul_one] rfl have hpoint : (fun streams => (streamV n d streams x a s * (streamG n d streams x a s - streamD d streams x a s)) ^ 2) = (fun streams => v (streams 1) * p (streams 2) * f (streams 3)) := by funext streams dsimp [v, p, f, c, u, M, B, A] unfold streamG streamV streamCpilot streamH streamD streamC streamU split_ifs <;> simp [mul_pow] rw [hpoint, (upper_three_stream_product_moment P v p f hv hp hf hvi hpi hfi).2, hpmean] rw [show (∫ streams, v (streams 1) ∂fourStreamLaw n P) = (missingCellMass P x a s) ^ 2 + missingCellMass P x a s / ((n : ℝ) / 8) from upper_stream_v_second_moment hn P x a s] rfl
CausalSmith.Stat.MarNearcompleteFrontier.upper_streamVG_sub_VD_second_moment_eq · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamLargeVariance.lean:58
theorem upper_streamVG_sub_VD_pilot_second_moment_le

Retaining the pilot improves the branch-moment bound by its selection probability, which is essential for large cells. Given the specified input n, the specified input d, the specified input hn, the specified input P, the specified input x, the specified input a, the specified input s, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
hn :
0 < n
P :
x :
Fin d
a s :
(∫ streams, (streamV n d streams x a s * (streamG n d streams x a s - streamD d streams x a s)) ^ 2 ∂fourStreamLaw n P)
≤ ((missingCellMass P x a s) ^ 2 + missingCellMass P x a s / ((n : ℝ) / 8)) * (2 * (streamPilotLightProb n P x a s * (∫ streams, (streamH n d streams x a s) ^ 2 ∂fourStreamLaw n P)) + streamPilotLightProb n P x a s / 2)
Proof (Lean source)
-- @node: upper_streamVG_sub_VD_pilot_second_moment_le lemma upper_streamVG_sub_VD_pilot_second_moment_le {n d : ℕ} (hn : 0 < n) (P : FullLaw d) (x : Fin d) (a s : Bool) : (∫ streams, (streamV n d streams x a s * (streamG n d streams x a s - streamD d streams x a s)) ^ 2 ∂fourStreamLaw n P) ≤ ((missingCellMass P x a s) ^ 2 + missingCellMass P x a s / ((n : ℝ) / 8)) * (2 * (streamPilotLightProb n P x a s * (∫ streams, (streamH n d streams x a s) ^ 2 ∂fourStreamLaw n P)) + streamPilotLightProb n P x a s / 2) := by rw [upper_streamVG_sub_VD_second_moment_eq hn P x a s] have hw : 0 ≤ missingCellMass P x a s := sub_nonneg.mpr (arrivedCellMass_le_cellMass P x a s) have hp := (upper_streamPilotLightProb_bounds (n := n) P x a s).1 have hc : 0 ≤ ((missingCellMass P x a s) ^ 2 + missingCellMass P x a s / ((n : ℝ) / 8)) * streamPilotLightProb n P x a s := by positivity calc _ ≤ ((missingCellMass P x a s) ^ 2 + missingCellMass P x a s / ((n : ℝ) / 8)) * streamPilotLightProb n P x a s * (2 * (∫ streams, (streamH n d streams x a s) ^ 2 ∂fourStreamLaw n P) + 1 / 2) := mul_le_mul_of_nonneg_left (upper_streamHD_second_moment_le P x a s) hc _ = _ := by ring
CausalSmith.Stat.MarNearcompleteFrontier.upper_streamVG_sub_VD_pilot_second_moment_le · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamLargeVariance.lean:132
theorem upper_stream_large_correction_second_moment_le

Equation (18), cellwise: both the light and bounded heavy contributions are exponentially suppressed by the large-cell pilot tail. Given the specified input n, the specified input d, the specified input hn, the specified input hL, the specified input P, the specified input x, the specified input a, the specified input s, the specified input hzB, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
hn :
0 < n
hL :
128 ≤ ell n
P :
x :
Fin d
a s :
hzB :
polyThreshold n ≤ streamZ n P x a s
(∫ streams, (streamV n d streams x a s * (streamG n d streams x a s - streamD d streams x a s)) ^ 2 ∂fourStreamLaw n P)
≤ (5 / 2 : ℝ) * ((missingCellMass P x a s) ^ 2 + missingCellMass P x a s / ((n : ℝ) / 8)) * exp (-polyThreshold n / 8)
Proof (Lean source)
-- @node: upper_stream_large_correction_second_moment_le lemma upper_stream_large_correction_second_moment_le {n d : ℕ} (hn : 0 < n) (hL : 128 ≤ ell n) (P : FullLaw d) (x : Fin d) (a s : Bool) (hzB : polyThreshold n ≤ streamZ n P x a s) : (∫ streams, (streamV n d streams x a s * (streamG n d streams x a s - streamD d streams x a s)) ^ 2 ∂fourStreamLaw n P) ≤ (5 / 2 : ℝ) * ((missingCellMass P x a s) ^ 2 + missingCellMass P x a s / ((n : ℝ) / 8)) * exp (-polyThreshold n / 8) := by have hw : 0 ≤ missingCellMass P x a s := sub_nonneg.mpr (arrivedCellMass_le_cellMass P x a s) have hc : 0 ≤ (missingCellMass P x a s) ^ 2 + missingCellMass P x a s / ((n : ℝ) / 8) := by positivity have hB : 0 ≤ polyThreshold n := by unfold polyThreshold; linarith have hz0 : 0 ≤ streamZ n P x a s := hB.trans hzB have hlight := upper_streamH_pilot_large_second_moment_le hL P x a s hzB have hpilot := upper_stream_pilot_large_prob_le hL P x a s hzB have he := Real.exp_le_exp.mpr (show -streamZ n P x a s / 4 ≤ -streamZ n P x a s / 8 by linarith) have hbranch : 2 * (streamPilotLightProb n P x a s * (∫ streams, (streamH n d streams x a s) ^ 2 ∂fourStreamLaw n P)) + streamPilotLightProb n P x a s / 2 ≤ (5 / 2 : ℝ) * exp (-streamZ n P x a s / 8) := by linarith [hpilot.trans he] calc _ ≤ _ := upper_streamVG_sub_VD_pilot_second_moment_le hn P x a s _ ≤ ((missingCellMass P x a s) ^ 2 + missingCellMass P x a s / ((n : ℝ) / 8)) * ((5 / 2 : ℝ) * exp (-streamZ n P x a s / 8)) := mul_le_mul_of_nonneg_left hbranch hc _ ≤ _ := by have hh := mul_le_mul_of_nonneg_left (Real.exp_le_exp.mpr (show -streamZ n P x a s / 8 ≤ -polyThreshold n / 8 by linarith)) (show 0 ≤ (5 / 2 : ℝ) * ((missingCellMass P x a s) ^ 2 + missingCellMass P x a s / ((n : ℝ) / 8)) by positivity) nlinarith only [hh]
CausalSmith.Stat.MarNearcompleteFrontier.upper_stream_large_correction_second_moment_le · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamLargeVariance.lean:157
theorem upper_missing_second_moment_sum_le

The missing-count second moments sum to a dimension-free budget, using nonnegative cell masses and their total missing-mass bound. Given the specified input n, the specified input d, the specified input q, the specified input hn, the specified input P, the specified input h, the stated mathematical conclusion holds. Given the specified input hq.

Formal statement
n d :
ℕ
q :
ℝ
hn :
0 < n
P :
h :
LawClass d q P
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
(∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, ((missingCellMass P x a s) ^ 2 + missingCellMass P x a s / ((n : ℝ) / 8)))
≤ (delta q) ^ 2 + delta q / ((n : ℝ) / 8)
Proof (Lean source)
-- @node: upper_missing_second_moment_sum_le lemma upper_missing_second_moment_sum_le {n d : ℕ} {q : ℝ} (hn : 0 < n) (P : FullLaw d) (h : LawClass d q P) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) : (∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, ((missingCellMass P x a s) ^ 2 + missingCellMass P x a s / ((n : ℝ) / 8))) ≤ (delta q) ^ 2 + delta q / ((n : ℝ) / 8) := by classical have hw : ∀ x a s, 0 ≤ missingCellMass P x a s := fun x a s => (missingCellMass_bounds P h hq x a s).1 have hmass := sum_missingCellMass_le_delta P h hq have hδ : 0 ≤ delta q := by unfold delta; linarith [hq.2] have hm : 0 < (n : ℝ) / 8 := by positivity have hwδ : ∀ x a s, missingCellMass P x a s ≤ delta q := by intro x a s calc _ ≤ ∑ s' : Bool, missingCellMass P x a s' := Finset.single_le_sum (fun s' _ => hw x a s') (Finset.mem_univ s) _ ≤ ∑ a' : Bool, ∑ s' : Bool, missingCellMass P x a' s' := Finset.single_le_sum (fun a' _ => Finset.sum_nonneg (fun s' _ => hw x a' s')) (Finset.mem_univ a) _ ≤ ∑ x' : Fin d, ∑ a' : Bool, ∑ s' : Bool, missingCellMass P x' a' s' := Finset.single_le_sum (fun x' _ => Finset.sum_nonneg (fun a' _ => Finset.sum_nonneg (fun s' _ => hw x' a' s'))) (Finset.mem_univ x) _ ≤ _ := hmass calc _ ≤ ∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, (delta q * missingCellMass P x a s + missingCellMass P x a s / ((n : ℝ) / 8)) := by apply Finset.sum_le_sum intro x hx apply Finset.sum_le_sum intro a ha apply Finset.sum_le_sum intro s hs have hh := mul_le_mul_of_nonneg_right (hwδ x a s) (hw x a s) nlinarith only [hh] _ = delta q * (∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, missingCellMass P x a s) + (∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, missingCellMass P x a s) / ((n : ℝ) / 8) := by simp only [Finset.sum_add_distrib, Finset.mul_sum, Finset.sum_div] _ ≤ _ := by have hh := mul_le_mul_of_nonneg_left hmass hδ have hd := div_le_div_of_nonneg_right hmass hm.le nlinarith only [hh, hd]
CausalSmith.Stat.MarNearcompleteFrontier.upper_missing_second_moment_sum_le · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamLargeVariance.lean:196
theorem upper_stream_large_correction_second_moment_sum_le

Equation (18), summed over all large cells, costs only the total missing-mass budget times the exponential pilot decay. Given the specified input n, the specified input d, the specified input q, the specified input hn, the specified input hL, the specified input P, the specified input h, the stated mathematical conclusion holds. Given the specified input hq.

Formal statement
n d :
ℕ
q :
ℝ
hn :
0 < n
hL :
128 ≤ ell n
P :
h :
LawClass d q P
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
(∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, if polyThreshold n < streamZ n P x a s then (∫ streams, (streamV n d streams x a s * (streamG n d streams x a s - streamD d streams x a s)) ^ 2 ∂fourStreamLaw n P) else 0)
≤ (5 / 2 : ℝ) * ((delta q) ^ 2 + delta q / ((n : ℝ) / 8)) * exp (-polyThreshold n / 8)
Proof (Lean source)
-- @node: upper_stream_large_correction_second_moment_sum_le lemma upper_stream_large_correction_second_moment_sum_le {n d : ℕ} {q : ℝ} (hn : 0 < n) (hL : 128 ≤ ell n) (P : FullLaw d) (h : LawClass d q P) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) : (∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, if polyThreshold n < streamZ n P x a s then (∫ streams, (streamV n d streams x a s * (streamG n d streams x a s - streamD d streams x a s)) ^ 2 ∂fourStreamLaw n P) else 0) ≤ (5 / 2 : ℝ) * ((delta q) ^ 2 + delta q / ((n : ℝ) / 8)) * exp (-polyThreshold n / 8) := by classical have hm : 0 < (n : ℝ) / 8 := by positivity have hcoef : 0 ≤ (5 / 2 : ℝ) * exp (-polyThreshold n / 8) := by positivity calc _ ≤ ∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, (5 / 2 : ℝ) * exp (-polyThreshold n / 8) * ((missingCellMass P x a s) ^ 2 + missingCellMass P x a s / ((n : ℝ) / 8)) := by apply Finset.sum_le_sum intro x hx apply Finset.sum_le_sum intro a ha apply Finset.sum_le_sum intro s hs split_ifs with hzB · have hh := upper_stream_large_correction_second_moment_le hn hL P x a s hzB.le nlinarith only [hh] · have hw := (missingCellMass_bounds P h hq x a s).1 positivity _ = ((5 / 2 : ℝ) * exp (-polyThreshold n / 8)) * (∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, ((missingCellMass P x a s) ^ 2 + missingCellMass P x a s / ((n : ℝ) / 8))) := by simp only [Finset.mul_sum] _ ≤ _ := by have hh := mul_le_mul_of_nonneg_left (upper_missing_second_moment_sum_le hn P h hq) hcoef nlinarith only [hh]
CausalSmith.Stat.MarNearcompleteFrontier.upper_stream_large_correction_second_moment_sum_le · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamLargeVariance.lean:241
theorem upper_large_variance_exp_le_inv Lemma upper_large_variance_exp_le_inv in the paper ↗

The large-cell exponential residual is at most inverse sample size. Given the specified input n, the specified input hn, the specified input hL, the stated mathematical conclusion holds.

Formal statement
n :
ℕ
hn :
0 < n
hL :
128 ≤ ell n
exp (-polyThreshold n / 8) ≤ 1 / (n : ℝ)
Proof (Lean source)
-- @node: upper_large_variance_exp_le_inv lemma upper_large_variance_exp_le_inv {n : ℕ} (hn : 0 < n) (hL : 128 ≤ ell n) : exp (-polyThreshold n / 8) ≤ 1 / (n : ℝ) := by have hnR : 0 < (n : ℝ) := by exact_mod_cast hn have he : 0 < exp (1 : ℝ) + (n : ℝ) := by positivity calc _ ≤ exp (-ell n) := by apply Real.exp_le_exp.mpr unfold polyThreshold linarith _ = 1 / (exp (1 : ℝ) + (n : ℝ)) := by rw [Real.exp_neg] unfold ell rw [Real.exp_log he, one_div] _ ≤ _ := one_div_le_one_div_of_le hnR (by linarith [Real.exp_pos (1 : ℝ)])
CausalSmith.Stat.MarNearcompleteFrontier.upper_large_variance_exp_le_inv · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamLargeVariance.lean:281
theorem upper_stream_large_correction_second_moment_sum_rate

Equation (18) has a universal inverse-sample-size budget, with explicit constant 25 and no dimension dependence. Given the specified input n, the specified input d, the specified input q, the specified input hn, the specified input hL, the specified input P, the specified input h, the stated mathematical conclusion holds. Given the specified input hq.

Formal statement
n d :
ℕ
q :
ℝ
hn :
0 < n
hL :
128 ≤ ell n
P :
h :
LawClass d q P
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
(∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, if polyThreshold n < streamZ n P x a s then (∫ streams, (streamV n d streams x a s * (streamG n d streams x a s - streamD d streams x a s)) ^ 2 ∂fourStreamLaw n P) else 0)
≤ 25 / (n : ℝ)
Proof (Lean source)
-- @node: upper_stream_large_correction_second_moment_sum_rate lemma upper_stream_large_correction_second_moment_sum_rate {n d : ℕ} {q : ℝ} (hn : 0 < n) (hL : 128 ≤ ell n) (P : FullLaw d) (h : LawClass d q P) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) : (∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, if polyThreshold n < streamZ n P x a s then (∫ streams, (streamV n d streams x a s * (streamG n d streams x a s - streamD d streams x a s)) ^ 2 ∂fourStreamLaw n P) else 0) ≤ 25 / (n : ℝ) := by have hn1 : (1 : ℝ) ≤ (n : ℝ) := by exact_mod_cast hn have hnR : 0 < (n : ℝ) := by positivity have hδ : 0 ≤ delta q := by unfold delta; linarith [hq.2] have hδ1 : delta q ≤ 1 := by unfold delta; linarith [hq.1] have hδsq : (delta q) ^ 2 ≤ 1 := by nlinarith have hdiv : delta q / ((n : ℝ) / 8) ≤ 8 := by rw [div_le_iff₀ (show 0 < (n : ℝ) / 8 by positivity)] linarith have hc : (5 / 2 : ℝ) * ((delta q) ^ 2 + delta q / ((n : ℝ) / 8)) ≤ 25 := by linarith calc _ ≤ _ := upper_stream_large_correction_second_moment_sum_le hn hL P h hq _ ≤ 25 * exp (-polyThreshold n / 8) := mul_le_mul_of_nonneg_right hc (Real.exp_pos _).le _ ≤ 25 * (1 / (n : ℝ)) := mul_le_mul_of_nonneg_left (upper_large_variance_exp_le_inv hn hL) (by norm_num) _ = _ := by ring
CausalSmith.Stat.MarNearcompleteFrontier.upper_stream_large_correction_second_moment_sum_rate · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamLargeVariance.lean:298
theorem upper_stream_correction_second_moment_sum_le

The entire selected correction second moment is the sum of the small-cell budget in (17) and the dimension-free large-cell budget in (18). Given the specified input n, the specified input d, the specified input q, the specified input hn, the specified input hL, the specified input P, the specified input h, the stated mathematical conclusion holds. Given the specified input hq.

Formal statement
n d :
ℕ
q :
ℝ
hn :
0 < n
hL :
128 ≤ ell n
P :
h :
LawClass d q P
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
(∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, (∫ streams, (streamV n d streams x a s * (streamG n d streams x a s - streamD d streams x a s)) ^ 2 ∂fourStreamLaw n P))
≤ 12 * (d : ℝ) * exp (ell n / 8) * ((4 * (delta q) ^ 2 * (polyThreshold n) ^ 2 + 2 * delta q * polyThreshold n) / ((n : ℝ) / 8) ^ 2)
+ 25 / (n : ℝ)
Proof (Lean source)
-- @node: upper_stream_correction_second_moment_sum_le lemma upper_stream_correction_second_moment_sum_le {n d : ℕ} {q : ℝ} (hn : 0 < n) (hL : 128 ≤ ell n) (P : FullLaw d) (h : LawClass d q P) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) : (∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, (∫ streams, (streamV n d streams x a s * (streamG n d streams x a s - streamD d streams x a s)) ^ 2 ∂fourStreamLaw n P)) ≤ 12 * (d : ℝ) * exp (ell n / 8) * ((4 * (delta q) ^ 2 * (polyThreshold n) ^ 2 + 2 * delta q * polyThreshold n) / ((n : ℝ) / 8) ^ 2) + 25 / (n : ℝ) := by classical have hs := upper_stream_small_correction_second_moment_sum_le hn hL P h hq have hl := upper_stream_large_correction_second_moment_sum_rate hn hL P h hq have hsplit : (∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, (∫ streams, (streamV n d streams x a s * (streamG n d streams x a s - streamD d streams x a s)) ^ 2 ∂fourStreamLaw n P)) = (∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, if streamZ n P x a s ≤ polyThreshold n then (∫ streams, (streamV n d streams x a s * (streamG n d streams x a s - streamD d streams x a s)) ^ 2 ∂fourStreamLaw n P) else 0) + (∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, if polyThreshold n < streamZ n P x a s then (∫ streams, (streamV n d streams x a s * (streamG n d streams x a s - streamD d streams x a s)) ^ 2 ∂fourStreamLaw n P) else 0) := by simp only [← Finset.sum_add_distrib] apply Finset.sum_congr rfl intro x hx apply Finset.sum_congr rfl intro a ha apply Finset.sum_congr rfl intro s hs by_cases hz : streamZ n P x a s ≤ polyThreshold n · simp [hz, not_lt.mpr hz] · simp [hz, lt_of_not_ge hz] rw [hsplit] exact add_le_add hs hl
CausalSmith.Stat.MarNearcompleteFrontier.upper_stream_correction_second_moment_sum_le · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamLargeVariance.lean:327
CausalSmith.Stat.STAT_MarNearcompleteFrontier_Research.Helpers.UpperRisk.StreamLightSecondMoment 9 declarations The arrived-count law transports the raw Poisson moment bound to the actual fourth stream.

Expected light-correction square envelope

The arrived-count law transports the raw Poisson moment bound to the actual fourth stream. Integrating the pointwise envelope proves equation (8).

theorem upper_measurable_finiteStreamCount

Real-valued finite-stream event counts are measurable. Given the specified input d, the specified input hE, the stated mathematical conclusion holds. Given the specified input E.

Formal statement
d :
ℕ
E :
Set (Obs d)
hE :
Measurable (fun z : FiniteSample (Obs d) => finiteStreamCount z (fun o => o ∈ E))
Proof (Lean source)
-- @node: upper_measurable_finiteStreamCount @[fun_prop] lemma upper_measurable_finiteStreamCount {d : ℕ} (E : Set (Obs d)) (hE : MeasurableSet E) : Measurable (fun z : FiniteSample (Obs d) => finiteStreamCount z (fun o => o ∈ E)) := by classical have hm := (measurable_of_countable (fun k : ℕ => (k : ℝ))).comp (measurable_eventCount E hE) convert hm using 1 funext z simpa only [eventCount, Set.mem_ofPred_eq, Function.comp_apply] using upper_finiteStreamCount_eq_eventCount z (fun o => o ∈ E)
CausalSmith.Stat.MarNearcompleteFrontier.upper_measurable_finiteStreamCount · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamLightSecondMoment.lean:22
theorem upper_measurable_streamC

The fourth-stream arrived count is measurable. Given the specified input d, the specified input x, the specified input a, the specified input s, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
x :
Fin d
a s :
Measurable (fun streams : Fin 4 → FiniteSample (Obs d) => streamC d streams x a s)
Proof (Lean source)
-- @node: upper_measurable_streamC @[fun_prop] lemma upper_measurable_streamC {d : ℕ} (x : Fin d) (a s : Bool) : Measurable (fun streams : Fin 4 → FiniteSample (Obs d) => streamC d streams x a s) := by let B : Set (Obs d) := {o | inCell o x a s ∧ o.R = true} have hB : MeasurableSet B := by measurability exact (upper_measurable_finiteStreamCount B hB).comp (measurable_pi_apply 3)
theorem upper_measurable_streamH

The fourth-stream light correction is measurable. Given the specified input n, the specified input d, the specified input x, the specified input a, the specified input s, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
x :
Fin d
a s :
Measurable (fun streams : Fin 4 → FiniteSample (Obs d) => streamH n d streams x a s)
Proof (Lean source)
-- @node: upper_measurable_streamH @[fun_prop] lemma upper_measurable_streamH {n d : ℕ} (x : Fin d) (a s : Bool) : Measurable (fun streams : Fin 4 → FiniteSample (Obs d) => streamH n d streams x a s) := by have hC := upper_measurable_streamC x a s let A : Set (Obs d) := {o | inCell o x a s ∧ o.RY = true} have hA : MeasurableSet A := by measurability have hU : Measurable (fun streams : Fin 4 → FiniteSample (Obs d) => streamU d streams x a s) := (upper_measurable_finiteStreamCount A hA).comp (measurable_pi_apply 3) unfold streamH lightCorrection shiftedFalling fun_prop
theorem upper_streamC_power_integrable

All arrived-count powers are integrable under the ideal experiment. Given the specified input n, the specified input d, the specified input P, the specified input x, the specified input a, the specified input s, the specified input r, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
P :
x :
Fin d
a s :
r :
ℕ
Integrable (fun streams => (streamC d streams x a s) ^ r) (fourStreamLaw n P)
Proof (Lean source)
-- @node: upper_streamC_power_integrable lemma upper_streamC_power_integrable {n d : ℕ} (P : FullLaw d) (x : Fin d) (a s : Bool) (r : ℕ) : Integrable (fun streams => (streamC d streams x a s) ^ r) (fourStreamLaw n P) := by have hc := upper_measurable_streamC x a s have hf : Measurable (fun c : ℝ => c ^ r) := by fun_prop change Integrable ((fun c : ℝ => c ^ r) ∘ fun streams => streamC d streams x a s) (fourStreamLaw n P) apply (integrable_map_measure hf.aestronglyMeasurable hc.aemeasurable).mp rw [(upper_stream_arrived_count_law (n := n) P x a s).2] exact (integrable_map_measure hf.aestronglyMeasurable (measurable_of_countable _).aemeasurable).mpr (poisson_power_integrable _ r)
CausalSmith.Stat.MarNearcompleteFrontier.upper_streamC_power_integrable · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamLightSecondMoment.lean:62
theorem upper_streamC_power_moment_le

Equation (7) transferred through the actual arrived-count marginal. Given the specified input n, the specified input d, the specified input P, the specified input x, the specified input a, the specified input s, the specified input r, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
P :
x :
Fin d
a s :
r :
ℕ
(∫ streams, (streamC d streams x a s) ^ r ∂fourStreamLaw n P)
≤ (streamZ n P x a s + (r : ℝ)) ^ r
Proof (Lean source)
-- @node: upper_streamC_power_moment_le lemma upper_streamC_power_moment_le {n d : ℕ} (P : FullLaw d) (x : Fin d) (a s : Bool) (r : ℕ) : (∫ streams, (streamC d streams x a s) ^ r ∂fourStreamLaw n P) ≤ (streamZ n P x a s + (r : ℝ)) ^ r := by have hc := upper_measurable_streamC x a s have hf : Measurable (fun c : ℝ => c ^ r) := by fun_prop rw [← integral_map hc.aemeasurable hf.aestronglyMeasurable, (upper_stream_arrived_count_law (n := n) P x a s).2, integral_map (measurable_of_countable _).aemeasurable hf.aestronglyMeasurable] have hrate : (streamPoissonRate n P x a s : ℝ) = streamZ n P x a s := by rfl rw [← hrate] exact poisson_power_moment_le (streamPoissonRate n P x a s) r
CausalSmith.Stat.MarNearcompleteFrontier.upper_streamC_power_moment_le · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamLightSecondMoment.lean:78
theorem upper_streamH_sq_le_add_envelope_ae

Replacing the maximum by one plus the nonnegative count power gives an integrable envelope for the light correction's square. Given the specified input n, the specified input d, the specified input P, the specified input x, the specified input a, the specified input s, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
P :
x :
Fin d
a s :
∀ᵐ streams ∂fourStreamLaw n P, (streamH n d streams x a s) ^ 2
≤ (64 : ℝ) ^ polyDegree n / 4 * (1 + (streamC d streams x a s / polyThreshold n) ^ (2 * polyDegree n))
Proof (Lean source)
-- @node: upper_streamH_sq_le_add_envelope_ae lemma upper_streamH_sq_le_add_envelope_ae {n d : ℕ} (P : FullLaw d) (x : Fin d) (a s : Bool) : ∀ᵐ streams ∂fourStreamLaw n P, (streamH n d streams x a s) ^ 2 ≤ (64 : ℝ) ^ polyDegree n / 4 * (1 + (streamC d streams x a s / polyThreshold n) ^ (2 * polyDegree n)) := by filter_upwards [upper_streamH_sq_le_degree_envelope_ae (n := n) P x a s] with streams hs apply hs.trans apply mul_le_mul_of_nonneg_left _ (by positivity) apply max_le · have hp : 0 ≤ (streamC d streams x a s / polyThreshold n) ^ (2 * polyDegree n) := by rw [pow_mul] positivity linarith · linarith
CausalSmith.Stat.MarNearcompleteFrontier.upper_streamH_sq_le_add_envelope_ae · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamLightSecondMoment.lean:94
theorem upper_streamH_sq_integrable

The coefficient and count-power envelope makes the actual light correction square integrable without adding regularity premises. Given the specified input n, the specified input d, the specified input P, the specified input x, the specified input a, the specified input s, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
P :
x :
Fin d
a s :
Integrable (fun streams => (streamH n d streams x a s) ^ 2) (fourStreamLaw n P)
Proof (Lean source)
-- @node: upper_streamH_sq_integrable lemma upper_streamH_sq_integrable {n d : ℕ} (P : FullLaw d) (x : Fin d) (a s : Bool) : Integrable (fun streams => (streamH n d streams x a s) ^ 2) (fourStreamLaw n P) := by let := upper_fourStreamLaw_isProbabilityMeasure (n := n) P have he : Integrable (fun streams => (64 : ℝ) ^ polyDegree n / 4 * (1 + (streamC d streams x a s / polyThreshold n) ^ (2 * polyDegree n))) (fourStreamLaw n P) := by simp_rw [div_pow] exact ((integrable_const 1).add ((upper_streamC_power_integrable P x a s _).div_const _)).const_mul _ apply he.mono' ((upper_measurable_streamH x a s).pow_const 2).aestronglyMeasurable filter_upwards [upper_streamH_sq_le_add_envelope_ae (n := n) P x a s] with streams hs rw [Real.norm_eq_abs, abs_of_nonneg (sq_nonneg (streamH n d streams x a s))] exact hs
CausalSmith.Stat.MarNearcompleteFrontier.upper_streamH_sq_integrable · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamLightSecondMoment.lean:116
theorem upper_streamH_second_moment_add_le

Integrating the envelope and applying the Poisson power moment bound gives the growth factor in equation (8). Given the specified input n, the specified input d, the specified input P, the specified input x, the specified input a, the specified input s, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
P :
x :
Fin d
a s :
(∫ streams, (streamH n d streams x a s) ^ 2 ∂fourStreamLaw n P)
≤ (64 : ℝ) ^ polyDegree n / 4 * (1 + ((streamZ n P x a s + (2 * polyDegree n : ℕ)) / polyThreshold n) ^ (2 * polyDegree n))
Proof (Lean source)
-- @node: upper_streamH_second_moment_add_le lemma upper_streamH_second_moment_add_le {n d : ℕ} (P : FullLaw d) (x : Fin d) (a s : Bool) : (∫ streams, (streamH n d streams x a s) ^ 2 ∂fourStreamLaw n P) ≤ (64 : ℝ) ^ polyDegree n / 4 * (1 + ((streamZ n P x a s + (2 * polyDegree n : ℕ)) / polyThreshold n) ^ (2 * polyDegree n)) := by let := upper_fourStreamLaw_isProbabilityMeasure (n := n) P have hp := upper_streamC_power_integrable (n := n) P x a s (2 * polyDegree n) have he : Integrable (fun streams => (64 : ℝ) ^ polyDegree n / 4 * (1 + (streamC d streams x a s / polyThreshold n) ^ (2 * polyDegree n))) (fourStreamLaw n P) := by simp_rw [div_pow] exact ((integrable_const 1).add (hp.div_const _)).const_mul _ calc _ ≤ ∫ streams, (64 : ℝ) ^ polyDegree n / 4 * (1 + (streamC d streams x a s / polyThreshold n) ^ (2 * polyDegree n)) ∂fourStreamLaw n P := integral_mono_ae (upper_streamH_sq_integrable P x a s) he (upper_streamH_sq_le_add_envelope_ae P x a s) _ = (64 : ℝ) ^ polyDegree n / 4 * (1 + (∫ streams, (streamC d streams x a s) ^ (2 * polyDegree n) ∂fourStreamLaw n P) / polyThreshold n ^ (2 * polyDegree n)) := by simp_rw [div_pow] rw [integral_const_mul, integral_add (integrable_const 1) (hp.div_const _), integral_const, integral_div] simp _ ≤ _ := by rw [div_pow] apply mul_le_mul_of_nonneg_left _ (by positivity) apply add_le_add_right exact div_le_div_of_nonneg_right (upper_streamC_power_moment_le P x a s _) (by rw [pow_mul]; positivity)
CausalSmith.Stat.MarNearcompleteFrontier.upper_streamH_second_moment_add_le · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamLightSecondMoment.lean:136
theorem upper_streamH_second_moment_le

Equation (8) for the actual light-stream statistic, with explicit universal constant one half. Given the specified input n, the specified input d, the specified input P, the specified input x, the specified input a, the specified input s, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
P :
x :
Fin d
a s :
(∫ streams, (streamH n d streams x a s) ^ 2 ∂fourStreamLaw n P)
≤ (64 : ℝ) ^ polyDegree n / 2 * max 1 (((streamZ n P x a s + (2 * polyDegree n : ℕ)) / polyThreshold n) ^ (2 * polyDegree n))
Proof (Lean source)
-- @node: upper_streamH_second_moment_le lemma upper_streamH_second_moment_le {n d : ℕ} (P : FullLaw d) (x : Fin d) (a s : Bool) : (∫ streams, (streamH n d streams x a s) ^ 2 ∂fourStreamLaw n P) ≤ (64 : ℝ) ^ polyDegree n / 2 * max 1 (((streamZ n P x a s + (2 * polyDegree n : ℕ)) / polyThreshold n) ^ (2 * polyDegree n)) := by apply (upper_streamH_second_moment_add_le P x a s).trans have h1 := le_max_left (1 : ℝ) (((streamZ n P x a s + (2 * polyDegree n : ℕ)) / polyThreshold n) ^ (2 * polyDegree n)) have h2 := le_max_right (1 : ℝ) (((streamZ n P x a s + (2 * polyDegree n : ℕ)) / polyThreshold n) ^ (2 * polyDegree n)) have hh := mul_le_mul_of_nonneg_left (add_le_add h1 h2) (show 0 ≤ (64 : ℝ) ^ polyDegree n / 4 by positivity) nlinarith only [hh]
CausalSmith.Stat.MarNearcompleteFrontier.upper_streamH_second_moment_le · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamLightSecondMoment.lean:172
CausalSmith.Stat.STAT_MarNearcompleteFrontier_Research.Helpers.UpperRisk.StreamLinear 14 declarations The linear arrived score is a difference of two thinned Poisson counts.

Moments of the linear first stream

The linear arrived score is a difference of two thinned Poisson counts. Their exact moments give square integrability and an inverse-sample-size variance budget for the linear term in equations (1) and (20).

def upper_streamEventCount

Count a Boolean event in an auxiliary stream. Given the specified input d, the specified input i, the specified input E, the stated mathematical conclusion holds. Given the specified input streams.

Definition (Lean source)
d :
ℕ
i :
Fin 4
E :
Obs d → Bool
streams :
Fin 4 → FiniteSample (Obs d)
upper_streamEventCount i E streams :
ℕ
by classical exact (Finset.univ.filter (fun k : Fin (streams i).count => E ((streams i).points k) = true)).card
CausalSmith.Stat.MarNearcompleteFrontier.upper_streamEventCount · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamLinear.lean:22
theorem upper_streamEventCount_measurable

Stream event counts are measurable. Given the specified input d, the specified input i, the specified input E, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
i :
Fin 4
E :
Obs d → Bool
Proof (Lean source)
-- @node: upper_streamEventCount_measurable lemma upper_streamEventCount_measurable {d : ℕ} (i : Fin 4) (E : Obs d → Bool) : Measurable (upper_streamEventCount i E) := by exact (upper_measurable_eventCount E).comp (measurable_pi_apply i)
CausalSmith.Stat.MarNearcompleteFrontier.upper_streamEventCount_measurable · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamLinear.lean:30
theorem upper_streamEventCount_law

Thinning any of the four streams gives the Poisson law at intensity n/8 times the event probability. Given the specified input n, the specified input d, the specified input P, the specified input i, the specified input E, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
P :
i :
Fin 4
E :
Obs d → Bool
Measure.map (upper_streamEventCount i E) (fourStreamLaw n P)
= poissonMeasure (((n : NNReal) / 8) * ((observedLaw P).toMeasure {o | E o = true}).toNNReal)
Proof (Lean source)
-- @node: upper_streamEventCount_law lemma upper_streamEventCount_law {n d : ℕ} (P : FullLaw d) (i : Fin 4) (E : Obs d → Bool) : Measure.map (upper_streamEventCount i E) (fourStreamLaw n P) = poissonMeasure (((n : NNReal) / 8) * ((observedLaw P).toMeasure {o | E o = true}).toNNReal) := by let Q := (observedLaw P).toMeasure let ν : Fin 4 → Measure (FiniteSample (Obs d)) := fun j => finitePoissonSampleLaw Q ((n : NNReal) / 2 * uniformFourMass j) have (j : Fin 4) : IsProbabilityMeasure (ν j) := by dsimp [ν] infer_instance have hstream : Measure.map (fun streams => streams i) (fourStreamLaw n P) = ν i := by rw [show fourStreamLaw n P = Measure.pi ν from labeledStreamLaw_eq_independent _ _ _ _] simpa using (Measure.pi_map_eval (μ := ν) i) change Measure.map ((fun z : FiniteSample (Obs d) => (Finset.univ.filter (fun k : Fin z.count => E (z.points k) = true)).card) ∘ (fun streams => streams i)) (fourStreamLaw n P) = _ rw [← Measure.map_map (upper_measurable_eventCount E) (measurable_pi_apply i), hstream] have h := upper_finitePoissonSampleLaw_eventCount Q ((n : NNReal) / 2 * uniformFourMass i) E (measurable_of_countable E) have hlam : (n : NNReal) / 2 * uniformFourMass i = (n : NNReal) / 8 := by unfold uniformFourMass ring simpa only [ν, hlam] using h
CausalSmith.Stat.MarNearcompleteFrontier.upper_streamEventCount_law · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamLinear.lean:36
theorem upper_streamEventCount_memLp_two

Real event counts have finite second moments. Given the specified input n, the specified input d, the specified input P, the specified input i, the specified input E, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
P :
i :
Fin 4
E :
Obs d → Bool
MemLp (fun streams => (upper_streamEventCount i E streams : ℝ)) 2 (fourStreamLaw n P)
Proof (Lean source)
-- @node: upper_streamEventCount_memLp_two lemma upper_streamEventCount_memLp_two {n d : ℕ} (P : FullLaw d) (i : Fin 4) (E : Obs d → Bool) : MemLp (fun streams => (upper_streamEventCount i E streams : ℝ)) 2 (fourStreamLaw n P) := by have hp : MemLp (fun k : ℕ => (k : ℝ)) 2 (Measure.map (upper_streamEventCount i E) (fourStreamLaw n P)) := by rw [upper_streamEventCount_law] exact poisson_natCast_memLp_two _ exact hp.comp_of_map (upper_streamEventCount_measurable i E).aemeasurable
CausalSmith.Stat.MarNearcompleteFrontier.upper_streamEventCount_memLp_two · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamLinear.lean:65
theorem upper_streamEventCount_mean

The mean of an event count is its thinned intensity. Given the specified input n, the specified input d, the specified input P, the specified input i, the specified input E, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
P :
i :
Fin 4
E :
Obs d → Bool
(∫ streams, (upper_streamEventCount i E streams : ℝ) ∂fourStreamLaw n P)
= (n : ℝ) / 8 * (observedLaw P).toMeasure.real {o | E o = true}
Proof (Lean source)
-- @node: upper_streamEventCount_mean lemma upper_streamEventCount_mean {n d : ℕ} (P : FullLaw d) (i : Fin 4) (E : Obs d → Bool) : (∫ streams, (upper_streamEventCount i E streams : ℝ) ∂fourStreamLaw n P) = (n : ℝ) / 8 * (observedLaw P).toMeasure.real {o | E o = true} := by rw [← integral_map (upper_streamEventCount_measurable i E).aemeasurable (measurable_of_countable (fun k : ℕ => (k : ℝ))).aestronglyMeasurable, upper_streamEventCount_law, poisson_natCast_first_moment] push_cast rfl
CausalSmith.Stat.MarNearcompleteFrontier.upper_streamEventCount_mean · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamLinear.lean:77
theorem upper_streamEventCount_variance

The variance of an event count is its thinned intensity. Given the specified input n, the specified input d, the specified input P, the specified input i, the specified input E, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
P :
i :
Fin 4
E :
Obs d → Bool
variance (fun streams => (upper_streamEventCount i E streams : ℝ)) (fourStreamLaw n P)
= (n : ℝ) / 8 * (observedLaw P).toMeasure.real {o | E o = true}
Proof (Lean source)
-- @node: upper_streamEventCount_variance lemma upper_streamEventCount_variance {n d : ℕ} (P : FullLaw d) (i : Fin 4) (E : Obs d → Bool) : variance (fun streams => (upper_streamEventCount i E streams : ℝ)) (fourStreamLaw n P) = (n : ℝ) / 8 * (observedLaw P).toMeasure.real {o | E o = true} := by change variance ((fun k : ℕ => (k : ℝ)) ∘ upper_streamEventCount i E) (fourStreamLaw n P) = _ rw [← variance_map (measurable_of_countable (fun k : ℕ => (k : ℝ))).aemeasurable (upper_streamEventCount_measurable i E).aemeasurable, upper_streamEventCount_law] rw [variance_eq_sub (poisson_natCast_memLp_two _)] simp only [Pi.pow_apply] rw [poisson_count_second_moment, poisson_natCast_first_moment] push_cast change ((n : ℝ) / 8 * (observedLaw P).toMeasure.real {o | E o = true}) ^ 2 + (n : ℝ) / 8 * (observedLaw P).toMeasure.real {o | E o = true} - ((n : ℝ) / 8 * (observedLaw P).toMeasure.real {o | E o = true}) ^ 2 = _ ring
CausalSmith.Stat.MarNearcompleteFrontier.upper_streamEventCount_variance · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamLinear.lean:90
def upper_streamLinear

The normalized arrived score from the first auxiliary stream. Given the specified input n, the specified input d, the stated mathematical conclusion holds. Given the specified input streams.

Definition (Lean source)
n d :
ℕ
streams :
Fin 4 → FiniteSample (Obs d)
upper_streamLinear n d streams :
ℝ
((n : ℝ) / 8)⁻¹ * ∑ k : Fin (streams 0).count, upper_fallbackScore ((streams 0).points k)
theorem upper_streamLinear_eq_counts

The linear term is the difference of positive and negative arrived counts. Given the specified input n, the specified input d, the stated mathematical conclusion holds. Given the specified input streams.

Formal statement
n d :
ℕ
streams :
Fin 4 → FiniteSample (Obs d)
upper_streamLinear n d streams
= ((n : ℝ) / 8)⁻¹ * ((upper_streamEventCount 0 (fun o : Obs d => o.R && (o.A == o.RY)) streams : ℝ) - (upper_streamEventCount 0 (fun o : Obs d => o.R && !(o.A == o.RY)) streams : ℝ))
Proof (Lean source)
-- @node: upper_streamLinear_eq_counts lemma upper_streamLinear_eq_counts {n d : ℕ} (streams : Fin 4 → FiniteSample (Obs d)) : upper_streamLinear n d streams = ((n : ℝ) / 8)⁻¹ * ((upper_streamEventCount 0 (fun o : Obs d => o.R && (o.A == o.RY)) streams : ℝ) - (upper_streamEventCount 0 (fun o : Obs d => o.R && !(o.A == o.RY)) streams : ℝ)) := by classical unfold upper_streamLinear upper_streamEventCount simp only [← Finset.sum_boole, ← Finset.sum_sub_distrib] congr 1 apply Finset.sum_congr rfl intro k _ cases ha : ((streams 0).points k).A <;> cases hr : ((streams 0).points k).R <;> cases hy : ((streams 0).points k).RY <;> norm_num [upper_fallbackScore, ha, hr, hy]
CausalSmith.Stat.MarNearcompleteFrontier.upper_streamLinear_eq_counts · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamLinear.lean:119
theorem upper_streamLinear_memLp_two

The first-stream linear term is square integrable. Given the specified input n, the specified input d, the specified input P, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
P :
Proof (Lean source)
-- @node: upper_streamLinear_memLp_two lemma upper_streamLinear_memLp_two {n d : ℕ} (P : FullLaw d) : MemLp (upper_streamLinear n d) 2 (fourStreamLaw n P) := by convert ((upper_streamEventCount_memLp_two (n := n) P 0 (fun o : Obs d => o.R && (o.A == o.RY))).sub (upper_streamEventCount_memLp_two (n := n) P 0 (fun o : Obs d => o.R && !(o.A == o.RY)))).const_mul (((n : ℝ) / 8)⁻¹) using 1 ext streams exact upper_streamLinear_eq_counts streams
CausalSmith.Stat.MarNearcompleteFrontier.upper_streamLinear_memLp_two · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamLinear.lean:137
theorem upper_fourStreamRawEstimate_eq_linear_add

The linear term in the raw estimator agrees with the named first-stream score. Given the specified input n, the specified input d, the stated mathematical conclusion holds. Given the specified input streams.

Formal statement
n d :
ℕ
streams :
Fin 4 → FiniteSample (Obs d)
= upper_streamLinear n d streams
+ 2 * (∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, treatmentSign a * streamCellCorrection n d streams x a s)
Proof (Lean source)
-- @node: upper_fourStreamRawEstimate_eq_linear_add lemma upper_fourStreamRawEstimate_eq_linear_add {n d : ℕ} (streams : Fin 4 → FiniteSample (Obs d)) : fourStreamRawEstimate n d streams = upper_streamLinear n d streams + 2 * (∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, treatmentSign a * streamCellCorrection n d streams x a s) := by unfold fourStreamRawEstimate upper_streamLinear treatmentSign upper_fallbackScore dsimp only simp only [Finset.mul_sum] congr 1 apply Finset.sum_congr rfl intro k _ dsimp [FiniteSample.points] simp only [div_eq_mul_inv] ring_nf rfl
CausalSmith.Stat.MarNearcompleteFrontier.upper_fourStreamRawEstimate_eq_linear_add · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamLinear.lean:148
theorem upper_streamLinear_variance_le

The linear-stream variance is bounded by a universal multiple of 1/n. The two event probabilities are each at most one; no cell-count factor enters. Given the specified input n, the specified input d, the specified input hn, the specified input P, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
hn :
0 < n
P :
variance (upper_streamLinear n d) (fourStreamLaw n P) ≤ 32 / (n : ℝ)
Proof (Lean source)
-- @node: upper_streamLinear_variance_le lemma upper_streamLinear_variance_le {n d : ℕ} (hn : 0 < n) (P : FullLaw d) : variance (upper_streamLinear n d) (fourStreamLaw n P) ≤ 32 / (n : ℝ) := by let := upper_fourStreamLaw_isProbabilityMeasure (n := n) P let X := fun streams => (upper_streamEventCount 0 (fun o : Obs d => o.R && (o.A == o.RY)) streams : ℝ) let Y := fun streams => (upper_streamEventCount 0 (fun o : Obs d => o.R && !(o.A == o.RY)) streams : ℝ) have hX : MemLp X 2 (fourStreamLaw n P) := upper_streamEventCount_memLp_two P 0 _ have hY : MemLp Y 2 (fourStreamLaw n P) := upper_streamEventCount_memLp_two P 0 _ have hv : variance (fun streams => X streams - Y streams) (fourStreamLaw n P) ≤ 2 * variance X (fourStreamLaw n P) + 2 * variance Y (fourStreamLaw n P) := by have hp := variance_fun_add hX hY have hm := variance_fun_sub hX hY have hz := variance_nonneg (X := fun streams => X streams + Y streams) (μ := fourStreamLaw n P) linarith have hXv : variance X (fourStreamLaw n P) ≤ (n : ℝ) / 8 := by rw [upper_streamEventCount_variance] exact mul_le_of_le_one_right (by positivity) measureReal_le_one have hYv : variance Y (fourStreamLaw n P) ≤ (n : ℝ) / 8 := by rw [upper_streamEventCount_variance] exact mul_le_of_le_one_right (by positivity) measureReal_le_one have heq : upper_streamLinear n d = fun streams => ((n : ℝ) / 8)⁻¹ * (X streams - Y streams) := by ext streams exact upper_streamLinear_eq_counts streams rw [heq, variance_const_mul] calc _ ≤ (((n : ℝ) / 8)⁻¹) ^ 2 * ((n : ℝ) / 2) := by apply mul_le_mul_of_nonneg_left _ (sq_nonneg _) linarith _ = _ := by have hnR : (n : ℝ) ≠ 0 := by positivity field_simp ring
CausalSmith.Stat.MarNearcompleteFrontier.upper_streamLinear_variance_le · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamLinear.lean:166
theorem upper_fallbackScore_mean_eq_event_difference

The arrived score mean is the difference of its positive and negative event probabilities. Given the specified input d, the specified input P, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
P :
(∫ o, upper_fallbackScore o ∂(observedLaw P).toMeasure)
= (observedLaw P).toMeasure.real {o | (o.R && (o.A == o.RY)) = true}
- (observedLaw P).toMeasure.real {o | (o.R && !(o.A == o.RY)) = true}
Proof (Lean source)
-- @node: upper_fallbackScore_mean_eq_event_difference lemma upper_fallbackScore_mean_eq_event_difference {d : ℕ} (P : FullLaw d) : (∫ o, upper_fallbackScore o ∂(observedLaw P).toMeasure) = (observedLaw P).toMeasure.real {o | (o.R && (o.A == o.RY)) = true} - (observedLaw P).toMeasure.real {o | (o.R && !(o.A == o.RY)) = true} := by classical let Epos : Set (Obs d) := {o | (o.R && (o.A == o.RY)) = true} let Eneg : Set (Obs d) := {o | (o.R && !(o.A == o.RY)) = true} have heq : upper_fallbackScore (d := d) = fun o => Epos.indicator (1 : Obs d → ℝ) o - Eneg.indicator (1 : Obs d → ℝ) o := by ext o cases ha : o.A <;> cases hr : o.R <;> cases hy : o.RY <;> norm_num [upper_fallbackScore, Epos, Eneg, indicator, ha, hr, hy] rw [heq, integral_sub Integrable.of_finite Integrable.of_finite, integral_indicator_one (by measurability), integral_indicator_one (by measurability)]
CausalSmith.Stat.MarNearcompleteFrontier.upper_fallbackScore_mean_eq_event_difference · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamLinear.lean:205
theorem upper_streamLinear_mean

Normalizing the first Poisson stream leaves the population arrived-score mean unchanged. Given the specified input n, the specified input d, the specified input hn, the specified input P, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
hn :
0 < n
P :
(∫ streams, upper_streamLinear n d streams ∂fourStreamLaw n P)
= ∫ o, upper_fallbackScore o ∂(observedLaw P).toMeasure
Proof (Lean source)
-- @node: upper_streamLinear_mean lemma upper_streamLinear_mean {n d : ℕ} (hn : 0 < n) (P : FullLaw d) : (∫ streams, upper_streamLinear n d streams ∂fourStreamLaw n P) = ∫ o, upper_fallbackScore o ∂(observedLaw P).toMeasure := by let := upper_fourStreamLaw_isProbabilityMeasure (n := n) P have heq : upper_streamLinear n d = fun streams => ((n : ℝ) / 8)⁻¹ * ((upper_streamEventCount 0 (fun o : Obs d => o.R && (o.A == o.RY)) streams : ℝ) - (upper_streamEventCount 0 (fun o : Obs d => o.R && !(o.A == o.RY)) streams : ℝ)) := by ext streams exact upper_streamLinear_eq_counts streams rw [heq, integral_const_mul, integral_sub ((upper_streamEventCount_memLp_two P 0 _).integrable (by norm_num)) ((upper_streamEventCount_memLp_two P 0 _).integrable (by norm_num)), upper_streamEventCount_mean, upper_streamEventCount_mean, upper_fallbackScore_mean_eq_event_difference] have hnR : (n : ℝ) ≠ 0 := by positivity field_simp
CausalSmith.Stat.MarNearcompleteFrontier.upper_streamLinear_mean · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamLinear.lean:223
theorem upper_streamLinear_mean_eq_arrived

The linear-stream mean is exactly the arrived part of the identified centered target decomposition (1). Given the specified input n, the specified input d, the specified input hn, the specified input P, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
hn :
0 < n
P :
(∫ streams, upper_streamLinear n d streams ∂fourStreamLaw n P)
= 2 * (∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, treatmentSign a * arrivedCellMass P x a s * cellEta P x a s)
Proof (Lean source)
-- @node: upper_streamLinear_mean_eq_arrived lemma upper_streamLinear_mean_eq_arrived {n d : ℕ} (hn : 0 < n) (P : FullLaw d) : (∫ streams, upper_streamLinear n d streams ∂fourStreamLaw n P) = 2 * (∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, treatmentSign a * arrivedCellMass P x a s * cellEta P x a s) := by rw [upper_streamLinear_mean hn P, upper_fallbackScore_mean]
CausalSmith.Stat.MarNearcompleteFrontier.upper_streamLinear_mean_eq_arrived · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamLinear.lean:243
CausalSmith.Stat.STAT_MarNearcompleteFrontier_Research.Helpers.UpperRisk.StreamMoments 10 declarations These leaves isolate equations (3)--(5) of the upper-risk proof.

Paper-local four-stream moment targets

These leaves isolate equations (3)--(5) of the upper-risk proof. They expose the exact independent Poisson stream law and the estimator's named cell statistics.

def fourStreamLaw

The ideal independent four-stream law for one full-data distribution.

Definition (Lean source)
d :
ℕ
n :
ℕ
P :
fourStreamLaw n P :
Measure (Fin 4 → FiniteSample (Obs d))
labeledStreamLaw (observedLaw P).toMeasure uniformFourMass uniformFourMass_sum ((n : NNReal) / 2)
def streamZ

Mean count of arrived records in a cell of one auxiliary stream.

Definition (Lean source)
d :
ℕ
n :
ℕ
P :
x :
Fin d
a s :
streamZ n P x a s :
ℝ
((n : ℝ) / 8) * arrivedCellMass P x a s
def streamPoissonRate

Nonnegative Poisson rate for an arrived cell in one auxiliary stream.

Definition (Lean source)
d :
ℕ
n :
ℕ
P :
x :
Fin d
a s :
streamPoissonRate n P x a s :
((n : NNReal) / 8) * ⟨arrivedCellMass P x a s, arrivedCellMass_nonneg P x a s⟩
theorem upper_stream_v_mean

Equation (3), first moment: the normalized missing count has mean equal to the missing cell mass. Given the specified input n, the specified input d, the specified input hn, the specified input P, the specified input x, the specified input a, the specified input s, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
hn :
0 < n
P :
x :
Fin d
a s :
(∫ streams, streamV n d streams x a s ∂fourStreamLaw n P) = missingCellMass P x a s
Proof (Lean source)
lemma upper_stream_v_mean {n d : ℕ} (hn : 0 < n) (P : FullLaw d) (x : Fin d) (a s : Bool) : (∫ streams, streamV n d streams x a s ∂fourStreamLaw n P) = missingCellMass P x a s := by classical let μ := fourStreamLaw n P let Q := (observedLaw P).toMeasure let lam : NNReal := ((n : NNReal) / 2) * uniformFourMass 1 let hist : FiniteSample (Obs d) → (Obs d → ℕ) := fun z ↦ finiteSampleHistogram z.points have hstream : Measure.map (fun streams ↦ streams 1) μ = finitePoissonSampleLaw Q lam := by let ν : Fin 4 → Measure (FiniteSample (Obs d)) := fun i ↦ finitePoissonSampleLaw (observedLaw P).toMeasure (((n : NNReal) / 2) * uniformFourMass i) haveI (i : Fin 4) : IsProbabilityMeasure (ν i) := by dsimp [ν] infer_instance rw [show μ = Measure.pi ν by unfold μ fourStreamLaw ν exact labeledStreamLaw_eq_independent _ _ _ _] simpa [ν, Q, lam] using (Measure.pi_map_eval (μ := ν) 1) have hhist : Measure.map hist (finitePoissonSampleLaw Q lam) = independentPoissonCountLaw Q lam := by exact finitePoissonSampleLaw_map_histogram Q lam have hmap : Measure.map (fun streams ↦ hist (streams 1)) μ = independentPoissonCountLaw Q lam := by rw [← hhist, ← hstream, Measure.map_map] · rfl · exact measurable_finiteSampleHistogram · fun_prop rw [show streamV n d = fun streams x a s ↦ finiteStreamCount (streams 1) (fun o ↦ inCell o x a s ∧ o.R = false) / ((n : ℝ) / 8) by rfl] simp_rw [finiteStreamCount_eq_histogram_sum] change (∫ streams, (∑ o : Obs d, @ite ℝ (inCell o x a s ∧ o.R = false) (propDecidable _) (hist (streams 1) o : ℝ) 0) / ((n : ℝ) / 8) ∂μ) = _ rw [← integral_map (μ := μ) (φ := fun streams ↦ hist (streams 1)) (f := fun counts : Obs d → ℕ ↦ (∑ o : Obs d, @ite ℝ (inCell o x a s ∧ o.R = false) (propDecidable _) (counts o : ℝ) 0) / ((n : ℝ) / 8)) (by change AEMeasurable ((fun z : FiniteSample (Obs d) ↦ finiteSampleHistogram z.points) ∘ fun streams ↦ streams 1) μ exact (measurable_finiteSampleHistogram.comp (measurable_pi_apply 1)).aemeasurable) (measurable_of_countable _).aestronglyMeasurable, hmap] unfold independentPoissonCountLaw rw [integral_div] rw [integral_finset_sum] have hite (o : Obs d) : (∫ counts : Obs d → ℕ, @ite ℝ (inCell o x a s ∧ o.R = false) (propDecidable _) (counts o : ℝ) 0 ∂Measure.pi (fun o : Obs d ↦ poissonMeasure (lam * (Q {o}).toNNReal))) = @ite ℝ (inCell o x a s ∧ o.R = false) (propDecidable _) (∫ counts : Obs d → ℕ, (counts o : ℝ) ∂Measure.pi (fun o : Obs d ↦ poissonMeasure (lam * (Q {o}).toNNReal))) 0 := by by_cases h : inCell o x a s ∧ o.R = false <;> simp [h] simp_rw [hite] simp_rw [integral_comp_eval (μ := fun o : Obs d ↦ poissonMeasure (lam * (Q {o}).toNNReal)) (i := _) (f := fun k : ℕ ↦ (k : ℝ)) (measurable_of_countable _).aestronglyMeasurable] simp_rw [poisson_natCast_first_moment] dsimp only [lam] change (∑ o : Obs d, if inCell o x a s ∧ o.R = false then ((((n : NNReal) / 2) * uniformFourMass 1 * (Q {o}).toNNReal : NNReal) : ℝ) else 0) / ((n : ℝ) / 8) = missingCellMass P x a s simp only [uniformFourMass] have hn8 : ((n : ℝ) / 8) ≠ 0 := by positivity rw [missingCellMass_eq_massOf_missing P x a s] have hobs := obsMass_sum_event P (fun o : Obs d ↦ inCell o x a s ∧ o.R = false) have hobs' : (∑ o : Obs d, if inCell o x a s ∧ o.R = false then obsMass (observedLaw P) o else 0) = massOf P (fun w ↦ w.X = x ∧ w.A = a ∧ w.S = s ∧ w.R = false) := by simpa [inCell, observe, and_assoc] using hobs rw [← hobs'] unfold Q obsMass simp_rw [PMF.toMeasure_apply_singleton _ _ (measurableSet_singleton _)] push_cast field_simp rw [Finset.sum_mul, Finset.mul_sum] apply Finset.sum_congr rfl intro o ho by_cases h : inCell o x a s ∧ o.R = false <;> simp [h] <;> ring intro i hi by_cases h : inCell i x a s ∧ i.R = false · simp only [h, if_true] have hint : Integrable (fun k : ℕ ↦ (k : ℝ)) (poissonMeasure (lam * ((observedLaw P).toMeasure {i}).toNNReal)) := (poisson_natCast_memLp_two (lam * ((observedLaw P).toMeasure {i}).toNNReal)).integrable (by norm_num) exact integrable_comp_eval (μ := fun o : Obs d ↦ poissonMeasure (lam * ((observedLaw P).toMeasure {o}).toNNReal)) (i := i) hint · simp [h]
CausalSmith.Stat.MarNearcompleteFrontier.upper_stream_v_mean · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamMoments.lean:89
theorem upper_map_finitePoissonSampleLaw_finiteSampleMap Lemma upper_map_finitePoissonSampleLaw_finiteSampleMap in the paper ↗

Given the specified input X, the specified input Y, the specified input P, the specified input f, the specified input hf, the specified input lambda, the stated mathematical conclusion holds.

Formal statement
f :
X → Y
hf :
lambda :
ℝ≥0
Measure.map (finiteSampleMap f) (finitePoissonSampleLaw P lambda)
= (letI : IsProbabilityMeasure (Measure.map f P) := Measure.isProbabilityMeasure_map hf.aemeasurable finitePoissonSampleLaw (Measure.map f P) lambda)
Proof (Lean source)
lemma upper_map_finitePoissonSampleLaw_finiteSampleMap {X Y : Type*} [MeasurableSpace X] [MeasurableSpace Y] (P : Measure X) [IsProbabilityMeasure P] (f : X → Y) (hf : Measurable f) (lambda : ℝ≥0) : Measure.map (finiteSampleMap f) (finitePoissonSampleLaw P lambda) = (letI : IsProbabilityMeasure (Measure.map f P) := Measure.isProbabilityMeasure_map hf.aemeasurable finitePoissonSampleLaw (Measure.map f P) lambda) := by letI : IsProbabilityMeasure (Measure.map f P) := Measure.isProbabilityMeasure_map hf.aemeasurable let F := finiteSampleMap f have hF : Measurable F := measurable_finiteSampleMap f hf let mu := Measure.map F (finitePoissonSampleLaw P lambda) let nu := finitePoissonSampleLaw (Measure.map f P) lambda have hrest (n : ℕ) : mu.restrict (FiniteSample.count ⁻¹' ({n} : Set ℕ)) = nu.restrict (FiniteSample.count ⁻¹' ({n} : Set ℕ)) := by rw [show mu = Measure.map F (finitePoissonSampleLaw P lambda) by rfl, Measure.restrict_map hF (measurable_finiteSample_count (MeasurableSet.singleton n))] have hpre : F ⁻¹' (FiniteSample.count ⁻¹' ({n} : Set ℕ)) = FiniteSample.count ⁻¹' ({n} : Set ℕ) := by ext s; rfl rw [hpre, finitePoissonSampleLaw_restrict_count_eq, show nu = finitePoissonSampleLaw (Measure.map f P) lambda by rfl, finitePoissonSampleLaw_restrict_count_eq, Measure.map_smul, Measure.map_map hF (measurable_fixedSizeEmbed n)] have hfun : F ∘ fixedSizeEmbed n = fixedSizeEmbed n ∘ (fun x : Fin n → X => fun i => f (x i)) := by funext x exact finiteSampleMap_fixedSizeEmbed f n x rw [hfun] congr 1 let G : (Fin n → X) → (Fin n → Y) := fun x i => f (x i) have hG : Measurable G := measurable_pi_lambda _ fun i => hf.comp (measurable_pi_apply i) change Measure.map (fixedSizeEmbed n ∘ G) (Measure.pi fun _ : Fin n => P) = _ calc Measure.map (fixedSizeEmbed n ∘ G) (Measure.pi fun _ : Fin n => P) = Measure.map (fixedSizeEmbed n) (Measure.map G (Measure.pi fun _ : Fin n => P)) := (Measure.map_map (measurable_fixedSizeEmbed n) hG).symm _ = Measure.map (fixedSizeEmbed n) (Measure.pi fun _ : Fin n => Measure.map f P) := by rw [show G = (fun x i => f (x i)) by rfl, Measure.pi_map_pi (fun _ => hf.aemeasurable)] have hdecomp (eta : Measure (FiniteSample Y)) : eta = Measure.sum (fun n => eta.restrict (FiniteSample.count ⁻¹' ({n} : Set ℕ))) := by have hdis : Pairwise (onFun Disjoint (fun n : ℕ => (FiniteSample.count : FiniteSample Y → ℕ) ⁻¹' ({n} : Set ℕ))) := by intro i j hij apply Set.disjoint_left.2 intro s hi hj apply hij simpa using hi.symm.trans hj have hcover : ⋃ n : ℕ, (FiniteSample.count : FiniteSample Y → ℕ) ⁻¹' ({n} : Set ℕ) = univ := by ext s; simp calc eta = eta.restrict univ := by rw [Measure.restrict_univ] _ = eta.restrict (⋃ n : ℕ, FiniteSample.count ⁻¹' ({n} : Set ℕ)) := by rw [hcover] _ = Measure.sum (fun n => eta.restrict (FiniteSample.count ⁻¹' ({n} : Set ℕ))) := by exact Measure.restrict_iUnion hdis (fun n => measurable_finiteSample_count (MeasurableSet.singleton n)) change mu = nu rw [hdecomp mu, hdecomp nu] congr 1 funext n exact hrest n
CausalSmith.Stat.MarNearcompleteFrontier.upper_map_finitePoissonSampleLaw_finiteSampleMap · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamMoments.lean:200
theorem upper_measurable_eventCount Lemma upper_measurable_eventCount in the paper ↗

Given the specified input X, the specified input E, the stated mathematical conclusion holds.

Formal statement
X :
E :
X → Bool
Measurable (fun z : FiniteSample X => (Finset.univ.filter (fun i : Fin z.count => E (z.points i) = true)).card)
Proof (Lean source)
lemma upper_measurable_eventCount {X : Type*} [MeasurableSpace X] [Countable X] [MeasurableSingletonClass X] (E : X → Bool) : Measurable (fun z : FiniteSample X => (Finset.univ.filter (fun i : Fin z.count => E (z.points i) = true)).card) := by classical apply measurable_to_countable' intro k rw [MeasurableSpace.measurableSet_iInf] intro m exact measurable_of_countable (fun xs : Fin m → X => (Finset.univ.filter (fun i : Fin m => E (xs i) = true)).card) (measurableSet_singleton k)
CausalSmith.Stat.MarNearcompleteFrontier.upper_measurable_eventCount · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamMoments.lean:276
theorem upper_finitePoissonSampleLaw_eventCount Lemma upper_finitePoissonSampleLaw_eventCount in the paper ↗

An event count in a finite Poisson sample has the corresponding Poisson law. Given the specified input X, the specified input Q, the specified input lam, the specified input E, the specified input hE, the stated mathematical conclusion holds.

Formal statement
X :
lam :
E :
X → Bool
hE :
Measure.map (fun z : FiniteSample X => (Finset.univ.filter (fun i : Fin z.count => E (z.points i) = true)).card) (finitePoissonSampleLaw Q lam)
= poissonMeasure (lam * (Q {x | E x = true}).toNNReal)
Proof (Lean source)
lemma upper_finitePoissonSampleLaw_eventCount {X : Type*} [MeasurableSpace X] [StandardBorelSpace X] [Countable X] (Q : Measure X) [IsProbabilityMeasure Q] (lam : NNReal) (E : X → Bool) (hE : Measurable E) : Measure.map (fun z : FiniteSample X => (Finset.univ.filter (fun i : Fin z.count => E (z.points i) = true)).card) (finitePoissonSampleLaw Q lam) = poissonMeasure (lam * (Q {x | E x = true}).toNNReal) := by classical let p : FiniteMeasurablePartition X Bool := { cell := E, measurable_cell := hE } let R : Measure ℝ := Measure.dirac 0 have herase := upper_map_finitePoissonSampleLaw_finiteSampleMap (Q.prod R) Prod.fst measurable_fst lam have hprod : Measure.map Prod.fst (Q.prod R) = Q := by rw [Measure.map_fst_prod, measure_univ, one_smul] have herase' : Measure.map (finiteSampleMap Prod.fst) (finiteMarkedPoissonSampleLaw Q R lam) = finitePoissonSampleLaw Q lam := by change Measure.map (finiteSampleMap Prod.fst) (finitePoissonSampleLaw (Q.prod R) lam) = finitePoissonSampleLaw Q lam simpa only [hprod] using herase have hcount (z : FiniteSample (X × ℝ)) : (p.restrictCell true z).count = (Finset.univ.filter (fun i : Fin (finiteSampleMap Prod.fst z).count => E ((finiteSampleMap Prod.fst z).points i) = true)).card := by change (p.cellIndices true z).card = _ simp only [FiniteMeasurablePartition.cellIndices, p, finiteSampleMap, FiniteSample.count, FiniteSample.points] congr 1 exact Finset.filter_congr_decidable _ _ _ have hmarked := p.map_restrictCell_count_finiteMarkedPoissonSampleLaw Q R lam true have hmass : p.cellMass Q true = (Q {x | E x = true}).toNNReal := by rfl rw [hmass] at hmarked have hmeas := upper_measurable_eventCount E calc Measure.map (fun z : FiniteSample X => (Finset.univ.filter (fun i : Fin z.count => E (z.points i) = true)).card) (finitePoissonSampleLaw Q lam) = Measure.map (fun z : FiniteSample (X × ℝ) => (p.restrictCell true z).count) (finiteMarkedPoissonSampleLaw Q R lam) := by rw [← herase', Measure.map_map] · exact congrArg (fun f => Measure.map f (finiteMarkedPoissonSampleLaw Q R lam)) (funext fun z => (hcount z).symm) · exact hmeas · exact measurable_finiteSampleMap Prod.fst measurable_fst _ = _ := hmarked
CausalSmith.Stat.MarNearcompleteFrontier.upper_finitePoissonSampleLaw_eventCount · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamMoments.lean:291
theorem upper_finiteStreamCount_eq_eventCount

Given the specified input d, the specified input E, the stated mathematical conclusion holds. Given the specified input z.

Formal statement
d :
ℕ
z :
FiniteSample (Obs d)
E :
Obs d → Prop
= ((Finset.univ.filter (fun i : Fin z.count => E (z.points i))).card : ℝ)
Proof (Lean source)
lemma upper_finiteStreamCount_eq_eventCount {d : ℕ} (z : FiniteSample (Obs d)) (E : Obs d → Prop) [DecidablePred E] : finiteStreamCount z E = ((Finset.univ.filter (fun i : Fin z.count => E (z.points i))).card : ℝ) := by classical rcases z with ⟨N, points⟩ unfold finiteStreamCount simp only [FiniteSample.count, FiniteSample.points] have hsum : (∑ i : Fin N, @ite ℝ (E (points i)) (propDecidable _) 1 0) = ∑ i : Fin N, if E (points i) then (1 : ℝ) else 0 := by apply Finset.sum_congr rfl intro i hi by_cases h : E (points i) <;> simp [h] calc _ = (∑ i : Fin N, if E (points i) then (1 : ℝ) else 0) := hsum _ = _ := by convert (Finset.sum_boole (fun i : Fin N => E (points i)) (Finset.univ : Finset (Fin N)) : (∑ i : Fin N, if E (points i) then (1 : ℝ) else 0) = ((Finset.univ.filter (fun i : Fin N => E (points i))).card : ℝ)) using 1 congr 1
CausalSmith.Stat.MarNearcompleteFrontier.upper_finiteStreamCount_eq_eventCount · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamMoments.lean:344
theorem upper_stream_v_second_moment

Equation (3), second moment: a scaled Poisson missing count has its mean squared plus its Poisson variance. Given the specified input n, the specified input d, the specified input hn, the specified input P, the specified input x, the specified input a, the specified input s, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
hn :
0 < n
P :
x :
Fin d
a s :
(∫ streams, (streamV n d streams x a s) ^ 2 ∂fourStreamLaw n P)
= (missingCellMass P x a s) ^ 2 + missingCellMass P x a s / ((n : ℝ) / 8)
Proof (Lean source)
lemma upper_stream_v_second_moment {n d : ℕ} (hn : 0 < n) (P : FullLaw d) (x : Fin d) (a s : Bool) : (∫ streams, (streamV n d streams x a s) ^ 2 ∂fourStreamLaw n P) = (missingCellMass P x a s) ^ 2 + missingCellMass P x a s / ((n : ℝ) / 8) := by classical let μ := fourStreamLaw n P let Q := (observedLaw P).toMeasure let lam : NNReal := ((n : NNReal) / 2) * uniformFourMass 1 let E : Obs d → Bool := fun o => decide (inCell o x a s ∧ o.R = false) let count : (Fin 4 → FiniteSample (Obs d)) → ℕ := fun streams => (Finset.univ.filter (fun i : Fin (streams 1).count => E ((streams 1).points i) = true)).card let rate : NNReal := lam * (Q {o | E o = true}).toNNReal have hstream : Measure.map (fun streams ↦ streams 1) μ = finitePoissonSampleLaw Q lam := by let ν : Fin 4 → Measure (FiniteSample (Obs d)) := fun i ↦ finitePoissonSampleLaw Q (((n : NNReal) / 2) * uniformFourMass i) haveI (i : Fin 4) : IsProbabilityMeasure (ν i) := by dsimp [ν] infer_instance rw [show μ = Measure.pi ν by unfold μ fourStreamLaw ν exact labeledStreamLaw_eq_independent _ _ _ _] simpa [ν, Q, lam] using (Measure.pi_map_eval (μ := ν) 1) have hcountMeas : Measurable count := (upper_measurable_eventCount E).comp (measurable_pi_apply 1) have hlaw : Measure.map count μ = poissonMeasure rate := by rw [show count = (fun z : FiniteSample (Obs d) => (Finset.univ.filter (fun i : Fin z.count => E (z.points i) = true)).card) ∘ (fun streams => streams 1) by rfl] rw [← Measure.map_map (upper_measurable_eventCount E) (measurable_pi_apply 1), hstream] exact upper_finitePoissonSampleLaw_eventCount Q lam E (measurable_of_countable E) have hcountReal (streams : Fin 4 → FiniteSample (Obs d)) : finiteStreamCount (streams 1) (fun o ↦ inCell o x a s ∧ o.R = false) = (count streams : ℝ) := by simpa only [count, E, decide_eq_true_eq] using upper_finiteStreamCount_eq_eventCount (streams 1) (fun o ↦ inCell o x a s ∧ o.R = false) have hV (streams : Fin 4 → FiniteSample (Obs d)) : streamV n d streams x a s = (count streams : ℝ) / ((n : ℝ) / 8) := by unfold streamV rw [hcountReal] have hmean : (∫ streams, (count streams : ℝ) / ((n : ℝ) / 8) ∂μ) = missingCellMass P x a s := by simpa only [μ, ← hV] using upper_stream_v_mean hn P x a s have hfirst : (∫ k : ℕ, (k : ℝ) / ((n : ℝ) / 8) ∂poissonMeasure rate) = missingCellMass P x a s := by rw [← hlaw, integral_map hcountMeas.aemeasurable (measurable_of_countable _).aestronglyMeasurable] exact hmean have hsecond : (∫ k : ℕ, ((k : ℝ) / ((n : ℝ) / 8)) ^ 2 ∂poissonMeasure rate) = (rate : ℝ) ^ 2 / (((n : ℝ) / 8) ^ 2) + (rate : ℝ) / (((n : ℝ) / 8) ^ 2) := by simp only [div_pow] rw [integral_div, poisson_count_second_moment] ring have hn8 : ((n : ℝ) / 8) ≠ 0 := by positivity have hrate : (rate : ℝ) / ((n : ℝ) / 8) = missingCellMass P x a s := by rw [← hfirst, integral_div, poisson_natCast_first_moment] simp_rw [hV] change (∫ streams, ((count streams : ℝ) / ((n : ℝ) / 8)) ^ 2 ∂μ) = _ calc (∫ streams, ((count streams : ℝ) / ((n : ℝ) / 8)) ^ 2 ∂μ) = ∫ k : ℕ, ((k : ℝ) / ((n : ℝ) / 8)) ^ 2 ∂Measure.map count μ := by rw [integral_map hcountMeas.aemeasurable (measurable_of_countable _).aestronglyMeasurable] _ = _ := by rw [hlaw, hsecond, ← hrate] field_simp
CausalSmith.Stat.MarNearcompleteFrontier.upper_stream_v_second_moment · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamMoments.lean:369
theorem upper_stream_arrived_count_law

Equation (3), count law: the pilot and correction arrived counts each have the Poisson law with rate given by the arrived cell mass. Given the specified input n, the specified input d, the specified input P, the specified input x, the specified input a, the specified input s, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
P :
x :
Fin d
a s :
conclusion 1
Measure.map (fun streams ↦ streamCpilot d streams x a s) (fourStreamLaw n P)
= Measure.map (fun k : ℕ ↦ (k : ℝ)) (poissonMeasure (streamPoissonRate n P x a s))
conclusion 2
Measure.map (fun streams ↦ streamC d streams x a s) (fourStreamLaw n P)
= Measure.map (fun k : ℕ ↦ (k : ℝ)) (poissonMeasure (streamPoissonRate n P x a s))
Proof (Lean source)
lemma upper_stream_arrived_count_law {n d : ℕ} (P : FullLaw d) (x : Fin d) (a s : Bool) : Measure.map (fun streams ↦ streamCpilot d streams x a s) (fourStreamLaw n P) = Measure.map (fun k : ℕ ↦ (k : ℝ)) (poissonMeasure (streamPoissonRate n P x a s)) ∧ Measure.map (fun streams ↦ streamC d streams x a s) (fourStreamLaw n P) = Measure.map (fun k : ℕ ↦ (k : ℝ)) (poissonMeasure (streamPoissonRate n P x a s)) := by classical let Q := (observedLaw P).toMeasure let E : Obs d → Bool := fun o => decide (inCell o x a s ∧ o.R = true) have hmass : (Q {o | E o = true}).toNNReal = ⟨arrivedCellMass P x a s, arrivedCellMass_nonneg P x a s⟩ := by apply NNReal.eq change (Q {o | E o = true}).toReal = arrivedCellMass P x a s simp only [E, decide_eq_true_eq] rw [show (Q {o | inCell o x a s ∧ o.R = true}).toReal = ∑ o : Obs d, if inCell o x a s ∧ o.R = true then obsMass (observedLaw P) o else 0 by rw [show Q = (observedLaw P).toMeasure by rfl, PMF.toMeasure_apply_fintype, ENNReal.toReal_sum] · apply Finset.sum_congr rfl intro o ho by_cases h : inCell o x a s ∧ o.R = true <;> simp [indicator, h, obsMass] · intro o ho by_cases h : inCell o x a s ∧ o.R = true <;> simp [indicator, h, PMF.apply_ne_top]] simpa only [inCell, arrivedCellMass, and_assoc] using observed_arrived_mass P x a s have hcount (i : Fin 4) (hi : i = 2 ∨ i = 3) : Measure.map (fun streams => finiteStreamCount (streams i) (fun o => inCell o x a s ∧ o.R = true)) (fourStreamLaw n P) = Measure.map (fun k : ℕ => (k : ℝ)) (poissonMeasure (streamPoissonRate n P x a s)) := by let lam : NNReal := ((n : NNReal) / 2) * uniformFourMass i let count : FiniteSample (Obs d) → ℕ := fun z => (Finset.univ.filter (fun j : Fin z.count => E (z.points j) = true)).card have hstream : Measure.map (fun streams => streams i) (fourStreamLaw n P) = finitePoissonSampleLaw Q lam := by let ν : Fin 4 → Measure (FiniteSample (Obs d)) := fun j => finitePoissonSampleLaw Q (((n : NNReal) / 2) * uniformFourMass j) haveI (j : Fin 4) : IsProbabilityMeasure (ν j) := by dsimp [ν] infer_instance rw [show fourStreamLaw n P = Measure.pi ν by unfold fourStreamLaw ν Q exact labeledStreamLaw_eq_independent _ _ _ _] simpa [ν, lam] using (Measure.pi_map_eval (μ := ν) i) have hlaw : Measure.map count (finitePoissonSampleLaw Q lam) = poissonMeasure (lam * (Q {o | E o = true}).toNNReal) := upper_finitePoissonSampleLaw_eventCount Q lam E (measurable_of_countable E) have hrate : lam * (Q {o | E o = true}).toNNReal = streamPoissonRate n P x a s := by rw [hmass] cases hi with | inl h => subst i; norm_num [lam, uniformFourMass, streamPoissonRate]; ring | inr h => subst i; norm_num [lam, uniformFourMass, streamPoissonRate]; ring have hreal (z : FiniteSample (Obs d)) : finiteStreamCount z (fun o => inCell o x a s ∧ o.R = true) = (count z : ℝ) := by simpa only [count, E, decide_eq_true_eq] using upper_finiteStreamCount_eq_eventCount z (fun o => inCell o x a s ∧ o.R = true) have heval : Measurable (fun streams : Fin 4 → FiniteSample (Obs d) => streams i) := measurable_pi_apply i have hcountMeas : Measurable count := upper_measurable_eventCount E have hcast : Measurable (fun k : ℕ => (k : ℝ)) := measurable_of_countable _ calc _ = Measure.map ((fun k : ℕ => (k : ℝ)) ∘ count ∘ (fun streams => streams i)) (fourStreamLaw n P) := by congr 1 funext streams exact hreal (streams i) _ = Measure.map (fun k : ℕ => (k : ℝ)) (Measure.map count (Measure.map (fun streams => streams i) (fourStreamLaw n P))) := by rw [Measure.map_map hcountMeas heval] rw [Measure.map_map hcast (hcountMeas.comp heval)] _ = _ := by rw [hstream, hlaw, hrate] constructor · exact hcount 2 (inl rfl) · exact hcount 3 (inr rfl)
CausalSmith.Stat.MarNearcompleteFrontier.upper_stream_arrived_count_law · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamMoments.lean:448
CausalSmith.Stat.STAT_MarNearcompleteFrontier_Research.Helpers.UpperRisk.StreamPilot 4 declarations These paper-local identities combine the proved branch means using independence of the third pilot stream from the fourth correction stream.

Pilot selection of the light and heavy correction branches

These paper-local identities combine the proved branch means using independence of the third pilot stream from the fourth correction stream.

def streamPilotLightProb

Probability that the third stream selects the light correction in a cell.

Definition (Lean source)
d :
ℕ
n :
ℕ
P :
x :
Fin d
a s :
streamPilotLightProb n P x a s :
ℝ
(fourStreamLaw n P).real {streams | streamCpilot d streams x a s ≤ polyThreshold n / 4}
CausalSmith.Stat.MarNearcompleteFrontier.streamPilotLightProb · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamPilot.lean:164
theorem upper_stream_pilot_light_prob_poisson

The pilot light-selection probability is the Poisson probability that the arrived-cell pilot count is below its threshold. Given the specified input n, the specified input d, the specified input P, the specified input x, the specified input a, the specified input s, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
P :
x :
Fin d
a s :
= (poissonMeasure (streamPoissonRate n P x a s)).real {k : ℕ | (k : ℝ) ≤ polyThreshold n / 4}
Proof (Lean source)
lemma upper_stream_pilot_light_prob_poisson {n d : ℕ} (P : FullLaw d) (x : Fin d) (a s : Bool) : streamPilotLightProb n P x a s = (poissonMeasure (streamPoissonRate n P x a s)).real {k : ℕ | (k : ℝ) ≤ polyThreshold n / 4} := by let threshold : ℝ := polyThreshold n / 4 let S : Set ℝ := Set.Iic threshold have hS : MeasurableSet S := measurableSet_Iic have hcount := measurable_streamCpilot x a s have hcast : Measurable (fun k : ℕ => (k : ℝ)) := measurable_of_countable _ have hlaw := (upper_stream_arrived_count_law (n := n) P x a s).1 have happ := congrArg (fun ν : Measure ℝ => (ν S).toReal) hlaw rw [Measure.map_apply hcount hS, Measure.map_apply hcast hS] at happ unfold streamPilotLightProb change ((fourStreamLaw n P) ((fun streams => streamCpilot d streams x a s) ⁻¹' S)).toReal = (poissonMeasure (streamPoissonRate n P x a s) ((fun k : ℕ => (k : ℝ)) ⁻¹' S)).toReal exact happ
CausalSmith.Stat.MarNearcompleteFrontier.upper_stream_pilot_light_prob_poisson · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamPilot.lean:171
theorem upper_stream_pilot_branch_mean

Independence of the pilot and correction streams mixes their light and heavy expected corrections with the pilot selection probability. Given the specified input n, the specified input d, the specified input P, the specified input x, the specified input a, the specified input s, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
P :
x :
Fin d
a s :
(∫ streams, streamG n d streams x a s ∂fourStreamLaw n P)
= streamPilotLightProb n P x a s * (∫ streams, streamH n d streams x a s ∂fourStreamLaw n P)
+ (1 - streamPilotLightProb n P x a s) * (∫ streams, streamD d streams x a s ∂fourStreamLaw n P)
Proof (Lean source)
lemma upper_stream_pilot_branch_mean {n d : ℕ} (P : FullLaw d) (x : Fin d) (a s : Bool) : (∫ streams, streamG n d streams x a s ∂fourStreamLaw n P) = streamPilotLightProb n P x a s * (∫ streams, streamH n d streams x a s ∂fourStreamLaw n P) + (1 - streamPilotLightProb n P x a s) * (∫ streams, streamD d streams x a s ∂fourStreamLaw n P) := by classical let μ := fourStreamLaw n P let Q := (observedLaw P).toMeasure let μi : Fin 4 → Measure (FiniteSample (Obs d)) := fun i => finitePoissonSampleLaw Q ((n : NNReal) / 2 * uniformFourMass i) have hμ : μ = Measure.pi μi := by unfold μ μi fourStreamLaw Q exact labeledStreamLaw_eq_independent _ _ _ _ letI : IsProbabilityMeasure μ := by rw [hμ]; infer_instance let B : Set (Obs d) := {o | inCell o x a s ∧ o.R = true} let A : Set (Obs d) := {o | inCell o x a s ∧ o.RY = true} let c : FiniteSample (Obs d) → ℝ := fun z => finiteStreamCount z (fun o => o ∈ B) let u : FiniteSample (Obs d) → ℝ := fun z => finiteStreamCount z (fun o => o ∈ A) let pilot : FiniteSample (Obs d) → ℝ := fun z => if c z ≤ polyThreshold n / 4 then 1 else 0 let light : FiniteSample (Obs d) → ℝ := fun z => lightCorrection n (c z) (u z) let heavy : FiniteSample (Obs d) → ℝ := fun z => heavyCorrection (c z) (u z) have hB : MeasurableSet B := by measurability have hA : MeasurableSet A := by measurability have hc : Measurable c := measurable_finiteStreamCount_set B hB have hu : Measurable u := measurable_finiteStreamCount_set A hA have hp : Measurable pilot := by unfold pilot apply Measurable.ite (measurableSet_le hc measurable_const) <;> fun_prop have hl : Measurable light := by unfold light lightCorrection shiftedFalling fun_prop have hd : Measurable heavy := by unfold heavy heavyCorrection apply Measurable.ite (measurableSet_lt measurable_const hc) <;> fun_prop have hi : iIndepFun (fun i (streams : Fin 4 → FiniteSample (Obs d)) => streams i) μ := by rw [hμ] exact iIndepFun_pi (X := fun _ => id) (fun _ => aemeasurable_id) have hi23 := hi.indepFun (by decide : (2 : Fin 4) ≠ 3) have hindLight := hi23.comp hp hl have hnot : Measurable (fun z => 1 - pilot z) := measurable_const.sub hp have hindHeavy := hi23.comp hnot hd have hpInt : Integrable (fun streams => pilot (streams 2)) μ := Integrable.of_bound (hp.comp (measurable_pi_apply 2)).aestronglyMeasurable 1 (Filter.Eventually.of_forall fun streams => by unfold pilot split_ifs <;> norm_num) have hnInt : Integrable (fun streams => 1 - pilot (streams 2)) μ := (integrable_const 1).sub hpInt have hlInt : Integrable (fun streams => light (streams 3)) μ := by simpa only [μ, light, c, u, streamH, streamC, streamU, B, A, Set.mem_ofPred_eq] using integrable_streamH P x a s have hdInt : Integrable (fun streams => heavy (streams 3)) μ := by simpa only [μ, heavy, c, u, streamD, streamC, streamU, B, A, Set.mem_ofPred_eq] using integrable_streamD P x a s have hfacLight : (∫ streams, pilot (streams 2) * light (streams 3) ∂μ) = (∫ streams, pilot (streams 2) ∂μ) * ∫ streams, light (streams 3) ∂μ := hindLight.integral_fun_mul_eq_mul_integral (hp.comp (measurable_pi_apply 2)).aestronglyMeasurable (hl.comp (measurable_pi_apply 3)).aestronglyMeasurable have hfacHeavy : (∫ streams, (1 - pilot (streams 2)) * heavy (streams 3) ∂μ) = (∫ streams, 1 - pilot (streams 2) ∂μ) * ∫ streams, heavy (streams 3) ∂μ := hindHeavy.integral_fun_mul_eq_mul_integral ((measurable_const.sub (hp.comp (measurable_pi_apply 2))).aestronglyMeasurable) (hd.comp (measurable_pi_apply 3)).aestronglyMeasurable have hprodLight : Integrable (fun streams => pilot (streams 2) * light (streams 3)) μ := by convert hindLight.integrable_mul hpInt hlInt using 1 <;> funext streams <;> rfl have hprodHeavy : Integrable (fun streams => (1 - pilot (streams 2)) * heavy (streams 3)) μ := by convert hindHeavy.integrable_mul hnInt hdInt using 1 <;> funext streams <;> rfl let E : Set (Fin 4 → FiniteSample (Obs d)) := {streams | streamCpilot d streams x a s ≤ polyThreshold n / 4} have hE : MeasurableSet E := measurableSet_le (measurable_streamCpilot x a s) measurable_const have hpMean : (∫ streams, pilot (streams 2) ∂μ) = streamPilotLightProb n P x a s := by rw [show (fun streams => pilot (streams 2)) = E.indicator (fun _ => (1 : ℝ)) by funext streams simp only [pilot, c, E, indicator, Set.mem_ofPred_eq, streamCpilot, B] rfl] rw [integral_indicator_const (1 : ℝ) hE] simp only [smul_eq_mul, mul_one, μ, streamPilotLightProb, E] have hnMean : (∫ streams, 1 - pilot (streams 2) ∂μ) = 1 - streamPilotLightProb n P x a s := by rw [show (fun streams => 1 - pilot (streams 2)) = Eᶜ.indicator (fun _ => (1 : ℝ)) by funext streams simp only [pilot, c, E, indicator, Set.mem_compl_iff, Set.mem_ofPred_eq, streamCpilot, B] split_ifs <;> simp_all] rw [integral_indicator_const (1 : ℝ) hE.compl] simp only [smul_eq_mul, mul_one, measureReal_compl hE, probReal_univ, μ, streamPilotLightProb, E] rw [show (fun streams => streamG n d streams x a s) = (fun streams => pilot (streams 2) * light (streams 3) + (1 - pilot (streams 2)) * heavy (streams 3)) by funext streams unfold streamG simp only [pilot, light, heavy, c, u, streamCpilot, streamH, streamD, B, A, Set.mem_ofPred_eq] norm_num [div_eq_mul_inv] at * split_ifs <;> simp_all [streamC, streamU]] change (∫ streams, pilot (streams 2) * light (streams 3) + (1 - pilot (streams 2)) * heavy (streams 3) ∂μ) = streamPilotLightProb n P x a s * (∫ streams, light (streams 3) ∂μ) + (1 - streamPilotLightProb n P x a s) * (∫ streams, heavy (streams 3) ∂μ) rw [integral_add hprodLight hprodHeavy, hfacLight, hfacHeavy, hpMean, hnMean]
CausalSmith.Stat.MarNearcompleteFrontier.upper_stream_pilot_branch_mean · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamPilot.lean:194
theorem upper_stream_pilot_bias

The selected correction's cellwise bias is the sum of its light Chebyshev remainder and heavy empty-count remainder. Given the specified input n, the specified input d, the specified input P, the specified input q, the specified input h, the specified input x, the specified input a, the specified input s, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
P :
q :
ℝ
h :
LawClass d q P
x :
Fin d
a s :
(∫ streams, streamG n d streams x a s ∂fourStreamLaw n P) - cellEta P x a s
= -cellEta P x a s * (streamPilotLightProb n P x a s * (qPoly n).eval (streamZ n P x a s) + (1 - streamPilotLightProb n P x a s) * exp (-(streamZ n P x a s)))
Proof (Lean source)
lemma upper_stream_pilot_bias {n d : ℕ} (P : FullLaw d) {q : ℝ} (h : LawClass d q P) (x : Fin d) (a s : Bool) : (∫ streams, streamG n d streams x a s ∂fourStreamLaw n P) - cellEta P x a s = -cellEta P x a s * (streamPilotLightProb n P x a s * (qPoly n).eval (streamZ n P x a s) + (1 - streamPilotLightProb n P x a s) * exp (-(streamZ n P x a s))) := by rw [upper_stream_pilot_branch_mean P x a s, upper_stream_light_mean P h x a s, upper_stream_heavy_mean P h x a s] ring
CausalSmith.Stat.MarNearcompleteFrontier.upper_stream_pilot_bias · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamPilot.lean:312
CausalSmith.Stat.STAT_MarNearcompleteFrontier_Research.Helpers.UpperRisk.StreamProduct 2 declarations These identities isolate the independence step in the heavy-cell variance calculation of the upper-risk proof.

Product moments of the independent missing and correction streams

These identities isolate the independence step in the heavy-cell variance calculation of the upper-risk proof.

theorem upper_stream_vd_mean

The mean of a cell's missing-count times heavy correction factors across the independent second and fourth Poisson streams. Given the specified input n, the specified input d, the specified input hn, the specified input P, the specified input x, the specified input a, the specified input s, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
hn :
0 < n
P :
x :
Fin d
a s :
(∫ streams, streamV n d streams x a s * streamD d streams x a s ∂fourStreamLaw n P)
= missingCellMass P x a s * (∫ streams, streamD d streams x a s ∂fourStreamLaw n P)
Proof (Lean source)
lemma upper_stream_vd_mean {n d : ℕ} (hn : 0 < n) (P : FullLaw d) (x : Fin d) (a s : Bool) : (∫ streams, streamV n d streams x a s * streamD d streams x a s ∂fourStreamLaw n P) = missingCellMass P x a s * (∫ streams, streamD d streams x a s ∂fourStreamLaw n P) := by classical let μ := fourStreamLaw n P let Q := (observedLaw P).toMeasure let μi : Fin 4 → Measure (FiniteSample (Obs d)) := fun i => finitePoissonSampleLaw Q ((n : NNReal) / 2 * uniformFourMass i) have hμ : μ = Measure.pi μi := by unfold μ μi fourStreamLaw Q exact labeledStreamLaw_eq_independent _ _ _ _ let _ : IsProbabilityMeasure μ := by rw [hμ]; infer_instance let M : Set (Obs d) := {o | inCell o x a s ∧ o.R = false} let B : Set (Obs d) := {o | inCell o x a s ∧ o.R = true} let A : Set (Obs d) := {o | inCell o x a s ∧ o.RY = true} let v : FiniteSample (Obs d) → ℝ := fun z => finiteStreamCount z (fun o => o ∈ M) / ((n : ℝ) / 8) let corr : FiniteSample (Obs d) → ℝ := fun z => heavyCorrection (finiteStreamCount z (fun o => o ∈ B)) (finiteStreamCount z (fun o => o ∈ A)) have hM : MeasurableSet M := by measurability have hB : MeasurableSet B := by measurability have hA : MeasurableSet A := by measurability have hv : Measurable v := by have hm := measurable_finiteStreamCount_set M hM unfold v exact hm.div measurable_const have hcorr : Measurable corr := by have hc := measurable_finiteStreamCount_set B hB have hu := measurable_finiteStreamCount_set A hA unfold corr heavyCorrection apply Measurable.ite (measurableSet_lt measurable_const hc) <;> fun_prop have hi : iIndepFun (fun i (streams : Fin 4 → FiniteSample (Obs d)) => streams i) μ := by rw [hμ] exact iIndepFun_pi (X := fun _ => id) (fun _ => aemeasurable_id) have hind := (hi.indepFun (by decide : (1 : Fin 4) ≠ 3)).comp hv hcorr have hfactor : (∫ streams, v (streams 1) * corr (streams 3) ∂μ) = (∫ streams, v (streams 1) ∂μ) * ∫ streams, corr (streams 3) ∂μ := by exact hind.integral_fun_mul_eq_mul_integral (hv.comp (measurable_pi_apply 1)).aestronglyMeasurable (hcorr.comp (measurable_pi_apply 3)).aestronglyMeasurable have hvMean : (∫ streams, v (streams 1) ∂μ) = missingCellMass P x a s := by simpa only [μ, v, M, streamV, Set.mem_ofPred_eq] using upper_stream_v_mean hn P x a s calc (∫ streams, streamV n d streams x a s * streamD d streams x a s ∂fourStreamLaw n P) = ∫ streams, v (streams 1) * corr (streams 3) ∂μ := by congr 1 _ = (∫ streams, v (streams 1) ∂μ) * ∫ streams, corr (streams 3) ∂μ := hfactor _ = missingCellMass P x a s * (∫ streams, streamD d streams x a s ∂fourStreamLaw n P) := by rw [hvMean] congr 1
CausalSmith.Stat.MarNearcompleteFrontier.upper_stream_vd_mean · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamProduct.lean:39
theorem upper_stream_vd_second_moment

The second moment of a cell's missing-count times heavy correction factors across the independent second and fourth Poisson streams. Given the specified input n, the specified input d, the specified input hn, the specified input P, the specified input x, the specified input a, the specified input s, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
hn :
0 < n
P :
x :
Fin d
a s :
(∫ streams, (streamV n d streams x a s * streamD d streams x a s) ^ 2 ∂fourStreamLaw n P)
= ((missingCellMass P x a s) ^ 2 + missingCellMass P x a s / ((n : ℝ) / 8)) * (∫ streams, (streamD d streams x a s) ^ 2 ∂fourStreamLaw n P)
Proof (Lean source)
lemma upper_stream_vd_second_moment {n d : ℕ} (hn : 0 < n) (P : FullLaw d) (x : Fin d) (a s : Bool) : (∫ streams, (streamV n d streams x a s * streamD d streams x a s) ^ 2 ∂fourStreamLaw n P) = ((missingCellMass P x a s) ^ 2 + missingCellMass P x a s / ((n : ℝ) / 8)) * (∫ streams, (streamD d streams x a s) ^ 2 ∂fourStreamLaw n P) := by classical let μ := fourStreamLaw n P let Q := (observedLaw P).toMeasure let μi : Fin 4 → Measure (FiniteSample (Obs d)) := fun i => finitePoissonSampleLaw Q ((n : NNReal) / 2 * uniformFourMass i) have hμ : μ = Measure.pi μi := by unfold μ μi fourStreamLaw Q exact labeledStreamLaw_eq_independent _ _ _ _ let _ : IsProbabilityMeasure μ := by rw [hμ]; infer_instance let M : Set (Obs d) := {o | inCell o x a s ∧ o.R = false} let B : Set (Obs d) := {o | inCell o x a s ∧ o.R = true} let A : Set (Obs d) := {o | inCell o x a s ∧ o.RY = true} let v : FiniteSample (Obs d) → ℝ := fun z => finiteStreamCount z (fun o => o ∈ M) / ((n : ℝ) / 8) let corr : FiniteSample (Obs d) → ℝ := fun z => heavyCorrection (finiteStreamCount z (fun o => o ∈ B)) (finiteStreamCount z (fun o => o ∈ A)) have hM : MeasurableSet M := by measurability have hB : MeasurableSet B := by measurability have hA : MeasurableSet A := by measurability have hv : Measurable v := by have hm := measurable_finiteStreamCount_set M hM unfold v exact hm.div measurable_const have hcorr : Measurable corr := by have hc := measurable_finiteStreamCount_set B hB have hu := measurable_finiteStreamCount_set A hA unfold corr heavyCorrection apply Measurable.ite (measurableSet_lt measurable_const hc) <;> fun_prop have hv2 : Measurable (fun z => (v z) ^ 2) := by fun_prop have hcorr2 : Measurable (fun z => (corr z) ^ 2) := by fun_prop have hi : iIndepFun (fun i (streams : Fin 4 → FiniteSample (Obs d)) => streams i) μ := by rw [hμ] exact iIndepFun_pi (X := fun _ => id) (fun _ => aemeasurable_id) have hind := (hi.indepFun (by decide : (1 : Fin 4) ≠ 3)).comp hv2 hcorr2 have hfactor : (∫ streams, (v (streams 1)) ^ 2 * (corr (streams 3)) ^ 2 ∂μ) = (∫ streams, (v (streams 1)) ^ 2 ∂μ) * ∫ streams, (corr (streams 3)) ^ 2 ∂μ := by exact hind.integral_fun_mul_eq_mul_integral (hv2.comp (measurable_pi_apply 1)).aestronglyMeasurable (hcorr2.comp (measurable_pi_apply 3)).aestronglyMeasurable have hvMoment : (∫ streams, (v (streams 1)) ^ 2 ∂μ) = (missingCellMass P x a s) ^ 2 + missingCellMass P x a s / ((n : ℝ) / 8) := by simpa only [μ, v, M, streamV, Set.mem_ofPred_eq] using upper_stream_v_second_moment hn P x a s calc (∫ streams, (streamV n d streams x a s * streamD d streams x a s) ^ 2 ∂fourStreamLaw n P) = ∫ streams, (v (streams 1)) ^ 2 * (corr (streams 3)) ^ 2 ∂μ := by congr 1 funext streams simp only [v, corr, M, B, A, streamV, streamD, streamC, streamU, Set.mem_ofPred_eq] ring _ = (∫ streams, (v (streams 1)) ^ 2 ∂μ) * ∫ streams, (corr (streams 3)) ^ 2 ∂μ := hfactor _ = ((missingCellMass P x a s) ^ 2 + missingCellMass P x a s / ((n : ℝ) / 8)) * (∫ streams, (streamD d streams x a s) ^ 2 ∂fourStreamLaw n P) := by rw [hvMoment] congr 1
CausalSmith.Stat.MarNearcompleteFrontier.upper_stream_vd_second_moment · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamProduct.lean:108
CausalSmith.Stat.STAT_MarNearcompleteFrontier_Research.Helpers.UpperRisk.StreamRawMean 5 declarations Independence of the missing-count stream from the pilot and outcome streams turns the correction mean into the missing-mass-weighted mean in equation (14).

Mean and bias of the unprojected four-stream estimator

Independence of the missing-count stream from the pilot and outcome streams turns the correction mean into the missing-mass-weighted mean in equation (14).

theorem upper_streamV_indep_streamG

The missing-count statistic is independent of the jointly selected pilot and outcome correction, since their stream coordinates are disjoint. Given the specified input n, the specified input d, the specified input P, the specified input x, the specified input a, the specified input s, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
P :
x :
Fin d
a s :
IndepFun (fun streams => streamV n d streams x a s) (fun streams => streamG n d streams x a s) (fourStreamLaw n P)
Proof (Lean source)
-- @node: upper_streamV_indep_streamG lemma upper_streamV_indep_streamG {n d : ℕ} (P : FullLaw d) (x : Fin d) (a s : Bool) : IndepFun (fun streams => streamV n d streams x a s) (fun streams => streamG n d streams x a s) (fourStreamLaw n P) := by classical let v : FiniteSample (Obs d) → ℝ := fun z => finiteStreamCount z (fun o => inCell o x a s ∧ o.R = false) / ((n : ℝ) / 8) let c : FiniteSample (Obs d) → ℝ := fun z => finiteStreamCount z (fun o => inCell o x a s ∧ o.R = true) let u : FiniteSample (Obs d) → ℝ := fun z => finiteStreamCount z (fun o => inCell o x a s ∧ o.RY = true) let g : FiniteSample (Obs d) × FiniteSample (Obs d) → ℝ := fun z => if c z.1 ≤ polyThreshold n / 4 then lightCorrection n (c z.2) (u z.2) else heavyCorrection (c z.2) (u z.2) have hM : MeasurableSet {o : Obs d | inCell o x a s ∧ o.R = false} := by measurability have hB : MeasurableSet {o : Obs d | inCell o x a s ∧ o.R = true} := by measurability have hA : MeasurableSet {o : Obs d | inCell o x a s ∧ o.RY = true} := by measurability have hv : Measurable v := (upper_measurable_finiteStreamCount _ hM).div_const _ have hc : Measurable c := upper_measurable_finiteStreamCount _ hB have hu : Measurable u := upper_measurable_finiteStreamCount _ hA have hg : Measurable g := by unfold g apply Measurable.ite (measurableSet_le (hc.comp measurable_fst) measurable_const) · unfold lightCorrection shiftedFalling fun_prop · unfold heavyCorrection apply Measurable.ite (measurableSet_lt measurable_const (hc.comp measurable_snd)) <;> fun_prop have hi : iIndepFun (fun i (streams : Fin 4 → FiniteSample (Obs d)) => streams i) (fourStreamLaw n P) := by rw [show fourStreamLaw n P = Measure.pi (fun i : Fin 4 => finitePoissonSampleLaw (observedLaw P).toMeasure ((n : NNReal) / 2 * uniformFourMass i)) from labeledStreamLaw_eq_independent _ _ _ _] exact iIndepFun_pi (X := fun _ => id) (fun _ => aemeasurable_id) exact (hi.indepFun_prodMk (fun i => measurable_pi_apply i) 2 3 1 (by decide) (by decide)).symm.comp hv hg
CausalSmith.Stat.MarNearcompleteFrontier.upper_streamV_indep_streamG · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamRawMean.lean:22
theorem upper_streamVG_mean

Independence factors the mean of the actual selected cell product. Given the specified input n, the specified input d, the specified input hn, the specified input P, the specified input x, the specified input a, the specified input s, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
hn :
0 < n
P :
x :
Fin d
a s :
(∫ streams, streamCellCorrection n d streams x a s ∂fourStreamLaw n P)
= missingCellMass P x a s * (∫ streams, streamG n d streams x a s ∂fourStreamLaw n P)
Proof (Lean source)
-- @node: upper_streamVG_mean lemma upper_streamVG_mean {n d : ℕ} (hn : 0 < n) (P : FullLaw d) (x : Fin d) (a s : Bool) : (∫ streams, streamCellCorrection n d streams x a s ∂fourStreamLaw n P) = missingCellMass P x a s * (∫ streams, streamG n d streams x a s ∂fourStreamLaw n P) := by unfold streamCellCorrection rw [ (upper_streamV_indep_streamG (n := n) P x a s).integral_fun_mul_eq_mul_integral (upper_streamV_memLp_two (n := n) P x a s).aestronglyMeasurable (upper_measurable_streamG (n := n) x a s).aestronglyMeasurable, upper_stream_v_mean hn P x a s]
CausalSmith.Stat.MarNearcompleteFrontier.upper_streamVG_mean · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamRawMean.lean:64
theorem upper_fourStreamRawEstimate_memLp_two

The finite sum defining the unprojected estimator is square integrable. Given the specified input n, the specified input d, the specified input hn, the specified input P, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
hn :
0 < n
P :
Proof (Lean source)
-- @node: upper_fourStreamRawEstimate_memLp_two lemma upper_fourStreamRawEstimate_memLp_two {n d : ℕ} (hn : 0 < n) (P : FullLaw d) : MemLp (fourStreamRawEstimate n d) 2 (fourStreamLaw n P) := by have hsum : MemLp (fun streams => ∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, treatmentSign a * streamCellCorrection n d streams x a s) 2 (fourStreamLaw n P) := by apply memLp_finsetSum intro x hx apply memLp_finsetSum intro a ha apply memLp_finsetSum intro s hs exact (upper_streamVG_memLp_two hn P x a s).const_mul (treatmentSign a) convert (upper_streamLinear_memLp_two (n := n) P).add (hsum.const_mul 2) using 1 ext streams exact upper_fourStreamRawEstimate_eq_linear_add streams
CausalSmith.Stat.MarNearcompleteFrontier.upper_fourStreamRawEstimate_memLp_two · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamRawMean.lean:78
theorem upper_fourStreamRawEstimate_bias_eq

The exact raw-estimator bias is the signed aggregate selected-correction bias; identification cancels the first-stream arrived component. Given the specified input n, the specified input d, the specified input q, the specified input hn, the specified input P, the specified input h, the stated mathematical conclusion holds. Given the specified input hq.

Formal statement
n d :
ℕ
q :
ℝ
hn :
0 < n
P :
h :
LawClass d q P
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
(∫ streams, fourStreamRawEstimate n d streams ∂fourStreamLaw n P) - tau P
= 2 * (∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, treatmentSign a * missingCellMass P x a s * ((∫ streams, streamG n d streams x a s ∂fourStreamLaw n P) - cellEta P x a s))
Proof (Lean source)
-- @node: upper_fourStreamRawEstimate_bias_eq lemma upper_fourStreamRawEstimate_bias_eq {n d : ℕ} {q : ℝ} (hn : 0 < n) (P : FullLaw d) (h : LawClass d q P) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) : (∫ streams, fourStreamRawEstimate n d streams ∂fourStreamLaw n P) - tau P = 2 * (∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, treatmentSign a * missingCellMass P x a s * ((∫ streams, streamG n d streams x a s ∂fourStreamLaw n P) - cellEta P x a s)) := by let := upper_fourStreamLaw_isProbabilityMeasure (n := n) P have hi (x : Fin d) (a s : Bool) : Integrable (fun streams => treatmentSign a * streamCellCorrection n d streams x a s) (fourStreamLaw n P) := ((upper_streamVG_memLp_two hn P x a s).integrable (by norm_num)).const_mul _ have hs : Integrable (fun streams => ∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, treatmentSign a * streamCellCorrection n d streams x a s) (fourStreamLaw n P) := integrable_finsetSum _ (fun x _ => integrable_finsetSum _ (fun a _ => integrable_finsetSum _ (fun s _ => hi x a s))) simp_rw [upper_fourStreamRawEstimate_eq_linear_add] rw [integral_add ((upper_streamLinear_memLp_two (n := n) P).integrable (by norm_num)) (hs.const_mul 2), integral_const_mul] rw [integral_finsetSum _ (fun x _ => integrable_finsetSum _ (fun a _ => integrable_finsetSum _ (fun s _ => hi x a s)))] simp_rw [integral_finsetSum _ (fun a _ => integrable_finsetSum _ (fun s _ => hi _ a s)), integral_finsetSum _ (fun s _ => hi _ _ s), integral_const_mul, upper_streamVG_mean hn P] rw [upper_streamLinear_mean_eq_arrived hn P, tau_eq_arrived_missing_cells P h hq] simp only [mul_add, mul_sub, Finset.sum_add_distrib, Finset.sum_sub_distrib, mul_assoc] ring
CausalSmith.Stat.MarNearcompleteFrontier.upper_fourStreamRawEstimate_bias_eq · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamRawMean.lean:96
theorem upper_fourStreamRawEstimate_bias_le

The raw-estimator bias inherits equation (14), with no extra regularity premises or independence gates. Given the specified input n, the specified input d, the specified input q, the specified input hn, the specified input hL, the specified input P, the specified input h, the stated mathematical conclusion holds. Given the specified input hq.

Formal statement
n d :
ℕ
q :
ℝ
hn :
0 < n
hL :
128 ≤ ell n
P :
h :
LawClass d q P
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
|(∫ streams, fourStreamRawEstimate n d streams ∂fourStreamLaw n P) - tau P|
≤ 268435456 * (delta q * (d : ℝ) / ((n : ℝ) * ell n))
+ 4 * delta q * exp (-16 * ell n)
Proof (Lean source)
-- @node: upper_fourStreamRawEstimate_bias_le lemma upper_fourStreamRawEstimate_bias_le {n d : ℕ} {q : ℝ} (hn : 0 < n) (hL : 128 ≤ ell n) (P : FullLaw d) (h : LawClass d q P) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) : |(∫ streams, fourStreamRawEstimate n d streams ∂fourStreamLaw n P) - tau P| ≤ 268435456 * (delta q * (d : ℝ) / ((n : ℝ) * ell n)) + 4 * delta q * exp (-16 * ell n) := by rw [upper_fourStreamRawEstimate_bias_eq hn P h hq] exact upper_stream_pilot_bias_sum_rate hn hL P h hq
CausalSmith.Stat.MarNearcompleteFrontier.upper_fourStreamRawEstimate_bias_le · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamRawMean.lean:127
CausalSmith.Stat.STAT_MarNearcompleteFrontier_Research.Helpers.UpperRisk.StreamRiskAssembly 9 declarations Bias, projection, capping and averaging reduce the nonfallback upper bound to one remaining quantity: the variance of the aggregate signed cell correction.

Squared-risk assembly for the four-stream estimator

Bias, projection, capping and averaging reduce the nonfallback upper bound to one remaining quantity: the variance of the aggregate signed cell correction. The aggregate is retained explicitly until cross-cell independence is proved.

theorem upper_fourStreamRawEstimate_risk_eq

The uncapped estimator's squared risk is its variance plus squared bias. Given the specified input n, the specified input d, the specified input hn, the specified input P, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
hn :
0 < n
P :
(∫ streams, (fourStreamRawEstimate n d streams - tau P) ^ 2 ∂fourStreamLaw n P)
+ ((∫ streams, fourStreamRawEstimate n d streams ∂fourStreamLaw n P) - tau P) ^ 2
Proof (Lean source)
-- @node: upper_fourStreamRawEstimate_risk_eq lemma upper_fourStreamRawEstimate_risk_eq {n d : ℕ} (hn : 0 < n) (P : FullLaw d) : (∫ streams, (fourStreamRawEstimate n d streams - tau P) ^ 2 ∂fourStreamLaw n P) = variance (fourStreamRawEstimate n d) (fourStreamLaw n P) + ((∫ streams, fourStreamRawEstimate n d streams ∂fourStreamLaw n P) - tau P) ^ 2 := by let := upper_fourStreamLaw_isProbabilityMeasure (n := n) P have hX := upper_fourStreamRawEstimate_memLp_two hn P have hshift := hX.sub (memLp_const (tau P)) have hv := variance_eq_sub hshift change variance (fun streams => fourStreamRawEstimate n d streams - tau P) (fourStreamLaw n P) = (∫ streams, (fourStreamRawEstimate n d streams - tau P) ^ 2 ∂fourStreamLaw n P) - (∫ streams, fourStreamRawEstimate n d streams - tau P ∂fourStreamLaw n P) ^ 2 at hv rw [variance_sub_const hX.aestronglyMeasurable] at hv rw [integral_sub (hX.integrable (by norm_num)) (integrable_const _), integral_const] at hv simpa only [Pi.pow_apply, probReal_univ, one_smul] using (eq_add_of_sub_eq hv.symm)
CausalSmith.Stat.MarNearcompleteFrontier.upper_fourStreamRawEstimate_risk_eq · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamRiskAssembly.lean:21
theorem upper_fourStreamEstimate_risk_le_raw

Projection cannot increase squared risk, since the target is in the projection interval and the raw estimator has a finite second moment. Given the specified input n, the specified input d, the specified input hn, the specified input P, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
hn :
0 < n
P :
(∫ streams, (fourStreamEstimate n d streams - tau P) ^ 2 ∂fourStreamLaw n P)
≤ (∫ streams, (fourStreamRawEstimate n d streams - tau P) ^ 2 ∂fourStreamLaw n P)
Proof (Lean source)
-- @node: upper_fourStreamEstimate_risk_le_raw lemma upper_fourStreamEstimate_risk_le_raw {n d : ℕ} (hn : 0 < n) (P : FullLaw d) : (∫ streams, (fourStreamEstimate n d streams - tau P) ^ 2 ∂fourStreamLaw n P) ≤ (∫ streams, (fourStreamRawEstimate n d streams - tau P) ^ 2 ∂fourStreamLaw n P) := by let := upper_fourStreamLaw_isProbabilityMeasure (n := n) P have hraw := (upper_fourStreamRawEstimate_memLp_two hn P).sub (memLp_const (tau P)) have hi := (memLp_two_iff_integrable_sq hraw.aestronglyMeasurable).mp hraw have hpoint (streams) : (fourStreamEstimate n d streams - tau P) ^ 2 ≤ (fourStreamRawEstimate n d streams - tau P) ^ 2 := by have hc := clipUnit_contracts (fourStreamRawEstimate n d streams) (tau P) (tau_range P) change |fourStreamEstimate n d streams - tau P| ≤ |fourStreamRawEstimate n d streams - tau P| at hc simpa only [sq_abs] using pow_le_pow_left₀ (abs_nonneg _) hc 2 apply integral_mono_of_nonneg · exact Filter.Eventually.of_forall (fun _ => sq_nonneg _) · exact hi · exact Filter.Eventually.of_forall hpoint
CausalSmith.Stat.MarNearcompleteFrontier.upper_fourStreamEstimate_risk_le_raw · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamRiskAssembly.lean:40
theorem upper_nonfallback_rate_eq

Below the dimension fallback threshold the rate has the untruncated squared-bias scale used in equations (19)--(20). Given the specified input n, the specified input d, the specified input hn, the specified input hL, the specified input q, the specified input d, the specified input n, the stated mathematical conclusion holds. Given the specified input hd.

Formal statement
n d :
ℕ
hn :
0 < n
hL :
128 ≤ ell n
q :
ℝ
hd :
(d : ℝ) < (n : ℝ) * ell n
rate n d q = 1 / (n : ℝ) + (delta q * (d : ℝ) / ((n : ℝ) * ell n)) ^ 2
Proof (Lean source)
-- @node: upper_nonfallback_rate_eq lemma upper_nonfallback_rate_eq {n d : ℕ} (hn : 0 < n) (hL : 128 ≤ ell n) (q : ℝ) (hd : (d : ℝ) < (n : ℝ) * ell n) : rate n d q = 1 / (n : ℝ) + (delta q * (d : ℝ) / ((n : ℝ) * ell n)) ^ 2 := by have hden : 0 < (n : ℝ) * ell n := mul_pos (by positivity) (by linarith) have hr : (d : ℝ) / ((n : ℝ) * ell n) ≤ 1 := (div_le_one hden).mpr hd.le simp only [rate, gScale, min_eq_right hr, mul_div_assoc]
CausalSmith.Stat.MarNearcompleteFrontier.upper_nonfallback_rate_eq · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamRiskAssembly.lean:60
theorem upper_pilot_bias_remainder_sq_le Lemma upper_pilot_bias_remainder_sq_le in the paper ↗

The exponentially small pilot-bias remainder has a squared inverse-sample-size budget. Given the specified input n, the specified input q, the specified input hn, the specified input hL, the stated mathematical conclusion holds. Given the specified input hq.

Formal statement
n :
ℕ
q :
ℝ
hn :
0 < n
hL :
128 ≤ ell n
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
(4 * delta q * exp (-16 * ell n)) ^ 2 ≤ 4 / (n : ℝ)
Proof (Lean source)
-- @node: upper_pilot_bias_remainder_sq_le lemma upper_pilot_bias_remainder_sq_le {n : ℕ} {q : ℝ} (hn : 0 < n) (hL : 128 ≤ ell n) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) : (4 * delta q * exp (-16 * ell n)) ^ 2 ≤ 4 / (n : ℝ) := by have hδ : 0 ≤ delta q ∧ delta q ≤ 1 / 2 := by unfold delta constructor <;> linarith [hq.1, hq.2] have he : (exp (-16 * ell n)) ^ 2 = exp (-32 * ell n) := by rw [← Real.exp_nat_mul] congr 1 ring have ht : exp (-32 * ell n) ≤ exp (-ell n) := Real.exp_le_exp.mpr (by linarith) have hnR : 0 < (n : ℝ) := by positivity have ht' : exp (-ell n) ≤ 1 / (n : ℝ) := by rw [Real.exp_neg, ell, Real.exp_log (by positivity)] simpa only [one_div] using inv_anti₀ hnR (le_add_of_nonneg_left (Real.exp_pos 1).le) calc _ = 16 * (delta q) ^ 2 * exp (-32 * ell n) := by rw [← he]; ring _ ≤ 4 * exp (-32 * ell n) := by have hs : (delta q) ^ 2 ≤ (1 / 2 : ℝ) ^ 2 := pow_le_pow_left₀ hδ.1 hδ.2 2 nlinarith [Real.exp_pos (-32 * ell n)] _ ≤ 4 * (1 / (n : ℝ)) := mul_le_mul_of_nonneg_left (ht.trans ht') (by norm_num) _ = _ := by ring
CausalSmith.Stat.MarNearcompleteFrontier.upper_pilot_bias_remainder_sq_le · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamRiskAssembly.lean:72
theorem upper_fourStreamRawEstimate_bias_sq_rate

The raw estimator's squared bias has the claimed nonfallback rate, using the established pilot-bias bound and its exponential remainder. Given the specified input n, the specified input d, the specified input q, the specified input hn, the specified input hL, the specified input d, the specified input n, the specified input P, the specified input h, the stated mathematical conclusion holds. Given the specified input hd, the specified input hq.

Formal statement
n d :
ℕ
q :
ℝ
hn :
0 < n
hL :
128 ≤ ell n
hd :
(d : ℝ) < (n : ℝ) * ell n
P :
h :
LawClass d q P
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
((∫ streams, fourStreamRawEstimate n d streams ∂fourStreamLaw n P) - tau P) ^ 2
≤ (2 * (268435456 : ℝ) ^ 2 + 8) * rate n d q
Proof (Lean source)
-- @node: upper_fourStreamRawEstimate_bias_sq_rate lemma upper_fourStreamRawEstimate_bias_sq_rate {n d : ℕ} {q : ℝ} (hn : 0 < n) (hL : 128 ≤ ell n) (hd : (d : ℝ) < (n : ℝ) * ell n) (P : FullLaw d) (h : LawClass d q P) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) : ((∫ streams, fourStreamRawEstimate n d streams ∂fourStreamLaw n P) - tau P) ^ 2 ≤ (2 * (268435456 : ℝ) ^ 2 + 8) * rate n d q := by let x := delta q * (d : ℝ) / ((n : ℝ) * ell n) let b := 4 * delta q * exp (-16 * ell n) have hx : 0 ≤ x := by have hδ : 0 ≤ delta q := by unfold delta; linarith [hq.2] dsimp [x] positivity have hb : 0 ≤ b := by have hδ : 0 ≤ delta q := by unfold delta; linarith [hq.2] dsimp [b] positivity have hbound := upper_fourStreamRawEstimate_bias_le hn hL P h hq have hsq := pow_le_pow_left₀ (abs_nonneg _) hbound 2 have hrem : b ^ 2 ≤ 4 / (n : ℝ) := upper_pilot_bias_remainder_sq_le hn hL hq rw [upper_nonfallback_rate_eq hn hL q hd] change _ ≤ (2 * (268435456 : ℝ) ^ 2 + 8) * (1 / (n : ℝ) + x ^ 2) change _ ≤ (268435456 * x + b) ^ 2 at hsq rw [sq_abs] at hsq have hrem' : b ^ 2 ≤ 4 * (1 / (n : ℝ)) := by simpa only [div_eq_mul_inv, one_mul] using hrem nlinarith only [hsq, hrem', sq_nonneg (268435456 * x - b), sq_nonneg x, (show 0 ≤ 1 / (n : ℝ) by positivity)]
CausalSmith.Stat.MarNearcompleteFrontier.upper_fourStreamRawEstimate_bias_sq_rate · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamRiskAssembly.lean:100
theorem upper_streamCorrectionSum_memLp_two

The aggregate signed correction is square integrable by the finite sum of the already established cell product moments. Given the specified input n, the specified input d, the specified input hn, the specified input P, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
hn :
0 < n
P :
MemLp (fun streams => ∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, treatmentSign a * streamCellCorrection n d streams x a s) 2 (fourStreamLaw n P)
Proof (Lean source)
-- @node: upper_streamCorrectionSum_memLp_two lemma upper_streamCorrectionSum_memLp_two {n d : ℕ} (hn : 0 < n) (P : FullLaw d) : MemLp (fun streams => ∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, treatmentSign a * streamCellCorrection n d streams x a s) 2 (fourStreamLaw n P) := by apply memLp_finsetSum intro x hx apply memLp_finsetSum intro a ha apply memLp_finsetSum intro s hs exact (upper_streamVG_memLp_two hn P x a s).const_mul (treatmentSign a)
CausalSmith.Stat.MarNearcompleteFrontier.upper_streamCorrectionSum_memLp_two · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamRiskAssembly.lean:130
theorem upper_fourStreamRawEstimate_variance_le_aggregate

The raw estimator variance is controlled by the first stream and the aggregate correction; this step does not require independence between them. Given the specified input n, the specified input d, the specified input hn, the specified input P, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
hn :
0 < n
P :
≤ 64 / (n : ℝ)
+ 8 * variance (fun streams => ∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, treatmentSign a * streamCellCorrection n d streams x a s) (fourStreamLaw n P)
Proof (Lean source)
-- @node: upper_fourStreamRawEstimate_variance_le_aggregate lemma upper_fourStreamRawEstimate_variance_le_aggregate {n d : ℕ} (hn : 0 < n) (P : FullLaw d) : variance (fourStreamRawEstimate n d) (fourStreamLaw n P) ≤ 64 / (n : ℝ) + 8 * variance (fun streams => ∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, treatmentSign a * streamCellCorrection n d streams x a s) (fourStreamLaw n P) := by let := upper_fourStreamLaw_isProbabilityMeasure (n := n) P have hsum := upper_streamCorrectionSum_memLp_two hn P have heq : fourStreamRawEstimate n d = fun streams => upper_streamLinear n d streams + 2 * (∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, treatmentSign a * streamCellCorrection n d streams x a s) := by ext streams exact upper_fourStreamRawEstimate_eq_linear_add streams rw [heq] have hv := upper_variance_add_le_twice (upper_streamLinear_memLp_two (n := n) P) (hsum.const_mul 2) simp only [variance_const_mul] at hv have hl := upper_streamLinear_variance_le hn P simp only [div_eq_mul_inv] at hl ⊢ norm_num only at hv linarith
CausalSmith.Stat.MarNearcompleteFrontier.upper_fourStreamRawEstimate_variance_le_aggregate · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamRiskAssembly.lean:145
theorem upper_fourStreamEstimate_risk_le_aggregate

In the nonfallback regime, projection and the proved bias and linear variance budgets leave only the aggregate correction variance to control. Given the specified input n, the specified input d, the specified input q, the specified input hn, the specified input hL, the specified input d, the specified input n, the specified input P, the specified input h, the stated mathematical conclusion holds. Given the specified input hd, the specified input hq.

Formal statement
n d :
ℕ
q :
ℝ
hn :
0 < n
hL :
128 ≤ ell n
hd :
(d : ℝ) < (n : ℝ) * ell n
P :
h :
LawClass d q P
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
(∫ streams, (fourStreamEstimate n d streams - tau P) ^ 2 ∂fourStreamLaw n P)
≤ 8 * variance (fun streams => ∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, treatmentSign a * streamCellCorrection n d streams x a s) (fourStreamLaw n P)
+ (2 * (268435456 : ℝ) ^ 2 + 72) * rate n d q
Proof (Lean source)
-- @node: upper_fourStreamEstimate_risk_le_aggregate lemma upper_fourStreamEstimate_risk_le_aggregate {n d : ℕ} {q : ℝ} (hn : 0 < n) (hL : 128 ≤ ell n) (hd : (d : ℝ) < (n : ℝ) * ell n) (P : FullLaw d) (h : LawClass d q P) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) : (∫ streams, (fourStreamEstimate n d streams - tau P) ^ 2 ∂fourStreamLaw n P) ≤ 8 * variance (fun streams => ∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, treatmentSign a * streamCellCorrection n d streams x a s) (fourStreamLaw n P) + (2 * (268435456 : ℝ) ^ 2 + 72) * rate n d q := by have hp := upper_fourStreamEstimate_risk_le_raw hn P rw [upper_fourStreamRawEstimate_risk_eq hn P] at hp have hv := upper_fourStreamRawEstimate_variance_le_aggregate hn P have hb := upper_fourStreamRawEstimate_bias_sq_rate hn hL hd P h hq have hr : 1 / (n : ℝ) ≤ rate n d q := by exact le_add_of_nonneg_right (sq_nonneg (gScale n d q)) have hr' : 64 / (n : ℝ) ≤ 64 * rate n d q := by simpa only [div_eq_mul_inv, one_mul] using mul_le_mul_of_nonneg_left hr (by norm_num : (0 : ℝ) ≤ 64) linarith
CausalSmith.Stat.MarNearcompleteFrontier.upper_fourStreamEstimate_risk_le_aggregate · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamRiskAssembly.lean:171
theorem upper_nonfallback_risk_le_aggregate

Capping and averaging preserve the risk reduction to aggregate correction variance, paying only the already proved inverse-sample-size cap penalty. Given the specified input n, the specified input d, the specified input q, the specified input hn, the specified input P, the specified input h, the specified input hqne, the specified input d, the specified input n, the stated mathematical conclusion holds. Given the specified input hq, the specified input hreg.

Formal statement
n d :
ℕ
q :
ℝ
hn :
0 < n
P :
h :
LawClass d q P
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
hqne :
q ≠ 1
hreg :
¬(ell n < 128 ∨ (d : ℝ) ≥ (n : ℝ) * ell n)
(∫ sample, (tauhatMM n d q sample - tau P) ^ 2 ∂samplePi P n)
≤ 8 * variance (fun streams => ∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, treatmentSign a * streamCellCorrection n d streams x a s) (fourStreamLaw n P)
+ (2 * (268435456 : ℝ) ^ 2 + 104) * rate n d q
Proof (Lean source)
-- @node: upper_nonfallback_risk_le_aggregate lemma upper_nonfallback_risk_le_aggregate {n d : ℕ} {q : ℝ} (hn : 0 < n) (P : FullLaw d) (h : LawClass d q P) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (hqne : q ≠ 1) (hreg : ¬(ell n < 128 ∨ (d : ℝ) ≥ (n : ℝ) * ell n)) : (∫ sample, (tauhatMM n d q sample - tau P) ^ 2 ∂samplePi P n) ≤ 8 * variance (fun streams => ∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, treatmentSign a * streamCellCorrection n d streams x a s) (fourStreamLaw n P) + (2 * (268435456 : ℝ) ^ 2 + 104) * rate n d q := by have hL : 128 ≤ ell n := le_of_not_gt (fun hh => hreg (inl hh)) have hd : (d : ℝ) < (n : ℝ) * ell n := lt_of_not_ge (fun hh => hreg (inr hh)) have hc := upper_nonfallback_risk_le_ideal_add_rate hn q P hqne hreg have hi := upper_fourStreamEstimate_risk_le_aggregate hn hL hd P h hq have hr : 1 / (n : ℝ) ≤ rate n d q := le_add_of_nonneg_right (sq_nonneg (gScale n d q)) have hr' : 32 / (n : ℝ) ≤ 32 * rate n d q := by simpa only [div_eq_mul_inv, one_mul] using mul_le_mul_of_nonneg_left hr (by norm_num : (0 : ℝ) ≤ 32) linarith
CausalSmith.Stat.MarNearcompleteFrontier.upper_nonfallback_risk_le_aggregate · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamRiskAssembly.lean:193
CausalSmith.Stat.STAT_MarNearcompleteFrontier_Research.Helpers.UpperRisk.StreamRiskVariance 5 declarations The heavy product and pilot-selected remainder decomposition combines equation (16) with equations (17)--(19), without assuming independence of the branches.

Variance budget for the selected cell correction

The heavy product and pilot-selected remainder decomposition combines equation (16) with equations (17)--(19), without assuming independence of the branches.

theorem upper_variance_add_le_twice Lemma upper_variance_add_le_twice in the paper ↗

The variance of a sum is at most twice the sum of its variances, even when the two square-integrable terms are dependent. Given the specified input X, the specified input Y, the specified input hX, the specified input hY, the stated mathematical conclusion holds. Given the specified input Ω, the specified input μ.

Formal statement
Ω :
X Y :
Ω → ℝ
hX :
MemLp X 2 μ
hY :
MemLp Y 2 μ
variance (fun ω => X ω + Y ω) μ ≤ 2 * variance X μ + 2 * variance Y μ
Proof (Lean source)
-- @node: upper_variance_add_le_twice lemma upper_variance_add_le_twice {Ω : Type*} [MeasurableSpace Ω] {μ : Measure Ω} [IsProbabilityMeasure μ] {X Y : Ω → ℝ} (hX : MemLp X 2 μ) (hY : MemLp Y 2 μ) : variance (fun ω => X ω + Y ω) μ ≤ 2 * variance X μ + 2 * variance Y μ := by have hp := variance_fun_add hX hY have hm := variance_fun_sub hX hY have hn := variance_nonneg (X := fun ω => X ω - Y ω) (μ := μ) linarith
CausalSmith.Stat.MarNearcompleteFrontier.upper_variance_add_le_twice · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamRiskVariance.lean:18
theorem upper_streamVG_sub_VD_memLp_two

The pilot-selected remainder is square integrable by the previously proved product-square domination. Given the specified input n, the specified input d, the specified input hn, the specified input P, the specified input x, the specified input a, the specified input s, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
hn :
0 < n
P :
x :
Fin d
a s :
MemLp (fun streams => streamV n d streams x a s * (streamG n d streams x a s - streamD d streams x a s)) 2 (fourStreamLaw n P)
Proof (Lean source)
-- @node: upper_streamVG_sub_VD_memLp_two lemma upper_streamVG_sub_VD_memLp_two {n d : ℕ} (hn : 0 < n) (P : FullLaw d) (x : Fin d) (a s : Bool) : MemLp (fun streams => streamV n d streams x a s * (streamG n d streams x a s - streamD d streams x a s)) 2 (fourStreamLaw n P) := by have hv := (upper_streamV_memLp_two (n := n) P x a s).aestronglyMeasurable have hg := (upper_measurable_streamG (n := n) x a s).aestronglyMeasurable (μ := fourStreamLaw n P) have hd := (upper_measurable_streamD x a s).aestronglyMeasurable (μ := fourStreamLaw n P) exact (memLp_two_iff_integrable_sq (hv.mul (hg.sub hd))).mpr (upper_streamVG_sub_VD_sq_integrable hn P x a s)
CausalSmith.Stat.MarNearcompleteFrontier.upper_streamVG_sub_VD_memLp_two · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamRiskVariance.lean:30
theorem upper_streamVG_memLp_two

The full selected missing-membership correction is square integrable, since it is the sum of the heavy product and selected remainder. Given the specified input n, the specified input d, the specified input hn, the specified input P, the specified input x, the specified input a, the specified input s, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
hn :
0 < n
P :
x :
Fin d
a s :
MemLp (fun streams => streamV n d streams x a s * streamG n d streams x a s) 2 (fourStreamLaw n P)
Proof (Lean source)
-- @node: upper_streamVG_memLp_two lemma upper_streamVG_memLp_two {n d : ℕ} (hn : 0 < n) (P : FullLaw d) (x : Fin d) (a s : Bool) : MemLp (fun streams => streamV n d streams x a s * streamG n d streams x a s) 2 (fourStreamLaw n P) := by convert (upper_streamVD_memLp_two (n := n) P x a s).add (upper_streamVG_sub_VD_memLp_two hn P x a s) using 1 ext streams simp only [Pi.add_apply] ring
CausalSmith.Stat.MarNearcompleteFrontier.upper_streamVG_memLp_two · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamRiskVariance.lean:45
theorem upper_streamVG_variance_le

Splitting off the heavy branch bounds the selected cell variance by twice the heavy variance plus twice the selected remainder's second moment. Given the specified input n, the specified input d, the specified input hn, the specified input P, the specified input x, the specified input a, the specified input s, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
hn :
0 < n
P :
x :
Fin d
a s :
variance (fun streams => streamV n d streams x a s * streamG n d streams x a s) (fourStreamLaw n P)
≤ 2 * variance (fun streams => streamV n d streams x a s * streamD d streams x a s) (fourStreamLaw n P)
+ 2 * (∫ streams, (streamV n d streams x a s * (streamG n d streams x a s - streamD d streams x a s)) ^ 2 ∂fourStreamLaw n P)
Proof (Lean source)
-- @node: upper_streamVG_variance_le lemma upper_streamVG_variance_le {n d : ℕ} (hn : 0 < n) (P : FullLaw d) (x : Fin d) (a s : Bool) : variance (fun streams => streamV n d streams x a s * streamG n d streams x a s) (fourStreamLaw n P) ≤ 2 * variance (fun streams => streamV n d streams x a s * streamD d streams x a s) (fourStreamLaw n P) + 2 * (∫ streams, (streamV n d streams x a s * (streamG n d streams x a s - streamD d streams x a s)) ^ 2 ∂fourStreamLaw n P) := by let := upper_fourStreamLaw_isProbabilityMeasure (n := n) P have hd := upper_streamVD_memLp_two (n := n) P x a s have hr := upper_streamVG_sub_VD_memLp_two hn P x a s have hsplit : (fun streams => streamV n d streams x a s * streamG n d streams x a s) = (fun streams => streamV n d streams x a s * streamD d streams x a s + streamV n d streams x a s * (streamG n d streams x a s - streamD d streams x a s)) := by ext streams ring rw [hsplit] exact (upper_variance_add_le_twice hd hr).trans (add_le_add_right (mul_le_mul_of_nonneg_left (variance_le_expectation_sq hr.aestronglyMeasurable) (by norm_num : (0 : ℝ) ≤ 2)) _)
CausalSmith.Stat.MarNearcompleteFrontier.upper_streamVG_variance_le · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamRiskVariance.lean:58
theorem upper_streamVG_variance_sum_rate

The sum of selected cell variances has the squared-bias scale and a universal inverse-sample-size budget obtained from equations (16)--(19). Given the specified input n, the specified input d, the specified input q, the specified input hn, the specified input hL, the specified input P, the specified input h, the stated mathematical conclusion holds. Given the specified input hq.

Formal statement
n d :
ℕ
q :
ℝ
hn :
0 < n
hL :
128 ≤ ell n
P :
h :
LawClass d q P
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
(∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, variance (fun streams => streamV n d streams x a s * streamG n d streams x a s) (fourStreamLaw n P))
≤ (delta q * (d : ℝ) / ((n : ℝ) * ell n)) ^ 2
+ ((201719808 : ℝ) ^ 2 * ((720 * (4 / 3 : ℝ) ^ 6) * (exp 1 + 1)) + 118) / (n : ℝ)
Proof (Lean source)
-- @node: upper_streamVG_variance_sum_rate lemma upper_streamVG_variance_sum_rate {n d : ℕ} {q : ℝ} (hn : 0 < n) (hL : 128 ≤ ell n) (P : FullLaw d) (h : LawClass d q P) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) : (∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, variance (fun streams => streamV n d streams x a s * streamG n d streams x a s) (fourStreamLaw n P)) ≤ (delta q * (d : ℝ) / ((n : ℝ) * ell n)) ^ 2 + ((201719808 : ℝ) ^ 2 * ((720 * (4 / 3 : ℝ) ^ 6) * (exp 1 + 1)) + 118) / (n : ℝ) := by calc _ ≤ ∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, (2 * variance (fun streams => streamV n d streams x a s * streamD d streams x a s) (fourStreamLaw n P) + 2 * (∫ streams, (streamV n d streams x a s * (streamG n d streams x a s - streamD d streams x a s)) ^ 2 ∂fourStreamLaw n P)) := by apply Finset.sum_le_sum intro x hx apply Finset.sum_le_sum intro a ha apply Finset.sum_le_sum intro s hs exact upper_streamVG_variance_le hn P x a s _ = 2 * (∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, variance (fun streams => streamV n d streams x a s * streamD d streams x a s) (fourStreamLaw n P)) + 2 * (∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, (∫ streams, (streamV n d streams x a s * (streamG n d streams x a s - streamD d streams x a s)) ^ 2 ∂fourStreamLaw n P)) := by simp only [Finset.sum_add_distrib, Finset.mul_sum] _ ≤ 2 * (34 / (n : ℝ)) + 2 * ((delta q * (d : ℝ) / ((n : ℝ) * ell n)) ^ 2 / 2 + ((201719808 : ℝ) ^ 2 * ((720 * (4 / 3 : ℝ) ^ 6) * (exp 1 + 1)) / 2 + 25) / (n : ℝ)) := add_le_add (mul_le_mul_of_nonneg_left (upper_streamVD_variance_sum_le hn P h hq) (by norm_num)) (mul_le_mul_of_nonneg_left (upper_stream_correction_second_moment_sum_rate hn hL P h hq) (by norm_num)) _ = _ := by ring
CausalSmith.Stat.MarNearcompleteFrontier.upper_streamVG_variance_sum_rate · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamRiskVariance.lean:83
CausalSmith.Stat.STAT_MarNearcompleteFrontier_Research.Helpers.UpperRisk.StreamStatistic 16 declarations This module identifies the run's explicit count-and-label formula with the finite-partition Rao--Blackwell API.

Four-stream form of the missing-membership estimator

This module identifies the run's explicit count-and-label formula with the finite-partition Rao--Blackwell API.

def finiteStreamCount

Count observations in a finite stream satisfying a condition.

Definition (Lean source)
d :
ℕ
s :
FiniteSample (Obs d)
E :
Obs d → Prop
finiteStreamCount s E :
ℝ
by classical exact ∑ i : Fin s.count, if E (s.2 i) then 1 else 0
def streamV

Missing-cell count from the second stream divided by its Poisson intensity.

Definition (Lean source)
n d :
ℕ
streams :
Fin 4 → FiniteSample (Obs d)
x :
Fin d
a s :
streamV n d streams x a s :
ℝ
finiteStreamCount (streams 1) (fun o ↦ inCell o x a s ∧ o.R = false) / ((n : ℝ) / 8)
def streamCpilot

Pilot arrived-cell count from the third stream.

Definition (Lean source)
d :
ℕ
streams :
Fin 4 → FiniteSample (Obs d)
x :
Fin d
a s :
streamCpilot d streams x a s :
ℝ
finiteStreamCount (streams 2) (fun o ↦ inCell o x a s ∧ o.R = true)
def streamC

Arrived-cell count from the fourth stream.

Definition (Lean source)
d :
ℕ
streams :
Fin 4 → FiniteSample (Obs d)
x :
Fin d
a s :
streamC d streams x a s :
ℝ
finiteStreamCount (streams 3) (fun o ↦ inCell o x a s ∧ o.R = true)
def streamU

Arrived-success count from the fourth stream.

Definition (Lean source)
d :
ℕ
streams :
Fin 4 → FiniteSample (Obs d)
x :
Fin d
a s :
streamU d streams x a s :
ℝ
finiteStreamCount (streams 3) (fun o ↦ inCell o x a s ∧ o.RY = true)
def streamH

Light-cell polynomial correction for a fourth-stream cell.

Definition (Lean source)
n d :
ℕ
streams :
Fin 4 → FiniteSample (Obs d)
x :
Fin d
a s :
streamH n d streams x a s :
ℝ
lightCorrection n (streamC d streams x a s) (streamU d streams x a s)
def streamD

Heavy-cell plug-in correction for a fourth-stream cell.

Definition (Lean source)
d :
ℕ
streams :
Fin 4 → FiniteSample (Obs d)
x :
Fin d
a s :
streamD d streams x a s :
ℝ
heavyCorrection (streamC d streams x a s) (streamU d streams x a s)
def streamG

Pilot-selected correction for one cell.

Definition (Lean source)
n d :
ℕ
streams :
Fin 4 → FiniteSample (Obs d)
x :
Fin d
a s :
streamG n d streams x a s :
ℝ
if streamCpilot d streams x a s
≤ polyThreshold n / 4 then streamH n d streams x a s else streamD d streams x a s
def streamCellCorrection

One cell's missing-membership correction written as a statistic of four streams.

Definition (Lean source)
n d :
ℕ
streams :
Fin 4 → FiniteSample (Obs d)
x :
Fin d
a s :
streamCellCorrection n d streams x a s :
ℝ
streamV n d streams x a s * streamG n d streams x a s
def fourStreamRawEstimate

The raw, unprojected missing-membership estimate of four streams.

Definition (Lean source)
n d :
ℕ
streams :
Fin 4 → FiniteSample (Obs d)
fourStreamRawEstimate n d streams :
ℝ
m :
(n : ℝ) / 8 (: ℝ)
2 / m * (∑ i : Fin (streams 0).count, (if ((streams 0).2 i).A then (1 : ℝ) else -1) * (if ((streams 0).2 i).R then (1 : ℝ) else 0) * ((if ((streams 0).2 i).RY then (1 : ℝ) else 0) - 1 / 2))
+ 2 * (∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, (if a then (1 : ℝ) else -1) * streamCellCorrection n d streams x a s)
CausalSmith.Stat.MarNearcompleteFrontier.fourStreamRawEstimate · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamStatistic.lean:72
def fourStreamEstimate

The projected missing-membership estimate as a statistic of four independent streams.

Definition (Lean source)
n d :
ℕ
streams :
Fin 4 → FiniteSample (Obs d)
fourStreamEstimate n d streams :
ℝ
def uniformFourMass

Uniform masses for the four auxiliary labels.

Definition (Lean source)
_ :
Fin 4
uniformFourMass _ :
ℝ≥0
1 / 4

the stated mathematical conclusion holds.

Formal statement
∑ i : Fin 4, uniformFourMass i = 1
Proof (Lean source)
lemma uniformFourMass_sum : ∑ i : Fin 4, uniformFourMass i = 1 := by norm_num [uniformFourMass]
theorem finiteStreamCount_labeledPrefix

Given the specified input n, the specified input d, the specified input N, the specified input sample, the specified input hN, the specified input labels, the specified input stream, the specified input E, the stated mathematical conclusion holds.

Formal statement
n d N :
ℕ
sample :
Fin n → Obs d
hN :
N ≤ n
labels :
Fin N → Fin 4
stream :
Fin 4
E :
Obs d → Prop
finiteStreamCount ((labeledPrefix sample N hN labels) stream) E
= streamCount sample hN labels stream E
Proof (Lean source)
lemma finiteStreamCount_labeledPrefix {n d N : ℕ} (sample : Fin n → Obs d) (hN : N ≤ n) (labels : Fin N → Fin 4) (stream : Fin 4) (E : Obs d → Prop) : finiteStreamCount ((labeledPrefix sample N hN labels) stream) E = streamCount sample hN labels stream E := by classical calc finiteStreamCount ((labeledPrefix sample N hN labels) stream) E = ∑ i : Fin N, if labels i = stream then (if E (sample ⟨i.val, lt_of_lt_of_le i.isLt hN⟩) then (1 : ℝ) else 0) else 0 := by simpa only [finiteStreamCount] using finiteStreamSum_labeledPrefix sample hN labels stream (fun o ↦ if E o then (1 : ℝ) else 0) _ = streamCount sample hN labels stream E := by unfold streamCount apply Finset.sum_congr rfl intro i _ by_cases hi : labels i = stream <;> simp [hi]
CausalSmith.Stat.MarNearcompleteFrontier.finiteStreamCount_labeledPrefix · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamStatistic.lean:125
theorem fourStreamEstimate_labeledPrefix

Given the specified input n, the specified input d, the specified input N, the specified input sample, the specified input hN, the specified input labels, the stated mathematical conclusion holds.

Formal statement
n d N :
ℕ
sample :
Fin n → Obs d
hN :
N ≤ n
labels :
Fin N → Fin 4
fourStreamEstimate n d (labeledPrefix sample N hN labels)
= randomizedEstimate sample hN labels
Proof (Lean source)
lemma fourStreamEstimate_labeledPrefix {n d N : ℕ} (sample : Fin n → Obs d) (hN : N ≤ n) (labels : Fin N → Fin 4) : fourStreamEstimate n d (labeledPrefix sample N hN labels) = randomizedEstimate sample hN labels := by classical have hmain := finiteStreamSum_labeledPrefix sample hN labels 0 (fun o ↦ (if o.A then (1 : ℝ) else -1) * (if o.R then (1 : ℝ) else 0) * ((if o.RY then (1 : ℝ) else 0) - 1 / 2)) unfold fourStreamEstimate fourStreamRawEstimate randomizedEstimate rw [hmain] unfold streamCellCorrection streamV streamG streamH streamD streamCpilot streamC streamU cellCorrection simp_rw [finiteStreamCount_labeledPrefix]
CausalSmith.Stat.MarNearcompleteFrontier.fourStreamEstimate_labeledPrefix · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamStatistic.lean:147
theorem tauhatMM_nonfallback_eq_fixedStatistic

Given the specified input n, the specified input d, the specified input q, the specified input sample, the specified input hq, the specified input d, the specified input n, the stated mathematical conclusion holds. Given the specified input hreg.

Formal statement
n d :
ℕ
q :
ℝ
sample :
Fin n → Obs d
hq :
q ≠ 1
hreg :
¬(ell n < 128 ∨ (d : ℝ) ≥ (n : ℝ) * ell n)
Proof (Lean source)
lemma tauhatMM_nonfallback_eq_fixedStatistic {n d : ℕ} (q : ℝ) (sample : Fin n → Obs d) (hq : q ≠ 1) (hreg : ¬(ell n < 128 ∨ (d : ℝ) ≥ (n : ℝ) * ell n)) : tauhatMM n d q sample = fixedStatistic uniformFourMass uniformFourMass_sum ((n : NNReal) / 2) sample (fourStreamEstimate n d) 0 := by rw [fixedStatistic_eq_finite_sum] simp [tauhatMM, hq, hreg, auxiliaryCountMass, conditionalStreamAverage, fourStreamEstimate_labeledPrefix, uniformFourMass, ProbabilityTheory.poissonMeasure_real_singleton] apply Finset.sum_congr rfl intro N _ congr 1 · ring · rw [Finset.sum_div] apply Finset.sum_congr rfl intro labels _ rw [div_eq_mul_inv] ring
CausalSmith.Stat.MarNearcompleteFrontier.tauhatMM_nonfallback_eq_fixedStatistic · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamStatistic.lean:165
CausalSmith.Stat.STAT_MarNearcompleteFrontier_Research.Helpers.UpperRisk.StreamSupport 3 declarations The observed outcome mark can be true only when the outcome arrived.

Support of the observed success count

The observed outcome mark can be true only when the outcome arrived. These helpers express that support condition for one observed record and for the fourth ideal Poisson stream.

def streamArrivedSuccessCount

Count arrived successes in one cell of the fourth stream.

Definition (Lean source)
d :
ℕ
streams :
Fin 4 → FiniteSample (Obs d)
x :
Fin d
a s :
streamArrivedSuccessCount d streams x a s :
ℝ
finiteStreamCount (streams 3) (fun o ↦ inCell o x a s ∧ o.R = true ∧ o.RY = true)
CausalSmith.Stat.MarNearcompleteFrontier.streamArrivedSuccessCount · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamSupport.lean:21
theorem observedLaw_RY_implies_R_ae

Under the observed-data law, a true recorded outcome mark almost surely implies that the outcome arrived. Given the specified input d, the specified input P, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
P :
∀ᵐ o ∂(observedLaw P).toMeasure, o.RY = true → o.R = true
Proof (Lean source)
lemma observedLaw_RY_implies_R_ae {d : ℕ} (P : FullLaw d) : ∀ᵐ o ∂(observedLaw P).toMeasure, o.RY = true → o.R = true := by let _ : MeasurableSpace (FullAtom d) := ⊤ unfold observedLaw rw [← PMF.toMeasure_map observe P.pmf (measurable_of_finite _)] rw [ae_map_iff (measurable_of_finite _).aemeasurable (by measurability)] exact Filter.Eventually.of_forall fun w hRY => by cases hR : w.R <;> simp [observe, hR] at hRY ⊢
CausalSmith.Stat.MarNearcompleteFrontier.observedLaw_RY_implies_R_ae · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamSupport.lean:29
theorem streamU_eq_arrivedSuccess_ae

Under the ideal four-stream law, the fourth-stream success count agrees almost surely with the count of successes whose outcomes arrived. Given the specified input n, the specified input d, the specified input P, the specified input x, the specified input a, the specified input s, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
P :
x :
Fin d
a s :
∀ᵐ streams ∂fourStreamLaw n P, streamU d streams x a s
= streamArrivedSuccessCount d streams x a s
Proof (Lean source)
lemma streamU_eq_arrivedSuccess_ae {n d : ℕ} (P : FullLaw d) (x : Fin d) (a s : Bool) : ∀ᵐ streams ∂fourStreamLaw n P, streamU d streams x a s = streamArrivedSuccessCount d streams x a s := by classical let rate : NNReal := (n : NNReal) / 2 * uniformFourMass 3 have hindependent : fourStreamLaw n P = Measure.pi (fun i : Fin 4 => finitePoissonSampleLaw (observedLaw P).toMeasure ((n : NNReal) / 2 * uniformFourMass i)) := by unfold fourStreamLaw exact labeledStreamLaw_eq_independent _ _ _ _ have hfourth : ∀ᵐ z ∂finitePoissonSampleLaw (observedLaw P).toMeasure rate, ∀ i : Fin z.count, (z.points i).RY = true → (z.points i).R = true := finitePoissonSample_RY_implies_R_ae P rate rw [hindependent] have hlift : ∀ᵐ streams ∂Measure.pi (fun i : Fin 4 => finitePoissonSampleLaw (observedLaw P).toMeasure ((n : NNReal) / 2 * uniformFourMass i)), ∀ j : Fin (streams 3).count, ((streams 3).points j).RY = true → ((streams 3).points j).R = true := by simpa [rate] using (measurePreserving_eval (μ := fun i : Fin 4 => finitePoissonSampleLaw (observedLaw P).toMeasure ((n : NNReal) / 2 * uniformFourMass i)) (3 : Fin 4)).quasiMeasurePreserving.ae hfourth filter_upwards [hlift] with streams hs generalize hsample : streams 3 = sample at hs ⊢ rcases sample with ⟨N, z⟩ unfold streamU streamArrivedSuccessCount finiteStreamCount rw [hsample] apply Finset.sum_congr rfl intro i hi simp only by_cases hcell : inCell (z i) x a s · by_cases hRY : (z i).RY = true · have hR : (z i).R = true := by simpa [FiniteSample.points] using hs i hRY simp [hcell, hRY, hR] · simp [hcell, hRY] · simp [hcell]
CausalSmith.Stat.MarNearcompleteFrontier.streamU_eq_arrivedSuccess_ae · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamSupport.lean:76
CausalSmith.Stat.STAT_MarNearcompleteFrontier_Research.Helpers.UpperRisk.StreamTransfer 7 declarations The actual nonfallback estimator is the finite-partition conditional average.

Capping and averaging the ideal four-stream estimator

The actual nonfallback estimator is the finite-partition conditional average. Conditional Jensen and the Poisson cap coupling transfer its squared risk from the projected ideal experiment, with a universal inverse-sample-size penalty.

theorem upper_finiteSample_measurableSingletonClass

Singleton finite samples are measurable, by checking each fixed-size slice. Given the specified input d, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
Proof (Lean source)
-- @node: upper_finiteSample_measurableSingletonClass lemma upper_finiteSample_measurableSingletonClass (d : ℕ) : MeasurableSingletonClass (FiniteSample (Obs d)) := by constructor intro z rw [MeasurableSpace.measurableSet_iInf] intro m change MeasurableSet ((Sigma.mk m) ⁻¹' {z}) exact Set.toFinite _ |>.measurableSet
CausalSmith.Stat.MarNearcompleteFrontier.upper_finiteSample_measurableSingletonClass · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamTransfer.lean:23
theorem upper_measurable_fourStreamEstimate Lemma upper_measurable_fourStreamEstimate in the paper ↗

For a sample size and a covariate dimension, the ideal four-stream estimate is measurable.

Formal statement
n d :
ℕ
Proof (Lean source)
-- @node: upper_measurable_fourStreamEstimate @[fun_prop] lemma upper_measurable_fourStreamEstimate (n d : ℕ) : Measurable (fourStreamEstimate n d) := by first | fun_prop | let := upper_finiteSample_measurableSingletonClass d exact measurable_of_countable _
CausalSmith.Stat.MarNearcompleteFrontier.upper_measurable_fourStreamEstimate · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamTransfer.lean:34
theorem upper_fourStreamEstimate_range

Projection confines every ideal estimate to the feasible target interval. Given the specified input n, the specified input d, the stated mathematical conclusion holds. Given the specified input streams.

Formal statement
n d :
ℕ
streams :
Fin 4 → FiniteSample (Obs d)
fourStreamEstimate n d streams ∈ Icc (-1) 1
Proof (Lean source)
-- @node: upper_fourStreamEstimate_range lemma upper_fourStreamEstimate_range {n d : ℕ} (streams : Fin 4 → FiniteSample (Obs d)) : fourStreamEstimate n d streams ∈ Icc (-1) 1 := by simp only [fourStreamEstimate, clipUnit, Set.mem_Icc] exact ⟨le_max_left _ _, max_le (by norm_num) (min_le_left _ _)⟩
CausalSmith.Stat.MarNearcompleteFrontier.upper_fourStreamEstimate_range · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamTransfer.lean:42
theorem upper_half_mean_cap_tail_exp Lemma upper_half_mean_cap_tail_exp in the paper ↗

Exponential Markov at tilt log two bounds the count-cap overflow for an auxiliary Poisson count of mean half the sample size. Given the specified input n, the stated mathematical conclusion holds.

Formal statement
n :
ℕ
(poissonMeasure ((n : NNReal) / 2)).real (Ioi n)
≤ exp (-(log 2 - 1 / 2) * (n : ℝ))
Proof (Lean source)
-- @node: upper_half_mean_cap_tail_exp lemma upper_half_mean_cap_tail_exp (n : ℕ) : (poissonMeasure ((n : NNReal) / 2)).real (Ioi n) ≤ exp (-(log 2 - 1 / 2) * (n : ℝ)) := by have hc := poisson_upper_tail_mul_exp_le ((n : NNReal) / 2) n (r := 1) (by norm_num) apply le_of_mul_le_mul_right _ (Real.exp_pos (-(n : ℝ) / 2)) calc _ ≤ exp (-log 2 * (n : ℝ)) := by simpa only [NNReal.coe_div, NNReal.coe_natCast, NNReal.coe_ofNat, one_mul, neg_one_mul, neg_div, show (1 + 1 : ℝ) = 2 by norm_num, Ioi] using hc _ = _ := by rw [← Real.exp_add] congr 1 ring
CausalSmith.Stat.MarNearcompleteFrontier.upper_half_mean_cap_tail_exp · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamTransfer.lean:50
theorem upper_half_mean_cap_tail_rate Lemma upper_half_mean_cap_tail_rate in the paper ↗

The exponential cap penalty is bounded by eight inverse observations. Given the specified input n, the specified input hn, the stated mathematical conclusion holds.

Formal statement
n :
ℕ
hn :
0 < n
(poissonMeasure ((n : NNReal) / 2)).real (Ioi n) ≤ 8 / (n : ℝ)
Proof (Lean source)
-- @node: upper_half_mean_cap_tail_rate lemma upper_half_mean_cap_tail_rate {n : ℕ} (hn : 0 < n) : (poissonMeasure ((n : NNReal) / 2)).real (Ioi n) ≤ 8 / (n : ℝ) := by have hnR : 0 < (n : ℝ) := by exact_mod_cast hn have hlog : (1 / 8 : ℝ) ≤ log 2 - 1 / 2 := by have := Real.log_two_gt_d9 linarith have hx : 0 < (n : ℝ) / 8 := by positivity have hxe : (n : ℝ) / 8 ≤ exp ((n : ℝ) / 8) := (le_add_of_nonneg_right zero_le_one).trans (Real.add_one_le_exp _) calc _ ≤ exp (-(log 2 - 1 / 2) * (n : ℝ)) := upper_half_mean_cap_tail_exp n _ ≤ exp (-((n : ℝ) / 8)) := by apply Real.exp_le_exp.mpr nlinarith _ ≤ ((n : ℝ) / 8)⁻¹ := by rw [Real.exp_neg] exact inv_anti₀ hx hxe _ = _ := by field_simp
CausalSmith.Stat.MarNearcompleteFrontier.upper_half_mean_cap_tail_rate · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamTransfer.lean:68
theorem upper_nonfallback_risk_le_ideal_add_tail

Conditional averaging and cap coupling bound the actual nonfallback risk by projected independent-stream risk plus four times the overflow tail. Given the specified input n, the specified input d, the specified input q, the specified input P, the specified input hq, the specified input d, the specified input n, the stated mathematical conclusion holds. Given the specified input hreg.

Formal statement
n d :
ℕ
q :
ℝ
P :
hq :
q ≠ 1
hreg :
¬(ell n < 128 ∨ (d : ℝ) ≥ (n : ℝ) * ell n)
(∫ sample, (tauhatMM n d q sample - tau P) ^ 2 ∂samplePi P n)
≤ (∫ streams, (fourStreamEstimate n d streams - tau P) ^ 2 ∂fourStreamLaw n P)
+ 4 * (poissonMeasure ((n : NNReal) / 2)).real (Ioi n)
Proof (Lean source)
-- @node: upper_nonfallback_risk_le_ideal_add_tail lemma upper_nonfallback_risk_le_ideal_add_tail {n d : ℕ} (q : ℝ) (P : FullLaw d) (hq : q ≠ 1) (hreg : ¬(ell n < 128 ∨ (d : ℝ) ≥ (n : ℝ) * ell n)) : (∫ sample, (tauhatMM n d q sample - tau P) ^ 2 ∂samplePi P n) ≤ (∫ streams, (fourStreamEstimate n d streams - tau P) ^ 2 ∂fourStreamLaw n P) + 4 * (poissonMeasure ((n : NNReal) / 2)).real (Ioi n) := by have ht := fixedRisk_le_independentRisk_add_tail (observedLaw P).toMeasure uniformFourMass uniformFourMass_sum ((n : NNReal) / 2) n (upper_measurable_fourStreamEstimate n d) (a := -1) (b := 1) (theta := tau P) (zOver := 0) (fun streams => upper_fourStreamEstimate_range streams) (tau_range P) (by norm_num) have hlaw : fourStreamLaw n P = Measure.pi (fun i : Fin 4 => finitePoissonSampleLaw (observedLaw P).toMeasure (((n : NNReal) / 2) * uniformFourMass i)) := by unfold fourStreamLaw exact labeledStreamLaw_eq_independent _ _ _ _ simp_rw [tauhatMM_nonfallback_eq_fixedStatistic q _ hq hreg] simpa only [sqRisk, fixedPoolLaw, samplePi, hlaw, show ((1 : ℝ) - -1) ^ 2 = 4 by norm_num] using ht
CausalSmith.Stat.MarNearcompleteFrontier.upper_nonfallback_risk_le_ideal_add_tail · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamTransfer.lean:90
theorem upper_nonfallback_risk_le_ideal_add_rate

The fully implemented nonfallback estimator pays at most a universal inverse-sample-size cost for its cap and auxiliary averaging. Given the specified input n, the specified input d, the specified input hn, the specified input q, the specified input P, the specified input hq, the specified input d, the specified input n, the stated mathematical conclusion holds. Given the specified input hreg.

Formal statement
n d :
ℕ
hn :
0 < n
q :
ℝ
P :
hq :
q ≠ 1
hreg :
¬(ell n < 128 ∨ (d : ℝ) ≥ (n : ℝ) * ell n)
(∫ sample, (tauhatMM n d q sample - tau P) ^ 2 ∂samplePi P n)
≤ (∫ streams, (fourStreamEstimate n d streams - tau P) ^ 2 ∂fourStreamLaw n P)
+ 32 / (n : ℝ)
Proof (Lean source)
-- @node: upper_nonfallback_risk_le_ideal_add_rate lemma upper_nonfallback_risk_le_ideal_add_rate {n d : ℕ} (hn : 0 < n) (q : ℝ) (P : FullLaw d) (hq : q ≠ 1) (hreg : ¬(ell n < 128 ∨ (d : ℝ) ≥ (n : ℝ) * ell n)) : (∫ sample, (tauhatMM n d q sample - tau P) ^ 2 ∂samplePi P n) ≤ (∫ streams, (fourStreamEstimate n d streams - tau P) ^ 2 ∂fourStreamLaw n P) + 32 / (n : ℝ) := by calc _ ≤ _ := upper_nonfallback_risk_le_ideal_add_tail q P hq hreg _ ≤ (∫ streams, (fourStreamEstimate n d streams - tau P) ^ 2 ∂fourStreamLaw n P) + 4 * (8 / (n : ℝ)) := add_le_add_right (mul_le_mul_of_nonneg_left (upper_half_mean_cap_tail_rate hn) (by norm_num : (0 : ℝ) ≤ 4)) _ _ = _ := by ring
CausalSmith.Stat.MarNearcompleteFrontier.upper_nonfallback_risk_le_ideal_add_rate · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamTransfer.lean:114
CausalSmith.Stat.STAT_MarNearcompleteFrontier_Research.Helpers.UpperRisk.StreamVariance 6 declarations This module isolates the self-normalized heavy correction variance needed in the paper's upper-risk aggregation.

Cellwise variance bounds for the four-stream correction

This module isolates the self-normalized heavy correction variance needed in the paper's upper-risk aggregation.

theorem upper_streamD_abs_le_half_ae

The heavy correction lies in the centered Bernoulli range almost surely. Given the specified input n, the specified input d, the specified input P, the specified input x, the specified input a, the specified input s, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
P :
x :
Fin d
a s :
∀ᵐ streams ∂fourStreamLaw n P, |streamD d streams x a s| ≤ (1 / 2 : ℝ)
Proof (Lean source)
lemma upper_streamD_abs_le_half_ae {n d : ℕ} (P : FullLaw d) (x : Fin d) (a s : Bool) : ∀ᵐ streams ∂fourStreamLaw n P, |streamD d streams x a s| ≤ (1 / 2 : ℝ) := by classical let A : Set (Obs d) := {o | inCell o x a s ∧ o.R = true ∧ o.RY = true} let B : Set (Obs d) := {o | inCell o x a s ∧ o.R = true} let frac : Set (Obs d) → Set (Obs d) → FiniteSample (Obs d) → ℝ := Causalean.Stat.FiniteRaoBlackwell.Poisson.FinitePartition.NestedEventRatioMean.successFraction have hAB : A ⊆ B := fun o ho => ⟨ho.1, ho.2.1⟩ filter_upwards [streamU_eq_arrivedSuccess_ae (n := n) P x a s] with streams hs unfold streamD rw [hs] have hcountA := finiteStreamCount_eq_ratioEventCount (streams 3) (fun o => inCell o x a s ∧ o.R = true ∧ o.RY = true) have hcountB := finiteStreamCount_eq_ratioEventCount (streams 3) (fun o => inCell o x a s ∧ o.R = true) unfold heavyCorrection streamArrivedSuccessCount streamC rw [hcountA, hcountB] by_cases hzero : eventCount B (streams 3) = 0 · simp [B, hzero] · have hpos : 0 < eventCount B (streams 3) := lt_of_le_of_ne (eventCount_bounds B (streams 3)).1 (Ne.symm hzero) have hfrac := successFraction_bounds hAB (streams 3) have hrepr : eventCount A (streams 3) / eventCount B (streams 3) = frac A B (streams 3) := by simp [frac, Causalean.Stat.FiniteRaoBlackwell.Poisson.FinitePartition.NestedEventRatioMean.successFraction, hzero] rw [if_pos hpos, hrepr, abs_le] constructor <;> linarith
CausalSmith.Stat.MarNearcompleteFrontier.upper_streamD_abs_le_half_ae · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamVariance.lean:33
theorem upper_measurable_streamD

The totalized heavy correction is measurable as a function of the streams. Given the specified input d, the specified input x, the specified input a, the specified input s, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
x :
Fin d
a s :
Measurable (fun streams : Fin 4 → FiniteSample (Obs d) => streamD d streams x a s)
Proof (Lean source)
@[fun_prop] lemma upper_measurable_streamD {d : ℕ} (x : Fin d) (a s : Bool) : Measurable (fun streams : Fin 4 → FiniteSample (Obs d) => streamD d streams x a s) := by classical have hc (E : Set (Obs d)) : Measurable (fun streams : Fin 4 → FiniteSample (Obs d) => finiteStreamCount (streams 3) (fun o => o ∈ E)) := by have hE : MeasurableSet E := by measurability have hm := Causalean.Stat.FiniteRaoBlackwell.Poisson.FinitePartition.NestedEventMoment.measurable_eventCount E hE have heq : (fun z : FiniteSample (Obs d) => finiteStreamCount z (fun o => o ∈ E)) = (fun z => (Causalean.Stat.FiniteRaoBlackwell.Poisson.FinitePartition.NestedEventMoment.eventCount z E : ℝ)) := by funext z simpa only [Causalean.Stat.FiniteRaoBlackwell.Poisson.FinitePartition.NestedEventMoment.eventCount, Set.mem_ofPred_eq] using upper_finiteStreamCount_eq_eventCount z (fun o => o ∈ E) change Measurable ((fun z => finiteStreamCount z (fun o => o ∈ E)) ∘ fun streams : Fin 4 → FiniteSample (Obs d) => streams 3) rw [heq] exact ((measurable_of_countable (fun k : ℕ => (k : ℝ))).comp hm).comp (measurable_pi_apply 3) have hC : Measurable (fun streams : Fin 4 → FiniteSample (Obs d) => streamC d streams x a s) := hc {o | inCell o x a s ∧ o.R = true} have hU : Measurable (fun streams : Fin 4 → FiniteSample (Obs d) => streamU d streams x a s) := hc {o | inCell o x a s ∧ o.RY = true} unfold streamD heavyCorrection apply Measurable.ite (measurableSet_lt measurable_const hC) <;> fun_prop
CausalSmith.Stat.MarNearcompleteFrontier.upper_measurable_streamD · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamVariance.lean:76
theorem upper_stream_heavy_variance_uniform

The centered heavy correction has mean squared size at most one quarter, by its almost-sure centered Bernoulli range. Given the specified input n, the specified input d, the specified input P, the specified input x, the specified input a, the specified input s, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
P :
x :
Fin d
a s :
(∫ streams, (streamD d streams x a s - (∫ z, streamD d z x a s ∂fourStreamLaw n P)) ^ 2 ∂fourStreamLaw n P)
≤ (1 / 4 : ℝ)
Proof (Lean source)
lemma upper_stream_heavy_variance_uniform {n d : ℕ} (P : FullLaw d) (x : Fin d) (a s : Bool) : (∫ streams, (streamD d streams x a s - (∫ z, streamD d z x a s ∂fourStreamLaw n P)) ^ 2 ∂fourStreamLaw n P) ≤ (1 / 4 : ℝ) := by classical have hμ : fourStreamLaw n P = Measure.pi (fun i : Fin 4 => finitePoissonSampleLaw (observedLaw P).toMeasure ((n : NNReal) / 2 * uniformFourMass i)) := by unfold fourStreamLaw exact Causalean.Stat.FiniteRaoBlackwell.Poisson.FinitePartition.labeledStreamLaw_eq_independent _ _ _ _ letI : IsProbabilityMeasure (fourStreamLaw n P) := by rw [hμ] infer_instance have hm : Measurable (fun streams : Fin 4 → FiniteSample (Obs d) => streamD d streams x a s) := upper_measurable_streamD x a s have hb : ∀ᵐ streams ∂fourStreamLaw n P, streamD d streams x a s ∈ Icc (-(1 / 2 : ℝ)) (1 / 2) := by filter_upwards [upper_streamD_abs_le_half_ae (n := n) P x a s] with streams hs exact abs_le.mp hs have hv := ProbabilityTheory.variance_le_sq_of_bounded hb hm.aemeasurable rw [ProbabilityTheory.variance_eq_integral hm.aemeasurable] at hv norm_num at hv exact hv
CausalSmith.Stat.MarNearcompleteFrontier.upper_stream_heavy_variance_uniform · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamVariance.lean:108
theorem upper_stream_heavy_variance_small_rate

The heavy correction satisfies the required inverse-rate bound whenever the arrived-cell Poisson rate is at most fifteen. Given the specified input n, the specified input d, the specified input P, the specified input x, the specified input a, the specified input s, the specified input hz, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
P :
x :
Fin d
a s :
hz :
streamZ n P x a s ≤ 15
(∫ streams, (streamD d streams x a s - (∫ z, streamD d z x a s ∂fourStreamLaw n P)) ^ 2 ∂fourStreamLaw n P)
≤ 4 / (1 + streamZ n P x a s)
Proof (Lean source)
lemma upper_stream_heavy_variance_small_rate {n d : ℕ} (P : FullLaw d) (x : Fin d) (a s : Bool) (hz : streamZ n P x a s ≤ 15) : (∫ streams, (streamD d streams x a s - (∫ z, streamD d z x a s ∂fourStreamLaw n P)) ^ 2 ∂fourStreamLaw n P) ≤ 4 / (1 + streamZ n P x a s) := by have hz0 : 0 ≤ streamZ n P x a s := by unfold streamZ exact mul_nonneg (by positivity) (arrivedCellMass_nonneg P x a s) apply (upper_stream_heavy_variance_uniform (n := n) P x a s).trans apply (le_div_iff₀ (by positivity : 0 < 1 + streamZ n P x a s)).mpr linarith
CausalSmith.Stat.MarNearcompleteFrontier.upper_stream_heavy_variance_small_rate · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamVariance.lean:138
theorem upper_successFraction_complement Lemma upper_successFraction_complement in the paper ↗

Splitting the containing event into successes and failures splits its zero-safe empirical fraction as well. Given the specified input X, the specified input A, the specified input B, the specified input hAB, the specified input z, the stated mathematical conclusion holds.

Formal statement
X :
hAB :
A ⊆ B
z :
- successFraction (B \ A) B z
= 2 * successFraction A B z
Proof (Lean source)
-- @node: upper_successFraction_complement lemma upper_successFraction_complement {X : Type*} [MeasurableSpace X] {A B : Set X} (hAB : A ⊆ B) (z : FiniteSample X) : successFraction A B z - successFraction (B \ A) B z = 2 * successFraction A B z - successFraction B B z := by classical open Causalean.Stat.FiniteRaoBlackwell.Poisson.FinitePartition.NestedEventRatioMean in have hc : eventCount A z + eventCount (B \ A) z = eventCount B z := by unfold eventCount iidEventCount rw [← Finset.sum_add_distrib] apply Finset.sum_congr rfl intro i hi by_cases hA : z.points i ∈ A · simp [hA, hAB hA] · by_cases hB : z.points i ∈ B <;> simp [hA, hB] unfold successFraction by_cases hz : eventCount B z = 0 · simp [hz] · simp only [hz, if_false] rw [← hc] ring
CausalSmith.Stat.MarNearcompleteFrontier.upper_successFraction_complement · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamVariance.lean:153
theorem upper_stream_heavy_variance_le

The fourth-stream heavy correction has variance at most a constant divided by one plus its arrived-cell Poisson rate. Given the specified input n, the specified input d, the specified input P, the specified input x, the specified input a, the specified input s, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
P :
x :
Fin d
a s :
(∫ streams, (streamD d streams x a s - (∫ z, streamD d z x a s ∂fourStreamLaw n P)) ^ 2 ∂fourStreamLaw n P)
≤ 4 / (1 + streamZ n P x a s)
Proof (Lean source)
lemma upper_stream_heavy_variance_le {n d : ℕ} (P : FullLaw d) (x : Fin d) (a s : Bool) : (∫ streams, (streamD d streams x a s - (∫ z, streamD d z x a s ∂fourStreamLaw n P)) ^ 2 ∂fourStreamLaw n P) ≤ 4 / (1 + streamZ n P x a s) := by by_cases hz : streamZ n P x a s ≤ 15 · exact upper_stream_heavy_variance_small_rate P x a s hz · classical let Q := (observedLaw P).toMeasure let lam : NNReal := (n : NNReal) / 2 * uniformFourMass (3 : Fin 4) let A : Set (Obs d) := {o | inCell o x a s ∧ o.R = true ∧ o.RY = true} let B : Set (Obs d) := {o | inCell o x a s ∧ o.R = true} let frac : Set (Obs d) → Set (Obs d) → FiniteSample (Obs d) → ℝ := Causalean.Stat.FiniteRaoBlackwell.Poisson.FinitePartition.NestedEventRatioMean.successFraction have hA : MeasurableSet A := by measurability have hB : MeasurableSet B := by measurability have hAB : A ⊆ B := fun o ho => ⟨ho.1, ho.2.1⟩ have hCB : B \ A ⊆ B := Set.sdiff_subset have hμ : fourStreamLaw n P = Measure.pi (fun i : Fin 4 => finitePoissonSampleLaw Q ((n : NNReal) / 2 * uniformFourMass i)) := by unfold fourStreamLaw Q exact Causalean.Stat.FiniteRaoBlackwell.Poisson.FinitePartition.labeledStreamLaw_eq_independent _ _ _ _ let : IsProbabilityMeasure (fourStreamLaw n P) := by rw [hμ]; infer_instance have hrate : (lam : ℝ) * Q.real B = streamZ n P x a s := by have hmass : Q.real B = arrivedCellMass P x a s := by rw [show Q.real B = ∑ o : Obs d, if inCell o x a s ∧ o.R = true then obsMass (observedLaw P) o else 0 by simpa only [Q, B, Measure.real] using observed_event_mass_toReal (observedLaw P) (fun o => inCell o x a s ∧ o.R = true)] simpa only [inCell, arrivedCellMass, and_assoc] using observed_arrived_mass P x a s rw [hmass] norm_num [lam, uniformFourMass, streamZ] left ring have hPB : 0 < Q.real B := by have hzpos : 0 < streamZ n P x a s := by linarith rw [← hrate] at hzpos exact (mul_pos_iff.mp hzpos).resolve_right (by intro hneg exact (not_lt_of_ge (by positivity : 0 ≤ (lam : ℝ))) hneg.1) |>.2 let pA := Q.real A / Q.real B let pC := Q.real (B \ A) / Q.real B let c := (pA - pC) / 2 have hpoint : ∀ᵐ streams ∂fourStreamLaw n P, streamD d streams x a s = (frac A B (streams 3) - frac (B \ A) B (streams 3)) / 2 := by filter_upwards [streamU_eq_arrivedSuccess_ae (n := n) P x a s] with streams hs rw [upper_successFraction_complement hAB] unfold streamD rw [hs] unfold heavyCorrection streamArrivedSuccessCount streamC rw [finiteStreamCount_eq_ratioEventCount, finiteStreamCount_eq_ratioEventCount] unfold Causalean.Stat.FiniteRaoBlackwell.Poisson.FinitePartition.NestedEventRatioMean.successFraction by_cases hz0 : eventCount B (streams 3) = 0 · simp [B, hz0] · have hzpos : 0 < eventCount B (streams 3) := lt_of_le_of_ne (eventCount_bounds B (streams 3)).1 (Ne.symm hz0) simp only [hz0, if_false, B, hzpos, if_true] dsimp [A] field_simp [show eventCount {o | inCell o x a s ∧ o.R = true} (streams 3) ≠ 0 from hz0] have hm := (upper_measurable_streamD x a s).aestronglyMeasurable (μ := fourStreamLaw n P) have herr (E : Set (Obs d)) (hE : MeasurableSet E) (hEB : E ⊆ B) : (∫ streams, (frac E B (streams 3) - Q.real E / Q.real B) ^ 2 ∂fourStreamLaw n P) ≤ 4 / (1 + streamZ n P x a s) := by rw [hμ] rw [integral_comp_eval (μ := fun i : Fin 4 => finitePoissonSampleLaw Q ((n : NNReal) / 2 * uniformFourMass i)) (i := (3 : Fin 4)) (f := fun z => (frac E B z - Q.real E / Q.real B) ^ 2) (((measurable_successFraction hE hB).sub measurable_const).pow_const 2).aestronglyMeasurable] simpa only [frac, lam, hrate] using CausalSmith.Stat.MarRareqLogfrontier.finitePoisson_successFraction_centered_sq_le Q lam hE hB hEB hPB have hint (E : Set (Obs d)) (hE : MeasurableSet E) (hEB : E ⊆ B) : Integrable (fun streams => (frac E B (streams 3) - Q.real E / Q.real B) ^ 2) (fourStreamLaw n P) := by have hmeas : Measurable (fun streams : Fin 4 → FiniteSample (Obs d) => (frac E B (streams 3) - Q.real E / Q.real B) ^ 2) := by fun_prop apply Integrable.of_bound hmeas.aestronglyMeasurable 1 filter_upwards [] with streams have hf := successFraction_bounds hEB (streams 3) have hp0 : 0 ≤ Q.real E / Q.real B := div_nonneg measureReal_nonneg hPB.le have hp1 : Q.real E / Q.real B ≤ 1 := (div_le_one hPB).mpr (measureReal_mono hEB) rw [Real.norm_eq_abs, abs_of_nonneg (sq_nonneg _)] dsimp [frac] nlinarith have hDint : Integrable (fun streams => (streamD d streams x a s - c) ^ 2) (fourStreamLaw n P) := by apply Integrable.of_bound ((hm.sub aestronglyMeasurable_const).pow 2) ((1 / 2 + |c|) ^ 2) filter_upwards [upper_streamD_abs_le_half_ae (n := n) P x a s] with streams hb rw [Real.norm_eq_abs, abs_of_nonneg (sq_nonneg _)] have hab : |streamD d streams x a s - c| ≤ 1 / 2 + |c| := by calc _ ≤ |streamD d streams x a s| + |c| := abs_sub _ _ _ ≤ _ := by linarith simpa only [sq_abs, Pi.pow_apply, Pi.sub_apply] using pow_le_pow_left₀ (abs_nonneg _) hab 2 calc _ = variance (fun streams => streamD d streams x a s) (fourStreamLaw n P) := (ProbabilityTheory.variance_eq_integral hm.aemeasurable).symm _ = variance (fun streams => streamD d streams x a s - c) (fourStreamLaw n P) := (ProbabilityTheory.variance_sub_const hm c).symm _ ≤ ∫ streams, (streamD d streams x a s - c) ^ 2 ∂fourStreamLaw n P := ProbabilityTheory.variance_le_expectation_sq (hm.sub aestronglyMeasurable_const) _ ≤ ∫ streams, ((frac A B (streams 3) - pA) ^ 2 + (frac (B \ A) B (streams 3) - pC) ^ 2) / 2 ∂fourStreamLaw n P := by apply integral_mono_ae hDint (((hint A hA hAB).add (hint (B \ A) (hB.diff hA) hCB)).div_const 2) filter_upwards [hpoint] with streams hs rw [hs] dsimp [c] nlinarith [sq_nonneg ((frac A B (streams 3) - pA) + (frac (B \ A) B (streams 3) - pC))] _ = ((∫ streams, (frac A B (streams 3) - pA) ^ 2 ∂fourStreamLaw n P) + (∫ streams, (frac (B \ A) B (streams 3) - pC) ^ 2 ∂fourStreamLaw n P)) / 2 := by rw [integral_div, integral_add (hint A hA hAB) (hint (B \ A) (hB.diff hA) hCB)] _ ≤ _ := by have ha := herr A hA hAB have hc := herr (B \ A) (hB.diff hA) hCB dsimp only [pA, pC] linarith
CausalSmith.Stat.MarNearcompleteFrontier.upper_stream_heavy_variance_le · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamVariance.lean:180
CausalSmith.Stat.STAT_MarNearcompleteFrontier_Research.Helpers.UpperRisk.StreamVarianceAlgebra 2 declarations These bounds turn a within-stream heavy-correction variance estimate into the cellwise and aggregate product-variance budget in equation (16).

Deterministic heavy-cell variance assembly

These bounds turn a within-stream heavy-correction variance estimate into the cellwise and aggregate product-variance budget in equation (16).

theorem heavyProductVariance_algebra_le Lemma heavyProductVariance_algebra_le in the paper ↗

Product-moment algebra bounds one heavy-cell correction variance from its within-stream variance and centered-mean bounds. Given the specified input w, the specified input m, the specified input z, the specified input hw, the specified input hm, the specified input hz, the stated mathematical conclusion holds. Given the specified input ν, the specified input μ, the specified input hμ. Given the specified input hν.

Formal statement
w m z ν μ :
ℝ
hw :
0 ≤ w
hm :
0 < m
hz :
0 ≤ z
hν :
ν ≤ 4 / (1 + z)
hμ :
μ ^ 2 ≤ 1 / 4
(w ^ 2 + w / m) * (ν + μ ^ 2) - (w * μ) ^ 2 ≤ 4 * w ^ 2 / (1 + z) + (17 / 4) * (w / m)
Proof (Lean source)
lemma heavyProductVariance_algebra_le {w m z ν μ : ℝ} (hw : 0 ≤ w) (hm : 0 < m) (hz : 0 ≤ z) (hν : ν ≤ 4 / (1 + z)) (hμ : μ ^ 2 ≤ 1 / 4) : (w ^ 2 + w / m) * (ν + μ ^ 2) - (w * μ) ^ 2 ≤ 4 * w ^ 2 / (1 + z) + (17 / 4) * (w / m) := by have hwm : 0 ≤ w / m := div_nonneg hw hm.le have hcoef : 0 ≤ w ^ 2 + w / m := by positivity have hden : 0 < 1 + z := by linarith have hνmul := mul_le_mul_of_nonneg_left hν hcoef have hμmul := mul_le_mul_of_nonneg_left hμ hwm have hfrac : 4 * (w / m) / (1 + z) ≤ 4 * (w / m) := by rw [div_le_iff₀ hden] nlinarith calc (w ^ 2 + w / m) * (ν + μ ^ 2) - (w * μ) ^ 2 = (w ^ 2 + w / m) * ν + (w / m) * μ ^ 2 := by ring _ ≤ (w ^ 2 + w / m) * (4 / (1 + z)) + (w / m) * (1 / 4) := add_le_add hνmul hμmul _ = 4 * w ^ 2 / (1 + z) + 4 * (w / m) / (1 + z) + (w / m) / 4 := by ring _ ≤ 4 * w ^ 2 / (1 + z) + 4 * (w / m) + (w / m) / 4 := by linarith _ = 4 * w ^ 2 / (1 + z) + (17 / 4) * (w / m) := by ring
CausalSmith.Stat.MarNearcompleteFrontier.heavyProductVariance_algebra_le · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamVarianceAlgebra.lean:18
theorem heavyProductVariance_budget

Summing the heavy-cell product-variance bounds costs at most a universal multiple of the inverse stream intensity. Given the specified input d, the specified input q, the specified input P, the specified input h, the specified input m, the specified input hm, the stated mathematical conclusion holds. Given the specified input hq.

Formal statement
d :
ℕ
q :
ℝ
P :
h :
LawClass d q P
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
m :
ℝ
hm :
0 < m
(∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, (4 * (missingCellMass P x a s) ^ 2 / (1 + m * arrivedCellMass P x a s) + (17 / 4 : ℝ) * (missingCellMass P x a s / m)))
≤ 17 / (4 * m)
Proof (Lean source)
lemma heavyProductVariance_budget {d : ℕ} {q : ℝ} (P : FullLaw d) (h : LawClass d q P) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (m : ℝ) (hm : 0 < m) : (∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, (4 * (missingCellMass P x a s) ^ 2 / (1 + m * arrivedCellMass P x a s) + (17 / 4 : ℝ) * (missingCellMass P x a s / m))) ≤ 17 / (4 * m) := by classical have hbase := missingCellMass_heavy_variance_budget P h hq m hm calc (∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, (4 * (missingCellMass P x a s) ^ 2 / (1 + m * arrivedCellMass P x a s) + (17 / 4 : ℝ) * (missingCellMass P x a s / m))) ≤ ∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, (17 / 4 : ℝ) * (missingCellMass P x a s / m + (missingCellMass P x a s) ^ 2 / (1 + m * arrivedCellMass P x a s)) := by apply Finset.sum_le_sum intro x hx apply Finset.sum_le_sum intro a ha apply Finset.sum_le_sum intro s hs have harr : 0 ≤ arrivedCellMass P x a s := arrivedCellMass_nonneg P x a s have hden : 0 < 1 + m * arrivedCellMass P x a s := by positivity have hquad : 0 ≤ (missingCellMass P x a s) ^ 2 / (1 + m * arrivedCellMass P x a s) := div_nonneg (sq_nonneg _) hden.le calc 4 * (missingCellMass P x a s) ^ 2 / (1 + m * arrivedCellMass P x a s) + (17 / 4 : ℝ) * (missingCellMass P x a s / m) = 4 * ((missingCellMass P x a s) ^ 2 / (1 + m * arrivedCellMass P x a s)) + (17 / 4 : ℝ) * (missingCellMass P x a s / m) := by ring _ ≤ (17 / 4 : ℝ) * (missingCellMass P x a s / m + (missingCellMass P x a s) ^ 2 / (1 + m * arrivedCellMass P x a s)) := by linarith _ = (17 / 4 : ℝ) * (∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, (missingCellMass P x a s / m + (missingCellMass P x a s) ^ 2 / (1 + m * arrivedCellMass P x a s))) := by simp only [Finset.mul_sum] _ ≤ (17 / 4 : ℝ) * (1 / m) := mul_le_mul_of_nonneg_left hbase (by norm_num) _ = 17 / (4 * m) := by field_simp [ne_of_gt hm]
CausalSmith.Stat.MarNearcompleteFrontier.heavyProductVariance_budget · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamVarianceAlgebra.lean:45
CausalSmith.Stat.STAT_MarNearcompleteFrontier_Research.Helpers.UpperRisk.StreamVarianceRates 6 declarations Equation (19) follows from the sixth Taylor term of the exponential and Young's inequality.

Absorbing the correction variance into the frontier rate

Equation (19) follows from the sixth Taylor term of the exponential and Young's inequality. These bounds retain the exact exponential logarithmic scale of equation (17), avoiding an unnecessary approximation by n^(1/8).

theorem upper_log_sixth_exp_bound Lemma upper_log_sixth_exp_bound in the paper ↗

The sixth logarithmic power is dominated by an exponential with exponent three quarters, with a fixed numerical constant. Given the specified input L, the specified input hL, the stated mathematical conclusion holds.

Formal statement
L :
ℝ
hL :
0 ≤ L
L ^ 6 ≤ (720 * (4 / 3 : ℝ) ^ 6) * exp (3 * L / 4)
Proof (Lean source)
-- @node: upper_log_sixth_exp_bound lemma upper_log_sixth_exp_bound {L : ℝ} (hL : 0 ≤ L) : L ^ 6 ≤ (720 * (4 / 3 : ℝ) ^ 6) * exp (3 * L / 4) := by have ht := Real.pow_div_factorial_le_exp (3 * L / 4) (show 0 ≤ 3 * L / 4 by positivity) 6 norm_num [factorial] at ht nlinarith only [ht]
CausalSmith.Stat.MarNearcompleteFrontier.upper_log_sixth_exp_bound · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamVarianceRates.lean:19
theorem upper_exp_ell_le_sample Lemma upper_exp_ell_le_sample in the paper ↗

The exponential of the sample logarithm is at most a fixed multiple of sample size, including the smallest positive sample size. Given the specified input n, the specified input hn, the stated mathematical conclusion holds.

Formal statement
n :
ℕ
hn :
0 < n
exp (ell n) ≤ (exp 1 + 1) * (n : ℝ)
Proof (Lean source)
-- @node: upper_exp_ell_le_sample lemma upper_exp_ell_le_sample {n : ℕ} (hn : 0 < n) : exp (ell n) ≤ (exp 1 + 1) * (n : ℝ) := by have hn1 : (1 : ℝ) ≤ (n : ℝ) := by exact_mod_cast hn rw [ell, Real.exp_log (by positivity)] nlinarith [Real.exp_pos (1 : ℝ)]
CausalSmith.Stat.MarNearcompleteFrontier.upper_exp_ell_le_sample · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamVarianceRates.lean:28
theorem upper_variance_log_factor_sq_le Lemma upper_variance_log_factor_sq_le in the paper ↗

Squaring the factor paired with the bias scale in equation (19) costs only a universal multiple of inverse sample size. Given the specified input n, the specified input hn, the specified input hL, the stated mathematical conclusion holds.

Formal statement
n :
ℕ
hn :
0 < n
hL :
0 ≤ ell n
(exp (ell n / 8) * (ell n) ^ 3 / (n : ℝ)) ^ 2
≤ ((720 * (4 / 3 : ℝ) ^ 6) * (exp 1 + 1)) / (n : ℝ)
Proof (Lean source)
-- @node: upper_variance_log_factor_sq_le lemma upper_variance_log_factor_sq_le {n : ℕ} (hn : 0 < n) (hL : 0 ≤ ell n) : (exp (ell n / 8) * (ell n) ^ 3 / (n : ℝ)) ^ 2 ≤ ((720 * (4 / 3 : ℝ) ^ 6) * (exp 1 + 1)) / (n : ℝ) := by have hnR : 0 < (n : ℝ) := by positivity have hp := mul_le_mul_of_nonneg_left (upper_log_sixth_exp_bound hL) (Real.exp_pos (ell n / 4)).le have he : exp (ell n / 4) * exp (3 * ell n / 4) = exp (ell n) := by rw [← Real.exp_add]; congr 1; ring have hs : (exp (ell n / 8)) ^ 2 = exp (ell n / 4) := by rw [← Real.exp_nat_mul]; congr 1; norm_num; ring calc _ = exp (ell n / 4) * (ell n) ^ 6 / (n : ℝ) ^ 2 := by rw [← hs]; ring _ ≤ (720 * (4 / 3 : ℝ) ^ 6) * exp (ell n) / (n : ℝ) ^ 2 := by apply div_le_div_of_nonneg_right _ (sq_nonneg _) calc _ ≤ exp (ell n / 4) * ((720 * (4 / 3 : ℝ) ^ 6) * exp (3 * ell n / 4)) := hp _ = _ := by rw [mul_left_comm, he] _ ≤ (720 * (4 / 3 : ℝ) ^ 6) * ((exp 1 + 1) * (n : ℝ)) / (n : ℝ) ^ 2 := div_le_div_of_nonneg_right (mul_le_mul_of_nonneg_left (upper_exp_ell_le_sample hn) (by positivity)) (sq_nonneg _) _ = _ := by field_simp
CausalSmith.Stat.MarNearcompleteFrontier.upper_variance_log_factor_sq_le · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamVarianceRates.lean:37
theorem upper_variance_cross_term_le Lemma upper_variance_cross_term_le in the paper ↗

Young's inequality absorbs any fixed multiple of the nonparametric correction term into squared bias and inverse sample size. Given the specified input n, the specified input hn, the specified input hL, the specified input A, the specified input x, the stated mathematical conclusion holds.

Formal statement
n :
ℕ
hn :
0 < n
hL :
0 ≤ ell n
A x :
ℝ
A * x * (exp (ell n / 8) * (ell n) ^ 3 / (n : ℝ))
≤ x ^ 2 / 2 + (A ^ 2 * ((720 * (4 / 3 : ℝ) ^ 6) * (exp 1 + 1)) / 2) / (n : ℝ)
Proof (Lean source)
-- @node: upper_variance_cross_term_le lemma upper_variance_cross_term_le {n : ℕ} (hn : 0 < n) (hL : 0 ≤ ell n) (A x : ℝ) : A * x * (exp (ell n / 8) * (ell n) ^ 3 / (n : ℝ)) ≤ x ^ 2 / 2 + (A ^ 2 * ((720 * (4 / 3 : ℝ) ^ 6) * (exp 1 + 1)) / 2) / (n : ℝ) := by have hb := mul_le_mul_of_nonneg_left (upper_variance_log_factor_sq_le hn hL) (sq_nonneg A) have hy := sq_nonneg (x - A * (exp (ell n / 8) * (ell n) ^ 3 / (n : ℝ))) have hb' : (A * (exp (ell n / 8) * (ell n) ^ 3 / (n : ℝ))) ^ 2 / 2 ≤ (A ^ 2 * ((720 * (4 / 3 : ℝ) ^ 6) * (exp 1 + 1)) / 2) / (n : ℝ) := by convert mul_le_mul_of_nonneg_left hb (by norm_num : (0 : ℝ) ≤ 1 / 2) using 1 <;> first | rfl | ring calc _ ≤ x ^ 2 / 2 + (A * (exp (ell n / 8) * (ell n) ^ 3 / (n : ℝ))) ^ 2 / 2 := by nlinarith only [hy] _ ≤ _ := add_le_add_right hb' _
CausalSmith.Stat.MarNearcompleteFrontier.upper_variance_cross_term_le · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamVarianceRates.lean:65
theorem upper_small_variance_envelope_le Lemma upper_small_variance_envelope_le in the paper ↗

The explicit small-cell envelope in equation (17) factors into the bias scale times the logarithmic factor controlled by equation (19). Given the specified input n, the specified input d, the specified input q, the specified input hn, the specified input hL, the stated mathematical conclusion holds. Given the specified input hq.

Formal statement
n d :
ℕ
q :
ℝ
hn :
0 < n
hL :
128 ≤ ell n
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
12 * (d : ℝ) * exp (ell n / 8) * ((4 * (delta q) ^ 2 * (polyThreshold n) ^ 2 + 2 * delta q * polyThreshold n) / ((n : ℝ) / 8) ^ 2)
≤ 201719808 * (delta q * (d : ℝ) / ((n : ℝ) * ell n)) * (exp (ell n / 8) * (ell n) ^ 3 / (n : ℝ))
Proof (Lean source)
-- @node: upper_small_variance_envelope_le lemma upper_small_variance_envelope_le {n d : ℕ} {q : ℝ} (hn : 0 < n) (hL : 128 ≤ ell n) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) : 12 * (d : ℝ) * exp (ell n / 8) * ((4 * (delta q) ^ 2 * (polyThreshold n) ^ 2 + 2 * delta q * polyThreshold n) / ((n : ℝ) / 8) ^ 2) ≤ 201719808 * (delta q * (d : ℝ) / ((n : ℝ) * ell n)) * (exp (ell n / 8) * (ell n) ^ 3 / (n : ℝ)) := by have hnR : 0 < (n : ℝ) := by positivity have hδ : 0 ≤ delta q := by unfold delta; linarith [hq.2] have hδ1 : delta q ≤ 1 := by unfold delta; linarith [hq.1] have hδsq : (delta q) ^ 2 ≤ delta q := by nlinarith have hLpos : 0 < ell n := by linarith have hLsq : ell n ≤ (ell n) ^ 2 := by nlinarith have hquad := mul_le_mul_of_nonneg_right hδsq (sq_nonneg (ell n)) have hlin := mul_le_mul_of_nonneg_left hLsq hδ have hnum : 4 * (delta q) ^ 2 * (polyThreshold n) ^ 2 + 2 * delta q * polyThreshold n ≤ 262656 * delta q * (ell n) ^ 2 := by unfold polyThreshold nlinarith only [hquad, hlin] calc _ ≤ 12 * (d : ℝ) * exp (ell n / 8) * ((262656 * delta q * (ell n) ^ 2) / ((n : ℝ) / 8) ^ 2) := mul_le_mul_of_nonneg_left (div_le_div_of_nonneg_right hnum (sq_nonneg _)) (by positivity) _ = _ := by field_simp; ring
CausalSmith.Stat.MarNearcompleteFrontier.upper_small_variance_envelope_le · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamVarianceRates.lean:85
theorem upper_stream_correction_second_moment_sum_rate

Combining equations (17)--(19) bounds the full correction second-moment budget by squared bias scale plus a universal inverse-sample-size term. Given the specified input n, the specified input d, the specified input q, the specified input hn, the specified input hL, the specified input P, the specified input h, the stated mathematical conclusion holds. Given the specified input hq.

Formal statement
n d :
ℕ
q :
ℝ
hn :
0 < n
hL :
128 ≤ ell n
P :
h :
LawClass d q P
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
(∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, (∫ streams, (streamV n d streams x a s * (streamG n d streams x a s - streamD d streams x a s)) ^ 2 ∂fourStreamLaw n P))
≤ (delta q * (d : ℝ) / ((n : ℝ) * ell n)) ^ 2 / 2
+ ((201719808 : ℝ) ^ 2 * ((720 * (4 / 3 : ℝ) ^ 6) * (exp 1 + 1)) / 2 + 25) / (n : ℝ)
Proof (Lean source)
-- @node: upper_stream_correction_second_moment_sum_rate lemma upper_stream_correction_second_moment_sum_rate {n d : ℕ} {q : ℝ} (hn : 0 < n) (hL : 128 ≤ ell n) (P : FullLaw d) (h : LawClass d q P) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) : (∑ x : Fin d, ∑ a : Bool, ∑ s : Bool, (∫ streams, (streamV n d streams x a s * (streamG n d streams x a s - streamD d streams x a s)) ^ 2 ∂fourStreamLaw n P)) ≤ (delta q * (d : ℝ) / ((n : ℝ) * ell n)) ^ 2 / 2 + ((201719808 : ℝ) ^ 2 * ((720 * (4 / 3 : ℝ) ^ 6) * (exp 1 + 1)) / 2 + 25) / (n : ℝ) := by have hsmall := upper_small_variance_envelope_le (d := d) hn hL hq have hcross := upper_variance_cross_term_le hn (by linarith : 0 ≤ ell n) 201719808 (delta q * (d : ℝ) / ((n : ℝ) * ell n)) calc _ ≤ _ := upper_stream_correction_second_moment_sum_le hn hL P h hq _ ≤ 201719808 * (delta q * (d : ℝ) / ((n : ℝ) * ell n)) * (exp (ell n / 8) * (ell n) ^ 3 / (n : ℝ)) + 25 / (n : ℝ) := add_le_add hsmall le_rfl _ ≤ ((delta q * (d : ℝ) / ((n : ℝ) * ell n)) ^ 2 / 2 + ((201719808 : ℝ) ^ 2 * ((720 * (4 / 3 : ℝ) ^ 6) * (exp 1 + 1)) / 2) / (n : ℝ)) + 25 / (n : ℝ) := add_le_add hcross le_rfl _ = _ := by ring
CausalSmith.Stat.MarNearcompleteFrontier.upper_stream_correction_second_moment_sum_rate · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/Helpers/UpperRisk/StreamVarianceRates.lean:115
CausalSmith.Stat.STAT_MarNearcompleteFrontier_Research.TCompleteArrival 1 declarations At q=1 the estimator uses only the observed primary outcomes and the rate loses its many-cell term.

Complete-arrival endpoint

At q=1 the estimator uses only the observed primary outcomes and the rate loses its many-cell term. The point and interval constants remain uniform in d.

theorem complete_arrival_reduction

Complete arrival gives the projected HT estimator and uniform parametric frontiers. the stated mathematical conclusion holds.

Formal statement
∃ c C : ℝ,
0 < c
c < C
conclusion 1
α :
ℝ
α ∈ Ioo 0 ((1 : ℝ) / 2)
∃ cα Cα : ℝ,
0 < cα
cα < Cα
n d :
ℕ
1 ≤ n
1 ≤ d
gScale n d 1 = 0
rate n d 1 = 1 / (n : ℝ)
sample :
Fin n → Obs d
tauhatMM n d 1 sample = completeHT sample
P :
sample :
Fin n → Obs d
|tauhatMM n d 1 sample - tau P.val| ≤ |unprojectedHT sample - tau P.val|
(⨆ P : ClassLaw d 1, ∫ sample, (tauhatMM n d 1 sample - tau P.val) ^ 2 ∂ samplePi P.val n)
≤ (⨆ P : ClassLaw d 1, ∫ sample, (unprojectedHT sample - tau P.val) ^ 2 ∂ samplePi P.val n)
(⨆ P : ClassLaw d 1, ∫ sample, (unprojectedHT sample - tau P.val) ^ 2 ∂ samplePi P.val n)
≤ 4 / (n : ℝ)
c / (n : ℝ) ≤ pointMinimaxRisk n d 1
pointMinimaxRisk n d 1 ≤ C / (n : ℝ)
cα / sqrt n ≤ lengthMinimaxRisk n d 1 α
lengthMinimaxRisk n d 1 α ≤ Cα / sqrt n
Proof (Lean source)
theorem complete_arrival_reduction : ∃ c C : ℝ, 0 < c ∧ c < C ∧ ∀ (α : ℝ), α ∈ Ioo 0 ((1 : ℝ) / 2) → ∃ cα Cα : ℝ, 0 < cα ∧ cα < Cα ∧ ∀ (n d : ℕ), 1 ≤ n → 1 ≤ d → gScale n d 1 = 0 ∧ rate n d 1 = 1 / (n : ℝ) ∧ (∀ sample : Fin n → Obs d, tauhatMM n d 1 sample = completeHT sample) ∧ (∀ (P : ClassLaw d 1) (sample : Fin n → Obs d), |tauhatMM n d 1 sample - tau P.val| ≤ |unprojectedHT sample - tau P.val|) ∧ (⨆ P : ClassLaw d 1, ∫ sample, (tauhatMM n d 1 sample - tau P.val) ^ 2 ∂ samplePi P.val n) ≤ (⨆ P : ClassLaw d 1, ∫ sample, (unprojectedHT sample - tau P.val) ^ 2 ∂ samplePi P.val n) ∧ (⨆ P : ClassLaw d 1, ∫ sample, (unprojectedHT sample - tau P.val) ^ 2 ∂ samplePi P.val n) ≤ 4 / (n : ℝ) ∧ c / (n : ℝ) ≤ pointMinimaxRisk n d 1 ∧ pointMinimaxRisk n d 1 ≤ C / (n : ℝ) ∧ cα / sqrt n ≤ lengthMinimaxRisk n d 1 α ∧ lengthMinimaxRisk n d 1 α ≤ Cα / sqrt n := by obtain ⟨c, C, hc, hcC, hpoint⟩ := point_frontier refine ⟨c, C, hc, hcC, ?_⟩ intro α hα obtain ⟨cα, Cα, hcα, hcαCα, hinterval⟩ := interval_frontier α hα refine ⟨cα, Cα, hcα, hcαCα, ?_⟩ intro n d hn hd have hq : (1 : ℝ) ∈ Icc ((1 : ℝ) / 2) 1 := by constructor <;> norm_num have hp := hpoint n d 1 hn hd hq have hi := hinterval n d 1 hn hd hq letI : Nonempty (ClassLaw d 1) := ⟨pairedClassLaw n d 1 0 hn hd hq (by norm_num : (0 : ℝ) ∈ Icc (-1) 1) ⟨fun _ => inr (), fun _ => false⟩⟩ have hunproj : (⨆ P : ClassLaw d 1, ∫ sample, (unprojectedHT sample - tau P.val) ^ 2 ∂samplePi P.val n) ≤ 4 / (n : ℝ) := by apply ciSup_le intro P exact complete_arrival_unprojected_risk_of_mean P.val hn (complete_arrival_score_mean P.val P.property) have hproj : (⨆ P : ClassLaw d 1, ∫ sample, (tauhatMM n d 1 sample - tau P.val) ^ 2 ∂samplePi P.val n) ≤ (⨆ P : ClassLaw d 1, ∫ sample, (unprojectedHT sample - tau P.val) ^ 2 ∂samplePi P.val n) := by have hb : BddAbove (Set.range fun P : ClassLaw d 1 => ∫ sample, (unprojectedHT sample - tau P.val) ^ 2 ∂samplePi P.val n) := by exact ⟨4 / (n : ℝ), fun z ⟨P, hz⟩ => hz ▸ complete_arrival_unprojected_risk_of_mean P.val hn (complete_arrival_score_mean P.val P.property)⟩ apply ciSup_le intro P exact le_trans (complete_arrival_projection_risk P.val) (le_ciSup hb P) refine ⟨complete_arrival_gScale n d, complete_arrival_rate n d, complete_arrival_estimator n d, ?_, hproj, hunproj, ?_, ?_, ?_, ?_⟩ · intro P sample exact complete_arrival_projection_error P.val sample · simpa [complete_arrival_rate, div_eq_mul_inv] using hp.1 · simpa [complete_arrival_rate, div_eq_mul_inv] using hp.2 · simpa [complete_arrival_rate, Real.sqrt_div, div_eq_mul_inv] using hi.1 · simpa [complete_arrival_rate, Real.sqrt_div, div_eq_mul_inv] using hi.2
CausalSmith.Stat.MarNearcompleteFrontier.complete_arrival_reduction · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/TCompleteArrival.lean:20
CausalSmith.Stat.STAT_MarNearcompleteFrontier_Research.THonestInterval 1 declarations The radius uses a certified uniform risk constant.

Honest clipped interval from the risk certificate

The radius uses a certified uniform risk constant. Its large-radius branch covers deterministically, and its smaller branch uses Markov's inequality.

theorem honest_interval_construction

The clipped interval is honest and has the stated pointwise and expected length. Given the specified input n, the specified input d, the specified input q, the specified input CU, the specified input hn, the specified input hd, the specified input hCU, the stated mathematical conclusion holds. Given the specified input α. Given the specified input hq, the specified input hα.

Formal statement
n d :
ℕ
q α CU :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
hα :
α ∈ Ioo 0 ((1 : ℝ) / 2)
conclusion 1
Honest n d q α (intervalMM n d q α CU hCU)
conclusion 2
o :
Fin n → Obs d
(intervalMM n d q α CU hCU).hi o - (intervalMM n d q α CU hCU).lo o
≤ min 2 (2 * intervalRadius n d q α CU)
conclusion 3
min 2 (2 * intervalRadius n d q α CU) = min 2 (2 * sqrt (CU * rate n d q / α))
conclusion 4
P :
(∫ o, ((intervalMM n d q α CU hCU).hi o - (intervalMM n d q α CU hCU).lo o) ∂ samplePi P.val n)
≤ min 2 (2 * sqrt (CU * rate n d q / α))
conclusion 5
intervalRadius n d q α CU < 2
P :
(samplePi P.val n).real {o | tau P.val ∉ Icc ((intervalMM n d q α CU hCU).lo o) ((intervalMM n d q α CU hCU).hi o)}
≤ α
conclusion 6
intervalRadius n d q α CU = 2
P :
o :
Fin n → Obs d
tau P.val ∈ Icc ((intervalMM n d q α CU hCU).lo o) ((intervalMM n d q α CU hCU).hi o)
Proof (Lean source)
lemma honest_interval_construction (n d : ℕ) (q α CU : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (hα : α ∈ Ioo 0 ((1 : ℝ) / 2)) (hCU : UpperRiskCertificate CU) : Honest n d q α (intervalMM n d q α CU hCU) ∧ (∀ o : Fin n → Obs d, (intervalMM n d q α CU hCU).hi o - (intervalMM n d q α CU hCU).lo o ≤ min 2 (2 * intervalRadius n d q α CU)) ∧ (min 2 (2 * intervalRadius n d q α CU) = min 2 (2 * sqrt (CU * rate n d q / α))) ∧ (∀ P : ClassLaw d q, (∫ o, ((intervalMM n d q α CU hCU).hi o - (intervalMM n d q α CU hCU).lo o) ∂ samplePi P.val n) ≤ min 2 (2 * sqrt (CU * rate n d q / α))) ∧ (intervalRadius n d q α CU < 2 → ∀ P : ClassLaw d q, (samplePi P.val n).real {o | tau P.val ∉ Icc ((intervalMM n d q α CU hCU).lo o) ((intervalMM n d q α CU hCU).hi o)} ≤ α) ∧ (intervalRadius n d q α CU = 2 → ∀ (P : ClassLaw d q) (o : Fin n → Obs d), tau P.val ∈ Icc ((intervalMM n d q α CU hCU).lo o) ((intervalMM n d q α CU hCU).hi o)) := by let h := intervalRadius n d q α CU let I := intervalMM n d q α CU hCU have hh : 0 ≤ h := intervalRadius_nonneg n d q α CU have hlen (o : Fin n → Obs d) : I.hi o - I.lo o ≤ min 2 (2 * h) := by have hb := I.bounds o change min 1 (tauhatMM n d q o + h) - max (-1) (tauhatMM n d q o - h) ≤ min 2 (2 * h) apply le_min · have hl := le_max_left (-1) (tauhatMM n d q o - h) have hu := min_le_left 1 (tauhatMM n d q o + h) linarith · have hl := le_max_right (-1) (tauhatMM n d q o - h) have hu := min_le_right 1 (tauhatMM n d q o + h) linarith have hmin : min 2 (2 * h) = min 2 (2 * sqrt (CU * rate n d q / α)) := by simp only [h, intervalRadius] rcases le_total 2 (sqrt (CU * rate n d q / α)) with hs | hs · rw [min_eq_left hs] have hs' : 2 ≤ 2 * sqrt (CU * rate n d q / α) := by linarith simp [min_eq_left hs'] · rw [min_eq_right hs] have hlarge (hh2 : h = 2) (P : ClassLaw d q) (o : Fin n → Obs d) : tau P.val ∈ Icc (I.lo o) (I.hi o) := by have ht := tau_range P.val have he := tauhatMM_range n d q o rcases ht with ⟨htlo, hthi⟩ rcases he with ⟨helo, hehi⟩ change max (-1) (tauhatMM n d q o - h) ≤ tau P.val ∧ tau P.val ≤ min 1 (tauhatMM n d q o + h) constructor · apply max_le htlo rw [hh2] linarith · apply le_min hthi rw [hh2] linarith have hsmall (hh2 : h < 2) (P : ClassLaw d q) : (samplePi P.val n).real {o | tau P.val ∉ Icc (I.lo o) (I.hi o)} ≤ α := by let μ := samplePi P.val n letI : IsProbabilityMeasure μ := by dsimp [μ, samplePi] infer_instance let f : (Fin n → Obs d) → ℝ := fun o => (tauhatMM n d q o - tau P.val) ^ 2 have hαpos : 0 < α := hα.1 have hrate : 0 ≤ rate n d q := by unfold rate; positivity have hrad : h = sqrt (CU * rate n d q / α) := by dsimp [h, intervalRadius] at hh2 ⊢ by_cases hs : sqrt (CU * rate n d q / α) ≤ 2 · exact min_eq_right hs · have hs' : 2 ≤ sqrt (CU * rate n d q / α) := le_of_not_ge hs simp only [min_eq_left hs'] at hh2 linarith have hsq : h ^ 2 = CU * rate n d q / α := by rw [hrad, Real.sq_sqrt (div_nonneg (mul_nonneg (le_of_lt hCU.1) hrate) (le_of_lt hαpos))] have hpos : 0 < h := by rw [hrad] apply Real.sqrt_pos.2 have hrpos : 0 < rate n d q := by unfold rate have : 0 < (n : ℝ) := Nat.cast_pos.mpr (by omega) positivity exact div_pos (mul_pos hCU.1 hrpos) hαpos have hsubset : {o | tau P.val ∉ Icc (I.lo o) (I.hi o)} ⊆ {o | h ^ 2 ≤ f o} := by intro o ho have he := tauhatMM_range n d q o change ¬(max (-1) (tauhatMM n d q o - h) ≤ tau P.val ∧ tau P.val ≤ min 1 (tauhatMM n d q o + h)) at ho simp only [not_and_or, not_le] at ho change h ^ 2 ≤ (tauhatMM n d q o - tau P.val) ^ 2 rcases ho with hlo | hhi · have ht := (tau_range P.val).1 have hm : tau P.val < tauhatMM n d q o - h := by by_cases hb : -1 ≤ tauhatMM n d q o - h · simpa [max_eq_right hb] using hlo · have heq : max (-1) (tauhatMM n d q o - h) = -1 := max_eq_left (le_of_not_ge hb) rw [heq] at hlo linarith nlinarith · have ht := (tau_range P.val).2 have hm : tauhatMM n d q o + h < tau P.val := by by_cases hb : tauhatMM n d q o + h ≤ 1 · simpa [min_eq_right hb] using hhi · have heq : min 1 (tauhatMM n d q o + h) = 1 := min_eq_left (le_of_not_ge hb) rw [heq] at hhi linarith nlinarith have hfint : Integrable f μ := Integrable.of_finite have hmarkov : h ^ 2 * μ.real {o | h ^ 2 ≤ f o} ≤ ∫ o, f o ∂μ := mul_meas_ge_le_integral_of_nonneg (Filter.Eventually.of_forall (fun o => sq_nonneg _)) hfint (h ^ 2) have hrisk := hCU.2 n d q hn hd hq P μ rfl have hmeas : μ.real {o | tau P.val ∉ Icc (I.lo o) (I.hi o)} ≤ μ.real {o | h ^ 2 ≤ f o} := measureReal_mono hsubset have hnonneg : 0 ≤ μ.real {o | tau P.val ∉ Icc (I.lo o) (I.hi o)} := measureReal_nonneg have hsqpos : 0 < h ^ 2 := sq_pos_of_pos hpos have hprod : CU * rate n d q = α * h ^ 2 := by rw [hsq] field_simp calc μ.real {o | tau P.val ∉ Icc (I.lo o) (I.hi o)} ≤ μ.real {o | h ^ 2 ≤ f o} := hmeas _ ≤ α := by dsimp [f, μ] at hmarkov hrisk ⊢ nlinarith [hmarkov, hrisk, hprod] refine ⟨?_, hlen, hmin, ?_, hsmall, hlarge⟩ · intro P let μ := samplePi P.val n letI : IsProbabilityMeasure μ := by dsimp [μ, samplePi] infer_instance by_cases hh2 : h = 2 · have heq : {o | tau P.val ∈ Icc (I.lo o) (I.hi o)} = univ := by ext o simp only [Set.mem_setOf_eq, Set.mem_univ, iff_true] exact hlarge hh2 P o rw [heq] have : μ.real univ = 1 := by simp change (samplePi P.val n).real univ = 1 at this have hαpos : 0 < α := hα.1 linarith · have hlt : h < 2 := lt_of_le_of_ne (min_le_left _ _) hh2 have hbad := hsmall hlt P have hmeas : MeasurableSet {o | tau P.val ∈ Icc (I.lo o) (I.hi o)} := by change MeasurableSet ({o | I.lo o ≤ tau P.val} ∩ {o | tau P.val ≤ I.hi o}) exact (measurableSet_le I.lo_measurable measurable_const).inter (measurableSet_le measurable_const I.hi_measurable) have hcomp := measureReal_compl (μ := μ) hmeas have hunit : μ.real univ = 1 := by simp have heq : {o | tau P.val ∈ Icc (I.lo o) (I.hi o)}ᶜ = {o | tau P.val ∉ Icc (I.lo o) (I.hi o)} := rfl rw [heq, hunit] at hcomp dsimp [μ] at hcomp linarith · intro P letI : IsProbabilityMeasure (samplePi P.val n) := by unfold samplePi infer_instance have hint : Integrable (fun o => I.hi o - I.lo o) (samplePi P.val n) := Integrable.of_finite calc (∫ o, I.hi o - I.lo o ∂ samplePi P.val n) ≤ ∫ _o, min 2 (2 * h) ∂ samplePi P.val n := integral_mono_of_nonneg (Filter.Eventually.of_forall (fun o => sub_nonneg.mpr (I.bounds o).2.1)) (integrable_const _) (Filter.Eventually.of_forall hlen) _ = min 2 (2 * sqrt (CU * rate n d q / α)) := by simp [hmin]
CausalSmith.Stat.MarNearcompleteFrontier.honest_interval_construction · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/THonestInterval.lean:19
CausalSmith.Stat.STAT_MarNearcompleteFrontier_Research.TIntervalFrontier 1 declarations Exact honest connected-interval length frontier

Exact honest connected-interval length frontier

theorem interval_frontier

Fixed-coverage expected length is uniformly comparable to the square-root rate. the stated mathematical conclusion holds. Given the specified input α. Given the specified input hα.

Formal statement
α :
ℝ
hα :
α ∈ Ioo 0 ((1 : ℝ) / 2)
∃ cα Cα : ℝ,
0 < cα
cα < Cα
conclusion 1
n d :
ℕ
q :
ℝ
1 ≤ n
1 ≤ d
q ∈ Icc ((1 : ℝ) / 2) 1
cα * sqrt (rate n d q) ≤ lengthMinimaxRisk n d q α
lengthMinimaxRisk n d q α ≤ Cα * sqrt (rate n d q)
Proof (Lean source)
-- @realizes alpha(fixed noncoverage level in (0,1/2)) theorem interval_frontier (α : ℝ) (hα : α ∈ Ioo 0 ((1 : ℝ) / 2)) : ∃ cα Cα : ℝ, 0 < cα ∧ cα < Cα ∧ ∀ (n d : ℕ) (q : ℝ), 1 ≤ n → 1 ≤ d → q ∈ Icc ((1 : ℝ) / 2) 1 → cα * sqrt (rate n d q) ≤ lengthMinimaxRisk n d q α ∧ lengthMinimaxRisk n d q α ≤ Cα * sqrt (rate n d q) := by obtain ⟨cPoint, c0, hcPoint, hc0, hprior⟩ := prior_reduction obtain ⟨CU, hCU⟩ := upper_risk obtain ⟨cInterval, c0α, hcInterval, hc0α, hbounds⟩ := hprior α hα let cα := cInterval let Cα := cInterval + 2 * sqrt (CU / α) + 1 refine ⟨cα, Cα, hcInterval, ?_, ?_⟩ · have hs : 0 ≤ sqrt (CU / α) := Real.sqrt_nonneg _ dsimp [cα, Cα] linarith intro n d q hn hd hq have hrate : 0 ≤ rate n d q := by unfold rate positivity have hsqrt : 0 ≤ sqrt (rate n d q) := Real.sqrt_nonneg _ constructor · exact (hbounds n d q hn hd hq).2.2.2.2 · have hconstruction := honest_interval_construction n d q α CU hn hd hq hα hCU let I : HonestIntervalClass n d q α := ⟨intervalMM n d q α CU hCU, hconstruction.1⟩ letI : Nonempty (ClassLaw d q) := ⟨pairedClassLaw n d q 0 hn hd hq (by norm_num : (0 : ℝ) ∈ Icc (-1) 1) ⟨fun _ => inr (), fun _ => false⟩⟩ have hsup : (⨆ P : ClassLaw d q, ∫ o, (I.val.hi o - I.val.lo o) ∂ samplePi P.val n) ≤ min 2 (2 * sqrt (CU * rate n d q / α)) := by apply ciSup_le intro P exact hconstruction.2.2.2.1 P have hmin : min 2 (2 * sqrt (CU * rate n d q / α)) ≤ 2 * sqrt (CU / α) * sqrt (rate n d q) := by have heq : CU * rate n d q / α = (CU / α) * rate n d q := by ring rw [heq, Real.sqrt_mul (div_nonneg (le_of_lt hCU.1) (le_of_lt hα.1))] calc min 2 (2 * (sqrt (CU / α) * sqrt (rate n d q))) ≤ 2 * (sqrt (CU / α) * sqrt (rate n d q)) := min_le_right _ _ _ = 2 * sqrt (CU / α) * sqrt (rate n d q) := by ring have hupper : 2 * sqrt (CU / α) * sqrt (rate n d q) ≤ Cα * sqrt (rate n d q) := by apply mul_le_mul_of_nonneg_right _ hsqrt dsimp [Cα] linarith [hcInterval] calc lengthMinimaxRisk n d q α ≤ (⨆ P : ClassLaw d q, ∫ o, (I.val.hi o - I.val.lo o) ∂ samplePi P.val n) := by unfold lengthMinimaxRisk exact ciInf_le (by refine ⟨0, ?_⟩ rintro y ⟨I', rfl⟩ by_cases hb : BddAbove (Set.range fun P : ClassLaw d q => ∫ o, (I'.val.hi o - I'.val.lo o) ∂ samplePi P.val n) · let P0 : ClassLaw d q := pairedClassLaw n d q 0 hn hd hq (by norm_num : (0 : ℝ) ∈ Icc (-1) 1) ⟨fun _ => inr (), fun _ => false⟩ exact le_ciSup_of_le hb P0 (integral_nonneg (fun o => sub_nonneg.mpr (I'.val.bounds o).2.1)) · change 0 ≤ ⨆ P : ClassLaw d q, ∫ o, (I'.val.hi o - I'.val.lo o) ∂ samplePi P.val n rw [ciSup_of_not_bddAbove hb] simp) I _ ≤ min 2 (2 * sqrt (CU * rate n d q / α)) := hsup _ ≤ 2 * sqrt (CU / α) * sqrt (rate n d q) := hmin _ ≤ Cα * sqrt (rate n d q) := hupper
CausalSmith.Stat.MarNearcompleteFrontier.interval_frontier · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/TIntervalFrontier.lean:16
CausalSmith.Stat.STAT_MarNearcompleteFrontier_Research.TNormalizedConverse 3 declarations Both priors are on the legal full-data class.

Normalized same-experiment converse

Both priors are on the legal full-data class. Their predictive laws retain the entire observed record, including membership on nonarrival.

theorem normalized_converse

Paired legal priors have close complete-sample mixtures and separated ATEs. the stated mathematical conclusion holds. Given the specified input β. Given the specified input hβ.

Formal statement
β :
ℝ
hβ :
β ∈ Ioo 0 ((1 : ℝ) / 4)
∃ cβ : ℝ,
0 < cβ
conclusion 1
n d :
ℕ
q :
ℝ
1 ≤ n
1 ≤ d
q ∈ Icc ((1 : ℝ) / 2) 1
gScale n d q ^ 2 ≥ 1 / (n : ℝ)
∃ πminus πplus : PMF (ClassLaw d q),
tvDist (priorPredictive n d q πminus) (priorPredictive n d q πplus) ≤ β
∃ m0 : ℝ,
1 - β ≤ priorEventMass d q πminus (fun P => tau P.val ≤ m0 - cβ * gScale n d q)
1 - β ≤ priorEventMass d q πplus (fun P => m0 + cβ * gScale n d q ≤ tau P.val)
Proof (Lean source)
-- @realizes beta(fixed fuzzy-hypothesis tolerance in (0,1/4)) theorem normalized_converse (β : ℝ) (hβ : β ∈ Ioo 0 ((1 : ℝ) / 4)) : ∃ cβ : ℝ, 0 < cβ ∧ ∀ (n d : ℕ) (q : ℝ), 1 ≤ n → 1 ≤ d → q ∈ Icc ((1 : ℝ) / 2) 1 → gScale n d q ^ 2 ≥ 1 / (n : ℝ) → ∃ πminus πplus : PMF (ClassLaw d q), tvDist (priorPredictive n d q πminus) (priorPredictive n d q πplus) ≤ β ∧ ∃ m0 : ℝ, 1 - β ≤ priorEventMass d q πminus (fun P => tau P.val ≤ m0 - cβ * gScale n d q) ∧ 1 - β ≤ priorEventMass d q πplus (fun P => m0 + cβ * gScale n d q ≤ tau P.val) := by apply normalized_converse_of_eventual_certificate β hβ obtain ⟨NTV, hNTV, htv⟩ := paired_predictive_tv_eventual β hβ.1 obtain ⟨NTarget, hNTarget, c, hc, htarget⟩ := pairedPrior_target_events_eventual β hβ.1 refine ⟨max NTV NTarget, le_max_of_le_left hNTV, c, hc, ?_⟩ intro n d q hnN hd hq hreg have hnTV : NTV ≤ n := (le_max_left _ _).trans hnN have hnTarget : NTarget ≤ n := (le_max_right _ _).trans hnN have hn : 1 ≤ n := le_trans (by omega : 1 ≤ NTV) hnTV refine ⟨(pairedPrior n d q hn hd hq).1, (pairedPrior n d q hn hd hq).2, htv n d q hnTV hn hd hq hreg, ?_⟩ exact htarget n d q hnTarget hn hd hq hreg
CausalSmith.Stat.MarNearcompleteFrontier.normalized_converse · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/TNormalizedConverse.lean:23
def converseConstant

Separation constant extracted from the proved converse at a fixed tolerance.

Definition (Lean source)
β :
ℝ
hβ :
β ∈ Ioo 0 ((1 : ℝ) / 4)
converseConstant β hβ :
ℝ
CausalSmith.Stat.MarNearcompleteFrontier.converseConstant · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/TNormalizedConverse.lean:53
theorem converseConstant_spec

The selected separation constant retains the complete paired-prior certificate. the stated mathematical conclusion holds. Given the specified input β. Given the specified input hβ.

Formal statement
β :
ℝ
hβ :
β ∈ Ioo 0 ((1 : ℝ) / 4)
conclusion 1
0 < converseConstant β hβ
conclusion 2
n d :
ℕ
q :
ℝ
1 ≤ n
1 ≤ d
q ∈ Icc ((1 : ℝ) / 2) 1
gScale n d q ^ 2 ≥ 1 / (n : ℝ)
∃ πminus πplus : PMF (ClassLaw d q),
tvDist (priorPredictive n d q πminus) (priorPredictive n d q πplus) ≤ β
∃ m0 : ℝ,
1 - β
≤ priorEventMass d q πminus (fun P => tau P.val ≤ m0 - converseConstant β hβ * gScale n d q)
1 - β
≤ priorEventMass d q πplus (fun P => m0 + converseConstant β hβ * gScale n d q ≤ tau P.val)
Proof (Lean source)
lemma converseConstant_spec (β : ℝ) (hβ : β ∈ Ioo 0 ((1 : ℝ) / 4)) : 0 < converseConstant β hβ ∧ ∀ (n d : ℕ) (q : ℝ), 1 ≤ n → 1 ≤ d → q ∈ Icc ((1 : ℝ) / 2) 1 → gScale n d q ^ 2 ≥ 1 / (n : ℝ) → ∃ πminus πplus : PMF (ClassLaw d q), tvDist (priorPredictive n d q πminus) (priorPredictive n d q πplus) ≤ β ∧ ∃ m0 : ℝ, 1 - β ≤ priorEventMass d q πminus (fun P => tau P.val ≤ m0 - converseConstant β hβ * gScale n d q) ∧ 1 - β ≤ priorEventMass d q πplus (fun P => m0 + converseConstant β hβ * gScale n d q ≤ tau P.val) := by exact Classical.choose_spec (normalized_converse β hβ)
CausalSmith.Stat.MarNearcompleteFrontier.converseConstant_spec · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/TNormalizedConverse.lean:60
CausalSmith.Stat.STAT_MarNearcompleteFrontier_Research.TParametricFloor 18 declarations The point-risk constant is universal.

One-cell parametric minimax floors

The point-risk constant is universal. The interval constant may depend only on its fixed noncoverage level.

theorem lawClass_mono_floor

Lowering the required arrival floor preserves membership in the MAR class. Given the specified input d, the specified input q, the specified input q', the specified input hqq', the specified input P, the specified input hP, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
q q' :
ℝ
hqq' :
q ≤ q'
P :
hP :
LawClass d q' P
LawClass d q P
Proof (Lean source)
lemma lawClass_mono_floor {d : ℕ} {q q' : ℝ} (hqq' : q ≤ q') {P : FullLaw d} (hP : LawClass d q' P) : LawClass d q P := by refine ⟨hP.randomized, hP.balanced, hP.consistency, hP.mar, ?_⟩ intro x a s hcell exact le_trans hqq' (hP.floor x a s hcell)
CausalSmith.Stat.MarNearcompleteFrontier.lawClass_mono_floor · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/TParametricFloor.lean:22
theorem mar_of_complete_arrival

A law with deterministic outcome arrival satisfies MAR on every cell. Given the specified input d, the specified input P, the specified input hR, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
P :
hR :
∀ w : FullAtom d
if
w.R = false
then
fullMass P w = 0
Proof (Lean source)
lemma mar_of_complete_arrival {d : ℕ} (P : FullLaw d) (hR : ∀ w : FullAtom d, w.R = false → fullMass P w = 0) : MissingAtRandom P := by classical intro x a s r y have erase_arrival (E : FullAtom d → Prop) [DecidablePred E] : massOf P (fun w => E w ∧ w.R = true) = massOf P E := by unfold massOf apply Finset.sum_congr rfl intro w _ by_cases hr : w.R = true · simp [hr] · have hf : w.R = false := by cases h : w.R <;> simp_all simp [hr, hR w hf] have no_nonarrival (E : FullAtom d → Prop) [DecidablePred E] : massOf P (fun w => E w ∧ w.R = false) = 0 := by unfold massOf apply Finset.sum_eq_zero intro w _ by_cases hr : w.R = false · simp [hr, hR w hr] · simp [hr] cases r with | false => have hjoint := no_nonarrival (fun w : FullAtom d => w.X = x ∧ w.A = a ∧ w.S = s ∧ w.Y = y) have hmarg := no_nonarrival (fun w : FullAtom d => w.X = x ∧ w.A = a ∧ w.S = s) have hzero : massOf P (fun w => w.X = x ∧ w.A = a ∧ w.S = s ∧ w.R = false ∧ w.Y = y) = 0 := by simpa only [and_assoc, and_left_comm, and_comm] using hjoint rw [hzero] have hzero' : massOf P (fun w => w.X = x ∧ w.A = a ∧ w.S = s ∧ w.R = false) = 0 := by simpa only [and_assoc] using hmarg rw [hzero'] ring | true => have hjoint := erase_arrival (fun w : FullAtom d => w.X = x ∧ w.A = a ∧ w.S = s ∧ w.Y = y) have hmarg := erase_arrival (fun w : FullAtom d => w.X = x ∧ w.A = a ∧ w.S = s) have heq : massOf P (fun w => w.X = x ∧ w.A = a ∧ w.S = s ∧ w.R = true ∧ w.Y = y) = massOf P (fun w => w.X = x ∧ w.A = a ∧ w.S = s ∧ w.Y = y) := by simpa only [and_assoc, and_left_comm, and_comm] using hjoint have heq' : massOf P (fun w => w.X = x ∧ w.A = a ∧ w.S = s ∧ w.R = true) = cellMass P x a s := by simpa only [cellMass, and_assoc] using hmarg rw [heq, heq'] ring
CausalSmith.Stat.MarNearcompleteFrontier.mar_of_complete_arrival · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/TParametricFloor.lean:30
theorem complete_arrival_mass

An event has the same mass after intersecting with certain arrival. Given the specified input d, the specified input P, the specified input hR, the specified input E, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
P :
hR :
∀ w : FullAtom d
if
w.R = false
then
fullMass P w = 0
E :
FullAtom d → Prop
massOf P (fun w => E w ∧ w.R = true) = massOf P E
Proof (Lean source)
lemma complete_arrival_mass {d : ℕ} (P : FullLaw d) (hR : ∀ w : FullAtom d, w.R = false → fullMass P w = 0) (E : FullAtom d → Prop) : massOf P (fun w => E w ∧ w.R = true) = massOf P E := by classical unfold massOf apply Finset.sum_congr rfl intro w _ by_cases hr : w.R = true · simp [hr] · have hf : w.R = false := by cases h : w.R <;> simp_all simp [hr, hR w hf]
CausalSmith.Stat.MarNearcompleteFrontier.complete_arrival_mass · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/TParametricFloor.lean:85
theorem complete_arrival_floor

Certain arrival meets every arrival floor at most one. Given the specified input d, the specified input P, the specified input q, the specified input hq, the specified input hR, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
P :
q :
ℝ
hq :
q ≤ 1
hR :
∀ w : FullAtom d
if
w.R = false
then
fullMass P w = 0
Proof (Lean source)
lemma complete_arrival_floor {d : ℕ} (P : FullLaw d) (q : ℝ) (hq : q ≤ 1) (hR : ∀ w : FullAtom d, w.R = false → fullMass P w = 0) : ArrivalFloor q P := by intro x a s hcell have heq : massOf P (fun w => w.X = x ∧ w.A = a ∧ w.S = s ∧ w.R = true) = cellMass P x a s := by simpa only [cellMass, and_assoc] using complete_arrival_mass P hR (fun w => w.X = x ∧ w.A = a ∧ w.S = s) rw [arrivalProb, heq, div_self (ne_of_gt hcell)] exact hq
CausalSmith.Stat.MarNearcompleteFrontier.complete_arrival_floor · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/TParametricFloor.lean:100
theorem complete_arrival_lawClass

A randomized, balanced and consistent law with certain arrival is legal. Given the specified input d, the specified input P, the specified input q, the specified input hq, the specified input hrandom, the specified input hbalanced, the specified input hconsistent, the specified input hR, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
P :
q :
ℝ
hq :
q ≤ 1
hbalanced :
hconsistent :
Consistency P
hR :
∀ w : FullAtom d
if
w.R = false
then
fullMass P w = 0
LawClass d q P
Proof (Lean source)
lemma complete_arrival_lawClass {d : ℕ} (P : FullLaw d) (q : ℝ) (hq : q ≤ 1) (hrandom : RandomizedIndependence P) (hbalanced : BalancedRandomization P) (hconsistent : Consistency P) (hR : ∀ w : FullAtom d, w.R = false → fullMass P w = 0) : LawClass d q P := by exact ⟨hrandom, hbalanced, hconsistent, mar_of_complete_arrival P hR, complete_arrival_floor P q hq hR⟩
CausalSmith.Stat.MarNearcompleteFrontier.complete_arrival_lawClass · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/TParametricFloor.lean:115
theorem parametric_oneCell_lawClass

The complete-arrival one-cell Bernoulli family belongs to every required floor class. Given the specified input d, the specified input x, the specified input p, the specified input q, the specified input hp, the specified input hq, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
x :
Fin d
p q :
ℝ
hp :
p ∈ Icc 0 1
hq :
q ≤ 1
Proof (Lean source)
lemma parametric_oneCell_lawClass {d : ℕ} (x : Fin d) (p q : ℝ) (hp : p ∈ Icc 0 1) (hq : q ≤ 1) : LawClass d q (parametricFullLaw x p hp) := by exact complete_arrival_lawClass (parametricFullLaw x p hp) q hq (parametricFullLaw_randomized x p hp) (parametricFullLaw_balanced x p hp) (parametricFullLaw_consistency x p hp) (parametricFullLaw_complete x p hp)
CausalSmith.Stat.MarNearcompleteFrontier.parametric_oneCell_lawClass · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/TParametricFloor.lean:127

The one-record chi-square expression of the one-cell Bernoulli submodel is at most sixteen times the squared half-separation. Given the specified input u, the specified input hu0, the specified input hu1, the stated mathematical conclusion holds.

Formal statement
u :
ℝ
hu0 :
0 ≤ u
hu1 :
u ≤ 1 / 4
8 * u ^ 2 / (1 - 4 * u ^ 2) ≤ 16 * u ^ 2
Proof (Lean source)
lemma parametric_chisq_bound (u : ℝ) (hu0 : 0 ≤ u) (hu1 : u ≤ 1 / 4) : 8 * u ^ 2 / (1 - 4 * u ^ 2) ≤ 16 * u ^ 2 := by have hu_sq : u ^ 2 ≤ 1 / 16 := by nlinarith have hden : 0 < 1 - 4 * u ^ 2 := by nlinarith apply (div_le_iff₀ hden).2 nlinarith [sq_nonneg u]
CausalSmith.Stat.MarNearcompleteFrontier.parametric_chisq_bound · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/TParametricFloor.lean:138
theorem parametric_chisq_identity Lemma parametric_chisq_identity in the paper ↗

The two treated-atom contributions in the paper's one-record calculation. Given the specified input u, the specified input hu0, the specified input hu1, the stated mathematical conclusion holds.

Formal statement
u :
ℝ
hu0 :
0 ≤ u
hu1 :
u ≤ 1 / 4
u ^ 2 * (1 / (1 / 4 + u / 2) + 1 / (1 / 4 - u / 2)) = 8 * u ^ 2 / (1 - 4 * u ^ 2)
Proof (Lean source)
lemma parametric_chisq_identity (u : ℝ) (hu0 : 0 ≤ u) (hu1 : u ≤ 1 / 4) : u ^ 2 * (1 / (1 / 4 + u / 2) + 1 / (1 / 4 - u / 2)) = 8 * u ^ 2 / (1 - 4 * u ^ 2) := by have hplus : 1 / 4 + u / 2 ≠ 0 := by linarith have hminus : 1 / 4 - u / 2 ≠ 0 := by linarith have hden : 1 - 4 * u ^ 2 ≠ 0 := by nlinarith [sq_nonneg u] have hplus' : 2 + u * 4 ≠ 0 := by linarith have hminus' : 2 - u * 4 ≠ 0 := by linarith have hden' : 1 - u ^ 2 * 4 ≠ 0 := by convert hden using 1; ring field_simp [hplus, hminus, hden, hplus', hminus', hden'] ring
CausalSmith.Stat.MarNearcompleteFrontier.parametric_chisq_identity · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/TParametricFloor.lean:148

Equation (45), ready for the product chi-square comparison. Given the specified input u, the specified input hu0, the specified input hu1, the stated mathematical conclusion holds.

Formal statement
u :
ℝ
hu0 :
0 ≤ u
hu1 :
u ≤ 1 / 4
u ^ 2 * (1 / (1 / 4 + u / 2) + 1 / (1 / 4 - u / 2)) ≤ 16 * u ^ 2
Proof (Lean source)
lemma parametric_chisq_le (u : ℝ) (hu0 : 0 ≤ u) (hu1 : u ≤ 1 / 4) : u ^ 2 * (1 / (1 / 4 + u / 2) + 1 / (1 / 4 - u / 2)) ≤ 16 * u ^ 2 := by rw [parametric_chisq_identity u hu0 hu1] exact parametric_chisq_bound u hu0 hu1
CausalSmith.Stat.MarNearcompleteFrontier.parametric_chisq_le · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/TParametricFloor.lean:162
theorem parametric_product_tv_of_chisq

The product chi-square identity and Cauchy--Schwarz give equation (46) once the one-record divergence is bounded by 16u². Given the specified input d, the specified input n, the specified input hac, the specified input u, the specified input hchi, the stated mathematical conclusion holds. Given the specified input μ, the specified input ν.

Formal statement
d n :
ℕ
hac :
μ ≪ ν
u :
ℝ
hchi :
chiSqDiv μ ν ≤ 16 * u ^ 2
tvDist (Measure.pi (fun _ : Fin n => μ)) (Measure.pi (fun _ : Fin n => ν))
≤ (1 / 2 : ℝ) * sqrt (exp (16 * (n : ℝ) * u ^ 2) - 1)
Proof (Lean source)
lemma parametric_product_tv_of_chisq {d n : ℕ} (μ ν : Measure (Obs d)) [IsProbabilityMeasure μ] [IsProbabilityMeasure ν] (hac : μ ≪ ν) (u : ℝ) (hchi : chiSqDiv μ ν ≤ 16 * u ^ 2) : tvDist (Measure.pi (fun _ : Fin n => μ)) (Measure.pi (fun _ : Fin n => ν)) ≤ (1 / 2 : ℝ) * sqrt (exp (16 * (n : ℝ) * u ^ 2) - 1) := by let μn := Measure.pi (fun _ : Fin n => μ) let νn := Measure.pi (fun _ : Fin n => ν) have hint : Integrable (fun x => ((μn.rnDeriv νn x).toReal - 1) ^ 2) νn := Integrable.of_finite have hacn : μn ≪ νn := pi_iid_absolutelyContinuous μ ν hac n have htv := tvDist_le_half_sqrt_chiSqDiv μn νn hacn hint have hprod := Causalean.Stat.one_add_chiSqDiv_pi_iid μ ν hac n have hbase : 0 ≤ 1 + chiSqDiv μ ν := by linarith [chiSqDiv_nonneg (μ := μ) (ν := ν)] have hpow : (1 + chiSqDiv μ ν) ^ n ≤ exp ((n : ℝ) * chiSqDiv μ ν) := by have hbase_exp : 1 + chiSqDiv μ ν ≤ exp (chiSqDiv μ ν) := by linarith [Real.add_one_le_exp (chiSqDiv μ ν)] calc _ ≤ (exp (chiSqDiv μ ν)) ^ n := pow_le_pow_left₀ hbase hbase_exp n _ = _ := by rw [← Real.exp_nat_mul] have hchi_prod : chiSqDiv μn νn ≤ exp (16 * (n : ℝ) * u ^ 2) - 1 := by have hscale : (n : ℝ) * chiSqDiv μ ν ≤ 16 * (n : ℝ) * u ^ 2 := by nlinarith [mul_le_mul_of_nonneg_left hchi (Nat.cast_nonneg n)] have h := hpow.trans (Real.exp_le_exp.mpr hscale) rw [← hprod] at h linarith exact htv.trans (by gcongr)
CausalSmith.Stat.MarNearcompleteFrontier.parametric_product_tv_of_chisq · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/TParametricFloor.lean:170
theorem parametric_product_tv_half

A logarithmic chi-square budget makes the two product laws hard to test. Given the specified input d, the specified input n, the specified input hac, the specified input u, the specified input hchi, the specified input n, the stated mathematical conclusion holds. Given the specified input μ, the specified input ν, the specified input hbudget.

Formal statement
d n :
ℕ
hac :
μ ≪ ν
u :
ℝ
hchi :
chiSqDiv μ ν ≤ 16 * u ^ 2
hbudget :
16 * (n : ℝ) * u ^ 2 ≤ log 2
tvDist (Measure.pi (fun _ : Fin n => μ)) (Measure.pi (fun _ : Fin n => ν))
≤ 1 / 2
Proof (Lean source)
lemma parametric_product_tv_half {d n : ℕ} (μ ν : Measure (Obs d)) [IsProbabilityMeasure μ] [IsProbabilityMeasure ν] (hac : μ ≪ ν) (u : ℝ) (hchi : chiSqDiv μ ν ≤ 16 * u ^ 2) (hbudget : 16 * (n : ℝ) * u ^ 2 ≤ log 2) : tvDist (Measure.pi (fun _ : Fin n => μ)) (Measure.pi (fun _ : Fin n => ν)) ≤ 1 / 2 := by have htv := parametric_product_tv_of_chisq (n := n) μ ν hac u hchi have hexp : exp (16 * (n : ℝ) * u ^ 2) ≤ 2 := by calc _ ≤ exp (log 2) := Real.exp_le_exp.mpr hbudget _ = 2 := Real.exp_log (by norm_num) have hroot : sqrt (exp (16 * (n : ℝ) * u ^ 2) - 1) ≤ 1 := by have h := Real.sqrt_le_sqrt (show exp (16 * (n : ℝ) * u ^ 2) - 1 ≤ 1 by linarith) simpa using h nlinarith
CausalSmith.Stat.MarNearcompleteFrontier.parametric_product_tv_half · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/TParametricFloor.lean:210
theorem parametric_radius_budget Lemma parametric_radius_budget in the paper ↗

A single positive perturbation scale meets the product testing budget at every sample size. the stated mathematical conclusion holds.

Formal statement
∃ a : ℝ,
0 < a
conclusion 1
n :
ℕ
1 ≤ n
0 < a / sqrt n
a / sqrt n ≤ 1 / 4
16 * (n : ℝ) * (a / sqrt n) ^ 2 ≤ log 2
Proof (Lean source)
lemma parametric_radius_budget : ∃ a : ℝ, 0 < a ∧ ∀ n : ℕ, 1 ≤ n → 0 < a / sqrt n ∧ a / sqrt n ≤ 1 / 4 ∧ 16 * (n : ℝ) * (a / sqrt n) ^ 2 ≤ log 2 := by let a : ℝ := min (1 / 4) (sqrt (log 2) / 4) have hlog : 0 < log 2 := Real.log_pos (by norm_num) have ha : 0 < a := lt_min (by norm_num) (by positivity) have haquarter : a ≤ 1 / 4 := min_le_left _ _ have haroot : a ≤ sqrt (log 2) / 4 := min_le_right _ _ refine ⟨a, ha, ?_⟩ intro n hn have hnpos : (0 : ℝ) < n := by exact_mod_cast hn have hroot : 0 < sqrt (n : ℝ) := Real.sqrt_pos.2 hnpos have hroot1 : 1 ≤ sqrt (n : ℝ) := by rw [← Real.sqrt_one] exact Real.sqrt_le_sqrt (by exact_mod_cast hn) have hroot_sq : sqrt (n : ℝ) ^ 2 = n := Real.sq_sqrt (le_of_lt hnpos) have hlogsqrt : 0 ≤ sqrt (log 2) := Real.sqrt_nonneg _ have ha2 : a ^ 2 ≤ log 2 / 16 := by have hright : 0 ≤ sqrt (log 2) / 4 := by positivity have h := mul_nonneg (sub_nonneg.mpr haroot) (add_nonneg (le_of_lt ha) hright) have hsqrt : (sqrt (log 2)) ^ 2 = log 2 := Real.sq_sqrt (le_of_lt hlog) nlinarith [h] constructor · exact div_pos ha hroot constructor · exact (div_le_iff₀ hroot).2 (by nlinarith [haquarter, hroot1]) · have hscale : (n : ℝ) * (a / sqrt n) ^ 2 = a ^ 2 := by have hdiv : (a / sqrt n) * sqrt n = a := div_mul_cancel₀ a (ne_of_gt hroot) calc (n : ℝ) * (a / sqrt n) ^ 2 = ((a / sqrt n) * sqrt n) ^ 2 := by rw [mul_pow, hroot_sq] ring _ = a ^ 2 := by rw [hdiv] calc 16 * (n : ℝ) * (a / sqrt n) ^ 2 = 16 * a ^ 2 := by rw [mul_assoc, hscale] _ ≤ log 2 := by nlinarith [ha2]
CausalSmith.Stat.MarNearcompleteFrontier.parametric_radius_budget · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/TParametricFloor.lean:230
theorem parametric_product_tv_at_radius

For absolutely continuous observed laws, a positive sample size, a radius budget valid at every positive integer, and the stated chi-square bound, the product laws have total variation distance at most one half.

Formal statement
d n :
ℕ
hac :
μ ≪ ν
a :
ℝ
hn :
1 ≤ n
ha :
∀ m : ℕ
if
1 ≤ m
then
0 < a / sqrt m ∧
a / sqrt m ≤ 1 / 4 ∧
16 * (m : ℝ) * (a / sqrt m) ^ 2 ≤ log 2
hchi :
chiSqDiv μ ν ≤ 16 * (a / sqrt n) ^ 2
tvDist (Measure.pi (fun _ : Fin n => μ)) (Measure.pi (fun _ : Fin n => ν))
≤ 1 / 2
Proof (Lean source)
lemma parametric_product_tv_at_radius {d n : ℕ} (μ ν : Measure (Obs d)) [IsProbabilityMeasure μ] [IsProbabilityMeasure ν] (hac : μ ≪ ν) (a : ℝ) (hn : 1 ≤ n) (ha : ∀ m : ℕ, 1 ≤ m → 0 < a / sqrt m ∧ a / sqrt m ≤ 1 / 4 ∧ 16 * (m : ℝ) * (a / sqrt m) ^ 2 ≤ log 2) (hchi : chiSqDiv μ ν ≤ 16 * (a / sqrt n) ^ 2) : tvDist (Measure.pi (fun _ : Fin n => μ)) (Measure.pi (fun _ : Fin n => ν)) ≤ 1 / 2 := by exact parametric_product_tv_half μ ν hac (a / sqrt n) hchi (ha n hn).2.2
CausalSmith.Stat.MarNearcompleteFrontier.parametric_product_tv_at_radius · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/TParametricFloor.lean:277
theorem parametric_product_tv_at_budget

A chi-square budget calibrated to an arbitrary positive testing tolerance. Given the specified input d, the specified input n, the specified input hac, the specified input u, the specified input b, the specified input hb, the specified input hchi, the specified input n, the stated mathematical conclusion holds. Given the specified input μ, the specified input ν, the specified input hbudget.

Formal statement
d n :
ℕ
hac :
μ ≪ ν
u b :
ℝ
hb :
0 ≤ b
hchi :
chiSqDiv μ ν ≤ 16 * u ^ 2
hbudget :
16 * (n : ℝ) * u ^ 2 ≤ log (1 + b ^ 2)
tvDist (Measure.pi (fun _ : Fin n => μ)) (Measure.pi (fun _ : Fin n => ν))
≤ b / 2
Proof (Lean source)
lemma parametric_product_tv_at_budget {d n : ℕ} (μ ν : Measure (Obs d)) [IsProbabilityMeasure μ] [IsProbabilityMeasure ν] (hac : μ ≪ ν) (u b : ℝ) (hb : 0 ≤ b) (hchi : chiSqDiv μ ν ≤ 16 * u ^ 2) (hbudget : 16 * (n : ℝ) * u ^ 2 ≤ log (1 + b ^ 2)) : tvDist (Measure.pi (fun _ : Fin n => μ)) (Measure.pi (fun _ : Fin n => ν)) ≤ b / 2 := by have htv := parametric_product_tv_of_chisq (n := n) μ ν hac u hchi have harg : 0 < 1 + b ^ 2 := by positivity have hexp : exp (16 * (n : ℝ) * u ^ 2) ≤ 1 + b ^ 2 := by calc _ ≤ exp (log (1 + b ^ 2)) := Real.exp_le_exp.mpr hbudget _ = 1 + b ^ 2 := Real.exp_log harg have hroot : sqrt (exp (16 * (n : ℝ) * u ^ 2) - 1) ≤ b := by have h := Real.sqrt_le_sqrt (show exp (16 * (n : ℝ) * u ^ 2) - 1 ≤ b ^ 2 by linarith) simpa [Real.sqrt_sq_eq_abs, abs_of_nonneg hb] using h nlinarith
CausalSmith.Stat.MarNearcompleteFrontier.parametric_product_tv_at_budget · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/TParametricFloor.lean:291
theorem parametric_radius_budget_at_tolerance Lemma parametric_radius_budget_at_tolerance in the paper ↗

The one-cell perturbation can be scaled to any positive interval-testing tolerance. Given the specified input b, the specified input hb, the stated mathematical conclusion holds.

Formal statement
b :
ℝ
hb :
0 < b
∃ a : ℝ,
0 < a
conclusion 1
n :
ℕ
1 ≤ n
0 < a / sqrt n
a / sqrt n ≤ 1 / 4
16 * (n : ℝ) * (a / sqrt n) ^ 2 ≤ log (1 + b ^ 2)
Proof (Lean source)
lemma parametric_radius_budget_at_tolerance (b : ℝ) (hb : 0 < b) : ∃ a : ℝ, 0 < a ∧ ∀ n : ℕ, 1 ≤ n → 0 < a / sqrt n ∧ a / sqrt n ≤ 1 / 4 ∧ 16 * (n : ℝ) * (a / sqrt n) ^ 2 ≤ log (1 + b ^ 2) := by let a : ℝ := min (1 / 4) (sqrt (log (1 + b ^ 2)) / 4) have hb2 : 0 < b ^ 2 := sq_pos_of_pos hb have hlog : 0 < log (1 + b ^ 2) := Real.log_pos (by linarith) have ha : 0 < a := lt_min (by norm_num) (by positivity) have haquarter : a ≤ 1 / 4 := min_le_left _ _ have haroot : a ≤ sqrt (log (1 + b ^ 2)) / 4 := min_le_right _ _ refine ⟨a, ha, ?_⟩ intro n hn have hnpos : (0 : ℝ) < n := by exact_mod_cast hn have hroot : 0 < sqrt (n : ℝ) := Real.sqrt_pos.2 hnpos have hroot1 : 1 ≤ sqrt (n : ℝ) := by rw [← Real.sqrt_one] exact Real.sqrt_le_sqrt (by exact_mod_cast hn) have hroot_sq : sqrt (n : ℝ) ^ 2 = n := Real.sq_sqrt (le_of_lt hnpos) have ha2 : a ^ 2 ≤ log (1 + b ^ 2) / 16 := by have hright : 0 ≤ sqrt (log (1 + b ^ 2)) / 4 := by positivity have h := mul_nonneg (sub_nonneg.mpr haroot) (add_nonneg (le_of_lt ha) hright) have hsqrt : sqrt (log (1 + b ^ 2)) ^ 2 = log (1 + b ^ 2) := Real.sq_sqrt (le_of_lt hlog) nlinarith [h] constructor · exact div_pos ha hroot constructor · exact (div_le_iff₀ hroot).2 (by nlinarith [haquarter, hroot1]) · have hscale : (n : ℝ) * (a / sqrt n) ^ 2 = a ^ 2 := by have hdiv : (a / sqrt n) * sqrt n = a := div_mul_cancel₀ a (ne_of_gt hroot) calc (n : ℝ) * (a / sqrt n) ^ 2 = ((a / sqrt n) * sqrt n) ^ 2 := by rw [mul_pow, hroot_sq] ring _ = a ^ 2 := by rw [hdiv] calc 16 * (n : ℝ) * (a / sqrt n) ^ 2 = 16 * a ^ 2 := by rw [mul_assoc, hscale] _ ≤ log (1 + b ^ 2) := by nlinarith [ha2]
CausalSmith.Stat.MarNearcompleteFrontier.parametric_radius_budget_at_tolerance · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/TParametricFloor.lean:312
theorem parametric_product_tv_at_tolerance_radius

For absolutely continuous observed laws, a nonnegative tolerance, a positive sample size, a tolerance radius budget, and the stated chi-square bound, the product laws have total variation distance at most half the tolerance.

Formal statement
d n :
ℕ
hac :
μ ≪ ν
a b :
ℝ
hb :
0 ≤ b
hn :
1 ≤ n
ha :
∀ m : ℕ
if
1 ≤ m
then
0 < a / sqrt m ∧
a / sqrt m ≤ 1 / 4 ∧
16 * (m : ℝ) * (a / sqrt m) ^ 2 ≤ log (1 + b ^ 2)
hchi :
chiSqDiv μ ν ≤ 16 * (a / sqrt n) ^ 2
tvDist (Measure.pi (fun _ : Fin n => μ)) (Measure.pi (fun _ : Fin n => ν))
≤ b / 2
Proof (Lean source)
lemma parametric_product_tv_at_tolerance_radius {d n : ℕ} (μ ν : Measure (Obs d)) [IsProbabilityMeasure μ] [IsProbabilityMeasure ν] (hac : μ ≪ ν) (a b : ℝ) (hb : 0 ≤ b) (hn : 1 ≤ n) (ha : ∀ m : ℕ, 1 ≤ m → 0 < a / sqrt m ∧ a / sqrt m ≤ 1 / 4 ∧ 16 * (m : ℝ) * (a / sqrt m) ^ 2 ≤ log (1 + b ^ 2)) (hchi : chiSqDiv μ ν ≤ 16 * (a / sqrt n) ^ 2) : tvDist (Measure.pi (fun _ : Fin n => μ)) (Measure.pi (fun _ : Fin n => ν)) ≤ b / 2 := by exact parametric_product_tv_at_budget μ ν hac (a / sqrt n) b hb hchi (ha n hn).2.2
CausalSmith.Stat.MarNearcompleteFrontier.parametric_product_tv_at_tolerance_radius · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/TParametricFloor.lean:359
theorem parametric_oneCell_pair

The central and perturbed one-cell laws form a legal pair with controlled divergence. Given the specified input d, the specified input q, the specified input u, the specified input hd, the specified input hq, the specified input hu, the specified input huquarter, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
q u :
ℝ
hd :
1 ≤ d
hq :
q ≤ 1
hu :
0 < u
huquarter :
u ≤ 1 / 4
∃ P₀ P₁ : ClassLaw d q,
conclusion 1
tau P₀.val = 1 / 2
conclusion 2
tau P₁.val = 1 / 2 + u
conclusion 3
(observedLaw P₁.val).toMeasure ≪ (observedLaw P₀.val).toMeasure
conclusion 4
chiSqDiv (observedLaw P₁.val).toMeasure (observedLaw P₀.val).toMeasure
≤ 16 * u ^ 2
Proof (Lean source)
lemma parametric_oneCell_pair {d : ℕ} {q u : ℝ} (hd : 1 ≤ d) (hq : q ≤ 1) (hu : 0 < u) (huquarter : u ≤ 1 / 4) : ∃ P₀ P₁ : ClassLaw d q, tau P₀.val = 1 / 2 ∧ tau P₁.val = 1 / 2 + u ∧ (observedLaw P₁.val).toMeasure ≪ (observedLaw P₀.val).toMeasure ∧ chiSqDiv (observedLaw P₁.val).toMeasure (observedLaw P₀.val).toMeasure ≤ 16 * u ^ 2 := by let x : Fin d := ⟨0, by omega⟩ have hp₀ : (1 / 2 : ℝ) ∈ Icc 0 1 := by norm_num have hp₁ : (1 / 2 + u : ℝ) ∈ Icc 0 1 := by constructor <;> linarith let P₀ : ClassLaw d q := ⟨parametricFullLaw x (1 / 2) hp₀, parametric_oneCell_lawClass x (1 / 2) q hp₀ hq⟩ let P₁ : ClassLaw d q := ⟨parametricFullLaw x (1 / 2 + u) hp₁, parametric_oneCell_lawClass x (1 / 2 + u) q hp₁ hq⟩ refine ⟨P₀, P₁, ?_, ?_, ?_, ?_⟩ · simpa [P₀] using parametricFullLaw_tau x (1 / 2) hp₀ · simpa [P₁] using parametricFullLaw_tau x (1 / 2 + u) hp₁ · simpa [P₀, P₁] using parametric_observed_ac x (1 / 2 + u) hp₁ · rw [show (observedLaw P₁.val).toMeasure = (observedLaw (parametricFullLaw x (1 / 2 + u) hp₁)).toMeasure by rfl, show (observedLaw P₀.val).toMeasure = (observedLaw (parametricFullLaw x (1 / 2) hp₀)).toMeasure by rfl, parametric_observed_chisq] nlinarith [sq_nonneg u]
CausalSmith.Stat.MarNearcompleteFrontier.parametric_oneCell_pair · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/TParametricFloor.lean:375
theorem parametric_floor

One-cell Bernoulli submodels give the standard parametric floors. the stated mathematical conclusion holds.

Formal statement
∃ c0 : ℝ,
0 < c0
conclusion 1
n d :
ℕ
q :
ℝ
1 ≤ n
1 ≤ d
q ∈ Icc ((1 : ℝ) / 2) 1
c0 / (n : ℝ) ≤ pointMinimaxRisk n d q
conclusion 2
α :
ℝ
α ∈ Ioo 0 ((1 : ℝ) / 2)
∃ cα : ℝ,
0 < cα
n d :
ℕ
q :
ℝ
1 ≤ n
1 ≤ d
q ∈ Icc ((1 : ℝ) / 2) 1
cα / sqrt n ≤ lengthMinimaxRisk n d q α
Proof (Lean source)
lemma parametric_floor : ∃ c0 : ℝ, 0 < c0 ∧ (∀ (n d : ℕ) (q : ℝ), 1 ≤ n → 1 ≤ d → q ∈ Icc ((1 : ℝ) / 2) 1 → c0 / (n : ℝ) ≤ pointMinimaxRisk n d q) ∧ (∀ α : ℝ, α ∈ Ioo 0 ((1 : ℝ) / 2) → ∃ cα : ℝ, 0 < cα ∧ ∀ (n d : ℕ) (q : ℝ), 1 ≤ n → 1 ≤ d → q ∈ Icc ((1 : ℝ) / 2) 1 → cα / sqrt n ≤ lengthMinimaxRisk n d q α) := by obtain ⟨a, ha, hbudget⟩ := parametric_radius_budget refine ⟨a ^ 2 / 16, by positivity, ?_, ?_⟩ · intro n d q hn hd hq let u := a / sqrt n have hu := (hbudget n hn).1 have huquarter := (hbudget n hn).2.1 obtain ⟨P₀, P₁, htau₀, htau₁, hac, hchi⟩ := parametric_oneCell_pair hd hq.2 hu huquarter have htv : tvDist (samplePi P₁.val n) (samplePi P₀.val n) ≤ 1 / 2 := by unfold samplePi exact parametric_product_tv_at_radius (observedLaw P₁.val).toMeasure (observedLaw P₀.val).toMeasure hac a hn hbudget hchi have hlower := parametric_point_pair_lower P₀ P₁ hu htau₀ htau₁ htv have hnpos : (0 : ℝ) < n := by exact_mod_cast hn have hsqrt : sqrt (n : ℝ) ^ 2 = n := Real.sq_sqrt (le_of_lt hnpos) calc (a ^ 2 / 16) / (n : ℝ) = u ^ 2 / 16 := by dsimp [u] rw [div_pow, hsqrt] ring _ ≤ pointMinimaxRisk n d q := hlower · intro α hα let b := 1 - 2 * α have hb : 0 < b := by dsimp [b]; linarith [hα.2] obtain ⟨aα, haα, hbudgetα⟩ := parametric_radius_budget_at_tolerance b hb let cα := aα * b / 2 have hcα : 0 < cα := by dsimp [cα]; positivity refine ⟨cα, hcα, ?_⟩ intro n d q hn hd hq let u := aα / sqrt n have hu := (hbudgetα n hn).1 have huquarter := (hbudgetα n hn).2.1 obtain ⟨P₀, P₁, htau₀, htau₁, hac, hchi⟩ := parametric_oneCell_pair hd hq.2 hu huquarter have htv : tvDist (samplePi P₀.val n) (samplePi P₁.val n) ≤ (1 - 2 * α) / 2 := by have htv' := parametric_product_tv_at_tolerance_radius (observedLaw P₁.val).toMeasure (observedLaw P₀.val).toMeasure hac aα b (le_of_lt hb) hn hbudgetα hchi unfold samplePi rw [tvDist_symm] simpa [b] using htv' have hlower := parametric_interval_pair_lower P₀ P₁ hu (le_of_lt hα.1) htau₀ htau₁ htv calc cα / sqrt n = u * (1 - 2 * α) / 2 := by dsimp [cα, u, b] ring _ ≤ lengthMinimaxRisk n d q α := hlower
CausalSmith.Stat.MarNearcompleteFrontier.parametric_floor · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/TParametricFloor.lean:405
CausalSmith.Stat.STAT_MarNearcompleteFrontier_Research.TPointFrontier 1 declarations Exact all-procedure point-risk frontier

Exact all-procedure point-risk frontier

theorem point_frontier

Universal constants sandwich the finite-sample minimax MSE at the stated rate. the stated mathematical conclusion holds.

Formal statement
∃ c C : ℝ,
0 < c
c < C
conclusion 1
n d :
ℕ
q :
ℝ
1 ≤ n
1 ≤ d
q ∈ Icc ((1 : ℝ) / 2) 1
c * rate n d q ≤ pointMinimaxRisk n d q
pointMinimaxRisk n d q ≤ C * rate n d q
Proof (Lean source)
theorem point_frontier : ∃ c C : ℝ, 0 < c ∧ c < C ∧ ∀ (n d : ℕ) (q : ℝ), 1 ≤ n → 1 ≤ d → -- @realizes n(sample size in Nat≥1) -- @realizes d(baseline alphabet bound in Nat≥1) q ∈ Icc ((1 : ℝ) / 2) 1 → -- @realizes q(known arrival floor in [1/2,1]) c * rate n d q ≤ pointMinimaxRisk n d q ∧ pointMinimaxRisk n d q ≤ C * rate n d q := by obtain ⟨cPoint, c0, hcPoint, hc0, hprior⟩ := prior_reduction obtain ⟨CU, hCU⟩ := upper_risk let c := min cPoint (CU / 2) refine ⟨c, CU, ?_, ?_, ?_⟩ · exact lt_min hcPoint (by linarith [hCU.1]) · exact lt_of_le_of_lt (min_le_right _ _) (by linarith [hCU.1]) intro n d q hn hd hq constructor · obtain ⟨cInterval, c0α, hcInterval, hc0α, hbounds⟩ := hprior (1 / 4) (by constructor <;> norm_num) exact le_trans (mul_le_mul_of_nonneg_right (min_le_left _ _) (by unfold rate positivity)) (hbounds n d q hn hd hq).2.2.2.1 · let T : Estimator n d := ⟨tauhatMM n d q, measurable_tauhatMM n d q, tauhatMM_range n d q⟩ letI : Nonempty (ClassLaw d q) := ⟨pairedClassLaw n d q 0 hn hd hq (by norm_num : (0 : ℝ) ∈ Icc (-1) 1) ⟨fun _ => inr (), fun _ => false⟩⟩ calc pointMinimaxRisk n d q ≤ ⨆ P : ClassLaw d q, ∫ o, (T o - tau P.val) ^ 2 ∂ samplePi P.val n := by unfold pointMinimaxRisk exact ciInf_le (by refine ⟨0, ?_⟩ rintro y ⟨T', rfl⟩ by_cases hb : BddAbove (Set.range fun P : ClassLaw d q => ∫ o, (T' o - tau P.val) ^ 2 ∂ samplePi P.val n) · let P0 : ClassLaw d q := pairedClassLaw n d q 0 hn hd hq (by norm_num : (0 : ℝ) ∈ Icc (-1) 1) ⟨fun _ => inr (), fun _ => false⟩ exact le_ciSup_of_le hb P0 (integral_nonneg (fun _ => sq_nonneg _)) · change 0 ≤ ⨆ P : ClassLaw d q, ∫ o, (T' o - tau P.val) ^ 2 ∂ samplePi P.val n rw [ciSup_of_not_bddAbove hb] simp) T _ ≤ CU * rate n d q := by apply ciSup_le intro P exact hCU.2 n d q hn hd hq P _ rfl
CausalSmith.Stat.MarNearcompleteFrontier.point_frontier · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/TPointFrontier.lean:16
CausalSmith.Stat.STAT_MarNearcompleteFrontier_Research.TPriorReduction 7 declarations This module converts prior separation and parametric floors into interval and combined minimax bounds.

Interval reduction and combined lower frontiers

This module converts prior separation and parametric floors into interval and combined minimax bounds.

theorem priorPredictive_event_from_good

A high-probability event on the concentrated part of a prior remains likely in its mixture. Given the specified input n, the specified input d, the specified input q, the specified input Good, the specified input hgood, the stated mathematical conclusion holds. Given the specified input α, the specified input β, the specified input hα. Given the specified input π, the specified input E, the specified input hE.

Formal statement
n d :
ℕ
q α β :
ℝ
π :
E :
Set (Fin n → Obs d)
Good :
ClassLaw d q → Prop
hα :
0 ≤ α
hgood :
1 - β ≤ priorEventMass d q π Good
hE :
∀ P
if
Good P
then
1 - α ≤ (samplePi P.val n).real E
1 - α - β ≤ (priorPredictive n d q π).real E
Proof (Lean source)
-- @node: priorPredictive_event_from_good lemma priorPredictive_event_from_good {n d : ℕ} {q α β : ℝ} (π : PMF (ClassLaw d q)) (E : Set (Fin n → Obs d)) (Good : ClassLaw d q → Prop) (hα : 0 ≤ α) (hgood : 1 - β ≤ priorEventMass d q π Good) (hE : ∀ P, Good P → 1 - α ≤ (samplePi P.val n).real E) : 1 - α - β ≤ (priorPredictive n d q π).real E := by classical let f : ClassLaw d q → ℝ := fun P => (samplePi P.val n).real E let bad : ClassLaw d q → ℝ := fun P => if Good P then 0 else 1 have hbad : (∫ P, bad P ∂π.toMeasure) ≤ β := by have hfail := priorEventMass_failure_le π Good hgood have hmeas : MeasurableSet {P : ClassLaw d q | ¬ Good P} := trivial have hpoint : bad = {P : ClassLaw d q | ¬ Good P}.indicator (fun _ => 1) := by funext P by_cases h : Good P <;> simp [bad, indicator, h] have hbad_eq : (∫ P, bad P ∂π.toMeasure) = priorEventMass d q π (fun P => ¬ Good P) := by unfold priorEventMass change (∫ P, bad P ∂π.toMeasure) = π.toMeasure.real {P | ¬ Good P} rw [hpoint, integral_indicator hmeas] simp exact hbad_eq.trans_le hfail have hfint : Integrable f π.toMeasure := by have hm : Measurable f := by intro s hs; trivial apply Integrable.of_bound hm.aestronglyMeasurable 1 filter_upwards [] with P haveI : IsProbabilityMeasure (samplePi P.val n) := by unfold samplePi infer_instance have hlo : 0 ≤ f P := measureReal_nonneg have hhi : f P ≤ 1 := measureReal_le_one simp only [Real.norm_eq_abs] exact abs_le.mpr ⟨by linarith, hhi⟩ have hbadint : Integrable bad π.toMeasure := by have hm : Measurable bad := by intro s hs; trivial apply Integrable.of_bound hm.aestronglyMeasurable 1 filter_upwards [] with P by_cases h : Good P <;> simp [bad, h] have hpoint (P : ClassLaw d q) : 1 - α - bad P ≤ f P := by by_cases h : Good P · simpa [bad, h, f] using hE P h · have hnonneg : 0 ≤ f P := measureReal_nonneg simp [bad, h] linarith haveI : IsProbabilityMeasure π.toMeasure := inferInstance have hbound : (∫ P, 1 - α - bad P ∂π.toMeasure) ≤ ∫ P, f P ∂π.toMeasure := integral_mono ((integrable_const (1 - α)).sub hbadint) hfint hpoint have hlin : (∫ P, 1 - α - bad P ∂π.toMeasure) = 1 - α - ∫ P, bad P ∂π.toMeasure := by rw [integral_sub (integrable_const (1 - α)) hbadint] simp rw [hlin] at hbound rw [priorPredictive_event_eq_integral] linarith
CausalSmith.Stat.MarNearcompleteFrontier.priorPredictive_event_from_good · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/TPriorReduction.lean:17
theorem priorPredictive_integral_eq_priorAverage

Integration under a predictive mixture is integration under the prior of sample integrals. Given the specified input n, the specified input d, the specified input q, the stated mathematical conclusion holds. Given the specified input π, the specified input f.

Formal statement
n d :
ℕ
q :
ℝ
π :
f :
(Fin n → Obs d) → ℝ
(∫ o, f o ∂priorPredictive n d q π) = ∫ P, ∫ o, f o ∂samplePi P.val n ∂π.toMeasure
Proof (Lean source)
-- @node: priorPredictive_integral_eq_priorAverage lemma priorPredictive_integral_eq_priorAverage {n d : ℕ} {q : ℝ} (π : PMF (ClassLaw d q)) (f : (Fin n → Obs d) → ℝ) : (∫ o, f o ∂priorPredictive n d q π) = ∫ P, ∫ o, f o ∂samplePi P.val n ∂π.toMeasure := by have hK : Measurable (fun P : ClassLaw d q => samplePi P.val n) := by intro s hs trivial haveI := priorPredictive_isProbability n d q π have hf : Integrable f (priorPredictive n d q π) := Integrable.of_finite simpa [priorPredictive] using (integral_bind hK hf)
CausalSmith.Stat.MarNearcompleteFrontier.priorPredictive_integral_eq_priorAverage · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/TPriorReduction.lean:75
theorem intervalLength_integrable_prior

The bounded interval length is integrable over any legal-law prior. Given the specified input n, the specified input d, the specified input q, the specified input I, the stated mathematical conclusion holds. Given the specified input π.

Formal statement
n d :
ℕ
q :
ℝ
π :
I :
Integrable (fun P : ClassLaw d q => ∫ o, (I.hi o - I.lo o) ∂samplePi P.val n) π.toMeasure
Proof (Lean source)
-- @node: intervalLength_integrable_prior lemma intervalLength_integrable_prior {n d : ℕ} {q : ℝ} (π : PMF (ClassLaw d q)) (I : IntervalProc n d) : Integrable (fun P : ClassLaw d q => ∫ o, (I.hi o - I.lo o) ∂samplePi P.val n) π.toMeasure := by have hmeas : Measurable (fun P : ClassLaw d q => ∫ o, (I.hi o - I.lo o) ∂samplePi P.val n) := by intro s hs trivial apply Integrable.of_bound hmeas.aestronglyMeasurable 2 filter_upwards [] with P haveI : IsProbabilityMeasure (samplePi P.val n) := by unfold samplePi infer_instance have hlo : 0 ≤ ∫ o, (I.hi o - I.lo o) ∂samplePi P.val n := integral_nonneg (fun o => sub_nonneg.mpr (I.bounds o).2.1) have hhi : (∫ o, (I.hi o - I.lo o) ∂samplePi P.val n) ≤ 2 := by have hpoint (o : Fin n → Obs d) : I.hi o - I.lo o ≤ 2 := by have h := I.bounds o linarith have hInt : Integrable (fun o => I.hi o - I.lo o) (samplePi P.val n) := Integrable.of_finite simpa using (integral_mono hInt (integrable_const 2) hpoint) simp only [Real.norm_eq_abs] exact abs_le.mpr ⟨by linarith, hhi⟩
CausalSmith.Stat.MarNearcompleteFrontier.intervalLength_integrable_prior · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/TPriorReduction.lean:89
theorem lengthMinimaxRisk_lower_of_prior

A lower bound on every honest interval's prior-average length passes to minimax length. Given the specified input n, the specified input d, the specified input q, the specified input c, the stated mathematical conclusion holds. Given the specified input α, the specified input hα. Given the specified input π, the specified input h.

Formal statement
n d :
ℕ
q α c :
ℝ
π :
hα :
0 ≤ α
h :
∀ I : HonestIntervalClass n d q α,
c ≤ ∫ P : ClassLaw d q, ∫ o, (I.val.hi o - I.val.lo o) ∂samplePi P.val n ∂π.toMeasure
c ≤ lengthMinimaxRisk n d q α
Proof (Lean source)
-- @node: lengthMinimaxRisk_lower_of_prior lemma lengthMinimaxRisk_lower_of_prior {n d : ℕ} {q α c : ℝ} (π : PMF (ClassLaw d q)) (hα : 0 ≤ α) (h : ∀ I : HonestIntervalClass n d q α, c ≤ ∫ P : ClassLaw d q, ∫ o, (I.val.hi o - I.val.lo o) ∂samplePi P.val n ∂π.toMeasure) : c ≤ lengthMinimaxRisk n d q α := by let Iall : IntervalProc n d := ⟨fun _ => -1, fun _ => 1, measurable_const, measurable_const, fun _ => by constructor <;> norm_num⟩ letI : Nonempty (HonestIntervalClass n d q α) := ⟨⟨Iall, fun P' => by haveI : IsProbabilityMeasure (samplePi P'.val n) := by unfold samplePi infer_instance have hτ := tau_range P'.val have hevent : {o : Fin n → Obs d | tau P'.val ∈ Icc (Iall.lo o) (Iall.hi o)} = univ := by ext o simp [Iall, hτ] rw [hevent, probReal_univ] linarith⟩⟩ unfold lengthMinimaxRisk refine le_ciInf fun I => ?_ let lengthRisk : ClassLaw d q → ℝ := fun P => ∫ o, (I.val.hi o - I.val.lo o) ∂samplePi P.val n have hb : BddAbove (range lengthRisk) := by refine ⟨2, ?_⟩ rintro y ⟨P, rfl⟩ haveI : IsProbabilityMeasure (samplePi P.val n) := by unfold samplePi infer_instance have hpoint (o : Fin n → Obs d) : I.val.hi o - I.val.lo o ≤ 2 := by have hI := I.val.bounds o linarith have hInt : Integrable (fun o => I.val.hi o - I.val.lo o) (samplePi P.val n) := Integrable.of_finite simpa [lengthRisk] using (integral_mono hInt (integrable_const 2) hpoint) let R : ℝ := ⨆ P : ClassLaw d q, lengthRisk P have hpoint (P : ClassLaw d q) : lengthRisk P ≤ R := le_ciSup hb P have havg := priorAverage_le_of_pointwise π lengthRisk R (intervalLength_integrable_prior π I.val) hpoint have hc := h I dsimp [lengthRisk, R] at havg hc ⊢ exact hc.trans havg
CausalSmith.Stat.MarNearcompleteFrontier.lengthMinimaxRisk_lower_of_prior · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/TPriorReduction.lean:116
theorem priorPredictive_intervalLength_ge_event

Length on a predictive sample event bounds its mixture expectation. Given the specified input n, the specified input d, the specified input q, the specified input I, the specified input a, the specified input hE, the stated mathematical conclusion holds. Given the specified input π, the specified input E.

Formal statement
n d :
ℕ
q :
ℝ
π :
I :
E :
Set (Fin n → Obs d)
a :
ℝ
hE :
∀ o ∈ E, a ≤ I.hi o - I.lo o
a * (priorPredictive n d q π).real E
≤ ∫ P : ClassLaw d q, ∫ o, (I.hi o - I.lo o) ∂samplePi P.val n ∂π.toMeasure
Proof (Lean source)
-- @node: priorPredictive_intervalLength_ge_event lemma priorPredictive_intervalLength_ge_event {n d : ℕ} {q : ℝ} (π : PMF (ClassLaw d q)) (I : IntervalProc n d) (E : Set (Fin n → Obs d)) (a : ℝ) (hE : ∀ o ∈ E, a ≤ I.hi o - I.lo o) : a * (priorPredictive n d q π).real E ≤ ∫ P : ClassLaw d q, ∫ o, (I.hi o - I.lo o) ∂samplePi P.val n ∂π.toMeasure := by haveI := priorPredictive_isProbability n d q π have hmeas : MeasurableSet E := (Set.toFinite E).measurableSet have hpoint (o : Fin n → Obs d) : E.indicator (fun _ => a) o ≤ I.hi o - I.lo o := by by_cases ho : o ∈ E · simpa [indicator, ho] using hE o ho · have hnonneg := (I.bounds o).2.1 simpa [indicator, ho] using hnonneg have hInt : Integrable (E.indicator (fun _ : Fin n → Obs d => a)) (priorPredictive n d q π) := Integrable.of_finite have hLen : Integrable (fun o => I.hi o - I.lo o) (priorPredictive n d q π) := Integrable.of_finite have hbound := integral_mono hInt hLen hpoint calc a * (priorPredictive n d q π).real E = ∫ o, E.indicator (fun _ => a) o ∂priorPredictive n d q π := by simp [integral_indicator hmeas, mul_comm] _ ≤ ∫ o, I.hi o - I.lo o ∂priorPredictive n d q π := hbound _ = ∫ P, ∫ o, I.hi o - I.lo o ∂samplePi P.val n ∂π.toMeasure := priorPredictive_integral_eq_priorAverage π _
CausalSmith.Stat.MarNearcompleteFrontier.priorPredictive_intervalLength_ge_event · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/TPriorReduction.lean:163
theorem priorIntervalRisk_separation

The normalized converse gives the stated 5/4 interval-length coefficient. Given the specified input n, the specified input d, the specified input q, the specified input hn, the specified input hd, the specified input n, the stated mathematical conclusion holds. Given the specified input α. Given the specified input hα, the specified input hq, the specified input hlarge.

Formal statement
α :
ℝ
hα :
α ∈ Ioo 0 ((1 : ℝ) / 2)
n d :
ℕ
q :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
hlarge :
gScale n d q ^ 2 ≥ 1 / (n : ℝ)
(5 / 4 : ℝ) * converseConstant (intervalBeta α) (intervalBeta_valid α hα) * (1 - 2 * α) * gScale n d q
≤ lengthMinimaxRisk n d q α
Proof (Lean source)
-- @node: priorIntervalRisk_separation lemma priorIntervalRisk_separation (α : ℝ) (hα : α ∈ Ioo 0 ((1 : ℝ) / 2)) (n d : ℕ) (q : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (hlarge : gScale n d q ^ 2 ≥ 1 / (n : ℝ)) : (5 / 4 : ℝ) * converseConstant (intervalBeta α) (intervalBeta_valid α hα) * (1 - 2 * α) * gScale n d q ≤ lengthMinimaxRisk n d q α := by let β := intervalBeta α let a := converseConstant β (intervalBeta_valid α hα) * gScale n d q obtain ⟨πminus, πplus, htv, m, hm, hp⟩ := (converseConstant_spec β (intervalBeta_valid α hα)).2 n d q hn hd hq hlarge have ha : 0 ≤ a := mul_nonneg (le_of_lt (converseConstant_spec β (intervalBeta_valid α hα)).1) (gScale_nonneg_of_q n d q hq) apply lengthMinimaxRisk_lower_of_prior πplus (le_of_lt hα.1) intro I let EL : Set (Fin n → Obs d) := {o | I.val.lo o ≤ m - a} let ER : Set (Fin n → Obs d) := {o | m + a ≤ I.val.hi o} have hL : 1 - α - β ≤ (priorPredictive n d q πminus).real EL := by apply priorPredictive_event_from_good πminus EL (fun P => tau P.val ≤ m - a) (le_of_lt hα.1) hm intro P hP haveI : IsProbabilityMeasure (samplePi P.val n) := by unfold samplePi infer_instance have hcov := I.property P have hsub : {o | tau P.val ∈ Icc (I.val.lo o) (I.val.hi o)} ⊆ EL := by intro o ho exact le_trans ho.1 hP exact hcov.trans (measureReal_mono hsub (measure_ne_top _ _)) have hR : 1 - α - β ≤ (priorPredictive n d q πplus).real ER := by apply priorPredictive_event_from_good πplus ER (fun P => m + a ≤ tau P.val) (le_of_lt hα.1) hp intro P hP haveI : IsProbabilityMeasure (samplePi P.val n) := by unfold samplePi infer_instance have hcov := I.property P have hsub : {o | tau P.val ∈ Icc (I.val.lo o) (I.val.hi o)} ⊆ ER := by intro o ho exact le_trans hP ho.2 exact hcov.trans (measureReal_mono hsub (measure_ne_top _ _)) have hinter := priorPredictive_separated_intersection πminus πplus htv EL ER hL hR have hlen := priorPredictive_intervalLength_ge_event πplus I.val (EL ∩ ER) (2 * a) (by intro o ho rcases ho with ⟨hoL, hoR⟩ change I.val.lo o ≤ m - a at hoL change m + a ≤ I.val.hi o at hoR linarith) have hmass : 2 * a * (1 - 2 * α - 3 * β) ≤ 2 * a * (priorPredictive n d q πplus).real (EL ∩ ER) := mul_le_mul_of_nonneg_left hinter (by linarith) dsimp [a, β, intervalBeta] at hmass hlen ⊢ nlinarith
CausalSmith.Stat.MarNearcompleteFrontier.priorIntervalRisk_separation · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/TPriorReduction.lean:193
theorem prior_reduction

Explicit fuzzy-prior constants, parametric floors and combined lower rates. the stated mathematical conclusion holds.

Formal statement
∃ cPoint c0 : ℝ,
0 < cPoint
0 < c0
conclusion 1
α :
ℝ
hα :
α ∈ Ioo 0 ((1 : ℝ) / 2)
∃ cInterval c0α : ℝ,
0 < cInterval
0 < c0α
n d :
ℕ
q :
ℝ
1 ≤ n
1 ≤ d
q ∈ Icc ((1 : ℝ) / 2) 1
gScale n d q ^ 2 ≥ 1 / (n : ℝ)
(13 / 32 : ℝ) * converseConstant pointBeta pointBeta_valid ^ 2 * gScale n d q ^ 2
(5 / 4 : ℝ) * converseConstant (intervalBeta α) (intervalBeta_valid α hα) * (1 - 2 * α) * gScale n d q
≤ lengthMinimaxRisk n d q α
c0 / (n : ℝ) ≤ pointMinimaxRisk n d q
c0α / sqrt n ≤ lengthMinimaxRisk n d q α
cPoint * rate n d q ≤ pointMinimaxRisk n d q
cInterval * sqrt (rate n d q) ≤ lengthMinimaxRisk n d q α
Proof (Lean source)
lemma prior_reduction : ∃ cPoint c0 : ℝ, 0 < cPoint ∧ 0 < c0 ∧ ∀ (α : ℝ) (hα : α ∈ Ioo 0 ((1 : ℝ) / 2)), ∃ cInterval c0α : ℝ, 0 < cInterval ∧ 0 < c0α ∧ ∀ (n d : ℕ) (q : ℝ), 1 ≤ n → 1 ≤ d → q ∈ Icc ((1 : ℝ) / 2) 1 → (gScale n d q ^ 2 ≥ 1 / (n : ℝ) → (13 / 32 : ℝ) * converseConstant pointBeta pointBeta_valid ^ 2 * gScale n d q ^ 2 ≤ pointMinimaxRisk n d q ∧ (5 / 4 : ℝ) * converseConstant (intervalBeta α) (intervalBeta_valid α hα) * (1 - 2 * α) * gScale n d q ≤ lengthMinimaxRisk n d q α) ∧ c0 / (n : ℝ) ≤ pointMinimaxRisk n d q ∧ c0α / sqrt n ≤ lengthMinimaxRisk n d q α ∧ cPoint * rate n d q ≤ pointMinimaxRisk n d q ∧ cInterval * sqrt (rate n d q) ≤ lengthMinimaxRisk n d q α := by obtain ⟨c0, hc0, hfloorPoint, hfloorInterval⟩ := parametric_floor let cSepPoint : ℝ := (13 / 32 : ℝ) * converseConstant pointBeta pointBeta_valid ^ 2 have hcSepPoint : 0 < cSepPoint := by dsimp [cSepPoint] have hc := (converseConstant_spec pointBeta pointBeta_valid).1 positivity refine ⟨min c0 cSepPoint / 2, c0, ?_, hc0, ?_⟩ · positivity intro α hα obtain ⟨c0α, hc0α, hfloorα⟩ := hfloorInterval α hα let cSepInterval : ℝ := (5 / 4 : ℝ) * converseConstant (intervalBeta α) (intervalBeta_valid α hα) * (1 - 2 * α) have hcSepInterval : 0 < cSepInterval := by dsimp [cSepInterval] have hc := (converseConstant_spec (intervalBeta α) (intervalBeta_valid α hα)).1 have hfac : 0 < 1 - 2 * α := by linarith [hα.2] positivity refine ⟨min c0α cSepInterval / 2, c0α, ?_, hc0α, ?_⟩ · positivity intro n d q hn hd hq have hPointSep : gScale n d q ^ 2 ≥ 1 / (n : ℝ) → cSepPoint * gScale n d q ^ 2 ≤ pointMinimaxRisk n d q := by intro hlarge exact priorPointRisk_separation n d q hn hd hq hlarge have hIntervalSep : gScale n d q ^ 2 ≥ 1 / (n : ℝ) → cSepInterval * gScale n d q ≤ lengthMinimaxRisk n d q α := by intro hlarge exact priorIntervalRisk_separation α hα n d q hn hd hq hlarge have hPointFloor := hfloorPoint n d q hn hd hq have hIntervalFloor := hfloorα n d q hn hd hq have hPointRate := pointRate_from_floor_and_separation n d q c0 cSepPoint (pointMinimaxRisk n d q) hn (le_of_lt hc0) (le_of_lt hcSepPoint) hPointFloor hPointSep have hIntervalRate := intervalRate_from_floor_and_separation n d q c0α cSepInterval (lengthMinimaxRisk n d q α) hn (le_of_lt hc0α) (le_of_lt hcSepInterval) hIntervalFloor hIntervalSep hq exact ⟨fun hlarge => ⟨hPointSep hlarge, hIntervalSep hlarge⟩, hPointFloor, hIntervalFloor, hPointRate, hIntervalRate⟩
CausalSmith.Stat.MarNearcompleteFrontier.prior_reduction · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/TPriorReduction.lean:255
CausalSmith.Stat.STAT_MarNearcompleteFrontier_Research.TPriorReductionPoint 27 declarations This is the paper's reduction from the normalized paired prior and one-cell parametric floor to the combined point and interval lower frontiers.

Fuzzy-prior and interval lower-bound reduction

This is the paper's reduction from the normalized paired prior and one-cell parametric floor to the combined point and interval lower frontiers.

theorem priorPredictive_isProbability

Mixing the legal iid sample laws under a prior gives a probability law. Given the specified input n, the specified input d, the specified input q, the stated mathematical conclusion holds. Given the specified input π.

Formal statement
n d :
ℕ
q :
ℝ
π :
IsProbabilityMeasure (priorPredictive n d q π)
Proof (Lean source)
-- @node: priorPredictive_isProbability lemma priorPredictive_isProbability (n d : ℕ) (q : ℝ) (π : PMF (ClassLaw d q)) : IsProbabilityMeasure (priorPredictive n d q π) := by unfold priorPredictive have hsample : Measurable (fun P : ClassLaw d q => samplePi P.val n) := by intro s hs trivial have hsample_prob (P : ClassLaw d q) : IsProbabilityMeasure (samplePi P.val n) := by unfold samplePi infer_instance exact isProbabilityMeasure_bind hsample.aemeasurable (Filter.Eventually.of_forall hsample_prob)
CausalSmith.Stat.MarNearcompleteFrontier.priorPredictive_isProbability · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/TPriorReductionPoint.lean:19
theorem priorPredictive_event_eq_integral

A predictive event has probability equal to its prior-averaged sample probability. Given the specified input n, the specified input d, the specified input q, the stated mathematical conclusion holds. Given the specified input π, the specified input E.

Formal statement
n d :
ℕ
q :
ℝ
π :
E :
Set (Fin n → Obs d)
(priorPredictive n d q π).real E = ∫ P, (samplePi P.val n).real E ∂π.toMeasure
Proof (Lean source)
lemma priorPredictive_event_eq_integral (n d : ℕ) (q : ℝ) (π : PMF (ClassLaw d q)) (E : Set (Fin n → Obs d)) : (priorPredictive n d q π).real E = ∫ P, (samplePi P.val n).real E ∂π.toMeasure := by let K : ClassLaw d q → Measure (Fin n → Obs d) := fun P => samplePi P.val n have hK : Measurable K := by intro s hs trivial have hprob : ∀ P, IsProbabilityMeasure (K P) := by intro P dsimp [K, samplePi] infer_instance haveI : IsProbabilityMeasure (priorPredictive n d q π) := priorPredictive_isProbability n d q π have hE : MeasurableSet E := (Set.toFinite E).measurableSet let f : (Fin n → Obs d) → ℝ := E.indicator (fun _ => 1) have hfm : Measurable f := measurable_const.indicator hE have hfint : Integrable f (priorPredictive n d q π) := Integrable.of_bound hfm.aestronglyMeasurable 1 (Filter.Eventually.of_forall fun z => by simp only [f, indicator] split <;> simp) calc (priorPredictive n d q π).real E = ∫ z in E, (1 : ℝ) ∂(priorPredictive n d q π) := by simp _ = ∫ z, f z ∂(priorPredictive n d q π) := by rw [integral_indicator hE] _ = ∫ P, ∫ z, f z ∂K P ∂π.toMeasure := by simpa [priorPredictive, K] using (integral_bind hK hfint) _ = ∫ P, (samplePi P.val n).real E ∂π.toMeasure := by congr 1 funext P rw [show f = E.indicator (fun _ => (1 : ℝ)) from rfl, integral_indicator hE] simp [K]
CausalSmith.Stat.MarNearcompleteFrontier.priorPredictive_event_eq_integral · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/TPriorReductionPoint.lean:36
theorem priorPredictive_event_transfer

Total variation transfers any sample-event lower bound between the two mixtures. Given the specified input n, the specified input d, the specified input q, the stated mathematical conclusion holds. Given the specified input β. Given the specified input πminus, the specified input πplus, the specified input htv, the specified input E.

Formal statement
n d :
ℕ
q β :
ℝ
πminus πplus :
htv :
tvDist (priorPredictive n d q πminus) (priorPredictive n d q πplus) ≤ β
E :
Set (Fin n → Obs d)
(priorPredictive n d q πminus).real E - β ≤ (priorPredictive n d q πplus).real E
Proof (Lean source)
-- @node: priorPredictive_event_transfer lemma priorPredictive_event_transfer {n d : ℕ} {q β : ℝ} (πminus πplus : PMF (ClassLaw d q)) (htv : tvDist (priorPredictive n d q πminus) (priorPredictive n d q πplus) ≤ β) (E : Set (Fin n → Obs d)) : (priorPredictive n d q πminus).real E - β ≤ (priorPredictive n d q πplus).real E := by haveI := priorPredictive_isProbability n d q πminus haveI := priorPredictive_isProbability n d q πplus have hE : MeasurableSet E := (Set.toFinite E).measurableSet have h := abs_measureReal_sub_le_tvDist (μ := priorPredictive n d q πminus) (ν := priorPredictive n d q πplus) hE have hdiff := (abs_le.mp h).2 linarith
CausalSmith.Stat.MarNearcompleteFrontier.priorPredictive_event_transfer · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/TPriorReductionPoint.lean:73
theorem priorPredictive_separated_intersection

Two high-probability hits under the fuzzy priors overlap under the plus mixture. Given the specified input n, the specified input d, the specified input q, the stated mathematical conclusion holds. Given the specified input α, the specified input β. Given the specified input πminus, the specified input πplus, the specified input htv, the specified input Eleft, the specified input Eright, the specified input hleft, the specified input hright.

Formal statement
n d :
ℕ
q α β :
ℝ
πminus πplus :
htv :
tvDist (priorPredictive n d q πminus) (priorPredictive n d q πplus) ≤ β
Eleft Eright :
Set (Fin n → Obs d)
hleft :
1 - α - β ≤ (priorPredictive n d q πminus).real Eleft
hright :
1 - α - β ≤ (priorPredictive n d q πplus).real Eright
1 - 2 * α - 3 * β ≤ (priorPredictive n d q πplus).real (Eleft ∩ Eright)
Proof (Lean source)
lemma priorPredictive_separated_intersection {n d : ℕ} {q α β : ℝ} (πminus πplus : PMF (ClassLaw d q)) (htv : tvDist (priorPredictive n d q πminus) (priorPredictive n d q πplus) ≤ β) (Eleft Eright : Set (Fin n → Obs d)) (hleft : 1 - α - β ≤ (priorPredictive n d q πminus).real Eleft) (hright : 1 - α - β ≤ (priorPredictive n d q πplus).real Eright) : 1 - 2 * α - 3 * β ≤ (priorPredictive n d q πplus).real (Eleft ∩ Eright) := by letI := priorPredictive_isProbability n d q πplus have htransfer := priorPredictive_event_transfer πminus πplus htv Eleft have hmeas : MeasurableSet Eright := (Set.toFinite Eright).measurableSet have hfinite : (priorPredictive n d q πplus) (Eleft ∪ Eright) ≠ ⊤ := by exact measure_ne_top _ _ have hsum := measureReal_union_add_inter hmeas (show (priorPredictive n d q πplus) Eleft ≠ ⊤ by exact measure_ne_top _ _) (show (priorPredictive n d q πplus) Eright ≠ ⊤ by exact measure_ne_top _ _) have hunion : (priorPredictive n d q πplus).real (Eleft ∪ Eright) ≤ 1 := by simpa using (measureReal_mono (Set.subset_univ _) hfinite) linarith
CausalSmith.Stat.MarNearcompleteFrontier.priorPredictive_separated_intersection · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/TPriorReductionPoint.lean:92
def pointBeta

Fixed fuzzy-hypothesis tolerance for point risk.

Definition (Lean source)
pointBeta :
ℝ
1 / 16
theorem pointBeta_valid

The fixed point-risk tolerance lies strictly between zero and one quarter.

Formal statement
pointBeta ∈ Ioo 0 ((1 : ℝ) / 4)
Proof (Lean source)
lemma pointBeta_valid : pointBeta ∈ Ioo 0 ((1 : ℝ) / 4) := by unfold pointBeta constructor <;> norm_num
CausalSmith.Stat.MarNearcompleteFrontier.pointBeta_valid · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/TPriorReductionPoint.lean:116
def intervalBeta

Tolerance used in the honest-interval reduction.

Definition (Lean source)
α :
ℝ
intervalBeta α :
ℝ
(1 - 2 * α) / 8
theorem intervalBeta_valid

For a confidence level strictly between zero and one half, the interval-risk tolerance lies strictly between zero and one quarter.

Formal statement
α :
ℝ
hα :
α ∈ Ioo 0 ((1 : ℝ) / 2)
intervalBeta α ∈ Ioo 0 ((1 : ℝ) / 4)
Proof (Lean source)
lemma intervalBeta_valid (α : ℝ) (hα : α ∈ Ioo 0 ((1 : ℝ) / 2)) : intervalBeta α ∈ Ioo 0 ((1 : ℝ) / 4) := by rcases hα with ⟨hα0, hα1⟩ unfold intervalBeta constructor <;> linarith
CausalSmith.Stat.MarNearcompleteFrontier.intervalBeta_valid · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/TPriorReductionPoint.lean:123
theorem gScale_nonneg_of_q

The missingness scale is nonnegative on the model's arrival-floor range. Given the specified input n, the specified input d, the specified input q, the stated mathematical conclusion holds. Given the specified input hq.

Formal statement
n d :
ℕ
q :
ℝ
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
0 ≤ gScale n d q
Proof (Lean source)
lemma gScale_nonneg_of_q (n d : ℕ) (q : ℝ) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) : 0 ≤ gScale n d q := by have hδ : 0 ≤ delta q := by unfold delta linarith [hq.2] have hn : 0 ≤ (n : ℝ) := Nat.cast_nonneg _ have hd : 0 ≤ (d : ℝ) := Nat.cast_nonneg _ have hL : 0 ≤ ell n := le_of_lt (by unfold ell apply Real.log_pos have he : (1 : ℝ) < exp 1 := Real.one_lt_exp_iff.mpr (by norm_num) linarith) unfold gScale exact mul_nonneg hδ (le_min (by norm_num) (div_nonneg hd (mul_nonneg hn hL)))
CausalSmith.Stat.MarNearcompleteFrontier.gScale_nonneg_of_q · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/TPriorReductionPoint.lean:131
theorem pointRate_from_floor_and_separation

The parametric floor and the separation bound combine into the point-risk rate. Given the specified input n, the specified input d, the specified input q, the specified input c0, the specified input cSep, the specified input R, the specified input hn, the specified input hc0, the specified input hcSep, the specified input n, the specified input n, the stated mathematical conclusion holds. Given the specified input hfloor, the specified input hsep.

Formal statement
n d :
ℕ
q c0 cSep R :
ℝ
hn :
1 ≤ n
hc0 :
0 ≤ c0
hcSep :
0 ≤ cSep
hfloor :
c0 / (n : ℝ) ≤ R
hsep :
gScale n d q ^ 2 ≥ 1 / (n : ℝ) → cSep * gScale n d q ^ 2 ≤ R
min c0 cSep / 2 * rate n d q ≤ R
Proof (Lean source)
lemma pointRate_from_floor_and_separation (n d : ℕ) (q c0 cSep R : ℝ) (hn : 1 ≤ n) (hc0 : 0 ≤ c0) (hcSep : 0 ≤ cSep) (hfloor : c0 / (n : ℝ) ≤ R) (hsep : gScale n d q ^ 2 ≥ 1 / (n : ℝ) → cSep * gScale n d q ^ 2 ≤ R) : min c0 cSep / 2 * rate n d q ≤ R := by have hn0 : (0 : ℝ) ≤ (n : ℝ) := by exact_mod_cast (zero_le n) have hx : 0 ≤ (1 : ℝ) / (n : ℝ) := by positivity have hy : 0 ≤ gScale n d q ^ 2 := sq_nonneg _ have hc0' : min c0 cSep / 2 ≤ c0 / 2 := by linarith [min_le_left c0 cSep] have hcSep' : min c0 cSep / 2 ≤ cSep / 2 := by linarith [min_le_right c0 cSep] have hcmin : 0 ≤ min c0 cSep / 2 := by exact div_nonneg (le_min hc0 hcSep) (by norm_num) by_cases hlarge : 1 / (n : ℝ) ≤ gScale n d q ^ 2 · have h := hsep hlarge rw [rate] calc min c0 cSep / 2 * (1 / (n : ℝ) + gScale n d q ^ 2) ≤ min c0 cSep / 2 * (2 * gScale n d q ^ 2) := by exact mul_le_mul_of_nonneg_left (by linarith) hcmin _ ≤ cSep * gScale n d q ^ 2 := by nlinarith [mul_nonneg (sub_nonneg.mpr (by linarith : 0 ≤ cSep - 2 * (min c0 cSep / 2))) hy] _ ≤ R := h · have hsmall : gScale n d q ^ 2 ≤ 1 / (n : ℝ) := le_of_lt (lt_of_not_ge hlarge) rw [rate] calc min c0 cSep / 2 * (1 / (n : ℝ) + gScale n d q ^ 2) ≤ min c0 cSep / 2 * (2 * (1 / (n : ℝ))) := by exact mul_le_mul_of_nonneg_left (by linarith) hcmin _ ≤ c0 * (1 / (n : ℝ)) := by nlinarith [mul_nonneg (sub_nonneg.mpr (by linarith : 0 ≤ c0 - 2 * (min c0 cSep / 2))) hx] _ = c0 / (n : ℝ) := by ring _ ≤ R := hfloor
CausalSmith.Stat.MarNearcompleteFrontier.pointRate_from_floor_and_separation · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/TPriorReductionPoint.lean:149
theorem intervalRate_from_floor_and_separation

The parametric floor and separated-prior bound combine into the interval rate. Given the specified input n, the specified input d, the specified input q, the specified input c0, the specified input cSep, the specified input R, the specified input hn, the specified input hc0, the specified input hcSep, the specified input hfloor, the specified input n, the stated mathematical conclusion holds. Given the specified input hsep, the specified input hq.

Formal statement
n d :
ℕ
q c0 cSep R :
ℝ
hn :
1 ≤ n
hc0 :
0 ≤ c0
hcSep :
0 ≤ cSep
hfloor :
c0 / sqrt n ≤ R
hsep :
gScale n d q ^ 2 ≥ 1 / (n : ℝ) → cSep * gScale n d q ≤ R
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
min c0 cSep / 2 * sqrt (rate n d q) ≤ R
Proof (Lean source)
lemma intervalRate_from_floor_and_separation (n d : ℕ) (q c0 cSep R : ℝ) (hn : 1 ≤ n) (hc0 : 0 ≤ c0) (hcSep : 0 ≤ cSep) (hfloor : c0 / sqrt n ≤ R) (hsep : gScale n d q ^ 2 ≥ 1 / (n : ℝ) → cSep * gScale n d q ≤ R) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) : min c0 cSep / 2 * sqrt (rate n d q) ≤ R := by have hg : 0 ≤ gScale n d q := gScale_nonneg_of_q n d q hq have hnpos : (0 : ℝ) < n := by exact_mod_cast hn have hroot : 0 < sqrt (n : ℝ) := Real.sqrt_pos.2 hnpos have hroot_sq : sqrt (n : ℝ) ^ 2 = n := Real.sq_sqrt (le_of_lt hnpos) have hx : 0 ≤ (1 : ℝ) / n := by positivity have hrate : 0 ≤ rate n d q := by unfold rate; positivity have hsqrt : 0 ≤ sqrt (rate n d q) := Real.sqrt_nonneg _ have hsqrt_sq : sqrt (rate n d q) ^ 2 = rate n d q := Real.sq_sqrt hrate have hc : 0 ≤ min c0 cSep / 2 := by positivity by_cases hlarge : 1 / (n : ℝ) ≤ gScale n d q ^ 2 · have hbound : sqrt (rate n d q) ≤ 2 * gScale n d q := by rw [rate] rw [rate] at hsqrt_sq nlinarith only [hsqrt_sq, hlarge, hg, hsqrt] calc min c0 cSep / 2 * sqrt (rate n d q) ≤ min c0 cSep / 2 * (2 * gScale n d q) := mul_le_mul_of_nonneg_left hbound hc _ ≤ cSep * gScale n d q := by nlinarith [min_le_right c0 cSep] _ ≤ R := hsep hlarge · have hsmall : gScale n d q ^ 2 ≤ 1 / (n : ℝ) := le_of_lt (lt_of_not_ge hlarge) have hbound : sqrt (rate n d q) ≤ 2 / sqrt n := by rw [rate] rw [rate] at hsqrt_sq have hrecip : (1 : ℝ) / n = 1 / sqrt n ^ 2 := by rw [hroot_sq] rw [hrecip] at hsmall hsqrt_sq rw [hrecip] have hpow : (1 : ℝ) / sqrt n ^ 2 = (1 / sqrt n) ^ 2 := by ring rw [hpow] at hsmall hsqrt_sq ⊢ have hy : 0 ≤ 1 / sqrt (n : ℝ) := by positivity have hs : 0 ≤ sqrt ((1 / sqrt n) ^ 2 + gScale n d q ^ 2) := Real.sqrt_nonneg _ have htwo : 2 / sqrt n = 2 * (1 / sqrt n) := by ring rw [htwo] nlinarith only [hsqrt_sq, hsmall, hs, hy] calc min c0 cSep / 2 * sqrt (rate n d q) ≤ min c0 cSep / 2 * (2 / sqrt n) := mul_le_mul_of_nonneg_left hbound hc _ ≤ c0 / sqrt n := by have hmin : min c0 cSep ≤ c0 := min_le_left _ _ calc min c0 cSep / 2 * (2 / sqrt n) = min c0 cSep / sqrt n := by ring _ ≤ c0 / sqrt n := div_le_div_of_nonneg_right hmin (le_of_lt hroot) _ ≤ R := hfloor
CausalSmith.Stat.MarNearcompleteFrontier.intervalRate_from_floor_and_separation · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/TPriorReductionPoint.lean:189
theorem priorEventMass_complement

Prior mass of a target failure is the complement of target success. Given the specified input d, the specified input q, the specified input E, the stated mathematical conclusion holds. Given the specified input π.

Formal statement
d :
ℕ
q :
ℝ
π :
E :
ClassLaw d q → Prop
priorEventMass d q π (fun P => ¬ E P) = 1 - priorEventMass d q π E
Proof (Lean source)
-- @node: priorEventMass_complement lemma priorEventMass_complement {d : ℕ} {q : ℝ} (π : PMF (ClassLaw d q)) (E : ClassLaw d q → Prop) : priorEventMass d q π (fun P => ¬ E P) = 1 - priorEventMass d q π E := by classical unfold priorEventMass have hE : MeasurableSet {P : ClassLaw d q | E P} := trivial simpa only [show {P : ClassLaw d q | ¬ E P} = {P | E P}ᶜ by rfl, probReal_univ] using (measureReal_compl hE : π.toMeasure.real {P : ClassLaw d q | E P}ᶜ = π.toMeasure.real univ - π.toMeasure.real {P | E P})
CausalSmith.Stat.MarNearcompleteFrontier.priorEventMass_complement · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/TPriorReductionPoint.lean:247
theorem priorEventMass_failure_le

A prior concentration certificate bounds the complementary target event. Given the specified input d, the specified input q, the specified input E, the specified input hgood, the stated mathematical conclusion holds. Given the specified input β. Given the specified input π.

Formal statement
d :
ℕ
q β :
ℝ
π :
E :
ClassLaw d q → Prop
hgood :
1 - β ≤ priorEventMass d q π E
priorEventMass d q π (fun P => ¬ E P) ≤ β
Proof (Lean source)
-- @node: priorEventMass_failure_le lemma priorEventMass_failure_le {d : ℕ} {q β : ℝ} (π : PMF (ClassLaw d q)) (E : ClassLaw d q → Prop) (hgood : 1 - β ≤ priorEventMass d q π E) : priorEventMass d q π (fun P => ¬ E P) ≤ β := by rw [priorEventMass_complement] linarith
CausalSmith.Stat.MarNearcompleteFrontier.priorEventMass_failure_le · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/TPriorReductionPoint.lean:261
theorem squaredLoss_of_left_target_and_right_test Lemma squaredLoss_of_left_target_and_right_test in the paper ↗

A test that selects the right hypothesis incurs the separation loss on a left target. Given the specified input t, the specified input m, the specified input a, the specified input ha, the specified input ht, the stated mathematical conclusion holds. Given the specified input θ, the specified input hθ.

Formal statement
t θ m a :
ℝ
ha :
0 ≤ a
hθ :
θ ≤ m - a
ht :
m ≤ t
a ^ 2 ≤ (t - θ) ^ 2
Proof (Lean source)
-- @node: squaredLoss_of_left_target_and_right_test lemma squaredLoss_of_left_target_and_right_test (t θ m a : ℝ) (ha : 0 ≤ a) (hθ : θ ≤ m - a) (ht : m ≤ t) : a ^ 2 ≤ (t - θ) ^ 2 := by have hsep : a ≤ t - θ := by linarith nlinarith [sq_nonneg (t - θ - a)]
CausalSmith.Stat.MarNearcompleteFrontier.squaredLoss_of_left_target_and_right_test · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/TPriorReductionPoint.lean:270
theorem squaredLoss_of_right_target_and_left_test Lemma squaredLoss_of_right_target_and_left_test in the paper ↗

A test that selects the left hypothesis incurs the separation loss on a right target. Given the specified input t, the specified input m, the specified input a, the specified input ha, the specified input ht, the stated mathematical conclusion holds. Given the specified input θ, the specified input hθ.

Formal statement
t θ m a :
ℝ
ha :
0 ≤ a
hθ :
m + a ≤ θ
ht :
t ≤ m
a ^ 2 ≤ (t - θ) ^ 2
Proof (Lean source)
-- @node: squaredLoss_of_right_target_and_left_test lemma squaredLoss_of_right_target_and_left_test (t θ m a : ℝ) (ha : 0 ≤ a) (hθ : m + a ≤ θ) (ht : t ≤ m) : a ^ 2 ≤ (t - θ) ^ 2 := by have hsep : a ≤ θ - t := by linarith nlinarith [sq_nonneg (θ - t - a)]
CausalSmith.Stat.MarNearcompleteFrontier.squaredLoss_of_right_target_and_left_test · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/TPriorReductionPoint.lean:278
theorem sampleIntegral_ge_event

A pointwise nonnegative loss bound on a sample event passes to its probability. Given the specified input n, the specified input d, the specified input P, the specified input a, the specified input hf, the specified input hE, the stated mathematical conclusion holds. Given the specified input E, the specified input f.

Formal statement
n d :
ℕ
P :
E :
Set (Fin n → Obs d)
f :
(Fin n → Obs d) → ℝ
a :
ℝ
hf :
∀ o, 0 ≤ f o
hE :
∀ o ∈ E, a ≤ f o
a * (samplePi P n).real E ≤ ∫ o, f o ∂samplePi P n
Proof (Lean source)
-- @node: sampleIntegral_ge_event lemma sampleIntegral_ge_event {n d : ℕ} (P : FullLaw d) (E : Set (Fin n → Obs d)) (f : (Fin n → Obs d) → ℝ) (a : ℝ) (hf : ∀ o, 0 ≤ f o) (hE : ∀ o ∈ E, a ≤ f o) : a * (samplePi P n).real E ≤ ∫ o, f o ∂samplePi P n := by letI : IsProbabilityMeasure (samplePi P n) := by unfold samplePi infer_instance have hmeas : MeasurableSet E := (Set.toFinite E).measurableSet have hpoint (o : Fin n → Obs d) : E.indicator (fun _ => a) o ≤ f o := by by_cases ho : o ∈ E · simpa [indicator, ho] using hE o ho · simpa [indicator, ho] using hf o have hint : Integrable (E.indicator (fun _ : Fin n → Obs d => a)) (samplePi P n) := Integrable.of_finite have hfint : Integrable f (samplePi P n) := Integrable.of_finite have hbound := integral_mono hint hfint hpoint simpa [integral_indicator hmeas, mul_comm] using hbound
CausalSmith.Stat.MarNearcompleteFrontier.sampleIntegral_ge_event · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/TPriorReductionPoint.lean:286
theorem leftPrior_sampleRisk_lower

A right decision costs the squared separation on every left-target law. Given the specified input n, the specified input d, the specified input P, the specified input T, the specified input m, the specified input a, the specified input ha, the stated mathematical conclusion holds. Given the specified input hτ.

Formal statement
n d :
ℕ
P :
T :
m a :
ℝ
ha :
0 ≤ a
hτ :
tau P ≤ m - a
a ^ 2 * (samplePi P n).real {o | m ≤ T o} ≤ ∫ o, (T o - tau P) ^ 2 ∂samplePi P n
Proof (Lean source)
-- @node: leftPrior_sampleRisk_lower lemma leftPrior_sampleRisk_lower {n d : ℕ} (P : FullLaw d) (T : Estimator n d) (m a : ℝ) (ha : 0 ≤ a) (hτ : tau P ≤ m - a) : a ^ 2 * (samplePi P n).real {o | m ≤ T o} ≤ ∫ o, (T o - tau P) ^ 2 ∂samplePi P n := by apply sampleIntegral_ge_event P {o | m ≤ T o} (fun o => (T o - tau P) ^ 2) (a ^ 2) (fun o => sq_nonneg _) intro o ho exact squaredLoss_of_left_target_and_right_test (T o) (tau P) m a ha hτ ho
CausalSmith.Stat.MarNearcompleteFrontier.leftPrior_sampleRisk_lower · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/TPriorReductionPoint.lean:307
theorem rightPrior_sampleRisk_lower

A left decision costs the squared separation on every right-target law. Given the specified input n, the specified input d, the specified input P, the specified input T, the specified input m, the specified input a, the specified input ha, the stated mathematical conclusion holds. Given the specified input hτ.

Formal statement
n d :
ℕ
P :
T :
m a :
ℝ
ha :
0 ≤ a
hτ :
m + a ≤ tau P
a ^ 2 * (samplePi P n).real {o | T o ≤ m} ≤ ∫ o, (T o - tau P) ^ 2 ∂samplePi P n
Proof (Lean source)
-- @node: rightPrior_sampleRisk_lower lemma rightPrior_sampleRisk_lower {n d : ℕ} (P : FullLaw d) (T : Estimator n d) (m a : ℝ) (ha : 0 ≤ a) (hτ : m + a ≤ tau P) : a ^ 2 * (samplePi P n).real {o | T o ≤ m} ≤ ∫ o, (T o - tau P) ^ 2 ∂samplePi P n := by apply sampleIntegral_ge_event P {o | T o ≤ m} (fun o => (T o - tau P) ^ 2) (a ^ 2) (fun o => sq_nonneg _) intro o ho exact squaredLoss_of_right_target_and_left_test (T o) (tau P) m a ha hτ ho
CausalSmith.Stat.MarNearcompleteFrontier.rightPrior_sampleRisk_lower · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/TPriorReductionPoint.lean:319
theorem priorAverage_eventRisk_lower

A concentrated prior turns a sample-event loss into a Bayes-risk bound. Given the specified input n, the specified input d, the specified input q, the specified input Good, the specified input loss, the specified input a, the specified input ha, the specified input hgood, the specified input hlossint, the specified input hloss_nonneg, the stated mathematical conclusion holds. Given the specified input β. Given the specified input π, the specified input E, the specified input hloss_good.

Formal statement
n d :
ℕ
q β :
ℝ
π :
E :
Set (Fin n → Obs d)
Good :
ClassLaw d q → Prop
loss :
ClassLaw d q → ℝ
a :
ℝ
ha :
0 ≤ a
hgood :
1 - β ≤ priorEventMass d q π Good
hlossint :
Integrable loss π.toMeasure
hloss_nonneg :
∀ P, 0 ≤ loss P
hloss_good :
∀ P
if
Good P
then
a * (samplePi P.val n).real E ≤ loss P
a * ((priorPredictive n d q π).real E - β) ≤ ∫ P, loss P ∂π.toMeasure
Proof (Lean source)
-- @node: priorAverage_eventRisk_lower lemma priorAverage_eventRisk_lower {n d : ℕ} {q β : ℝ} (π : PMF (ClassLaw d q)) (E : Set (Fin n → Obs d)) (Good : ClassLaw d q → Prop) (loss : ClassLaw d q → ℝ) (a : ℝ) (ha : 0 ≤ a) (hgood : 1 - β ≤ priorEventMass d q π Good) (hlossint : Integrable loss π.toMeasure) (hloss_nonneg : ∀ P, 0 ≤ loss P) (hloss_good : ∀ P, Good P → a * (samplePi P.val n).real E ≤ loss P) : a * ((priorPredictive n d q π).real E - β) ≤ ∫ P, loss P ∂π.toMeasure := by classical let f : ClassLaw d q → ℝ := fun P => (samplePi P.val n).real E let bad : ClassLaw d q → ℝ := fun P => if Good P then 0 else 1 have hbad : (∫ P, bad P ∂π.toMeasure) ≤ β := by have hfail := priorEventMass_failure_le π Good hgood have hbad_eq : (∫ P, bad P ∂π.toMeasure) = priorEventMass d q π (fun P => ¬ Good P) := by unfold priorEventMass have hmeas : MeasurableSet {P : ClassLaw d q | ¬ Good P} := trivial have hpoint : bad = {P : ClassLaw d q | ¬ Good P}.indicator (fun _ => 1) := by funext P by_cases h : Good P <;> simp [bad, indicator, h] change (∫ P, bad P ∂π.toMeasure) = π.toMeasure.real {P | ¬ Good P} rw [hpoint, integral_indicator hmeas] simp exact hbad_eq.trans_le hfail have hf_le (P : ClassLaw d q) : f P ≤ 1 := by haveI : IsProbabilityMeasure (samplePi P.val n) := by unfold samplePi infer_instance exact measureReal_le_one have hpoint (P : ClassLaw d q) : a * f P - a * bad P ≤ loss P := by by_cases h : Good P · simpa [bad, h, f] using hloss_good P h · have hnonneg := hloss_nonneg P have := mul_le_mul_of_nonneg_left (hf_le P) ha simp [bad, h] linarith have hfint : Integrable f π.toMeasure := by have hm : Measurable f := by intro s hs; trivial apply Integrable.of_bound hm.aestronglyMeasurable 1 filter_upwards [] with P have hnonneg : 0 ≤ f P := measureReal_nonneg simp only [Real.norm_eq_abs] exact abs_le.mpr ⟨by linarith, hf_le P⟩ have hbadint : Integrable bad π.toMeasure := by have hm : Measurable bad := by intro s hs; trivial apply Integrable.of_bound hm.aestronglyMeasurable 1 filter_upwards [] with P by_cases h : Good P <;> simp [bad, h] have hbound : (∫ P, a * f P - a * bad P ∂π.toMeasure) ≤ ∫ P, loss P ∂π.toMeasure := integral_mono (hfint.const_mul a |>.sub (hbadint.const_mul a)) hlossint hpoint have hpred := priorPredictive_event_eq_integral n d q π E have hlin : (∫ P, a * f P - a * bad P ∂π.toMeasure) = a * (priorPredictive n d q π).real E - a * (∫ P, bad P ∂π.toMeasure) := by rw [integral_sub (hfint.const_mul a) (hbadint.const_mul a)] simp only [integral_const_mul] rw [hpred] rw [hlin] at hbound have := mul_le_mul_of_nonneg_left hbad ha nlinarith
CausalSmith.Stat.MarNearcompleteFrontier.priorAverage_eventRisk_lower · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/TPriorReductionPoint.lean:331
theorem pointRisk_integrable_prior

The bounded squared loss can be averaged under any legal-law prior. Given the specified input n, the specified input d, the specified input q, the specified input T, the stated mathematical conclusion holds. Given the specified input π.

Formal statement
n d :
ℕ
q :
ℝ
π :
T :
Integrable (fun P : ClassLaw d q => ∫ o, (T o - tau P.val) ^ 2 ∂samplePi P.val n) π.toMeasure
Proof (Lean source)
-- @node: pointRisk_integrable_prior lemma pointRisk_integrable_prior {n d : ℕ} {q : ℝ} (π : PMF (ClassLaw d q)) (T : Estimator n d) : Integrable (fun P : ClassLaw d q => ∫ o, (T o - tau P.val) ^ 2 ∂samplePi P.val n) π.toMeasure := by have hmeas : Measurable (fun P : ClassLaw d q => ∫ o, (T o - tau P.val) ^ 2 ∂samplePi P.val n) := by intro s hs trivial apply Integrable.of_bound hmeas.aestronglyMeasurable 4 filter_upwards [] with P haveI : IsProbabilityMeasure (samplePi P.val n) := by unfold samplePi infer_instance have hlo : 0 ≤ ∫ o, (T o - tau P.val) ^ 2 ∂samplePi P.val n := integral_nonneg (fun o => sq_nonneg _) have hhi : (∫ o, (T o - tau P.val) ^ 2 ∂samplePi P.val n) ≤ 4 := by have hpoint (o : Fin n → Obs d) : (T o - tau P.val) ^ 2 ≤ 4 := by have hT := T.range o have hτ := tau_range P.val rcases hT with ⟨hT0, hT1⟩ rcases hτ with ⟨hτ0, hτ1⟩ nlinarith [sq_nonneg (T o + 1), sq_nonneg (1 - T o), sq_nonneg (tau P.val + 1), sq_nonneg (1 - tau P.val)] have hInt : Integrable (fun o : Fin n → Obs d => (T o - tau P.val) ^ 2) (samplePi P.val n) := Integrable.of_finite simpa using (integral_mono hInt (integrable_const 4) hpoint) simp only [Real.norm_eq_abs] exact abs_le.mpr ⟨by linarith, hhi⟩
CausalSmith.Stat.MarNearcompleteFrontier.pointRisk_integrable_prior · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/TPriorReductionPoint.lean:400
theorem priorPointTest_BayesSum_lower

Two concentrated target priors force the sum of their Bayes squared risks. Given the specified input n, the specified input d, the specified input q, the specified input T, the specified input m, the specified input a, the specified input ha, the stated mathematical conclusion holds. Given the specified input β. Given the specified input πminus, the specified input πplus, the specified input htv, the specified input hminus, the specified input hplus.

Formal statement
n d :
ℕ
q β :
ℝ
πminus πplus :
T :
m a :
ℝ
ha :
0 ≤ a
htv :
tvDist (priorPredictive n d q πminus) (priorPredictive n d q πplus) ≤ β
hminus :
1 - β ≤ priorEventMass d q πminus (fun P => tau P.val ≤ m - a)
hplus :
1 - β ≤ priorEventMass d q πplus (fun P => m + a ≤ tau P.val)
a ^ 2 * (1 - 3 * β)
≤ (∫ P : ClassLaw d q, ∫ o, (T o - tau P.val) ^ 2 ∂samplePi P.val n ∂πminus.toMeasure)
+ (∫ P : ClassLaw d q, ∫ o, (T o - tau P.val) ^ 2 ∂samplePi P.val n ∂πplus.toMeasure)
Proof (Lean source)
-- @node: priorPointTest_BayesSum_lower lemma priorPointTest_BayesSum_lower {n d : ℕ} {q β : ℝ} (πminus πplus : PMF (ClassLaw d q)) (T : Estimator n d) (m a : ℝ) (ha : 0 ≤ a) (htv : tvDist (priorPredictive n d q πminus) (priorPredictive n d q πplus) ≤ β) (hminus : 1 - β ≤ priorEventMass d q πminus (fun P => tau P.val ≤ m - a)) (hplus : 1 - β ≤ priorEventMass d q πplus (fun P => m + a ≤ tau P.val)) : a ^ 2 * (1 - 3 * β) ≤ (∫ P : ClassLaw d q, ∫ o, (T o - tau P.val) ^ 2 ∂samplePi P.val n ∂πminus.toMeasure) + (∫ P : ClassLaw d q, ∫ o, (T o - tau P.val) ^ 2 ∂samplePi P.val n ∂πplus.toMeasure) := by let E : Set (Fin n → Obs d) := {o | m ≤ T o} let loss : ClassLaw d q → ℝ := fun P => ∫ o, (T o - tau P.val) ^ 2 ∂samplePi P.val n have hloss_nonneg (P : ClassLaw d q) : 0 ≤ loss P := integral_nonneg (fun o => sq_nonneg _) have hleft : a ^ 2 * ((priorPredictive n d q πminus).real E - β) ≤ ∫ P, loss P ∂πminus.toMeasure := by apply priorAverage_eventRisk_lower πminus E (fun P => tau P.val ≤ m - a) loss (a ^ 2) (sq_nonneg _) hminus (pointRisk_integrable_prior πminus T) hloss_nonneg intro P hP exact leftPrior_sampleRisk_lower P.val T m a ha hP have hright : a ^ 2 * ((priorPredictive n d q πplus).real Eᶜ - β) ≤ ∫ P, loss P ∂πplus.toMeasure := by apply priorAverage_eventRisk_lower πplus Eᶜ (fun P => m + a ≤ tau P.val) loss (a ^ 2) (sq_nonneg _) hplus (pointRisk_integrable_prior πplus T) hloss_nonneg intro P hP apply sampleIntegral_ge_event P.val Eᶜ (fun o => (T o - tau P.val) ^ 2) (a ^ 2) (fun o => sq_nonneg _) intro o ho apply squaredLoss_of_right_target_and_left_test (T o) (tau P.val) m a ha hP have : ¬ m ≤ T o := ho linarith haveI := priorPredictive_isProbability n d q πminus haveI := priorPredictive_isProbability n d q πplus have hE : MeasurableSet E := (Set.toFinite E).measurableSet have htvE := abs_measureReal_sub_le_tvDist (μ := priorPredictive n d q πminus) (ν := priorPredictive n d q πplus) hE have htransfer : (priorPredictive n d q πminus).real E + (priorPredictive n d q πplus).real Eᶜ ≥ 1 - β := by rw [probReal_compl_eq_one_sub hE] have := (abs_le.mp htvE).1 linarith dsimp [loss] at hleft hright ⊢ nlinarith
CausalSmith.Stat.MarNearcompleteFrontier.priorPointTest_BayesSum_lower · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/TPriorReductionPoint.lean:432
theorem interval_length_of_separated_hits

A connected interval hitting both separated target regions has length at least 2a. Given the specified input n, the specified input d, the specified input I, the specified input o, the specified input m, the specified input a, the specified input xL, the specified input xR, the specified input hleft, the specified input hright, the stated mathematical conclusion holds. Given the specified input hL, the specified input hR.

Formal statement
n d :
ℕ
I :
o :
Fin n → Obs d
m a xL xR :
ℝ
hL :
xL ∈ Icc (I.lo o) (I.hi o)
hR :
xR ∈ Icc (I.lo o) (I.hi o)
hleft :
xL ≤ m - a
hright :
m + a ≤ xR
2 * a ≤ I.hi o - I.lo o
Proof (Lean source)
-- @node: interval_length_of_separated_hits lemma interval_length_of_separated_hits {n d : ℕ} (I : IntervalProc n d) (o : Fin n → Obs d) (m a xL xR : ℝ) (hL : xL ∈ Icc (I.lo o) (I.hi o)) (hR : xR ∈ Icc (I.lo o) (I.hi o)) (hleft : xL ≤ m - a) (hright : m + a ≤ xR) : 2 * a ≤ I.hi o - I.lo o := by rcases hL with ⟨hlo, _⟩ rcases hR with ⟨_, hhi⟩ linarith
CausalSmith.Stat.MarNearcompleteFrontier.interval_length_of_separated_hits · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/TPriorReductionPoint.lean:487
theorem pointMinimaxRisk_lower_of_pair

A two-law risk bound passes through the supremum and estimator infimum. Given the specified input n, the specified input d, the specified input q, the specified input c, the specified input Pminus, the specified input Pplus, the stated mathematical conclusion holds. Given the specified input h.

Formal statement
n d :
ℕ
q c :
ℝ
Pminus Pplus :
h :
∀ T : Estimator n d,
c
≤ max (∫ o, (T o - tau Pminus.val) ^ 2 ∂samplePi Pminus.val n) (∫ o, (T o - tau Pplus.val) ^ 2 ∂samplePi Pplus.val n)
c ≤ pointMinimaxRisk n d q
Proof (Lean source)
lemma pointMinimaxRisk_lower_of_pair {n d : ℕ} {q c : ℝ} (Pminus Pplus : ClassLaw d q) (h : ∀ T : Estimator n d, c ≤ max (∫ o, (T o - tau Pminus.val) ^ 2 ∂samplePi Pminus.val n) (∫ o, (T o - tau Pplus.val) ^ 2 ∂samplePi Pplus.val n)) : c ≤ pointMinimaxRisk n d q := by letI : Nonempty (Estimator n d) := ⟨⟨fun _ => 0, measurable_const, fun _ => by constructor <;> norm_num⟩⟩ unfold pointMinimaxRisk refine le_ciInf fun T => ?_ have hb : BddAbove (Set.range fun P : ClassLaw d q => ∫ o, (T o - tau P.val) ^ 2 ∂samplePi P.val n) := by refine ⟨4, ?_⟩ rintro y ⟨P, rfl⟩ letI : IsProbabilityMeasure (samplePi P.val n) := by unfold samplePi infer_instance have hrange (o : Fin n → Obs d) : (T o - tau P.val) ^ 2 ≤ 4 := by have hT := T.range o have hτ := tau_range P.val rcases hT with ⟨hT0, hT1⟩ rcases hτ with ⟨hτ0, hτ1⟩ nlinarith [sq_nonneg (T o + 1), sq_nonneg (1 - T o), sq_nonneg (tau P.val + 1), sq_nonneg (1 - tau P.val)] have hInt : Integrable (fun o => (T o - tau P.val) ^ 2) (samplePi P.val n) := Integrable.of_finite simpa using (integral_mono hInt (integrable_const 4) hrange) have hm : (∫ o, (T o - tau Pminus.val) ^ 2 ∂samplePi Pminus.val n) ≤ ⨆ P : ClassLaw d q, ∫ o, (T o - tau P.val) ^ 2 ∂samplePi P.val n := le_ciSup hb Pminus have hp : (∫ o, (T o - tau Pplus.val) ^ 2 ∂samplePi Pplus.val n) ≤ ⨆ P : ClassLaw d q, ∫ o, (T o - tau P.val) ^ 2 ∂samplePi P.val n := le_ciSup hb Pplus exact (h T).trans (max_le hm hp)
CausalSmith.Stat.MarNearcompleteFrontier.pointMinimaxRisk_lower_of_pair · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/TPriorReductionPoint.lean:500
theorem lengthMinimaxRisk_lower_of_law

A fixed legal law gives a lower bound on every honest interval's worst-law length. Given the specified input n, the specified input d, the specified input q, the specified input c, the specified input P, the stated mathematical conclusion holds. Given the specified input α, the specified input hα. Given the specified input h.

Formal statement
n d :
ℕ
q α c :
ℝ
P :
hα :
0 ≤ α
h :
∀ I : HonestIntervalClass n d q α, c ≤ ∫ o, (I.val.hi o - I.val.lo o) ∂samplePi P.val n
c ≤ lengthMinimaxRisk n d q α
Proof (Lean source)
lemma lengthMinimaxRisk_lower_of_law {n d : ℕ} {q α c : ℝ} (P : ClassLaw d q) (hα : 0 ≤ α) (h : ∀ I : HonestIntervalClass n d q α, c ≤ ∫ o, (I.val.hi o - I.val.lo o) ∂samplePi P.val n) : c ≤ lengthMinimaxRisk n d q α := by let Iall : IntervalProc n d := ⟨fun _ => -1, fun _ => 1, measurable_const, measurable_const, fun _ => by constructor <;> norm_num⟩ letI : Nonempty (HonestIntervalClass n d q α) := ⟨⟨Iall, fun P' => by haveI : IsProbabilityMeasure (samplePi P'.val n) := by unfold samplePi infer_instance have hτ := tau_range P'.val have hevent : {o : Fin n → Obs d | tau P'.val ∈ Icc (Iall.lo o) (Iall.hi o)} = univ := by ext o simp [Iall, hτ] rw [hevent, probReal_univ] linarith⟩⟩ unfold lengthMinimaxRisk refine le_ciInf fun I => ?_ have hb : BddAbove (Set.range fun P' : ClassLaw d q => ∫ o, (I.val.hi o - I.val.lo o) ∂samplePi P'.val n) := by refine ⟨2, ?_⟩ rintro y ⟨P', rfl⟩ letI : IsProbabilityMeasure (samplePi P'.val n) := by unfold samplePi infer_instance have hrange (o : Fin n → Obs d) : I.val.hi o - I.val.lo o ≤ 2 := by have hI := I.val.bounds o linarith have hInt : Integrable (fun o => I.val.hi o - I.val.lo o) (samplePi P'.val n) := Integrable.of_finite simpa using (integral_mono hInt (integrable_const 2) hrange) exact (h I).trans (le_ciSup hb P)
CausalSmith.Stat.MarNearcompleteFrontier.lengthMinimaxRisk_lower_of_law · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/TPriorReductionPoint.lean:543
theorem priorAverage_le_of_pointwise

A pointwise risk bound also bounds its average under any legal-law prior. Given the specified input d, the specified input q, the specified input f, the specified input R, the specified input hf, the specified input hR, the stated mathematical conclusion holds. Given the specified input π.

Formal statement
d :
ℕ
q :
ℝ
π :
f :
ClassLaw d q → ℝ
R :
ℝ
hf :
Integrable f π.toMeasure
hR :
∀ P, f P ≤ R
(∫ P, f P ∂π.toMeasure) ≤ R
Proof (Lean source)
lemma priorAverage_le_of_pointwise {d : ℕ} {q : ℝ} (π : PMF (ClassLaw d q)) (f : ClassLaw d q → ℝ) (R : ℝ) (hf : Integrable f π.toMeasure) (hR : ∀ P, f P ≤ R) : (∫ P, f P ∂π.toMeasure) ≤ R := by haveI : IsProbabilityMeasure π.toMeasure := inferInstance simpa using (integral_mono hf (integrable_const R) hR)
CausalSmith.Stat.MarNearcompleteFrontier.priorAverage_le_of_pointwise · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/TPriorReductionPoint.lean:583
theorem pointMinimaxRisk_lower_of_priors

A Bayes-risk lower bound under two legal priors passes to minimax risk. Given the specified input n, the specified input d, the specified input q, the specified input c, the stated mathematical conclusion holds. Given the specified input πminus, the specified input πplus, the specified input h.

Formal statement
n d :
ℕ
q c :
ℝ
πminus πplus :
h :
∀ T : Estimator n d,
2 * c
≤ (∫ P : ClassLaw d q, ∫ o, (T o - tau P.val) ^ 2 ∂samplePi P.val n ∂πminus.toMeasure)
+ (∫ P : ClassLaw d q, ∫ o, (T o - tau P.val) ^ 2 ∂samplePi P.val n ∂πplus.toMeasure)
c ≤ pointMinimaxRisk n d q
Proof (Lean source)
-- @node: pointMinimaxRisk_lower_of_priors lemma pointMinimaxRisk_lower_of_priors {n d : ℕ} {q c : ℝ} (πminus πplus : PMF (ClassLaw d q)) (h : ∀ T : Estimator n d, 2 * c ≤ (∫ P : ClassLaw d q, ∫ o, (T o - tau P.val) ^ 2 ∂samplePi P.val n ∂πminus.toMeasure) + (∫ P : ClassLaw d q, ∫ o, (T o - tau P.val) ^ 2 ∂samplePi P.val n ∂πplus.toMeasure)) : c ≤ pointMinimaxRisk n d q := by letI : Nonempty (Estimator n d) := ⟨⟨fun _ => 0, measurable_const, fun _ => by constructor <;> norm_num⟩⟩ unfold pointMinimaxRisk refine le_ciInf fun T => ?_ let risk : ClassLaw d q → ℝ := fun P => ∫ o, (T o - tau P.val) ^ 2 ∂samplePi P.val n have hb : BddAbove (range risk) := by refine ⟨4, ?_⟩ rintro y ⟨P, rfl⟩ haveI : IsProbabilityMeasure (samplePi P.val n) := by unfold samplePi infer_instance have hpoint (o : Fin n → Obs d) : (T o - tau P.val) ^ 2 ≤ 4 := by have hT := T.range o have hτ := tau_range P.val rcases hT with ⟨hT0, hT1⟩ rcases hτ with ⟨hτ0, hτ1⟩ nlinarith [sq_nonneg (T o + 1), sq_nonneg (1 - T o), sq_nonneg (tau P.val + 1), sq_nonneg (1 - tau P.val)] have hInt : Integrable (fun o : Fin n → Obs d => (T o - tau P.val) ^ 2) (samplePi P.val n) := Integrable.of_finite simpa [risk] using (integral_mono hInt (integrable_const 4) hpoint) let R : ℝ := ⨆ P : ClassLaw d q, risk P have hpoint (P : ClassLaw d q) : risk P ≤ R := le_ciSup hb P have hm := priorAverage_le_of_pointwise πminus risk R (pointRisk_integrable_prior πminus T) hpoint have hp := priorAverage_le_of_pointwise πplus risk R (pointRisk_integrable_prior πplus T) hpoint have hbayes := h T dsimp [risk, R] at hm hp ⊢ linarith
CausalSmith.Stat.MarNearcompleteFrontier.pointMinimaxRisk_lower_of_priors · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/TPriorReductionPoint.lean:591
theorem priorPointRisk_separation

The normalized converse gives the stated 13/32 point-risk coefficient. Given the specified input n, the specified input d, the specified input q, the specified input hn, the specified input hd, the specified input n, the stated mathematical conclusion holds. Given the specified input hq, the specified input hlarge.

Formal statement
n d :
ℕ
q :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hq :
q ∈ Icc ((1 : ℝ) / 2) 1
hlarge :
gScale n d q ^ 2 ≥ 1 / (n : ℝ)
(13 / 32 : ℝ) * converseConstant pointBeta pointBeta_valid ^ 2 * gScale n d q ^ 2
Proof (Lean source)
-- @node: priorPointRisk_separation lemma priorPointRisk_separation (n d : ℕ) (q : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hq : q ∈ Icc ((1 : ℝ) / 2) 1) (hlarge : gScale n d q ^ 2 ≥ 1 / (n : ℝ)) : (13 / 32 : ℝ) * converseConstant pointBeta pointBeta_valid ^ 2 * gScale n d q ^ 2 ≤ pointMinimaxRisk n d q := by obtain ⟨πminus, πplus, htv, m, hm, hp⟩ := (converseConstant_spec pointBeta pointBeta_valid).2 n d q hn hd hq hlarge let a := converseConstant pointBeta pointBeta_valid * gScale n d q have ha : 0 ≤ a := mul_nonneg (le_of_lt (converseConstant_spec pointBeta pointBeta_valid).1) (gScale_nonneg_of_q n d q hq) apply pointMinimaxRisk_lower_of_priors πminus πplus intro T have hsum := priorPointTest_BayesSum_lower πminus πplus T m a ha htv hm hp dsimp [a, pointBeta] at hsum ⊢ nlinarith
CausalSmith.Stat.MarNearcompleteFrontier.priorPointRisk_separation · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/TPriorReductionPoint.lean:634
CausalSmith.Stat.STAT_MarNearcompleteFrontier_Research.TUpperRisk 1 declarations The constant is outside all sample-size, alphabet-size and arrival-floor quantifiers.

Uniform risk of the missing-membership estimator

The constant is outside all sample-size, alphabet-size and arrival-floor quantifiers.

theorem upper_risk Lemma 2 in the paper ↗

A universal constant controls the estimator's risk on the complete MAR class. the stated mathematical conclusion holds.

Formal statement
∃ CU : ℝ, UpperRiskCertificate CU
Proof (Lean source)
lemma upper_risk : ∃ CU : ℝ, UpperRiskCertificate CU := by let Cnon : ℝ := 8 * ((201719808 : ℝ) ^ 2 * ((720 * (4 / 3 : ℝ) ^ 6) * (exp 1 + 1)) + 119) + 2 * (268435456 : ℝ) ^ 2 + 104 let Cfall : ℝ := 4 * exp 128 have hnC : 0 < Cnon := by dsimp [Cnon]; positivity have hfC : 0 < Cfall := by dsimp [Cfall]; positivity refine ⟨Cnon + Cfall, add_pos hnC hfC, ?_⟩ intro n d q hn hd hq P μ hiid have hn' : 0 < n := Nat.zero_lt_of_lt hn have hr : 0 ≤ rate n d q := by unfold rate; positivity rw [hiid] by_cases hqone : q = 1 · have hf := upper_fallback_branches_risk_rate hn' P.val P.property hq (inl hqone) exact hf.trans (mul_le_mul_of_nonneg_right (by dsimp [Cfall]; linarith) hr) · by_cases hreg : ell n < 128 ∨ (d : ℝ) ≥ (n : ℝ) * ell n · have hf := upper_fallback_branches_risk_rate hn' P.val P.property hq (inr hreg) exact hf.trans (mul_le_mul_of_nonneg_right (by dsimp [Cfall]; linarith) hr) · have hnon := upper_nonfallback_risk_rate hn' P.val P.property hq hqone hreg exact hnon.trans (mul_le_mul_of_nonneg_right (by dsimp [Cnon]; linarith) hr)
CausalSmith.Stat.MarNearcompleteFrontier.upper_risk · CausalSmith/Stat/STAT_MarNearcompleteFrontier_Research/TUpperRisk.lean:46