Formalization: Treatment Effect Estimation with Missing Outcomes and Many Covariate Categories

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

CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Basic 74 declarations Finite full-data and observed experiments for the rare-arrival MAR frontier.

Finite full-data and observed experiments for the rare-arrival MAR frontier. The finite-table encoding is deliberate: the available POSystem and MinimaxATE models have a different observational alphabet. The generic minimax value is reused.

structure FullRecord Definition 1 in the paper ↗

For the specified inputs and assumptions, the mathematical structure records the components specified by this declaration.

Definition (Lean source)
structure FullRecord (d : ℕ) where X : Fin d -- @realizes \(X\)(baseline category); @realizes \(d\)(alphabet size) A : Bool -- @realizes \(A\)(binary randomized arm) S0 : Bool -- @realizes \(S(a)\)(control surrogate) S1 : Bool -- @realizes \(S(a)\)(treated surrogate) Y0 : Bool -- @realizes \(Y(a)\)(control outcome) Y1 : Bool -- @realizes \(Y(a)\)(treated outcome) R : Bool -- @realizes \(R\)(arrival flag) deriving DecidableEq
CausalSmith.Stat.MarRareqLogfrontier.FullRecord · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Basic.lean:24
instance instDecidableEqFullRecord

For the specified inputs and assumptions, the mathematical structure records the components specified by this declaration.

Definition (Lean source)
deriving DecidableEq
CausalSmith.Stat.MarRareqLogfrontier.instDecidableEqFullRecord · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Basic.lean:33

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
d :
ℕ
r :
S r :
if r.A then r.S1 else r.S0
CausalSmith.Stat.MarRareqLogfrontier.FullRecord.S · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Basic.lean:37

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
d :
ℕ
r :
Y r :
if r.A then r.Y1 else r.Y0
CausalSmith.Stat.MarRareqLogfrontier.FullRecord.Y · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Basic.lean:41
instance instMeasurableSpaceFullRecord

the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
instance (d : ℕ) : MeasurableSpace (FullRecord d) := ⊤
CausalSmith.Stat.MarRareqLogfrontier.instMeasurableSpaceFullRecord · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Basic.lean:45

For the specified inputs and assumptions, the mathematical structure records the components specified by this declaration.

Definition (Lean source)
structure ObsRecord (d : ℕ) where X : Fin d A : Bool S : Bool R : Bool RY : Bool deriving DecidableEq, Fintype
CausalSmith.Stat.MarRareqLogfrontier.ObsRecord · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Basic.lean:48
instance instDecidableEqObsRecord

For the specified inputs and assumptions, the mathematical structure records the components specified by this declaration.

Definition (Lean source)
deriving DecidableEq, Fintype
CausalSmith.Stat.MarRareqLogfrontier.instDecidableEqObsRecord · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Basic.lean:55
instance instFintypeObsRecord

For the specified inputs and assumptions, the mathematical structure records the components specified by this declaration.

Definition (Lean source)
deriving DecidableEq, Fintype
CausalSmith.Stat.MarRareqLogfrontier.instFintypeObsRecord · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Basic.lean:55
instance instMeasurableSpaceObsRecord

the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
instance (d : ℕ) : MeasurableSpace (ObsRecord d) := ⊤
CausalSmith.Stat.MarRareqLogfrontier.instMeasurableSpaceObsRecord · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Basic.lean:59
def obs

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
d :
ℕ
r :
obs r :
⟨r.X, r.A, r.S, r.R, r.R && r.Y⟩
CausalSmith.Stat.MarRareqLogfrontier.obs · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Basic.lean:62
def Cell

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
d :
ℕ
Cell d :
Type
Bool × Fin d × Bool
CausalSmith.Stat.MarRareqLogfrontier.Cell · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Basic.lean:69

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
d :
ℕ
r :
j :
Cell d
inCell r j :
Prop
clause 1
r.A = j.1
clause 2
r.X = j.2.1
clause 3
r.S = j.2.2
CausalSmith.Stat.MarRareqLogfrontier.inCell · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Basic.lean:72

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
d :
ℕ
FullLaw d :
Type
CausalSmith.Stat.MarRareqLogfrontier.FullLaw · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Basic.lean:76

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
d :
ℕ
n :
ℕ
P :
sampleLaw n P :
Measure.pi (fun _ : Fin n => P.1.map obs)
CausalSmith.Stat.MarRareqLogfrontier.sampleLaw · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Basic.lean:80
def arrivedCell

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
d :
ℕ
P :
j :
Cell d
arrivedCell P j :
ℝ
P.1.real {r | inCell r j ∧ r.R = true}
CausalSmith.Stat.MarRareqLogfrontier.arrivedCell · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Basic.lean:84
def cellProb

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
d :
ℕ
P :
j :
Cell d
cellProb P j :
ℝ
P.1.real {r | inCell r j}
CausalSmith.Stat.MarRareqLogfrontier.cellProb · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Basic.lean:88
def arrivalProb

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
d :
ℕ
P :
j :
Cell d
arrivalProb P j :
ℝ
if 0 < cellProb P j then arrivedCell P j / cellProb P j else 0
CausalSmith.Stat.MarRareqLogfrontier.arrivalProb · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Basic.lean:92
def cellMean

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
d :
ℕ
P :
j :
Cell d
cellMean P j :
ℝ
if 0 < arrivedCell P j then P.1.real {r | inCell r j ∧ r.R = true ∧ r.Y = true} / arrivedCell P j else 0
CausalSmith.Stat.MarRareqLogfrontier.cellMean · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Basic.lean:97
def cellContribution

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
d :
ℕ
P :
j :
Cell d
cellContribution P j :
ℝ
if 0 < arrivedCell P j then cellProb P j * cellMean P j else 0
CausalSmith.Stat.MarRareqLogfrontier.cellContribution · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Basic.lean:104
def armSign

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
a :
armSign a :
ℝ
if a then 1 else -1
CausalSmith.Stat.MarRareqLogfrontier.armSign · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Basic.lean:109
def IIDSampling

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
Ω :
d :
ℕ
n :
ℕ
μ :
O :
Fin n → Ω → ObsRecord d
P :
IIDSampling n μ O P :
Prop
clause 1
i :
clause 2
iIndepFun O μ
clause 3
i :
μ.map (O i) = P.1.map obs
CausalSmith.Stat.MarRareqLogfrontier.IIDSampling · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Basic.lean:113
def RandomizedIndependence

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
d :
ℕ
P :
RandomizedIndependence P :
Prop
IndepFun FullRecord.A (fun r : FullRecord d => (r.X, r.S0, r.S1, r.Y0, r.Y1)) P.1
CausalSmith.Stat.MarRareqLogfrontier.RandomizedIndependence · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Basic.lean:120
def BalancedRandomization

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
d :
ℕ
P :
BalancedRandomization P :
Prop
P.1.real {r | r.A = true} = 1 / 2
CausalSmith.Stat.MarRareqLogfrontier.BalancedRandomization · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Basic.lean:125
def SurrogateConsistency

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
d :
ℕ
P :
SurrogateConsistency P :
Prop
∀ᵐ r : FullRecord d ∂(P.1), r.S = if r.A then r.S1 else r.S0
CausalSmith.Stat.MarRareqLogfrontier.SurrogateConsistency · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Basic.lean:131
def OutcomeConsistency

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
d :
ℕ
P :
OutcomeConsistency P :
Prop
∀ᵐ r : FullRecord d ∂(P.1), r.Y = if r.A then r.Y1 else r.Y0
CausalSmith.Stat.MarRareqLogfrontier.OutcomeConsistency · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Basic.lean:136
def ArrivalMAR

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
d :
ℕ
P :
j :
Cell d
y r :
ArrivalMAR P :
Prop
P.1.real {w | inCell w j ∧ w.R = r ∧ w.Y = y} * cellProb P j
= P.1.real {w | inCell w j ∧ w.R = r} * P.1.real {w | inCell w j ∧ w.Y = y}
CausalSmith.Stat.MarRareqLogfrontier.ArrivalMAR · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Basic.lean:141
def OccupiedCellArrival

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
d :
ℕ
q :
ℝ
P :
j :
Cell d
0 < cellProb P j
OccupiedCellArrival q P :
Prop
q * cellProb P j ≤ arrivedCell P j
CausalSmith.Stat.MarRareqLogfrontier.OccupiedCellArrival · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Basic.lean:149
def EffectiveSizeScope

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
n :
ℕ
q :
ℝ
EffectiveSizeScope n q :
Prop
clause 1
1 ≤ n
clause 2
0 < q
CausalSmith.Stat.MarRareqLogfrontier.EffectiveSizeScope · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Basic.lean:153
def effectiveSize

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
n :
ℕ
q :
ℝ
effectiveSize n q :
ℝ
n * q
CausalSmith.Stat.MarRareqLogfrontier.effectiveSize · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Basic.lean:159

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
n :
ℕ
q :
ℝ
logScale n q :
ℝ
CausalSmith.Stat.MarRareqLogfrontier.logScale · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Basic.lean:162
def RareArrivalSlice Assumption 8 in the paper ↗

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
n :
ℕ
q :
ℝ
RareArrivalSlice n q :
Prop
q * (logScale n q) ^ 2 ≤ 1 / 64
CausalSmith.Stat.MarRareqLogfrontier.RareArrivalSlice · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Basic.lean:167
structure UnrestrictedArrivalModelClass

For the specified inputs and assumptions, the mathematical structure records the components specified by this declaration.

Definition (Lean source)
n d :
ℕ
q :
ℝ
P :
n_pos :
1 ≤ n
d_pos :
1 ≤ d
q_pos :
0 < q
q_le_one :
q ≤ 1
randomized :
balanced :
surrogate :
outcome :
mar :
arrival :
CausalSmith.Stat.MarRareqLogfrontier.UnrestrictedArrivalModelClass · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Basic.lean:172
structure RareArrivalModelClass

For the specified inputs and assumptions, the mathematical structure records the components specified by this declaration.

Definition (Lean source)
n d :
ℕ
q :
ℝ
P :
iid :
IIDSampling n (sampleLaw n P) (fun (i : Fin n) (ω : Fin n → ObsRecord d) => ω i) P
randomized :
balanced :
surrogate :
outcome :
mar :
arrival :
slice :
n_pos :
1 ≤ n
d_pos :
1 ≤ d
q_pos :
0 < q
q_le_one :
q ≤ 1
CausalSmith.Stat.MarRareqLogfrontier.RareArrivalModelClass · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Basic.lean:187
def observedExperiment

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
n d :
ℕ
q :
ℝ
observedExperiment n d q :
Set (Measure (Fin n → ObsRecord d))
{ν | ∃ P : FullLaw d, RareArrivalModelClass n d q P ∧ ν = sampleLaw n P}
CausalSmith.Stat.MarRareqLogfrontier.observedExperiment · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Basic.lean:204
def ate

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
d :
ℕ
P :
ate P :
ℝ
∫ r : FullRecord d, ((if r.Y1 then (1 : ℝ) else 0) - (if r.Y0 then (1 : ℝ) else 0)) ∂(P.1)
def cellFunctional

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
d :
ℕ
P :
cellFunctional P :
ℝ
2 * ∑ j : Cell d, armSign j.1 * cellContribution P j
CausalSmith.Stat.MarRareqLogfrontier.cellFunctional · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Basic.lean:216

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
n d :
ℕ
q :
ℝ
frontierRate n d q :
ℝ
min 1 ((effectiveSize n q)⁻¹ + ((d : ℝ) / (effectiveSize n q * logScale n q)) ^ 2)
CausalSmith.Stat.MarRareqLogfrontier.frontierRate · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Basic.lean:222
def BoundedRealKernel

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
Z :
BoundedRealKernel Z :
Type (max 0 u_1)
{K : Kernel Z ℝ // IsMarkovKernel K ∧ ∀ o, K o (Icc (-1 : ℝ) 1) = 1}
CausalSmith.Stat.MarRareqLogfrontier.BoundedRealKernel · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Basic.lean:228
def Estimator

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
n d :
ℕ
Estimator n d :
Type
CausalSmith.Stat.MarRareqLogfrontier.Estimator · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Basic.lean:232
def ofMap

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
n d :
ℕ
f :
(Fin n → ObsRecord d) → ℝ
hf :
Measurable f ∧ ∀ s, f s ∈ Icc (-1 : ℝ) 1
ofMap f hf :
⟨Kernel.deterministic f hf.1, inferInstance, by intro s rw [Kernel.deterministic_apply, Measure.dirac_apply] rw [Set.indicator_of_mem (hf.2 s)] rfl⟩
CausalSmith.Stat.MarRareqLogfrontier.Estimator.ofMap · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Basic.lean:237
def toBoundedKernel

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
n d :
ℕ
T :
toBoundedKernel T :
T
CausalSmith.Stat.MarRareqLogfrontier.Estimator.toBoundedKernel · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Basic.lean:247
theorem toBoundedKernel_val

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
T :
T.toBoundedKernel.1 = T.1
Proof (Lean source)
@[simp] lemma Estimator.toBoundedKernel_val {n d : ℕ} (T : Estimator n d) : T.toBoundedKernel.1 = T.1 := rfl
CausalSmith.Stat.MarRareqLogfrontier.Estimator.toBoundedKernel_val · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Basic.lean:250
def squaredRisk

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
n d :
ℕ
T :
P :
squaredRisk T P :
ℝ
∫ s, (∫ t, (t - ate P) ^ 2 ∂(T.1 s)) ∂(sampleLaw n P)
CausalSmith.Stat.MarRareqLogfrontier.squaredRisk · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Basic.lean:254

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
n d :
ℕ
f :
(Fin n → ObsRecord d) → ℝ
P :
deterministicRisk f P :
ℝ
∫ s, (f s - ate P) ^ 2 ∂(sampleLaw n P)
CausalSmith.Stat.MarRareqLogfrontier.deterministicRisk · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Basic.lean:258
def minimaxRisk

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
n d :
ℕ
q :
ℝ
minimaxRisk n d q :
ℝ
minimaxValueReal (E := Estimator n d) (Θ := {P : FullLaw d // RareArrivalModelClass n d q P}) (fun T P => squaredRisk T P.1)
CausalSmith.Stat.MarRareqLogfrontier.minimaxRisk · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Basic.lean:264
def EndpointPair

the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
EndpointPair :
Type
{p : ℝ × ℝ // -1 ≤ p.1 ∧ p.1 ≤ p.2 ∧ p.2 ≤ 1}
CausalSmith.Stat.MarRareqLogfrontier.EndpointPair · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Basic.lean:271

the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
ConnectedInterval :
Type
CausalSmith.Stat.MarRareqLogfrontier.ConnectedInterval · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Basic.lean:273
instance instMeasurableSpaceConnectedInterval

the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
instance : MeasurableSpace ConnectedInterval := by unfold ConnectedInterval infer_instance
CausalSmith.Stat.MarRareqLogfrontier.instMeasurableSpaceConnectedInterval · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Basic.lean:276
def lo

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Definition (Lean source)
lo I :
ℝ
I.1.1
CausalSmith.Stat.MarRareqLogfrontier.ConnectedInterval.lo · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Basic.lean:281
def hi

The interval has right endpoint equal to its second coordinate.

Definition (Lean source)
hi I :
ℝ
I.1.2
CausalSmith.Stat.MarRareqLogfrontier.ConnectedInterval.hi · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Basic.lean:283
theorem lower

The interval has left endpoint at least minus one.

Formal statement
-1 ≤ I.lo
Proof (Lean source)
lemma ConnectedInterval.lower (I : ConnectedInterval) : -1 ≤ I.lo := I.2.1
CausalSmith.Stat.MarRareqLogfrontier.ConnectedInterval.lower · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Basic.lean:285
theorem ordered

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
I.lo ≤ I.hi
Proof (Lean source)
lemma ConnectedInterval.ordered (I : ConnectedInterval) : I.lo ≤ I.hi := I.2.2.1
CausalSmith.Stat.MarRareqLogfrontier.ConnectedInterval.ordered · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Basic.lean:287
theorem upper

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
I.hi ≤ 1
Proof (Lean source)
lemma ConnectedInterval.upper (I : ConnectedInterval) : I.hi ≤ 1 := I.2.2.2
CausalSmith.Stat.MarRareqLogfrontier.ConnectedInterval.upper · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Basic.lean:289
theorem measurable_connectedInterval_lo

the stated mathematical conclusion holds.

Formal statement
Measurable ConnectedInterval.lo
Proof (Lean source)
@[fun_prop] lemma measurable_connectedInterval_lo : Measurable ConnectedInterval.lo := measurable_fst.comp measurable_subtype_coe
CausalSmith.Stat.MarRareqLogfrontier.measurable_connectedInterval_lo · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Basic.lean:292
theorem measurable_connectedInterval_hi

the stated mathematical conclusion holds.

Formal statement
Measurable ConnectedInterval.hi
Proof (Lean source)
@[fun_prop] lemma measurable_connectedInterval_hi : Measurable ConnectedInterval.hi := measurable_snd.comp measurable_subtype_coe
CausalSmith.Stat.MarRareqLogfrontier.measurable_connectedInterval_hi · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Basic.lean:295
def closedLeft

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
closedLeft _I :
CausalSmith.Stat.MarRareqLogfrontier.ConnectedInterval.closedLeft · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Basic.lean:299
def closedRight

The connected interval is closed at its right endpoint.

Definition (Lean source)
closedRight _I :
CausalSmith.Stat.MarRareqLogfrontier.ConnectedInterval.closedRight · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Basic.lean:301

The interval contains the point exactly when both endpoint tests hold.

Definition (Lean source)
t :
ℝ
intervalContains I t :
Prop
clause 1
if I.closedLeft then I.lo ≤ t else I.lo < t
clause 2
if I.closedRight then t ≤ I.hi else t < I.hi
CausalSmith.Stat.MarRareqLogfrontier.intervalContains · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Basic.lean:304
def IntervalProcedure

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
n d :
ℕ
IntervalProcedure n d :
Type
CausalSmith.Stat.MarRareqLogfrontier.IntervalProcedure · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Basic.lean:309
def ofMap

A measurable interval-valued map defines the corresponding deterministic interval procedure.

Definition (Lean source)
n d :
ℕ
f :
hf :
ofMap f hf :
⟨Kernel.deterministic f hf, inferInstance⟩
CausalSmith.Stat.MarRareqLogfrontier.IntervalProcedure.ofMap · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Basic.lean:314

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
n d :
ℕ
q α :
ℝ
P :
HonestInterval n d q α T :
Prop
1 - α ≤ ∫ s, (T.1 s).real {I | intervalContains I (ate P)} ∂(sampleLaw n P)
CausalSmith.Stat.MarRareqLogfrontier.HonestInterval · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Basic.lean:319
def intervalRisk

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
n d :
ℕ
P :
intervalRisk T P :
ℝ
∫ s, (∫ I : ConnectedInterval, I.hi - I.lo ∂(T.1 s)) ∂(sampleLaw n P)
CausalSmith.Stat.MarRareqLogfrontier.intervalRisk · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Basic.lean:325

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
n d :
ℕ
f :
(Fin n → ObsRecord d) → ℝ × ℝ
P :
deterministicIntervalRisk f P :
ℝ
∫ s, (f s).2 - (f s).1 ∂(sampleLaw n P)
CausalSmith.Stat.MarRareqLogfrontier.deterministicIntervalRisk · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Basic.lean:330
def intervalLengthRisk Definition 29 in the paper ↗

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
n d :
ℕ
q α :
ℝ
intervalLengthRisk n d q α :
ℝ
minimaxValueReal (E := {T : IntervalProcedure n d // HonestInterval n d q α T}) (Θ := {P : FullLaw d // RareArrivalModelClass n d q P}) (fun T P => intervalRisk T.1 P.1)
CausalSmith.Stat.MarRareqLogfrontier.intervalLengthRisk · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Basic.lean:336
def unrestrictedMinimaxRisk

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
n d :
ℕ
q :
ℝ
unrestrictedMinimaxRisk n d q :
ℝ
minimaxValueReal (E := Estimator n d) (Θ := {P : FullLaw d // UnrestrictedArrivalModelClass n d q P}) (fun T P => squaredRisk T P.1)
CausalSmith.Stat.MarRareqLogfrontier.unrestrictedMinimaxRisk · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Basic.lean:345
def ZengRecord

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
d :
ℕ
ZengRecord d :
Type
Fin d × Bool × Bool
CausalSmith.Stat.MarRareqLogfrontier.ZengRecord · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Basic.lean:353

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
d :
ℕ
ZengLaw d :
Type
CausalSmith.Stat.MarRareqLogfrontier.ZengLaw · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Basic.lean:356
def zengCategory

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
d :
ℕ
P :
x :
Fin d
zengCategory P x :
ℝ
P.1.real {r | r.1 = x}
CausalSmith.Stat.MarRareqLogfrontier.zengCategory · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Basic.lean:359
def zengArm

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
d :
ℕ
P :
x :
Fin d
b :
zengArm P x b :
ℝ
P.1.real {r | r.1 = x ∧ r.2.1 = b}
CausalSmith.Stat.MarRareqLogfrontier.zengArm · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Basic.lean:362
def zengMean

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
d :
ℕ
P :
x :
Fin d
b :
_h :
0 < zengCategory P x
zengMean P x b _h :
ℝ
P.1.real {r | r.1 = x ∧ r.2.1 = b ∧ r.2.2 = true} / zengArm P x b
CausalSmith.Stat.MarRareqLogfrontier.zengMean · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Basic.lean:365
def zengDiscreteClass

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
d :
ℕ
ε :
ℝ
zengDiscreteClass d ε :
{P | 0 < ε ∧ ε < 1 / 2 ∧ 1 ≤ d ∧ ∀ x : Fin d, 0 < zengCategory P x → ε * zengCategory P x ≤ zengArm P x true ∧ zengArm P x true ≤ (1 - ε) * zengCategory P x}
CausalSmith.Stat.MarRareqLogfrontier.zengDiscreteClass · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Basic.lean:371
def zengATE

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
d :
ℕ
P :
zengATE P :
ℝ
∑ x : Fin d, if h : 0 < zengCategory P x then zengCategory P x * (zengMean P x true h - zengMean P x false h) else 0
CausalSmith.Stat.MarRareqLogfrontier.zengATE · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Basic.lean:381
def ReciprocalBestApproximation

the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
ReciprocalBestApproximation :
Sort 0
∀ K : ℕ
if
2 ≤ K
then
bestUniformApproxError (fun z : ℝ => z⁻¹) 1 ((K : ℝ) ^ 2) K
= (((K : ℝ) ^ 2 - 1) / (2 * (K : ℝ) ^ 2)) * (((K : ℝ) - 1) / ((K : ℝ) + 1)) ^ K
CausalSmith.Stat.MarRareqLogfrontier.ReciprocalBestApproximation · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Basic.lean:387
theorem reciprocalBestApproximation_proved Lemma 6 in the paper ↗

the stated mathematical conclusion holds.

Formal statement
Proof (Lean source)
-- keep: discharges cited node lem:reciprocal-best-approximation; stable staging theorem, relink to promoted Causalean module after study -- @node: lem:reciprocal-best-approximation lemma reciprocalBestApproximation_proved : ReciprocalBestApproximation := by intro K hK exact bestUniformApproxError_reciprocal_one_sq K hK
CausalSmith.Stat.MarRareqLogfrontier.reciprocalBestApproximation_proved · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Basic.lean:395
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.Activation 14 declarations Explicit finite activated laws and the two prior-mixture experiments.

Explicit finite activated laws and the two prior-mixture experiments.

def lowerDegree

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
n :
ℕ
q :
ℝ
lowerDegree n q :
ℕ
def lowerEndpoint

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
n :
ℕ
q :
ℝ
lowerEndpoint n q :
ℝ
(lowerDegree n q : ℝ) ^ 2
CausalSmith.Stat.MarRareqLogfrontier.lowerEndpoint · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Activation.lean:19
theorem lower_activation_probability_le_one

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n :
ℕ
q :
ℝ
hq :
0 ≤ q
hslice :
q * lowerEndpoint n q ≤ 1
Proof (Lean source)
-- @node: lower_activation_probability_le_one lemma lower_activation_probability_le_one (n : ℕ) (q : ℝ) (hq : 0 ≤ q) (hslice : RareArrivalSlice n q) : q * lowerEndpoint n q ≤ 1 := by have hN : 0 ≤ effectiveSize n q := by unfold effectiveSize positivity have hlog : 1 ≤ logScale n q := by unfold logScale have harg : exp 1 ≤ exp 1 + effectiveSize n q := by linarith have hpos : 0 < exp (1 : ℝ) := Real.exp_pos _ have := Real.log_le_log hpos harg simpa using this have hceil : (lowerDegree n q : ℝ) ≤ 2 * logScale n q := by have h := Nat.ceil_lt_add_one (show 0 ≤ logScale n q by linarith) unfold lowerDegree exact le_of_lt (lt_of_lt_of_le h (by linarith)) have hdegree : 0 ≤ (lowerDegree n q : ℝ) := by positivity have hsq : lowerEndpoint n q ≤ 4 * (logScale n q) ^ 2 := by unfold lowerEndpoint nlinarith [sq_nonneg ((lowerDegree n q : ℝ) - 2 * logScale n q)] have hslice' : q * (logScale n q) ^ 2 ≤ 1 / 64 := hslice nlinarith
CausalSmith.Stat.MarRareqLogfrontier.lower_activation_probability_le_one · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Activation.lean:22
def rareMass

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
η :
ℝ
n :
ℕ
q :
ℝ
rareMass η n q :
ℝ
η / (effectiveSize n q * logScale n q)
def rareCount

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
η :
ℝ
n d :
ℕ
q :
ℝ
rareCount η n d q :
ℕ
min (d - 1) (floor ((2 * rareMass η n q)⁻¹))
def FiniteReciprocalPrior

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
H :
ℝ
prior :
FiniteReciprocalPrior H prior :
Prop
clause 1
clause 2
∃ support : Finset ℝ,
prior (support : Set ℝ) = 1
z ∈ support :
1 ≤ z
z ≤ H
CausalSmith.Stat.MarRareqLogfrontier.FiniteReciprocalPrior · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Activation.lean:57
def baselineMass

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
η :
ℝ
n d :
ℕ
q :
ℝ
x :
Fin d
baselineMass η n d q x :
ℝ
if x.val < rareCount η n d q then rareMass η n q else if x.val
= rareCount η n d q then 1 - rareCount η n d q * rareMass η n q else 0
CausalSmith.Stat.MarRareqLogfrontier.baselineMass · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Activation.lean:64
def lowerCellZ

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
η :
ℝ
n d :
ℕ
q :
ℝ
z :
Fin d → ℝ
x :
Fin d
lowerCellZ η n d q z x :
ℝ
if x.val < rareCount η n d q then z x else lowerEndpoint n q
def bernWeight

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
p :
ℝ
b :
bernWeight p b :
ℝ
if b then p else 1 - p
def lowerFullRecord

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
d :
ℕ
x :
Fin d
a y₁ arrival :
lowerFullRecord x a y₁ arrival :
⟨x, a, false, false, false, y₁, arrival⟩
CausalSmith.Stat.MarRareqLogfrontier.lowerFullRecord · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Activation.lean:78
def activatedLaw

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
η :
ℝ
n d :
ℕ
q :
ℝ
z :
Fin d → ℝ
_hz :
∀ x, z x ∈ Icc (1 : ℝ) (lowerEndpoint n q)
activatedLaw η n d q z _hz :
∑ x : Fin d, ∑ a : Bool, ∑ y₁ : Bool, ∑ arrival : Bool, ofReal (baselineMass η n d q x / 2 * bernWeight (if x.val < rareCount η n d q then (z x)⁻¹ else 0) y₁ * bernWeight (q * lowerCellZ η n d q z x) arrival) • Measure.dirac (lowerFullRecord x a y₁ arrival)
CausalSmith.Stat.MarRareqLogfrontier.activatedLaw · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Activation.lean:82
def augmentedOutcomeWeight

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
η :
ℝ
n d :
ℕ
q :
ℝ
z :
Fin d → ℝ
x :
Fin d
a flag arrival one :
augmentedOutcomeWeight η n d q z x a flag arrival one :
ℝ
if !flag then if !arrival && !one then 1 else 0 else if one then if arrival && a && x.val < rareCount η n d q then 1 / lowerEndpoint n q else 0 else if arrival then if a && x.val < rareCount η n d q then (z x - 1) / lowerEndpoint n q else lowerCellZ η n d q z x / lowerEndpoint n q else 1
- lowerCellZ η n d q z x / lowerEndpoint n q
CausalSmith.Stat.MarRareqLogfrontier.augmentedOutcomeWeight · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Activation.lean:94
def augmentedOneRecord

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
η :
ℝ
n d :
ℕ
q :
ℝ
z :
Fin d → ℝ
_hz :
∀ x, z x ∈ Icc (1 : ℝ) (lowerEndpoint n q)
augmentedOneRecord η n d q z _hz :
∑ x : Fin d, ∑ a : Bool, ∑ flag : Bool, ∑ arrival : Bool, ∑ one : Bool, ofReal (baselineMass η n d q x / 2 * bernWeight (q * lowerEndpoint n q) flag * augmentedOutcomeWeight η n d q z x a flag arrival one) • Measure.dirac (flag, ⟨x, a, false, arrival, one⟩)
CausalSmith.Stat.MarRareqLogfrontier.augmentedOneRecord · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Activation.lean:105
def activationHandle

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
η :
ℝ
@realizes \(\eta\)(universal constant selected before n,d,q)
_hη :
0 < η
@realizes \(\eta\)(positive universal constant) @realizes \(b_0\)(activation-scope positive numerator)
n d :
ℕ
q :
ℝ
_hn :
1 ≤ n
@realizes \(b_0\)(activation-scope positive sample size)
_hd :
1 ≤ d
_hq_pos :
0 < q
@realizes \(b_0\)(activation-scope positive arrival floor)
_hq_le_one :
q ≤ 1
_hregime :
prior0 :
@realizes \(\Pi_0\)(first prior carrier)
prior1 :
@realizes \(\Pi_1\)(second prior carrier)
_hprior0 :
@realizes \(\Pi_0\)(finite probability supported on [1,H])
_hprior1 :
@realizes \(\Pi_1\)(finite probability supported on [1,H])
_hmoments :
∀ v : ℕ
if
v ≤ lowerDegree n q
then
(∫ z, z ^ v ∂prior0) = ∫ z, z ^ v ∂prior1
_hseparation :
1 / 12 ≤ |(∫ z, z⁻¹ ∂prior1) - (∫ z, z⁻¹ ∂prior0)|
activationHandle η _hη n d q _hn _hd _hq_pos _hq_le_one _hregime prior0 prior1 _hprior0 _hprior1 _hmoments _hseparation :
Measure (Fin n → Bool × ObsRecord d) × Measure (Fin n → Bool × ObsRecord d)
((Measure.pi (fun _ : Fin d => prior0)).bind (fun z => if hz : ∀ x, z x ∈ Icc (1 : ℝ) (lowerEndpoint n q) then Measure.pi (fun _ : Fin n => augmentedOneRecord η n d q z hz) else 0), (Measure.pi (fun _ : Fin d => prior1)).bind (fun z => if hz : ∀ x, z x ∈ Icc (1 : ℝ) (lowerEndpoint n q) then Measure.pi (fun _ : Fin n => augmentedOneRecord η n d q z hz) else 0))
CausalSmith.Stat.MarRareqLogfrontier.activationHandle · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Activation.lean:118
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.Certificate.BiasVariance 11 declarations The bounded auxiliary risk from marked moments and pilot selection.

The bounded auxiliary risk from marked moments and pilot selection.

theorem mixedCountEstimator_eq_zero_of_effectiveSize_le_one

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
hsmall :
effectiveSize n q ≤ 1
sample :
Fin n → ObsRecord d
mixedCountEstimator n d q sample = 0
Proof (Lean source)
-- @node: mixedCountEstimator_eq_zero_of_effectiveSize_le_one lemma mixedCountEstimator_eq_zero_of_effectiveSize_le_one (n d : ℕ) (q : ℝ) (hsmall : effectiveSize n q ≤ 1) (sample : Fin n → ObsRecord d) : mixedCountEstimator n d q sample = 0 := by simp [mixedCountEstimator, auxiliaryMixedValue, hsmall]
CausalSmith.Stat.MarRareqLogfrontier.mixedCountEstimator_eq_zero_of_effectiveSize_le_one · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/BiasVariance.lean:24
theorem riskEnvelope_eq_one_of_effectiveSize_le_one

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
hsmall :
effectiveSize n q ≤ 1
riskEnvelope n d q = 1
Proof (Lean source)
-- @node: riskEnvelope_eq_one_of_effectiveSize_le_one lemma riskEnvelope_eq_one_of_effectiveSize_le_one (n d : ℕ) (q : ℝ) (hsmall : effectiveSize n q ≤ 1) : riskEnvelope n d q = 1 := by simp [riskEnvelope, hsmall]
CausalSmith.Stat.MarRareqLogfrontier.riskEnvelope_eq_one_of_effectiveSize_le_one · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/BiasVariance.lean:32
theorem mixedCountEstimator_risk_eq_sq_of_effectiveSize_le_one

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
P :
hsmall :
effectiveSize n q ≤ 1
(∫ sample, (mixedCountEstimator n d q sample - cellFunctional P) ^ 2 ∂(sampleLaw n P))
= (cellFunctional P) ^ 2
Proof (Lean source)
-- @node: mixedCountEstimator_risk_eq_sq_of_effectiveSize_le_one lemma mixedCountEstimator_risk_eq_sq_of_effectiveSize_le_one (n d : ℕ) (q : ℝ) (P : FullLaw d) (hsmall : effectiveSize n q ≤ 1) : (∫ sample, (mixedCountEstimator n d q sample - cellFunctional P) ^ 2 ∂(sampleLaw n P)) = (cellFunctional P) ^ 2 := by let : IsProbabilityMeasure P.1 := P.2 have : IsProbabilityMeasure (P.1.map obs) := Measure.isProbabilityMeasure_map (by fun_prop : AEMeasurable obs P.1) have : IsProbabilityMeasure (sampleLaw n P) := by unfold sampleLaw infer_instance simp only [mixedCountEstimator_eq_zero_of_effectiveSize_le_one n d q hsmall, zero_sub, neg_sq] simp
CausalSmith.Stat.MarRareqLogfrontier.mixedCountEstimator_risk_eq_sq_of_effectiveSize_le_one · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/BiasVariance.lean:39
theorem unrestricted_auxiliary_risk_envelope_small

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
P :
hsmall :
effectiveSize n q ≤ 1
(∫ sample, (mixedCountEstimator n d q sample - cellFunctional P) ^ 2 ∂(sampleLaw n P))
≤ riskEnvelope n d q
Proof (Lean source)
-- @node: unrestricted_auxiliary_risk_envelope_small lemma unrestricted_auxiliary_risk_envelope_small (n d : ℕ) (q : ℝ) (P : FullLaw d) (hP : UnrestrictedArrivalModelClass n d q P) (hsmall : effectiveSize n q ≤ 1) : (∫ sample, (mixedCountEstimator n d q sample - cellFunctional P) ^ 2 ∂(sampleLaw n P)) ≤ riskEnvelope n d q := by rw [mixedCountEstimator_risk_eq_sq_of_effectiveSize_le_one n d q P hsmall, riskEnvelope_eq_one_of_effectiveSize_le_one n d q hsmall] have htarget := cellFunctional_mem_Icc P hP nlinarith [htarget.1, htarget.2]
CausalSmith.Stat.MarRareqLogfrontier.unrestricted_auxiliary_risk_envelope_small · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/BiasVariance.lean:56
theorem unrestricted_mixedCountEstimator_risk_le_four

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
P :
(∫ sample, (mixedCountEstimator n d q sample - cellFunctional P) ^ 2 ∂(sampleLaw n P)) ≤ 4
Proof (Lean source)
-- @node: unrestricted_mixedCountEstimator_risk_le_four lemma unrestricted_mixedCountEstimator_risk_le_four (n d : ℕ) (q : ℝ) (P : FullLaw d) (hP : UnrestrictedArrivalModelClass n d q P) : (∫ sample, (mixedCountEstimator n d q sample - cellFunctional P) ^ 2 ∂(sampleLaw n P)) ≤ 4 := by let : IsProbabilityMeasure P.1 := P.2 have : IsProbabilityMeasure (P.1.map obs) := Measure.isProbabilityMeasure_map (by fun_prop : AEMeasurable obs P.1) have : IsProbabilityMeasure (sampleLaw n P) := by unfold sampleLaw infer_instance calc _ ≤ ∫ _sample : Fin n → ObsRecord d, (4 : ℝ) ∂sampleLaw n P := by apply integral_mono (Integrable.of_finite) (integrable_const _) intro sample exact sq_sub_le_four_of_mem_Icc ((mixed_count_estimator_regular n d q).2 sample) (cellFunctional_mem_Icc P hP) _ = 4 := by simp
CausalSmith.Stat.MarRareqLogfrontier.unrestricted_mixedCountEstimator_risk_le_four · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/BiasVariance.lean:68
theorem unrestricted_auxiliary_risk_envelope_active

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
P :
hb :
hlarge :
¬ effectiveSize n q ≤ 1
(∫ sample, (mixedCountEstimator n d q sample - cellFunctional P) ^ 2 ∂sampleLaw n P)
≤ riskEnvelope n d q
Proof (Lean source)
-- @node: unrestricted_auxiliary_risk_envelope_active lemma unrestricted_auxiliary_risk_envelope_active (n d : ℕ) (q : ℝ) (P : FullLaw d) (hP : UnrestrictedArrivalModelClass n d q P) (hb : needleBranch n d q) (hlarge : ¬ effectiveSize n q ≤ 1) : (∫ sample, (mixedCountEstimator n d q sample - cellFunctional P) ^ 2 ∂sampleLaw n P) ≤ riskEnvelope n d q := by have ht := deterministicRisk_mixedCountEstimator_le_streamRisk_add_tail n d q P rw [unrestricted_cell_identification P hP] at ht rw [← integral_sq_poissonAuxiliaryMixedValue_eq_streams] at ht have hi := integral_sq_poissonAuxiliaryMixedValue_le_active_budget n d q P hP hb hlarge simp only [riskEnvelope, if_neg hlarge, not_true_eq_false, hb, if_false] apply le_min (unrestricted_mixedCountEstimator_risk_le_four n d q P hP) simp only [deterministicRisk, unrestricted_cell_identification P hP] at ht exact ht.trans (add_le_add hi le_rfl)
CausalSmith.Stat.MarRareqLogfrontier.unrestricted_auxiliary_risk_envelope_active · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/BiasVariance.lean:89
theorem abs_integral_poissonRawMixedValue_bias_le_ratio

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
P :
hb :
¬ needleBranch n d q
|(∫ s, poissonRawMixedValue n d q s ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2))
≤ 8 * d / (exp 1 * streamEffectiveSize n q)
Proof (Lean source)
-- @node: abs_integral_poissonRawMixedValue_bias_le_ratio lemma abs_integral_poissonRawMixedValue_bias_le_ratio (n d : ℕ) (q : ℝ) (P : FullLaw d) (hP : UnrestrictedArrivalModelClass n d q P) (hb : ¬ needleBranch n d q) : |(∫ s, poissonRawMixedValue n d q s ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) - cellFunctional P| ≤ 8 * d / (exp 1 * streamEffectiveSize n q) := by classical have hn : 0 < n := lt_of_lt_of_le Nat.zero_lt_one hP.n_pos have hj (j : Cell d) : Integrable (fun s ↦ armSign j.1 * poissonMemberWeight n j s * poissonSelectedCellEstimate n d q j s) (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) := by simpa only [mul_assoc] using ((memLp_poissonMemberWeight_mul_selectedCellEstimate n d q P j).integrable (by norm_num)).const_mul (armSign j.1) have hc (j : Cell d) : cellContribution P j = cellProb P j * cellMean P j := by by_cases ha : 0 < arrivedCell P j · simp [cellContribution, ha] · simp [cellContribution, cellMean, ha] change |(∫ s, 2 * ∑ j : Cell d, armSign j.1 * poissonMemberWeight n j s * poissonSelectedCellEstimate n d q j s ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) - cellFunctional P| ≤ _ rw [integral_const_mul, integral_finsetSum _ (fun j _ ↦ hj j)] simp_rw [mul_assoc (armSign _) (poissonMemberWeight _ _ _) _, integral_const_mul, integral_poissonMemberWeight_mul_selectedCellEstimate n d q P _ hn] rw [cellFunctional] simp_rw [hc, ← mul_assoc] rw [← mul_sub, ← Finset.sum_sub_distrib] have heq : (∑ j : Cell d, ( armSign j.1 * cellProb P j * (∫ s, poissonSelectedCellEstimate n d q j s ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) - armSign j.1 * cellProb P j * cellMean P j)) = ∑ j : Cell d, armSign j.1 * cellProb P j * ((∫ s, poissonSelectedCellEstimate n d q j s ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) - cellMean P j) := by apply Finset.sum_congr rfl intro j _ ring rw [heq] simpa only [poissonSelectedCellEstimate, hb, false_and, if_false] using abs_ratioBranch_aggregate_bias_le n d q P hP
CausalSmith.Stat.MarRareqLogfrontier.abs_integral_poissonRawMixedValue_bias_le_ratio · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/BiasVariance.lean:105
theorem variance_poissonRawMixedValue_le_ratio_budget

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
P :
hb :
¬ needleBranch n d q
≤ 4 * (4 / streamEffectiveSize n q + 1 / streamSize n)
Proof (Lean source)
-- @node: variance_poissonRawMixedValue_le_ratio_budget lemma variance_poissonRawMixedValue_le_ratio_budget (n d : ℕ) (q : ℝ) (P : FullLaw d) (hP : UnrestrictedArrivalModelClass n d q P) (hb : ¬ needleBranch n d q) : variance (poissonRawMixedValue n d q) (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) ≤ 4 * (4 / streamEffectiveSize n q + 1 / streamSize n) := by rw [variance_poissonRawMixedValue_eq_four_sum] simp only [poissonSelectedCellEstimate, hb, false_and, if_false] exact mul_le_mul_of_nonneg_left (sum_variance_poissonMemberWeight_mul_ratioBranch_le n d q P hP) (by norm_num)
CausalSmith.Stat.MarRareqLogfrontier.variance_poissonRawMixedValue_le_ratio_budget · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/BiasVariance.lean:150
theorem integral_sq_poissonAuxiliaryMixedValue_le_ratio_budget

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
P :
hb :
¬ needleBranch n d q
hlarge :
¬ effectiveSize n q ≤ 1
(∫ s, (poissonAuxiliaryMixedValue n d q s - cellFunctional P) ^ 2 ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2))
≤ (8 * d / (exp 1 * streamEffectiveSize n q)) ^ 2
+ 4 * (4 / streamEffectiveSize n q + 1 / streamSize n)
Proof (Lean source)
-- @node: integral_sq_poissonAuxiliaryMixedValue_le_ratio_budget lemma integral_sq_poissonAuxiliaryMixedValue_le_ratio_budget (n d : ℕ) (q : ℝ) (P : FullLaw d) (hP : UnrestrictedArrivalModelClass n d q P) (hb : ¬ needleBranch n d q) (hlarge : ¬ effectiveSize n q ≤ 1) : (∫ s, (poissonAuxiliaryMixedValue n d q s - cellFunctional P) ^ 2 ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) ≤ (8 * d / (exp 1 * streamEffectiveSize n q)) ^ 2 + 4 * (4 / streamEffectiveSize n q + 1 / streamSize n) := by have hbias := abs_integral_poissonRawMixedValue_bias_le_ratio n d q P hP hb have hs := mul_self_le_mul_self (abs_nonneg _) hbias have hs' : ((∫ s, poissonRawMixedValue n d q s ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) - cellFunctional P) ^ 2 ≤ (8 * d / (exp 1 * streamEffectiveSize n q)) ^ 2 := by simpa only [← sq, sq_abs] using hs have hv := variance_poissonRawMixedValue_le_ratio_budget n d q P hP hb refine (integral_sq_poissonAuxiliaryMixedValue_le_raw n d q P hP hlarge).trans ?_ rw [integral_sq_poissonRawMixedValue_error_eq] exact (add_le_add hv hs').trans_eq (add_comm _ _)
CausalSmith.Stat.MarRareqLogfrontier.integral_sq_poissonAuxiliaryMixedValue_le_ratio_budget · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/BiasVariance.lean:163
theorem unrestricted_auxiliary_risk_envelope_ratio

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
P :
hb :
¬ needleBranch n d q
hlarge :
¬ effectiveSize n q ≤ 1
(∫ sample, (mixedCountEstimator n d q sample - cellFunctional P) ^ 2 ∂sampleLaw n P)
≤ riskEnvelope n d q
Proof (Lean source)
-- @node: unrestricted_auxiliary_risk_envelope_ratio lemma unrestricted_auxiliary_risk_envelope_ratio (n d : ℕ) (q : ℝ) (P : FullLaw d) (hP : UnrestrictedArrivalModelClass n d q P) (hb : ¬ needleBranch n d q) (hlarge : ¬ effectiveSize n q ≤ 1) : (∫ sample, (mixedCountEstimator n d q sample - cellFunctional P) ^ 2 ∂sampleLaw n P) ≤ riskEnvelope n d q := by have ht := deterministicRisk_mixedCountEstimator_le_streamRisk_add_tail n d q P rw [unrestricted_cell_identification P hP] at ht rw [← integral_sq_poissonAuxiliaryMixedValue_eq_streams] at ht have hi := integral_sq_poissonAuxiliaryMixedValue_le_ratio_budget n d q P hP hb hlarge simp only [riskEnvelope, if_neg hlarge, hb, not_false_eq_true, if_true] apply le_min (unrestricted_mixedCountEstimator_risk_le_four n d q P hP) simp only [deterministicRisk, unrestricted_cell_identification P hP] at ht exact ht.trans (add_le_add hi le_rfl)
CausalSmith.Stat.MarRareqLogfrontier.unrestricted_auxiliary_risk_envelope_ratio · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/BiasVariance.lean:184
theorem unrestricted_auxiliary_risk_envelope

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
P :
(∫ sample, (mixedCountEstimator n d q sample - cellFunctional P) ^ 2 ∂(sampleLaw n P))
≤ riskEnvelope n d q
Proof (Lean source)
lemma unrestricted_auxiliary_risk_envelope (n d : ℕ) (q : ℝ) (P : FullLaw d) (hP : UnrestrictedArrivalModelClass n d q P) : (∫ sample, (mixedCountEstimator n d q sample - cellFunctional P) ^ 2 ∂(sampleLaw n P)) ≤ riskEnvelope n d q := by by_cases hsmall : effectiveSize n q ≤ 1 · exact unrestricted_auxiliary_risk_envelope_small n d q P hP hsmall · by_cases hcap : riskEnvelope n d q = 4 · rw [hcap] exact unrestricted_mixedCountEstimator_risk_le_four n d q P hP · by_cases hb : needleBranch n d q · exact unrestricted_auxiliary_risk_envelope_active n d q P hP hb hsmall · exact unrestricted_auxiliary_risk_envelope_ratio n d q P hP hb hsmall
CausalSmith.Stat.MarRareqLogfrontier.unrestricted_auxiliary_risk_envelope · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/BiasVariance.lean:201
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.Certificate.CellIntensity 4 declarations Effective cell intensities inside the ambient marked Poisson sample.

Effective cell intensities inside the ambient marked Poisson sample.

def arrivedStreamIntensity

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
n :
ℕ
d :
ℕ
P :
pool :
Fin 3
j :
Cell d
arrivedStreamIntensity n P pool j :
ℝ≥0
((n : ℝ≥0) / 2) * ((markedObsLaw P) (streamEvent pool j true false)).toNNReal
CausalSmith.Stat.MarRareqLogfrontier.arrivedStreamIntensity · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/CellIntensity.lean:17
theorem coe_arrivedStreamIntensity

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n :
ℕ
d :
ℕ
P :
pool :
Fin 3
j :
Cell d
(arrivedStreamIntensity n P pool j : ℝ) = streamSize n * arrivedCell P j
Proof (Lean source)
lemma coe_arrivedStreamIntensity (n : ℕ) {d : ℕ} (P : FullLaw d) (pool : Fin 3) (j : Cell d) : (arrivedStreamIntensity n P pool j : ℝ) = streamSize n * arrivedCell P j := by unfold arrivedStreamIntensity change ((n : ℝ) / 2) * ((markedObsLaw P) (streamEvent pool j true false)).toReal = _ rw [← measureReal_def, markedObsLaw_streamEvent_real, map_obsStreamEvent_arrived_real] unfold streamSize ring
CausalSmith.Stat.MarRareqLogfrontier.coe_arrivedStreamIntensity · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/CellIntensity.lean:23
theorem streamEffectiveSize_mul_cellProb_le_arrivedStreamIntensity

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
P :
pool :
Fin 3
j :
Cell d
streamEffectiveSize n q * cellProb P j ≤ (arrivedStreamIntensity n P pool j : ℝ)
Proof (Lean source)
lemma streamEffectiveSize_mul_cellProb_le_arrivedStreamIntensity (n d : ℕ) (q : ℝ) (P : FullLaw d) (hP : UnrestrictedArrivalModelClass n d q P) (pool : Fin 3) (j : Cell d) : streamEffectiveSize n q * cellProb P j ≤ (arrivedStreamIntensity n P pool j : ℝ) := by rw [coe_arrivedStreamIntensity] unfold streamEffectiveSize have hm : 0 ≤ streamSize n := by unfold streamSize positivity by_cases hj : 0 < cellProb P j · simpa only [mul_assoc] using mul_le_mul_of_nonneg_left (hP.arrival j hj) hm · have hj' : cellProb P j = 0 := le_antisymm (le_of_not_gt hj) measureReal_nonneg rw [hj', mul_zero] exact mul_nonneg hm measureReal_nonneg
CausalSmith.Stat.MarRareqLogfrontier.streamEffectiveSize_mul_cellProb_le_arrivedStreamIntensity · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/CellIntensity.lean:36
theorem integral_sq_markedPoissonFactorialBranch_le_exp_of_light

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
P :
j :
Cell d
hbranch :
hlight :
(∫ s, (poissonFactorialBranch n d q j s) ^ 2 ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2))
≤ exp (logScale n q / 8)
Proof (Lean source)
lemma integral_sq_markedPoissonFactorialBranch_le_exp_of_light (n d : ℕ) (q : ℝ) (P : FullLaw d) (j : Cell d) (hbranch : needleBranch n d q) (hlight : streamSize n * arrivedCell P j ≤ needleRadius n q) : (∫ s, (poissonFactorialBranch n d q j s) ^ 2 ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) ≤ exp (logScale n q / 8) := by apply integral_sq_poissonFactorialBranch_le_exp_effective n d q j (markedObsLaw P) ((n : ℝ≥0) / 2) hbranch change (arrivedStreamIntensity n P 2 j : ℝ) ≤ needleRadius n q rw [coe_arrivedStreamIntensity] exact hlight
CausalSmith.Stat.MarRareqLogfrontier.integral_sq_markedPoissonFactorialBranch_le_exp_of_light · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/CellIntensity.lean:54
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.Certificate.ChebyshevNeedle 1 declarations Chebyshev needle bounds used by the light-cell analysis.

Chebyshev needle bounds used by the light-cell analysis.

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
k :
ℕ
x :
ℝ
hx :
x ∈ Icc (-1) 1
conclusion 1
0 ≤ 1 - (Chebyshev.T ℝ (k : ℤ)).eval x
conclusion 2
1 - (Chebyshev.T ℝ (k : ℤ)).eval x ≤ (k : ℝ)^2 * (1 - x)
Proof (Lean source)
lemma cheb_secant (k : ℕ) (x : ℝ) (hx : x ∈ Icc (-1) 1) : 0 ≤ 1 - (Chebyshev.T ℝ (k : ℤ)).eval x ∧ 1 - (Chebyshev.T ℝ (k : ℤ)).eval x ≤ (k : ℝ)^2 * (1 - x) := by have hT := Chebyshev.abs_eval_T_real_le_one (k : ℤ) (show |x| ≤ 1 by exact abs_le.mpr ⟨hx.1, hx.2⟩) have hderiv (y : ℝ) (hy : y ∈ Ico x 1) : |(derivative (Chebyshev.T ℝ (k : ℤ))).eval y| ≤ (k : ℝ)^2 := by have hyy : |y| ≤ 1 := abs_le.mpr ⟨le_trans hx.1 hy.1, le_of_lt hy.2⟩ have hh := Chebyshev.abs_iterate_derivative_T_real_le (k : ℤ) 1 hyy simpa [Chebyshev.derivative_T_eval_one] using hh have hmv := norm_image_sub_le_of_norm_deriv_le_segment' (f := fun y : ℝ => (Chebyshev.T ℝ (k : ℤ)).eval y) (f' := fun y : ℝ => (derivative (Chebyshev.T ℝ (k : ℤ))).eval y) (a := x) (b := 1) (C := (k : ℝ)^2) (fun y _ => (Chebyshev.T ℝ (k : ℤ)).hasDerivWithinAt y (Icc x 1)) (by intro y hy; simpa only [Real.norm_eq_abs] using hderiv y hy) (1 : ℝ) (show (1 : ℝ) ∈ Icc x 1 from ⟨hx.2, le_refl _⟩) constructor · have := (abs_le.mp hT).2 linarith · rw [Chebyshev.T_eval_one] at hmv have := (abs_le.mp (by simpa only [Real.norm_eq_abs] using hmv)).2 linarith
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.Certificate.CoefficientOneNorm 11 declarations Coefficient one-norm transport lemmas for the rescaled Chebyshev needle.

Coefficient one-norm transport lemmas for the rescaled Chebyshev needle.

theorem polynomialCoeffOneNorm_nonneg

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
p :
Proof (Lean source)
lemma polynomialCoeffOneNorm_nonneg (p : Polynomial ℝ) : 0 ≤ polynomialCoeffOneNorm p := by change 0 ≤ p.sum (fun _ c => |c|) exact Finset.sum_nonneg fun _ _ => abs_nonneg _
CausalSmith.Stat.MarRareqLogfrontier.polynomialCoeffOneNorm_nonneg · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/CoefficientOneNorm.lean:23
theorem sum_abs_coeff_le_polynomialCoeffOneNorm

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
p :
s :
Finset ℕ
(∑ i ∈ s, |p.coeff i|) ≤ polynomialCoeffOneNorm p
Proof (Lean source)
lemma sum_abs_coeff_le_polynomialCoeffOneNorm (p : Polynomial ℝ) (s : Finset ℕ) : (∑ i ∈ s, |p.coeff i|) ≤ polynomialCoeffOneNorm p := by classical change (∑ i ∈ s, |p.coeff i|) ≤ ∑ i ∈ p.support, |p.coeff i| have heq : (∑ i ∈ s ∩ p.support, |p.coeff i|) = ∑ i ∈ s, |p.coeff i| := by apply Finset.sum_subset Finset.inter_subset_left intro i his hi have hnmem : i ∉ p.support := by intro hiSupport exact hi (Finset.mem_inter.mpr ⟨his, hiSupport⟩) simp only [mem_support_iff, ne_eq, not_not] at hnmem simp [hnmem] rw [← heq] exact Finset.sum_le_sum_of_subset_of_nonneg inter_subset_right (fun i _ _ => abs_nonneg (p.coeff i))
CausalSmith.Stat.MarRareqLogfrontier.sum_abs_coeff_le_polynomialCoeffOneNorm · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/CoefficientOneNorm.lean:29
theorem polynomialCoeffOneNorm_add_le

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
p q :
Proof (Lean source)
lemma polynomialCoeffOneNorm_add_le (p q : Polynomial ℝ) : polynomialCoeffOneNorm (p + q) ≤ polynomialCoeffOneNorm p + polynomialCoeffOneNorm q := by let m := max p.natDegree q.natDegree + 1 rw [coefficientOneNorm_range (p + q) (lt_of_le_of_lt (natDegree_add_le _ _) (lt_succ_self _)), coefficientOneNorm_range p (lt_of_le_of_lt (le_max_left _ _) (lt_succ_self _)), coefficientOneNorm_range q (lt_of_le_of_lt (le_max_right _ _) (lt_succ_self _)), ← Finset.sum_add_distrib] exact Finset.sum_le_sum fun i _ => by simpa only [coeff_add] using abs_add_le (p.coeff i) (q.coeff i)
CausalSmith.Stat.MarRareqLogfrontier.polynomialCoeffOneNorm_add_le · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/CoefficientOneNorm.lean:47
theorem polynomialCoeffOneNorm_sub_le

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
p q :
Proof (Lean source)
lemma polynomialCoeffOneNorm_sub_le (p q : Polynomial ℝ) : polynomialCoeffOneNorm (p - q) ≤ polynomialCoeffOneNorm p + polynomialCoeffOneNorm q := by let m := max p.natDegree q.natDegree + 1 rw [coefficientOneNorm_range (p - q) (lt_of_le_of_lt (natDegree_sub_le _ _) (lt_succ_self _)), coefficientOneNorm_range p (lt_of_le_of_lt (le_max_left _ _) (lt_succ_self _)), coefficientOneNorm_range q (lt_of_le_of_lt (le_max_right _ _) (lt_succ_self _)), ← Finset.sum_add_distrib] exact Finset.sum_le_sum fun i _ => by simpa only [coeff_sub] using abs_sub (p.coeff i) (q.coeff i)
CausalSmith.Stat.MarRareqLogfrontier.polynomialCoeffOneNorm_sub_le · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/CoefficientOneNorm.lean:62
theorem polynomialCoeffOneNorm_C

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
c :
ℝ
Proof (Lean source)
lemma polynomialCoeffOneNorm_C (c : ℝ) : polynomialCoeffOneNorm (C c) = |c| := by by_cases hc : c = 0 · simp [hc, polynomialCoeffOneNorm, polyCoeffL1] · rw [coefficientOneNorm_range (C c) (m := 1) (by simp)] simp
theorem polynomialCoeffOneNorm_sum_le

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
ι :
Type*
s :
f :
ι → Polynomial ℝ
polynomialCoeffOneNorm (∑ i ∈ s, f i) ≤ ∑ i ∈ s, polynomialCoeffOneNorm (f i)
Proof (Lean source)
lemma polynomialCoeffOneNorm_sum_le {ι : Type*} (s : Finset ι) (f : ι → Polynomial ℝ) : polynomialCoeffOneNorm (∑ i ∈ s, f i) ≤ ∑ i ∈ s, polynomialCoeffOneNorm (f i) := by classical induction s using Finset.induction_on with | empty => simp [polynomialCoeffOneNorm, polyCoeffL1] | @insert i s hi ih => simp only [Finset.sum_insert hi] exact (polynomialCoeffOneNorm_add_le _ _).trans (add_le_add_right ih _)
CausalSmith.Stat.MarRareqLogfrontier.polynomialCoeffOneNorm_sum_le · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/CoefficientOneNorm.lean:86
theorem polynomialCoeffOneNorm_pow_le

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
p :
m :
ℕ
Proof (Lean source)
lemma polynomialCoeffOneNorm_pow_le (p : Polynomial ℝ) (m : ℕ) : polynomialCoeffOneNorm (p ^ m) ≤ polynomialCoeffOneNorm p ^ m := by induction m with | zero => rw [pow_zero, pow_zero, show (1 : Polynomial ℝ) = C 1 by simp, polynomialCoeffOneNorm_C] norm_num | succ m ih => rw [pow_succ, pow_succ] exact (polynomialCoeffOneNorm_mul_le _ _).trans (mul_le_mul_of_nonneg_right ih (polynomialCoeffOneNorm_nonneg p))
CausalSmith.Stat.MarRareqLogfrontier.polynomialCoeffOneNorm_pow_le · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/CoefficientOneNorm.lean:99
theorem polynomialCoeffOneNorm_comp_le

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
p q :
hq :
Proof (Lean source)
lemma polynomialCoeffOneNorm_comp_le (p q : Polynomial ℝ) (hq : 1 ≤ polynomialCoeffOneNorm q) : polynomialCoeffOneNorm (p.comp q) ≤ polynomialCoeffOneNorm p * polynomialCoeffOneNorm q ^ p.natDegree := by classical rw [Polynomial.comp_eq_sum_left] calc polynomialCoeffOneNorm (p.sum fun e a => C a * q ^ e) ≤ ∑ e ∈ p.support, polynomialCoeffOneNorm (C (p.coeff e) * q ^ e) := by simpa only [Polynomial.sum] using polynomialCoeffOneNorm_sum_le p.support (fun e => C (p.coeff e) * q ^ e) _ ≤ ∑ e ∈ p.support, |p.coeff e| * polynomialCoeffOneNorm q ^ e := by apply Finset.sum_le_sum intro e he calc polynomialCoeffOneNorm (C (p.coeff e) * q ^ e) ≤ polynomialCoeffOneNorm (C (p.coeff e)) * polynomialCoeffOneNorm (q ^ e) := polynomialCoeffOneNorm_mul_le _ _ _ = |p.coeff e| * polynomialCoeffOneNorm (q ^ e) := by rw [polynomialCoeffOneNorm_C] _ ≤ |p.coeff e| * polynomialCoeffOneNorm q ^ e := by gcongr exact polynomialCoeffOneNorm_pow_le q e _ ≤ ∑ e ∈ p.support, |p.coeff e| * polynomialCoeffOneNorm q ^ p.natDegree := by apply Finset.sum_le_sum intro e he gcongr exact le_natDegree_of_ne_zero (mem_support_iff.mp he) _ = polynomialCoeffOneNorm p * polynomialCoeffOneNorm q ^ p.natDegree := by change (∑ e ∈ p.support, |p.coeff e| * polynomialCoeffOneNorm q ^ p.natDegree) = (∑ e ∈ p.support, |p.coeff e|) * polynomialCoeffOneNorm q ^ p.natDegree rw [Finset.sum_mul]
CausalSmith.Stat.MarRareqLogfrontier.polynomialCoeffOneNorm_comp_le · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/CoefficientOneNorm.lean:112
theorem polynomialCoeffOneNorm_divX_le

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
p :
Proof (Lean source)
lemma polynomialCoeffOneNorm_divX_le (p : Polynomial ℝ) : polynomialCoeffOneNorm p.divX ≤ polynomialCoeffOneNorm p := by by_cases hp : p = 0 · simp [hp, polynomialCoeffOneNorm, polyCoeffL1] · rw [coefficientOneNorm_range p.divX (lt_of_le_of_lt natDegree_divX_le (lt_succ_self _)), coefficientOneNorm_range p (lt_succ_self _)] rw [Finset.sum_range_succ, Finset.sum_range_succ'] simp only [coeff_divX] have htop : p.coeff (p.natDegree + 1) = 0 := coeff_eq_zero_of_natDegree_lt (lt_succ_self _) simp only [htop, abs_zero, add_zero] exact le_add_of_nonneg_right (abs_nonneg (p.coeff 0))
CausalSmith.Stat.MarRareqLogfrontier.polynomialCoeffOneNorm_divX_le · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/CoefficientOneNorm.lean:153
theorem polynomialCoeffOneNorm_one_sub_two_X

the stated mathematical conclusion holds.

Formal statement
polynomialCoeffOneNorm (C 1 - C 2 * X : Polynomial ℝ) = 3
Proof (Lean source)
lemma polynomialCoeffOneNorm_one_sub_two_X : polynomialCoeffOneNorm (C 1 - C 2 * X : Polynomial ℝ) = 3 := by rw [coefficientOneNorm_range (C 1 - C 2 * X : Polynomial ℝ) (m := 2) (by exact lt_of_le_of_lt (natDegree_sub_le _ _) (by norm_num))] norm_num [Finset.sum_range_succ, coeff_sub, coeff_one, coeff_C_mul, coeff_X]
CausalSmith.Stat.MarRareqLogfrontier.polynomialCoeffOneNorm_one_sub_two_X · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/CoefficientOneNorm.lean:169
theorem C_mul_divX_comp_scale

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
p :
B :
ℝ
C B * (p.divX.comp (C B * X)) = (p.comp (C B * X)).divX
Proof (Lean source)
lemma C_mul_divX_comp_scale (p : Polynomial ℝ) (B : ℝ) : C B * (p.divX.comp (C B * X)) = (p.comp (C B * X)).divX := by ext i simp only [coeff_C_mul, coeff_divX, comp_C_mul_X_coeff] rw [pow_succ] ring
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.Certificate.CoefficientOverlap 10 declarations The exact coefficient-overlap expression controlling the marked factorial second moment.

The exact coefficient-overlap expression controlling the marked factorial second moment.

def factorialOverlap

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
lam :
ℝ≥0
@realizes \(t\)(generic Poisson intensity in [0,∞))
v w :
ℕ
factorialOverlap lam v w :
ℝ
∑ r ∈ range (min v w + 1), (v.choose r : ℝ) * (w.choose r : ℝ) * (Nat.factorial r : ℝ) * (lam : ℝ) ^ (v + w - r)
def needleCoefficientOverlap

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
n d :
ℕ
q :
ℝ
lam :
ℝ≥0
needleCoefficientOverlap n d q lam :
ℝ
∑ v ∈ Icc 1 (needleDegree n q - 1), ∑ w ∈ Icc 1 (needleDegree n q - 1), |needleCoeff n d q v * needleCoeff n d q w| * factorialOverlap lam v w
theorem needle_scaled_polynomial_oneNorm_le

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
hbranch :
polynomialCoeffOneNorm ((1 - chebNeedle n d q).comp (C (needleRadius n q) * X))
≤ (8 : ℝ) ^ needleDegree n q
Proof (Lean source)
lemma needle_scaled_polynomial_oneNorm_le (n d : ℕ) (q : ℝ) (hbranch : needleBranch n d q) : polynomialCoeffOneNorm ((1 - chebNeedle n d q).comp (C (needleRadius n q) * X)) ≤ (8 : ℝ) ^ needleDegree n q := by let k := needleDegree n q let B := needleRadius n q let T := T ℝ (k : ℤ) let p : Polynomial ℝ := 1 - T.comp (C 1 - C (2 / B) * X) let r : Polynomial ℝ := 1 - T.comp (C 1 - C 2 * X) have hell : 128 ≤ logScale n q := hbranch.1 have hB : 0 < B := by dsimp [B, needleRadius]; positivity have hk : 2 ≤ k := by dsimp [k, needleDegree] exact Nat.le_floor (by linarith) have hpcomp : p.comp (C B * X) = r := by dsimp [p, r] rw [Polynomial.sub_comp, Polynomial.one_comp, Polynomial.comp_assoc] congr 2 rw [Polynomial.sub_comp, Polynomial.C_comp, Polynomial.mul_comp, Polynomial.C_comp, Polynomial.X_comp] ext i simp only [Polynomial.coeff_sub, Polynomial.coeff_C, Polynomial.coeff_C_mul, Polynomial.coeff_X] split_ifs <;> field_simp [hB.ne'] have hscaled : (chebNeedle n d q).comp (C B * X) = C (1 / (2 * (k : ℝ) ^ 2)) * r.divX := by rw [chebNeedle, if_pos hbranch] dsimp [k, B, p] at hpcomp ⊢ rw [Polynomial.mul_comp, Polynomial.C_comp] have hshift := C_mul_divX_comp_scale p B rw [hpcomp] at hshift calc C (B / (2 * (k : ℝ) ^ 2)) * p.divX.comp (C B * X) = C (1 / (2 * (k : ℝ) ^ 2)) * (C B * p.divX.comp (C B * X)) := by rw [← mul_assoc] congr 1 rw [← Polynomial.C_mul] congr 1 field_simp [hB.ne'] _ = _ := by rw [hshift] have hrnorm : polynomialCoeffOneNorm r ≤ 1 + (1 + sqrt 2) ^ k * 3 ^ k := by dsimp [r, T] calc polynomialCoeffOneNorm (1 - (T ℝ (k : ℤ)).comp (C 1 - C 2 * X)) ≤ 1 + polynomialCoeffOneNorm ((T ℝ (k : ℤ)).comp (C 1 - C 2 * X)) := by calc _ ≤ polynomialCoeffOneNorm (1 : Polynomial ℝ) + polynomialCoeffOneNorm ((T ℝ (k : ℤ)).comp (C 1 - C 2 * X)) := polynomialCoeffOneNorm_sub_le _ _ _ = _ := by rw [show (1 : Polynomial ℝ) = C 1 by simp, polynomialCoeffOneNorm_C] norm_num _ ≤ 1 + (polynomialCoeffOneNorm (T ℝ (k : ℤ)) * polynomialCoeffOneNorm (C 1 - C 2 * X) ^ (T ℝ (k : ℤ)).natDegree) := by gcongr apply polynomialCoeffOneNorm_comp_le rw [polynomialCoeffOneNorm_one_sub_two_X] norm_num _ = 1 + polynomialCoeffOneNorm (T ℝ (k : ℤ)) * 3 ^ k := by rw [polynomialCoeffOneNorm_one_sub_two_X, Polynomial.Chebyshev.natDegree_T] simp _ ≤ _ := by gcongr exact polynomialCoeffOneNorm_chebyshev_le k rw [Polynomial.sub_comp, Polynomial.one_comp, hscaled] calc polynomialCoeffOneNorm (1 - C (1 / (2 * (k : ℝ) ^ 2)) * r.divX) ≤ 1 + (1 / (2 * (k : ℝ) ^ 2)) * polynomialCoeffOneNorm r := by calc _ ≤ polynomialCoeffOneNorm 1 + polynomialCoeffOneNorm (C (1 / (2 * (k : ℝ) ^ 2)) * r.divX) := polynomialCoeffOneNorm_sub_le _ _ _ ≤ 1 + (1 / (2 * (k : ℝ) ^ 2)) * polynomialCoeffOneNorm r.divX := by rw [show (1 : Polynomial ℝ) = C 1 by simp, polynomialCoeffOneNorm_C, abs_one] gcongr calc polynomialCoeffOneNorm (C (1 / (2 * (k : ℝ) ^ 2)) * r.divX) ≤ polynomialCoeffOneNorm (C (1 / (2 * (k : ℝ) ^ 2))) * polynomialCoeffOneNorm r.divX := polynomialCoeffOneNorm_mul_le _ _ _ = _ := by rw [polynomialCoeffOneNorm_C, abs_of_nonneg] positivity _ ≤ _ := by gcongr exact polynomialCoeffOneNorm_divX_le r _ ≤ (8 : ℝ) ^ k := by have hsqrt : sqrt 2 ≤ (3 : ℝ) / 2 := by rw [Real.sqrt_le_iff] constructor <;> norm_num have hbase : 3 * (1 + sqrt 2) ≤ 8 := by linarith have hr8 : polynomialCoeffOneNorm r ≤ 1 + (8 : ℝ) ^ k := by calc _ ≤ 1 + (1 + sqrt 2) ^ k * 3 ^ k := hrnorm _ = 1 + (3 * (1 + sqrt 2)) ^ k := by rw [mul_pow]; ring _ ≤ 1 + 8 ^ k := by gcongr have hkreal : (2 : ℝ) ≤ k := by exact_mod_cast hk have hc0 : 0 ≤ 1 / (2 * (k : ℝ) ^ 2) := by positivity have hc8 : 1 / (2 * (k : ℝ) ^ 2) ≤ (1 : ℝ) / 8 := by apply (div_le_iff₀ (by positivity : (0 : ℝ) < 2 * (k : ℝ) ^ 2)).2 nlinarith have hpow : (64 : ℝ) ≤ 8 ^ k := by calc (64 : ℝ) = 8 ^ 2 := by norm_num _ ≤ 8 ^ k := pow_le_pow_right₀ (by norm_num) hk nlinarith [mul_le_mul_of_nonneg_left hr8 hc0]
CausalSmith.Stat.MarRareqLogfrontier.needle_scaled_polynomial_oneNorm_le · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/CoefficientOverlap.lean:90
theorem needle_scaled_coefficient_oneNorm_le

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
hbranch :
(∑ v ∈ Icc 1 (needleDegree n q - 1), |needleCoeff n d q v * needleRadius n q ^ v|)
≤ (8 : ℝ) ^ needleDegree n q
Proof (Lean source)
lemma needle_scaled_coefficient_oneNorm_le (n d : ℕ) (q : ℝ) (hbranch : needleBranch n d q) : (∑ v ∈ Icc 1 (needleDegree n q - 1), |needleCoeff n d q v * needleRadius n q ^ v|) ≤ (8 : ℝ) ^ needleDegree n q := by let B := needleRadius n q let R := (1 - chebNeedle n d q).comp (C B * X) calc (∑ v ∈ Icc 1 (needleDegree n q - 1), |needleCoeff n d q v * needleRadius n q ^ v|) = ∑ v ∈ Icc 1 (needleDegree n q - 1), |R.coeff v| := by apply Finset.sum_congr rfl intro v hv dsimp [R, B] rw [Polynomial.comp_C_mul_X_coeff] simp only [needleCoeff, if_pos hbranch] _ ≤ polynomialCoeffOneNorm R := sum_abs_coeff_le_polynomialCoeffOneNorm R _ _ ≤ (8 : ℝ) ^ needleDegree n q := needle_scaled_polynomial_oneNorm_le n d q hbranch
CausalSmith.Stat.MarRareqLogfrontier.needle_scaled_coefficient_oneNorm_le · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/CoefficientOverlap.lean:222
def NeedleCoefficientOverlapBound

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
n d :
ℕ
q :
ℝ
lam :
ℝ≥0
(lam : ℝ) ≤ needleRadius n q
NeedleCoefficientOverlapBound n d q :
Prop
needleCoefficientOverlap n d q lam ≤ exp (logScale n q / 8)
CausalSmith.Stat.MarRareqLogfrontier.NeedleCoefficientOverlapBound · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/CoefficientOverlap.lean:354
theorem needleCoefficientOverlap_bound

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
Proof (Lean source)
lemma needleCoefficientOverlap_bound (n d : ℕ) (q : ℝ) : NeedleCoefficientOverlapBound n d q := by intro hbranch lam hlam exact (needleCoefficientOverlap_le_exp_mul_sq n d q lam hbranch hlam ((8 : ℝ) ^ needleDegree n q) (needle_scaled_coefficient_oneNorm_le n d q hbranch)).trans (needle_overlap_exponential_budget n d q hbranch)
CausalSmith.Stat.MarRareqLogfrontier.needleCoefficientOverlap_bound · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/CoefficientOverlap.lean:359
theorem weightedFactorial_le_eventCount_descFactorial

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
X :
A B :
Set X
hAB :
A ⊆ B
v :
ℕ
hv :
1 ≤ v
s :
weightedFactorial A B v s ≤ (eventCount s B).descFactorial v
Proof (Lean source)
lemma weightedFactorial_le_eventCount_descFactorial {X : Type*} [MeasurableSpace X] (A B : Set X) (hAB : A ⊆ B) (v : ℕ) (hv : 1 ≤ v) (s : FiniteSample X) : weightedFactorial A B v s ≤ (eventCount s B).descFactorial v := by have hcount : eventCount s A ≤ eventCount s B := eventCount_mono s hAB cases v with | zero => omega | succ v => unfold weightedFactorial simp only [Nat.add_sub_cancel] by_cases hB : eventCount s B = 0 · have hA : eventCount s A = 0 := by omega simp [hA, hB] · have hpos : 0 < eventCount s B := Nat.pos_of_ne_zero hB rw [show eventCount s B = (eventCount s B - 1) + 1 by omega, Nat.succ_descFactorial_succ] push_cast gcongr exact_mod_cast (show eventCount s A ≤ eventCount s B - 1 + 1 by omega)
CausalSmith.Stat.MarRareqLogfrontier.weightedFactorial_le_eventCount_descFactorial · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/CoefficientOverlap.lean:368
theorem integral_mul_weightedFactorial_le_effective

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
lam :
ℝ≥0
A B :
Set X
hA :
hB :
hAB :
A ⊆ B
v w :
ℕ
hv :
1 ≤ v
hw :
1 ≤ w
(∫ s, weightedFactorial A B v s * weightedFactorial A B w s ∂finitePoissonSampleLaw Q lam)
≤ factorialOverlap (lam * (Q B).toNNReal) v w
Proof (Lean source)
lemma integral_mul_weightedFactorial_le_effective {X : Type*} [MeasurableSpace X] [Fintype X] [MeasurableSingletonClass X] [DecidableEq X] (Q : Measure X) [IsProbabilityMeasure Q] (lam : ℝ≥0) (A B : Set X) (hA : MeasurableSet A) (hB : MeasurableSet B) (hAB : A ⊆ B) (v w : ℕ) (hv : 1 ≤ v) (hw : 1 ≤ w) : (∫ s, weightedFactorial A B v s * weightedFactorial A B w s ∂finitePoissonSampleLaw Q lam) ≤ factorialOverlap (lam * (Q B).toNNReal) v w := by let t : ℝ≥0 := lam * (Q B).toNNReal have hWeighted := integrable_mul_weightedFactorial Q lam A B A B hA hB hA hB hAB hAB v w hv hw have hPoisson : Integrable (fun N : ℕ => (N.descFactorial v : ℝ) * (N.descFactorial w : ℝ)) (poissonMeasure t) := by have hsum := integrable_finsetSum (range (min v w + 1)) (fun r _ => (poisson_descFactorial_integrable t (v + w - r)).const_mul ((v.choose r : ℝ) * (w.choose r : ℝ) * (Nat.factorial r : ℝ))) refine hsum.congr (Filter.Eventually.of_forall fun N => ?_) change (∑ r ∈ range (min v w + 1), (v.choose r : ℝ) * (w.choose r : ℝ) * (Nat.factorial r : ℝ) * (N.descFactorial (v + w - r) : ℝ)) = (N.descFactorial v : ℝ) * (N.descFactorial w : ℝ) rw [descFactorial_mul N v w] have hmap : Measure.map (fun s : FiniteSample X => eventCount s B) (finitePoissonSampleLaw Q lam) = poissonMeasure t := by exact finitePoissonSampleLaw_map_eventCount Q lam B hB have hCount : Integrable (fun s : FiniteSample X => ((eventCount s B).descFactorial v : ℝ) * ((eventCount s B).descFactorial w : ℝ)) (finitePoissonSampleLaw Q lam) := by rw [← hmap] at hPoisson exact hPoisson.comp_aemeasurable (measurable_eventCount B hB).aemeasurable calc _ ≤ ∫ s, ((eventCount s B).descFactorial v : ℝ) * ((eventCount s B).descFactorial w : ℝ) ∂finitePoissonSampleLaw Q lam := by apply integral_mono hWeighted hCount intro s exact mul_le_mul (weightedFactorial_le_eventCount_descFactorial A B hAB v hv s) (weightedFactorial_le_eventCount_descFactorial A B hAB w hw s) (weightedFactorial_nonneg_le_countFactorial A B hAB w hw s).1 (by positivity) _ = factorialOverlap t v w := by unfold factorialOverlap have hmixed := poisson_descFactorial_mixed t v w rw [← hmixed, ← hmap] have hMap : Integrable (fun N : ℕ => (N.descFactorial v : ℝ) * (N.descFactorial w : ℝ)) (Measure.map (fun s : FiniteSample X => eventCount s B) (finitePoissonSampleLaw Q lam)) := by rw [hmap] exact hPoisson exact (integral_map (measurable_eventCount B hB).aemeasurable hMap.aestronglyMeasurable).symm
CausalSmith.Stat.MarRareqLogfrontier.integral_mul_weightedFactorial_le_effective · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/CoefficientOverlap.lean:389
theorem integral_sq_poissonFactorialBranch_le_effective_overlap

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
j :
Cell d
lam :
ℝ≥0
(∫ s, (poissonFactorialBranch n d q j s) ^ 2 ∂finitePoissonSampleLaw Q lam)
≤ needleCoefficientOverlap n d q (lam * (Q (streamEvent 2 j true false)).toNNReal)
Proof (Lean source)
lemma integral_sq_poissonFactorialBranch_le_effective_overlap (n d : ℕ) (q : ℝ) (j : Cell d) (Q : Measure (ObsRecord d × Fin 3)) [IsProbabilityMeasure Q] (lam : ℝ≥0) : (∫ s, (poissonFactorialBranch n d q j s) ^ 2 ∂finitePoissonSampleLaw Q lam) ≤ needleCoefficientOverlap n d q (lam * (Q (streamEvent 2 j true false)).toNNReal) := by by_cases hb : needleBranch n d q · let S := Icc 1 (needleDegree n q - 1) let A := streamEvent 2 j true true let B := streamEvent 2 j true false have hA : MeasurableSet A := Set.Finite.measurableSet (Set.toFinite _) have hB : MeasurableSet B := Set.Finite.measurableSet (Set.toFinite _) have hAB : A ⊆ B := streamEvent_ones_subset_arrived 2 j have hv (v : ℕ) (hvS : v ∈ S) : 1 ≤ v := (Finset.mem_Icc.mp hvS).1 have hint (v w : ℕ) (hvS : v ∈ S) (hwS : w ∈ S) : Integrable (fun s : FiniteSample (ObsRecord d × Fin 3) => (needleCoeff n d q v * weightedFactorial A B v s) * (needleCoeff n d q w * weightedFactorial A B w s)) (finitePoissonSampleLaw Q lam) := by simpa only [mul_assoc, mul_left_comm, mul_comm] using (integrable_mul_weightedFactorial Q lam A B A B hA hB hA hB hAB hAB v w (hv v hvS) (hv w hwS)).const_mul (needleCoeff n d q v * needleCoeff n d q w) simp only [poissonFactorialBranch, hb, if_true, pow_two] change (∫ s, (∑ v ∈ S, needleCoeff n d q v * weightedFactorial A B v s) * (∑ w ∈ S, needleCoeff n d q w * weightedFactorial A B w s) ∂finitePoissonSampleLaw Q lam) ≤ needleCoefficientOverlap n d q (lam * (Q B).toNNReal) simp_rw [Finset.sum_mul, Finset.mul_sum] rw [integral_finsetSum] · apply Finset.sum_le_sum intro v hvS rw [integral_finsetSum] · apply Finset.sum_le_sum intro w hwS have hfun : (fun s : FiniteSample (ObsRecord d × Fin 3) => (needleCoeff n d q v * weightedFactorial A B v s) * (needleCoeff n d q w * weightedFactorial A B w s)) = (fun s => (needleCoeff n d q v * needleCoeff n d q w) * (weightedFactorial A B v s * weightedFactorial A B w s)) := by funext s ring rw [hfun, integral_const_mul] change needleCoeff n d q v * needleCoeff n d q w * (∫ s, weightedFactorial A B v s * weightedFactorial A B w s ∂finitePoissonSampleLaw Q lam) ≤ |needleCoeff n d q v * needleCoeff n d q w| * factorialOverlap (lam * (Q B).toNNReal) v w have hcross := integral_mul_weightedFactorial_le_effective Q lam A B hA hB hAB v w (hv v hvS) (hv w hwS) have hcross0 : 0 ≤ (∫ s, weightedFactorial A B v s * weightedFactorial A B w s ∂finitePoissonSampleLaw Q lam) := integral_nonneg fun s => mul_nonneg (weightedFactorial_nonneg_le_countFactorial A B hAB v (hv v hvS) s).1 (weightedFactorial_nonneg_le_countFactorial A B hAB w (hv w hwS) s).1 calc _ ≤ |needleCoeff n d q v * needleCoeff n d q w| * (∫ s, weightedFactorial A B v s * weightedFactorial A B w s ∂finitePoissonSampleLaw Q lam) := by gcongr exact le_abs_self _ _ ≤ _ := mul_le_mul_of_nonneg_left hcross (abs_nonneg _) · intro w hwS exact hint v w hvS hwS · intro v hvS exact integrable_finsetSum S fun w hwS => hint v w hvS hwS · simp [poissonFactorialBranch, needleCoefficientOverlap, needleCoeff, hb]
CausalSmith.Stat.MarRareqLogfrontier.integral_sq_poissonFactorialBranch_le_effective_overlap · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/CoefficientOverlap.lean:449
theorem integral_sq_poissonFactorialBranch_le_exp_effective

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
j :
Cell d
lam :
ℝ≥0
hbranch :
hlam :
((lam * (Q (streamEvent 2 j true false)).toNNReal : ℝ≥0) : ℝ) ≤ needleRadius n q
(∫ s, (poissonFactorialBranch n d q j s) ^ 2 ∂finitePoissonSampleLaw Q lam)
≤ exp (logScale n q / 8)
Proof (Lean source)
lemma integral_sq_poissonFactorialBranch_le_exp_effective (n d : ℕ) (q : ℝ) (j : Cell d) (Q : Measure (ObsRecord d × Fin 3)) [IsProbabilityMeasure Q] (lam : ℝ≥0) (hbranch : needleBranch n d q) (hlam : ((lam * (Q (streamEvent 2 j true false)).toNNReal : ℝ≥0) : ℝ) ≤ needleRadius n q) : (∫ s, (poissonFactorialBranch n d q j s) ^ 2 ∂finitePoissonSampleLaw Q lam) ≤ exp (logScale n q / 8) := (integral_sq_poissonFactorialBranch_le_effective_overlap n d q j Q lam).trans (needleCoefficientOverlap_bound n d q hbranch _ hlam)
CausalSmith.Stat.MarRareqLogfrontier.integral_sq_poissonFactorialBranch_le_exp_effective · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/CoefficientOverlap.lean:519
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.Certificate.CountBridge 37 declarations Exact count bridges from the mixed-stream encoding to finite Poisson samples.

Exact count bridges from the mixed-stream encoding to finite Poisson samples.

def streamEvent

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
d :
ℕ
pool :
Fin 3
j :
Cell d
arrived ones :
streamEvent pool j arrived ones :
Set (ObsRecord d × Fin 3)
{z | z.2 = pool ∧ z.1.A = j.1 ∧ z.1.X = j.2.1 ∧ z.1.S = j.2.2 ∧ (arrived = false ∨ z.1.R = true) ∧ (ones = false ∨ z.1.RY = true)}
def obsStreamEvent

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
d :
ℕ
j :
Cell d
arrived ones :
obsStreamEvent j arrived ones :
{z | z.A = j.1 ∧ z.X = j.2.1 ∧ z.S = j.2.2 ∧ (arrived = false ∨ z.R = true) ∧ (ones = false ∨ z.RY = true)}
def markedObsLaw

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
d :
ℕ
P :
markedObsLaw P :
(P.1.map obs).prod (uniformOfFintype (Fin 3)).toMeasure
def uniformPoolMass

the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
_ :
Fin 3
uniformPoolMass _ :
ℝ≥0
1 / 3
theorem uniformPoolMass_sum

the stated mathematical conclusion holds.

Formal statement
∑ i : Fin 3, uniformPoolMass i = 1
Proof (Lean source)
lemma uniformPoolMass_sum : ∑ i : Fin 3, uniformPoolMass i = 1 := by norm_num [uniformPoolMass]
theorem labelLaw_uniformPoolMass

the stated mathematical conclusion holds.

Formal statement
Proof (Lean source)
lemma labelLaw_uniformPoolMass : labelLaw uniformPoolMass uniformPoolMass_sum = (uniformOfFintype (Fin 3)).toMeasure := by apply Measure.ext_of_singleton intro i rw [PMF.toMeasure_apply_singleton _ _ (MeasurableSet.singleton _)] simp [labelLaw, uniformPoolMass, PMF.ofFintype_apply]
CausalSmith.Stat.MarRareqLogfrontier.labelLaw_uniformPoolMass · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/CountBridge.lean:48
theorem streamEvent_eq_prod

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
pool :
Fin 3
j :
Cell d
arrived ones :
streamEvent pool j arrived ones = obsStreamEvent j arrived ones ×ˢ {pool}
Proof (Lean source)
lemma streamEvent_eq_prod {d : ℕ} (pool : Fin 3) (j : Cell d) (arrived ones : Bool) : streamEvent pool j arrived ones = obsStreamEvent j arrived ones ×ˢ {pool} := by ext z simp only [streamEvent, obsStreamEvent, Set.mem_ofPred_eq, Set.mem_prod, Set.mem_singleton_iff] tauto
theorem markedObsLaw_streamEvent_real

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
P :
pool :
Fin 3
j :
Cell d
arrived ones :
(markedObsLaw P).real (streamEvent pool j arrived ones)
= (P.1.map obs).real (obsStreamEvent j arrived ones) / 3
Proof (Lean source)
lemma markedObsLaw_streamEvent_real {d : ℕ} (P : FullLaw d) (pool : Fin 3) (j : Cell d) (arrived ones : Bool) : (markedObsLaw P).real (streamEvent pool j arrived ones) = (P.1.map obs).real (obsStreamEvent j arrived ones) / 3 := by rw [streamEvent_eq_prod] rw [markedObsLaw, measureReal_def, Measure.prod_prod, PMF.toMeasure_apply_singleton _ _ (MeasurableSet.singleton _), PMF.uniformOfFintype_apply] norm_num [ENNReal.toReal_mul, ENNReal.toReal_inv, div_eq_mul_inv] rfl
CausalSmith.Stat.MarRareqLogfrontier.markedObsLaw_streamEvent_real · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/CountBridge.lean:66
theorem markedObsLaw_isProbabilityMeasure

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
P :
Proof (Lean source)
lemma markedObsLaw_isProbabilityMeasure {d : ℕ} (P : FullLaw d) : IsProbabilityMeasure (markedObsLaw P) := by letI : IsProbabilityMeasure P.1 := P.2 letI : IsProbabilityMeasure (P.1.map obs) := Measure.isProbabilityMeasure_map (by fun_prop) letI : IsProbabilityMeasure (uniformOfFintype (Fin 3)).toMeasure := isProbabilityMeasure _ unfold markedObsLaw infer_instance
CausalSmith.Stat.MarRareqLogfrontier.markedObsLaw_isProbabilityMeasure · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/CountBridge.lean:78
theorem map_obs_isProbabilityMeasure

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
P :
Proof (Lean source)
lemma map_obs_isProbabilityMeasure {d : ℕ} (P : FullLaw d) : IsProbabilityMeasure (P.1.map obs) := by letI : IsProbabilityMeasure P.1 := P.2 exact Measure.isProbabilityMeasure_map (by fun_prop)
CausalSmith.Stat.MarRareqLogfrontier.map_obs_isProbabilityMeasure · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/CountBridge.lean:91
theorem map_unshuffle_markedObsLaw

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
P :
lam :
ℝ≥0
= Measure.pi (fun _ : Fin 3 => finitePoissonSampleLaw (P.1.map obs) (lam * (1 / 3)))
Proof (Lean source)
lemma map_unshuffle_markedObsLaw {d : ℕ} (P : FullLaw d) (lam : ℝ≥0) : Measure.map unshuffle (finitePoissonSampleLaw (markedObsLaw P) lam) = Measure.pi (fun _ : Fin 3 => finitePoissonSampleLaw (P.1.map obs) (lam * (1 / 3))) := by letI : IsProbabilityMeasure P.1 := P.2 calc Measure.map unshuffle (finitePoissonSampleLaw (markedObsLaw P) lam) = labeledStreamLaw (P.1.map obs) uniformPoolMass uniformPoolMass_sum lam := by simp only [labeledStreamLaw, markedObsLaw, labelLaw_uniformPoolMass] _ = Measure.pi (fun i : Fin 3 => finitePoissonSampleLaw (P.1.map obs) (lam * uniformPoolMass i)) := labeledStreamLaw_eq_independent (P.1.map obs) uniformPoolMass uniformPoolMass_sum lam _ = _ := by simp [uniformPoolMass]
CausalSmith.Stat.MarRareqLogfrontier.map_unshuffle_markedObsLaw · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/CountBridge.lean:99
theorem map_obsStreamEvent_membership_real

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
P :
j :
Cell d
(P.1.map obs).real (obsStreamEvent j false false) = cellProb P j
Proof (Lean source)
lemma map_obsStreamEvent_membership_real {d : ℕ} (P : FullLaw d) (j : Cell d) : (P.1.map obs).real (obsStreamEvent j false false) = cellProb P j := by rw [measureReal_def, Measure.map_apply (by fun_prop) (Set.Finite.measurableSet (Set.toFinite _))] unfold cellProb congr 2 ext r simp [obsStreamEvent, obs, inCell]
CausalSmith.Stat.MarRareqLogfrontier.map_obsStreamEvent_membership_real · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/CountBridge.lean:115
theorem map_obsStreamEvent_arrived_real

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
P :
j :
Cell d
Proof (Lean source)
lemma map_obsStreamEvent_arrived_real {d : ℕ} (P : FullLaw d) (j : Cell d) : (P.1.map obs).real (obsStreamEvent j true false) = arrivedCell P j := by rw [measureReal_def, Measure.map_apply (by fun_prop) (Set.Finite.measurableSet (Set.toFinite _))] unfold arrivedCell congr 2 ext r simp [obsStreamEvent, obs, inCell] tauto
CausalSmith.Stat.MarRareqLogfrontier.map_obsStreamEvent_arrived_real · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/CountBridge.lean:125
theorem map_obsStreamEvent_arrivedOne_real

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
P :
j :
Cell d
= P.1.real {r | inCell r j ∧ r.R = true ∧ r.Y = true}
Proof (Lean source)
lemma map_obsStreamEvent_arrivedOne_real {d : ℕ} (P : FullLaw d) (j : Cell d) : (P.1.map obs).real (obsStreamEvent j true true) = P.1.real {r | inCell r j ∧ r.R = true ∧ r.Y = true} := by rw [measureReal_def, Measure.map_apply (by fun_prop) (Set.Finite.measurableSet (Set.toFinite _)), measureReal_def] congr 2 ext r simp [obsStreamEvent, obs, inCell] tauto
CausalSmith.Stat.MarRareqLogfrontier.map_obsStreamEvent_arrivedOne_real · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/CountBridge.lean:136
theorem streamCount_eq_eventCount

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
k d :
ℕ
records :
Fin k → ObsRecord d
assign :
Fin k → Fin 3
pool :
Fin 3
j :
Cell d
arrived ones :
streamCount records assign pool j arrived ones
= eventCount (fixedSizeEmbed k (fun i ↦ (records i, assign i))) (streamEvent pool j arrived ones)
Proof (Lean source)
lemma streamCount_eq_eventCount {k d : ℕ} (records : Fin k → ObsRecord d) (assign : Fin k → Fin 3) (pool : Fin 3) (j : Cell d) (arrived ones : Bool) : streamCount records assign pool j arrived ones = eventCount (fixedSizeEmbed k (fun i ↦ (records i, assign i))) (streamEvent pool j arrived ones) := by classical simp [streamCount, eventCount, streamEvent, FiniteSample.count, FiniteSample.points, fixedSizeEmbed] apply congrArg card grind
CausalSmith.Stat.MarRareqLogfrontier.streamCount_eq_eventCount · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/CountBridge.lean:147
theorem streamEvent_ones_subset_arrived

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
pool :
Fin 3
j :
Cell d
Proof (Lean source)
lemma streamEvent_ones_subset_arrived {d : ℕ} (pool : Fin 3) (j : Cell d) : streamEvent pool j true true ⊆ streamEvent pool j true false := by intro z hz rcases hz with ⟨hp, ha, hx, hs, hr, _hy⟩ exact ⟨hp, ha, hx, hs, hr, by simp⟩
CausalSmith.Stat.MarRareqLogfrontier.streamEvent_ones_subset_arrived · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/CountBridge.lean:160
theorem memberCount_eq_eventCount

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
k d :
ℕ
records :
Fin k → ObsRecord d
assign :
Fin k → Fin 3
j :
Cell d
memberCount records assign j
= eventCount (fixedSizeEmbed k (fun i ↦ (records i, assign i))) (streamEvent 0 j false false)
Proof (Lean source)
lemma memberCount_eq_eventCount {k d : ℕ} (records : Fin k → ObsRecord d) (assign : Fin k → Fin 3) (j : Cell d) : memberCount records assign j = eventCount (fixedSizeEmbed k (fun i ↦ (records i, assign i))) (streamEvent 0 j false false) := by exact streamCount_eq_eventCount records assign 0 j false false
CausalSmith.Stat.MarRareqLogfrontier.memberCount_eq_eventCount · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/CountBridge.lean:167
theorem pilotCount_eq_eventCount

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
k d :
ℕ
records :
Fin k → ObsRecord d
assign :
Fin k → Fin 3
j :
Cell d
pilotCount records assign j
= eventCount (fixedSizeEmbed k (fun i ↦ (records i, assign i))) (streamEvent 1 j true false)
Proof (Lean source)
lemma pilotCount_eq_eventCount {k d : ℕ} (records : Fin k → ObsRecord d) (assign : Fin k → Fin 3) (j : Cell d) : pilotCount records assign j = eventCount (fixedSizeEmbed k (fun i ↦ (records i, assign i))) (streamEvent 1 j true false) := by exact streamCount_eq_eventCount records assign 1 j true false
CausalSmith.Stat.MarRareqLogfrontier.pilotCount_eq_eventCount · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/CountBridge.lean:175
theorem arrivedCount_eq_eventCount

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
k d :
ℕ
records :
Fin k → ObsRecord d
assign :
Fin k → Fin 3
j :
Cell d
arrivedCount records assign j
= eventCount (fixedSizeEmbed k (fun i ↦ (records i, assign i))) (streamEvent 2 j true false)
Proof (Lean source)
lemma arrivedCount_eq_eventCount {k d : ℕ} (records : Fin k → ObsRecord d) (assign : Fin k → Fin 3) (j : Cell d) : arrivedCount records assign j = eventCount (fixedSizeEmbed k (fun i ↦ (records i, assign i))) (streamEvent 2 j true false) := by exact streamCount_eq_eventCount records assign 2 j true false
CausalSmith.Stat.MarRareqLogfrontier.arrivedCount_eq_eventCount · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/CountBridge.lean:183
theorem arrivedOneCount_eq_eventCount

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
k d :
ℕ
records :
Fin k → ObsRecord d
assign :
Fin k → Fin 3
j :
Cell d
arrivedOneCount records assign j
= eventCount (fixedSizeEmbed k (fun i ↦ (records i, assign i))) (streamEvent 2 j true true)
Proof (Lean source)
lemma arrivedOneCount_eq_eventCount {k d : ℕ} (records : Fin k → ObsRecord d) (assign : Fin k → Fin 3) (j : Cell d) : arrivedOneCount records assign j = eventCount (fixedSizeEmbed k (fun i ↦ (records i, assign i))) (streamEvent 2 j true true) := by exact streamCount_eq_eventCount records assign 2 j true true
CausalSmith.Stat.MarRareqLogfrontier.arrivedOneCount_eq_eventCount · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/CountBridge.lean:191
theorem arrivedOne_fallingFactorial_eq_weightedFactorial

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
k d v :
ℕ
records :
Fin k → ObsRecord d
assign :
Fin k → Fin 3
j :
Cell d
(arrivedOneCount records assign j : ℝ) * fallingFactorial (arrivedCount records assign j - 1) (v - 1)
= weightedFactorial (streamEvent 2 j true true) (streamEvent 2 j true false) v (fixedSizeEmbed k (fun i ↦ (records i, assign i)))
Proof (Lean source)
lemma arrivedOne_fallingFactorial_eq_weightedFactorial {k d v : ℕ} (records : Fin k → ObsRecord d) (assign : Fin k → Fin 3) (j : Cell d) : (arrivedOneCount records assign j : ℝ) * fallingFactorial (arrivedCount records assign j - 1) (v - 1) = weightedFactorial (streamEvent 2 j true true) (streamEvent 2 j true false) v (fixedSizeEmbed k (fun i ↦ (records i, assign i))) := by rw [arrivedOneCount, arrivedCount, streamCount_eq_eventCount, streamCount_eq_eventCount] rfl
CausalSmith.Stat.MarRareqLogfrontier.arrivedOne_fallingFactorial_eq_weightedFactorial · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/CountBridge.lean:199
theorem factorialBranch_eq_weightedFactorialSum

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
k d :
ℕ
n :
ℕ
q :
ℝ
records :
Fin k → ObsRecord d
assign :
Fin k → Fin 3
j :
Cell d
factorialBranch n q records assign j
= if needleBranch n d q then ∑ v ∈ Icc 1 (needleDegree n q - 1), needleCoeff n d q v * weightedFactorial (streamEvent 2 j true true) (streamEvent 2 j true false) v (fixedSizeEmbed k (fun i ↦ (records i, assign i))) else 0
Proof (Lean source)
lemma factorialBranch_eq_weightedFactorialSum {k d : ℕ} (n : ℕ) (q : ℝ) (records : Fin k → ObsRecord d) (assign : Fin k → Fin 3) (j : Cell d) : factorialBranch n q records assign j = if needleBranch n d q then ∑ v ∈ Icc 1 (needleDegree n q - 1), needleCoeff n d q v * weightedFactorial (streamEvent 2 j true true) (streamEvent 2 j true false) v (fixedSizeEmbed k (fun i ↦ (records i, assign i))) else 0 := by unfold factorialBranch split_ifs with hbranch · apply Finset.sum_congr rfl intro v hv rw [← arrivedOne_fallingFactorial_eq_weightedFactorial (records := records) (assign := assign) (j := j) (v := v)] ring · rfl
CausalSmith.Stat.MarRareqLogfrontier.factorialBranch_eq_weightedFactorialSum · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/CountBridge.lean:210
def poissonFactorialBranch

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
n d :
ℕ
q :
ℝ
j :
Cell d
s :
poissonFactorialBranch n d q j s :
ℝ
if needleBranch n d q then ∑ v ∈ Icc 1 (needleDegree n q - 1), needleCoeff n d q v * weightedFactorial (streamEvent 2 j true true) (streamEvent 2 j true false) v s else 0
CausalSmith.Stat.MarRareqLogfrontier.poissonFactorialBranch · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/CountBridge.lean:230
def poissonRatioBranch

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
d :
ℕ
j :
Cell d
s :
poissonRatioBranch j s :
ℝ
if 0 < eventCount s (streamEvent 2 j true false) then eventCount s (streamEvent 2 j true true) / eventCount s (streamEvent 2 j true false) else 0
def poissonSelectedCellEstimate

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
n d :
ℕ
q :
ℝ
j :
Cell d
s :
poissonSelectedCellEstimate n d q j s :
ℝ
if needleBranch n d q ∧
eventCount s (streamEvent 1 j true false)
≤ needleRadius n q / 4 then poissonFactorialBranch n d q j s else poissonRatioBranch j s
CausalSmith.Stat.MarRareqLogfrontier.poissonSelectedCellEstimate · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/CountBridge.lean:248
theorem ratioBranch_eq_poissonRatioBranch

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
k d :
ℕ
records :
Fin k → ObsRecord d
assign :
Fin k → Fin 3
j :
Cell d
ratioBranch records assign j
= poissonRatioBranch j (fixedSizeEmbed k (fun i ↦ (records i, assign i)))
Proof (Lean source)
lemma ratioBranch_eq_poissonRatioBranch {k d : ℕ} (records : Fin k → ObsRecord d) (assign : Fin k → Fin 3) (j : Cell d) : ratioBranch records assign j = poissonRatioBranch j (fixedSizeEmbed k (fun i ↦ (records i, assign i))) := by rw [ratioBranch, poissonRatioBranch, arrivedCount_eq_eventCount, arrivedOneCount_eq_eventCount]
CausalSmith.Stat.MarRareqLogfrontier.ratioBranch_eq_poissonRatioBranch · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/CountBridge.lean:256
theorem selectedCellEstimate_eq_poissonSelectedCellEstimate

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
k d :
ℕ
n :
ℕ
q :
ℝ
records :
Fin k → ObsRecord d
assign :
Fin k → Fin 3
j :
Cell d
selectedCellEstimate n q records assign j
= poissonSelectedCellEstimate n d q j (fixedSizeEmbed k (fun i ↦ (records i, assign i)))
Proof (Lean source)
lemma selectedCellEstimate_eq_poissonSelectedCellEstimate {k d : ℕ} (n : ℕ) (q : ℝ) (records : Fin k → ObsRecord d) (assign : Fin k → Fin 3) (j : Cell d) : selectedCellEstimate n q records assign j = poissonSelectedCellEstimate n d q j (fixedSizeEmbed k (fun i ↦ (records i, assign i))) := by unfold selectedCellEstimate poissonSelectedCellEstimate rw [pilotCount_eq_eventCount, ratioBranch_eq_poissonRatioBranch] split_ifs with hbranch · rw [factorialBranch_eq_weightedFactorialSum] simp only [poissonFactorialBranch, hbranch.1, if_true] · rfl
CausalSmith.Stat.MarRareqLogfrontier.selectedCellEstimate_eq_poissonSelectedCellEstimate · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/CountBridge.lean:264
theorem eventCount_mono

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
X :
s :
A B :
Set X
hAB :
A ⊆ B
eventCount s A ≤ eventCount s B
Proof (Lean source)
lemma eventCount_mono {X : Type*} [MeasurableSpace X] (s : FiniteSample X) {A B : Set X} (hAB : A ⊆ B) : eventCount s A ≤ eventCount s B := by classical unfold eventCount apply Finset.card_le_card intro i hi simp only [mem_filter, Finset.mem_univ, true_and] at hi ⊢ exact hAB hi
theorem poissonRatioBranch_mem_unitInterval

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
j :
Cell d
s :
poissonRatioBranch j s ∈ Icc (0 : ℝ) 1
Proof (Lean source)
lemma poissonRatioBranch_mem_unitInterval {d : ℕ} (j : Cell d) (s : FiniteSample (ObsRecord d × Fin 3)) : poissonRatioBranch j s ∈ Icc (0 : ℝ) 1 := by have hsub := streamEvent_ones_subset_arrived 2 j have hle := eventCount_mono s hsub unfold poissonRatioBranch split_ifs with hpos · constructor · positivity · exact (div_le_one (by exact_mod_cast hpos)).2 (by exact_mod_cast hle) · simp
CausalSmith.Stat.MarRareqLogfrontier.poissonRatioBranch_mem_unitInterval · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/CountBridge.lean:288
theorem measurable_poissonRatioBranch

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
j :
Cell d
Proof (Lean source)
lemma measurable_poissonRatioBranch {d : ℕ} (j : Cell d) : Measurable (poissonRatioBranch j) := by let A := streamEvent 2 j true true let B := streamEvent 2 j true false have hA : MeasurableSet A := Set.Finite.measurableSet (Set.toFinite _) have hB : MeasurableSet B := Set.Finite.measurableSet (Set.toFinite _) unfold poissonRatioBranch apply Measurable.ite · exact (measurable_eventCount B hB) measurableSet_Ioi · exact ((measurable_of_countable (fun z : ℕ => (z : ℝ))).comp (measurable_eventCount A hA)).div ((measurable_of_countable (fun z : ℕ => (z : ℝ))).comp (measurable_eventCount B hB)) · exact measurable_const
CausalSmith.Stat.MarRareqLogfrontier.measurable_poissonRatioBranch · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/CountBridge.lean:301
theorem integrable_poissonRatioBranch_sq

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
P :
j :
Cell d
Integrable (fun s => (poissonRatioBranch j s) ^ 2) (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2))
Proof (Lean source)
lemma integrable_poissonRatioBranch_sq (n d : ℕ) (P : FullLaw d) (j : Cell d) : Integrable (fun s => (poissonRatioBranch j s) ^ 2) (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) := by apply Integrable.of_bound ((measurable_poissonRatioBranch j).pow_const 2).aestronglyMeasurable 1 filter_upwards [] with s rw [Real.norm_eq_abs, abs_of_nonneg (sq_nonneg _)] rcases poissonRatioBranch_mem_unitInterval j s with ⟨hzero, hone⟩ nlinarith [mul_nonneg hzero (sub_nonneg.mpr hone)]
CausalSmith.Stat.MarRareqLogfrontier.integrable_poissonRatioBranch_sq · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/CountBridge.lean:317
theorem map_finitePoissonSampleLaw_finiteSampleMap

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
f :
X → Y
hf :
lam :
ℝ≥0
Measure.map (finiteSampleMap f) (finitePoissonSampleLaw Q lam)
= (letI : IsProbabilityMeasure (Measure.map f Q) := Measure.isProbabilityMeasure_map hf.aemeasurable finitePoissonSampleLaw (Measure.map f Q) lam)
Proof (Lean source)
lemma map_finitePoissonSampleLaw_finiteSampleMap {X Y : Type*} [MeasurableSpace X] [MeasurableSpace Y] (Q : Measure X) [IsProbabilityMeasure Q] (f : X → Y) (hf : Measurable f) (lam : ℝ≥0) : Measure.map (finiteSampleMap f) (finitePoissonSampleLaw Q lam) = (letI : IsProbabilityMeasure (Measure.map f Q) := Measure.isProbabilityMeasure_map hf.aemeasurable finitePoissonSampleLaw (Measure.map f Q) lam) := by letI : IsProbabilityMeasure (Measure.map f Q) := Measure.isProbabilityMeasure_map hf.aemeasurable let F := finiteSampleMap f have hF : Measurable F := measurable_finiteSampleMap f hf apply Measure.ext_of_iUnion_eq_univ (show (⋃ n : ℕ, FiniteSample.count ⁻¹' ({n} : Set ℕ)) = univ by ext s; simp) intro n rw [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, 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) calc Measure.map (fixedSizeEmbed n ∘ G) (Measure.pi fun _ : Fin n => Q) = Measure.map (fixedSizeEmbed n) (Measure.map G (Measure.pi fun _ : Fin n => Q)) := (Measure.map_map (measurable_fixedSizeEmbed n) hG).symm _ = Measure.map (fixedSizeEmbed n) (Measure.pi fun _ : Fin n => Measure.map f Q) := by rw [Measure.pi_map_pi (fun _ => hf.aemeasurable)]
CausalSmith.Stat.MarRareqLogfrontier.map_finitePoissonSampleLaw_finiteSampleMap · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/CountBridge.lean:327
theorem finitePoissonSampleLaw_map_eventCount

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
Measure.map (fun s : FiniteSample X => eventCount s B) (finitePoissonSampleLaw Q intensity)
= poissonMeasure (intensity * (Q B).toNNReal)
Proof (Lean source)
lemma finitePoissonSampleLaw_map_eventCount {X : Type*} [MeasurableSpace X] [Fintype X] [MeasurableSingletonClass X] [DecidableEq X] (Q : Measure X) [IsProbabilityMeasure Q] (intensity : ℝ≥0) (B : Set X) (hB : MeasurableSet B) : Measure.map (fun s : FiniteSample X => eventCount s B) (finitePoissonSampleLaw Q intensity) = poissonMeasure (intensity * (Q B).toNNReal) := by classical let f : X → Bool := fun x => decide (x ∈ B) have hf : Measurable f := measurable_of_finite _ let QB := Measure.map f Q letI : IsProbabilityMeasure QB := Measure.isProbabilityMeasure_map hf.aemeasurable let H : FiniteSample Bool → (Bool → ℕ) := fun s => finiteSampleHistogram s.points have hpoint (s : FiniteSample X) : eventCount s B = H (finiteSampleMap f s) true := by rcases s with ⟨n, x⟩ simp only [eventCount, H, finiteSampleHistogram, finiteSampleMap, FiniteSample.count, FiniteSample.points, f] rw [Fintype.card_subtype] change (Finset.univ.filter (fun i : Fin n => x i ∈ B)).card = (Finset.univ.filter (fun i : Fin n => decide (x i ∈ B) = true)).card apply congrArg Finset.card ext i simp have hmass : QB {true} = Q B := by rw [Measure.map_apply hf (MeasurableSet.singleton true)] congr 1 ext x simp [f] have hH : Measurable H := Causalean.Stat.FiniteRaoBlackwell.PairedPoissonHistogram.measurable_finiteSampleHistogram have hEval : Measurable (Function.eval true : (Bool → ℕ) → ℕ) := measurable_pi_apply true calc Measure.map (fun s : FiniteSample X => eventCount s B) (finitePoissonSampleLaw Q intensity) = Measure.map (Function.eval true) (Measure.map H (Measure.map (finiteSampleMap f) (finitePoissonSampleLaw Q intensity))) := by rw [Measure.map_map hEval hH, Measure.map_map (hEval.comp hH) (measurable_finiteSampleMap f hf)] · congr 1 funext s exact hpoint s _ = Measure.map (Function.eval true) (independentPoissonCountLaw QB intensity) := by rw [map_finitePoissonSampleLaw_finiteSampleMap Q f hf intensity, finitePoissonSampleLaw_map_histogram] _ = poissonMeasure (intensity * (QB {true}).toNNReal) := by unfold independentPoissonCountLaw rw [Measure.pi_map_eval] simp _ = _ := by rw [hmass]
CausalSmith.Stat.MarRareqLogfrontier.finitePoissonSampleLaw_map_eventCount · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/CountBridge.lean:367
theorem integral_poissonFactorialBranch

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
j :
Cell d
lam :
ℝ≥0
(∫ s, poissonFactorialBranch n d q j s ∂finitePoissonSampleLaw Q lam)
= if needleBranch n d q then ∑ v ∈ Icc 1 (needleDegree n q - 1), needleCoeff n d q v * (lam : ℝ) ^ v * (Q (streamEvent 2 j true true)).toReal * (Q (streamEvent 2 j true false)).toReal ^ (v - 1) else 0
Proof (Lean source)
lemma integral_poissonFactorialBranch (n d : ℕ) (q : ℝ) (j : Cell d) (Q : Measure (ObsRecord d × Fin 3)) [IsProbabilityMeasure Q] (lam : ℝ≥0) : (∫ s, poissonFactorialBranch n d q j s ∂finitePoissonSampleLaw Q lam) = if needleBranch n d q then ∑ v ∈ Icc 1 (needleDegree n q - 1), needleCoeff n d q v * (lam : ℝ) ^ v * (Q (streamEvent 2 j true true)).toReal * (Q (streamEvent 2 j true false)).toReal ^ (v - 1) else 0 := by classical have hOne : MeasurableSet (streamEvent 2 j true true) := Set.Finite.measurableSet (Set.toFinite _) have hArrived : MeasurableSet (streamEvent 2 j true false) := Set.Finite.measurableSet (Set.toFinite _) have hsub := streamEvent_ones_subset_arrived 2 j by_cases hbranch : needleBranch n d q · simp only [poissonFactorialBranch, if_pos hbranch] rw [integral_finsetSum] · apply Finset.sum_congr rfl intro v hv have hv1 : 1 ≤ v := (Finset.mem_Icc.mp hv).1 rw [integral_const_mul, finitePoisson_nestedEvent_factorialMoment Q lam (streamEvent 2 j true true) (streamEvent 2 j true false) hOne hArrived hsub v hv1] ring · intro v hv have hv1 : 1 ≤ v := (Finset.mem_Icc.mp hv).1 exact (integrable_weightedFactorial Q lam (streamEvent 2 j true true) (streamEvent 2 j true false) hOne hArrived hsub v hv1).const_mul _ · simp [poissonFactorialBranch, hbranch]
CausalSmith.Stat.MarRareqLogfrontier.integral_poissonFactorialBranch · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/CountBridge.lean:426
theorem integrable_sq_weightedFactorial

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
X :
lam :
ℝ≥0
A B :
Set X
hA :
hB :
hAB :
A ⊆ B
v :
ℕ
hv :
1 ≤ v
Proof (Lean source)
lemma integrable_sq_weightedFactorial {X : Type*} [MeasurableSpace X] (Q : Measure X) [IsProbabilityMeasure Q] (lam : ℝ≥0) (A B : Set X) (hA : MeasurableSet A) (hB : MeasurableSet B) (hAB : A ⊆ B) (v : ℕ) (hv : 1 ≤ v) : Integrable (fun s : FiniteSample X => (weightedFactorial A B v s) ^ 2) (finitePoissonSampleLaw Q lam) := by have hPoisson : Integrable (fun N : ℕ => (N.descFactorial v : ℝ) ^ 2) (poissonMeasure lam) := by have hsum := integrable_finsetSum (range (min v v + 1)) (fun r _ => (poisson_descFactorial_integrable lam (v + v - r)).const_mul ((v.choose r : ℝ) * (v.choose r : ℝ) * (Nat.factorial r : ℝ))) refine hsum.congr (Filter.Eventually.of_forall fun N => ?_) change (∑ r ∈ range (min v v + 1), (v.choose r : ℝ) * (v.choose r : ℝ) * (Nat.factorial r : ℝ) * (N.descFactorial (v + v - r) : ℝ)) = (N.descFactorial v : ℝ) ^ 2 rw [pow_two, descFactorial_mul N v v] have hCount : Integrable (fun s : FiniteSample X => (s.count.descFactorial v : ℝ) ^ 2) (finitePoissonSampleLaw Q lam) := by rw [← finitePoissonSampleLaw_map_count Q lam] at hPoisson exact hPoisson.comp_aemeasurable measurable_finiteSample_count.aemeasurable have hmeas : AEStronglyMeasurable (fun s : FiniteSample X => (weightedFactorial A B v s) ^ 2) (finitePoissonSampleLaw Q lam) := ((measurable_weightedFactorial A B hA hB v).pow_const 2).aestronglyMeasurable apply integrable_of_le_of_le hmeas (Filter.Eventually.of_forall fun _ => sq_nonneg _) _ (integrable_zero _ _ _) hCount filter_upwards [] with s have hs := weightedFactorial_nonneg_le_countFactorial A B hAB v hv s nlinarith
CausalSmith.Stat.MarRareqLogfrontier.integrable_sq_weightedFactorial · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/CountBridge.lean:460
theorem integrable_mul_weightedFactorial

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
X :
lam :
ℝ≥0
A B C D :
Set X
hA :
hB :
hC :
hD :
hAB :
A ⊆ B
hCD :
C ⊆ D
v w :
ℕ
hv :
1 ≤ v
hw :
1 ≤ w
Proof (Lean source)
lemma integrable_mul_weightedFactorial {X : Type*} [MeasurableSpace X] (Q : Measure X) [IsProbabilityMeasure Q] (lam : ℝ≥0) (A B C D : Set X) (hA : MeasurableSet A) (hB : MeasurableSet B) (hC : MeasurableSet C) (hD : MeasurableSet D) (hAB : A ⊆ B) (hCD : C ⊆ D) (v w : ℕ) (hv : 1 ≤ v) (hw : 1 ≤ w) : Integrable (fun s : FiniteSample X => weightedFactorial A B v s * weightedFactorial C D w s) (finitePoissonSampleLaw Q lam) := by have hPoisson : Integrable (fun N : ℕ => (N.descFactorial v : ℝ) * (N.descFactorial w : ℝ)) (poissonMeasure lam) := by have hsum := integrable_finsetSum (range (min v w + 1)) (fun r _ => (poisson_descFactorial_integrable lam (v + w - r)).const_mul ((v.choose r : ℝ) * (w.choose r : ℝ) * (Nat.factorial r : ℝ))) refine hsum.congr (Filter.Eventually.of_forall fun N => ?_) change (∑ r ∈ range (min v w + 1), (v.choose r : ℝ) * (w.choose r : ℝ) * (Nat.factorial r : ℝ) * (N.descFactorial (v + w - r) : ℝ)) = (N.descFactorial v : ℝ) * (N.descFactorial w : ℝ) rw [descFactorial_mul N v w] have hCount : Integrable (fun s : FiniteSample X => (s.count.descFactorial v : ℝ) * (s.count.descFactorial w : ℝ)) (finitePoissonSampleLaw Q lam) := by rw [← finitePoissonSampleLaw_map_count Q lam] at hPoisson exact hPoisson.comp_aemeasurable measurable_finiteSample_count.aemeasurable have hmeas : AEStronglyMeasurable (fun s : FiniteSample X => weightedFactorial A B v s * weightedFactorial C D w s) (finitePoissonSampleLaw Q lam) := ((measurable_weightedFactorial A B hA hB v).mul (measurable_weightedFactorial C D hC hD w)).aestronglyMeasurable apply integrable_of_le_of_le hmeas (Filter.Eventually.of_forall fun s => mul_nonneg (weightedFactorial_nonneg_le_countFactorial A B hAB v hv s).1 (weightedFactorial_nonneg_le_countFactorial C D hCD w hw s).1) _ (integrable_zero _ _ _) hCount filter_upwards [] with s exact mul_le_mul (weightedFactorial_nonneg_le_countFactorial A B hAB v hv s).2 (weightedFactorial_nonneg_le_countFactorial C D hCD w hw s).2 (weightedFactorial_nonneg_le_countFactorial C D hCD w hw s).1 (by positivity)
CausalSmith.Stat.MarRareqLogfrontier.integrable_mul_weightedFactorial · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/CountBridge.lean:496
theorem integral_markedPoissonFactorialBranch

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
P :
j :
Cell d
(∫ s, poissonFactorialBranch n d q j s ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2))
= if needleBranch n d q then ∑ v ∈ Icc 1 (needleDegree n q - 1), needleCoeff n d q v * ((((n : ℝ≥0) / 2 : ℝ≥0) : ℝ) ^ v) * (P.1.real {r | inCell r j ∧ r.R = true ∧ r.Y = true} / 3) * (arrivedCell P j / 3) ^ (v - 1) else 0
Proof (Lean source)
lemma integral_markedPoissonFactorialBranch (n d : ℕ) (q : ℝ) (P : FullLaw d) (j : Cell d) : (∫ s, poissonFactorialBranch n d q j s ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) = if needleBranch n d q then ∑ v ∈ Icc 1 (needleDegree n q - 1), needleCoeff n d q v * ((((n : ℝ≥0) / 2 : ℝ≥0) : ℝ) ^ v) * (P.1.real {r | inCell r j ∧ r.R = true ∧ r.Y = true} / 3) * (arrivedCell P j / 3) ^ (v - 1) else 0 := by rw [integral_poissonFactorialBranch] congr 1 apply Finset.sum_congr rfl intro v hv change needleCoeff n d q v * ((((n : ℝ≥0) / 2 : ℝ≥0) : ℝ) ^ v) * (markedObsLaw P).real (streamEvent 2 j true true) * ((markedObsLaw P).real (streamEvent 2 j true false)) ^ (v - 1) = _ rw [markedObsLaw_streamEvent_real, markedObsLaw_streamEvent_real, map_obsStreamEvent_arrivedOne_real, map_obsStreamEvent_arrived_real]
CausalSmith.Stat.MarRareqLogfrontier.integral_markedPoissonFactorialBranch · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/CountBridge.lean:542
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.Certificate.CrossCellIndependence 10 declarations Disjoint cell histograms in the marked Poisson experiment are independent.

Disjoint cell histograms in the marked Poisson experiment are independent. This supplies the cross-cell independence required after roadmap (21).

theorem eventCount_eq_sum_singleton_histogram Lemma eventCount_eq_sum_singleton_histogram in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
eventCount s B
= ∑ x ∈ Finset.univ.filter (fun x ↦ x ∈ B), finiteSampleHistogram s.points x
Proof (Lean source)
-- @node: eventCount_eq_sum_singleton_histogram lemma eventCount_eq_sum_singleton_histogram {X : Type*} [MeasurableSpace X] [Fintype X] [DecidableEq X] (s : FiniteSample X) (B : Set X) : eventCount s B = ∑ x ∈ Finset.univ.filter (fun x ↦ x ∈ B), finiteSampleHistogram s.points x := by classical have h := Finset.sum_card_fiberwise_eq_card_filter (Finset.univ : Finset (Fin s.count)) (Finset.univ.filter (fun x ↦ x ∈ B)) s.points simp only [mem_filter, Finset.mem_univ, true_and] at h rw [eventCount, ← h] apply Finset.sum_congr rfl intro x hx simp [finiteSampleHistogram, Fintype.card_subtype]
CausalSmith.Stat.MarRareqLogfrontier.eventCount_eq_sum_singleton_histogram · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/CrossCellIndependence.lean:18
def markedCellAlphabet

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
d :
ℕ
j :
Cell d
markedCellAlphabet j :
Finset.univ.filter (fun z ↦ z.1.A = j.1 ∧ z.1.X = j.2.1 ∧ z.1.S = j.2.2)
def poissonCellHistogram

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
d :
ℕ
j :
Cell d
s :
poissonCellHistogram j s :
fun z ↦ finiteSampleHistogram s.points z
theorem disjoint_markedCellAlphabet

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
Cell d
hij :
i ≠ j
Proof (Lean source)
-- @node: disjoint_markedCellAlphabet lemma disjoint_markedCellAlphabet {d : ℕ} {i j : Cell d} (hij : i ≠ j) : Disjoint (markedCellAlphabet i) (markedCellAlphabet j) := by classical apply Finset.disjoint_left.mpr intro z hi hj simp only [markedCellAlphabet, mem_filter, Finset.mem_univ, true_and] at hi hj apply hij apply Prod.ext · exact hi.1.symm.trans hj.1 · exact Prod.ext (hi.2.1.symm.trans hj.2.1) (hi.2.2.symm.trans hj.2.2)
CausalSmith.Stat.MarRareqLogfrontier.disjoint_markedCellAlphabet · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/CrossCellIndependence.lean:45
theorem indepFun_poissonCellHistogram

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
P :
i j :
Cell d
hij :
i ≠ j
Proof (Lean source)
-- @node: indepFun_poissonCellHistogram lemma indepFun_poissonCellHistogram (n d : ℕ) (P : FullLaw d) {i j : Cell d} (hij : i ≠ j) : IndepFun (poissonCellHistogram i) (poissonCellHistogram j) (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) := by classical let H := fun s : FiniteSample (ObsRecord d × Fin 3) ↦ finiteSampleHistogram s.points have hH : Measurable H := by apply measurable_pi_lambda intro z have he : (fun s : FiniteSample (ObsRecord d × Fin 3) ↦ H s z) = (fun s ↦ eventCount s {z}) := by funext s simp [H, finiteSampleHistogram, eventCount, Fintype.card_subtype] rw [he] exact measurable_eventCount _ (MeasurableSet.singleton _) have hind := (iIndepFun_pi (μ := fun z : ObsRecord d × Fin 3 ↦ poissonMeasure (((n : ℝ≥0) / 2) * ((markedObsLaw P) {z}).toNNReal)) (X := fun _ ↦ id) (fun _ ↦ measurable_id.aemeasurable)).indepFun_finset (markedCellAlphabet i) (markedCellAlphabet j) (disjoint_markedCellAlphabet hij) (fun _ ↦ measurable_pi_apply _) change IndepFun (fun h (z : markedCellAlphabet i) ↦ h z) (fun h (z : markedCellAlphabet j) ↦ h z) (independentPoissonCountLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) at hind rw [← finitePoissonSampleLaw_map_histogram (markedObsLaw P) ((n : ℝ≥0) / 2)] at hind rw [indepFun_iff_measure_inter_preimage_eq_mul] at hind ⊢ intro a b ha hb have hi : Measurable (fun h : (ObsRecord d × Fin 3) → ℕ ↦ fun z : markedCellAlphabet i ↦ h z) := by fun_prop have hj : Measurable (fun h : (ObsRecord d × Fin 3) → ℕ ↦ fun z : markedCellAlphabet j ↦ h z) := by fun_prop have h := hind a b ha hb rw [Measure.map_apply hH ((ha.preimage hi).inter (hb.preimage hj)), Measure.map_apply hH (ha.preimage hi), Measure.map_apply hH (hb.preimage hj)] at h exact h
CausalSmith.Stat.MarRareqLogfrontier.indepFun_poissonCellHistogram · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/CrossCellIndependence.lean:58
def cellHistogramEventCount

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
d :
ℕ
j :
Cell d
pool :
Fin 3
arrived ones :
h :
cellHistogramEventCount j pool arrived ones h :
ℕ
∑ z : markedCellAlphabet j, if z.val ∈ streamEvent pool j arrived ones then h z else 0
theorem cellHistogramEventCount_poissonCellHistogram

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
j :
Cell d
pool :
Fin 3
arrived ones :
s :
= eventCount s (streamEvent pool j arrived ones)
Proof (Lean source)
-- @node: cellHistogramEventCount_poissonCellHistogram lemma cellHistogramEventCount_poissonCellHistogram {d : ℕ} (j : Cell d) (pool : Fin 3) (arrived ones : Bool) (s : FiniteSample (ObsRecord d × Fin 3)) : cellHistogramEventCount j pool arrived ones (poissonCellHistogram j s) = eventCount s (streamEvent pool j arrived ones) := by classical rw [eventCount_eq_sum_singleton_histogram] unfold cellHistogramEventCount poissonCellHistogram rw [Finset.sum_coe_sort (markedCellAlphabet j) (fun z ↦ if z ∈ streamEvent pool j arrived ones then finiteSampleHistogram s.points z else 0)] unfold markedCellAlphabet simp only [Finset.sum_filter] apply Finset.sum_congr rfl intro z hz by_cases he : z ∈ streamEvent pool j arrived ones · have hc : z ∈ markedCellAlphabet j := by simp only [markedCellAlphabet, mem_filter, Finset.mem_univ, true_and] exact ⟨he.2.1, he.2.2.1, he.2.2.2.1⟩ simp [he, he.2.1, he.2.2.1, he.2.2.2.1] · simp [he]
CausalSmith.Stat.MarRareqLogfrontier.cellHistogramEventCount_poissonCellHistogram · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/CrossCellIndependence.lean:101
def histogramWeightedSelectedEstimate

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
n d :
ℕ
q :
ℝ
j :
Cell d
h :
histogramWeightedSelectedEstimate n d q j h :
ℝ
(M : ℝ) / streamSize n * (if needleBranch n d q ∧ (C' : ℝ) ≤ needleRadius n q / 4 then (if needleBranch n d q then ∑ v ∈ Icc 1 (needleDegree n q - 1), needleCoeff n d q v * ((U : ℝ) * ((C - 1).descFactorial (v - 1) : ℝ)) else 0) else if 0 < C then (U : ℝ) / C else 0)
CausalSmith.Stat.MarRareqLogfrontier.histogramWeightedSelectedEstimate · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/CrossCellIndependence.lean:123
theorem histogramWeightedSelectedEstimate_poissonCellHistogram

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
j :
Cell d
s :
Proof (Lean source)
CausalSmith.Stat.MarRareqLogfrontier.histogramWeightedSelectedEstimate_poissonCellHistogram · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/CrossCellIndependence.lean:138
theorem indepFun_memberWeight_mul_selectedCellEstimate

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
P :
i j :
Cell d
hij :
i ≠ j
IndepFun (fun s ↦ poissonMemberWeight n i s * poissonSelectedCellEstimate n d q i s) (fun s ↦ poissonMemberWeight n j s * poissonSelectedCellEstimate n d q j s) (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2))
Proof (Lean source)
-- @node: indepFun_memberWeight_mul_selectedCellEstimate lemma indepFun_memberWeight_mul_selectedCellEstimate (n d : ℕ) (q : ℝ) (P : FullLaw d) {i j : Cell d} (hij : i ≠ j) : IndepFun (fun s ↦ poissonMemberWeight n i s * poissonSelectedCellEstimate n d q i s) (fun s ↦ poissonMemberWeight n j s * poissonSelectedCellEstimate n d q j s) (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) := by have h := (indepFun_poissonCellHistogram n d P hij).comp (measurable_of_countable (histogramWeightedSelectedEstimate n d q i)) (measurable_of_countable (histogramWeightedSelectedEstimate n d q j)) simpa only [Function.comp_def, histogramWeightedSelectedEstimate_poissonCellHistogram] using h
CausalSmith.Stat.MarRareqLogfrontier.indepFun_memberWeight_mul_selectedCellEstimate · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/CrossCellIndependence.lean:148
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.Certificate.EnvelopeRate 1 declarations Uniform comparison of the explicit envelope with the frontier rate.

Uniform comparison of the explicit envelope with the frontier rate.

theorem riskEnvelope_le_frontierRate

the stated mathematical conclusion holds.

Formal statement
∃ C : ℝ,
0 < C
conclusion 1
n d :
ℕ
q :
ℝ
1 ≤ n
1 ≤ d
0 < q
q ≤ 1
riskEnvelope n d q ≤ C * frontierRate n d q
Proof (Lean source)
lemma riskEnvelope_le_frontierRate : ∃ C : ℝ, 0 < C ∧ ∀ (n d : ℕ) (q : ℝ), 1 ≤ n → 1 ≤ d → 0 < q → q ≤ 1 → riskEnvelope n d q ≤ C * frontierRate n d q := by refine ⟨10 ^ 30, by norm_num, ?_⟩ intro n d q hn hd hq hq1 let N := effectiveSize n q let m := streamSize n let N₀ := streamEffectiveSize n q let ell := logScale n q let k := needleDegree n q let B := needleRadius n q let gamma := log 2 - 1 / 2 change (if N ≤ 1 then 1 else if ¬ needleBranch n d q then min 4 (((8 * d / (exp 1 * N₀)) ^ 2) + 4 * (4 / N₀ + 1 / m) + 4 * exp (-(n : ℝ) * gamma)) else let b := 2 * (4 * d * B / (N₀ * (k : ℝ) ^ 2) + 3 * exp (-16 * ell)) let v := 8 * (4 / N₀ + 1 / m) + 64 * d * (exp (ell / 8) + 1) * (B ^ 2 / N₀ ^ 2 + B / (m * N₀)) + 32 * exp (-32 * ell) * (1 + 1 / m) min 4 (b ^ 2 + v + 4 * exp (-(n : ℝ) * gamma))) ≤ 10 ^ 30 * min 1 (N⁻¹ + ((d : ℝ) / (N * ell)) ^ 2) have hnR : 0 < (n : ℝ) := by exact_mod_cast hn have hdR : 0 < (d : ℝ) := by exact_mod_cast hd have hNpos : 0 < N := by dsimp [N, effectiveSize] positivity have hNn : N ≤ (n : ℝ) := by dsimp [N, effectiveSize] nlinarith [mul_nonneg hnR.le hq.le] have hm : m = (n : ℝ) / 6 := rfl have hN₀ : N₀ = N / 6 := by dsimp [N₀, streamEffectiveSize, streamSize, N, effectiveSize] ring have hell : ell = log (exp 1 + N) := rfl have hR0 : 0 ≤ N⁻¹ + ((d : ℝ) / (N * ell)) ^ 2 := add_nonneg (inv_nonneg.mpr hNpos.le) (sq_nonneg _) by_cases hsmall : N ≤ 1 · rw [if_pos hsmall] have hInv : 1 ≤ N⁻¹ := (one_le_inv₀ hNpos).2 hsmall have hR1 : 1 ≤ N⁻¹ + ((d : ℝ) / (N * ell)) ^ 2 := by nlinarith [sq_nonneg ((d : ℝ) / (N * ell))] rw [min_eq_left hR1] norm_num · rw [if_neg hsmall] have hN1 : 1 < N := lt_of_not_ge hsmall obtain ⟨hell1, hexpell, hexpneg⟩ := logscale_basic N ell hN1 hell have hellpos : 0 < ell := lt_trans (by norm_num) hell1 have htail := poisson_tail_rate n N hn hNpos hNn have hmpos : 0 < m := by rw [hm]; positivity have hN₀pos : 0 < N₀ := by rw [hN₀]; positivity have hN₀inv : 1 / N₀ = 6 * N⁻¹ := by rw [hN₀] field_simp have hminv : 1 / m ≤ 6 * N⁻¹ := by have hmN : N / 6 ≤ m := by rw [hm]; linarith calc 1 / m ≤ 1 / (N / 6) := one_div_le_one_div_of_le (by positivity) hmN _ = 6 * N⁻¹ := by field_simp by_cases hbranch : needleBranch n d q · rw [if_neg (not_not_intro hbranch)] rcases hbranch with ⟨hell128, hdsqrt⟩ have hB : B = 256 * ell := rfl have hxfloor : 1 ≤ ell / 64 := by linarith have hk : ell / 128 ≤ (k : ℝ) := by have hf := half_le_natFloor hxfloor dsimp [k, needleDegree] convert hf using 1 <;> ring have hkpos : 0 < (k : ℝ) := lt_of_lt_of_le (by positivity) hk have hkSq : (ell / 128) ^ 2 ≤ (k : ℝ) ^ 2 := pow_le_pow_left₀ (by positivity) hk 2 obtain ⟨hgrowth, hell_d⟩ := needle_growth N ell d hN1 hell128 hexpell hdsqrt hdR.le have hexp16 : exp (-16 * ell) ≤ N⁻¹ := by exact (Real.exp_le_exp.mpr (by nlinarith)).trans hexpneg have hexp32 : exp (-32 * ell) ≤ N⁻¹ := by exact (Real.exp_le_exp.mpr (by nlinarith)).trans hexpneg have hinv_ratio : N⁻¹ ≤ 2 * (d : ℝ) / (N * ell) := by rw [inv_eq_one_div] apply (div_le_div_iff₀ hNpos (mul_pos hNpos hellpos)).2 have hp : 0 ≤ N * (2 * (d : ℝ) - ell) := mul_nonneg hNpos.le (sub_nonneg.mpr hell_d) nlinarith have hmain : 4 * (d : ℝ) * B / (N₀ * (k : ℝ) ^ 2) ≤ 100663296 * ((d : ℝ) / (N * ell)) := by rw [hB, hN₀] calc 4 * (d : ℝ) * (256 * ell) / (N / 6 * (k : ℝ) ^ 2) = 6144 * (d : ℝ) * ell / (N * (k : ℝ) ^ 2) := by field_simp; ring _ ≤ 6144 * (d : ℝ) * ell / (N * (ell / 128) ^ 2) := by have hnumer : 0 ≤ 6144 * (d : ℝ) * ell := by positivity have hden := mul_le_mul_of_nonneg_left hkSq hNpos.le exact div_le_div_of_nonneg_left hnumer (mul_pos hNpos (sq_pos_of_pos (by positivity : 0 < ell / 128))) hden _ = 100663296 * ((d : ℝ) / (N * ell)) := by field_simp; ring have hbias_inside : 4 * (d : ℝ) * B / (N₀ * (k : ℝ) ^ 2) + 3 * exp (-16 * ell) ≤ 100663302 * ((d : ℝ) / (N * ell)) := by have htail_ratio : 3 * exp (-16 * ell) ≤ 6 * ((d : ℝ) / (N * ell)) := by calc 3 * exp (-16 * ell) ≤ 3 * N⁻¹ := mul_le_mul_of_nonneg_left hexp16 (by norm_num) _ ≤ 3 * (2 * (d : ℝ) / (N * ell)) := mul_le_mul_of_nonneg_left hinv_ratio (by norm_num) _ = 6 * ((d : ℝ) / (N * ell)) := by ring linarith have hbias_sq : (2 * (4 * (d : ℝ) * B / (N₀ * (k : ℝ) ^ 2) + 3 * exp (-16 * ell))) ^ 2 ≤ 40532401478172816 * ((d : ℝ) / (N * ell)) ^ 2 := by have hins0 : 0 ≤ 4 * (d : ℝ) * B / (N₀ * (k : ℝ) ^ 2) + 3 * exp (-16 * ell) := by rw [hB]; positivity have hs := pow_le_pow_left₀ hins0 hbias_inside 2 calc (2 * (4 * (d : ℝ) * B / (N₀ * (k : ℝ) ^ 2) + 3 * exp (-16 * ell))) ^ 2 ≤ (2 * (100663302 * ((d : ℝ) / (N * ell)))) ^ 2 := by exact pow_le_pow_left₀ (mul_nonneg (by norm_num) hins0) (mul_le_mul_of_nonneg_left hbias_inside (by norm_num)) 2 _ = 40532401478172816 * ((d : ℝ) / (N * ell)) ^ 2 := by ring have hN₀m : N₀ ≤ m := by rw [hN₀, hm] linarith have hB1 : 1 ≤ B := by rw [hB]; nlinarith have hBterms : B ^ 2 / N₀ ^ 2 + B / (m * N₀) ≤ 4718592 * ell ^ 2 / N ^ 2 := by have hden : N₀ ^ 2 ≤ m * N₀ := by rw [sq] exact mul_le_mul_of_nonneg_right hN₀m hN₀pos.le have hsecond : B / (m * N₀) ≤ B ^ 2 / N₀ ^ 2 := by calc B / (m * N₀) ≤ B / N₀ ^ 2 := div_le_div_of_nonneg_left (zero_le_one.trans hB1) (sq_pos_of_pos hN₀pos) hden _ ≤ B ^ 2 / N₀ ^ 2 := div_le_div_of_nonneg_right (by nlinarith [sq_nonneg (B - 1)]) (sq_nonneg N₀) calc B ^ 2 / N₀ ^ 2 + B / (m * N₀) ≤ 2 * (B ^ 2 / N₀ ^ 2) := by linarith _ = 4718592 * ell ^ 2 / N ^ 2 := by rw [hB, hN₀]; field_simp; ring have hscale : (d : ℝ) * (exp (ell / 8) + 1) * ell ^ 2 / N ^ 2 ≤ 262144 * ((d : ℝ) / (N * ell)) ^ 2 := by calc (d : ℝ) * (exp (ell / 8) + 1) * ell ^ 2 / N ^ 2 = (d : ℝ) * ((exp (ell / 8) + 1) * ell ^ 4) / (N ^ 2 * ell ^ 2) := by field_simp _ ≤ (d : ℝ) * (262144 * d) / (N ^ 2 * ell ^ 2) := by exact div_le_div_of_nonneg_right (mul_le_mul_of_nonneg_left hgrowth hdR.le) (by positivity) _ = 262144 * ((d : ℝ) / (N * ell)) ^ 2 := by field_simp have hcomplex : 64 * (d : ℝ) * (exp (ell / 8) + 1) * (B ^ 2 / N₀ ^ 2 + B / (m * N₀)) ≤ 79164837199872 * ((d : ℝ) / (N * ell)) ^ 2 := by calc 64 * (d : ℝ) * (exp (ell / 8) + 1) * (B ^ 2 / N₀ ^ 2 + B / (m * N₀)) ≤ 64 * (d : ℝ) * (exp (ell / 8) + 1) * (4718592 * ell ^ 2 / N ^ 2) := mul_le_mul_of_nonneg_left hBterms (by positivity) _ = 301989888 * ((d : ℝ) * (exp (ell / 8) + 1) * ell ^ 2 / N ^ 2) := by ring _ ≤ 301989888 * (262144 * ((d : ℝ) / (N * ell)) ^ 2) := mul_le_mul_of_nonneg_left hscale (by norm_num) _ = 79164837199872 * ((d : ℝ) / (N * ell)) ^ 2 := by ring have hbase : 8 * (4 / N₀ + 1 / m) ≤ 240 * N⁻¹ := by have hfour : 4 / N₀ = 24 * N⁻¹ := by rw [show 4 / N₀ = 4 * (1 / N₀) by ring, hN₀inv] ring rw [hfour] nlinarith have hinv1 : N⁻¹ ≤ 1 := (inv_le_one₀ hNpos).2 hN1.le have hmInv6 : 1 / m ≤ 6 := hminv.trans (by nlinarith) have hvtail : 32 * exp (-32 * ell) * (1 + 1 / m) ≤ 224 * N⁻¹ := by calc 32 * exp (-32 * ell) * (1 + 1 / m) ≤ 32 * N⁻¹ * 7 := mul_le_mul (mul_le_mul_of_nonneg_left hexp32 (by norm_num)) (by linarith) (by positivity) (by positivity) _ = 224 * N⁻¹ := by ring refine min_four_le_const_min_one ?_ hR0 (by norm_num : (4 : ℝ) ≤ 10 ^ 30) have htail' : 4 * exp (-(n : ℝ) * gamma) ≤ 32 * N⁻¹ := by dsimp [gamma] nlinarith calc (2 * (4 * (d : ℝ) * B / (N₀ * (k : ℝ) ^ 2) + 3 * exp (-16 * ell))) ^ 2 + (8 * (4 / N₀ + 1 / m) + 64 * (d : ℝ) * (exp (ell / 8) + 1) * (B ^ 2 / N₀ ^ 2 + B / (m * N₀)) + 32 * exp (-32 * ell) * (1 + 1 / m)) + 4 * exp (-(n : ℝ) * gamma) ≤ (40532401478172816 + 79164837199872) * ((d : ℝ) / (N * ell)) ^ 2 + 496 * N⁻¹ := by linarith _ ≤ 10 ^ 30 * (N⁻¹ + ((d : ℝ) / (N * ell)) ^ 2) := by nlinarith [inv_nonneg.mpr hNpos.le, sq_nonneg ((d : ℝ) / (N * ell))] · rw [if_pos hbranch] have hfrac0 : 0 ≤ 8 * (d : ℝ) / (exp 1 * N₀) := by positivity have hfrac : 8 * (d : ℝ) / (exp 1 * N₀) ≤ 48 * (d : ℝ) / N := by calc 8 * (d : ℝ) / (exp 1 * N₀) ≤ 8 * (d : ℝ) / N₀ := by apply (div_le_div_iff₀ (mul_pos (Real.exp_pos 1) hN₀pos) hN₀pos).2 have he := Real.one_le_exp (show (0 : ℝ) ≤ 1 by norm_num) nlinarith [mul_nonneg (show (0 : ℝ) ≤ 8 * d by positivity) (sub_nonneg.mpr he)] _ = 48 * (d : ℝ) / N := by rw [hN₀]; field_simp; norm_num have hfrac_sq : (8 * (d : ℝ) / (exp 1 * N₀)) ^ 2 ≤ 2304 * ((d : ℝ) / N) ^ 2 := by have := pow_le_pow_left₀ hfrac0 hfrac 2 calc (8 * (d : ℝ) / (exp 1 * N₀)) ^ 2 ≤ (48 * (d : ℝ) / N) ^ 2 := this _ = 2304 * ((d : ℝ) / N) ^ 2 := by ring have hnbranch : ell < 128 ∨ (d : ℝ) < sqrt N := by simp only [needleBranch, not_and_or, not_le] at hbranch exact hbranch have hdratio : ((d : ℝ) / N) ^ 2 ≤ N⁻¹ + 16384 * ((d : ℝ) / (N * ell)) ^ 2 := by rcases hnbranch with hell128 | hdsqrt · have heq : (d : ℝ) / N = ell * ((d : ℝ) / (N * ell)) := by field_simp rw [heq] have hs := sq_nonneg ((d : ℝ) / (N * ell)) have hellsq : ell ^ 2 ≤ 16384 := by nlinarith [sq_nonneg (128 - ell)] calc (ell * ((d : ℝ) / (N * ell))) ^ 2 = ell ^ 2 * ((d : ℝ) / (N * ell)) ^ 2 := by ring _ ≤ 16384 * ((d : ℝ) / (N * ell)) ^ 2 := mul_le_mul_of_nonneg_right hellsq hs _ ≤ N⁻¹ + 16384 * ((d : ℝ) / (N * ell)) ^ 2 := le_add_of_nonneg_left (inv_nonneg.mpr hNpos.le) · have hsqrt : (sqrt N) ^ 2 = N := Real.sq_sqrt hNpos.le have hdsq : (d : ℝ) ^ 2 ≤ N := by nlinarith [sq_nonneg (sqrt N - d)] have hratioN : ((d : ℝ) / N) ^ 2 ≤ N⁻¹ := by calc ((d : ℝ) / N) ^ 2 = (d : ℝ) ^ 2 / N ^ 2 := by ring _ ≤ N / N ^ 2 := div_le_div_of_nonneg_right hdsq (sq_nonneg N) _ = N⁻¹ := by field_simp exact hratioN.trans (le_add_of_nonneg_right (by positivity)) have hvar : 4 * (4 / N₀ + 1 / m) ≤ 120 * N⁻¹ := by have hfour : 4 / N₀ = 24 * N⁻¹ := by -- … truncated; follow the source link for the rest …
CausalSmith.Stat.MarRareqLogfrontier.riskEnvelope_le_frontierRate · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/EnvelopeRate.lean:140
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.Certificate.FactorialMean 4 declarations The finite coefficient expansion and exact Chebyshev mean of the marked factorial branch, including zero-arrival cells, in roadmap (8).

The finite coefficient expansion and exact Chebyshev mean of the marked factorial branch, including zero-arrival cells, in roadmap (8).

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
(chebNeedle n d q).eval 0 = 1
Proof (Lean source)
-- @node: chebNeedle_eval_zero lemma chebNeedle_eval_zero (n d : ℕ) (q : ℝ) : (chebNeedle n d q).eval 0 = 1 := by by_cases hb : needleBranch n d q · have hB : 0 < needleRadius n q := by unfold needleRadius have := hb.1 positivity have hk : 0 < needleDegree n q := by unfold needleDegree exact Nat.floor_pos.mpr (by linarith [hb.1]) let p : Polynomial ℝ := 1 - (Chebyshev.T ℝ (needleDegree n q : ℤ)).comp (C 1 - C (2 / needleRadius n q) * X) have hc : p.coeff 1 = (2 / needleRadius n q) * (needleDegree n q : ℝ)^2 := by have hder : p.coeff 1 = (derivative p).eval 0 := by rw [← coeff_zero_eq_eval_zero, coeff_derivative] norm_num rw [hder] simp [p, derivative_sub, derivative_comp, Chebyshev.derivative_T_eval_one] have hform : (chebNeedle n d q).eval 0 = (needleRadius n q / (2 * (needleDegree n q : ℝ)^2)) * p.coeff 1 := by simp [chebNeedle, hb, p, ← coeff_zero_eq_eval_zero, coeff_divX] rw [hform, hc] have hk0 : (needleDegree n q : ℝ) ≠ 0 := by exact_mod_cast hk.ne' field_simp · simp [chebNeedle, hb]
theorem natDegree_one_sub_chebNeedle_le

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
hb :
(1 - chebNeedle n d q).natDegree ≤ needleDegree n q - 1
Proof (Lean source)
-- @node: natDegree_one_sub_chebNeedle_le lemma natDegree_one_sub_chebNeedle_le (n d : ℕ) (q : ℝ) (hb : needleBranch n d q) : (1 - chebNeedle n d q).natDegree ≤ needleDegree n q - 1 := by let a : Polynomial ℝ := C 1 - C (2 / needleRadius n q) * X have ha : a.natDegree ≤ 1 := by apply (natDegree_sub_le _ _).trans apply max_le (by simp) exact (natDegree_C_mul_le _ _).trans (by simp) have hp : (1 - (Chebyshev.T ℝ (needleDegree n q : ℤ)).comp a).natDegree ≤ needleDegree n q := by apply (natDegree_sub_le _ _).trans apply max_le · simp · apply (natDegree_comp_le).trans rw [Chebyshev.natDegree_T] simp only [Int.natAbs_natCast] exact (Nat.mul_le_mul_left _ ha).trans_eq (Nat.mul_one _) have hQ : (chebNeedle n d q).natDegree ≤ needleDegree n q - 1 := by rw [chebNeedle, if_pos hb] apply (natDegree_C_mul_le _ _).trans rw [natDegree_divX_eq_natDegree_tsub_one] exact Nat.sub_le_sub_right hp 1 exact (natDegree_sub_le _ _).trans (max_le (by simp) hQ)
CausalSmith.Stat.MarRareqLogfrontier.natDegree_one_sub_chebNeedle_le · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/FactorialMean.lean:47
theorem sum_needleCoeff_mul_pow

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q t :
ℝ
hb :
(∑ v ∈ Icc 1 (needleDegree n q - 1), needleCoeff n d q v * t ^ v)
= 1 - (chebNeedle n d q).eval t
Proof (Lean source)
-- @node: sum_needleCoeff_mul_pow lemma sum_needleCoeff_mul_pow (n d : ℕ) (q t : ℝ) (hb : needleBranch n d q) : (∑ v ∈ Icc 1 (needleDegree n q - 1), needleCoeff n d q v * t ^ v) = 1 - (chebNeedle n d q).eval t := by classical let p := 1 - chebNeedle n d q have hp0 : p.coeff 0 = 0 := by simp [p, coeff_zero_eq_eval_zero, chebNeedle_eval_zero] have hk : 0 < needleDegree n q := by unfold needleDegree exact Nat.floor_pos.mpr (by linarith [hb.1]) have hdeg : p.natDegree < needleDegree n q := lt_of_le_of_lt (natDegree_one_sub_chebNeedle_le n d q hb) (sub_lt hk (by decide)) have heval := Polynomial.eval_eq_sum_range' hdeg t rw [Nat.range_eq_Icc_zero_sub_one _ hk.ne'] at heval have hsum : (∑ v ∈ Icc 0 (needleDegree n q - 1), p.coeff v * t ^ v) = ∑ v ∈ Icc 1 (needleDegree n q - 1), p.coeff v * t ^ v := by symm apply Finset.sum_subset · intro v hv simp only [Finset.mem_Icc] at hv ⊢ omega · intro v hv hn have hv0 : v = 0 := by simp only [Finset.mem_Icc] at hv hn omega simp [hv0, hp0] rw [hsum] at heval simp only [p, eval_sub, eval_one] at heval simpa only [needleCoeff, if_pos hb] using heval.symm
CausalSmith.Stat.MarRareqLogfrontier.sum_needleCoeff_mul_pow · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/FactorialMean.lean:73
theorem integral_markedPoissonFactorialBranch_eq_needle

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
P :
j :
Cell d
(∫ s, poissonFactorialBranch n d q j s ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2))
= cellMean P j * (1 - (chebNeedle n d q).eval (streamSize n * arrivedCell P j))
Proof (Lean source)
-- @node: integral_markedPoissonFactorialBranch_eq_needle lemma integral_markedPoissonFactorialBranch_eq_needle (n d : ℕ) (q : ℝ) (P : FullLaw d) (j : Cell d) : (∫ s, poissonFactorialBranch n d q j s ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) = cellMean P j * (1 - (chebNeedle n d q).eval (streamSize n * arrivedCell P j)) := by classical let : IsProbabilityMeasure P.1 := P.2 by_cases hb : needleBranch n d q · rw [integral_markedPoissonFactorialBranch, if_pos hb, ← sum_needleCoeff_mul_pow n d q _ hb, Finset.mul_sum] apply Finset.sum_congr rfl intro v hv have hvpos : 1 ≤ v := (Finset.mem_Icc.mp hv).1 have hpow : v - 1 + 1 = v := by omega by_cases hj : 0 < arrivedCell P j · rw [cellMean, if_pos hj] simp only [NNReal.coe_div, NNReal.coe_natCast, NNReal.coe_ofNat] rw [show streamSize n * arrivedCell P j = ((n : ℝ) / 2) * (arrivedCell P j / 3) by unfold streamSize; ring, mul_pow] have ha0 := hj.ne' have ha : (arrivedCell P j / 3) ^ v = (arrivedCell P j / 3) ^ (v - 1) * (arrivedCell P j / 3) := by conv_lhs => rw [← hpow, pow_succ] rw [ha] field_simp · have hz : arrivedCell P j = 0 := le_antisymm (le_of_not_gt hj) measureReal_nonneg have hone : P.1.real {r | inCell r j ∧ r.R = true ∧ r.Y = true} = 0 := by apply le_antisymm _ measureReal_nonneg calc _ ≤ arrivedCell P j := measureReal_mono (fun r hr ↦ ⟨hr.1, hr.2.1⟩) (measure_ne_top P.1 _) _ = 0 := hz simp [cellMean, hj, hone] · simp [integral_markedPoissonFactorialBranch, chebNeedle, hb]
CausalSmith.Stat.MarRareqLogfrontier.integral_markedPoissonFactorialBranch_eq_needle · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/FactorialMean.lean:106
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.Certificate.FullBias 5 declarations Assembly of the light and heavy needle biases and the complementary pilot term into the signed bias bound in roadmap (20).

Assembly of the light and heavy needle biases and the complementary pilot term into the signed bias bound in roadmap (20).

theorem abs_sum_pilot_needle_bias_le

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
P :
hb :
|2 * ∑ j : Cell d, armSign j.1 * cellProb P j * cellMean P j * (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)).real {s | (eventCount s (streamEvent 1 j true false) : ℝ) ≤ needleRadius n q / 4} * (chebNeedle n d q).eval (streamSize n * arrivedCell P j)|
≤ 8 * d * needleRadius n q / (streamEffectiveSize n q * (needleDegree n q : ℝ)^2)
+ 4 * exp (-16 * logScale n q)
Proof (Lean source)
-- @node: abs_sum_pilot_needle_bias_le lemma abs_sum_pilot_needle_bias_le (n d : ℕ) (q : ℝ) (P : FullLaw d) (hP : UnrestrictedArrivalModelClass n d q P) (hb : needleBranch n d q) : |2 * ∑ j : Cell d, armSign j.1 * cellProb P j * cellMean P j * (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)).real {s | (eventCount s (streamEvent 1 j true false) : ℝ) ≤ needleRadius n q / 4} * (chebNeedle n d q).eval (streamSize n * arrivedCell P j)| ≤ 8 * d * needleRadius n q / (streamEffectiveSize n q * (needleDegree n q : ℝ)^2) + 4 * exp (-16 * logScale n q) := by classical let f : Cell d → ℝ := fun j ↦ armSign j.1 * cellProb P j * cellMean P j * (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)).real {s | (eventCount s (streamEvent 1 j true false) : ℝ) ≤ needleRadius n q / 4} * (chebNeedle n d q).eval (streamSize n * arrivedCell P j) have hsplit : (∑ j : Cell d, f j) = (∑ j ∈ (Finset.univ : Finset (Cell d)).filter (fun j ↦ streamSize n * arrivedCell P j ≤ needleRadius n q), f j) + (∑ j ∈ (Finset.univ : Finset (Cell d)).filter (fun j ↦ needleRadius n q < streamSize n * arrivedCell P j), f j) := by rw [Finset.sum_filter, Finset.sum_filter, ← Finset.sum_add_distrib] apply Finset.sum_congr rfl intro j _ by_cases hj : streamSize n * arrivedCell P j ≤ needleRadius n q · simp [hj, not_lt.mpr hj] · simp [hj, lt_of_not_ge hj] have hl := abs_sum_light_pilot_needle_bias_le n d q P hP hb (fun j ↦ (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)).real {s | (eventCount s (streamEvent 1 j true false) : ℝ) ≤ needleRadius n q / 4}) (fun _ ↦ ⟨measureReal_nonneg, measureReal_le_one⟩) have hh := abs_sum_heavy_pilot_needle_bias_le n d q P hb change |2 * ∑ j : Cell d, f j| ≤ _ rw [hsplit, mul_add] exact (abs_add_le _ _).trans (add_le_add hl hh)
CausalSmith.Stat.MarRareqLogfrontier.abs_sum_pilot_needle_bias_le · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/FullBias.lean:18
theorem abs_sum_markedPoissonSelectedCellEstimate_bias_le

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
P :
hb :
|2 * ∑ j : Cell d, armSign j.1 * cellProb P j * ((∫ s, poissonSelectedCellEstimate n d q j s ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) - cellMean P j)|
≤ 2 * (4 * d * needleRadius n q / (streamEffectiveSize n q * (needleDegree n q : ℝ)^2) + 3 * exp (-16 * logScale n q))
Proof (Lean source)
-- @node: abs_sum_markedPoissonSelectedCellEstimate_bias_le lemma abs_sum_markedPoissonSelectedCellEstimate_bias_le (n d : ℕ) (q : ℝ) (P : FullLaw d) (hP : UnrestrictedArrivalModelClass n d q P) (hb : needleBranch n d q) : |2 * ∑ j : Cell d, armSign j.1 * cellProb P j * ((∫ s, poissonSelectedCellEstimate n d q j s ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) - cellMean P j)| ≤ 2 * (4 * d * needleRadius n q / (streamEffectiveSize n q * (needleDegree n q : ℝ)^2) + 3 * exp (-16 * logScale n q)) := by classical let f : Cell d → ℝ := fun j ↦ armSign j.1 * cellProb P j * cellMean P j * (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)).real {s | (eventCount s (streamEvent 1 j true false) : ℝ) ≤ needleRadius n q / 4} * (chebNeedle n d q).eval (streamSize n * arrivedCell P j) let g : Cell d → ℝ := fun j ↦ armSign j.1 * cellProb P j * cellMean P j * (1 - (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)).real {s | (eventCount s (streamEvent 1 j true false) : ℝ) ≤ needleRadius n q / 4}) * exp (-(streamSize n * arrivedCell P j)) have heq : (2 * ∑ j : Cell d, armSign j.1 * cellProb P j * ((∫ s, poissonSelectedCellEstimate n d q j s ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) - cellMean P j)) = -(2 * ∑ j : Cell d, f j) - (2 * ∑ j : Cell d, g j) := by have hj (j : Cell d) : armSign j.1 * cellProb P j * ((∫ s, poissonSelectedCellEstimate n d q j s ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) - cellMean P j) = -f j - g j := by rw [markedPoissonSelectedCellEstimate_bias n d q P j hb] dsimp [f, g] ring simp_rw [hj] rw [Finset.sum_sub_distrib, Finset.sum_neg_distrib] ring have hf := abs_sum_pilot_needle_bias_le n d q P hP hb have hg := abs_sum_pilot_heavy_exp_bias_le n d q P hb rw [heq] calc _ ≤ |2 * ∑ j : Cell d, f j| + |2 * ∑ j : Cell d, g j| := by simpa only [abs_neg] using abs_sub (-(2 * ∑ j : Cell d, f j)) (2 * ∑ j : Cell d, g j) _ ≤ (8 * d * needleRadius n q / (streamEffectiveSize n q * (needleDegree n q : ℝ)^2) + 4 * exp (-16 * logScale n q)) + 2 * exp (-16 * logScale n q) := add_le_add hf hg _ = _ := by ring
CausalSmith.Stat.MarRareqLogfrontier.abs_sum_markedPoissonSelectedCellEstimate_bias_le · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/FullBias.lean:55
theorem memLp_poissonMemberWeight_mul_selectedCellEstimate

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
P :
j :
Cell d
MemLp (fun s ↦ poissonMemberWeight n j s * poissonSelectedCellEstimate n d q j s) 2 (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2))
Proof (Lean source)
-- @node: memLp_poissonMemberWeight_mul_selectedCellEstimate lemma memLp_poissonMemberWeight_mul_selectedCellEstimate (n d : ℕ) (q : ℝ) (P : FullLaw d) (j : Cell d) : MemLp (fun s ↦ poissonMemberWeight n j s * poissonSelectedCellEstimate n d q j s) 2 (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) := by have h := (memLp_poissonMemberWeight_mul_ratioBranch n d P j).add (memLp_poissonMemberWeight_mul_selectedCorrection n d q P j) convert h using 1 funext s simp only [Pi.add_apply] ring
CausalSmith.Stat.MarRareqLogfrontier.memLp_poissonMemberWeight_mul_selectedCellEstimate · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/FullBias.lean:102
theorem integral_poissonMemberWeight_mul_selectedCellEstimate

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
P :
j :
Cell d
hn :
0 < n
(∫ s, poissonMemberWeight n j s * poissonSelectedCellEstimate n d q j s ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2))
= cellProb P j * (∫ s, poissonSelectedCellEstimate n d q j s ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2))
Proof (Lean source)
-- @node: integral_poissonMemberWeight_mul_selectedCellEstimate lemma integral_poissonMemberWeight_mul_selectedCellEstimate (n d : ℕ) (q : ℝ) (P : FullLaw d) (j : Cell d) (hn : 0 < n) : (∫ s, poissonMemberWeight n j s * poissonSelectedCellEstimate n d q j s ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) = cellProb P j * (∫ s, poissonSelectedCellEstimate n d q j s ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) := by have hD := (memLp_poissonRatioBranch n d P j).integrable (by norm_num) have hC := (memLp_poissonSelectedCellEstimate_sub_ratio n d q P j).integrable (by norm_num) have hWD := (memLp_poissonMemberWeight_mul_ratioBranch n d P j).integrable (by norm_num) have hWC := (memLp_poissonMemberWeight_mul_selectedCorrection n d q P j).integrable (by norm_num) have hmeanD := (indepFun_poissonMemberWeight_ratioBranch n d P j).integral_fun_mul_eq_mul_integral (measurable_poissonMemberWeight n d j).aestronglyMeasurable (measurable_poissonRatioBranch j).aestronglyMeasurable have hiC := indepFun_poissonMemberWeight_selectedCorrection n d q P j have hmeanC := hiC.integral_fun_mul_eq_mul_integral (measurable_poissonMemberWeight n d j).aestronglyMeasurable ((measurable_poissonSelectedCellEstimate n d q j).sub (measurable_poissonRatioBranch j)).aestronglyMeasurable have heq : (fun s ↦ poissonMemberWeight n j s * poissonSelectedCellEstimate n d q j s) = (fun s ↦ poissonMemberWeight n j s * poissonRatioBranch j s + poissonMemberWeight n j s * (poissonSelectedCellEstimate n d q j s - poissonRatioBranch j s)) := by funext s ring have hGeq : (fun s ↦ poissonRatioBranch j s + (poissonSelectedCellEstimate n d q j s - poissonRatioBranch j s)) = poissonSelectedCellEstimate n d q j := by funext s ring rw [heq, integral_add hWD hWC, hmeanD, hmeanC, integral_poissonMemberWeight n d P j hn] rw [← mul_add, ← integral_add hD hC, hGeq]
CausalSmith.Stat.MarRareqLogfrontier.integral_poissonMemberWeight_mul_selectedCellEstimate · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/FullBias.lean:115
theorem abs_integral_raw_poissonSelected_estimator_bias_le

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
P :
hb :
|(∫ s, 2 * ∑ j : Cell d, armSign j.1 * poissonMemberWeight n j s * poissonSelectedCellEstimate n d q j s ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2))
≤ 2 * (4 * d * needleRadius n q / (streamEffectiveSize n q * (needleDegree n q : ℝ)^2) + 3 * exp (-16 * logScale n q))
Proof (Lean source)
-- @node: abs_integral_raw_poissonSelected_estimator_bias_le lemma abs_integral_raw_poissonSelected_estimator_bias_le (n d : ℕ) (q : ℝ) (P : FullLaw d) (hP : UnrestrictedArrivalModelClass n d q P) (hb : needleBranch n d q) : |(∫ s, 2 * ∑ j : Cell d, armSign j.1 * poissonMemberWeight n j s * poissonSelectedCellEstimate n d q j s ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) - cellFunctional P| ≤ 2 * (4 * d * needleRadius n q / (streamEffectiveSize n q * (needleDegree n q : ℝ)^2) + 3 * exp (-16 * logScale n q)) := by classical have hn : 0 < n := lt_of_lt_of_le Nat.zero_lt_one hP.n_pos have hj (j : Cell d) : Integrable (fun s ↦ armSign j.1 * poissonMemberWeight n j s * poissonSelectedCellEstimate n d q j s) (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) := by simpa only [mul_assoc] using ((memLp_poissonMemberWeight_mul_selectedCellEstimate n d q P j).integrable (by norm_num)).const_mul (armSign j.1) have hc (j : Cell d) : cellContribution P j = cellProb P j * cellMean P j := by by_cases ha : 0 < arrivedCell P j · simp [cellContribution, ha] · simp [cellContribution, cellMean, ha] rw [integral_const_mul, integral_finsetSum _ (fun j _ ↦ hj j)] simp_rw [mul_assoc (armSign _) (poissonMemberWeight _ _ _) _, integral_const_mul, integral_poissonMemberWeight_mul_selectedCellEstimate n d q P _ hn] rw [cellFunctional] simp_rw [hc, ← mul_assoc] rw [← mul_sub, ← Finset.sum_sub_distrib] have heq : (∑ j : Cell d, ( armSign j.1 * cellProb P j * (∫ s, poissonSelectedCellEstimate n d q j s ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) - armSign j.1 * cellProb P j * cellMean P j)) = ∑ j : Cell d, armSign j.1 * cellProb P j * ((∫ s, poissonSelectedCellEstimate n d q j s ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) - cellMean P j) := by apply Finset.sum_congr rfl intro j _ ring rw [heq] exact abs_sum_markedPoissonSelectedCellEstimate_bias_le n d q P hP hb
CausalSmith.Stat.MarRareqLogfrontier.abs_integral_raw_poissonSelected_estimator_bias_le · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/FullBias.lean:153
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.Certificate.FullFactorialMoment 5 declarations Full-range factorial second moments and the false-light product in (10)--(13).

Full-range factorial second moments and the false-light product in (10)--(13).

theorem factorialOverlap_le_intensity_add_orders_pow Lemma factorialOverlap_le_intensity_add_orders_pow in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
lam :
ℝ≥0
v w :
ℕ
factorialOverlap lam v w ≤ ((lam : ℝ) + v + w) ^ (v + w)
Proof (Lean source)
-- @node: factorialOverlap_le_intensity_add_orders_pow lemma factorialOverlap_le_intensity_add_orders_pow (lam : ℝ≥0) (v w : ℕ) : factorialOverlap lam v w ≤ ((lam : ℝ) + v + w) ^ (v + w) := by have hv0 : (0 : ℝ) ≤ v := by positivity have hw0 : (0 : ℝ) ≤ w := by positivity have ht : 0 ≤ (lam : ℝ) := lam.coe_nonneg calc _ ≤ ∑ r ∈ range (v + 1), (v.choose r : ℝ) * (w : ℝ) ^ r * (lam : ℝ) ^ (v - r) * (lam : ℝ) ^ w := by unfold factorialOverlap apply (Finset.sum_le_sum fun r hr ↦ ?_).trans (Finset.sum_le_sum_of_subset_of_nonneg (Finset.range_mono (by omega : min v w + 1 ≤ v + 1)) (fun r _ _ ↦ by positivity)) have hrv : r ≤ v := by have := Finset.mem_range.mp hr; omega have hc : (w.choose r : ℝ) * (Nat.factorial r : ℝ) ≤ (w : ℝ) ^ r := by have h := Nat.choose_le_pow_div (α := ℝ) r w exact (le_div_iff₀ (by positivity : (0 : ℝ) < Nat.factorial r)).mp h have he : v + w - r = (v - r) + w := by omega rw [he, pow_add] calc _ = (v.choose r : ℝ) * ((w.choose r : ℝ) * Nat.factorial r) * (lam : ℝ) ^ (v - r) * (lam : ℝ) ^ w := by ring _ ≤ _ := by gcongr _ = ((w : ℝ) + lam) ^ v * (lam : ℝ) ^ w := by rw [← Finset.sum_mul, add_pow] congr 1 apply Finset.sum_congr rfl intro r hr ring _ ≤ ((lam : ℝ) + v + w) ^ v * ((lam : ℝ) + v + w) ^ w := by apply mul_le_mul (pow_le_pow_left₀ (by positivity) (by linarith) _) (pow_le_pow_left₀ ht (by linarith) _) (by positivity) (by positivity) _ = _ := (pow_add _ _ _).symm
CausalSmith.Stat.MarRareqLogfrontier.factorialOverlap_le_intensity_add_orders_pow · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/FullFactorialMoment.lean:18
theorem needleCoefficientOverlap_le_full_growth

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
lam :
ℝ≥0
hb :
≤ (64 : ℝ) ^ needleDegree n q * max 1 (((lam + 2 * needleDegree n q) / needleRadius n q) ^ (2 * needleDegree n q))
Proof (Lean source)
-- @node: needleCoefficientOverlap_le_full_growth lemma needleCoefficientOverlap_le_full_growth (n d : ℕ) (q : ℝ) (lam : ℝ≥0) (hb : needleBranch n d q) : needleCoefficientOverlap n d q lam ≤ (64 : ℝ) ^ needleDegree n q * max 1 (((lam + 2 * needleDegree n q) / needleRadius n q) ^ (2 * needleDegree n q)) := by let k := needleDegree n q let B := needleRadius n q let S := Icc 1 (k - 1) let x : ℝ := ((lam : ℝ) + 2 * k) / B let M : ℝ := max 1 (x ^ (2 * k)) let a : ℕ → ℝ := fun v ↦ |needleCoeff n d q v * B ^ v| have hB : 0 < B := by dsimp [B, needleRadius]; linarith [hb.1] have hx : 0 ≤ x := by dsimp [x]; positivity have hM : 0 ≤ M := le_trans (by norm_num) (le_max_left _ _) have hpow (r : ℕ) (hr : r ≤ 2 * k) : x ^ r ≤ M := by by_cases hx1 : x ≤ 1 · exact (pow_le_one₀ hx hx1).trans (le_max_left _ _) · exact (pow_le_pow_right₀ (le_of_not_ge hx1) hr).trans (le_max_right _ _) have hterm (v w : ℕ) (hv : v ∈ S) (hw : w ∈ S) : |needleCoeff n d q v * needleCoeff n d q w| * factorialOverlap lam v w ≤ a v * a w * M := by have hvk : v ≤ k := by have := (Finset.mem_Icc.mp hv).2; dsimp [S] at hv; omega have hwk : w ≤ k := by have := (Finset.mem_Icc.mp hw).2; dsimp [S] at hw; omega have horders : (v : ℝ) + w ≤ 2 * k := by exact_mod_cast (show v + w ≤ 2 * k by omega) have ho : factorialOverlap lam v w ≤ ((lam : ℝ) + 2 * k) ^ (v + w) := by apply (factorialOverlap_le_intensity_add_orders_pow lam v w).trans apply pow_le_pow_left₀ (by positivity) linarith calc _ ≤ |needleCoeff n d q v * needleCoeff n d q w| * (((lam : ℝ) + 2 * k) ^ (v + w)) := by gcongr _ = a v * a w * x ^ (v + w) := by dsimp [a, x] rw [div_pow, pow_add B, abs_mul, abs_mul, abs_mul, abs_pow, abs_pow, abs_of_pos hB] field_simp _ ≤ _ := mul_le_mul_of_nonneg_left (hpow _ (by omega)) (by positivity) change (∑ v ∈ S, ∑ w ∈ S, |needleCoeff n d q v * needleCoeff n d q w| * factorialOverlap lam v w) ≤ _ calc _ ≤ ∑ v ∈ S, ∑ w ∈ S, a v * a w * M := by apply Finset.sum_le_sum intro v hv apply Finset.sum_le_sum intro w hw exact hterm v w hv hw _ = (∑ v ∈ S, a v) ^ 2 * M := by simp_rw [← Finset.sum_mul, ← Finset.mul_sum] rw [← Finset.sum_mul] ring _ ≤ ((8 : ℝ) ^ k) ^ 2 * M := by apply mul_le_mul_of_nonneg_right _ hM apply pow_le_pow_left₀ (Finset.sum_nonneg fun _ _ ↦ abs_nonneg _) exact needle_scaled_coefficient_oneNorm_le n d q hb _ = _ := by change ((8 : ℝ) ^ k) ^ 2 * M = (64 : ℝ) ^ k * M rw [pow_right_comm] norm_num
CausalSmith.Stat.MarRareqLogfrontier.needleCoefficientOverlap_le_full_growth · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/FullFactorialMoment.lean:54
theorem integral_sq_markedPoissonFactorialBranch_le_full_growth

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
P :
j :
Cell d
hb :
(∫ s, (poissonFactorialBranch n d q j s) ^ 2 ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2))
≤ (64 : ℝ) ^ needleDegree n q * max 1 (((streamSize n * arrivedCell P j + 2 * needleDegree n q) / needleRadius n q) ^ (2 * needleDegree n q))
Proof (Lean source)
-- @node: integral_sq_markedPoissonFactorialBranch_le_full_growth lemma integral_sq_markedPoissonFactorialBranch_le_full_growth (n d : ℕ) (q : ℝ) (P : FullLaw d) (j : Cell d) (hb : needleBranch n d q) : (∫ s, (poissonFactorialBranch n d q j s) ^ 2 ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) ≤ (64 : ℝ) ^ needleDegree n q * max 1 (((streamSize n * arrivedCell P j + 2 * needleDegree n q) / needleRadius n q) ^ (2 * needleDegree n q)) := by have h := (integral_sq_poissonFactorialBranch_le_effective_overlap n d q j (markedObsLaw P) ((n : ℝ≥0) / 2)).trans (needleCoefficientOverlap_le_full_growth n d q (arrivedStreamIntensity n P 2 j) hb) simpa only [coe_arrivedStreamIntensity] using h
CausalSmith.Stat.MarRareqLogfrontier.integral_sq_markedPoissonFactorialBranch_le_full_growth · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/FullFactorialMoment.lean:115
theorem markedPoisson_pilot_light_mul_factorial_secondMoment_le_intensity

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
P :
j :
Cell d
hb :
hh :
(finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)).real {s | (eventCount s (streamEvent 1 j true false) : ℝ) ≤ needleRadius n q / 4} * (∫ s, (poissonFactorialBranch n d q j s) ^ 2 ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2))
≤ exp (-(streamSize n * arrivedCell P j) / 8)
Proof (Lean source)
-- @node: markedPoisson_pilot_light_mul_factorial_secondMoment_le_intensity lemma markedPoisson_pilot_light_mul_factorial_secondMoment_le_intensity (n d : ℕ) (q : ℝ) (P : FullLaw d) (j : Cell d) (hb : needleBranch n d q) (hh : needleRadius n q < streamSize n * arrivedCell P j) : (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)).real {s | (eventCount s (streamEvent 1 j true false) : ℝ) ≤ needleRadius n q / 4} * (∫ s, (poissonFactorialBranch n d q j s) ^ 2 ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) ≤ exp (-(streamSize n * arrivedCell P j) / 8) := by have hl : 0 < logScale n q := by linarith [hb.1] have hk : (needleDegree n q : ℝ) ≤ logScale n q / 64 := Nat.floor_le (by positivity) have hx : 1 ≤ (streamSize n * arrivedCell P j + 2 * needleDegree n q) / needleRadius n q := by apply (le_div_iff₀ (by dsimp [needleRadius]; positivity)).2 have hk0 : (0 : ℝ) ≤ needleDegree n q := by positivity linarith have hp := one_le_pow₀ hx (n := 2 * needleDegree n q) calc _ ≤ exp (-(streamSize n * arrivedCell P j) / 4) * ((64 : ℝ) ^ needleDegree n q * max 1 (((streamSize n * arrivedCell P j + 2 * needleDegree n q) / needleRadius n q) ^ (2 * needleDegree n q))) := by apply mul_le_mul (markedPoisson_pilot_light_probability_le_of_heavy n d q P j hb hh) (integral_sq_markedPoissonFactorialBranch_le_full_growth n d q P j hb) (integral_nonneg fun _ ↦ sq_nonneg _) (Real.exp_pos _).le _ ≤ _ := by rw [max_eq_right hp, ← mul_assoc] exact heavy_factorial_tail_growth_le (logScale n q) (streamSize n * arrivedCell P j) (needleDegree n q) hl hk hh.le
CausalSmith.Stat.MarRareqLogfrontier.markedPoisson_pilot_light_mul_factorial_secondMoment_le_intensity · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/FullFactorialMoment.lean:131
theorem markedPoisson_pilot_light_mul_factorial_secondMoment_le

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
P :
j :
Cell d
hb :
hh :
(finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)).real {s | (eventCount s (streamEvent 1 j true false) : ℝ) ≤ needleRadius n q / 4} * (∫ s, (poissonFactorialBranch n d q j s) ^ 2 ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2))
≤ exp (-32 * logScale n q)
Proof (Lean source)
-- @node: markedPoisson_pilot_light_mul_factorial_secondMoment_le lemma markedPoisson_pilot_light_mul_factorial_secondMoment_le (n d : ℕ) (q : ℝ) (P : FullLaw d) (j : Cell d) (hb : needleBranch n d q) (hh : needleRadius n q < streamSize n * arrivedCell P j) : (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)).real {s | (eventCount s (streamEvent 1 j true false) : ℝ) ≤ needleRadius n q / 4} * (∫ s, (poissonFactorialBranch n d q j s) ^ 2 ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) ≤ exp (-32 * logScale n q) := by apply (markedPoisson_pilot_light_mul_factorial_secondMoment_le_intensity n d q P j hb hh).trans apply Real.exp_le_exp.mpr change 256 * logScale n q < streamSize n * arrivedCell P j at hh linarith
CausalSmith.Stat.MarRareqLogfrontier.markedPoisson_pilot_light_mul_factorial_secondMoment_le · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/FullFactorialMoment.lean:165
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.Certificate.FullVarianceBudget 4 declarations Full correction second-moment budget and weighted selected-cell variance comparison for roadmap (21)--(24).

Full correction second-moment budget and weighted selected-cell variance comparison for roadmap (21)--(24). Cross-cell independence is left to the signed raw-estimator assembly.

theorem sum_integral_sq_memberWeight_mul_selectedCorrection_le

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
P :
hb :
8 * (∑ j : Cell d, ∫ s, (poissonMemberWeight n j s * (poissonSelectedCellEstimate n d q j s - poissonRatioBranch j s)) ^ 2 ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2))
≤ 64 * d * (exp (logScale n q / 8) + 1) * (needleRadius n q ^ 2 / streamEffectiveSize n q ^ 2 + needleRadius n q / (streamSize n * streamEffectiveSize n q))
+ 32 * exp (-32 * logScale n q) * (1 + 1 / streamSize n)
Proof (Lean source)
-- @node: sum_integral_sq_memberWeight_mul_selectedCorrection_le lemma sum_integral_sq_memberWeight_mul_selectedCorrection_le (n d : ℕ) (q : ℝ) (P : FullLaw d) (hP : UnrestrictedArrivalModelClass n d q P) (hb : needleBranch n d q) : 8 * (∑ j : Cell d, ∫ s, (poissonMemberWeight n j s * (poissonSelectedCellEstimate n d q j s - poissonRatioBranch j s)) ^ 2 ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) ≤ 64 * d * (exp (logScale n q / 8) + 1) * (needleRadius n q ^ 2 / streamEffectiveSize n q ^ 2 + needleRadius n q / (streamSize n * streamEffectiveSize n q)) + 32 * exp (-32 * logScale n q) * (1 + 1 / streamSize n) := by classical let f : Cell d → ℝ := fun j ↦ ∫ s, (poissonMemberWeight n j s * (poissonSelectedCellEstimate n d q j s - poissonRatioBranch j s)) ^ 2 ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2) have hsplit : (∑ j : Cell d, f j) = (∑ j ∈ (Finset.univ : Finset (Cell d)).filter (fun j ↦ streamSize n * arrivedCell P j ≤ needleRadius n q), f j) + (∑ j ∈ (Finset.univ : Finset (Cell d)).filter (fun j ↦ needleRadius n q < streamSize n * arrivedCell P j), f j) := by rw [Finset.sum_filter, Finset.sum_filter, ← Finset.sum_add_distrib] apply Finset.sum_congr rfl intro j _ by_cases hj : streamSize n * arrivedCell P j ≤ needleRadius n q · simp [hj, not_lt.mpr hj] · simp [hj, lt_of_not_ge hj] change 8 * (∑ j : Cell d, f j) ≤ _ rw [hsplit, mul_add] exact add_le_add (sum_light_integral_sq_poissonMemberWeight_mul_selectedCorrection_le n d q P hP hb) (sum_heavy_integral_sq_memberWeight_mul_selectedCorrection_le n d q P (lt_of_lt_of_le Nat.zero_lt_one hP.n_pos) hb)
CausalSmith.Stat.MarRareqLogfrontier.sum_integral_sq_memberWeight_mul_selectedCorrection_le · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/FullVarianceBudget.lean:18
theorem selected_variance_add_le_twice Lemma selected_variance_add_le_twice in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
Ω :
X Y :
Ω → ℝ
hX :
MemLp X 2 μ
hY :
MemLp Y 2 μ
variance (fun s ↦ X s + Y s) μ ≤ 2 * variance X μ + 2 * variance Y μ
Proof (Lean source)
-- @node: selected_variance_add_le_twice lemma selected_variance_add_le_twice {Ω : Type*} [MeasurableSpace Ω] (μ : Measure Ω) [IsFiniteMeasure μ] {X Y : Ω → ℝ} (hX : MemLp X 2 μ) (hY : MemLp Y 2 μ) : variance (fun s ↦ X s + Y s) μ ≤ 2 * variance X μ + 2 * variance Y μ := by have hsub := variance_nonneg (X := X - Y) (μ := μ) rw [variance_sub hX hY] at hsub rw [variance_fun_add hX hY] linarith
CausalSmith.Stat.MarRareqLogfrontier.selected_variance_add_le_twice · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/FullVarianceBudget.lean:52
theorem variance_memberWeight_mul_selectedCellEstimate_le

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
P :
j :
Cell d
variance (fun s ↦ poissonMemberWeight n j s * poissonSelectedCellEstimate n d q j s) (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2))
≤ 2 * variance (fun s ↦ poissonMemberWeight n j s * poissonRatioBranch j s) (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2))
+ 2 * (∫ s, (poissonMemberWeight n j s * (poissonSelectedCellEstimate n d q j s - poissonRatioBranch j s)) ^ 2 ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2))
Proof (Lean source)
-- @node: variance_memberWeight_mul_selectedCellEstimate_le lemma variance_memberWeight_mul_selectedCellEstimate_le (n d : ℕ) (q : ℝ) (P : FullLaw d) (j : Cell d) : variance (fun s ↦ poissonMemberWeight n j s * poissonSelectedCellEstimate n d q j s) (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) ≤ 2 * variance (fun s ↦ poissonMemberWeight n j s * poissonRatioBranch j s) (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) + 2 * (∫ s, (poissonMemberWeight n j s * (poissonSelectedCellEstimate n d q j s - poissonRatioBranch j s)) ^ 2 ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) := by have hD := memLp_poissonMemberWeight_mul_ratioBranch n d P j have hC := memLp_poissonMemberWeight_mul_selectedCorrection n d q P j have heq : (fun s ↦ poissonMemberWeight n j s * poissonSelectedCellEstimate n d q j s) = (fun s ↦ poissonMemberWeight n j s * poissonRatioBranch j s + poissonMemberWeight n j s * (poissonSelectedCellEstimate n d q j s - poissonRatioBranch j s)) := by funext s ring rw [heq] exact (selected_variance_add_le_twice _ hD hC).trans (add_le_add le_rfl (mul_le_mul_of_nonneg_left (variance_le_expectation_sq hC.aestronglyMeasurable) (by norm_num : (0 : ℝ) ≤ 2)))
CausalSmith.Stat.MarRareqLogfrontier.variance_memberWeight_mul_selectedCellEstimate_le · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/FullVarianceBudget.lean:63
theorem four_sum_variance_memberWeight_mul_selectedCellEstimate_le

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
P :
hb :
4 * (∑ j : Cell d, variance (fun s ↦ poissonMemberWeight n j s * poissonSelectedCellEstimate n d q j s) (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)))
≤ 8 * (4 / streamEffectiveSize n q + 1 / streamSize n)
+ 64 * d * (exp (logScale n q / 8) + 1) * (needleRadius n q ^ 2 / streamEffectiveSize n q ^ 2 + needleRadius n q / (streamSize n * streamEffectiveSize n q))
+ 32 * exp (-32 * logScale n q) * (1 + 1 / streamSize n)
Proof (Lean source)
-- @node: four_sum_variance_memberWeight_mul_selectedCellEstimate_le lemma four_sum_variance_memberWeight_mul_selectedCellEstimate_le (n d : ℕ) (q : ℝ) (P : FullLaw d) (hP : UnrestrictedArrivalModelClass n d q P) (hb : needleBranch n d q) : 4 * (∑ j : Cell d, variance (fun s ↦ poissonMemberWeight n j s * poissonSelectedCellEstimate n d q j s) (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2))) ≤ 8 * (4 / streamEffectiveSize n q + 1 / streamSize n) + 64 * d * (exp (logScale n q / 8) + 1) * (needleRadius n q ^ 2 / streamEffectiveSize n q ^ 2 + needleRadius n q / (streamSize n * streamEffectiveSize n q)) + 32 * exp (-32 * logScale n q) * (1 + 1 / streamSize n) := by have hsum := Finset.sum_le_sum (s := (Finset.univ : Finset (Cell d))) (fun j _ ↦ variance_memberWeight_mul_selectedCellEstimate_le n d q P j) rw [Finset.sum_add_distrib, ← Finset.mul_sum, ← Finset.mul_sum] at hsum have h := mul_le_mul_of_nonneg_left hsum (by norm_num : (0 : ℝ) ≤ 4) have hratio := sum_variance_poissonMemberWeight_mul_ratioBranch_le n d q P hP have hcorr := sum_integral_sq_memberWeight_mul_selectedCorrection_le n d q P hP hb linarith
CausalSmith.Stat.MarRareqLogfrontier.four_sum_variance_memberWeight_mul_selectedCellEstimate_le · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/FullVarianceBudget.lean:88
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.Certificate.HeavyBias 4 declarations Heavy needle bias via the exact factorial mean and Cauchy--Schwarz, as required by roadmap (18)--(20).

Heavy needle bias via the exact factorial mean and Cauchy--Schwarz, as required by roadmap (18)--(20).

theorem sq_integral_markedPoissonFactorialBranch_le

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
P :
j :
Cell d
(∫ s, poissonFactorialBranch n d q j s ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) ^ 2
≤ (∫ s, (poissonFactorialBranch n d q j s) ^ 2 ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2))
Proof (Lean source)
-- @node: sq_integral_markedPoissonFactorialBranch_le lemma sq_integral_markedPoissonFactorialBranch_le (n d : ℕ) (q : ℝ) (P : FullLaw d) (j : Cell d) : (∫ s, poissonFactorialBranch n d q j s ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) ^ 2 ≤ (∫ s, (poissonFactorialBranch n d q j s) ^ 2 ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) := by have hv := variance_nonneg (poissonFactorialBranch n d q j) (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) rw [variance_eq_sub (memLp_poissonFactorialBranch n d q P j)] at hv exact sub_nonneg.mp hv
CausalSmith.Stat.MarRareqLogfrontier.sq_integral_markedPoissonFactorialBranch_le · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/HeavyBias.lean:17
theorem markedPoisson_pilot_light_mul_abs_factorial_mean_le

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
P :
j :
Cell d
hb :
hh :
(finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)).real {s | (eventCount s (streamEvent 1 j true false) : ℝ) ≤ needleRadius n q / 4} * |∫ s, poissonFactorialBranch n d q j s ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)|
≤ exp (-(streamSize n * arrivedCell P j) / 16)
Proof (Lean source)
-- @node: markedPoisson_pilot_light_mul_abs_factorial_mean_le lemma markedPoisson_pilot_light_mul_abs_factorial_mean_le (n d : ℕ) (q : ℝ) (P : FullLaw d) (j : Cell d) (hb : needleBranch n d q) (hh : needleRadius n q < streamSize n * arrivedCell P j) : (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)).real {s | (eventCount s (streamEvent 1 j true false) : ℝ) ≤ needleRadius n q / 4} * |∫ s, poissonFactorialBranch n d q j s ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)| ≤ exp (-(streamSize n * arrivedCell P j) / 16) := by let p := (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)).real {s | (eventCount s (streamEvent 1 j true false) : ℝ) ≤ needleRadius n q / 4} let a := ∫ s, poissonFactorialBranch n d q j s ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2) let b := ∫ s, (poissonFactorialBranch n d q j s) ^ 2 ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2) have hp0 : 0 ≤ p := measureReal_nonneg have hp1 : p ≤ 1 := measureReal_le_one have ha : a ^ 2 ≤ b := sq_integral_markedPoissonFactorialBranch_le n d q P j have hprod : p * b ≤ exp (-(streamSize n * arrivedCell P j) / 8) := markedPoisson_pilot_light_mul_factorial_secondMoment_le_intensity n d q P j hb hh have hs : (p * |a|) ^ 2 ≤ exp (-(streamSize n * arrivedCell P j) / 8) := by calc _ = p * (p * a ^ 2) := by rw [mul_pow, sq_abs]; ring _ ≤ p * a ^ 2 := by have h := mul_le_mul_of_nonneg_right hp1 (mul_nonneg hp0 (sq_nonneg a)) simpa only [one_mul] using h _ ≤ p * b := mul_le_mul_of_nonneg_left ha hp0 _ ≤ _ := hprod have he : (exp (-(streamSize n * arrivedCell P j) / 16)) ^ 2 = exp (-(streamSize n * arrivedCell P j) / 8) := by rw [← Real.exp_nat_mul] congr 1 norm_num ring change p * |a| ≤ _ nlinarith [Real.exp_pos (-(streamSize n * arrivedCell P j) / 16)]
CausalSmith.Stat.MarRareqLogfrontier.markedPoisson_pilot_light_mul_abs_factorial_mean_le · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/HeavyBias.lean:30
theorem markedPoisson_heavy_needle_bias_le

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
P :
j :
Cell d
hb :
hh :
cellMean P j * (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)).real {s | (eventCount s (streamEvent 1 j true false) : ℝ) ≤ needleRadius n q / 4} * |(chebNeedle n d q).eval (streamSize n * arrivedCell P j)|
≤ 2 * exp (-(streamSize n * arrivedCell P j) / 16)
Proof (Lean source)
-- @node: markedPoisson_heavy_needle_bias_le lemma markedPoisson_heavy_needle_bias_le (n d : ℕ) (q : ℝ) (P : FullLaw d) (j : Cell d) (hb : needleBranch n d q) (hh : needleRadius n q < streamSize n * arrivedCell P j) : cellMean P j * (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)).real {s | (eventCount s (streamEvent 1 j true false) : ℝ) ≤ needleRadius n q / 4} * |(chebNeedle n d q).eval (streamSize n * arrivedCell P j)| ≤ 2 * exp (-(streamSize n * arrivedCell P j) / 16) := by let p := (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)).real {s | (eventCount s (streamEvent 1 j true false) : ℝ) ≤ needleRadius n q / 4} let a := ∫ s, poissonFactorialBranch n d q j s ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2) have hp0 : 0 ≤ p := measureReal_nonneg have hmu := cellMean_mem_Icc P j have hid : cellMean P j * (chebNeedle n d q).eval (streamSize n * arrivedCell P j) = cellMean P j - a := by dsimp [a] rw [integral_markedPoissonFactorialBranch_eq_needle n d q P j] ring have ht0 : 0 ≤ streamSize n * arrivedCell P j := by have : 0 ≤ arrivedCell P j := measureReal_nonneg unfold streamSize positivity have hp : p ≤ exp (-(streamSize n * arrivedCell P j) / 16) := by apply (markedPoisson_pilot_light_probability_le_of_heavy n d q P j hb hh).trans apply Real.exp_le_exp.mpr linarith have ha := markedPoisson_pilot_light_mul_abs_factorial_mean_le n d q P j hb hh change cellMean P j * p * _ ≤ _ calc _ = p * |cellMean P j - a| := by rw [← hid, abs_mul, abs_of_nonneg hmu.1] ring _ ≤ p * (cellMean P j + |a|) := by apply mul_le_mul_of_nonneg_left _ hp0 exact (abs_sub _ _).trans_eq (by rw [abs_of_nonneg hmu.1]) _ ≤ p + p * |a| := by nlinarith [mul_le_mul_of_nonneg_left hmu.2 hp0] _ ≤ _ := by change p * |a| ≤ _ at ha; linarith
CausalSmith.Stat.MarRareqLogfrontier.markedPoisson_heavy_needle_bias_le · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/HeavyBias.lean:69
theorem abs_sum_heavy_pilot_needle_bias_le

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
P :
hb :
|2 * ∑ j ∈ (Finset.univ : Finset (Cell d)).filter (fun j ↦ needleRadius n q < streamSize n * arrivedCell P j), armSign j.1 * cellProb P j * cellMean P j * (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)).real {s | (eventCount s (streamEvent 1 j true false) : ℝ) ≤ needleRadius n q / 4} * (chebNeedle n d q).eval (streamSize n * arrivedCell P j)|
≤ 4 * exp (-16 * logScale n q)
Proof (Lean source)
-- @node: abs_sum_heavy_pilot_needle_bias_le lemma abs_sum_heavy_pilot_needle_bias_le (n d : ℕ) (q : ℝ) (P : FullLaw d) (hb : needleBranch n d q) : |2 * ∑ j ∈ (Finset.univ : Finset (Cell d)).filter (fun j ↦ needleRadius n q < streamSize n * arrivedCell P j), armSign j.1 * cellProb P j * cellMean P j * (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)).real {s | (eventCount s (streamEvent 1 j true false) : ℝ) ≤ needleRadius n q / 4} * (chebNeedle n d q).eval (streamSize n * arrivedCell P j)| ≤ 4 * exp (-16 * logScale n q) := by classical have hj (j : Cell d) (hh : needleRadius n q < streamSize n * arrivedCell P j) : |armSign j.1 * cellProb P j * cellMean P j * (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)).real {s | (eventCount s (streamEvent 1 j true false) : ℝ) ≤ needleRadius n q / 4} * (chebNeedle n d q).eval (streamSize n * arrivedCell P j)| ≤ cellProb P j * (2 * exp (-16 * logScale n q)) := by have hp : 0 ≤ cellProb P j := measureReal_nonneg have hmu := cellMean_mem_Icc P j have hsign : |armSign j.1| = 1 := by cases j.1 <;> simp [armSign] rw [abs_mul, abs_mul, abs_mul, abs_mul, hsign, one_mul, abs_of_nonneg hp, abs_of_nonneg hmu.1, abs_of_nonneg measureReal_nonneg] calc _ = cellProb P j * (cellMean P j * (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)).real {s | (eventCount s (streamEvent 1 j true false) : ℝ) ≤ needleRadius n q / 4} * |(chebNeedle n d q).eval (streamSize n * arrivedCell P j)|) := by ring _ ≤ cellProb P j * (2 * exp (-(streamSize n * arrivedCell P j) / 16)) := mul_le_mul_of_nonneg_left (markedPoisson_heavy_needle_bias_le n d q P j hb hh) hp _ ≤ _ := by gcongr change 256 * logScale n q < streamSize n * arrivedCell P j at hh linarith rw [abs_mul, abs_of_nonneg (by norm_num : (0 : ℝ) ≤ 2)] calc _ ≤ 2 * ∑ j ∈ (Finset.univ : Finset (Cell d)).filter (fun j ↦ needleRadius n q < streamSize n * arrivedCell P j), |armSign j.1 * cellProb P j * cellMean P j * (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)).real {s | (eventCount s (streamEvent 1 j true false) : ℝ) ≤ needleRadius n q / 4} * (chebNeedle n d q).eval (streamSize n * arrivedCell P j)| := by gcongr exact abs_sum_le_sum_abs _ _ _ ≤ 2 * ∑ j : Cell d, cellProb P j * (2 * exp (-16 * logScale n q)) := by apply mul_le_mul_of_nonneg_left _ (by norm_num) rw [Finset.sum_filter] apply Finset.sum_le_sum intro j _ split_ifs with hh · exact hj j hh · exact mul_nonneg measureReal_nonneg (by positivity) _ = _ := by rw [← Finset.sum_mul, sum_cellProb_eq_one]; ring
CausalSmith.Stat.MarRareqLogfrontier.abs_sum_heavy_pilot_needle_bias_le · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/HeavyBias.lean:111
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.Certificate.HeavyCorrection 4 declarations Heavy-cell correction second moments, retaining the random membership weights, as required by roadmap (24).

Heavy-cell correction second moments, retaining the random membership weights, as required by roadmap (24).

theorem integral_sq_selectedCorrection_eq_pilot_mul

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
P :
j :
Cell d
hb :
(∫ s, (poissonSelectedCellEstimate n d q j s - poissonRatioBranch j s) ^ 2 ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2))
= (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)).real {s | (eventCount s (streamEvent 1 j true false) : ℝ) ≤ needleRadius n q / 4} * (∫ s, (poissonFactorialBranch n d q j s - poissonRatioBranch j s) ^ 2 ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2))
Proof (Lean source)
-- @node: integral_sq_selectedCorrection_eq_pilot_mul lemma integral_sq_selectedCorrection_eq_pilot_mul (n d : ℕ) (q : ℝ) (P : FullLaw d) (j : Cell d) (hb : needleBranch n d q) : (∫ s, (poissonSelectedCellEstimate n d q j s - poissonRatioBranch j s) ^ 2 ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) = (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)).real {s | (eventCount s (streamEvent 1 j true false) : ℝ) ≤ needleRadius n q / 4} * (∫ s, (poissonFactorialBranch n d q j s - poissonRatioBranch j s) ^ 2 ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) := by classical let H : FiniteSample (ObsRecord d) → ℝ := fun s ↦ if needleBranch n d q then ∑ v ∈ Icc 1 (needleDegree n q - 1), needleCoeff n d q v * weightedFactorial (obsStreamEvent j true true) (obsStreamEvent j true false) v s else 0 let D : FiniteSample (ObsRecord d) → ℝ := fun s ↦ if 0 < eventCount s (obsStreamEvent j true false) then eventCount s (obsStreamEvent j true true) / eventCount s (obsStreamEvent j true false) else 0 have hH : Measurable H := by simp only [H, if_pos hb] apply Finset.measurable_sum intro v hv exact (measurable_weightedFactorial _ _ (Set.Finite.measurableSet (Set.toFinite _)) (Set.Finite.measurableSet (Set.toFinite _)) v).const_mul _ have hc (a o : Bool) : Measurable (fun s : FiniteSample (ObsRecord d) ↦ (eventCount s (obsStreamEvent j a o) : ℝ)) := (measurable_of_countable (fun k : ℕ ↦ (k : ℝ))).comp (measurable_eventCount _ (Set.Finite.measurableSet (Set.toFinite _))) have hD : Measurable D := by apply Measurable.ite · exact (measurable_eventCount _ (Set.Finite.measurableSet (Set.toFinite _))) measurableSet_Ioi · exact (hc true true).div (hc true false) · fun_prop have hDs (s : FiniteSample (ObsRecord d × Fin 3)) : D (unshuffle s 2) = poissonRatioBranch j s := by simp only [D, poissonRatioBranch, eventCount_unshuffle] have hHs (s : FiniteSample (ObsRecord d × Fin 3)) : H (unshuffle s 2) = poissonFactorialBranch n d q j s := by simp only [H, poissonFactorialBranch, weightedFactorial, eventCount_unshuffle] have hgate := integral_pilot_gated_estimationStatistic n d q P j (fun s ↦ (H s - D s) ^ 2) ((hH.sub hD).pow_const 2) simp only [hHs, hDs] at hgate rw [← hgate] apply integral_congr_ae filter_upwards [] with s simp only [poissonSelectedCellEstimate, hb, true_and] split_ifs <;> simp
CausalSmith.Stat.MarRareqLogfrontier.integral_sq_selectedCorrection_eq_pilot_mul · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/HeavyCorrection.lean:20
theorem integral_sq_selectedCorrection_le_of_heavy

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
P :
j :
Cell d
hb :
hh :
(∫ s, (poissonSelectedCellEstimate n d q j s - poissonRatioBranch j s) ^ 2 ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2))
≤ 4 * exp (-32 * logScale n q)
Proof (Lean source)
-- @node: integral_sq_selectedCorrection_le_of_heavy lemma integral_sq_selectedCorrection_le_of_heavy (n d : ℕ) (q : ℝ) (P : FullLaw d) (j : Cell d) (hb : needleBranch n d q) (hh : needleRadius n q < streamSize n * arrivedCell P j) : (∫ s, (poissonSelectedCellEstimate n d q j s - poissonRatioBranch j s) ^ 2 ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) ≤ 4 * exp (-32 * logScale n q) := by have hH := (memLp_two_iff_integrable_sq (measurable_poissonFactorialBranch n d q j).aestronglyMeasurable).1 (memLp_poissonFactorialBranch n d q P j) have hdiff := (memLp_two_iff_integrable_sq ((measurable_poissonFactorialBranch n d q j).sub (measurable_poissonRatioBranch j)).aestronglyMeasurable).1 ((memLp_poissonFactorialBranch n d q P j).sub (memLp_poissonRatioBranch n d P j)) have hmoment : (∫ s, (poissonFactorialBranch n d q j s - poissonRatioBranch j s) ^ 2 ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) ≤ 2 * ((∫ s, (poissonFactorialBranch n d q j s) ^ 2 ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) + 1) := by calc _ ≤ ∫ s, 2 * ((poissonFactorialBranch n d q j s) ^ 2 + 1) ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2) := by apply integral_mono hdiff ((hH.add (integrable_const 1)).const_mul 2) intro s dsimp only [Pi.add_apply] have hD := poissonRatioBranch_mem_unitInterval j s have hDs : (poissonRatioBranch j s) ^ 2 ≤ 1 := by nlinarith [hD.1, hD.2] have hsq := add_sq_le (a := poissonFactorialBranch n d q j s) (b := -poissonRatioBranch j s) simp only [neg_sq, ← sub_eq_add_neg] at hsq exact hsq.trans (by linarith) _ = _ := by rw [integral_const_mul, integral_add hH (integrable_const 1)]; simp rw [integral_sq_selectedCorrection_eq_pilot_mul n d q P j hb] have hp := markedPoisson_pilot_light_probability_le_exp_of_heavy n d q P j hb hh have hprod := markedPoisson_pilot_light_mul_factorial_secondMoment_le n d q P j hb hh have h := mul_le_mul_of_nonneg_left hmoment (show 0 ≤ (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)).real {s | (eventCount s (streamEvent 1 j true false) : ℝ) ≤ needleRadius n q / 4} from measureReal_nonneg) nlinarith
CausalSmith.Stat.MarRareqLogfrontier.integral_sq_selectedCorrection_le_of_heavy · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/HeavyCorrection.lean:73
theorem integral_sq_memberWeight_mul_selectedCorrection_le_of_heavy

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
P :
j :
Cell d
hn :
0 < n
hb :
hh :
(∫ s, (poissonMemberWeight n j s * (poissonSelectedCellEstimate n d q j s - poissonRatioBranch j s)) ^ 2 ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2))
≤ 4 * exp (-32 * logScale n q) * (∫ s, (poissonMemberWeight n j s) ^ 2 ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2))
Proof (Lean source)
-- @node: integral_sq_memberWeight_mul_selectedCorrection_le_of_heavy lemma integral_sq_memberWeight_mul_selectedCorrection_le_of_heavy (n d : ℕ) (q : ℝ) (P : FullLaw d) (j : Cell d) (hn : 0 < n) (hb : needleBranch n d q) (hh : needleRadius n q < streamSize n * arrivedCell P j) : (∫ s, (poissonMemberWeight n j s * (poissonSelectedCellEstimate n d q j s - poissonRatioBranch j s)) ^ 2 ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) ≤ 4 * exp (-32 * logScale n q) * (∫ s, (poissonMemberWeight n j s) ^ 2 ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) := by rw [integral_sq_poissonMemberWeight_mul_selectedCorrection n d q P j hn, integral_sq_poissonMemberWeight n d P j hn] have h := mul_le_mul_of_nonneg_left (integral_sq_selectedCorrection_le_of_heavy n d q P j hb hh) (show 0 ≤ (cellProb P j) ^ 2 + cellProb P j / streamSize n from add_nonneg (sq_nonneg _) (div_nonneg measureReal_nonneg (by unfold streamSize; positivity))) simpa only [mul_comm] using h
CausalSmith.Stat.MarRareqLogfrontier.integral_sq_memberWeight_mul_selectedCorrection_le_of_heavy · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/HeavyCorrection.lean:117
theorem sum_heavy_integral_sq_memberWeight_mul_selectedCorrection_le

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
P :
hn :
0 < n
hb :
8 * (∑ j ∈ (Finset.univ : Finset (Cell d)).filter (fun j ↦ needleRadius n q < streamSize n * arrivedCell P j), ∫ s, (poissonMemberWeight n j s * (poissonSelectedCellEstimate n d q j s - poissonRatioBranch j s)) ^ 2 ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2))
≤ 32 * exp (-32 * logScale n q) * (1 + 1 / streamSize n)
Proof (Lean source)
-- @node: sum_heavy_integral_sq_memberWeight_mul_selectedCorrection_le lemma sum_heavy_integral_sq_memberWeight_mul_selectedCorrection_le (n d : ℕ) (q : ℝ) (P : FullLaw d) (hn : 0 < n) (hb : needleBranch n d q) : 8 * (∑ j ∈ (Finset.univ : Finset (Cell d)).filter (fun j ↦ needleRadius n q < streamSize n * arrivedCell P j), ∫ s, (poissonMemberWeight n j s * (poissonSelectedCellEstimate n d q j s - poissonRatioBranch j s)) ^ 2 ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) ≤ 32 * exp (-32 * logScale n q) * (1 + 1 / streamSize n) := by classical calc _ ≤ 8 * ∑ j : Cell d, 4 * exp (-32 * logScale n q) * (∫ s, (poissonMemberWeight n j s) ^ 2 ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) := by rw [Finset.sum_filter] apply mul_le_mul_of_nonneg_left _ (by norm_num) apply Finset.sum_le_sum intro j _ split_ifs with hh · exact integral_sq_memberWeight_mul_selectedCorrection_le_of_heavy n d q P j hn hb hh · exact mul_nonneg (by positivity) (integral_nonneg fun _ ↦ sq_nonneg _) _ = 32 * exp (-32 * logScale n q) * (∑ j : Cell d, ∫ s, (poissonMemberWeight n j s) ^ 2 ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) := by rw [← Finset.mul_sum] ring _ ≤ _ := mul_le_mul_of_nonneg_left (sum_integral_sq_poissonMemberWeight_le n d P hn) (by positivity)
CausalSmith.Stat.MarRareqLogfrontier.sum_heavy_integral_sq_memberWeight_mul_selectedCorrection_le · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/HeavyCorrection.lean:138
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.Certificate.HeavyFactorialBudget 4 declarations Numerical heavy-cell exponential budgets for the false-light product (13).

Numerical heavy-cell exponential budgets for the false-light product (13). These isolate the analytic step after the factorial second-moment bound (10).

theorem heavy_factorial_exponent_budget Lemma heavy_factorial_exponent_budget in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
ell t :
ℝ
k :
ℕ
hell :
0 < ell
hk :
(k : ℝ) ≤ ell / 64
ht :
256 * ell ≤ t
6 * (k : ℝ) + 2 * (k : ℝ) * ((t + 2 * k) / (256 * ell)) ≤ t / 8
Proof (Lean source)
-- @node: heavy_factorial_exponent_budget lemma heavy_factorial_exponent_budget (ell t : ℝ) (k : ℕ) (hell : 0 < ell) (hk : (k : ℝ) ≤ ell / 64) (ht : 256 * ell ≤ t) : 6 * (k : ℝ) + 2 * (k : ℝ) * ((t + 2 * k) / (256 * ell)) ≤ t / 8 := by have hk0 : (0 : ℝ) ≤ k := by positivity have ht0 : 0 ≤ t := by linarith have hkt : (k : ℝ) ≤ t / 16384 := by linarith have hratio : 2 * (k : ℝ) / (256 * ell) ≤ 1 / 8192 := by apply (div_le_iff₀ (by positivity : (0 : ℝ) < 256 * ell)).2 linarith have hprod := mul_le_mul_of_nonneg_right hratio (show 0 ≤ t + 2 * (k : ℝ) by positivity) have heq : 2 * (k : ℝ) * ((t + 2 * k) / (256 * ell)) = (2 * (k : ℝ) / (256 * ell)) * (t + 2 * k) := by ring rw [heq] linarith
CausalSmith.Stat.MarRareqLogfrontier.heavy_factorial_exponent_budget · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/HeavyFactorialBudget.lean:17
theorem heavy_factorial_tail_growth_le Lemma heavy_factorial_tail_growth_le in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
ell t :
ℝ
k :
ℕ
hell :
0 < ell
hk :
(k : ℝ) ≤ ell / 64
ht :
256 * ell ≤ t
exp (-t / 4) * (64 : ℝ) ^ k * ((t + 2 * k) / (256 * ell)) ^ (2 * k)
≤ exp (-t / 8)
Proof (Lean source)
-- @node: heavy_factorial_tail_growth_le lemma heavy_factorial_tail_growth_le (ell t : ℝ) (k : ℕ) (hell : 0 < ell) (hk : (k : ℝ) ≤ ell / 64) (ht : 256 * ell ≤ t) : exp (-t / 4) * (64 : ℝ) ^ k * ((t + 2 * k) / (256 * ell)) ^ (2 * k) ≤ exp (-t / 8) := by let x := (t + 2 * k) / (256 * ell) have ht0 : 0 ≤ t := by linarith have hx0 : 0 ≤ x := by dsimp [x]; positivity have hx : x ≤ exp x := by linarith [Real.add_one_le_exp x] have htwo : (2 : ℝ) ≤ exp 1 := by have h := Real.add_one_le_exp (1 : ℝ) norm_num at h exact h have hcoeff : (64 : ℝ) ^ k ≤ exp (6 * (k : ℝ)) := by calc (64 : ℝ) ^ k = ((2 : ℝ) ^ 6) ^ k := by norm_num _ = (2 : ℝ) ^ (6 * k) := by rw [← pow_mul] _ ≤ (exp 1) ^ (6 * k) := by gcongr _ = exp (6 * (k : ℝ)) := by rw [← Real.exp_nat_mul] congr 1 norm_num have hgrowth : x ^ (2 * k) ≤ exp (2 * (k : ℝ) * x) := by calc _ ≤ (exp x) ^ (2 * k) := by gcongr _ = _ := by rw [← Real.exp_nat_mul]; congr 1; push_cast; ring calc _ ≤ exp (-t / 4) * exp (6 * (k : ℝ)) * exp (2 * (k : ℝ) * x) := by gcongr _ = exp (-t / 4 + 6 * (k : ℝ) + 2 * (k : ℝ) * x) := by rw [← Real.exp_add, ← Real.exp_add] _ ≤ exp (-t / 8) := by apply Real.exp_le_exp.mpr have h := heavy_factorial_exponent_budget ell t k hell hk ht change 6 * (k : ℝ) + 2 * (k : ℝ) * x ≤ t / 8 at h linarith
CausalSmith.Stat.MarRareqLogfrontier.heavy_factorial_tail_growth_le · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/HeavyFactorialBudget.lean:35
theorem heavy_factorial_tail_max_growth_le Lemma heavy_factorial_tail_max_growth_le in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
ell t :
ℝ
k :
ℕ
hell :
0 < ell
hk :
(k : ℝ) ≤ ell / 64
ht :
256 * ell ≤ t
exp (-t / 4) * ((64 : ℝ) ^ k * max 1 (((t + 2 * k) / (256 * ell)) ^ (2 * k)))
≤ exp (-32 * ell)
Proof (Lean source)
-- @node: heavy_factorial_tail_max_growth_le lemma heavy_factorial_tail_max_growth_le (ell t : ℝ) (k : ℕ) (hell : 0 < ell) (hk : (k : ℝ) ≤ ell / 64) (ht : 256 * ell ≤ t) : exp (-t / 4) * ((64 : ℝ) ^ k * max 1 (((t + 2 * k) / (256 * ell)) ^ (2 * k))) ≤ exp (-32 * ell) := by have hx : 1 ≤ (t + 2 * (k : ℝ)) / (256 * ell) := by apply (le_div_iff₀ (by positivity : (0 : ℝ) < 256 * ell)).2 have hk0 : (0 : ℝ) ≤ k := by positivity linarith have hpow : 1 ≤ ((t + 2 * (k : ℝ)) / (256 * ell)) ^ (2 * k) := one_le_pow₀ hx rw [max_eq_right hpow, ← mul_assoc] apply (heavy_factorial_tail_growth_le ell t k hell hk ht).trans apply Real.exp_le_exp.mpr linarith
CausalSmith.Stat.MarRareqLogfrontier.heavy_factorial_tail_max_growth_le · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/HeavyFactorialBudget.lean:73
theorem markedPoisson_pilot_light_mul_factorial_growth_le

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
P :
j :
Cell d
hb :
hh :
(finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)).real {s | (eventCount s (streamEvent 1 j true false) : ℝ) ≤ needleRadius n q / 4} * ((64 : ℝ) ^ needleDegree n q * max 1 (((streamSize n * arrivedCell P j + 2 * needleDegree n q) / needleRadius n q) ^ (2 * needleDegree n q)))
≤ exp (-32 * logScale n q)
Proof (Lean source)
-- @node: markedPoisson_pilot_light_mul_factorial_growth_le lemma markedPoisson_pilot_light_mul_factorial_growth_le (n d : ℕ) (q : ℝ) (P : FullLaw d) (j : Cell d) (hb : needleBranch n d q) (hh : needleRadius n q < streamSize n * arrivedCell P j) : (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)).real {s | (eventCount s (streamEvent 1 j true false) : ℝ) ≤ needleRadius n q / 4} * ((64 : ℝ) ^ needleDegree n q * max 1 (((streamSize n * arrivedCell P j + 2 * needleDegree n q) / needleRadius n q) ^ (2 * needleDegree n q))) ≤ exp (-32 * logScale n q) := by have hl : 0 < logScale n q := by linarith [hb.1] have hk : (needleDegree n q : ℝ) ≤ logScale n q / 64 := Nat.floor_le (by positivity) calc _ ≤ exp (-(streamSize n * arrivedCell P j) / 4) * ((64 : ℝ) ^ needleDegree n q * max 1 (((streamSize n * arrivedCell P j + 2 * needleDegree n q) / needleRadius n q) ^ (2 * needleDegree n q))) := by apply mul_le_mul_of_nonneg_right (markedPoisson_pilot_light_probability_le_of_heavy n d q P j hb hh) positivity _ ≤ _ := heavy_factorial_tail_max_growth_le (logScale n q) (streamSize n * arrivedCell P j) (needleDegree n q) hl hk hh.le
CausalSmith.Stat.MarRareqLogfrontier.markedPoisson_pilot_light_mul_factorial_growth_le · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/HeavyFactorialBudget.lean:91
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.Certificate.IdealEstimator 9 declarations The ideal estimator evaluated on an uncapped marked Poisson sample.

The ideal estimator evaluated on an uncapped marked Poisson sample.

def poissonMemberWeight

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
n :
ℕ
d :
ℕ
j :
Cell d
s :
poissonMemberWeight n j s :
ℝ
eventCount s (streamEvent 0 j false false) / streamSize n
def poissonRawMixedValue

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
n d :
ℕ
q :
ℝ
s :
poissonRawMixedValue n d q s :
ℝ
2 * ∑ j : Cell d, armSign j.1 * poissonMemberWeight n j s * poissonSelectedCellEstimate n d q j s
def poissonAuxiliaryMixedValue

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
n d :
ℕ
q :
ℝ
s :
poissonAuxiliaryMixedValue n d q s :
ℝ
if effectiveSize n q ≤ 1 then 0 else clip (poissonRawMixedValue n d q s)
CausalSmith.Stat.MarRareqLogfrontier.poissonAuxiliaryMixedValue · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/IdealEstimator.lean:27
theorem memberWeight_eq_poissonMemberWeight

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
k d :
ℕ
n :
ℕ
records :
Fin k → ObsRecord d
assign :
Fin k → Fin 3
j :
Cell d
memberWeight n records assign j
= poissonMemberWeight n j (fixedSizeEmbed k (fun i ↦ (records i, assign i)))
Proof (Lean source)
lemma memberWeight_eq_poissonMemberWeight {k d : ℕ} (n : ℕ) (records : Fin k → ObsRecord d) (assign : Fin k → Fin 3) (j : Cell d) : memberWeight n records assign j = poissonMemberWeight n j (fixedSizeEmbed k (fun i ↦ (records i, assign i))) := by rw [memberWeight, poissonMemberWeight, memberCount_eq_eventCount]
CausalSmith.Stat.MarRareqLogfrontier.memberWeight_eq_poissonMemberWeight · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/IdealEstimator.lean:32
theorem auxiliaryMixedValue_eq_poissonAuxiliaryMixedValue

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
k d :
ℕ
n :
ℕ
q :
ℝ
records :
Fin k → ObsRecord d
assign :
Fin k → Fin 3
auxiliaryMixedValue n q records assign
= poissonAuxiliaryMixedValue n d q (fixedSizeEmbed k (fun i ↦ (records i, assign i)))
Proof (Lean source)
lemma auxiliaryMixedValue_eq_poissonAuxiliaryMixedValue {k d : ℕ} (n : ℕ) (q : ℝ) (records : Fin k → ObsRecord d) (assign : Fin k → Fin 3) : auxiliaryMixedValue n q records assign = poissonAuxiliaryMixedValue n d q (fixedSizeEmbed k (fun i ↦ (records i, assign i))) := by unfold auxiliaryMixedValue poissonAuxiliaryMixedValue poissonRawMixedValue split_ifs · rfl · congr 2 apply Finset.sum_congr rfl intro j hj rw [memberWeight_eq_poissonMemberWeight, selectedCellEstimate_eq_poissonSelectedCellEstimate]
CausalSmith.Stat.MarRareqLogfrontier.auxiliaryMixedValue_eq_poissonAuxiliaryMixedValue · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/IdealEstimator.lean:39
theorem measurable_poissonFactorialBranch

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
j :
Cell d
Proof (Lean source)
@[fun_prop] lemma measurable_poissonFactorialBranch (n d : ℕ) (q : ℝ) (j : Cell d) : Measurable (poissonFactorialBranch n d q j) := by unfold poissonFactorialBranch split_ifs · apply Finset.measurable_sum intro v hv exact (measurable_weightedFactorial (streamEvent 2 j true true) (streamEvent 2 j true false) (Set.Finite.measurableSet (Set.toFinite _)) (Set.Finite.measurableSet (Set.toFinite _)) v).const_mul _ · fun_prop
CausalSmith.Stat.MarRareqLogfrontier.measurable_poissonFactorialBranch · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/IdealEstimator.lean:55
theorem measurable_poissonSelectedCellEstimate

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
j :
Cell d
Proof (Lean source)
@[fun_prop] lemma measurable_poissonSelectedCellEstimate (n d : ℕ) (q : ℝ) (j : Cell d) : Measurable (poissonSelectedCellEstimate n d q j) := by unfold poissonSelectedCellEstimate apply Measurable.ite · by_cases hbranch : needleBranch n d q · simp only [hbranch, true_and] have hc : Measurable (fun s : FiniteSample (ObsRecord d × Fin 3) => (eventCount s (streamEvent 1 j true false) : ℝ)) := (measurable_of_countable (fun z : ℕ => (z : ℝ))).comp (measurable_eventCount _ (Set.Finite.measurableSet (Set.toFinite _))) exact hc measurableSet_Iic · simp [hbranch] · exact measurable_poissonFactorialBranch n d q j · exact measurable_poissonRatioBranch j
CausalSmith.Stat.MarRareqLogfrontier.measurable_poissonSelectedCellEstimate · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/IdealEstimator.lean:68
theorem measurable_poissonAuxiliaryMixedValue

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
Proof (Lean source)
@[fun_prop] lemma measurable_poissonAuxiliaryMixedValue (n d : ℕ) (q : ℝ) : Measurable (poissonAuxiliaryMixedValue n d q) := by unfold poissonAuxiliaryMixedValue poissonRawMixedValue poissonMemberWeight clip split_ifs · fun_prop · apply Measurable.max measurable_const apply Measurable.min measurable_const apply Measurable.const_mul apply Finset.measurable_sum intro j hj have hmember : Measurable (fun s : FiniteSample (ObsRecord d × Fin 3) => (eventCount s (streamEvent 0 j false false) : ℝ) / streamSize n) := by apply Measurable.div_const exact (measurable_of_countable (fun z : ℕ => (z : ℝ))).comp (measurable_eventCount _ (Set.Finite.measurableSet (Set.toFinite _))) exact (hmember.const_mul _).mul (measurable_poissonSelectedCellEstimate n d q j)
CausalSmith.Stat.MarRareqLogfrontier.measurable_poissonAuxiliaryMixedValue · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/IdealEstimator.lean:84
theorem poissonAuxiliaryMixedValue_mem_Icc

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
s :
poissonAuxiliaryMixedValue n d q s ∈ Icc (-1 : ℝ) 1
Proof (Lean source)
lemma poissonAuxiliaryMixedValue_mem_Icc (n d : ℕ) (q : ℝ) (s : FiniteSample (ObsRecord d × Fin 3)) : poissonAuxiliaryMixedValue n d q s ∈ Icc (-1 : ℝ) 1 := by unfold poissonAuxiliaryMixedValue clip split_ifs · norm_num · exact ⟨le_max_left _ _, (max_le_iff.mpr ⟨by norm_num, min_le_left _ _⟩)⟩
CausalSmith.Stat.MarRareqLogfrontier.poissonAuxiliaryMixedValue_mem_Icc · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/IdealEstimator.lean:103
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.Certificate.IdealRiskTransfer 1 declarations Transfer of ideal risk between a marked Poisson sample and independent streams.

Transfer of ideal risk between a marked Poisson sample and independent streams.

theorem integral_sq_poissonAuxiliaryMixedValue_eq_streams

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q θ :
ℝ
P :
(∫ s, (poissonAuxiliaryMixedValue n d q s - θ) ^ 2 ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2))
= ∫ s, (streamAuxiliaryMixedValue n d q s - θ) ^ 2 ∂Measure.pi (fun _ : Fin 3 ↦ finitePoissonSampleLaw (P.1.map obs) (((n : ℝ≥0) / 2) * (1 / 3)))
Proof (Lean source)
lemma integral_sq_poissonAuxiliaryMixedValue_eq_streams (n d : ℕ) (q θ : ℝ) (P : FullLaw d) : (∫ s, (poissonAuxiliaryMixedValue n d q s - θ) ^ 2 ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) = ∫ s, (streamAuxiliaryMixedValue n d q s - θ) ^ 2 ∂Measure.pi (fun _ : Fin 3 ↦ finitePoissonSampleLaw (P.1.map obs) (((n : ℝ≥0) / 2) * (1 / 3))) := by letI : IsProbabilityMeasure P.1 := P.2 letI : IsProbabilityMeasure (P.1.map obs) := map_obs_isProbabilityMeasure P rw [← map_unshuffle_markedObsLaw P ((n : ℝ≥0) / 2)] let f : (Fin 3 → FiniteSample (ObsRecord d)) → ℝ := fun s ↦ (streamAuxiliaryMixedValue n d q s - θ) ^ 2 have hf : Measurable f := ((measurable_streamAuxiliaryMixedValue n d q).sub measurable_const).pow_const 2 change _ = ∫ s, f s ∂Measure.map unshuffle (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) rw [integral_map measurable_unshuffle.aemeasurable hf.aestronglyMeasurable] apply integral_congr_ae filter_upwards [] with s dsimp [f] rw [streamAuxiliaryMixedValue_unshuffle]
CausalSmith.Stat.MarRareqLogfrontier.integral_sq_poissonAuxiliaryMixedValue_eq_streams · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/IdealRiskTransfer.lean:19
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.Certificate.MembershipMoments 9 declarations Exact random membership-weight moments in roadmap (3), (21), and (24).

Exact random membership-weight moments in roadmap (3), (21), and (24).

def membershipStreamIntensity

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
n :
ℕ
d :
ℕ
P :
j :
Cell d
membershipStreamIntensity n P j :
ℝ≥0
((n : ℝ≥0) / 2) * ((markedObsLaw P) (streamEvent 0 j false false)).toNNReal
CausalSmith.Stat.MarRareqLogfrontier.membershipStreamIntensity · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/MembershipMoments.lean:21
theorem coe_membershipStreamIntensity

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n :
ℕ
d :
ℕ
P :
j :
Cell d
(membershipStreamIntensity n P j : ℝ) = streamSize n * cellProb P j
Proof (Lean source)
lemma coe_membershipStreamIntensity (n : ℕ) {d : ℕ} (P : FullLaw d) (j : Cell d) : (membershipStreamIntensity n P j : ℝ) = streamSize n * cellProb P j := by unfold membershipStreamIntensity change ((n : ℝ) / 2) * ((markedObsLaw P) (streamEvent 0 j false false)).toReal = _ rw [← measureReal_def, markedObsLaw_streamEvent_real, map_obsStreamEvent_membership_real] unfold streamSize ring
CausalSmith.Stat.MarRareqLogfrontier.coe_membershipStreamIntensity · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/MembershipMoments.lean:29
theorem map_membershipCount_eq_poisson

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
P :
j :
Cell d
Measure.map (fun s ↦ eventCount s (streamEvent 0 j false false)) (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2))
Proof (Lean source)
-- @node: map_membershipCount_eq_poisson lemma map_membershipCount_eq_poisson (n d : ℕ) (P : FullLaw d) (j : Cell d) : Measure.map (fun s ↦ eventCount s (streamEvent 0 j false false)) (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) = poissonMeasure (membershipStreamIntensity n P j) := by classical exact finitePoissonSampleLaw_map_eventCount (markedObsLaw P) ((n : ℝ≥0) / 2) (streamEvent 0 j false false) (Set.Finite.measurableSet (Set.toFinite _))
CausalSmith.Stat.MarRareqLogfrontier.map_membershipCount_eq_poisson · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/MembershipMoments.lean:41
theorem memLp_poissonMemberWeight

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
P :
j :
Cell d
Proof (Lean source)
-- @node: memLp_poissonMemberWeight lemma memLp_poissonMemberWeight (n d : ℕ) (P : FullLaw d) (j : Cell d) : MemLp (poissonMemberWeight n j) 2 (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) := by classical have h := poisson_natCast_memLp_two (membershipStreamIntensity n P j) rw [← map_membershipCount_eq_poisson n d P j] at h have hc := h.comp_of_map (measurable_eventCount (streamEvent 0 j false false) (Set.Finite.measurableSet (Set.toFinite _))).aemeasurable change MemLp (fun s ↦ (eventCount s (streamEvent 0 j false false) : ℝ) / streamSize n) 2 _ simpa [Function.comp_def, div_eq_mul_inv] using hc.mul_const (streamSize n)⁻¹
CausalSmith.Stat.MarRareqLogfrontier.memLp_poissonMemberWeight · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/MembershipMoments.lean:51
theorem integral_poissonMemberWeight

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
P :
j :
Cell d
hn :
0 < n
(∫ s, poissonMemberWeight n j s ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2))
= cellProb P j
Proof (Lean source)
-- @node: integral_poissonMemberWeight lemma integral_poissonMemberWeight (n d : ℕ) (P : FullLaw d) (j : Cell d) (hn : 0 < n) : (∫ s, poissonMemberWeight n j s ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) = cellProb P j := by classical have hm : streamSize n ≠ 0 := by unfold streamSize exact div_ne_zero (by exact_mod_cast hn.ne') (by norm_num) unfold poissonMemberWeight rw [integral_div] rw [← integral_map (measurable_eventCount (streamEvent 0 j false false) (Set.Finite.measurableSet (Set.toFinite _))).aemeasurable (measurable_of_countable (fun k : ℕ ↦ (k : ℝ))).aestronglyMeasurable, map_membershipCount_eq_poisson, poisson_count_first_moment, coe_membershipStreamIntensity] exact mul_div_cancel_left₀ _ hm
CausalSmith.Stat.MarRareqLogfrontier.integral_poissonMemberWeight · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/MembershipMoments.lean:68
theorem integral_sq_poissonMemberWeight

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
P :
j :
Cell d
hn :
0 < n
(∫ s, (poissonMemberWeight n j s) ^ 2 ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2))
= (cellProb P j) ^ 2 + cellProb P j / streamSize n
Proof (Lean source)
-- @node: integral_sq_poissonMemberWeight lemma integral_sq_poissonMemberWeight (n d : ℕ) (P : FullLaw d) (j : Cell d) (hn : 0 < n) : (∫ s, (poissonMemberWeight n j s) ^ 2 ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) = (cellProb P j) ^ 2 + cellProb P j / streamSize n := by classical have hm : streamSize n ≠ 0 := by unfold streamSize exact div_ne_zero (by exact_mod_cast hn.ne') (by norm_num) simp only [poissonMemberWeight, div_pow] rw [integral_div] rw [← integral_map (measurable_eventCount (streamEvent 0 j false false) (Set.Finite.measurableSet (Set.toFinite _))).aemeasurable (measurable_of_countable (fun k : ℕ ↦ (k : ℝ) ^ 2)).aestronglyMeasurable, map_membershipCount_eq_poisson, poisson_count_second_moment, coe_membershipStreamIntensity] field_simp
CausalSmith.Stat.MarRareqLogfrontier.integral_sq_poissonMemberWeight · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/MembershipMoments.lean:88
theorem variance_poissonMemberWeight

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
P :
j :
Cell d
hn :
0 < n
= cellProb P j / streamSize n
Proof (Lean source)
-- @node: variance_poissonMemberWeight lemma variance_poissonMemberWeight (n d : ℕ) (P : FullLaw d) (j : Cell d) (hn : 0 < n) : variance (poissonMemberWeight n j) (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) = cellProb P j / streamSize n := by rw [variance_eq_sub (memLp_poissonMemberWeight n d P j)] change (∫ s, (poissonMemberWeight n j s) ^ 2 ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) - (∫ s, poissonMemberWeight n j s ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) ^ 2 = _ rw [integral_sq_poissonMemberWeight n d P j hn, integral_poissonMemberWeight n d P j hn] ring
CausalSmith.Stat.MarRareqLogfrontier.variance_poissonMemberWeight · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/MembershipMoments.lean:109
theorem sum_integral_sq_poissonMemberWeight_le

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
P :
hn :
0 < n
(∑ j : Cell d, ∫ s, (poissonMemberWeight n j s) ^ 2 ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2))
≤ 1 + 1 / streamSize n
Proof (Lean source)
-- @node: sum_integral_sq_poissonMemberWeight_le lemma sum_integral_sq_poissonMemberWeight_le (n d : ℕ) (P : FullLaw d) (hn : 0 < n) : (∑ j : Cell d, ∫ s, (poissonMemberWeight n j s) ^ 2 ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) ≤ 1 + 1 / streamSize n := by have hp (j : Cell d) : cellProb P j ≤ 1 := by calc cellProb P j ≤ ∑ i : Cell d, cellProb P i := Finset.single_le_sum (fun i _ ↦ (show 0 ≤ cellProb P i from measureReal_nonneg)) (Finset.mem_univ j) _ = 1 := sum_cellProb_eq_one P calc _ = ∑ j : Cell d, ((cellProb P j) ^ 2 + cellProb P j / streamSize n) := by apply Finset.sum_congr rfl intro j hj exact integral_sq_poissonMemberWeight n d P j hn _ ≤ ∑ j : Cell d, (cellProb P j + cellProb P j / streamSize n) := by apply Finset.sum_le_sum intro j hj have hnonneg : 0 ≤ cellProb P j := measureReal_nonneg nlinarith [hp j] _ = _ := by rw [Finset.sum_add_distrib, ← Finset.sum_div, sum_cellProb_eq_one]
CausalSmith.Stat.MarRareqLogfrontier.sum_integral_sq_poissonMemberWeight_le · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/MembershipMoments.lean:125
theorem sum_membershipVariance_mul_ratioSecondMoment_le

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
P :
hn :
0 < n
(∑ j : Cell d, variance (poissonMemberWeight n j) (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) * (∫ s, (poissonRatioBranch j s) ^ 2 ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)))
≤ 1 / streamSize n
Proof (Lean source)
-- @node: sum_membershipVariance_mul_ratioSecondMoment_le lemma sum_membershipVariance_mul_ratioSecondMoment_le (n d : ℕ) (P : FullLaw d) (hn : 0 < n) : (∑ j : Cell d, variance (poissonMemberWeight n j) (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) * (∫ s, (poissonRatioBranch j s) ^ 2 ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2))) ≤ 1 / streamSize n := by have hm : 0 < streamSize n := by unfold streamSize exact div_pos (by exact_mod_cast hn) (by norm_num) calc _ ≤ ∑ j : Cell d, cellProb P j / streamSize n := by apply Finset.sum_le_sum intro j hj rw [variance_poissonMemberWeight n d P j hn] have hsecond : (∫ s, (poissonRatioBranch j s) ^ 2 ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) ≤ 1 := by calc _ ≤ ∫ _s : FiniteSample (ObsRecord d × Fin 3), (1 : ℝ) ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2) := by apply integral_mono (integrable_poissonRatioBranch_sq n d P j) (integrable_const _) intro s rcases poissonRatioBranch_mem_unitInterval j s with ⟨hs0, hs1⟩ nlinarith _ = 1 := by simp simpa using mul_le_mul_of_nonneg_left hsecond (div_nonneg (show 0 ≤ cellProb P j from measureReal_nonneg) hm.le) _ = _ := by rw [← Finset.sum_div, sum_cellProb_eq_one]
CausalSmith.Stat.MarRareqLogfrontier.sum_membershipVariance_mul_ratioSecondMoment_le · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/MembershipMoments.lean:151
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.Certificate.MembershipRatio 6 declarations Independent membership and estimation streams give the weighted ratio variance identity and its aggregate bound in roadmap (21).

Independent membership and estimation streams give the weighted ratio variance identity and its aggregate bound in roadmap (21).

theorem measurable_poissonMemberWeight Lemma measurable_poissonMemberWeight in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
j :
Cell d
Proof (Lean source)
-- @node: measurable_poissonMemberWeight @[fun_prop] lemma measurable_poissonMemberWeight (n d : ℕ) (j : Cell d) : Measurable (poissonMemberWeight n j) := by unfold poissonMemberWeight exact ((measurable_of_countable (fun k : ℕ ↦ (k : ℝ))).comp (measurable_eventCount _ (Set.Finite.measurableSet (Set.toFinite _)))).div_const _
CausalSmith.Stat.MarRareqLogfrontier.measurable_poissonMemberWeight · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/MembershipRatio.lean:23
theorem memLp_poissonRatioBranch

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
P :
j :
Cell d
Proof (Lean source)
-- @node: memLp_poissonRatioBranch lemma memLp_poissonRatioBranch (n d : ℕ) (P : FullLaw d) (j : Cell d) : MemLp (poissonRatioBranch j) 2 (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) := by apply (memLp_two_iff_integrable_sq (measurable_poissonRatioBranch j).aestronglyMeasurable).2 exact integrable_poissonRatioBranch_sq n d P j
CausalSmith.Stat.MarRareqLogfrontier.memLp_poissonRatioBranch · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/MembershipRatio.lean:31
theorem indepFun_poissonMemberWeight_ratioBranch

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
P :
j :
Cell d
Proof (Lean source)
-- @node: indepFun_poissonMemberWeight_ratioBranch lemma indepFun_poissonMemberWeight_ratioBranch (n d : ℕ) (P : FullLaw d) (j : Cell d) : IndepFun (poissonMemberWeight n j) (poissonRatioBranch j) (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) := by classical let W : FiniteSample (ObsRecord d) → ℝ := fun s ↦ eventCount s (obsStreamEvent j false false) / streamSize n let D : FiniteSample (ObsRecord d) → ℝ := fun s ↦ if 0 < eventCount s (obsStreamEvent j true false) then eventCount s (obsStreamEvent j true true) / eventCount s (obsStreamEvent j true false) else 0 have hcount (a o : Bool) : Measurable (fun s : FiniteSample (ObsRecord d) ↦ (eventCount s (obsStreamEvent j a o) : ℝ)) := (measurable_of_countable (fun k : ℕ ↦ (k : ℝ))).comp (measurable_eventCount _ (Set.Finite.measurableSet (Set.toFinite _))) have hW : Measurable W := (hcount false false).div_const _ have hD : Measurable D := by apply Measurable.ite · exact (measurable_eventCount _ (Set.Finite.measurableSet (Set.toFinite _))) measurableSet_Ioi · exact (hcount true true).div (hcount true false) · fun_prop have hcoords := (iIndepFun_pi (μ := fun _ : Fin 3 ↦ finitePoissonSampleLaw (P.1.map obs) (((n : ℝ≥0) / 2) * (1 / 3))) (X := fun _ ↦ id) (fun _ ↦ measurable_id.aemeasurable)).indepFun (show (0 : Fin 3) ≠ 2 by decide) have hind := hcoords.comp hW hD rw [← map_unshuffle_markedObsLaw P ((n : ℝ≥0) / 2)] at hind have hWs (s : FiniteSample (ObsRecord d × Fin 3)) : W (unshuffle s 0) = poissonMemberWeight n j s := by simp only [W, poissonMemberWeight, eventCount_unshuffle] have hDs (s : FiniteSample (ObsRecord d × Fin 3)) : D (unshuffle s 2) = poissonRatioBranch j s := by simp only [D, poissonRatioBranch, eventCount_unshuffle] rw [indepFun_iff_measure_inter_preimage_eq_mul] at hind ⊢ intro a b ha hb have h := hind a b ha hb simp only [id_eq] at h rw [Measure.map_apply measurable_unshuffle ((ha.preimage (hW.comp (measurable_pi_apply 0))).inter (hb.preimage (hD.comp (measurable_pi_apply 2)))), Measure.map_apply measurable_unshuffle (ha.preimage (hW.comp (measurable_pi_apply 0))), Measure.map_apply measurable_unshuffle (hb.preimage (hD.comp (measurable_pi_apply 2)))] at h simpa only [Set.preimage_inter, Set.preimage_preimage, Function.comp_def, hWs, hDs] using h
CausalSmith.Stat.MarRareqLogfrontier.indepFun_poissonMemberWeight_ratioBranch · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/MembershipRatio.lean:40
theorem memLp_poissonMemberWeight_mul_ratioBranch

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
P :
j :
Cell d
MemLp (fun s ↦ poissonMemberWeight n j s * poissonRatioBranch j s) 2 (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2))
Proof (Lean source)
-- @node: memLp_poissonMemberWeight_mul_ratioBranch lemma memLp_poissonMemberWeight_mul_ratioBranch (n d : ℕ) (P : FullLaw d) (j : Cell d) : MemLp (fun s ↦ poissonMemberWeight n j s * poissonRatioBranch j s) 2 (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) := by apply (memLp_poissonMemberWeight n d P j).of_le_mul ((measurable_poissonMemberWeight n d j).mul (measurable_poissonRatioBranch j)).aestronglyMeasurable (c := 1) filter_upwards [] with s simp only [Pi.mul_apply, norm_mul, one_mul] apply mul_le_of_le_one_right (norm_nonneg _) rcases poissonRatioBranch_mem_unitInterval j s with ⟨h0, h1⟩ simpa [Real.norm_eq_abs, abs_of_nonneg h0] using h1
CausalSmith.Stat.MarRareqLogfrontier.memLp_poissonMemberWeight_mul_ratioBranch · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/MembershipRatio.lean:87
theorem variance_poissonMemberWeight_mul_ratioBranch

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
P :
j :
Cell d
hn :
0 < n
variance (fun s ↦ poissonMemberWeight n j s * poissonRatioBranch j s) (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2))
= (cellProb P j) ^ 2 * variance (poissonRatioBranch j) (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2))
+ (cellProb P j / streamSize n) * (∫ s, (poissonRatioBranch j s) ^ 2 ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2))
Proof (Lean source)
-- @node: variance_poissonMemberWeight_mul_ratioBranch lemma variance_poissonMemberWeight_mul_ratioBranch (n d : ℕ) (P : FullLaw d) (j : Cell d) (hn : 0 < n) : variance (fun s ↦ poissonMemberWeight n j s * poissonRatioBranch j s) (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) = (cellProb P j) ^ 2 * variance (poissonRatioBranch j) (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) + (cellProb P j / streamSize n) * (∫ s, (poissonRatioBranch j s) ^ 2 ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) := by have hi := indepFun_poissonMemberWeight_ratioBranch n d P j have hmean := hi.integral_fun_mul_eq_mul_integral (measurable_poissonMemberWeight n d j).aestronglyMeasurable (measurable_poissonRatioBranch j).aestronglyMeasurable have hsecond := (hi.comp (measurable_id.pow_const 2) (measurable_id.pow_const 2)).integral_fun_mul_eq_mul_integral ((measurable_poissonMemberWeight n d j).pow_const 2).aestronglyMeasurable ((measurable_poissonRatioBranch j).pow_const 2).aestronglyMeasurable simp only [Function.comp_def, id_eq] at hsecond rw [variance_eq_sub (memLp_poissonMemberWeight_mul_ratioBranch n d P j), variance_eq_sub (memLp_poissonRatioBranch n d P j)] simp only [Pi.pow_apply] simp only [mul_pow] rw [hmean, hsecond, integral_poissonMemberWeight n d P j hn, integral_sq_poissonMemberWeight n d P j hn] ring
CausalSmith.Stat.MarRareqLogfrontier.variance_poissonMemberWeight_mul_ratioBranch · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/MembershipRatio.lean:102
theorem sum_variance_poissonMemberWeight_mul_ratioBranch_le

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
P :
(∑ j : Cell d, variance (fun s ↦ poissonMemberWeight n j s * poissonRatioBranch j s) (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)))
≤ 4 / streamEffectiveSize n q + 1 / streamSize n
Proof (Lean source)
-- @node: sum_variance_poissonMemberWeight_mul_ratioBranch_le lemma sum_variance_poissonMemberWeight_mul_ratioBranch_le (n d : ℕ) (q : ℝ) (P : FullLaw d) (hP : UnrestrictedArrivalModelClass n d q P) : (∑ j : Cell d, variance (fun s ↦ poissonMemberWeight n j s * poissonRatioBranch j s) (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2))) ≤ 4 / streamEffectiveSize n q + 1 / streamSize n := by have hn : 0 < n := lt_of_lt_of_le Nat.zero_lt_one hP.n_pos simp_rw [variance_poissonMemberWeight_mul_ratioBranch n d P _ hn] rw [Finset.sum_add_distrib] apply add_le_add (sum_cellProb_sq_mul_ratioVariance_le n d q P hP) simpa only [variance_poissonMemberWeight n d P _ hn] using sum_membershipVariance_mul_ratioSecondMoment_le n d P hn
CausalSmith.Stat.MarRareqLogfrontier.sum_variance_poissonMemberWeight_mul_ratioBranch_le · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/MembershipRatio.lean:129
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.Certificate.PilotBias 4 declarations Pilot independence and the exact selected-cell bias in roadmap (16).

Pilot independence and the exact selected-cell bias in roadmap (16).

theorem indepFun_pilotCount_estimationStatistic

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
P :
j :
Cell d
F :
hF :
IndepFun (fun s ↦ eventCount s (streamEvent 1 j true false)) (fun s ↦ F (unshuffle s 2)) (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2))
Proof (Lean source)
-- @node: indepFun_pilotCount_estimationStatistic lemma indepFun_pilotCount_estimationStatistic (n d : ℕ) (P : FullLaw d) (j : Cell d) (F : FiniteSample (ObsRecord d) → ℝ) (hF : Measurable F) : IndepFun (fun s ↦ eventCount s (streamEvent 1 j true false)) (fun s ↦ F (unshuffle s 2)) (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) := by classical let C : FiniteSample (ObsRecord d) → ℕ := fun s ↦ eventCount s (obsStreamEvent j true false) have hC : Measurable C := measurable_eventCount _ (Set.Finite.measurableSet (Set.toFinite _)) have hcoords := (iIndepFun_pi (μ := fun _ : Fin 3 ↦ finitePoissonSampleLaw (P.1.map obs) (((n : ℝ≥0) / 2) * (1 / 3))) (X := fun _ ↦ id) (fun _ ↦ measurable_id.aemeasurable)).indepFun (show (1 : Fin 3) ≠ 2 by decide) have hind := hcoords.comp hC hF rw [← map_unshuffle_markedObsLaw P ((n : ℝ≥0) / 2)] at hind rw [indepFun_iff_measure_inter_preimage_eq_mul] at hind ⊢ intro a b ha hb have h := hind a b ha hb simp only [id_eq] at h rw [Measure.map_apply measurable_unshuffle ((ha.preimage (hC.comp (measurable_pi_apply 1))).inter (hb.preimage (hF.comp (measurable_pi_apply 2)))), Measure.map_apply measurable_unshuffle (ha.preimage (hC.comp (measurable_pi_apply 1))), Measure.map_apply measurable_unshuffle (hb.preimage (hF.comp (measurable_pi_apply 2)))] at h simpa only [Set.preimage_inter, Set.preimage_preimage, Function.comp_def, C, eventCount_unshuffle] using h
CausalSmith.Stat.MarRareqLogfrontier.indepFun_pilotCount_estimationStatistic · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/PilotBias.lean:19
theorem integral_pilot_gated_estimationStatistic

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
P :
j :
Cell d
F :
hF :
(∫ s, (if (eventCount s (streamEvent 1 j true false) : ℝ) ≤ needleRadius n q / 4 then F (unshuffle s 2) else 0) ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2))
= (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)).real {s | (eventCount s (streamEvent 1 j true false) : ℝ) ≤ needleRadius n q / 4} * (∫ s, F (unshuffle s 2) ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2))
Proof (Lean source)
-- @node: integral_pilot_gated_estimationStatistic lemma integral_pilot_gated_estimationStatistic (n d : ℕ) (q : ℝ) (P : FullLaw d) (j : Cell d) (F : FiniteSample (ObsRecord d) → ℝ) (hF : Measurable F) : (∫ s, (if (eventCount s (streamEvent 1 j true false) : ℝ) ≤ needleRadius n q / 4 then F (unshuffle s 2) else 0) ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) = (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)).real {s | (eventCount s (streamEvent 1 j true false) : ℝ) ≤ needleRadius n q / 4} * (∫ s, F (unshuffle s 2) ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) := by classical let g : ℕ → ℝ := fun c ↦ if (c : ℝ) ≤ needleRadius n q / 4 then 1 else 0 have hg : Measurable g := measurable_of_countable _ have hi := (indepFun_pilotCount_estimationStatistic n d P j F hF).comp hg measurable_id have hcount := measurable_eventCount (streamEvent 1 j true false) (Set.Finite.measurableSet (Set.toFinite _)) have hstat : Measurable (fun s : FiniteSample (ObsRecord d × Fin 3) ↦ F (unshuffle s 2)) := hF.comp ((measurable_pi_apply (2 : Fin 3)).comp measurable_unshuffle) have h := hi.integral_fun_mul_eq_mul_integral (hg.comp hcount).aestronglyMeasurable hstat.aestronglyMeasurable simp only [Function.comp_def, id_eq, g, ite_mul, one_mul, zero_mul] at h rw [h] congr 1 have hs : MeasurableSet {s : FiniteSample (ObsRecord d × Fin 3) | (eventCount s (streamEvent 1 j true false) : ℝ) ≤ needleRadius n q / 4} := ((measurable_of_countable (fun c : ℕ ↦ (c : ℝ))).comp hcount) measurableSet_Iic simpa only [indicator, Set.mem_ofPred_eq, Pi.one_apply] using (integral_indicator_one (μ := finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) hs)
CausalSmith.Stat.MarRareqLogfrontier.integral_pilot_gated_estimationStatistic · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/PilotBias.lean:49
theorem integral_poissonSelectedCellEstimate_eq_pilot_mixture

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
P :
j :
Cell d
hb :
(∫ s, poissonSelectedCellEstimate n d q j s ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2))
= (∫ s, poissonRatioBranch j s ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2))
+ (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)).real {s | (eventCount s (streamEvent 1 j true false) : ℝ) ≤ needleRadius n q / 4} * ((∫ s, poissonFactorialBranch n d q j s ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) - (∫ s, poissonRatioBranch j s ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)))
Proof (Lean source)
-- @node: integral_poissonSelectedCellEstimate_eq_pilot_mixture lemma integral_poissonSelectedCellEstimate_eq_pilot_mixture (n d : ℕ) (q : ℝ) (P : FullLaw d) (j : Cell d) (hb : needleBranch n d q) : (∫ s, poissonSelectedCellEstimate n d q j s ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) = (∫ s, poissonRatioBranch j s ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) + (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)).real {s | (eventCount s (streamEvent 1 j true false) : ℝ) ≤ needleRadius n q / 4} * ((∫ s, poissonFactorialBranch n d q j s ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) - (∫ s, poissonRatioBranch j s ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2))) := by classical let H : FiniteSample (ObsRecord d) → ℝ := fun s ↦ if needleBranch n d q then ∑ v ∈ Icc 1 (needleDegree n q - 1), needleCoeff n d q v * weightedFactorial (obsStreamEvent j true true) (obsStreamEvent j true false) v s else 0 let D : FiniteSample (ObsRecord d) → ℝ := fun s ↦ if 0 < eventCount s (obsStreamEvent j true false) then eventCount s (obsStreamEvent j true true) / eventCount s (obsStreamEvent j true false) else 0 have hH : Measurable H := by simp only [H, if_pos hb] apply Finset.measurable_sum intro v hv exact (measurable_weightedFactorial _ _ (Set.Finite.measurableSet (Set.toFinite _)) (Set.Finite.measurableSet (Set.toFinite _)) v).const_mul _ have hc (a o : Bool) : Measurable (fun s : FiniteSample (ObsRecord d) ↦ (eventCount s (obsStreamEvent j a o) : ℝ)) := (measurable_of_countable (fun k : ℕ ↦ (k : ℝ))).comp (measurable_eventCount _ (Set.Finite.measurableSet (Set.toFinite _))) have hD : Measurable D := by apply Measurable.ite · exact (measurable_eventCount _ (Set.Finite.measurableSet (Set.toFinite _))) measurableSet_Ioi · exact (hc true true).div (hc true false) · fun_prop have hDs (s : FiniteSample (ObsRecord d × Fin 3)) : D (unshuffle s 2) = poissonRatioBranch j s := by simp only [D, poissonRatioBranch, eventCount_unshuffle] have hHs (s : FiniteSample (ObsRecord d × Fin 3)) : H (unshuffle s 2) = poissonFactorialBranch n d q j s := by simp only [H, poissonFactorialBranch, weightedFactorial, eventCount_unshuffle] have hgate := integral_pilot_gated_estimationStatistic n d q P j (fun s ↦ H s - D s) (hH.sub hD) simp only [hHs, hDs] at hgate have hDint := (memLp_poissonRatioBranch n d P j).integrable (by norm_num) have hHint := (memLp_poissonFactorialBranch n d q P j).integrable (by norm_num) have hCint := (memLp_poissonSelectedCellEstimate_sub_ratio n d q P j).integrable (by norm_num) have hdecomp : (fun s ↦ poissonSelectedCellEstimate n d q j s) = (fun s ↦ poissonRatioBranch j s + (poissonSelectedCellEstimate n d q j s - poissonRatioBranch j s)) := by funext s ring rw [hdecomp, integral_add hDint hCint] have hcorr : (fun s ↦ poissonSelectedCellEstimate n d q j s - poissonRatioBranch j s) = (fun s ↦ if (eventCount s (streamEvent 1 j true false) : ℝ) ≤ needleRadius n q / 4 then poissonFactorialBranch n d q j s - poissonRatioBranch j s else 0) := by funext s simp only [poissonSelectedCellEstimate, hb, true_and] split_ifs <;> simp rw [hcorr, hgate, integral_sub hHint hDint]
CausalSmith.Stat.MarRareqLogfrontier.integral_poissonSelectedCellEstimate_eq_pilot_mixture · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/PilotBias.lean:81
theorem markedPoissonSelectedCellEstimate_bias

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
P :
j :
Cell d
hb :
(∫ s, poissonSelectedCellEstimate n d q j s ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2))
- cellMean P j
= -cellMean P j * ((finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)).real {s | (eventCount s (streamEvent 1 j true false) : ℝ) ≤ needleRadius n q / 4} * (chebNeedle n d q).eval (streamSize n * arrivedCell P j) + (1 - (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)).real {s | (eventCount s (streamEvent 1 j true false) : ℝ) ≤ needleRadius n q / 4}) * exp (-(streamSize n * arrivedCell P j)))
Proof (Lean source)
-- @node: markedPoissonSelectedCellEstimate_bias lemma markedPoissonSelectedCellEstimate_bias (n d : ℕ) (q : ℝ) (P : FullLaw d) (j : Cell d) (hb : needleBranch n d q) : (∫ s, poissonSelectedCellEstimate n d q j s ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) - cellMean P j = -cellMean P j * ((finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)).real {s | (eventCount s (streamEvent 1 j true false) : ℝ) ≤ needleRadius n q / 4} * (chebNeedle n d q).eval (streamSize n * arrivedCell P j) + (1 - (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)).real {s | (eventCount s (streamEvent 1 j true false) : ℝ) ≤ needleRadius n q / 4}) * exp (-(streamSize n * arrivedCell P j))) := by rw [integral_poissonSelectedCellEstimate_eq_pilot_mixture n d q P j hb, integral_markedPoissonFactorialBranch_eq_needle, integral_markedPoissonRatioBranch] rw [neg_mul] ring
CausalSmith.Stat.MarRareqLogfrontier.markedPoissonSelectedCellEstimate_bias · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/PilotBias.lean:150
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.Certificate.PilotBiasBounds 3 declarations Complementary pilot probabilities and the signed false-heavy bias contribution in roadmap (19)--(20), together with the heavy-cell pilot bound for (24).

Complementary pilot probabilities and the signed false-heavy bias contribution in roadmap (19)--(20), together with the heavy-cell pilot bound for (24).

theorem markedPoisson_pilot_heavy_probability_eq_one_sub_light

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
P :
j :
Cell d
(finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)).real {s | needleRadius n q / 4 < (eventCount s (streamEvent 1 j true false) : ℝ)}
= 1
- (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)).real {s | (eventCount s (streamEvent 1 j true false) : ℝ) ≤ needleRadius n q / 4}
Proof (Lean source)
-- @node: markedPoisson_pilot_heavy_probability_eq_one_sub_light lemma markedPoisson_pilot_heavy_probability_eq_one_sub_light (n d : ℕ) (q : ℝ) (P : FullLaw d) (j : Cell d) : (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)).real {s | needleRadius n q / 4 < (eventCount s (streamEvent 1 j true false) : ℝ)} = 1 - (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)).real {s | (eventCount s (streamEvent 1 j true false) : ℝ) ≤ needleRadius n q / 4} := by have hs : MeasurableSet {s : FiniteSample (ObsRecord d × Fin 3) | (eventCount s (streamEvent 1 j true false) : ℝ) ≤ needleRadius n q / 4} := ((measurable_of_countable (fun c : ℕ ↦ (c : ℝ))).comp (measurable_eventCount _ (Set.Finite.measurableSet (Set.toFinite _)))) measurableSet_Iic have heq : {s : FiniteSample (ObsRecord d × Fin 3) | needleRadius n q / 4 < (eventCount s (streamEvent 1 j true false) : ℝ)} = {s | (eventCount s (streamEvent 1 j true false) : ℝ) ≤ needleRadius n q / 4}ᶜ := by ext s simp only [Set.mem_setOf_eq, Set.mem_compl_iff, not_le] rw [heq, measureReal_compl hs, probReal_univ]
CausalSmith.Stat.MarRareqLogfrontier.markedPoisson_pilot_heavy_probability_eq_one_sub_light · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/PilotBiasBounds.lean:18
theorem abs_sum_pilot_heavy_exp_bias_le

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
P :
hb :
|2 * ∑ j : Cell d, armSign j.1 * cellProb P j * cellMean P j * (1 - (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)).real {s | (eventCount s (streamEvent 1 j true false) : ℝ) ≤ needleRadius n q / 4}) * exp (-(streamSize n * arrivedCell P j))|
≤ 2 * exp (-16 * logScale n q)
Proof (Lean source)
-- @node: abs_sum_pilot_heavy_exp_bias_le lemma abs_sum_pilot_heavy_exp_bias_le (n d : ℕ) (q : ℝ) (P : FullLaw d) (hb : needleBranch n d q) : |2 * ∑ j : Cell d, armSign j.1 * cellProb P j * cellMean P j * (1 - (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)).real {s | (eventCount s (streamEvent 1 j true false) : ℝ) ≤ needleRadius n q / 4}) * exp (-(streamSize n * arrivedCell P j))| ≤ 2 * exp (-16 * logScale n q) := by classical have hj (j : Cell d) : |armSign j.1 * cellProb P j * cellMean P j * (1 - (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)).real {s | (eventCount s (streamEvent 1 j true false) : ℝ) ≤ needleRadius n q / 4}) * exp (-(streamSize n * arrivedCell P j))| ≤ cellProb P j * exp (-16 * logScale n q) := by rw [← markedPoisson_pilot_heavy_probability_eq_one_sub_light] have hp : 0 ≤ cellProb P j := measureReal_nonneg have hmu := cellMean_mem_Icc P j have hsign : |armSign j.1| = 1 := by cases j.1 <;> simp [armSign] rw [abs_mul, abs_mul, abs_mul, abs_mul, hsign, one_mul, abs_of_nonneg hp, abs_of_nonneg hmu.1, abs_of_nonneg measureReal_nonneg, abs_of_pos (Real.exp_pos _)] calc _ = cellProb P j * cellMean P j * ((finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)).real {s | needleRadius n q / 4 < (eventCount s (streamEvent 1 j true false) : ℝ)} * exp (-(streamSize n * arrivedCell P j))) := by ring _ ≤ cellProb P j * 1 * exp (-16 * logScale n q) := by gcongr · exact hmu.2 · exact markedPoisson_pilot_heavy_mul_exp_le n d q P j hb _ = _ := by ring rw [abs_mul, abs_of_nonneg (by norm_num : (0 : ℝ) ≤ 2)] calc _ ≤ 2 * ∑ j : Cell d, |armSign j.1 * cellProb P j * cellMean P j * (1 - (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)).real {s | (eventCount s (streamEvent 1 j true false) : ℝ) ≤ needleRadius n q / 4}) * exp (-(streamSize n * arrivedCell P j))| := by gcongr exact abs_sum_le_sum_abs _ _ _ ≤ 2 * ∑ j : Cell d, cellProb P j * exp (-16 * logScale n q) := by gcongr with j exact hj j _ = _ := by rw [← Finset.sum_mul, sum_cellProb_eq_one, one_mul]
CausalSmith.Stat.MarRareqLogfrontier.abs_sum_pilot_heavy_exp_bias_le · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/PilotBiasBounds.lean:38
theorem markedPoisson_pilot_light_probability_le_exp_of_heavy

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
P :
j :
Cell d
hb :
hh :
(finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)).real {s | (eventCount s (streamEvent 1 j true false) : ℝ) ≤ needleRadius n q / 4}
≤ exp (-32 * logScale n q)
Proof (Lean source)
-- @node: markedPoisson_pilot_light_probability_le_exp_of_heavy lemma markedPoisson_pilot_light_probability_le_exp_of_heavy (n d : ℕ) (q : ℝ) (P : FullLaw d) (j : Cell d) (hb : needleBranch n d q) (hh : needleRadius n q < streamSize n * arrivedCell P j) : (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)).real {s | (eventCount s (streamEvent 1 j true false) : ℝ) ≤ needleRadius n q / 4} ≤ exp (-32 * logScale n q) := by apply (markedPoisson_pilot_light_probability_le_of_heavy n d q P j hb hh).trans apply Real.exp_le_exp.mpr have hl := hb.1 change 256 * logScale n q < streamSize n * arrivedCell P j at hh linarith
CausalSmith.Stat.MarRareqLogfrontier.markedPoisson_pilot_light_probability_le_exp_of_heavy · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/PilotBiasBounds.lean:84
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.Certificate.PilotCorrection 15 declarations Square integrability, independent membership weighting, and the light-cell correction bounds in roadmap (22)--(23).

Square integrability, independent membership weighting, and the light-cell correction bounds in roadmap (22)--(23).

theorem memLp_poissonFactorialBranch

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
P :
j :
Cell d
MemLp (poissonFactorialBranch n d q j) 2 (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2))
Proof (Lean source)
-- @node: memLp_poissonFactorialBranch lemma memLp_poissonFactorialBranch (n d : ℕ) (q : ℝ) (P : FullLaw d) (j : Cell d) : MemLp (poissonFactorialBranch n d q j) 2 (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) := by classical unfold poissonFactorialBranch split_ifs · apply memLp_finsetSum intro v hv have hA : MeasurableSet (streamEvent 2 j true true) := Set.Finite.measurableSet (Set.toFinite _) have hB : MeasurableSet (streamEvent 2 j true false) := Set.Finite.measurableSet (Set.toFinite _) have hmem := (memLp_two_iff_integrable_sq (measurable_weightedFactorial _ _ hA hB v).aestronglyMeasurable).2 (integrable_sq_weightedFactorial (markedObsLaw P) ((n : ℝ≥0) / 2) _ _ hA hB (streamEvent_ones_subset_arrived 2 j) v (Finset.mem_Icc.mp hv).1) exact hmem.const_mul _ · simp
CausalSmith.Stat.MarRareqLogfrontier.memLp_poissonFactorialBranch · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/PilotCorrection.lean:25
theorem poissonSelectedCellEstimate_eq_ratio_add_correction

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
j :
Cell d
s :
+ (if needleBranch n d q ∧ eventCount s (streamEvent 1 j true false) ≤ needleRadius n q / 4 then poissonFactorialBranch n d q j s - poissonRatioBranch j s else 0)
Proof (Lean source)
-- @node: poissonSelectedCellEstimate_eq_ratio_add_correction lemma poissonSelectedCellEstimate_eq_ratio_add_correction (n d : ℕ) (q : ℝ) (j : Cell d) (s : FiniteSample (ObsRecord d × Fin 3)) : poissonSelectedCellEstimate n d q j s = poissonRatioBranch j s + (if needleBranch n d q ∧ eventCount s (streamEvent 1 j true false) ≤ needleRadius n q / 4 then poissonFactorialBranch n d q j s - poissonRatioBranch j s else 0) := by unfold poissonSelectedCellEstimate split_ifs <;> ring
CausalSmith.Stat.MarRareqLogfrontier.poissonSelectedCellEstimate_eq_ratio_add_correction · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/PilotCorrection.lean:48
theorem norm_poissonSelectedCellEstimate_sub_ratio_le

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
j :
Cell d
s :
‖poissonSelectedCellEstimate n d q j s - poissonRatioBranch j s‖
≤ ‖poissonFactorialBranch n d q j s - poissonRatioBranch j s‖
Proof (Lean source)
-- @node: norm_poissonSelectedCellEstimate_sub_ratio_le lemma norm_poissonSelectedCellEstimate_sub_ratio_le (n d : ℕ) (q : ℝ) (j : Cell d) (s : FiniteSample (ObsRecord d × Fin 3)) : ‖poissonSelectedCellEstimate n d q j s - poissonRatioBranch j s‖ ≤ ‖poissonFactorialBranch n d q j s - poissonRatioBranch j s‖ := by unfold poissonSelectedCellEstimate split_ifs · exact le_rfl · simp only [sub_self, norm_zero] exact norm_nonneg _
CausalSmith.Stat.MarRareqLogfrontier.norm_poissonSelectedCellEstimate_sub_ratio_le · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/PilotCorrection.lean:59
theorem memLp_poissonSelectedCellEstimate_sub_ratio

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
P :
j :
Cell d
MemLp (fun s ↦ poissonSelectedCellEstimate n d q j s - poissonRatioBranch j s) 2 (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2))
Proof (Lean source)
-- @node: memLp_poissonSelectedCellEstimate_sub_ratio lemma memLp_poissonSelectedCellEstimate_sub_ratio (n d : ℕ) (q : ℝ) (P : FullLaw d) (j : Cell d) : MemLp (fun s ↦ poissonSelectedCellEstimate n d q j s - poissonRatioBranch j s) 2 (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) := by apply ((memLp_poissonFactorialBranch n d q P j).sub (memLp_poissonRatioBranch n d P j)).of_le · exact ((measurable_poissonSelectedCellEstimate n d q j).sub (measurable_poissonRatioBranch j)).aestronglyMeasurable · filter_upwards [] with s exact norm_poissonSelectedCellEstimate_sub_ratio_le n d q j s
CausalSmith.Stat.MarRareqLogfrontier.memLp_poissonSelectedCellEstimate_sub_ratio · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/PilotCorrection.lean:71
theorem integral_sq_poissonSelectedCellEstimate_sub_ratio_le

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
P :
j :
Cell d
(∫ s, (poissonSelectedCellEstimate n d q j s - poissonRatioBranch j s) ^ 2 ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2))
≤ 2 * ((∫ s, (poissonFactorialBranch n d q j s) ^ 2 ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) + 1)
Proof (Lean source)
-- @node: integral_sq_poissonSelectedCellEstimate_sub_ratio_le lemma integral_sq_poissonSelectedCellEstimate_sub_ratio_le (n d : ℕ) (q : ℝ) (P : FullLaw d) (j : Cell d) : (∫ s, (poissonSelectedCellEstimate n d q j s - poissonRatioBranch j s) ^ 2 ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) ≤ 2 * ((∫ s, (poissonFactorialBranch n d q j s) ^ 2 ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) + 1) := by have hH := (memLp_two_iff_integrable_sq (measurable_poissonFactorialBranch n d q j).aestronglyMeasurable).1 (memLp_poissonFactorialBranch n d q P j) have hC := (memLp_two_iff_integrable_sq ((measurable_poissonSelectedCellEstimate n d q j).sub (measurable_poissonRatioBranch j)).aestronglyMeasurable).1 (memLp_poissonSelectedCellEstimate_sub_ratio n d q P j) calc _ ≤ ∫ s, 2 * ((poissonFactorialBranch n d q j s) ^ 2 + 1) ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2) := by apply integral_mono hC ((hH.add (integrable_const 1)).const_mul 2) intro s have hD := poissonRatioBranch_mem_unitInterval j s have hDs : (poissonRatioBranch j s) ^ 2 ≤ 1 := by nlinarith [hD.1, hD.2] dsimp only [Pi.sub_apply, Pi.add_apply] unfold poissonSelectedCellEstimate split_ifs · have hsq := add_sq_le (a := poissonFactorialBranch n d q j s) (b := -poissonRatioBranch j s) simp only [neg_sq, ← sub_eq_add_neg] at hsq exact hsq.trans (by linarith) · simp only [sub_self, zero_pow (by decide : 2 ≠ 0)] positivity _ = _ := by rw [integral_const_mul, integral_add hH (integrable_const 1)]; simp
CausalSmith.Stat.MarRareqLogfrontier.integral_sq_poissonSelectedCellEstimate_sub_ratio_le · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/PilotCorrection.lean:84
theorem integral_sq_poissonSelectedCellEstimate_sub_ratio_le_of_light

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
P :
j :
Cell d
hbranch :
hlight :
(∫ s, (poissonSelectedCellEstimate n d q j s - poissonRatioBranch j s) ^ 2 ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2))
≤ 2 * (exp (logScale n q / 8) + 1)
Proof (Lean source)
-- @node: integral_sq_poissonSelectedCellEstimate_sub_ratio_le_of_light lemma integral_sq_poissonSelectedCellEstimate_sub_ratio_le_of_light (n d : ℕ) (q : ℝ) (P : FullLaw d) (j : Cell d) (hbranch : needleBranch n d q) (hlight : streamSize n * arrivedCell P j ≤ needleRadius n q) : (∫ s, (poissonSelectedCellEstimate n d q j s - poissonRatioBranch j s) ^ 2 ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) ≤ 2 * (exp (logScale n q / 8) + 1) := by apply (integral_sq_poissonSelectedCellEstimate_sub_ratio_le n d q P j).trans gcongr exact integral_sq_markedPoissonFactorialBranch_le_exp_of_light n d q P j hbranch hlight
CausalSmith.Stat.MarRareqLogfrontier.integral_sq_poissonSelectedCellEstimate_sub_ratio_le_of_light · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/PilotCorrection.lean:118
theorem indepFun_poissonMemberWeight_pilot_estimation

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
P :
j :
Cell d
F :
hF :
IndepFun (poissonMemberWeight n j) (fun s ↦ F (unshuffle s 1, unshuffle s 2)) (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2))
Proof (Lean source)
-- @node: indepFun_poissonMemberWeight_pilot_estimation lemma indepFun_poissonMemberWeight_pilot_estimation (n d : ℕ) (P : FullLaw d) (j : Cell d) (F : FiniteSample (ObsRecord d) × FiniteSample (ObsRecord d) → ℝ) (hF : Measurable F) : IndepFun (poissonMemberWeight n j) (fun s ↦ F (unshuffle s 1, unshuffle s 2)) (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) := by classical let W : FiniteSample (ObsRecord d) → ℝ := fun s ↦ eventCount s (obsStreamEvent j false false) / streamSize n have hW : Measurable W := ((measurable_of_countable (fun k : ℕ ↦ (k : ℝ))).comp (measurable_eventCount _ (Set.Finite.measurableSet (Set.toFinite _)))).div_const _ have hcoords := (iIndepFun_pi (μ := fun _ : Fin 3 ↦ finitePoissonSampleLaw (P.1.map obs) (((n : ℝ≥0) / 2) * (1 / 3))) (X := fun _ ↦ id) (fun _ ↦ measurable_id.aemeasurable)).indepFun_prodMk (fun _ ↦ measurable_pi_apply _) 1 2 0 (by decide) (by decide) have hind := hcoords.symm.comp hW hF rw [← map_unshuffle_markedObsLaw P ((n : ℝ≥0) / 2)] at hind have hWs (s : FiniteSample (ObsRecord d × Fin 3)) : W (unshuffle s 0) = poissonMemberWeight n j s := by simp only [W, poissonMemberWeight, eventCount_unshuffle] rw [indepFun_iff_measure_inter_preimage_eq_mul] at hind ⊢ intro a b ha hb have h := hind a b ha hb simp only [id_eq] at h have hpair : Measurable (fun s : Fin 3 → FiniteSample (ObsRecord d) ↦ (s 1, s 2)) := (measurable_pi_apply 1).prodMk (measurable_pi_apply 2) rw [Measure.map_apply measurable_unshuffle ((ha.preimage (hW.comp (measurable_pi_apply 0))).inter (hb.preimage (hF.comp hpair))), Measure.map_apply measurable_unshuffle (ha.preimage (hW.comp (measurable_pi_apply 0))), Measure.map_apply measurable_unshuffle (hb.preimage (hF.comp hpair))] at h simpa only [Set.preimage_inter, Set.preimage_preimage, Function.comp_def, hWs] using h
CausalSmith.Stat.MarRareqLogfrontier.indepFun_poissonMemberWeight_pilot_estimation · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/PilotCorrection.lean:132
theorem indepFun_poissonMemberWeight_selectedCorrection

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
P :
j :
Cell d
Proof (Lean source)
-- @node: indepFun_poissonMemberWeight_selectedCorrection lemma indepFun_poissonMemberWeight_selectedCorrection (n d : ℕ) (q : ℝ) (P : FullLaw d) (j : Cell d) : IndepFun (poissonMemberWeight n j) (fun s ↦ poissonSelectedCellEstimate n d q j s - poissonRatioBranch j s) (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) := by classical let H : FiniteSample (ObsRecord d) → ℝ := fun s ↦ if needleBranch n d q then ∑ v ∈ Icc 1 (needleDegree n q - 1), needleCoeff n d q v * weightedFactorial (obsStreamEvent j true true) (obsStreamEvent j true false) v s else 0 let D : FiniteSample (ObsRecord d) → ℝ := fun s ↦ if 0 < eventCount s (obsStreamEvent j true false) then eventCount s (obsStreamEvent j true true) / eventCount s (obsStreamEvent j true false) else 0 have hH : Measurable H := by dsimp [H] split_ifs · apply Finset.measurable_sum intro v hv exact (measurable_weightedFactorial _ _ (Set.Finite.measurableSet (Set.toFinite _)) (Set.Finite.measurableSet (Set.toFinite _)) v).const_mul _ · fun_prop have hc (a o : Bool) : Measurable (fun s : FiniteSample (ObsRecord d) ↦ (eventCount s (obsStreamEvent j a o) : ℝ)) := (measurable_of_countable (fun k : ℕ ↦ (k : ℝ))).comp (measurable_eventCount _ (Set.Finite.measurableSet (Set.toFinite _))) have hD : Measurable D := by apply Measurable.ite · exact (measurable_eventCount _ (Set.Finite.measurableSet (Set.toFinite _))) measurableSet_Ioi · exact (hc true true).div (hc true false) · fun_prop let F : FiniteSample (ObsRecord d) × FiniteSample (ObsRecord d) → ℝ := fun z ↦ (if needleBranch n d q ∧ eventCount z.1 (obsStreamEvent j true false) ≤ needleRadius n q / 4 then H z.2 else D z.2) - D z.2 have hF : Measurable F := by apply Measurable.sub _ (hD.comp measurable_snd) apply Measurable.ite · by_cases hb : needleBranch n d q · simp only [hb, true_and] exact ((hc true false).comp measurable_fst) measurableSet_Iic · simp [hb] · exact hH.comp measurable_snd · exact hD.comp measurable_snd have hDs (s : FiniteSample (ObsRecord d × Fin 3)) : D (unshuffle s 2) = poissonRatioBranch j s := by simp only [D, poissonRatioBranch, eventCount_unshuffle] have hHs (s : FiniteSample (ObsRecord d × Fin 3)) : H (unshuffle s 2) = poissonFactorialBranch n d q j s := by simp only [H, poissonFactorialBranch, weightedFactorial, eventCount_unshuffle] have hFs : (fun s ↦ F (unshuffle s 1, unshuffle s 2)) = (fun s ↦ poissonSelectedCellEstimate n d q j s - poissonRatioBranch j s) := by funext s simp only [F, eventCount_unshuffle, hDs, hHs, poissonSelectedCellEstimate] rw [← hFs] exact indepFun_poissonMemberWeight_pilot_estimation n d P j F hF
CausalSmith.Stat.MarRareqLogfrontier.indepFun_poissonMemberWeight_selectedCorrection · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/PilotCorrection.lean:168
theorem memLp_poissonMemberWeight_mul_selectedCorrection

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
P :
j :
Cell d
MemLp (fun s ↦ poissonMemberWeight n j s * (poissonSelectedCellEstimate n d q j s - poissonRatioBranch j s)) 2 (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2))
Proof (Lean source)
-- @node: memLp_poissonMemberWeight_mul_selectedCorrection lemma memLp_poissonMemberWeight_mul_selectedCorrection (n d : ℕ) (q : ℝ) (P : FullLaw d) (j : Cell d) : MemLp (fun s ↦ poissonMemberWeight n j s * (poissonSelectedCellEstimate n d q j s - poissonRatioBranch j s)) 2 (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) := by have hW := (memLp_two_iff_integrable_sq (measurable_poissonMemberWeight n d j).aestronglyMeasurable).1 (memLp_poissonMemberWeight n d P j) have hC := (memLp_two_iff_integrable_sq ((measurable_poissonSelectedCellEstimate n d q j).sub (measurable_poissonRatioBranch j)).aestronglyMeasurable).1 (memLp_poissonSelectedCellEstimate_sub_ratio n d q P j) have hi := (indepFun_poissonMemberWeight_selectedCorrection n d q P j).comp (measurable_id.pow_const 2) (measurable_id.pow_const 2) have h := hi.integrable_mul hW hC change Integrable (fun s ↦ (poissonMemberWeight n j s) ^ 2 * (poissonSelectedCellEstimate n d q j s - poissonRatioBranch j s) ^ 2) _ at h apply (memLp_two_iff_integrable_sq ((measurable_poissonMemberWeight n d j).mul ((measurable_poissonSelectedCellEstimate n d q j).sub (measurable_poissonRatioBranch j))).aestronglyMeasurable).2 simpa only [Pi.mul_apply, Pi.sub_apply, mul_pow] using h
CausalSmith.Stat.MarRareqLogfrontier.memLp_poissonMemberWeight_mul_selectedCorrection · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/PilotCorrection.lean:230
theorem integral_sq_poissonMemberWeight_mul_selectedCorrection

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
P :
j :
Cell d
hn :
0 < n
(∫ s, (poissonMemberWeight n j s * (poissonSelectedCellEstimate n d q j s - poissonRatioBranch j s)) ^ 2 ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2))
= ((cellProb P j) ^ 2 + cellProb P j / streamSize n) * (∫ s, (poissonSelectedCellEstimate n d q j s - poissonRatioBranch j s) ^ 2 ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2))
Proof (Lean source)
-- @node: integral_sq_poissonMemberWeight_mul_selectedCorrection lemma integral_sq_poissonMemberWeight_mul_selectedCorrection (n d : ℕ) (q : ℝ) (P : FullLaw d) (j : Cell d) (hn : 0 < n) : (∫ s, (poissonMemberWeight n j s * (poissonSelectedCellEstimate n d q j s - poissonRatioBranch j s)) ^ 2 ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) = ((cellProb P j) ^ 2 + cellProb P j / streamSize n) * (∫ s, (poissonSelectedCellEstimate n d q j s - poissonRatioBranch j s) ^ 2 ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) := by have hi := (indepFun_poissonMemberWeight_selectedCorrection n d q P j).comp (measurable_id.pow_const 2) (measurable_id.pow_const 2) have h := hi.integral_fun_mul_eq_mul_integral ((measurable_poissonMemberWeight n d j).pow_const 2).aestronglyMeasurable (((measurable_poissonSelectedCellEstimate n d q j).sub (measurable_poissonRatioBranch j)).pow_const 2).aestronglyMeasurable simp only [Function.comp_def, id_eq] at h simp_rw [mul_pow] rw [h, integral_sq_poissonMemberWeight n d P j hn]
CausalSmith.Stat.MarRareqLogfrontier.integral_sq_poissonMemberWeight_mul_selectedCorrection · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/PilotCorrection.lean:255
theorem integral_sq_poissonMemberWeight_mul_selectedCorrection_le_of_light

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
P :
j :
Cell d
hn :
0 < n
hbranch :
hlight :
(∫ s, (poissonMemberWeight n j s * (poissonSelectedCellEstimate n d q j s - poissonRatioBranch j s)) ^ 2 ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2))
≤ 2 * ((cellProb P j) ^ 2 + cellProb P j / streamSize n) * (exp (logScale n q / 8) + 1)
Proof (Lean source)
-- @node: integral_sq_poissonMemberWeight_mul_selectedCorrection_le_of_light lemma integral_sq_poissonMemberWeight_mul_selectedCorrection_le_of_light (n d : ℕ) (q : ℝ) (P : FullLaw d) (j : Cell d) (hn : 0 < n) (hbranch : needleBranch n d q) (hlight : streamSize n * arrivedCell P j ≤ needleRadius n q) : (∫ s, (poissonMemberWeight n j s * (poissonSelectedCellEstimate n d q j s - poissonRatioBranch j s)) ^ 2 ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) ≤ 2 * ((cellProb P j) ^ 2 + cellProb P j / streamSize n) * (exp (logScale n q / 8) + 1) := by rw [integral_sq_poissonMemberWeight_mul_selectedCorrection n d q P j hn] calc _ ≤ ((cellProb P j) ^ 2 + cellProb P j / streamSize n) * (2 * (exp (logScale n q / 8) + 1)) := mul_le_mul_of_nonneg_left (integral_sq_poissonSelectedCellEstimate_sub_ratio_le_of_light n d q P j hbranch hlight) (add_nonneg (sq_nonneg _) (div_nonneg measureReal_nonneg (by unfold streamSize; positivity))) _ = _ := by ring
CausalSmith.Stat.MarRareqLogfrontier.integral_sq_poissonMemberWeight_mul_selectedCorrection_le_of_light · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/PilotCorrection.lean:275
theorem sum_light_integral_sq_poissonMemberWeight_mul_selectedCorrection_le

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
P :
hbranch :
8 * (∑ j ∈ (Finset.univ : Finset (Cell d)).filter (fun j ↦ streamSize n * arrivedCell P j ≤ needleRadius n q), ∫ s, (poissonMemberWeight n j s * (poissonSelectedCellEstimate n d q j s - poissonRatioBranch j s)) ^ 2 ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2))
≤ 64 * d * (exp (logScale n q / 8) + 1) * (needleRadius n q ^ 2 / streamEffectiveSize n q ^ 2 + needleRadius n q / (streamSize n * streamEffectiveSize n q))
Proof (Lean source)
-- @node: sum_light_integral_sq_poissonMemberWeight_mul_selectedCorrection_le lemma sum_light_integral_sq_poissonMemberWeight_mul_selectedCorrection_le (n d : ℕ) (q : ℝ) (P : FullLaw d) (hP : UnrestrictedArrivalModelClass n d q P) (hbranch : needleBranch n d q) : 8 * (∑ j ∈ (Finset.univ : Finset (Cell d)).filter (fun j ↦ streamSize n * arrivedCell P j ≤ needleRadius n q), ∫ s, (poissonMemberWeight n j s * (poissonSelectedCellEstimate n d q j s - poissonRatioBranch j s)) ^ 2 ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) ≤ 64 * d * (exp (logScale n q / 8) + 1) * (needleRadius n q ^ 2 / streamEffectiveSize n q ^ 2 + needleRadius n q / (streamSize n * streamEffectiveSize n q)) := by classical have hn : 0 < n := lt_of_lt_of_le Nat.zero_lt_one hP.n_pos have hm : 0 < streamSize n := by unfold streamSize; positivity have hN : 0 < streamEffectiveSize n q := by unfold streamEffectiveSize exact mul_pos hm hP.q_pos have hB : 0 ≤ needleRadius n q := by unfold needleRadius linarith [hbranch.1] let c : ℝ := 2 * (needleRadius n q ^ 2 / streamEffectiveSize n q ^ 2 + needleRadius n q / (streamSize n * streamEffectiveSize n q)) * (exp (logScale n q / 8) + 1) have hc : 0 ≤ c := by dsimp [c]; positivity have hj (j : Cell d) (hlight : streamSize n * arrivedCell P j ≤ needleRadius n q) : (∫ s, (poissonMemberWeight n j s * (poissonSelectedCellEstimate n d q j s - poissonRatioBranch j s)) ^ 2 ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) ≤ c := by have hp0 : 0 ≤ cellProb P j := measureReal_nonneg have hp : cellProb P j ≤ needleRadius n q / streamEffectiveSize n q := by apply (le_div_iff₀ hN).2 have hi := streamEffectiveSize_mul_cellProb_le_arrivedStreamIntensity n d q P hP 2 j rw [coe_arrivedStreamIntensity] at hi simpa only [mul_comm] using hi.trans hlight have hmass : (cellProb P j) ^ 2 + cellProb P j / streamSize n ≤ needleRadius n q ^ 2 / streamEffectiveSize n q ^ 2 + needleRadius n q / (streamSize n * streamEffectiveSize n q) := by calc _ ≤ (needleRadius n q / streamEffectiveSize n q) ^ 2 + (needleRadius n q / streamEffectiveSize n q) / streamSize n := by gcongr _ = _ := by rw [div_pow]; field_simp exact (integral_sq_poissonMemberWeight_mul_selectedCorrection_le_of_light n d q P j hn hbranch hlight).trans (mul_le_mul_of_nonneg_right (mul_le_mul_of_nonneg_left hmass (by norm_num)) (by positivity)) calc _ ≤ 8 * ∑ _j : Cell d, c := by rw [Finset.sum_filter] apply mul_le_mul_of_nonneg_left _ (by norm_num) apply Finset.sum_le_sum intro j hjmem split_ifs with hlight · exact hj j hlight · exact hc _ = _ := by simp [c]; ring
CausalSmith.Stat.MarRareqLogfrontier.sum_light_integral_sq_poissonMemberWeight_mul_selectedCorrection_le · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/PilotCorrection.lean:297
theorem cheb_needle_intensity_abs_le

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q t :
ℝ
hbranch :
ht :
t ∈ Icc 0 (needleRadius n q)
t * |(chebNeedle n d q).eval t| ≤ needleRadius n q / (needleDegree n q : ℝ)^2
Proof (Lean source)
-- @node: cheb_needle_intensity_abs_le lemma cheb_needle_intensity_abs_le (n d : ℕ) (q t : ℝ) (hbranch : needleBranch n d q) (ht : t ∈ Icc 0 (needleRadius n q)) : t * |(chebNeedle n d q).eval t| ≤ needleRadius n q / (needleDegree n q : ℝ)^2 := by have hB : 0 < needleRadius n q := by unfold needleRadius linarith [hbranch.1] have hk : 0 < needleDegree n q := by unfold needleDegree apply Nat.floor_pos.mpr linarith [hbranch.1] have hk2 : 0 < (needleDegree n q : ℝ)^2 := by positivity let p : Polynomial ℝ := 1 - (Chebyshev.T ℝ (needleDegree n q : ℤ)).comp (C 1 - C (2 / needleRadius n q) * X) have hp0 : p.coeff 0 = 0 := by simp [p, coeff_zero_eq_eval_zero, Chebyshev.T_eval_one] have hdiv : p.divX.eval t * t = p.eval t := by have h := congrArg (eval t) (divX_mul_X_add p) simpa [hp0] using h have hprod : (chebNeedle n d q).eval t * t = (needleRadius n q / (2 * (needleDegree n q : ℝ)^2)) * (1 - (Chebyshev.T ℝ (needleDegree n q : ℤ)).eval (1 - 2 * t / needleRadius n q)) := by simp only [chebNeedle, if_pos hbranch, eval_mul, eval_C] rw [mul_assoc, hdiv] simp only [p, eval_sub, eval_one, eval_comp, eval_mul, eval_C, eval_X] congr 3 ring have hx : |1 - 2 * t / needleRadius n q| ≤ 1 := by apply abs_le.mpr have hratio : 0 ≤ 2 * t / needleRadius n q := div_nonneg (mul_nonneg (by norm_num) ht.1) hB.le have hu : 2 * t / needleRadius n q ≤ 2 := (div_le_iff₀ hB).2 (by linarith [ht.2]) constructor <;> linarith have hT := Chebyshev.abs_eval_T_real_le_one (needleDegree n q : ℤ) hx have hab : |1 - (Chebyshev.T ℝ (needleDegree n q : ℤ)).eval (1 - 2 * t / needleRadius n q)| ≤ 2 := by apply abs_le.mpr constructor <;> linarith [(abs_le.mp hT).1, (abs_le.mp hT).2] calc _ = |(chebNeedle n d q).eval t * t| := by rw [abs_mul, abs_of_nonneg ht.1, mul_comm] _ = (needleRadius n q / (2 * (needleDegree n q : ℝ)^2)) * |1 - (Chebyshev.T ℝ (needleDegree n q : ℤ)).eval (1 - 2 * t / needleRadius n q)| := by rw [hprod, abs_mul, abs_of_nonneg (by positivity)] _ ≤ (needleRadius n q / (2 * (needleDegree n q : ℝ)^2)) * 2 := mul_le_mul_of_nonneg_left hab (by positivity) _ = _ := by field_simp
CausalSmith.Stat.MarRareqLogfrontier.cheb_needle_intensity_abs_le · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/PilotCorrection.lean:358
theorem cellProb_mul_cellMean_abs_needle_le_of_light

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
P :
j :
Cell d
hbranch :
hlight :
cellProb P j * cellMean P j * |(chebNeedle n d q).eval (streamSize n * arrivedCell P j)|
≤ needleRadius n q / (streamEffectiveSize n q * (needleDegree n q : ℝ)^2)
Proof (Lean source)
-- @node: cellProb_mul_cellMean_abs_needle_le_of_light lemma cellProb_mul_cellMean_abs_needle_le_of_light (n d : ℕ) (q : ℝ) (P : FullLaw d) (hP : UnrestrictedArrivalModelClass n d q P) (j : Cell d) (hbranch : needleBranch n d q) (hlight : streamSize n * arrivedCell P j ≤ needleRadius n q) : cellProb P j * cellMean P j * |(chebNeedle n d q).eval (streamSize n * arrivedCell P j)| ≤ needleRadius n q / (streamEffectiveSize n q * (needleDegree n q : ℝ)^2) := by have hm : 0 < streamSize n := by unfold streamSize have hn : 0 < (n : ℝ) := by exact_mod_cast (lt_of_lt_of_le Nat.zero_lt_one hP.n_pos) positivity have hN : 0 < streamEffectiveSize n q := by unfold streamEffectiveSize exact mul_pos hm hP.q_pos have ht : 0 ≤ streamSize n * arrivedCell P j := mul_nonneg hm.le measureReal_nonneg have hi := streamEffectiveSize_mul_cellProb_le_arrivedStreamIntensity n d q P hP 2 j rw [coe_arrivedStreamIntensity] at hi have hneedle := cheb_needle_intensity_abs_le n d q (streamSize n * arrivedCell P j) hbranch ⟨ht, hlight⟩ have hmu := cellMean_mem_Icc P j have hp : 0 ≤ cellProb P j := measureReal_nonneg have hmass : streamEffectiveSize n q * (cellProb P j * cellMean P j) ≤ streamSize n * arrivedCell P j := by calc _ ≤ streamEffectiveSize n q * (cellProb P j * 1) := by gcongr; exact hmu.2 _ ≤ _ := by simpa using hi have h := (mul_le_mul_of_nonneg_right hmass (abs_nonneg ((chebNeedle n d q).eval (streamSize n * arrivedCell P j)))).trans hneedle have hdiv : cellProb P j * cellMean P j * |(chebNeedle n d q).eval (streamSize n * arrivedCell P j)| ≤ (needleRadius n q / (needleDegree n q : ℝ)^2) / streamEffectiveSize n q := (le_div_iff₀ hN).2 (by nlinarith [h]) simpa only [div_div, mul_comm] using hdiv
CausalSmith.Stat.MarRareqLogfrontier.cellProb_mul_cellMean_abs_needle_le_of_light · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/PilotCorrection.lean:412
theorem abs_sum_light_pilot_needle_bias_le

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
P :
hbranch :
pilot :
Cell d → ℝ
hpilot :
∀ j, pilot j ∈ Icc (0 : ℝ) 1
|2 * ∑ j ∈ (Finset.univ : Finset (Cell d)).filter (fun j ↦ streamSize n * arrivedCell P j ≤ needleRadius n q), armSign j.1 * cellProb P j * cellMean P j * pilot j * (chebNeedle n d q).eval (streamSize n * arrivedCell P j)|
≤ 8 * d * needleRadius n q / (streamEffectiveSize n q * (needleDegree n q : ℝ)^2)
Proof (Lean source)
-- @node: abs_sum_light_pilot_needle_bias_le lemma abs_sum_light_pilot_needle_bias_le (n d : ℕ) (q : ℝ) (P : FullLaw d) (hP : UnrestrictedArrivalModelClass n d q P) (hbranch : needleBranch n d q) (pilot : Cell d → ℝ) (hpilot : ∀ j, pilot j ∈ Icc (0 : ℝ) 1) : |2 * ∑ j ∈ (Finset.univ : Finset (Cell d)).filter (fun j ↦ streamSize n * arrivedCell P j ≤ needleRadius n q), armSign j.1 * cellProb P j * cellMean P j * pilot j * (chebNeedle n d q).eval (streamSize n * arrivedCell P j)| ≤ 8 * d * needleRadius n q / (streamEffectiveSize n q * (needleDegree n q : ℝ)^2) := by classical let c := needleRadius n q / (streamEffectiveSize n q * (needleDegree n q : ℝ)^2) have hc : 0 ≤ c := by dsimp [c, needleRadius, streamEffectiveSize, streamSize] have := hbranch.1 have := hP.q_pos positivity have hj (j : Cell d) (hlight : streamSize n * arrivedCell P j ≤ needleRadius n q) : |armSign j.1 * cellProb P j * cellMean P j * pilot j * (chebNeedle n d q).eval (streamSize n * arrivedCell P j)| ≤ c := by have hsign : |armSign j.1| = 1 := by cases j.1 <;> simp [armSign] have hp : 0 ≤ cellProb P j := measureReal_nonneg have hmu := cellMean_mem_Icc P j have hpm : 0 ≤ cellProb P j * cellMean P j := mul_nonneg hp hmu.1 rw [abs_mul, abs_mul, abs_mul, abs_mul, hsign, one_mul, abs_of_nonneg hp, abs_of_nonneg (cellMean_mem_Icc P j).1, abs_of_nonneg (hpilot j).1] calc _ ≤ cellProb P j * cellMean P j * 1 * |(chebNeedle n d q).eval (streamSize n * arrivedCell P j)| := by gcongr exact (hpilot j).2 _ ≤ c := by simpa only [mul_one] using cellProb_mul_cellMean_abs_needle_le_of_light n d q P hP j hbranch hlight rw [abs_mul, abs_of_nonneg (by norm_num : (0 : ℝ) ≤ 2)] calc _ ≤ 2 * ∑ j ∈ (Finset.univ : Finset (Cell d)).filter (fun j ↦ streamSize n * arrivedCell P j ≤ needleRadius n q), |armSign j.1 * cellProb P j * cellMean P j * pilot j * (chebNeedle n d q).eval (streamSize n * arrivedCell P j)| := by gcongr exact abs_sum_le_sum_abs _ _ _ ≤ 2 * ∑ _j : Cell d, c := by rw [Finset.sum_filter] apply mul_le_mul_of_nonneg_left _ (by norm_num) apply Finset.sum_le_sum intro j _ split_ifs with hlight · exact hj j hlight · exact hc _ = _ := by simp [c]; ring
CausalSmith.Stat.MarRareqLogfrontier.abs_sum_light_pilot_needle_bias_le · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/PilotCorrection.lean:454
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.Certificate.PilotTailBounds 3 declarations Pilot-stream Poisson tail terms in roadmap (12) and (19).

Pilot-stream Poisson tail terms in roadmap (12) and (19).

theorem markedPoisson_pilot_light_probability_le_of_heavy

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
P :
j :
Cell d
hbranch :
hheavy :
(finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)).real {s | (eventCount s (streamEvent 1 j true false) : ℝ) ≤ needleRadius n q / 4}
≤ exp (-(streamSize n * arrivedCell P j) / 4)
Proof (Lean source)
-- @node: markedPoisson_pilot_light_probability_le_of_heavy lemma markedPoisson_pilot_light_probability_le_of_heavy (n d : ℕ) (q : ℝ) (P : FullLaw d) (j : Cell d) (hbranch : needleBranch n d q) (hheavy : needleRadius n q < streamSize n * arrivedCell P j) : (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)).real {s | (eventCount s (streamEvent 1 j true false) : ℝ) ≤ needleRadius n q / 4} ≤ exp (-(streamSize n * arrivedCell P j) / 4) := by have hB : 0 ≤ needleRadius n q / 4 := by unfold needleRadius have := hbranch.1 positivity have hk : (⌊needleRadius n q / 4⌋₊ : ℝ) < (arrivedStreamIntensity n P 1 j : ℝ) / 4 := by rw [coe_arrivedStreamIntensity] exact (Nat.floor_le hB).trans_lt (by linarith) have htail := poisson_le_cutoff_of_cutoff_lt_quarter (arrivedStreamIntensity n P 1 j) ⌊needleRadius n q / 4⌋₊ hk have hmap := finitePoissonSampleLaw_map_eventCount (markedObsLaw P) ((n : ℝ≥0) / 2) (streamEvent 1 j true false) (Set.Finite.measurableSet (Set.toFinite _)) simp only [arrivedStreamIntensity] at htail rw [← hmap, Measure.map_apply (measurable_eventCount _ (Set.Finite.measurableSet (Set.toFinite _))) ((Set.to_countable _).measurableSet)] at htail have hset : {s : FiniteSample (ObsRecord d × Fin 3) | (eventCount s (streamEvent 1 j true false) : ℝ) ≤ needleRadius n q / 4} = (fun s ↦ eventCount s (streamEvent 1 j true false)) ⁻¹' {w : ℕ | w ≤ ⌊needleRadius n q / 4⌋₊} := by ext s exact (Nat.le_floor_iff hB).symm rw [hset, measureReal_def] have hreal := ENNReal.toReal_mono (by finiteness) htail change _ ≤ (ofReal (exp (-(arrivedStreamIntensity n P 1 j : ℝ) / 4))).toReal at hreal simpa only [ENNReal.toReal_ofReal (Real.exp_nonneg _), coe_arrivedStreamIntensity] using hreal
CausalSmith.Stat.MarRareqLogfrontier.markedPoisson_pilot_light_probability_le_of_heavy · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/PilotTailBounds.lean:19
theorem poisson_pilot_heavy_mul_exp_le

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
lam :
ℝ≥0
hbranch :
(poissonMeasure lam).real {w : ℕ | needleRadius n q / 4 < (w : ℝ)} * exp (-(lam : ℝ))
≤ exp (-16 * logScale n q)
Proof (Lean source)
-- @node: poisson_pilot_heavy_mul_exp_le lemma poisson_pilot_heavy_mul_exp_le (n d : ℕ) (q : ℝ) (lam : ℝ≥0) (hbranch : needleBranch n d q) : (poissonMeasure lam).real {w : ℕ | needleRadius n q / 4 < (w : ℝ)} * exp (-(lam : ℝ)) ≤ exp (-16 * logScale n q) := by have hB : 0 ≤ needleRadius n q / 4 := by unfold needleRadius have := hbranch.1 positivity have hset : {w : ℕ | needleRadius n q / 4 < (w : ℝ)} = {w : ℕ | ⌊needleRadius n q / 4⌋₊ < w} := by ext w exact (Nat.floor_lt hB).symm rw [hset] have ht := poisson_upper_tail_mul_exp_le lam ⌊needleRadius n q / 4⌋₊ (r := 1) (by norm_num) simp only [neg_mul, one_mul] at ht apply ht.trans apply Real.exp_le_exp.mpr have hf := Nat.lt_floor_add_one (needleRadius n q / 4) have hl := Real.log_two_gt_d9 have hk : 0 ≤ (⌊needleRadius n q / 4⌋₊ : ℝ) := Nat.cast_nonneg _ have hlog : logScale n q ≥ 128 := hbranch.1 norm_num only at ht ⊢ change 256 * logScale n q / 4 < (⌊needleRadius n q / 4⌋₊ : ℝ) + 1 at hf nlinarith
CausalSmith.Stat.MarRareqLogfrontier.poisson_pilot_heavy_mul_exp_le · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/PilotTailBounds.lean:58
theorem markedPoisson_pilot_heavy_mul_exp_le

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
P :
j :
Cell d
hbranch :
(finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)).real {s | needleRadius n q / 4 < (eventCount s (streamEvent 1 j true false) : ℝ)} * exp (-(streamSize n * arrivedCell P j))
≤ exp (-16 * logScale n q)
Proof (Lean source)
-- @node: markedPoisson_pilot_heavy_mul_exp_le lemma markedPoisson_pilot_heavy_mul_exp_le (n d : ℕ) (q : ℝ) (P : FullLaw d) (j : Cell d) (hbranch : needleBranch n d q) : (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)).real {s | needleRadius n q / 4 < (eventCount s (streamEvent 1 j true false) : ℝ)} * exp (-(streamSize n * arrivedCell P j)) ≤ exp (-16 * logScale n q) := by have hmap := finitePoissonSampleLaw_map_eventCount (markedObsLaw P) ((n : ℝ≥0) / 2) (streamEvent 1 j true false) (Set.Finite.measurableSet (Set.toFinite _)) have hprob : (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)).real {s | needleRadius n q / 4 < (eventCount s (streamEvent 1 j true false) : ℝ)} = (poissonMeasure (arrivedStreamIntensity n P 1 j)).real {w : ℕ | needleRadius n q / 4 < (w : ℝ)} := by simp only [arrivedStreamIntensity] rw [← hmap] simp only [measureReal_def] rw [Measure.map_apply (measurable_eventCount _ (Set.Finite.measurableSet (Set.toFinite _))) ((Set.to_countable _).measurableSet)] rfl rw [hprob] simpa only [coe_arrivedStreamIntensity] using poisson_pilot_heavy_mul_exp_le n d q (arrivedStreamIntensity n P 1 j) hbranch
CausalSmith.Stat.MarRareqLogfrontier.markedPoisson_pilot_heavy_mul_exp_le · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/PilotTailBounds.lean:86
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.Certificate.PoissonThinning 1 declarations Poisson cap and thinning bookkeeping for the three streams.

Poisson cap and thinning bookkeeping for the three streams.

theorem poisson_half_prefix_tail Lemma poisson_half_prefix_tail in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n :
ℕ
(poissonMeasure ((n : ℝ≥0) / 2)).real {k : ℕ | n < k}
≤ exp (-(n : ℝ) * (log 2 - 1 / 2))
Proof (Lean source)
lemma poisson_half_prefix_tail (n : ℕ) : (poissonMeasure ((n : ℝ≥0) / 2)).real {k : ℕ | n < k} ≤ exp (-(n : ℝ) * (log 2 - 1 / 2)) := by have h := poisson_upper_tail_mul_exp_le ((n : ℝ≥0) / 2) n (r := 1) (by norm_num) have hexp : 0 < exp (-((n : ℝ) / 2)) := Real.exp_pos _ apply le_of_mul_le_mul_right _ hexp calc (poissonMeasure ((n : ℝ≥0) / 2)).real {k : ℕ | n < k} * exp (-((n : ℝ) / 2)) ≤ exp (-log 2 * (n : ℝ)) := by convert h using 1 <;> norm_num [NNReal.coe_div] _ = exp (-(n : ℝ) * (log 2 - 1 / 2)) * exp (-((n : ℝ) / 2)) := by rw [← Real.exp_add] congr 1 ring
CausalSmith.Stat.MarRareqLogfrontier.poisson_half_prefix_tail · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/PoissonThinning.lean:15
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.Certificate.PrefixIdealTransfer 3 declarations Transfer from the finite prefix estimator to the independent ideal streams.

Transfer from the finite prefix estimator to the independent ideal streams.

theorem streamAuxiliaryMixedValue_labeledPrefix

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d k :
ℕ
q :
ℝ
sample :
Fin n → ObsRecord d
hk :
k ≤ n
assign :
Fin k → Fin 3
streamAuxiliaryMixedValue n d q (labeledPrefix sample k hk assign)
= auxiliaryMixedValue n q (fun i ↦ sample (castLE hk i)) assign
Proof (Lean source)
lemma streamAuxiliaryMixedValue_labeledPrefix {n d k : ℕ} (q : ℝ) (sample : Fin n → ObsRecord d) (hk : k ≤ n) (assign : Fin k → Fin 3) : streamAuxiliaryMixedValue n d q (labeledPrefix sample k hk assign) = auxiliaryMixedValue n q (fun i ↦ sample (castLE hk i)) assign := by unfold labeledPrefix rw [streamAuxiliaryMixedValue_unshuffle] rw [auxiliaryMixedValue_eq_poissonAuxiliaryMixedValue] congr 1
CausalSmith.Stat.MarRareqLogfrontier.streamAuxiliaryMixedValue_labeledPrefix · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/PrefixIdealTransfer.lean:24
theorem mixedCountEstimator_eq_fixedStatistic

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
sample :
Fin n → ObsRecord d
Proof (Lean source)
lemma mixedCountEstimator_eq_fixedStatistic (n d : ℕ) (q : ℝ) (sample : Fin n → ObsRecord d) : mixedCountEstimator n d q sample = fixedStatistic uniformPoolMass uniformPoolMass_sum ((n : ℝ≥0) / 2) sample (streamAuxiliaryMixedValue n d q) 0 := by rw [fixedStatistic_eq_finite_sum] simp only [mul_zero, add_zero] unfold mixedCountEstimator rw [← Fin.sum_univ_eq_sum_range] apply Fintype.sum_congr intro k have hkn : k.val ≤ n := le_of_lt_succ k.isLt simp only [dif_pos hkn] congr 1 simp only [uniformPoolMass, streamAuxiliaryMixedValue_labeledPrefix] rw [Finset.sum_div] apply Finset.sum_congr rfl intro assign ha simp [uniformPoolMass, div_eq_mul_inv] ring
CausalSmith.Stat.MarRareqLogfrontier.mixedCountEstimator_eq_fixedStatistic · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/PrefixIdealTransfer.lean:35
theorem deterministicRisk_mixedCountEstimator_le_streamRisk_add_tail

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
P :
≤ (∫ s, (streamAuxiliaryMixedValue n d q s - ate P) ^ 2 ∂Measure.pi (fun _ : Fin 3 ↦ finitePoissonSampleLaw (P.1.map obs) (((n : ℝ≥0) / 2) * (1 / 3))))
+ 4 * exp (-(n : ℝ) * (log 2 - 1 / 2))
Proof (Lean source)
lemma deterministicRisk_mixedCountEstimator_le_streamRisk_add_tail (n d : ℕ) (q : ℝ) (P : FullLaw d) : deterministicRisk (mixedCountEstimator n d q) P ≤ (∫ s, (streamAuxiliaryMixedValue n d q s - ate P) ^ 2 ∂Measure.pi (fun _ : Fin 3 ↦ finitePoissonSampleLaw (P.1.map obs) (((n : ℝ≥0) / 2) * (1 / 3)))) + 4 * exp (-(n : ℝ) * (log 2 - 1 / 2)) := by letI : IsProbabilityMeasure P.1 := P.2 letI : IsProbabilityMeasure (P.1.map obs) := map_obs_isProbabilityMeasure P have htransfer := fixedRisk_le_independentRisk_add_tail (P.1.map obs) uniformPoolMass uniformPoolMass_sum ((n : ℝ≥0) / 2) n (measurable_streamAuxiliaryMixedValue n d q) (a := (-1 : ℝ)) (b := 1) (theta := ate P) (zOver := 0) (streamAuxiliaryMixedValue_mem_Icc n d q) (ate_mem_Icc_of_fullLaw P) (by norm_num) have hfun : (fun sample : Fin n → ObsRecord d ↦ fixedStatistic uniformPoolMass uniformPoolMass_sum ((n : ℝ≥0) / 2) sample (streamAuxiliaryMixedValue n d q) 0) = mixedCountEstimator n d q := by funext sample exact (mixedCountEstimator_eq_fixedStatistic n d q sample).symm rw [hfun] at htransfer have htransfer' : deterministicRisk (mixedCountEstimator n d q) P ≤ (∫ s, (streamAuxiliaryMixedValue n d q s - ate P) ^ 2 ∂Measure.pi (fun _ : Fin 3 ↦ finitePoissonSampleLaw (P.1.map obs) (((n : ℝ≥0) / 2) * (1 / 3)))) + 4 * (poissonMeasure ((n : ℝ≥0) / 2)).real (Ioi n) := by norm_num at htransfer simpa [deterministicRisk, sqRisk, fixedPoolLaw, sampleLaw, uniformPoolMass] using htransfer refine htransfer'.trans ?_ gcongr exact poisson_half_prefix_tail n
CausalSmith.Stat.MarRareqLogfrontier.deterministicRisk_mixedCountEstimator_le_streamRisk_add_tail · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/PrefixIdealTransfer.lean:57
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.Certificate.PrefixTransfer 3 declarations Conditional averaging contracts squared risk.

Conditional averaging contracts squared risk.

theorem finite_weighted_square_with_remainder Lemma finite_weighted_square_with_remainder in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
ι :
Type*
s :
w a :
ι → ℝ
c :
ℝ
hw :
∀ i ∈ s, 0 ≤ w i
hmass :
∑ i ∈ s, w i ≤ 1
((∑ i ∈ s, w i * a i) - c) ^ 2 ≤ (1 - ∑ i ∈ s, w i) * c ^ 2 + ∑ i ∈ s, w i * (a i - c) ^ 2
Proof (Lean source)
lemma finite_weighted_square_with_remainder {ι : Type*} (s : Finset ι) (w a : ι → ℝ) (c : ℝ) (hw : ∀ i ∈ s, 0 ≤ w i) (hmass : ∑ i ∈ s, w i ≤ 1) : ((∑ i ∈ s, w i * a i) - c) ^ 2 ≤ (1 - ∑ i ∈ s, w i) * c ^ 2 + ∑ i ∈ s, w i * (a i - c) ^ 2 := by have hc : ConvexOn ℝ univ (fun x : ℝ => x ^ 2) := (show Even (2 : ℕ) by decide).convexOn_pow have hj := hc.map_add_sum_le hw (show (1 - ∑ i ∈ s, w i) + ∑ i ∈ s, w i = 1 by ring) (by simp : ∀ i ∈ s, a i - c ∈ univ) (sub_nonneg.mpr hmass) (by simp : -c ∈ univ) have he : (∑ i ∈ s, w i * a i) - c = (1 - ∑ i ∈ s, w i) * (-c) + ∑ i ∈ s, w i * (a i - c) := by simp_rw [mul_sub] rw [Finset.sum_sub_distrib, ← Finset.sum_mul] ring simpa only [smul_eq_mul, Function.comp_apply, neg_sq, he] using hj
CausalSmith.Stat.MarRareqLogfrontier.finite_weighted_square_with_remainder · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/PrefixTransfer.lean:16

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
ι :
Type*
Nonempty ι
f :
ι → ℝ
c :
ℝ
((∑ i : ι, f i) / (Fintype.card ι : ℝ) - c)^2
≤ (∑ i : ι, (f i - c)^2) / (Fintype.card ι : ℝ)
Proof (Lean source)
lemma finite_uniform_square {ι : Type*} [Fintype ι] [Nonempty ι] (f : ι → ℝ) (c : ℝ) : ((∑ i : ι, f i) / (Fintype.card ι : ℝ) - c)^2 ≤ (∑ i : ι, (f i - c)^2) / (Fintype.card ι : ℝ) := by have h := sum_div_card_sq_le_sum_sq_div_card (s := (Finset.univ : Finset ι)) (f := fun i => f i - c) have hc : (Fintype.card ι : ℝ) ≠ 0 := by positivity have he : (∑ i : ι, (f i - c)) / (Fintype.card ι : ℝ) = (∑ i : ι, f i) / (Fintype.card ι : ℝ) - c := by simp only [Finset.sum_sub_distrib, Finset.sum_const, Finset.card_univ, nsmul_eq_mul] field_simp rw [← he] simpa using h
theorem mixed_count_derandomization

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
P :
Proof (Lean source)
lemma mixed_count_derandomization (n d : ℕ) (q : ℝ) (P : FullLaw d) : deterministicRisk (mixedCountEstimator n d q) P ≤ auxiliaryMixedRisk n q P := by classical let w : ℕ → ℝ := fun k => (poissonMeasure ((n : ℝ≥0) / 2)).real ({k} : Set ℕ) let a : (Fin n → ObsRecord d) → ℕ → ℝ := fun sample k => if h : k ≤ n then (∑ assign : Fin k → Fin 3, auxiliaryMixedValue n q (fun i => sample (castLE h i)) assign) / (3 : ℝ) ^ k else 0 have hw (k : ℕ) : 0 ≤ w k := measureReal_nonneg have hmass : (∑ k ∈ range (n + 1), w k) ≤ 1 := by have h := MeasureTheory.sum_measureReal_le_measureReal_univ (μ := poissonMeasure ((n : ℝ≥0) / 2)) (s := range (n + 1)) (t := fun k : ℕ => ({k} : Set ℕ)) have hm : ∀ k ∈ range (n + 1), MeasurableSet ({k} : Set ℕ) := fun _ _ => MeasurableSet.singleton _ have hd : (↑(range (n + 1)) : Set ℕ).PairwiseDisjoint (fun k : ℕ => ({k} : Set ℕ)) := by intro i hi j hj hij exact Set.disjoint_singleton.mpr hij simpa [w] using h hm hd have hpoint (sample : Fin n → ObsRecord d) : (mixedCountEstimator n d q sample - ate P) ^ 2 ≤ (∑ k ∈ range (n + 1), if h : k ≤ n then w k * ((∑ assign : Fin k → Fin 3, (auxiliaryMixedValue n q (fun i => sample (castLE h i)) assign - ate P) ^ 2) / (3 : ℝ) ^ k) else 0) + (1 - ∑ k ∈ range (n + 1), w k) * (ate P) ^ 2 := by have houter := finite_weighted_square_with_remainder (range (n + 1)) w (a sample) (ate P) (fun k _ => hw k) hmass have hinner (k : ℕ) (h : k ≤ n) : (a sample k - ate P) ^ 2 ≤ (∑ assign : Fin k → Fin 3, (auxiliaryMixedValue n q (fun i => sample (castLE h i)) assign - ate P) ^ 2) / (3 : ℝ) ^ k := by simpa [a, h] using finite_uniform_square (fun assign : Fin k → Fin 3 => auxiliaryMixedValue n q (fun i => sample (castLE h i)) assign) (ate P) have hsum : (∑ k ∈ range (n + 1), w k * (a sample k - ate P) ^ 2) ≤ (∑ k ∈ range (n + 1), if h : k ≤ n then w k * ((∑ assign : Fin k → Fin 3, (auxiliaryMixedValue n q (fun i => sample (castLE h i)) assign - ate P) ^ 2) / (3 : ℝ) ^ k) else 0) := by apply Finset.sum_le_sum intro k hk have h : k ≤ n := by simpa using hk simpa only [a, dif_pos h] using mul_le_mul_of_nonneg_left (hinner k h) (hw k) have he : mixedCountEstimator n d q sample = ∑ k ∈ range (n + 1), w k * a sample k := by simp [mixedCountEstimator, w, a] rw [he] linarith letI : IsProbabilityMeasure P.1 := P.2 haveI : IsProbabilityMeasure (P.1.map obs) := Measure.isProbabilityMeasure_map (by fun_prop : AEMeasurable obs P.1) haveI : IsProbabilityMeasure (sampleLaw n P) := by unfold sampleLaw infer_instance change (∫ sample, (mixedCountEstimator n d q sample - ate P) ^ 2 ∂(sampleLaw n P)) ≤ ∫ sample, (∑ k ∈ range (n + 1), if h : k ≤ n then w k * ((∑ assign : Fin k → Fin 3, (auxiliaryMixedValue n q (fun i => sample (castLE h i)) assign - ate P) ^ 2) / (3 : ℝ) ^ k) else 0) + (1 - ∑ k ∈ range (n + 1), w k) * (ate P) ^ 2 ∂(sampleLaw n P) apply integral_mono_of_nonneg · exact Filter.Eventually.of_forall (fun sample => sq_nonneg _) · exact Integrable.of_finite · exact Filter.Eventually.of_forall hpoint
CausalSmith.Stat.MarRareqLogfrontier.mixed_count_derandomization · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/PrefixTransfer.lean:52
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.Certificate.RatioAggregate 3 declarations Aggregate deterministic bounds for the empirical-ratio branch.

Aggregate deterministic bounds for the empirical-ratio branch.

theorem cellMean_mem_Icc

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
shared
P :
j :
Cell d
cellMean P j ∈ Icc (0 : ℝ) 1
Proof (Lean source)
lemma cellMean_mem_Icc (P : FullLaw d) (j : Cell d) : cellMean P j ∈ Icc (0 : ℝ) 1 := by letI : IsProbabilityMeasure P.1 := P.2 by_cases hpos : 0 < arrivedCell P j · rw [cellMean, if_pos hpos] constructor · exact div_nonneg measureReal_nonneg hpos.le · apply (div_le_one hpos).2 exact measureReal_mono (fun r hr ↦ ⟨hr.1, hr.2.1⟩) (measure_ne_top P.1 _) · simp [cellMean, hpos]
theorem cell_exp_envelope

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
eps t z :
ℝ
heps :
0 < eps
ht :
0 < t
hz :
0 ≤ z
z * exp (-eps * t * z) ≤ 1 / (eps * exp 1 * t)
Proof (Lean source)
lemma cell_exp_envelope {eps t z : ℝ} (heps : 0 < eps) (ht : 0 < t) (hz : 0 ≤ z) : z * exp (-eps * t * z) ≤ 1 / (eps * exp 1 * t) := by have hbase : exp 1 * (eps * t * z) ≤ exp (eps * t * z) := Real.exp_one_mul_le_exp have hmul := mul_le_mul_of_nonneg_right hbase (Real.exp_pos (-(eps * t * z))).le have hprod : exp 1 * (eps * t * z) * exp (-(eps * t * z)) ≤ 1 := by calc _ ≤ exp (eps * t * z) * exp (-(eps * t * z)) := hmul _ = 1 := by rw [← Real.exp_add]; ring_nf; simp apply (le_div_iff₀ (by positivity : 0 < eps * exp 1 * t)).2 calc z * exp (-eps * t * z) * (eps * exp 1 * t) = exp 1 * (eps * t * z) * exp (-(eps * t * z)) := by ring _ ≤ 1 := hprod
theorem abs_ratioBranch_aggregate_bias_le

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
P :
abs (2 * ∑ j : Cell d, armSign j.1 * cellProb P j * ((∫ s, poissonRatioBranch j s ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) - cellMean P j))
≤ 8 * d / (exp 1 * streamEffectiveSize n q)
Proof (Lean source)
lemma abs_ratioBranch_aggregate_bias_le (n d : ℕ) (q : ℝ) (P : FullLaw d) (hP : UnrestrictedArrivalModelClass n d q P) : abs (2 * ∑ j : Cell d, armSign j.1 * cellProb P j * ((∫ s, poissonRatioBranch j s ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) - cellMean P j)) ≤ 8 * d / (exp 1 * streamEffectiveSize n q) := by have hm : 0 < streamSize n := by unfold streamSize have hn : 0 < (n : ℝ) := by exact_mod_cast (lt_of_lt_of_le Nat.zero_lt_one hP.n_pos) positivity have hq : 0 < q := hP.q_pos have hN0 : 0 < streamEffectiveSize n q := by unfold streamEffectiveSize positivity have hcell (j : Cell d) : abs (armSign j.1 * cellProb P j * ((∫ s, poissonRatioBranch j s ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) - cellMean P j)) ≤ 1 / (exp 1 * streamEffectiveSize n q) := by rw [markedPoissonRatioBranch_bias] have hmu := cellMean_mem_Icc P j have hp : 0 ≤ cellProb P j := measureReal_nonneg have harr : q * cellProb P j ≤ arrivedCell P j := by by_cases hpj : 0 < cellProb P j · exact hP.arrival j hpj · have hp0 : cellProb P j = 0 := le_antisymm (le_of_not_gt hpj) hp rw [hp0, mul_zero] exact measureReal_nonneg have hexp : exp (-streamSize n * arrivedCell P j) ≤ exp (-q * streamSize n * cellProb P j) := by apply Real.exp_le_exp.mpr have := mul_le_mul_of_nonneg_left harr hm.le nlinarith have hfirst : abs (armSign j.1 * cellProb P j * (-cellMean P j * exp (-streamSize n * arrivedCell P j))) ≤ cellProb P j * exp (-q * streamSize n * cellProb P j) := by rw [abs_mul, abs_mul, abs_mul] have hsign : abs (armSign j.1) = 1 := by cases j.1 <;> simp [armSign] rw [hsign, one_mul] rw [abs_of_nonneg hp, abs_neg, abs_of_nonneg hmu.1, abs_of_pos (Real.exp_pos _)] calc cellProb P j * (cellMean P j * exp (-streamSize n * arrivedCell P j)) ≤ cellProb P j * (1 * exp (-streamSize n * arrivedCell P j)) := by gcongr exact hmu.2 _ ≤ cellProb P j * exp (-q * streamSize n * cellProb P j) := by gcongr simpa using hexp refine hfirst.trans ?_ have he := cell_exp_envelope hq hm hp simpa [streamEffectiveSize, mul_comm, mul_left_comm, mul_assoc] using he calc abs (2 * ∑ j : Cell d, armSign j.1 * cellProb P j * ((∫ s, poissonRatioBranch j s ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) - cellMean P j)) = 2 * abs (∑ j : Cell d, armSign j.1 * cellProb P j * ((∫ s, poissonRatioBranch j s ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) - cellMean P j)) := by rw [abs_mul, abs_of_nonneg (by norm_num : (0 : ℝ) ≤ 2)] _ ≤ 2 * ∑ j : Cell d, abs (armSign j.1 * cellProb P j * ((∫ s, poissonRatioBranch j s ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) - cellMean P j)) := by gcongr exact abs_sum_le_sum_abs _ _ _ ≤ 2 * ∑ _j : Cell d, 1 / (exp 1 * streamEffectiveSize n q) := by gcongr with j exact hcell j _ = 8 * d / (exp 1 * streamEffectiveSize n q) := by simp [div_eq_mul_inv] ring
CausalSmith.Stat.MarRareqLogfrontier.abs_ratioBranch_aggregate_bias_le · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/RatioAggregate.lean:48
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.Certificate.RatioMean 6 declarations The exact, zero-safe ratio-branch mean in the marked Poisson experiment.

The exact, zero-safe ratio-branch mean in the marked Poisson experiment.

theorem successFraction_eventCount_eq_cast Lemma successFraction_eventCount_eq_cast in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
X :
A :
Set X
s :
= (eventCount s A : ℝ)
Proof (Lean source)
-- @node: successFraction_eventCount_eq_cast lemma successFraction_eventCount_eq_cast {X : Type*} [MeasurableSpace X] (A : Set X) (s : FiniteSample X) : eventCount A s = (eventCount s A : ℝ) := by classical simp only [eventCount, iidEventCount, eventCount, Finset.card_filter, Nat.cast_sum, Nat.cast_ite, Nat.cast_one, Nat.cast_zero]
CausalSmith.Stat.MarRareqLogfrontier.successFraction_eventCount_eq_cast · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/RatioMean.lean:19
theorem poissonRatioBranch_eq_successFraction

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
j :
Cell d
s :
Proof (Lean source)
-- @node: poissonRatioBranch_eq_successFraction lemma poissonRatioBranch_eq_successFraction {d : ℕ} (j : Cell d) (s : FiniteSample (ObsRecord d × Fin 3)) : poissonRatioBranch j s = successFraction (streamEvent 2 j true true) (streamEvent 2 j true false) s := by classical simp only [poissonRatioBranch, successFraction, successFraction_eventCount_eq_cast, Nat.cast_eq_zero] by_cases h : eventCount s (streamEvent 2 j true false) = 0 · simp [h] · simp [h, Nat.pos_of_ne_zero h]
CausalSmith.Stat.MarRareqLogfrontier.poissonRatioBranch_eq_successFraction · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/RatioMean.lean:31
theorem integral_markedPoissonRatioBranch_of_pos

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
P :
j :
Cell d
hpos :
0 < arrivedCell P j
(∫ s, poissonRatioBranch j s ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2))
= cellMean P j * (1 - exp (-streamSize n * arrivedCell P j))
Proof (Lean source)
-- @node: integral_markedPoissonRatioBranch_of_pos lemma integral_markedPoissonRatioBranch_of_pos (n d : ℕ) (P : FullLaw d) (j : Cell d) (hpos : 0 < arrivedCell P j) : (∫ s, poissonRatioBranch j s ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) = cellMean P j * (1 - exp (-streamSize n * arrivedCell P j)) := by letI := markedObsLaw_isProbabilityMeasure P simp_rw [poissonRatioBranch_eq_successFraction] rw [finitePoisson_successFraction_mean (markedObsLaw P) ((n : ℝ≥0) / 2) (Set.Finite.measurableSet (Set.toFinite _)) (Set.Finite.measurableSet (Set.toFinite _)) (streamEvent_ones_subset_arrived 2 j) (by rw [markedObsLaw_streamEvent_real, map_obsStreamEvent_arrived_real]; positivity)] rw [markedObsLaw_streamEvent_real, markedObsLaw_streamEvent_real, map_obsStreamEvent_arrivedOne_real, map_obsStreamEvent_arrived_real] simp only [cellMean, if_pos hpos, NNReal.coe_div, NNReal.coe_natCast, NNReal.coe_ofNat] congr 1 · ring · congr 2 unfold streamSize ring
CausalSmith.Stat.MarRareqLogfrontier.integral_markedPoissonRatioBranch_of_pos · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/RatioMean.lean:46
theorem integral_markedPoissonRatioBranch_of_zero

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
P :
j :
Cell d
hzero :
arrivedCell P j = 0
(∫ s, poissonRatioBranch j s ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) = 0
Proof (Lean source)
-- @node: integral_markedPoissonRatioBranch_of_zero lemma integral_markedPoissonRatioBranch_of_zero (n d : ℕ) (P : FullLaw d) (j : Cell d) (hzero : arrivedCell P j = 0) : (∫ s, poissonRatioBranch j s ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) = 0 := by have hmass : (markedObsLaw P) (streamEvent 2 j true false) = 0 := by apply (measureReal_eq_zero_iff).mp rw [markedObsLaw_streamEvent_real, map_obsStreamEvent_arrived_real, hzero, zero_div] simp_rw [poissonRatioBranch_eq_successFraction] exact finitePoisson_successFraction_mean_of_mass_zero (markedObsLaw P) ((n : ℝ≥0) / 2) (Set.Finite.measurableSet (Set.toFinite _)) hmass
CausalSmith.Stat.MarRareqLogfrontier.integral_markedPoissonRatioBranch_of_zero · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/RatioMean.lean:71
theorem integral_markedPoissonRatioBranch

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
P :
j :
Cell d
(∫ s, poissonRatioBranch j s ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2))
= cellMean P j * (1 - exp (-streamSize n * arrivedCell P j))
Proof (Lean source)
-- @node: integral_markedPoissonRatioBranch lemma integral_markedPoissonRatioBranch (n d : ℕ) (P : FullLaw d) (j : Cell d) : (∫ s, poissonRatioBranch j s ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) = cellMean P j * (1 - exp (-streamSize n * arrivedCell P j)) := by by_cases hpos : 0 < arrivedCell P j · exact integral_markedPoissonRatioBranch_of_pos n d P j hpos · have hzero : arrivedCell P j = 0 := le_antisymm (le_of_not_gt hpos) measureReal_nonneg rw [integral_markedPoissonRatioBranch_of_zero n d P j hzero] simp [cellMean, hpos]
CausalSmith.Stat.MarRareqLogfrontier.integral_markedPoissonRatioBranch · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/RatioMean.lean:86
theorem markedPoissonRatioBranch_bias

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
P :
j :
Cell d
(∫ s, poissonRatioBranch j s ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2))
- cellMean P j
= -cellMean P j * exp (-streamSize n * arrivedCell P j)
Proof (Lean source)
-- @node: markedPoissonRatioBranch_bias lemma markedPoissonRatioBranch_bias (n d : ℕ) (P : FullLaw d) (j : Cell d) : (∫ s, poissonRatioBranch j s ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) - cellMean P j = -cellMean P j * exp (-streamSize n * arrivedCell P j) := by rw [integral_markedPoissonRatioBranch] ring
CausalSmith.Stat.MarRareqLogfrontier.markedPoissonRatioBranch_bias · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/RatioMean.lean:100
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.Certificate.RatioSecondMoment 5 declarations Second moments for the zero-safe marked Poisson ratio branch.

Second moments for the zero-safe marked Poisson ratio branch.

theorem iid_successFraction_count_fibre_centered_sq_le

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n k :
ℕ
hk :
0 < k
A B :
Set X
hA :
hB :
hAB :
A ⊆ B
hPB :
0 < P.real B
(∫ x : Fin n → X, (successFraction A B (fixedSizeEmbed n x) - P.real A / P.real B) ^ 2 ∂(Measure.pi (fun _ : Fin n ↦ P)).restrict {x | iidEventCount B x = (k : ℝ)})
≤ (k : ℝ)⁻¹ * (Measure.pi (fun _ : Fin n ↦ P)).real {x | iidEventCount B x = (k : ℝ)}
Proof (Lean source)
lemma iid_successFraction_count_fibre_centered_sq_le {X : Type*} [MeasurableSpace X] [Fintype X] [MeasurableSingletonClass X] (P : Measure X) [IsProbabilityMeasure P] (n k : ℕ) (hk : 0 < k) {A B : Set X} (hA : MeasurableSet A) (hB : MeasurableSet B) (hAB : A ⊆ B) (hPB : 0 < P.real B) : (∫ x : Fin n → X, (successFraction A B (fixedSizeEmbed n x) - P.real A / P.real B) ^ 2 ∂(Measure.pi (fun _ : Fin n ↦ P)).restrict {x | iidEventCount B x = (k : ℝ)}) ≤ (k : ℝ)⁻¹ * (Measure.pi (fun _ : Fin n ↦ P)).real {x | iidEventCount B x = (k : ℝ)} := by classical let T := Finset.univ.filter (fun U : Finset (Fin n) ↦ U.card = k) let R := fun U : Finset (Fin n) ↦ ratioPattern B U have hset : {x : Fin n → X | iidEventCount B x = (k : ℝ)} = ⋃ U ∈ T, R U := by ext x simp only [Set.mem_ofPred_eq, Set.mem_iUnion] constructor · intro hx let U := Finset.univ.filter (fun i ↦ x i ∈ B) refine ⟨U, ?_, ?_⟩ · simp only [T, mem_filter, Finset.mem_univ, true_and] exact_mod_cast (iidEventCount_eq_card B x).symm.trans hx · exact (mem_ratioPattern_iff B U x).mpr rfl · rintro ⟨U, hU, hx⟩ have hcard : U.card = k := (Finset.mem_filter.mp hU).2 rw [iidEventCount_eq_card B x, (mem_ratioPattern_iff B U x).mp hx, hcard] have hm : ∀ U ∈ T, MeasurableSet (R U) := fun U _ ↦ measurable_ratioPattern hB U have hd : PairwiseDisjoint (↑T) R := fun U _ V _ hUV ↦ disjoint_ratioPatterns B U V hUV have hkR : (k : ℝ) ≠ 0 := by exact_mod_cast hk.ne' have hPBR : P.real B ≠ 0 := ne_of_gt hPB let f : (Fin n → X) → ℝ := fun x ↦ (successFraction A B (fixedSizeEmbed n x) - P.real A / P.real B) ^ 2 have hf : Integrable f (Measure.pi (fun _ : Fin n ↦ P)) := by apply Integrable.of_bound (((measurable_successFraction hA hB).comp (measurable_fixedSizeEmbed n) |>.sub measurable_const).pow_const 2).aestronglyMeasurable 1 filter_upwards [] with x rcases successFraction_bounds hAB (fixedSizeEmbed n x) with ⟨hs0, hs1⟩ have hp0 : 0 ≤ P.real A / P.real B := div_nonneg measureReal_nonneg hPB.le have hp1 : P.real A / P.real B ≤ 1 := (div_le_one hPB).2 (measureReal_mono hAB) rw [Real.norm_eq_abs, abs_of_nonneg (sq_nonneg _)] change (successFraction A B (fixedSizeEmbed n x) - P.real A / P.real B) ^ 2 ≤ 1 nlinarith rw [hset, integral_biUnion_finset T hm hd (fun _ _ ↦ hf.integrableOn), measureReal_biUnion_finset hd hm] rw [Finset.mul_sum] apply Finset.sum_le_sum intro U hU have hcard : U.card = k := (Finset.mem_filter.mp hU).2 have heq : f =ᵐ[(Measure.pi (fun _ : Fin n ↦ P)).restrict (R U)] fun x ↦ (P.real B * iidEventCount A x - P.real A * (k : ℝ)) ^ 2 / ((P.real B) ^ 2 * (k : ℝ) ^ 2) := by filter_upwards [ae_restrict_mem (hm U hU)] with x hx have hxB : iidEventCount B x = (k : ℝ) := by rw [iidEventCount_eq_card B x, (mem_ratioPattern_iff B U x).mp hx, hcard] simp only [f, successFraction, eventCount_fixedSizeEmbed, hxB, hkR, if_false] field_simp rw [integral_congr_ae heq, integral_div] have hpat := iid_nested_pattern_centered_sq_le P U hA hB hAB rw [hcard] at hpat apply (div_le_iff₀ (mul_pos (sq_pos_of_pos hPB) (sq_pos_of_pos (by exact_mod_cast hk)))).2 calc (∫ x, (P.real B * iidEventCount A x - P.real A * (k : ℝ)) ^ 2 ∂(Measure.pi (fun _ : Fin n ↦ P)).restrict (R U)) ≤ (k : ℝ) * (P.real B) ^ 2 * (Measure.pi (fun _ : Fin n ↦ P)).real (R U) := hpat _ = ((k : ℝ)⁻¹ * (Measure.pi (fun _ : Fin n ↦ P)).real (R U)) * ((P.real B) ^ 2 * (k : ℝ) ^ 2) := by field_simp
CausalSmith.Stat.MarRareqLogfrontier.iid_successFraction_count_fibre_centered_sq_le · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/RatioSecondMoment.lean:265
theorem iid_successFraction_centered_sq_le_inverseCount

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n :
ℕ
A B :
Set X
hA :
hB :
hAB :
A ⊆ B
hPB :
0 < P.real B
(∫ x : Fin n → X, (successFraction A B (fixedSizeEmbed n x) - P.real A / P.real B) ^ 2 ∂Measure.pi (fun _ : Fin n ↦ P))
≤ ∫ x : Fin n → X, (if 0 < iidEventCount B x then (iidEventCount B x)⁻¹ else 1) ∂Measure.pi (fun _ : Fin n ↦ P)
Proof (Lean source)
lemma iid_successFraction_centered_sq_le_inverseCount {X : Type*} [MeasurableSpace X] [Fintype X] [MeasurableSingletonClass X] (P : Measure X) [IsProbabilityMeasure P] (n : ℕ) {A B : Set X} (hA : MeasurableSet A) (hB : MeasurableSet B) (hAB : A ⊆ B) (hPB : 0 < P.real B) : (∫ x : Fin n → X, (successFraction A B (fixedSizeEmbed n x) - P.real A / P.real B) ^ 2 ∂Measure.pi (fun _ : Fin n ↦ P)) ≤ ∫ x : Fin n → X, (if 0 < iidEventCount B x then (iidEventCount B x)⁻¹ else 1) ∂Measure.pi (fun _ : Fin n ↦ P) := by classical let μ : Measure (Fin n → X) := Measure.pi (fun _ : Fin n ↦ P) let F : ℕ → Set (Fin n → X) := fun k ↦ {x | iidEventCount B x = (k : ℝ)} let T := range (n + 1) let f : (Fin n → X) → ℝ := fun x ↦ (successFraction A B (fixedSizeEmbed n x) - P.real A / P.real B) ^ 2 let g : (Fin n → X) → ℝ := fun x ↦ if 0 < iidEventCount B x then (iidEventCount B x)⁻¹ else 1 have hm : ∀ k ∈ T, MeasurableSet (F k) := fun k _ ↦ (measurable_iidEventCount hB n) (measurableSet_singleton _) have hd : PairwiseDisjoint (↑T) F := by intro k _ l _ hkl apply Set.disjoint_left.mpr intro x hx hy apply hkl exact_mod_cast (hx.symm.trans hy : (k : ℝ) = (l : ℝ)) have hcover : (⋃ k ∈ T, F k) = univ := by apply Set.eq_univ_of_forall intro x let U := Finset.univ.filter (fun i : Fin n ↦ x i ∈ B) have hU : U.card ≤ n := (Finset.card_le_card (filter_subset _ _)).trans (by simp) exact Set.mem_iUnion.mpr ⟨U.card, Set.mem_iUnion.mpr ⟨Finset.mem_range.mpr (by omega), iidEventCount_eq_card B x⟩⟩ have hf : Integrable f μ := Integrable.of_finite have hg : Integrable g μ := Integrable.of_finite change (∫ x, f x ∂μ) ≤ ∫ x, g x ∂μ rw [← Measure.restrict_univ (μ := μ), ← hcover, integral_biUnion_finset T hm hd (fun _ _ ↦ hf.integrableOn), integral_biUnion_finset T hm hd (fun _ _ ↦ hg.integrableOn)] apply Finset.sum_le_sum intro k hkT by_cases hk0 : k = 0 · subst k have hpoint : ∀ x ∈ F 0, f x ≤ g x := by intro x hx have hp0 : 0 ≤ P.real A / P.real B := div_nonneg measureReal_nonneg hPB.le have hp1 : P.real A / P.real B ≤ 1 := (div_le_one hPB).2 (measureReal_mono hAB) have hx0 : iidEventCount B x = 0 := by simpa [F] using hx have hs0 : successFraction A B (fixedSizeEmbed n x) = 0 := by simp [successFraction, eventCount_fixedSizeEmbed, hx0] simp only [f, g, hs0, hx0, lt_self_iff_false, if_false, zero_sub] nlinarith apply integral_mono_ae hf.restrict hg.restrict filter_upwards [ae_restrict_mem (hm 0 hkT)] with x hx exact hpoint x hx · have hkpos : 0 < k := Nat.pos_of_ne_zero hk0 have hleft := iid_successFraction_count_fibre_centered_sq_le P n k hkpos hA hB hAB hPB have hright : (∫ x, g x ∂μ.restrict (F k)) = (k : ℝ)⁻¹ * μ.real (F k) := by have heq : g =ᵐ[μ.restrict (F k)] (fun _ ↦ (k : ℝ)⁻¹) := by filter_upwards [ae_restrict_mem (hm k hkT)] with x hx have hxk : iidEventCount B x = (k : ℝ) := by simpa [F] using hx simp [g, hxk, hkpos] rw [integral_congr_ae heq, integral_const] rw [measureReal_restrict_apply_univ] simp [smul_eq_mul, mul_comm] change (∫ x, f x ∂μ.restrict (F k)) ≤ _ rw [hright] exact hleft
CausalSmith.Stat.MarRareqLogfrontier.iid_successFraction_centered_sq_le_inverseCount · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/RatioSecondMoment.lean:341
theorem poisson_zeroSafeInverse_expectation_le

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
lambda :
ℝ≥0
(∫ k : ℕ, (if 0 < k then ((k : ℝ)⁻¹) else 1) ∂poissonMeasure lambda)
≤ 4 / (1 + (lambda : ℝ))
Proof (Lean source)
lemma poisson_zeroSafeInverse_expectation_le (lambda : ℝ≥0) : (∫ k : ℕ, (if 0 < k then ((k : ℝ)⁻¹) else 1) ∂poissonMeasure lambda) ≤ 4 / (1 + (lambda : ℝ)) := by let g : ℕ → ℝ := fun k ↦ if 0 < k then ((k : ℝ)⁻¹) else 1 have hg : Integrable g (poissonMeasure lambda) := by apply Integrable.of_bound (measurable_of_countable _).aestronglyMeasurable 1 filter_upwards with k rw [Real.norm_eq_abs, abs_of_nonneg] · by_cases hk : 0 < k · simp only [g, hk, if_true] apply (inv_le_one₀ (by positivity : 0 < (k : ℝ))).2 exact_mod_cast hk · simp [g, hk] · simp only [g] split_ifs · positivity · positivity by_cases hlambda : (lambda : ℝ) ≤ 1 · calc (∫ k : ℕ, (if 0 < k then ((k : ℝ)⁻¹) else 1) ∂poissonMeasure lambda) = ∫ k, g k ∂poissonMeasure lambda := rfl _ ≤ ∫ _k : ℕ, (1 : ℝ) ∂poissonMeasure lambda := by apply integral_mono hg (integrable_const 1) intro k by_cases hk : 0 < k · simp only [g, hk, if_true] apply (inv_le_one₀ (by positivity : 0 < (k : ℝ))).2 exact_mod_cast hk · simp [g, hk] _ = 1 := by simp _ ≤ 4 / (1 + (lambda : ℝ)) := by apply (le_div_iff₀ (by positivity : 0 < 1 + (lambda : ℝ))).2 linarith · have hlambda_pos : 0 < (lambda : ℝ) := by have : 1 < (lambda : ℝ) := lt_of_not_ge hlambda linarith let r : ℕ → ℝ := fun k ↦ (((k + 1 : ℕ) : ℝ))⁻¹ have hr : Integrable r (poissonMeasure lambda) := (shifted_reciprocal_memLp_two lambda).integrable (by norm_num) have hpoint (k : ℕ) : g k ≤ 2 * r k := by by_cases hk : k = 0 · subst k simp [g, r] · have hkpos : 0 < k := Nat.pos_of_ne_zero hk simp only [g, hkpos, if_true, r] rw [← one_div, show 2 * (((k + 1 : ℕ) : ℝ))⁻¹ = 2 / (((k + 1 : ℕ) : ℝ)) by rw [div_eq_mul_inv]] apply (div_le_div_iff₀ (by positivity : 0 < (k : ℝ)) (by positivity : 0 < ((k + 1 : ℕ) : ℝ))).2 norm_num exact_mod_cast (show k + 1 ≤ 2 * k by omega) have hshift := Causalean.Mathlib.Probability.Poisson.shifted_reciprocal_first_moment lambda have hr_eq : (∫ k : ℕ, r k ∂poissonMeasure lambda) = (1 - exp (-(lambda : ℝ))) / (lambda : ℝ) := by apply (eq_div_iff hlambda_pos.ne').2 simpa [r, mul_comm] using hshift calc (∫ k : ℕ, (if 0 < k then ((k : ℝ)⁻¹) else 1) ∂poissonMeasure lambda) = ∫ k, g k ∂poissonMeasure lambda := rfl _ ≤ ∫ k, 2 * r k ∂poissonMeasure lambda := by exact integral_mono hg (hr.const_mul 2) hpoint _ = 2 * ((1 - exp (-(lambda : ℝ))) / (lambda : ℝ)) := by rw [integral_const_mul, hr_eq] _ ≤ 2 / (lambda : ℝ) := by have hexp : 0 ≤ exp (-(lambda : ℝ)) := (Real.exp_pos _).le rw [← mul_div_assoc] apply div_le_div_of_nonneg_right _ hlambda_pos.le linarith _ ≤ 4 / (1 + (lambda : ℝ)) := by apply (div_le_div_iff₀ hlambda_pos (by positivity : 0 < 1 + (lambda : ℝ))).2 have : 1 ≤ (lambda : ℝ) := le_of_not_ge hlambda nlinarith
CausalSmith.Stat.MarRareqLogfrontier.poisson_zeroSafeInverse_expectation_le · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/RatioSecondMoment.lean:415
theorem finitePoisson_successFraction_centered_sq_le

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
lambda :
ℝ≥0
A B :
Set X
hA :
hB :
hAB :
A ⊆ B
hPB :
0 < P.real B
(∫ s : FiniteSample X, (successFraction A B s - P.real A / P.real B) ^ 2 ∂finitePoissonSampleLaw P lambda)
≤ 4 / (1 + (lambda : ℝ) * P.real B)
Proof (Lean source)
lemma finitePoisson_successFraction_centered_sq_le {X : Type*} [MeasurableSpace X] [Fintype X] [MeasurableSingletonClass X] [DecidableEq X] (P : Measure X) [IsProbabilityMeasure P] (lambda : ℝ≥0) {A B : Set X} (hA : MeasurableSet A) (hB : MeasurableSet B) (hAB : A ⊆ B) (hPB : 0 < P.real B) : (∫ s : FiniteSample X, (successFraction A B s - P.real A / P.real B) ^ 2 ∂finitePoissonSampleLaw P lambda) ≤ 4 / (1 + (lambda : ℝ) * P.real B) := by classical let target : ℝ := P.real A / P.real B let f : FiniteSample X → ℝ := fun s ↦ (successFraction A B s - target) ^ 2 let g : FiniteSample X → ℝ := fun s ↦ if 0 < Causalean.Stat.FiniteRaoBlackwell.Poisson.FinitePartition.NestedEventMoment.eventCount s B then ((Causalean.Stat.FiniteRaoBlackwell.Poisson.FinitePartition.NestedEventMoment.eventCount s B : ℝ))⁻¹ else 1 have hf : Measurable f := by exact ((measurable_successFraction hA hB).sub measurable_const).pow_const 2 have hg : Measurable g := by have hh : Measurable (fun k : ℕ ↦ if 0 < k then ((k : ℝ)⁻¹) else 1) := measurable_of_countable _ exact hh.comp (measurable_eventCount B hB) have hfb (s : FiniteSample X) : ‖f s‖ ≤ 1 := by rcases successFraction_bounds hAB s with ⟨hs0, hs1⟩ have ht0 : 0 ≤ target := div_nonneg measureReal_nonneg hPB.le have ht1 : target ≤ 1 := (div_le_one hPB).2 (measureReal_mono hAB) rw [Real.norm_eq_abs, abs_of_nonneg (sq_nonneg _)] dsimp [f] nlinarith have hgb (s : FiniteSample X) : ‖g s‖ ≤ 1 := by rw [Real.norm_eq_abs, abs_of_nonneg] · by_cases hk : 0 < Causalean.Stat.FiniteRaoBlackwell.Poisson.FinitePartition.NestedEventMoment.eventCount s B · simp only [g, hk, if_true] apply (inv_le_one₀ (by exact_mod_cast hk : (0 : ℝ) < _)).2 exact_mod_cast hk · simp [g, hk] · simp only [g] split_ifs <;> positivity rw [show (fun s : FiniteSample X ↦ (successFraction A B s - P.real A / P.real B) ^ 2) = f by rfl] rw [integral_finitePoissonSampleLaw_eq_integral_iid P lambda f hf 1 hfb] calc (∫ n : ℕ, ∫ x : Fin n → X, f (fixedSizeEmbed n x) ∂Measure.pi (fun _ : Fin n ↦ P) ∂poissonMeasure lambda) ≤ ∫ n : ℕ, ∫ x : Fin n → X, g (fixedSizeEmbed n x) ∂Measure.pi (fun _ : Fin n ↦ P) ∂poissonMeasure lambda := by apply integral_mono · exact Integrable.of_bound (measurable_of_countable _).aestronglyMeasurable 1 (Filter.Eventually.of_forall fun n ↦ by simpa using norm_integral_le_of_norm_le_const (μ := Measure.pi (fun _ : Fin n ↦ P)) (f := fun x : Fin n → X ↦ f (fixedSizeEmbed n x)) (Filter.Eventually.of_forall fun x ↦ hfb _)) · exact Integrable.of_bound (measurable_of_countable _).aestronglyMeasurable 1 (Filter.Eventually.of_forall fun n ↦ by simpa using norm_integral_le_of_norm_le_const (μ := Measure.pi (fun _ : Fin n ↦ P)) (f := fun x : Fin n → X ↦ g (fixedSizeEmbed n x)) (Filter.Eventually.of_forall fun x ↦ hgb _)) · intro n calc (∫ x : Fin n → X, f (fixedSizeEmbed n x) ∂Measure.pi (fun _ : Fin n ↦ P)) ≤ ∫ x : Fin n → X, (if 0 < iidEventCount B x then (iidEventCount B x)⁻¹ else 1) ∂Measure.pi (fun _ : Fin n ↦ P) := by simpa [f, target] using iid_successFraction_centered_sq_le_inverseCount P n hA hB hAB hPB _ = ∫ x : Fin n → X, g (fixedSizeEmbed n x) ∂Measure.pi (fun _ : Fin n ↦ P) := by apply integral_congr_ae filter_upwards with x have hc := successFraction_eventCount_eq_cast B (fixedSizeEmbed n x) rw [eventCount_fixedSizeEmbed] at hc by_cases hk : 0 < Causalean.Stat.FiniteRaoBlackwell.Poisson.FinitePartition.NestedEventMoment.eventCount (fixedSizeEmbed n x) B · have hkr : 0 < iidEventCount B x := by rw [hc] exact_mod_cast hk simp [g, hk, hkr, hc] · have hk0 : Causalean.Stat.FiniteRaoBlackwell.Poisson.FinitePartition.NestedEventMoment.eventCount (fixedSizeEmbed n x) B = 0 := Nat.eq_zero_of_not_pos hk have hreal0 : iidEventCount B x = 0 := by simp [hc, hk0] simp [g, hk, hreal0] _ = ∫ s : FiniteSample X, g s ∂finitePoissonSampleLaw P lambda := by rw [integral_finitePoissonSampleLaw_eq_integral_iid P lambda g hg 1 hgb] _ = ∫ k : ℕ, (if 0 < k then ((k : ℝ)⁻¹) else 1) ∂poissonMeasure (lambda * (P B).toNNReal) := by have hmap := finitePoissonSampleLaw_map_eventCount P lambda B hB let h : ℕ → ℝ := fun k ↦ if 0 < k then ((k : ℝ)⁻¹) else 1 have hh : Measurable h := measurable_of_countable _ rw [← integral_map (measurable_eventCount B hB).aemeasurable hh.aestronglyMeasurable, hmap] _ ≤ 4 / (1 + ((lambda * (P B).toNNReal : ℝ≥0) : ℝ)) := poisson_zeroSafeInverse_expectation_le _ _ = 4 / (1 + (lambda : ℝ) * P.real B) := by have hmass : ((P B).toNNReal : ℝ) = (P B).toReal := by calc ((P B).toNNReal : ℝ) = (((P B).toNNReal : ℝ≥0∞).toReal) := (ENNReal.coe_toReal _).symm _ = (P B).toReal := congrArg toReal (ENNReal.coe_toNNReal (measure_ne_top P B)) simp [NNReal.coe_mul, Measure.real, hmass]
CausalSmith.Stat.MarRareqLogfrontier.finitePoisson_successFraction_centered_sq_le · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/RatioSecondMoment.lean:491
theorem integral_sq_markedPoissonRatioBranch_sub_cellMean_le

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
P :
j :
Cell d
hpos :
0 < arrivedCell P j
(∫ s, (poissonRatioBranch j s - cellMean P j) ^ 2 ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2))
≤ 4 / (1 + streamSize n * arrivedCell P j)
Proof (Lean source)
lemma integral_sq_markedPoissonRatioBranch_sub_cellMean_le (n d : ℕ) (P : FullLaw d) (j : Cell d) (hpos : 0 < arrivedCell P j) : (∫ s, (poissonRatioBranch j s - cellMean P j) ^ 2 ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) ≤ 4 / (1 + streamSize n * arrivedCell P j) := by letI := markedObsLaw_isProbabilityMeasure P have h := finitePoisson_successFraction_centered_sq_le (markedObsLaw P) ((n : ℝ≥0) / 2) (Set.Finite.measurableSet (Set.toFinite (streamEvent 2 j true true))) (Set.Finite.measurableSet (Set.toFinite (streamEvent 2 j true false))) (streamEvent_ones_subset_arrived 2 j) (by rw [markedObsLaw_streamEvent_real, map_obsStreamEvent_arrived_real]; positivity) simp_rw [poissonRatioBranch_eq_successFraction] rw [cellMean, if_pos hpos] rw [markedObsLaw_streamEvent_real, markedObsLaw_streamEvent_real, map_obsStreamEvent_arrivedOne_real, map_obsStreamEvent_arrived_real] at h have hratio : P.1.real {r | inCell r j ∧ r.R = true ∧ r.Y = true} / arrivedCell P j = (P.1.real {r | inCell r j ∧ r.R = true ∧ r.Y = true} / 3) / (arrivedCell P j / 3) := by field_simp [ne_of_gt hpos] rw [hratio] convert h using 1 unfold streamSize push_cast ring
CausalSmith.Stat.MarRareqLogfrontier.integral_sq_markedPoissonRatioBranch_sub_cellMean_le · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/RatioSecondMoment.lean:603
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.Certificate.RatioVariance 6 declarations Null-cell completion and variance bounds for roadmap (15).

Null-cell completion and variance bounds for roadmap (15).

theorem integral_sq_markedPoissonRatioBranch_of_zero

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
P :
j :
Cell d
hzero :
arrivedCell P j = 0
(∫ s, (poissonRatioBranch j s) ^ 2 ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2))
= 0
Proof (Lean source)
-- @node: integral_sq_markedPoissonRatioBranch_of_zero lemma integral_sq_markedPoissonRatioBranch_of_zero (n d : ℕ) (P : FullLaw d) (j : Cell d) (hzero : arrivedCell P j = 0) : (∫ s, (poissonRatioBranch j s) ^ 2 ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) = 0 := by have hint : Integrable (poissonRatioBranch j) (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) := by apply Integrable.of_bound (measurable_poissonRatioBranch j).aestronglyMeasurable 1 filter_upwards [] with s rcases poissonRatioBranch_mem_unitInterval j s with ⟨hs0, hs1⟩ simpa [Real.norm_eq_abs, abs_of_nonneg hs0] using hs1 apply le_antisymm _ (integral_nonneg fun s ↦ sq_nonneg _) calc _ ≤ ∫ s, poissonRatioBranch j s ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2) := by apply integral_mono (integrable_poissonRatioBranch_sq n d P j) hint intro s rcases poissonRatioBranch_mem_unitInterval j s with ⟨hs0, hs1⟩ nlinarith _ = 0 := integral_markedPoissonRatioBranch_of_zero n d P j hzero
CausalSmith.Stat.MarRareqLogfrontier.integral_sq_markedPoissonRatioBranch_of_zero · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/RatioVariance.lean:19
theorem markedPoissonRatioBranch_centered_secondMoment_le

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
P :
j :
Cell d
(∫ s, (poissonRatioBranch j s - cellMean P j) ^ 2 ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2))
≤ 4 / (1 + streamSize n * arrivedCell P j)
Proof (Lean source)
-- @node: markedPoissonRatioBranch_centered_secondMoment_le lemma markedPoissonRatioBranch_centered_secondMoment_le (n d : ℕ) (P : FullLaw d) (j : Cell d) : (∫ s, (poissonRatioBranch j s - cellMean P j) ^ 2 ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) ≤ 4 / (1 + streamSize n * arrivedCell P j) := by by_cases hpos : 0 < arrivedCell P j · exact integral_sq_markedPoissonRatioBranch_sub_cellMean_le n d P j hpos · have hzero : arrivedCell P j = 0 := le_antisymm (le_of_not_gt hpos) measureReal_nonneg simp only [cellMean, hpos, if_false, sub_zero] rw [integral_sq_markedPoissonRatioBranch_of_zero n d P j hzero, hzero] norm_num
CausalSmith.Stat.MarRareqLogfrontier.markedPoissonRatioBranch_centered_secondMoment_le · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/RatioVariance.lean:41
theorem markedPoissonRatioBranch_variance_le

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
P :
j :
Cell d
≤ 4 / (1 + streamSize n * arrivedCell P j)
Proof (Lean source)
-- @node: markedPoissonRatioBranch_variance_le lemma markedPoissonRatioBranch_variance_le (n d : ℕ) (P : FullLaw d) (j : Cell d) : variance (poissonRatioBranch j) (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) ≤ 4 / (1 + streamSize n * arrivedCell P j) := by have hm := (measurable_poissonRatioBranch j).aestronglyMeasurable (μ := finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) calc _ = variance (fun s ↦ poissonRatioBranch j s - cellMean P j) (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) := (variance_sub_const hm (cellMean P j)).symm _ ≤ ∫ s, (poissonRatioBranch j s - cellMean P j) ^ 2 ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2) := variance_le_expectation_sq (hm.sub aestronglyMeasurable_const) _ ≤ _ := markedPoissonRatioBranch_centered_secondMoment_le n d P j
CausalSmith.Stat.MarRareqLogfrontier.markedPoissonRatioBranch_variance_le · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/RatioVariance.lean:56
theorem sum_cellProb_eq_one

Given the probability law, the cell probabilities sum to one.

Formal statement
d :
ℕ
shared
P :
(∑ j : Cell d, cellProb P j) = 1
Proof (Lean source)
-- @node: sum_cellProb_eq_one lemma sum_cellProb_eq_one (P : FullLaw d) : (∑ j : Cell d, cellProb P j) = 1 := by classical letI : IsProbabilityMeasure P.1 := P.2 have h := sum_measureReal_preimage_singleton (μ := P.1) (Finset.univ : Finset (Cell d)) (f := fun r : FullRecord d ↦ (r.A, r.X, r.S)) (by intro; simp) have heq (j : Cell d) : {r : FullRecord d | inCell r j} = (fun r : FullRecord d ↦ (r.A, r.X, r.S)) ⁻¹' {j} := by ext r simp [inCell, Prod.ext_iff] simpa [cellProb, heq] using h
theorem cellProb_sq_div_one_add_intensity_le

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
P :
j :
Cell d
(cellProb P j) ^ 2 / (1 + streamSize n * arrivedCell P j)
≤ cellProb P j / streamEffectiveSize n q
Proof (Lean source)
-- @node: cellProb_sq_div_one_add_intensity_le lemma cellProb_sq_div_one_add_intensity_le (n d : ℕ) (q : ℝ) (P : FullLaw d) (hP : UnrestrictedArrivalModelClass n d q P) (j : Cell d) : (cellProb P j) ^ 2 / (1 + streamSize n * arrivedCell P j) ≤ cellProb P j / streamEffectiveSize n q := by have hm : 0 < streamSize n := by unfold streamSize have hn : 0 < (n : ℝ) := by exact_mod_cast hP.n_pos positivity have hN : 0 < streamEffectiveSize n q := by unfold streamEffectiveSize exact mul_pos hm hP.q_pos have hp : 0 ≤ cellProb P j := measureReal_nonneg have ht : 0 ≤ streamSize n * arrivedCell P j := mul_nonneg hm.le measureReal_nonneg have hlo := streamEffectiveSize_mul_cellProb_le_arrivedStreamIntensity n d q P hP 2 j rw [coe_arrivedStreamIntensity] at hlo apply (div_le_div_iff₀ (by positivity : 0 < 1 + streamSize n * arrivedCell P j) hN).2 have hmul := mul_le_mul_of_nonneg_left hlo hp nlinarith
CausalSmith.Stat.MarRareqLogfrontier.cellProb_sq_div_one_add_intensity_le · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/RatioVariance.lean:89
theorem sum_cellProb_sq_mul_ratioVariance_le

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
P :
(∑ j : Cell d, (cellProb P j) ^ 2 * variance (poissonRatioBranch j) (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)))
Proof (Lean source)
-- @node: sum_cellProb_sq_mul_ratioVariance_le lemma sum_cellProb_sq_mul_ratioVariance_le (n d : ℕ) (q : ℝ) (P : FullLaw d) (hP : UnrestrictedArrivalModelClass n d q P) : (∑ j : Cell d, (cellProb P j) ^ 2 * variance (poissonRatioBranch j) (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2))) ≤ 4 / streamEffectiveSize n q := by calc _ ≤ ∑ j : Cell d, 4 * (cellProb P j / streamEffectiveSize n q) := by apply Finset.sum_le_sum intro j hj calc _ ≤ (cellProb P j) ^ 2 * (4 / (1 + streamSize n * arrivedCell P j)) := mul_le_mul_of_nonneg_left (markedPoissonRatioBranch_variance_le n d P j) (sq_nonneg _) _ = 4 * ((cellProb P j) ^ 2 / (1 + streamSize n * arrivedCell P j)) := by ring _ ≤ _ := mul_le_mul_of_nonneg_left (cellProb_sq_div_one_add_intensity_le n d q P hP j) (by norm_num) _ = _ := by rw [← Finset.mul_sum, ← Finset.sum_div, sum_cellProb_eq_one] ring
CausalSmith.Stat.MarRareqLogfrontier.sum_cellProb_sq_mul_ratioVariance_le · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/RatioVariance.lean:112
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.Certificate.RawRiskAssembly 5 declarations Square integrability, bias--variance decomposition, and clipping assemble ideal squared risk from the actual raw-estimator variance and the proved bias budget.

Square integrability, bias--variance decomposition, and clipping assemble ideal squared risk from the actual raw-estimator variance and the proved bias budget. Cross-cell independence is still needed to bound that variance.

theorem memLp_poissonRawMixedValue

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
P :
Proof (Lean source)
-- @node: memLp_poissonRawMixedValue lemma memLp_poissonRawMixedValue (n d : ℕ) (q : ℝ) (P : FullLaw d) : MemLp (poissonRawMixedValue n d q) 2 (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) := by have hj (j : Cell d) := (memLp_poissonMemberWeight_mul_selectedCellEstimate n d q P j).const_mul (armSign j.1) have hs := memLp_finsetSum (Finset.univ : Finset (Cell d)) (fun j _ ↦ hj j) change MemLp (fun s ↦ 2 * ∑ j : Cell d, armSign j.1 * poissonMemberWeight n j s * poissonSelectedCellEstimate n d q j s) 2 _ simpa only [mul_assoc] using hs.const_mul (2 : ℝ)
CausalSmith.Stat.MarRareqLogfrontier.memLp_poissonRawMixedValue · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/RawRiskAssembly.lean:18
theorem integral_sq_error_eq_variance_add_bias_sq Lemma integral_sq_error_eq_variance_add_bias_sq in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
Ω :
X :
Ω → ℝ
hX :
MemLp X 2 μ
θ :
ℝ
(∫ s, (X s - θ) ^ 2 ∂μ) = variance X μ + ((∫ s, X s ∂μ) - θ) ^ 2
Proof (Lean source)
-- @node: integral_sq_error_eq_variance_add_bias_sq lemma integral_sq_error_eq_variance_add_bias_sq {Ω : Type*} [MeasurableSpace Ω] (μ : Measure Ω) [IsProbabilityMeasure μ] {X : Ω → ℝ} (hX : MemLp X 2 μ) (θ : ℝ) : (∫ s, (X s - θ) ^ 2 ∂μ) = variance X μ + ((∫ s, X s ∂μ) - θ) ^ 2 := by have hsub : MemLp (fun s ↦ X s - θ) 2 μ := hX.sub (memLp_const θ) have hv := variance_eq_sub hsub rw [variance_sub_const hX.aestronglyMeasurable θ] at hv have hm : (∫ s, X s - θ ∂μ) = (∫ s, X s ∂μ) - θ := by rw [integral_sub (hX.integrable (by norm_num)) (integrable_const θ)] simp simp only [Pi.pow_apply] at hv rw [hm] at hv linarith
CausalSmith.Stat.MarRareqLogfrontier.integral_sq_error_eq_variance_add_bias_sq · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/RawRiskAssembly.lean:31
theorem integral_sq_poissonRawMixedValue_error_eq

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q θ :
ℝ
P :
(∫ s, (poissonRawMixedValue n d q s - θ) ^ 2 ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2))
+ ((∫ s, poissonRawMixedValue n d q s ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) - θ) ^ 2
Proof (Lean source)
-- @node: integral_sq_poissonRawMixedValue_error_eq lemma integral_sq_poissonRawMixedValue_error_eq (n d : ℕ) (q θ : ℝ) (P : FullLaw d) : (∫ s, (poissonRawMixedValue n d q s - θ) ^ 2 ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) = variance (poissonRawMixedValue n d q) (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) + ((∫ s, poissonRawMixedValue n d q s ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) - θ) ^ 2 := by exact integral_sq_error_eq_variance_add_bias_sq _ (memLp_poissonRawMixedValue n d q P) θ
CausalSmith.Stat.MarRareqLogfrontier.integral_sq_poissonRawMixedValue_error_eq · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/RawRiskAssembly.lean:47
theorem integral_sq_poissonAuxiliaryMixedValue_le_raw

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
P :
hlarge :
¬ effectiveSize n q ≤ 1
(∫ s, (poissonAuxiliaryMixedValue n d q s - cellFunctional P) ^ 2 ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2))
≤ ∫ s, (poissonRawMixedValue n d q s - cellFunctional P) ^ 2 ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)
Proof (Lean source)
-- @node: integral_sq_poissonAuxiliaryMixedValue_le_raw lemma integral_sq_poissonAuxiliaryMixedValue_le_raw (n d : ℕ) (q : ℝ) (P : FullLaw d) (hP : UnrestrictedArrivalModelClass n d q P) (hlarge : ¬ effectiveSize n q ≤ 1) : (∫ s, (poissonAuxiliaryMixedValue n d q s - cellFunctional P) ^ 2 ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) ≤ ∫ s, (poissonRawMixedValue n d q s - cellFunctional P) ^ 2 ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2) := by have haux : MemLp (poissonAuxiliaryMixedValue n d q) 2 (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) := by apply memLp_of_bounded (a := -1) (b := 1) _ (measurable_poissonAuxiliaryMixedValue n d q).aestronglyMeasurable filter_upwards [] with s exact poissonAuxiliaryMixedValue_mem_Icc n d q s apply integral_mono (haux.sub (memLp_const (cellFunctional P))).integrable_sq ((memLp_poissonRawMixedValue n d q P).sub (memLp_const (cellFunctional P))).integrable_sq intro s change (poissonAuxiliaryMixedValue n d q s - cellFunctional P) ^ 2 ≤ (poissonRawMixedValue n d q s - cellFunctional P) ^ 2 simp only [poissonAuxiliaryMixedValue, if_neg hlarge] exact clip_sq_sub_le _ _ (cellFunctional_mem_Icc P hP)
CausalSmith.Stat.MarRareqLogfrontier.integral_sq_poissonAuxiliaryMixedValue_le_raw · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/RawRiskAssembly.lean:58
theorem integral_sq_poissonAuxiliaryMixedValue_le_variance_add_active_bias_sq

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
P :
hb :
hlarge :
¬ effectiveSize n q ≤ 1
(∫ s, (poissonAuxiliaryMixedValue n d q s - cellFunctional P) ^ 2 ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2))
+ (2 * (4 * d * needleRadius n q / (streamEffectiveSize n q * (needleDegree n q : ℝ)^2) + 3 * exp (-16 * logScale n q))) ^ 2
Proof (Lean source)
-- @node: integral_sq_poissonAuxiliaryMixedValue_le_variance_add_active_bias_sq lemma integral_sq_poissonAuxiliaryMixedValue_le_variance_add_active_bias_sq (n d : ℕ) (q : ℝ) (P : FullLaw d) (hP : UnrestrictedArrivalModelClass n d q P) (hb : needleBranch n d q) (hlarge : ¬ effectiveSize n q ≤ 1) : (∫ s, (poissonAuxiliaryMixedValue n d q s - cellFunctional P) ^ 2 ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) ≤ variance (poissonRawMixedValue n d q) (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) + (2 * (4 * d * needleRadius n q / (streamEffectiveSize n q * (needleDegree n q : ℝ)^2) + 3 * exp (-16 * logScale n q))) ^ 2 := by have h := abs_integral_raw_poissonSelected_estimator_bias_le n d q P hP hb change |(∫ s, poissonRawMixedValue n d q s ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) - cellFunctional P| ≤ _ at h refine (integral_sq_poissonAuxiliaryMixedValue_le_raw n d q P hP hlarge).trans ?_ rw [integral_sq_poissonRawMixedValue_error_eq] apply add_le_add_right have hs := mul_self_le_mul_self (abs_nonneg _) h simpa only [← sq, sq_abs] using hs
CausalSmith.Stat.MarRareqLogfrontier.integral_sq_poissonAuxiliaryMixedValue_le_variance_add_active_bias_sq · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/RawRiskAssembly.lean:82
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.Certificate.RiskGeometry 4 declarations Bounded-target and clipping geometry used by the risk certificate.

Bounded-target and clipping geometry used by the risk certificate.

theorem ate_mem_Icc_of_fullLaw

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
P :
ate P ∈ Icc (-1 : ℝ) 1
Proof (Lean source)
lemma ate_mem_Icc_of_fullLaw {d : ℕ} (P : FullLaw d) : ate P ∈ Icc (-1 : ℝ) 1 := by rw [ate_eq_potentialOutcomeMass] letI : IsProbabilityMeasure P.1 := P.2 have h0 : (0 : ℝ) ≤ P.1.real {r | r.Y0 = true} := measureReal_nonneg have h1 : (0 : ℝ) ≤ P.1.real {r | r.Y1 = true} := measureReal_nonneg have h0' : P.1.real {r | r.Y0 = true} ≤ 1 := measureReal_le_one have h1' : P.1.real {r | r.Y1 = true} ≤ 1 := measureReal_le_one constructor <;> linarith
CausalSmith.Stat.MarRareqLogfrontier.ate_mem_Icc_of_fullLaw · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/RiskGeometry.lean:13
theorem cellFunctional_mem_Icc

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
P :
cellFunctional P ∈ Icc (-1 : ℝ) 1
Proof (Lean source)
lemma cellFunctional_mem_Icc {n d : ℕ} {q : ℝ} (P : FullLaw d) (hP : UnrestrictedArrivalModelClass n d q P) : cellFunctional P ∈ Icc (-1 : ℝ) 1 := by rw [← unrestricted_cell_identification P hP] exact ate_mem_Icc_of_fullLaw P
CausalSmith.Stat.MarRareqLogfrontier.cellFunctional_mem_Icc · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/RiskGeometry.lean:24
theorem clip_sq_sub_le

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
u theta :
ℝ
htheta :
theta ∈ Icc (-1 : ℝ) 1
(clip u - theta) ^ 2 ≤ (u - theta) ^ 2
Proof (Lean source)
lemma clip_sq_sub_le (u theta : ℝ) (htheta : theta ∈ Icc (-1 : ℝ) 1) : (clip u - theta) ^ 2 ≤ (u - theta) ^ 2 := by rcases htheta with ⟨htheta0, htheta1⟩ unfold clip by_cases hu0 : u < -1 · have hmax : max (-1) (min 1 u) = -1 := by rw [max_eq_left] exact (min_le_right 1 u).trans (le_of_lt hu0) rw [hmax] nlinarith [sq_nonneg (u - theta), sq_nonneg (-1 - theta)] · have hu0' : -1 ≤ u := le_of_not_gt hu0 by_cases hu1 : 1 < u · have hmax : max (-1) (min 1 u) = 1 := by rw [min_eq_left (le_of_lt hu1), max_eq_right] norm_num rw [hmax] nlinarith [sq_nonneg (u - theta), sq_nonneg (1 - theta)] · have hu1' : u ≤ 1 := le_of_not_gt hu1 rw [min_eq_right hu1', max_eq_right hu0']
theorem sq_sub_le_four_of_mem_Icc

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
u theta :
ℝ
hu :
u ∈ Icc (-1 : ℝ) 1
htheta :
theta ∈ Icc (-1 : ℝ) 1
(u - theta) ^ 2 ≤ 4
Proof (Lean source)
lemma sq_sub_le_four_of_mem_Icc {u theta : ℝ} (hu : u ∈ Icc (-1 : ℝ) 1) (htheta : theta ∈ Icc (-1 : ℝ) 1) : (u - theta) ^ 2 ≤ 4 := by rcases hu with ⟨hu0, hu1⟩ rcases htheta with ⟨htheta0, htheta1⟩ nlinarith [sq_nonneg (u - theta + 2), sq_nonneg (2 - (u - theta))]
CausalSmith.Stat.MarRareqLogfrontier.sq_sub_le_four_of_mem_Icc · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/RiskGeometry.lean:52
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.Certificate.SignedVariance 3 declarations Cross-cell independence assembles the signed raw variance and the active ideal risk bound in roadmap (20)--(24), retaining random membership weights.

Cross-cell independence assembles the signed raw variance and the active ideal risk bound in roadmap (20)--(24), retaining random membership weights.

theorem variance_poissonRawMixedValue_eq_four_sum

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
P :
= 4 * ∑ j : Cell d, variance (fun s ↦ poissonMemberWeight n j s * poissonSelectedCellEstimate n d q j s) (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2))
Proof (Lean source)
-- @node: variance_poissonRawMixedValue_eq_four_sum lemma variance_poissonRawMixedValue_eq_four_sum (n d : ℕ) (q : ℝ) (P : FullLaw d) : variance (poissonRawMixedValue n d q) (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) = 4 * ∑ j : Cell d, variance (fun s ↦ poissonMemberWeight n j s * poissonSelectedCellEstimate n d q j s) (finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) := by classical let μ := finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2) let X (j : Cell d) := fun s ↦ poissonMemberWeight n j s * poissonSelectedCellEstimate n d q j s let Z (j : Cell d) := fun s ↦ armSign j.1 * X j s have hZ (j : Cell d) : MemLp (Z j) 2 μ := (memLp_poissonMemberWeight_mul_selectedCellEstimate n d q P j).const_mul _ have hi : Pairwise (↑(Finset.univ : Finset (Cell d))) (fun i j ↦ IndepFun (Z i) (Z j) μ) := by intro i _ j _ hij exact (indepFun_memberWeight_mul_selectedCellEstimate n d q P hij).comp (measurable_const.mul measurable_id) (measurable_const.mul measurable_id) have hv := IndepFun.variance_sum (fun j _ ↦ hZ j) hi have hsign (j : Cell d) : armSign j.1 ^ 2 = 1 := by cases j.1 <;> norm_num [armSign] change variance (fun s ↦ 2 * ∑ j : Cell d, armSign j.1 * poissonMemberWeight n j s * poissonSelectedCellEstimate n d q j s) μ = _ have heq : (fun s ↦ ∑ j : Cell d, armSign j.1 * poissonMemberWeight n j s * poissonSelectedCellEstimate n d q j s) = ∑ j : Cell d, Z j := by funext s simp only [Finset.sum_apply, Z, X, mul_assoc] rw [variance_const_mul, heq] rw [hv] norm_num only [show (2 : ℝ) ^ 2 = 4 by norm_num] congr 1 apply Finset.sum_congr rfl intro j _ change variance (fun s ↦ armSign j.1 * X j s) μ = _ rw [variance_const_mul, hsign, one_mul]
CausalSmith.Stat.MarRareqLogfrontier.variance_poissonRawMixedValue_eq_four_sum · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/SignedVariance.lean:16
theorem variance_poissonRawMixedValue_le_active_budget

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
P :
hb :
≤ 8 * (4 / streamEffectiveSize n q + 1 / streamSize n)
+ 64 * d * (exp (logScale n q / 8) + 1) * (needleRadius n q ^ 2 / streamEffectiveSize n q ^ 2 + needleRadius n q / (streamSize n * streamEffectiveSize n q))
+ 32 * exp (-32 * logScale n q) * (1 + 1 / streamSize n)
Proof (Lean source)
CausalSmith.Stat.MarRareqLogfrontier.variance_poissonRawMixedValue_le_active_budget · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/SignedVariance.lean:55
theorem integral_sq_poissonAuxiliaryMixedValue_le_active_budget

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
P :
hb :
hlarge :
¬ effectiveSize n q ≤ 1
(∫ s, (poissonAuxiliaryMixedValue n d q s - cellFunctional P) ^ 2 ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2))
≤ (2 * (4 * d * needleRadius n q / (streamEffectiveSize n q * (needleDegree n q : ℝ)^2) + 3 * exp (-16 * logScale n q))) ^ 2
+ (8 * (4 / streamEffectiveSize n q + 1 / streamSize n) + 64 * d * (exp (logScale n q / 8) + 1) * (needleRadius n q ^ 2 / streamEffectiveSize n q ^ 2 + needleRadius n q / (streamSize n * streamEffectiveSize n q)) + 32 * exp (-32 * logScale n q) * (1 + 1 / streamSize n))
Proof (Lean source)
-- @node: integral_sq_poissonAuxiliaryMixedValue_le_active_budget lemma integral_sq_poissonAuxiliaryMixedValue_le_active_budget (n d : ℕ) (q : ℝ) (P : FullLaw d) (hP : UnrestrictedArrivalModelClass n d q P) (hb : needleBranch n d q) (hlarge : ¬ effectiveSize n q ≤ 1) : (∫ s, (poissonAuxiliaryMixedValue n d q s - cellFunctional P) ^ 2 ∂finitePoissonSampleLaw (markedObsLaw P) ((n : ℝ≥0) / 2)) ≤ (2 * (4 * d * needleRadius n q / (streamEffectiveSize n q * (needleDegree n q : ℝ)^2) + 3 * exp (-16 * logScale n q))) ^ 2 + (8 * (4 / streamEffectiveSize n q + 1 / streamSize n) + 64 * d * (exp (logScale n q / 8) + 1) * (needleRadius n q ^ 2 / streamEffectiveSize n q ^ 2 + needleRadius n q / (streamSize n * streamEffectiveSize n q)) + 32 * exp (-32 * logScale n q) * (1 + 1 / streamSize n)) := by have hr := integral_sq_poissonAuxiliaryMixedValue_le_variance_add_active_bias_sq n d q P hP hb hlarge have hv := variance_poissonRawMixedValue_le_active_budget n d q P hP hb exact hr.trans (by linarith)
CausalSmith.Stat.MarRareqLogfrontier.integral_sq_poissonAuxiliaryMixedValue_le_active_budget · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/SignedVariance.lean:69
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.Certificate.StreamBridge 12 declarations Ordered-stream representation of the ideal marked Poisson estimator.

Ordered-stream representation of the ideal marked Poisson estimator.

theorem eventCount_unshuffle

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
shared
s :
pool :
Fin 3
j :
Cell d
arrived ones :
eventCount (unshuffle s pool) (obsStreamEvent j arrived ones)
= eventCount s (streamEvent pool j arrived ones)
Proof (Lean source)
lemma eventCount_unshuffle (s : FiniteSample (ObsRecord d × Fin 3)) (pool : Fin 3) (j : Cell d) (arrived ones : Bool) : eventCount (unshuffle s pool) (obsStreamEvent j arrived ones) = eventCount s (streamEvent pool j arrived ones) := by classical rcases s with ⟨k, z⟩ unfold eventCount unshuffle simp only [FiniteSample.count, FiniteSample.points] let w : Fin k → Fin 3 := fun i => (z i).2 let y : Fin k → ObsRecord d := fun i => (z i).1 let e (i : Fin (wordHistogram w pool)) : Fin k := wordUnshuffleEquiv w ⟨pool, i⟩ apply Finset.card_bij (fun i _ => e i) · intro i hi change i ∈ Finset.univ.filter (fun i => gatherWord (fun k => (z k).2) (fun k => (z k).1) pool i ∈ obsStreamEvent j arrived ones) at hi change e i ∈ Finset.univ.filter (fun i => z i ∈ streamEvent pool j arrived ones) rw [mem_filter] at hi ⊢ rcases hi with ⟨_, hi⟩ refine ⟨Finset.mem_univ _, ?_⟩ have hlabel := (wordFiberEquiv w pool i).property change w (e i) = pool at hlabel simpa [e, w, y, gatherWord, obsStreamEvent, streamEvent, hlabel] using hi · intro i hi i' hi' he have hsigma : (⟨pool, i⟩ : Σ a, Fin (wordHistogram w a)) = ⟨pool, i'⟩ := (wordUnshuffleEquiv w).injective he cases hsigma rfl · intro i hi change i ∈ Finset.univ.filter (fun i => z i ∈ streamEvent pool j arrived ones) at hi rw [mem_filter] at hi rcases hi with ⟨_, hi⟩ have hipool : w i = pool := by simpa [w, streamEvent] using hi.1 let u : {a : Fin k // w a = pool} := ⟨i, hipool⟩ let r : Fin (wordHistogram w pool) := (wordFiberEquiv w pool).symm u refine ⟨r, ?_, ?_⟩ · change r ∈ Finset.univ.filter (fun r => gatherWord (fun k => (z k).2) (fun k => (z k).1) pool r ∈ obsStreamEvent j arrived ones) rw [mem_filter] refine ⟨Finset.mem_univ _, ?_⟩ have heq : e r = i := by change ((wordFiberEquiv w pool) r).1 = i exact congrArg val ((wordFiberEquiv w pool).apply_symm_apply u) simpa [e, w, y, gatherWord, obsStreamEvent, streamEvent, heq] using hi.2 · change ((wordFiberEquiv w pool) r).1 = i exact congrArg val ((wordFiberEquiv w pool).apply_symm_apply u)
def streamFactorialBranch

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
n d :
ℕ
q :
ℝ
j :
Cell d
s :
streamFactorialBranch n d q j s :
ℝ
if needleBranch n d q then ∑ v ∈ Icc 1 (needleDegree n q - 1), needleCoeff n d q v * weightedFactorial (obsStreamEvent j true true) (obsStreamEvent j true false) v (s 2) else 0
CausalSmith.Stat.MarRareqLogfrontier.streamFactorialBranch · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/StreamBridge.lean:72
def streamRatioBranch

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
d :
ℕ
j :
Cell d
s :
streamRatioBranch j s :
ℝ
if 0 < eventCount (s 2) (obsStreamEvent j true false) then eventCount (s 2) (obsStreamEvent j true true) / eventCount (s 2) (obsStreamEvent j true false) else 0
def streamSelectedCellEstimate

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
n d :
ℕ
q :
ℝ
j :
Cell d
s :
streamSelectedCellEstimate n d q j s :
ℝ
if needleBranch n d q ∧
eventCount (s 1) (obsStreamEvent j true false)
≤ needleRadius n q / 4 then streamFactorialBranch n d q j s else streamRatioBranch j s
CausalSmith.Stat.MarRareqLogfrontier.streamSelectedCellEstimate · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/StreamBridge.lean:89
def streamAuxiliaryMixedValue

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
n d :
ℕ
q :
ℝ
s :
streamAuxiliaryMixedValue n d q s :
ℝ
≤ 1 then 0 else clip (2 * ∑ j : Cell d, armSign j.1 * (eventCount (s 0) (obsStreamEvent j false false) / streamSize n) * streamSelectedCellEstimate n d q j s)
CausalSmith.Stat.MarRareqLogfrontier.streamAuxiliaryMixedValue · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/StreamBridge.lean:97
theorem streamAuxiliaryMixedValue_unshuffle

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
s :
Proof (Lean source)
CausalSmith.Stat.MarRareqLogfrontier.streamAuxiliaryMixedValue_unshuffle · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/StreamBridge.lean:105
theorem measurable_streamEventCount

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
pool :
Fin 3
j :
Cell d
arrived ones :
Measurable (fun s : Fin 3 → FiniteSample (ObsRecord d) ↦ eventCount (s pool) (obsStreamEvent j arrived ones))
Proof (Lean source)
lemma measurable_streamEventCount {d : ℕ} (pool : Fin 3) (j : Cell d) (arrived ones : Bool) : Measurable (fun s : Fin 3 → FiniteSample (ObsRecord d) ↦ eventCount (s pool) (obsStreamEvent j arrived ones)) := by exact (measurable_eventCount _ (Set.Finite.measurableSet (Set.toFinite _))).comp (measurable_pi_apply pool)
CausalSmith.Stat.MarRareqLogfrontier.measurable_streamEventCount · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/StreamBridge.lean:132
theorem measurable_streamFactorialBranch

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
j :
Cell d
Proof (Lean source)
@[fun_prop] lemma measurable_streamFactorialBranch (n d : ℕ) (q : ℝ) (j : Cell d) : Measurable (streamFactorialBranch n d q j) := by unfold streamFactorialBranch split_ifs · apply Finset.measurable_sum intro v hv exact (measurable_weightedFactorial (obsStreamEvent j true true) (obsStreamEvent j true false) (Set.Finite.measurableSet (Set.toFinite _)) (Set.Finite.measurableSet (Set.toFinite _)) v |>.comp (measurable_pi_apply 2)).const_mul _ · fun_prop
CausalSmith.Stat.MarRareqLogfrontier.measurable_streamFactorialBranch · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/StreamBridge.lean:141
theorem measurable_streamRatioBranch

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
j :
Cell d
Proof (Lean source)
@[fun_prop] lemma measurable_streamRatioBranch {d : ℕ} (j : Cell d) : Measurable (streamRatioBranch j) := by have hnum : Measurable (fun s : Fin 3 → FiniteSample (ObsRecord d) ↦ (eventCount (s 2) (obsStreamEvent j true true) : ℝ)) := (measurable_of_countable (fun z : ℕ ↦ (z : ℝ))).comp (measurable_streamEventCount 2 j true true) have hden : Measurable (fun s : Fin 3 → FiniteSample (ObsRecord d) ↦ (eventCount (s 2) (obsStreamEvent j true false) : ℝ)) := (measurable_of_countable (fun z : ℕ ↦ (z : ℝ))).comp (measurable_streamEventCount 2 j true false) unfold streamRatioBranch apply Measurable.ite · exact (measurable_streamEventCount 2 j true false) measurableSet_Ioi · exact hnum.div hden · fun_prop
CausalSmith.Stat.MarRareqLogfrontier.measurable_streamRatioBranch · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/StreamBridge.lean:155
theorem measurable_streamSelectedCellEstimate

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
j :
Cell d
Proof (Lean source)
@[fun_prop] lemma measurable_streamSelectedCellEstimate (n d : ℕ) (q : ℝ) (j : Cell d) : Measurable (streamSelectedCellEstimate n d q j) := by unfold streamSelectedCellEstimate apply Measurable.ite · by_cases hbranch : needleBranch n d q · simp only [hbranch, true_and] have hc : Measurable (fun s : Fin 3 → FiniteSample (ObsRecord d) ↦ (eventCount (s 1) (obsStreamEvent j true false) : ℝ)) := (measurable_of_countable (fun z : ℕ ↦ (z : ℝ))).comp (measurable_streamEventCount 1 j true false) exact hc measurableSet_Iic · simp [hbranch] · exact measurable_streamFactorialBranch n d q j · exact measurable_streamRatioBranch j
CausalSmith.Stat.MarRareqLogfrontier.measurable_streamSelectedCellEstimate · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/StreamBridge.lean:172
theorem measurable_streamAuxiliaryMixedValue

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
Proof (Lean source)
@[fun_prop] lemma measurable_streamAuxiliaryMixedValue (n d : ℕ) (q : ℝ) : Measurable (streamAuxiliaryMixedValue n d q) := by unfold streamAuxiliaryMixedValue clip split_ifs · fun_prop · apply Measurable.max measurable_const apply Measurable.min measurable_const apply Measurable.const_mul apply Finset.measurable_sum intro j hj have hmember : Measurable (fun s : Fin 3 → FiniteSample (ObsRecord d) ↦ (eventCount (s 0) (obsStreamEvent j false false) : ℝ) / streamSize n) := by apply Measurable.div_const exact (measurable_of_countable (fun z : ℕ ↦ (z : ℝ))).comp (measurable_streamEventCount 0 j false false) exact (hmember.const_mul _).mul (measurable_streamSelectedCellEstimate n d q j)
CausalSmith.Stat.MarRareqLogfrontier.measurable_streamAuxiliaryMixedValue · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/StreamBridge.lean:188
theorem streamAuxiliaryMixedValue_mem_Icc

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
s :
streamAuxiliaryMixedValue n d q s ∈ Icc (-1 : ℝ) 1
Proof (Lean source)
lemma streamAuxiliaryMixedValue_mem_Icc (n d : ℕ) (q : ℝ) (s : Fin 3 → FiniteSample (ObsRecord d)) : streamAuxiliaryMixedValue n d q s ∈ Icc (-1 : ℝ) 1 := by unfold streamAuxiliaryMixedValue clip split_ifs · norm_num · exact ⟨le_max_left _ _, (max_le_iff.mpr ⟨by norm_num, min_le_left _ _⟩)⟩
CausalSmith.Stat.MarRareqLogfrontier.streamAuxiliaryMixedValue_mem_Icc · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Certificate/StreamBridge.lean:209
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.CompleteArrivalFamily 15 declarations A normalized one-cell complete-arrival Bernoulli family.

A normalized one-cell complete-arrival Bernoulli family.

def completeRecord

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
d :
ℕ
x :
Fin d
a y :
completeRecord x a y :
⟨x, a, false, false, false, y, true⟩

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
p :
ℝ
b :
completeBernWeight p b :
ℝ
if b then p else 1 - p
def completeMeasure

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
d :
ℕ
x :
Fin d
u :
ℝ
completeMeasure x u :
∑ a : Bool, ∑ y : Bool, ofReal (completeBernWeight (1/2) a * completeBernWeight u y) • Measure.dirac (completeRecord x a y)
theorem completeMeasure_univ

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
x :
Fin d
u :
ℝ
hu :
0 ≤ u ∧ u ≤ 1
Proof (Lean source)
lemma completeMeasure_univ {d : ℕ} (x : Fin d) (u : ℝ) (hu : 0 ≤ u ∧ u ≤ 1) : completeMeasure x u univ = 1 := by simp [completeMeasure, completeBernWeight] have hu' : 0 ≤ 1 - u := by linarith [hu.2] norm_num at ⊢ have hhalf : ofReal (1 / 2 : ℝ) = (2 : ℝ≥0∞)⁻¹ := by rw [ENNReal.ofReal_div_of_pos (by norm_num)] norm_num rw [hhalf] calc _ = (2⁻¹ + 2⁻¹ : ℝ≥0∞) * (ofReal u + ofReal (1 - u)) := by ring _ = 1 := by rw [← ENNReal.ofReal_add hu.1 hu', ENNReal.inv_two_add_inv_two]; norm_num
CausalSmith.Stat.MarRareqLogfrontier.completeMeasure_univ · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/CompleteArrivalFamily.lean:31
def completeFamilyLaw

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
d :
ℕ
x :
Fin d
u :
ℝ
hu :
0 ≤ u ∧ u ≤ 1
completeFamilyLaw x u hu :
⟨completeMeasure x u, ⟨completeMeasure_univ x u hu⟩⟩
theorem completeFamilyLaw_ate

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
x :
Fin d
u :
ℝ
hu :
0 ≤ u ∧ u ≤ 1
ate (completeFamilyLaw x u hu) = u
Proof (Lean source)
lemma completeFamilyLaw_ate {d : ℕ} (x : Fin d) (u : ℝ) (hu : 0 ≤ u ∧ u ≤ 1) : ate (completeFamilyLaw x u hu) = u := by let f : FullRecord d → ℝ := fun r => (if r.Y1 then 1 else 0) - (if r.Y0 then 1 else 0) have hInt (a y : Bool) : Integrable f (ofReal (completeBernWeight (1/2) a * completeBernWeight u y) • Measure.dirac (completeRecord x a y)) := by exact (integrable_dirac (by simp)).smul_measure ENNReal.ofReal_ne_top unfold ate completeFamilyLaw completeMeasure change (∫ r, f r ∂(∑ a : Bool, ∑ y : Bool, ofReal (completeBernWeight (1/2) a * completeBernWeight u y) • Measure.dirac (completeRecord x a y))) = u have hinner (a : Bool) : (∫ r, f r ∂(∑ y : Bool, ofReal (completeBernWeight (1/2) a * completeBernWeight u y) • Measure.dirac (completeRecord x a y))) = ∑ y : Bool, ∫ r, f r ∂(ofReal (completeBernWeight (1/2) a * completeBernWeight u y) • Measure.dirac (completeRecord x a y)) := by exact integral_finsetSum_measure (by intro y hy; exact hInt a y) have hOuter : ∀ a : Bool, Integrable f (∑ y : Bool, ofReal (completeBernWeight (1/2) a * completeBernWeight u y) • Measure.dirac (completeRecord x a y)) := by intro a apply (integrable_finsetSum_measure).2 intro y hy exact hInt a y rw [integral_finsetSum_measure (by intro a ha; exact hOuter a)] simp_rw [hinner] simp [completeRecord, completeBernWeight, integral_smul_measure, integral_dirac] have hu' : 0 ≤ 1 - u := by linarith [hu.2] have hu2 : 0 ≤ (1 - 2⁻¹ : ℝ) * u := mul_nonneg (by norm_num) hu.1 simp [f, ENNReal.toReal_ofReal hu.1, ENNReal.toReal_ofReal hu'] rw [ENNReal.toReal_ofReal hu2] ring
CausalSmith.Stat.MarRareqLogfrontier.completeFamilyLaw_ate · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/CompleteArrivalFamily.lean:53
theorem completeFamilyLaw_obs_ac

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
x :
Fin d
u :
ℝ
hu :
0 ≤ u ∧ u ≤ 1
((completeFamilyLaw x u hu).1.map obs) ≪ ((completeFamilyLaw x (1 / 2) (by norm_num : (0 : ℝ) ≤ 1 / 2 ∧ (1 / 2 : ℝ) ≤ 1)).1.map obs)
Proof (Lean source)
lemma completeFamilyLaw_obs_ac {d : ℕ} (x : Fin d) (u : ℝ) (hu : 0 ≤ u ∧ u ≤ 1) : ((completeFamilyLaw x u hu).1.map obs) ≪ ((completeFamilyLaw x (1 / 2) (by norm_num : (0 : ℝ) ≤ 1 / 2 ∧ (1 / 2 : ℝ) ≤ 1)).1.map obs) := by intro s hs rw [Measure.map_apply (by fun_prop) (by simp)] at hs ⊢ simp [completeFamilyLaw, completeMeasure, completeBernWeight, completeRecord] at hs ⊢ norm_num at hs tauto
CausalSmith.Stat.MarRareqLogfrontier.completeFamilyLaw_obs_ac · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/CompleteArrivalFamily.lean:91
theorem completeFamilyLaw_obs_atom

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
x :
Fin d
u :
ℝ
hu :
0 ≤ u ∧ u ≤ 1
o :
((completeFamilyLaw x u hu).1.map obs).real {o} = if o.X = x ∧
o.S = false ∧
o.R
= true then (1 / 2 : ℝ) * (if o.A then completeBernWeight u o.RY else if o.RY then 0 else 1) else 0
Proof (Lean source)
lemma completeFamilyLaw_obs_atom {d : ℕ} (x : Fin d) (u : ℝ) (hu : 0 ≤ u ∧ u ≤ 1) (o : ObsRecord d) : ((completeFamilyLaw x u hu).1.map obs).real {o} = if o.X = x ∧ o.S = false ∧ o.R = true then (1 / 2 : ℝ) * (if o.A then completeBernWeight u o.RY else if o.RY then 0 else 1) else 0 := by have h1 : 0 ≤ u * (1 / 2 : ℝ) := mul_nonneg hu.1 (by norm_num) have h2 : 0 ≤ (1 / 2 : ℝ) + u * (-1 / 2) := by nlinarith [hu.2] rw [measureReal_def, Measure.map_apply (by fun_prop) (by simp)] rcases o with ⟨X, A, S, R, RY⟩ by_cases hx : X = x · subst X cases A <;> cases S <;> cases R <;> cases RY <;> simp [completeFamilyLaw, completeMeasure, completeBernWeight, completeRecord, obs, FullRecord.Y, FullRecord.S, indicator, hu.1, sub_nonneg.mpr hu.2, ENNReal.toReal_add, ENNReal.toReal_ofReal, h1, h2] <;> try ring rw [ENNReal.toReal_ofReal h1, ENNReal.toReal_ofReal h2] ring · have hneq : x ≠ X := Ne.symm hx cases A <;> cases S <;> cases R <;> cases RY <;> simp [completeFamilyLaw, completeMeasure, completeBernWeight, completeRecord, obs, FullRecord.Y, FullRecord.S, indicator, hx, hneq]
CausalSmith.Stat.MarRareqLogfrontier.completeFamilyLaw_obs_atom · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/CompleteArrivalFamily.lean:105
theorem completeFamilyLaw_obs_chi

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
x :
Fin d
u :
ℝ
hu :
0 ≤ u ∧ u ≤ 1
chiSqDiv ((completeFamilyLaw x u hu).1.map obs) ((completeFamilyLaw x (1 / 2) (by norm_num)).1.map obs)
= 2 * (u - 1 / 2) ^ 2
Proof (Lean source)
lemma completeFamilyLaw_obs_chi {d : ℕ} (x : Fin d) (u : ℝ) (hu : 0 ≤ u ∧ u ≤ 1) : chiSqDiv ((completeFamilyLaw x u hu).1.map obs) ((completeFamilyLaw x (1 / 2) (by norm_num)).1.map obs) = 2 * (u - 1 / 2) ^ 2 := by let P₁ := completeFamilyLaw x u hu let P₀ := completeFamilyLaw x (1 / 2) (by norm_num : (0 : ℝ) ≤ 1 / 2 ∧ (1 / 2 : ℝ) ≤ 1) letI : IsProbabilityMeasure P₁.1 := P₁.2 letI : IsProbabilityMeasure P₀.1 := P₀.2 let μ := P₁.1.map obs let ν := P₀.1.map obs letI : IsProbabilityMeasure μ := Measure.isProbabilityMeasure_map (by fun_prop) letI : IsProbabilityMeasure ν := Measure.isProbabilityMeasure_map (by fun_prop) have hac := completeFamilyLaw_obs_ac x u hu have h := finite_one_add_chiSqDiv μ ν hac dsimp [μ, ν, P₁, P₀] at h simp_rw [completeFamilyLaw_obs_atom x u hu, completeFamilyLaw_obs_atom x (1 / 2) (by norm_num : (0 : ℝ) ≤ 1 / 2 ∧ (1 / 2 : ℝ) ≤ 1)] at h let a : ObsRecord d := ⟨x, false, false, true, false⟩ let b : ObsRecord d := ⟨x, true, false, true, false⟩ let c : ObsRecord d := ⟨x, true, false, true, true⟩ let f : ObsRecord d → ℝ := fun o => (if o.X = x ∧ o.S = false ∧ o.R = true then (1 / 2 : ℝ) * (if o.A then completeBernWeight u o.RY else if o.RY then 0 else 1) else 0) ^ 2 / (if o.X = x ∧ o.S = false ∧ o.R = true then (1 / 2 : ℝ) * (if o.A then completeBernWeight (1 / 2) o.RY else if o.RY then 0 else 1) else 0) have hsum : (∑ o : ObsRecord d, f o) = ∑ o ∈ ({a, b, c} : Finset (ObsRecord d)), f o := by symm apply Finset.sum_subset (Finset.subset_univ _) intro o ho hn 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, a, b, c] at hn ⊢ · simp [f, hx] have hvalue : (∑ o : ObsRecord d, f o) = 1 + 2 * (u - 1 / 2) ^ 2 := by rw [hsum] simp [f, a, b, c, completeBernWeight] ring change 1 + chiSqDiv ((completeFamilyLaw x u hu).1.map obs) ((completeFamilyLaw x (1 / 2) (by norm_num)).1.map obs) = ∑ o : ObsRecord d, f o at h linarith [hvalue]
CausalSmith.Stat.MarRareqLogfrontier.completeFamilyLaw_obs_chi · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/CompleteArrivalFamily.lean:132
theorem completeFamilyLaw_balanced

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
x :
Fin d
u :
ℝ
hu :
0 ≤ u ∧ u ≤ 1
Proof (Lean source)
lemma completeFamilyLaw_balanced {d : ℕ} (x : Fin d) (u : ℝ) (hu : 0 ≤ u ∧ u ≤ 1) : BalancedRandomization (completeFamilyLaw x u hu) := by rw [BalancedRandomization, Measure.real] simp [completeFamilyLaw, completeMeasure, completeBernWeight, completeRecord] have hu' : 0 ≤ 1 - u := by linarith [hu.2] have hw : ofReal u + ofReal (1 - u) = 1 := by rw [← ENNReal.ofReal_add hu.1 hu'] norm_num rw [← mul_add, hw] norm_num
CausalSmith.Stat.MarRareqLogfrontier.completeFamilyLaw_balanced · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/CompleteArrivalFamily.lean:187
theorem completeFamilyLaw_consistency

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
x :
Fin d
u :
ℝ
hu :
0 ≤ u ∧ u ≤ 1
Proof (Lean source)
lemma completeFamilyLaw_consistency {d : ℕ} (x : Fin d) (u : ℝ) (hu : 0 ≤ u ∧ u ≤ 1) : SurrogateConsistency (completeFamilyLaw x u hu) ∧ OutcomeConsistency (completeFamilyLaw x u hu) := by constructor · filter_upwards [] with r rfl · filter_upwards [] with r rfl
CausalSmith.Stat.MarRareqLogfrontier.completeFamilyLaw_consistency · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/CompleteArrivalFamily.lean:201
theorem completeFamilyLaw_arrivedCell

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
x :
Fin d
u :
ℝ
hu :
0 ≤ u ∧ u ≤ 1
j :
Cell d
arrivedCell (completeFamilyLaw x u hu) j = cellProb (completeFamilyLaw x u hu) j
Proof (Lean source)
lemma completeFamilyLaw_arrivedCell {d : ℕ} (x : Fin d) (u : ℝ) (hu : 0 ≤ u ∧ u ≤ 1) (j : Cell d) : arrivedCell (completeFamilyLaw x u hu) j = cellProb (completeFamilyLaw x u hu) j := by simp [arrivedCell, cellProb, Measure.real, completeFamilyLaw, completeMeasure, completeBernWeight, completeRecord, inCell, indicator]
CausalSmith.Stat.MarRareqLogfrontier.completeFamilyLaw_arrivedCell · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/CompleteArrivalFamily.lean:213
theorem completeFamilyLaw_mar

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
x :
Fin d
u :
ℝ
hu :
0 ≤ u ∧ u ≤ 1
Proof (Lean source)
lemma completeFamilyLaw_mar {d : ℕ} (x : Fin d) (u : ℝ) (hu : 0 ≤ u ∧ u ≤ 1) : ArrivalMAR (completeFamilyLaw x u hu) := by intro j y r cases r <;> simp [Measure.real, completeFamilyLaw, completeMeasure, completeBernWeight, completeRecord, cellProb, inCell, indicator] <;> ring
CausalSmith.Stat.MarRareqLogfrontier.completeFamilyLaw_mar · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/CompleteArrivalFamily.lean:222
theorem completeFamilyLaw_randomized

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
x :
Fin d
u :
ℝ
hu :
0 ≤ u ∧ u ≤ 1
Proof (Lean source)
lemma completeFamilyLaw_randomized {d : ℕ} (x : Fin d) (u : ℝ) (hu : 0 ≤ u ∧ u ≤ 1) : RandomizedIndependence (completeFamilyLaw x u hu) := by rw [RandomizedIndependence, indepFun_iff_measure_inter_preimage_eq_mul] intro s t _ _ have hu' : 0 ≤ 1 - u := by linarith [hu.2] have hw (v : ℝ) (hv : 0 ≤ v) : ofReal ((1 - 2⁻¹ : ℝ) * v) = (2⁻¹ : ℝ≥0∞) * ofReal v := by norm_num [ENNReal.ofReal_mul (by norm_num : (0 : ℝ) ≤ 1 / 2)] norm_num [ENNReal.ofReal_div_of_pos] have hsum : ofReal u + ofReal (1 - u) = 1 := by rw [← ENNReal.ofReal_add hu.1 hu'] norm_num have htwo : (2⁻¹ : ℝ≥0∞) * 2 = 1 := by rw [mul_two] exact ENNReal.inv_two_add_inv_two simp [completeFamilyLaw, completeMeasure, completeRecord, completeBernWeight, indicator, hw u hu.1, hw (1-u) hu'] by_cases hsT : true ∈ s <;> by_cases hsF : false ∈ s <;> by_cases htT : (x, false, false, false, true) ∈ t <;> by_cases htF : (x, false, false, false, false) ∈ t <;> simp [hsT, hsF, htT, htF, Set.mem_inter_iff] <;> simp only [← mul_add, hsum, mul_one] <;> simp only [← two_mul, ← mul_assoc, htwo, one_mul] <;> rw [mul_comm (2 : ℝ≥0∞) (2⁻¹ : ℝ≥0∞), htwo] <;> simp <;> simpa only [mul_comm] using htwo.symm
CausalSmith.Stat.MarRareqLogfrontier.completeFamilyLaw_randomized · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/CompleteArrivalFamily.lean:231
theorem completeFamilyLaw_in_unrestricted_class_of_randomized

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
hn :
1 ≤ n
hd :
1 ≤ d
x :
Fin d
u :
ℝ
hu :
0 ≤ u ∧ u ≤ 1
Proof (Lean source)
lemma completeFamilyLaw_in_unrestricted_class_of_randomized {n d : ℕ} (hn : 1 ≤ n) (hd : 1 ≤ d) (x : Fin d) (u : ℝ) (hu : 0 ≤ u ∧ u ≤ 1) (hR : RandomizedIndependence (completeFamilyLaw x u hu)) : UnrestrictedArrivalModelClass n d 1 (completeFamilyLaw x u hu) := by refine ⟨hn, hd, by norm_num, by norm_num, hR, completeFamilyLaw_balanced x u hu, (completeFamilyLaw_consistency x u hu).1, (completeFamilyLaw_consistency x u hu).2, completeFamilyLaw_mar x u hu, ?_⟩ intro j hj rw [completeFamilyLaw_arrivedCell] simp
CausalSmith.Stat.MarRareqLogfrontier.completeFamilyLaw_in_unrestricted_class_of_randomized · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/CompleteArrivalFamily.lean:260
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.CompleteArrivalTesting 2 declarations A quantitative testing floor for the complete-arrival two-point experiment.

A quantitative testing floor for the complete-arrival two-point experiment.

theorem complete_arrival_exp_eighth_lt_two Lemma complete_arrival_exp_eighth_lt_two in the paper ↗

the stated mathematical conclusion holds.

Formal statement
exp (1 / 8 : ℝ) < 2
Proof (Lean source)
lemma complete_arrival_exp_eighth_lt_two : exp (1 / 8 : ℝ) < 2 := by have hsq : exp (1 / 2 : ℝ) * exp (1 / 2 : ℝ) = exp 1 := by rw [← Real.exp_add] norm_num have hmon : exp (1 / 8 : ℝ) ≤ exp (1 / 2 : ℝ) := by exact Real.exp_le_exp.mpr (by norm_num) have hpos : 0 < exp (1 / 2 : ℝ) := Real.exp_pos _ nlinarith [Real.exp_one_lt_three]
CausalSmith.Stat.MarRareqLogfrontier.complete_arrival_exp_eighth_lt_two · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/CompleteArrivalTesting.lean:15
theorem complete_arrival_product_testing_half Lemma complete_arrival_product_testing_half in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n :
ℕ
hn :
1 ≤ n
hac :
P₁ ≪ P₀
hint :
Integrable (fun x => ((P₁.rnDeriv P₀ x).toReal - 1) ^ 2) P₀
hchi :
chiSqDiv P₁ P₀ ≤ (1 / 8 : ℝ) / n
A :
Set (Fin n → Ω)
(Measure.pi (fun _ : Fin n => P₁)).real Aᶜ + (Measure.pi (fun _ : Fin n => P₀)).real A
≥ 1 / 2
Proof (Lean source)
lemma complete_arrival_product_testing_half {Ω : Type} [MeasurableSpace Ω] [MeasurableSingletonClass Ω] (n : ℕ) (hn : 1 ≤ n) (P₁ P₀ : Measure Ω) [IsProbabilityMeasure P₁] [IsProbabilityMeasure P₀] (hac : P₁ ≪ P₀) (hint : Integrable (fun x => ((P₁.rnDeriv P₀ x).toReal - 1) ^ 2) P₀) (hchi : chiSqDiv P₁ P₀ ≤ (1 / 8 : ℝ) / n) : ∀ A : Set (Fin n → Ω), MeasurableSet A → (Measure.pi (fun _ : Fin n => P₁)).real Aᶜ + (Measure.pi (fun _ : Fin n => P₀)).real A ≥ 1 / 2 := by intro A hA let Q₁ : Measure (Fin n → Ω) := Measure.pi (fun _ => P₁) let Q₀ : Measure (Fin n → Ω) := Measure.pi (fun _ => P₀) have hprod_ac : Q₁ ≪ Q₀ := Causalean.Mathlib.Probability.ProductAbsolutelyContinuous.pi_iid_absolutelyContinuous P₁ P₀ hac n have hprod_int : Integrable (fun x => ((Q₁.rnDeriv Q₀ x).toReal - 1) ^ 2) Q₀ := Causalean.Stat.pi_iid_integrable_sq_dev P₁ P₀ hac hint n have hchi_non : 0 ≤ chiSqDiv P₁ P₀ := Causalean.Stat.chiSqDiv_nonneg have hnpos : (0 : ℝ) < n := by exact_mod_cast hn have hmul : (n : ℝ) * chiSqDiv P₁ P₀ ≤ 1 / 8 := by have h := mul_le_mul_of_nonneg_left hchi (le_of_lt hnpos) field_simp [hnpos.ne'] at h linarith have hprod_chi : chiSqDiv Q₁ Q₀ ≤ exp (1 / 8 : ℝ) - 1 := by have hident := one_add_chiSqDiv_pi_iid_general P₁ P₀ hac hint n change 1 + chiSqDiv Q₁ Q₀ = (1 + chiSqDiv P₁ P₀) ^ n at hident have hpow : (1 + chiSqDiv P₁ P₀) ^ n ≤ exp ((n : ℝ) * chiSqDiv P₁ P₀) := by calc _ ≤ (exp (chiSqDiv P₁ P₀)) ^ n := pow_le_pow_left₀ (by linarith) (by linarith [Real.add_one_le_exp (chiSqDiv P₁ P₀)]) n _ = _ := by rw [← Real.exp_nat_mul] linarith [hpow, Real.exp_le_exp.mpr hmul] letI : IsProbabilityMeasure Q₁ := by dsimp [Q₁]; infer_instance letI : IsProbabilityMeasure Q₀ := by dsimp [Q₀]; infer_instance have htv := Causalean.Stat.tvDist_le_half_sqrt_chiSqDiv Q₁ Q₀ hprod_ac hprod_int have hchi_lt : chiSqDiv Q₁ Q₀ < 1 := by linarith [complete_arrival_exp_eighth_lt_two] have htv_le : tvDist Q₁ Q₀ ≤ 1 / 2 := by have hsqrt := Real.sqrt_le_sqrt (le_of_lt hchi_lt) have h := htv.trans (mul_le_mul_of_nonneg_left (by simpa only [Real.sqrt_one] using hsqrt) (by norm_num : (0 : ℝ) ≤ 1 / 2)) simpa using h have htest := one_sub_tvDist_le_test (μ := Q₁) (ν := Q₀) hA.compl simpa only [compl_compl] using (le_trans (by linarith : (1 / 2 : ℝ) ≤ 1 - tvDist Q₁ Q₀) htest)
CausalSmith.Stat.MarRareqLogfrontier.complete_arrival_product_testing_half · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/CompleteArrivalTesting.lean:26
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.Estimator 26 declarations The finite-work mixed-count estimator and its deterministic risk envelope.

The finite-work mixed-count estimator and its deterministic risk envelope.

def streamSize

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
n :
ℕ
streamSize n :
ℝ
(n : ℝ) / 6
def streamEffectiveSize

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
n :
ℕ
q :
ℝ
streamEffectiveSize n q :
ℝ
CausalSmith.Stat.MarRareqLogfrontier.streamEffectiveSize · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Estimator.lean:21

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
n :
ℕ
q :
ℝ
needleDegree n q :
ℕ
floor (logScale n q / 64)
CausalSmith.Stat.MarRareqLogfrontier.needleDegree · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Estimator.lean:25
def needleRadius

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
n :
ℕ
q :
ℝ
needleRadius n q :
ℝ
256 * logScale n q
CausalSmith.Stat.MarRareqLogfrontier.needleRadius · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Estimator.lean:28

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
n d :
ℕ
q :
ℝ
needleBranch n d q :
Prop
clause 1
128 ≤ logScale n q
clause 2
sqrt (effectiveSize n q) ≤ d
CausalSmith.Stat.MarRareqLogfrontier.needleBranch · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Estimator.lean:31
def chebNeedle

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
n d :
ℕ
q :
ℝ
chebNeedle n d q :
if needleBranch n d q then C (needleRadius n q / (2 * (needleDegree n q : ℝ) ^ 2)) * (1 - (T ℝ (needleDegree n q : ℤ)).comp (C 1 - C (2 / needleRadius n q) * X)).divX else 1

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
n d :
ℕ
q :
ℝ
v :
ℕ
needleCoeff n d q v :
ℝ
if needleBranch n d q then (1 - chebNeedle n d q).coeff v else 0
CausalSmith.Stat.MarRareqLogfrontier.needleCoeff · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Estimator.lean:45
def fallingFactorial

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
z v :
ℕ
fallingFactorial z v :
ℝ
(z.descFactorial v : ℝ)
CausalSmith.Stat.MarRareqLogfrontier.fallingFactorial · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Estimator.lean:51
def streamCount

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
k d :
ℕ
records :
Fin k → ObsRecord d
assign :
Fin k → Fin 3
pool :
Fin 3
j :
Cell d
arrived ones :
streamCount records assign pool j arrived ones :
ℕ
∑ i : Fin k, if assign i = pool ∧
(records i).A = j.1 ∧
(records i).X = j.2.1 ∧
(records i).S = j.2.2 ∧
(!arrived ∨ (records i).R = true) ∧
(!ones ∨ (records i).RY = true) then 1 else 0
CausalSmith.Stat.MarRareqLogfrontier.streamCount · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Estimator.lean:55

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
k d :
ℕ
records :
Fin k → ObsRecord d
assign :
Fin k → Fin 3
j :
Cell d
memberCount records assign j :
ℕ
streamCount records assign 0 j false false
CausalSmith.Stat.MarRareqLogfrontier.memberCount · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Estimator.lean:64
def pilotCount

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
k d :
ℕ
records :
Fin k → ObsRecord d
assign :
Fin k → Fin 3
j :
Cell d
pilotCount records assign j :
ℕ
streamCount records assign 1 j true false
def arrivedCount

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
k d :
ℕ
records :
Fin k → ObsRecord d
assign :
Fin k → Fin 3
j :
Cell d
arrivedCount records assign j :
ℕ
streamCount records assign 2 j true false
CausalSmith.Stat.MarRareqLogfrontier.arrivedCount · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Estimator.lean:74

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
k d :
ℕ
records :
Fin k → ObsRecord d
assign :
Fin k → Fin 3
j :
Cell d
arrivedOneCount records assign j :
ℕ
streamCount records assign 2 j true true
CausalSmith.Stat.MarRareqLogfrontier.arrivedOneCount · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Estimator.lean:79

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
k d :
ℕ
n :
ℕ
records :
Fin k → ObsRecord d
assign :
Fin k → Fin 3
j :
Cell d
memberWeight n records assign j :
ℝ
memberCount records assign j / streamSize n
CausalSmith.Stat.MarRareqLogfrontier.memberWeight · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Estimator.lean:84

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
k d :
ℕ
records :
Fin k → ObsRecord d
assign :
Fin k → Fin 3
j :
Cell d
ratioBranch records assign j :
ℝ
if 0 < arrivedCount records assign j then arrivedOneCount records assign j / arrivedCount records assign j else 0
CausalSmith.Stat.MarRareqLogfrontier.ratioBranch · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Estimator.lean:89

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
k d :
ℕ
n :
ℕ
q :
ℝ
records :
Fin k → ObsRecord d
assign :
Fin k → Fin 3
j :
Cell d
factorialBranch n q records assign j :
ℝ
if needleBranch n d q then ∑ v ∈ Icc 1 (needleDegree n q - 1), needleCoeff n d q v * arrivedOneCount records assign j * fallingFactorial (arrivedCount records assign j - 1) (v - 1) else 0
CausalSmith.Stat.MarRareqLogfrontier.factorialBranch · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Estimator.lean:96
def selectedCellEstimate Definition 24 in the paper ↗

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
k d :
ℕ
n :
ℕ
q :
ℝ
records :
Fin k → ObsRecord d
assign :
Fin k → Fin 3
j :
Cell d
selectedCellEstimate n q records assign j :
ℝ
if needleBranch n d q ∧
pilotCount records assign j
≤ needleRadius n q / 4 then factorialBranch n q records assign j else ratioBranch records assign j
CausalSmith.Stat.MarRareqLogfrontier.selectedCellEstimate · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Estimator.lean:106
def clip

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
u :
ℝ
clip u :
ℝ
max (-1) (min 1 u)
def auxiliaryMixedValue

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
k d :
ℕ
n :
ℕ
q :
ℝ
records :
Fin k → ObsRecord d
assign :
Fin k → Fin 3
auxiliaryMixedValue n q records assign :
ℝ
≤ 1 then 0 else clip (2 * ∑ j : Cell d, armSign j.1 * memberWeight n records assign j * selectedCellEstimate n q records assign j)
CausalSmith.Stat.MarRareqLogfrontier.auxiliaryMixedValue · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Estimator.lean:117
def mixedCountEstimator

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
n d :
ℕ
q :
ℝ
sample :
Fin n → ObsRecord d
mixedCountEstimator n d q sample :
ℝ
∑ k ∈ range (n + 1), if h : k
≤ n then (poissonMeasure ((n : ℝ≥0) / 2)).real ({k} : Set ℕ) * ((∑ assign : Fin k → Fin 3, auxiliaryMixedValue n q (fun i => sample (castLE h i)) assign) / (3 : ℝ) ^ k) else 0
CausalSmith.Stat.MarRareqLogfrontier.mixedCountEstimator · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Estimator.lean:126

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
conclusion 1
conclusion 2
s :
mixedCountEstimator n d q s ∈ Icc (-1 : ℝ) 1
Proof (Lean source)
-- @node: mixed_count_estimator_regular lemma mixed_count_estimator_regular (n d : ℕ) (q : ℝ) : Measurable (mixedCountEstimator n d q) ∧ ∀ s, mixedCountEstimator n d q s ∈ Icc (-1 : ℝ) 1 := by constructor · exact measurable_of_finite _ · intro s have hclip (k : ℕ) (records : Fin k → ObsRecord d) (assign : Fin k → Fin 3) : -1 ≤ auxiliaryMixedValue n q records assign ∧ auxiliaryMixedValue n q records assign ≤ 1 := by unfold auxiliaryMixedValue clip split_ifs <;> constructor <;> simp [le_max_iff, max_le_iff, min_le_iff] have hweight (k : ℕ) : 0 ≤ (poissonMeasure ((n : ℝ≥0) / 2)).real ({k} : Set ℕ) := measureReal_nonneg have hmass : (∑ k ∈ range (n + 1), (poissonMeasure ((n : ℝ≥0) / 2)).real ({k} : Set ℕ)) ≤ 1 := by have h := MeasureTheory.sum_measureReal_le_measureReal_univ (μ := poissonMeasure ((n : ℝ≥0) / 2)) (s := range (n + 1)) (t := fun k : ℕ => ({k} : Set ℕ)) have hm : ∀ k ∈ range (n + 1), MeasurableSet ({k} : Set ℕ) := fun _ _ => MeasurableSet.singleton _ have hd : (↑(range (n + 1)) : Set ℕ).PairwiseDisjoint (fun k : ℕ => ({k} : Set ℕ)) := by intro i hi j hj hij exact Set.disjoint_singleton.mpr hij simpa using h hm hd have havg (k : ℕ) (h : k ≤ n) : -1 ≤ (∑ assign : Fin k → Fin 3, auxiliaryMixedValue n q (fun i => s (castLE h i)) assign) / (3 : ℝ) ^ k ∧ (∑ assign : Fin k → Fin 3, auxiliaryMixedValue n q (fun i => s (castLE h i)) assign) / (3 : ℝ) ^ k ≤ 1 := by have hp : (0 : ℝ) < 3 ^ k := by positivity have hc : (card (Fin k → Fin 3) : ℝ) = 3 ^ k := by simp constructor · apply (le_div_iff₀ hp).2 rw [neg_mul, one_mul, ← hc] simpa using Finset.sum_le_sum (s := univ) (fun a _ => (hclip k _ a).1) · apply (div_le_iff₀ hp).2 rw [one_mul, ← hc] simpa using Finset.sum_le_sum (s := univ) (fun a _ => (hclip k _ a).2) have hlow : -(∑ k ∈ range (n + 1), (poissonMeasure ((n : ℝ≥0) / 2)).real ({k} : Set ℕ)) ≤ mixedCountEstimator n d q s := by unfold mixedCountEstimator rw [← Finset.sum_neg_distrib] apply Finset.sum_le_sum intro k hk have h : k ≤ n := by simpa using hk simp only [dif_pos h] simpa only [mul_neg, mul_one] using mul_le_mul_of_nonneg_left (havg k h).1 (hweight k) have hupp : mixedCountEstimator n d q s ≤ ∑ k ∈ range (n + 1), (poissonMeasure ((n : ℝ≥0) / 2)).real ({k} : Set ℕ) := by unfold mixedCountEstimator apply Finset.sum_le_sum intro k hk have h : k ≤ n := by simpa using hk simp only [dif_pos h] simpa only [mul_one] using mul_le_mul_of_nonneg_left (havg k h).2 (hweight k) exact ⟨by linarith, hupp.trans hmass⟩
CausalSmith.Stat.MarRareqLogfrontier.mixed_count_estimator_regular · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Estimator.lean:139

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
n :
ℕ
d :
ℕ
q :
ℝ
P :
auxiliaryMixedRisk n q P :
ℝ
∫ sample, (∑ k ∈ range (n + 1), if h : k ≤ n then (poissonMeasure ((n : ℝ≥0) / 2)).real ({k} : Set ℕ) * ((∑ assign : Fin k → Fin 3, (auxiliaryMixedValue n q (fun i => sample (castLE h i)) assign - ate P) ^ 2) / (3 : ℝ) ^ k) else 0)
+ (1 - ∑ k ∈ range (n + 1), (poissonMeasure ((n : ℝ≥0) / 2)).real ({k} : Set ℕ)) * (ate P) ^ 2 ∂(sampleLaw n P)
CausalSmith.Stat.MarRareqLogfrontier.auxiliaryMixedRisk · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Estimator.lean:211

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
n d :
ℕ
q :
ℝ
riskEnvelope n d q :
ℝ
N :
m :
N₀ :
ell :
k :
B :
γ :
log 2 - 1 / 2
if N
≤ 1 then 1 else if ¬ needleBranch n d q then min 4 (((8 * d / (exp 1 * N₀)) ^ 2) + 4 * (4 / N₀ + 1 / m) + 4 * exp (-(n : ℝ) * γ)) else let b := 2 * (4 * d * B / (N₀ * (k : ℝ) ^ 2) + 3 * exp (-16 * ell)) let v := 8 * (4 / N₀ + 1 / m)
+ 64 * d * (exp (ell / 8) + 1) * (B ^ 2 / N₀ ^ 2 + B / (m * N₀))
+ 32 * exp (-32 * ell) * (1 + 1 / m) min 4 (b ^ 2 + v + 4 * exp (-(n : ℝ) * γ))
CausalSmith.Stat.MarRareqLogfrontier.riskEnvelope · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Estimator.lean:224

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
n d :
ℕ
q α :
ℝ
sample :
Fin n → ObsRecord d
riskEnvelopeEndpoints n d q α sample :
ℝ × ℝ
(max (-1) (mixedCountEstimator n d q sample - sqrt (riskEnvelope n d q / α)), min 1 (mixedCountEstimator n d q sample + sqrt (riskEnvelope n d q / α)))
CausalSmith.Stat.MarRareqLogfrontier.riskEnvelopeEndpoints · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Estimator.lean:245
def riskEnvelopeInterval

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
n d :
ℕ
q α :
ℝ
@realizes \(\alpha\)(miscoverage level)
sample :
Fin n → ObsRecord d
riskEnvelopeInterval n d q α sample :
Set ℝ
Icc (riskEnvelopeEndpoints n d q α sample).1 (riskEnvelopeEndpoints n d q α sample).2
CausalSmith.Stat.MarRareqLogfrontier.riskEnvelopeInterval · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Estimator.lean:252
def completeArrivalHTEstimator

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
n d :
ℕ
sample :
Fin n → ObsRecord d
completeArrivalHTEstimator n d sample :
ℝ
clip ((2 / (n : ℝ)) * ∑ i : Fin n, armSign (sample i).A * (if (sample i).R && (sample i).RY then (1 : ℝ) else 0))
CausalSmith.Stat.MarRareqLogfrontier.completeArrivalHTEstimator · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Estimator.lean:261
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.Identification 7 declarations Finite-cell identification under randomization, consistency, and MAR.

Finite-cell identification under randomization, consistency, and MAR.

theorem cellContribution_eq_cellOutcomeMass

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
P :
j :
Cell d
cellContribution P j = P.1.real {r | inCell r j ∧ r.Y = true}
Proof (Lean source)
lemma cellContribution_eq_cellOutcomeMass {n d : ℕ} {q : ℝ} (P : FullLaw d) (hP : UnrestrictedArrivalModelClass n d q P) (j : Cell d) : cellContribution P j = P.1.real {r | inCell r j ∧ r.Y = true} := by classical letI : IsProbabilityMeasure P.1 := P.2 by_cases hp : 0 < cellProb P j · have ha : 0 < arrivedCell P j := lt_of_lt_of_le (mul_pos hP.q_pos hp) (hP.arrival j hp) have hm := hP.mar j true true have hmass : cellContribution P j = cellProb P j * (P.1.real {r | inCell r j ∧ r.R = true ∧ r.Y = true} / arrivedCell P j) := by simp [cellContribution, cellMean, ha] rw [hmass] have : arrivedCell P j ≠ 0 := ne_of_gt ha calc cellProb P j * (P.1.real {r | inCell r j ∧ r.R = true ∧ r.Y = true} / arrivedCell P j) = (P.1.real {r | inCell r j ∧ r.R = true ∧ r.Y = true} * cellProb P j) / arrivedCell P j := by ring _ = P.1.real {r | inCell r j ∧ r.Y = true} := by rw [hm] have ha' : P.1.real {r | inCell r j ∧ r.R = true} ≠ 0 := by simpa only [arrivedCell] using this exact mul_div_cancel_left₀ _ ha' · have hzero : cellProb P j = 0 := le_antisymm (le_of_not_gt hp) (measureReal_nonneg) have hsub : P.1.real {r | inCell r j ∧ r.Y = true} ≤ cellProb P j := by exact measureReal_mono (by intro r hr; exact hr.1) have hy : P.1.real {r | inCell r j ∧ r.Y = true} = 0 := le_antisymm (hsub.trans_eq hzero) measureReal_nonneg have ha : arrivedCell P j = 0 := le_antisymm ((measureReal_mono (by intro r hr; exact hr.1)).trans_eq hzero) measureReal_nonneg simp [cellContribution, ha, hy]
CausalSmith.Stat.MarRareqLogfrontier.cellContribution_eq_cellOutcomeMass · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Identification.lean:14
theorem sum_cellOutcomeMass_eq_armOutcomeMass

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
P :
a :
(∑ x : Fin d, ∑ s : Bool, P.1.real {r | inCell r (a, x, s) ∧ r.Y = true})
= P.1.real {r | r.A = a ∧ r.Y = true}
Proof (Lean source)
lemma sum_cellOutcomeMass_eq_armOutcomeMass {d : ℕ} (P : FullLaw d) (a : Bool) : (∑ x : Fin d, ∑ s : Bool, P.1.real {r | inCell r (a, x, s) ∧ r.Y = true}) = P.1.real {r | r.A = a ∧ r.Y = true} := by classical letI : IsProbabilityMeasure P.1 := P.2 let μ := P.1.restrict {r | r.A = a ∧ r.Y = true} have hμ : IsFiniteMeasure μ := inferInstance have hsum := sum_measureReal_preimage_singleton (μ := μ) (Finset.univ : Finset (Fin d × Bool)) (f := fun r : FullRecord d => (r.X, r.S)) (by intro; simp) calc (∑ x : Fin d, ∑ s : Bool, P.1.real {r | inCell r (a, x, s) ∧ r.Y = true}) = ∑ j : Fin d × Bool, μ.real ((fun r : FullRecord d => (r.X, r.S)) ⁻¹' {j}) := by rw [← Finset.sum_product'] apply Finset.sum_congr rfl intro x hx simp only [μ, measureReal_def, Measure.restrict_apply] have hs : {r : FullRecord d | inCell r (a, x.1, x.2) ∧ r.Y = true} = ((fun r : FullRecord d => (r.X, r.S)) ⁻¹' {x}) ∩ {r | r.A = a ∧ r.Y = true} := by rcases x with ⟨x, s⟩ ext r simp only [Set.mem_ofPred_eq, Set.mem_inter_iff, Set.mem_preimage, Set.mem_singleton_iff, Prod.mk.injEq, inCell] tauto rw [hs] rw [Measure.restrict_apply (by simp)] _ = μ.real ((fun r : FullRecord d => (r.X, r.S)) ⁻¹' (Finset.univ : Finset (Fin d × Bool))) := hsum _ = P.1.real {r | r.A = a ∧ r.Y = true} := by simp [μ, measureReal_def, Measure.restrict_apply]
CausalSmith.Stat.MarRareqLogfrontier.sum_cellOutcomeMass_eq_armOutcomeMass · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Identification.lean:55
theorem randomized_armOutcomeMass

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
P :
a :
2 * P.1.real {r | r.A = a ∧ r.Y = true} = P.1.real {r | (if a then r.Y1 else r.Y0) = true}
Proof (Lean source)
lemma randomized_armOutcomeMass {d : ℕ} (P : FullLaw d) (hR : RandomizedIndependence P) (hB : BalancedRandomization P) (a : Bool) : 2 * P.1.real {r | r.A = a ∧ r.Y = true} = P.1.real {r | (if a then r.Y1 else r.Y0) = true} := by classical letI : IsProbabilityMeasure P.1 := P.2 let y : FullRecord d → Bool := fun r => if a then r.Y1 else r.Y0 have hInd : IndepFun (fun r : FullRecord d => r.A) y P.1 := by have h := hR.comp (φ := id) (ψ := fun z : Fin d × Bool × Bool × Bool × Bool => if a then z.2.2.2.2 else z.2.2.2.1) (by fun_prop) (by fun_prop) simpa [y, Function.comp_def] using h have hm := hInd.measure_inter_preimage_eq_mul ({a} : Set Bool) ({true} : Set Bool) (by simp) (by simp) change P.1 {r | r.A = a ∧ y r = true} = P.1 {r | r.A = a} * P.1 {r | y r = true} at hm have hmreal : P.1.real {r | r.A = a ∧ y r = true} = P.1.real {r | r.A = a} * P.1.real {r | y r = true} := by simpa only [measureReal_def, ENNReal.toReal_mul] using congrArg ENNReal.toReal hm have ha : P.1.real {r | r.A = a} = 1 / 2 := by cases a with | true => exact hB | false => have hcomp : {r : FullRecord d | r.A = false} = {r : FullRecord d | r.A = true}ᶜ := by ext r; cases r.A <;> simp rw [hcomp, measureReal_compl (by simp), hB] norm_num rw [show {r : FullRecord d | r.A = a ∧ r.Y = true} = {r | r.A = a ∧ y r = true} from by ext r simp only [Set.mem_setOf_eq] constructor · rintro ⟨h, hy⟩ simpa [y, FullRecord.Y, h] using hy · rintro ⟨h, hy⟩ exact ⟨h, by simpa [y, FullRecord.Y, h] using hy⟩] rw [hmreal, ha] simp [y]
CausalSmith.Stat.MarRareqLogfrontier.randomized_armOutcomeMass · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Identification.lean:90
theorem cellFunctional_eq_armOutcomeMass

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
P :
= 2 * (P.1.real {r | r.A = true ∧ r.Y = true} - P.1.real {r | r.A = false ∧ r.Y = true})
Proof (Lean source)
lemma cellFunctional_eq_armOutcomeMass {n d : ℕ} {q : ℝ} (P : FullLaw d) (hP : UnrestrictedArrivalModelClass n d q P) : cellFunctional P = 2 * (P.1.real {r | r.A = true ∧ r.Y = true} - P.1.real {r | r.A = false ∧ r.Y = true}) := by classical unfold cellFunctional rw [Fintype.sum_prod_type] simp_rw [cellContribution_eq_cellOutcomeMass P hP] simp [Fintype.univ_bool, armSign, Fintype.sum_prod_type] have ht := sum_cellOutcomeMass_eq_armOutcomeMass P true have hf := sum_cellOutcomeMass_eq_armOutcomeMass P false simp [Fintype.univ_bool] at ht hf rw [ht, hf] ring
CausalSmith.Stat.MarRareqLogfrontier.cellFunctional_eq_armOutcomeMass · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Identification.lean:133
theorem ate_eq_potentialOutcomeMass

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
P :
ate P = P.1.real {r | r.Y1 = true} - P.1.real {r | r.Y0 = true}
Proof (Lean source)
lemma ate_eq_potentialOutcomeMass {d : ℕ} (P : FullLaw d) : ate P = P.1.real {r | r.Y1 = true} - P.1.real {r | r.Y0 = true} := by classical letI : IsProbabilityMeasure P.1 := P.2 have hv (a : Bool) : (fun r : FullRecord d => if (if a then r.Y1 else r.Y0) then (1 : ℝ) else 0) = ({r : FullRecord d | (if a then r.Y1 else r.Y0) = true}.indicator 1) := by funext r rcases r with ⟨x, a', s₀, s₁, y₀, y₁, arrival⟩ cases a <;> cases y₀ <;> cases y₁ <;> simp [indicator] have hi (a : Bool) : Integrable (fun r : FullRecord d => if (if a then r.Y1 else r.Y0) then (1 : ℝ) else 0) P.1 := by rw [hv] exact (integrable_const (1 : ℝ)).indicator (by simp) have he (a : Bool) : (∫ r : FullRecord d, (if (if a then r.Y1 else r.Y0) then (1 : ℝ) else 0) ∂P.1) = P.1.real {r | (if a then r.Y1 else r.Y0) = true} := by rw [hv] exact integral_indicator_one (by simp) unfold ate rw [integral_sub (by simpa using hi true) (by simpa using hi false)] simpa using congrArg₂ (· - ·) (he true) (he false)
CausalSmith.Stat.MarRareqLogfrontier.ate_eq_potentialOutcomeMass · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Identification.lean:151
theorem unrestricted_cell_identification

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
P :
ate P = cellFunctional P
Proof (Lean source)
lemma unrestricted_cell_identification {n d : ℕ} {q : ℝ} (P : FullLaw d) (hP : UnrestrictedArrivalModelClass n d q P) : ate P = cellFunctional P := by rw [ate_eq_potentialOutcomeMass P, cellFunctional_eq_armOutcomeMass P hP] have ht := randomized_armOutcomeMass P hP.randomized hP.balanced true have hf := randomized_armOutcomeMass P hP.randomized hP.balanced false have ht' : 2 * P.1.real {r | r.A = true ∧ r.Y = true} = P.1.real {r | r.Y1 = true} := by simpa using ht have hf' : 2 * P.1.real {r | r.A = false ∧ r.Y = true} = P.1.real {r | r.Y0 = true} := by simpa using hf linear_combination -ht' + hf'
CausalSmith.Stat.MarRareqLogfrontier.unrestricted_cell_identification · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Identification.lean:178
theorem cell_identification_background

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
P :
hP :
ate P = cellFunctional P
Proof (Lean source)
lemma cell_identification_background {n d : ℕ} {q : ℝ} (P : FullLaw d) (hP : RareArrivalModelClass n d q P) : ate P = cellFunctional P := by apply unrestricted_cell_identification P exact { n_pos := hP.n_pos d_pos := hP.d_pos q_pos := hP.q_pos q_le_one := hP.q_le_one randomized := hP.randomized balanced := hP.balanced surrogate := hP.surrogate outcome := hP.outcome mar := hP.mar arrival := hP.arrival }
CausalSmith.Stat.MarRareqLogfrontier.cell_identification_background · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Identification.lean:192
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.IntervalConcentration 7 declarations Variance and Chebyshev concentration of the latent rare-cell target in equations (8) and (12) of the connected-interval lower bound.

Variance and Chebyshev concentration of the latent rare-cell target in equations (8) and (12) of the connected-interval lower bound. The connection of this target to the activated full-law ATE is supplied separately.

theorem finiteReciprocalPrior_reciprocal_ae_unit Lemma finiteReciprocalPrior_reciprocal_ae_unit in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
H :
ℝ
π :
∀ᵐ z ∂π, z⁻¹ ∈ Icc (0 : ℝ) 1
Proof (Lean source)
-- @node: finiteReciprocalPrior_reciprocal_ae_unit lemma finiteReciprocalPrior_reciprocal_ae_unit {H : ℝ} {π : Measure ℝ} (hπ : FiniteReciprocalPrior H π) : ∀ᵐ z ∂π, z⁻¹ ∈ Icc (0 : ℝ) 1 := by letI := hπ.1 obtain ⟨s, hs, hsupport⟩ := hπ.2 have hae : ∀ᵐ z ∂π, z ∈ (s : Set ℝ) := (ae_mem_iff_measure_eq s.measurableSet.nullMeasurableSet).2 (by simpa using hs) filter_upwards [hae] with z hz have hlow := (hsupport z hz).1 exact ⟨inv_nonneg.mpr (by linarith), inv_le_one_of_one_le₀ hlow⟩
CausalSmith.Stat.MarRareqLogfrontier.finiteReciprocalPrior_reciprocal_ae_unit · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/IntervalConcentration.lean:17

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
J :
ℕ
b :
ℝ
z :
Fin J → ℝ
intervalPriorTarget J b z :
ℝ
b * ∑ i, (z i)⁻¹
CausalSmith.Stat.MarRareqLogfrontier.intervalPriorTarget · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/IntervalConcentration.lean:29
theorem intervalPriorTarget_integral

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
H :
ℝ
π :
J :
ℕ
b :
ℝ
(∫ z, intervalPriorTarget J b z ∂Measure.pi (fun _ : Fin J => π))
= (J : ℝ) * b * ∫ z, z⁻¹ ∂π
Proof (Lean source)
-- @node: intervalPriorTarget_integral lemma intervalPriorTarget_integral {H : ℝ} {π : Measure ℝ} (hπ : FiniteReciprocalPrior H π) (J : ℕ) (b : ℝ) : (∫ z, intervalPriorTarget J b z ∂Measure.pi (fun _ : Fin J => π)) = (J : ℝ) * b * ∫ z, z⁻¹ ∂π := by letI := hπ.1 have hf : Integrable (fun z : ℝ => z⁻¹) π := finiteReciprocalPrior_integrable hπ _ unfold intervalPriorTarget rw [integral_const_mul, integral_finsetSum] · simp_rw [integral_comp_eval (μ := fun _ : Fin J => π) hf.aestronglyMeasurable] simp only [Finset.sum_const, Finset.card_fin, nsmul_eq_mul] ring · intro i hi exact integrable_comp_eval (μ := fun _ : Fin J => π) (i := i) hf
CausalSmith.Stat.MarRareqLogfrontier.intervalPriorTarget_integral · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/IntervalConcentration.lean:34
theorem intervalPriorTarget_variance_le

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
H :
ℝ
π :
J :
ℕ
b :
ℝ
variance (intervalPriorTarget J b) (Measure.pi (fun _ : Fin J => π)) ≤ (J : ℝ) * b ^ 2 / 4
Proof (Lean source)
-- @node: intervalPriorTarget_variance_le lemma intervalPriorTarget_variance_le {H : ℝ} {π : Measure ℝ} (hπ : FiniteReciprocalPrior H π) (J : ℕ) (b : ℝ) : variance (intervalPriorTarget J b) (Measure.pi (fun _ : Fin J => π)) ≤ (J : ℝ) * b ^ 2 / 4 := by letI := hπ.1 have hbound := finiteReciprocalPrior_reciprocal_ae_unit hπ have hf : MemLp (fun z : ℝ => z⁻¹) 2 π := memLp_of_bounded hbound (by fun_prop) 2 have hvar : variance (fun z : ℝ => z⁻¹) π ≤ 1 / 4 := by have h := variance_le_sq_of_bounded hbound (show AEMeasurable (fun z : ℝ => z⁻¹) π by fun_prop) norm_num at h ⊢ exact h unfold intervalPriorTarget rw [variance_const_mul] have heq : (fun z : Fin J → ℝ => ∑ i, (z i)⁻¹) = ∑ i : Fin J, fun z : Fin J → ℝ => (z i)⁻¹ := by funext z simp only [Finset.sum_apply] rw [heq, variance_sum_pi (fun _ => hf)] simp only [Finset.sum_const, Finset.card_fin, nsmul_eq_mul] nlinarith [mul_le_mul_of_nonneg_left hvar (show 0 ≤ (J : ℝ) * b ^ 2 by positivity)]
CausalSmith.Stat.MarRareqLogfrontier.intervalPriorTarget_variance_le · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/IntervalConcentration.lean:50
theorem intervalPriorTarget_chebyshev

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
H :
ℝ
π :
J :
ℕ
b w :
ℝ
hw :
0 < w
(Measure.pi (fun _ : Fin J => π)).real {z | w < |intervalPriorTarget J b z - (J : ℝ) * b * ∫ z, z⁻¹ ∂π|}
≤ ((J : ℝ) * b ^ 2 / 4) / w ^ 2
Proof (Lean source)
-- @node: intervalPriorTarget_chebyshev lemma intervalPriorTarget_chebyshev {H : ℝ} {π : Measure ℝ} (hπ : FiniteReciprocalPrior H π) (J : ℕ) (b w : ℝ) (hw : 0 < w) : (Measure.pi (fun _ : Fin J => π)).real {z | w < |intervalPriorTarget J b z - (J : ℝ) * b * ∫ z, z⁻¹ ∂π|} ≤ ((J : ℝ) * b ^ 2 / 4) / w ^ 2 := by letI := hπ.1 have hf : MemLp (fun z : ℝ => z⁻¹) 2 π := memLp_of_bounded (finiteReciprocalPrior_reciprocal_ae_unit hπ) (by fun_prop) 2 have hsum : MemLp (intervalPriorTarget J b) 2 (Measure.pi (fun _ : Fin J => π)) := by have heq : intervalPriorTarget J b = fun z : Fin J → ℝ => b * (∑ i : Fin J, fun z : Fin J → ℝ => (z i)⁻¹) z := by funext z simp [intervalPriorTarget, Finset.sum_apply] rw [heq] exact (memLp_finsetSum' univ fun i hi => hf.comp_measurePreserving (measurePreserving_eval (fun _ : Fin J => π) i)).const_mul b have htail := meas_ge_le_variance_div_sq hsum hw rw [intervalPriorTarget_integral hπ J b] at htail have hmono : (Measure.pi (fun _ : Fin J => π)) {z | w < |intervalPriorTarget J b z - (J : ℝ) * b * ∫ z, z⁻¹ ∂π|} ≤ ofReal (((J : ℝ) * b ^ 2 / 4) / w ^ 2) := by have hsubset : {z : Fin J → ℝ | w < |intervalPriorTarget J b z - (J : ℝ) * b * ∫ z, z⁻¹ ∂π|} ⊆ {z | w ≤ |intervalPriorTarget J b z - (J : ℝ) * b * ∫ z, z⁻¹ ∂π|} := by intro z hz simp only [Set.mem_setOf_eq] at hz ⊢ exact le_of_lt hz refine (measure_mono hsubset).trans (htail.trans ?_) exact ENNReal.ofReal_le_ofReal (div_le_div_of_nonneg_right (intervalPriorTarget_variance_le hπ J b) (sq_nonneg w)) have hreal := ENNReal.toReal_mono (by simp) hmono simpa only [Measure.real, ENNReal.toReal_ofReal (by positivity : 0 ≤ ((J : ℝ) * b ^ 2 / 4) / w ^ 2)] using hreal
CausalSmith.Stat.MarRareqLogfrontier.intervalPriorTarget_chebyshev · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/IntervalConcentration.lean:74
theorem intervalPriorTarget_concentration_budget

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
H :
ℝ
π :
J M :
ℕ
b Δ u :
ℝ
hb :
0 < b
hΔ :
0 < Δ
hu :
0 < u
hM :
1 ≤ M
hgap :
(J : ℝ) * b / 12 ≤ Δ
hJ :
18432 * (M : ℝ) ^ 2 / u ≤ (J : ℝ)
(Measure.pi (fun _ : Fin J => π)).real {z | Δ / (8 * M) < |intervalPriorTarget J b z - (J : ℝ) * b * ∫ z, z⁻¹ ∂π|}
≤ u / 8
Proof (Lean source)
-- @node: intervalPriorTarget_concentration_budget lemma intervalPriorTarget_concentration_budget {H : ℝ} {π : Measure ℝ} (hπ : FiniteReciprocalPrior H π) (J M : ℕ) (b Δ u : ℝ) (hb : 0 < b) (hΔ : 0 < Δ) (hu : 0 < u) (hM : 1 ≤ M) (hgap : (J : ℝ) * b / 12 ≤ Δ) (hJ : 18432 * (M : ℝ) ^ 2 / u ≤ (J : ℝ)) : (Measure.pi (fun _ : Fin J => π)).real {z | Δ / (8 * M) < |intervalPriorTarget J b z - (J : ℝ) * b * ∫ z, z⁻¹ ∂π|} ≤ u / 8 := by have hMr : 0 < (M : ℝ) := by exact_mod_cast (by omega : 0 < M) have hJr : 0 < (J : ℝ) := lt_of_lt_of_le (by positivity) hJ have hJu : 18432 * (M : ℝ) ^ 2 ≤ (J : ℝ) * u := (div_le_iff₀ hu).mp hJ apply (intervalPriorTarget_chebyshev hπ J b (Δ / (8 * M)) (by positivity)).trans apply (div_le_iff₀ (by positivity : 0 < (Δ / (8 * M)) ^ 2)).mpr have hsq : ((J : ℝ) * b) ^ 2 ≤ 144 * Δ ^ 2 := by have hlinear : (J : ℝ) * b ≤ 12 * Δ := by linarith have hs := mul_self_le_mul_self (by positivity : 0 ≤ (J : ℝ) * b) hlinear nlinarith have hprod := mul_le_mul_of_nonneg_left hsq hu.le have hcount := mul_le_mul_of_nonneg_right hJu (sq_nonneg b) field_simp nlinarith
CausalSmith.Stat.MarRareqLogfrontier.intervalPriorTarget_concentration_budget · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/IntervalConcentration.lean:111
theorem intervalInterpolatedPrior_grid_concentration

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
H :
ℝ
π₀ π₁ :
h₀ :
h₁ :
J M :
ℕ
b u :
ℝ
hb :
0 < b
hu :
0 < u
hM :
1 ≤ M
hgap :
1 / 12 ≤ |(∫ z, z⁻¹ ∂π₁) - ∫ z, z⁻¹ ∂π₀|
hJ :
18432 * (M : ℝ) ^ 2 / u ≤ (J : ℝ)
j :
Fin (M + 1)
(Measure.pi (fun _ : Fin J => intervalInterpolatedPrior π₀ π₁ ((j : ℝ) / M))).real {z | ((J : ℝ) * b * |(∫ z, z⁻¹ ∂π₁) - ∫ z, z⁻¹ ∂π₀|) / (8 * M) < |intervalPriorTarget J b z - ((J : ℝ) * b * (∫ z, z⁻¹ ∂π₀) + (j : ℝ) * ((J : ℝ) * b * ((∫ z, z⁻¹ ∂π₁) - ∫ z, z⁻¹ ∂π₀) / M))|}
≤ u / 8
Proof (Lean source)
-- @node: intervalInterpolatedPrior_grid_concentration lemma intervalInterpolatedPrior_grid_concentration {H : ℝ} {π₀ π₁ : Measure ℝ} (h₀ : FiniteReciprocalPrior H π₀) (h₁ : FiniteReciprocalPrior H π₁) (J M : ℕ) (b u : ℝ) (hb : 0 < b) (hu : 0 < u) (hM : 1 ≤ M) (hgap : 1 / 12 ≤ |(∫ z, z⁻¹ ∂π₁) - ∫ z, z⁻¹ ∂π₀|) (hJ : 18432 * (M : ℝ) ^ 2 / u ≤ (J : ℝ)) : ∀ j : Fin (M + 1), (Measure.pi (fun _ : Fin J => intervalInterpolatedPrior π₀ π₁ ((j : ℝ) / M))).real {z | ((J : ℝ) * b * |(∫ z, z⁻¹ ∂π₁) - ∫ z, z⁻¹ ∂π₀|) / (8 * M) < |intervalPriorTarget J b z - ((J : ℝ) * b * (∫ z, z⁻¹ ∂π₀) + (j : ℝ) * ((J : ℝ) * b * ((∫ z, z⁻¹ ∂π₁) - ∫ z, z⁻¹ ∂π₀) / M))|} ≤ u / 8 := by have hMr : 0 < (M : ℝ) := by exact_mod_cast (by omega : 0 < M) have hJr : 0 < (J : ℝ) := lt_of_lt_of_le (by positivity) hJ have hdiff : 0 < |(∫ z, z⁻¹ ∂π₁) - ∫ z, z⁻¹ ∂π₀| := lt_of_lt_of_le (by norm_num) hgap intro j have ht : (j : ℝ) / M ∈ Icc (0 : ℝ) 1 := by refine ⟨by positivity, (div_le_one hMr).mpr ?_⟩ exact_mod_cast (by omega : j.val ≤ M) have hprior := finiteReciprocalPrior_interpolate h₀ h₁ ht have hsegment : (J : ℝ) * b / 12 ≤ (J : ℝ) * b * |(∫ z, z⁻¹ ∂π₁) - ∫ z, z⁻¹ ∂π₀| := by nlinarith [mul_le_mul_of_nonneg_left hgap (show 0 ≤ (J : ℝ) * b by positivity)] have htail := intervalPriorTarget_concentration_budget hprior J M b ((J : ℝ) * b * |(∫ z, z⁻¹ ∂π₁) - ∫ z, z⁻¹ ∂π₀|) u hb (by positivity) hu hM hsegment hJ have hmean : (J : ℝ) * b * (∫ z, z⁻¹ ∂intervalInterpolatedPrior π₀ π₁ ((j : ℝ) / M)) = (J : ℝ) * b * (∫ z, z⁻¹ ∂π₀) + (j : ℝ) * ((J : ℝ) * b * ((∫ z, z⁻¹ ∂π₁) - ∫ z, z⁻¹ ∂π₀) / M) := by rw [intervalInterpolatedPrior_integral h₀ h₁ ht] ring simpa only [hmean] using htail
CausalSmith.Stat.MarRareqLogfrontier.intervalInterpolatedPrior_grid_concentration · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/IntervalConcentration.lean:135
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.IntervalNeighborhood 7 declarations Neighborhood coverage transfer and expected length for the many-prior interval argument.

Neighborhood coverage transfer and expected length for the many-prior interval argument.

theorem connectedInterval_neighborhood_iff

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
t w :
ℝ
hw :
0 ≤ w
(∃ x : ℝ, I.lo ≤ x ∧ x ≤ I.hi ∧ |x - t| ≤ w) ↔ t ∈ Icc (I.lo - w) (I.hi + w)
Proof (Lean source)
-- @node: connectedInterval_neighborhood_iff lemma connectedInterval_neighborhood_iff (I : ConnectedInterval) (t w : ℝ) (hw : 0 ≤ w) : (∃ x : ℝ, I.lo ≤ x ∧ x ≤ I.hi ∧ |x - t| ≤ w) ↔ t ∈ Icc (I.lo - w) (I.hi + w) := by constructor · rintro ⟨x, hxlo, hxhi, hx⟩ rcases abs_le.mp hx with ⟨hx0, hx1⟩ constructor <;> linarith · rintro ⟨ht0, ht1⟩ refine ⟨max I.lo (t - w), le_max_left _ _, ?_, ?_⟩ · exact max_le I.ordered (by linarith) · rw [abs_le] constructor · have := le_max_right I.lo (t - w) linarith · have : max I.lo (t - w) ≤ t + w := max_le (by linarith) (by linarith) linarith
CausalSmith.Stat.MarRareqLogfrontier.connectedInterval_neighborhood_iff · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/IntervalNeighborhood.lean:15
theorem connectedInterval_measurableSet_neighborhood

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
θ w :
ℝ
hw :
0 ≤ w
MeasurableSet {I : ConnectedInterval | ∃ x : ℝ, I.lo ≤ x ∧ x ≤ I.hi ∧ |x - θ| ≤ w}
Proof (Lean source)
-- @node: connectedInterval_measurableSet_neighborhood lemma connectedInterval_measurableSet_neighborhood (θ w : ℝ) (hw : 0 ≤ w) : MeasurableSet {I : ConnectedInterval | ∃ x : ℝ, I.lo ≤ x ∧ x ≤ I.hi ∧ |x - θ| ≤ w} := by have hF : Measurable (fun I : ConnectedInterval => (I.lo, I.hi, I.closedLeft, I.closedRight)) := by exact (measurable_fst.comp measurable_subtype_coe).prodMk ((measurable_snd.comp measurable_subtype_coe).prodMk (measurable_const.prodMk measurable_const)) have hlo : Measurable (fun I : ConnectedInterval => I.lo - w) := by first | fun_prop | exact (measurable_connectedInterval_lo).sub_const w have hhi : Measurable (fun I : ConnectedInterval => I.hi + w) := by first | fun_prop | exact (measurable_connectedInterval_hi).add_const w have heq : {I : ConnectedInterval | ∃ x : ℝ, I.lo ≤ x ∧ x ≤ I.hi ∧ |x - θ| ≤ w} = {I | I.lo - w ≤ θ} ∩ {I | θ ≤ I.hi + w} := by ext I exact connectedInterval_neighborhood_iff I θ w hw rw [heq] exact (measurableSet_le hlo measurable_const).inter (measurableSet_le measurable_const hhi)
CausalSmith.Stat.MarRareqLogfrontier.connectedInterval_measurableSet_neighborhood · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/IntervalNeighborhood.lean:35
theorem connectedInterval_joint_neighborhood_coverage

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
θ w u ε :
ℝ
hcoverage :
u ≤ μ.real {z | intervalContains z.2 z.1}
hconcentration :
μ.real {z | w < |z.1 - θ|} ≤ ε
u - ε ≤ μ.real {z | ∃ x : ℝ, z.2.lo ≤ x ∧ x ≤ z.2.hi ∧ |x - θ| ≤ w}
Proof (Lean source)
-- @node: connectedInterval_joint_neighborhood_coverage lemma connectedInterval_joint_neighborhood_coverage (μ : Measure (ℝ × ConnectedInterval)) [IsProbabilityMeasure μ] (θ w u ε : ℝ) (hcoverage : u ≤ μ.real {z | intervalContains z.2 z.1}) (hconcentration : μ.real {z | w < |z.1 - θ|} ≤ ε) : u - ε ≤ μ.real {z | ∃ x : ℝ, z.2.lo ≤ x ∧ x ≤ z.2.hi ∧ |x - θ| ≤ w} := by have hsubset : {z : ℝ × ConnectedInterval | intervalContains z.2 z.1} ⊆ {z | ∃ x : ℝ, z.2.lo ≤ x ∧ x ≤ z.2.hi ∧ |x - θ| ≤ w} ∪ {z | w < |z.1 - θ|} := by intro z hz by_cases hnear : |z.1 - θ| ≤ w · left have hlo : z.2.lo ≤ z.1 := by have h := hz.1 change (if z.2.closedLeft then z.2.lo ≤ z.1 else z.2.lo < z.1) at h split at h · exact h · exact h.le have hhi : z.1 ≤ z.2.hi := by have h := hz.2 change (if z.2.closedRight then z.1 ≤ z.2.hi else z.1 < z.2.hi) at h split at h · exact h · exact h.le exact ⟨z.1, hlo, hhi, hnear⟩ · exact inr (lt_of_not_ge hnear) have hmono := measureReal_mono (μ := μ) hsubset have hunion := measureReal_union_le (μ := μ) {z | ∃ x : ℝ, z.2.lo ≤ x ∧ x ≤ z.2.hi ∧ |x - θ| ≤ w} {z | w < |z.1 - θ|} linarith
CausalSmith.Stat.MarRareqLogfrontier.connectedInterval_joint_neighborhood_coverage · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/IntervalNeighborhood.lean:58
theorem connectedInterval_prior_neighborhood_coverage

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
θ w u ε :
ℝ
hw :
0 ≤ w
hcoverage :
u ≤ μ.real {z | intervalContains z.2 z.1}
hconcentration :
μ.real {z | w < |z.1 - θ|} ≤ ε
u - ε ≤ (μ.map snd).real {I | ∃ x : ℝ, I.lo ≤ x ∧ x ≤ I.hi ∧ |x - θ| ≤ w}
Proof (Lean source)
-- @node: connectedInterval_prior_neighborhood_coverage lemma connectedInterval_prior_neighborhood_coverage (μ : Measure (ℝ × ConnectedInterval)) [IsProbabilityMeasure μ] (θ w u ε : ℝ) (hw : 0 ≤ w) (hcoverage : u ≤ μ.real {z | intervalContains z.2 z.1}) (hconcentration : μ.real {z | w < |z.1 - θ|} ≤ ε) : u - ε ≤ (μ.map snd).real {I | ∃ x : ℝ, I.lo ≤ x ∧ x ≤ I.hi ∧ |x - θ| ≤ w} := by rw [map_measureReal_apply measurable_snd (connectedInterval_measurableSet_neighborhood θ w hw)] exact connectedInterval_joint_neighborhood_coverage μ θ w u ε hcoverage hconcentration
CausalSmith.Stat.MarRareqLogfrontier.connectedInterval_prior_neighborhood_coverage · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/IntervalNeighborhood.lean:93
theorem connectedInterval_expected_neighborhood_length_of_tv

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
M :
ℕ
ν :
θ δ w p ε :
ℝ
hδ :
0 < δ
hw :
0 ≤ w
hhit :
∀ j : Fin (M + 1),
p ≤ (ν j).real {I | ∃ x : ℝ, I.lo ≤ x ∧ x ≤ I.hi ∧ |x - (θ + (j : ℝ) * δ)| ≤ w}
htv :
∀ j, tvDist ν₀ (ν j) ≤ ε
δ * (((M + 1 : ℕ) : ℝ) * (p - ε) - 1) - 2 * w ≤ ∫ I : ConnectedInterval, I.hi - I.lo ∂ν₀
Proof (Lean source)
-- @node: connectedInterval_expected_neighborhood_length_of_tv lemma connectedInterval_expected_neighborhood_length_of_tv (ν₀ : Measure ConnectedInterval) [IsProbabilityMeasure ν₀] (M : ℕ) (ν : Fin (M + 1) → Measure ConnectedInterval) [∀ j, IsProbabilityMeasure (ν j)] (θ δ w p ε : ℝ) (hδ : 0 < δ) (hw : 0 ≤ w) (hhit : ∀ j : Fin (M + 1), p ≤ (ν j).real {I | ∃ x : ℝ, I.lo ≤ x ∧ x ≤ I.hi ∧ |x - (θ + (j : ℝ) * δ)| ≤ w}) (htv : ∀ j, tvDist ν₀ (ν j) ≤ ε) : δ * (((M + 1 : ℕ) : ℝ) * (p - ε) - 1) - 2 * w ≤ ∫ I : ConnectedInterval, I.hi - I.lo ∂ν₀ := by have hF : Measurable (fun I : ConnectedInterval => (I.lo, I.hi, I.closedLeft, I.closedRight)) := by exact (measurable_fst.comp measurable_subtype_coe).prodMk ((measurable_snd.comp measurable_subtype_coe).prodMk (measurable_const.prodMk measurable_const)) have hlo : Measurable (fun I : ConnectedInterval => I.lo - w) := by first | fun_prop | exact (measurable_connectedInterval_lo).sub_const w have hhi : Measurable (fun I : ConnectedInterval => I.hi + w) := by first | fun_prop | exact (measurable_connectedInterval_hi).add_const w let L : ConnectedInterval → ℝ := fun I => I.lo - w let U : ConnectedInterval → ℝ := fun I => I.hi + w have hcoverage : ∀ j : Fin (M + 1), p - ε ≤ ν₀.real (coverageEvent L U (gridPoint θ δ j)) := by intro j have heq : {I : ConnectedInterval | ∃ x : ℝ, I.lo ≤ x ∧ x ≤ I.hi ∧ |x - (θ + (j : ℝ) * δ)| ≤ w} = coverageEvent L U (gridPoint θ δ j) := by ext I exact connectedInterval_neighborhood_iff I _ w hw have hh := hhit j rw [heq] at hh have hgap := measureReal_sub_le_tvDist (μ := ν₀) (ν := ν j) (A := coverageEvent L U (gridPoint θ δ j)) (measurableSet_coverageEvent hlo hhi) linarith [htv j] have hbound := expected_interval_length_lower_of_grid ν₀ M θ δ (p - ε) hlo hhi hδ hcoverage have hlen : Integrable (fun I : ConnectedInterval => I.hi - I.lo) ν₀ := Integrable.of_bound ((measurable_connectedInterval_hi).sub (measurable_connectedInterval_lo)).aestronglyMeasurable 2 (Filter.Eventually.of_forall (fun I => by rw [Real.norm_eq_abs, abs_of_nonneg (sub_nonneg.mpr I.ordered)] linarith [I.lower, I.upper])) have hexpand : ∀ I : ConnectedInterval, intervalLength (I.lo - w) (I.hi + w) = (I.hi - I.lo) + 2 * w := by intro I dsimp [intervalLength, L, U] rw [max_eq_right (by have h := I.2.2.1; linarith)] ring simp_rw [hexpand] at hbound have hlenw : Integrable (fun I : ConnectedInterval => (I.hi - I.lo) + 2 * w) ν₀ := hlen.add (integrable_const (2 * w)) rw [← ofReal_integral_eq_lintegral_ofReal hlenw (Filter.Eventually.of_forall (fun I => by change 0 ≤ I.hi - I.lo + 2 * w linarith [I.ordered]))] at hbound have hreal := (ENNReal.ofReal_le_ofReal_iff (integral_nonneg (fun I => by change 0 ≤ I.hi - I.lo + 2 * w linarith [I.ordered]))).mp hbound have heq : (∫ I : ConnectedInterval, (I.hi - I.lo) + 2 * w ∂ν₀) = (∫ I : ConnectedInterval, I.hi - I.lo ∂ν₀) + 2 * w := by integral_linearity simp rw [heq] at hreal linarith
CausalSmith.Stat.MarRareqLogfrontier.connectedInterval_expected_neighborhood_length_of_tv · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/IntervalNeighborhood.lean:107
theorem connectedInterval_many_prior_length_floor

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
M :
ℕ
ν :
θ Δ u :
ℝ
hΔ :
0 < Δ
hu :
0 < u
hM :
8 / u ≤ (M : ℝ)
hhit :
∀ j : Fin (M + 1),
7 * u / 8
≤ (ν j).real {I | ∃ x : ℝ, I.lo ≤ x ∧ x ≤ I.hi ∧ |x - (θ + (j : ℝ) * (Δ / M))| ≤ Δ / (8 * M)}
htv :
∀ j, tvDist ν₀ (ν j) ≤ u / 16
(21 * u / 32) * Δ ≤ ∫ I : ConnectedInterval, I.hi - I.lo ∂ν₀
Proof (Lean source)
-- @node: connectedInterval_many_prior_length_floor lemma connectedInterval_many_prior_length_floor (ν₀ : Measure ConnectedInterval) [IsProbabilityMeasure ν₀] (M : ℕ) (ν : Fin (M + 1) → Measure ConnectedInterval) [∀ j, IsProbabilityMeasure (ν j)] (θ Δ u : ℝ) (hΔ : 0 < Δ) (hu : 0 < u) (hM : 8 / u ≤ (M : ℝ)) (hhit : ∀ j : Fin (M + 1), 7 * u / 8 ≤ (ν j).real {I | ∃ x : ℝ, I.lo ≤ x ∧ x ≤ I.hi ∧ |x - (θ + (j : ℝ) * (Δ / M))| ≤ Δ / (8 * M)}) (htv : ∀ j, tvDist ν₀ (ν j) ≤ u / 16) : (21 * u / 32) * Δ ≤ ∫ I : ConnectedInterval, I.hi - I.lo ∂ν₀ := by have hMr : 0 < (M : ℝ) := lt_of_lt_of_le (by positivity) hM have hMu : 8 ≤ (M : ℝ) * u := (div_le_iff₀ hu).mp hM have hbound := connectedInterval_expected_neighborhood_length_of_tv ν₀ M ν θ (Δ / M) (Δ / (8 * M)) (7 * u / 8) (u / 16) (by positivity) (by positivity) hhit htv apply le_trans ?_ hbound push_cast rw [show Δ / (M : ℝ) * (((M : ℝ) + 1) * (7 * u / 8 - u / 16) - 1) - 2 * (Δ / (8 * M)) = (Δ * (((M : ℝ) + 1) * (7 * u / 8 - u / 16) - 1) - Δ / 4) / M by ring] apply (le_div_iff₀ hMr).mpr have harith : (21 * u / 32) * Δ * M ≤ Δ * (((M : ℝ) + 1) * (7 * u / 8 - u / 16) - 1) - Δ / 4 := by nlinarith [mul_nonneg hΔ.le hu.le] exact harith
CausalSmith.Stat.MarRareqLogfrontier.connectedInterval_many_prior_length_floor · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/IntervalNeighborhood.lean:184
theorem connectedInterval_many_prior_length_of_joint_coverage

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
M :
ℕ
μ :
Fin (M + 1) → Measure (ℝ × ConnectedInterval)
∀ j, IsProbabilityMeasure (μ j)
θ Δ u :
ℝ
hΔ :
0 < Δ
hu :
0 < u
hM :
8 / u ≤ (M : ℝ)
hcoverage :
∀ j, u ≤ (μ j).real {z | intervalContains z.2 z.1}
hconcentration :
∀ j : Fin (M + 1), (μ j).real {z | Δ / (8 * M) < |z.1 - (θ + (j : ℝ) * (Δ / M))|} ≤ u / 8
htv :
∀ j, tvDist ((μ 0).map snd) ((μ j).map snd) ≤ u / 16
(21 * u / 32) * Δ ≤ ∫ I : ConnectedInterval, I.hi - I.lo ∂((μ 0).map snd)
Proof (Lean source)
-- @node: connectedInterval_many_prior_length_of_joint_coverage lemma connectedInterval_many_prior_length_of_joint_coverage (M : ℕ) (μ : Fin (M + 1) → Measure (ℝ × ConnectedInterval)) [∀ j, IsProbabilityMeasure (μ j)] (θ Δ u : ℝ) (hΔ : 0 < Δ) (hu : 0 < u) (hM : 8 / u ≤ (M : ℝ)) (hcoverage : ∀ j, u ≤ (μ j).real {z | intervalContains z.2 z.1}) (hconcentration : ∀ j : Fin (M + 1), (μ j).real {z | Δ / (8 * M) < |z.1 - (θ + (j : ℝ) * (Δ / M))|} ≤ u / 8) (htv : ∀ j, tvDist ((μ 0).map snd) ((μ j).map snd) ≤ u / 16) : (21 * u / 32) * Δ ≤ ∫ I : ConnectedInterval, I.hi - I.lo ∂((μ 0).map snd) := by have hMr : 0 < (M : ℝ) := lt_of_lt_of_le (by positivity) hM let ν : Fin (M + 1) → Measure ConnectedInterval := fun j => (μ j).map snd have (j : Fin (M + 1)) : IsProbabilityMeasure (ν j) := by dsimp [ν] exact Measure.isProbabilityMeasure_map measurable_snd.aemeasurable apply connectedInterval_many_prior_length_floor (ν 0) M ν θ Δ u hΔ hu hM · intro j have h := connectedInterval_prior_neighborhood_coverage (μ j) (θ + (j : ℝ) * (Δ / M)) (Δ / (8 * M)) u (u / 8) (by positivity) (hcoverage j) (hconcentration j) convert h using 1; ring · exact htv
CausalSmith.Stat.MarRareqLogfrontier.connectedInterval_many_prior_length_of_joint_coverage · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/IntervalNeighborhood.lean:212
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.IntervalPriors 7 declarations The finite interpolated reciprocal priors in equations (5) and (7) of the connected-interval lower bound.

The finite interpolated reciprocal priors in equations (5) and (7) of the connected-interval lower bound.

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
π₀ π₁ :
t :
ℝ
intervalInterpolatedPrior π₀ π₁ t :
ofReal (1 - t) • π₀ + ofReal t • π₁
CausalSmith.Stat.MarRareqLogfrontier.intervalInterpolatedPrior · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/IntervalPriors.lean:16
theorem finiteReciprocalPrior_integrable Lemma finiteReciprocalPrior_integrable in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
H :
ℝ
π :
f :
ℝ → ℝ
Proof (Lean source)
-- @node: finiteReciprocalPrior_integrable lemma finiteReciprocalPrior_integrable {H : ℝ} {π : Measure ℝ} (hπ : FiniteReciprocalPrior H π) (f : ℝ → ℝ) : Integrable f π := by let := hπ.1 obtain ⟨s, hs, _⟩ := hπ.2 have hae : ∀ᵐ z ∂π, z ∈ (s : Set ℝ) := (ae_mem_iff_measure_eq s.measurableSet.nullMeasurableSet).2 (by simpa using hs) have hres : π.restrict (s : Set ℝ) = π := Measure.restrict_eq_self_of_ae_mem hae have hi : IntegrableOn f (s : Set ℝ) π := IntegrableOn.of_finite s.finite_toSet simpa only [IntegrableOn, hres] using hi
CausalSmith.Stat.MarRareqLogfrontier.finiteReciprocalPrior_integrable · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/IntervalPriors.lean:21
theorem finiteReciprocalPrior_interpolate

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
H :
ℝ
π₀ π₁ :
h₀ :
h₁ :
t :
ℝ
ht :
t ∈ Icc (0 : ℝ) 1
Proof (Lean source)
-- @node: finiteReciprocalPrior_interpolate lemma finiteReciprocalPrior_interpolate {H : ℝ} {π₀ π₁ : Measure ℝ} (h₀ : FiniteReciprocalPrior H π₀) (h₁ : FiniteReciprocalPrior H π₁) {t : ℝ} (ht : t ∈ Icc (0 : ℝ) 1) : FiniteReciprocalPrior H (intervalInterpolatedPrior π₀ π₁ t) := by classical let := h₀.1 let := h₁.1 have hweights : ofReal (1 - t) + ofReal t = 1 := by rw [← ENNReal.ofReal_add (by linarith [ht.2]) ht.1] norm_num have hp : IsProbabilityMeasure (intervalInterpolatedPrior π₀ π₁ t) := by constructor simp only [intervalInterpolatedPrior, Measure.add_apply, Measure.smul_apply, measure_univ, smul_eq_mul, mul_one] exact hweights refine ⟨hp, ?_⟩ obtain ⟨s₀, hs₀, hmem₀⟩ := h₀.2 obtain ⟨s₁, hs₁, hmem₁⟩ := h₁.2 have hmass₀ : π₀ (↑(s₀ ∪ s₁) : Set ℝ) = 1 := by apply le_antisymm (by simpa using (measure_mono (subset_univ _) : π₀ (↑(s₀ ∪ s₁) : Set ℝ) ≤ π₀ univ)) rw [← hs₀] exact measure_mono (by simp only [Finset.coe_union]; exact subset_union_left) have hmass₁ : π₁ (↑(s₀ ∪ s₁) : Set ℝ) = 1 := by apply le_antisymm (by simpa using (measure_mono (subset_univ _) : π₁ (↑(s₀ ∪ s₁) : Set ℝ) ≤ π₁ univ)) rw [← hs₁] exact measure_mono (by simp only [Finset.coe_union]; exact subset_union_right) refine ⟨s₀ ∪ s₁, ?_, ?_⟩ · simp only [intervalInterpolatedPrior, Measure.add_apply, Measure.smul_apply, hmass₀, hmass₁, smul_eq_mul, mul_one] exact hweights · intro z hz rcases Finset.mem_union.mp hz with hz | hz · exact hmem₀ z hz · exact hmem₁ z hz
CausalSmith.Stat.MarRareqLogfrontier.finiteReciprocalPrior_interpolate · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/IntervalPriors.lean:33
theorem intervalInterpolatedPrior_integral

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
H :
ℝ
π₀ π₁ :
h₀ :
h₁ :
t :
ℝ
ht :
t ∈ Icc (0 : ℝ) 1
f :
ℝ → ℝ
(∫ z, f z ∂intervalInterpolatedPrior π₀ π₁ t)
= (1 - t) * (∫ z, f z ∂π₀) + t * (∫ z, f z ∂π₁)
Proof (Lean source)
-- @node: intervalInterpolatedPrior_integral lemma intervalInterpolatedPrior_integral {H : ℝ} {π₀ π₁ : Measure ℝ} (h₀ : FiniteReciprocalPrior H π₀) (h₁ : FiniteReciprocalPrior H π₁) {t : ℝ} (ht : t ∈ Icc (0 : ℝ) 1) (f : ℝ → ℝ) : (∫ z, f z ∂intervalInterpolatedPrior π₀ π₁ t) = (1 - t) * (∫ z, f z ∂π₀) + t * (∫ z, f z ∂π₁) := by rw [intervalInterpolatedPrior, integral_add_measure ((finiteReciprocalPrior_integrable h₀ f).smul_measure (by simp)) ((finiteReciprocalPrior_integrable h₁ f).smul_measure (by simp)), integral_smul_measure, integral_smul_measure] simp only [ENNReal.toReal_ofReal (show 0 ≤ 1 - t by linarith [ht.2]), ENNReal.toReal_ofReal ht.1, smul_eq_mul]
CausalSmith.Stat.MarRareqLogfrontier.intervalInterpolatedPrior_integral · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/IntervalPriors.lean:72
theorem intervalInterpolatedPrior_moments

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
H :
ℝ
π₀ π₁ :
h₀ :
h₁ :
K :
ℕ
hm :
∀ v : ℕ
if
v ≤ K
then
(∫ z, z ^ v ∂π₀) = ∫ z, z ^ v ∂π₁
t :
ℝ
ht :
t ∈ Icc (0 : ℝ) 1
v :
ℕ
hv :
v ≤ K
(∫ z, z ^ v ∂intervalInterpolatedPrior π₀ π₁ t) = ∫ z, z ^ v ∂π₀
Proof (Lean source)
-- @node: intervalInterpolatedPrior_moments lemma intervalInterpolatedPrior_moments {H : ℝ} {π₀ π₁ : Measure ℝ} (h₀ : FiniteReciprocalPrior H π₀) (h₁ : FiniteReciprocalPrior H π₁) (K : ℕ) (hm : ∀ v : ℕ, v ≤ K → (∫ z, z ^ v ∂π₀) = ∫ z, z ^ v ∂π₁) {t : ℝ} (ht : t ∈ Icc (0 : ℝ) 1) (v : ℕ) (hv : v ≤ K) : (∫ z, z ^ v ∂intervalInterpolatedPrior π₀ π₁ t) = ∫ z, z ^ v ∂π₀ := by rw [intervalInterpolatedPrior_integral h₀ h₁ ht, ← hm v hv] ring
CausalSmith.Stat.MarRareqLogfrontier.intervalInterpolatedPrior_moments · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/IntervalPriors.lean:86
theorem intervalInterpolatedPrior_grid

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
H :
ℝ
π₀ π₁ :
h₀ :
h₁ :
K :
ℕ
hm :
∀ v : ℕ
if
v ≤ K
then
(∫ z, z ^ v ∂π₀) = ∫ z, z ^ v ∂π₁
M :
ℕ
hM :
1 ≤ M
h :
Fin (M + 1)
conclusion 1
FiniteReciprocalPrior H (intervalInterpolatedPrior π₀ π₁ ((h : ℝ) / M))
conclusion 2
h' :
Fin (M + 1)
v :
ℕ
v ≤ K
(∫ z, z ^ v ∂intervalInterpolatedPrior π₀ π₁ ((h : ℝ) / M))
= ∫ z, z ^ v ∂intervalInterpolatedPrior π₀ π₁ ((h' : ℝ) / M)
conclusion 3
(∫ z, z⁻¹ ∂intervalInterpolatedPrior π₀ π₁ ((h : ℝ) / M))
= (∫ z, z⁻¹ ∂π₀) + (h : ℝ) * (((∫ z, z⁻¹ ∂π₁) - ∫ z, z⁻¹ ∂π₀) / M)
Proof (Lean source)
-- @node: intervalInterpolatedPrior_grid lemma intervalInterpolatedPrior_grid {H : ℝ} {π₀ π₁ : Measure ℝ} (h₀ : FiniteReciprocalPrior H π₀) (h₁ : FiniteReciprocalPrior H π₁) (K : ℕ) (hm : ∀ v : ℕ, v ≤ K → (∫ z, z ^ v ∂π₀) = ∫ z, z ^ v ∂π₁) (M : ℕ) (hM : 1 ≤ M) : ∀ h : Fin (M + 1), FiniteReciprocalPrior H (intervalInterpolatedPrior π₀ π₁ ((h : ℝ) / M)) ∧ (∀ h' : Fin (M + 1), ∀ v : ℕ, v ≤ K → (∫ z, z ^ v ∂intervalInterpolatedPrior π₀ π₁ ((h : ℝ) / M)) = ∫ z, z ^ v ∂intervalInterpolatedPrior π₀ π₁ ((h' : ℝ) / M)) ∧ (∫ z, z⁻¹ ∂intervalInterpolatedPrior π₀ π₁ ((h : ℝ) / M)) = (∫ z, z⁻¹ ∂π₀) + (h : ℝ) * (((∫ z, z⁻¹ ∂π₁) - ∫ z, z⁻¹ ∂π₀) / M) := by have hMpos : (0 : ℝ) < M := by exact_mod_cast (by omega : 0 < M) have ht (h : Fin (M + 1)) : (h : ℝ) / M ∈ Icc (0 : ℝ) 1 := by refine ⟨by positivity, (div_le_one hMpos).mpr ?_⟩ exact_mod_cast (by omega : h.val ≤ M) intro h refine ⟨finiteReciprocalPrior_interpolate h₀ h₁ (ht h), ?_, ?_⟩ · intro h' v hv rw [intervalInterpolatedPrior_moments h₀ h₁ K hm (ht h) v hv, intervalInterpolatedPrior_moments h₀ h₁ K hm (ht h') v hv] · rw [intervalInterpolatedPrior_integral h₀ h₁ (ht h)] ring
CausalSmith.Stat.MarRareqLogfrontier.intervalInterpolatedPrior_grid · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/IntervalPriors.lean:96
theorem intervalInterpolatedPrior_reciprocal_spacing

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
H :
ℝ
π₀ π₁ :
h₀ :
h₁ :
M h :
ℕ
hh :
h < M
|(∫ z, z⁻¹ ∂intervalInterpolatedPrior π₀ π₁ (((h : ℝ) + 1) / M))
- (∫ z, z⁻¹ ∂intervalInterpolatedPrior π₀ π₁ ((h : ℝ) / M))|
= |(∫ z, z⁻¹ ∂π₁) - ∫ z, z⁻¹ ∂π₀| / M
Proof (Lean source)
-- @node: intervalInterpolatedPrior_reciprocal_spacing lemma intervalInterpolatedPrior_reciprocal_spacing {H : ℝ} {π₀ π₁ : Measure ℝ} (h₀ : FiniteReciprocalPrior H π₀) (h₁ : FiniteReciprocalPrior H π₁) (M h : ℕ) (hh : h < M) : |(∫ z, z⁻¹ ∂intervalInterpolatedPrior π₀ π₁ (((h : ℝ) + 1) / M)) - (∫ z, z⁻¹ ∂intervalInterpolatedPrior π₀ π₁ ((h : ℝ) / M))| = |(∫ z, z⁻¹ ∂π₁) - ∫ z, z⁻¹ ∂π₀| / M := by have hM : (0 : ℝ) < M := by exact_mod_cast (by omega : 0 < M) have ht : (h : ℝ) / M ∈ Icc (0 : ℝ) 1 := by refine ⟨by positivity, (div_le_one hM).mpr ?_⟩ exact_mod_cast (le_of_lt hh) have ht' : ((h : ℝ) + 1) / M ∈ Icc (0 : ℝ) 1 := by refine ⟨by positivity, (div_le_one hM).mpr ?_⟩ exact_mod_cast (by omega : h + 1 ≤ M) rw [intervalInterpolatedPrior_integral h₀ h₁ ht', intervalInterpolatedPrior_integral h₀ h₁ ht] have heq (a b : ℝ) : (1 - ((h : ℝ) + 1) / M) * a + (((h : ℝ) + 1) / M) * b - ((1 - (h : ℝ) / M) * a + ((h : ℝ) / M) * b) = (b - a) / M := by ring rw [heq, abs_div, abs_of_pos hM]
CausalSmith.Stat.MarRareqLogfrontier.intervalInterpolatedPrior_reciprocal_spacing · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/IntervalPriors.lean:122
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.IntervalRegimes 4 declarations The bounded-effective-size and small-rare-count cases in equations (18)--(19).

The bounded-effective-size and small-rare-count cases in equations (18)--(19).

theorem interval_many_scale_sqrt Lemma interval_many_scale_sqrt in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
hN :
hell :
0 < logScale n q
sqrt (min 1 (((d : ℝ) / (effectiveSize n q * logScale n q)) ^ 2))
= min 1 ((d : ℝ) / (effectiveSize n q * logScale n q))
Proof (Lean source)
-- @node: interval_many_scale_sqrt lemma interval_many_scale_sqrt (n d : ℕ) (q : ℝ) (hN : 0 < effectiveSize n q) (hell : 0 < logScale n q) : sqrt (min 1 (((d : ℝ) / (effectiveSize n q * logScale n q)) ^ 2)) = min 1 ((d : ℝ) / (effectiveSize n q * logScale n q)) := by let x := (d : ℝ) / (effectiveSize n q * logScale n q) have hx : 0 ≤ x := by dsimp [x]; positivity change sqrt (min 1 (x ^ 2)) = min 1 x by_cases hx1 : x ≤ 1 · rw [min_eq_right (by nlinarith : x ^ 2 ≤ 1), Real.sqrt_sq hx, min_eq_right hx1] · rw [min_eq_left (by nlinarith : 1 ≤ x ^ 2), Real.sqrt_one, min_eq_left (le_of_not_ge hx1)]
CausalSmith.Stat.MarRareqLogfrontier.interval_many_scale_sqrt · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/IntervalRegimes.lean:14
theorem interval_bounded_size_parametric_scale Lemma interval_bounded_size_parametric_scale in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
N T :
ℝ
hN :
0 < N
hNT :
N ≤ T
min 1 (sqrt T)⁻¹ ≤ min 1 (sqrt N)⁻¹
Proof (Lean source)
-- @node: interval_bounded_size_parametric_scale lemma interval_bounded_size_parametric_scale (N T : ℝ) (hN : 0 < N) (hNT : N ≤ T) : min 1 (sqrt T)⁻¹ ≤ min 1 (sqrt N)⁻¹ := by apply min_le_min_left exact (inv_le_inv₀ (Real.sqrt_pos.mpr (hN.trans_le hNT)) (Real.sqrt_pos.mpr hN)).mpr (Real.sqrt_le_sqrt hNT)
CausalSmith.Stat.MarRareqLogfrontier.interval_bounded_size_parametric_scale · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/IntervalRegimes.lean:29
theorem interval_small_rare_count_scale Lemma interval_small_rare_count_scale in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
η :
ℝ
n d D :
ℕ
q :
ℝ
hd :
1 ≤ d
hN :
1 ≤ effectiveSize n q
hell :
1 ≤ logScale n q
hcapacity :
(D : ℝ) ≤ (2 * rareMass η n q)⁻¹
hsmall :
rareCount η n d q < D
min 1 ((d : ℝ) / (effectiveSize n q * logScale n q))
≤ (D : ℝ) * min 1 (sqrt (effectiveSize n q))⁻¹
Proof (Lean source)
-- @node: interval_small_rare_count_scale lemma interval_small_rare_count_scale (η : ℝ) (n d D : ℕ) (q : ℝ) (hd : 1 ≤ d) (hN : 1 ≤ effectiveSize n q) (hell : 1 ≤ logScale n q) (hcapacity : (D : ℝ) ≤ (2 * rareMass η n q)⁻¹) (hsmall : rareCount η n d q < D) : min 1 ((d : ℝ) / (effectiveSize n q * logScale n q)) ≤ (D : ℝ) * min 1 (sqrt (effectiveSize n q))⁻¹ := by have hs : 1 ≤ sqrt (effectiveSize n q) := Real.one_le_sqrt.mpr hN have hinv : (sqrt (effectiveSize n q))⁻¹ ≤ 1 := by simpa using (inv_le_inv₀ (by linarith : 0 < sqrt (effectiveSize n q)) (by norm_num : (0 : ℝ) < 1)).mpr hs rw [min_eq_right hinv] exact interval_small_dimension_scale n d D q hN hell (rareCount_small_dimension η n d D q hd hcapacity hsmall)
CausalSmith.Stat.MarRareqLogfrontier.interval_small_rare_count_scale · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/IntervalRegimes.lean:38
theorem interval_many_scale_of_large_regime Lemma interval_many_scale_of_large_regime in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
η T c₀ c₁ :
ℝ
D :
ℕ
hT :
1 ≤ T
hD :
1 ≤ D
hc₀ :
0 < c₀
hc₁ :
0 < c₁
n d :
ℕ
q L :
ℝ
hd :
1 ≤ d
hN :
hell :
1 ≤ logScale n q
hparam :
c₀ * min 1 (sqrt (effectiveSize n q))⁻¹ ≤ L
hcapacity :
T ≤ effectiveSize n q → (D : ℝ) ≤ (2 * rareMass η n q)⁻¹
hlarge :
T
≤ effectiveSize n q → D ≤ rareCount η n d q → c₁ * min 1 ((d : ℝ) / (effectiveSize n q * logScale n q)) ≤ L
min c₁ (min (c₀ * min 1 (sqrt T)⁻¹) (c₀ / D)) * min 1 ((d : ℝ) / (effectiveSize n q * logScale n q))
≤ L
Proof (Lean source)
-- @node: interval_many_scale_of_large_regime lemma interval_many_scale_of_large_regime (η T c₀ c₁ : ℝ) (D : ℕ) (hT : 1 ≤ T) (hD : 1 ≤ D) (hc₀ : 0 < c₀) (hc₁ : 0 < c₁) (n d : ℕ) (q L : ℝ) (hd : 1 ≤ d) (hN : 0 < effectiveSize n q) (hell : 1 ≤ logScale n q) (hparam : c₀ * min 1 (sqrt (effectiveSize n q))⁻¹ ≤ L) (hcapacity : T ≤ effectiveSize n q → (D : ℝ) ≤ (2 * rareMass η n q)⁻¹) (hlarge : T ≤ effectiveSize n q → D ≤ rareCount η n d q → c₁ * min 1 ((d : ℝ) / (effectiveSize n q * logScale n q)) ≤ L) : min c₁ (min (c₀ * min 1 (sqrt T)⁻¹) (c₀ / D)) * min 1 ((d : ℝ) / (effectiveSize n q * logScale n q)) ≤ L := by let c := min c₁ (min (c₀ * min 1 (sqrt T)⁻¹) (c₀ / D)) let b := min 1 ((d : ℝ) / (effectiveSize n q * logScale n q)) have hb : 0 ≤ b := by dsimp [b]; positivity change c * b ≤ L by_cases hNT : T ≤ effectiveSize n q · by_cases hJ : D ≤ rareCount η n d q · exact (mul_le_mul_of_nonneg_right (min_le_left _ _) hb).trans (hlarge hNT hJ) · have hscale := interval_small_rare_count_scale η n d D q hd (hT.trans hNT) hell (hcapacity hNT) (lt_of_not_ge hJ) have hc : c ≤ c₀ / D := (min_le_right _ _).trans (min_le_right _ _) have hDpos : (0 : ℝ) < D := by exact_mod_cast (lt_of_lt_of_le (by decide : 0 < 1) hD) have hcpos : 0 ≤ c := by dsimp [c]; positivity have hmul := mul_le_mul_of_nonneg_left hscale hcpos have hcoef : c * (D : ℝ) ≤ c₀ := (le_div_iff₀ hDpos).mp hc have hmul' := mul_le_mul_of_nonneg_right hcoef (show 0 ≤ min 1 (sqrt (effectiveSize n q))⁻¹ by positivity) have hfinish : c * ((D : ℝ) * min 1 (sqrt (effectiveSize n q))⁻¹) ≤ L := by calc c * ((D : ℝ) * min 1 (sqrt (effectiveSize n q))⁻¹) ≤ c₀ * min 1 (sqrt (effectiveSize n q))⁻¹ := by simpa [mul_assoc] using hmul' _ ≤ L := hparam exact hmul.trans hfinish · have hc : c ≤ c₀ * min 1 (sqrt T)⁻¹ := (min_le_right _ _).trans (min_le_left _ _) have hcpos : 0 ≤ c := by dsimp [c]; positivity have hb1 : b ≤ 1 := min_le_left _ _ have hscale := interval_bounded_size_parametric_scale (effectiveSize n q) T hN (le_of_not_ge hNT) calc c * b ≤ c := by nlinarith _ ≤ c₀ * min 1 (sqrt T)⁻¹ := hc _ ≤ c₀ * min 1 (sqrt (effectiveSize n q))⁻¹ := mul_le_mul_of_nonneg_left hscale hc₀.le _ ≤ L := hparam
CausalSmith.Stat.MarRareqLogfrontier.interval_many_scale_of_large_regime · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/IntervalRegimes.lean:54
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.IntervalScales 5 declarations Rare-cell mass and the complementary small-dimension scale in equations (17)--(18) of the connected-interval frontier proof.

Rare-cell mass and the complementary small-dimension scale in equations (17)--(18) of the connected-interval frontier proof.

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
η :
ℝ
n d :
ℕ
q :
ℝ
hb :
0 < rareMass η n q
(rareCount η n d q : ℝ) * rareMass η n q ≤ 1 / 2
Proof (Lean source)
-- @node: rareCount_mass_le_half lemma rareCount_mass_le_half (η : ℝ) (n d : ℕ) (q : ℝ) (hb : 0 < rareMass η n q) : (rareCount η n d q : ℝ) * rareMass η n q ≤ 1 / 2 := by have hcount : rareCount η n d q ≤ floor ((2 * rareMass η n q)⁻¹) := min_le_right _ _ have hfloor := Nat.floor_le (show 0 ≤ (2 * rareMass η n q)⁻¹ by positivity) have hle : (rareCount η n d q : ℝ) ≤ (2 * rareMass η n q)⁻¹ := (Nat.cast_le.mpr hcount).trans hfloor have hmul := mul_le_mul_of_nonneg_right hle hb.le have hid : (2 * rareMass η n q)⁻¹ * rareMass η n q = 1 / 2 := by field_simp linarith [hid]
CausalSmith.Stat.MarRareqLogfrontier.rareCount_mass_le_half · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/IntervalScales.lean:13

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
η :
ℝ
n d :
ℕ
q :
ℝ
hd :
2 ≤ d
hb :
0 < rareMass η n q
hbsmall :
rareMass η n q ≤ 1 / 4
min ((d : ℝ) * rareMass η n q / 2) (1 / 4) ≤ (rareCount η n d q : ℝ) * rareMass η n q
Proof (Lean source)
-- @node: rareCount_mass_lower lemma rareCount_mass_lower (η : ℝ) (n d : ℕ) (q : ℝ) (hd : 2 ≤ d) (hb : 0 < rareMass η n q) (hbsmall : rareMass η n q ≤ 1 / 4) : min ((d : ℝ) * rareMass η n q / 2) (1 / 4) ≤ (rareCount η n d q : ℝ) * rareMass η n q := by by_cases hbranch : d - 1 ≤ floor ((2 * rareMass η n q)⁻¹) · rw [rareCount, min_eq_left hbranch] have hdim : (d : ℝ) / 2 ≤ ((d - 1 : ℕ) : ℝ) := by rw [Nat.cast_sub (by omega : 1 ≤ d)] have : (2 : ℝ) ≤ d := by exact_mod_cast hd push_cast linarith apply (min_le_left _ _).trans nlinarith · rw [rareCount, min_eq_right (le_of_not_ge hbranch)] have hf := Nat.sub_one_lt_floor ((2 * rareMass η n q)⁻¹) have hmul := mul_lt_mul_of_pos_right hf hb have hid : (2 * rareMass η n q)⁻¹ * rareMass η n q = 1 / 2 := by field_simp apply (min_le_right _ _).trans nlinarith
CausalSmith.Stat.MarRareqLogfrontier.rareCount_mass_lower · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/IntervalScales.lean:28
theorem interval_prior_segment_width_lower Lemma interval_prior_segment_width_lower in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
η Δ :
ℝ
n d :
ℕ
q :
ℝ
hη :
0 < η
hηsmall :
η ≤ 1 / 2
hd :
2 ≤ d
hN :
hell :
0 < logScale n q
hbsmall :
rareMass η n q ≤ 1 / 4
hseparation :
(rareCount η n d q : ℝ) * rareMass η n q / 12 ≤ Δ
(η / 24) * min 1 ((d : ℝ) / (effectiveSize n q * logScale n q)) ≤ Δ
Proof (Lean source)
-- @node: interval_prior_segment_width_lower lemma interval_prior_segment_width_lower (η Δ : ℝ) (n d : ℕ) (q : ℝ) (hη : 0 < η) (hηsmall : η ≤ 1 / 2) (hd : 2 ≤ d) (hN : 0 < effectiveSize n q) (hell : 0 < logScale n q) (hbsmall : rareMass η n q ≤ 1 / 4) (hseparation : (rareCount η n d q : ℝ) * rareMass η n q / 12 ≤ Δ) : (η / 24) * min 1 ((d : ℝ) / (effectiveSize n q * logScale n q)) ≤ Δ := by have hb : 0 < rareMass η n q := by unfold rareMass positivity have hmass := rareCount_mass_lower η n d q hd hb hbsmall have hscale : (η / 24) * min 1 ((d : ℝ) / (effectiveSize n q * logScale n q)) ≤ min ((d : ℝ) * rareMass η n q / 2) (1 / 4) / 12 := by rw [← min_div_div_right (by norm_num : (0 : ℝ) ≤ 12)] apply le_min · have h := mul_le_mul_of_nonneg_left (min_le_right (1 : ℝ) ((d : ℝ) / (effectiveSize n q * logScale n q))) (show 0 ≤ η / 24 by positivity) convert h using 1 dsimp [rareMass] ring · have h := mul_le_mul_of_nonneg_left (min_le_left (1 : ℝ) ((d : ℝ) / (effectiveSize n q * logScale n q))) (show 0 ≤ η / 24 by positivity) linarith exact hscale.trans ((div_le_div_of_nonneg_right hmass (by norm_num)).trans hseparation)
CausalSmith.Stat.MarRareqLogfrontier.interval_prior_segment_width_lower · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/IntervalScales.lean:51
theorem rareCount_small_dimension Lemma rareCount_small_dimension in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
η :
ℝ
n d D :
ℕ
q :
ℝ
hd :
1 ≤ d
hcapacity :
(D : ℝ) ≤ (2 * rareMass η n q)⁻¹
hsmall :
rareCount η n d q < D
d ≤ D
Proof (Lean source)
-- @node: rareCount_small_dimension lemma rareCount_small_dimension (η : ℝ) (n d D : ℕ) (q : ℝ) (hd : 1 ≤ d) (hcapacity : (D : ℝ) ≤ (2 * rareMass η n q)⁻¹) (hsmall : rareCount η n d q < D) : d ≤ D := by have hfloor : D ≤ floor ((2 * rareMass η n q)⁻¹) := by exact (Nat.le_floor_iff (by exact (show (0 : ℝ) ≤ D by positivity).trans hcapacity)).mpr hcapacity have hbranch : d - 1 < D := by unfold rareCount at hsmall omega omega
CausalSmith.Stat.MarRareqLogfrontier.rareCount_small_dimension · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/IntervalScales.lean:80
theorem interval_small_dimension_scale Lemma interval_small_dimension_scale in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d D :
ℕ
q :
ℝ
hN :
1 ≤ effectiveSize n q
hell :
1 ≤ logScale n q
hd :
d ≤ D
min 1 ((d : ℝ) / (effectiveSize n q * logScale n q))
≤ (D : ℝ) * (sqrt (effectiveSize n q))⁻¹
Proof (Lean source)
-- @node: interval_small_dimension_scale lemma interval_small_dimension_scale (n d D : ℕ) (q : ℝ) (hN : 1 ≤ effectiveSize n q) (hell : 1 ≤ logScale n q) (hd : d ≤ D) : min 1 ((d : ℝ) / (effectiveSize n q * logScale n q)) ≤ (D : ℝ) * (sqrt (effectiveSize n q))⁻¹ := by have hNpos : 0 < effectiveSize n q := by linarith have hspos : 0 < sqrt (effectiveSize n q) := Real.sqrt_pos.mpr hNpos have hs : sqrt (effectiveSize n q) ≤ effectiveSize n q := by apply Real.sqrt_le_iff.mpr refine ⟨hNpos.le, ?_⟩ nlinarith have hden : sqrt (effectiveSize n q) ≤ effectiveSize n q * logScale n q := by nlinarith have hdim : (d : ℝ) ≤ D := by exact_mod_cast hd apply (min_le_right _ _).trans rw [← div_eq_mul_inv] apply (div_le_div_iff₀ (by positivity) hspos).mpr have hmul := mul_le_mul_of_nonneg_right hdim hspos.le have hmul' := mul_le_mul_of_nonneg_left hden (show (0 : ℝ) ≤ D by positivity) exact hmul.trans hmul'
CausalSmith.Stat.MarRareqLogfrontier.interval_small_dimension_scale · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/IntervalScales.lean:93
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.IntervalThresholds 5 declarations Uniform effective-size thresholds for equations (9)--(10) of the connected-interval proof.

Uniform effective-size thresholds for equations (9)--(10) of the connected-interval proof. These are numerical estimates, preceding the activated likelihood and model-mixture transfer.

theorem interval_capacity_of_large_size Lemma interval_capacity_of_large_size in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
η :
ℝ
D n :
ℕ
q :
ℝ
hη :
0 < η
hN :
hell :
1 ≤ logScale n q
hlarge :
2 * η * D ≤ effectiveSize n q
(D : ℝ) ≤ (2 * rareMass η n q)⁻¹
Proof (Lean source)
-- @node: interval_capacity_of_large_size lemma interval_capacity_of_large_size (η : ℝ) (D n : ℕ) (q : ℝ) (hη : 0 < η) (hN : 0 < effectiveSize n q) (hell : 1 ≤ logScale n q) (hlarge : 2 * η * D ≤ effectiveSize n q) : (D : ℝ) ≤ (2 * rareMass η n q)⁻¹ := by have hb : 0 < 2 * rareMass η n q := by unfold rareMass; positivity rw [inv_eq_one_div] apply (le_div_iff₀ hb).mpr rw [show (D : ℝ) * (2 * rareMass η n q) = (2 * η * D) / (effectiveSize n q * logScale n q) by unfold rareMass; ring] apply (div_le_iff₀ (by positivity : 0 < effectiveSize n q * logScale n q)).mpr nlinarith [mul_le_mul_of_nonneg_left hell hN.le]
CausalSmith.Stat.MarRareqLogfrontier.interval_capacity_of_large_size · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/IntervalThresholds.lean:14
theorem interval_activation_tail_le_exp Lemma interval_activation_tail_le_exp in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
hN :
hell :
1 ≤ logScale n q
(rareCount (exp (-32)) n d q : ℝ) * (exp 1 * exp (-32)) ^ (lowerDegree n q + 1)
≤ exp (32 - 29 * logScale n q)
Proof (Lean source)
-- @node: interval_activation_tail_le_exp lemma interval_activation_tail_le_exp (n d : ℕ) (q : ℝ) (hN : 0 < effectiveSize n q) (hell : 1 ≤ logScale n q) : (rareCount (exp (-32)) n d q : ℝ) * (exp 1 * exp (-32)) ^ (lowerDegree n q + 1) ≤ exp (32 - 29 * logScale n q) := by let N := effectiveSize n q let L := logScale n q have hNL : 0 < N * L := by dsimp [N, L]; positivity have hcap : (rareCount (exp (-32)) n d q : ℝ) ≤ N * L / (2 * exp (-32)) := by have h := rareCount_mass_le_half (exp (-32)) n d q (show 0 < rareMass (exp (-32)) n q by unfold rareMass; positivity) apply (le_div_iff₀ (by positivity : 0 < 2 * exp (-32))).mpr dsimp [rareMass] at h have h' := (div_le_iff₀ hNL).mp (show (rareCount (exp (-32)) n d q : ℝ) * exp (-32) / (N * L) ≤ 1 / 2 by simpa [N, L, mul_div_assoc] using h) nlinarith have hexpL : exp L = exp 1 + N := by dsimp [L, N, logScale] rw [Real.exp_log (by positivity)] have hNexp : N ≤ exp L := by rw [hexpL]; linarith [Real.exp_pos (1 : ℝ)] have hLexp : L ≤ exp L := by linarith [Real.add_one_le_exp L] have hprod : N * L ≤ exp (2 * L) := by rw [show 2 * L = L + L by ring, Real.exp_add] exact mul_le_mul hNexp hLexp (by dsimp [L]; linarith) (Real.exp_nonneg _) have hdegree : L ≤ (lowerDegree n q + 1 : ℕ) := by have h := Nat.le_ceil (logScale n q) dsimp [L] unfold lowerDegree push_cast linarith have hpow : (exp 1 * exp (-32)) ^ (lowerDegree n q + 1) ≤ exp (-31 * L) := by rw [← Real.exp_add, show (1 : ℝ) + -32 = -31 by norm_num, ← Real.exp_nat_mul] apply Real.exp_le_exp.mpr nlinarith calc _ ≤ (N * L / (2 * exp (-32))) * exp (-31 * L) := mul_le_mul hcap hpow (by positivity) (by positivity) _ ≤ (exp (2 * L) / exp (-32)) * exp (-31 * L) := by apply mul_le_mul_of_nonneg_right _ (Real.exp_nonneg _) exact (div_le_div_of_nonneg_left hNL.le (Real.exp_pos (-32)) (by linarith [Real.exp_pos (-32)])).trans (div_le_div_of_nonneg_right hprod (Real.exp_nonneg (-32))) _ = exp (32 - 29 * logScale n q) := by rw [← Real.exp_sub, ← Real.exp_add] congr 1 dsimp [L] ring
CausalSmith.Stat.MarRareqLogfrontier.interval_activation_tail_le_exp · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/IntervalThresholds.lean:28
theorem interval_activation_tail_budget Lemma interval_activation_tail_budget in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
u :
ℝ
n d :
ℕ
q :
ℝ
hu :
0 < u
hN :
hell :
1 ≤ logScale n q
hlarge :
exp ((32 - log (u / 16)) / 29) ≤ effectiveSize n q
(rareCount (exp (-32)) n d q : ℝ) * (exp 1 * exp (-32)) ^ (lowerDegree n q + 1)
≤ u / 16
Proof (Lean source)
-- @node: interval_activation_tail_budget lemma interval_activation_tail_budget (u : ℝ) (n d : ℕ) (q : ℝ) (hu : 0 < u) (hN : 0 < effectiveSize n q) (hell : 1 ≤ logScale n q) (hlarge : exp ((32 - log (u / 16)) / 29) ≤ effectiveSize n q) : (rareCount (exp (-32)) n d q : ℝ) * (exp 1 * exp (-32)) ^ (lowerDegree n q + 1) ≤ u / 16 := by have hlog := Real.log_le_log (Real.exp_pos ((32 - log (u / 16)) / 29)) (hlarge.trans (show effectiveSize n q ≤ exp 1 + effectiveSize n q by linarith [Real.exp_pos (1 : ℝ)])) rw [Real.log_exp] at hlog change (32 - log (u / 16)) / 29 ≤ logScale n q at hlog apply (interval_activation_tail_le_exp n d q hN hell).trans calc exp (32 - 29 * logScale n q) ≤ exp (log (u / 16)) := by apply Real.exp_le_exp.mpr linarith _ = u / 16 := Real.exp_log (by positivity)
CausalSmith.Stat.MarRareqLogfrontier.interval_activation_tail_budget · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/IntervalThresholds.lean:82
theorem interval_activation_thresholds Lemma interval_activation_thresholds in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
u :
ℝ
D :
ℕ
hu :
0 < u
∃ T : ℝ,
1 ≤ T
conclusion 1
n d :
ℕ
q :
ℝ
T ≤ effectiveSize n q
(D : ℝ) ≤ (2 * rareMass (exp (-32)) n q)⁻¹
(rareCount (exp (-32)) n d q : ℝ) * (exp 1 * exp (-32)) ^ (lowerDegree n q + 1)
≤ u / 16
Proof (Lean source)
-- @node: interval_activation_thresholds lemma interval_activation_thresholds (u : ℝ) (D : ℕ) (hu : 0 < u) : ∃ T : ℝ, 1 ≤ T ∧ ∀ (n d : ℕ) (q : ℝ), 0 < effectiveSize n q → T ≤ effectiveSize n q → (D : ℝ) ≤ (2 * rareMass (exp (-32)) n q)⁻¹ ∧ (rareCount (exp (-32)) n d q : ℝ) * (exp 1 * exp (-32)) ^ (lowerDegree n q + 1) ≤ u / 16 := by let T := max 1 (max (2 * exp (-32) * D) (exp ((32 - log (u / 16)) / 29))) refine ⟨T, le_max_left _ _, ?_⟩ intro n d q hN hlarge have hell : 1 ≤ logScale n q := by unfold logScale have h := Real.log_le_log (Real.exp_pos (1 : ℝ)) (show exp 1 ≤ exp 1 + effectiveSize n q by linarith) simpa using h have hcap : 2 * exp (-32) * D ≤ effectiveSize n q := (le_max_left _ _).trans ((le_max_right _ _).trans hlarge) have htail : exp ((32 - log (u / 16)) / 29) ≤ effectiveSize n q := (le_max_right _ _).trans ((le_max_right _ _).trans hlarge) exact ⟨interval_capacity_of_large_size _ D n q (Real.exp_pos _) hN hell hcap, interval_activation_tail_budget u n d q hu hN hell htail⟩
CausalSmith.Stat.MarRareqLogfrontier.interval_activation_thresholds · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/IntervalThresholds.lean:101
theorem interval_activation_grid_thresholds Lemma interval_activation_grid_thresholds in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
u :
ℝ
hu :
0 < u
M :
ceil (8 / u) + 1
D :
ceil (18432 * (M : ℝ) ^ 2 / u) + 1
1 ≤ M
(M : ℝ)⁻¹ ≤ u / 8
1 ≤ D
18432 * (M : ℝ) ^ 2 / u ≤ (D : ℝ)
Proof (Lean source)
-- @node: interval_activation_grid_thresholds lemma interval_activation_grid_thresholds (u : ℝ) (hu : 0 < u) : let M := ceil (8 / u) + 1 let D := ceil (18432 * (M : ℝ) ^ 2 / u) + 1 1 ≤ M ∧ (M : ℝ)⁻¹ ≤ u / 8 ∧ 1 ≤ D ∧ 18432 * (M : ℝ) ^ 2 / u ≤ (D : ℝ) := by dsimp only have hM : 1 ≤ ceil (8 / u) + 1 := by omega have hMr : 0 < ((ceil (8 / u) + 1 : ℕ) : ℝ) := by exact_mod_cast hM have hceil := Nat.le_ceil (8 / u) have hgrid : 8 ≤ u * ((ceil (8 / u) + 1 : ℕ) : ℝ) := by have h := (div_le_iff₀ hu).mp hceil push_cast nlinarith refine ⟨hM, ?_, by omega, ?_⟩ · rw [inv_eq_one_div] apply (div_le_iff₀ hMr).mpr nlinarith · have h := Nat.le_ceil (18432 * (((ceil (8 / u) + 1 : ℕ) : ℝ)) ^ 2 / u) push_cast at * linarith
CausalSmith.Stat.MarRareqLogfrontier.interval_activation_grid_thresholds · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/IntervalThresholds.lean:125
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.LargeAlphabet.CollisionProbability 11 declarations Actual iid treated-cell collision probabilities for the large-alphabet experiment.

Actual iid treated-cell collision probabilities for the large-alphabet experiment.

theorem largeAlphabetLaw_treated_cell_mass

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
q :
ℝ
ξ :
Fin d → Bool
hd :
1 ≤ d
hq :
0 < q
hq1 :
q ≤ 1
x :
Fin d
((largeAlphabetLaw q ξ hd hq hq1).1.map obs).real {o | o.A = true ∧ o.X = x}
= 1 / (2 * (d : ℝ))
Proof (Lean source)
-- @node: largeAlphabetLaw_treated_cell_mass lemma largeAlphabetLaw_treated_cell_mass {d : ℕ} (q : ℝ) (ξ : Fin d → Bool) (hd : 1 ≤ d) (hq : 0 < q) (hq1 : q ≤ 1) (x : Fin d) : ((largeAlphabetLaw q ξ hd hq hq1).1.map obs).real {o | o.A = true ∧ o.X = x} = 1 / (2 * (d : ℝ)) := by classical rw [measureReal_def, Measure.map_apply (by fun_prop) (by measurability)] change (largeAlphabetLaw q ξ hd hq hq1).1.real _ = _ rw [largeAlphabetLaw_real_event] simp [obs, largeAlphabetRecord, completeBernWeight, Finset.sum_ite_irrel, Finset.sum_ite_eq'] ring
CausalSmith.Stat.MarRareqLogfrontier.largeAlphabetLaw_treated_cell_mass · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/LargeAlphabet/CollisionProbability.lean:11
theorem largeAlphabet_iid_pair_collision

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
hd :
1 ≤ d
hm :
∀ x : Fin d, μ.real {o | o.A = true ∧ o.X = x} = 1 / (2 * (d : ℝ))
i j :
Fin n
hij :
i ≠ j
(Measure.pi (fun _ : Fin n => μ)).real {s | (s i).A = true ∧ (s j).A = true ∧ (s i).X = (s j).X}
≤ 1 / (4 * (d : ℝ))
Proof (Lean source)
-- @node: largeAlphabet_iid_pair_collision lemma largeAlphabet_iid_pair_collision {n d : ℕ} (μ : Measure (ObsRecord d)) [IsProbabilityMeasure μ] (hd : 1 ≤ d) (hm : ∀ x : Fin d, μ.real {o | o.A = true ∧ o.X = x} = 1 / (2 * (d : ℝ))) (i j : Fin n) (hij : i ≠ j) : (Measure.pi (fun _ : Fin n => μ)).real {s | (s i).A = true ∧ (s j).A = true ∧ (s i).X = (s j).X} ≤ 1 / (4 * (d : ℝ)) := by classical let Q := Measure.pi (fun _ : Fin n => μ) let C (x : Fin d) : Set (ObsRecord d) := {o | o.A = true ∧ o.X = x} have hind : iIndepFun (fun k : Fin n => fun s : Fin n → ObsRecord d => s k) Q := iIndepFun_pi (fun _ => aemeasurable_id) have hcoord (k : Fin n) (x : Fin d) : Q.real {s | s k ∈ C x} = 1 / (2 * (d : ℝ)) := by have hp := (measurePreserving_eval (fun _ : Fin n => μ) k).map_eq have heq := congrArg (fun ν : Measure (ObsRecord d) => ν.real (C x)) hp rw [measureReal_def, Measure.map_apply (by fun_prop) (by measurability)] at heq exact heq.trans (hm x) have hp (x : Fin d) : Q.real {s | s i ∈ C x ∧ s j ∈ C x} = (1 / (2 * (d : ℝ))) ^ 2 := by have heq := (hind.indepFun hij).measure_inter_preimage_eq_mul (C x) (C x) (by measurability) (by measurability) have hr := congrArg toReal heq rw [ENNReal.toReal_mul] at hr change Q.real {s | s i ∈ C x ∧ s j ∈ C x} = Q.real {s | s i ∈ C x} * Q.real {s | s j ∈ C x} at hr rw [hcoord, hcoord] at hr simpa [pow_two] using hr have hcover : {s : Fin n → ObsRecord d | (s i).A = true ∧ (s j).A = true ∧ (s i).X = (s j).X} ⊆ ⋃ x : Fin d, {s | s i ∈ C x ∧ s j ∈ C x} := by intro s hs exact mem_iUnion.mpr ⟨(s i).X, ⟨⟨hs.1, rfl⟩, ⟨hs.2.1, hs.2.2.symm⟩⟩⟩ calc Q.real _ ≤ Q.real (⋃ x : Fin d, {s | s i ∈ C x ∧ s j ∈ C x}) := measureReal_mono hcover (measure_ne_top Q _) _ ≤ ∑ x : Fin d, Q.real {s | s i ∈ C x ∧ s j ∈ C x} := measureReal_iUnion_fintype_le _ _ = 1 / (4 * (d : ℝ)) := by simp_rw [hp] simp only [Finset.sum_const, Finset.card_univ, Fintype.card_fin, nsmul_eq_mul] have hdpos : 0 < (d : ℝ) := by exact_mod_cast hd field_simp <;> ring
CausalSmith.Stat.MarRareqLogfrontier.largeAlphabet_iid_pair_collision · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/LargeAlphabet/CollisionProbability.lean:25
theorem largeAlphabetComparisonLaw_treated_cell_mass

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
q :
ℝ
hd :
1 ≤ d
hq :
0 < q
hq1 :
q ≤ 1
x :
Fin d
((largeAlphabetComparisonLaw d q hd hq hq1).1.map obs).real {o | o.A = true ∧ o.X = x}
= 1 / (2 * (d : ℝ))
Proof (Lean source)
-- @node: largeAlphabetComparisonLaw_treated_cell_mass lemma largeAlphabetComparisonLaw_treated_cell_mass (d : ℕ) (q : ℝ) (hd : 1 ≤ d) (hq : 0 < q) (hq1 : q ≤ 1) (x : Fin d) : ((largeAlphabetComparisonLaw d q hd hq hq1).1.map obs).real {o | o.A = true ∧ o.X = x} = 1 / (2 * (d : ℝ)) := by classical rw [measureReal_def, Measure.map_apply (by fun_prop) (by measurability)] change (largeAlphabetComparisonLaw d q hd hq hq1).1.real _ = _ rw [largeAlphabetComparisonLaw_real_event] simp [obs, largeAlphabetComparisonWeight, completeBernWeight, largeAlphabetComparisonArrival, Finset.sum_ite_irrel, Finset.sum_ite_eq'] ring
CausalSmith.Stat.MarRareqLogfrontier.largeAlphabetComparisonLaw_treated_cell_mass · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/LargeAlphabet/CollisionProbability.lean:71
theorem largeAlphabetLaw_pair_collision

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
ξ :
Fin d → Bool
hd :
1 ≤ d
hq :
0 < q
hq1 :
q ≤ 1
i j :
Fin n
hij :
i ≠ j
(sampleLaw n (largeAlphabetLaw q ξ hd hq hq1)).real {s | (s i).A = true ∧ (s j).A = true ∧ (s i).X = (s j).X}
≤ 1 / (4 * (d : ℝ))
Proof (Lean source)
-- @node: largeAlphabetLaw_pair_collision lemma largeAlphabetLaw_pair_collision {n d : ℕ} (q : ℝ) (ξ : Fin d → Bool) (hd : 1 ≤ d) (hq : 0 < q) (hq1 : q ≤ 1) (i j : Fin n) (hij : i ≠ j) : (sampleLaw n (largeAlphabetLaw q ξ hd hq hq1)).real {s | (s i).A = true ∧ (s j).A = true ∧ (s i).X = (s j).X} ≤ 1 / (4 * (d : ℝ)) := by let := (largeAlphabetLaw q ξ hd hq hq1).2 let : IsProbabilityMeasure ((largeAlphabetLaw q ξ hd hq hq1).1.map obs) := Measure.isProbabilityMeasure_map (by fun_prop) exact largeAlphabet_iid_pair_collision _ hd (largeAlphabetLaw_treated_cell_mass q ξ hd hq hq1) i j hij
CausalSmith.Stat.MarRareqLogfrontier.largeAlphabetLaw_pair_collision · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/LargeAlphabet/CollisionProbability.lean:85
theorem largeAlphabetComparisonLaw_pair_collision

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
hd :
1 ≤ d
hq :
0 < q
hq1 :
q ≤ 1
i j :
Fin n
hij :
i ≠ j
(sampleLaw n (largeAlphabetComparisonLaw d q hd hq hq1)).real {s | (s i).A = true ∧ (s j).A = true ∧ (s i).X = (s j).X}
≤ 1 / (4 * (d : ℝ))
Proof (Lean source)
-- @node: largeAlphabetComparisonLaw_pair_collision lemma largeAlphabetComparisonLaw_pair_collision {n d : ℕ} (q : ℝ) (hd : 1 ≤ d) (hq : 0 < q) (hq1 : q ≤ 1) (i j : Fin n) (hij : i ≠ j) : (sampleLaw n (largeAlphabetComparisonLaw d q hd hq hq1)).real {s | (s i).A = true ∧ (s j).A = true ∧ (s i).X = (s j).X} ≤ 1 / (4 * (d : ℝ)) := by let := (largeAlphabetComparisonLaw d q hd hq hq1).2 let : IsProbabilityMeasure ((largeAlphabetComparisonLaw d q hd hq hq1).1.map obs) := Measure.isProbabilityMeasure_map (by fun_prop) exact largeAlphabet_iid_pair_collision _ hd (largeAlphabetComparisonLaw_treated_cell_mass d q hd hq hq1) i j hij
CausalSmith.Stat.MarRareqLogfrontier.largeAlphabetComparisonLaw_pair_collision · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/LargeAlphabet/CollisionProbability.lean:98
theorem largeAlphabet_collision_budget Lemma largeAlphabet_collision_budget in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
hn :
1 ≤ n
hd :
1024 * n ^ 2 ≤ d
(n.choose 2 : ℝ) * (1 / (4 * (d : ℝ))) ≤ 1 / 8192
Proof (Lean source)
-- @node: largeAlphabet_collision_budget lemma largeAlphabet_collision_budget (n d : ℕ) (hn : 1 ≤ n) (hd : 1024 * n ^ 2 ≤ d) : (n.choose 2 : ℝ) * (1 / (4 * (d : ℝ))) ≤ 1 / 8192 := by have hnat : 2 * n.choose 2 ≤ n ^ 2 := by rw [Nat.choose_two_right] have hm := Nat.mul_le_mul_left n (sub_le n 1) simp only [pow_two] omega have hc : 2 * (n.choose 2 : ℝ) ≤ (n : ℝ) ^ 2 := by exact_mod_cast hnat have hdreal : 1024 * (n : ℝ) ^ 2 ≤ d := by exact_mod_cast hd have hnreal : 1 ≤ (n : ℝ) := by exact_mod_cast hn have hdpos : 0 < (d : ℝ) := by nlinarith rw [mul_one_div, div_le_iff₀ (by positivity : 0 < 4 * (d : ℝ))] nlinarith
CausalSmith.Stat.MarRareqLogfrontier.largeAlphabet_collision_budget · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/LargeAlphabet/CollisionProbability.lean:111
theorem largeAlphabetLaw_collision_probability

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
ξ :
Fin d → Bool
hn :
1 ≤ n
hd :
1024 * n ^ 2 ≤ d
hq :
0 < q
hq1 :
q ≤ 1
(sampleLaw n (largeAlphabetLaw q ξ (by nlinarith) hq hq1)).real {s | ¬ noRepeatedTreatedCell s}
≤ 1 / 8192
Proof (Lean source)
-- @node: largeAlphabetLaw_collision_probability lemma largeAlphabetLaw_collision_probability (n d : ℕ) (q : ℝ) (ξ : Fin d → Bool) (hn : 1 ≤ n) (hd : 1024 * n ^ 2 ≤ d) (hq : 0 < q) (hq1 : q ≤ 1) : (sampleLaw n (largeAlphabetLaw q ξ (by nlinarith) hq hq1)).real {s | ¬ noRepeatedTreatedCell s} ≤ 1 / 8192 := by have hdpos : 1 ≤ d := by nlinarith let := (largeAlphabetLaw q ξ hdpos hq hq1).2 let : IsProbabilityMeasure ((largeAlphabetLaw q ξ hdpos hq hq1).1.map obs) := Measure.isProbabilityMeasure_map (by fun_prop) let : IsProbabilityMeasure (sampleLaw n (largeAlphabetLaw q ξ hdpos hq hq1)) := by unfold sampleLaw infer_instance exact (largeAlphabet_collision_union_bound _ (1 / (4 * (d : ℝ))) (fun i j hij => largeAlphabetLaw_pair_collision q ξ hdpos hq hq1 i j hij.ne)).trans (largeAlphabet_collision_budget n d hn hd)
CausalSmith.Stat.MarRareqLogfrontier.largeAlphabetLaw_collision_probability · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/LargeAlphabet/CollisionProbability.lean:128
theorem largeAlphabetComparisonLaw_collision_probability

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
hn :
1 ≤ n
hd :
1024 * n ^ 2 ≤ d
hq :
0 < q
hq1 :
q ≤ 1
(sampleLaw n (largeAlphabetComparisonLaw d q (by nlinarith) hq hq1)).real {s | ¬ noRepeatedTreatedCell s}
≤ 1 / 8192
Proof (Lean source)
-- @node: largeAlphabetComparisonLaw_collision_probability lemma largeAlphabetComparisonLaw_collision_probability (n d : ℕ) (q : ℝ) (hn : 1 ≤ n) (hd : 1024 * n ^ 2 ≤ d) (hq : 0 < q) (hq1 : q ≤ 1) : (sampleLaw n (largeAlphabetComparisonLaw d q (by nlinarith) hq hq1)).real {s | ¬ noRepeatedTreatedCell s} ≤ 1 / 8192 := by have hdpos : 1 ≤ d := by nlinarith let := (largeAlphabetComparisonLaw d q hdpos hq hq1).2 let : IsProbabilityMeasure ((largeAlphabetComparisonLaw d q hdpos hq hq1).1.map obs) := Measure.isProbabilityMeasure_map (by fun_prop) let : IsProbabilityMeasure (sampleLaw n (largeAlphabetComparisonLaw d q hdpos hq hq1)) := by unfold sampleLaw infer_instance exact (largeAlphabet_collision_union_bound _ (1 / (4 * (d : ℝ))) (fun i j hij => largeAlphabetComparisonLaw_pair_collision q hdpos hq hq1 i j hij.ne)).trans (largeAlphabet_collision_budget n d hn hd)
CausalSmith.Stat.MarRareqLogfrontier.largeAlphabetComparisonLaw_collision_probability · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/LargeAlphabet/CollisionProbability.lean:145
theorem largeAlphabetSampleMixture_real_event

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
hd :
1 ≤ d
hq :
0 < q
hq1 :
q ≤ 1
E :
Set (Fin n → ObsRecord d)
(largeAlphabetSampleMixture n d q hd hq hq1).real E
= ∫ ξ, (sampleLaw n (largeAlphabetLaw q ξ hd hq hq1)).real E ∂binaryCellPrior d
Proof (Lean source)
-- @node: largeAlphabetSampleMixture_real_event lemma largeAlphabetSampleMixture_real_event (n d : ℕ) (q : ℝ) (hd : 1 ≤ d) (hq : 0 < q) (hq1 : q ≤ 1) (E : Set (Fin n → ObsRecord d)) : (largeAlphabetSampleMixture n d q hd hq hq1).real E = ∫ ξ, (sampleLaw n (largeAlphabetLaw q ξ hd hq hq1)).real E ∂binaryCellPrior d := by classical let μ : Measure Bool := (1 / 2 : ℝ≥0∞) • Measure.dirac false + (1 / 2 : ℝ≥0∞) • Measure.dirac true let : IsProbabilityMeasure μ := fairBinary_probability let : IsProbabilityMeasure (binaryCellPrior d) := inferInstanceAs (IsProbabilityMeasure (Measure.pi (fun _ : Fin d => μ))) let : IsProbabilityMeasure (largeAlphabetSampleMixture n d q hd hq hq1) := largeAlphabetSampleMixture_probability n d q hd hq hq1 rw [probability_measureReal_eq_tsum_singletons _ E (by measurability), tsum_fintype] have hterm (s : Fin n → ObsRecord d) : E.indicator (fun s => (largeAlphabetSampleMixture n d q hd hq hq1).real {s}) s = ∫ ξ, E.indicator (fun s => (sampleLaw n (largeAlphabetLaw q ξ hd hq hq1)).real {s}) s ∂binaryCellPrior d := by by_cases hs : s ∈ E · simp only [Set.indicator_of_mem hs, largeAlphabetSampleMixture_real_singleton] · simp [Set.indicator_of_notMem hs] simp_rw [hterm] rw [← integral_finsetSum _ (fun _ _ => Integrable.of_finite)] apply integral_congr_ae filter_upwards [] with ξ let := (largeAlphabetLaw q ξ hd hq hq1).2 let : IsProbabilityMeasure ((largeAlphabetLaw q ξ hd hq hq1).1.map obs) := Measure.isProbabilityMeasure_map (by fun_prop) let : IsProbabilityMeasure (sampleLaw n (largeAlphabetLaw q ξ hd hq hq1)) := by unfold sampleLaw infer_instance rw [probability_measureReal_eq_tsum_singletons _ E (by measurability), tsum_fintype]
CausalSmith.Stat.MarRareqLogfrontier.largeAlphabetSampleMixture_real_event · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/LargeAlphabet/CollisionProbability.lean:162
theorem largeAlphabetSampleMixture_collision_probability

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
hn :
1 ≤ n
hd :
1024 * n ^ 2 ≤ d
hq :
0 < q
hq1 :
q ≤ 1
(largeAlphabetSampleMixture n d q (by nlinarith) hq hq1).real {s | ¬ noRepeatedTreatedCell s}
≤ 1 / 8192
Proof (Lean source)
-- @node: largeAlphabetSampleMixture_collision_probability lemma largeAlphabetSampleMixture_collision_probability (n d : ℕ) (q : ℝ) (hn : 1 ≤ n) (hd : 1024 * n ^ 2 ≤ d) (hq : 0 < q) (hq1 : q ≤ 1) : (largeAlphabetSampleMixture n d q (by nlinarith) hq hq1).real {s | ¬ noRepeatedTreatedCell s} ≤ 1 / 8192 := by let μ : Measure Bool := (1 / 2 : ℝ≥0∞) • Measure.dirac false + (1 / 2 : ℝ≥0∞) • Measure.dirac true let : IsProbabilityMeasure μ := fairBinary_probability let : IsProbabilityMeasure (binaryCellPrior d) := inferInstanceAs (IsProbabilityMeasure (Measure.pi (fun _ : Fin d => μ))) rw [largeAlphabetSampleMixture_real_event] calc _ ≤ ∫ _ξ : Fin d → Bool, (1 / 8192 : ℝ) ∂binaryCellPrior d := integral_mono Integrable.of_finite Integrable.of_finite (fun ξ => largeAlphabetLaw_collision_probability n d q ξ hn hd hq hq1) _ = 1 / 8192 := by simp
CausalSmith.Stat.MarRareqLogfrontier.largeAlphabetSampleMixture_collision_probability · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/LargeAlphabet/CollisionProbability.lean:199
theorem largeAlphabet_actual_collision_testing

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
hn :
1 ≤ n
hd :
1024 * n ^ 2 ≤ d
hq :
0 < q
hq1 :
q ≤ 1
κ :
T :
Set ((Fin n → ObsRecord d) × ℝ)
hT :
1 - (1 / 8192 : ℝ)
≤ (largeAlphabetSampleMixture n d q (by nlinarith) hq hq1 ⊗ₘ κ.1).real T
+ (sampleLaw n (largeAlphabetComparisonLaw d q (by nlinarith) hq hq1) ⊗ₘ κ.1).real Tᶜ
Proof (Lean source)
-- @node: largeAlphabet_actual_collision_testing lemma largeAlphabet_actual_collision_testing (n d : ℕ) (q : ℝ) (hn : 1 ≤ n) (hd : 1024 * n ^ 2 ≤ d) (hq : 0 < q) (hq1 : q ≤ 1) (κ : BoundedKernel (Fin n → ObsRecord d)) (T : Set ((Fin n → ObsRecord d) × ℝ)) (hT : MeasurableSet T) : 1 - (1 / 8192 : ℝ) ≤ (largeAlphabetSampleMixture n d q (by nlinarith) hq hq1 ⊗ₘ κ.1).real T + (sampleLaw n (largeAlphabetComparisonLaw d q (by nlinarith) hq hq1) ⊗ₘ κ.1).real Tᶜ := by have hdpos : 1 ≤ d := by nlinarith let := (largeAlphabetComparisonLaw d q hdpos hq hq1).2 let : IsProbabilityMeasure ((largeAlphabetComparisonLaw d q hdpos hq hq1).1.map obs) := Measure.isProbabilityMeasure_map (by fun_prop) let : IsProbabilityMeasure (sampleLaw n (largeAlphabetComparisonLaw d q hdpos hq hq1)) := by unfold sampleLaw infer_instance let : IsProbabilityMeasure (largeAlphabetSampleMixture n d q hdpos hq hq1) := largeAlphabetSampleMixture_probability n d q hdpos hq hq1 exact largeAlphabet_collision_testing _ _ (largeAlphabetSampleMixture_matching n d q hdpos hq hq1) (largeAlphabetSampleMixture_collision_probability n d q hn hd hq hq1) (largeAlphabetComparisonLaw_collision_probability n d q hn hd hq hq1) κ T hT
CausalSmith.Stat.MarRareqLogfrontier.largeAlphabet_actual_collision_testing · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/LargeAlphabet/CollisionProbability.lean:217
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.LargeAlphabet.CollisionTV 4 declarations The event on which every treated baseline category occurs at most once.

The event on which every treated baseline category occurs at most once.

def noRepeatedTreatedCell

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
n d :
ℕ
s :
Fin n → ObsRecord d
i j :
Fin n
i ≠ j
(s i).A = true
(s j).A = true
noRepeatedTreatedCell s :
Prop
(s i).X ≠ (s j).X
theorem largeAlphabet_collision_union_bound

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
b :
ℝ
hpair :
∀ i j : Fin n
if
i < j
then
Q.real {s | (s i).A = true ∧ (s j).A = true ∧ (s i).X = (s j).X} ≤ b
Q.real {s | ¬ noRepeatedTreatedCell s} ≤ (n.choose 2 : ℝ) * b
Proof (Lean source)
-- @node: largeAlphabet_collision_union_bound lemma largeAlphabet_collision_union_bound {n d : ℕ} (Q : Measure (Fin n → ObsRecord d)) [IsProbabilityMeasure Q] (b : ℝ) (hpair : ∀ i j : Fin n, i < j → Q.real {s | (s i).A = true ∧ (s j).A = true ∧ (s i).X = (s j).X} ≤ b) : Q.real {s | ¬ noRepeatedTreatedCell s} ≤ (n.choose 2 : ℝ) * b := by classical let pairs := (Finset.univ ×ˢ (Finset.univ : Finset (Fin n))).filter (fun ij => ij.1 < ij.2) let events (ij : Fin n × Fin n) : Set (Fin n → ObsRecord d) := {s | (s ij.1).A = true ∧ (s ij.2).A = true ∧ (s ij.1).X = (s ij.2).X} have hcover : {s | ¬ noRepeatedTreatedCell s} ⊆ ⋃ ij ∈ pairs, events ij := by intro s hs simp only [Set.mem_ofPred_eq, noRepeatedTreatedCell, not_forall, not_not] at hs obtain ⟨i, j, hij, hi, hj, hx⟩ := hs rcases lt_or_gt_of_ne hij with hlt | hgt · exact Set.mem_iUnion.mpr ⟨(i, j), Set.mem_iUnion.mpr ⟨by simp [pairs, hlt], ⟨hi, hj, hx⟩⟩⟩ · exact Set.mem_iUnion.mpr ⟨(j, i), Set.mem_iUnion.mpr ⟨by simp [pairs, hgt], ⟨hj, hi, hx.symm⟩⟩⟩ calc Q.real {s | ¬ noRepeatedTreatedCell s} ≤ Q.real (⋃ ij ∈ pairs, events ij) := measureReal_mono hcover (measure_ne_top Q _) _ ≤ ∑ ij ∈ pairs, Q.real (events ij) := measureReal_biUnion_finset_le pairs events _ ≤ ∑ _ij ∈ pairs, b := by apply Finset.sum_le_sum intro ij hij exact hpair ij.1 ij.2 (by simpa [pairs] using hij) _ = (n.choose 2 : ℝ) * b := by simp only [Finset.sum_const, nsmul_eq_mul] congr 1 simpa [pairs] using congrArg (fun k : ℕ => (k : ℝ)) (Finset.card_product_filter_lt (s := (Finset.univ : Finset (Fin n))))
CausalSmith.Stat.MarRareqLogfrontier.largeAlphabet_collision_union_bound · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/LargeAlphabet/CollisionTV.lean:14
theorem largeAlphabet_tv_le_collision_mass Lemma largeAlphabet_tv_le_collision_mass in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
E :
Set Z
hmatch :
∀ z ∈ E, Q₀.real {z} = Q₁.real {z}
tvDist Q₀ Q₁ ≤ (Q₀.real Eᶜ + Q₁.real Eᶜ) / 2
Proof (Lean source)
-- @node: largeAlphabet_tv_le_collision_mass lemma largeAlphabet_tv_le_collision_mass {Z : Type*} [Finite Z] [MeasurableSpace Z] [MeasurableSingletonClass Z] (Q₀ Q₁ : Measure Z) [IsProbabilityMeasure Q₀] [IsProbabilityMeasure Q₁] (E : Set Z) (hmatch : ∀ z ∈ E, Q₀.real {z} = Q₁.real {z}) : tvDist Q₀ Q₁ ≤ (Q₀.real Eᶜ + Q₁.real Eᶜ) / 2 := by classical let _ := ofFinite Z have hmass (Q : Measure Z) [IsProbabilityMeasure Q] : Q.real Eᶜ = ∑ z : Z, Eᶜ.indicator (fun z => Q.real {z}) z := by simpa only [tsum_fintype] using probability_measureReal_eq_tsum_singletons Q Eᶜ (by measurability) have hsum : (∑ z : Z, |Q₀.real {z} - Q₁.real {z}|) ≤ Q₀.real Eᶜ + Q₁.real Eᶜ := by rw [hmass Q₀, hmass Q₁, ← Finset.sum_add_distrib] apply Finset.sum_le_sum intro z _ by_cases hz : z ∈ E · simp [hmatch z hz, indicator, hz] · simp only [Set.mem_compl_iff, hz, not_false_eq_true, Set.indicator_of_mem] apply abs_le.mpr constructor <;> linarith [measureReal_nonneg (μ := Q₀) (s := {z}), measureReal_nonneg (μ := Q₁) (s := {z})] have htv := tvDist_le_half_tsum_singleton_abs Q₀ Q₁ rw [tsum_fintype] at htv exact htv.trans (by linarith)
CausalSmith.Stat.MarRareqLogfrontier.largeAlphabet_tv_le_collision_mass · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/LargeAlphabet/CollisionTV.lean:51
theorem largeAlphabet_collision_testing

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
hmatch :
∀ s
then
Q₀.real {s} = Q₁.real {s}
hcollision₀ :
Q₀.real {s | ¬ noRepeatedTreatedCell s} ≤ 1 / 8192
hcollision₁ :
Q₁.real {s | ¬ noRepeatedTreatedCell s} ≤ 1 / 8192
κ :
T :
Set ((Fin n → ObsRecord d) × ℝ)
hT :
1 - (1 / 8192 : ℝ) ≤ (Q₀ ⊗ₘ κ.1).real T + (Q₁ ⊗ₘ κ.1).real Tᶜ
Proof (Lean source)
-- @node: largeAlphabet_collision_testing lemma largeAlphabet_collision_testing {n d : ℕ} (Q₀ Q₁ : Measure (Fin n → ObsRecord d)) [IsProbabilityMeasure Q₀] [IsProbabilityMeasure Q₁] (hmatch : ∀ s, noRepeatedTreatedCell s → Q₀.real {s} = Q₁.real {s}) (hcollision₀ : Q₀.real {s | ¬ noRepeatedTreatedCell s} ≤ 1 / 8192) (hcollision₁ : Q₁.real {s | ¬ noRepeatedTreatedCell s} ≤ 1 / 8192) (κ : BoundedKernel (Fin n → ObsRecord d)) (T : Set ((Fin n → ObsRecord d) × ℝ)) (hT : MeasurableSet T) : 1 - (1 / 8192 : ℝ) ≤ (Q₀ ⊗ₘ κ.1).real T + (Q₁ ⊗ₘ κ.1).real Tᶜ := by let : IsMarkovKernel κ.1 := κ.2.1 have htv := largeAlphabet_tv_le_collision_mass Q₀ Q₁ {s | noRepeatedTreatedCell s} hmatch have hbudget : tvDist Q₀ Q₁ ≤ 1 / 8192 := by change tvDist Q₀ Q₁ ≤ (Q₀.real {s | ¬ noRepeatedTreatedCell s} + Q₁.real {s | ¬ noRepeatedTreatedCell s}) / 2 at htv linarith exact (sub_le_sub_left hbudget 1).trans ((randomized_kernel_tv_comparison Q₀ Q₁ κ.1).2.2.1 T hT)
CausalSmith.Stat.MarRareqLogfrontier.largeAlphabet_collision_testing · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/LargeAlphabet/CollisionTV.lean:79
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.LargeAlphabet.ComparisonLaw 23 declarations The comparison member with independent treated outcome and arrival draws.

The comparison member with independent treated outcome and arrival draws. This is the law P_* in equations (3) and (5) of the large-alphabet roadmap.

theorem largeAlphabetComparison_parameters Lemma largeAlphabetComparison_parameters in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
q :
ℝ
hq :
0 < q
hq1 :
q ≤ 1
conclusion 1
q / (1 + q) ∈ Icc (0 : ℝ) 1
conclusion 2
q ≤ (1 + q) / 2
conclusion 3
(1 + q) / 2 ∈ Icc (0 : ℝ) 1
Proof (Lean source)
-- @node: largeAlphabetComparison_parameters lemma largeAlphabetComparison_parameters (q : ℝ) (hq : 0 < q) (hq1 : q ≤ 1) : q / (1 + q) ∈ Icc (0 : ℝ) 1 ∧ q ≤ (1 + q) / 2 ∧ (1 + q) / 2 ∈ Icc (0 : ℝ) 1 := by have hp : 0 < 1 + q := by linarith refine ⟨⟨by positivity, (div_le_iff₀ hp).mpr (by linarith)⟩, by linarith, by constructor <;> linarith⟩
CausalSmith.Stat.MarRareqLogfrontier.largeAlphabetComparison_parameters · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/LargeAlphabet/ComparisonLaw.lean:12

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
q :
ℝ
a :
largeAlphabetComparisonArrival q a :
ℝ
if a then (1 + q) / 2 else 1
CausalSmith.Stat.MarRareqLogfrontier.largeAlphabetComparisonArrival · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/LargeAlphabet/ComparisonLaw.lean:21
theorem largeAlphabetComparisonArrival_bounds

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
q :
ℝ
hq :
0 < q
hq1 :
q ≤ 1
a :
conclusion 1
conclusion 2
largeAlphabetComparisonArrival q a ∈ Icc (0 : ℝ) 1
Proof (Lean source)
lemma largeAlphabetComparisonArrival_bounds (q : ℝ) (hq : 0 < q) (hq1 : q ≤ 1) (a : Bool) : q ≤ largeAlphabetComparisonArrival q a ∧ largeAlphabetComparisonArrival q a ∈ Icc (0 : ℝ) 1 := by have hp := largeAlphabetComparison_parameters q hq hq1 cases a · simp only [largeAlphabetComparisonArrival, Bool.false_eq_true, if_false] exact ⟨hq1, by norm_num⟩ · exact ⟨hp.2.1, hp.2.2⟩
CausalSmith.Stat.MarRareqLogfrontier.largeAlphabetComparisonArrival_bounds · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/LargeAlphabet/ComparisonLaw.lean:27

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
d :
ℕ
q :
ℝ
a y r :
largeAlphabetComparisonWeight d q a y r :
ℝ
(1 / (2 * (d : ℝ))) * completeBernWeight (q / (1 + q)) y * completeBernWeight (largeAlphabetComparisonArrival q a) r
CausalSmith.Stat.MarRareqLogfrontier.largeAlphabetComparisonWeight · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/LargeAlphabet/ComparisonLaw.lean:38
theorem largeAlphabetComparisonWeight_nonneg

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
q :
ℝ
hq :
0 < q
hq1 :
q ≤ 1
a y r :
Proof (Lean source)
lemma largeAlphabetComparisonWeight_nonneg (d : ℕ) (q : ℝ) (hq : 0 < q) (hq1 : q ≤ 1) (a y r : Bool) : 0 ≤ largeAlphabetComparisonWeight d q a y r := by have hy := (largeAlphabetComparison_parameters q hq hq1).1 have hr := (largeAlphabetComparisonArrival_bounds q hq hq1 a).2 have hb (p : ℝ) (hp : p ∈ Icc (0 : ℝ) 1) (b : Bool) : 0 ≤ completeBernWeight p b := by cases b <;> simp [completeBernWeight] <;> linarith [hp.1, hp.2] exact mul_nonneg (mul_nonneg (by positivity) (hb _ hy y)) (hb _ hr r)
CausalSmith.Stat.MarRareqLogfrontier.largeAlphabetComparisonWeight_nonneg · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/LargeAlphabet/ComparisonLaw.lean:45
def largeAlphabetComparisonMeasure

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
d :
ℕ
q :
ℝ
largeAlphabetComparisonMeasure d q :
∑ x : Fin d, ∑ a : Bool, ∑ y : Bool, ∑ r : Bool, ofReal (largeAlphabetComparisonWeight d q a y r) • Measure.dirac (⟨x, a, false, false, false, y, r⟩ : FullRecord d)
CausalSmith.Stat.MarRareqLogfrontier.largeAlphabetComparisonMeasure · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/LargeAlphabet/ComparisonLaw.lean:57
theorem largeAlphabetComparisonWeight_sum_arrival

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
q :
ℝ
hq :
0 < q
hq1 :
q ≤ 1
a y :
= ofReal ((1 / (2 * (d : ℝ))) * completeBernWeight (q / (1 + q)) y)
Proof (Lean source)
lemma largeAlphabetComparisonWeight_sum_arrival (d : ℕ) (q : ℝ) (hq : 0 < q) (hq1 : q ≤ 1) (a y : Bool) : (∑ r : Bool, ofReal (largeAlphabetComparisonWeight d q a y r)) = ofReal ((1 / (2 * (d : ℝ))) * completeBernWeight (q / (1 + q)) y) := by rw [Fintype.sum_bool, ← ENNReal.ofReal_add (largeAlphabetComparisonWeight_nonneg d q hq hq1 a y true) (largeAlphabetComparisonWeight_nonneg d q hq hq1 a y false)] congr 1 simp only [largeAlphabetComparisonWeight, completeBernWeight, if_true, Bool.false_eq_true, if_false] ring
CausalSmith.Stat.MarRareqLogfrontier.largeAlphabetComparisonWeight_sum_arrival · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/LargeAlphabet/ComparisonLaw.lean:65
theorem largeAlphabetComparisonMeasure_univ

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
q :
ℝ
hd :
1 ≤ d
hq :
0 < q
hq1 :
q ≤ 1
Proof (Lean source)
lemma largeAlphabetComparisonMeasure_univ (d : ℕ) (q : ℝ) (hd : 1 ≤ d) (hq : 0 < q) (hq1 : q ≤ 1) : largeAlphabetComparisonMeasure d q univ = 1 := by have hdpos : 0 < (d : ℝ) := by exact_mod_cast hd have hp := (largeAlphabetComparison_parameters q hq hq1).1 have hsum : (∑ y : Bool, ofReal ((1 / (2 * (d : ℝ))) * completeBernWeight (q / (1 + q)) y)) = ofReal (1 / (2 * (d : ℝ))) := by simp only [Fintype.sum_bool, completeBernWeight, if_true, Bool.false_eq_true, if_false] rw [← ENNReal.ofReal_add (mul_nonneg (by positivity) hp.1) (mul_nonneg (by positivity) (sub_nonneg.mpr hp.2))] congr 1 ring simp only [largeAlphabetComparisonMeasure, Measure.finsetSum_apply, Measure.smul_apply, Measure.dirac_apply_of_mem (mem_univ _), smul_eq_mul, mul_one, largeAlphabetComparisonWeight_sum_arrival d q hq hq1, hsum] simp only [Finset.sum_const, Finset.card_univ, Fintype.card_bool, Fintype.card_fin, nsmul_eq_mul] rw [← ENNReal.ofReal_natCast, ← ENNReal.ofReal_natCast, ← ENNReal.ofReal_mul (by positivity), ← ENNReal.ofReal_mul (by positivity)] have heq : (d : ℝ) * (2 * (1 / (2 * (d : ℝ)))) = 1 := by field_simp norm_num only [Nat.cast_ofNat] at ⊢ rw [heq] norm_num
CausalSmith.Stat.MarRareqLogfrontier.largeAlphabetComparisonMeasure_univ · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/LargeAlphabet/ComparisonLaw.lean:79
def largeAlphabetComparisonLaw

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
d :
ℕ
q :
ℝ
hd :
1 ≤ d
hq :
0 < q
hq1 :
q ≤ 1
largeAlphabetComparisonLaw d q hd hq hq1 :
⟨largeAlphabetComparisonMeasure d q, ⟨largeAlphabetComparisonMeasure_univ d q hd hq hq1⟩⟩
CausalSmith.Stat.MarRareqLogfrontier.largeAlphabetComparisonLaw · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/LargeAlphabet/ComparisonLaw.lean:105
theorem largeAlphabetComparisonLaw_real_event

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
q :
ℝ
hd :
1 ≤ d
hq :
0 < q
hq1 :
q ≤ 1
E :
(largeAlphabetComparisonLaw d q hd hq hq1).1.real E
= by classical exact ∑ x : Fin d, ∑ a : Bool, ∑ y : Bool, ∑ r : Bool, if (⟨x, a, false, false, false, y, r⟩ : FullRecord d) ∈ E then largeAlphabetComparisonWeight d q a y r else 0
Proof (Lean source)
-- @node: largeAlphabetComparisonLaw_real_event lemma largeAlphabetComparisonLaw_real_event (d : ℕ) (q : ℝ) (hd : 1 ≤ d) (hq : 0 < q) (hq1 : q ≤ 1) (E : Set (FullRecord d)) : (largeAlphabetComparisonLaw d q hd hq hq1).1.real E = by classical exact ∑ x : Fin d, ∑ a : Bool, ∑ y : Bool, ∑ r : Bool, if (⟨x, a, false, false, false, y, r⟩ : FullRecord d) ∈ E then largeAlphabetComparisonWeight d q a y r else 0 := by classical simp only [largeAlphabetComparisonLaw, largeAlphabetComparisonMeasure, Measure.real, Measure.finsetSum_apply, Measure.smul_apply, smul_eq_mul, Measure.dirac_apply, Set.indicator_apply, Pi.one_apply, mul_ite, mul_one, mul_zero] have hfinite (x : Fin d) (a y r : Bool) : (if (⟨x, a, false, false, false, y, r⟩ : FullRecord d) ∈ E then ofReal (largeAlphabetComparisonWeight d q a y r) else 0) ≠ ⊤ := by split_ifs <;> simp rw [ENNReal.toReal_sum (by simp only [ENNReal.sum_ne_top]; intros; apply hfinite)] apply Finset.sum_congr rfl intro x _ rw [ENNReal.toReal_sum (by simp only [ENNReal.sum_ne_top]; intros; apply hfinite)] apply Finset.sum_congr rfl intro a _ rw [ENNReal.toReal_sum (by simp only [ENNReal.sum_ne_top]; intros; apply hfinite)] apply Finset.sum_congr rfl intro y _ rw [ENNReal.toReal_sum (by intros; apply hfinite)] apply Finset.sum_congr rfl intro r _ split_ifs · exact ENNReal.toReal_ofReal (largeAlphabetComparisonWeight_nonneg d q hq hq1 a y r) · rfl
CausalSmith.Stat.MarRareqLogfrontier.largeAlphabetComparisonLaw_real_event · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/LargeAlphabet/ComparisonLaw.lean:112
theorem largeAlphabetComparisonLaw_integral

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
q :
ℝ
hd :
1 ≤ d
hq :
0 < q
hq1 :
q ≤ 1
f :
FullRecord d → ℝ
(∫ w, f w ∂(largeAlphabetComparisonLaw d q hd hq hq1).1)
= ∑ x : Fin d, ∑ a : Bool, ∑ y : Bool, ∑ r : Bool, largeAlphabetComparisonWeight d q a y r * f ⟨x, a, false, false, false, y, r⟩
Proof (Lean source)
-- @node: largeAlphabetComparisonLaw_integral lemma largeAlphabetComparisonLaw_integral (d : ℕ) (q : ℝ) (hd : 1 ≤ d) (hq : 0 < q) (hq1 : q ≤ 1) (f : FullRecord d → ℝ) : (∫ w, f w ∂(largeAlphabetComparisonLaw d q hd hq hq1).1) = ∑ x : Fin d, ∑ a : Bool, ∑ y : Bool, ∑ r : Bool, largeAlphabetComparisonWeight d q a y r * f ⟨x, a, false, false, false, y, r⟩ := by have hi (x : Fin d) (a y r : Bool) : Integrable f (ofReal (largeAlphabetComparisonWeight d q a y r) • Measure.dirac (⟨x, a, false, false, false, y, r⟩ : FullRecord d)) := by exact (integrable_dirac (by simp)).smul_measure ENNReal.ofReal_ne_top have hir (x : Fin d) (a y : Bool) : Integrable f (∑ r : Bool, ofReal (largeAlphabetComparisonWeight d q a y r) • Measure.dirac (⟨x, a, false, false, false, y, r⟩ : FullRecord d)) := by apply integrable_finsetSum_measure.mpr intro r _ exact hi x a y r have hiy (x : Fin d) (a : Bool) : Integrable f (∑ y : Bool, ∑ r : Bool, ofReal (largeAlphabetComparisonWeight d q a y r) • Measure.dirac (⟨x, a, false, false, false, y, r⟩ : FullRecord d)) := by apply integrable_finsetSum_measure.mpr intro y _ exact hir x a y have hia (x : Fin d) : Integrable f (∑ a : Bool, ∑ y : Bool, ∑ r : Bool, ofReal (largeAlphabetComparisonWeight d q a y r) • Measure.dirac (⟨x, a, false, false, false, y, r⟩ : FullRecord d)) := by apply integrable_finsetSum_measure.mpr intro a _ exact hiy x a change (∫ w, f w ∂largeAlphabetComparisonMeasure d q) = _ rw [largeAlphabetComparisonMeasure, integral_finsetSum_measure (by intro x _; exact hia x)] apply Finset.sum_congr rfl intro x _ rw [integral_finsetSum_measure (by intro a _; exact hiy x a)] apply Finset.sum_congr rfl intro a _ rw [integral_finsetSum_measure (by intro y _; exact hir x a y)] apply Finset.sum_congr rfl intro y _ rw [integral_finsetSum_measure (by intro r _; exact hi x a y r)] apply Finset.sum_congr rfl intro r _ rw [integral_smul_measure, integral_dirac, ENNReal.toReal_ofReal (largeAlphabetComparisonWeight_nonneg d q hq hq1 a y r)] rfl
CausalSmith.Stat.MarRareqLogfrontier.largeAlphabetComparisonLaw_integral · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/LargeAlphabet/ComparisonLaw.lean:145
theorem largeAlphabetComparisonLaw_ate

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
q :
ℝ
hd :
1 ≤ d
hq :
0 < q
hq1 :
q ≤ 1
ate (largeAlphabetComparisonLaw d q hd hq hq1) = q / (1 + q)
Proof (Lean source)
-- @node: largeAlphabetComparisonLaw_ate lemma largeAlphabetComparisonLaw_ate (d : ℕ) (q : ℝ) (hd : 1 ≤ d) (hq : 0 < q) (hq1 : q ≤ 1) : ate (largeAlphabetComparisonLaw d q hd hq hq1) = q / (1 + q) := by have hdpos : 0 < (d : ℝ) := by exact_mod_cast hd rw [ate, largeAlphabetComparisonLaw_integral] simp [largeAlphabetComparisonWeight, completeBernWeight, largeAlphabetComparisonArrival] field_simp <;> ring
CausalSmith.Stat.MarRareqLogfrontier.largeAlphabetComparisonLaw_ate · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/LargeAlphabet/ComparisonLaw.lean:193
theorem largeAlphabetComparisonLaw_observed_atom

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
q :
ℝ
hd :
1 ≤ d
hq :
0 < q
hq1 :
q ≤ 1
o :
((largeAlphabetComparisonLaw d q hd hq hq1).1.map obs).real {o}
= if o.S = false then (1 / (2 * (d : ℝ))) * (if o.A then if o.R then (if o.RY then q / 2 else 1 / 2) else (if o.RY then 0 else (1 - q) / 2) else if o.R = true ∧ o.RY = false then 1 else 0) else 0
Proof (Lean source)
-- @node: largeAlphabetComparisonLaw_observed_atom lemma largeAlphabetComparisonLaw_observed_atom (d : ℕ) (q : ℝ) (hd : 1 ≤ d) (hq : 0 < q) (hq1 : q ≤ 1) (o : ObsRecord d) : ((largeAlphabetComparisonLaw d q hd hq hq1).1.map obs).real {o} = if o.S = false then (1 / (2 * (d : ℝ))) * (if o.A then if o.R then (if o.RY then q / 2 else 1 / 2) else (if o.RY then 0 else (1 - q) / 2) else if o.R = true ∧ o.RY = false then 1 else 0) else 0 := by classical have hp : 1 + q ≠ 0 := by linarith rw [measureReal_def, Measure.map_apply (by fun_prop) (by simp)] change (largeAlphabetComparisonLaw d q hd hq hq1).1.real (obs ⁻¹' {o}) = _ rw [largeAlphabetComparisonLaw_real_event] rcases o with ⟨x, a, s, r, ry⟩ cases a <;> cases s <;> cases r <;> cases ry <;> simp [obs, FullRecord.S, FullRecord.Y, largeAlphabetComparisonWeight, completeBernWeight, largeAlphabetComparisonArrival, ite_and, Finset.sum_ite_irrel, Finset.sum_ite_eq'] <;> field_simp <;> ring
CausalSmith.Stat.MarRareqLogfrontier.largeAlphabetComparisonLaw_observed_atom · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/LargeAlphabet/ComparisonLaw.lean:204
theorem largeAlphabetComparisonLaw_cellProb

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
q :
ℝ
hd :
1 ≤ d
hq :
0 < q
hq1 :
q ≤ 1
a :
x :
Fin d
s :
cellProb (largeAlphabetComparisonLaw d q hd hq hq1) (a, x, s)
= if s then 0 else 1 / (2 * (d : ℝ))
Proof (Lean source)
-- @node: largeAlphabetComparisonLaw_cellProb lemma largeAlphabetComparisonLaw_cellProb (d : ℕ) (q : ℝ) (hd : 1 ≤ d) (hq : 0 < q) (hq1 : q ≤ 1) (a : Bool) (x : Fin d) (s : Bool) : cellProb (largeAlphabetComparisonLaw d q hd hq hq1) (a, x, s) = if s then 0 else 1 / (2 * (d : ℝ)) := by classical rw [cellProb, largeAlphabetComparisonLaw_real_event] cases a <;> cases s <;> simp [inCell, FullRecord.S, largeAlphabetComparisonWeight, completeBernWeight, largeAlphabetComparisonArrival, Finset.sum_ite_irrel, Finset.sum_ite_eq'] <;> ring
CausalSmith.Stat.MarRareqLogfrontier.largeAlphabetComparisonLaw_cellProb · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/LargeAlphabet/ComparisonLaw.lean:227
theorem largeAlphabetComparisonLaw_arrivedCell

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
q :
ℝ
hd :
1 ≤ d
hq :
0 < q
hq1 :
q ≤ 1
a :
x :
Fin d
s :
arrivedCell (largeAlphabetComparisonLaw d q hd hq hq1) (a, x, s)
= largeAlphabetComparisonArrival q a * cellProb (largeAlphabetComparisonLaw d q hd hq hq1) (a, x, s)
Proof (Lean source)
-- @node: largeAlphabetComparisonLaw_arrivedCell lemma largeAlphabetComparisonLaw_arrivedCell (d : ℕ) (q : ℝ) (hd : 1 ≤ d) (hq : 0 < q) (hq1 : q ≤ 1) (a : Bool) (x : Fin d) (s : Bool) : arrivedCell (largeAlphabetComparisonLaw d q hd hq hq1) (a, x, s) = largeAlphabetComparisonArrival q a * cellProb (largeAlphabetComparisonLaw d q hd hq hq1) (a, x, s) := by classical rw [arrivedCell, largeAlphabetComparisonLaw_real_event, largeAlphabetComparisonLaw_cellProb] cases a <;> cases s <;> simp [inCell, FullRecord.S, largeAlphabetComparisonWeight, completeBernWeight, largeAlphabetComparisonArrival, Finset.sum_ite_irrel, Finset.sum_ite_eq'] <;> ring
CausalSmith.Stat.MarRareqLogfrontier.largeAlphabetComparisonLaw_arrivedCell · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/LargeAlphabet/ComparisonLaw.lean:240
theorem largeAlphabetComparisonLaw_mar

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
q :
ℝ
hd :
1 ≤ d
hq :
0 < q
hq1 :
q ≤ 1
Proof (Lean source)
-- @node: largeAlphabetComparisonLaw_mar lemma largeAlphabetComparisonLaw_mar (d : ℕ) (q : ℝ) (hd : 1 ≤ d) (hq : 0 < q) (hq1 : q ≤ 1) : ArrivalMAR (largeAlphabetComparisonLaw d q hd hq hq1) := by classical intro j y r rcases j with ⟨a, x, s⟩ rw [largeAlphabetComparisonLaw_cellProb] simp_rw [largeAlphabetComparisonLaw_real_event] cases a <;> cases s <;> cases y <;> cases r <;> simp [inCell, FullRecord.S, FullRecord.Y, largeAlphabetComparisonWeight, completeBernWeight, largeAlphabetComparisonArrival, ite_and, Finset.sum_ite_irrel, Finset.sum_ite_eq'] all_goals first | (left; ring) | ring
CausalSmith.Stat.MarRareqLogfrontier.largeAlphabetComparisonLaw_mar · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/LargeAlphabet/ComparisonLaw.lean:254
theorem largeAlphabetComparisonLaw_occupiedCellArrival

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
q :
ℝ
hd :
1 ≤ d
hq :
0 < q
hq1 :
q ≤ 1
Proof (Lean source)
lemma largeAlphabetComparisonLaw_occupiedCellArrival (d : ℕ) (q : ℝ) (hd : 1 ≤ d) (hq : 0 < q) (hq1 : q ≤ 1) : OccupiedCellArrival q (largeAlphabetComparisonLaw d q hd hq hq1) := by intro j hj rcases j with ⟨a, x, s⟩ rw [largeAlphabetComparisonLaw_arrivedCell] exact mul_le_mul_of_nonneg_right (largeAlphabetComparisonArrival_bounds q hq hq1 a).1 hj.le
CausalSmith.Stat.MarRareqLogfrontier.largeAlphabetComparisonLaw_occupiedCellArrival · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/LargeAlphabet/ComparisonLaw.lean:271
theorem largeAlphabetComparisonLaw_balanced

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
q :
ℝ
hd :
1 ≤ d
hq :
0 < q
hq1 :
q ≤ 1
Proof (Lean source)
lemma largeAlphabetComparisonLaw_balanced (d : ℕ) (q : ℝ) (hd : 1 ≤ d) (hq : 0 < q) (hq1 : q ≤ 1) : BalancedRandomization (largeAlphabetComparisonLaw d q hd hq hq1) := by classical have hdpos : 0 < (d : ℝ) := by exact_mod_cast hd rw [BalancedRandomization, largeAlphabetComparisonLaw_real_event] calc _ = ∑ _x : Fin d, 1 / (2 * (d : ℝ)) := by apply Finset.sum_congr rfl intro x _ simp [largeAlphabetComparisonWeight, completeBernWeight, largeAlphabetComparisonArrival] ring _ = 1 / 2 := by simp; field_simp
CausalSmith.Stat.MarRareqLogfrontier.largeAlphabetComparisonLaw_balanced · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/LargeAlphabet/ComparisonLaw.lean:282
theorem largeAlphabetComparisonLaw_arm_event_factor

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
q :
ℝ
hd :
1 ≤ d
hq :
0 < q
hq1 :
q ≤ 1
s :
t :
Set (Fin d × Bool × Bool × Bool × Bool)
(largeAlphabetComparisonLaw d q hd hq hq1).1.real {w | w.A ∈ s ∧ (w.X, w.S0, w.S1, w.Y0, w.Y1) ∈ t}
= (by classical exact ((if true ∈ s then (1 : ℝ) else 0) + (if false ∈ s then (1 : ℝ) else 0)) / 2) * (largeAlphabetComparisonLaw d q hd hq hq1).1.real {w | (w.X, w.S0, w.S1, w.Y0, w.Y1) ∈ t}
Proof (Lean source)
-- @node: largeAlphabetComparisonLaw_arm_event_factor lemma largeAlphabetComparisonLaw_arm_event_factor (d : ℕ) (q : ℝ) (hd : 1 ≤ d) (hq : 0 < q) (hq1 : q ≤ 1) (s : Set Bool) (t : Set (Fin d × Bool × Bool × Bool × Bool)) : (largeAlphabetComparisonLaw d q hd hq hq1).1.real {w | w.A ∈ s ∧ (w.X, w.S0, w.S1, w.Y0, w.Y1) ∈ t} = (by classical exact ((if true ∈ s then (1 : ℝ) else 0) + (if false ∈ s then (1 : ℝ) else 0)) / 2) * (largeAlphabetComparisonLaw d q hd hq hq1).1.real {w | (w.X, w.S0, w.S1, w.Y0, w.Y1) ∈ t} := by classical rw [largeAlphabetComparisonLaw_real_event, largeAlphabetComparisonLaw_real_event, Finset.mul_sum] apply Finset.sum_congr rfl intro x _ by_cases hsT : true ∈ s <;> by_cases hsF : false ∈ s <;> by_cases htT : (x, false, false, false, true) ∈ t <;> by_cases htF : (x, false, false, false, false) ∈ t <;> simp [largeAlphabetComparisonWeight, completeBernWeight, largeAlphabetComparisonArrival, hsT, hsF, htT, htF] <;> ring
CausalSmith.Stat.MarRareqLogfrontier.largeAlphabetComparisonLaw_arm_event_factor · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/LargeAlphabet/ComparisonLaw.lean:297
theorem largeAlphabetComparisonLaw_arm_mass

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
q :
ℝ
hd :
1 ≤ d
hq :
0 < q
hq1 :
q ≤ 1
s :
(largeAlphabetComparisonLaw d q hd hq hq1).1.real {w | w.A ∈ s}
= (by classical exact ((if true ∈ s then (1 : ℝ) else 0) + (if false ∈ s then (1 : ℝ) else 0)) / 2)
Proof (Lean source)
lemma largeAlphabetComparisonLaw_arm_mass (d : ℕ) (q : ℝ) (hd : 1 ≤ d) (hq : 0 < q) (hq1 : q ≤ 1) (s : Set Bool) : (largeAlphabetComparisonLaw d q hd hq hq1).1.real {w | w.A ∈ s} = (by classical exact ((if true ∈ s then (1 : ℝ) else 0) + (if false ∈ s then (1 : ℝ) else 0)) / 2) := by let := (largeAlphabetComparisonLaw d q hd hq hq1).2 simpa using largeAlphabetComparisonLaw_arm_event_factor d q hd hq hq1 s univ
CausalSmith.Stat.MarRareqLogfrontier.largeAlphabetComparisonLaw_arm_mass · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/LargeAlphabet/ComparisonLaw.lean:320
theorem largeAlphabetComparisonLaw_randomized

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
q :
ℝ
hd :
1 ≤ d
hq :
0 < q
hq1 :
q ≤ 1
Proof (Lean source)
lemma largeAlphabetComparisonLaw_randomized (d : ℕ) (q : ℝ) (hd : 1 ≤ d) (hq : 0 < q) (hq1 : q ≤ 1) : RandomizedIndependence (largeAlphabetComparisonLaw d q hd hq hq1) := by let := (largeAlphabetComparisonLaw d q hd hq hq1).2 rw [RandomizedIndependence, indepFun_iff_measure_inter_preimage_eq_mul] intro s t _ _ apply (ENNReal.toReal_eq_toReal_iff' (measure_ne_top _ _) (by finiteness)).mp rw [ENNReal.toReal_mul] change (largeAlphabetComparisonLaw d q hd hq hq1).1.real {w | w.A ∈ s ∧ (w.X, w.S0, w.S1, w.Y0, w.Y1) ∈ t} = (largeAlphabetComparisonLaw d q hd hq hq1).1.real {w | w.A ∈ s} * (largeAlphabetComparisonLaw d q hd hq hq1).1.real {w | (w.X, w.S0, w.S1, w.Y0, w.Y1) ∈ t} rw [largeAlphabetComparisonLaw_arm_event_factor, largeAlphabetComparisonLaw_arm_mass]
CausalSmith.Stat.MarRareqLogfrontier.largeAlphabetComparisonLaw_randomized · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/LargeAlphabet/ComparisonLaw.lean:330
theorem largeAlphabetComparisonLaw_model

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hq :
0 < q
hq1 :
q ≤ 1
Proof (Lean source)
-- @node: largeAlphabetComparisonLaw_model lemma largeAlphabetComparisonLaw_model (n d : ℕ) (q : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hq : 0 < q) (hq1 : q ≤ 1) : UnrestrictedArrivalModelClass n d q (largeAlphabetComparisonLaw d q hd hq hq1) := by refine ⟨hn, hd, hq, hq1, largeAlphabetComparisonLaw_randomized d q hd hq hq1, largeAlphabetComparisonLaw_balanced d q hd hq hq1, ?_, ?_, largeAlphabetComparisonLaw_mar d q hd hq hq1, largeAlphabetComparisonLaw_occupiedCellArrival d q hd hq hq1⟩ all_goals filter_upwards [] with w; rfl
CausalSmith.Stat.MarRareqLogfrontier.largeAlphabetComparisonLaw_model · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/LargeAlphabet/ComparisonLaw.lean:346
theorem largeAlphabet_one_visit_matching

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
q :
ℝ
hd :
1 ≤ d
hq :
0 < q
hq1 :
q ≤ 1
o :
(∫ b : Bool, ((largeAlphabetLaw q (fun _ : Fin d => b) hd hq hq1).1.map obs).real {o} ∂((1 / 2 : ℝ≥0∞) • Measure.dirac false + (1 / 2 : ℝ≥0∞) • Measure.dirac true))
= ((largeAlphabetComparisonLaw d q hd hq hq1).1.map obs).real {o}
Proof (Lean source)
-- @node: largeAlphabet_one_visit_matching lemma largeAlphabet_one_visit_matching (d : ℕ) (q : ℝ) (hd : 1 ≤ d) (hq : 0 < q) (hq1 : q ≤ 1) (o : ObsRecord d) : (∫ b : Bool, ((largeAlphabetLaw q (fun _ : Fin d => b) hd hq hq1).1.map obs).real {o} ∂((1 / 2 : ℝ≥0∞) • Measure.dirac false + (1 / 2 : ℝ≥0∞) • Measure.dirac true)) = ((largeAlphabetComparisonLaw d q hd hq hq1).1.map obs).real {o} := by rw [fairBinary_integral] simp_rw [largeAlphabetLaw_observed_atom, largeAlphabetComparisonLaw_observed_atom] rcases o with ⟨x, a, s, r, ry⟩ cases a <;> cases s <;> cases r <;> cases ry <;> simp [largeAlphabetArrival, completeBernWeight] <;> ring
CausalSmith.Stat.MarRareqLogfrontier.largeAlphabet_one_visit_matching · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/LargeAlphabet/ComparisonLaw.lean:357
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.LargeAlphabet.FuzzyPrior 5 declarations The fair product prior on binary cell outcome parameters for the large-alphabet converse.

The fair product prior on binary cell outcome parameters for the large-alphabet converse.

def binaryCellPrior

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
d :
ℕ
binaryCellPrior d :
Measure (Fin d → Bool)
Measure.pi (fun _ : Fin d => (1 / 2 : ℝ≥0∞) • Measure.dirac false + (1 / 2 : ℝ≥0∞) • Measure.dirac true)
def cellPriorTarget

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
d :
ℕ
ξ :
Fin d → Bool
cellPriorTarget ξ :
ℝ
(∑ x : Fin d, if ξ x then (1 : ℝ) else 0) / d

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
f :
Bool → ℝ
(∫ b, f b ∂((1 / 2 : ℝ≥0∞) • Measure.dirac false + (1 / 2 : ℝ≥0∞) • Measure.dirac true))
= (f false + f true) / 2
Proof (Lean source)
-- @node: fairBinary_integral lemma fairBinary_integral (f : Bool → ℝ) : (∫ b, f b ∂((1 / 2 : ℝ≥0∞) • Measure.dirac false + (1 / 2 : ℝ≥0∞) • Measure.dirac true)) = (f false + f true) / 2 := by rw [integral_add_measure ((integrable_dirac (by simp)).smul_measure (by norm_num)) ((integrable_dirac (by simp)).smul_measure (by norm_num)), integral_smul_measure, integral_smul_measure] simp ring

the stated mathematical conclusion holds.

Formal statement
IsProbabilityMeasure ((1 / 2 : ℝ≥0∞) • Measure.dirac false + (1 / 2 : ℝ≥0∞) • Measure.dirac true)
Proof (Lean source)
-- @node: fairBinary_probability lemma fairBinary_probability : IsProbabilityMeasure ((1 / 2 : ℝ≥0∞) • Measure.dirac false + (1 / 2 : ℝ≥0∞) • Measure.dirac true) := by constructor norm_num exact ENNReal.inv_two_add_inv_two
CausalSmith.Stat.MarRareqLogfrontier.fairBinary_probability · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/LargeAlphabet/FuzzyPrior.lean:33
theorem binaryCellPrior_target_concentration Lemma binaryCellPrior_target_concentration in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
hd :
1 ≤ d
h :
ℝ
hh :
0 < h
(binaryCellPrior d).real {ξ | h < |cellPriorTarget ξ - 1 / 2|} ≤ 1 / (4 * (d : ℝ) * h ^ 2)
Proof (Lean source)
lemma binaryCellPrior_target_concentration (d : ℕ) (hd : 1 ≤ d) (h : ℝ) (hh : 0 < h) : (binaryCellPrior d).real {ξ | h < |cellPriorTarget ξ - 1 / 2|} ≤ 1 / (4 * (d : ℝ) * h ^ 2) := by let μ : Measure Bool := (1 / 2 : ℝ≥0∞) • Measure.dirac false + (1 / 2 : ℝ≥0∞) • Measure.dirac true let : IsProbabilityMeasure μ := fairBinary_probability let g : Bool → ℝ := fun b => if b then 1 else 0 have hg : MemLp g 2 μ := MemLp.of_discrete have hmean : (∫ b, g b ∂μ) = 1 / 2 := by rw [show μ = _ from rfl, fairBinary_integral] norm_num [g] have hvar : variance g μ = 1 / 4 := by rw [variance_eq_integral hg.aemeasurable, hmean] rw [show μ = _ from rfl, fairBinary_integral] norm_num [g] have hdpos : 0 < (d : ℝ) := by exact_mod_cast hd have hcheb := iid_sum_chebyshev (N := d) μ g hg (mul_pos hdpos hh) rw [hmean, hvar] at hcheb have hsub : {ξ | h < |cellPriorTarget ξ - 1 / 2|} ⊆ {ξ : Fin d → Bool | (d : ℝ) * h ≤ |(∑ x, g (ξ x)) - d * (1 / 2)|} := by intro ξ hξ have heq : (∑ x, g (ξ x)) - d * (1 / 2) = (d : ℝ) * (cellPriorTarget ξ - 1 / 2) := by dsimp [cellPriorTarget, g] field_simp change (d : ℝ) * h ≤ |(∑ x, g (ξ x)) - d * (1 / 2)| rw [heq, abs_mul, abs_of_pos hdpos] exact le_of_lt (mul_lt_mul_of_pos_left hξ hdpos) have hprob := (measure_mono hsub).trans hcheb have hreal := ENNReal.toReal_mono (by simp) hprob rw [ENNReal.toReal_ofReal (by positivity)] at hreal change (binaryCellPrior d).real {ξ | h < |cellPriorTarget ξ - 1 / 2|} ≤ _ at hreal have halg : (d : ℝ) * (1 / 4) / ((d : ℝ) * h) ^ 2 = 1 / (4 * (d : ℝ) * h ^ 2) := by field_simp simpa only [halg] using hreal
CausalSmith.Stat.MarRareqLogfrontier.binaryCellPrior_target_concentration · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/LargeAlphabet/FuzzyPrior.lean:43
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.LargeAlphabet.MemberLaw 20 declarations The deterministic binary-cell members of the large-alphabet lower-bound experiment.

The deterministic binary-cell members of the large-alphabet lower-bound experiment.

def largeAlphabetRecord

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
d :
ℕ
ξ :
Fin d → Bool
x :
Fin d
a r :
largeAlphabetRecord ξ x a r :
⟨x, a, false, false, false, ξ x, r⟩

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
d :
ℕ
q :
ℝ
ξ :
Fin d → Bool
x :
Fin d
a :
largeAlphabetArrival q ξ x a :
ℝ
if a && ξ x then q else 1
def largeAlphabetMeasure

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
d :
ℕ
q :
ℝ
ξ :
Fin d → Bool
largeAlphabetMeasure q ξ :
∑ x : Fin d, ∑ a : Bool, ∑ r : Bool, ofReal ((1 / (2 * (d : ℝ))) * completeBernWeight (largeAlphabetArrival q ξ x a) r) • Measure.dirac (largeAlphabetRecord ξ x a r)
theorem largeAlphabetArrival_bounds

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
q :
ℝ
ξ :
Fin d → Bool
hq :
0 < q
hq1 :
q ≤ 1
x :
Fin d
a :
conclusion 1
q ≤ largeAlphabetArrival q ξ x a
conclusion 2
largeAlphabetArrival q ξ x a ∈ Icc (0 : ℝ) 1
Proof (Lean source)
-- @node: largeAlphabetArrival_bounds lemma largeAlphabetArrival_bounds {d : ℕ} (q : ℝ) (ξ : Fin d → Bool) (hq : 0 < q) (hq1 : q ≤ 1) (x : Fin d) (a : Bool) : q ≤ largeAlphabetArrival q ξ x a ∧ largeAlphabetArrival q ξ x a ∈ Icc (0 : ℝ) 1 := by unfold largeAlphabetArrival split_ifs <;> refine ⟨by linarith, ?_, ?_⟩ <;> linarith
CausalSmith.Stat.MarRareqLogfrontier.largeAlphabetArrival_bounds · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/LargeAlphabet/MemberLaw.lean:31
theorem largeAlphabet_weight_nonneg

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
q :
ℝ
ξ :
Fin d → Bool
hq :
0 < q
hq1 :
q ≤ 1
x :
Fin d
a r :
0 ≤ (1 / (2 * (d : ℝ))) * completeBernWeight (largeAlphabetArrival q ξ x a) r
Proof (Lean source)
-- @node: largeAlphabet_weight_nonneg lemma largeAlphabet_weight_nonneg {d : ℕ} (q : ℝ) (ξ : Fin d → Bool) (hq : 0 < q) (hq1 : q ≤ 1) (x : Fin d) (a r : Bool) : 0 ≤ (1 / (2 * (d : ℝ))) * completeBernWeight (largeAlphabetArrival q ξ x a) r := by have hb := (largeAlphabetArrival_bounds q ξ hq hq1 x a).2 apply mul_nonneg (by positivity) cases r <;> simp only [completeBernWeight, Bool.false_eq_true, if_false, if_true] · linarith [hb.2] · exact hb.1
CausalSmith.Stat.MarRareqLogfrontier.largeAlphabet_weight_nonneg · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/LargeAlphabet/MemberLaw.lean:40
theorem largeAlphabetMeasure_univ

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
q :
ℝ
ξ :
Fin d → Bool
hd :
1 ≤ d
hq :
0 < q
hq1 :
q ≤ 1
largeAlphabetMeasure q ξ univ = 1
Proof (Lean source)
-- @node: largeAlphabetMeasure_univ lemma largeAlphabetMeasure_univ {d : ℕ} (q : ℝ) (ξ : Fin d → Bool) (hd : 1 ≤ d) (hq : 0 < q) (hq1 : q ≤ 1) : largeAlphabetMeasure q ξ univ = 1 := by have hdpos : 0 < (d : ℝ) := by exact_mod_cast hd have hsum (x : Fin d) (a : Bool) : (∑ r : Bool, ofReal ((1 / (2 * (d : ℝ))) * completeBernWeight (largeAlphabetArrival q ξ x a) r)) = ofReal (1 / (2 * (d : ℝ))) := by simp only [Fintype.sum_bool, completeBernWeight, if_true, Bool.false_eq_true, if_false] rw [← ENNReal.ofReal_add (by simpa [completeBernWeight] using largeAlphabet_weight_nonneg q ξ hq hq1 x a true) (by simpa [completeBernWeight] using largeAlphabet_weight_nonneg q ξ hq hq1 x a false)] congr 1 ring simp only [largeAlphabetMeasure, Measure.finsetSum_apply, Measure.smul_apply, Measure.dirac_apply_of_mem (mem_univ _), smul_eq_mul, mul_one, hsum] simp only [Finset.sum_const, Finset.card_univ, Fintype.card_bool, Fintype.card_fin, nsmul_eq_mul] rw [← ENNReal.ofReal_natCast, ← ENNReal.ofReal_natCast, ← ENNReal.ofReal_mul (by positivity), ← ENNReal.ofReal_mul (by positivity)] have heq : (d : ℝ) * (2 * (1 / (2 * (d : ℝ)))) = 1 := by field_simp norm_num only [Nat.cast_ofNat] at ⊢ rw [heq] norm_num
CausalSmith.Stat.MarRareqLogfrontier.largeAlphabetMeasure_univ · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/LargeAlphabet/MemberLaw.lean:51
def largeAlphabetLaw

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
d :
ℕ
q :
ℝ
ξ :
Fin d → Bool
hd :
1 ≤ d
hq :
0 < q
hq1 :
q ≤ 1
largeAlphabetLaw q ξ hd hq hq1 :
⟨largeAlphabetMeasure q ξ, ⟨largeAlphabetMeasure_univ q ξ hd hq hq1⟩⟩
theorem largeAlphabetLaw_real_event

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
q :
ℝ
ξ :
Fin d → Bool
hd :
1 ≤ d
hq :
0 < q
hq1 :
q ≤ 1
E :
(largeAlphabetLaw q ξ hd hq hq1).1.real E
= by classical exact ∑ x : Fin d, ∑ a : Bool, ∑ r : Bool, if largeAlphabetRecord ξ x a r ∈ E then (1 / (2 * (d : ℝ))) * completeBernWeight (largeAlphabetArrival q ξ x a) r else 0
Proof (Lean source)
-- @node: largeAlphabetLaw_real_event lemma largeAlphabetLaw_real_event {d : ℕ} (q : ℝ) (ξ : Fin d → Bool) (hd : 1 ≤ d) (hq : 0 < q) (hq1 : q ≤ 1) (E : Set (FullRecord d)) : (largeAlphabetLaw q ξ hd hq hq1).1.real E = by classical exact ∑ x : Fin d, ∑ a : Bool, ∑ r : Bool, if largeAlphabetRecord ξ x a r ∈ E then (1 / (2 * (d : ℝ))) * completeBernWeight (largeAlphabetArrival q ξ x a) r else 0 := by classical simp only [largeAlphabetLaw, largeAlphabetMeasure, Measure.real, Measure.finsetSum_apply, Measure.smul_apply, smul_eq_mul, Measure.dirac_apply, Set.indicator_apply, Pi.one_apply, mul_ite, mul_one, mul_zero] rw [ENNReal.toReal_sum (by simp only [ENNReal.sum_ne_top] intros split_ifs <;> simp only [ENNReal.ofReal_ne_top, ne_eq, ENNReal.zero_ne_top, not_false_eq_true])] apply Finset.sum_congr rfl intro x _ rw [ENNReal.toReal_sum (by simp only [ENNReal.sum_ne_top] intros split_ifs <;> simp only [ENNReal.ofReal_ne_top, ne_eq, ENNReal.zero_ne_top, not_false_eq_true])] apply Finset.sum_congr rfl intro a _ rw [ENNReal.toReal_sum (by intros split_ifs <;> simp only [ENNReal.ofReal_ne_top, ne_eq, ENNReal.zero_ne_top, not_false_eq_true])] apply Finset.sum_congr rfl intro r _ split_ifs · exact ENNReal.toReal_ofReal (largeAlphabet_weight_nonneg q ξ hq hq1 x a r) · rfl
CausalSmith.Stat.MarRareqLogfrontier.largeAlphabetLaw_real_event · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/LargeAlphabet/MemberLaw.lean:84
theorem largeAlphabetLaw_cellProb

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
q :
ℝ
ξ :
Fin d → Bool
hd :
1 ≤ d
hq :
0 < q
hq1 :
q ≤ 1
a :
x :
Fin d
s :
cellProb (largeAlphabetLaw q ξ hd hq hq1) (a, x, s) = if s then 0 else 1 / (2 * (d : ℝ))
Proof (Lean source)
-- @node: largeAlphabetLaw_cellProb lemma largeAlphabetLaw_cellProb {d : ℕ} (q : ℝ) (ξ : Fin d → Bool) (hd : 1 ≤ d) (hq : 0 < q) (hq1 : q ≤ 1) (a : Bool) (x : Fin d) (s : Bool) : cellProb (largeAlphabetLaw q ξ hd hq hq1) (a, x, s) = if s then 0 else 1 / (2 * (d : ℝ)) := by classical rw [cellProb, largeAlphabetLaw_real_event] cases a <;> cases s <;> simp [inCell, largeAlphabetRecord, FullRecord.S, completeBernWeight, Finset.sum_ite_irrel, Finset.sum_ite_eq'] <;> ring
CausalSmith.Stat.MarRareqLogfrontier.largeAlphabetLaw_cellProb · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/LargeAlphabet/MemberLaw.lean:119
theorem largeAlphabetLaw_arrivedCell

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
q :
ℝ
ξ :
Fin d → Bool
hd :
1 ≤ d
hq :
0 < q
hq1 :
q ≤ 1
a :
x :
Fin d
s :
arrivedCell (largeAlphabetLaw q ξ hd hq hq1) (a, x, s)
= largeAlphabetArrival q ξ x a * cellProb (largeAlphabetLaw q ξ hd hq hq1) (a, x, s)
Proof (Lean source)
-- @node: largeAlphabetLaw_arrivedCell lemma largeAlphabetLaw_arrivedCell {d : ℕ} (q : ℝ) (ξ : Fin d → Bool) (hd : 1 ≤ d) (hq : 0 < q) (hq1 : q ≤ 1) (a : Bool) (x : Fin d) (s : Bool) : arrivedCell (largeAlphabetLaw q ξ hd hq hq1) (a, x, s) = largeAlphabetArrival q ξ x a * cellProb (largeAlphabetLaw q ξ hd hq hq1) (a, x, s) := by classical rw [arrivedCell, largeAlphabetLaw_real_event, largeAlphabetLaw_cellProb] cases a <;> cases s <;> simp [inCell, largeAlphabetRecord, FullRecord.S, completeBernWeight, Finset.sum_ite_irrel, Finset.sum_ite_eq'] <;> ring
CausalSmith.Stat.MarRareqLogfrontier.largeAlphabetLaw_arrivedCell · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/LargeAlphabet/MemberLaw.lean:131
theorem largeAlphabetLaw_mar

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
q :
ℝ
ξ :
Fin d → Bool
hd :
1 ≤ d
hq :
0 < q
hq1 :
q ≤ 1
ArrivalMAR (largeAlphabetLaw q ξ hd hq hq1)
Proof (Lean source)
-- @node: largeAlphabetLaw_mar lemma largeAlphabetLaw_mar {d : ℕ} (q : ℝ) (ξ : Fin d → Bool) (hd : 1 ≤ d) (hq : 0 < q) (hq1 : q ≤ 1) : ArrivalMAR (largeAlphabetLaw q ξ hd hq hq1) := by classical intro j y r rcases j with ⟨a, x, s⟩ rw [largeAlphabetLaw_cellProb] simp_rw [largeAlphabetLaw_real_event] cases a <;> cases s <;> cases y <;> cases r <;> simp [inCell, largeAlphabetRecord, FullRecord.S, FullRecord.Y, completeBernWeight, Finset.sum_ite_irrel, Finset.sum_ite_eq', ite_and] all_goals first | (left; ring) | (split_ifs <;> ring) | ring
theorem largeAlphabetLaw_occupiedCellArrival

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
q :
ℝ
ξ :
Fin d → Bool
hd :
1 ≤ d
hq :
0 < q
hq1 :
q ≤ 1
Proof (Lean source)
-- @node: largeAlphabetLaw_occupiedCellArrival lemma largeAlphabetLaw_occupiedCellArrival {d : ℕ} (q : ℝ) (ξ : Fin d → Bool) (hd : 1 ≤ d) (hq : 0 < q) (hq1 : q ≤ 1) : OccupiedCellArrival q (largeAlphabetLaw q ξ hd hq hq1) := by intro j hj rcases j with ⟨a, x, s⟩ rw [largeAlphabetLaw_arrivedCell] exact mul_le_mul_of_nonneg_right (largeAlphabetArrival_bounds q ξ hq hq1 x a).1 hj.le
CausalSmith.Stat.MarRareqLogfrontier.largeAlphabetLaw_occupiedCellArrival · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/LargeAlphabet/MemberLaw.lean:158
theorem largeAlphabetLaw_balanced

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
q :
ℝ
ξ :
Fin d → Bool
hd :
1 ≤ d
hq :
0 < q
hq1 :
q ≤ 1
Proof (Lean source)
-- @node: largeAlphabetLaw_balanced lemma largeAlphabetLaw_balanced {d : ℕ} (q : ℝ) (ξ : Fin d → Bool) (hd : 1 ≤ d) (hq : 0 < q) (hq1 : q ≤ 1) : BalancedRandomization (largeAlphabetLaw q ξ hd hq hq1) := by classical have hdpos : 0 < (d : ℝ) := by exact_mod_cast hd rw [BalancedRandomization, largeAlphabetLaw_real_event] calc _ = ∑ _x : Fin d, 1 / (2 * (d : ℝ)) := by apply Finset.sum_congr rfl intro x _ simp [largeAlphabetRecord, completeBernWeight] ring _ = 1 / 2 := by simp; field_simp
CausalSmith.Stat.MarRareqLogfrontier.largeAlphabetLaw_balanced · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/LargeAlphabet/MemberLaw.lean:169
theorem largeAlphabetLaw_arm_event_factor

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
q :
ℝ
ξ :
Fin d → Bool
hd :
1 ≤ d
hq :
0 < q
hq1 :
q ≤ 1
s :
t :
Set (Fin d × Bool × Bool × Bool × Bool)
(largeAlphabetLaw q ξ hd hq hq1).1.real {w | w.A ∈ s ∧ (w.X, w.S0, w.S1, w.Y0, w.Y1) ∈ t}
= (by classical exact ((if true ∈ s then (1 : ℝ) else 0) + (if false ∈ s then (1 : ℝ) else 0)) / 2) * (largeAlphabetLaw q ξ hd hq hq1).1.real {w | (w.X, w.S0, w.S1, w.Y0, w.Y1) ∈ t}
Proof (Lean source)
-- @node: largeAlphabetLaw_arm_event_factor lemma largeAlphabetLaw_arm_event_factor {d : ℕ} (q : ℝ) (ξ : Fin d → Bool) (hd : 1 ≤ d) (hq : 0 < q) (hq1 : q ≤ 1) (s : Set Bool) (t : Set (Fin d × Bool × Bool × Bool × Bool)) : (largeAlphabetLaw q ξ hd hq hq1).1.real {w | w.A ∈ s ∧ (w.X, w.S0, w.S1, w.Y0, w.Y1) ∈ t} = (by classical exact ((if true ∈ s then (1 : ℝ) else 0) + (if false ∈ s then (1 : ℝ) else 0)) / 2) * (largeAlphabetLaw q ξ hd hq hq1).1.real {w | (w.X, w.S0, w.S1, w.Y0, w.Y1) ∈ t} := by classical rw [largeAlphabetLaw_real_event, largeAlphabetLaw_real_event, Finset.mul_sum] apply Finset.sum_congr rfl intro x _ by_cases hsT : true ∈ s <;> by_cases hsF : false ∈ s <;> by_cases ht : (x, false, false, false, ξ x) ∈ t <;> simp [largeAlphabetRecord, completeBernWeight, hsT, hsF, ht] <;> ring
CausalSmith.Stat.MarRareqLogfrontier.largeAlphabetLaw_arm_event_factor · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/LargeAlphabet/MemberLaw.lean:185
theorem largeAlphabetLaw_arm_mass

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
q :
ℝ
ξ :
Fin d → Bool
hd :
1 ≤ d
hq :
0 < q
hq1 :
q ≤ 1
s :
(largeAlphabetLaw q ξ hd hq hq1).1.real {w | w.A ∈ s}
= (by classical exact ((if true ∈ s then (1 : ℝ) else 0) + (if false ∈ s then (1 : ℝ) else 0)) / 2)
Proof (Lean source)
-- @node: largeAlphabetLaw_arm_mass lemma largeAlphabetLaw_arm_mass {d : ℕ} (q : ℝ) (ξ : Fin d → Bool) (hd : 1 ≤ d) (hq : 0 < q) (hq1 : q ≤ 1) (s : Set Bool) : (largeAlphabetLaw q ξ hd hq hq1).1.real {w | w.A ∈ s} = (by classical exact ((if true ∈ s then (1 : ℝ) else 0) + (if false ∈ s then (1 : ℝ) else 0)) / 2) := by let := (largeAlphabetLaw q ξ hd hq hq1).2 simpa using largeAlphabetLaw_arm_event_factor q ξ hd hq hq1 s univ
CausalSmith.Stat.MarRareqLogfrontier.largeAlphabetLaw_arm_mass · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/LargeAlphabet/MemberLaw.lean:204
theorem largeAlphabetLaw_randomized

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
q :
ℝ
ξ :
Fin d → Bool
hd :
1 ≤ d
hq :
0 < q
hq1 :
q ≤ 1
Proof (Lean source)
-- @node: largeAlphabetLaw_randomized lemma largeAlphabetLaw_randomized {d : ℕ} (q : ℝ) (ξ : Fin d → Bool) (hd : 1 ≤ d) (hq : 0 < q) (hq1 : q ≤ 1) : RandomizedIndependence (largeAlphabetLaw q ξ hd hq hq1) := by let := (largeAlphabetLaw q ξ hd hq hq1).2 rw [RandomizedIndependence, indepFun_iff_measure_inter_preimage_eq_mul] intro s t _ _ apply (ENNReal.toReal_eq_toReal_iff' (measure_ne_top _ _) (by finiteness)).mp rw [ENNReal.toReal_mul] change (largeAlphabetLaw q ξ hd hq hq1).1.real {w | w.A ∈ s ∧ (w.X, w.S0, w.S1, w.Y0, w.Y1) ∈ t} = (largeAlphabetLaw q ξ hd hq hq1).1.real {w | w.A ∈ s} * (largeAlphabetLaw q ξ hd hq hq1).1.real {w | (w.X, w.S0, w.S1, w.Y0, w.Y1) ∈ t} rw [largeAlphabetLaw_arm_event_factor, largeAlphabetLaw_arm_mass]
CausalSmith.Stat.MarRareqLogfrontier.largeAlphabetLaw_randomized · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/LargeAlphabet/MemberLaw.lean:214
theorem largeAlphabetLaw_model

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
ξ :
Fin d → Bool
hn :
1 ≤ n
hd :
1 ≤ d
hq :
0 < q
hq1 :
q ≤ 1
Proof (Lean source)
-- @node: largeAlphabetLaw_model lemma largeAlphabetLaw_model {n d : ℕ} (q : ℝ) (ξ : Fin d → Bool) (hn : 1 ≤ n) (hd : 1 ≤ d) (hq : 0 < q) (hq1 : q ≤ 1) : UnrestrictedArrivalModelClass n d q (largeAlphabetLaw q ξ hd hq hq1) := by refine ⟨hn, hd, hq, hq1, largeAlphabetLaw_randomized q ξ hd hq hq1, largeAlphabetLaw_balanced q ξ hd hq hq1, ?_, ?_, largeAlphabetLaw_mar q ξ hd hq hq1, largeAlphabetLaw_occupiedCellArrival q ξ hd hq hq1⟩ all_goals filter_upwards [] with w; rfl
CausalSmith.Stat.MarRareqLogfrontier.largeAlphabetLaw_model · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/LargeAlphabet/MemberLaw.lean:231
theorem largeAlphabetLaw_integral

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
q :
ℝ
ξ :
Fin d → Bool
hd :
1 ≤ d
hq :
0 < q
hq1 :
q ≤ 1
f :
FullRecord d → ℝ
(∫ w, f w ∂(largeAlphabetLaw q ξ hd hq hq1).1)
= ∑ x : Fin d, ∑ a : Bool, ∑ r : Bool, (1 / (2 * (d : ℝ))) * completeBernWeight (largeAlphabetArrival q ξ x a) r * f (largeAlphabetRecord ξ x a r)
Proof (Lean source)
-- @node: largeAlphabetLaw_integral lemma largeAlphabetLaw_integral {d : ℕ} (q : ℝ) (ξ : Fin d → Bool) (hd : 1 ≤ d) (hq : 0 < q) (hq1 : q ≤ 1) (f : FullRecord d → ℝ) : (∫ w, f w ∂(largeAlphabetLaw q ξ hd hq hq1).1) = ∑ x : Fin d, ∑ a : Bool, ∑ r : Bool, (1 / (2 * (d : ℝ))) * completeBernWeight (largeAlphabetArrival q ξ x a) r * f (largeAlphabetRecord ξ x a r) := by have hi (x : Fin d) (a r : Bool) : Integrable f (ofReal ((1 / (2 * (d : ℝ))) * completeBernWeight (largeAlphabetArrival q ξ x a) r) • Measure.dirac (largeAlphabetRecord ξ x a r)) := by exact (integrable_dirac (by simp)).smul_measure ENNReal.ofReal_ne_top have hir (x : Fin d) (a : Bool) : Integrable f (∑ r : Bool, ofReal ((1 / (2 * (d : ℝ))) * completeBernWeight (largeAlphabetArrival q ξ x a) r) • Measure.dirac (largeAlphabetRecord ξ x a r)) := by apply integrable_finsetSum_measure.mpr intro r _ exact hi x a r have hia (x : Fin d) : Integrable f (∑ a : Bool, ∑ r : Bool, ofReal ((1 / (2 * (d : ℝ))) * completeBernWeight (largeAlphabetArrival q ξ x a) r) • Measure.dirac (largeAlphabetRecord ξ x a r)) := by apply integrable_finsetSum_measure.mpr intro a _ exact hir x a change (∫ w, f w ∂largeAlphabetMeasure q ξ) = _ rw [largeAlphabetMeasure, integral_finsetSum_measure (by intro x _; exact hia x)] apply Finset.sum_congr rfl intro x _ rw [integral_finsetSum_measure (by intro a _; exact hir x a)] apply Finset.sum_congr rfl intro a _ rw [integral_finsetSum_measure (by intro r _; exact hi x a r)] apply Finset.sum_congr rfl intro r _ rw [integral_smul_measure, integral_dirac] rw [ENNReal.toReal_ofReal (largeAlphabet_weight_nonneg q ξ hq hq1 x a r)] rfl
CausalSmith.Stat.MarRareqLogfrontier.largeAlphabetLaw_integral · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/LargeAlphabet/MemberLaw.lean:242
theorem largeAlphabetLaw_ate

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
q :
ℝ
ξ :
Fin d → Bool
hd :
1 ≤ d
hq :
0 < q
hq1 :
q ≤ 1
ate (largeAlphabetLaw q ξ hd hq hq1) = cellPriorTarget ξ
Proof (Lean source)
-- @node: largeAlphabetLaw_ate lemma largeAlphabetLaw_ate {d : ℕ} (q : ℝ) (ξ : Fin d → Bool) (hd : 1 ≤ d) (hq : 0 < q) (hq1 : q ≤ 1) : ate (largeAlphabetLaw q ξ hd hq hq1) = cellPriorTarget ξ := by rw [ate, largeAlphabetLaw_integral] unfold cellPriorTarget rw [Finset.sum_div] apply Finset.sum_congr rfl intro x _ cases hx : ξ x <;> simp [largeAlphabetRecord, completeBernWeight, largeAlphabetArrival, hx] <;> ring
theorem largeAlphabetLaw_observed_atom

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
q :
ℝ
ξ :
Fin d → Bool
hd :
1 ≤ d
hq :
0 < q
hq1 :
q ≤ 1
o :
((largeAlphabetLaw q ξ hd hq hq1).1.map obs).real {o} = if o.S = false ∧
o.RY
= (o.R && (o.A && ξ o.X)) then (1 / (2 * (d : ℝ))) * completeBernWeight (largeAlphabetArrival q ξ o.X o.A) o.R else 0
Proof (Lean source)
-- @node: largeAlphabetLaw_observed_atom lemma largeAlphabetLaw_observed_atom {d : ℕ} (q : ℝ) (ξ : Fin d → Bool) (hd : 1 ≤ d) (hq : 0 < q) (hq1 : q ≤ 1) (o : ObsRecord d) : ((largeAlphabetLaw q ξ hd hq hq1).1.map obs).real {o} = if o.S = false ∧ o.RY = (o.R && (o.A && ξ o.X)) then (1 / (2 * (d : ℝ))) * completeBernWeight (largeAlphabetArrival q ξ o.X o.A) o.R else 0 := by classical rw [measureReal_def, Measure.map_apply (by fun_prop) (by simp)] change (largeAlphabetLaw q ξ hd hq hq1).1.real (obs ⁻¹' {o}) = _ rw [largeAlphabetLaw_real_event] rcases o with ⟨x, a, s, r, ry⟩ cases a <;> cases s <;> cases r <;> cases ry <;> simp [obs, largeAlphabetRecord, FullRecord.S, FullRecord.Y, completeBernWeight, ite_and, Finset.sum_ite_irrel, Finset.sum_ite_eq']
CausalSmith.Stat.MarRareqLogfrontier.largeAlphabetLaw_observed_atom · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/LargeAlphabet/MemberLaw.lean:296
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.LargeAlphabet.RiskAveraging 5 declarations Prior averaging of the common randomized test and member squared risks.

Prior averaging of the common randomized test and member squared risks.

theorem largeAlphabetSampleMixture_integral

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
hd :
1 ≤ d
hq :
0 < q
hq1 :
q ≤ 1
f :
(Fin n → ObsRecord d) → ℝ
(∫ s, f s ∂largeAlphabetSampleMixture n d q hd hq hq1)
= ∫ ξ, (∫ s, f s ∂sampleLaw n (largeAlphabetLaw q ξ hd hq hq1)) ∂binaryCellPrior d
Proof (Lean source)
-- @node: largeAlphabetSampleMixture_integral lemma largeAlphabetSampleMixture_integral (n d : ℕ) (q : ℝ) (hd : 1 ≤ d) (hq : 0 < q) (hq1 : q ≤ 1) (f : (Fin n → ObsRecord d) → ℝ) : (∫ s, f s ∂largeAlphabetSampleMixture n d q hd hq hq1) = ∫ ξ, (∫ s, f s ∂sampleLaw n (largeAlphabetLaw q ξ hd hq hq1)) ∂binaryCellPrior d := by classical let μ : Measure Bool := (1 / 2 : ℝ≥0∞) • Measure.dirac false + (1 / 2 : ℝ≥0∞) • Measure.dirac true let : IsProbabilityMeasure μ := fairBinary_probability let : IsProbabilityMeasure (binaryCellPrior d) := inferInstanceAs (IsProbabilityMeasure (Measure.pi (fun _ : Fin d => μ))) let : IsProbabilityMeasure (largeAlphabetSampleMixture n d q hd hq hq1) := largeAlphabetSampleMixture_probability n d q hd hq hq1 rw [integral_fintype Integrable.of_finite] simp only [smul_eq_mul] simp_rw [largeAlphabetSampleMixture_real_singleton] simp_rw [← integral_mul_const] rw [← integral_finsetSum _ (fun _ _ => Integrable.of_finite)] apply integral_congr_ae filter_upwards [] with ξ let := (largeAlphabetLaw q ξ hd hq hq1).2 let : IsProbabilityMeasure ((largeAlphabetLaw q ξ hd hq hq1).1.map obs) := Measure.isProbabilityMeasure_map (by fun_prop) let : IsProbabilityMeasure (sampleLaw n (largeAlphabetLaw q ξ hd hq hq1)) := by unfold sampleLaw infer_instance exact (integral_fintype Integrable.of_finite).symm
CausalSmith.Stat.MarRareqLogfrontier.largeAlphabetSampleMixture_integral · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/LargeAlphabet/RiskAveraging.lean:12
theorem largeAlphabet_joint_event_integral Lemma largeAlphabet_joint_event_integral in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
Z :
κ :
E :
Set (Z × ℝ)
hE :
(Q ⊗ₘ κ.1).real E = ∫ s, ∫ w, E.indicator (fun _ => (1 : ℝ)) (s, w) ∂κ.1 s ∂Q
Proof (Lean source)
-- @node: largeAlphabet_joint_event_integral lemma largeAlphabet_joint_event_integral {Z : Type*} [MeasurableSpace Z] (Q : Measure Z) [IsProbabilityMeasure Q] (κ : BoundedKernel Z) (E : Set (Z × ℝ)) (hE : MeasurableSet E) : (Q ⊗ₘ κ.1).real E = ∫ s, ∫ w, E.indicator (fun _ => (1 : ℝ)) (s, w) ∂κ.1 s ∂Q := by let : IsMarkovKernel κ.1 := κ.2.1 have hi : Integrable (E.indicator (fun _ => (1 : ℝ))) (Q ⊗ₘ κ.1) := (integrable_const 1).indicator hE rw [← Measure.integral_compProd hi, integral_indicator_const 1 hE] simp
CausalSmith.Stat.MarRareqLogfrontier.largeAlphabet_joint_event_integral · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/LargeAlphabet/RiskAveraging.lean:43
theorem largeAlphabetSampleMixture_joint_event

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
hd :
1 ≤ d
hq :
0 < q
hq1 :
q ≤ 1
κ :
E :
Set ((Fin n → ObsRecord d) × ℝ)
hE :
(largeAlphabetSampleMixture n d q hd hq hq1 ⊗ₘ κ.1).real E
= ∫ ξ, (sampleLaw n (largeAlphabetLaw q ξ hd hq hq1) ⊗ₘ κ.1).real E ∂binaryCellPrior d
Proof (Lean source)
-- @node: largeAlphabetSampleMixture_joint_event lemma largeAlphabetSampleMixture_joint_event (n d : ℕ) (q : ℝ) (hd : 1 ≤ d) (hq : 0 < q) (hq1 : q ≤ 1) (κ : BoundedKernel (Fin n → ObsRecord d)) (E : Set ((Fin n → ObsRecord d) × ℝ)) (hE : MeasurableSet E) : (largeAlphabetSampleMixture n d q hd hq hq1 ⊗ₘ κ.1).real E = ∫ ξ, (sampleLaw n (largeAlphabetLaw q ξ hd hq hq1) ⊗ₘ κ.1).real E ∂binaryCellPrior d := by let : IsProbabilityMeasure (largeAlphabetSampleMixture n d q hd hq hq1) := largeAlphabetSampleMixture_probability n d q hd hq hq1 rw [largeAlphabet_joint_event_integral _ κ E hE, largeAlphabetSampleMixture_integral] apply integral_congr_ae filter_upwards [] with ξ let := (largeAlphabetLaw q ξ hd hq hq1).2 let : IsProbabilityMeasure ((largeAlphabetLaw q ξ hd hq hq1).1.map obs) := Measure.isProbabilityMeasure_map (by fun_prop) let : IsProbabilityMeasure (sampleLaw n (largeAlphabetLaw q ξ hd hq hq1)) := by unfold sampleLaw infer_instance exact (largeAlphabet_joint_event_integral _ κ E hE).symm
CausalSmith.Stat.MarRareqLogfrontier.largeAlphabetSampleMixture_joint_event · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/LargeAlphabet/RiskAveraging.lean:56
theorem largeAlphabet_prior_test_risk

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
hd :
1 ≤ d
hq :
0 < q
hq1 :
q ≤ 1
T :
a h :
ℝ
hh :
0 ≤ h
(h ^ 2 / 16) * (largeAlphabetSampleMixture n d q hd hq hq1 ⊗ₘ T.1).real {z | z.2 ≤ a - h / 2}
≤ (∫ ξ, squaredRisk T (largeAlphabetLaw q ξ hd hq hq1) ∂binaryCellPrior d)
+ (h ^ 2 / 16) * (binaryCellPrior d).real {ξ | h / 4 < |cellPriorTarget ξ - a|}
Proof (Lean source)
-- @node: largeAlphabet_prior_test_risk lemma largeAlphabet_prior_test_risk (n d : ℕ) (q : ℝ) (hd : 1 ≤ d) (hq : 0 < q) (hq1 : q ≤ 1) (T : Estimator n d) (a h : ℝ) (hh : 0 ≤ h) : (h ^ 2 / 16) * (largeAlphabetSampleMixture n d q hd hq hq1 ⊗ₘ T.1).real {z | z.2 ≤ a - h / 2} ≤ (∫ ξ, squaredRisk T (largeAlphabetLaw q ξ hd hq hq1) ∂binaryCellPrior d) + (h ^ 2 / 16) * (binaryCellPrior d).real {ξ | h / 4 < |cellPriorTarget ξ - a|} := by classical let μ : Measure Bool := (1 / 2 : ℝ≥0∞) • Measure.dirac false + (1 / 2 : ℝ≥0∞) • Measure.dirac true let : IsProbabilityMeasure μ := fairBinary_probability let : IsProbabilityMeasure (binaryCellPrior d) := inferInstanceAs (IsProbabilityMeasure (Measure.pi (fun _ : Fin d => μ))) rw [largeAlphabetSampleMixture_joint_event n d q hd hq hq1 T _ (by measurability), ← integral_const_mul] have hp (ξ : Fin d → Bool) := by let := (largeAlphabetLaw q ξ hd hq hq1).2 let : IsProbabilityMeasure ((largeAlphabetLaw q ξ hd hq hq1).1.map obs) := Measure.isProbabilityMeasure_map (by fun_prop) let : IsProbabilityMeasure (sampleLaw n (largeAlphabetLaw q ξ hd hq hq1)) := by unfold sampleLaw infer_instance exact largeAlphabet_member_test_risk (sampleLaw n (largeAlphabetLaw q ξ hd hq hq1)) T a h (ate (largeAlphabetLaw q ξ hd hq hq1)) hh have havg := integral_mono (μ := binaryCellPrior d) Integrable.of_finite Integrable.of_finite hp simp_rw [largeAlphabetLaw_ate] at havg rw [integral_add Integrable.of_finite Integrable.of_finite] at havg have hpenalty : (∫ ξ, (if h / 4 < |cellPriorTarget ξ - a| then h ^ 2 / 16 else 0) ∂binaryCellPrior d) = (h ^ 2 / 16) * (binaryCellPrior d).real {ξ | h / 4 < |cellPriorTarget ξ - a|} := by change (∫ ξ, {ξ | h / 4 < |cellPriorTarget ξ - a|}.indicator (fun _ => h ^ 2 / 16) ξ ∂binaryCellPrior d) = _ rw [integral_indicator_const _ (by measurability), smul_eq_mul, mul_comm] rw [hpenalty] at havg simpa only [squaredRisk, largeAlphabetLaw_ate] using havg
CausalSmith.Stat.MarRareqLogfrontier.largeAlphabet_prior_test_risk · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/LargeAlphabet/RiskAveraging.lean:79
theorem largeAlphabet_prior_squaredRisk_le_worst

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hq :
0 < q
hq1 :
q ≤ 1
T :
(∫ ξ, squaredRisk T (largeAlphabetLaw q ξ hd hq hq1) ∂binaryCellPrior d)
≤ worstCaseRiskReal (fun (T : Estimator n d) (P : {P : FullLaw d // UnrestrictedArrivalModelClass n d q P}) => squaredRisk T P.1) T
Proof (Lean source)
-- @node: largeAlphabet_prior_squaredRisk_le_worst lemma largeAlphabet_prior_squaredRisk_le_worst (n d : ℕ) (q : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hq : 0 < q) (hq1 : q ≤ 1) (T : Estimator n d) : (∫ ξ, squaredRisk T (largeAlphabetLaw q ξ hd hq hq1) ∂binaryCellPrior d) ≤ worstCaseRiskReal (fun (T : Estimator n d) (P : {P : FullLaw d // UnrestrictedArrivalModelClass n d q P}) => squaredRisk T P.1) T := by let μ : Measure Bool := (1 / 2 : ℝ≥0∞) • Measure.dirac false + (1 / 2 : ℝ≥0∞) • Measure.dirac true let : IsProbabilityMeasure μ := fairBinary_probability let : IsProbabilityMeasure (binaryCellPrior d) := inferInstanceAs (IsProbabilityMeasure (Measure.pi (fun _ : Fin d => μ))) have hbdd : BddAbove (range (fun P : {P : FullLaw d // UnrestrictedArrivalModelClass n d q P} => squaredRisk T P.1)) := by refine ⟨4, ?_⟩ rintro _ ⟨P, rfl⟩ exact (unrestricted_squaredRisk_bounds T P.1).2 have hle (ξ : Fin d → Bool) := le_worstCaseRisk (risk := fun (T : Estimator n d) (P : {P : FullLaw d // UnrestrictedArrivalModelClass n d q P}) => squaredRisk T P.1) (e := T) hbdd ⟨_, largeAlphabetLaw_model q ξ hn hd hq hq1⟩ simpa using integral_mono (μ := binaryCellPrior d) Integrable.of_finite (integrable_const _) hle
CausalSmith.Stat.MarRareqLogfrontier.largeAlphabet_prior_squaredRisk_le_worst · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/LargeAlphabet/RiskAveraging.lean:123
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.LargeAlphabet.RiskTesting 6 declarations Squared-loss consequences of the common randomized threshold test.

Squared-loss consequences of the common randomized threshold test.

theorem largeAlphabet_joint_loss_integrable Lemma largeAlphabet_joint_loss_integrable in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
Integrable (fun z : Z × ℝ => (z.2 - t) ^ 2) (Q ⊗ₘ κ.1)
Proof (Lean source)
-- @node: largeAlphabet_joint_loss_integrable lemma largeAlphabet_joint_loss_integrable {Z : Type*} [Finite Z] [MeasurableSpace Z] [MeasurableSingletonClass Z] (Q : Measure Z) [IsProbabilityMeasure Q] (κ : BoundedKernel Z) (t : ℝ) : Integrable (fun z : Z × ℝ => (z.2 - t) ^ 2) (Q ⊗ₘ κ.1) := by let : IsMarkovKernel κ.1 := κ.2.1 apply (Measure.integrable_compProd_iff (by fun_prop)).mpr refine ⟨?_, Integrable.of_finite⟩ filter_upwards [] with o have hb : ∀ᵐ w ∂(κ.1 o), w ∈ Icc (-1 : ℝ) 1 := (ae_mem_iff_measure_eq (μ := κ.1 o) measurableSet_Icc.nullMeasurableSet).2 (by simpa only [measure_univ] using κ.2.2 o) have hm : AEStronglyMeasurable (fun w : ℝ => w) (κ.1 o) := by fun_prop exact ((memLp_of_bounded hb hm 2).sub (memLp_const t)).integrable_sq
CausalSmith.Stat.MarRareqLogfrontier.largeAlphabet_joint_loss_integrable · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/LargeAlphabet/RiskTesting.lean:11
theorem largeAlphabet_kernel_event_loss Lemma largeAlphabet_kernel_event_loss in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
κ :
t b :
ℝ
E :
Set (Z × ℝ)
hE :
hdom :
∀ z ∈ E, b ≤ (z.2 - t) ^ 2
b * (Q ⊗ₘ κ.1).real E ≤ ∫ o, ∫ w, (w - t) ^ 2 ∂κ.1 o ∂Q
Proof (Lean source)
-- @node: largeAlphabet_kernel_event_loss lemma largeAlphabet_kernel_event_loss {Z : Type*} [Finite Z] [MeasurableSpace Z] [MeasurableSingletonClass Z] (Q : Measure Z) [IsProbabilityMeasure Q] (κ : BoundedKernel Z) (t b : ℝ) (E : Set (Z × ℝ)) (hE : MeasurableSet E) (hdom : ∀ z ∈ E, b ≤ (z.2 - t) ^ 2) : b * (Q ⊗ₘ κ.1).real E ≤ ∫ o, ∫ w, (w - t) ^ 2 ∂κ.1 o ∂Q := by let : IsMarkovKernel κ.1 := κ.2.1 have hi := largeAlphabet_joint_loss_integrable Q κ t have hmono : ∫ z, E.indicator (fun _ => b) z ∂(Q ⊗ₘ κ.1) ≤ ∫ z : Z × ℝ, (z.2 - t) ^ 2 ∂(Q ⊗ₘ κ.1) := by apply integral_mono ((integrable_const b).indicator hE) hi intro z by_cases hz : z ∈ E · simpa only [indicator_of_mem hz] using hdom z hz · simp only [indicator_of_notMem hz] exact sq_nonneg _ rw [integral_indicator_const b hE, smul_eq_mul, mul_comm, Measure.integral_compProd hi] at hmono exact hmono
CausalSmith.Stat.MarRareqLogfrontier.largeAlphabet_kernel_event_loss · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/LargeAlphabet/RiskTesting.lean:27
theorem largeAlphabet_good_target_test_loss Lemma largeAlphabet_good_target_test_loss in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
a h t w :
ℝ
hh :
0 ≤ h
ht :
|t - a| ≤ h / 4
hw :
w ≤ a - h / 2
h ^ 2 / 16 ≤ (w - t) ^ 2
Proof (Lean source)
-- @node: largeAlphabet_good_target_test_loss lemma largeAlphabet_good_target_test_loss (a h t w : ℝ) (hh : 0 ≤ h) (ht : |t - a| ≤ h / 4) (hw : w ≤ a - h / 2) : h ^ 2 / 16 ≤ (w - t) ^ 2 := by have htlow := (abs_le.mp ht).1 have herr : h / 4 ≤ t - w := by linarith nlinarith [sq_nonneg (t - w - h / 4)]
CausalSmith.Stat.MarRareqLogfrontier.largeAlphabet_good_target_test_loss · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/LargeAlphabet/RiskTesting.lean:49
theorem largeAlphabet_comparison_test_loss Lemma largeAlphabet_comparison_test_loss in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
a h w :
ℝ
hh :
0 ≤ h
hw :
a - h / 2 < w
h ^ 2 / 16 ≤ (w - (a - h)) ^ 2
Proof (Lean source)
-- @node: largeAlphabet_comparison_test_loss lemma largeAlphabet_comparison_test_loss (a h w : ℝ) (hh : 0 ≤ h) (hw : a - h / 2 < w) : h ^ 2 / 16 ≤ (w - (a - h)) ^ 2 := by have herr : h / 2 ≤ w - (a - h) := by linarith nlinarith [sq_nonneg (w - (a - h) - h / 2)]
CausalSmith.Stat.MarRareqLogfrontier.largeAlphabet_comparison_test_loss · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/LargeAlphabet/RiskTesting.lean:58
theorem largeAlphabet_member_test_risk Lemma largeAlphabet_member_test_risk in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
κ :
a h t :
ℝ
hh :
0 ≤ h
(h ^ 2 / 16) * (Q ⊗ₘ κ.1).real {z | z.2 ≤ a - h / 2}
≤ (∫ o, ∫ w, (w - t) ^ 2 ∂κ.1 o ∂Q) + (if h / 4 < |t - a| then h ^ 2 / 16 else 0)
Proof (Lean source)
-- @node: largeAlphabet_member_test_risk lemma largeAlphabet_member_test_risk {Z : Type*} [Finite Z] [MeasurableSpace Z] [MeasurableSingletonClass Z] (Q : Measure Z) [IsProbabilityMeasure Q] (κ : BoundedKernel Z) (a h t : ℝ) (hh : 0 ≤ h) : (h ^ 2 / 16) * (Q ⊗ₘ κ.1).real {z | z.2 ≤ a - h / 2} ≤ (∫ o, ∫ w, (w - t) ^ 2 ∂κ.1 o ∂Q) + (if h / 4 < |t - a| then h ^ 2 / 16 else 0) := by let : IsMarkovKernel κ.1 := κ.2.1 by_cases ht : h / 4 < |t - a| · rw [if_pos ht] have hp : (Q ⊗ₘ κ.1).real {z | z.2 ≤ a - h / 2} ≤ 1 := measureReal_le_one have hm := mul_le_mul_of_nonneg_left hp (by positivity : 0 ≤ h ^ 2 / 16) have hr : 0 ≤ ∫ o, ∫ w, (w - t) ^ 2 ∂κ.1 o ∂Q := integral_nonneg (fun _ => integral_nonneg (fun _ => sq_nonneg _)) linarith · rw [if_neg ht, add_zero] apply largeAlphabet_kernel_event_loss Q κ t (h ^ 2 / 16) _ (by measurability) intro z hz exact largeAlphabet_good_target_test_loss a h t z.2 hh (le_of_not_gt ht) hz
CausalSmith.Stat.MarRareqLogfrontier.largeAlphabet_member_test_risk · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/LargeAlphabet/RiskTesting.lean:66
theorem largeAlphabet_comparison_test_risk Lemma largeAlphabet_comparison_test_risk in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
κ :
a h :
ℝ
hh :
0 ≤ h
(h ^ 2 / 16) * (Q ⊗ₘ κ.1).real {z | ¬ z.2 ≤ a - h / 2}
≤ ∫ o, ∫ w, (w - (a - h)) ^ 2 ∂κ.1 o ∂Q
Proof (Lean source)
-- @node: largeAlphabet_comparison_test_risk lemma largeAlphabet_comparison_test_risk {Z : Type*} [Finite Z] [MeasurableSpace Z] [MeasurableSingletonClass Z] (Q : Measure Z) [IsProbabilityMeasure Q] (κ : BoundedKernel Z) (a h : ℝ) (hh : 0 ≤ h) : (h ^ 2 / 16) * (Q ⊗ₘ κ.1).real {z | ¬ z.2 ≤ a - h / 2} ≤ ∫ o, ∫ w, (w - (a - h)) ^ 2 ∂κ.1 o ∂Q := by apply largeAlphabet_kernel_event_loss Q κ (a - h) (h ^ 2 / 16) _ (by measurability) intro z hz exact largeAlphabet_comparison_test_loss a h z.2 hh (lt_of_not_ge hz)
CausalSmith.Stat.MarRareqLogfrontier.largeAlphabet_comparison_test_risk · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/LargeAlphabet/RiskTesting.lean:90
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.LargeAlphabet.SampleMatching 10 declarations Independence of distinct treated prior coordinates and sample-atom matching.

Independence of distinct treated prior coordinates and sample-atom matching.

theorem binaryCellPrior_integral_distinct_prod Lemma binaryCellPrior_integral_distinct_prod in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
ι :
Type*
d :
ℕ
x :
ι → Fin d
hx :
f :
ι → Bool → ℝ
(∫ ξ, ∏ i, f i (ξ (x i)) ∂binaryCellPrior d) = ∏ i, (f i false + f i true) / 2
Proof (Lean source)
-- @node: binaryCellPrior_integral_distinct_prod lemma binaryCellPrior_integral_distinct_prod {ι : Type*} [Fintype ι] {d : ℕ} (x : ι → Fin d) (hx : Injective x) (f : ι → Bool → ℝ) : (∫ ξ, ∏ i, f i (ξ (x i)) ∂binaryCellPrior d) = ∏ i, (f i false + f i true) / 2 := by let μ : Measure Bool := (1 / 2 : ℝ≥0∞) • Measure.dirac false + (1 / 2 : ℝ≥0∞) • Measure.dirac true let : IsProbabilityMeasure μ := fairBinary_probability have hi : iIndepFun (fun j : Fin d => fun ξ : Fin d → Bool => ξ j) (binaryCellPrior d) := iIndepFun_pi (fun _ => aemeasurable_id) have hprod := (hi.precomp hx).integral_fun_prod_comp (f := f) (fun i => (measurable_pi_apply (x i)).aemeasurable) (fun _ => by fun_prop) rw [hprod] apply Finset.prod_congr rfl intro i _ change (∫ ξ, f i (ξ (x i)) ∂Measure.pi (fun _ : Fin d => μ)) = _ have hp := measurePreserving_eval (fun _ : Fin d => μ) (x i) rw [← integral_map hp.measurable.aemeasurable (by fun_prop), hp.map_eq] exact fairBinary_integral (f i)
CausalSmith.Stat.MarRareqLogfrontier.binaryCellPrior_integral_distinct_prod · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/LargeAlphabet/SampleMatching.lean:13
theorem binaryCellPrior_integral_partial_distinct_prod Lemma binaryCellPrior_integral_partial_distinct_prod in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
ι :
Type*
d :
ℕ
p :
ι → Prop
x :
ι → Fin d
f :
ι → Bool → ℝ
hx :
Injective (fun i : {i // p i} => x i)
hc :
∀ i
if
¬ p i
then
f i true = f i false
(∫ ξ, ∏ i, f i (ξ (x i)) ∂binaryCellPrior d) = ∏ i, (f i false + f i true) / 2
Proof (Lean source)
-- @node: binaryCellPrior_integral_partial_distinct_prod lemma binaryCellPrior_integral_partial_distinct_prod {ι : Type*} [Fintype ι] {d : ℕ} (p : ι → Prop) (x : ι → Fin d) (f : ι → Bool → ℝ) (hx : Injective (fun i : {i // p i} => x i)) (hc : ∀ i, ¬ p i → f i true = f i false) : (∫ ξ, ∏ i, f i (ξ (x i)) ∂binaryCellPrior d) = ∏ i, (f i false + f i true) / 2 := by classical let μ : Measure Bool := (1 / 2 : ℝ≥0∞) • Measure.dirac false + (1 / 2 : ℝ≥0∞) • Measure.dirac true let : IsProbabilityMeasure μ := fairBinary_probability let : IsProbabilityMeasure (binaryCellPrior d) := inferInstanceAs (IsProbabilityMeasure (Measure.pi (fun _ : Fin d => μ))) have hconst (ξ : Fin d → Bool) (i : {i // ¬ p i}) : f i (ξ (x i)) = f i false := by cases ξ (x i) · rfl · exact hc i i.property have heq : (fun ξ : Fin d → Bool => ∏ i, f i (ξ (x i))) = (fun ξ => (∏ i : {i // p i}, f i (ξ (x i))) * (∏ i : {i // ¬ p i}, f i false)) := by funext ξ rw [← Fintype.prod_subtype_mul_prod_subtype p] simp_rw [hconst] rw [heq, integral_mul_const, binaryCellPrior_integral_distinct_prod (fun i : {i // p i} => x i) hx] rw [← Fintype.prod_subtype_mul_prod_subtype p] congr 1 apply Finset.prod_congr rfl intro i _ rw [hc i i.property] ring
CausalSmith.Stat.MarRareqLogfrontier.binaryCellPrior_integral_partial_distinct_prod · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/LargeAlphabet/SampleMatching.lean:35
theorem largeAlphabetLaw_atom_coordinate

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
q :
ℝ
ξ :
Fin d → Bool
hd :
1 ≤ d
hq :
0 < q
hq1 :
q ≤ 1
o :
((largeAlphabetLaw q ξ hd hq hq1).1.map obs).real {o}
= ((largeAlphabetLaw q (fun _ : Fin d => ξ o.X) hd hq hq1).1.map obs).real {o}
Proof (Lean source)
-- @node: largeAlphabetLaw_atom_coordinate lemma largeAlphabetLaw_atom_coordinate {d : ℕ} (q : ℝ) (ξ : Fin d → Bool) (hd : 1 ≤ d) (hq : 0 < q) (hq1 : q ≤ 1) (o : ObsRecord d) : ((largeAlphabetLaw q ξ hd hq hq1).1.map obs).real {o} = ((largeAlphabetLaw q (fun _ : Fin d => ξ o.X) hd hq hq1).1.map obs).real {o} := by simp only [largeAlphabetLaw_observed_atom, largeAlphabetArrival]
CausalSmith.Stat.MarRareqLogfrontier.largeAlphabetLaw_atom_coordinate · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/LargeAlphabet/SampleMatching.lean:69
theorem largeAlphabetLaw_control_atom_constant

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
q :
ℝ
hd :
1 ≤ d
hq :
0 < q
hq1 :
q ≤ 1
o :
ha :
o.A ≠ true
((largeAlphabetLaw q (fun _ : Fin d => true) hd hq hq1).1.map obs).real {o}
= ((largeAlphabetLaw q (fun _ : Fin d => false) hd hq hq1).1.map obs).real {o}
Proof (Lean source)
-- @node: largeAlphabetLaw_control_atom_constant lemma largeAlphabetLaw_control_atom_constant {d : ℕ} (q : ℝ) (hd : 1 ≤ d) (hq : 0 < q) (hq1 : q ≤ 1) (o : ObsRecord d) (ha : o.A ≠ true) : ((largeAlphabetLaw q (fun _ : Fin d => true) hd hq hq1).1.map obs).real {o} = ((largeAlphabetLaw q (fun _ : Fin d => false) hd hq hq1).1.map obs).real {o} := by have hf : o.A = false := Bool.eq_false_iff.mpr ha simp only [largeAlphabetLaw_observed_atom, largeAlphabetArrival, hf, Bool.false_and, Bool.and_false, Bool.false_eq_true, if_false]
CausalSmith.Stat.MarRareqLogfrontier.largeAlphabetLaw_control_atom_constant · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/LargeAlphabet/SampleMatching.lean:77
theorem largeAlphabet_sample_atom_prod

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
P :
s :
Fin n → ObsRecord d
(sampleLaw n P).real {s} = ∏ i, (P.1.map obs).real {s i}
Proof (Lean source)
-- @node: largeAlphabet_sample_atom_prod lemma largeAlphabet_sample_atom_prod {n d : ℕ} (P : FullLaw d) (s : Fin n → ObsRecord d) : (sampleLaw n P).real {s} = ∏ i, (P.1.map obs).real {s i} := by let := P.2 rw [sampleLaw, Measure.real, Measure.pi_singleton, ENNReal.toReal_prod] rfl
CausalSmith.Stat.MarRareqLogfrontier.largeAlphabet_sample_atom_prod · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/LargeAlphabet/SampleMatching.lean:88
theorem largeAlphabet_sample_atom_matching

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
hd :
1 ≤ d
hq :
0 < q
hq1 :
q ≤ 1
s :
Fin n → ObsRecord d
(∫ ξ, (sampleLaw n (largeAlphabetLaw q ξ hd hq hq1)).real {s} ∂binaryCellPrior d)
= (sampleLaw n (largeAlphabetComparisonLaw d q hd hq hq1)).real {s}
Proof (Lean source)
-- @node: largeAlphabet_sample_atom_matching lemma largeAlphabet_sample_atom_matching {n d : ℕ} (q : ℝ) (hd : 1 ≤ d) (hq : 0 < q) (hq1 : q ≤ 1) (s : Fin n → ObsRecord d) (hs : noRepeatedTreatedCell s) : (∫ ξ, (sampleLaw n (largeAlphabetLaw q ξ hd hq hq1)).real {s} ∂binaryCellPrior d) = (sampleLaw n (largeAlphabetComparisonLaw d q hd hq hq1)).real {s} := by classical simp_rw [largeAlphabet_sample_atom_prod, largeAlphabetLaw_atom_coordinate] rw [binaryCellPrior_integral_partial_distinct_prod (fun i => (s i).A = true) (fun i => (s i).X) (fun i b => ((largeAlphabetLaw q (fun _ : Fin d => b) hd hq hq1).1.map obs).real {s i})] · apply Finset.prod_congr rfl intro i _ simpa only [fairBinary_integral] using largeAlphabet_one_visit_matching d q hd hq hq1 (s i) · intro i j hij apply Subtype.ext by_contra hne exact hs i j hne i.property j.property hij · intro i hi exact largeAlphabetLaw_control_atom_constant q hd hq hq1 (s i) hi
CausalSmith.Stat.MarRareqLogfrontier.largeAlphabet_sample_atom_matching · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/LargeAlphabet/SampleMatching.lean:97
def largeAlphabetSampleMixture

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
n d :
ℕ
q :
ℝ
hd :
1 ≤ d
hq :
0 < q
hq1 :
q ≤ 1
largeAlphabetSampleMixture n d q hd hq hq1 :
∑ s, ofReal (∫ ξ, (sampleLaw n (largeAlphabetLaw q ξ hd hq hq1)).real {s} ∂binaryCellPrior d) • Measure.dirac s
CausalSmith.Stat.MarRareqLogfrontier.largeAlphabetSampleMixture · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/LargeAlphabet/SampleMatching.lean:121
theorem largeAlphabetSampleMixture_real_singleton

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
hd :
1 ≤ d
hq :
0 < q
hq1 :
q ≤ 1
s :
Fin n → ObsRecord d
(largeAlphabetSampleMixture n d q hd hq hq1).real {s}
= ∫ ξ, (sampleLaw n (largeAlphabetLaw q ξ hd hq hq1)).real {s} ∂binaryCellPrior d
Proof (Lean source)
lemma largeAlphabetSampleMixture_real_singleton (n d : ℕ) (q : ℝ) (hd : 1 ≤ d) (hq : 0 < q) (hq1 : q ≤ 1) (s : Fin n → ObsRecord d) : (largeAlphabetSampleMixture n d q hd hq hq1).real {s} = ∫ ξ, (sampleLaw n (largeAlphabetLaw q ξ hd hq hq1)).real {s} ∂binaryCellPrior d := by classical unfold largeAlphabetSampleMixture Measure.real simp only [Measure.finsetSum_apply, Measure.smul_apply, smul_eq_mul, Measure.dirac_apply, Set.indicator_apply, Set.mem_singleton_iff, Pi.one_apply] simp only [mul_ite, mul_one, mul_zero, Finset.sum_ite_eq', Finset.mem_univ, if_true] exact ENNReal.toReal_ofReal (integral_nonneg (fun _ => measureReal_nonneg))
CausalSmith.Stat.MarRareqLogfrontier.largeAlphabetSampleMixture_real_singleton · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/LargeAlphabet/SampleMatching.lean:131
theorem largeAlphabetSampleMixture_probability

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
hd :
1 ≤ d
hq :
0 < q
hq1 :
q ≤ 1
Proof (Lean source)
lemma largeAlphabetSampleMixture_probability (n d : ℕ) (q : ℝ) (hd : 1 ≤ d) (hq : 0 < q) (hq1 : q ≤ 1) : IsProbabilityMeasure (largeAlphabetSampleMixture n d q hd hq hq1) := by classical let μ : Measure Bool := (1 / 2 : ℝ≥0∞) • Measure.dirac false + (1 / 2 : ℝ≥0∞) • Measure.dirac true let : IsProbabilityMeasure μ := fairBinary_probability let : IsProbabilityMeasure (binaryCellPrior d) := inferInstanceAs (IsProbabilityMeasure (Measure.pi (fun _ : Fin d => μ))) have hsum : (∑ s : Fin n → ObsRecord d, ∫ ξ, (sampleLaw n (largeAlphabetLaw q ξ hd hq hq1)).real {s} ∂binaryCellPrior d) = 1 := by rw [← integral_finsetSum _ (fun _ _ => Integrable.of_finite)] have hnorm (ξ : Fin d → Bool) : (∑ s : Fin n → ObsRecord d, (sampleLaw n (largeAlphabetLaw q ξ hd hq hq1)).real {s}) = 1 := by let := (largeAlphabetLaw q ξ hd hq hq1).2 let : IsProbabilityMeasure ((largeAlphabetLaw q ξ hd hq hq1).1.map obs) := Measure.isProbabilityMeasure_map (by fun_prop) let : IsProbabilityMeasure (sampleLaw n (largeAlphabetLaw q ξ hd hq hq1)) := by unfold sampleLaw infer_instance rw [sum_measureReal_singleton] simp simp_rw [hnorm] simp constructor unfold largeAlphabetSampleMixture simp only [Measure.finsetSum_apply, Measure.smul_apply, smul_eq_mul, Measure.dirac_apply_of_mem (Set.mem_univ _), mul_one] rw [← ENNReal.ofReal_sum_of_nonneg (fun _ _ => integral_nonneg (fun _ => measureReal_nonneg)), hsum] simp
CausalSmith.Stat.MarRareqLogfrontier.largeAlphabetSampleMixture_probability · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/LargeAlphabet/SampleMatching.lean:145
theorem largeAlphabetSampleMixture_matching

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
hd :
1 ≤ d
hq :
0 < q
hq1 :
q ≤ 1
s :
Fin n → ObsRecord d
(largeAlphabetSampleMixture n d q hd hq hq1).real {s}
= (sampleLaw n (largeAlphabetComparisonLaw d q hd hq hq1)).real {s}
Proof (Lean source)
-- @node: largeAlphabetSampleMixture_matching lemma largeAlphabetSampleMixture_matching (n d : ℕ) (q : ℝ) (hd : 1 ≤ d) (hq : 0 < q) (hq1 : q ≤ 1) (s : Fin n → ObsRecord d) (hs : noRepeatedTreatedCell s) : (largeAlphabetSampleMixture n d q hd hq hq1).real {s} = (sampleLaw n (largeAlphabetComparisonLaw d q hd hq hq1)).real {s} := by rw [largeAlphabetSampleMixture_real_singleton] exact largeAlphabet_sample_atom_matching q hd hq hq1 s hs
CausalSmith.Stat.MarRareqLogfrontier.largeAlphabetSampleMixture_matching · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/LargeAlphabet/SampleMatching.lean:180
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.Lower.ActivationCalibration 7 declarations Ceiling-degree calibration of the actual activated cutoff.

Ceiling-degree calibration of the actual activated cutoff. The rounding allowance changes only the numerical effective-size threshold in (9).

theorem activation_mean_le_factorial_order Lemma activation_mean_le_factorial_order in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
η :
ℝ
n :
ℕ
q :
ℝ
hη :
0 ≤ η
hN :
hell :
1 ≤ logScale n q
(n : ℝ) * (rareMass η n q * (q * lowerEndpoint n q)) ≤ (2 * η) * (lowerDegree n q + 1 : ℕ)
Proof (Lean source)
-- @node: activation_mean_le_factorial_order lemma activation_mean_le_factorial_order (η : ℝ) (n : ℕ) (q : ℝ) (hη : 0 ≤ η) (hN : 0 < effectiveSize n q) (hell : 1 ≤ logScale n q) : (n : ℝ) * (rareMass η n q * (q * lowerEndpoint n q)) ≤ (2 * η) * (lowerDegree n q + 1 : ℕ) := by have hn0 : 0 < (n : ℝ) := by have h : 0 < (n : ℝ) * q := hN exact (mul_pos_iff.mp h).elim (fun h => h.1) (fun h => False.elim (not_lt_of_ge (Nat.cast_nonneg n) h.1)) have hq0 : 0 < q := (mul_pos_iff.mp hN).elim (fun h => h.2) (fun h => False.elim (not_lt_of_ge (Nat.cast_nonneg n) h.1)) have hL : 0 < logScale n q := by linarith have hK : (lowerDegree n q : ℝ) ≤ 2 * logScale n q := by have h := Nat.ceil_lt_add_one hL.le simpa only [lowerDegree] using h.le.trans (by linarith) have hKr : 0 ≤ (lowerDegree n q : ℝ) := by positivity have hsq : (lowerDegree n q : ℝ) ^ 2 ≤ 2 * logScale n q * (lowerDegree n q + 1 : ℕ) := by push_cast nlinarith [mul_le_mul_of_nonneg_right hK hKr] have heq : (n : ℝ) * (rareMass η n q * (q * lowerEndpoint n q)) = η * (lowerDegree n q : ℝ) ^ 2 / logScale n q := by unfold rareMass lowerEndpoint effectiveSize at * field_simp [ne_of_gt hn0, ne_of_gt hq0] rw [heq] apply (div_le_iff₀ hL).mpr nlinarith [mul_le_mul_of_nonneg_left hsq hη]
CausalSmith.Stat.MarRareqLogfrontier.activation_mean_le_factorial_order · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationCalibration.lean:16
theorem activation_factorial_ratio_le_exp Lemma activation_factorial_ratio_le_exp in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n :
ℕ
q :
ℝ
hN :
hell :
1 ≤ logScale n q
((n : ℝ) * (rareMass (exp (-32)) n q * (q * lowerEndpoint n q))) ^ (lowerDegree n q + 1) / ((lowerDegree n q + 1).factorial : ℝ)
≤ exp (-30 * logScale n q)
Proof (Lean source)
-- @node: activation_factorial_ratio_le_exp lemma activation_factorial_ratio_le_exp (n : ℕ) (q : ℝ) (hN : 0 < effectiveSize n q) (hell : 1 ≤ logScale n q) : ((n : ℝ) * (rareMass (exp (-32)) n q * (q * lowerEndpoint n q))) ^ (lowerDegree n q + 1) / ((lowerDegree n q + 1).factorial : ℝ) ≤ exp (-30 * logScale n q) := by let r := lowerDegree n q + 1 have hmean := activation_mean_le_factorial_order (exp (-32)) n q (Real.exp_nonneg _) hN hell have hdegree : logScale n q ≤ (r : ℝ) := by have h := Nat.le_ceil (logScale n q) dsimp [r, lowerDegree] push_cast linarith have hcoef : 2 * exp (-32) ≤ exp (-31) := by rw [show (-31 : ℝ) = 1 + -32 by norm_num, Real.exp_add] have h := Real.add_one_le_exp (1 : ℝ) nlinarith [Real.exp_pos (-32)] have hnonneg : 0 ≤ (n : ℝ) * (rareMass (exp (-32)) n q * (q * lowerEndpoint n q)) := by unfold rareMass lowerEndpoint effectiveSize at * have : 0 < (n : ℝ) * q := hN have hn : 0 < (n : ℝ) := by by_contra h have : n = 0 := by exact_mod_cast (le_antisymm (le_of_not_gt h) (Nat.cast_nonneg n)) simp [this] at hN have hq : 0 < q := ((mul_pos_iff.mp hN).resolve_right (by rintro ⟨h, _⟩; linarith)).2 positivity calc _ ≤ ((exp (-31)) * (r : ℝ)) ^ r / (r.factorial : ℝ) := by apply div_le_div_of_nonneg_right _ (by positivity) exact pow_le_pow_left₀ hnonneg (hmean.trans (mul_le_mul_of_nonneg_right hcoef (by positivity))) r _ = exp (-31) ^ r * ((r : ℝ) ^ r / (r.factorial : ℝ)) := by ring _ ≤ exp (-31) ^ r * exp (r : ℝ) := mul_le_mul_of_nonneg_left (Real.pow_div_factorial_le_exp r (by positivity) r) (by positivity) _ = exp (-30 * (r : ℝ)) := by rw [← Real.exp_nat_mul, ← Real.exp_add] congr 1 ring _ ≤ exp (-30 * logScale n q) := Real.exp_le_exp.mpr (by linarith)
CausalSmith.Stat.MarRareqLogfrontier.activation_factorial_ratio_le_exp · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationCalibration.lean:45
theorem activatedAugmentedMixture_cutoff_le_exp

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hq :
0 < q
hslice :
π :
(activatedAugmentedMixture (exp (-32)) n d q π).real {s | ¬ ∀ x : Fin d, x.val < rareCount (exp (-32)) n d q → (∑ i ∈ Finset.univ.filter (fun i => (s i).2.X = x), if (s i).1 then 1 else 0) ≤ lowerDegree n q}
≤ exp (32 - 28 * logScale n q)
Proof (Lean source)
-- @node: activatedAugmentedMixture_cutoff_le_exp lemma activatedAugmentedMixture_cutoff_le_exp (n d : ℕ) (q : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hq : 0 < q) (hslice : RareArrivalSlice n q) {π : Measure ℝ} (hπ : FiniteReciprocalPrior (lowerEndpoint n q) π) : (activatedAugmentedMixture (exp (-32)) n d q π).real {s | ¬ ∀ x : Fin d, x.val < rareCount (exp (-32)) n d q → (∑ i ∈ Finset.univ.filter (fun i => (s i).2.X = x), if (s i).1 then 1 else 0) ≤ lowerDegree n q} ≤ exp (32 - 28 * logScale n q) := by have hN : 0 < effectiveSize n q := by unfold effectiveSize; positivity have hell : 1 ≤ logScale n q := by unfold logScale have h := Real.log_le_log (Real.exp_pos (1 : ℝ)) (show exp 1 ≤ exp 1 + effectiveSize n q by linarith) simpa using h have hb : 0 < rareMass (exp (-32)) n q := by unfold rareMass; positivity have hcap : (rareCount (exp (-32)) n d q : ℝ) ≤ effectiveSize n q * logScale n q / (2 * exp (-32)) := by have h := rareCount_mass_le_half (exp (-32)) n d q hb apply (le_div_iff₀ (by positivity : 0 < 2 * exp (-32))).mpr dsimp [rareMass] at h have h' := (div_le_iff₀ (by positivity : 0 < effectiveSize n q * logScale n q)).mp (show (rareCount (exp (-32)) n d q : ℝ) * exp (-32) / (effectiveSize n q * logScale n q) ≤ 1 / 2 by simpa [mul_div_assoc] using h) nlinarith have hNexp : effectiveSize n q ≤ exp (logScale n q) := by rw [logScale, Real.exp_log (by positivity)] linarith [Real.exp_pos (1 : ℝ)] have hLexp : logScale n q ≤ exp (logScale n q) := by linarith [Real.add_one_le_exp (logScale n q)] have hprod : effectiveSize n q * logScale n q ≤ exp (2 * logScale n q) := by rw [show 2 * logScale n q = logScale n q + logScale n q by ring, Real.exp_add] exact mul_le_mul hNexp hLexp (by linarith) (Real.exp_nonneg _) apply (activatedAugmentedMixture_factorial_cutoff_bound (exp (-32)) n d (lowerDegree n q) q hn hd hb hq hslice hπ).trans calc _ ≤ (effectiveSize n q * logScale n q / (2 * exp (-32))) * exp (-30 * logScale n q) := mul_le_mul hcap (activation_factorial_ratio_le_exp n q hN hell) (by unfold lowerEndpoint; positivity) (div_nonneg (mul_nonneg hN.le (by linarith)) (by positivity)) _ ≤ (exp (2 * logScale n q) / exp (-32)) * exp (-30 * logScale n q) := by apply mul_le_mul_of_nonneg_right _ (Real.exp_nonneg _) exact (div_le_div_of_nonneg_left (mul_nonneg hN.le (by linarith)) (Real.exp_pos (-32)) (by linarith [Real.exp_pos (-32)])).trans (div_le_div_of_nonneg_right hprod (Real.exp_nonneg (-32))) _ = _ := by rw [← Real.exp_sub, ← Real.exp_add] congr 1 ring
CausalSmith.Stat.MarRareqLogfrontier.activatedAugmentedMixture_cutoff_le_exp · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationCalibration.lean:89
theorem activatedAugmentedMixture_cutoff_budget

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
u :
ℝ
n d :
ℕ
q :
ℝ
hu :
0 < u
hn :
1 ≤ n
hd :
1 ≤ d
hq :
0 < q
hslice :
π :
hlarge :
exp ((32 - log (u / 16)) / 28) ≤ effectiveSize n q
(activatedAugmentedMixture (exp (-32)) n d q π).real {s | ¬ ∀ x : Fin d, x.val < rareCount (exp (-32)) n d q → (∑ i ∈ Finset.univ.filter (fun i => (s i).2.X = x), if (s i).1 then 1 else 0) ≤ lowerDegree n q}
≤ u / 16
Proof (Lean source)
-- @node: activatedAugmentedMixture_cutoff_budget lemma activatedAugmentedMixture_cutoff_budget (u : ℝ) (n d : ℕ) (q : ℝ) (hu : 0 < u) (hn : 1 ≤ n) (hd : 1 ≤ d) (hq : 0 < q) (hslice : RareArrivalSlice n q) {π : Measure ℝ} (hπ : FiniteReciprocalPrior (lowerEndpoint n q) π) (hlarge : exp ((32 - log (u / 16)) / 28) ≤ effectiveSize n q) : (activatedAugmentedMixture (exp (-32)) n d q π).real {s | ¬ ∀ x : Fin d, x.val < rareCount (exp (-32)) n d q → (∑ i ∈ Finset.univ.filter (fun i => (s i).2.X = x), if (s i).1 then 1 else 0) ≤ lowerDegree n q} ≤ u / 16 := by have hlog := Real.log_le_log (Real.exp_pos ((32 - log (u / 16)) / 28)) (hlarge.trans (show effectiveSize n q ≤ exp 1 + effectiveSize n q by linarith [Real.exp_pos (1 : ℝ)])) rw [Real.log_exp] at hlog change (32 - log (u / 16)) / 28 ≤ logScale n q at hlog apply (activatedAugmentedMixture_cutoff_le_exp n d q hn hd hq hslice hπ).trans calc exp (32 - 28 * logScale n q) ≤ exp (log (u / 16)) := Real.exp_le_exp.mpr (by linarith) _ = u / 16 := Real.exp_log (by positivity)
CausalSmith.Stat.MarRareqLogfrontier.activatedAugmentedMixture_cutoff_budget · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationCalibration.lean:144
theorem activatedAugmentedMixture_interval_minimax_calibrated

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d M :
ℕ
q α :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hq :
0 < q
hslice :
π₀ π₁ :
hm :
∀ v : ℕ
if
v ≤ lowerDegree n q
then
(∫ z, z ^ v ∂π₀) = ∫ z, z ^ v ∂π₁
hgap :
1 / 12 ≤ (∫ z, z⁻¹ ∂π₁) - ∫ z, z⁻¹ ∂π₀
hα :
0 ≤ α
hα1 :
α < 1
hM :
1 ≤ M
hgrid :
8 / (1 - α) ≤ (M : ℝ)
hJ :
18432 * (M : ℝ) ^ 2 / (1 - α) ≤ (rareCount (exp (-32)) n d q : ℝ)
hlarge :
exp ((32 - log ((1 - α) / 16)) / 28) ≤ effectiveSize n q
(21 * (1 - α) / 32) * ((rareCount (exp (-32)) n d q : ℝ) * rareMass (exp (-32)) n q * ((∫ z, z⁻¹ ∂π₁) - ∫ z, z⁻¹ ∂π₀))
≤ intervalLengthRisk n d q α
Proof (Lean source)
-- @node: activatedAugmentedMixture_interval_minimax_calibrated lemma activatedAugmentedMixture_interval_minimax_calibrated (n d M : ℕ) (q α : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hq : 0 < q) (hslice : RareArrivalSlice n q) {π₀ π₁ : Measure ℝ} (h₀ : FiniteReciprocalPrior (lowerEndpoint n q) π₀) (h₁ : FiniteReciprocalPrior (lowerEndpoint n q) π₁) (hm : ∀ v : ℕ, v ≤ lowerDegree n q → (∫ z, z ^ v ∂π₀) = ∫ z, z ^ v ∂π₁) (hgap : 1 / 12 ≤ (∫ z, z⁻¹ ∂π₁) - ∫ z, z⁻¹ ∂π₀) (hα : 0 ≤ α) (hα1 : α < 1) (hM : 1 ≤ M) (hgrid : 8 / (1 - α) ≤ (M : ℝ)) (hJ : 18432 * (M : ℝ) ^ 2 / (1 - α) ≤ (rareCount (exp (-32)) n d q : ℝ)) (hlarge : exp ((32 - log ((1 - α) / 16)) / 28) ≤ effectiveSize n q) : (21 * (1 - α) / 32) * ((rareCount (exp (-32)) n d q : ℝ) * rareMass (exp (-32)) n q * ((∫ z, z⁻¹ ∂π₁) - ∫ z, z⁻¹ ∂π₀)) ≤ intervalLengthRisk n d q α := by have hN : 0 < effectiveSize n q := by unfold effectiveSize; positivity have hell : 1 ≤ logScale n q := by unfold logScale have h := Real.log_le_log (Real.exp_pos (1 : ℝ)) (show exp 1 ≤ exp 1 + effectiveSize n q by linarith) simpa using h have hb : 0 < rareMass (exp (-32)) n q := by unfold rareMass; positivity apply activatedAugmentedMixture_interval_minimax_of_cutoff (exp (-32)) n d M q α hn hd hb hq hslice h₀ h₁ (lowerDegree n q) hm hgap hα hα1 hM hgrid hJ exact activatedAugmentedMixture_cutoff_budget (1 - α) n d q (by linarith) hn hd hq hslice (finiteReciprocalPrior_interpolate h₀ h₁ (by simp)) hlarge
CausalSmith.Stat.MarRareqLogfrontier.activatedAugmentedMixture_interval_minimax_calibrated · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationCalibration.lean:167
theorem interval_ordered_reciprocal_priors Lemma interval_ordered_reciprocal_priors in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n :
ℕ
q :
ℝ
hK :
2 ≤ lowerDegree n q
conclusion 1
v :
ℕ
v ≤ lowerDegree n q
(∫ z, z ^ v ∂π₀) = ∫ z, z ^ v ∂π₁
conclusion 2
1 / 12 ≤ (∫ z, z⁻¹ ∂π₁) - ∫ z, z⁻¹ ∂π₀
Proof (Lean source)
-- @node: interval_ordered_reciprocal_priors lemma interval_ordered_reciprocal_priors (n : ℕ) (q : ℝ) (hK : 2 ≤ lowerDegree n q) : ∃ π₀ π₁ : Measure ℝ, FiniteReciprocalPrior (lowerEndpoint n q) π₀ ∧ FiniteReciprocalPrior (lowerEndpoint n q) π₁ ∧ (∀ v : ℕ, v ≤ lowerDegree n q → (∫ z, z ^ v ∂π₀) = ∫ z, z ^ v ∂π₁) ∧ 1 / 12 ≤ (∫ z, z⁻¹ ∂π₁) - ∫ z, z⁻¹ ∂π₀ := by obtain ⟨π₀, π₁, hp₀, hp₁, ⟨s₀, s₁, hs₀, hs₁, hm₀, hm₁⟩, hm, hgap⟩ := moment_matched_reciprocal_priors (lowerDegree n q) hK have h₀ : FiniteReciprocalPrior (lowerEndpoint n q) π₀ := ⟨hp₀, s₀, hs₀, hm₀⟩ have h₁ : FiniteReciprocalPrior (lowerEndpoint n q) π₁ := ⟨hp₁, s₁, hs₁, hm₁⟩ by_cases horder : (∫ z, z⁻¹ ∂π₀) ≤ ∫ z, z⁻¹ ∂π₁ · refine ⟨π₀, π₁, h₀, h₁, hm, ?_⟩ simpa only [abs_of_nonneg (sub_nonneg.mpr horder)] using hgap · refine ⟨π₁, π₀, h₁, h₀, fun v hv => (hm v hv).symm, ?_⟩ rw [abs_of_nonpos (by linarith)] at hgap linarith
CausalSmith.Stat.MarRareqLogfrontier.interval_ordered_reciprocal_priors · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationCalibration.lean:197
theorem interval_activated_large_regime

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
α :
ℝ
hα :
0 ≤ α
hα1 :
α < 1
∃ (T : ℝ) (D : ℕ) (cAct : ℝ),
1 ≤ T
1 ≤ D
0 < cAct
conclusion 1
n d :
ℕ
q :
ℝ
1 ≤ n
1 ≤ d
0 < q
q ≤ 1
T ≤ effectiveSize n q
(D : ℝ) ≤ (2 * rareMass (exp (-32)) n q)⁻¹
D ≤ rareCount (exp (-32)) n d q
cAct * min 1 ((d : ℝ) / (effectiveSize n q * logScale n q)) ≤ intervalLengthRisk n d q α
Proof (Lean source)
-- @node: interval_activated_large_regime lemma interval_activated_large_regime (α : ℝ) (hα : 0 ≤ α) (hα1 : α < 1) : ∃ (T : ℝ) (D : ℕ) (cAct : ℝ), 1 ≤ T ∧ 1 ≤ D ∧ 0 < cAct ∧ ∀ (n d : ℕ) (q : ℝ), 1 ≤ n → 1 ≤ d → 0 < q → q ≤ 1 → RareArrivalSlice n q → T ≤ effectiveSize n q → (D : ℝ) ≤ (2 * rareMass (exp (-32)) n q)⁻¹ ∧ (D ≤ rareCount (exp (-32)) n d q → cAct * min 1 ((d : ℝ) / (effectiveSize n q * logScale n q)) ≤ intervalLengthRisk n d q α) := by let u := 1 - α let η := exp (-32) let M := ceil (8 / u) + 1 let D := ceil (18432 * (M : ℝ) ^ 2 / u) + 1 have hu : 0 < u := by dsimp [u]; linarith obtain ⟨hM, hgridInv, hD, hDreal⟩ := interval_activation_grid_thresholds u hu have hD' : 1 ≤ D := hD have hη : 0 < η := Real.exp_pos _ have hηsmall : η ≤ 1 / 2 := by have h := Real.add_one_le_exp (32 : ℝ) dsimp [η] rw [Real.exp_neg, inv_eq_one_div] apply (div_le_iff₀ (Real.exp_pos 32)).mpr linarith let T := max 1 (max (exp 2) (max (4 * η) (max (2 * η * D) (exp ((32 - log (u / 16)) / 28))))) let cAct := (21 * u / 32) * (η / 24) refine ⟨T, D, cAct, le_max_left _ _, hD, by dsimp [cAct]; positivity, ?_⟩ intro n d q hn hd hq _hq1 hslice hlarge have hN : 0 < effectiveSize n q := by unfold effectiveSize; positivity have hell : 1 ≤ logScale n q := by unfold logScale have h := Real.log_le_log (Real.exp_pos (1 : ℝ)) (show exp 1 ≤ exp 1 + effectiveSize n q by linarith) simpa using h have hTexp : exp 2 ≤ effectiveSize n q := (le_max_left _ _).trans ((le_max_right _ _).trans hlarge) have hTmass : 4 * η ≤ effectiveSize n q := (le_max_left _ _).trans ((le_max_right _ _).trans ((le_max_right _ _).trans hlarge)) have hTcap : 2 * η * D ≤ effectiveSize n q := (le_max_left _ _).trans ((le_max_right _ _).trans ((le_max_right _ _).trans ((le_max_right _ _).trans hlarge))) have hTtail : exp ((32 - log (u / 16)) / 28) ≤ effectiveSize n q := (le_max_right _ _).trans ((le_max_right _ _).trans ((le_max_right _ _).trans ((le_max_right _ _).trans hlarge))) refine ⟨interval_capacity_of_large_size η D n q hη hN hell hTcap, ?_⟩ intro hJ change D ≤ rareCount η n d q at hJ have hK : 2 ≤ lowerDegree n q := by have hlog := Real.log_le_log (Real.exp_pos (2 : ℝ)) (hTexp.trans (show effectiveSize n q ≤ exp 1 + effectiveSize n q by linarith [Real.exp_pos (1 : ℝ)])) rw [Real.log_exp] at hlog have hceil := Nat.le_ceil (logScale n q) have : (2 : ℝ) ≤ (lowerDegree n q : ℝ) := hlog.trans hceil exact_mod_cast this obtain ⟨π₀, π₁, h₀, h₁, hm, hgap⟩ := interval_ordered_reciprocal_priors n q hK have hJreal : 18432 * (M : ℝ) ^ 2 / (1 - α) ≤ (rareCount η n d q : ℝ) := hDreal.trans (Nat.cast_le.mpr hJ) have hgrid : 8 / (1 - α) ≤ (M : ℝ) := by have h := Nat.le_ceil (8 / u) dsimp [M] push_cast dsimp [u] at h linarith have hlength := activatedAugmentedMixture_interval_minimax_calibrated n d M q α hn hd hq hslice h₀ h₁ hm hgap hα hα1 hM hgrid hJreal hTtail have hbsmall : rareMass η n q ≤ 1 / 4 := by unfold rareMass apply (div_le_iff₀ (by positivity : 0 < effectiveSize n q * logScale n q)).mpr nlinarith [mul_le_mul_of_nonneg_left hell hN.le] have hd2 : 2 ≤ d := by have hc : rareCount η n d q ≤ d - 1 := min_le_left _ _ omega have hsep : (rareCount η n d q : ℝ) * rareMass η n q / 12 ≤ (rareCount η n d q : ℝ) * rareMass η n q * ((∫ z, z⁻¹ ∂π₁) - ∫ z, z⁻¹ ∂π₀) := by have hb : 0 < rareMass η n q := by unfold rareMass; positivity nlinarith [mul_le_mul_of_nonneg_left hgap (mul_nonneg (Nat.cast_nonneg (rareCount η n d q)) hb.le)] have hwidth := interval_prior_segment_width_lower η _ n d q hη hηsmall hd2 hN (by linarith) hbsmall hsep have hfinal : cAct * min 1 ((d : ℝ) / (effectiveSize n q * logScale n q)) ≤ (21 * (1 - α) / 32) * ((rareCount η n d q : ℝ) * rareMass η n q * ((∫ z, z⁻¹ ∂π₁) - ∫ z, z⁻¹ ∂π₀)) := by simpa only [cAct, u, mul_assoc] using mul_le_mul_of_nonneg_left hwidth (show 0 ≤ 21 * (1 - α) / 32 by positivity) exact hfinal.trans hlength
CausalSmith.Stat.MarRareqLogfrontier.interval_activated_large_regime · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationCalibration.lean:219
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.Lower.ActivationCoverage 11 declarations Uniform honesty transfers to neighborhood hits in the actual activated prior mixture.

Uniform honesty transfers to neighborhood hits in the actual activated prior mixture. The target concentration budget is kept separate from coverage, so equations (13)--(16) and the minimax reduction are assembled without assuming averaged honesty. The actual activation-cutoff tail remains a separate input to the lower-bound assembly.

theorem intervalContains_subset_neighborhood

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
t θ w :
ℝ
hnear :
|t - θ| ≤ w
{I : ConnectedInterval | intervalContains I t} ⊆ {I | ∃ x : ℝ, I.lo ≤ x ∧ x ≤ I.hi ∧ |x - θ| ≤ w}
Proof (Lean source)
-- @node: intervalContains_subset_neighborhood lemma intervalContains_subset_neighborhood (t θ w : ℝ) (hnear : |t - θ| ≤ w) : {I : ConnectedInterval | intervalContains I t} ⊆ {I | ∃ x : ℝ, I.lo ≤ x ∧ x ≤ I.hi ∧ |x - θ| ≤ w} := by intro I hI have hlo : I.lo ≤ t := by have h := hI.1 change (if I.closedLeft then I.lo ≤ t else I.lo < t) at h split at h · exact h · exact h.le have hhi : t ≤ I.hi := by have h := hI.2 change (if I.closedRight then t ≤ I.hi else t < I.hi) at h split at h · exact h · exact h.le exact ⟨t, hlo, hhi, hnear⟩
CausalSmith.Stat.MarRareqLogfrontier.intervalContains_subset_neighborhood · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationCoverage.lean:19
theorem intervalProcedure_real_event

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
(T.1 ∘ₘ μ).real A = ∫ s, (T.1 s).real A ∂μ
Proof (Lean source)
-- @node: intervalProcedure_real_event lemma intervalProcedure_real_event {n d : ℕ} (T : IntervalProcedure n d) (μ : Measure (Fin n → ObsRecord d)) [IsProbabilityMeasure μ] (A : Set ConnectedInterval) (hA : MeasurableSet A) : (T.1 ∘ₘ μ).real A = ∫ s, (T.1 s).real A ∂μ := by let := T.2 rw [measureReal_def, Measure.bind_apply hA T.1.aemeasurable, ← integral_toReal (T.1.measurable_coe hA).aemeasurable (Filter.Eventually.of_forall fun s => (lt_top_iff_ne_top).2 (measure_ne_top (T.1 s) A))] rfl
CausalSmith.Stat.MarRareqLogfrontier.intervalProcedure_real_event · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationCoverage.lean:39
theorem honestInterval_neighborhood_coverage

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q α :
ℝ
hT :
HonestInterval n d q α T
hα :
0 ≤ α
P :
hP :
θ w :
ℝ
1 - α - (if w < |ate P - θ| then 1 else 0)
≤ ∫ s, (T.1 s).real {I | ∃ x : ℝ, I.lo ≤ x ∧ x ≤ I.hi ∧ |x - θ| ≤ w} ∂sampleLaw n P
Proof (Lean source)
-- @node: honestInterval_neighborhood_coverage lemma honestInterval_neighborhood_coverage {n d : ℕ} {q α : ℝ} (T : IntervalProcedure n d) (hT : HonestInterval n d q α T) (hα : 0 ≤ α) (P : FullLaw d) (hP : RareArrivalModelClass n d q P) (θ w : ℝ) : 1 - α - (if w < |ate P - θ| then 1 else 0) ≤ ∫ s, (T.1 s).real {I | ∃ x : ℝ, I.lo ≤ x ∧ x ≤ I.hi ∧ |x - θ| ≤ w} ∂sampleLaw n P := by classical let := T.2 let := P.2 let : IsProbabilityMeasure (sampleLaw n P) := by unfold sampleLaw let : IsProbabilityMeasure (P.1.map obs) := Measure.isProbabilityMeasure_map (by fun_prop) infer_instance by_cases hbad : w < |ate P - θ| · simp only [if_pos hbad] have hnonneg : 0 ≤ ∫ s, (T.1 s).real {I | ∃ x : ℝ, I.lo ≤ x ∧ x ≤ I.hi ∧ |x - θ| ≤ w} ∂sampleLaw n P := integral_nonneg (fun _ => measureReal_nonneg) linarith · simp only [if_neg hbad, sub_zero] apply (hT P hP).trans apply integral_mono Integrable.of_finite Integrable.of_finite intro s exact measureReal_mono (intervalContains_subset_neighborhood (ate P) θ w (le_of_not_gt hbad)) (measure_ne_top (T.1 s) _)
CausalSmith.Stat.MarRareqLogfrontier.honestInterval_neighborhood_coverage · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationCoverage.lean:52
theorem intervalPrior_initial_coordinates_map Lemma intervalPrior_initial_coordinates_map in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d J :
ℕ
hJ :
J ≤ d
(Measure.pi (fun _ : Fin d => π)).map (fun z : Fin d → ℝ => fun x : Fin J => z (x.castLE hJ))
= Measure.pi (fun _ : Fin J => π)
Proof (Lean source)
-- @node: intervalPrior_initial_coordinates_map lemma intervalPrior_initial_coordinates_map {π : Measure ℝ} [IsProbabilityMeasure π] (d J : ℕ) (hJ : J ≤ d) : (Measure.pi (fun _ : Fin d => π)).map (fun z : Fin d → ℝ => fun x : Fin J => z (x.castLE hJ)) = Measure.pi (fun _ : Fin J => π) := by have hind : iIndepFun (fun x : Fin d => fun z : Fin d → ℝ => z x) (Measure.pi (fun _ : Fin d => π)) := iIndepFun_pi (X := fun _ (z : ℝ) => z) (fun _ => measurable_id.aemeasurable) have hrestrict := hind.precomp (Fin.castLE_injective hJ) rw [hrestrict.map_fun_eq_pi_map (fun x => (measurable_pi_apply _).aemeasurable)] simp_rw [(measurePreserving_eval (fun _ : Fin d => π) _).map_eq]
CausalSmith.Stat.MarRareqLogfrontier.intervalPrior_initial_coordinates_map · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationCoverage.lean:82
theorem intervalPrior_full_alphabet_concentration_budget Lemma intervalPrior_full_alphabet_concentration_budget in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
H :
ℝ
π :
d J M :
ℕ
hJd :
J ≤ d
b Δ u :
ℝ
hb :
0 < b
hΔ :
0 < Δ
hu :
0 < u
hM :
1 ≤ M
hgap :
(J : ℝ) * b / 12 ≤ Δ
hJ :
18432 * (M : ℝ) ^ 2 / u ≤ (J : ℝ)
(Measure.pi (fun _ : Fin d => π)).real {z | Δ / (8 * M) < |b * (∑ x : Fin d, if x.val < J then (z x)⁻¹ else 0) - (J : ℝ) * b * ∫ z, z⁻¹ ∂π|}
≤ u / 8
Proof (Lean source)
-- @node: intervalPrior_full_alphabet_concentration_budget lemma intervalPrior_full_alphabet_concentration_budget {H : ℝ} {π : Measure ℝ} (hπ : FiniteReciprocalPrior H π) (d J M : ℕ) (hJd : J ≤ d) (b Δ u : ℝ) (hb : 0 < b) (hΔ : 0 < Δ) (hu : 0 < u) (hM : 1 ≤ M) (hgap : (J : ℝ) * b / 12 ≤ Δ) (hJ : 18432 * (M : ℝ) ^ 2 / u ≤ (J : ℝ)) : (Measure.pi (fun _ : Fin d => π)).real {z | Δ / (8 * M) < |b * (∑ x : Fin d, if x.val < J then (z x)⁻¹ else 0) - (J : ℝ) * b * ∫ z, z⁻¹ ∂π|} ≤ u / 8 := by let := hπ.1 let restrict : (Fin d → ℝ) → (Fin J → ℝ) := fun z x => z (x.castLE hJd) have hr : Measurable restrict := by fun_prop have hevent : MeasurableSet {z : Fin J → ℝ | Δ / (8 * M) < |intervalPriorTarget J b z - (J : ℝ) * b * ∫ z, z⁻¹ ∂π|} := by have hf : Measurable (intervalPriorTarget J b) := by unfold intervalPriorTarget fun_prop simpa only [Function.comp_def, Real.norm_eq_abs] using (measurableSet_lt measurable_const (measurable_norm.comp (hf.sub_const _))) have hmap := intervalPrior_initial_coordinates_map d J hJd (π := π) have hprob := map_measureReal_apply (μ := Measure.pi (fun _ : Fin d => π)) hr hevent rw [hmap] at hprob have htail := intervalPriorTarget_concentration_budget hπ J M b Δ u hb hΔ hu hM hgap hJ rw [hprob] at htail simpa only [Set.preimage_ofPred_eq, intervalPriorTarget, activation_sum_initial_cells d J hJd, restrict] using htail
CausalSmith.Stat.MarRareqLogfrontier.intervalPrior_full_alphabet_concentration_budget · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationCoverage.lean:96
theorem activatedAugmentedMixture_neighborhood_coverage

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
η :
ℝ
n d :
ℕ
q α θ w ε :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hb :
0 < rareMass η n q
hq :
0 < q
hslice :
π :
hT :
HonestInterval n d q α T
hα :
0 ≤ α
htail :
(Measure.pi (fun _ : Fin d => π)).real {z | w < |rareMass η n q * (∑ x : Fin d, if x.val < rareCount η n d q then (z x)⁻¹ else 0) - θ|}
≤ ε
1 - α - ε
≤ ∫ s, (T.1 s).real {I | ∃ x : ℝ, I.lo ≤ x ∧ x ≤ I.hi ∧ |x - θ| ≤ w} ∂((activatedAugmentedMixture η n d q π).map (fun s i => (s i).2))
Proof (Lean source)
-- @node: activatedAugmentedMixture_neighborhood_coverage lemma activatedAugmentedMixture_neighborhood_coverage (η : ℝ) (n d : ℕ) (q α θ w ε : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hb : 0 < rareMass η n q) (hq : 0 < q) (hslice : RareArrivalSlice n q) {π : Measure ℝ} (hπ : FiniteReciprocalPrior (lowerEndpoint n q) π) (T : IntervalProcedure n d) (hT : HonestInterval n d q α T) (hα : 0 ≤ α) (htail : (Measure.pi (fun _ : Fin d => π)).real {z | w < |rareMass η n q * (∑ x : Fin d, if x.val < rareCount η n d q then (z x)⁻¹ else 0) - θ|} ≤ ε) : 1 - α - ε ≤ ∫ s, (T.1 s).real {I | ∃ x : ℝ, I.lo ≤ x ∧ x ≤ I.hi ∧ |x - θ| ≤ w} ∂((activatedAugmentedMixture η n d q π).map (fun s i => (s i).2)) := by classical let := hπ.1 let μ := Measure.pi (fun _ : Fin d => π) let target : (Fin d → ℝ) → ℝ := fun z => rareMass η n q * ∑ x : Fin d, if x.val < rareCount η n d q then (z x)⁻¹ else 0 let bad : Set (Fin d → ℝ) := {z | w < |target z - θ|} have hmeas : Measurable target := by dsimp [target] apply Measurable.const_mul apply Finset.measurable_sum intro x hx by_cases h : x.val < rareCount η n d q <;> simp only [h, if_true, if_false] · fun_prop · fun_prop have hbad : MeasurableSet bad := by simpa only [bad, Function.comp_def, Real.norm_eq_abs] using (measurableSet_lt measurable_const (measurable_norm.comp (hmeas.sub_const θ))) rw [activatedAugmentedMixture_projected_integral η n d q hn hd hb hq hslice hπ] have hle : ∀ᵐ z ∂μ, 1 - α - bad.indicator (fun _ => (1 : ℝ)) z ≤ (if hz : ∀ x, z x ∈ Icc (1 : ℝ) (lowerEndpoint n q) then ∫ s, (T.1 s).real {I | ∃ x : ℝ, I.lo ≤ x ∧ x ≤ I.hi ∧ |x - θ| ≤ w} ∂sampleLaw n (activatedFullLaw η n d q z hd hb hq hslice hz) else 0) := by filter_upwards [finiteReciprocalPrior_pi_ae_support hπ d] with z hz rw [dif_pos hz] have htarget : ate (activatedFullLaw η n d q z hd hb hq hslice hz) = target z := by change (∫ r : FullRecord d, ((if r.Y1 then (1 : ℝ) else 0) - (if r.Y0 then (1 : ℝ) else 0)) ∂activatedLaw η n d q z hz) = target z exact activatedLaw_target_integral η n d q z hb hq hslice hz have h := honestInterval_neighborhood_coverage T hT hα (activatedFullLaw η n d q z hd hb hq hslice hz) (activatedFullLaw_model η n d q z hd hb hq hslice hz hn) θ w simpa only [htarget, Set.indicator_apply, Set.mem_ofPred_eq, bad, Pi.one_apply] using h have hbound := integral_mono_ae (finiteReciprocalPrior_pi_integrable hπ d _) (finiteReciprocalPrior_pi_integrable hπ d _) hle have heq : (∫ z, 1 - α - bad.indicator (fun _ => (1 : ℝ)) z ∂μ) = 1 - α - μ.real bad := by rw [integral_sub (integrable_const _) (finiteReciprocalPrior_pi_integrable hπ d _), integral_const, integral_indicator_const 1 hbad] simp [μ] rw [heq] at hbound exact (sub_le_sub_left htail (1 - α)).trans hbound
CausalSmith.Stat.MarRareqLogfrontier.activatedAugmentedMixture_neighborhood_coverage · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationCoverage.lean:125
theorem activatedAugmentedMixture_neighborhood_coverage_budget

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
η :
ℝ
n d M :
ℕ
q α Δ :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hb :
0 < rareMass η n q
hq :
0 < q
hslice :
π :
hT :
HonestInterval n d q α T
hα :
0 ≤ α
hα1 :
α < 1
hΔ :
0 < Δ
hM :
1 ≤ M
hgap :
(rareCount η n d q : ℝ) * rareMass η n q / 12 ≤ Δ
hJ :
18432 * (M : ℝ) ^ 2 / (1 - α) ≤ (rareCount η n d q : ℝ)
7 * (1 - α) / 8
≤ (T.1 ∘ₘ ((activatedAugmentedMixture η n d q π).map (fun s i => (s i).2))).real {I | ∃ x : ℝ, I.lo ≤ x ∧ x ≤ I.hi ∧ |x - ((rareCount η n d q : ℝ) * rareMass η n q * ∫ z, z⁻¹ ∂π)| ≤ Δ / (8 * M)}
Proof (Lean source)
-- @node: activatedAugmentedMixture_neighborhood_coverage_budget lemma activatedAugmentedMixture_neighborhood_coverage_budget (η : ℝ) (n d M : ℕ) (q α Δ : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hb : 0 < rareMass η n q) (hq : 0 < q) (hslice : RareArrivalSlice n q) {π : Measure ℝ} (hπ : FiniteReciprocalPrior (lowerEndpoint n q) π) (T : IntervalProcedure n d) (hT : HonestInterval n d q α T) (hα : 0 ≤ α) (hα1 : α < 1) (hΔ : 0 < Δ) (hM : 1 ≤ M) (hgap : (rareCount η n d q : ℝ) * rareMass η n q / 12 ≤ Δ) (hJ : 18432 * (M : ℝ) ^ 2 / (1 - α) ≤ (rareCount η n d q : ℝ)) : 7 * (1 - α) / 8 ≤ (T.1 ∘ₘ ((activatedAugmentedMixture η n d q π).map (fun s i => (s i).2))).real {I | ∃ x : ℝ, I.lo ≤ x ∧ x ≤ I.hi ∧ |x - ((rareCount η n d q : ℝ) * rareMass η n q * ∫ z, z⁻¹ ∂π)| ≤ Δ / (8 * M)} := by let := activatedAugmentedMixture_isProbabilityMeasure η n d q hn hd hb hq hslice hπ have hf : Measurable (fun s : Fin n → Bool × ObsRecord d => fun i => (s i).2) := by fun_prop let := Measure.isProbabilityMeasure_map hf.aemeasurable (μ := activatedAugmentedMixture η n d q π) have hMr : 0 < (M : ℝ) := by exact_mod_cast (by omega : 0 < M) rw [intervalProcedure_real_event T _ _ (connectedInterval_measurableSet_neighborhood _ _ (by positivity))] have htail := intervalPrior_full_alphabet_concentration_budget hπ d (rareCount η n d q) M ((min_le_left _ _).trans (sub_le d 1)) (rareMass η n q) Δ (1 - α) hb hΔ (by linarith) hM hgap hJ have h := activatedAugmentedMixture_neighborhood_coverage η n d q α ((rareCount η n d q : ℝ) * rareMass η n q * ∫ z, z⁻¹ ∂π) (Δ / (8 * M)) ((1 - α) / 8) hn hd hb hq hslice hπ T hT hα htail convert h using 1 ring
CausalSmith.Stat.MarRareqLogfrontier.activatedAugmentedMixture_neighborhood_coverage_budget · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationCoverage.lean:186
theorem activatedAugmentedMixture_reported_length_le_worst

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
η :
ℝ
n d :
ℕ
q :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hb :
0 < rareMass η n q
hq :
0 < q
hslice :
π :
(∫ I : ConnectedInterval, I.hi - I.lo ∂(T.1 ∘ₘ ((activatedAugmentedMixture η n d q π).map (fun s i => (s i).2))))
≤ worstCaseRiskReal (fun (_ : Unit) (P : {P : FullLaw d // RareArrivalModelClass n d q P}) => intervalRisk T P.1) ()
Proof (Lean source)
-- @node: activatedAugmentedMixture_reported_length_le_worst lemma activatedAugmentedMixture_reported_length_le_worst (η : ℝ) (n d : ℕ) (q : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hb : 0 < rareMass η n q) (hq : 0 < q) (hslice : RareArrivalSlice n q) {π : Measure ℝ} (hπ : FiniteReciprocalPrior (lowerEndpoint n q) π) (T : IntervalProcedure n d) : (∫ I : ConnectedInterval, I.hi - I.lo ∂(T.1 ∘ₘ ((activatedAugmentedMixture η n d q π).map (fun s i => (s i).2)))) ≤ worstCaseRiskReal (fun (_ : Unit) (P : {P : FullLaw d // RareArrivalModelClass n d q P}) => intervalRisk T P.1) () := by let := T.2 let := activatedAugmentedMixture_isProbabilityMeasure η n d q hn hd hb hq hslice hπ have hf : Measurable (fun s : Fin n → Bool × ObsRecord d => fun i => (s i).2) := by fun_prop let := Measure.isProbabilityMeasure_map hf.aemeasurable (μ := activatedAugmentedMixture η n d q π) have hF : Measurable (fun I : ConnectedInterval => (I.lo, I.hi, I.closedLeft, I.closedRight)) := by exact (measurable_fst.comp measurable_subtype_coe).prodMk ((measurable_snd.comp measurable_subtype_coe).prodMk (measurable_const.prodMk measurable_const)) have hlen : Measurable (fun I : ConnectedInterval => I.hi - I.lo) := by first | fun_prop | exact (measurable_connectedInterval_hi).sub (measurable_connectedInterval_lo) have hint : Integrable (fun I : ConnectedInterval => I.hi - I.lo) (T.1 ∘ₘ ((activatedAugmentedMixture η n d q π).map (fun s i => (s i).2))) := Integrable.of_bound hlen.aestronglyMeasurable 2 (Eventually.of_forall fun I => by rw [Real.norm_eq_abs, abs_of_nonneg (sub_nonneg.mpr I.ordered)] linarith [I.lower, I.upper]) rw [integral_bind T.1.measurable hint] exact activatedAugmentedMixture_intervalRisk_le_worst η n d q hn hd hb hq hslice hπ T
CausalSmith.Stat.MarRareqLogfrontier.activatedAugmentedMixture_reported_length_le_worst · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationCoverage.lean:221
theorem activatedAugmentedMixture_grid_length_le_worst

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
η :
ℝ
n d M :
ℕ
q α :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hb :
0 < rareMass η n q
hq :
0 < q
hslice :
π₀ π₁ :
K :
ℕ
hm :
∀ v : ℕ
if
v ≤ K
then
(∫ z, z ^ v ∂π₀) = ∫ z, z ^ v ∂π₁
hgap :
1 / 12 ≤ (∫ z, z⁻¹ ∂π₁) - ∫ z, z⁻¹ ∂π₀
hα :
0 ≤ α
hα1 :
α < 1
hM :
1 ≤ M
hgrid :
8 / (1 - α) ≤ (M : ℝ)
hJ :
18432 * (M : ℝ) ^ 2 / (1 - α) ≤ (rareCount η n d q : ℝ)
htv :
∀ j : Fin (M + 1),
tvDist ((activatedAugmentedMixture η n d q (intervalInterpolatedPrior π₀ π₁ ((0 : ℝ) / M))).map (fun s i => (s i).2)) ((activatedAugmentedMixture η n d q (intervalInterpolatedPrior π₀ π₁ ((j : ℝ) / M))).map (fun s i => (s i).2))
≤ (1 - α) / 16
hT :
HonestInterval n d q α T
(21 * (1 - α) / 32) * ((rareCount η n d q : ℝ) * rareMass η n q * ((∫ z, z⁻¹ ∂π₁) - ∫ z, z⁻¹ ∂π₀))
≤ worstCaseRiskReal (fun (_ : Unit) (P : {P : FullLaw d // RareArrivalModelClass n d q P}) => intervalRisk T P.1) ()
Proof (Lean source)
-- @node: activatedAugmentedMixture_grid_length_le_worst lemma activatedAugmentedMixture_grid_length_le_worst (η : ℝ) (n d M : ℕ) (q α : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hb : 0 < rareMass η n q) (hq : 0 < q) (hslice : RareArrivalSlice n q) {π₀ π₁ : Measure ℝ} (h₀ : FiniteReciprocalPrior (lowerEndpoint n q) π₀) (h₁ : FiniteReciprocalPrior (lowerEndpoint n q) π₁) (K : ℕ) (hm : ∀ v : ℕ, v ≤ K → (∫ z, z ^ v ∂π₀) = ∫ z, z ^ v ∂π₁) (hgap : 1 / 12 ≤ (∫ z, z⁻¹ ∂π₁) - ∫ z, z⁻¹ ∂π₀) (hα : 0 ≤ α) (hα1 : α < 1) (hM : 1 ≤ M) (hgrid : 8 / (1 - α) ≤ (M : ℝ)) (hJ : 18432 * (M : ℝ) ^ 2 / (1 - α) ≤ (rareCount η n d q : ℝ)) (htv : ∀ j : Fin (M + 1), tvDist ((activatedAugmentedMixture η n d q (intervalInterpolatedPrior π₀ π₁ ((0 : ℝ) / M))).map (fun s i => (s i).2)) ((activatedAugmentedMixture η n d q (intervalInterpolatedPrior π₀ π₁ ((j : ℝ) / M))).map (fun s i => (s i).2)) ≤ (1 - α) / 16) (T : IntervalProcedure n d) (hT : HonestInterval n d q α T) : (21 * (1 - α) / 32) * ((rareCount η n d q : ℝ) * rareMass η n q * ((∫ z, z⁻¹ ∂π₁) - ∫ z, z⁻¹ ∂π₀)) ≤ worstCaseRiskReal (fun (_ : Unit) (P : {P : FullLaw d // RareArrivalModelClass n d q P}) => intervalRisk T P.1) () := by let J : ℝ := rareCount η n d q let b := rareMass η n q let Δ := J * b * ((∫ z, z⁻¹ ∂π₁) - ∫ z, z⁻¹ ∂π₀) let θ := J * b * ∫ z, z⁻¹ ∂π₀ let Q : Fin (M + 1) → Measure (Fin n → ObsRecord d) := fun j => (activatedAugmentedMixture η n d q (intervalInterpolatedPrior π₀ π₁ ((j : ℝ) / M))).map (fun s i => (s i).2) let ν : Fin (M + 1) → Measure ConnectedInterval := fun j => T.1 ∘ₘ Q j have hpriors := intervalInterpolatedPrior_grid h₀ h₁ K hm M hM let := T.2 have hQ (j : Fin (M + 1)) : IsProbabilityMeasure (Q j) := by let := activatedAugmentedMixture_isProbabilityMeasure η n d q hn hd hb hq hslice (hpriors j).1 apply Measure.isProbabilityMeasure_map have hf : Measurable (fun s : Fin n → Bool × ObsRecord d => fun i => (s i).2) := by fun_prop exact hf.aemeasurable have hν (j : Fin (M + 1)) : IsProbabilityMeasure (ν j) := by dsimp [ν] infer_instance have hu : 0 < 1 - α := by linarith have hMr : 0 < (M : ℝ) := by exact_mod_cast (by omega : 0 < M) have hJpos : 0 < J := lt_of_lt_of_le (by positivity) hJ have hΔ : 0 < Δ := by dsimp [Δ, b]; positivity have hΔgap : J * b / 12 ≤ Δ := by dsimp [Δ] nlinarith [mul_le_mul_of_nonneg_left hgap (mul_nonneg hJpos.le hb.le)] have hlength := connectedInterval_many_prior_length_floor (ν 0) M ν θ Δ (1 - α) hΔ hu hgrid (fun j => ?_) (fun j => ?_) · exact hlength.trans (activatedAugmentedMixture_reported_length_le_worst η n d q hn hd hb hq hslice (hpriors 0).1 T) · have h := activatedAugmentedMixture_neighborhood_coverage_budget η n d M q α Δ hn hd hb hq hslice (hpriors j).1 T hT hα hα1 hΔ hM hΔgap hJ have hcenter : J * b * (∫ z, z⁻¹ ∂intervalInterpolatedPrior π₀ π₁ ((j : ℝ) / M)) = θ + (j : ℝ) * (Δ / M) := by rw [(hpriors j).2.2] dsimp [θ, Δ] ring change 7 * (1 - α) / 8 ≤ (ν j).real {I | ∃ x : ℝ, I.lo ≤ x ∧ x ≤ I.hi ∧ |x - (J * b * ∫ z, z⁻¹ ∂intervalInterpolatedPrior π₀ π₁ ((j : ℝ) / M))| ≤ Δ / (8 * M)} at h rw [hcenter] at h exact h · exact (tvDist_bind_le (Q 0) (Q j) T.1).trans (by simpa [Q] using htv j)
CausalSmith.Stat.MarRareqLogfrontier.activatedAugmentedMixture_grid_length_le_worst · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationCoverage.lean:259
theorem honestInterval_nonempty

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q α :
ℝ
hα :
0 ≤ α
Nonempty {T : IntervalProcedure n d // HonestInterval n d q α T}
Proof (Lean source)
-- @node: honestInterval_nonempty lemma honestInterval_nonempty (n d : ℕ) (q α : ℝ) (hα : 0 ≤ α) : Nonempty {T : IntervalProcedure n d // HonestInterval n d q α T} := by let I : ConnectedInterval := ⟨(-1, 1), by norm_num, by norm_num, by norm_num⟩ let T : IntervalProcedure n d := ⟨Kernel.const _ (Measure.dirac I), inferInstance⟩ refine ⟨⟨T, ?_⟩⟩ intro P hP let := P.2 let := Measure.isProbabilityMeasure_map (show Measurable obs by fun_prop).aemeasurable (μ := P.1) letI : IsProbabilityMeasure (sampleLaw n P) := by unfold sampleLaw; infer_instance have hmem : I ∈ {I | intervalContains I (ate P)} := by exact ate_mem_unit_interval P have heq (s : Fin n → ObsRecord d) : (T.1 s).real {I | intervalContains I (ate P)} = 1 := by rw [Kernel.const_apply, Measure.real, Measure.dirac_apply_of_mem hmem] simp simp_rw [heq] simp only [integral_const, probReal_univ, smul_eq_mul, one_mul] linarith
CausalSmith.Stat.MarRareqLogfrontier.honestInterval_nonempty · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationCoverage.lean:330
theorem activatedAugmentedMixture_interval_minimax_of_cutoff

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
η :
ℝ
n d M :
ℕ
q α :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hb :
0 < rareMass η n q
hq :
0 < q
hslice :
π₀ π₁ :
K :
ℕ
hm :
∀ v : ℕ
if
v ≤ K
then
(∫ z, z ^ v ∂π₀) = ∫ z, z ^ v ∂π₁
hgap :
1 / 12 ≤ (∫ z, z⁻¹ ∂π₁) - ∫ z, z⁻¹ ∂π₀
hα :
0 ≤ α
hα1 :
α < 1
hM :
1 ≤ M
hgrid :
8 / (1 - α) ≤ (M : ℝ)
hJ :
18432 * (M : ℝ) ^ 2 / (1 - α) ≤ (rareCount η n d q : ℝ)
hbad :
(activatedAugmentedMixture η n d q (intervalInterpolatedPrior π₀ π₁ ((0 : ℝ) / M))).real {s | ¬ ∀ x : Fin d, x.val < rareCount η n d q → (∑ i ∈ Finset.univ.filter (fun i => (s i).2.X = x), if (s i).1 then 1 else 0) ≤ K}
≤ (1 - α) / 16
(21 * (1 - α) / 32) * ((rareCount η n d q : ℝ) * rareMass η n q * ((∫ z, z⁻¹ ∂π₁) - ∫ z, z⁻¹ ∂π₀))
≤ intervalLengthRisk n d q α
Proof (Lean source)
-- @node: activatedAugmentedMixture_interval_minimax_of_cutoff lemma activatedAugmentedMixture_interval_minimax_of_cutoff (η : ℝ) (n d M : ℕ) (q α : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hb : 0 < rareMass η n q) (hq : 0 < q) (hslice : RareArrivalSlice n q) {π₀ π₁ : Measure ℝ} (h₀ : FiniteReciprocalPrior (lowerEndpoint n q) π₀) (h₁ : FiniteReciprocalPrior (lowerEndpoint n q) π₁) (K : ℕ) (hm : ∀ v : ℕ, v ≤ K → (∫ z, z ^ v ∂π₀) = ∫ z, z ^ v ∂π₁) (hgap : 1 / 12 ≤ (∫ z, z⁻¹ ∂π₁) - ∫ z, z⁻¹ ∂π₀) (hα : 0 ≤ α) (hα1 : α < 1) (hM : 1 ≤ M) (hgrid : 8 / (1 - α) ≤ (M : ℝ)) (hJ : 18432 * (M : ℝ) ^ 2 / (1 - α) ≤ (rareCount η n d q : ℝ)) (hbad : (activatedAugmentedMixture η n d q (intervalInterpolatedPrior π₀ π₁ ((0 : ℝ) / M))).real {s | ¬ ∀ x : Fin d, x.val < rareCount η n d q → (∑ i ∈ Finset.univ.filter (fun i => (s i).2.X = x), if (s i).1 then 1 else 0) ≤ K} ≤ (1 - α) / 16) : (21 * (1 - α) / 32) * ((rareCount η n d q : ℝ) * rareMass η n q * ((∫ z, z⁻¹ ∂π₁) - ∫ z, z⁻¹ ∂π₀)) ≤ intervalLengthRisk n d q α := by have htv (j : Fin (M + 1)) := activatedAugmentedMixture_projected_grid_tv_le_bad_event η n d q hn hd hb hq hslice h₀ h₁ K hm M hM 0 j have htvbudget (j : Fin (M + 1)) : tvDist ((activatedAugmentedMixture η n d q (intervalInterpolatedPrior π₀ π₁ ((0 : ℝ) / M))).map (fun s i => (s i).2)) ((activatedAugmentedMixture η n d q (intervalInterpolatedPrior π₀ π₁ ((j : ℝ) / M))).map (fun s i => (s i).2)) ≤ (1 - α) / 16 := by simpa only [Fin.val_zero, Nat.cast_zero] using (htv j).trans (by simpa only [Fin.val_zero, Nat.cast_zero] using hbad) letI := honestInterval_nonempty n d q α hα unfold intervalLengthRisk apply le_minimaxValue intro T exact activatedAugmentedMixture_grid_length_le_worst η n d M q α hn hd hb hq hslice h₀ h₁ K hm hgap hα hα1 hM hgrid hJ htvbudget T.1 T.2
CausalSmith.Stat.MarRareqLogfrontier.activatedAugmentedMixture_interval_minimax_of_cutoff · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationCoverage.lean:352
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.Lower.ActivationIntervalTransfer 4 declarations Averaging randomized interval lengths in the actual activated experiment and comparing the prior average with the model-class worst-case length.

Averaging randomized interval lengths in the actual activated experiment and comparing the prior average with the model-class worst-case length.

theorem activatedAugmentedMixture_integral

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
η :
ℝ
n d :
ℕ
q :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hb :
0 < rareMass η n q
hq :
0 < q
hslice :
π :
f :
(Fin n → Bool × ObsRecord d) → ℝ
(∫ s, f s ∂activatedAugmentedMixture η n d q π)
= ∫ z, (∫ s, f s ∂activatedAugmentedSample η n d q z) ∂Measure.pi (fun _ : Fin d => π)
Proof (Lean source)
-- @node: activatedAugmentedMixture_integral lemma activatedAugmentedMixture_integral (η : ℝ) (n d : ℕ) (q : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hb : 0 < rareMass η n q) (hq : 0 < q) (hslice : RareArrivalSlice n q) {π : Measure ℝ} (hπ : FiniteReciprocalPrior (lowerEndpoint n q) π) (f : (Fin n → Bool × ObsRecord d) → ℝ) : (∫ s, f s ∂activatedAugmentedMixture η n d q π) = ∫ z, (∫ s, f s ∂activatedAugmentedSample η n d q z) ∂Measure.pi (fun _ : Fin d => π) := by classical let := activatedAugmentedMixture_isProbabilityMeasure η n d q hn hd hb hq hslice hπ rw [integral_fintype Integrable.of_finite] simp_rw [activatedAugmentedMixture_real_singleton, smul_eq_mul, ← integral_mul_const] rw [← integral_finsetSum _ (fun s _ => finiteReciprocalPrior_pi_integrable hπ d _)] apply integral_congr_ae filter_upwards [finiteReciprocalPrior_pi_ae_support hπ d] with z hz rw [activatedAugmentedSample, dif_pos hz] let := augmentedOneRecord_isProbabilityMeasure η n d q z hn hd hb hq hslice hz simpa only [smul_eq_mul] using (integral_fintype (f := f) (μ := Measure.pi (fun _ : Fin n => augmentedOneRecord η n d q z hz)) Integrable.of_finite).symm
CausalSmith.Stat.MarRareqLogfrontier.activatedAugmentedMixture_integral · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationIntervalTransfer.lean:16
theorem activatedAugmentedMixture_projected_integral

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
η :
ℝ
n d :
ℕ
q :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hb :
0 < rareMass η n q
hq :
0 < q
hslice :
π :
f :
(Fin n → ObsRecord d) → ℝ
(∫ s, f s ∂((activatedAugmentedMixture η n d q π).map (fun s i => (s i).2)))
= ∫ z, (if hz : ∀ x, z x ∈ Icc (1 : ℝ) (lowerEndpoint n q) then ∫ s, f s ∂sampleLaw n (activatedFullLaw η n d q z hd hb hq hslice hz) else 0) ∂Measure.pi (fun _ : Fin d => π)
Proof (Lean source)
-- @node: activatedAugmentedMixture_projected_integral lemma activatedAugmentedMixture_projected_integral (η : ℝ) (n d : ℕ) (q : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hb : 0 < rareMass η n q) (hq : 0 < q) (hslice : RareArrivalSlice n q) {π : Measure ℝ} (hπ : FiniteReciprocalPrior (lowerEndpoint n q) π) (f : (Fin n → ObsRecord d) → ℝ) : (∫ s, f s ∂((activatedAugmentedMixture η n d q π).map (fun s i => (s i).2))) = ∫ z, (if hz : ∀ x, z x ∈ Icc (1 : ℝ) (lowerEndpoint n q) then ∫ s, f s ∂sampleLaw n (activatedFullLaw η n d q z hd hb hq hslice hz) else 0) ∂Measure.pi (fun _ : Fin d => π) := by have hf : Measurable (fun s : Fin n → Bool × ObsRecord d => fun i => (s i).2) := by fun_prop rw [integral_map hf.aemeasurable (by fun_prop), activatedAugmentedMixture_integral η n d q hn hd hb hq hslice hπ] apply integral_congr_ae filter_upwards [finiteReciprocalPrior_pi_ae_support hπ d] with z hz rw [dif_pos hz, activatedAugmentedSample, dif_pos hz] rw [← activated_sample_projection η n d q z hn hd hb hq hslice hz, integral_map hf.aemeasurable (by fun_prop)]
CausalSmith.Stat.MarRareqLogfrontier.activatedAugmentedMixture_projected_integral · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationIntervalTransfer.lean:39
theorem activatedAugmentedMixture_intervalRisk_average

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
η :
ℝ
n d :
ℕ
q :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hb :
0 < rareMass η n q
hq :
0 < q
hslice :
π :
(∫ s, (∫ I : ConnectedInterval, I.hi - I.lo ∂T.1 s) ∂((activatedAugmentedMixture η n d q π).map (fun s i => (s i).2)))
= ∫ z, (if hz : ∀ x, z x ∈ Icc (1 : ℝ) (lowerEndpoint n q) then intervalRisk T (activatedFullLaw η n d q z hd hb hq hslice hz) else 0) ∂Measure.pi (fun _ : Fin d => π)
Proof (Lean source)
-- @node: activatedAugmentedMixture_intervalRisk_average lemma activatedAugmentedMixture_intervalRisk_average (η : ℝ) (n d : ℕ) (q : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hb : 0 < rareMass η n q) (hq : 0 < q) (hslice : RareArrivalSlice n q) {π : Measure ℝ} (hπ : FiniteReciprocalPrior (lowerEndpoint n q) π) (T : IntervalProcedure n d) : (∫ s, (∫ I : ConnectedInterval, I.hi - I.lo ∂T.1 s) ∂((activatedAugmentedMixture η n d q π).map (fun s i => (s i).2))) = ∫ z, (if hz : ∀ x, z x ∈ Icc (1 : ℝ) (lowerEndpoint n q) then intervalRisk T (activatedFullLaw η n d q z hd hb hq hslice hz) else 0) ∂Measure.pi (fun _ : Fin d => π) := by exact activatedAugmentedMixture_projected_integral η n d q hn hd hb hq hslice hπ _
CausalSmith.Stat.MarRareqLogfrontier.activatedAugmentedMixture_intervalRisk_average · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationIntervalTransfer.lean:60
theorem activatedAugmentedMixture_intervalRisk_le_worst

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
η :
ℝ
n d :
ℕ
q :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hb :
0 < rareMass η n q
hq :
0 < q
hslice :
π :
(∫ s, (∫ I : ConnectedInterval, I.hi - I.lo ∂T.1 s) ∂((activatedAugmentedMixture η n d q π).map (fun s i => (s i).2)))
≤ worstCaseRiskReal (fun (_ : Unit) (P : {P : FullLaw d // RareArrivalModelClass n d q P}) => intervalRisk T P.1) ()
Proof (Lean source)
-- @node: activatedAugmentedMixture_intervalRisk_le_worst lemma activatedAugmentedMixture_intervalRisk_le_worst (η : ℝ) (n d : ℕ) (q : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hb : 0 < rareMass η n q) (hq : 0 < q) (hslice : RareArrivalSlice n q) {π : Measure ℝ} (hπ : FiniteReciprocalPrior (lowerEndpoint n q) π) (T : IntervalProcedure n d) : (∫ s, (∫ I : ConnectedInterval, I.hi - I.lo ∂T.1 s) ∂((activatedAugmentedMixture η n d q π).map (fun s i => (s i).2))) ≤ worstCaseRiskReal (fun (_ : Unit) (P : {P : FullLaw d // RareArrivalModelClass n d q P}) => intervalRisk T P.1) () := by let := hπ.1 rw [activatedAugmentedMixture_intervalRisk_average η n d q hn hd hb hq hslice hπ T] have hbdd : BddAbove (range (fun P : {P : FullLaw d // RareArrivalModelClass n d q P} => intervalRisk T P.1)) := by refine ⟨2, ?_⟩ rintro _ ⟨P, rfl⟩ exact (intervalRisk_bounds T P.1).2 have hle : ∀ᵐ z ∂Measure.pi (fun _ : Fin d => π), (if hz : ∀ x, z x ∈ Icc (1 : ℝ) (lowerEndpoint n q) then intervalRisk T (activatedFullLaw η n d q z hd hb hq hslice hz) else 0) ≤ worstCaseRiskReal (fun (_ : Unit) (P : {P : FullLaw d // RareArrivalModelClass n d q P}) => intervalRisk T P.1) () := by filter_upwards [finiteReciprocalPrior_pi_ae_support hπ d] with z hz rw [dif_pos hz] exact le_worstCaseRisk (risk := fun (_ : Unit) (P : {P : FullLaw d // RareArrivalModelClass n d q P}) => intervalRisk T P.1) (e := ()) hbdd ⟨_, activatedFullLaw_model η n d q z hd hb hq hslice hz hn⟩ simpa using integral_mono_ae (finiteReciprocalPrior_pi_integrable hπ d _) (integrable_const _) hle
CausalSmith.Stat.MarRareqLogfrontier.activatedAugmentedMixture_intervalRisk_le_worst · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationIntervalTransfer.lean:74
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.Lower.ActivationLikelihood 4 declarations Projection from the activated experiment to every observed record.

Projection from the activated experiment to every observed record.

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
η :
ℝ
n d :
ℕ
q :
ℝ
z :
Fin d → ℝ
x :
Fin d
a arrival one :
hz :
1 ≤ z x ∧ z x ≤ lowerEndpoint n q
(∑ flag : Bool, bernWeight (q * lowerEndpoint n q) flag * augmentedOutcomeWeight η n d q z x a flag arrival one)
= ∑ y₁ : Bool, bernWeight (if x.val < rareCount η n d q then (z x)⁻¹ else 0) y₁ * bernWeight (q * lowerCellZ η n d q z x) arrival * (if (arrival && (a && y₁)) = one then (1 : ℝ) else 0)
Proof (Lean source)
lemma activation_atom_weight (η : ℝ) (n d : ℕ) (q : ℝ) (z : Fin d → ℝ) (x : Fin d) (a arrival one : Bool) (hz : 1 ≤ z x ∧ z x ≤ lowerEndpoint n q) : (∑ flag : Bool, bernWeight (q * lowerEndpoint n q) flag * augmentedOutcomeWeight η n d q z x a flag arrival one) = ∑ y₁ : Bool, bernWeight (if x.val < rareCount η n d q then (z x)⁻¹ else 0) y₁ * bernWeight (q * lowerCellZ η n d q z x) arrival * (if (arrival && (a && y₁)) = one then (1 : ℝ) else 0) := by have hH : lowerEndpoint n q ≠ 0 := by linarith have hz0 : z x ≠ 0 := by linarith by_cases hr : x.val < rareCount η n d q · cases a <;> cases arrival <;> cases one <;> simp [bernWeight, augmentedOutcomeWeight, lowerCellZ, hr] <;> field_simp <;> ring · cases a <;> cases arrival <;> cases one <;> simp [bernWeight, augmentedOutcomeWeight, lowerCellZ, hr] <;> field_simp <;> simp
theorem augmentedOutcomeWeight_nonneg Lemma augmentedOutcomeWeight_nonneg in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
η :
ℝ
n d :
ℕ
q :
ℝ
z :
Fin d → ℝ
x :
Fin d
a flag arrival one :
hz :
1 ≤ z x ∧ z x ≤ lowerEndpoint n q
0 ≤ augmentedOutcomeWeight η n d q z x a flag arrival one
Proof (Lean source)
lemma augmentedOutcomeWeight_nonneg (η : ℝ) (n d : ℕ) (q : ℝ) (z : Fin d → ℝ) (x : Fin d) (a flag arrival one : Bool) (hz : 1 ≤ z x ∧ z x ≤ lowerEndpoint n q) : 0 ≤ augmentedOutcomeWeight η n d q z x a flag arrival one := by have hH : 0 < lowerEndpoint n q := by linarith [hz.1, hz.2] have hcell : 0 ≤ lowerCellZ η n d q z x ∧ lowerCellZ η n d q z x ≤ lowerEndpoint n q := by unfold lowerCellZ split_ifs <;> constructor <;> linarith [hz.1, hz.2] unfold augmentedOutcomeWeight split_ifs <;> try positivity all_goals try exact div_nonneg (by linarith [hz.1]) (le_of_lt hH) all_goals apply sub_nonneg.mpr all_goals exact (div_le_one hH).2 hcell.2
CausalSmith.Stat.MarRareqLogfrontier.augmentedOutcomeWeight_nonneg · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationLikelihood.lean:36
theorem ofReal_signed_mul_bool_sum Lemma ofReal_signed_mul_bool_sum in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
b :
ℝ
w :
Bool → ℝ
hw :
∀ flag, 0 ≤ w flag
(∑ flag : Bool, ofReal (b * w flag)) = ofReal (b * ∑ flag : Bool, w flag)
Proof (Lean source)
lemma ofReal_signed_mul_bool_sum (b : ℝ) (w : Bool → ℝ) (hw : ∀ flag, 0 ≤ w flag) : (∑ flag : Bool, ofReal (b * w flag)) = ofReal (b * ∑ flag : Bool, w flag) := by simp_rw [ENNReal.ofReal_mul' (hw _)] rw [← Finset.mul_sum] rw [ENNReal.ofReal_mul' (Finset.sum_nonneg (fun flag _ => hw flag))] rw [ENNReal.ofReal_sum_of_nonneg (fun flag _ => hw flag)]
CausalSmith.Stat.MarRareqLogfrontier.ofReal_signed_mul_bool_sum · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationLikelihood.lean:53
theorem activated_projection

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
η :
ℝ
n d :
ℕ
q :
ℝ
z :
Fin d → ℝ
_hn :
1 ≤ n
_hd :
1 ≤ d
hq :
0 < q
hslice :
hz :
∀ x, 1 ≤ z x ∧ z x ≤ lowerEndpoint n q
(augmentedOneRecord η n d q z (by simpa [Set.mem_Icc] using hz)).map snd
= (activatedLaw η n d q z (by simpa [Set.mem_Icc] using hz)).map obs
Proof (Lean source)
lemma activated_projection (η : ℝ) (n d : ℕ) (q : ℝ) (z : Fin d → ℝ) (_hn : 1 ≤ n) (_hd : 1 ≤ d) (hq : 0 < q) (hslice : RareArrivalSlice n q) (hz : ∀ x, 1 ≤ z x ∧ z x ≤ lowerEndpoint n q) -- @realizes \(Z\)(latent reciprocal variable in [1,H]) : (augmentedOneRecord η n d q z (by simpa [Set.mem_Icc] using hz)).map Prod.snd = (activatedLaw η n d q z (by simpa [Set.mem_Icc] using hz)).map obs := by classical have hH : q * lowerEndpoint n q ≤ 1 := lower_activation_probability_le_one n q (le_of_lt hq) hslice have hHpos : 0 ≤ lowerEndpoint n q := by unfold lowerEndpoint positivity have hcell (x : Fin d) : 0 ≤ lowerCellZ η n d q z x ∧ lowerCellZ η n d q z x ≤ lowerEndpoint n q := by unfold lowerCellZ split_ifs <;> constructor <;> linarith [(hz x).1, (hz x).2] have hprob (x : Fin d) : 0 ≤ q * lowerCellZ η n d q z x ∧ q * lowerCellZ η n d q z x ≤ 1 := by constructor · exact mul_nonneg (le_of_lt hq) (hcell x).1 · exact (mul_le_mul_of_nonneg_left (hcell x).2 (le_of_lt hq)).trans hH have hbw (p : ℝ) (hp : 0 ≤ p ∧ p ≤ 1) (v : Bool) : 0 ≤ bernWeight p v := by cases v <;> simp [bernWeight] <;> linarith [hp.1, hp.2] have hyprob (x : Fin d) : 0 ≤ (if x.val < rareCount η n d q then (z x)⁻¹ else 0) ∧ (if x.val < rareCount η n d q then (z x)⁻¹ else 0) ≤ 1 := by split_ifs · constructor · exact inv_nonneg.mpr (le_trans (by norm_num) (hz x).1) · exact inv_le_one₀ (by linarith [(hz x).1]) |>.mpr (hz x).1 · constructor <;> norm_num have hcoeff (x : Fin d) (a arrival one : Bool) : (∑ flag : Bool, ofReal (baselineMass η n d q x / 2 * bernWeight (q * lowerEndpoint n q) flag * augmentedOutcomeWeight η n d q z x a flag arrival one)) = ∑ y₁ : Bool, ofReal (baselineMass η n d q x / 2 * (bernWeight (if x.val < rareCount η n d q then (z x)⁻¹ else 0) y₁ * bernWeight (q * lowerCellZ η n d q z x) arrival * (if (arrival && (a && y₁)) = one then (1 : ℝ) else 0))) := by let b := baselineMass η n d q x / 2 have hleft (flag : Bool) : 0 ≤ bernWeight (q * lowerEndpoint n q) flag * augmentedOutcomeWeight η n d q z x a flag arrival one := mul_nonneg (hbw _ ⟨mul_nonneg (le_of_lt hq) hHpos, hH⟩ flag) (augmentedOutcomeWeight_nonneg η n d q z x a flag arrival one (hz x)) have hright (y₁ : Bool) : 0 ≤ bernWeight (if x.val < rareCount η n d q then (z x)⁻¹ else 0) y₁ * bernWeight (q * lowerCellZ η n d q z x) arrival * (if (arrival && (a && y₁)) = one then (1 : ℝ) else 0) := by apply mul_nonneg · exact mul_nonneg (hbw _ (hyprob x) y₁) (hbw _ (hprob x) arrival) · split_ifs <;> norm_num simp_rw [show ∀ flag : Bool, baselineMass η n d q x / 2 * bernWeight (q * lowerEndpoint n q) flag * augmentedOutcomeWeight η n d q z x a flag arrival one = b * (bernWeight (q * lowerEndpoint n q) flag * augmentedOutcomeWeight η n d q z x a flag arrival one) from fun _ => by simp [b, mul_assoc]] rw [ofReal_signed_mul_bool_sum b _ hleft] rw [activation_atom_weight η n d q z x a arrival one (hz x)] rw [← ofReal_signed_mul_bool_sum b _ hright] have hsnd : Measurable (Prod.snd : Bool × ObsRecord d → ObsRecord d) := measurable_snd have hobs : Measurable (obs : FullRecord d → ObsRecord d) := by fun_prop simp only [augmentedOneRecord, activatedLaw] rw [Measure.map_finset_sum' hsnd.aemeasurable] rw [Measure.map_finset_sum' hobs.aemeasurable] simp_rw [Measure.map_finset_sum' hsnd.aemeasurable] simp_rw [Measure.map_finset_sum' hobs.aemeasurable] simp only [Measure.map_smul, Measure.map_dirac, obs, lowerFullRecord, FullRecord.S, FullRecord.Y] apply Finset.sum_congr rfl intro x _ apply Finset.sum_congr rfl intro a _ rw [Finset.sum_comm] conv_rhs => rw [Finset.sum_comm] apply Finset.sum_congr rfl intro arrival _ rw [Finset.sum_comm] simp_rw [← Finset.sum_smul] simp_rw [hcoeff x a arrival] simp_rw [Finset.sum_smul] rw [Finset.sum_comm] apply Finset.sum_congr rfl intro y₁ _ cases a <;> cases arrival <;> cases y₁ <;> simp [mul_assoc]
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.Lower.ActivationMixture 8 declarations Construct the augmented prior mixture from its averaged atoms, with normalization and event probabilities derived from the supported experiment.

Construct the augmented prior mixture from its averaged atoms, with normalization and event probabilities derived from the supported experiment.

theorem finiteReciprocalPrior_pi_integrable Lemma finiteReciprocalPrior_pi_integrable in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
H :
ℝ
π :
J :
ℕ
f :
(Fin J → ℝ) → ℝ
Integrable f (Measure.pi (fun _ : Fin J => π))
Proof (Lean source)
-- @node: finiteReciprocalPrior_pi_integrable lemma finiteReciprocalPrior_pi_integrable {H : ℝ} {π : Measure ℝ} (hπ : FiniteReciprocalPrior H π) (J : ℕ) (f : (Fin J → ℝ) → ℝ) : Integrable f (Measure.pi (fun _ : Fin J => π)) := by let := hπ.1 obtain ⟨s, hs, _⟩ := hπ.2 have hae : ∀ᵐ z ∂π, z ∈ (s : Set ℝ) := (ae_mem_iff_measure_eq s.measurableSet.nullMeasurableSet).2 (by simpa using hs) have hprod : ∀ᵐ z ∂Measure.pi (fun _ : Fin J => π), ∀ x, z x ∈ (s : Set ℝ) := by rw [ae_all_iff] intro x exact Measure.tendsto_eval_ae_ae.eventually hae have hfinite : {z : Fin J → ℝ | ∀ x, z x ∈ (s : Set ℝ)}.Finite := Set.Finite.pi' (fun _ => s.finite_toSet) have hres : (Measure.pi (fun _ : Fin J => π)).restrict {z : Fin J → ℝ | ∀ x, z x ∈ (s : Set ℝ)} = Measure.pi (fun _ : Fin J => π) := Measure.restrict_eq_self_of_ae_mem hprod have hi : IntegrableOn f {z : Fin J → ℝ | ∀ x, z x ∈ (s : Set ℝ)} (Measure.pi (fun _ : Fin J => π)) := IntegrableOn.of_finite hfinite simpa only [IntegrableOn, hres] using hi
CausalSmith.Stat.MarRareqLogfrontier.finiteReciprocalPrior_pi_integrable · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationMixture.lean:15
def activatedAugmentedMixture

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
η :
ℝ
n d :
ℕ
q :
ℝ
π :
activatedAugmentedMixture η n d q π :
Measure (Fin n → Bool × ObsRecord d)
∑ s, ofReal (∫ z, (activatedAugmentedSample η n d q z).real {s} ∂Measure.pi (fun _ : Fin d => π)) • Measure.dirac s
CausalSmith.Stat.MarRareqLogfrontier.activatedAugmentedMixture · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationMixture.lean:38
theorem activatedAugmentedMixture_real_singleton

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
η :
ℝ
n d :
ℕ
q :
ℝ
π :
s :
Fin n → Bool × ObsRecord d
= ∫ z, (activatedAugmentedSample η n d q z).real {s} ∂Measure.pi (fun _ : Fin d => π)
Proof (Lean source)
-- @node: activatedAugmentedMixture_real_singleton lemma activatedAugmentedMixture_real_singleton (η : ℝ) (n d : ℕ) (q : ℝ) (π : Measure ℝ) (s : Fin n → Bool × ObsRecord d) : (activatedAugmentedMixture η n d q π).real {s} = ∫ z, (activatedAugmentedSample η n d q z).real {s} ∂Measure.pi (fun _ : Fin d => π) := by classical unfold activatedAugmentedMixture Measure.real simp only [Measure.finsetSum_apply, Measure.smul_apply, smul_eq_mul, Measure.dirac_apply, Set.indicator_apply, Set.mem_singleton_iff, Pi.one_apply] simp only [mul_ite, mul_one, mul_zero, Finset.sum_ite_eq', Finset.mem_univ, if_true] exact ENNReal.toReal_ofReal (integral_nonneg (fun _ => measureReal_nonneg))
CausalSmith.Stat.MarRareqLogfrontier.activatedAugmentedMixture_real_singleton · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationMixture.lean:45
theorem activatedAugmentedMixture_isProbabilityMeasure

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
η :
ℝ
n d :
ℕ
q :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hb :
0 < rareMass η n q
hq :
0 < q
hslice :
π :
Proof (Lean source)
-- @node: activatedAugmentedMixture_isProbabilityMeasure lemma activatedAugmentedMixture_isProbabilityMeasure (η : ℝ) (n d : ℕ) (q : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hb : 0 < rareMass η n q) (hq : 0 < q) (hslice : RareArrivalSlice n q) {π : Measure ℝ} (hπ : FiniteReciprocalPrior (lowerEndpoint n q) π) : IsProbabilityMeasure (activatedAugmentedMixture η n d q π) := by classical let := hπ.1 have hsum : (∑ s : Fin n → Bool × ObsRecord d, ∫ z, (activatedAugmentedSample η n d q z).real {s} ∂Measure.pi (fun _ : Fin d => π)) = 1 := by rw [← integral_finsetSum _ (fun s _ => finiteReciprocalPrior_pi_integrable hπ d _)] calc (∫ z, ∑ s : Fin n → Bool × ObsRecord d, (activatedAugmentedSample η n d q z).real {s} ∂Measure.pi (fun _ : Fin d => π)) = ∫ _z, (1 : ℝ) ∂Measure.pi (fun _ : Fin d => π) := by apply integral_congr_ae filter_upwards [finiteReciprocalPrior_pi_ae_support hπ d] with z hz rw [activatedAugmentedSample, dif_pos hz] let := augmentedOneRecord_isProbabilityMeasure η n d q z hn hd hb hq hslice hz rw [sum_measureReal_singleton] simp _ = 1 := by simp constructor unfold activatedAugmentedMixture simp only [Measure.finsetSum_apply, Measure.smul_apply, smul_eq_mul, Measure.dirac_apply_of_mem (Set.mem_univ _), mul_one] rw [← ENNReal.ofReal_sum_of_nonneg (fun s _ => integral_nonneg (fun _ => measureReal_nonneg)), hsum] simp
CausalSmith.Stat.MarRareqLogfrontier.activatedAugmentedMixture_isProbabilityMeasure · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationMixture.lean:59
theorem activatedAugmentedMixture_real_event

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
η :
ℝ
n d :
ℕ
q :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hb :
0 < rareMass η n q
hq :
0 < q
hslice :
π :
A :
Set (Fin n → Bool × ObsRecord d)
= ∫ z, (activatedAugmentedSample η n d q z).real A ∂Measure.pi (fun _ : Fin d => π)
Proof (Lean source)
-- @node: activatedAugmentedMixture_real_event lemma activatedAugmentedMixture_real_event (η : ℝ) (n d : ℕ) (q : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hb : 0 < rareMass η n q) (hq : 0 < q) (hslice : RareArrivalSlice n q) {π : Measure ℝ} (hπ : FiniteReciprocalPrior (lowerEndpoint n q) π) (A : Set (Fin n → Bool × ObsRecord d)) : (activatedAugmentedMixture η n d q π).real A = ∫ z, (activatedAugmentedSample η n d q z).real A ∂Measure.pi (fun _ : Fin d => π) := by classical let := activatedAugmentedMixture_isProbabilityMeasure η n d q hn hd hb hq hslice hπ rw [← Set.coe_toFinset A, ← sum_measureReal_singleton] simp_rw [activatedAugmentedMixture_real_singleton] rw [← integral_finsetSum _ (fun s _ => finiteReciprocalPrior_pi_integrable hπ d _)] apply integral_congr_ae filter_upwards [finiteReciprocalPrior_pi_ae_support hπ d] with z hz rw [activatedAugmentedSample, dif_pos hz] let := augmentedOneRecord_isProbabilityMeasure η n d q z hn hd hb hq hslice hz exact sum_measureReal_singleton _
CausalSmith.Stat.MarRareqLogfrontier.activatedAugmentedMixture_real_event · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationMixture.lean:92
theorem activatedAugmentedMixture_grid_tv_le_bad_event

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
η :
ℝ
n d :
ℕ
q :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hb :
0 < rareMass η n q
hq :
0 < q
hslice :
π₀ π₁ :
K :
ℕ
hm :
∀ v : ℕ
if
v ≤ K
then
(∫ z, z ^ v ∂π₀) = ∫ z, z ^ v ∂π₁
M :
ℕ
hM :
1 ≤ M
j j' :
Fin (M + 1)
tvDist (activatedAugmentedMixture η n d q (intervalInterpolatedPrior π₀ π₁ ((j : ℝ) / M))) (activatedAugmentedMixture η n d q (intervalInterpolatedPrior π₀ π₁ ((j' : ℝ) / M)))
≤ (activatedAugmentedMixture η n d q (intervalInterpolatedPrior π₀ π₁ ((j : ℝ) / M))).real {s | ¬ ∀ x : Fin d, x.val < rareCount η n d q → (∑ i ∈ Finset.univ.filter (fun i => (s i).2.X = x), if (s i).1 then 1 else 0) ≤ K}
Proof (Lean source)
-- @node: activatedAugmentedMixture_grid_tv_le_bad_event lemma activatedAugmentedMixture_grid_tv_le_bad_event (η : ℝ) (n d : ℕ) (q : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hb : 0 < rareMass η n q) (hq : 0 < q) (hslice : RareArrivalSlice n q) {π₀ π₁ : Measure ℝ} (h₀ : FiniteReciprocalPrior (lowerEndpoint n q) π₀) (h₁ : FiniteReciprocalPrior (lowerEndpoint n q) π₁) (K : ℕ) (hm : ∀ v : ℕ, v ≤ K → (∫ z, z ^ v ∂π₀) = ∫ z, z ^ v ∂π₁) (M : ℕ) (hM : 1 ≤ M) (j j' : Fin (M + 1)) : tvDist (activatedAugmentedMixture η n d q (intervalInterpolatedPrior π₀ π₁ ((j : ℝ) / M))) (activatedAugmentedMixture η n d q (intervalInterpolatedPrior π₀ π₁ ((j' : ℝ) / M))) ≤ (activatedAugmentedMixture η n d q (intervalInterpolatedPrior π₀ π₁ ((j : ℝ) / M))).real {s | ¬ ∀ x : Fin d, x.val < rareCount η n d q → (∑ i ∈ Finset.univ.filter (fun i => (s i).2.X = x), if (s i).1 then 1 else 0) ≤ K} := by have hgrid := intervalInterpolatedPrior_grid h₀ h₁ K hm M hM let := activatedAugmentedMixture_isProbabilityMeasure η n d q hn hd hb hq hslice (hgrid j).1 let := activatedAugmentedMixture_isProbabilityMeasure η n d q hn hd hb hq hslice (hgrid j').1 exact activatedAugmentedSample_grid_tv_le_bad_event η n d q hn hd hb hq hslice h₀ h₁ K hm M hM j j' _ _ (activatedAugmentedMixture_real_singleton η n d q _) (activatedAugmentedMixture_real_singleton η n d q _)
CausalSmith.Stat.MarRareqLogfrontier.activatedAugmentedMixture_grid_tv_le_bad_event · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationMixture.lean:113
theorem activatedAugmentedMixture_projected_real_event

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
η :
ℝ
n d :
ℕ
q :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hb :
0 < rareMass η n q
hq :
0 < q
hslice :
π :
A :
Set (Fin n → ObsRecord d)
((activatedAugmentedMixture η n d q π).map (fun s i => (s i).2)).real A
= ∫ z, (if hz : ∀ x, z x ∈ Icc (1 : ℝ) (lowerEndpoint n q) then (sampleLaw n (activatedFullLaw η n d q z hd hb hq hslice hz)).real A else 0) ∂Measure.pi (fun _ : Fin d => π)
Proof (Lean source)
-- @node: activatedAugmentedMixture_projected_real_event lemma activatedAugmentedMixture_projected_real_event (η : ℝ) (n d : ℕ) (q : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hb : 0 < rareMass η n q) (hq : 0 < q) (hslice : RareArrivalSlice n q) {π : Measure ℝ} (hπ : FiniteReciprocalPrior (lowerEndpoint n q) π) (A : Set (Fin n → ObsRecord d)) : ((activatedAugmentedMixture η n d q π).map (fun s i => (s i).2)).real A = ∫ z, (if hz : ∀ x, z x ∈ Icc (1 : ℝ) (lowerEndpoint n q) then (sampleLaw n (activatedFullLaw η n d q z hd hb hq hslice hz)).real A else 0) ∂Measure.pi (fun _ : Fin d => π) := by have hf : Measurable (fun s : Fin n → Bool × ObsRecord d => fun i => (s i).2) := by fun_prop have hA : MeasurableSet A := A.toFinite.measurableSet rw [map_measureReal_apply hf hA, activatedAugmentedMixture_real_event η n d q hn hd hb hq hslice hπ] apply integral_congr_ae filter_upwards [finiteReciprocalPrior_pi_ae_support hπ d] with z hz rw [dif_pos hz, activatedAugmentedSample, dif_pos hz] rw [← activated_sample_projection η n d q z hn hd hb hq hslice hz, map_measureReal_apply hf hA]
CausalSmith.Stat.MarRareqLogfrontier.activatedAugmentedMixture_projected_real_event · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationMixture.lean:142
theorem activatedAugmentedMixture_projected_grid_tv_le_bad_event

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
η :
ℝ
n d :
ℕ
q :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hb :
0 < rareMass η n q
hq :
0 < q
hslice :
π₀ π₁ :
K :
ℕ
hm :
∀ v : ℕ
if
v ≤ K
then
(∫ z, z ^ v ∂π₀) = ∫ z, z ^ v ∂π₁
M :
ℕ
hM :
1 ≤ M
j j' :
Fin (M + 1)
tvDist ((activatedAugmentedMixture η n d q (intervalInterpolatedPrior π₀ π₁ ((j : ℝ) / M))).map (fun s i => (s i).2)) ((activatedAugmentedMixture η n d q (intervalInterpolatedPrior π₀ π₁ ((j' : ℝ) / M))).map (fun s i => (s i).2))
≤ (activatedAugmentedMixture η n d q (intervalInterpolatedPrior π₀ π₁ ((j : ℝ) / M))).real {s | ¬ ∀ x : Fin d, x.val < rareCount η n d q → (∑ i ∈ Finset.univ.filter (fun i => (s i).2.X = x), if (s i).1 then 1 else 0) ≤ K}
Proof (Lean source)
-- @node: activatedAugmentedMixture_projected_grid_tv_le_bad_event lemma activatedAugmentedMixture_projected_grid_tv_le_bad_event (η : ℝ) (n d : ℕ) (q : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hb : 0 < rareMass η n q) (hq : 0 < q) (hslice : RareArrivalSlice n q) {π₀ π₁ : Measure ℝ} (h₀ : FiniteReciprocalPrior (lowerEndpoint n q) π₀) (h₁ : FiniteReciprocalPrior (lowerEndpoint n q) π₁) (K : ℕ) (hm : ∀ v : ℕ, v ≤ K → (∫ z, z ^ v ∂π₀) = ∫ z, z ^ v ∂π₁) (M : ℕ) (hM : 1 ≤ M) (j j' : Fin (M + 1)) : tvDist ((activatedAugmentedMixture η n d q (intervalInterpolatedPrior π₀ π₁ ((j : ℝ) / M))).map (fun s i => (s i).2)) ((activatedAugmentedMixture η n d q (intervalInterpolatedPrior π₀ π₁ ((j' : ℝ) / M))).map (fun s i => (s i).2)) ≤ (activatedAugmentedMixture η n d q (intervalInterpolatedPrior π₀ π₁ ((j : ℝ) / M))).real {s | ¬ ∀ x : Fin d, x.val < rareCount η n d q → (∑ i ∈ Finset.univ.filter (fun i => (s i).2.X = x), if (s i).1 then 1 else 0) ≤ K} := by have hgrid := intervalInterpolatedPrior_grid h₀ h₁ K hm M hM let := activatedAugmentedMixture_isProbabilityMeasure η n d q hn hd hb hq hslice (hgrid j).1 let := activatedAugmentedMixture_isProbabilityMeasure η n d q hn hd hb hq hslice (hgrid j').1 have hf : Measurable (fun s : Fin n → Bool × ObsRecord d => fun i => (s i).2) := by fun_prop apply activation_projected_tv_le_bad_event _ _ _ _ _ hf intro s hs rw [activatedAugmentedMixture_real_singleton, activatedAugmentedMixture_real_singleton] exact activatedAugmentedSample_grid_singleton_eq η n d q hn hd hb hq hslice h₀ h₁ K hm M hM j j' s hs
CausalSmith.Stat.MarRareqLogfrontier.activatedAugmentedMixture_projected_grid_tv_le_bad_event · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationMixture.lean:164
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.Lower.ActivationModel 11 declarations Cell probabilities and MAR factorization for the activated full-data laws.

Cell probabilities and MAR factorization for the activated full-data laws. These construction identities supply the model obligations used when averaging coverage over the finite reciprocal priors.

theorem activatedFullLaw_real_event

Given the event, the stated activated-law mass identity holds.

Formal statement
η :
ℝ
shared
n :
ℕ
shared
d :
ℕ
shared
q :
ℝ
shared
z :
Fin d → ℝ
shared
hd :
1 ≤ d
shared
hb :
0 < rareMass η n q
shared
hq :
0 < q
shared
hslice :
shared
hz :
∀ (x : Fin d), z x ∈ Icc 1 (lowerEndpoint n q)
shared
E :
(activatedFullLaw η n d q z hd hb hq hslice hz).1.real E
= by classical exact ∑ x : Fin d, ∑ a : Bool, ∑ y : Bool, ∑ r : Bool, if lowerFullRecord x a y r ∈ E then baselineMass η n d q x / 2 * bernWeight (if x.val < rareCount η n d q then (z x)⁻¹ else 0) y * bernWeight (q * lowerCellZ η n d q z x) r else 0
Proof (Lean source)
-- @node: activatedFullLaw_real_event lemma activatedFullLaw_real_event (E : Set (FullRecord d)) : (activatedFullLaw η n d q z hd hb hq hslice hz).1.real E = by classical exact ∑ x : Fin d, ∑ a : Bool, ∑ y : Bool, ∑ r : Bool, if lowerFullRecord x a y r ∈ E then baselineMass η n d q x / 2 * bernWeight (if x.val < rareCount η n d q then (z x)⁻¹ else 0) y * bernWeight (q * lowerCellZ η n d q z x) r else 0 := by classical simp only [activatedFullLaw, activatedLaw, Measure.real, Measure.finsetSum_apply, Measure.smul_apply, smul_eq_mul, Measure.dirac_apply, Set.indicator_apply, Pi.one_apply] simp only [mul_ite, mul_one, mul_zero] rw [ENNReal.toReal_sum (by simp [ENNReal.sum_ne_top, ite_eq_iff])] apply Finset.sum_congr rfl intro x _ rw [ENNReal.toReal_sum (by simp [ENNReal.sum_ne_top, ite_eq_iff])] apply Finset.sum_congr rfl intro a _ rw [ENNReal.toReal_sum (by simp [ENNReal.sum_ne_top, ite_eq_iff])] apply Finset.sum_congr rfl intro y _ rw [ENNReal.toReal_sum (by simp [ENNReal.sum_ne_top, ite_eq_iff])] apply Finset.sum_congr rfl intro r _ by_cases he : lowerFullRecord x a y r ∈ E · simp only [if_pos he] exact ENNReal.toReal_ofReal (activatedLaw_weight_nonneg η n d q z hb hq hslice hz x y r) · simp only [if_neg he, ENNReal.toReal_zero]
CausalSmith.Stat.MarRareqLogfrontier.activatedFullLaw_real_event · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationModel.lean:22
theorem activatedFullLaw_cellProb

Given an arm, cell, and surrogate value, the activated cell probability has the displayed form.

Formal statement
η :
ℝ
shared
n :
ℕ
shared
d :
ℕ
shared
q :
ℝ
shared
z :
Fin d → ℝ
shared
hd :
1 ≤ d
shared
hb :
0 < rareMass η n q
shared
hq :
0 < q
shared
hslice :
shared
hz :
∀ (x : Fin d), z x ∈ Icc 1 (lowerEndpoint n q)
shared
a :
x :
Fin d
s :
cellProb (activatedFullLaw η n d q z hd hb hq hslice hz) (a, x, s)
= if s then 0 else baselineMass η n d q x / 2
Proof (Lean source)
-- @node: activatedFullLaw_cellProb lemma activatedFullLaw_cellProb (a : Bool) (x : Fin d) (s : Bool) : cellProb (activatedFullLaw η n d q z hd hb hq hslice hz) (a, x, s) = if s then 0 else baselineMass η n d q x / 2 := by classical rw [cellProb, activatedFullLaw_real_event η n d q z hd hb hq hslice hz] cases a <;> cases s <;> simp [inCell, lowerFullRecord, FullRecord.S, bernWeight, Finset.sum_ite_irrel, Finset.sum_ite_eq'] all_goals split_ifs <;> ring
CausalSmith.Stat.MarRareqLogfrontier.activatedFullLaw_cellProb · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationModel.lean:55
theorem activatedFullLaw_arrivedCell

Given an arm, cell, and surrogate value, the activated arrived-cell mass has the displayed form.

Formal statement
η :
ℝ
shared
n :
ℕ
shared
d :
ℕ
shared
q :
ℝ
shared
z :
Fin d → ℝ
shared
hd :
1 ≤ d
shared
hb :
0 < rareMass η n q
shared
hq :
0 < q
shared
hslice :
shared
hz :
∀ (x : Fin d), z x ∈ Icc 1 (lowerEndpoint n q)
shared
a :
x :
Fin d
s :
arrivedCell (activatedFullLaw η n d q z hd hb hq hslice hz) (a, x, s)
= q * lowerCellZ η n d q z x * cellProb (activatedFullLaw η n d q z hd hb hq hslice hz) (a, x, s)
Proof (Lean source)
-- @node: activatedFullLaw_arrivedCell lemma activatedFullLaw_arrivedCell (a : Bool) (x : Fin d) (s : Bool) : arrivedCell (activatedFullLaw η n d q z hd hb hq hslice hz) (a, x, s) = q * lowerCellZ η n d q z x * cellProb (activatedFullLaw η n d q z hd hb hq hslice hz) (a, x, s) := by classical rw [arrivedCell, activatedFullLaw_real_event η n d q z hd hb hq hslice hz, activatedFullLaw_cellProb η n d q z hd hb hq hslice hz] cases a <;> cases s <;> simp [inCell, lowerFullRecord, FullRecord.S, bernWeight, Finset.sum_ite_irrel, Finset.sum_ite_eq'] all_goals split_ifs <;> ring
CausalSmith.Stat.MarRareqLogfrontier.activatedFullLaw_arrivedCell · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationModel.lean:67
theorem activatedFullLaw_occupiedCellArrival

The activated law satisfies occupied-cell arrival.

Formal statement
η :
ℝ
shared
n :
ℕ
shared
d :
ℕ
shared
q :
ℝ
shared
z :
Fin d → ℝ
shared
hd :
1 ≤ d
shared
hb :
0 < rareMass η n q
shared
hq :
0 < q
shared
hslice :
shared
hz :
∀ (x : Fin d), z x ∈ Icc 1 (lowerEndpoint n q)
shared
OccupiedCellArrival q (activatedFullLaw η n d q z hd hb hq hslice hz)
Proof (Lean source)
-- @node: activatedFullLaw_occupiedCellArrival lemma activatedFullLaw_occupiedCellArrival : OccupiedCellArrival q (activatedFullLaw η n d q z hd hb hq hslice hz) := by intro j hj rcases j with ⟨a, x, s⟩ rw [activatedFullLaw_arrivedCell η n d q z hd hb hq hslice hz] have hcell : 1 ≤ lowerCellZ η n d q z x := by unfold lowerCellZ split_ifs · exact (hz x).1 · exact lowerEndpoint_one_le n q hq.le have hfactor : q ≤ q * lowerCellZ η n d q z x := by nlinarith exact mul_le_mul_of_nonneg_right hfactor hj.le
CausalSmith.Stat.MarRareqLogfrontier.activatedFullLaw_occupiedCellArrival · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationModel.lean:81
theorem activatedFullLaw_mar

The activated law satisfies arrival MAR.

Formal statement
η :
ℝ
shared
n :
ℕ
shared
d :
ℕ
shared
q :
ℝ
shared
z :
Fin d → ℝ
shared
hd :
1 ≤ d
shared
hb :
0 < rareMass η n q
shared
hq :
0 < q
shared
hslice :
shared
hz :
∀ (x : Fin d), z x ∈ Icc 1 (lowerEndpoint n q)
shared
ArrivalMAR (activatedFullLaw η n d q z hd hb hq hslice hz)
Proof (Lean source)
-- @node: activatedFullLaw_mar lemma activatedFullLaw_mar : ArrivalMAR (activatedFullLaw η n d q z hd hb hq hslice hz) := by classical intro j y r rcases j with ⟨a, x, s⟩ rw [activatedFullLaw_cellProb η n d q z hd hb hq hslice hz] simp_rw [activatedFullLaw_real_event η n d q z hd hb hq hslice hz] cases a <;> cases s <;> cases y <;> cases r <;> simp [inCell, lowerFullRecord, FullRecord.S, FullRecord.Y, bernWeight, Finset.sum_add_distrib, Finset.sum_ite_irrel, Finset.sum_ite_eq'] all_goals split_ifs <;> ring all_goals simp only [true_or]
CausalSmith.Stat.MarRareqLogfrontier.activatedFullLaw_mar · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationModel.lean:96
theorem activatedFullLaw_consistency

The activated law satisfies surrogate and outcome consistency.

Formal statement
η :
ℝ
shared
n :
ℕ
shared
d :
ℕ
shared
q :
ℝ
shared
z :
Fin d → ℝ
shared
hd :
1 ≤ d
shared
hb :
0 < rareMass η n q
shared
hq :
0 < q
shared
hslice :
shared
hz :
∀ (x : Fin d), z x ∈ Icc 1 (lowerEndpoint n q)
shared
conclusion 1
SurrogateConsistency (activatedFullLaw η n d q z hd hb hq hslice hz)
conclusion 2
OutcomeConsistency (activatedFullLaw η n d q z hd hb hq hslice hz)
Proof (Lean source)
-- @node: activatedFullLaw_consistency lemma activatedFullLaw_consistency : SurrogateConsistency (activatedFullLaw η n d q z hd hb hq hslice hz) ∧ OutcomeConsistency (activatedFullLaw η n d q z hd hb hq hslice hz) := by constructor <;> filter_upwards [] with r <;> rfl
CausalSmith.Stat.MarRareqLogfrontier.activatedFullLaw_consistency · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationModel.lean:111
theorem activatedFullLaw_balanced

The activated law has balanced treatment assignment.

Formal statement
η :
ℝ
shared
n :
ℕ
shared
d :
ℕ
shared
q :
ℝ
shared
z :
Fin d → ℝ
shared
hd :
1 ≤ d
shared
hb :
0 < rareMass η n q
shared
hq :
0 < q
shared
hslice :
shared
hz :
∀ (x : Fin d), z x ∈ Icc 1 (lowerEndpoint n q)
shared
BalancedRandomization (activatedFullLaw η n d q z hd hb hq hslice hz)
Proof (Lean source)
-- @node: activatedFullLaw_balanced lemma activatedFullLaw_balanced : BalancedRandomization (activatedFullLaw η n d q z hd hb hq hslice hz) := by classical rw [BalancedRandomization, activatedFullLaw_real_event η n d q z hd hb hq hslice hz] calc _ = ∑ x : Fin d, baselineMass η n d q x / 2 := by apply Finset.sum_congr rfl intro x _ by_cases hr : x.val < rareCount η n d q <;> simp [lowerFullRecord, bernWeight, hr] <;> ring _ = 1 / 2 := by rw [← Finset.sum_div, baselineMass_sum η n d q hd]
CausalSmith.Stat.MarRareqLogfrontier.activatedFullLaw_balanced · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationModel.lean:118
theorem activatedFullLaw_arm_event_factor

For arm and latent events, the activated-law joint mass factors.

Formal statement
η :
ℝ
shared
n :
ℕ
shared
d :
ℕ
shared
q :
ℝ
shared
z :
Fin d → ℝ
shared
hd :
1 ≤ d
shared
hb :
0 < rareMass η n q
shared
hq :
0 < q
shared
hslice :
shared
hz :
∀ (x : Fin d), z x ∈ Icc 1 (lowerEndpoint n q)
shared
s :
t :
Set (Fin d × Bool × Bool × Bool × Bool)
(activatedFullLaw η n d q z hd hb hq hslice hz).1.real {r | r.A ∈ s ∧ (r.X, r.S0, r.S1, r.Y0, r.Y1) ∈ t}
= (by classical exact ((if true ∈ s then (1 : ℝ) else 0) + (if false ∈ s then (1 : ℝ) else 0)) / 2) * (activatedFullLaw η n d q z hd hb hq hslice hz).1.real {r | (r.X, r.S0, r.S1, r.Y0, r.Y1) ∈ t}
Proof (Lean source)
-- @node: activatedFullLaw_arm_event_factor lemma activatedFullLaw_arm_event_factor (s : Set Bool) (t : Set (Fin d × Bool × Bool × Bool × Bool)) : (activatedFullLaw η n d q z hd hb hq hslice hz).1.real {r | r.A ∈ s ∧ (r.X, r.S0, r.S1, r.Y0, r.Y1) ∈ t} = (by classical exact ((if true ∈ s then (1 : ℝ) else 0) + (if false ∈ s then (1 : ℝ) else 0)) / 2) * (activatedFullLaw η n d q z hd hb hq hslice hz).1.real {r | (r.X, r.S0, r.S1, r.Y0, r.Y1) ∈ t} := by classical rw [activatedFullLaw_real_event η n d q z hd hb hq hslice hz, activatedFullLaw_real_event η n d q z hd hb hq hslice hz, Finset.mul_sum] apply Finset.sum_congr rfl intro x _ by_cases hsT : true ∈ s <;> by_cases hsF : false ∈ s <;> by_cases htT : (x, false, false, false, true) ∈ t <;> by_cases htF : (x, false, false, false, false) ∈ t <;> simp [lowerFullRecord, bernWeight, hsT, hsF, htT, htF] all_goals split_ifs <;> ring
CausalSmith.Stat.MarRareqLogfrontier.activatedFullLaw_arm_event_factor · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationModel.lean:132
theorem activatedFullLaw_arm_mass

For an arm event, the activated-law arm mass has the displayed value.

Formal statement
η :
ℝ
shared
n :
ℕ
shared
d :
ℕ
shared
q :
ℝ
shared
z :
Fin d → ℝ
shared
hd :
1 ≤ d
shared
hb :
0 < rareMass η n q
shared
hq :
0 < q
shared
hslice :
shared
hz :
∀ (x : Fin d), z x ∈ Icc 1 (lowerEndpoint n q)
shared
s :
(activatedFullLaw η n d q z hd hb hq hslice hz).1.real {r | r.A ∈ s}
= (by classical exact ((if true ∈ s then (1 : ℝ) else 0) + (if false ∈ s then (1 : ℝ) else 0)) / 2)
Proof (Lean source)
-- @node: activatedFullLaw_arm_mass lemma activatedFullLaw_arm_mass (s : Set Bool) : (activatedFullLaw η n d q z hd hb hq hslice hz).1.real {r | r.A ∈ s} = (by classical exact ((if true ∈ s then (1 : ℝ) else 0) + (if false ∈ s then (1 : ℝ) else 0)) / 2) := by let := (activatedFullLaw η n d q z hd hb hq hslice hz).2 simpa using activatedFullLaw_arm_event_factor η n d q z hd hb hq hslice hz s univ
CausalSmith.Stat.MarRareqLogfrontier.activatedFullLaw_arm_mass · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationModel.lean:153
theorem activatedFullLaw_randomized

The activated law has randomized treatment independent of latent variables.

Formal statement
η :
ℝ
shared
n :
ℕ
shared
d :
ℕ
shared
q :
ℝ
shared
z :
Fin d → ℝ
shared
hd :
1 ≤ d
shared
hb :
0 < rareMass η n q
shared
hq :
0 < q
shared
hslice :
shared
hz :
∀ (x : Fin d), z x ∈ Icc 1 (lowerEndpoint n q)
shared
RandomizedIndependence (activatedFullLaw η n d q z hd hb hq hslice hz)
Proof (Lean source)
-- @node: activatedFullLaw_randomized lemma activatedFullLaw_randomized : RandomizedIndependence (activatedFullLaw η n d q z hd hb hq hslice hz) := by let := (activatedFullLaw η n d q z hd hb hq hslice hz).2 rw [RandomizedIndependence, indepFun_iff_measure_inter_preimage_eq_mul] intro s t _ _ apply (ENNReal.toReal_eq_toReal_iff' (measure_ne_top _ _) (by finiteness)).mp rw [ENNReal.toReal_mul] change (activatedFullLaw η n d q z hd hb hq hslice hz).1.real {r | r.A ∈ s ∧ (r.X, r.S0, r.S1, r.Y0, r.Y1) ∈ t} = (activatedFullLaw η n d q z hd hb hq hslice hz).1.real {r | r.A ∈ s} * (activatedFullLaw η n d q z hd hb hq hslice hz).1.real {r | (r.X, r.S0, r.S1, r.Y0, r.Y1) ∈ t} rw [activatedFullLaw_arm_event_factor η n d q z hd hb hq hslice hz, activatedFullLaw_arm_mass η n d q z hd hb hq hslice hz]
CausalSmith.Stat.MarRareqLogfrontier.activatedFullLaw_randomized · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationModel.lean:162
theorem activatedFullLaw_model

Given a positive sample size, the activated law belongs to the rare-arrival model.

Formal statement
η :
ℝ
shared
n :
ℕ
shared
d :
ℕ
shared
q :
ℝ
shared
z :
Fin d → ℝ
shared
hd :
1 ≤ d
shared
hb :
0 < rareMass η n q
shared
hq :
0 < q
shared
hslice :
shared
hz :
∀ (x : Fin d), z x ∈ Icc 1 (lowerEndpoint n q)
shared
hn :
1 ≤ n
RareArrivalModelClass n d q (activatedFullLaw η n d q z hd hb hq hslice hz)
Proof (Lean source)
-- @node: activatedFullLaw_model lemma activatedFullLaw_model (hn : 1 ≤ n) : RareArrivalModelClass n d q (activatedFullLaw η n d q z hd hb hq hslice hz) := by have hq1 : q ≤ 1 := by have hH := lowerEndpoint_one_le n q hq.le have hactivation := lower_activation_probability_le_one n q hq.le hslice nlinarith exact ⟨sampleLaw_iid n _, activatedFullLaw_randomized η n d q z hd hb hq hslice hz, activatedFullLaw_balanced η n d q z hd hb hq hslice hz, (activatedFullLaw_consistency η n d q z hd hb hq hslice hz).1, (activatedFullLaw_consistency η n d q z hd hb hq hslice hz).2, activatedFullLaw_mar η n d q z hd hb hq hslice hz, activatedFullLaw_occupiedCellArrival η n d q z hd hb hq hslice hz, hslice, hn, hd, hq, hq1⟩
CausalSmith.Stat.MarRareqLogfrontier.activatedFullLaw_model · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationModel.lean:179
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.Lower.ActivationPolynomial 9 declarations The conditional rare-cell likelihood in equation (6) is polynomial, with degree at most the number of revealed activations.

The conditional rare-cell likelihood in equation (6) is polynomial, with degree at most the number of revealed activations. Matching moments therefore identifies its prior averages below the activation cutoff.

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
H :
ℝ
a flag arrival one :
activationRareOutcomePolynomial H a flag arrival one :
if !flag then if !arrival && !one then 1 else 0 else if one then if arrival && a then C H⁻¹ else 0 else if arrival then if a then C H⁻¹ * (X - 1) else C H⁻¹ * X else 1
- C H⁻¹ * X
CausalSmith.Stat.MarRareqLogfrontier.activationRareOutcomePolynomial · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationPolynomial.lean:17
theorem activationRareOutcomePolynomial_eval

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
η :
ℝ
n d :
ℕ
q :
ℝ
z :
Fin d → ℝ
x :
Fin d
a flag arrival one :
hx :
x.val < rareCount η n d q
(activationRareOutcomePolynomial (lowerEndpoint n q) a flag arrival one).eval (z x)
= augmentedOutcomeWeight η n d q z x a flag arrival one
Proof (Lean source)
-- @node: activationRareOutcomePolynomial_eval lemma activationRareOutcomePolynomial_eval (η : ℝ) (n d : ℕ) (q : ℝ) (z : Fin d → ℝ) (x : Fin d) (a flag arrival one : Bool) (hx : x.val < rareCount η n d q) : (activationRareOutcomePolynomial (lowerEndpoint n q) a flag arrival one).eval (z x) = augmentedOutcomeWeight η n d q z x a flag arrival one := by cases a <;> cases flag <;> cases arrival <;> cases one <;> simp only [activationRareOutcomePolynomial, augmentedOutcomeWeight, lowerCellZ, hx, Bool.not_false, Bool.not_true, Bool.false_eq_true, Bool.and_false, Bool.and_true, Bool.false_and, Bool.true_and, if_true, if_false, eval_zero, eval_one, eval_C, eval_mul, eval_sub, eval_X] <;> simp [div_eq_mul_inv, mul_comm]
CausalSmith.Stat.MarRareqLogfrontier.activationRareOutcomePolynomial_eval · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationPolynomial.lean:27
theorem activationRareOutcomePolynomial_natDegree

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
H :
ℝ
a flag arrival one :
(activationRareOutcomePolynomial H a flag arrival one).natDegree ≤ if flag then 1 else 0
Proof (Lean source)
-- @node: activationRareOutcomePolynomial_natDegree lemma activationRareOutcomePolynomial_natDegree (H : ℝ) (a flag arrival one : Bool) : (activationRareOutcomePolynomial H a flag arrival one).natDegree ≤ if flag then 1 else 0 := by have hmul : (C H⁻¹ * X : Polynomial ℝ).natDegree ≤ 1 := by simpa using (natDegree_mul_le (p := (C H⁻¹ : Polynomial ℝ)) (q := X)) have hsub : (X - 1 : Polynomial ℝ).natDegree ≤ 1 := by simpa using (natDegree_sub_le (X : Polynomial ℝ) 1) have hmulsub : (C H⁻¹ * (X - 1) : Polynomial ℝ).natDegree ≤ 1 := by exact (natDegree_mul_le (p := C H⁻¹) (q := X - 1)).trans (by simpa using hsub) have hlast : (1 - C H⁻¹ * X : Polynomial ℝ).natDegree ≤ 1 := (natDegree_sub_le _ _).trans (max_le (by simp) hmul) cases a <;> cases flag <;> cases arrival <;> cases one <;> simp [activationRareOutcomePolynomial] <;> assumption
CausalSmith.Stat.MarRareqLogfrontier.activationRareOutcomePolynomial_natDegree · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationPolynomial.lean:41

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
ι :
Type*
s :
H :
ℝ
a flag arrival one :
ι → Bool
activationRareCellPolynomial s H a flag arrival one :
∏ i ∈ s, activationRareOutcomePolynomial H (a i) (flag i) (arrival i) (one i)
CausalSmith.Stat.MarRareqLogfrontier.activationRareCellPolynomial · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationPolynomial.lean:58
theorem activationRareCellPolynomial_natDegree

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
ι :
Type*
s :
H :
ℝ
a flag arrival one :
ι → Bool
(activationRareCellPolynomial s H a flag arrival one).natDegree
≤ ∑ i ∈ s, if flag i then 1 else 0
Proof (Lean source)
-- @node: activationRareCellPolynomial_natDegree lemma activationRareCellPolynomial_natDegree {ι : Type*} (s : Finset ι) (H : ℝ) (a flag arrival one : ι → Bool) : (activationRareCellPolynomial s H a flag arrival one).natDegree ≤ ∑ i ∈ s, if flag i then 1 else 0 := by apply (natDegree_prod_le s _).trans exact Finset.sum_le_sum (fun i _ => activationRareOutcomePolynomial_natDegree H (a i) (flag i) (arrival i) (one i))
CausalSmith.Stat.MarRareqLogfrontier.activationRareCellPolynomial_natDegree · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationPolynomial.lean:64
theorem activationRareCellPolynomial_eval

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
ι :
Type*
s :
η :
ℝ
n d :
ℕ
q :
ℝ
z :
Fin d → ℝ
x :
Fin d
a flag arrival one :
ι → Bool
hx :
x.val < rareCount η n d q
(activationRareCellPolynomial s (lowerEndpoint n q) a flag arrival one).eval (z x)
= ∏ i ∈ s, augmentedOutcomeWeight η n d q z x (a i) (flag i) (arrival i) (one i)
Proof (Lean source)
-- @node: activationRareCellPolynomial_eval lemma activationRareCellPolynomial_eval {ι : Type*} (s : Finset ι) (η : ℝ) (n d : ℕ) (q : ℝ) (z : Fin d → ℝ) (x : Fin d) (a flag arrival one : ι → Bool) (hx : x.val < rareCount η n d q) : (activationRareCellPolynomial s (lowerEndpoint n q) a flag arrival one).eval (z x) = ∏ i ∈ s, augmentedOutcomeWeight η n d q z x (a i) (flag i) (arrival i) (one i) := by simp only [activationRareCellPolynomial, eval_prod] exact Finset.prod_congr rfl (fun i _ => activationRareOutcomePolynomial_eval η n d q z x _ _ _ _ hx)
CausalSmith.Stat.MarRareqLogfrontier.activationRareCellPolynomial_eval · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationPolynomial.lean:74
theorem finiteReciprocalPrior_polynomial_integral_eq Lemma finiteReciprocalPrior_polynomial_integral_eq in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
H :
ℝ
π₀ π₁ :
h₀ :
h₁ :
K :
ℕ
hm :
∀ v : ℕ
if
v ≤ K
then
(∫ z, z ^ v ∂π₀) = ∫ z, z ^ v ∂π₁
p :
hp :
p.natDegree ≤ K
(∫ z, p.eval z ∂π₀) = ∫ z, p.eval z ∂π₁
Proof (Lean source)
-- @node: finiteReciprocalPrior_polynomial_integral_eq lemma finiteReciprocalPrior_polynomial_integral_eq {H : ℝ} {π₀ π₁ : Measure ℝ} (h₀ : FiniteReciprocalPrior H π₀) (h₁ : FiniteReciprocalPrior H π₁) (K : ℕ) (hm : ∀ v : ℕ, v ≤ K → (∫ z, z ^ v ∂π₀) = ∫ z, z ^ v ∂π₁) (p : Polynomial ℝ) (hp : p.natDegree ≤ K) : (∫ z, p.eval z ∂π₀) = ∫ z, p.eval z ∂π₁ := by simp_rw [eval_eq_sum_range] rw [integral_finsetSum _ (fun i _ => finiteReciprocalPrior_integrable h₀ _), integral_finsetSum _ (fun i _ => finiteReciprocalPrior_integrable h₁ _)] apply Finset.sum_congr rfl intro i hi rw [integral_const_mul, integral_const_mul, hm i] exact (le_of_lt_succ (Finset.mem_range.mp hi)).trans hp
CausalSmith.Stat.MarRareqLogfrontier.finiteReciprocalPrior_polynomial_integral_eq · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationPolynomial.lean:85
theorem activationRareCellPolynomial_integral_eq

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
ι :
Type*
s :
H :
ℝ
π₀ π₁ :
h₀ :
h₁ :
K :
ℕ
hm :
∀ v : ℕ
if
v ≤ K
then
(∫ z, z ^ v ∂π₀) = ∫ z, z ^ v ∂π₁
a flag arrival one :
ι → Bool
hcount :
(∑ i ∈ s, if flag i then 1 else 0) ≤ K
(∫ z, (activationRareCellPolynomial s H a flag arrival one).eval z ∂π₀)
= ∫ z, (activationRareCellPolynomial s H a flag arrival one).eval z ∂π₁
Proof (Lean source)
-- @node: activationRareCellPolynomial_integral_eq lemma activationRareCellPolynomial_integral_eq {ι : Type*} (s : Finset ι) {H : ℝ} {π₀ π₁ : Measure ℝ} (h₀ : FiniteReciprocalPrior H π₀) (h₁ : FiniteReciprocalPrior H π₁) (K : ℕ) (hm : ∀ v : ℕ, v ≤ K → (∫ z, z ^ v ∂π₀) = ∫ z, z ^ v ∂π₁) (a flag arrival one : ι → Bool) (hcount : (∑ i ∈ s, if flag i then 1 else 0) ≤ K) : (∫ z, (activationRareCellPolynomial s H a flag arrival one).eval z ∂π₀) = ∫ z, (activationRareCellPolynomial s H a flag arrival one).eval z ∂π₁ := by exact finiteReciprocalPrior_polynomial_integral_eq h₀ h₁ K hm _ ((activationRareCellPolynomial_natDegree s H a flag arrival one).trans hcount)
CausalSmith.Stat.MarRareqLogfrontier.activationRareCellPolynomial_integral_eq · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationPolynomial.lean:100
theorem activationRareCellPolynomial_grid_integral_eq

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
ι :
Type*
s :
H :
ℝ
π₀ π₁ :
h₀ :
h₁ :
K :
ℕ
hm :
∀ v : ℕ
if
v ≤ K
then
(∫ z, z ^ v ∂π₀) = ∫ z, z ^ v ∂π₁
M :
ℕ
hM :
1 ≤ M
j j' :
Fin (M + 1)
a flag arrival one :
ι → Bool
hcount :
(∑ i ∈ s, if flag i then 1 else 0) ≤ K
(∫ z, (activationRareCellPolynomial s H a flag arrival one).eval z ∂intervalInterpolatedPrior π₀ π₁ ((j : ℝ) / M))
= ∫ z, (activationRareCellPolynomial s H a flag arrival one).eval z ∂intervalInterpolatedPrior π₀ π₁ ((j' : ℝ) / M)
Proof (Lean source)
-- @node: activationRareCellPolynomial_grid_integral_eq lemma activationRareCellPolynomial_grid_integral_eq {ι : Type*} (s : Finset ι) {H : ℝ} {π₀ π₁ : Measure ℝ} (h₀ : FiniteReciprocalPrior H π₀) (h₁ : FiniteReciprocalPrior H π₁) (K : ℕ) (hm : ∀ v : ℕ, v ≤ K → (∫ z, z ^ v ∂π₀) = ∫ z, z ^ v ∂π₁) (M : ℕ) (hM : 1 ≤ M) (j j' : Fin (M + 1)) (a flag arrival one : ι → Bool) (hcount : (∑ i ∈ s, if flag i then 1 else 0) ≤ K) : (∫ z, (activationRareCellPolynomial s H a flag arrival one).eval z ∂intervalInterpolatedPrior π₀ π₁ ((j : ℝ) / M)) = ∫ z, (activationRareCellPolynomial s H a flag arrival one).eval z ∂intervalInterpolatedPrior π₀ π₁ ((j' : ℝ) / M) := by have hgrid := intervalInterpolatedPrior_grid h₀ h₁ K hm M hM exact activationRareCellPolynomial_integral_eq s (hgrid j).1 (hgrid j').1 K ((hgrid j).2.1 j') a flag arrival one hcount
CausalSmith.Stat.MarRareqLogfrontier.activationRareCellPolynomial_grid_integral_eq · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationPolynomial.lean:113
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.Lower.ActivationPriorTarget 10 declarations Extend independent rare-cell priors to the full alphabet and identify the actual activated ATE with the reciprocal target in equations (7)--(12).

Extend independent rare-cell priors to the full alphabet and identify the actual activated ATE with the reciprocal target in equations (7)--(12).

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n :
ℕ
q :
ℝ
hq :
0 ≤ q
1 ≤ lowerEndpoint n q
Proof (Lean source)
-- @node: lowerEndpoint_one_le lemma lowerEndpoint_one_le (n : ℕ) (q : ℝ) (hq : 0 ≤ q) : 1 ≤ lowerEndpoint n q := by have hN : 0 ≤ effectiveSize n q := by unfold effectiveSize; positivity have hlog : 1 ≤ logScale n q := by unfold logScale have h := Real.log_le_log (Real.exp_pos (1 : ℝ)) (show exp 1 ≤ exp 1 + effectiveSize n q by linarith) simpa using h have hceil : (1 : ℝ) ≤ lowerDegree n q := hlog.trans (Nat.le_ceil (logScale n q)) unfold lowerEndpoint nlinarith

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
η :
ℝ
n d :
ℕ
q :
ℝ
z :
Fin (rareCount η n d q) → ℝ
x :
Fin d
activationExtendRare η n d q z x :
ℝ
if h : x.val < rareCount η n d q then z ⟨x.val, h⟩ else lowerEndpoint n q
theorem activationExtendRare_eval

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
η :
ℝ
n d :
ℕ
q :
ℝ
z :
Fin (rareCount η n d q) → ℝ
x :
Fin (rareCount η n d q)
activationExtendRare η n d q z (x.castLE ((min_le_left _ _).trans (sub_le d 1))) = z x
Proof (Lean source)
-- @node: activationExtendRare_eval lemma activationExtendRare_eval (η : ℝ) (n d : ℕ) (q : ℝ) (z : Fin (rareCount η n d q) → ℝ) (x : Fin (rareCount η n d q)) : activationExtendRare η n d q z (x.castLE ((min_le_left _ _).trans (sub_le d 1))) = z x := by change (if h : x.val < rareCount η n d q then z ⟨x.val, h⟩ else lowerEndpoint n q) = z x rw [dif_pos x.isLt]
CausalSmith.Stat.MarRareqLogfrontier.activationExtendRare_eval · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationPriorTarget.lean:35
theorem activationExtendRare_support

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
η :
ℝ
n d :
ℕ
q :
ℝ
hq :
0 ≤ q
z :
Fin (rareCount η n d q) → ℝ
hz :
∀ x, z x ∈ Icc (1 : ℝ) (lowerEndpoint n q)
x :
activationExtendRare η n d q z x ∈ Icc (1 : ℝ) (lowerEndpoint n q)
Proof (Lean source)
-- @node: activationExtendRare_support lemma activationExtendRare_support (η : ℝ) (n d : ℕ) (q : ℝ) (hq : 0 ≤ q) (z : Fin (rareCount η n d q) → ℝ) (hz : ∀ x, z x ∈ Icc (1 : ℝ) (lowerEndpoint n q)) : ∀ x, activationExtendRare η n d q z x ∈ Icc (1 : ℝ) (lowerEndpoint n q) := by intro x unfold activationExtendRare split_ifs with h · exact hz ⟨x.val, h⟩ · exact ⟨lowerEndpoint_one_le n q hq, le_rfl⟩
CausalSmith.Stat.MarRareqLogfrontier.activationExtendRare_support · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationPriorTarget.lean:45
theorem finiteReciprocalPrior_pi_ae_support Lemma finiteReciprocalPrior_pi_ae_support in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
H :
ℝ
π :
J :
ℕ
∀ᵐ z ∂Measure.pi (fun _ : Fin J => π), ∀ x, z x ∈ Icc (1 : ℝ) H
Proof (Lean source)
-- @node: finiteReciprocalPrior_pi_ae_support lemma finiteReciprocalPrior_pi_ae_support {H : ℝ} {π : Measure ℝ} (hπ : FiniteReciprocalPrior H π) (J : ℕ) : ∀ᵐ z ∂Measure.pi (fun _ : Fin J => π), ∀ x, z x ∈ Icc (1 : ℝ) H := by let := hπ.1 obtain ⟨s, hs, hsupport⟩ := hπ.2 have hae : ∀ᵐ z ∂π, z ∈ (s : Set ℝ) := (ae_mem_iff_measure_eq s.measurableSet.nullMeasurableSet).2 (by simpa using hs) have hinterval : ∀ᵐ z ∂π, z ∈ Icc (1 : ℝ) H := by filter_upwards [hae] with z hz exact hsupport z hz rw [ae_all_iff] intro x exact Measure.tendsto_eval_ae_ae.eventually hinterval
CausalSmith.Stat.MarRareqLogfrontier.finiteReciprocalPrior_pi_ae_support · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationPriorTarget.lean:57
def activatedRarePriorATE

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
η :
ℝ
n d :
ℕ
q :
ℝ
hd :
1 ≤ d
hb :
0 < rareMass η n q
hq :
0 < q
hslice :
z :
Fin (rareCount η n d q) → ℝ
activatedRarePriorATE η n d q hd hb hq hslice z :
ℝ
if hz : ∀ x, z x ∈ Icc (1 : ℝ) (lowerEndpoint n q) then ate (activatedFullLaw η n d q (activationExtendRare η n d q z) hd hb hq hslice (activationExtendRare_support η n d q hq.le z hz)) else 0
theorem activatedRarePriorATE_ae_eq

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
η :
ℝ
n d :
ℕ
q :
ℝ
hd :
1 ≤ d
hb :
0 < rareMass η n q
hq :
0 < q
hslice :
π :
activatedRarePriorATE η n d q hd hb hq hslice
=ᵐ[ Measure.pi (fun _ : Fin (rareCount η n d q) => π)] intervalPriorTarget (rareCount η n d q) (rareMass η n q)
Proof (Lean source)
-- @node: activatedRarePriorATE_ae_eq lemma activatedRarePriorATE_ae_eq (η : ℝ) (n d : ℕ) (q : ℝ) (hd : 1 ≤ d) (hb : 0 < rareMass η n q) (hq : 0 < q) (hslice : RareArrivalSlice n q) {π : Measure ℝ} (hπ : FiniteReciprocalPrior (lowerEndpoint n q) π) : activatedRarePriorATE η n d q hd hb hq hslice =ᵐ[ Measure.pi (fun _ : Fin (rareCount η n d q) => π)] intervalPriorTarget (rareCount η n d q) (rareMass η n q) := by filter_upwards [finiteReciprocalPrior_pi_ae_support hπ (rareCount η n d q)] with z hz rw [activatedRarePriorATE, dif_pos hz, activatedFullLaw_ate] congr 1 funext x exact activationExtendRare_eval η n d q z x
CausalSmith.Stat.MarRareqLogfrontier.activatedRarePriorATE_ae_eq · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationPriorTarget.lean:83
theorem activatedRarePriorATE_integral

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
η :
ℝ
n d :
ℕ
q :
ℝ
hd :
1 ≤ d
hb :
0 < rareMass η n q
hq :
0 < q
hslice :
π :
(∫ z, activatedRarePriorATE η n d q hd hb hq hslice z ∂Measure.pi (fun _ : Fin (rareCount η n d q) => π))
= (rareCount η n d q : ℝ) * rareMass η n q * ∫ z, z⁻¹ ∂π
Proof (Lean source)
-- @node: activatedRarePriorATE_integral lemma activatedRarePriorATE_integral (η : ℝ) (n d : ℕ) (q : ℝ) (hd : 1 ≤ d) (hb : 0 < rareMass η n q) (hq : 0 < q) (hslice : RareArrivalSlice n q) {π : Measure ℝ} (hπ : FiniteReciprocalPrior (lowerEndpoint n q) π) : (∫ z, activatedRarePriorATE η n d q hd hb hq hslice z ∂Measure.pi (fun _ : Fin (rareCount η n d q) => π)) = (rareCount η n d q : ℝ) * rareMass η n q * ∫ z, z⁻¹ ∂π := by rw [integral_congr_ae (activatedRarePriorATE_ae_eq η n d q hd hb hq hslice hπ)] exact intervalPriorTarget_integral hπ _ _
CausalSmith.Stat.MarRareqLogfrontier.activatedRarePriorATE_integral · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationPriorTarget.lean:98
theorem activatedRarePriorATE_variance_le

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
η :
ℝ
n d :
ℕ
q :
ℝ
hd :
1 ≤ d
hb :
0 < rareMass η n q
hq :
0 < q
hslice :
π :
variance (activatedRarePriorATE η n d q hd hb hq hslice) (Measure.pi (fun _ : Fin (rareCount η n d q) => π))
≤ (rareCount η n d q : ℝ) * (rareMass η n q) ^ 2 / 4
Proof (Lean source)
-- @node: activatedRarePriorATE_variance_le lemma activatedRarePriorATE_variance_le (η : ℝ) (n d : ℕ) (q : ℝ) (hd : 1 ≤ d) (hb : 0 < rareMass η n q) (hq : 0 < q) (hslice : RareArrivalSlice n q) {π : Measure ℝ} (hπ : FiniteReciprocalPrior (lowerEndpoint n q) π) : variance (activatedRarePriorATE η n d q hd hb hq hslice) (Measure.pi (fun _ : Fin (rareCount η n d q) => π)) ≤ (rareCount η n d q : ℝ) * (rareMass η n q) ^ 2 / 4 := by rw [variance_congr (activatedRarePriorATE_ae_eq η n d q hd hb hq hslice hπ)] exact intervalPriorTarget_variance_le hπ _ _
CausalSmith.Stat.MarRareqLogfrontier.activatedRarePriorATE_variance_le · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationPriorTarget.lean:110
theorem activatedRarePriorATE_grid_concentration

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
η :
ℝ
n d M :
ℕ
q u :
ℝ
hd :
1 ≤ d
hb :
0 < rareMass η n q
hq :
0 < q
hslice :
π₀ π₁ :
hu :
0 < u
hM :
1 ≤ M
hgap :
1 / 12 ≤ |(∫ z, z⁻¹ ∂π₁) - ∫ z, z⁻¹ ∂π₀|
hJ :
18432 * (M : ℝ) ^ 2 / u ≤ (rareCount η n d q : ℝ)
j :
Fin (M + 1)
(Measure.pi (fun _ : Fin (rareCount η n d q) => intervalInterpolatedPrior π₀ π₁ ((j : ℝ) / M))).real {z | ((rareCount η n d q : ℝ) * rareMass η n q * |(∫ z, z⁻¹ ∂π₁) - ∫ z, z⁻¹ ∂π₀|) / (8 * M) < |activatedRarePriorATE η n d q hd hb hq hslice z - ((rareCount η n d q : ℝ) * rareMass η n q * (∫ z, z⁻¹ ∂π₀) + (j : ℝ) * ((rareCount η n d q : ℝ) * rareMass η n q * ((∫ z, z⁻¹ ∂π₁) - ∫ z, z⁻¹ ∂π₀) / M))|}
≤ u / 8
Proof (Lean source)
-- @node: activatedRarePriorATE_grid_concentration lemma activatedRarePriorATE_grid_concentration (η : ℝ) (n d M : ℕ) (q u : ℝ) (hd : 1 ≤ d) (hb : 0 < rareMass η n q) (hq : 0 < q) (hslice : RareArrivalSlice n q) {π₀ π₁ : Measure ℝ} (h₀ : FiniteReciprocalPrior (lowerEndpoint n q) π₀) (h₁ : FiniteReciprocalPrior (lowerEndpoint n q) π₁) (hu : 0 < u) (hM : 1 ≤ M) (hgap : 1 / 12 ≤ |(∫ z, z⁻¹ ∂π₁) - ∫ z, z⁻¹ ∂π₀|) (hJ : 18432 * (M : ℝ) ^ 2 / u ≤ (rareCount η n d q : ℝ)) : ∀ j : Fin (M + 1), (Measure.pi (fun _ : Fin (rareCount η n d q) => intervalInterpolatedPrior π₀ π₁ ((j : ℝ) / M))).real {z | ((rareCount η n d q : ℝ) * rareMass η n q * |(∫ z, z⁻¹ ∂π₁) - ∫ z, z⁻¹ ∂π₀|) / (8 * M) < |activatedRarePriorATE η n d q hd hb hq hslice z - ((rareCount η n d q : ℝ) * rareMass η n q * (∫ z, z⁻¹ ∂π₀) + (j : ℝ) * ((rareCount η n d q : ℝ) * rareMass η n q * ((∫ z, z⁻¹ ∂π₁) - ∫ z, z⁻¹ ∂π₀) / M))|} ≤ u / 8 := by intro j have hMr : 0 < (M : ℝ) := by exact_mod_cast (by omega : 0 < M) have ht : (j : ℝ) / M ∈ Icc (0 : ℝ) 1 := by refine ⟨by positivity, (div_le_one hMr).mpr ?_⟩ exact_mod_cast (by omega : j.val ≤ M) have hae := activatedRarePriorATE_ae_eq η n d q hd hb hq hslice (finiteReciprocalPrior_interpolate h₀ h₁ ht) have hevent : {z | ((rareCount η n d q : ℝ) * rareMass η n q * |(∫ z, z⁻¹ ∂π₁) - ∫ z, z⁻¹ ∂π₀|) / (8 * M) < |activatedRarePriorATE η n d q hd hb hq hslice z - ((rareCount η n d q : ℝ) * rareMass η n q * (∫ z, z⁻¹ ∂π₀) + (j : ℝ) * ((rareCount η n d q : ℝ) * rareMass η n q * ((∫ z, z⁻¹ ∂π₁) - ∫ z, z⁻¹ ∂π₀) / M))|} =ᵐ[ Measure.pi (fun _ : Fin (rareCount η n d q) => intervalInterpolatedPrior π₀ π₁ ((j : ℝ) / M))] {z | ((rareCount η n d q : ℝ) * rareMass η n q * |(∫ z, z⁻¹ ∂π₁) - ∫ z, z⁻¹ ∂π₀|) / (8 * M) < |intervalPriorTarget (rareCount η n d q) (rareMass η n q) z - ((rareCount η n d q : ℝ) * rareMass η n q * (∫ z, z⁻¹ ∂π₀) + (j : ℝ) * ((rareCount η n d q : ℝ) * rareMass η n q * ((∫ z, z⁻¹ ∂π₁) - ∫ z, z⁻¹ ∂π₀) / M))|} := by filter_upwards [hae] with z hz change (_ < |activatedRarePriorATE η n d q hd hb hq hslice z - _|) = (_ < |intervalPriorTarget (rareCount η n d q) (rareMass η n q) z - _|) rw [hz] unfold Measure.real rw [measure_congr hevent] exact intervalInterpolatedPrior_grid_concentration h₀ h₁ (rareCount η n d q) M (rareMass η n q) u hb hu hM hgap hJ j
CausalSmith.Stat.MarRareqLogfrontier.activatedRarePriorATE_grid_concentration · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationPriorTarget.lean:122
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.Lower.ActivationProbability 7 declarations Probability certificates and fixed-sample projection for the activated experiment used in equation (6) of the connected-interval lower bound.

Probability certificates and fixed-sample projection for the activated experiment used in equation (6) of the connected-interval lower bound.

theorem augmentedOutcomeWeight_sum Lemma augmentedOutcomeWeight_sum in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
η :
ℝ
n d :
ℕ
q :
ℝ
z :
Fin d → ℝ
x :
Fin d
a flag :
hz :
1 ≤ z x ∧ z x ≤ lowerEndpoint n q
(∑ arrival : Bool, ∑ one : Bool, augmentedOutcomeWeight η n d q z x a flag arrival one)
= 1
Proof (Lean source)
-- @node: augmentedOutcomeWeight_sum lemma augmentedOutcomeWeight_sum (η : ℝ) (n d : ℕ) (q : ℝ) (z : Fin d → ℝ) (x : Fin d) (a flag : Bool) (hz : 1 ≤ z x ∧ z x ≤ lowerEndpoint n q) : (∑ arrival : Bool, ∑ one : Bool, augmentedOutcomeWeight η n d q z x a flag arrival one) = 1 := by have hH : lowerEndpoint n q ≠ 0 := by linarith [hz.1, hz.2] simp only [Fintype.sum_bool] by_cases hr : x.val < rareCount η n d q · cases a <;> cases flag <;> simp [augmentedOutcomeWeight, lowerCellZ, hr] all_goals field_simp; ring · cases a <;> cases flag <;> simp [augmentedOutcomeWeight, lowerCellZ, hr, hH]
CausalSmith.Stat.MarRareqLogfrontier.augmentedOutcomeWeight_sum · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationProbability.lean:16
theorem augmentedOneRecord_univ

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
η :
ℝ
n d :
ℕ
q :
ℝ
z :
Fin d → ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hb :
0 < rareMass η n q
hq :
0 < q
hslice :
hz :
∀ x, z x ∈ Icc (1 : ℝ) (lowerEndpoint n q)
augmentedOneRecord η n d q z hz univ = 1
Proof (Lean source)
-- @node: augmentedOneRecord_univ lemma augmentedOneRecord_univ (η : ℝ) (n d : ℕ) (q : ℝ) (z : Fin d → ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hb : 0 < rareMass η n q) (hq : 0 < q) (hslice : RareArrivalSlice n q) (hz : ∀ x, z x ∈ Icc (1 : ℝ) (lowerEndpoint n q)) : augmentedOneRecord η n d q z hz univ = 1 := by have hobs : Measurable (obs : FullRecord d → ObsRecord d) := by fun_prop have hp := activated_projection η n d q z hn hd hq hslice hz have hm := congrArg (fun μ : Measure (ObsRecord d) => μ univ) hp simpa only [Measure.map_apply measurable_snd MeasurableSet.univ, Measure.map_apply hobs MeasurableSet.univ, Set.preimage_univ, activatedLaw_univ η n d q z hd hb hq hslice hz] using hm
CausalSmith.Stat.MarRareqLogfrontier.augmentedOneRecord_univ · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationProbability.lean:32
theorem augmentedOneRecord_isProbabilityMeasure

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
η :
ℝ
n d :
ℕ
q :
ℝ
z :
Fin d → ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hb :
0 < rareMass η n q
hq :
0 < q
hslice :
hz :
∀ x, z x ∈ Icc (1 : ℝ) (lowerEndpoint n q)
Proof (Lean source)
-- @node: augmentedOneRecord_isProbabilityMeasure lemma augmentedOneRecord_isProbabilityMeasure (η : ℝ) (n d : ℕ) (q : ℝ) (z : Fin d → ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hb : 0 < rareMass η n q) (hq : 0 < q) (hslice : RareArrivalSlice n q) (hz : ∀ x, z x ∈ Icc (1 : ℝ) (lowerEndpoint n q)) : IsProbabilityMeasure (augmentedOneRecord η n d q z hz) := ⟨augmentedOneRecord_univ η n d q z hn hd hb hq hslice hz⟩
CausalSmith.Stat.MarRareqLogfrontier.augmentedOneRecord_isProbabilityMeasure · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationProbability.lean:47
theorem activated_sample_projection

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
η :
ℝ
n d :
ℕ
q :
ℝ
z :
Fin d → ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hb :
0 < rareMass η n q
hq :
0 < q
hslice :
hz :
∀ x, z x ∈ Icc (1 : ℝ) (lowerEndpoint n q)
(Measure.pi (fun _ : Fin n => augmentedOneRecord η n d q z hz)).map (fun s i => (s i).2)
= sampleLaw n (activatedFullLaw η n d q z hd hb hq hslice hz)
Proof (Lean source)
-- @node: activated_sample_projection lemma activated_sample_projection (η : ℝ) (n d : ℕ) (q : ℝ) (z : Fin d → ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hb : 0 < rareMass η n q) (hq : 0 < q) (hslice : RareArrivalSlice n q) (hz : ∀ x, z x ∈ Icc (1 : ℝ) (lowerEndpoint n q)) : (Measure.pi (fun _ : Fin n => augmentedOneRecord η n d q z hz)).map (fun s i => (s i).2) = sampleLaw n (activatedFullLaw η n d q z hd hb hq hslice hz) := by let := augmentedOneRecord_isProbabilityMeasure η n d q z hn hd hb hq hslice hz rw [Measure.pi_map_pi (fun _ => measurable_snd.aemeasurable)] simp_rw [activated_projection η n d q z hn hd hq hslice hz] rfl
CausalSmith.Stat.MarRareqLogfrontier.activated_sample_projection · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationProbability.lean:57
theorem augmentedOneRecord_marginal_weight Lemma augmentedOneRecord_marginal_weight in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
η :
ℝ
n d :
ℕ
q :
ℝ
z :
Fin d → ℝ
x :
Fin d
a flag :
hz :
1 ≤ z x ∧ z x ≤ lowerEndpoint n q
(∑ arrival : Bool, ∑ one : Bool, ofReal (baselineMass η n d q x / 2 * bernWeight (q * lowerEndpoint n q) flag * augmentedOutcomeWeight η n d q z x a flag arrival one))
= ofReal (baselineMass η n d q x / 2 * bernWeight (q * lowerEndpoint n q) flag)
Proof (Lean source)
-- @node: augmentedOneRecord_marginal_weight lemma augmentedOneRecord_marginal_weight (η : ℝ) (n d : ℕ) (q : ℝ) (z : Fin d → ℝ) (x : Fin d) (a flag : Bool) (hz : 1 ≤ z x ∧ z x ≤ lowerEndpoint n q) : (∑ arrival : Bool, ∑ one : Bool, ofReal (baselineMass η n d q x / 2 * bernWeight (q * lowerEndpoint n q) flag * augmentedOutcomeWeight η n d q z x a flag arrival one)) = ofReal (baselineMass η n d q x / 2 * bernWeight (q * lowerEndpoint n q) flag) := by let b := baselineMass η n d q x / 2 * bernWeight (q * lowerEndpoint n q) flag change (∑ arrival : Bool, ∑ one : Bool, ofReal (b * augmentedOutcomeWeight η n d q z x a flag arrival one)) = _ simp_rw [ofReal_signed_mul_bool_sum b _ (fun one => augmentedOutcomeWeight_nonneg η n d q z x a flag _ one hz)] rw [ofReal_signed_mul_bool_sum b _ (fun arrival => Finset.sum_nonneg (fun one _ => augmentedOutcomeWeight_nonneg η n d q z x a flag arrival one hz))] rw [augmentedOutcomeWeight_sum η n d q z x a flag hz, mul_one]
CausalSmith.Stat.MarRareqLogfrontier.augmentedOneRecord_marginal_weight · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationProbability.lean:72
theorem augmentedOneRecord_membership_activation_map Lemma augmentedOneRecord_membership_activation_map in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
η :
ℝ
n d :
ℕ
q :
ℝ
z :
Fin d → ℝ
hz :
∀ x, z x ∈ Icc (1 : ℝ) (lowerEndpoint n q)
(augmentedOneRecord η n d q z hz).map (fun r => (r.2.X, r.2.A, r.1))
= ∑ x : Fin d, ∑ a : Bool, ∑ flag : Bool, ofReal (baselineMass η n d q x / 2 * bernWeight (q * lowerEndpoint n q) flag) • Measure.dirac (x, a, flag)
Proof (Lean source)
-- @node: augmentedOneRecord_membership_activation_map lemma augmentedOneRecord_membership_activation_map (η : ℝ) (n d : ℕ) (q : ℝ) (z : Fin d → ℝ) (hz : ∀ x, z x ∈ Icc (1 : ℝ) (lowerEndpoint n q)) : (augmentedOneRecord η n d q z hz).map (fun r => (r.2.X, r.2.A, r.1)) = ∑ x : Fin d, ∑ a : Bool, ∑ flag : Bool, ofReal (baselineMass η n d q x / 2 * bernWeight (q * lowerEndpoint n q) flag) • Measure.dirac (x, a, flag) := by classical have hf : Measurable (fun r : Bool × ObsRecord d => (r.2.X, r.2.A, r.1)) := by fun_prop unfold augmentedOneRecord simp_rw [Measure.map_finset_sum' hf.aemeasurable, Measure.map_smul, Measure.map_dirac] apply Finset.sum_congr rfl intro x _ apply Finset.sum_congr rfl intro a _ apply Finset.sum_congr rfl intro flag _ simp_rw [← Finset.sum_smul] rw [augmentedOneRecord_marginal_weight η n d q z x a flag (hz x)]
CausalSmith.Stat.MarRareqLogfrontier.augmentedOneRecord_membership_activation_map · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationProbability.lean:93
theorem activated_sample_membership_activation_map

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
η :
ℝ
n d :
ℕ
q :
ℝ
z :
Fin d → ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hb :
0 < rareMass η n q
hq :
0 < q
hslice :
hz :
∀ x, z x ∈ Icc (1 : ℝ) (lowerEndpoint n q)
(Measure.pi (fun _ : Fin n => augmentedOneRecord η n d q z hz)).map (fun s i => ((s i).2.X, (s i).2.A, (s i).1))
= Measure.pi (fun _ : Fin n => ∑ x : Fin d, ∑ a : Bool, ∑ flag : Bool, ofReal (baselineMass η n d q x / 2 * bernWeight (q * lowerEndpoint n q) flag) • Measure.dirac (x, a, flag))
Proof (Lean source)
-- @node: activated_sample_membership_activation_map lemma activated_sample_membership_activation_map (η : ℝ) (n d : ℕ) (q : ℝ) (z : Fin d → ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hb : 0 < rareMass η n q) (hq : 0 < q) (hslice : RareArrivalSlice n q) (hz : ∀ x, z x ∈ Icc (1 : ℝ) (lowerEndpoint n q)) : (Measure.pi (fun _ : Fin n => augmentedOneRecord η n d q z hz)).map (fun s i => ((s i).2.X, (s i).2.A, (s i).1)) = Measure.pi (fun _ : Fin n => ∑ x : Fin d, ∑ a : Bool, ∑ flag : Bool, ofReal (baselineMass η n d q x / 2 * bernWeight (q * lowerEndpoint n q) flag) • Measure.dirac (x, a, flag)) := by let := augmentedOneRecord_isProbabilityMeasure η n d q z hn hd hb hq hslice hz have hf : Measurable (fun r : Bool × ObsRecord d => (r.2.X, r.2.A, r.1)) := by fun_prop rw [Measure.pi_map_pi (fun _ => hf.aemeasurable)] simp_rw [augmentedOneRecord_membership_activation_map η n d q z hz]
CausalSmith.Stat.MarRareqLogfrontier.activated_sample_membership_activation_map · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationProbability.lean:118
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.Lower.ActivationProduct 6 declarations Joint rare-cell likelihood cancellation under independent moment-matched priors, the exact-cancellation step preceding the tail bound in equation (6).

Joint rare-cell likelihood cancellation under independent moment-matched priors, the exact-cancellation step preceding the tail bound in equation (6).

theorem finiteReciprocalPrior_product_polynomial_integral_eq Lemma finiteReciprocalPrior_product_polynomial_integral_eq in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
J :
ℕ
H :
ℝ
π₀ π₁ :
h₀ :
h₁ :
K :
ℕ
hm :
∀ v : ℕ
if
v ≤ K
then
(∫ z, z ^ v ∂π₀) = ∫ z, z ^ v ∂π₁
p :
Fin J → Polynomial ℝ
hp :
∀ x, (p x).natDegree ≤ K
(∫ z, ∏ x, (p x).eval (z x) ∂Measure.pi (fun _ : Fin J => π₀))
= ∫ z, ∏ x, (p x).eval (z x) ∂Measure.pi (fun _ : Fin J => π₁)
Proof (Lean source)
-- @node: finiteReciprocalPrior_product_polynomial_integral_eq lemma finiteReciprocalPrior_product_polynomial_integral_eq {J : ℕ} {H : ℝ} {π₀ π₁ : Measure ℝ} (h₀ : FiniteReciprocalPrior H π₀) (h₁ : FiniteReciprocalPrior H π₁) (K : ℕ) (hm : ∀ v : ℕ, v ≤ K → (∫ z, z ^ v ∂π₀) = ∫ z, z ^ v ∂π₁) (p : Fin J → Polynomial ℝ) (hp : ∀ x, (p x).natDegree ≤ K) : (∫ z, ∏ x, (p x).eval (z x) ∂Measure.pi (fun _ : Fin J => π₀)) = ∫ z, ∏ x, (p x).eval (z x) ∂Measure.pi (fun _ : Fin J => π₁) := by let := h₀.1 let := h₁.1 rw [integral_fintype_prod_eq_prod (fun x t => (p x).eval t), integral_fintype_prod_eq_prod (fun x t => (p x).eval t)] exact Finset.prod_congr rfl (fun x _ => finiteReciprocalPrior_polynomial_integral_eq h₀ h₁ K hm (p x) (hp x))
CausalSmith.Stat.MarRareqLogfrontier.finiteReciprocalPrior_product_polynomial_integral_eq · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationProduct.lean:16
theorem activationRareRecords_factorization

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
ι :
Type*
s :
J :
ℕ
cell :
ι → Fin J
H :
ℝ
a flag arrival one :
ι → Bool
z :
Fin J → ℝ
(∏ i ∈ s, (activationRareOutcomePolynomial H (a i) (flag i) (arrival i) (one i)).eval (z (cell i)))
= ∏ x : Fin J, (activationRareCellPolynomial (s.filter (fun i => cell i = x)) H a flag arrival one).eval (z x)
Proof (Lean source)
-- @node: activationRareRecords_factorization lemma activationRareRecords_factorization {ι : Type*} (s : Finset ι) {J : ℕ} (cell : ι → Fin J) (H : ℝ) (a flag arrival one : ι → Bool) (z : Fin J → ℝ) : (∏ i ∈ s, (activationRareOutcomePolynomial H (a i) (flag i) (arrival i) (one i)).eval (z (cell i))) = ∏ x : Fin J, (activationRareCellPolynomial (s.filter (fun i => cell i = x)) H a flag arrival one).eval (z x) := by classical rw [← Finset.prod_fiberwise s cell] apply Finset.prod_congr rfl intro x _ simp only [activationRareCellPolynomial, eval_prod] apply Finset.prod_congr rfl intro i hi rw [(Finset.mem_filter.mp hi).2]
CausalSmith.Stat.MarRareqLogfrontier.activationRareRecords_factorization · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationProduct.lean:32
theorem activationRareRecords_integral_eq

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
ι :
Type*
s :
J :
ℕ
cell :
ι → Fin J
H :
ℝ
π₀ π₁ :
h₀ :
h₁ :
K :
ℕ
hm :
∀ v : ℕ
if
v ≤ K
then
(∫ z, z ^ v ∂π₀) = ∫ z, z ^ v ∂π₁
a flag arrival one :
ι → Bool
hcount :
∀ x, (∑ i ∈ s.filter (fun i => cell i = x), if flag i then 1 else 0) ≤ K
(∫ z, ∏ i ∈ s, (activationRareOutcomePolynomial H (a i) (flag i) (arrival i) (one i)).eval (z (cell i)) ∂Measure.pi (fun _ : Fin J => π₀))
= ∫ z, ∏ i ∈ s, (activationRareOutcomePolynomial H (a i) (flag i) (arrival i) (one i)).eval (z (cell i)) ∂Measure.pi (fun _ : Fin J => π₁)
Proof (Lean source)
-- @node: activationRareRecords_integral_eq lemma activationRareRecords_integral_eq {ι : Type*} (s : Finset ι) {J : ℕ} (cell : ι → Fin J) {H : ℝ} {π₀ π₁ : Measure ℝ} (h₀ : FiniteReciprocalPrior H π₀) (h₁ : FiniteReciprocalPrior H π₁) (K : ℕ) (hm : ∀ v : ℕ, v ≤ K → (∫ z, z ^ v ∂π₀) = ∫ z, z ^ v ∂π₁) (a flag arrival one : ι → Bool) (hcount : ∀ x, (∑ i ∈ s.filter (fun i => cell i = x), if flag i then 1 else 0) ≤ K) : (∫ z, ∏ i ∈ s, (activationRareOutcomePolynomial H (a i) (flag i) (arrival i) (one i)).eval (z (cell i)) ∂Measure.pi (fun _ : Fin J => π₀)) = ∫ z, ∏ i ∈ s, (activationRareOutcomePolynomial H (a i) (flag i) (arrival i) (one i)).eval (z (cell i)) ∂Measure.pi (fun _ : Fin J => π₁) := by classical simp_rw [activationRareRecords_factorization] apply finiteReciprocalPrior_product_polynomial_integral_eq h₀ h₁ K hm intro x exact (activationRareCellPolynomial_natDegree _ H a flag arrival one).trans (hcount x)
CausalSmith.Stat.MarRareqLogfrontier.activationRareRecords_integral_eq · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationProduct.lean:50
theorem activationRareRecords_grid_integral_eq

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
ι :
Type*
s :
J :
ℕ
cell :
ι → Fin J
H :
ℝ
π₀ π₁ :
h₀ :
h₁ :
K :
ℕ
hm :
∀ v : ℕ
if
v ≤ K
then
(∫ z, z ^ v ∂π₀) = ∫ z, z ^ v ∂π₁
M :
ℕ
hM :
1 ≤ M
j j' :
Fin (M + 1)
a flag arrival one :
ι → Bool
hcount :
∀ x, (∑ i ∈ s.filter (fun i => cell i = x), if flag i then 1 else 0) ≤ K
(∫ z, ∏ i ∈ s, (activationRareOutcomePolynomial H (a i) (flag i) (arrival i) (one i)).eval (z (cell i)) ∂Measure.pi (fun _ : Fin J => intervalInterpolatedPrior π₀ π₁ ((j : ℝ) / M)))
= ∫ z, ∏ i ∈ s, (activationRareOutcomePolynomial H (a i) (flag i) (arrival i) (one i)).eval (z (cell i)) ∂Measure.pi (fun _ : Fin J => intervalInterpolatedPrior π₀ π₁ ((j' : ℝ) / M))
Proof (Lean source)
-- @node: activationRareRecords_grid_integral_eq lemma activationRareRecords_grid_integral_eq {ι : Type*} (s : Finset ι) {J : ℕ} (cell : ι → Fin J) {H : ℝ} {π₀ π₁ : Measure ℝ} (h₀ : FiniteReciprocalPrior H π₀) (h₁ : FiniteReciprocalPrior H π₁) (K : ℕ) (hm : ∀ v : ℕ, v ≤ K → (∫ z, z ^ v ∂π₀) = ∫ z, z ^ v ∂π₁) (M : ℕ) (hM : 1 ≤ M) (j j' : Fin (M + 1)) (a flag arrival one : ι → Bool) (hcount : ∀ x, (∑ i ∈ s.filter (fun i => cell i = x), if flag i then 1 else 0) ≤ K) : (∫ z, ∏ i ∈ s, (activationRareOutcomePolynomial H (a i) (flag i) (arrival i) (one i)).eval (z (cell i)) ∂Measure.pi (fun _ : Fin J => intervalInterpolatedPrior π₀ π₁ ((j : ℝ) / M))) = ∫ z, ∏ i ∈ s, (activationRareOutcomePolynomial H (a i) (flag i) (arrival i) (one i)).eval (z (cell i)) ∂Measure.pi (fun _ : Fin J => intervalInterpolatedPrior π₀ π₁ ((j' : ℝ) / M)) := by have hgrid := intervalInterpolatedPrior_grid h₀ h₁ K hm M hM exact activationRareRecords_integral_eq s cell (hgrid j).1 (hgrid j').1 K ((hgrid j).2.1 j') a flag arrival one hcount
CausalSmith.Stat.MarRareqLogfrontier.activationRareRecords_grid_integral_eq · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationProduct.lean:68
theorem activationRareRecords_augmented_eq

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
ι :
Type*
s :
η :
ℝ
n d :
ℕ
q :
ℝ
cell :
ι → Fin (rareCount η n d q)
a flag arrival one :
ι → Bool
z :
Fin (rareCount η n d q) → ℝ
(∏ i ∈ s, (activationRareOutcomePolynomial (lowerEndpoint n q) (a i) (flag i) (arrival i) (one i)).eval (z (cell i)))
= ∏ i ∈ s, augmentedOutcomeWeight η n d q (activationExtendRare η n d q z) ((cell i).castLE ((min_le_left _ _).trans (sub_le d 1))) (a i) (flag i) (arrival i) (one i)
Proof (Lean source)
-- @node: activationRareRecords_augmented_eq lemma activationRareRecords_augmented_eq {ι : Type*} (s : Finset ι) (η : ℝ) (n d : ℕ) (q : ℝ) (cell : ι → Fin (rareCount η n d q)) (a flag arrival one : ι → Bool) (z : Fin (rareCount η n d q) → ℝ) : (∏ i ∈ s, (activationRareOutcomePolynomial (lowerEndpoint n q) (a i) (flag i) (arrival i) (one i)).eval (z (cell i))) = ∏ i ∈ s, augmentedOutcomeWeight η n d q (activationExtendRare η n d q z) ((cell i).castLE ((min_le_left _ _).trans (sub_le d 1))) (a i) (flag i) (arrival i) (one i) := by apply Finset.prod_congr rfl intro i _ have heval := activationRareOutcomePolynomial_eval η n d q (activationExtendRare η n d q z) ((cell i).castLE ((min_le_left _ _).trans (sub_le d 1))) (a i) (flag i) (arrival i) (one i) (cell i).isLt rw [activationExtendRare_eval] at heval exact heval
CausalSmith.Stat.MarRareqLogfrontier.activationRareRecords_augmented_eq · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationProduct.lean:87
theorem activationRareRecords_augmented_grid_integral_eq

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
ι :
Type*
s :
η :
ℝ
n d :
ℕ
q :
ℝ
cell :
ι → Fin (rareCount η n d q)
π₀ π₁ :
K :
ℕ
hm :
∀ v : ℕ
if
v ≤ K
then
(∫ z, z ^ v ∂π₀) = ∫ z, z ^ v ∂π₁
M :
ℕ
hM :
1 ≤ M
j j' :
Fin (M + 1)
a flag arrival one :
ι → Bool
hcount :
∀ x, (∑ i ∈ s.filter (fun i => cell i = x), if flag i then 1 else 0) ≤ K
(∫ z, ∏ i ∈ s, augmentedOutcomeWeight η n d q (activationExtendRare η n d q z) ((cell i).castLE ((min_le_left _ _).trans (sub_le d 1))) (a i) (flag i) (arrival i) (one i) ∂Measure.pi (fun _ : Fin (rareCount η n d q) => intervalInterpolatedPrior π₀ π₁ ((j : ℝ) / M)))
= ∫ z, ∏ i ∈ s, augmentedOutcomeWeight η n d q (activationExtendRare η n d q z) ((cell i).castLE ((min_le_left _ _).trans (sub_le d 1))) (a i) (flag i) (arrival i) (one i) ∂Measure.pi (fun _ : Fin (rareCount η n d q) => intervalInterpolatedPrior π₀ π₁ ((j' : ℝ) / M))
Proof (Lean source)
-- @node: activationRareRecords_augmented_grid_integral_eq lemma activationRareRecords_augmented_grid_integral_eq {ι : Type*} (s : Finset ι) (η : ℝ) (n d : ℕ) (q : ℝ) (cell : ι → Fin (rareCount η n d q)) {π₀ π₁ : Measure ℝ} (h₀ : FiniteReciprocalPrior (lowerEndpoint n q) π₀) (h₁ : FiniteReciprocalPrior (lowerEndpoint n q) π₁) (K : ℕ) (hm : ∀ v : ℕ, v ≤ K → (∫ z, z ^ v ∂π₀) = ∫ z, z ^ v ∂π₁) (M : ℕ) (hM : 1 ≤ M) (j j' : Fin (M + 1)) (a flag arrival one : ι → Bool) (hcount : ∀ x, (∑ i ∈ s.filter (fun i => cell i = x), if flag i then 1 else 0) ≤ K) : (∫ z, ∏ i ∈ s, augmentedOutcomeWeight η n d q (activationExtendRare η n d q z) ((cell i).castLE ((min_le_left _ _).trans (sub_le d 1))) (a i) (flag i) (arrival i) (one i) ∂Measure.pi (fun _ : Fin (rareCount η n d q) => intervalInterpolatedPrior π₀ π₁ ((j : ℝ) / M))) = ∫ z, ∏ i ∈ s, augmentedOutcomeWeight η n d q (activationExtendRare η n d q z) ((cell i).castLE ((min_le_left _ _).trans (sub_le d 1))) (a i) (flag i) (arrival i) (one i) ∂Measure.pi (fun _ : Fin (rareCount η n d q) => intervalInterpolatedPrior π₀ π₁ ((j' : ℝ) / M)) := by simp_rw [← activationRareRecords_augmented_eq] exact activationRareRecords_grid_integral_eq s cell h₀ h₁ K hm M hM j j' a flag arrival one hcount
CausalSmith.Stat.MarRareqLogfrontier.activationRareRecords_augmented_grid_integral_eq · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationProduct.lean:107
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.Lower.ActivationRiskTransfer 7 declarations Prior averaging and centered-risk transfer for randomized estimators in equations (14)--(16) of the activated point-risk lower bound.

Prior averaging and centered-risk transfer for randomized estimators in equations (14)--(16) of the activated point-risk lower bound.

theorem activated_deterministic_centered_risk_le

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
f :
(Fin n → ObsRecord d) → ℝ
P :
θ :
ℝ
(∫ s, (f s - θ) ^ 2 ∂sampleLaw n P) ≤ 2 * deterministicRisk f P + 2 * (ate P - θ) ^ 2
Proof (Lean source)
-- @node: activated_deterministic_centered_risk_le lemma activated_deterministic_centered_risk_le {n d : ℕ} (f : (Fin n → ObsRecord d) → ℝ) (P : FullLaw d) (θ : ℝ) : (∫ s, (f s - θ) ^ 2 ∂sampleLaw n P) ≤ 2 * deterministicRisk f P + 2 * (ate P - θ) ^ 2 := by let := P.2 let := Measure.isProbabilityMeasure_map (show Measurable obs by fun_prop).aemeasurable (μ := P.1) letI : IsProbabilityMeasure (sampleLaw n P) := by unfold sampleLaw; infer_instance have h := activated_centered_risk_le (sampleLaw n P) f (fun _ => ate P) θ Integrable.of_finite Integrable.of_finite Integrable.of_finite simpa [deterministicRisk] using h
CausalSmith.Stat.MarRareqLogfrontier.activated_deterministic_centered_risk_le · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationRiskTransfer.lean:16
theorem activated_full_prior_target_second_moment_le Lemma activated_full_prior_target_second_moment_le in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
η :
ℝ
n d :
ℕ
q :
ℝ
π :
(∫ z, (rareMass η n q * (∑ x : Fin d, if x.val < rareCount η n d q then (z x)⁻¹ else 0) - (rareCount η n d q : ℝ) * rareMass η n q * (∫ z, z⁻¹ ∂π)) ^ 2 ∂Measure.pi (fun _ : Fin d => π))
≤ (rareCount η n d q : ℝ) * (rareMass η n q) ^ 2 / 4
Proof (Lean source)
-- @node: activated_full_prior_target_second_moment_le lemma activated_full_prior_target_second_moment_le (η : ℝ) (n d : ℕ) (q : ℝ) {π : Measure ℝ} (hπ : FiniteReciprocalPrior (lowerEndpoint n q) π) : (∫ z, (rareMass η n q * (∑ x : Fin d, if x.val < rareCount η n d q then (z x)⁻¹ else 0) - (rareCount η n d q : ℝ) * rareMass η n q * (∫ z, z⁻¹ ∂π)) ^ 2 ∂Measure.pi (fun _ : Fin d => π)) ≤ (rareCount η n d q : ℝ) * (rareMass η n q) ^ 2 / 4 := by let := hπ.1 let J := rareCount η n d q have hJ : J ≤ d := (min_le_left _ _).trans (sub_le d 1) let restrict : (Fin d → ℝ) → (Fin J → ℝ) := fun z x => z (x.castLE hJ) have hr : Measurable restrict := by fun_prop have hmap := intervalPrior_initial_coordinates_map d J hJ (π := π) have hm : Measurable (intervalPriorTarget J (rareMass η n q)) := by unfold intervalPriorTarget apply Measurable.const_mul apply Finset.measurable_sum intro i hi fun_prop have hv := intervalPriorTarget_variance_le hπ J (rareMass η n q) rw [variance_eq_integral hm.aemeasurable, intervalPriorTarget_integral hπ] at hv rw [← hmap, integral_map hr.aemeasurable ((hm.sub_const _).pow_const 2).aestronglyMeasurable] at hv simpa only [intervalPriorTarget, activation_sum_initial_cells d J hJ, restrict, J] using hv
CausalSmith.Stat.MarRareqLogfrontier.activated_full_prior_target_second_moment_le · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationRiskTransfer.lean:30
theorem activated_prior_squaredRisk_le_worst

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
η :
ℝ
n d :
ℕ
q :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hb :
0 < rareMass η n q
hq :
0 < q
hslice :
π :
T :
(∫ z, (if hz : ∀ x, z x ∈ Icc (1 : ℝ) (lowerEndpoint n q) then squaredRisk T (activatedFullLaw η n d q z hd hb hq hslice hz) else 0) ∂Measure.pi (fun _ : Fin d => π))
≤ worstCaseRiskReal (fun (_ : Unit) (P : {P : FullLaw d // RareArrivalModelClass n d q P}) => squaredRisk T P.1) ()
Proof (Lean source)
-- @node: activated_prior_squaredRisk_le_worst lemma activated_prior_squaredRisk_le_worst (η : ℝ) (n d : ℕ) (q : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hb : 0 < rareMass η n q) (hq : 0 < q) (hslice : RareArrivalSlice n q) {π : Measure ℝ} (hπ : FiniteReciprocalPrior (lowerEndpoint n q) π) (T : Estimator n d) : (∫ z, (if hz : ∀ x, z x ∈ Icc (1 : ℝ) (lowerEndpoint n q) then squaredRisk T (activatedFullLaw η n d q z hd hb hq hslice hz) else 0) ∂Measure.pi (fun _ : Fin d => π)) ≤ worstCaseRiskReal (fun (_ : Unit) (P : {P : FullLaw d // RareArrivalModelClass n d q P}) => squaredRisk T P.1) () := by let := hπ.1 have hbdd : BddAbove (range (fun P : {P : FullLaw d // RareArrivalModelClass n d q P} => squaredRisk T P.1)) := by refine ⟨4, ?_⟩ rintro _ ⟨P, rfl⟩ exact (unrestricted_squaredRisk_bounds T P.1).2 have hle : ∀ᵐ z ∂Measure.pi (fun _ : Fin d => π), (if hz : ∀ x, z x ∈ Icc (1 : ℝ) (lowerEndpoint n q) then squaredRisk T (activatedFullLaw η n d q z hd hb hq hslice hz) else 0) ≤ worstCaseRiskReal (fun (_ : Unit) (P : {P : FullLaw d // RareArrivalModelClass n d q P}) => squaredRisk T P.1) () := by filter_upwards [finiteReciprocalPrior_pi_ae_support hπ d] with z hz rw [dif_pos hz] exact le_worstCaseRisk (risk := fun (_ : Unit) (P : {P : FullLaw d // RareArrivalModelClass n d q P}) => squaredRisk T P.1) (e := ()) hbdd ⟨_, activatedFullLaw_model η n d q z hd hb hq hslice hz hn⟩ simpa using integral_mono_ae (finiteReciprocalPrior_pi_integrable hπ d _) (integrable_const _) hle
CausalSmith.Stat.MarRareqLogfrontier.activated_prior_squaredRisk_le_worst · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationRiskTransfer.lean:59
theorem activatedAugmentedMixture_centered_risk_le_worst Lemma activatedAugmentedMixture_centered_risk_le_worst in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
η :
ℝ
n d :
ℕ
q :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hb :
0 < rareMass η n q
hq :
0 < q
hslice :
π :
T :
(∫ s, (kernelMean T.toBoundedKernel.1 clip s - (rareCount η n d q : ℝ) * rareMass η n q * (∫ z, z⁻¹ ∂π)) ^ 2 ∂((activatedAugmentedMixture η n d q π).map (fun s i => (s i).2)))
≤ 2 * worstCaseRiskReal (fun (_ : Unit) (P : {P : FullLaw d // RareArrivalModelClass n d q P}) => squaredRisk T P.1) ()
+ (rareCount η n d q : ℝ) * (rareMass η n q) ^ 2 / 2
Proof (Lean source)
lemma activatedAugmentedMixture_centered_risk_le_worst (η : ℝ) (n d : ℕ) (q : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hb : 0 < rareMass η n q) (hq : 0 < q) (hslice : RareArrivalSlice n q) {π : Measure ℝ} (hπ : FiniteReciprocalPrior (lowerEndpoint n q) π) (T : Estimator n d) : (∫ s, (kernelMean T.toBoundedKernel.1 clip s - (rareCount η n d q : ℝ) * rareMass η n q * (∫ z, z⁻¹ ∂π)) ^ 2 ∂((activatedAugmentedMixture η n d q π).map (fun s i => (s i).2))) ≤ 2 * worstCaseRiskReal (fun (_ : Unit) (P : {P : FullLaw d // RareArrivalModelClass n d q P}) => squaredRisk T P.1) () + (rareCount η n d q : ℝ) * (rareMass η n q) ^ 2 / 2 := by classical let := hπ.1 let f := kernelMean T.toBoundedKernel.1 clip let θ := (rareCount η n d q : ℝ) * rareMass η n q * (∫ z, z⁻¹ ∂π) let r := fun z : Fin d → ℝ => if hz : ∀ x, z x ∈ Icc (1 : ℝ) (lowerEndpoint n q) then squaredRisk T (activatedFullLaw η n d q z hd hb hq hslice hz) else 0 let v := fun z : Fin d → ℝ => (rareMass η n q * (∑ x : Fin d, if x.val < rareCount η n d q then (z x)⁻¹ else 0) - θ) ^ 2 rw [activatedAugmentedMixture_projected_integral η n d q hn hd hb hq hslice hπ] have hpoint : ∀ᵐ z ∂Measure.pi (fun _ : Fin d => π), (if hz : ∀ x, z x ∈ Icc (1 : ℝ) (lowerEndpoint n q) then ∫ s, (f s - θ) ^ 2 ∂sampleLaw n (activatedFullLaw η n d q z hd hb hq hslice hz) else 0) ≤ 2 * r z + 2 * v z := by filter_upwards [finiteReciprocalPrior_pi_ae_support hπ d] with z hz simp only [r, dif_pos hz] let P := activatedFullLaw η n d q z hd hb hq hslice hz have h := activated_deterministic_centered_risk_le f P θ have hj := complete_arrival_kernel_mean_risk_le T P have ht : ate P = rareMass η n q * (∑ x : Fin d, if x.val < rareCount η n d q then (z x)⁻¹ else 0) := by exact activatedLaw_target_integral η n d q z hb hq hslice hz dsimp only [v] rw [← ht] linarith have havg := integral_mono_ae (finiteReciprocalPrior_pi_integrable hπ d _) (finiteReciprocalPrior_pi_integrable hπ d _) hpoint rw [integral_add ((finiteReciprocalPrior_pi_integrable hπ d r).const_mul 2) ((finiteReciprocalPrior_pi_integrable hπ d v).const_mul 2), integral_const_mul, integral_const_mul] at havg have hr := activated_prior_squaredRisk_le_worst η n d q hn hd hb hq hslice hπ T have hv := activated_full_prior_target_second_moment_le η n d q hπ change (∫ z, v z ∂Measure.pi (fun _ : Fin d => π)) ≤ _ at hv change (∫ z, r z ∂Measure.pi (fun _ : Fin d => π)) ≤ _ at hr dsimp only [f, θ] at havg linarith
CausalSmith.Stat.MarRareqLogfrontier.activatedAugmentedMixture_centered_risk_le_worst · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationRiskTransfer.lean:92
theorem activatedAugmentedMixture_squaredRisk_lower

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
η :
ℝ
n d :
ℕ
q :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hb :
0 < rareMass η n q
hq :
0 < q
hslice :
π₀ π₁ :
hgap :
1 / 12 ≤ |(∫ z, z⁻¹ ∂π₁) - ∫ z, z⁻¹ ∂π₀|
hJ :
2048 ≤ rareCount η n d q
htv :
tvDist ((activatedAugmentedMixture η n d q π₀).map (fun s i => (s i).2)) ((activatedAugmentedMixture η n d q π₁).map (fun s i => (s i).2))
≤ 1 / 8
T :
(1 / 4096) * ((rareCount η n d q : ℝ) * rareMass η n q) ^ 2
≤ worstCaseRiskReal (fun (_ : Unit) (P : {P : FullLaw d // RareArrivalModelClass n d q P}) => squaredRisk T P.1) ()
Proof (Lean source)
-- @node: activatedAugmentedMixture_squaredRisk_lower lemma activatedAugmentedMixture_squaredRisk_lower (η : ℝ) (n d : ℕ) (q : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hb : 0 < rareMass η n q) (hq : 0 < q) (hslice : RareArrivalSlice n q) {π₀ π₁ : Measure ℝ} (h₀ : FiniteReciprocalPrior (lowerEndpoint n q) π₀) (h₁ : FiniteReciprocalPrior (lowerEndpoint n q) π₁) (hgap : 1 / 12 ≤ |(∫ z, z⁻¹ ∂π₁) - ∫ z, z⁻¹ ∂π₀|) (hJ : 2048 ≤ rareCount η n d q) (htv : tvDist ((activatedAugmentedMixture η n d q π₀).map (fun s i => (s i).2)) ((activatedAugmentedMixture η n d q π₁).map (fun s i => (s i).2)) ≤ 1 / 8) (T : Estimator n d) : (1 / 4096) * ((rareCount η n d q : ℝ) * rareMass η n q) ^ 2 ≤ worstCaseRiskReal (fun (_ : Unit) (P : {P : FullLaw d // RareArrivalModelClass n d q P}) => squaredRisk T P.1) () := by let := T.toBoundedKernel.2.1 let := activatedAugmentedMixture_isProbabilityMeasure η n d q hn hd hb hq hslice h₀ let := activatedAugmentedMixture_isProbabilityMeasure η n d q hn hd hb hq hslice h₁ have hf : Measurable (fun s : Fin n → Bool × ObsRecord d => fun i => (s i).2) := by fun_prop let := Measure.isProbabilityMeasure_map hf.aemeasurable (μ := activatedAugmentedMixture η n d q π₀) let := Measure.isProbabilityMeasure_map hf.aemeasurable (μ := activatedAugmentedMixture η n d q π₁) have hclip : Measurable clip := by unfold clip; fun_prop have hm := Causalean.Stat.measurable_kernelMean T.toBoundedKernel.1 hclip have hsep : (rareCount η n d q : ℝ) * rareMass η n q / 12 ≤ |(rareCount η n d q : ℝ) * rareMass η n q * (∫ z, z⁻¹ ∂π₁) - (rareCount η n d q : ℝ) * rareMass η n q * (∫ z, z⁻¹ ∂π₀)| := by rw [← mul_sub, abs_mul, abs_of_nonneg (by positivity)] nlinarith [mul_le_mul_of_nonneg_left hgap (show 0 ≤ (rareCount η n d q : ℝ) * rareMass η n q by positivity)] exact activated_fuzzy_risk_lower_of_center_comparison _ _ _ hm _ _ _ _ _ hJ hb.le hsep htv Integrable.of_finite Integrable.of_finite (activatedAugmentedMixture_centered_risk_le_worst η n d q hn hd hb hq hslice h₀ T) (activatedAugmentedMixture_centered_risk_le_worst η n d q hn hd hb hq hslice h₁ T)
CausalSmith.Stat.MarRareqLogfrontier.activatedAugmentedMixture_squaredRisk_lower · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationRiskTransfer.lean:141
theorem activatedAugmentedMixture_minimaxRisk_lower

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
η :
ℝ
n d :
ℕ
q :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hb :
0 < rareMass η n q
hq :
0 < q
hslice :
π₀ π₁ :
hgap :
1 / 12 ≤ |(∫ z, z⁻¹ ∂π₁) - ∫ z, z⁻¹ ∂π₀|
hJ :
2048 ≤ rareCount η n d q
htv :
tvDist ((activatedAugmentedMixture η n d q π₀).map (fun s i => (s i).2)) ((activatedAugmentedMixture η n d q π₁).map (fun s i => (s i).2))
≤ 1 / 8
(1 / 4096) * ((rareCount η n d q : ℝ) * rareMass η n q) ^ 2 ≤ minimaxRisk n d q
Proof (Lean source)
-- @node: activatedAugmentedMixture_minimaxRisk_lower lemma activatedAugmentedMixture_minimaxRisk_lower (η : ℝ) (n d : ℕ) (q : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hb : 0 < rareMass η n q) (hq : 0 < q) (hslice : RareArrivalSlice n q) {π₀ π₁ : Measure ℝ} (h₀ : FiniteReciprocalPrior (lowerEndpoint n q) π₀) (h₁ : FiniteReciprocalPrior (lowerEndpoint n q) π₁) (hgap : 1 / 12 ≤ |(∫ z, z⁻¹ ∂π₁) - ∫ z, z⁻¹ ∂π₀|) (hJ : 2048 ≤ rareCount η n d q) (htv : tvDist ((activatedAugmentedMixture η n d q π₀).map (fun s i => (s i).2)) ((activatedAugmentedMixture η n d q π₁).map (fun s i => (s i).2)) ≤ 1 / 8) : (1 / 4096) * ((rareCount η n d q : ℝ) * rareMass η n q) ^ 2 ≤ minimaxRisk n d q := by let T₀ : Estimator n d := Estimator.ofMap (fun _ => 0) ⟨measurable_const, by intro s; norm_num⟩ letI : Nonempty (Estimator n d) := ⟨T₀⟩ unfold minimaxRisk apply le_minimaxValue intro T exact activatedAugmentedMixture_squaredRisk_lower η n d q hn hd hb hq hslice h₀ h₁ hgap hJ htv T
CausalSmith.Stat.MarRareqLogfrontier.activatedAugmentedMixture_minimaxRisk_lower · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationRiskTransfer.lean:181
theorem activatedAugmentedMixture_minimaxRisk_calibrated

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hq :
0 < q
hslice :
π₀ π₁ :
hm :
∀ v : ℕ
if
v ≤ lowerDegree n q
then
(∫ z, z ^ v ∂π₀) = ∫ z, z ^ v ∂π₁
hgap :
1 / 12 ≤ |(∫ z, z⁻¹ ∂π₁) - ∫ z, z⁻¹ ∂π₀|
hJ :
2048 ≤ rareCount (exp (-32)) n d q
hlarge :
exp ((32 - log ((2 : ℝ) / 16)) / 28) ≤ effectiveSize n q
(1 / 4096) * ((rareCount (exp (-32)) n d q : ℝ) * rareMass (exp (-32)) n q) ^ 2
≤ minimaxRisk n d q
Proof (Lean source)
-- @node: activatedAugmentedMixture_minimaxRisk_calibrated lemma activatedAugmentedMixture_minimaxRisk_calibrated (n d : ℕ) (q : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hq : 0 < q) (hslice : RareArrivalSlice n q) {π₀ π₁ : Measure ℝ} (h₀ : FiniteReciprocalPrior (lowerEndpoint n q) π₀) (h₁ : FiniteReciprocalPrior (lowerEndpoint n q) π₁) (hm : ∀ v : ℕ, v ≤ lowerDegree n q → (∫ z, z ^ v ∂π₀) = ∫ z, z ^ v ∂π₁) (hgap : 1 / 12 ≤ |(∫ z, z⁻¹ ∂π₁) - ∫ z, z⁻¹ ∂π₀|) (hJ : 2048 ≤ rareCount (exp (-32)) n d q) (hlarge : exp ((32 - log ((2 : ℝ) / 16)) / 28) ≤ effectiveSize n q) : (1 / 4096) * ((rareCount (exp (-32)) n d q : ℝ) * rareMass (exp (-32)) n q) ^ 2 ≤ minimaxRisk n d q := by have hN : 0 < effectiveSize n q := by unfold effectiveSize; positivity have hell : 0 < logScale n q := by unfold logScale apply Real.log_pos linarith [Real.add_one_le_exp (1 : ℝ)] have hb : 0 < rareMass (exp (-32)) n q := by unfold rareMass positivity let := activatedAugmentedMixture_isProbabilityMeasure (exp (-32)) n d q hn hd hb hq hslice h₀ let := activatedAugmentedMixture_isProbabilityMeasure (exp (-32)) n d q hn hd hb hq hslice h₁ have htv := activation_projected_tv_le_bad_event (activatedAugmentedMixture (exp (-32)) n d q π₀) (activatedAugmentedMixture (exp (-32)) n d q π₁) {s | ∀ x : Fin d, x.val < rareCount (exp (-32)) n d q → (∑ i ∈ Finset.univ.filter (fun i => (s i).2.X = x), if (s i).1 then 1 else 0) ≤ lowerDegree n q} (by intro s hs rw [activatedAugmentedMixture_real_singleton, activatedAugmentedMixture_real_singleton] exact activatedAugmentedSample_prior_singleton_eq (exp (-32)) n d q hn hd hb hq hslice h₀ h₁ (lowerDegree n q) hm s hs) (fun s i => (s i).2) (by fun_prop) have htail := activatedAugmentedMixture_cutoff_budget 2 n d q (by norm_num) hn hd hq hslice h₀ hlarge apply activatedAugmentedMixture_minimaxRisk_lower (exp (-32)) n d q hn hd hb hq hslice h₀ h₁ hgap hJ exact htv.trans (by simpa only [Set.compl_setOf, show (2 : ℝ) / 16 = 1 / 8 by norm_num] using htail)
CausalSmith.Stat.MarRareqLogfrontier.activatedAugmentedMixture_minimaxRisk_calibrated · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationRiskTransfer.lean:204
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.Lower.ActivationSampleLikelihood 7 declarations Full augmented sample likelihood cancellation below the activation cutoff in equation (6).

Full augmented sample likelihood cancellation below the activation cutoff in equation (6). Reservoir and zero-mass cells contribute constant polynomials; only rare cells consume the matched-moment budget.

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
η :
ℝ
n d :
ℕ
q :
ℝ
x :
Fin d
a flag arrival one :
activationOutcomePolynomial η n d q x a flag arrival one :
if x.val < rareCount η n d q then activationRareOutcomePolynomial (lowerEndpoint n q) a flag arrival one else C (augmentedOutcomeWeight η n d q (fun _ => 0) x a flag arrival one)
CausalSmith.Stat.MarRareqLogfrontier.activationOutcomePolynomial · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationSampleLikelihood.lean:15
theorem activationOutcomePolynomial_eval

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
η :
ℝ
n d :
ℕ
q :
ℝ
z :
Fin d → ℝ
x :
Fin d
a flag arrival one :
(activationOutcomePolynomial η n d q x a flag arrival one).eval (z x)
= augmentedOutcomeWeight η n d q z x a flag arrival one
Proof (Lean source)
-- @node: activationOutcomePolynomial_eval lemma activationOutcomePolynomial_eval (η : ℝ) (n d : ℕ) (q : ℝ) (z : Fin d → ℝ) (x : Fin d) (a flag arrival one : Bool) : (activationOutcomePolynomial η n d q x a flag arrival one).eval (z x) = augmentedOutcomeWeight η n d q z x a flag arrival one := by by_cases hx : x.val < rareCount η n d q · simp only [activationOutcomePolynomial, hx, if_true] exact activationRareOutcomePolynomial_eval η n d q z x a flag arrival one hx · cases a <;> cases flag <;> cases arrival <;> cases one <;> simp [activationOutcomePolynomial, augmentedOutcomeWeight, lowerCellZ, hx]
CausalSmith.Stat.MarRareqLogfrontier.activationOutcomePolynomial_eval · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationSampleLikelihood.lean:23
theorem activationOutcomePolynomial_natDegree

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
η :
ℝ
n d :
ℕ
q :
ℝ
x :
Fin d
a flag arrival one :
(activationOutcomePolynomial η n d q x a flag arrival one).natDegree
≤ if x.val < rareCount η n d q then (if flag then 1 else 0) else 0
Proof (Lean source)
-- @node: activationOutcomePolynomial_natDegree lemma activationOutcomePolynomial_natDegree (η : ℝ) (n d : ℕ) (q : ℝ) (x : Fin d) (a flag arrival one : Bool) : (activationOutcomePolynomial η n d q x a flag arrival one).natDegree ≤ if x.val < rareCount η n d q then (if flag then 1 else 0) else 0 := by by_cases hx : x.val < rareCount η n d q · simp only [activationOutcomePolynomial, hx, if_true] exact activationRareOutcomePolynomial_natDegree _ a flag arrival one · simp [activationOutcomePolynomial, hx]
CausalSmith.Stat.MarRareqLogfrontier.activationOutcomePolynomial_natDegree · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationSampleLikelihood.lean:35
theorem activationSampleOutcome_factorization

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
ι :
Type*
s :
η :
ℝ
n d :
ℕ
q :
ℝ
cell :
ι → Fin d
a flag arrival one :
ι → Bool
z :
Fin d → ℝ
(∏ i ∈ s, augmentedOutcomeWeight η n d q z (cell i) (a i) (flag i) (arrival i) (one i))
= ∏ x : Fin d, (∏ i ∈ s.filter (fun i => cell i = x), activationOutcomePolynomial η n d q x (a i) (flag i) (arrival i) (one i)).eval (z x)
Proof (Lean source)
-- @node: activationSampleOutcome_factorization lemma activationSampleOutcome_factorization {ι : Type*} (s : Finset ι) (η : ℝ) (n d : ℕ) (q : ℝ) (cell : ι → Fin d) (a flag arrival one : ι → Bool) (z : Fin d → ℝ) : (∏ i ∈ s, augmentedOutcomeWeight η n d q z (cell i) (a i) (flag i) (arrival i) (one i)) = ∏ x : Fin d, (∏ i ∈ s.filter (fun i => cell i = x), activationOutcomePolynomial η n d q x (a i) (flag i) (arrival i) (one i)).eval (z x) := by classical rw [← Finset.prod_fiberwise s cell] apply Finset.prod_congr rfl intro x _ rw [eval_prod] apply Finset.prod_congr rfl intro i hi rw [(Finset.mem_filter.mp hi).2] exact (activationOutcomePolynomial_eval η n d q z x _ _ _ _).symm
CausalSmith.Stat.MarRareqLogfrontier.activationSampleOutcome_factorization · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationSampleLikelihood.lean:46
theorem activationSampleOutcome_integral_eq Lemma activationSampleOutcome_integral_eq in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
ι :
Type*
s :
η :
ℝ
n d :
ℕ
q :
ℝ
cell :
ι → Fin d
π₀ π₁ :
K :
ℕ
hm :
∀ v : ℕ
if
v ≤ K
then
(∫ z, z ^ v ∂π₀) = ∫ z, z ^ v ∂π₁
a flag arrival one :
ι → Bool
hcount :
∀ x : Fin d
if
x.val < rareCount η n d q
then
(∑ i ∈ s.filter (fun i => cell i = x), if flag i then 1 else 0) ≤ K
(∫ z, ∏ i ∈ s, augmentedOutcomeWeight η n d q z (cell i) (a i) (flag i) (arrival i) (one i) ∂Measure.pi (fun _ : Fin d => π₀))
= ∫ z, ∏ i ∈ s, augmentedOutcomeWeight η n d q z (cell i) (a i) (flag i) (arrival i) (one i) ∂Measure.pi (fun _ : Fin d => π₁)
Proof (Lean source)
-- @node: activationSampleOutcome_integral_eq lemma activationSampleOutcome_integral_eq {ι : Type*} (s : Finset ι) (η : ℝ) (n d : ℕ) (q : ℝ) (cell : ι → Fin d) {π₀ π₁ : Measure ℝ} (h₀ : FiniteReciprocalPrior (lowerEndpoint n q) π₀) (h₁ : FiniteReciprocalPrior (lowerEndpoint n q) π₁) (K : ℕ) (hm : ∀ v : ℕ, v ≤ K → (∫ z, z ^ v ∂π₀) = ∫ z, z ^ v ∂π₁) (a flag arrival one : ι → Bool) (hcount : ∀ x : Fin d, x.val < rareCount η n d q → (∑ i ∈ s.filter (fun i => cell i = x), if flag i then 1 else 0) ≤ K) : (∫ z, ∏ i ∈ s, augmentedOutcomeWeight η n d q z (cell i) (a i) (flag i) (arrival i) (one i) ∂Measure.pi (fun _ : Fin d => π₀)) = ∫ z, ∏ i ∈ s, augmentedOutcomeWeight η n d q z (cell i) (a i) (flag i) (arrival i) (one i) ∂Measure.pi (fun _ : Fin d => π₁) := by classical simp_rw [activationSampleOutcome_factorization] apply finiteReciprocalPrior_product_polynomial_integral_eq h₀ h₁ K hm intro x apply (natDegree_prod_le _ _).trans by_cases hx : x.val < rareCount η n d q · exact (Finset.sum_le_sum (fun i _ => by simpa only [hx, if_true] using activationOutcomePolynomial_natDegree η n d q x (a i) (flag i) (arrival i) (one i))).trans (hcount x hx) · have hzero : (∑ i ∈ s.filter (fun i => cell i = x), (activationOutcomePolynomial η n d q x (a i) (flag i) (arrival i) (one i)).natDegree) = 0 := by apply Finset.sum_eq_zero intro i _ simp [activationOutcomePolynomial, hx] rw [hzero] exact zero_le K
CausalSmith.Stat.MarRareqLogfrontier.activationSampleOutcome_integral_eq · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationSampleLikelihood.lean:66
theorem activationSampleWeight_integral_eq Lemma activationSampleWeight_integral_eq in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
ι :
Type*
s :
η :
ℝ
n d :
ℕ
q :
ℝ
cell :
ι → Fin d
π₀ π₁ :
K :
ℕ
hm :
∀ v : ℕ
if
v ≤ K
then
(∫ z, z ^ v ∂π₀) = ∫ z, z ^ v ∂π₁
a flag arrival one :
ι → Bool
hcount :
∀ x : Fin d
if
x.val < rareCount η n d q
then
(∑ i ∈ s.filter (fun i => cell i = x), if flag i then 1 else 0) ≤ K
(∫ z, ∏ i ∈ s, (baselineMass η n d q (cell i) / 2 * bernWeight (q * lowerEndpoint n q) (flag i) * augmentedOutcomeWeight η n d q z (cell i) (a i) (flag i) (arrival i) (one i)) ∂Measure.pi (fun _ : Fin d => π₀))
= ∫ z, ∏ i ∈ s, (baselineMass η n d q (cell i) / 2 * bernWeight (q * lowerEndpoint n q) (flag i) * augmentedOutcomeWeight η n d q z (cell i) (a i) (flag i) (arrival i) (one i)) ∂Measure.pi (fun _ : Fin d => π₁)
Proof (Lean source)
-- @node: activationSampleWeight_integral_eq lemma activationSampleWeight_integral_eq {ι : Type*} (s : Finset ι) (η : ℝ) (n d : ℕ) (q : ℝ) (cell : ι → Fin d) {π₀ π₁ : Measure ℝ} (h₀ : FiniteReciprocalPrior (lowerEndpoint n q) π₀) (h₁ : FiniteReciprocalPrior (lowerEndpoint n q) π₁) (K : ℕ) (hm : ∀ v : ℕ, v ≤ K → (∫ z, z ^ v ∂π₀) = ∫ z, z ^ v ∂π₁) (a flag arrival one : ι → Bool) (hcount : ∀ x : Fin d, x.val < rareCount η n d q → (∑ i ∈ s.filter (fun i => cell i = x), if flag i then 1 else 0) ≤ K) : (∫ z, ∏ i ∈ s, (baselineMass η n d q (cell i) / 2 * bernWeight (q * lowerEndpoint n q) (flag i) * augmentedOutcomeWeight η n d q z (cell i) (a i) (flag i) (arrival i) (one i)) ∂Measure.pi (fun _ : Fin d => π₀)) = ∫ z, ∏ i ∈ s, (baselineMass η n d q (cell i) / 2 * bernWeight (q * lowerEndpoint n q) (flag i) * augmentedOutcomeWeight η n d q z (cell i) (a i) (flag i) (arrival i) (one i)) ∂Measure.pi (fun _ : Fin d => π₁) := by simp_rw [Finset.prod_mul_distrib] rw [integral_const_mul, integral_const_mul] rw [activationSampleOutcome_integral_eq s η n d q cell h₀ h₁ K hm a flag arrival one hcount]
CausalSmith.Stat.MarRareqLogfrontier.activationSampleWeight_integral_eq · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationSampleLikelihood.lean:100
theorem activationSampleWeight_grid_integral_eq

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
ι :
Type*
s :
η :
ℝ
n d :
ℕ
q :
ℝ
cell :
ι → Fin d
π₀ π₁ :
K :
ℕ
hm :
∀ v : ℕ
if
v ≤ K
then
(∫ z, z ^ v ∂π₀) = ∫ z, z ^ v ∂π₁
M :
ℕ
hM :
1 ≤ M
j j' :
Fin (M + 1)
a flag arrival one :
ι → Bool
hcount :
∀ x : Fin d
if
x.val < rareCount η n d q
then
(∑ i ∈ s.filter (fun i => cell i = x), if flag i then 1 else 0) ≤ K
(∫ z, ∏ i ∈ s, (baselineMass η n d q (cell i) / 2 * bernWeight (q * lowerEndpoint n q) (flag i) * augmentedOutcomeWeight η n d q z (cell i) (a i) (flag i) (arrival i) (one i)) ∂Measure.pi (fun _ : Fin d => intervalInterpolatedPrior π₀ π₁ ((j : ℝ) / M)))
= ∫ z, ∏ i ∈ s, (baselineMass η n d q (cell i) / 2 * bernWeight (q * lowerEndpoint n q) (flag i) * augmentedOutcomeWeight η n d q z (cell i) (a i) (flag i) (arrival i) (one i)) ∂Measure.pi (fun _ : Fin d => intervalInterpolatedPrior π₀ π₁ ((j' : ℝ) / M))
Proof (Lean source)
-- @node: activationSampleWeight_grid_integral_eq lemma activationSampleWeight_grid_integral_eq {ι : Type*} (s : Finset ι) (η : ℝ) (n d : ℕ) (q : ℝ) (cell : ι → Fin d) {π₀ π₁ : Measure ℝ} (h₀ : FiniteReciprocalPrior (lowerEndpoint n q) π₀) (h₁ : FiniteReciprocalPrior (lowerEndpoint n q) π₁) (K : ℕ) (hm : ∀ v : ℕ, v ≤ K → (∫ z, z ^ v ∂π₀) = ∫ z, z ^ v ∂π₁) (M : ℕ) (hM : 1 ≤ M) (j j' : Fin (M + 1)) (a flag arrival one : ι → Bool) (hcount : ∀ x : Fin d, x.val < rareCount η n d q → (∑ i ∈ s.filter (fun i => cell i = x), if flag i then 1 else 0) ≤ K) : (∫ z, ∏ i ∈ s, (baselineMass η n d q (cell i) / 2 * bernWeight (q * lowerEndpoint n q) (flag i) * augmentedOutcomeWeight η n d q z (cell i) (a i) (flag i) (arrival i) (one i)) ∂Measure.pi (fun _ : Fin d => intervalInterpolatedPrior π₀ π₁ ((j : ℝ) / M))) = ∫ z, ∏ i ∈ s, (baselineMass η n d q (cell i) / 2 * bernWeight (q * lowerEndpoint n q) (flag i) * augmentedOutcomeWeight η n d q z (cell i) (a i) (flag i) (arrival i) (one i)) ∂Measure.pi (fun _ : Fin d => intervalInterpolatedPrior π₀ π₁ ((j' : ℝ) / M)) := by have hgrid := intervalInterpolatedPrior_grid h₀ h₁ K hm M hM exact activationSampleWeight_integral_eq s η n d q cell (hgrid j).1 (hgrid j').1 K ((hgrid j).2.1 j') a flag arrival one hcount
CausalSmith.Stat.MarRareqLogfrontier.activationSampleWeight_grid_integral_eq · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationSampleLikelihood.lean:124
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.Lower.ActivationSampleMass 12 declarations Atomic probabilities of the actual augmented fixed-horizon experiment and matched-prior cancellation on the activation cutoff event in equation (6).

Atomic probabilities of the actual augmented fixed-horizon experiment and matched-prior cancellation on the activation cutoff event in equation (6).

theorem augmentedOneRecord_singleton

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
η :
ℝ
n d :
ℕ
q :
ℝ
z :
Fin d → ℝ
hz :
∀ x, z x ∈ Icc (1 : ℝ) (lowerEndpoint n q)
r :
augmentedOneRecord η n d q z hz {r}
= if r.2.S then 0 else ofReal (baselineMass η n d q r.2.X / 2 * bernWeight (q * lowerEndpoint n q) r.1 * augmentedOutcomeWeight η n d q z r.2.X r.2.A r.1 r.2.R r.2.RY)
Proof (Lean source)
-- @node: augmentedOneRecord_singleton lemma augmentedOneRecord_singleton (η : ℝ) (n d : ℕ) (q : ℝ) (z : Fin d → ℝ) (hz : ∀ x, z x ∈ Icc (1 : ℝ) (lowerEndpoint n q)) (r : Bool × ObsRecord d) : augmentedOneRecord η n d q z hz {r} = if r.2.S then 0 else ofReal (baselineMass η n d q r.2.X / 2 * bernWeight (q * lowerEndpoint n q) r.1 * augmentedOutcomeWeight η n d q z r.2.X r.2.A r.1 r.2.R r.2.RY) := by classical rcases r with ⟨flag, x, a, s, arrival, one⟩ simp only [augmentedOneRecord, Measure.finsetSum_apply, Measure.smul_apply, smul_eq_mul, Measure.dirac_apply, Set.indicator_apply, Set.mem_singleton_iff, Pi.one_apply, Prod.mk.injEq, ObsRecord.mk.injEq] simp only [mul_ite, mul_one, mul_zero, ite_and] cases s <;> simp only [Bool.false_eq_true, ↓reduceIte, Finset.sum_ite_irrel, Finset.sum_ite_eq', Finset.mem_univ, Finset.sum_const_zero]
CausalSmith.Stat.MarRareqLogfrontier.augmentedOneRecord_singleton · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationSampleMass.lean:17
theorem augmentedOneRecord_weight_nonneg

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
η :
ℝ
n d :
ℕ
q :
ℝ
z :
Fin d → ℝ
hb :
0 < rareMass η n q
hq :
0 < q
hslice :
hz :
∀ x, z x ∈ Icc (1 : ℝ) (lowerEndpoint n q)
r :
0
≤ baselineMass η n d q r.2.X / 2 * bernWeight (q * lowerEndpoint n q) r.1 * augmentedOutcomeWeight η n d q z r.2.X r.2.A r.1 r.2.R r.2.RY
Proof (Lean source)
-- @node: augmentedOneRecord_weight_nonneg lemma augmentedOneRecord_weight_nonneg (η : ℝ) (n d : ℕ) (q : ℝ) (z : Fin d → ℝ) (hb : 0 < rareMass η n q) (hq : 0 < q) (hslice : RareArrivalSlice n q) (hz : ∀ x, z x ∈ Icc (1 : ℝ) (lowerEndpoint n q)) (r : Bool × ObsRecord d) : 0 ≤ baselineMass η n d q r.2.X / 2 * bernWeight (q * lowerEndpoint n q) r.1 * augmentedOutcomeWeight η n d q z r.2.X r.2.A r.1 r.2.R r.2.RY := by have hH : 0 ≤ lowerEndpoint n q := by unfold lowerEndpoint; positivity have hp : 0 ≤ q * lowerEndpoint n q ∧ q * lowerEndpoint n q ≤ 1 := ⟨mul_nonneg hq.le hH, lower_activation_probability_le_one n q hq.le hslice⟩ have hbern : 0 ≤ bernWeight (q * lowerEndpoint n q) r.1 := by cases r.1 <;> simp [bernWeight] <;> linarith [hp.1, hp.2] exact mul_nonneg (mul_nonneg (div_nonneg (baselineMass_nonneg η n d q hb r.2.X) (by norm_num)) hbern) (augmentedOutcomeWeight_nonneg η n d q z _ _ _ _ _ (hz r.2.X))
CausalSmith.Stat.MarRareqLogfrontier.augmentedOneRecord_weight_nonneg · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationSampleMass.lean:38
theorem augmentedOneRecord_real_singleton

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
η :
ℝ
n d :
ℕ
q :
ℝ
z :
Fin d → ℝ
hb :
0 < rareMass η n q
hq :
0 < q
hslice :
hz :
∀ x, z x ∈ Icc (1 : ℝ) (lowerEndpoint n q)
r :
(augmentedOneRecord η n d q z hz).real {r}
= if r.2.S then 0 else baselineMass η n d q r.2.X / 2 * bernWeight (q * lowerEndpoint n q) r.1 * augmentedOutcomeWeight η n d q z r.2.X r.2.A r.1 r.2.R r.2.RY
Proof (Lean source)
-- @node: augmentedOneRecord_real_singleton lemma augmentedOneRecord_real_singleton (η : ℝ) (n d : ℕ) (q : ℝ) (z : Fin d → ℝ) (hb : 0 < rareMass η n q) (hq : 0 < q) (hslice : RareArrivalSlice n q) (hz : ∀ x, z x ∈ Icc (1 : ℝ) (lowerEndpoint n q)) (r : Bool × ObsRecord d) : (augmentedOneRecord η n d q z hz).real {r} = if r.2.S then 0 else baselineMass η n d q r.2.X / 2 * bernWeight (q * lowerEndpoint n q) r.1 * augmentedOutcomeWeight η n d q z r.2.X r.2.A r.1 r.2.R r.2.RY := by rw [Measure.real, augmentedOneRecord_singleton] split_ifs · simp · exact ENNReal.toReal_ofReal (augmentedOneRecord_weight_nonneg η n d q z hb hq hslice hz r)
CausalSmith.Stat.MarRareqLogfrontier.augmentedOneRecord_real_singleton · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationSampleMass.lean:58
theorem activated_sample_real_singleton

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
η :
ℝ
n d :
ℕ
q :
ℝ
z :
Fin d → ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hb :
0 < rareMass η n q
hq :
0 < q
hslice :
hz :
∀ x, z x ∈ Icc (1 : ℝ) (lowerEndpoint n q)
s :
Fin n → Bool × ObsRecord d
(Measure.pi (fun _ : Fin n => augmentedOneRecord η n d q z hz)).real {s}
= ∏ i, if (s i).2.S then 0 else baselineMass η n d q (s i).2.X / 2 * bernWeight (q * lowerEndpoint n q) (s i).1 * augmentedOutcomeWeight η n d q z (s i).2.X (s i).2.A (s i).1 (s i).2.R (s i).2.RY
Proof (Lean source)
-- @node: activated_sample_real_singleton lemma activated_sample_real_singleton (η : ℝ) (n d : ℕ) (q : ℝ) (z : Fin d → ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hb : 0 < rareMass η n q) (hq : 0 < q) (hslice : RareArrivalSlice n q) (hz : ∀ x, z x ∈ Icc (1 : ℝ) (lowerEndpoint n q)) (s : Fin n → Bool × ObsRecord d) : (Measure.pi (fun _ : Fin n => augmentedOneRecord η n d q z hz)).real {s} = ∏ i, if (s i).2.S then 0 else baselineMass η n d q (s i).2.X / 2 * bernWeight (q * lowerEndpoint n q) (s i).1 * augmentedOutcomeWeight η n d q z (s i).2.X (s i).2.A (s i).1 (s i).2.R (s i).2.RY := by let := augmentedOneRecord_isProbabilityMeasure η n d q z hn hd hb hq hslice hz rw [Measure.real, Measure.pi_singleton, ENNReal.toReal_prod] exact Finset.prod_congr rfl (fun i _ => augmentedOneRecord_real_singleton η n d q z hb hq hslice hz (s i))
CausalSmith.Stat.MarRareqLogfrontier.activated_sample_real_singleton · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationSampleMass.lean:75
def activatedAugmentedSample

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
η :
ℝ
n d :
ℕ
q :
ℝ
z :
Fin d → ℝ
activatedAugmentedSample η n d q z :
Measure (Fin n → Bool × ObsRecord d)
if hz : ∀ x, z x ∈ Icc (1 : ℝ) (lowerEndpoint n q) then Measure.pi (fun _ : Fin n => augmentedOneRecord η n d q z hz) else 0
CausalSmith.Stat.MarRareqLogfrontier.activatedAugmentedSample · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationSampleMass.lean:93
theorem activatedAugmentedSample_prior_singleton

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
η :
ℝ
n d :
ℕ
q :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hb :
0 < rareMass η n q
hq :
0 < q
hslice :
π :
s :
Fin n → Bool × ObsRecord d
(∫ z, (activatedAugmentedSample η n d q z).real {s} ∂Measure.pi (fun _ : Fin d => π))
= if ∀ i, (s i).2.S = false then ∫ z, ∏ i, (baselineMass η n d q (s i).2.X / 2 * bernWeight (q * lowerEndpoint n q) (s i).1 * augmentedOutcomeWeight η n d q z (s i).2.X (s i).2.A (s i).1 (s i).2.R (s i).2.RY) ∂Measure.pi (fun _ : Fin d => π) else 0
Proof (Lean source)
-- @node: activatedAugmentedSample_prior_singleton lemma activatedAugmentedSample_prior_singleton (η : ℝ) (n d : ℕ) (q : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hb : 0 < rareMass η n q) (hq : 0 < q) (hslice : RareArrivalSlice n q) {π : Measure ℝ} (hπ : FiniteReciprocalPrior (lowerEndpoint n q) π) (s : Fin n → Bool × ObsRecord d) : (∫ z, (activatedAugmentedSample η n d q z).real {s} ∂Measure.pi (fun _ : Fin d => π)) = if ∀ i, (s i).2.S = false then ∫ z, ∏ i, (baselineMass η n d q (s i).2.X / 2 * bernWeight (q * lowerEndpoint n q) (s i).1 * augmentedOutcomeWeight η n d q z (s i).2.X (s i).2.A (s i).1 (s i).2.R (s i).2.RY) ∂Measure.pi (fun _ : Fin d => π) else 0 := by classical by_cases hs : ∀ i, (s i).2.S = false · rw [if_pos hs] apply integral_congr_ae filter_upwards [finiteReciprocalPrior_pi_ae_support hπ d] with z hz rw [activatedAugmentedSample, dif_pos hz, activated_sample_real_singleton η n d q z hn hd hb hq hslice hz] exact Finset.prod_congr rfl (fun i _ => by simp only [hs i, Bool.false_eq_true, if_false]) · rw [if_neg hs] calc (∫ z, (activatedAugmentedSample η n d q z).real {s} ∂Measure.pi (fun _ : Fin d => π)) = ∫ _z, (0 : ℝ) ∂Measure.pi (fun _ : Fin d => π) := by apply integral_congr_ae filter_upwards [finiteReciprocalPrior_pi_ae_support hπ d] with z hz rw [activatedAugmentedSample, dif_pos hz, activated_sample_real_singleton η n d q z hn hd hb hq hslice hz] obtain ⟨i, hi⟩ := not_forall.mp hs apply Finset.prod_eq_zero (Finset.mem_univ i) have hi' : (s i).2.S = true := by cases h : (s i).2.S <;> simp_all simp only [hi', if_true] _ = 0 := by simp
CausalSmith.Stat.MarRareqLogfrontier.activatedAugmentedSample_prior_singleton · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationSampleMass.lean:101
theorem activatedAugmentedSample_prior_singleton_eq

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
η :
ℝ
n d :
ℕ
q :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hb :
0 < rareMass η n q
hq :
0 < q
hslice :
π₀ π₁ :
K :
ℕ
hm :
∀ v : ℕ
if
v ≤ K
then
(∫ z, z ^ v ∂π₀) = ∫ z, z ^ v ∂π₁
s :
Fin n → Bool × ObsRecord d
hcount :
∀ x : Fin d
if
x.val < rareCount η n d q
then
(∑ i ∈ Finset.univ.filter (fun i => (s i).2.X = x), if (s i).1 then 1 else 0) ≤ K
(∫ z, (activatedAugmentedSample η n d q z).real {s} ∂Measure.pi (fun _ : Fin d => π₀))
= ∫ z, (activatedAugmentedSample η n d q z).real {s} ∂Measure.pi (fun _ : Fin d => π₁)
Proof (Lean source)
-- @node: activatedAugmentedSample_prior_singleton_eq lemma activatedAugmentedSample_prior_singleton_eq (η : ℝ) (n d : ℕ) (q : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hb : 0 < rareMass η n q) (hq : 0 < q) (hslice : RareArrivalSlice n q) {π₀ π₁ : Measure ℝ} (h₀ : FiniteReciprocalPrior (lowerEndpoint n q) π₀) (h₁ : FiniteReciprocalPrior (lowerEndpoint n q) π₁) (K : ℕ) (hm : ∀ v : ℕ, v ≤ K → (∫ z, z ^ v ∂π₀) = ∫ z, z ^ v ∂π₁) (s : Fin n → Bool × ObsRecord d) (hcount : ∀ x : Fin d, x.val < rareCount η n d q → (∑ i ∈ Finset.univ.filter (fun i => (s i).2.X = x), if (s i).1 then 1 else 0) ≤ K) : (∫ z, (activatedAugmentedSample η n d q z).real {s} ∂Measure.pi (fun _ : Fin d => π₀)) = ∫ z, (activatedAugmentedSample η n d q z).real {s} ∂Measure.pi (fun _ : Fin d => π₁) := by rw [activatedAugmentedSample_prior_singleton η n d q hn hd hb hq hslice h₀, activatedAugmentedSample_prior_singleton η n d q hn hd hb hq hslice h₁] split_ifs · exact activationSampleWeight_integral_eq univ η n d q (fun i => (s i).2.X) h₀ h₁ K hm (fun i => (s i).2.A) (fun i => (s i).1) (fun i => (s i).2.R) (fun i => (s i).2.RY) hcount · rfl
CausalSmith.Stat.MarRareqLogfrontier.activatedAugmentedSample_prior_singleton_eq · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationSampleMass.lean:139
theorem activatedAugmentedSample_grid_singleton_eq

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
η :
ℝ
n d :
ℕ
q :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hb :
0 < rareMass η n q
hq :
0 < q
hslice :
π₀ π₁ :
K :
ℕ
hm :
∀ v : ℕ
if
v ≤ K
then
(∫ z, z ^ v ∂π₀) = ∫ z, z ^ v ∂π₁
M :
ℕ
hM :
1 ≤ M
j j' :
Fin (M + 1)
s :
Fin n → Bool × ObsRecord d
hcount :
∀ x : Fin d
if
x.val < rareCount η n d q
then
(∑ i ∈ Finset.univ.filter (fun i => (s i).2.X = x), if (s i).1 then 1 else 0) ≤ K
(∫ z, (activatedAugmentedSample η n d q z).real {s} ∂Measure.pi (fun _ : Fin d => intervalInterpolatedPrior π₀ π₁ ((j : ℝ) / M)))
= ∫ z, (activatedAugmentedSample η n d q z).real {s} ∂Measure.pi (fun _ : Fin d => intervalInterpolatedPrior π₀ π₁ ((j' : ℝ) / M))
Proof (Lean source)
-- @node: activatedAugmentedSample_grid_singleton_eq lemma activatedAugmentedSample_grid_singleton_eq (η : ℝ) (n d : ℕ) (q : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hb : 0 < rareMass η n q) (hq : 0 < q) (hslice : RareArrivalSlice n q) {π₀ π₁ : Measure ℝ} (h₀ : FiniteReciprocalPrior (lowerEndpoint n q) π₀) (h₁ : FiniteReciprocalPrior (lowerEndpoint n q) π₁) (K : ℕ) (hm : ∀ v : ℕ, v ≤ K → (∫ z, z ^ v ∂π₀) = ∫ z, z ^ v ∂π₁) (M : ℕ) (hM : 1 ≤ M) (j j' : Fin (M + 1)) (s : Fin n → Bool × ObsRecord d) (hcount : ∀ x : Fin d, x.val < rareCount η n d q → (∑ i ∈ Finset.univ.filter (fun i => (s i).2.X = x), if (s i).1 then 1 else 0) ≤ K) : (∫ z, (activatedAugmentedSample η n d q z).real {s} ∂Measure.pi (fun _ : Fin d => intervalInterpolatedPrior π₀ π₁ ((j : ℝ) / M))) = ∫ z, (activatedAugmentedSample η n d q z).real {s} ∂Measure.pi (fun _ : Fin d => intervalInterpolatedPrior π₀ π₁ ((j' : ℝ) / M)) := by have hgrid := intervalInterpolatedPrior_grid h₀ h₁ K hm M hM exact activatedAugmentedSample_prior_singleton_eq η n d q hn hd hb hq hslice (hgrid j).1 (hgrid j').1 K ((hgrid j).2.1 j') s hcount
CausalSmith.Stat.MarRareqLogfrontier.activatedAugmentedSample_grid_singleton_eq · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationSampleMass.lean:165
theorem activation_good_event_real_eq Lemma activation_good_event_real_eq in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
G A :
Set Ω
hatom :
∀ s ∈ G, μ.real {s} = ν.real {s}
μ.real (A ∩ G) = ν.real (A ∩ G)
Proof (Lean source)
-- @node: activation_good_event_real_eq lemma activation_good_event_real_eq {Ω : Type*} [Fintype Ω] [MeasurableSpace Ω] [MeasurableSingletonClass Ω] (μ ν : Measure Ω) [IsProbabilityMeasure μ] [IsProbabilityMeasure ν] (G A : Set Ω) (hatom : ∀ s ∈ G, μ.real {s} = ν.real {s}) : μ.real (A ∩ G) = ν.real (A ∩ G) := by classical rw [← Set.coe_toFinset (A ∩ G), ← sum_measureReal_singleton, ← sum_measureReal_singleton] exact Finset.sum_congr rfl (fun s hs => hatom s (Set.mem_toFinset.mp hs).2)
CausalSmith.Stat.MarRareqLogfrontier.activation_good_event_real_eq · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationSampleMass.lean:187
theorem activation_tv_le_bad_event Lemma activation_tv_le_bad_event in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
G :
Set Ω
hatom :
∀ s ∈ G, μ.real {s} = ν.real {s}
tvDist μ ν ≤ μ.real Gᶜ
Proof (Lean source)
-- @node: activation_tv_le_bad_event lemma activation_tv_le_bad_event {Ω : Type*} [Fintype Ω] [MeasurableSpace Ω] [MeasurableSingletonClass Ω] (μ ν : Measure Ω) [IsProbabilityMeasure μ] [IsProbabilityMeasure ν] (G : Set Ω) (hatom : ∀ s ∈ G, μ.real {s} = ν.real {s}) : tvDist μ ν ≤ μ.real Gᶜ := by classical have hG : MeasurableSet G := G.toFinite.measurableSet have hgood : μ.real G = ν.real G := by simpa using activation_good_event_real_eq μ ν G Set.univ hatom have hbad : μ.real Gᶜ = ν.real Gᶜ := by rw [measureReal_compl hG, measureReal_compl hG, probReal_univ, probReal_univ, hgood] unfold tvDist apply ciSup_le rintro ⟨A, hA⟩ have hsplit (ρ : Measure Ω) [IsProbabilityMeasure ρ] : ρ.real A = ρ.real (A ∩ G) + ρ.real (A ∩ Gᶜ) := by rw [← measureReal_union (Set.disjoint_left.mpr (by intro s hs ht exact ht.2 hs.2)) (hA.inter hG.compl)] congr 1 exact (Set.inter_union_compl A G).symm rw [hsplit μ, hsplit ν, activation_good_event_real_eq μ ν G A hatom] have hμ := measureReal_mono (μ := μ) (Set.inter_subset_right : A ∩ Gᶜ ⊆ Gᶜ) have hν := measureReal_mono (μ := ν) (Set.inter_subset_right : A ∩ Gᶜ ⊆ Gᶜ) rw [← hbad] at hν have hμ0 : 0 ≤ μ.real (A ∩ Gᶜ) := measureReal_nonneg have hν0 : 0 ≤ ν.real (A ∩ Gᶜ) := measureReal_nonneg rw [abs_le] constructor <;> linarith
CausalSmith.Stat.MarRareqLogfrontier.activation_tv_le_bad_event · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationSampleMass.lean:199
theorem activation_projected_tv_le_bad_event Lemma activation_projected_tv_le_bad_event in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
G :
Set Ω
hatom :
∀ s ∈ G, μ.real {s} = ν.real {s}
f :
Ω → Ξ
hf :
tvDist (μ.map f) (ν.map f) ≤ μ.real Gᶜ
Proof (Lean source)
-- @node: activation_projected_tv_le_bad_event lemma activation_projected_tv_le_bad_event {Ω Ξ : Type*} [Fintype Ω] [MeasurableSpace Ω] [MeasurableSingletonClass Ω] [MeasurableSpace Ξ] (μ ν : Measure Ω) [IsProbabilityMeasure μ] [IsProbabilityMeasure ν] (G : Set Ω) (hatom : ∀ s ∈ G, μ.real {s} = ν.real {s}) (f : Ω → Ξ) (hf : Measurable f) : tvDist (μ.map f) (ν.map f) ≤ μ.real Gᶜ := by have htv := activation_tv_le_bad_event μ ν G hatom unfold tvDist apply ciSup_le rintro ⟨A, hA⟩ rw [map_measureReal_apply hf hA, map_measureReal_apply hf hA] exact (abs_measureReal_sub_le_tvDist (hf hA)).trans htv
CausalSmith.Stat.MarRareqLogfrontier.activation_projected_tv_le_bad_event · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationSampleMass.lean:232
theorem activatedAugmentedSample_grid_tv_le_bad_event

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
η :
ℝ
n d :
ℕ
q :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hb :
0 < rareMass η n q
hq :
0 < q
hslice :
π₀ π₁ :
K :
ℕ
hm :
∀ v : ℕ
if
v ≤ K
then
(∫ z, z ^ v ∂π₀) = ∫ z, z ^ v ∂π₁
M :
ℕ
hM :
1 ≤ M
j j' :
Fin (M + 1)
hQ :
∀ s,
Q.real {s}
= ∫ z, (activatedAugmentedSample η n d q z).real {s} ∂Measure.pi (fun _ : Fin d => intervalInterpolatedPrior π₀ π₁ ((j : ℝ) / M))
hQ' :
∀ s,
Q'.real {s}
= ∫ z, (activatedAugmentedSample η n d q z).real {s} ∂Measure.pi (fun _ : Fin d => intervalInterpolatedPrior π₀ π₁ ((j' : ℝ) / M))
tvDist Q Q'
≤ Q.real {s | ¬ ∀ x : Fin d, x.val < rareCount η n d q → (∑ i ∈ Finset.univ.filter (fun i => (s i).2.X = x), if (s i).1 then 1 else 0) ≤ K}
Proof (Lean source)
-- @node: activatedAugmentedSample_grid_tv_le_bad_event lemma activatedAugmentedSample_grid_tv_le_bad_event (η : ℝ) (n d : ℕ) (q : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hb : 0 < rareMass η n q) (hq : 0 < q) (hslice : RareArrivalSlice n q) {π₀ π₁ : Measure ℝ} (h₀ : FiniteReciprocalPrior (lowerEndpoint n q) π₀) (h₁ : FiniteReciprocalPrior (lowerEndpoint n q) π₁) (K : ℕ) (hm : ∀ v : ℕ, v ≤ K → (∫ z, z ^ v ∂π₀) = ∫ z, z ^ v ∂π₁) (M : ℕ) (hM : 1 ≤ M) (j j' : Fin (M + 1)) (Q Q' : Measure (Fin n → Bool × ObsRecord d)) [IsProbabilityMeasure Q] [IsProbabilityMeasure Q'] (hQ : ∀ s, Q.real {s} = ∫ z, (activatedAugmentedSample η n d q z).real {s} ∂Measure.pi (fun _ : Fin d => intervalInterpolatedPrior π₀ π₁ ((j : ℝ) / M))) (hQ' : ∀ s, Q'.real {s} = ∫ z, (activatedAugmentedSample η n d q z).real {s} ∂Measure.pi (fun _ : Fin d => intervalInterpolatedPrior π₀ π₁ ((j' : ℝ) / M))) : tvDist Q Q' ≤ Q.real {s | ¬ ∀ x : Fin d, x.val < rareCount η n d q → (∑ i ∈ Finset.univ.filter (fun i => (s i).2.X = x), if (s i).1 then 1 else 0) ≤ K} := by apply activation_tv_le_bad_event intro s hs rw [hQ s, hQ' s] exact activatedAugmentedSample_grid_singleton_eq η n d q hn hd hb hq hslice h₀ h₁ K hm M hM j j' s hs
CausalSmith.Stat.MarRareqLogfrontier.activatedAugmentedSample_grid_tv_le_bad_event · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationSampleMass.lean:247
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.Lower.ActivationTail 11 declarations Reduction of the actual activation-cutoff probability to a finite union under the parameter-independent iid membership, arm and flag distribution.

Reduction of the actual activation-cutoff probability to a finite union under the parameter-independent iid membership, arm and flag distribution. These identities isolate the binomial tail calculation in equation (6).

theorem activated_sample_membership_activation_event

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
η :
ℝ
n d :
ℕ
q :
ℝ
z :
Fin d → ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hb :
0 < rareMass η n q
hq :
0 < q
hslice :
hz :
∀ x, z x ∈ Icc (1 : ℝ) (lowerEndpoint n q)
A :
Set (Fin n → Fin d × Bool × Bool)
(Measure.pi (fun _ : Fin n => augmentedOneRecord η n d q z hz)).real {s | (fun i => ((s i).2.X, (s i).2.A, (s i).1)) ∈ A}
= (Measure.pi (fun _ : Fin n => ∑ x : Fin d, ∑ a : Bool, ∑ flag : Bool, ofReal (baselineMass η n d q x / 2 * bernWeight (q * lowerEndpoint n q) flag) • Measure.dirac (x, a, flag))).real A
Proof (Lean source)
-- @node: activated_sample_membership_activation_event lemma activated_sample_membership_activation_event (η : ℝ) (n d : ℕ) (q : ℝ) (z : Fin d → ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hb : 0 < rareMass η n q) (hq : 0 < q) (hslice : RareArrivalSlice n q) (hz : ∀ x, z x ∈ Icc (1 : ℝ) (lowerEndpoint n q)) (A : Set (Fin n → Fin d × Bool × Bool)) : (Measure.pi (fun _ : Fin n => augmentedOneRecord η n d q z hz)).real {s | (fun i => ((s i).2.X, (s i).2.A, (s i).1)) ∈ A} = (Measure.pi (fun _ : Fin n => ∑ x : Fin d, ∑ a : Bool, ∑ flag : Bool, ofReal (baselineMass η n d q x / 2 * bernWeight (q * lowerEndpoint n q) flag) • Measure.dirac (x, a, flag))).real A := by have hf : Measurable (fun s : Fin n → Bool × ObsRecord d => fun i => ((s i).2.X, (s i).2.A, (s i).1)) := by fun_prop rw [← activated_sample_membership_activation_map η n d q z hn hd hb hq hslice hz, map_measureReal_apply hf (MeasurableSet.of_discrete)] rfl
CausalSmith.Stat.MarRareqLogfrontier.activated_sample_membership_activation_event · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationTail.lean:20
theorem activatedAugmentedMixture_membership_activation_event

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
η :
ℝ
n d :
ℕ
q :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hb :
0 < rareMass η n q
hq :
0 < q
hslice :
π :
A :
Set (Fin n → Fin d × Bool × Bool)
(activatedAugmentedMixture η n d q π).real {s | (fun i => ((s i).2.X, (s i).2.A, (s i).1)) ∈ A}
= (Measure.pi (fun _ : Fin n => ∑ x : Fin d, ∑ a : Bool, ∑ flag : Bool, ofReal (baselineMass η n d q x / 2 * bernWeight (q * lowerEndpoint n q) flag) • Measure.dirac (x, a, flag))).real A
Proof (Lean source)
-- @node: activatedAugmentedMixture_membership_activation_event lemma activatedAugmentedMixture_membership_activation_event (η : ℝ) (n d : ℕ) (q : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hb : 0 < rareMass η n q) (hq : 0 < q) (hslice : RareArrivalSlice n q) {π : Measure ℝ} (hπ : FiniteReciprocalPrior (lowerEndpoint n q) π) (A : Set (Fin n → Fin d × Bool × Bool)) : (activatedAugmentedMixture η n d q π).real {s | (fun i => ((s i).2.X, (s i).2.A, (s i).1)) ∈ A} = (Measure.pi (fun _ : Fin n => ∑ x : Fin d, ∑ a : Bool, ∑ flag : Bool, ofReal (baselineMass η n d q x / 2 * bernWeight (q * lowerEndpoint n q) flag) • Measure.dirac (x, a, flag))).real A := by let := hπ.1 rw [activatedAugmentedMixture_real_event η n d q hn hd hb hq hslice hπ] calc _ = ∫ _z : Fin d → ℝ, (Measure.pi (fun _ : Fin n => ∑ x : Fin d, ∑ a : Bool, ∑ flag : Bool, ofReal (baselineMass η n d q x / 2 * bernWeight (q * lowerEndpoint n q) flag) • Measure.dirac (x, a, flag))).real A ∂Measure.pi (fun _ : Fin d => π) := by apply integral_congr_ae filter_upwards [finiteReciprocalPrior_pi_ae_support hπ d] with z hz rw [activatedAugmentedSample, dif_pos hz] exact activated_sample_membership_activation_event η n d q z hn hd hb hq hslice hz A _ = _ := by simp
CausalSmith.Stat.MarRareqLogfrontier.activatedAugmentedMixture_membership_activation_event · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationTail.lean:39
theorem activatedAugmentedMixture_cutoff_probability

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
η :
ℝ
n d K :
ℕ
q :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hb :
0 < rareMass η n q
hq :
0 < q
hslice :
π :
(activatedAugmentedMixture η n d q π).real {s | ¬ ∀ x : Fin d, x.val < rareCount η n d q → (∑ i ∈ Finset.univ.filter (fun i => (s i).2.X = x), if (s i).1 then 1 else 0) ≤ K}
= (Measure.pi (fun _ : Fin n => ∑ x : Fin d, ∑ a : Bool, ∑ flag : Bool, ofReal (baselineMass η n d q x / 2 * bernWeight (q * lowerEndpoint n q) flag) • Measure.dirac (x, a, flag))).real {s | ¬ ∀ x : Fin d, x.val < rareCount η n d q → (∑ i ∈ Finset.univ.filter (fun i => (s i).1 = x), if (s i).2.2 then 1 else 0) ≤ K}
Proof (Lean source)
-- @node: activatedAugmentedMixture_cutoff_probability lemma activatedAugmentedMixture_cutoff_probability (η : ℝ) (n d K : ℕ) (q : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hb : 0 < rareMass η n q) (hq : 0 < q) (hslice : RareArrivalSlice n q) {π : Measure ℝ} (hπ : FiniteReciprocalPrior (lowerEndpoint n q) π) : (activatedAugmentedMixture η n d q π).real {s | ¬ ∀ x : Fin d, x.val < rareCount η n d q → (∑ i ∈ Finset.univ.filter (fun i => (s i).2.X = x), if (s i).1 then 1 else 0) ≤ K} = (Measure.pi (fun _ : Fin n => ∑ x : Fin d, ∑ a : Bool, ∑ flag : Bool, ofReal (baselineMass η n d q x / 2 * bernWeight (q * lowerEndpoint n q) flag) • Measure.dirac (x, a, flag))).real {s | ¬ ∀ x : Fin d, x.val < rareCount η n d q → (∑ i ∈ Finset.univ.filter (fun i => (s i).1 = x), if (s i).2.2 then 1 else 0) ≤ K} := by exact activatedAugmentedMixture_membership_activation_event η n d q hn hd hb hq hslice hπ {s | ¬ ∀ x : Fin d, x.val < rareCount η n d q → (∑ i ∈ Finset.univ.filter (fun i => (s i).1 = x), if (s i).2.2 then 1 else 0) ≤ K}
CausalSmith.Stat.MarRareqLogfrontier.activatedAugmentedMixture_cutoff_probability · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationTail.lean:67
theorem activation_cutoff_union_bound Lemma activation_cutoff_union_bound in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
η :
ℝ
n d K :
ℕ
q ε :
ℝ
μ :
Measure (Fin n → Fin d × Bool × Bool)
htail :
∀ x : Fin d
if
x.val < rareCount η n d q
then
μ.real {s | K < (∑ i ∈ Finset.univ.filter (fun i => (s i).1 = x), if (s i).2.2 then 1 else 0)}
≤ ε
μ.real {s | ¬ ∀ x : Fin d, x.val < rareCount η n d q → (∑ i ∈ Finset.univ.filter (fun i => (s i).1 = x), if (s i).2.2 then 1 else 0) ≤ K}
≤ (rareCount η n d q : ℝ) * ε
Proof (Lean source)
-- @node: activation_cutoff_union_bound lemma activation_cutoff_union_bound (η : ℝ) (n d K : ℕ) (q ε : ℝ) (μ : Measure (Fin n → Fin d × Bool × Bool)) (htail : ∀ x : Fin d, x.val < rareCount η n d q → μ.real {s | K < (∑ i ∈ Finset.univ.filter (fun i => (s i).1 = x), if (s i).2.2 then 1 else 0)} ≤ ε) : μ.real {s | ¬ ∀ x : Fin d, x.val < rareCount η n d q → (∑ i ∈ Finset.univ.filter (fun i => (s i).1 = x), if (s i).2.2 then 1 else 0) ≤ K} ≤ (rareCount η n d q : ℝ) * ε := by classical have hJ : rareCount η n d q ≤ d := (min_le_left _ _).trans (sub_le d 1) let cell : Fin (rareCount η n d q) → Fin d := fun x => ⟨x.val, lt_of_lt_of_le x.isLt hJ⟩ let E (x : Fin (rareCount η n d q)) : Set (Fin n → Fin d × Bool × Bool) := {s | K < (∑ i ∈ Finset.univ.filter (fun i => (s i).1 = cell x), if (s i).2.2 then 1 else 0)} have heq : {s | ¬ ∀ x : Fin d, x.val < rareCount η n d q → (∑ i ∈ Finset.univ.filter (fun i => (s i).1 = x), if (s i).2.2 then 1 else 0) ≤ K} = ⋃ x, E x := by ext s simp only [Set.mem_ofPred_eq, not_forall, not_le, Set.mem_iUnion] constructor · rintro ⟨x, hx, hcount⟩ exact ⟨⟨x.val, hx⟩, hcount⟩ · rintro ⟨x, hx⟩ exact ⟨cell x, x.isLt, hx⟩ rw [heq] calc _ ≤ ∑ x, μ.real (E x) := measureReal_iUnion_fintype_le E _ ≤ ∑ _x : Fin (rareCount η n d q), ε := Finset.sum_le_sum (fun x _ => htail (cell x) x.isLt) _ = _ := by simp
CausalSmith.Stat.MarRareqLogfrontier.activation_cutoff_union_bound · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationTail.lean:89
theorem activation_event_descFactorial_eq_weighted Lemma activation_event_descFactorial_eq_weighted in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
X :
A :
Set X
n K :
ℕ
s :
Fin n → X
((eventCount (fixedSizeEmbed n s) A).descFactorial (K + 1) : ℝ)
= weightedFactorial A A (K + 1) (fixedSizeEmbed n s)
Proof (Lean source)
-- @node: activation_event_descFactorial_eq_weighted lemma activation_event_descFactorial_eq_weighted {X : Type*} [MeasurableSpace X] (A : Set X) (n K : ℕ) (s : Fin n → X) : ((eventCount (fixedSizeEmbed n s) A).descFactorial (K + 1) : ℝ) = weightedFactorial A A (K + 1) (fixedSizeEmbed n s) := by unfold weightedFactorial simp only [Nat.add_sub_cancel] generalize eventCount (fixedSizeEmbed n s) A = c cases c with | zero => simp | succ c => rw [Nat.succ_descFactorial_succ] simp only [Nat.add_sub_cancel, Nat.cast_mul]
CausalSmith.Stat.MarRareqLogfrontier.activation_event_descFactorial_eq_weighted · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationTail.lean:123
theorem activation_event_descFactorial_integral Lemma activation_event_descFactorial_integral in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
X :
A :
Set X
hA :
n K :
ℕ
(∫ s : Fin n → X, ((eventCount (fixedSizeEmbed n s) A).descFactorial (K + 1) : ℝ) ∂Measure.pi (fun _ : Fin n => P))
= (n.descFactorial (K + 1) : ℝ) * P.real A ^ (K + 1)
Proof (Lean source)
-- @node: activation_event_descFactorial_integral lemma activation_event_descFactorial_integral {X : Type*} [MeasurableSpace X] (P : Measure X) [IsProbabilityMeasure P] (A : Set X) (hA : MeasurableSet A) (n K : ℕ) : (∫ s : Fin n → X, ((eventCount (fixedSizeEmbed n s) A).descFactorial (K + 1) : ℝ) ∂Measure.pi (fun _ : Fin n => P)) = (n.descFactorial (K + 1) : ℝ) * P.real A ^ (K + 1) := by simp_rw [activation_event_descFactorial_eq_weighted] rw [integral_weightedFactorial_fixedCount P A A hA hA (Subset.rfl) (K + 1) n (by omega)] simp only [Nat.add_sub_cancel, Measure.real, pow_succ] ring
CausalSmith.Stat.MarRareqLogfrontier.activation_event_descFactorial_integral · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationTail.lean:143
theorem activation_event_factorial_tail Lemma activation_event_factorial_tail in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
A :
Set X
hA :
n K :
ℕ
(Measure.pi (fun _ : Fin n => P)).real {s | K < eventCount (fixedSizeEmbed n s) A}
≤ ((n : ℝ) * P.real A) ^ (K + 1) / ((K + 1).factorial : ℝ)
Proof (Lean source)
-- @node: activation_event_factorial_tail lemma activation_event_factorial_tail {X : Type*} [MeasurableSpace X] [MeasurableSingletonClass X] [Finite X] (P : Measure X) [IsProbabilityMeasure P] (A : Set X) (hA : MeasurableSet A) (n K : ℕ) : (Measure.pi (fun _ : Fin n => P)).real {s | K < eventCount (fixedSizeEmbed n s) A} ≤ ((n : ℝ) * P.real A) ^ (K + 1) / ((K + 1).factorial : ℝ) := by let μ := Measure.pi (fun _ : Fin n => P) let f (s : Fin n → X) : ℝ := ((eventCount (fixedSizeEmbed n s) A).descFactorial (K + 1) : ℝ) have hsubset : {s | K < eventCount (fixedSizeEmbed n s) A} ⊆ {s | ((K + 1).factorial : ℝ) ≤ f s} := by intro s hs have h := Nat.descFactorial_le (K + 1) (succ_le_of_lt hs) rw [Nat.descFactorial_self] at h change ((K + 1).factorial : ℝ) ≤ ((eventCount (fixedSizeEmbed n s) A).descFactorial (K + 1) : ℝ) exact_mod_cast h have hmarkov := mul_meas_ge_le_integral_of_nonneg (μ := μ) (Filter.Eventually.of_forall fun s => (Nat.cast_nonneg _ : 0 ≤ f s)) (Integrable.of_finite : Integrable f μ) ((K + 1).factorial : ℝ) have hmono := measureReal_mono (μ := μ) hsubset have hfac : (0 : ℝ) < ((K + 1).factorial : ℝ) := by positivity apply (le_div_iff₀ hfac).mpr have hmoment := activation_event_descFactorial_integral P A hA n K have hpow : (n.descFactorial (K + 1) : ℝ) ≤ (n : ℝ) ^ (K + 1) := by exact_mod_cast Nat.descFactorial_le_pow n (K + 1) have hbound : (∫ s, f s ∂μ) ≤ ((n : ℝ) * P.real A) ^ (K + 1) := by rw [show (∫ s, f s ∂μ) = (n.descFactorial (K + 1) : ℝ) * P.real A ^ (K + 1) from hmoment, mul_pow] exact mul_le_mul_of_nonneg_right hpow (by positivity) exact (by nlinarith : _ ≤ ∫ s, f s ∂μ).trans hbound
CausalSmith.Stat.MarRareqLogfrontier.activation_event_factorial_tail · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationTail.lean:159
theorem activation_count_eq_eventCount Lemma activation_count_eq_eventCount in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
x :
Fin d
s :
Fin n → Fin d × Bool × Bool
(∑ i ∈ Finset.univ.filter (fun i => (s i).1 = x), if (s i).2.2 then 1 else 0)
= eventCount (fixedSizeEmbed n s) {r | r.1 = x ∧ r.2.2 = true}
Proof (Lean source)
-- @node: activation_count_eq_eventCount lemma activation_count_eq_eventCount (n d : ℕ) (x : Fin d) (s : Fin n → Fin d × Bool × Bool) : (∑ i ∈ Finset.univ.filter (fun i => (s i).1 = x), if (s i).2.2 then 1 else 0) = eventCount (fixedSizeEmbed n s) {r | r.1 = x ∧ r.2.2 = true} := by classical unfold eventCount fixedSizeEmbed FiniteSample.count FiniteSample.points simp only [Finset.sum_boole, Finset.filter_filter, Set.mem_ofPred_eq, Nat.cast_id]
CausalSmith.Stat.MarRareqLogfrontier.activation_count_eq_eventCount · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationTail.lean:199
theorem activation_membership_flag_probability

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
η :
ℝ
n d :
ℕ
q :
ℝ
hb :
0 < rareMass η n q
hq :
0 < q
hslice :
x :
Fin d
(∑ y : Fin d, ∑ a : Bool, ∑ flag : Bool, ofReal (baselineMass η n d q y / 2 * bernWeight (q * lowerEndpoint n q) flag) • Measure.dirac (y, a, flag)).real {r | r.1 = x ∧ r.2.2 = true}
= baselineMass η n d q x * (q * lowerEndpoint n q)
Proof (Lean source)
-- @node: activation_membership_flag_probability lemma activation_membership_flag_probability (η : ℝ) (n d : ℕ) (q : ℝ) (hb : 0 < rareMass η n q) (hq : 0 < q) (hslice : RareArrivalSlice n q) (x : Fin d) : (∑ y : Fin d, ∑ a : Bool, ∑ flag : Bool, ofReal (baselineMass η n d q y / 2 * bernWeight (q * lowerEndpoint n q) flag) • Measure.dirac (y, a, flag)).real {r | r.1 = x ∧ r.2.2 = true} = baselineMass η n d q x * (q * lowerEndpoint n q) := by classical have hb0 := baselineMass_nonneg η n d q hb x have hH : 0 ≤ q * lowerEndpoint n q := by unfold lowerEndpoint positivity have hweight : 0 ≤ baselineMass η n d q x / 2 * (q * lowerEndpoint n q) := mul_nonneg (div_nonneg hb0 (by norm_num)) hH have hevent : MeasurableSet {r : Fin d × Bool × Bool | r.1 = x ∧ r.2.2 = true} := MeasurableSet.of_discrete simp only [Measure.real] simp [bernWeight, indicator] rw [Finset.sum_add_distrib] simp only [Finset.sum_ite_eq', Finset.mem_univ, if_true, ENNReal.toReal_add ENNReal.ofReal_ne_top ENNReal.ofReal_ne_top, ENNReal.toReal_ofReal hweight] ring
CausalSmith.Stat.MarRareqLogfrontier.activation_membership_flag_probability · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationTail.lean:215
theorem activation_membership_flag_isProbabilityMeasure

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
η :
ℝ
n d :
ℕ
q :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hb :
0 < rareMass η n q
hq :
0 < q
hslice :
IsProbabilityMeasure (∑ x : Fin d, ∑ a : Bool, ∑ flag : Bool, ofReal (baselineMass η n d q x / 2 * bernWeight (q * lowerEndpoint n q) flag) • Measure.dirac (x, a, flag))
Proof (Lean source)
-- @node: activation_membership_flag_isProbabilityMeasure lemma activation_membership_flag_isProbabilityMeasure (η : ℝ) (n d : ℕ) (q : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hb : 0 < rareMass η n q) (hq : 0 < q) (hslice : RareArrivalSlice n q) : IsProbabilityMeasure (∑ x : Fin d, ∑ a : Bool, ∑ flag : Bool, ofReal (baselineMass η n d q x / 2 * bernWeight (q * lowerEndpoint n q) flag) • Measure.dirac (x, a, flag)) := by have hz : ∀ x : Fin d, (fun _ : Fin d => (1 : ℝ)) x ∈ Icc (1 : ℝ) (lowerEndpoint n q) := fun _ => ⟨le_rfl, lowerEndpoint_one_le n q hq.le⟩ let := augmentedOneRecord_isProbabilityMeasure η n d q (fun _ => 1) hn hd hb hq hslice hz rw [← augmentedOneRecord_membership_activation_map η n d q (fun _ => 1) hz] exact Measure.isProbabilityMeasure_map (by fun_prop)
CausalSmith.Stat.MarRareqLogfrontier.activation_membership_flag_isProbabilityMeasure · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationTail.lean:241
theorem activatedAugmentedMixture_factorial_cutoff_bound

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
η :
ℝ
n d K :
ℕ
q :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hb :
0 < rareMass η n q
hq :
0 < q
hslice :
π :
(activatedAugmentedMixture η n d q π).real {s | ¬ ∀ x : Fin d, x.val < rareCount η n d q → (∑ i ∈ Finset.univ.filter (fun i => (s i).2.X = x), if (s i).1 then 1 else 0) ≤ K}
≤ (rareCount η n d q : ℝ) * (((n : ℝ) * (rareMass η n q * (q * lowerEndpoint n q))) ^ (K + 1) / ((K + 1).factorial : ℝ))
Proof (Lean source)
-- @node: activatedAugmentedMixture_factorial_cutoff_bound lemma activatedAugmentedMixture_factorial_cutoff_bound (η : ℝ) (n d K : ℕ) (q : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hb : 0 < rareMass η n q) (hq : 0 < q) (hslice : RareArrivalSlice n q) {π : Measure ℝ} (hπ : FiniteReciprocalPrior (lowerEndpoint n q) π) : (activatedAugmentedMixture η n d q π).real {s | ¬ ∀ x : Fin d, x.val < rareCount η n d q → (∑ i ∈ Finset.univ.filter (fun i => (s i).2.X = x), if (s i).1 then 1 else 0) ≤ K} ≤ (rareCount η n d q : ℝ) * (((n : ℝ) * (rareMass η n q * (q * lowerEndpoint n q))) ^ (K + 1) / ((K + 1).factorial : ℝ)) := by let P : Measure (Fin d × Bool × Bool) := ∑ x : Fin d, ∑ a : Bool, ∑ flag : Bool, ofReal (baselineMass η n d q x / 2 * bernWeight (q * lowerEndpoint n q) flag) • Measure.dirac (x, a, flag) let : IsProbabilityMeasure P := activation_membership_flag_isProbabilityMeasure η n d q hn hd hb hq hslice rw [activatedAugmentedMixture_cutoff_probability η n d K q hn hd hb hq hslice hπ] apply activation_cutoff_union_bound intro x hx simp_rw [activation_count_eq_eventCount] have htail := activation_event_factorial_tail P {r | r.1 = x ∧ r.2.2 = true} (MeasurableSet.of_discrete) n K have hprob : P.real {r | r.1 = x ∧ r.2.2 = true} = rareMass η n q * (q * lowerEndpoint n q) := by rw [activation_membership_flag_probability η n d q hb hq hslice x] simp [baselineMass, hx] simpa only [hprob] using htail
CausalSmith.Stat.MarRareqLogfrontier.activatedAugmentedMixture_factorial_cutoff_bound · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationTail.lean:257
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.Lower.ActivationTarget 8 declarations The activated full-data target is the rare-cell reciprocal sum used in equations (7)--(8) of the connected-interval lower bound.

The activated full-data target is the rare-cell reciprocal sum used in equations (7)--(8) of the connected-interval lower bound.

theorem activation_sum_initial_cells Lemma activation_sum_initial_cells in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d J :
ℕ
hJ :
J ≤ d
f :
Fin d → ℝ
(∑ x : Fin d, if x.val < J then f x else 0) = ∑ x : Fin J, f (x.castLE hJ)
Proof (Lean source)
-- @node: activation_sum_initial_cells lemma activation_sum_initial_cells (d J : ℕ) (hJ : J ≤ d) (f : Fin d → ℝ) : (∑ x : Fin d, if x.val < J then f x else 0) = ∑ x : Fin J, f (x.castLE hJ) := by classical rw [← Finset.sum_filter] symm apply Finset.sum_bij (fun x _ => x.castLE hJ) · intro x hx simp [x.isLt] · intro x hx y hy hxy apply Fin.ext exact congrArg (fun t : Fin d => t.val) hxy · intro y hy have hyl : y.val < J := (Finset.mem_filter.mp hy).2 exact ⟨⟨y.val, hyl⟩, Finset.mem_univ _, Fin.ext rfl⟩ · intro x hx rfl
CausalSmith.Stat.MarRareqLogfrontier.activation_sum_initial_cells · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationTarget.lean:16

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
η :
ℝ
n d :
ℕ
q :
ℝ
hd :
1 ≤ d
(∑ x : Fin d, baselineMass η n d q x) = 1
Proof (Lean source)
-- @node: baselineMass_sum lemma baselineMass_sum (η : ℝ) (n d : ℕ) (q : ℝ) (hd : 1 ≤ d) : (∑ x : Fin d, baselineMass η n d q x) = 1 := by classical have hJ : rareCount η n d q < d := by have h := min_le_left (d - 1) (floor ((2 * rareMass η n q)⁻¹)) change rareCount η n d q ≤ d - 1 at h omega let reservoir : Fin d := ⟨rareCount η n d q, hJ⟩ have hsplit (x : Fin d) : baselineMass η n d q x = (if x.val < rareCount η n d q then rareMass η n q else 0) + (if x = reservoir then 1 - rareCount η n d q * rareMass η n q else 0) := by have heq : x = reservoir ↔ x.val = rareCount η n d q := by simp [reservoir, Fin.ext_iff] by_cases hl : x.val < rareCount η n d q · have hn : x.val ≠ rareCount η n d q := by omega simp [baselineMass, hl, heq, hn] · simp [baselineMass, hl, heq] simp_rw [hsplit] rw [Finset.sum_add_distrib, activation_sum_initial_cells d _ (le_of_lt hJ)] simp

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
η :
ℝ
n d :
ℕ
q :
ℝ
hb :
0 < rareMass η n q
x :
Fin d
0 ≤ baselineMass η n d q x
Proof (Lean source)
-- @node: baselineMass_nonneg lemma baselineMass_nonneg (η : ℝ) (n d : ℕ) (q : ℝ) (hb : 0 < rareMass η n q) (x : Fin d) : 0 ≤ baselineMass η n d q x := by have hmass := rareCount_mass_le_half η n d q hb unfold baselineMass split_ifs <;> linarith
theorem activatedLaw_weight_nonneg

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
η :
ℝ
n d :
ℕ
q :
ℝ
z :
Fin d → ℝ
hb :
0 < rareMass η n q
hq :
0 < q
hslice :
hz :
∀ x, z x ∈ Icc (1 : ℝ) (lowerEndpoint n q)
x :
Fin d
y arrival :
0
≤ baselineMass η n d q x / 2 * bernWeight (if x.val < rareCount η n d q then (z x)⁻¹ else 0) y * bernWeight (q * lowerCellZ η n d q z x) arrival
Proof (Lean source)
-- @node: activatedLaw_weight_nonneg lemma activatedLaw_weight_nonneg (η : ℝ) (n d : ℕ) (q : ℝ) (z : Fin d → ℝ) (hb : 0 < rareMass η n q) (hq : 0 < q) (hslice : RareArrivalSlice n q) (hz : ∀ x, z x ∈ Icc (1 : ℝ) (lowerEndpoint n q)) (x : Fin d) (y arrival : Bool) : 0 ≤ baselineMass η n d q x / 2 * bernWeight (if x.val < rareCount η n d q then (z x)⁻¹ else 0) y * bernWeight (q * lowerCellZ η n d q z x) arrival := by have hH : 0 ≤ lowerEndpoint n q := by unfold lowerEndpoint; positivity have hcell : 0 ≤ lowerCellZ η n d q z x ∧ lowerCellZ η n d q z x ≤ lowerEndpoint n q := by unfold lowerCellZ split_ifs <;> constructor <;> linarith [(hz x).1, (hz x).2] have hprob : 0 ≤ q * lowerCellZ η n d q z x ∧ q * lowerCellZ η n d q z x ≤ 1 := ⟨mul_nonneg hq.le hcell.1, (mul_le_mul_of_nonneg_left hcell.2 hq.le).trans (lower_activation_probability_le_one n q hq.le hslice)⟩ have hy : 0 ≤ (if x.val < rareCount η n d q then (z x)⁻¹ else 0) ∧ (if x.val < rareCount η n d q then (z x)⁻¹ else 0) ≤ 1 := by split_ifs · exact ⟨inv_nonneg.mpr (by linarith [(hz x).1]), inv_le_one_of_one_le₀ (hz x).1⟩ · norm_num have hbern (p : ℝ) (hp : 0 ≤ p ∧ p ≤ 1) (v : Bool) : 0 ≤ bernWeight p v := by cases v <;> simp [bernWeight] <;> linarith [hp.1, hp.2] exact mul_nonneg (mul_nonneg (div_nonneg (baselineMass_nonneg η n d q hb x) (by norm_num)) (hbern _ hy y)) (hbern _ hprob arrival)
CausalSmith.Stat.MarRareqLogfrontier.activatedLaw_weight_nonneg · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationTarget.lean:68
theorem activatedLaw_target_integral

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
η :
ℝ
n d :
ℕ
q :
ℝ
z :
Fin d → ℝ
hb :
0 < rareMass η n q
hq :
0 < q
hslice :
hz :
∀ x, z x ∈ Icc (1 : ℝ) (lowerEndpoint n q)
(∫ r : FullRecord d, ((if r.Y1 then (1 : ℝ) else 0) - (if r.Y0 then (1 : ℝ) else 0)) ∂activatedLaw η n d q z hz)
= rareMass η n q * ∑ x : Fin d, if x.val < rareCount η n d q then (z x)⁻¹ else 0
Proof (Lean source)
-- @node: activatedLaw_target_integral lemma activatedLaw_target_integral (η : ℝ) (n d : ℕ) (q : ℝ) (z : Fin d → ℝ) (hb : 0 < rareMass η n q) (hq : 0 < q) (hslice : RareArrivalSlice n q) (hz : ∀ x, z x ∈ Icc (1 : ℝ) (lowerEndpoint n q)) : (∫ r : FullRecord d, ((if r.Y1 then (1 : ℝ) else 0) - (if r.Y0 then (1 : ℝ) else 0)) ∂activatedLaw η n d q z hz) = rareMass η n q * ∑ x : Fin d, if x.val < rareCount η n d q then (z x)⁻¹ else 0 := by let f : FullRecord d → ℝ := fun r => (if r.Y1 then 1 else 0) - (if r.Y0 then 1 else 0) let μ (x : Fin d) (a y arrival : Bool) : Measure (FullRecord d) := ofReal (baselineMass η n d q x / 2 * bernWeight (if x.val < rareCount η n d q then (z x)⁻¹ else 0) y * bernWeight (q * lowerCellZ η n d q z x) arrival) • Measure.dirac (lowerFullRecord x a y arrival) have hInt (x : Fin d) (a y arrival : Bool) : Integrable f (μ x a y arrival) := (integrable_dirac (by simp)).smul_measure ENNReal.ofReal_ne_top have hIntY (x : Fin d) (a y : Bool) : Integrable f (∑ arrival, μ x a y arrival) := integrable_finsetSum_measure.mpr (fun arrival _ => hInt x a y arrival) have hIntA (x : Fin d) (a : Bool) : Integrable f (∑ y, ∑ arrival, μ x a y arrival) := integrable_finsetSum_measure.mpr (fun y _ => hIntY x a y) have hIntX (x : Fin d) : Integrable f (∑ a, ∑ y, ∑ arrival, μ x a y arrival) := integrable_finsetSum_measure.mpr (fun a _ => hIntA x a) change (∫ r, f r ∂(∑ x, ∑ a, ∑ y, ∑ arrival, μ x a y arrival)) = _ rw [integral_finsetSum_measure (fun x _ => hIntX x)] simp_rw [integral_finsetSum_measure (fun a _ => hIntA _ a), integral_finsetSum_measure (fun y _ => hIntY _ _ y), integral_finsetSum_measure (fun arrival _ => hInt _ _ _ arrival)] simp only [μ, integral_smul_measure, integral_dirac, smul_eq_mul] simp_rw [ENNReal.toReal_ofReal (activatedLaw_weight_nonneg η n d q z hb hq hslice hz _ _ _)] rw [Finset.mul_sum] apply Finset.sum_congr rfl intro x _ by_cases hr : x.val < rareCount η n d q · simp [f, lowerFullRecord, bernWeight, hr, baselineMass] ring · simp [f, lowerFullRecord, bernWeight, hr]
CausalSmith.Stat.MarRareqLogfrontier.activatedLaw_target_integral · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/ActivationTarget.lean:101
theorem activatedLaw_univ

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
η :
ℝ
n d :
ℕ
q :
ℝ
z :
Fin d → ℝ
hd :
1 ≤ d
hb :
0 < rareMass η n q
hq :
0 < q
hslice :
hz :
∀ x, z x ∈ Icc (1 : ℝ) (lowerEndpoint n q)
activatedLaw η n d q z hz univ = 1
Proof (Lean source)
-- @node: activatedLaw_univ lemma activatedLaw_univ (η : ℝ) (n d : ℕ) (q : ℝ) (z : Fin d → ℝ) (hd : 1 ≤ d) (hb : 0 < rareMass η n q) (hq : 0 < q) (hslice : RareArrivalSlice n q) (hz : ∀ x, z x ∈ Icc (1 : ℝ) (lowerEndpoint n q)) : activatedLaw η n d q z hz univ = 1 := by classical let w (x : Fin d) (y arrival : Bool) : ℝ := baselineMass η n d q x / 2 * bernWeight (if x.val < rareCount η n d q then (z x)⁻¹ else 0) y * bernWeight (q * lowerCellZ η n d q z x) arrival have hw (x : Fin d) (y arrival : Bool) : 0 ≤ w x y arrival := activatedLaw_weight_nonneg η n d q z hb hq hslice hz x y arrival have hcell (x : Fin d) : (∑ y : Bool, ∑ arrival : Bool, ofReal (w x y arrival)) = ofReal (baselineMass η n d q x / 2) := by simp_rw [← ENNReal.ofReal_sum_of_nonneg (fun arrival _ => hw x _ arrival)] rw [← ENNReal.ofReal_sum_of_nonneg (fun y _ => Finset.sum_nonneg (fun arrival _ => hw x y arrival))] congr 1 by_cases hr : x.val < rareCount η n d q <;> simp [w, bernWeight, hr] <;> ring simp only [activatedLaw, Measure.finsetSum_apply, Measure.smul_apply, Measure.dirac_apply_of_mem (Set.mem_univ _), smul_eq_mul, mul_one] change (∑ x : Fin d, ∑ _a : Bool, ∑ y : Bool, ∑ arrival : Bool, ofReal (w x y arrival)) = 1 simp_rw [hcell] have harm (x : Fin d) : (∑ _a : Bool, ofReal (baselineMass η n d q x / 2)) = ofReal (baselineMass η n d q x) := by rw [← ENNReal.ofReal_sum_of_nonneg (fun _ _ => div_nonneg (baselineMass_nonneg η n d q hb x) (by norm_num))] congr 1 simp only [Finset.sum_const, Finset.card_univ, Fintype.card_bool, nsmul_eq_mul, Nat.cast_ofNat] ring simp_rw [harm] rw [← ENNReal.ofReal_sum_of_nonneg (fun x _ => baselineMass_nonneg η n d q hb x), baselineMass_sum η n d q hd] norm_num
def activatedFullLaw

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
η :
ℝ
n d :
ℕ
q :
ℝ
z :
Fin d → ℝ
hd :
1 ≤ d
hb :
0 < rareMass η n q
hq :
0 < q
hslice :
hz :
∀ x, z x ∈ Icc (1 : ℝ) (lowerEndpoint n q)
activatedFullLaw η n d q z hd hb hq hslice hz :
⟨activatedLaw η n d q z hz, ⟨activatedLaw_univ η n d q z hd hb hq hslice hz⟩⟩
theorem activatedFullLaw_ate

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
η :
ℝ
n d :
ℕ
q :
ℝ
z :
Fin d → ℝ
hd :
1 ≤ d
hb :
0 < rareMass η n q
hq :
0 < q
hslice :
hz :
∀ x, z x ∈ Icc (1 : ℝ) (lowerEndpoint n q)
ate (activatedFullLaw η n d q z hd hb hq hslice hz)
= intervalPriorTarget (rareCount η n d q) (rareMass η n q) (fun x => z (x.castLE (show rareCount η n d q ≤ d from (min_le_left _ _).trans (sub_le d 1))))
Proof (Lean source)
-- @node: activatedFullLaw_ate lemma activatedFullLaw_ate (η : ℝ) (n d : ℕ) (q : ℝ) (z : Fin d → ℝ) (hd : 1 ≤ d) (hb : 0 < rareMass η n q) (hq : 0 < q) (hslice : RareArrivalSlice n q) (hz : ∀ x, z x ∈ Icc (1 : ℝ) (lowerEndpoint n q)) : ate (activatedFullLaw η n d q z hd hb hq hslice hz) = intervalPriorTarget (rareCount η n d q) (rareMass η n q) (fun x => z (x.castLE (show rareCount η n d q ≤ d from (min_le_left _ _).trans (sub_le d 1)))) := by change (∫ r : FullRecord d, ((if r.Y1 then (1 : ℝ) else 0) - (if r.Y0 then (1 : ℝ) else 0)) ∂activatedLaw η n d q z hz) = _ rw [activatedLaw_target_integral η n d q z hb hq hslice hz, activation_sum_initial_cells d (rareCount η n d q) (show rareCount η n d q ≤ d from (min_le_left _ _).trans (sub_le d 1)) (fun x => (z x)⁻¹)] rfl
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.Lower.FuzzyRisk 7 declarations Centered squared-risk comparison and variance absorption for equations (13)--(16) of the activated point-risk lower bound.

Centered squared-risk comparison and variance absorption for equations (13)--(16) of the activated point-risk lower bound.

theorem activatedRarePriorATE_mean_separation

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
η :
ℝ
n d :
ℕ
q :
ℝ
hd :
1 ≤ d
hb :
0 < rareMass η n q
hq :
0 < q
hslice :
π₀ π₁ :
hgap :
1 / 12 ≤ |(∫ z, z⁻¹ ∂π₁) - ∫ z, z⁻¹ ∂π₀|
(rareCount η n d q : ℝ) * rareMass η n q / 12
≤ |(∫ z, activatedRarePriorATE η n d q hd hb hq hslice z ∂Measure.pi (fun _ : Fin (rareCount η n d q) => π₁))
- (∫ z, activatedRarePriorATE η n d q hd hb hq hslice z ∂Measure.pi (fun _ : Fin (rareCount η n d q) => π₀))|
Proof (Lean source)
-- @node: activatedRarePriorATE_mean_separation lemma activatedRarePriorATE_mean_separation (η : ℝ) (n d : ℕ) (q : ℝ) (hd : 1 ≤ d) (hb : 0 < rareMass η n q) (hq : 0 < q) (hslice : RareArrivalSlice n q) {π₀ π₁ : Measure ℝ} (h₀ : FiniteReciprocalPrior (lowerEndpoint n q) π₀) (h₁ : FiniteReciprocalPrior (lowerEndpoint n q) π₁) (hgap : 1 / 12 ≤ |(∫ z, z⁻¹ ∂π₁) - ∫ z, z⁻¹ ∂π₀|) : (rareCount η n d q : ℝ) * rareMass η n q / 12 ≤ |(∫ z, activatedRarePriorATE η n d q hd hb hq hslice z ∂Measure.pi (fun _ : Fin (rareCount η n d q) => π₁)) - (∫ z, activatedRarePriorATE η n d q hd hb hq hslice z ∂Measure.pi (fun _ : Fin (rareCount η n d q) => π₀))| := by rw [activatedRarePriorATE_integral η n d q hd hb hq hslice h₁, activatedRarePriorATE_integral η n d q hd hb hq hslice h₀, ← mul_sub, abs_mul, abs_of_nonneg (mul_nonneg (Nat.cast_nonneg _) hb.le)] have h := mul_le_mul_of_nonneg_left hgap (mul_nonneg (Nat.cast_nonneg (rareCount η n d q)) hb.le) nlinarith [h]
CausalSmith.Stat.MarRareqLogfrontier.activatedRarePriorATE_mean_separation · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/FuzzyRisk.lean:15
theorem activated_centered_risk_le Lemma activated_centered_risk_le in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
Ω :
μ :
T τ :
Ω → ℝ
θ :
ℝ
herror :
Integrable (fun ω => (T ω - τ ω) ^ 2) μ
htarget :
Integrable (fun ω => (τ ω - θ) ^ 2) μ
hcenter :
Integrable (fun ω => (T ω - θ) ^ 2) μ
(∫ ω, (T ω - θ) ^ 2 ∂μ) ≤ 2 * (∫ ω, (T ω - τ ω) ^ 2 ∂μ) + 2 * (∫ ω, (τ ω - θ) ^ 2 ∂μ)
Proof (Lean source)
-- @node: activated_centered_risk_le lemma activated_centered_risk_le {Ω : Type*} [MeasurableSpace Ω] (μ : Measure Ω) (T τ : Ω → ℝ) (θ : ℝ) (herror : Integrable (fun ω => (T ω - τ ω) ^ 2) μ) (htarget : Integrable (fun ω => (τ ω - θ) ^ 2) μ) (hcenter : Integrable (fun ω => (T ω - θ) ^ 2) μ) : (∫ ω, (T ω - θ) ^ 2 ∂μ) ≤ 2 * (∫ ω, (T ω - τ ω) ^ 2 ∂μ) + 2 * (∫ ω, (τ ω - θ) ^ 2 ∂μ) := by calc _ ≤ ∫ ω, 2 * (T ω - τ ω) ^ 2 + 2 * (τ ω - θ) ^ 2 ∂μ := by apply integral_mono hcenter ((herror.const_mul 2).add (htarget.const_mul 2)) intro ω have h := add_sq_le (a := T ω - τ ω) (b := τ ω - θ) change (T ω - θ) ^ 2 ≤ 2 * (T ω - τ ω) ^ 2 + 2 * (τ ω - θ) ^ 2 nlinarith [h] _ = _ := by rw [integral_add (herror.const_mul 2) (htarget.const_mul 2), integral_const_mul, integral_const_mul]
CausalSmith.Stat.MarRareqLogfrontier.activated_centered_risk_le · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/FuzzyRisk.lean:36
theorem activated_error_probability_mul_sq_le_risk Lemma activated_error_probability_mul_sq_le_risk in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
Ω :
T :
Ω → ℝ
hT :
θ s :
ℝ
hs :
0 ≤ s
hint :
Integrable (fun ω => (T ω - θ) ^ 2) μ
μ.real {ω | s ≤ |T ω - θ|} * s ^ 2 ≤ ∫ ω, (T ω - θ) ^ 2 ∂μ
Proof (Lean source)
-- @node: activated_error_probability_mul_sq_le_risk lemma activated_error_probability_mul_sq_le_risk {Ω : Type*} [MeasurableSpace Ω] (μ : Measure Ω) [IsProbabilityMeasure μ] (T : Ω → ℝ) (hT : Measurable T) (θ s : ℝ) (hs : 0 ≤ s) (hint : Integrable (fun ω => (T ω - θ) ^ 2) μ) : μ.real {ω | s ≤ |T ω - θ|} * s ^ 2 ≤ ∫ ω, (T ω - θ) ^ 2 ∂μ := by classical let E := {ω | s ≤ |T ω - θ|} have hE : MeasurableSet E := by dsimp [E] have hm : Measurable (fun ω => |T ω - θ|) := by fun_prop exact measurableSet_le measurable_const hm have hmono := integral_mono ((integrable_const (s ^ 2)).indicator hE) hint (fun ω => by by_cases hω : ω ∈ E · rw [indicator_of_mem hω] have hmiss : s ≤ |T ω - θ| := hω simpa only [sq_abs] using (sq_le_sq₀ hs (abs_nonneg _)).2 hmiss · rw [indicator_of_notMem hω] exact sq_nonneg _) rw [integral_indicator_const _ hE] at hmono simpa only [smul_eq_mul] using hmono
CausalSmith.Stat.MarRareqLogfrontier.activated_error_probability_mul_sq_le_risk · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/FuzzyRisk.lean:56
theorem activated_center_testing_risk_lower Lemma activated_center_testing_risk_lower in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
Ω :
T :
Ω → ℝ
hT :
θ₀ θ₁ :
ℝ
h₀ :
Integrable (fun ω => (T ω - θ₀) ^ 2) Q₀
h₁ :
Integrable (fun ω => (T ω - θ₁) ^ 2) Q₁
|θ₁ - θ₀| ^ 2 / 8 * (1 - tvDist Q₀ Q₁)
≤ max (∫ ω, (T ω - θ₀) ^ 2 ∂Q₀) (∫ ω, (T ω - θ₁) ^ 2 ∂Q₁)
Proof (Lean source)
-- @node: activated_center_testing_risk_lower lemma activated_center_testing_risk_lower {Ω : Type*} [MeasurableSpace Ω] (Q₀ Q₁ : Measure Ω) [IsProbabilityMeasure Q₀] [IsProbabilityMeasure Q₁] (T : Ω → ℝ) (hT : Measurable T) (θ₀ θ₁ : ℝ) (h₀ : Integrable (fun ω => (T ω - θ₀) ^ 2) Q₀) (h₁ : Integrable (fun ω => (T ω - θ₁) ^ 2) Q₁) : |θ₁ - θ₀| ^ 2 / 8 * (1 - tvDist Q₀ Q₁) ≤ max (∫ ω, (T ω - θ₀) ^ 2 ∂Q₀) (∫ ω, (T ω - θ₁) ^ 2 ∂Q₁) := by let s := |θ₁ - θ₀| / 2 have hs : 0 ≤ s := by dsimp [s]; positivity have hsep : 2 * s ≤ |θ₀ - θ₁| := by dsimp [s]; rw [abs_sub_comm]; linarith have htest := real_two_point_lower_bound (P₀ := Q₀) (P₁ := Q₁) hT hsep have hr₀ := activated_error_probability_mul_sq_le_risk Q₀ T hT θ₀ s hs h₀ have hr₁ := activated_error_probability_mul_sq_le_risk Q₁ T hT θ₁ s hs h₁ have hmax : max (Q₀.real {ω | s ≤ |T ω - θ₀|}) (Q₁.real {ω | s ≤ |T ω - θ₁|}) * s ^ 2 ≤ max (∫ ω, (T ω - θ₀) ^ 2 ∂Q₀) (∫ ω, (T ω - θ₁) ^ 2 ∂Q₁) := by rw [max_mul_of_nonneg _ _ (sq_nonneg s)] exact max_le_max hr₀ hr₁ have h := (mul_le_mul_of_nonneg_right htest (sq_nonneg s)).trans hmax calc _ = (1 - tvDist Q₀ Q₁) / 2 * s ^ 2 := by dsimp [s]; ring _ ≤ _ := h
CausalSmith.Stat.MarRareqLogfrontier.activated_center_testing_risk_lower · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/FuzzyRisk.lean:80
theorem activated_fuzzy_risk_variance_subtraction Lemma activated_fuzzy_risk_variance_subtraction in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
Δ J b R C₀ C₁ tv :
ℝ
htv :
tv ≤ 1 / 8
htest :
Δ ^ 2 / 8 * (1 - tv) ≤ max C₀ C₁
h₀ :
C₀ ≤ 2 * R + J * b ^ 2 / 2
h₁ :
C₁ ≤ 2 * R + J * b ^ 2 / 2
7 * Δ ^ 2 / 128 - J * b ^ 2 / 4 ≤ R
Proof (Lean source)
-- @node: activated_fuzzy_risk_variance_subtraction lemma activated_fuzzy_risk_variance_subtraction (Δ J b R C₀ C₁ tv : ℝ) (htv : tv ≤ 1 / 8) (htest : Δ ^ 2 / 8 * (1 - tv) ≤ max C₀ C₁) (h₀ : C₀ ≤ 2 * R + J * b ^ 2 / 2) (h₁ : C₁ ≤ 2 * R + J * b ^ 2 / 2) : 7 * Δ ^ 2 / 128 - J * b ^ 2 / 4 ≤ R := by have hupper := max_le h₀ h₁ have hbudget := mul_le_mul_of_nonneg_left (show 7 / 8 ≤ 1 - tv by linarith) (show 0 ≤ Δ ^ 2 / 8 by positivity) linarith [hbudget.trans (htest.trans hupper)]
CausalSmith.Stat.MarRareqLogfrontier.activated_fuzzy_risk_variance_subtraction · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/FuzzyRisk.lean:106
theorem activated_fuzzy_risk_absorb_variance Lemma activated_fuzzy_risk_absorb_variance in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
J :
ℕ
b Δ R :
ℝ
hJ :
2048 ≤ J
hb :
0 ≤ b
hgap :
(J : ℝ) * b / 12 ≤ Δ
hrisk :
7 * Δ ^ 2 / 128 - (J : ℝ) * b ^ 2 / 4 ≤ R
(1 / 4096) * ((J : ℝ) * b) ^ 2 ≤ R
Proof (Lean source)
-- @node: activated_fuzzy_risk_absorb_variance lemma activated_fuzzy_risk_absorb_variance (J : ℕ) (b Δ R : ℝ) (hJ : 2048 ≤ J) (hb : 0 ≤ b) (hgap : (J : ℝ) * b / 12 ≤ Δ) (hrisk : 7 * Δ ^ 2 / 128 - (J : ℝ) * b ^ 2 / 4 ≤ R) : (1 / 4096) * ((J : ℝ) * b) ^ 2 ≤ R := by have hJreal : (2048 : ℝ) ≤ J := by exact_mod_cast hJ have hΔ : 0 ≤ Δ := (by positivity : 0 ≤ (J : ℝ) * b / 12).trans hgap have hsq := (sq_le_sq₀ (by positivity : 0 ≤ (J : ℝ) * b / 12) hΔ).2 hgap have hpenalty := mul_le_mul_of_nonneg_right hJreal (show 0 ≤ (J : ℝ) * b ^ 2 by positivity) nlinarith
CausalSmith.Stat.MarRareqLogfrontier.activated_fuzzy_risk_absorb_variance · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/FuzzyRisk.lean:119
theorem activated_fuzzy_risk_lower_of_center_comparison Lemma activated_fuzzy_risk_lower_of_center_comparison in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
Ω :
T :
Ω → ℝ
hT :
θ₀ θ₁ b R :
ℝ
J :
ℕ
hJ :
2048 ≤ J
hb :
0 ≤ b
hgap :
(J : ℝ) * b / 12 ≤ |θ₁ - θ₀|
htv :
tvDist Q₀ Q₁ ≤ 1 / 8
hint₀ :
Integrable (fun ω => (T ω - θ₀) ^ 2) Q₀
hint₁ :
Integrable (fun ω => (T ω - θ₁) ^ 2) Q₁
hcenter₀ :
(∫ ω, (T ω - θ₀) ^ 2 ∂Q₀) ≤ 2 * R + (J : ℝ) * b ^ 2 / 2
hcenter₁ :
(∫ ω, (T ω - θ₁) ^ 2 ∂Q₁) ≤ 2 * R + (J : ℝ) * b ^ 2 / 2
(1 / 4096) * ((J : ℝ) * b) ^ 2 ≤ R
Proof (Lean source)
-- @node: activated_fuzzy_risk_lower_of_center_comparison lemma activated_fuzzy_risk_lower_of_center_comparison {Ω : Type*} [MeasurableSpace Ω] (Q₀ Q₁ : Measure Ω) [IsProbabilityMeasure Q₀] [IsProbabilityMeasure Q₁] (T : Ω → ℝ) (hT : Measurable T) (θ₀ θ₁ b R : ℝ) (J : ℕ) (hJ : 2048 ≤ J) (hb : 0 ≤ b) (hgap : (J : ℝ) * b / 12 ≤ |θ₁ - θ₀|) (htv : tvDist Q₀ Q₁ ≤ 1 / 8) (hint₀ : Integrable (fun ω => (T ω - θ₀) ^ 2) Q₀) (hint₁ : Integrable (fun ω => (T ω - θ₁) ^ 2) Q₁) (hcenter₀ : (∫ ω, (T ω - θ₀) ^ 2 ∂Q₀) ≤ 2 * R + (J : ℝ) * b ^ 2 / 2) (hcenter₁ : (∫ ω, (T ω - θ₁) ^ 2 ∂Q₁) ≤ 2 * R + (J : ℝ) * b ^ 2 / 2) : (1 / 4096) * ((J : ℝ) * b) ^ 2 ≤ R := by have htest := activated_center_testing_risk_lower Q₀ Q₁ T hT θ₀ θ₁ hint₀ hint₁ have hsubtract := activated_fuzzy_risk_variance_subtraction |θ₁ - θ₀| (J : ℝ) b R _ _ (tvDist Q₀ Q₁) htv htest hcenter₀ hcenter₁ exact activated_fuzzy_risk_absorb_variance J b |θ₁ - θ₀| R hJ hb hgap hsubtract
CausalSmith.Stat.MarRareqLogfrontier.activated_fuzzy_risk_lower_of_center_comparison · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/FuzzyRisk.lean:132
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.Lower.FuzzyTesting 2 declarations Fuzzy testing comparison in the original fixed-sample experiment.

Fuzzy testing comparison in the original fixed-sample experiment.

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
u :
ℝ
hu :
0 ≤ u
(min 1 u) ^ 2 = min 1 (u ^ 2)
Proof (Lean source)
-- @node: activated_min_one_sq lemma activated_min_one_sq (u : ℝ) (hu : 0 ≤ u) : (min 1 u) ^ 2 = min 1 (u ^ 2) := by by_cases h : u ≤ 1 · rw [min_eq_right h, min_eq_right (by nlinarith : u ^ 2 ≤ 1)] · have h' : 1 ≤ u := le_of_not_ge h rw [min_eq_left h', min_eq_left (by nlinarith : 1 ≤ u ^ 2)] norm_num
CausalSmith.Stat.MarRareqLogfrontier.activated_min_one_sq · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/FuzzyTesting.lean:17
theorem activated_fuzzy_lower

the stated mathematical conclusion holds.

Formal statement
∃ c : ℝ,
0 < c
conclusion 1
n d :
ℕ
q :
ℝ
1 ≤ n
1 ≤ d
0 < q
q ≤ 1
sqrt (effectiveSize n q) ≤ d
c * min 1 (((d : ℝ) / (effectiveSize n q * logScale n q)) ^ 2) ≤ minimaxRisk n d q
Proof (Lean source)
lemma activated_fuzzy_lower : ∃ c : ℝ, 0 < c ∧ ∀ (n d : ℕ) (q : ℝ), 1 ≤ n → 1 ≤ d → 0 < q → q ≤ 1 → RareArrivalSlice n q → sqrt (effectiveSize n q) ≤ d → c * min 1 (((d : ℝ) / (effectiveSize n q * logScale n q)) ^ 2) ≤ minimaxRisk n d q := by let η := exp (-32) let T := max 1 (max (exp 2) (max (4 * η) (max (2 * η * 2048) (exp ((32 - log ((2 : ℝ) / 16)) / 28))))) let c := min (1 / (256 * T)) (min (1 / (256 * (2048 : ℝ) ^ 2)) (η ^ 2 / 16384)) have hT : 1 ≤ T := le_max_left _ _ have hη : 0 < η := Real.exp_pos _ have hc : 0 < c := by dsimp [c]; positivity refine ⟨c, hc, ?_⟩ intro n d q hn hd hq hq1 hslice _hdim let N := effectiveSize n q let L := logScale n q let u := (d : ℝ) / (N * L) have hN : 0 < N := by dsimp [N, effectiveSize]; positivity have hL : 1 ≤ L := by dsimp [L, logScale] have h := Real.log_le_log (Real.exp_pos (1 : ℝ)) (show exp 1 ≤ exp 1 + effectiveSize n q by linarith) simpa using h have hu : 0 ≤ u := by dsimp [u]; positivity have hcap : 0 ≤ min 1 (u ^ 2) := le_min (by norm_num) (sq_nonneg _) have hone := (oneCell_minimax_risk_floors q hn hd hq hq1 hslice).1 have hcT : c ≤ 1 / (256 * T) := min_le_left _ _ have hcD : c ≤ 1 / (256 * (2048 : ℝ) ^ 2) := (min_le_right _ _).trans (min_le_left _ _) have hcη : c ≤ η ^ 2 / 16384 := (min_le_right _ _).trans (min_le_right _ _) change c * min 1 (u ^ 2) ≤ minimaxRisk n d q by_cases hlarge : T ≤ N · have hN1 : 1 ≤ N := hT.trans hlarge have hTexp : exp 2 ≤ N := (le_max_left _ _).trans ((le_max_right _ _).trans hlarge) have hTmass : 4 * η ≤ N := (le_max_left _ _).trans ((le_max_right _ _).trans ((le_max_right _ _).trans hlarge)) have hTcapacity : 2 * η * 2048 ≤ N := (le_max_left _ _).trans ((le_max_right _ _).trans ((le_max_right _ _).trans ((le_max_right _ _).trans hlarge))) have hTtail : exp ((32 - log ((2 : ℝ) / 16)) / 28) ≤ N := (le_max_right _ _).trans ((le_max_right _ _).trans ((le_max_right _ _).trans ((le_max_right _ _).trans hlarge))) have hcapacity := interval_capacity_of_large_size η 2048 n q hη hN hL hTcapacity by_cases hJ : 2048 ≤ rareCount η n d q · have hK : 2 ≤ lowerDegree n q := by have hlog := Real.log_le_log (Real.exp_pos (2 : ℝ)) (hTexp.trans (show N ≤ exp 1 + N by linarith [Real.exp_pos (1 : ℝ)])) rw [Real.log_exp] at hlog have hceil := Nat.le_ceil (logScale n q) have : (2 : ℝ) ≤ (lowerDegree n q : ℝ) := hlog.trans hceil exact_mod_cast this obtain ⟨π₀, π₁, h₀, h₁, hm, hgap⟩ := interval_ordered_reciprocal_priors n q hK have hgapabs : 1 / 12 ≤ |(∫ z, z⁻¹ ∂π₁) - ∫ z, z⁻¹ ∂π₀| := hgap.trans (le_abs_self _) have hrisk := activatedAugmentedMixture_minimaxRisk_calibrated n d q hn hd hq hslice h₀ h₁ hm hgapabs hJ hTtail have hb : 0 < rareMass η n q := by unfold rareMass; positivity have hbsmall : rareMass η n q ≤ 1 / 4 := by unfold rareMass apply (div_le_iff₀ (by positivity : 0 < effectiveSize n q * logScale n q)).mpr nlinarith [mul_le_mul_of_nonneg_left hL hN.le] have hηsmall : η ≤ 1 / 2 := by dsimp [η] rw [Real.exp_neg, inv_eq_one_div] apply (div_le_iff₀ (Real.exp_pos 32)).mpr linarith [Real.add_one_le_exp (32 : ℝ)] have hd2 : 2 ≤ d := by have hjd : rareCount η n d q ≤ d - 1 := min_le_left _ _ omega have hwidth := interval_prior_segment_width_lower η ((rareCount η n d q : ℝ) * rareMass η n q / 12) n d q hη hηsmall hd2 hN (by linarith) hbsmall le_rfl have hmass : η / 2 * min 1 u ≤ (rareCount η n d q : ℝ) * rareMass η n q := by change η / 24 * min 1 u ≤ _ at hwidth linarith have hsq := (sq_le_sq₀ (by positivity : 0 ≤ η / 2 * min 1 u) (by positivity : 0 ≤ (rareCount η n d q : ℝ) * rareMass η n q)).2 hmass rw [mul_pow, activated_min_one_sq u hu] at hsq have hbound : c * min 1 (u ^ 2) ≤ (1 / 4096) * ((rareCount η n d q : ℝ) * rareMass η n q) ^ 2 := by nlinarith [mul_le_mul_of_nonneg_right hcη hcap] exact hbound.trans hrisk · have hdsmall := rareCount_small_dimension η n d 2048 q hd hcapacity (by omega) have hscale := interval_small_dimension_scale n d 2048 q hN1 hL hdsmall change min 1 u ≤ (2048 : ℝ) * (sqrt N)⁻¹ at hscale have hs := (sq_le_sq₀ (le_min (by norm_num) hu) (by positivity)).2 hscale rw [activated_min_one_sq u hu, mul_pow, inv_pow, Real.sq_sqrt hN.le] at hs have hmin : min 1 N⁻¹ = N⁻¹ := min_eq_right (inv_le_one_of_one_le₀ hN1) change (1 / 256 : ℝ) * min 1 N⁻¹ ≤ _ at hone rw [hmin] at hone have hbnd := mul_le_mul_of_nonneg_left hs hc.le have hcoef : c * (2048 : ℝ) ^ 2 ≤ 1 / 256 := by nlinarith [mul_le_mul_of_nonneg_right hcD (by positivity : 0 ≤ (2048 : ℝ) ^ 2)] have hbound := mul_le_mul_of_nonneg_right hcoef (inv_nonneg.mpr hN.le) exact hbnd.trans (by simpa only [mul_assoc] using hbound.trans hone) · have hsmall : N ≤ T := le_of_not_ge hlarge have hrecip : T⁻¹ ≤ min 1 N⁻¹ := by apply le_min (inv_le_one_of_one_le₀ hT) exact (inv_le_inv₀ (show 0 < T by linarith [hT]) hN).mpr hsmall have hc' : c ≤ (1 / 256 : ℝ) * T⁻¹ := by convert hcT using 1 ring have hbound := mul_le_mul_of_nonneg_left hrecip (by norm_num : (0 : ℝ) ≤ 1 / 256) have hcap1 := mul_le_mul_of_nonneg_left (min_le_left (1 : ℝ) (u ^ 2)) hc.le exact hcap1.trans (by simpa only [mul_one] using (hc'.trans hbound).trans hone)
CausalSmith.Stat.MarRareqLogfrontier.activated_fuzzy_lower · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/Lower/FuzzyTesting.lean:28
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.MomentPriors 3 declarations Finite reciprocal-moment priors from the alternation dual and the cited gate.

Finite reciprocal-moment priors from the alternation dual and the cited gate.

theorem reciprocal_ratio_power_lower Lemma reciprocal_ratio_power_lower in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
K :
ℕ
hK :
3 ≤ K
(3 / 32 : ℝ) ≤ (((K : ℝ) - 1) / ((K : ℝ) + 1)) ^ K
Proof (Lean source)
lemma reciprocal_ratio_power_lower (K : ℕ) (hK : 3 ≤ K) : (3 / 32 : ℝ) ≤ (((K : ℝ) - 1) / ((K : ℝ) + 1)) ^ K := by let k : ℝ := K have hk : (3 : ℝ) ≤ k := by change (3 : ℝ) ≤ (K : ℝ) exact_mod_cast hK have hk0 : 0 < k := by linarith let x : ℝ := k⁻¹ have hx0 : 0 ≤ x := by dsimp [x]; positivity have hx1 : x < 1 := by dsimp [x] have h : 1 / k < 1 := (div_lt_iff₀ hk0).2 (by linarith) simpa only [one_div] using h have hlog := Real.log_div_le_sum_range_add hx0 hx1 0 simp only [Finset.range_zero, Finset.sum_empty, zero_add, pow_one, mul_zero] at hlog have hk1 : 0 < k - 1 := by linarith have hk2 : 0 < k + 1 := by linarith have hr : 0 < (k - 1) / (k + 1) := div_pos hk1 hk2 have hratio : (1 + x) / (1 - x) = ((k - 1) / (k + 1))⁻¹ := by dsimp [x] field_simp rw [hratio, Real.log_inv] at hlog have hbound : k * log ((k - 1) / (k + 1)) ≥ -(9 / 4 : ℝ) := by have hx : x = 1 / k := by simp [x] rw [hx] at hlog have hden : 0 < 1 - (1 / k)^2 := by have : (1 / k : ℝ) < 1 := by simpa [x] using hx1 nlinarith [sq_nonneg (1 - 1 / k)] have hsq : 8 * k^2 ≤ 9 * (k^2 - 1) := by nlinarith have hfrac : 2 * k^2 / (k^2 - 1) ≤ 9 / 4 := by apply (div_le_iff₀ (by nlinarith : 0 < k^2 - 1)).2 nlinarith have heq : k * (2 * (1 / k) / (1 - (1 / k)^2)) = 2 * k^2 / (k^2 - 1) := by field_simp have hlog2 : -log ((k - 1) / (k + 1)) ≤ 2 * (1 / k) / (1 - (1 / k)^2) := by have h := mul_le_mul_of_nonneg_left hlog (by norm_num : (0 : ℝ) ≤ 2) simpa [div_eq_mul_inv, mul_assoc] using h have h := mul_le_mul_of_nonneg_left hlog2 hk0.le nlinarith have hpow : log (((k - 1) / (k + 1)) ^ K) = k * log ((k - 1) / (k + 1)) := by rw [Real.log_pow] have hExp : exp (-(9 / 4 : ℝ)) ≤ ((k - 1) / (k + 1)) ^ K := by calc _ ≤ exp (k * log ((k - 1) / (k + 1))) := Real.exp_monotone hbound _ = _ := by rw [← hpow, Real.exp_log (pow_pos hr _)] have hnum : exp (9 / 4 : ℝ) ≤ 32 / 3 := by have h1 : exp 1 ≤ 11 / 4 := le_of_lt (Real.exp_one_lt_d9.trans (by norm_num)) have hq : exp (1 / 4 : ℝ) ≤ 9 / 7 := by convert Real.exp_le_two_add_div_two_sub (x := (1 / 4 : ℝ)) (by norm_num) (by norm_num) using 1 norm_num have he : exp (9 / 4 : ℝ) = (exp 1)^2 * exp (1 / 4 : ℝ) := by rw [show (9 / 4 : ℝ) = 1 + 1 + 1 / 4 by norm_num, Real.exp_add, Real.exp_add] ring rw [he] nlinarith [Real.exp_pos (1 / 4 : ℝ), Real.exp_pos 1] have hnum2 : (3 / 32 : ℝ) ≤ exp (-(9 / 4 : ℝ)) := by rw [Real.exp_neg] have hh : (3 / 32 : ℝ) ≤ 1 / exp (9 / 4 : ℝ) := (le_div_iff₀ (Real.exp_pos _)).2 (by nlinarith) simpa only [one_div] using hh exact hnum2.trans hExp
CausalSmith.Stat.MarRareqLogfrontier.reciprocal_ratio_power_lower · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/MomentPriors.lean:19
theorem reciprocal_best_error_lower Lemma reciprocal_best_error_lower in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
K :
ℕ
hK :
2 ≤ K
(1 / 12 : ℝ) ≤ 2 * bestUniformApproxError (fun z : ℝ => z⁻¹) 1 ((K : ℝ)^2) K
Proof (Lean source)
lemma reciprocal_best_error_lower (K : ℕ) (hK : 2 ≤ K) : (1 / 12 : ℝ) ≤ 2 * bestUniformApproxError (fun z : ℝ => z⁻¹) 1 ((K : ℝ)^2) K := by rw [reciprocalBestApproximation_proved K hK] by_cases h2 : K = 2 · subst K norm_num · have h3 : 3 ≤ K := by omega have hk : (3 : ℝ) ≤ K := by exact_mod_cast h3 have hcoeff : (4 / 9 : ℝ) ≤ (((K : ℝ)^2 - 1) / (2 * (K : ℝ)^2)) := by apply (le_div_iff₀ (by positivity : 0 < 2 * (K : ℝ)^2)).2 nlinarith calc (1 / 12 : ℝ) = 2 * ((4 / 9 : ℝ) * (3 / 32 : ℝ)) := by norm_num _ ≤ 2 * ((((K : ℝ)^2 - 1) / (2 * (K : ℝ)^2)) * (((K : ℝ) - 1) / ((K : ℝ) + 1)) ^ K) := by gcongr exact reciprocal_ratio_power_lower K h3
CausalSmith.Stat.MarRareqLogfrontier.reciprocal_best_error_lower · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/MomentPriors.lean:91
theorem moment_matched_reciprocal_priors Lemma 7 in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
K :
ℕ
hK :
2 ≤ K
∃ prior0 prior1 : Measure ℝ,
conclusion 1
∃ s₀ s₁ : Finset ℝ,
prior0 (s₀ : Set ℝ) = 1
prior1 (s₁ : Set ℝ) = 1
z ∈ s₀ :
1 ≤ z
z ≤ (K : ℝ) ^ 2
z ∈ s₁ :
1 ≤ z
z ≤ (K : ℝ) ^ 2
conclusion 2
v :
ℕ
v ≤ K
(∫ z, z ^ v ∂prior0) = ∫ z, z ^ v ∂prior1
conclusion 3
1 / 12 ≤ |(∫ z, z⁻¹ ∂prior1) - (∫ z, z⁻¹ ∂prior0)|
Proof (Lean source)
lemma moment_matched_reciprocal_priors (K : ℕ) (hK : 2 ≤ K) : ∃ prior0 prior1 : Measure ℝ, IsProbabilityMeasure prior0 ∧ IsProbabilityMeasure prior1 ∧ (∃ s₀ s₁ : Finset ℝ, prior0 (s₀ : Set ℝ) = 1 ∧ prior1 (s₁ : Set ℝ) = 1 ∧ (∀ z ∈ s₀, 1 ≤ z ∧ z ≤ (K : ℝ) ^ 2) ∧ (∀ z ∈ s₁, 1 ≤ z ∧ z ≤ (K : ℝ) ^ 2)) ∧ (∀ v : ℕ, v ≤ K → (∫ z, z ^ v ∂prior0) = ∫ z, z ^ v ∂prior1) ∧ 1 / 12 ≤ |(∫ z, z⁻¹ ∂prior1) - (∫ z, z⁻¹ ∂prior0)| := by classical have hKreal : (2 : ℝ) ≤ K := by exact_mod_cast hK have hrs : (1 : ℝ) < (K : ℝ)^2 := by nlinarith have hcont : ContinuousOn (fun z : ℝ => z⁻¹) (Icc 1 ((K : ℝ)^2)) := by apply continuousOn_id.inv₀ intro z hz have hz1 : 1 ≤ z := hz.1 simpa only [id_eq] using (ne_of_gt (lt_of_lt_of_le zero_lt_one hz1)) obtain ⟨D⟩ := exists_finiteMomentDual hrs hcont K let C := NormalizedFiniteSignedMomentCertificate.ofFiniteMomentDual D let p₀ := C.orientedPrior0 (fun z : ℝ => z⁻¹) let p₁ := C.orientedPrior1 (fun z : ℝ => z⁻¹) have hp₀ : IsProbabilityMeasure p₀ := inferInstance have hp₁ : IsProbabilityMeasure p₁ := inferInstance let s : Finset ℝ := (Set.finite_range C.node).toFinset have hs : (s : Set ℝ) = range C.node := Set.Finite.coe_toFinset _ have h0 : C.positivePrior (s : Set ℝ) = 1 := by rw [hs] calc _ = C.positivePrior univ := (ae_mem_iff_measure_eq (Set.finite_range C.node).measurableSet.nullMeasurableSet).1 C.jordanPriors_ae_mem_range.1 _ = 1 := measure_univ have h1 : C.negativePrior (s : Set ℝ) = 1 := by rw [hs] calc _ = C.negativePrior univ := (ae_mem_iff_measure_eq (Set.finite_range C.node).measurableSet.nullMeasurableSet).1 C.jordanPriors_ae_mem_range.2 _ = 1 := measure_univ have hs₀ : p₀ (s : Set ℝ) = 1 := by dsimp [p₀, NormalizedFiniteSignedMomentCertificate.orientedPrior0] split_ifs <;> assumption have hs₁ : p₁ (s : Set ℝ) = 1 := by dsimp [p₁, NormalizedFiniteSignedMomentCertificate.orientedPrior1] split_ifs <;> assumption have hmem : ∀ z ∈ s, 1 ≤ z ∧ z ≤ (K : ℝ)^2 := by intro z hz have hz' : z ∈ (s : Set ℝ) := hz rw [hs] at hz' obtain ⟨i, rfl⟩ := hz' exact D.nodes_mem i refine ⟨p₀, p₁, hp₀, hp₁, ⟨s, s, hs₀, hs₁, hmem, hmem⟩, (fun v hv => C.orientedPriors_moments_eq _ v hv), ?_⟩ have hsep := C.orientedPrior_target_separation (fun z : ℝ => z⁻¹) have htarget : |∑ i, C.weight i * (C.node i)⁻¹| = bestUniformApproxError (fun z : ℝ => z⁻¹) 1 ((K : ℝ)^2) K := D.target_abs_eq rw [htarget] at hsep change (1 / 12 : ℝ) ≤ |(∫ z, z⁻¹ ∂p₁) - (∫ z, z⁻¹ ∂p₀)| rw [show (∫ z, z⁻¹ ∂p₁) - (∫ z, z⁻¹ ∂p₀) = 2 * bestUniformApproxError (fun z : ℝ => z⁻¹) 1 ((K : ℝ)^2) K from hsep] exact (reciprocal_best_error_lower K hK).trans (le_abs_self _)
CausalSmith.Stat.MarRareqLogfrontier.moment_matched_reciprocal_priors · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/MomentPriors.lean:113
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.NearComplete.CompleteArrivalTwoPoint 14 declarations Complete-arrival frontier for the finite randomized experiment.

Complete-arrival frontier for the finite randomized experiment.

theorem complete_arrival_ht_estimator_regular Lemma complete_arrival_ht_estimator_regular in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
conclusion 2
s :
completeArrivalHTEstimator n d s ∈ Icc (-1 : ℝ) 1
Proof (Lean source)
lemma complete_arrival_ht_estimator_regular (n d : ℕ) : Measurable (completeArrivalHTEstimator n d) ∧ ∀ s, completeArrivalHTEstimator n d s ∈ Icc (-1 : ℝ) 1 := by constructor · exact measurable_of_finite _ · intro s unfold completeArrivalHTEstimator clip constructor · exact le_max_left _ _ · exact (max_le_iff.mpr ⟨by norm_num, min_le_left _ _⟩)
CausalSmith.Stat.MarRareqLogfrontier.complete_arrival_ht_estimator_regular · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/NearComplete/CompleteArrivalTwoPoint.lean:20

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
u v :
ℝ
hv :
v ∈ Icc (-1 : ℝ) 1
(clip u - v) ^ 2 ≤ (u - v) ^ 2
Proof (Lean source)
lemma clip_sq_error_le (u v : ℝ) (hv : v ∈ Icc (-1 : ℝ) 1) : (clip u - v) ^ 2 ≤ (u - v) ^ 2 := by rcases hv with ⟨hvlo, hvhi⟩ unfold clip rcases le_total u 1 with hu | hu · rw [min_eq_right hu] rcases le_total (-1 : ℝ) u with hlu | hlu · rw [max_eq_right hlu] · rw [max_eq_left hlu] nlinarith · rw [min_eq_left hu] rw [max_eq_right (by norm_num : (-1 : ℝ) ≤ 1)] nlinarith
theorem complete_arrival_score_variance_le Lemma complete_arrival_score_variance_le in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
P :
variance (fun o : ObsRecord d => 2 * armSign o.A * (if o.RY then (1 : ℝ) else 0)) (P.1.map obs)
≤ 4
Proof (Lean source)
lemma complete_arrival_score_variance_le {d : ℕ} (P : FullLaw d) : variance (fun o : ObsRecord d => 2 * armSign o.A * (if o.RY then (1 : ℝ) else 0)) (P.1.map obs) ≤ 4 := by let μ := P.1.map obs letI : IsProbabilityMeasure P.1 := P.2 letI : IsProbabilityMeasure μ := Measure.isProbabilityMeasure_map (by fun_prop : AEMeasurable obs P.1) have hbound : ∀ᵐ o ∂μ, 2 * armSign o.A * (if o.RY then (1 : ℝ) else 0) ∈ Icc (-2) 2 := by filter_upwards [] with o cases hA : o.A <;> cases hRY : o.RY <;> simp [armSign] have hmeas : AEMeasurable (fun o : ObsRecord d => 2 * armSign o.A * (if o.RY then (1 : ℝ) else 0)) μ := by fun_prop have h := ProbabilityTheory.variance_le_sq_of_bounded hbound hmeas norm_num at h ⊢ exact h
CausalSmith.Stat.MarRareqLogfrontier.complete_arrival_score_variance_le · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/NearComplete/CompleteArrivalTwoPoint.lean:47
theorem complete_arrival_no_absent_cell Lemma complete_arrival_no_absent_cell in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
P :
j :
Cell d
P.1.real {r | inCell r j ∧ r.R = false} = 0
Proof (Lean source)
lemma complete_arrival_no_absent_cell {n d : ℕ} (P : FullLaw d) (hP : UnrestrictedArrivalModelClass n d 1 P) (j : Cell d) : P.1.real {r | inCell r j ∧ r.R = false} = 0 := by letI : IsProbabilityMeasure P.1 := P.2 have hbound : arrivedCell P j ≤ cellProb P j := measureReal_mono (by intro r hr; exact hr.1) have heq : arrivedCell P j = cellProb P j := by by_cases hp : 0 < cellProb P j · exact le_antisymm hbound (by simpa using hP.arrival j hp) · have hz : cellProb P j = 0 := le_antisymm (le_of_not_gt hp) measureReal_nonneg exact (le_antisymm (hbound.trans_eq hz) measureReal_nonneg).trans hz.symm have hdiff : {r : FullRecord d | inCell r j ∧ r.R = false} = {r | inCell r j} \ {r | inCell r j ∧ r.R = true} := by ext r cases r.R <;> simp <;> tauto rw [hdiff, measureReal_sdiff (by intro r hr; exact hr.1) (by simp)] exact sub_eq_zero.mpr heq.symm
CausalSmith.Stat.MarRareqLogfrontier.complete_arrival_no_absent_cell · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/NearComplete/CompleteArrivalTwoPoint.lean:69
theorem complete_arrival_almost_sure Lemma complete_arrival_almost_sure in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
P :
∀ᵐ r : FullRecord d ∂P.1, r.R = true
Proof (Lean source)
lemma complete_arrival_almost_sure {n d : ℕ} (P : FullLaw d) (hP : UnrestrictedArrivalModelClass n d 1 P) : ∀ᵐ r : FullRecord d ∂P.1, r.R = true := by letI : IsProbabilityMeasure P.1 := P.2 have hzero : P.1.real {r : FullRecord d | r.R = false} = 0 := by let μ := P.1.restrict {r : FullRecord d | r.R = false} have hsum := sum_measureReal_preimage_singleton (μ := μ) (Finset.univ : Finset (Cell d)) (f := fun r : FullRecord d => (r.A, r.X, r.S)) (by intro; simp) have hcell (j : Cell d) : μ.real ((fun r : FullRecord d => (r.A, r.X, r.S)) ⁻¹' {j}) = 0 := by have hs : ((fun r : FullRecord d => (r.A, r.X, r.S)) ⁻¹' {j}) ∩ {r : FullRecord d | r.R = false} = {r | inCell r j ∧ r.R = false} := by ext r rcases j with ⟨a, x, s⟩ simp [inCell, Prod.mk.injEq, and_assoc, and_left_comm, and_comm] change (P.1.restrict {r : FullRecord d | r.R = false}).real ((fun r : FullRecord d => (r.A, r.X, r.S)) ⁻¹' {j}) = 0 rw [measureReal_def, Measure.restrict_apply (by simp)] rw [hs] exact congrArg toReal (by exact (measureReal_eq_zero_iff (by simp)).mp (complete_arrival_no_absent_cell P hP j)) simp_rw [hcell] at hsum simpa [μ, measureReal_def, Measure.restrict_apply] using hsum.symm have hzero' : P.1 {r : FullRecord d | r.R = false} = 0 := by exact (measureReal_eq_zero_iff (by simp)).mp hzero exact (ae_iff).2 (by simpa using hzero')
theorem complete_arrival_score_mean Lemma complete_arrival_score_mean in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
P :
(∫ o : ObsRecord d, 2 * armSign o.A * (if o.R && o.RY then (1 : ℝ) else 0) ∂(P.1.map obs))
= ate P
Proof (Lean source)
lemma complete_arrival_score_mean {n d : ℕ} (P : FullLaw d) (hP : UnrestrictedArrivalModelClass n d 1 P) : (∫ o : ObsRecord d, 2 * armSign o.A * (if o.R && o.RY then (1 : ℝ) else 0) ∂(P.1.map obs)) = ate P := by letI : IsProbabilityMeasure P.1 := P.2 have hmap : (∫ o : ObsRecord d, 2 * armSign o.A * (if o.R && o.RY then (1 : ℝ) else 0) ∂(P.1.map obs)) = ∫ r : FullRecord d, 2 * armSign r.A * (if r.R && r.Y then (1 : ℝ) else 0) ∂P.1 := by rw [integral_map (by fun_prop) (by fun_prop)] simp [obs, Bool.and_assoc] rw [hmap] have hae := complete_arrival_almost_sure P hP have hreplace : (∫ r : FullRecord d, 2 * armSign r.A * (if r.R && r.Y then (1 : ℝ) else 0) ∂P.1) = ∫ r : FullRecord d, 2 * armSign r.A * (if r.Y then (1 : ℝ) else 0) ∂P.1 := by apply integral_congr_ae filter_upwards [hae] with r hr simp [hr] rw [hreplace] let E (a : Bool) : Set (FullRecord d) := {r | r.A = a ∧ r.Y = true} have hpoint : (fun r : FullRecord d => 2 * armSign r.A * (if r.Y then (1 : ℝ) else 0)) = (E true).indicator (fun _ => (2 : ℝ)) - (E false).indicator (fun _ => (2 : ℝ)) := by funext r cases hA : r.A <;> cases hY : r.Y <;> simp [E, armSign, indicator, hA, hY] rw [hpoint] have hmeas (a : Bool) : MeasurableSet (E a) := by simp [E] change (∫ r : FullRecord d, (E true).indicator (fun _ => (2 : ℝ)) r - (E false).indicator (fun _ => (2 : ℝ)) r ∂P.1) = ate P rw [integral_sub ((integrable_const (2 : ℝ)).indicator (hmeas true)) ((integrable_const (2 : ℝ)).indicator (hmeas false))] rw [integral_indicator_const (2 : ℝ) (hmeas true), integral_indicator_const (2 : ℝ) (hmeas false)] rw [ate_eq_potentialOutcomeMass P] have ht := randomized_armOutcomeMass P hP.randomized hP.balanced true have hf := randomized_armOutcomeMass P hP.randomized hP.balanced false simp only [E] at * simp only [ite_true, Bool.false_eq_true, ite_false] at ht hf linear_combination ht - hf

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
P :
ate P ∈ Icc (-1 : ℝ) 1
Proof (Lean source)
lemma ate_mem_unit_interval {d : ℕ} (P : FullLaw d) : ate P ∈ Icc (-1 : ℝ) 1 := by rw [ate_eq_potentialOutcomeMass] have h₀ : (0 : ℝ) ≤ P.1.real {r | r.Y0 = true} := measureReal_nonneg have h₁ : (0 : ℝ) ≤ P.1.real {r | r.Y1 = true} := measureReal_nonneg have h₀' : P.1.real {r | r.Y0 = true} ≤ 1 := by letI : IsProbabilityMeasure P.1 := P.2 exact measureReal_le_one have h₁' : P.1.real {r | r.Y1 = true} ≤ 1 := by letI : IsProbabilityMeasure P.1 := P.2 exact measureReal_le_one constructor <;> linarith
theorem unrestricted_squaredRisk_bounds Lemma unrestricted_squaredRisk_bounds in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
T :
P :
conclusion 1
0 ≤ squaredRisk T P
conclusion 2
squaredRisk T P ≤ 4
Proof (Lean source)
lemma unrestricted_squaredRisk_bounds {n d : ℕ} (T : Estimator n d) (P : FullLaw d) : 0 ≤ squaredRisk T P ∧ squaredRisk T P ≤ 4 := by letI : IsProbabilityMeasure P.1 := P.2 letI : IsMarkovKernel T.toBoundedKernel.1 := T.toBoundedKernel.2.1 have hATE := ate_mem_unit_interval P rw [Set.mem_Icc] at hATE have hinner_nonneg (s : Fin n → ObsRecord d) : 0 ≤ ∫ t, (t - ate P) ^ 2 ∂(T.toBoundedKernel.1 s) := by exact integral_nonneg (fun t => sq_nonneg _) have hinner_le (s : Fin n → ObsRecord d) : (∫ t, (t - ate P) ^ 2 ∂(T.toBoundedKernel.1 s)) ≤ 4 := by haveI : IsProbabilityMeasure (T.toBoundedKernel.1 s) := inferInstance have hs : ∀ᵐ t ∂(T.toBoundedKernel.1 s), t ∈ Icc (-1 : ℝ) 1 := (mem_ae_iff_prob_eq_one measurableSet_Icc).mpr (T.toBoundedKernel.2.2 s) have hb : ∀ᵐ t ∂(T.toBoundedKernel.1 s), (t - ate P) ^ 2 ≤ 4 := by filter_upwards [hs] with t ht rw [Set.mem_Icc] at ht nlinarith [sq_nonneg (t - ate P + 2), sq_nonneg (t - ate P - 2)] simpa using (integral_mono_of_nonneg (μ := T.toBoundedKernel.1 s) (Filter.Eventually.of_forall (fun t => sq_nonneg (t - ate P))) (integrable_const 4) hb) haveI : IsProbabilityMeasure (sampleLaw n P) := by unfold sampleLaw letI : IsProbabilityMeasure (P.1.map obs) := Measure.isProbabilityMeasure_map (by fun_prop : AEMeasurable obs P.1) infer_instance constructor · exact integral_nonneg hinner_nonneg · simpa [squaredRisk] using (integral_mono_of_nonneg (μ := sampleLaw n P) (Filter.Eventually.of_forall hinner_nonneg) (integrable_const 4) (Filter.Eventually.of_forall hinner_le))
CausalSmith.Stat.MarRareqLogfrontier.unrestricted_squaredRisk_bounds · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/NearComplete/CompleteArrivalTwoPoint.lean:182
theorem unrestricted_minimax_lower_of_two_point Lemma unrestricted_minimax_lower_of_two_point in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q c :
ℝ
P₀ P₁ :
hP₀ :
hP₁ :
htwo :
∀ T : Estimator n d, c ≤ max (squaredRisk T P₀) (squaredRisk T P₁)
Proof (Lean source)
lemma unrestricted_minimax_lower_of_two_point {n d : ℕ} {q c : ℝ} (P₀ P₁ : FullLaw d) (hP₀ : UnrestrictedArrivalModelClass n d q P₀) (hP₁ : UnrestrictedArrivalModelClass n d q P₁) (htwo : ∀ T : Estimator n d, c ≤ max (squaredRisk T P₀) (squaredRisk T P₁)) : c ≤ unrestrictedMinimaxRisk n d q := by let T₀ : Estimator n d := Estimator.ofMap (fun _ => 0) ⟨measurable_const, by intro s; norm_num⟩ letI : Nonempty (Estimator n d) := ⟨T₀⟩ let θ₀ : {P : FullLaw d // UnrestrictedArrivalModelClass n d q P} := ⟨P₀, hP₀⟩ let θ₁ : {P : FullLaw d // UnrestrictedArrivalModelClass n d q P} := ⟨P₁, hP₁⟩ unfold unrestrictedMinimaxRisk apply le_minimaxValue_of_two_point θ₀ θ₁ · intro T refine ⟨4, ?_⟩ rintro r ⟨θ, rfl⟩ exact (unrestricted_squaredRisk_bounds T θ.1).2 · intro T exact htwo T
CausalSmith.Stat.MarRareqLogfrontier.unrestricted_minimax_lower_of_two_point · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/NearComplete/CompleteArrivalTwoPoint.lean:215
theorem complete_arrival_chisq_testing_floor Lemma complete_arrival_chisq_testing_floor in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
hn :
1 ≤ n
P₀ P₁ :
hac :
(P₁.1.map obs) ≪ (P₀.1.map obs)
hchi :
chiSqDiv (P₁.1.map obs) (P₀.1.map obs) ≤ (1 / 8 : ℝ) / n
A :
Set (Fin n → ObsRecord d)
(sampleLaw n P₁).real Aᶜ + (sampleLaw n P₀).real A ≥ 1 / 2
Proof (Lean source)
lemma complete_arrival_chisq_testing_floor {n d : ℕ} (hn : 1 ≤ n) (P₀ P₁ : FullLaw d) (hac : (P₁.1.map obs) ≪ (P₀.1.map obs)) (hchi : chiSqDiv (P₁.1.map obs) (P₀.1.map obs) ≤ (1 / 8 : ℝ) / n) : ∀ A : Set (Fin n → ObsRecord d), MeasurableSet A → (sampleLaw n P₁).real Aᶜ + (sampleLaw n P₀).real A ≥ 1 / 2 := by letI : IsProbabilityMeasure P₀.1 := P₀.2 letI : IsProbabilityMeasure P₁.1 := P₁.2 letI : IsProbabilityMeasure (P₀.1.map obs) := Measure.isProbabilityMeasure_map (by fun_prop) letI : IsProbabilityMeasure (P₁.1.map obs) := Measure.isProbabilityMeasure_map (by fun_prop) simpa only [sampleLaw] using complete_arrival_product_testing_half n hn (P₁.1.map obs) (P₀.1.map obs) hac (Integrable.of_finite) hchi
CausalSmith.Stat.MarRareqLogfrontier.complete_arrival_chisq_testing_floor · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/NearComplete/CompleteArrivalTwoPoint.lean:237
theorem complete_arrival_kernel_mean_risk_le Lemma complete_arrival_kernel_mean_risk_le in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
T :
P :
deterministicRisk (kernelMean T.toBoundedKernel.1 clip) P ≤ squaredRisk T P
Proof (Lean source)
lemma complete_arrival_kernel_mean_risk_le {n d : ℕ} (T : Estimator n d) (P : FullLaw d) : deterministicRisk (Causalean.Stat.kernelMean T.toBoundedKernel.1 clip) P ≤ squaredRisk T P := by letI : IsMarkovKernel T.toBoundedKernel.1 := T.toBoundedKernel.2.1 letI : IsProbabilityMeasure P.1 := P.2 letI : IsProbabilityMeasure (P.1.map obs) := Measure.isProbabilityMeasure_map (by fun_prop) letI : IsProbabilityMeasure (sampleLaw n P) := by unfold sampleLaw infer_instance have hclip_meas : Measurable clip := by unfold clip fun_prop have hclip_bound : UniformlyBounded clip := by refine ⟨1, by norm_num, ?_⟩ intro t rw [abs_le] simp [clip] have hclip_abs (t : ℝ) : |clip t| ≤ 1 := by rw [abs_le] constructor <;> simp [clip] let f := Causalean.Stat.kernelMean T.toBoundedKernel.1 clip have hf : Measurable f := measurable_kernelMean T.toBoundedKernel.1 hclip_meas have hpoint (s : Fin n → ObsRecord d) : (f s - ate P) ^ 2 ≤ ∫ t, (t - ate P) ^ 2 ∂(T.toBoundedKernel.1 s) := by calc _ ≤ ∫ t, (clip t - ate P) ^ 2 ∂(T.toBoundedKernel.1 s) := sqLoss_kernelMean_le T.toBoundedKernel.1 hclip_meas hclip_bound (ate P) s _ = _ := by apply integral_congr_ae filter_upwards [(mem_ae_iff_prob_eq_one measurableSet_Icc).mpr (T.toBoundedKernel.2.2 s)] with t ht simp [clip, ht.1, ht.2] have hfbound : ∀ s, f s ∈ Icc (-1 : ℝ) 1 := by intro s rw [Set.mem_Icc, ← abs_le] exact abs_kernelMean_le T.toBoundedKernel.1 (M := 1) hclip_abs s have hmeas : Measurable (fun s ↦ ∫ t, (t - ate P) ^ 2 ∂(T.toBoundedKernel.1 s)) := by exact ((measurable_id.sub measurable_const).pow_const 2).stronglyMeasurable |>.integral_kernel.measurable have hbound (s : Fin n → ObsRecord d) : |(∫ t, (t - ate P) ^ 2 ∂(T.toBoundedKernel.1 s))| ≤ 4 := by have hATE := ate_mem_unit_interval P have hs : ∀ᵐ t ∂(T.toBoundedKernel.1 s), t ∈ Icc (-1 : ℝ) 1 := (mem_ae_iff_prob_eq_one measurableSet_Icc).mpr (T.toBoundedKernel.2.2 s) have hle : ∀ᵐ t ∂(T.toBoundedKernel.1 s), (t - ate P) ^ 2 ≤ 4 := by filter_upwards [hs] with t ht rw [Set.mem_Icc] at ht hATE nlinarith [sq_nonneg (t - ate P + 2), sq_nonneg (t - ate P - 2)] have hnon : 0 ≤ ∫ t, (t - ate P) ^ 2 ∂(T.toBoundedKernel.1 s) := integral_nonneg (fun _ ↦ sq_nonneg _) rw [abs_of_nonneg hnon] simpa using integral_mono_of_nonneg (Filter.Eventually.of_forall fun t ↦ sq_nonneg _) (integrable_const 4) hle unfold deterministicRisk squaredRisk exact integral_mono_of_nonneg (Filter.Eventually.of_forall fun _ ↦ sq_nonneg _) (Integrable.of_bound hmeas.aestronglyMeasurable 4 (Filter.Eventually.of_forall fun s ↦ by simpa [Real.norm_eq_abs] using hbound s)) (Filter.Eventually.of_forall hpoint)
CausalSmith.Stat.MarRareqLogfrontier.complete_arrival_kernel_mean_risk_le · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/NearComplete/CompleteArrivalTwoPoint.lean:255
theorem complete_arrival_two_point_decision_reduction Lemma complete_arrival_two_point_decision_reduction in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
P₀ P₁ :
δ c :
ℝ
hδ :
0 < δ
hc :
0 ≤ c
hgap :
ate P₁ = ate P₀ + δ
hfloor :
∀ A : Set (Fin n → ObsRecord d)
then
(sampleLaw n P₁).real Aᶜ + (sampleLaw n P₀).real A ≥ c
T :
c * δ ^ 2 / 8 ≤ max (squaredRisk T P₀) (squaredRisk T P₁)
Proof (Lean source)
lemma complete_arrival_two_point_decision_reduction {n d : ℕ} (P₀ P₁ : FullLaw d) (δ c : ℝ) (hδ : 0 < δ) (hc : 0 ≤ c) (hgap : ate P₁ = ate P₀ + δ) (hfloor : ∀ A : Set (Fin n → ObsRecord d), MeasurableSet A → (sampleLaw n P₁).real Aᶜ + (sampleLaw n P₀).real A ≥ c) : ∀ T : Estimator n d, c * δ ^ 2 / 8 ≤ max (squaredRisk T P₀) (squaredRisk T P₁) := by intro T let f := Causalean.Stat.kernelMean T.toBoundedKernel.1 clip let E₀ : Set (Fin n → ObsRecord d) := {s | δ / 2 ≤ |f s - ate P₀|} let E₁ : Set (Fin n → ObsRecord d) := {s | δ / 2 ≤ |f s - ate P₁|} let A : Set (Fin n → ObsRecord d) := {s | |f s - ate P₁| ≤ |f s - ate P₀|} letI : IsMarkovKernel T.toBoundedKernel.1 := T.toBoundedKernel.2.1 letI : IsProbabilityMeasure P₀.1 := P₀.2 letI : IsProbabilityMeasure P₁.1 := P₁.2 letI : IsProbabilityMeasure (P₀.1.map obs) := Measure.isProbabilityMeasure_map (by fun_prop) letI : IsProbabilityMeasure (P₁.1.map obs) := Measure.isProbabilityMeasure_map (by fun_prop) letI : IsProbabilityMeasure (sampleLaw n P₀) := by unfold sampleLaw infer_instance letI : IsProbabilityMeasure (sampleLaw n P₁) := by unfold sampleLaw infer_instance have hf : Measurable f := measurable_kernelMean T.toBoundedKernel.1 (by unfold clip fun_prop) have hA : MeasurableSet A := by exact measurableSet_le (continuous_abs.measurable.comp (hf.sub measurable_const)) (continuous_abs.measurable.comp (hf.sub measurable_const)) have htri (s : Fin n → ObsRecord d) : δ ≤ |f s - ate P₀| + |f s - ate P₁| := by have ht := abs_sub_le (ate P₁) (f s) (ate P₀) have hdiff : |ate P₁ - ate P₀| = δ := by rw [hgap] simpa using abs_of_pos hδ calc δ = |ate P₁ - ate P₀| := hdiff.symm _ ≤ _ := by simpa [abs_sub_comm, add_comm] using ht have hA_E₀ : A ⊆ E₀ := by intro s hs simp only [A, E₀, Set.mem_setOf_eq] at hs ⊢ linarith [htri s] have hAc_E₁ : Aᶜ ⊆ E₁ := by intro s hs simp only [A, E₁, Set.mem_compl_iff, Set.mem_setOf_eq, not_le] at hs ⊢ linarith [htri s] have htest : c ≤ (sampleLaw n P₁).real E₁ + (sampleLaw n P₀).real E₀ := by calc c ≤ (sampleLaw n P₁).real Aᶜ + (sampleLaw n P₀).real A := hfloor A hA _ ≤ _ := add_le_add (measureReal_mono hAc_E₁ (by finiteness)) (measureReal_mono hA_E₀ (by finiteness)) have hbound (P : FullLaw d) : ∀ s, f s ∈ Icc (-1 : ℝ) 1 := by intro s rw [Set.mem_Icc, ← abs_le] exact abs_kernelMean_le T.toBoundedKernel.1 (M := 1) (fun t => by rw [abs_le]; constructor <;> simp [clip]) s have hint₀ : Integrable (fun s ↦ (f s - ate P₀) ^ 2) (sampleLaw n P₀) := mse_integrable_of_estimator_bound _ f hf (by norm_num) (hbound P₀) have hint₁ : Integrable (fun s ↦ (f s - ate P₁) ^ 2) (sampleLaw n P₁) := mse_integrable_of_estimator_bound _ f hf (by norm_num) (hbound P₁) have hmse₀ : (δ / 2) ^ 2 * (sampleLaw n P₀).real E₀ ≤ deterministicRisk f P₀ := by unfold deterministicRisk E₀ have hset : {s | (δ / 2) ^ 2 ≤ (f s - ate P₀) ^ 2} = {s | δ / 2 ≤ |f s - ate P₀|} := by ext s simp only [Set.mem_setOf_eq] rw [sq_le_sq, abs_of_nonneg (show (0 : ℝ) ≤ δ / 2 by positivity)] rw [← hset] exact mul_meas_ge_le_integral_of_nonneg (Filter.Eventually.of_forall fun s ↦ sq_nonneg _) hint₀ _ have hmse₁ : (δ / 2) ^ 2 * (sampleLaw n P₁).real E₁ ≤ deterministicRisk f P₁ := by unfold deterministicRisk E₁ have hset : {s | (δ / 2) ^ 2 ≤ (f s - ate P₁) ^ 2} = {s | δ / 2 ≤ |f s - ate P₁|} := by ext s simp only [Set.mem_setOf_eq] rw [sq_le_sq, abs_of_nonneg (show (0 : ℝ) ≤ δ / 2 by positivity)] rw [← hset] exact mul_meas_ge_le_integral_of_nonneg (Filter.Eventually.of_forall fun s ↦ sq_nonneg _) hint₁ _ have hmax : c / 2 ≤ max ((sampleLaw n P₀).real E₀) ((sampleLaw n P₁).real E₁) := by nlinarith [le_max_left ((sampleLaw n P₀).real E₀) ((sampleLaw n P₁).real E₁), le_max_right ((sampleLaw n P₀).real E₀) ((sampleLaw n P₁).real E₁)] calc c * δ ^ 2 / 8 ≤ (δ / 2) ^ 2 * max ((sampleLaw n P₀).real E₀) ((sampleLaw n P₁).real E₁) := by nlinarith [sq_nonneg δ] _ = max ((δ / 2) ^ 2 * (sampleLaw n P₀).real E₀) ((δ / 2) ^ 2 * (sampleLaw n P₁).real E₁) := by by_cases hle : (sampleLaw n P₀).real E₀ ≤ (sampleLaw n P₁).real E₁ · rw [max_eq_right hle, max_eq_right] exact mul_le_mul_of_nonneg_left hle (sq_nonneg _) · have hge := le_of_not_ge hle rw [max_eq_left hge, max_eq_left] exact mul_le_mul_of_nonneg_left hge (sq_nonneg _) _ ≤ max (deterministicRisk f P₀) (deterministicRisk f P₁) := max_le_max hmse₀ hmse₁ _ ≤ max (squaredRisk T P₀) (squaredRisk T P₁) := max_le_max (complete_arrival_kernel_mean_risk_le T P₀) (complete_arrival_kernel_mean_risk_le T P₁)
CausalSmith.Stat.MarRareqLogfrontier.complete_arrival_two_point_decision_reduction · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/NearComplete/CompleteArrivalTwoPoint.lean:322
theorem complete_arrival_two_point_minimax_floor Lemma complete_arrival_two_point_minimax_floor in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
hn :
1 ≤ n
P₀ P₁ :
hP₀ :
hP₁ :
δ :
ℝ
hδ :
0 < δ
hgap :
ate P₁ = ate P₀ + δ
hδsq :
δ ^ 2 = 1 / (16 * (n : ℝ))
hac :
(P₁.1.map obs) ≪ (P₀.1.map obs)
hchi :
chiSqDiv (P₁.1.map obs) (P₀.1.map obs) ≤ (1 / 8 : ℝ) / n
1 / (256 * (n : ℝ)) ≤ unrestrictedMinimaxRisk n d 1
Proof (Lean source)
lemma complete_arrival_two_point_minimax_floor {n d : ℕ} (hn : 1 ≤ n) (P₀ P₁ : FullLaw d) (hP₀ : UnrestrictedArrivalModelClass n d 1 P₀) (hP₁ : UnrestrictedArrivalModelClass n d 1 P₁) (δ : ℝ) (hδ : 0 < δ) (hgap : ate P₁ = ate P₀ + δ) (hδsq : δ ^ 2 = 1 / (16 * (n : ℝ))) (hac : (P₁.1.map obs) ≪ (P₀.1.map obs)) (hchi : chiSqDiv (P₁.1.map obs) (P₀.1.map obs) ≤ (1 / 8 : ℝ) / n) : 1 / (256 * (n : ℝ)) ≤ unrestrictedMinimaxRisk n d 1 := by apply unrestricted_minimax_lower_of_two_point P₀ P₁ hP₀ hP₁ intro T have hfloor := complete_arrival_chisq_testing_floor hn P₀ P₁ hac hchi have hrisk := complete_arrival_two_point_decision_reduction P₀ P₁ δ (1 / 2) hδ (by norm_num) hgap hfloor T have hnpos : (0 : ℝ) < n := by exact_mod_cast (lt_of_lt_of_le (by omega : 0 < 1) hn) rw [hδsq] at hrisk convert hrisk using 1 <;> ring
CausalSmith.Stat.MarRareqLogfrontier.complete_arrival_two_point_minimax_floor · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/NearComplete/CompleteArrivalTwoPoint.lean:439
theorem complete_arrival_frontier_direct

Uniformly over sample size and alphabet size, the complete-arrival minimax and estimator risks have the displayed parametric bounds.

Formal statement
n :
ℕ
shared
d :
ℕ
shared
n d :
ℕ
1 ≤ n
1 ≤ d
conclusion 1
1 / (256 * (n : ℝ)) ≤ unrestrictedMinimaxRisk n d 1
conclusion 3
≤ 4 / (n : ℝ)
Proof (Lean source)
theorem complete_arrival_frontier_direct : ∀ (n d : ℕ), 1 ≤ n → 1 ≤ d → 1 / (256 * (n : ℝ)) ≤ unrestrictedMinimaxRisk n d 1 ∧ unrestrictedMinimaxRisk n d 1 ≤ Causalean.Stat.worstCaseRiskReal (fun (_ : Unit) (P : {P : FullLaw d // UnrestrictedArrivalModelClass n d 1 P}) => deterministicRisk (completeArrivalHTEstimator n d) P.1) () ∧ Causalean.Stat.worstCaseRiskReal (fun (_ : Unit) (P : {P : FullLaw d // UnrestrictedArrivalModelClass n d 1 P}) => deterministicRisk (completeArrivalHTEstimator n d) P.1) () ≤ 4 / (n : ℝ) := by intro n d hn hd constructor · let x : Fin d := ⟨0, hd⟩ let δ : ℝ := 1 / (4 * sqrt n) have hnR : (0 : ℝ) < n := by exact_mod_cast (lt_of_lt_of_le (by omega : 0 < 1) hn) have hsqrt : 0 < sqrt (n : ℝ) := Real.sqrt_pos.2 hnR have hδ : 0 < δ := by dsimp [δ]; positivity have hn1 : (1 : ℝ) ≤ n := by exact_mod_cast hn have hsqrt1 : (1 : ℝ) ≤ sqrt n := by rw [← Real.sqrt_one] exact Real.sqrt_le_sqrt hn1 have hδle : δ ≤ 1 / 4 := by dsimp [δ] rw [div_le_iff₀ (by positivity : 0 < 4 * sqrt (n : ℝ))] nlinarith have hu₀ : (0 : ℝ) ≤ 1 / 2 ∧ (1 / 2 : ℝ) ≤ 1 := by norm_num have hu₁ : (0 : ℝ) ≤ 1 / 2 + δ ∧ (1 / 2 + δ : ℝ) ≤ 1 := by constructor <;> linarith let P₀ := completeFamilyLaw x (1 / 2) hu₀ let P₁ := completeFamilyLaw x (1 / 2 + δ) hu₁ have hgap : ate P₁ = ate P₀ + δ := by simp [P₀, P₁, completeFamilyLaw_ate] have hδsq : δ ^ 2 = 1 / (16 * (n : ℝ)) := by dsimp [δ] calc (1 / (4 * sqrt (n : ℝ))) ^ 2 = 1 / (16 * (sqrt (n : ℝ)) ^ 2) := by ring _ = 1 / (16 * (n : ℝ)) := by rw [Real.sq_sqrt (le_of_lt hnR)] have hP₀ : UnrestrictedArrivalModelClass n d 1 P₀ := by apply completeFamilyLaw_in_unrestricted_class_of_randomized hn hd x (1 / 2) hu₀ exact completeFamilyLaw_randomized x (1 / 2) hu₀ have hP₁ : UnrestrictedArrivalModelClass n d 1 P₁ := by apply completeFamilyLaw_in_unrestricted_class_of_randomized hn hd x (1 / 2 + δ) hu₁ exact completeFamilyLaw_randomized x (1 / 2 + δ) hu₁ have hac : (P₁.1.map obs) ≪ (P₀.1.map obs) := by simpa [P₀, P₁] using completeFamilyLaw_obs_ac x (1 / 2 + δ) hu₁ have hchi : chiSqDiv (P₁.1.map obs) (P₀.1.map obs) ≤ (1 / 8 : ℝ) / n := by have heq : chiSqDiv (P₁.1.map obs) (P₀.1.map obs) = 2 * δ ^ 2 := by simpa [P₀, P₁] using completeFamilyLaw_obs_chi x (1 / 2 + δ) hu₁ rw [heq, hδsq] apply le_of_eq field_simp [hnR.ne'] ring exact complete_arrival_two_point_minimax_floor hn P₀ P₁ hP₀ hP₁ δ hδ hgap hδsq hac hchi constructor · let f := completeArrivalHTEstimator n d have hEstimator := complete_arrival_ht_estimator_regular n d let T : Estimator n d := Estimator.ofMap f hEstimator have hrisk : ∀ (T : Estimator n d) (P : {P : FullLaw d // UnrestrictedArrivalModelClass n d 1 P}), 0 ≤ squaredRisk T P.1 := by intro T P exact integral_nonneg (fun s => integral_nonneg (fun y => sq_nonneg _)) have hval : unrestrictedMinimaxRisk n d 1 ≤ Causalean.Stat.worstCaseRiskReal (fun (_ : Unit) (P : {P : FullLaw d // UnrestrictedArrivalModelClass n d 1 P}) => squaredRisk T P.1) () := by exact Causalean.Stat.minimaxValue_le_worstCaseRisk_of_nonneg hrisk T have heq : (fun (_ : Unit) (P : {P : FullLaw d // UnrestrictedArrivalModelClass n d 1 P}) => squaredRisk T P.1) = (fun (_ : Unit) P => deterministicRisk f P.1) := by funext _ P simp [squaredRisk, deterministicRisk, T, Estimator.ofMap, Kernel.deterministic_apply] rw [heq] at hval exact hval · unfold Causalean.Stat.worstCaseRiskReal by_cases hne : Nonempty {P : FullLaw d // UnrestrictedArrivalModelClass n d 1 P} · letI := hne apply ciSup_le intro P let μ := P.1.1.map obs let ξ : ObsRecord d → ℝ := fun o => 2 * armSign o.A * (if o.R && o.RY then (1 : ℝ) else 0) letI : IsProbabilityMeasure P.1.1 := P.1.2 letI : IsProbabilityMeasure μ := Measure.isProbabilityMeasure_map (by fun_prop : AEMeasurable obs P.1.1) letI : IsProbabilityMeasure (sampleLaw n P.1) := by unfold sampleLaw infer_instance have htarget : ate P.1 ∈ Icc (-1 : ℝ) 1 := ate_mem_unit_interval P.1 have hbound : ∀ᵐ o ∂μ, ξ o ∈ Icc (-2 : ℝ) 2 := by filter_upwards [] with o cases hA : o.A <;> cases hR : o.R <;> cases hRY : o.RY <;> simp [ξ, armSign, hA, hR, hRY] have hLp : MemLp ξ 2 μ := memLp_of_bounded hbound (by fun_prop) 2 have hsquare : (∫ o, (ξ o) ^ 2 ∂μ) ≤ 4 := by have hint : Integrable (fun o => (ξ o) ^ 2) μ := hLp.integrable_sq have h := integral_mono hint (integrable_const (4 : ℝ)) simpa using h (fun o => by cases hA : o.A <;> cases hR : o.R <;> cases hRY : o.RY <;> norm_num [ξ, armSign, hA, hR, hRY]) have hmean : (∫ o, ξ o ∂μ) = ate P.1 := complete_arrival_score_mean P.1 P.2 have hiid := Causalean.Mathlib.Probability.iid_mean_sq_le μ hn ξ hLp have hsumLp : MemLp (fun s : Fin n → ObsRecord d => ∑ i : Fin n, ξ (s i)) 2 (sampleLaw n P.1) := by simpa [sampleLaw, μ] using (memLp_finset_sum univ (fun i _ => hLp.comp_measurePreserving (measurePreserving_eval (fun _ : Fin n => μ) i))) have hdevInt : Integrable (fun s : Fin n → ObsRecord d => ((n : ℝ)⁻¹ * ∑ i : Fin n, ξ (s i) - ate P.1) ^ 2) (sampleLaw n P.1) := ((hsumLp.const_mul _).sub (memLp_const _)).integrable_sq have hpoint (s : Fin n → ObsRecord d) : (completeArrivalHTEstimator n d s - ate P.1) ^ 2 ≤ ((n : ℝ)⁻¹ * ∑ i : Fin n, ξ (s i) - ate P.1) ^ 2 := by have hraw : (2 / (n : ℝ)) * ∑ i : Fin n, armSign (s i).A * (if (s i).R && (s i).RY then (1 : ℝ) else 0) = (n : ℝ)⁻¹ * ∑ i : Fin n, ξ (s i) := by simp only [ξ] simp_rw [mul_assoc] rw [← Finset.mul_sum] ring unfold completeArrivalHTEstimator rw [hraw] exact clip_sq_error_le _ _ htarget have hrisk : deterministicRisk (completeArrivalHTEstimator n d) P.1 ≤ (∫ s, ((n : ℝ)⁻¹ * ∑ i : Fin n, ξ (s i) - ate P.1) ^ 2 ∂(sampleLaw n P.1)) := by unfold deterministicRisk exact integral_mono_of_nonneg (ae_of_all _ (fun s => sq_nonneg _)) hdevInt (ae_of_all _ hpoint) calc deterministicRisk (completeArrivalHTEstimator n d) P.1 ≤ _ := hrisk _ ≤ (∫ o, (ξ o) ^ 2 ∂μ) / (n : ℝ) := by simpa [sampleLaw, μ, hmean] using hiid _ ≤ 4 / (n : ℝ) := by exact div_le_div_of_nonneg_right hsquare (by positivity) · haveI : IsEmpty {P : FullLaw d // UnrestrictedArrivalModelClass n d 1 P} := not_nonempty_iff.mp hne simp positivity
CausalSmith.Stat.MarRareqLogfrontier.complete_arrival_frontier_direct · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/NearComplete/CompleteArrivalTwoPoint.lean:459
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.NearComplete.ObservedContrast 9 declarations Armwise missing-outcome deficits and the clipped observed-contrast risk envelope.

Armwise missing-outcome deficits and the clipped observed-contrast risk envelope.

def armDeficit

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
d :
ℕ
P :
a :
armDeficit P a :
ℝ
2 * ∫ r, (if r.A = a ∧ r.R = false ∧ r.Y = true then (1 : ℝ) else 0) ∂P.1
theorem sum_armCell_event_mass

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
P :
a :
E :
(∑ j : Fin d × Bool, P.1.real {r | inCell r (a, j.1, j.2) ∧ r ∈ E})
= P.1.real {r | r.A = a ∧ r ∈ E}
Proof (Lean source)
-- @node: sum_armCell_event_mass lemma sum_armCell_event_mass {d : ℕ} (P : FullLaw d) (a : Bool) (E : Set (FullRecord d)) : (∑ j : Fin d × Bool, P.1.real {r | inCell r (a, j.1, j.2) ∧ r ∈ E}) = P.1.real {r | r.A = a ∧ r ∈ E} := by classical let : IsProbabilityMeasure P.1 := P.2 let μ := P.1.restrict {r | r.A = a ∧ r ∈ E} have hsum := sum_measureReal_preimage_singleton (μ := μ) (Finset.univ : Finset (Fin d × Bool)) (f := fun r : FullRecord d => (r.X, r.S)) (by intro; simp) calc (∑ j : Fin d × Bool, P.1.real {r | inCell r (a, j.1, j.2) ∧ r ∈ E}) = ∑ j : Fin d × Bool, μ.real ((fun r : FullRecord d => (r.X, r.S)) ⁻¹' {j}) := by apply Finset.sum_congr rfl intro j hj have hs : {r : FullRecord d | inCell r (a, j.1, j.2) ∧ r ∈ E} = ((fun r : FullRecord d => (r.X, r.S)) ⁻¹' {j}) ∩ {r | r.A = a ∧ r ∈ E} := by rcases j with ⟨x, s⟩ ext r simp [inCell, Prod.mk.injEq, and_assoc, and_left_comm, and_comm] rw [hs] simp [μ, measureReal_def, Measure.restrict_apply] _ = μ.real ((fun r : FullRecord d => (r.X, r.S)) ⁻¹' (Finset.univ : Finset (Fin d × Bool))) := hsum _ = P.1.real {r | r.A = a ∧ r ∈ E} := by simp [μ, measureReal_def, Measure.restrict_apply]
theorem absent_cell_mass_le

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
P :
j :
Cell d
P.1.real {r | inCell r j ∧ r.R = false} ≤ (1 - q) * cellProb P j
Proof (Lean source)
-- @node: absent_cell_mass_le lemma absent_cell_mass_le {n d : ℕ} {q : ℝ} (P : FullLaw d) (hP : UnrestrictedArrivalModelClass n d q P) (j : Cell d) : P.1.real {r | inCell r j ∧ r.R = false} ≤ (1 - q) * cellProb P j := by let : IsProbabilityMeasure P.1 := P.2 have harr : q * cellProb P j ≤ arrivedCell P j := by by_cases hp : 0 < cellProb P j · exact hP.arrival j hp · have hz : cellProb P j = 0 := le_antisymm (le_of_not_gt hp) measureReal_nonneg rw [hz, mul_zero] exact measureReal_nonneg have hdiff : {r : FullRecord d | inCell r j ∧ r.R = false} = {r | inCell r j} \ {r | inCell r j ∧ r.R = true} := by ext r cases r.R <;> simp <;> tauto rw [hdiff, measureReal_sdiff (by intro r hr; exact hr.1) (by simp)] change cellProb P j - arrivedCell P j ≤ _ linarith
theorem balanced_arm_mass

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
P :
a :
P.1.real {r | r.A = a} = 1 / 2
Proof (Lean source)
-- @node: balanced_arm_mass lemma balanced_arm_mass {d : ℕ} (P : FullLaw d) (hB : BalancedRandomization P) (a : Bool) : P.1.real {r | r.A = a} = 1 / 2 := by let : IsProbabilityMeasure P.1 := P.2 cases a with | true => exact hB | false => have hc : {r : FullRecord d | r.A = false} = {r | r.A = true}ᶜ := by ext r cases r.A <;> simp rw [hc, measureReal_compl (by simp), hB] norm_num
theorem armDeficit_eq_missingOutcomeMass

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
P :
a :
armDeficit P a = 2 * P.1.real {r | r.A = a ∧ r.R = false ∧ r.Y = true}
Proof (Lean source)
-- @node: armDeficit_eq_missingOutcomeMass lemma armDeficit_eq_missingOutcomeMass {d : ℕ} (P : FullLaw d) (a : Bool) : armDeficit P a = 2 * P.1.real {r | r.A = a ∧ r.R = false ∧ r.Y = true} := by classical let : IsProbabilityMeasure P.1 := P.2 unfold armDeficit have hi : (fun r : FullRecord d => if r.A = a ∧ r.R = false ∧ r.Y = true then (1 : ℝ) else 0) = {r : FullRecord d | r.A = a ∧ r.R = false ∧ r.Y = true}.indicator 1 := by funext r simp [indicator] rw [hi, integral_indicator_one (by simp)]
CausalSmith.Stat.MarRareqLogfrontier.armDeficit_eq_missingOutcomeMass · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/NearComplete/ObservedContrast.lean:84
theorem armDeficit_bounds

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
P :
a :
conclusion 1
0 ≤ armDeficit P a
conclusion 2
armDeficit P a ≤ 1 - q
Proof (Lean source)
-- @node: armDeficit_bounds lemma armDeficit_bounds {n d : ℕ} {q : ℝ} (P : FullLaw d) (hP : UnrestrictedArrivalModelClass n d q P) (a : Bool) : 0 ≤ armDeficit P a ∧ armDeficit P a ≤ 1 - q := by classical let : IsProbabilityMeasure P.1 := P.2 rw [armDeficit_eq_missingOutcomeMass] constructor · positivity · have hsum : (∑ j : Fin d × Bool, cellProb P (a, j.1, j.2)) = 1 / 2 := by have h := sum_armCell_event_mass P a univ simp only [Set.mem_univ, and_true] at h exact h.trans (balanced_arm_mass P hP.balanced a) have habsent : P.1.real {r | r.A = a ∧ r.R = false} ≤ (1 - q) / 2 := by calc P.1.real {r | r.A = a ∧ r.R = false} = ∑ j : Fin d × Bool, P.1.real {r | inCell r (a, j.1, j.2) ∧ r.R = false} := (sum_armCell_event_mass P a {r | r.R = false}).symm _ ≤ ∑ j : Fin d × Bool, (1 - q) * cellProb P (a, j.1, j.2) := Finset.sum_le_sum (fun j _ => absent_cell_mass_le P hP _) _ = (1 - q) / 2 := by rw [← Finset.mul_sum, hsum]; ring have hout : P.1.real {r | r.A = a ∧ r.R = false ∧ r.Y = true} ≤ P.1.real {r | r.A = a ∧ r.R = false} := measureReal_mono (by intro r hr; exact ⟨hr.1, hr.2.1⟩) linarith
theorem observed_contrast_score_mean

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
P :
(∫ o : ObsRecord d, 2 * armSign o.A * (if o.R && o.RY then (1 : ℝ) else 0) ∂(P.1.map obs))
Proof (Lean source)
-- @node: observed_contrast_score_mean lemma observed_contrast_score_mean {n d : ℕ} {q : ℝ} (P : FullLaw d) (hP : UnrestrictedArrivalModelClass n d q P) : (∫ o : ObsRecord d, 2 * armSign o.A * (if o.R && o.RY then (1 : ℝ) else 0) ∂(P.1.map obs)) = ate P - armDeficit P true + armDeficit P false := by classical let : IsProbabilityMeasure P.1 := P.2 rw [integral_map (by fun_prop) (by fun_prop)] let E (a : Bool) : Set (FullRecord d) := {r | r.A = a ∧ r.Y = true} let M (a : Bool) : Set (FullRecord d) := {r | r.A = a ∧ r.R = false ∧ r.Y = true} have hp : (fun r : FullRecord d => 2 * armSign (obs r).A * (if (obs r).R && (obs r).RY then (1 : ℝ) else 0)) = (fun r => (E true).indicator (fun _ => (2 : ℝ)) r - (E false).indicator (fun _ => (2 : ℝ)) r - (M true).indicator (fun _ => (2 : ℝ)) r + (M false).indicator (fun _ => (2 : ℝ)) r) := by funext r cases hA : r.A <;> cases hR : r.R <;> cases hY : r.Y <;> simp [obs, armSign, E, M, indicator, hA, hR, hY] rw [hp] have hi (a : Bool) : Integrable ((E a).indicator (fun _ => (2 : ℝ))) P.1 := by exact (integrable_const (2 : ℝ)).indicator (by simp [E]) have hm (a : Bool) : Integrable ((M a).indicator (fun _ => (2 : ℝ))) P.1 := by exact (integrable_const (2 : ℝ)).indicator (by simp [M]) have hit := hi true have hif := hi false have hmt := hm true have hmf := hm false integral_linearity rw [integral_indicator_const (s := E true) (2 : ℝ) (by simp [E]), integral_indicator_const (s := E false) (2 : ℝ) (by simp [E]), integral_indicator_const (s := M true) (2 : ℝ) (by simp [M]), integral_indicator_const (s := M false) (2 : ℝ) (by simp [M])] simp only [smul_eq_mul] rw [armDeficit_eq_missingOutcomeMass, armDeficit_eq_missingOutcomeMass, ate_eq_potentialOutcomeMass] have ht := randomized_armOutcomeMass P hP.randomized hP.balanced true have hf := randomized_armOutcomeMass P hP.randomized hP.balanced false simp only [ite_true, Bool.false_eq_true, ite_false] at ht hf dsimp only [E, M] linear_combination ht - hf
CausalSmith.Stat.MarRareqLogfrontier.observed_contrast_score_mean · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/NearComplete/ObservedContrast.lean:125
theorem observed_contrast_score_bias_le

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
P :
((∫ o : ObsRecord d, 2 * armSign o.A * (if o.R && o.RY then (1 : ℝ) else 0) ∂(P.1.map obs)) - ate P) ^ 2
≤ (1 - q) ^ 2
Proof (Lean source)
-- @node: observed_contrast_score_bias_le lemma observed_contrast_score_bias_le {n d : ℕ} {q : ℝ} (P : FullLaw d) (hP : UnrestrictedArrivalModelClass n d q P) : ((∫ o : ObsRecord d, 2 * armSign o.A * (if o.R && o.RY then (1 : ℝ) else 0) ∂(P.1.map obs)) - ate P) ^ 2 ≤ (1 - q) ^ 2 := by rw [observed_contrast_score_mean P hP] have ht := armDeficit_bounds P hP true have hf := armDeficit_bounds P hP false have habs : |ate P - armDeficit P true + armDeficit P false - ate P| ≤ 1 - q := by rw [abs_le] constructor <;> linarith have hsq := (sq_le_sq₀ (abs_nonneg _) (sub_nonneg.mpr hP.q_le_one)).mpr habs simpa only [sq_abs] using hsq
CausalSmith.Stat.MarRareqLogfrontier.observed_contrast_score_bias_le · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/NearComplete/ObservedContrast.lean:170
theorem observed_contrast_risk_le

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
P :
deterministicRisk (completeArrivalHTEstimator n d) P ≤ 4 / (n : ℝ) + (1 - q) ^ 2
Proof (Lean source)
-- @node: observed_contrast_risk_le lemma observed_contrast_risk_le {n d : ℕ} {q : ℝ} (P : FullLaw d) (hP : UnrestrictedArrivalModelClass n d q P) : deterministicRisk (completeArrivalHTEstimator n d) P ≤ 4 / (n : ℝ) + (1 - q) ^ 2 := by classical let : IsProbabilityMeasure P.1 := P.2 let μ := P.1.map obs let : IsProbabilityMeasure μ := Measure.isProbabilityMeasure_map (by fun_prop) let : IsProbabilityMeasure (sampleLaw n P) := by unfold sampleLaw infer_instance let ξ : ObsRecord d → ℝ := fun o => 2 * armSign o.A * (if o.R && o.RY then (1 : ℝ) else 0) let V : (Fin n → ObsRecord d) → ℝ := fun s => (n : ℝ)⁻¹ * ∑ i, ξ (s i) have hξ : MemLp ξ 2 μ := ⟨by fun_prop, eLpNorm_lt_top_of_finite⟩ have hV : MemLp V 2 (sampleLaw n P) := ⟨by fun_prop, eLpNorm_lt_top_of_finite⟩ have hmean : (∫ s, V s ∂sampleLaw n P) = ∫ o, ξ o ∂μ := iid_average_integral μ n hP.n_pos ξ (hξ.integrable (by norm_num)) have hvar : variance V (sampleLaw n P) = (n : ℝ)⁻¹ * variance ξ μ := Causalean.Mathlib.Probability.iid_average_variance μ n ξ hξ have hbound : ∀ᵐ o ∂μ, ξ o ∈ Icc (-2) 2 := by filter_upwards [] with o dsimp only [ξ] cases o.A <;> cases o.R <;> cases o.RY <;> norm_num [armSign] have hvarle : variance ξ μ ≤ 4 := by have h := variance_le_sq_of_bounded hbound hξ.aemeasurable norm_num at h exact h have hdecomp : (∫ s, (V s - ate P) ^ 2 ∂sampleLaw n P) = (n : ℝ)⁻¹ * variance ξ μ + ((∫ o, ξ o ∂μ) - ate P) ^ 2 := by have h := variance_eq_sub (hV.sub (memLp_const (ate P))) change variance (fun s => V s - ate P) (sampleLaw n P) = (∫ s, (V s - ate P) ^ 2 ∂sampleLaw n P) - (∫ s, V s - ate P ∂sampleLaw n P) ^ 2 at h rw [variance_sub_const hV.aestronglyMeasurable, hvar, integral_sub (hV.integrable (by norm_num)) (integrable_const _), integral_const, probReal_univ, one_smul, hmean] at h linarith have hclip : ∀ s, (completeArrivalHTEstimator n d s - ate P) ^ 2 ≤ (V s - ate P) ^ 2 := by intro s have he : completeArrivalHTEstimator n d s = clip (V s) := by unfold completeArrivalHTEstimator V ξ congr 1 simp only [Finset.mul_sum] apply Finset.sum_congr rfl intro i hi simp only [div_eq_mul_inv] ring rw [he] exact clip_sq_error_le _ _ (ate_mem_unit_interval P) calc deterministicRisk (completeArrivalHTEstimator n d) P ≤ ∫ s, (V s - ate P) ^ 2 ∂sampleLaw n P := integral_mono Integrable.of_finite Integrable.of_finite hclip _ = (n : ℝ)⁻¹ * variance ξ μ + ((∫ o, ξ o ∂μ) - ate P) ^ 2 := hdecomp _ ≤ 4 / (n : ℝ) + (1 - q) ^ 2 := by have hb := observed_contrast_score_bias_le P hP change ((∫ o, ξ o ∂μ) - ate P) ^ 2 ≤ (1 - q) ^ 2 at hb have hv := mul_le_mul_of_nonneg_left hvarle (inv_nonneg.mpr (Nat.cast_nonneg n)) simpa only [div_eq_mul_inv, mul_comm] using add_le_add hv hb
CausalSmith.Stat.MarRareqLogfrontier.observed_contrast_risk_le · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/NearComplete/ObservedContrast.lean:186
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.OneCell 28 declarations One-cell testing lower bounds inside the original rare-arrival model.

One-cell testing lower bounds inside the original rare-arrival model.

def oneCellRecord

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
d :
ℕ
x :
Fin d
a y r :
oneCellRecord x a y r :
⟨x, a, false, false, false, y, r⟩
CausalSmith.Stat.MarRareqLogfrontier.oneCellRecord · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/OneCell.lean:17
def oneCellMeasure

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
d :
ℕ
x :
Fin d
u q :
ℝ
oneCellMeasure x u q :
∑ a : Bool, ∑ y : Bool, ∑ r : Bool, ofReal (completeBernWeight (1 / 2) a * completeBernWeight u y * completeBernWeight q r) • Measure.dirac (oneCellRecord x a y r)
CausalSmith.Stat.MarRareqLogfrontier.oneCellMeasure · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/OneCell.lean:22
theorem oneCellMeasure_univ

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
x :
Fin d
u q :
ℝ
hu :
0 ≤ u ∧ u ≤ 1
hq :
0 ≤ q ∧ q ≤ 1
Proof (Lean source)
lemma oneCellMeasure_univ {d : ℕ} (x : Fin d) (u q : ℝ) (hu : 0 ≤ u ∧ u ≤ 1) (hq : 0 ≤ q ∧ q ≤ 1) : oneCellMeasure x u q univ = 1 := by have hu' : 0 ≤ 1 - u := by linarith [hu.2] have hq' : 0 ≤ 1 - q := by linarith [hq.2] simp [oneCellMeasure, completeBernWeight] norm_num at ⊢ rw [ENNReal.ofReal_mul (p := (1 / 2 : ℝ) * u) (mul_nonneg (by norm_num) hu.1), ENNReal.ofReal_mul (p := (1 / 2 : ℝ) * u) (mul_nonneg (by norm_num) hu.1), ENNReal.ofReal_mul (p := (1 / 2 : ℝ) * (1 - u)) (mul_nonneg (by norm_num) hu'), ENNReal.ofReal_mul (p := (1 / 2 : ℝ) * (1 - u)) (mul_nonneg (by norm_num) hu')] simp only [ENNReal.ofReal_mul (p := (1 / 2 : ℝ)) (by norm_num)] have hu_sum : ofReal u + ofReal (1 - u) = 1 := by rw [← ENNReal.ofReal_add hu.1 hu'] norm_num have hq_sum : ofReal q + ofReal (1 - q) = 1 := by rw [← ENNReal.ofReal_add hq.1 hq'] norm_num calc _ = (ofReal (1 / 2 : ℝ) + ofReal (1 / 2 : ℝ)) * (ofReal u + ofReal (1 - u)) * (ofReal q + ofReal (1 - q)) := by ring _ = 1 := by rw [hu_sum, hq_sum] simp only [mul_one] rw [← ENNReal.ofReal_add (by norm_num : (0 : ℝ) ≤ 1 / 2) (by norm_num : (0 : ℝ) ≤ 1 / 2)] norm_num
CausalSmith.Stat.MarRareqLogfrontier.oneCellMeasure_univ · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/OneCell.lean:31
def oneCellFamilyLaw

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
d :
ℕ
x :
Fin d
u q :
ℝ
hu :
0 ≤ u ∧ u ≤ 1
hq :
0 ≤ q ∧ q ≤ 1
oneCellFamilyLaw x u q hu hq :
⟨oneCellMeasure x u q, ⟨oneCellMeasure_univ x u q hu hq⟩⟩
CausalSmith.Stat.MarRareqLogfrontier.oneCellFamilyLaw · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/OneCell.lean:66
theorem oneCellFamilyLaw_ate

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
x :
Fin d
u q :
ℝ
hu :
0 ≤ u ∧ u ≤ 1
hq :
0 ≤ q ∧ q ≤ 1
ate (oneCellFamilyLaw x u q hu hq) = u
Proof (Lean source)
lemma oneCellFamilyLaw_ate {d : ℕ} (x : Fin d) (u q : ℝ) (hu : 0 ≤ u ∧ u ≤ 1) (hq : 0 ≤ q ∧ q ≤ 1) : ate (oneCellFamilyLaw x u q hu hq) = u := by let f : FullRecord d → ℝ := fun r => (if r.Y1 then 1 else 0) - (if r.Y0 then 1 else 0) have hInt (a y r : Bool) : Integrable f (ofReal (completeBernWeight (1 / 2) a * completeBernWeight u y * completeBernWeight q r) • Measure.dirac (oneCellRecord x a y r)) := by exact (integrable_dirac (by simp)).smul_measure ENNReal.ofReal_ne_top unfold ate oneCellFamilyLaw oneCellMeasure change (∫ w, f w ∂(∑ a : Bool, ∑ y : Bool, ∑ r : Bool, ofReal (completeBernWeight (1 / 2) a * completeBernWeight u y * completeBernWeight q r) • Measure.dirac (oneCellRecord x a y r))) = u have hr (a y : Bool) : (∫ w, f w ∂(∑ r : Bool, ofReal (completeBernWeight (1 / 2) a * completeBernWeight u y * completeBernWeight q r) • Measure.dirac (oneCellRecord x a y r))) = ∑ r : Bool, ∫ w, f w ∂(ofReal (completeBernWeight (1 / 2) a * completeBernWeight u y * completeBernWeight q r) • Measure.dirac (oneCellRecord x a y r)) := by exact integral_finsetSum_measure (by intro r _; exact hInt a y r) have hy (a : Bool) : (∫ w, f w ∂(∑ y : Bool, ∑ r : Bool, ofReal (completeBernWeight (1 / 2) a * completeBernWeight u y * completeBernWeight q r) • Measure.dirac (oneCellRecord x a y r))) = ∑ y : Bool, ∫ w, f w ∂(∑ r : Bool, ofReal (completeBernWeight (1 / 2) a * completeBernWeight u y * completeBernWeight q r) • Measure.dirac (oneCellRecord x a y r)) := by exact integral_finsetSum_measure (by intro y _ apply (integrable_finsetSum_measure).2 intro r _ exact hInt a y r) rw [integral_finsetSum_measure] · simp_rw [hy, hr] simp [f, oneCellRecord, completeBernWeight, integral_smul_measure, integral_dirac] have hu' : 0 ≤ 1 - u := by linarith [hu.2] have hq' : 0 ≤ 1 - q := by linarith [hq.2] norm_num [ENNReal.toReal_ofReal, hu.1, hu', hq.1, hq'] ring · intro a ha apply (integrable_finsetSum_measure).2 intro y hy apply (integrable_finsetSum_measure).2 intro r hr exact hInt a y r
CausalSmith.Stat.MarRareqLogfrontier.oneCellFamilyLaw_ate · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/OneCell.lean:72
theorem oneCellFamilyLaw_consistency

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
x :
Fin d
u q :
ℝ
hu :
0 ≤ u ∧ u ≤ 1
hq :
0 ≤ q ∧ q ≤ 1
conclusion 1
conclusion 2
Proof (Lean source)
lemma oneCellFamilyLaw_consistency {d : ℕ} (x : Fin d) (u q : ℝ) (hu : 0 ≤ u ∧ u ≤ 1) (hq : 0 ≤ q ∧ q ≤ 1) : SurrogateConsistency (oneCellFamilyLaw x u q hu hq) ∧ OutcomeConsistency (oneCellFamilyLaw x u q hu hq) := by constructor · filter_upwards [] with r rfl · filter_upwards [] with r rfl
CausalSmith.Stat.MarRareqLogfrontier.oneCellFamilyLaw_consistency · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/OneCell.lean:127
theorem oneCellFamilyLaw_support

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
x :
Fin d
u q :
ℝ
hu :
0 ≤ u ∧ u ≤ 1
hq :
0 ≤ q ∧ q ≤ 1
∀ᵐ w : FullRecord d ∂((oneCellFamilyLaw x u q hu hq).1), w.X
= x ∧ w.S0 = false ∧ w.S1 = false ∧ w.Y0 = false
Proof (Lean source)
lemma oneCellFamilyLaw_support {d : ℕ} (x : Fin d) (u q : ℝ) (hu : 0 ≤ u ∧ u ≤ 1) (hq : 0 ≤ q ∧ q ≤ 1) : ∀ᵐ w : FullRecord d ∂((oneCellFamilyLaw x u q hu hq).1), w.X = x ∧ w.S0 = false ∧ w.S1 = false ∧ w.Y0 = false := by simp [oneCellFamilyLaw, oneCellMeasure, oneCellRecord, Measure.ae_smul_measure]
CausalSmith.Stat.MarRareqLogfrontier.oneCellFamilyLaw_support · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/OneCell.lean:139
theorem oneCellFamilyLaw_iid

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
x :
Fin d
u q :
ℝ
hu :
0 ≤ u ∧ u ≤ 1
hq :
0 ≤ q ∧ q ≤ 1
IIDSampling n (sampleLaw n (oneCellFamilyLaw x u q hu hq)) (fun (i : Fin n) (s : Fin n → ObsRecord d) => s i) (oneCellFamilyLaw x u q hu hq)
Proof (Lean source)
lemma oneCellFamilyLaw_iid {n d : ℕ} (x : Fin d) (u q : ℝ) (hu : 0 ≤ u ∧ u ≤ 1) (hq : 0 ≤ q ∧ q ≤ 1) : IIDSampling n (sampleLaw n (oneCellFamilyLaw x u q hu hq)) (fun (i : Fin n) (s : Fin n → ObsRecord d) => s i) (oneCellFamilyLaw x u q hu hq) := sampleLaw_iid n _
CausalSmith.Stat.MarRareqLogfrontier.oneCellFamilyLaw_iid · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/OneCell.lean:147
theorem oneCellFamilyLaw_balanced

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
x :
Fin d
u q :
ℝ
hu :
0 ≤ u ∧ u ≤ 1
hq :
0 ≤ q ∧ q ≤ 1
Proof (Lean source)
lemma oneCellFamilyLaw_balanced {d : ℕ} (x : Fin d) (u q : ℝ) (hu : 0 ≤ u ∧ u ≤ 1) (hq : 0 ≤ q ∧ q ≤ 1) : BalancedRandomization (oneCellFamilyLaw x u q hu hq) := by have hu' : 0 ≤ 1 - u := by linarith [hu.2] have hq' : 0 ≤ 1 - q := by linarith [hq.2] simp [BalancedRandomization, Measure.real, oneCellFamilyLaw, oneCellMeasure, oneCellRecord, completeBernWeight, hu.1, hu'] have hu_sum : ofReal u + ofReal (1 - u) = 1 := by rw [← ENNReal.ofReal_add hu.1 hu'] norm_num have hq_sum : ofReal q + ofReal (1 - q) = 1 := by rw [← ENNReal.ofReal_add hq.1 hq'] norm_num rw [show (2⁻¹ * ofReal u * ofReal q + 2⁻¹ * ofReal u * ofReal (1 - q) + (2⁻¹ * ofReal (1 - u) * ofReal q + 2⁻¹ * ofReal (1 - u) * ofReal (1 - q))) = (2⁻¹ : ℝ≥0∞) * (ofReal u + ofReal (1 - u)) * (ofReal q + ofReal (1 - q)) by ring, hu_sum, hq_sum] norm_num
CausalSmith.Stat.MarRareqLogfrontier.oneCellFamilyLaw_balanced · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/OneCell.lean:156
theorem oneCellFamilyLaw_arrival_mass

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
x :
Fin d
u q :
ℝ
hu :
0 ≤ u ∧ u ≤ 1
hq :
0 ≤ q ∧ q ≤ 1
(oneCellFamilyLaw x u q hu hq).1.real {r | r.R = true} = q
Proof (Lean source)
lemma oneCellFamilyLaw_arrival_mass {d : ℕ} (x : Fin d) (u q : ℝ) (hu : 0 ≤ u ∧ u ≤ 1) (hq : 0 ≤ q ∧ q ≤ 1) : (oneCellFamilyLaw x u q hu hq).1.real {r | r.R = true} = q := by have hu' : 0 ≤ 1 - u := by linarith [hu.2] simp [Measure.real, oneCellFamilyLaw, oneCellMeasure, oneCellRecord, completeBernWeight, hu.1, hu'] have hu_sum : ofReal u + ofReal (1 - u) = 1 := by rw [← ENNReal.ofReal_add hu.1 hu'] norm_num have hhalf : ofReal (1 / 2 : ℝ) = (2 : ℝ≥0∞)⁻¹ := by rw [ENNReal.ofReal_div_of_pos (by norm_num)] norm_num norm_num only [ENNReal.ofReal_mul, hu.1, hu', hq.1] at ⊢ rw [ENNReal.ofReal_mul (p := (1 / 2 : ℝ) * u) (mul_nonneg (by norm_num) hu.1), ENNReal.ofReal_mul (p := (1 / 2 : ℝ) * (1 - u)) (mul_nonneg (by norm_num) hu'), ENNReal.ofReal_mul (p := (1 / 2 : ℝ)) (by norm_num)] rw [hhalf] rw [ENNReal.ofReal_mul (p := (1 / 2 : ℝ)) (by norm_num), hhalf] calc _ = (((2 : ℝ≥0∞)⁻¹ + 2⁻¹) * (ofReal u + ofReal (1 - u)) * ofReal q).toReal := by congr 1 ring _ = q := by rw [hu_sum, ENNReal.inv_two_add_inv_two]; simp [hq.1]
CausalSmith.Stat.MarRareqLogfrontier.oneCellFamilyLaw_arrival_mass · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/OneCell.lean:181
theorem oneCellFamilyLaw_randomized

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
x :
Fin d
u q :
ℝ
hu :
0 ≤ u ∧ u ≤ 1
hq :
0 ≤ q ∧ q ≤ 1
Proof (Lean source)
lemma oneCellFamilyLaw_randomized {d : ℕ} (x : Fin d) (u q : ℝ) (hu : 0 ≤ u ∧ u ≤ 1) (hq : 0 ≤ q ∧ q ≤ 1) : RandomizedIndependence (oneCellFamilyLaw x u q hu hq) := by rw [RandomizedIndependence, indepFun_iff_measure_inter_preimage_eq_mul] intro s t _ _ have hu' : 0 ≤ 1 - u := by linarith [hu.2] have hq' : 0 ≤ 1 - q := by linarith [hq.2] have hsum_u : ofReal u + ofReal (1 - u) = 1 := by rw [← ENNReal.ofReal_add hu.1 hu'] norm_num have hsum_q : ofReal q + ofReal (1 - q) = 1 := by rw [← ENNReal.ofReal_add hq.1 hq'] norm_num have hhalf : (1 - 2⁻¹ : ℝ) = 2⁻¹ := by norm_num have hfactor (a b : ℝ) (ha : 0 ≤ a) (hb : 0 ≤ b) : ofReal (2⁻¹ * a * b) = (2⁻¹ : ℝ≥0∞) * ofReal a * ofReal b := by rw [ENNReal.ofReal_mul (mul_nonneg (by norm_num) ha), ENNReal.ofReal_mul (by norm_num : (0 : ℝ) ≤ 2⁻¹)] norm_num [ENNReal.ofReal_div_of_pos] have htwo : (2⁻¹ : ℝ≥0∞) * 2 = 1 := by rw [mul_two] exact ENNReal.inv_two_add_inv_two have hdouble (z : ℝ≥0∞) : (2⁻¹ : ℝ≥0∞) * (z + z) = z := by rw [← two_mul, ← mul_assoc, htwo] simp simp [oneCellFamilyLaw, oneCellMeasure, oneCellRecord, completeBernWeight, indicator] rw [hhalf] simp only [hfactor u q hu.1 hq.1, hfactor u (1-q) hu.1 hq', hfactor (1-u) q hu' hq.1, hfactor (1-u) (1-q) hu' hq'] by_cases hsT : true ∈ s <;> by_cases hsF : false ∈ s <;> by_cases htT : (x, false, false, false, true) ∈ t <;> by_cases htF : (x, false, false, false, false) ∈ t <;> simp [hsT, hsF, htT, htF, Set.mem_inter_iff, ← mul_add, hsum_u, hsum_q] <;> norm_num [ENNReal.inv_two_add_inv_two] <;> simp [pow_two, mul_assoc, mul_comm, mul_left_comm, htwo, hdouble] all_goals calc _ = (2⁻¹ : ℝ≥0∞) * ofReal u := by ring _ = (2⁻¹ : ℝ≥0∞) * (2⁻¹ * (ofReal u + ofReal u)) := by rw [hdouble] _ = _ := by ring
CausalSmith.Stat.MarRareqLogfrontier.oneCellFamilyLaw_randomized · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/OneCell.lean:208
theorem oneCellFamilyLaw_mar

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
x :
Fin d
u q :
ℝ
hu :
0 ≤ u ∧ u ≤ 1
hq :
0 ≤ q ∧ q ≤ 1
Proof (Lean source)
lemma oneCellFamilyLaw_mar {d : ℕ} (x : Fin d) (u q : ℝ) (hu : 0 ≤ u ∧ u ≤ 1) (hq : 0 ≤ q ∧ q ≤ 1) : ArrivalMAR (oneCellFamilyLaw x u q hu hq) := by have hu' : 0 ≤ 1 - u := sub_nonneg.mpr hu.2 have hq' : 0 ≤ 1 - q := sub_nonneg.mpr hq.2 have h₀ : 0 ≤ u * (1 / 2) + u * q * (-1 / 2) := by nlinarith [mul_nonneg hu.1 hq'] have h₁ : 0 ≤ 1 / 2 + u * (-1 / 2) + u * q * (1 / 2) + q * (-1 / 2) := by nlinarith [mul_nonneg hu' hq'] have h₂ : 0 ≤ u * q * (1 / 2) := by nlinarith [mul_nonneg hu.1 hq.1] have h₃ : 0 ≤ u * q * (-1 / 2) + q * (1 / 2) := by nlinarith [mul_nonneg hu' hq.1] have h₄ : 0 ≤ (1 / 2 : ℝ) * u * q := mul_nonneg (mul_nonneg (by norm_num) hu.1) hq.1 have h₅ : 0 ≤ (1 / 2 : ℝ) * u * (1 - q) := mul_nonneg (mul_nonneg (by norm_num) hu.1) hq' have h₆ : 0 ≤ (1 / 2 : ℝ) * (1 - u) * q := mul_nonneg (mul_nonneg (by norm_num) hu') hq.1 have h₇ : 0 ≤ (1 / 2 : ℝ) * (1 - u) * (1 - q) := mul_nonneg (mul_nonneg (by norm_num) hu') hq' intro j y r cases j with | mk a xs => cases xs with | mk x' s => cases a <;> cases s <;> cases y <;> cases r <;> by_cases hx : x = x' all_goals simp [Measure.real, oneCellFamilyLaw, oneCellMeasure, completeBernWeight, oneCellRecord, FullRecord.Y, FullRecord.S, cellProb, inCell, indicator, hx, hu.1, hu', hq.1, hq', h₀, h₁, h₂, h₃, h₄, h₅, h₆, h₇, ENNReal.toReal_add, ENNReal.toReal_ofReal, ENNReal.toReal_mul] all_goals repeat rw [ENNReal.toReal_add (by finiteness) (by finiteness)] try simp [ENNReal.toReal_mul, ENNReal.toReal_ofReal, hu.1, hu', hq.1, hq'] ring
CausalSmith.Stat.MarRareqLogfrontier.oneCellFamilyLaw_mar · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/OneCell.lean:255
theorem oneCellFamilyLaw_arrivedCell

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
x :
Fin d
u q :
ℝ
hu :
0 ≤ u ∧ u ≤ 1
hq :
0 ≤ q ∧ q ≤ 1
j :
Cell d
= q * cellProb (oneCellFamilyLaw x u q hu hq) j
Proof (Lean source)
lemma oneCellFamilyLaw_arrivedCell {d : ℕ} (x : Fin d) (u q : ℝ) (hu : 0 ≤ u ∧ u ≤ 1) (hq : 0 ≤ q ∧ q ≤ 1) (j : Cell d) : arrivedCell (oneCellFamilyLaw x u q hu hq) j = q * cellProb (oneCellFamilyLaw x u q hu hq) j := by have hu' : 0 ≤ 1 - u := sub_nonneg.mpr hu.2 have hq' : 0 ≤ 1 - q := sub_nonneg.mpr hq.2 have h₀ : 0 ≤ u * (1 / 2) + u * q * (-1 / 2) := by nlinarith [mul_nonneg hu.1 hq'] have h₁ : 0 ≤ 1 / 2 + u * (-1 / 2) + u * q * (1 / 2) + q * (-1 / 2) := by nlinarith [mul_nonneg hu' hq'] have h₂ : 0 ≤ u * q * (1 / 2) := by nlinarith [mul_nonneg hu.1 hq.1] have h₃ : 0 ≤ u * q * (-1 / 2) + q * (1 / 2) := by nlinarith [mul_nonneg hu' hq.1] have h₄ : 0 ≤ (1 / 2 : ℝ) * u * q := mul_nonneg (mul_nonneg (by norm_num) hu.1) hq.1 have h₅ : 0 ≤ (1 / 2 : ℝ) * u * (1 - q) := mul_nonneg (mul_nonneg (by norm_num) hu.1) hq' have h₆ : 0 ≤ (1 / 2 : ℝ) * (1 - u) * q := mul_nonneg (mul_nonneg (by norm_num) hu') hq.1 have h₇ : 0 ≤ (1 / 2 : ℝ) * (1 - u) * (1 - q) := mul_nonneg (mul_nonneg (by norm_num) hu') hq' cases j with | mk a xs => cases xs with | mk x' s => cases a <;> cases s <;> by_cases hx : x = x' all_goals simp [arrivedCell, cellProb, Measure.real, oneCellFamilyLaw, oneCellMeasure, completeBernWeight, oneCellRecord, FullRecord.Y, FullRecord.S, inCell, indicator, hx, hu.1, hu', hq.1, hq', h₀, h₁, h₂, h₃, h₄, h₅, h₆, h₇, ENNReal.toReal_add, ENNReal.toReal_ofReal, ENNReal.toReal_mul] all_goals try rw [ENNReal.toReal_ofReal h₂] all_goals try rw [ENNReal.toReal_ofReal h₃] all_goals try rw [ENNReal.toReal_ofReal h₀] all_goals try rw [ENNReal.toReal_ofReal h₁] all_goals try ring all_goals repeat rw [ENNReal.toReal_add (by finiteness) (by finiteness)] try simp [ENNReal.toReal_mul, ENNReal.toReal_ofReal, hu.1, hu', hq.1, hq'] ring all_goals rw [ENNReal.toReal_ofReal h₂, ENNReal.toReal_ofReal h₃, ENNReal.toReal_ofReal h₀, ENNReal.toReal_ofReal h₁] ring
CausalSmith.Stat.MarRareqLogfrontier.oneCellFamilyLaw_arrivedCell · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/OneCell.lean:295
theorem oneCellFamilyLaw_model

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
x :
Fin d
u q :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hu :
0 ≤ u ∧ u ≤ 1
hq :
0 < q
hq1 :
q ≤ 1
hslice :
RareArrivalModelClass n d q (oneCellFamilyLaw x u q hu ⟨hq.le, hq1⟩)
Proof (Lean source)
lemma oneCellFamilyLaw_model {n d : ℕ} (x : Fin d) (u q : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hu : 0 ≤ u ∧ u ≤ 1) (hq : 0 < q) (hq1 : q ≤ 1) (hslice : RareArrivalSlice n q) : RareArrivalModelClass n d q (oneCellFamilyLaw x u q hu ⟨hq.le, hq1⟩) := by refine ⟨oneCellFamilyLaw_iid (n := n) x u q hu ⟨hq.le, hq1⟩, oneCellFamilyLaw_randomized x u q hu ⟨hq.le, hq1⟩, oneCellFamilyLaw_balanced x u q hu ⟨hq.le, hq1⟩, (oneCellFamilyLaw_consistency x u q hu ⟨hq.le, hq1⟩).1, (oneCellFamilyLaw_consistency x u q hu ⟨hq.le, hq1⟩).2, oneCellFamilyLaw_mar x u q hu ⟨hq.le, hq1⟩, ?_, hslice, hn, hd, hq, hq1⟩ intro j hj rw [oneCellFamilyLaw_arrivedCell]
CausalSmith.Stat.MarRareqLogfrontier.oneCellFamilyLaw_model · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/OneCell.lean:344
theorem oneCellFamilyLaw_obs_ac

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
x :
Fin d
u q :
ℝ
hu :
0 ≤ u ∧ u ≤ 1
hq :
0 ≤ q ∧ q ≤ 1
((oneCellFamilyLaw x u q hu hq).1.map obs) ≪ ((oneCellFamilyLaw x (1 / 2) q (by norm_num) hq).1.map obs)
Proof (Lean source)
lemma oneCellFamilyLaw_obs_ac {d : ℕ} (x : Fin d) (u q : ℝ) (hu : 0 ≤ u ∧ u ≤ 1) (hq : 0 ≤ q ∧ q ≤ 1) : ((oneCellFamilyLaw x u q hu hq).1.map obs) ≪ ((oneCellFamilyLaw x (1 / 2) q (by norm_num) hq).1.map obs) := by apply Measure.AbsolutelyContinuous.map · let μ : Bool × Bool × Bool → Measure (FullRecord d) := fun t => ofReal (completeBernWeight (1 / 2) t.1 * completeBernWeight u t.2.1 * completeBernWeight q t.2.2) • Measure.dirac (oneCellRecord x t.1 t.2.1 t.2.2) let ν : Bool × Bool × Bool → Measure (FullRecord d) := fun t => ofReal (completeBernWeight (1 / 2) t.1 * completeBernWeight (1 / 2) t.2.1 * completeBernWeight q t.2.2) • Measure.dirac (oneCellRecord x t.1 t.2.1 t.2.2) have hatom (t : Bool × Bool × Bool) : μ t ≪ ν t := by rcases t with ⟨a, y, r⟩ by_cases hν : ofReal (completeBernWeight (1 / 2) a * completeBernWeight (1 / 2) y * completeBernWeight q r) = 0 · have hμ : ofReal (completeBernWeight (1 / 2) a * completeBernWeight u y * completeBernWeight q r) = 0 := by cases a <;> cases y <;> cases r <;> simp [completeBernWeight, ENNReal.ofReal_eq_zero, hq.1, hq.2] at hν ⊢ <;> nlinarith change (ofReal (completeBernWeight (1 / 2) a * completeBernWeight u y * completeBernWeight q r) • Measure.dirac (oneCellRecord x a y r)) ≪ ofReal (completeBernWeight (1 / 2) a * completeBernWeight (1 / 2) y * completeBernWeight q r) • Measure.dirac (oneCellRecord x a y r) rw [hμ, hν] · exact Measure.smul_absolutelyContinuous.trans (Measure.AbsolutelyContinuous.rfl.smul_right hν) have hfin (s : Finset (Bool × Bool × Bool)) : (∑ t ∈ s, μ t) ≪ ∑ t ∈ s, ν t := by classical induction s using Finset.induction_on with | empty => simp | @insert t s ht ih => simp only [Finset.sum_insert ht] exact (hatom t).add ih have hsum : (∑ t, μ t) ≪ ∑ t, ν t := by simpa using hfin univ simpa [oneCellFamilyLaw, oneCellMeasure, μ, ν, Fintype.sum_prod_type] using hsum · fun_prop
CausalSmith.Stat.MarRareqLogfrontier.oneCellFamilyLaw_obs_ac · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/OneCell.lean:361
theorem oneCellFamilyLaw_obs_atom

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
x :
Fin d
u q :
ℝ
hu :
0 ≤ u ∧ u ≤ 1
hq :
0 ≤ q ∧ q ≤ 1
o :
((oneCellFamilyLaw x u q hu hq).1.map obs).real {o} = if o.X = x ∧
o.S
= false then if o.R then (1 / 2 : ℝ) * q * (if o.A then completeBernWeight u o.RY else if o.RY then 0 else 1) else if o.RY then 0 else (1 / 2 : ℝ) * (1 - q) else 0
Proof (Lean source)
lemma oneCellFamilyLaw_obs_atom {d : ℕ} (x : Fin d) (u q : ℝ) (hu : 0 ≤ u ∧ u ≤ 1) (hq : 0 ≤ q ∧ q ≤ 1) (o : ObsRecord d) : ((oneCellFamilyLaw x u q hu hq).1.map obs).real {o} = if o.X = x ∧ o.S = false then if o.R then (1 / 2 : ℝ) * q * (if o.A then completeBernWeight u o.RY else if o.RY then 0 else 1) else if o.RY then 0 else (1 / 2 : ℝ) * (1 - q) else 0 := by have hu' : 0 ≤ 1 - u := sub_nonneg.mpr hu.2 have hq' : 0 ≤ 1 - q := sub_nonneg.mpr hq.2 have h₀ : 0 ≤ u * (1 / 2) + u * q * (-1 / 2) := by nlinarith [mul_nonneg hu.1 hq'] have h₁ : 0 ≤ 1 / 2 + u * (-1 / 2) + u * q * (1 / 2) + q * (-1 / 2) := by nlinarith [mul_nonneg hu' hq'] have h₂ : 0 ≤ u * q * (1 / 2) := by nlinarith [mul_nonneg hu.1 hq.1] have h₃ : 0 ≤ u * q * (-1 / 2) + q * (1 / 2) := by nlinarith [mul_nonneg hu' hq.1] rw [measureReal_def, Measure.map_apply (by fun_prop) (by simp)] rcases o with ⟨X, A, S, R, RY⟩ by_cases hx : X = x · subst X cases A <;> cases S <;> cases R <;> cases RY <;> simp [oneCellFamilyLaw, oneCellMeasure, completeBernWeight, oneCellRecord, obs, FullRecord.Y, FullRecord.S, indicator, hu.1, hu', hq.1, hq', ENNReal.toReal_add, ENNReal.toReal_ofReal, h₀, h₁, h₂, h₃, ENNReal.toReal_mul] <;> try ring all_goals try { rw [ENNReal.toReal_ofReal h₀, ENNReal.toReal_ofReal h₁]; ring } all_goals try { rw [ENNReal.toReal_ofReal h₂, ENNReal.toReal_ofReal h₃]; ring } all_goals rw [ENNReal.toReal_add (by finiteness) (by finiteness), ENNReal.toReal_mul, ENNReal.toReal_mul, ENNReal.toReal_mul, ENNReal.toReal_mul] simp [ENNReal.toReal_ofReal, hu.1, hu', hq'] ring · have hneq : x ≠ X := Ne.symm hx cases A <;> cases S <;> cases R <;> cases RY <;> simp [oneCellFamilyLaw, oneCellMeasure, completeBernWeight, oneCellRecord, obs, FullRecord.Y, FullRecord.S, indicator, hx, hneq]
CausalSmith.Stat.MarRareqLogfrontier.oneCellFamilyLaw_obs_atom · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/OneCell.lean:408
theorem oneCellFamilyLaw_obs_chi

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
x :
Fin d
u q :
ℝ
hu :
0 ≤ u ∧ u ≤ 1
hq :
0 ≤ q ∧ q ≤ 1
chiSqDiv ((oneCellFamilyLaw x u q hu hq).1.map obs) ((oneCellFamilyLaw x (1 / 2) q (by norm_num) hq).1.map obs)
= 2 * q * (u - 1 / 2) ^ 2
Proof (Lean source)
lemma oneCellFamilyLaw_obs_chi {d : ℕ} (x : Fin d) (u q : ℝ) (hu : 0 ≤ u ∧ u ≤ 1) (hq : 0 ≤ q ∧ q ≤ 1) : chiSqDiv ((oneCellFamilyLaw x u q hu hq).1.map obs) ((oneCellFamilyLaw x (1 / 2) q (by norm_num) hq).1.map obs) = 2 * q * (u - 1 / 2) ^ 2 := by let P₁ := oneCellFamilyLaw x u q hu hq let P₀ := oneCellFamilyLaw x (1 / 2) q (by norm_num : (0 : ℝ) ≤ 1 / 2 ∧ (1 / 2 : ℝ) ≤ 1) hq letI : IsProbabilityMeasure P₁.1 := P₁.2 letI : IsProbabilityMeasure P₀.1 := P₀.2 let μ := P₁.1.map obs let ν := P₀.1.map obs letI : IsProbabilityMeasure μ := Measure.isProbabilityMeasure_map (by fun_prop) letI : IsProbabilityMeasure ν := Measure.isProbabilityMeasure_map (by fun_prop) have hac := oneCellFamilyLaw_obs_ac x u q hu hq have h := finite_one_add_chiSqDiv μ ν hac dsimp [μ, ν, P₁, P₀] at h simp_rw [oneCellFamilyLaw_obs_atom x u q hu hq, oneCellFamilyLaw_obs_atom x (1 / 2) q (by norm_num : (0 : ℝ) ≤ 1 / 2 ∧ (1 / 2 : ℝ) ≤ 1) hq] at h let f : ObsRecord d → ℝ := fun o => (if o.X = x ∧ o.S = false then if o.R then (1 / 2 : ℝ) * q * (if o.A then completeBernWeight u o.RY else if o.RY then 0 else 1) else if o.RY then 0 else (1 / 2 : ℝ) * (1 - q) else 0) ^ 2 / (if o.X = x ∧ o.S = false then if o.R then (1 / 2 : ℝ) * q * (if o.A then completeBernWeight (1 / 2) o.RY else if o.RY then 0 else 1) else if o.RY then 0 else (1 / 2 : ℝ) * (1 - q) else 0) let a : ObsRecord d := ⟨x, false, false, false, false⟩ let b : ObsRecord d := ⟨x, true, false, false, false⟩ let c : ObsRecord d := ⟨x, false, false, true, false⟩ let e₀ : ObsRecord d := ⟨x, true, false, true, false⟩ let e₁ : ObsRecord d := ⟨x, true, false, true, true⟩ have hsum : (∑ o : ObsRecord d, f o) = ∑ o ∈ ({a, b, c, e₀, e₁} : Finset (ObsRecord d)), f o := by symm apply Finset.sum_subset (Finset.subset_univ _) intro o ho hn 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, a, b, c, e₀, e₁] at hn ⊢ · simp [f, hx] have hvalue : (∑ o : ObsRecord d, f o) = 1 + 2 * q * (u - 1 / 2) ^ 2 := by classical rw [hsum] rcases eq_or_ne q 0 with rfl | hqne · norm_num [f, a, b, c, e₀, e₁] · rcases eq_or_ne (1 - q) 0 with hqone | hqone · have hqeq : q = 1 := by linarith subst q norm_num [f, a, b, c, e₀, e₁, completeBernWeight] field_simp ring · simp [f, a, b, c, e₀, e₁, completeBernWeight, hqne, hqone] field_simp ring change 1 + chiSqDiv ((oneCellFamilyLaw x u q hu hq).1.map obs) ((oneCellFamilyLaw x (1 / 2) q (by norm_num) hq).1.map obs) = ∑ o : ObsRecord d, f o at h linarith [hvalue]
CausalSmith.Stat.MarRareqLogfrontier.oneCellFamilyLaw_obs_chi · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/OneCell.lean:452
def oneCellStep

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
n :
ℕ
q :
ℝ
oneCellStep n q :
ℝ
min (1 / 4) (1 / (4 * sqrt (effectiveSize n q)))
CausalSmith.Stat.MarRareqLogfrontier.oneCellStep · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/OneCell.lean:523
theorem oneCellStep_pos

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n :
ℕ
q :
ℝ
hn :
1 ≤ n
hq :
0 < q
0 < oneCellStep n q
Proof (Lean source)
lemma oneCellStep_pos (n : ℕ) (q : ℝ) (hn : 1 ≤ n) (hq : 0 < q) : 0 < oneCellStep n q := by have hN : 0 < effectiveSize n q := by unfold effectiveSize positivity unfold oneCellStep exact lt_min (by norm_num) (by positivity)
CausalSmith.Stat.MarRareqLogfrontier.oneCellStep_pos · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/OneCell.lean:527
theorem oneCellStep_le_quarter

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n :
ℕ
q :
ℝ
oneCellStep n q ≤ 1 / 4
Proof (Lean source)
lemma oneCellStep_le_quarter (n : ℕ) (q : ℝ) : oneCellStep n q ≤ 1 / 4 := by exact min_le_left _ _
CausalSmith.Stat.MarRareqLogfrontier.oneCellStep_le_quarter · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/OneCell.lean:536
theorem oneCellStep_mem

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n :
ℕ
q :
ℝ
hn :
1 ≤ n
hq :
0 < q
conclusion 1
0 ≤ 1 / 2 + oneCellStep n q
conclusion 2
1 / 2 + oneCellStep n q ≤ 1
Proof (Lean source)
lemma oneCellStep_mem (n : ℕ) (q : ℝ) (hn : 1 ≤ n) (hq : 0 < q) : 0 ≤ 1 / 2 + oneCellStep n q ∧ 1 / 2 + oneCellStep n q ≤ 1 := by have hp := oneCellStep_pos n q hn hq have hle := oneCellStep_le_quarter n q constructor <;> linarith
CausalSmith.Stat.MarRareqLogfrontier.oneCellStep_mem · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/OneCell.lean:541
theorem oneCellFamilyLaw_obs_chi_step

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
x :
Fin d
n :
ℕ
q :
ℝ
hn :
1 ≤ n
hq :
0 < q
hq1 :
q ≤ 1
chiSqDiv ((oneCellFamilyLaw x (1 / 2 + oneCellStep n q) q (oneCellStep_mem n q hn hq) ⟨hq.le, hq1⟩).1.map obs) ((oneCellFamilyLaw x (1 / 2) q (by norm_num) ⟨hq.le, hq1⟩).1.map obs)
≤ (1 / 8 : ℝ) / n
Proof (Lean source)
lemma oneCellFamilyLaw_obs_chi_step {d : ℕ} (x : Fin d) (n : ℕ) (q : ℝ) (hn : 1 ≤ n) (hq : 0 < q) (hq1 : q ≤ 1) : chiSqDiv ((oneCellFamilyLaw x (1 / 2 + oneCellStep n q) q (oneCellStep_mem n q hn hq) ⟨hq.le, hq1⟩).1.map obs) ((oneCellFamilyLaw x (1 / 2) q (by norm_num) ⟨hq.le, hq1⟩).1.map obs) ≤ (1 / 8 : ℝ) / n := by rw [oneCellFamilyLaw_obs_chi] have hN : 0 < effectiveSize n q := by unfold effectiveSize positivity have hsqrt : 0 < sqrt (effectiveSize n q) := Real.sqrt_pos.2 hN have hle : oneCellStep n q ≤ 1 / (4 * sqrt (effectiveSize n q)) := min_le_right _ _ have hp := oneCellStep_pos n q hn hq have hsquare : (oneCellStep n q) ^ 2 ≤ (1 / (4 * sqrt (effectiveSize n q))) ^ 2 := by nlinarith have hsqrt_sq : (sqrt (effectiveSize n q)) ^ 2 = effectiveSize n q := Real.sq_sqrt hN.le have hbudget : 16 * effectiveSize n q * (oneCellStep n q) ^ 2 ≤ 1 := by rw [div_pow] at hsquare field_simp [hsqrt.ne'] at hsquare nlinarith have hnR : (0 : ℝ) < n := by positivity have heq : (1 / 2 + oneCellStep n q - 1 / 2) ^ 2 = (oneCellStep n q) ^ 2 := by ring rw [heq, le_div_iff₀ hnR] unfold effectiveSize at hbudget nlinarith
CausalSmith.Stat.MarRareqLogfrontier.oneCellFamilyLaw_obs_chi_step · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/OneCell.lean:549
theorem oneCell_product_testing_half

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
x :
Fin d
n :
ℕ
q :
ℝ
hn :
1 ≤ n
hq :
0 < q
hq1 :
q ≤ 1
A :
Set (Fin n → ObsRecord d)
(sampleLaw n (oneCellFamilyLaw x (1 / 2 + oneCellStep n q) q (oneCellStep_mem n q hn hq) ⟨hq.le, hq1⟩)).real Aᶜ
+ (sampleLaw n (oneCellFamilyLaw x (1 / 2) q (by norm_num) ⟨hq.le, hq1⟩)).real A
≥ 1 / 2
Proof (Lean source)
lemma oneCell_product_testing_half {d : ℕ} (x : Fin d) (n : ℕ) (q : ℝ) (hn : 1 ≤ n) (hq : 0 < q) (hq1 : q ≤ 1) : ∀ A : Set (Fin n → ObsRecord d), MeasurableSet A → (sampleLaw n (oneCellFamilyLaw x (1 / 2 + oneCellStep n q) q (oneCellStep_mem n q hn hq) ⟨hq.le, hq1⟩)).real Aᶜ + (sampleLaw n (oneCellFamilyLaw x (1 / 2) q (by norm_num) ⟨hq.le, hq1⟩)).real A ≥ 1 / 2 := by let L₁ := oneCellFamilyLaw x (1 / 2 + oneCellStep n q) q (oneCellStep_mem n q hn hq) ⟨hq.le, hq1⟩ let L₀ := oneCellFamilyLaw x (1 / 2) q (by norm_num) ⟨hq.le, hq1⟩ letI : IsProbabilityMeasure L₁.1 := L₁.2 letI : IsProbabilityMeasure L₀.1 := L₀.2 let P₁ := L₁.1.map obs let P₀ := L₀.1.map obs letI : IsProbabilityMeasure P₁ := Measure.isProbabilityMeasure_map (by fun_prop) letI : IsProbabilityMeasure P₀ := Measure.isProbabilityMeasure_map (by fun_prop) have hac : P₁ ≪ P₀ := oneCellFamilyLaw_obs_ac x (1 / 2 + oneCellStep n q) q (oneCellStep_mem n q hn hq) ⟨hq.le, hq1⟩ have hint : Integrable (fun z => ((P₁.rnDeriv P₀ z).toReal - 1) ^ 2) P₀ := Integrable.of_finite have hchi : chiSqDiv P₁ P₀ ≤ (1 / 8 : ℝ) / n := oneCellFamilyLaw_obs_chi_step x n q hn hq hq1 simpa [sampleLaw, P₁, P₀, L₁, L₀] using (complete_arrival_product_testing_half n hn P₁ P₀ hac hint hchi)
CausalSmith.Stat.MarRareqLogfrontier.oneCell_product_testing_half · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/OneCell.lean:582

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n :
ℕ
q :
ℝ
hn :
1 ≤ n
hq :
0 < q
(1 / 16 : ℝ) * min 1 (effectiveSize n q)⁻¹ ≤ (oneCellStep n q) ^ 2
Proof (Lean source)
lemma oneCellStep_sq_lower (n : ℕ) (q : ℝ) (hn : 1 ≤ n) (hq : 0 < q) : (1 / 16 : ℝ) * min 1 (effectiveSize n q)⁻¹ ≤ (oneCellStep n q) ^ 2 := by have hN : 0 < effectiveSize n q := by unfold effectiveSize positivity have hsqrt : 0 < sqrt (effectiveSize n q) := Real.sqrt_pos.2 hN have hsqrt_sq : (sqrt (effectiveSize n q)) ^ 2 = effectiveSize n q := Real.sq_sqrt hN.le unfold oneCellStep by_cases h : (1 / 4 : ℝ) ≤ 1 / (4 * sqrt (effectiveSize n q)) · rw [min_eq_left h] have hmin : min 1 (effectiveSize n q)⁻¹ ≤ 1 := min_le_left _ _ nlinarith · rw [min_eq_right (le_of_not_ge h)] have hmin : min 1 (effectiveSize n q)⁻¹ ≤ (effectiveSize n q)⁻¹ := min_le_right _ _ have heq : (1 / (4 * sqrt (effectiveSize n q))) ^ 2 = (1 / 16 : ℝ) * (effectiveSize n q)⁻¹ := by rw [div_pow, mul_pow, hsqrt_sq] field_simp norm_num rw [heq] exact mul_le_mul_of_nonneg_left hmin (by norm_num)
CausalSmith.Stat.MarRareqLogfrontier.oneCellStep_sq_lower · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/OneCell.lean:609
theorem oneCell_symmetric_testing_pair Lemma oneCell_symmetric_testing_pair in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
δ :
ℝ
hδ :
0 < δ
hδle :
δ ≤ 1 / 2
∃ u₀ ∈ Icc (1 / 4 : ℝ) (3 / 4 : ℝ), ∃ u₁ ∈ Icc (1 / 4 : ℝ) (3 / 4 : ℝ),
conclusion 1
u₀ ≠ u₁
conclusion 2
u₁ - u₀ = δ
Proof (Lean source)
lemma oneCell_symmetric_testing_pair (δ : ℝ) (hδ : 0 < δ) (hδle : δ ≤ 1 / 2) : ∃ u₀ ∈ Icc (1 / 4 : ℝ) (3 / 4 : ℝ), ∃ u₁ ∈ Icc (1 / 4 : ℝ) (3 / 4 : ℝ), u₀ ≠ u₁ ∧ u₁ - u₀ = δ := by refine ⟨1 / 2 - δ / 2, ?_, 1 / 2 + δ / 2, ?_, ?_, ?_⟩ · constructor <;> linarith · constructor <;> linarith · linarith · ring
CausalSmith.Stat.MarRareqLogfrontier.oneCell_symmetric_testing_pair · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/OneCell.lean:635

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
M :
ℕ
hM :
0 < M
w :
ℝ
hw :
0 < w
hwle :
w ≤ 1 / 2
∃ grid : Fin (M + 1) → ℝ,
conclusion 1
i :
grid i ∈ Icc (1 / 4 : ℝ) (3 / 4 : ℝ)
Proof (Lean source)
lemma oneCell_linear_grid (M : ℕ) (hM : 0 < M) (w : ℝ) (hw : 0 < w) (hwle : w ≤ 1 / 2) : ∃ grid : Fin (M + 1) → ℝ, Injective grid ∧ (∀ i, grid i ∈ Icc (1 / 4 : ℝ) (3 / 4 : ℝ)) := by have hMr : (0 : ℝ) < M := by exact_mod_cast hM refine ⟨fun i => 1 / 2 - w / 2 + w * (i : ℝ) / M, ?_, ?_⟩ · intro i j hij have hcast : (i : ℝ) = (j : ℝ) := by have hdiv : w * (i : ℝ) / M = w * (j : ℝ) / M := by linarith have hmul : w * (i : ℝ) = w * (j : ℝ) := (div_left_inj' (ne_of_gt hMr)).mp hdiv exact mul_left_cancel₀ (ne_of_gt hw) hmul exact Fin.ext (by exact_mod_cast hcast) · intro i have hi : (i : ℝ) ≤ M := by exact_mod_cast (Nat.lt_succ_iff.mp i.isLt) have hit : 0 ≤ w * (i : ℝ) / M := by positivity have hit' : w * (i : ℝ) / M ≤ w := by apply (div_le_iff₀ hMr).2 exact mul_le_mul_of_nonneg_left hi hw.le constructor <;> dsimp <;> linarith
CausalSmith.Stat.MarRareqLogfrontier.oneCell_linear_grid · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/OneCell.lean:648
theorem oneCellFamilyLaw_noSurrogate

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
x :
Fin d
u q :
ℝ
hu :
0 ≤ u ∧ u ≤ 1
hq :
0 ≤ q ∧ q ≤ 1
∀ᵐ r : FullRecord d ∂((oneCellFamilyLaw x u q hu hq).1), r.S0 = false ∧ r.S1 = false
Proof (Lean source)
lemma oneCellFamilyLaw_noSurrogate {d : ℕ} (x : Fin d) (u q : ℝ) (hu : 0 ≤ u ∧ u ≤ 1) (hq : 0 ≤ q ∧ q ≤ 1) : ∀ᵐ r : FullRecord d ∂((oneCellFamilyLaw x u q hu hq).1), r.S0 = false ∧ r.S1 = false := by filter_upwards [oneCellFamilyLaw_support x u q hu hq] with r hr exact ⟨hr.2.1, hr.2.2.1⟩
CausalSmith.Stat.MarRareqLogfrontier.oneCellFamilyLaw_noSurrogate · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/OneCell.lean:673
def noSurrogateRisk

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
n d :
ℕ
q :
ℝ
noSurrogateRisk n d q :
ℝ
minimaxValueReal (E := Estimator n d) (Θ := {P : FullLaw d // RareArrivalModelClass n d q P ∧ ∀ᵐ r : FullRecord d ∂(P.1), r.S0 = false ∧ r.S1 = false}) (fun T P => squaredRisk T P.1)
CausalSmith.Stat.MarRareqLogfrontier.noSurrogateRisk · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/OneCell.lean:681
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.RandomizedKernel 30 declarations Barycenters, clipping and uniform-seed representations of all bounded scalar kernels, and total-variation comparison of joint input/action experiments.

Barycenters, clipping and uniform-seed representations of all bounded scalar kernels, and total-variation comparison of joint input/action experiments. Common independent seeds and deterministic projections are constant-kernel and deterministic-kernel specializations.

def BoundedKernel

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
Z :
BoundedKernel Z :
Type u_1
def barycenter

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
Z :
κ :
o :
Z
barycenter κ o :
ℝ
∫ h, h ∂(κ.1 o)
def kernelRisk

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
Z Λ :
Q :
Λ → Measure Z
θ :
Λ → ℝ
κ :
param :
Λ
kernelRisk Q θ κ param :
ℝ
∫ o, (∫ h, (h - θ param) ^ 2 ∂(κ.1 o)) ∂(Q param)
def mapRisk

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
Z Λ :
Q :
Λ → Measure Z
θ :
Λ → ℝ
f :
Z → ℝ
param :
Λ
mapRisk Q θ f param :
ℝ
∫ o, (f o - θ param) ^ 2 ∂(Q param)
def realKernelRisk

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
Z Λ :
Q :
Λ → Measure Z
θ :
Λ → ℝ
κ :
Kernel Z ℝ
param :
Λ
realKernelRisk Q θ κ param :
ℝ≥0∞
∫⁻ o, (∫⁻ h, ofReal ((h - θ param) ^ 2) ∂(κ o)) ∂(Q param)
def realKernelClip

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
h :
ℝ
realKernelClip h :
ℝ
max (-1) (min 1 h)
def UnitSeed

the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
UnitSeed :
Set ℝ
Icc (0 : ℝ) 1
def uniformSeedLaw

the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
uniformSeedLaw :
volume.comap val
theorem kernel_barycenter_variance_identity Lemma kernel_barycenter_variance_identity in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
Z :
κ :
o :
Z
c :
ℝ
(∫ h, (h - c) ^ 2 ∂(κ.1 o))
= (barycenter κ o - c) ^ 2 + ∫ h, (h - barycenter κ o) ^ 2 ∂(κ.1 o)
Proof (Lean source)
-- @node: kernel_barycenter_variance_identity lemma kernel_barycenter_variance_identity {Z : Type*} [MeasurableSpace Z] (κ : BoundedKernel Z) (o : Z) (c : ℝ) : (∫ h, (h - c) ^ 2 ∂(κ.1 o)) = (barycenter κ o - c) ^ 2 + ∫ h, (h - barycenter κ o) ^ 2 ∂(κ.1 o) := by let : IsMarkovKernel κ.1 := κ.2.1 have hbounded : ∀ᵐ h ∂(κ.1 o), h ∈ Icc (-1 : ℝ) 1 := (ae_mem_iff_measure_eq (μ := κ.1 o) measurableSet_Icc.nullMeasurableSet).2 (by simpa only [measure_univ] using κ.2.2 o) have hmeas : AEStronglyMeasurable (fun h : ℝ => h) (κ.1 o) := by fun_prop have hLp : MemLp (fun h : ℝ => h) 2 (κ.1 o) := memLp_of_bounded hbounded hmeas 2 have hshiftLp : MemLp (fun h : ℝ => h - c) 2 (κ.1 o) := hLp.sub (memLp_const c) have hmean : (∫ h, h - c ∂(κ.1 o)) = barycenter κ o - c := by rw [integral_sub (hLp.integrable (by norm_num)) (integrable_const c)] simp [barycenter] have hvar := variance_eq_sub hshiftLp rw [variance_sub_const hmeas c, variance_eq_integral hLp.aemeasurable] at hvar change (∫ h, (h - ∫ x, x ∂(κ.1 o)) ^ 2 ∂(κ.1 o)) = (∫ h, (h - c) ^ 2 ∂(κ.1 o)) - (∫ h, h - c ∂(κ.1 o)) ^ 2 at hvar rw [hmean] at hvar dsimp only [barycenter] at * linarith
CausalSmith.Stat.MarRareqLogfrontier.kernel_barycenter_variance_identity · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/RandomizedKernel.lean:51

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
Z :
κ :
o :
Z
barycenter κ o ∈ Icc (-1 : ℝ) 1
Proof (Lean source)
-- @node: kernel_barycenter_mem lemma kernel_barycenter_mem {Z : Type*} [MeasurableSpace Z] (κ : BoundedKernel Z) (o : Z) : barycenter κ o ∈ Icc (-1 : ℝ) 1 := by let : IsMarkovKernel κ.1 := κ.2.1 have hb : ∀ᵐ h ∂(κ.1 o), h ∈ Icc (-1 : ℝ) 1 := (ae_mem_iff_measure_eq (μ := κ.1 o) measurableSet_Icc.nullMeasurableSet).2 (by simpa only [measure_univ] using κ.2.2 o) have hi : Integrable (fun h : ℝ => h) (κ.1 o) := by apply Integrable.of_mem_Icc (-1) 1 · fun_prop · exact hb constructor · have h := integral_mono_ae (integrable_const (-1 : ℝ)) hi (hb.mono fun _ hh => hh.1) simpa [barycenter] using h · have h := integral_mono_ae hi (integrable_const (1 : ℝ)) (hb.mono fun _ hh => hh.2) simpa [barycenter] using h
CausalSmith.Stat.MarRareqLogfrontier.kernel_barycenter_mem · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/RandomizedKernel.lean:78
theorem kernel_barycenter_sq_le Lemma kernel_barycenter_sq_le in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
Z :
κ :
o :
Z
c :
ℝ
(barycenter κ o - c) ^ 2 ≤ ∫ h, (h - c) ^ 2 ∂(κ.1 o)
Proof (Lean source)
-- @node: kernel_barycenter_sq_le lemma kernel_barycenter_sq_le {Z : Type*} [MeasurableSpace Z] (κ : BoundedKernel Z) (o : Z) (c : ℝ) : (barycenter κ o - c) ^ 2 ≤ ∫ h, (h - c) ^ 2 ∂(κ.1 o) := by rw [kernel_barycenter_variance_identity] exact le_add_of_nonneg_right (integral_nonneg fun _ => sq_nonneg _)
CausalSmith.Stat.MarRareqLogfrontier.kernel_barycenter_sq_le · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/RandomizedKernel.lean:98
theorem kernel_barycenter_risk_le Lemma kernel_barycenter_risk_le in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
Z Λ :
Q :
Λ → Measure Z
hQ :
∀ param, IsProbabilityMeasure (Q param)
θ :
Λ → ℝ
κ :
param :
Λ
mapRisk Q θ (barycenter κ) param ≤ kernelRisk Q θ κ param
Proof (Lean source)
-- @node: kernel_barycenter_risk_le lemma kernel_barycenter_risk_le {Z Λ : Type*} [Finite Z] [MeasurableSpace Z] [MeasurableSingletonClass Z] (Q : Λ → Measure Z) (hQ : ∀ param, IsProbabilityMeasure (Q param)) (θ : Λ → ℝ) (κ : BoundedKernel Z) (param : Λ) : mapRisk Q θ (barycenter κ) param ≤ kernelRisk Q θ κ param := by let : IsProbabilityMeasure (Q param) := hQ param exact integral_mono Integrable.of_finite Integrable.of_finite (fun o => kernel_barycenter_sq_le κ o (θ param))
CausalSmith.Stat.MarRareqLogfrontier.kernel_barycenter_risk_le · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/RandomizedKernel.lean:106
theorem bounded_kernelRisk_bounds Lemma bounded_kernelRisk_bounds in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
Z Λ :
Q :
Λ → Measure Z
hQ :
∀ param, IsProbabilityMeasure (Q param)
θ :
Λ → ℝ
hθ :
∀ param, θ param ∈ Icc (-1 : ℝ) 1
κ :
param :
Λ
kernelRisk Q θ κ param ∈ Icc (0 : ℝ) 4
Proof (Lean source)
-- @node: bounded_kernelRisk_bounds lemma bounded_kernelRisk_bounds {Z Λ : Type*} [Finite Z] [MeasurableSpace Z] [MeasurableSingletonClass Z] (Q : Λ → Measure Z) (hQ : ∀ param, IsProbabilityMeasure (Q param)) (θ : Λ → ℝ) (hθ : ∀ param, θ param ∈ Icc (-1 : ℝ) 1) (κ : BoundedKernel Z) (param : Λ) : kernelRisk Q θ κ param ∈ Icc (0 : ℝ) 4 := by let : IsProbabilityMeasure (Q param) := hQ param let : IsMarkovKernel κ.1 := κ.2.1 have hinner (o : Z) : (∫ h, (h - θ param) ^ 2 ∂(κ.1 o)) ≤ 4 := by have hb : ∀ᵐ h ∂(κ.1 o), h ∈ Icc (-1 : ℝ) 1 := (ae_mem_iff_measure_eq (μ := κ.1 o) measurableSet_Icc.nullMeasurableSet).2 (by simpa only [measure_univ] using κ.2.2 o) have hs : ∀ᵐ h ∂(κ.1 o), (h - θ param) ^ 2 ∈ Icc (0 : ℝ) 4 := by filter_upwards [hb] with h hh refine ⟨sq_nonneg _, ?_⟩ obtain ⟨hl, hu⟩ := hh obtain ⟨cl, cu⟩ := hθ param nlinarith [sq_nonneg (h - θ param + 2), sq_nonneg (h - θ param - 2), mul_nonneg (by linarith : 0 ≤ 2 - (h - θ param)) (by linarith : 0 ≤ 2 + (h - θ param))] have hi : Integrable (fun h => (h - θ param) ^ 2) (κ.1 o) := by apply Integrable.of_mem_Icc 0 4 · fun_prop · exact hs have h := integral_mono_ae hi (integrable_const (4 : ℝ)) (hs.mono fun _ hh => hh.2) simpa using h refine ⟨integral_nonneg (fun _ => integral_nonneg (fun _ => sq_nonneg _)), ?_⟩ have h := integral_mono (μ := Q param) Integrable.of_finite (integrable_const (4 : ℝ)) hinner simpa [kernelRisk] using h
CausalSmith.Stat.MarRareqLogfrontier.bounded_kernelRisk_bounds · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/RandomizedKernel.lean:117

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
Z :
f :
Z → Icc (-1 : ℝ) 1
hf :
boundedMapKernel f hf :
⟨Kernel.deterministic (fun o => (f o).1) (by fun_prop), inferInstance, by intro o rw [Kernel.deterministic_apply, Measure.dirac_apply] rw [Set.indicator_of_mem (f o).2] rfl⟩
theorem boundedMapKernel_risk

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
Z Λ :
Q :
Λ → Measure Z
θ :
Λ → ℝ
f :
Z → Icc (-1 : ℝ) 1
hf :
param :
Λ
kernelRisk Q θ (boundedMapKernel f hf) param = mapRisk Q θ (fun o => (f o).1) param
Proof (Lean source)
-- @node: boundedMapKernel_risk lemma boundedMapKernel_risk {Z Λ : Type*} [MeasurableSpace Z] (Q : Λ → Measure Z) (θ : Λ → ℝ) (f : Z → Icc (-1 : ℝ) 1) (hf : Measurable f) (param : Λ) : kernelRisk Q θ (boundedMapKernel f hf) param = mapRisk Q θ (fun o => (f o).1) param := by simp [kernelRisk, mapRisk, boundedMapKernel, Kernel.deterministic_apply]
CausalSmith.Stat.MarRareqLogfrontier.boundedMapKernel_risk · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/RandomizedKernel.lean:160
theorem bounded_kernel_minimax_eq_deterministic Lemma bounded_kernel_minimax_eq_deterministic in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
Z Λ :
Q :
Λ → Measure Z
hQ :
∀ param, IsProbabilityMeasure (Q param)
θ :
Λ → ℝ
hθ :
∀ param, θ param ∈ Icc (-1 : ℝ) 1
= minimaxValueReal (fun (f : Z → Icc (-1 : ℝ) 1) param => mapRisk Q θ (fun o => (f o).1) param)
Proof (Lean source)
-- @node: bounded_kernel_minimax_eq_deterministic lemma bounded_kernel_minimax_eq_deterministic {Z Λ : Type*} [Finite Z] [MeasurableSpace Z] [MeasurableSingletonClass Z] (Q : Λ → Measure Z) (hQ : ∀ param, IsProbabilityMeasure (Q param)) (θ : Λ → ℝ) (hθ : ∀ param, θ param ∈ Icc (-1 : ℝ) 1) : minimaxValueReal (kernelRisk Q θ) = minimaxValueReal (fun (f : Z → Icc (-1 : ℝ) 1) param => mapRisk Q θ (fun o => (f o).1) param) := by let D : (Z → Icc (-1 : ℝ) 1) → Λ → ℝ := fun f param => mapRisk Q θ (fun o => (f o).1) param let z : Z → Icc (-1 : ℝ) 1 := fun _ => ⟨0, by norm_num⟩ let : Nonempty (Z → Icc (-1 : ℝ) 1) := ⟨z⟩ let : Nonempty (BoundedKernel Z) := ⟨boundedMapKernel z (by fun_prop)⟩ have hknonneg : ∀ κ param, 0 ≤ kernelRisk Q θ κ param := fun κ param => (bounded_kernelRisk_bounds Q hQ θ hθ κ param).1 have hdnonneg : ∀ f param, 0 ≤ D f param := fun _ _ => integral_nonneg (fun _ => sq_nonneg _) have hkbdd : ∀ κ, BddAbove (range (kernelRisk Q θ κ)) := by intro κ refine ⟨4, ?_⟩ rintro _ ⟨param, rfl⟩ exact (bounded_kernelRisk_bounds Q hQ θ hθ κ param).2 apply le_antisymm · apply minimaxValue_le_minimaxValue (bddBelow_range_worstCaseRisk hknonneg) intro f have hf : Measurable f := by fun_prop refine ⟨boundedMapKernel f hf, le_of_eq ?_⟩ unfold worstCaseRiskReal simp_rw [boundedMapKernel_risk] · apply minimaxValue_le_minimaxValue (bddBelow_range_worstCaseRisk hdnonneg) intro κ let f : Z → Icc (-1 : ℝ) 1 := fun o => ⟨barycenter κ o, kernel_barycenter_mem κ o⟩ refine ⟨f, ?_⟩ exact worstCaseRisk_mono_class_of_nonneg (risk := fun (_ : Unit) param => D f param) (risk' := fun (_ : Unit) param => kernelRisk Q θ κ param) (e := ()) id (hkbdd κ) (hknonneg κ) (kernel_barycenter_risk_le Q hQ θ κ)
CausalSmith.Stat.MarRareqLogfrontier.bounded_kernel_minimax_eq_deterministic · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/RandomizedKernel.lean:169

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
h c :
ℝ
hc :
c ∈ Icc (-1 : ℝ) 1
(realKernelClip h - c) ^ 2 ≤ (h - c) ^ 2
Proof (Lean source)
-- @node: realKernelClip_sq_le lemma realKernelClip_sq_le (h c : ℝ) (hc : c ∈ Icc (-1 : ℝ) 1) : (realKernelClip h - c) ^ 2 ≤ (h - c) ^ 2 := by obtain ⟨hcl, hcu⟩ := hc unfold realKernelClip rcases le_total h 1 with hu | hu · rw [min_eq_right hu] rcases le_total (-1 : ℝ) h with hl | hl · rw [max_eq_right hl] · rw [max_eq_left hl] nlinarith · rw [min_eq_left hu, max_eq_right (by norm_num : (-1 : ℝ) ≤ 1)] nlinarith
CausalSmith.Stat.MarRareqLogfrontier.realKernelClip_sq_le · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/RandomizedKernel.lean:210
theorem measurable_realKernelClip Lemma measurable_realKernelClip in the paper ↗

the stated mathematical conclusion holds.

Formal statement
Proof (Lean source)
-- @node: measurable_realKernelClip @[fun_prop] lemma measurable_realKernelClip : Measurable realKernelClip := by unfold realKernelClip fun_prop
CausalSmith.Stat.MarRareqLogfrontier.measurable_realKernelClip · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/RandomizedKernel.lean:225

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
Z Λ :
Q :
Λ → Measure Z
θ :
Λ → ℝ
hθ :
∀ param, θ param ∈ Icc (-1 : ℝ) 1
κ :
Kernel Z ℝ
param :
Λ
realKernelRisk Q θ (κ.map realKernelClip) param ≤ realKernelRisk Q θ κ param
Proof (Lean source)
-- @node: realKernelClip_risk_le lemma realKernelClip_risk_le {Z Λ : Type*} [MeasurableSpace Z] (Q : Λ → Measure Z) (θ : Λ → ℝ) (hθ : ∀ param, θ param ∈ Icc (-1 : ℝ) 1) (κ : Kernel Z ℝ) (param : Λ) : realKernelRisk Q θ (κ.map realKernelClip) param ≤ realKernelRisk Q θ κ param := by apply lintegral_mono intro o dsimp only rw [Kernel.map_apply κ measurable_realKernelClip, lintegral_map (by fun_prop) measurable_realKernelClip] apply lintegral_mono intro h exact ENNReal.ofReal_le_ofReal (realKernelClip_sq_le h (θ param) (hθ param))
CausalSmith.Stat.MarRareqLogfrontier.realKernelClip_risk_le · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/RandomizedKernel.lean:231
theorem uniformSeedLaw_probability Lemma uniformSeedLaw_probability in the paper ↗

the stated mathematical conclusion holds.

Formal statement
Proof (Lean source)
-- @node: uniformSeedLaw_probability lemma uniformSeedLaw_probability : IsProbabilityMeasure uniformSeedLaw := by constructor rw [uniformSeedLaw, Measure.comap_apply val val_injective (fun s hs => (MeasurableEmbedding.subtype_coe measurableSet_Icc).measurableSet_image.mpr hs) _ MeasurableSet.univ] rw [image_univ, Subtype.range_coe] change volume (Icc (0 : ℝ) 1) = 1 simp only [Real.volume_Icc, sub_zero, ENNReal.ofReal_one]
CausalSmith.Stat.MarRareqLogfrontier.uniformSeedLaw_probability · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/RandomizedKernel.lean:247
theorem boundedKernel_of_uniformSeed Lemma boundedKernel_of_uniformSeed in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
f :
Z × UnitSeed → Icc (-1 : ℝ) 1
hf :
∃ κ : BoundedKernel Z, ∀ o, κ.1 o = uniformSeedLaw.map (fun v => (f (o, v)).1)
Proof (Lean source)
-- @node: boundedKernel_of_uniformSeed lemma boundedKernel_of_uniformSeed {Z : Type*} [Finite Z] [MeasurableSpace Z] [MeasurableSingletonClass Z] (f : Z × UnitSeed → Icc (-1 : ℝ) 1) (hf : Measurable f) : ∃ κ : BoundedKernel Z, ∀ o, κ.1 o = uniformSeedLaw.map (fun v => (f (o, v)).1) := by letI : IsProbabilityMeasure uniformSeedLaw := uniformSeedLaw_probability have hm (o : Z) : Measurable (fun v => (f (o, v)).1) := by fun_prop let κ : Kernel Z ℝ := ⟨fun o => uniformSeedLaw.map (fun v => (f (o, v)).1), measurable_of_finite _⟩ have hk : IsMarkovKernel κ := ⟨fun o => Measure.isProbabilityMeasure_map (hm o).aemeasurable⟩ refine ⟨⟨κ, hk, ?_⟩, fun _ => rfl⟩ intro o change uniformSeedLaw.map (fun v => (f (o, v)).1) (Icc (-1 : ℝ) 1) = 1 rw [Measure.map_apply (hm o) measurableSet_Icc] have hpre : (fun v => (f (o, v)).1) ⁻¹' Icc (-1 : ℝ) 1 = univ := by ext v simp only [mem_preimage, mem_univ, iff_true] exact (f (o, v)).2 rw [hpre, measure_univ]
CausalSmith.Stat.MarRareqLogfrontier.boundedKernel_of_uniformSeed · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/RandomizedKernel.lean:258

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
h :
ℝ
realKernelClip h ∈ Icc (-1 : ℝ) 1
Proof (Lean source)
-- @node: realKernelClip_mem lemma realKernelClip_mem (h : ℝ) : realKernelClip h ∈ Icc (-1 : ℝ) 1 := by exact ⟨le_max_left _ _, max_le (by norm_num) (min_le_left _ _)⟩
CausalSmith.Stat.MarRareqLogfrontier.realKernelClip_mem · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/RandomizedKernel.lean:280

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
h :
ℝ
hh :
h ∈ Icc (-1 : ℝ) 1
Proof (Lean source)
-- @node: realKernelClip_eq_self lemma realKernelClip_eq_self {h : ℝ} (hh : h ∈ Icc (-1 : ℝ) 1) : realKernelClip h = h := by exact (congrArg (max (-1)) (min_eq_right hh.2)).trans (max_eq_right hh.1)
CausalSmith.Stat.MarRareqLogfrontier.realKernelClip_eq_self · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/RandomizedKernel.lean:285

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
Z :
κ :
o :
Z
(κ.1 o).map realKernelClip = κ.1 o
Proof (Lean source)
-- @node: boundedKernel_map_clip lemma boundedKernel_map_clip {Z : Type*} [MeasurableSpace Z] (κ : BoundedKernel Z) (o : Z) : (κ.1 o).map realKernelClip = κ.1 o := by letI : IsMarkovKernel κ.1 := κ.2.1 have hb : ∀ᵐ h ∂(κ.1 o), h ∈ Icc (-1 : ℝ) 1 := (ae_mem_iff_measure_eq (μ := κ.1 o) measurableSet_Icc.nullMeasurableSet).2 (by simpa only [measure_univ] using κ.2.2 o) calc (κ.1 o).map realKernelClip = (κ.1 o).map id := Measure.map_congr (hb.mono fun _ hh => realKernelClip_eq_self hh) _ = κ.1 o := Measure.map_id
CausalSmith.Stat.MarRareqLogfrontier.boundedKernel_map_clip · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/RandomizedKernel.lean:291
theorem boundedKernel_uniformSeed_representation Lemma boundedKernel_uniformSeed_representation in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
∃ f : Z × UnitSeed → Icc (-1 : ℝ) 1,
conclusion 1
o :
κ.1 o = uniformSeedLaw.map (fun v => (f (o, v)).1)
Proof (Lean source)
-- @node: boundedKernel_uniformSeed_representation lemma boundedKernel_uniformSeed_representation {Z : Type*} [Finite Z] [MeasurableSpace Z] [MeasurableSingletonClass Z] (κ : BoundedKernel Z) : ∃ f : Z × UnitSeed → Icc (-1 : ℝ) 1, Measurable f ∧ ∀ o, κ.1 o = uniformSeedLaw.map (fun v => (f (o, v)).1) := by letI : IsMarkovKernel κ.1 := κ.2.1 obtain ⟨g, hg, hmap⟩ := κ.1.exists_measurable_map_eq_unitInterval let f : Z × UnitSeed → Icc (-1 : ℝ) 1 := fun p => ⟨realKernelClip (g p.1 p.2), realKernelClip_mem _⟩ have hf : Measurable f := by fun_prop refine ⟨f, hf, fun o => ?_⟩ have hgo : Measurable (g o) := by fun_prop change κ.1 o = (volume : Measure UnitSeed).map (realKernelClip ∘ g o) rw [← Measure.map_map measurable_realKernelClip hgo, hmap o, boundedKernel_map_clip]
CausalSmith.Stat.MarRareqLogfrontier.boundedKernel_uniformSeed_representation · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/RandomizedKernel.lean:304

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
Z :
κ :
Kernel Z ℝ
hk :
clippedRealKernel κ hk :
by letI : IsMarkovKernel κ := hk refine ⟨κ.map realKernelClip, Kernel.IsMarkovKernel.map κ measurable_realKernelClip, fun o
=> ?_⟩ rw [Kernel.map_apply κ measurable_realKernelClip, Measure.map_apply measurable_realKernelClip measurableSet_Icc] have hpre : realKernelClip ⁻¹' Icc (-1 : ℝ) 1 = univ := by ext h simp only [mem_preimage, mem_univ, iff_true] exact realKernelClip_mem h rw [hpre, measure_univ]
CausalSmith.Stat.MarRareqLogfrontier.clippedRealKernel · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/RandomizedKernel.lean:322
theorem bounded_realKernelRisk_eq_ofReal Lemma bounded_realKernelRisk_eq_ofReal in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
Z Λ :
Q :
Λ → Measure Z
hQ :
∀ param, IsProbabilityMeasure (Q param)
θ :
Λ → ℝ
κ :
param :
Λ
realKernelRisk Q θ κ.1 param = ofReal (kernelRisk Q θ κ param)
Proof (Lean source)
-- @node: bounded_realKernelRisk_eq_ofReal lemma bounded_realKernelRisk_eq_ofReal {Z Λ : Type*} [Finite Z] [MeasurableSpace Z] [MeasurableSingletonClass Z] (Q : Λ → Measure Z) (hQ : ∀ param, IsProbabilityMeasure (Q param)) (θ : Λ → ℝ) (κ : BoundedKernel Z) (param : Λ) : realKernelRisk Q θ κ.1 param = ofReal (kernelRisk Q θ κ param) := by letI : IsProbabilityMeasure (Q param) := hQ param letI : IsMarkovKernel κ.1 := κ.2.1 have hi (o : Z) : Integrable (fun h => (h - θ param) ^ 2) (κ.1 o) := by have hb : ∀ᵐ h ∂(κ.1 o), h ∈ Icc (-1 : ℝ) 1 := (ae_mem_iff_measure_eq (μ := κ.1 o) measurableSet_Icc.nullMeasurableSet).2 (by simpa only [measure_univ] using κ.2.2 o) have hm : AEStronglyMeasurable (fun h : ℝ => h) (κ.1 o) := by fun_prop exact ((memLp_of_bounded hb hm 2).sub (memLp_const (θ param))).integrable_sq unfold realKernelRisk kernelRisk rw [ofReal_integral_eq_lintegral_ofReal Integrable.of_finite (Filter.Eventually.of_forall fun o => integral_nonneg fun h => sq_nonneg _)] apply lintegral_congr intro o exact (ofReal_integral_eq_lintegral_ofReal (hi o) (Filter.Eventually.of_forall fun h => sq_nonneg (h - θ param))).symm
CausalSmith.Stat.MarRareqLogfrontier.bounded_realKernelRisk_eq_ofReal · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/RandomizedKernel.lean:336
theorem real_kernel_minimax_eq_bounded Lemma real_kernel_minimax_eq_bounded in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
Z Λ :
Q :
Λ → Measure Z
hQ :
∀ param, IsProbabilityMeasure (Q param)
θ :
Λ → ℝ
hθ :
∀ param, θ param ∈ Icc (-1 : ℝ) 1
(⨅ κ : {κ : Kernel Z ℝ // IsMarkovKernel κ}, ⨆ param : Λ, realKernelRisk Q θ κ.1 param).toReal
Proof (Lean source)
-- @node: real_kernel_minimax_eq_bounded lemma real_kernel_minimax_eq_bounded {Z Λ : Type*} [Finite Z] [MeasurableSpace Z] [MeasurableSingletonClass Z] (Q : Λ → Measure Z) (hQ : ∀ param, IsProbabilityMeasure (Q param)) (θ : Λ → ℝ) (hθ : ∀ param, θ param ∈ Icc (-1 : ℝ) 1) : (⨅ κ : {κ : Kernel Z ℝ // IsMarkovKernel κ}, ⨆ param : Λ, realKernelRisk Q θ κ.1 param).toReal = minimaxValueReal (kernelRisk Q θ) := by have heq : (⨅ κ : {κ : Kernel Z ℝ // IsMarkovKernel κ}, ⨆ param : Λ, realKernelRisk Q θ κ.1 param) = minimaxValueENNRealOfReal (kernelRisk Q θ) := by apply le_antisymm · apply le_iInf intro κ refine (iInf_le _ ⟨κ.1, κ.2.1⟩).trans ?_ apply iSup_le intro param rw [bounded_realKernelRisk_eq_ofReal Q hQ] exact le_iSup (fun param => ofReal (kernelRisk Q θ κ param)) param · apply le_iInf intro κ let b := clippedRealKernel κ.1 κ.2 change (⨅ b : BoundedKernel Z, ⨆ param, ofReal (kernelRisk Q θ b param)) ≤ _ refine (iInf_le _ b).trans ?_ apply iSup_le intro param rw [← bounded_realKernelRisk_eq_ofReal Q hQ] exact (realKernelClip_risk_le Q θ hθ κ.1 param).trans (le_iSup (realKernelRisk Q θ κ.1) param) rw [heq] apply minimaxValueENNRealOfReal_toReal_of_nonneg_of_bddAbove · exact fun κ param => (bounded_kernelRisk_bounds Q hQ θ hθ κ param).1 · intro κ refine ⟨4, ?_⟩ rintro _ ⟨param, rfl⟩ exact (bounded_kernelRisk_bounds Q hQ θ hθ κ param).2
CausalSmith.Stat.MarRareqLogfrontier.real_kernel_minimax_eq_bounded · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/RandomizedKernel.lean:359
theorem randomized_kernel_barycenter Lemma 1 in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
Z Λ :
Q :
Λ → Measure Z
hQ :
∀ param, IsProbabilityMeasure (Q param)
θ :
Λ → ℝ
hθ :
∀ param, θ param ∈ Icc (-1 : ℝ) 1
conclusion 1
κ :
o :
barycenter κ o ∈ Icc (-1 : ℝ) 1
conclusion 2
κ :
param :
Λ
mapRisk Q θ (barycenter κ) param ≤ kernelRisk Q θ κ param
conclusion 3
= minimaxValueReal (fun (f : Z → Icc (-1 : ℝ) 1) param => mapRisk Q θ (fun o => (f o).1) param)
conclusion 4
κ :
Kernel Z ℝ
param :
realKernelRisk Q θ (κ.map realKernelClip) param ≤ realKernelRisk Q θ κ param
conclusion 5
(⨅ κ : {κ : Kernel Z ℝ // IsMarkovKernel κ}, ⨆ param : Λ, realKernelRisk Q θ κ.1 param).toReal
conclusion 7
κ :
∃ f : Z × UnitSeed → Icc (-1 : ℝ) 1,
o :
κ.1 o = uniformSeedLaw.map (fun v => (f (o, v)).1)
conclusion 8
f :
Z × UnitSeed → Icc (-1 : ℝ) 1
∃ κ : BoundedKernel Z, ∀ o, κ.1 o = uniformSeedLaw.map (fun v => (f (o, v)).1)
Proof (Lean source)
-- @node: lem:randomized-kernel-barycenter lemma randomized_kernel_barycenter {Z Λ : Type*} [Finite Z] [MeasurableSpace Z] [MeasurableSingletonClass Z] (Q : Λ → Measure Z) (hQ : ∀ param, IsProbabilityMeasure (Q param)) (θ : Λ → ℝ) (hθ : ∀ param, θ param ∈ Icc (-1 : ℝ) 1) : (∀ κ : BoundedKernel Z, ∀ o, barycenter κ o ∈ Icc (-1 : ℝ) 1) ∧ (∀ (κ : BoundedKernel Z) (param : Λ), mapRisk Q θ (barycenter κ) param ≤ kernelRisk Q θ κ param) ∧ minimaxValueReal (kernelRisk Q θ) = minimaxValueReal (fun (f : Z → Icc (-1 : ℝ) 1) param => mapRisk Q θ (fun o => (f o).1) param) ∧ (∀ (κ : Kernel Z ℝ), IsMarkovKernel κ → ∀ param, realKernelRisk Q θ (κ.map realKernelClip) param ≤ realKernelRisk Q θ κ param) ∧ (⨅ κ : {κ : Kernel Z ℝ // IsMarkovKernel κ}, ⨆ param : Λ, realKernelRisk Q θ κ.1 param).toReal = minimaxValueReal (kernelRisk Q θ) ∧ IsProbabilityMeasure uniformSeedLaw ∧ (∀ κ : BoundedKernel Z, ∃ f : Z × UnitSeed → Icc (-1 : ℝ) 1, Measurable f ∧ ∀ o, κ.1 o = uniformSeedLaw.map (fun v => (f (o, v)).1)) ∧ (∀ f : Z × UnitSeed → Icc (-1 : ℝ) 1, Measurable f → ∃ κ : BoundedKernel Z, ∀ o, κ.1 o = uniformSeedLaw.map (fun v => (f (o, v)).1)) := by refine ⟨kernel_barycenter_mem, kernel_barycenter_risk_le Q hQ θ, bounded_kernel_minimax_eq_deterministic Q hQ θ hθ, ?_⟩ refine ⟨fun κ _ param => realKernelClip_risk_le Q θ hθ κ param, ?_, uniformSeedLaw_probability, ?_, ?_⟩ · exact real_kernel_minimax_eq_bounded Q hQ θ hθ · exact boundedKernel_uniformSeed_representation · exact boundedKernel_of_uniformSeed
CausalSmith.Stat.MarRareqLogfrontier.randomized_kernel_barycenter · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/RandomizedKernel.lean:397
theorem randomized_kernel_tv_comparison Lemma 2 in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
conclusion 1
tvDist (κ ∘ₘ Q₀) (κ ∘ₘ Q₁) ≤ tvDist (Q₀ ⊗ₘ κ) (Q₁ ⊗ₘ κ)
conclusion 2
tvDist (Q₀ ⊗ₘ κ) (Q₁ ⊗ₘ κ) = tvDist Q₀ Q₁
conclusion 3
T :
Set (Z × H)
1 - tvDist Q₀ Q₁ ≤ (Q₀ ⊗ₘ κ).real T + (Q₁ ⊗ₘ κ).real Tᶜ
conclusion 4
T :
Set H
1 - tvDist Q₀ Q₁ ≤ (κ ∘ₘ Q₀).real T + (κ ∘ₘ Q₁).real Tᶜ
Proof (Lean source)
-- @node: lem:randomized-kernel-tv-comparison lemma randomized_kernel_tv_comparison {Z H : Type*} [Finite Z] [MeasurableSpace Z] [MeasurableSingletonClass Z] [MeasurableSpace H] (Q₀ Q₁ : Measure Z) [IsProbabilityMeasure Q₀] [IsProbabilityMeasure Q₁] (κ : Kernel Z H) [IsMarkovKernel κ] : tvDist (κ ∘ₘ Q₀) (κ ∘ₘ Q₁) ≤ tvDist (Q₀ ⊗ₘ κ) (Q₁ ⊗ₘ κ) ∧ tvDist (Q₀ ⊗ₘ κ) (Q₁ ⊗ₘ κ) = tvDist Q₀ Q₁ ∧ (∀ T : Set (Z × H), MeasurableSet T → 1 - tvDist Q₀ Q₁ ≤ (Q₀ ⊗ₘ κ).real T + (Q₁ ⊗ₘ κ).real Tᶜ) ∧ (∀ T : Set H, MeasurableSet T → 1 - tvDist Q₀ Q₁ ≤ (κ ∘ₘ Q₀).real T + (κ ∘ₘ Q₁).real Tᶜ) := by exact ⟨Causalean.Stat.tvDist_bind_le_compProd Q₀ Q₁ κ, tvDist_compProd_eq Q₀ Q₁ κ, one_sub_tvDist_le_compProd_test Q₀ Q₁ κ, one_sub_tvDist_le_bind_test Q₀ Q₁ κ⟩
CausalSmith.Stat.MarRareqLogfrontier.randomized_kernel_tv_comparison · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/RandomizedKernel.lean:428
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.SyntheticCompletion 39 declarations Law-independent fair-coin completion of a discrete observational record.

Law-independent fair-coin completion of a discrete observational record.

def categoryLaw

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
d :
ℕ
P :
categoryLaw P :
P.1.map (fun r => r.1)
CausalSmith.Stat.MarRareqLogfrontier.SyntheticCompletion.categoryLaw · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/SyntheticCompletion.lean:21
def propensity

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
d :
ℕ
P :
x :
Fin d
propensity P x :
ℝ
if 0 < zengCategory P x then zengArm P x true / zengCategory P x else 0
CausalSmith.Stat.MarRareqLogfrontier.SyntheticCompletion.propensity · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/SyntheticCompletion.lean:25
def outcomeMean

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
d :
ℕ
P :
x :
Fin d
b :
outcomeMean P x b :
ℝ
if 0 < zengArm P x b then P.1.real {r | r.1 = x ∧ r.2.1 = b ∧ r.2.2 = true} / zengArm P x b else 0
CausalSmith.Stat.MarRareqLogfrontier.SyntheticCompletion.outcomeMean · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/SyntheticCompletion.lean:29
def parameters

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
d :
ℕ
P :
parameters P :
clause 1
μ := categoryLaw P
clause 2
μ_prob := by letI : IsProbabilityMeasure P.1 := P.2 exact Measure.isProbabilityMeasure_map (by fun_prop)
clause 3
e := propensity P
clause 4
q₀ := fun x => outcomeMean P x false
clause 5
q₁ := fun x => outcomeMean P x true
clause 6
he := by fun_prop
clause 7
hq₀ := by fun_prop
clause 8
hq₁ := by fun_prop
clause 9
he01 := by letI : IsProbabilityMeasure P.1 := P.2 intro x rw [Set.mem_Icc] by_cases hx : 0 < zengCategory P x · simp only [propensity, if_pos hx] constructor · exact div_nonneg measureReal_nonneg (le_of_lt hx) · apply (div_le_one hx).2 exact measureReal_mono (by intro r hr; exact hr.1) (measure_ne_top P.1 _) · simp [propensity, hx]
clause 10
hq₀01 := by letI : IsProbabilityMeasure P.1 := P.2 intro x rw [Set.mem_Icc] by_cases hb : 0 < zengArm P x false · simp only [outcomeMean, if_pos hb] constructor · exact div_nonneg measureReal_nonneg (le_of_lt hb) · apply (div_le_one hb).2 exact measureReal_mono (by intro r hr; exact ⟨hr.1, hr.2.1⟩) (measure_ne_top P.1 _) · simp [outcomeMean, hb]
clause 11
hq₁01 := by letI : IsProbabilityMeasure P.1 := P.2 intro x rw [Set.mem_Icc] by_cases hb : 0 < zengArm P x true · simp only [outcomeMean, if_pos hb] constructor · exact div_nonneg measureReal_nonneg (le_of_lt hb) · apply (div_le_one hb).2 exact measureReal_mono (by intro r hr; exact ⟨hr.1, hr.2.1⟩) (measure_ne_top P.1 _) · simp [outcomeMean, hb]
CausalSmith.Stat.MarRareqLogfrontier.SyntheticCompletion.parameters · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/SyntheticCompletion.lean:35
def fairCoin

the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
fairCoin :
(1 / 2 : ℝ≥0∞) • Measure.dirac false + (1 / 2 : ℝ≥0∞) • Measure.dirac true
CausalSmith.Stat.MarRareqLogfrontier.SyntheticCompletion.fairCoin · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/SyntheticCompletion.lean:83
instance instIsProbabilityMeasureBoolFairCoin

the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
instance : IsProbabilityMeasure fairCoin := by refine ⟨?_⟩ simp [fairCoin, ENNReal.inv_two_add_inv_two]
CausalSmith.Stat.MarRareqLogfrontier.SyntheticCompletion.instIsProbabilityMeasureBoolFairCoin · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/SyntheticCompletion.lean:88
def toFullRecord

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
d :
ℕ
z :
toFullRecord z :
⟨z.1.1, z.2, false, false, z.1.2.2.1, z.1.2.2.2, z.2 == z.1.2.1⟩
CausalSmith.Stat.MarRareqLogfrontier.SyntheticCompletion.toFullRecord · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/SyntheticCompletion.lean:93
def fullMeasure

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
d :
ℕ
P :
fullMeasure P :
CausalSmith.Stat.MarRareqLogfrontier.SyntheticCompletion.fullMeasure · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/SyntheticCompletion.lean:98
theorem fullMeasure_probability

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
P :
Proof (Lean source)
lemma fullMeasure_probability {d : ℕ} (P : ZengLaw d) : IsProbabilityMeasure (fullMeasure P) := by letI : IsProbabilityMeasure (parameters P).fullLaw := (parameters P).fullLaw_probability unfold fullMeasure exact Measure.isProbabilityMeasure_map (by fun_prop)
CausalSmith.Stat.MarRareqLogfrontier.SyntheticCompletion.fullMeasure_probability · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/SyntheticCompletion.lean:102
def fullLaw

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
d :
ℕ
P :
fullLaw P :
⟨fullMeasure P, fullMeasure_probability P⟩
CausalSmith.Stat.MarRareqLogfrontier.SyntheticCompletion.fullLaw · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/SyntheticCompletion.lean:110
theorem arm_sum

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
P :
x :
Fin d
Proof (Lean source)
lemma arm_sum {d : ℕ} (P : ZengLaw d) (x : Fin d) : zengArm P x false + zengArm P x true = zengCategory P x := by letI : IsProbabilityMeasure P.1 := P.2 rw [zengArm, zengArm, zengCategory, ← measureReal_union] · congr 1 ext r cases h : r.2.1 <;> simp [h] · rw [Set.disjoint_left] simp · measurability
CausalSmith.Stat.MarRareqLogfrontier.SyntheticCompletion.arm_sum · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/SyntheticCompletion.lean:114
theorem arm_pos

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
q :
ℝ
P :
hP :
x :
Fin d
hx :
0 < zengCategory P x
b :
0 < zengArm P x b
Proof (Lean source)
lemma arm_pos {d : ℕ} {q : ℝ} (P : ZengLaw d) (hP : P ∈ zengDiscreteClass d q) (x : Fin d) (hx : 0 < zengCategory P x) (b : Bool) : 0 < zengArm P x b := by rcases hP with ⟨hq, hqhalf, hd, hbounds⟩ cases b with | true => exact lt_of_lt_of_le (mul_pos hq hx) (hbounds x hx).1 | false => have hu := (hbounds x hx).2 have hs := arm_sum P x have : q < 1 := by linarith nlinarith
CausalSmith.Stat.MarRareqLogfrontier.SyntheticCompletion.arm_pos · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/SyntheticCompletion.lean:126
theorem categoryLaw_singleton_real

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
P :
x :
Fin d
Proof (Lean source)
lemma categoryLaw_singleton_real {d : ℕ} (P : ZengLaw d) (x : Fin d) : (categoryLaw P).real {x} = zengCategory P x := by letI : IsProbabilityMeasure P.1 := P.2 rw [categoryLaw, Measure.real, Measure.map_apply (by fun_prop) (by simp), zengCategory, measureReal_def] rfl
CausalSmith.Stat.MarRareqLogfrontier.SyntheticCompletion.categoryLaw_singleton_real · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/SyntheticCompletion.lean:139
theorem outcomeMean_eq_zengMean

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
q :
ℝ
P :
hP :
x :
Fin d
hx :
0 < zengCategory P x
b :
outcomeMean P x b = zengMean P x b hx
Proof (Lean source)
lemma outcomeMean_eq_zengMean {d : ℕ} {q : ℝ} (P : ZengLaw d) (hP : P ∈ zengDiscreteClass d q) (x : Fin d) (hx : 0 < zengCategory P x) (b : Bool) : outcomeMean P x b = zengMean P x b hx := by have hb := arm_pos P hP x hx b simp [outcomeMean, zengMean, hb]
CausalSmith.Stat.MarRareqLogfrontier.SyntheticCompletion.outcomeMean_eq_zengMean · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/SyntheticCompletion.lean:147
theorem success_real_singleton

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
P :
x :
Fin d
b :
P.1.real {r | r.1 = x ∧ r.2.1 = b ∧ r.2.2 = true} = P.1.real (singleton (x, b, true))
Proof (Lean source)
lemma success_real_singleton {d : ℕ} (P : ZengLaw d) (x : Fin d) (b : Bool) : P.1.real {r | r.1 = x ∧ r.2.1 = b ∧ r.2.2 = true} = P.1.real (singleton (x, b, true)) := by congr 1 ext r rcases r with ⟨x', b', y'⟩ change (x' = x ∧ b' = b ∧ y' = true) ↔ (x', b', y') = (x, b, true) cases y' <;> simp
CausalSmith.Stat.MarRareqLogfrontier.SyntheticCompletion.success_real_singleton · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/SyntheticCompletion.lean:155
theorem arm_real_split

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
P :
x :
Fin d
b :
zengArm P x b
= P.1.real (singleton (x, b, false)) + P.1.real (singleton (x, b, true))
Proof (Lean source)
lemma arm_real_split {d : ℕ} (P : ZengLaw d) (x : Fin d) (b : Bool) : zengArm P x b = P.1.real (singleton (x, b, false)) + P.1.real (singleton (x, b, true)) := by letI : IsProbabilityMeasure P.1 := P.2 rw [zengArm, ← measureReal_union] · congr 1 ext r rcases r with ⟨x', b', y'⟩ change (x' = x ∧ b' = b) ↔ (x', b', y') = (x, b, false) ∨ (x', b', y') = (x, b, true) cases y' <;> simp · rw [Set.disjoint_left] intro r hr₀ hr₁ change r = (x, b, false) at hr₀ change r = (x, b, true) at hr₁ subst r exact Bool.noConfusion (congrArg (fun z => z.2.2) hr₁) · exact MeasurableSet.singleton _
CausalSmith.Stat.MarRareqLogfrontier.SyntheticCompletion.arm_real_split · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/SyntheticCompletion.lean:166
theorem selected_eq

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
q :
ℝ
P :
hP :
(parameters P).selected = P.1
Proof (Lean source)
lemma selected_eq {d : ℕ} {q : ℝ} (P : ZengLaw d) (hP : P ∈ zengDiscreteClass d q) : (parameters P).selected = P.1 := by letI : IsProbabilityMeasure P.1 := P.2 letI : IsProbabilityMeasure (parameters P).selected := (parameters P).selected_probability apply Measure.ext_of_measureReal_singleton rintro ⟨x, b, y⟩ have hcell := (parameters P).selected_cell ({x} : Set (Fin d)) (by simp) b y have hset : {z : SelectedCoord (Fin d) | z.1 ∈ ({x} : Set (Fin d)) ∧ z.2.1 = b ∧ z.2.2 = y} = {(x, b, y)} := by ext z rcases z with ⟨x', b', y'⟩ simp rw [hset] at hcell rw [MeasureTheory.lintegral_singleton] at hcell have hcellReal := congrArg toReal hcell rw [Measure.real, hcellReal, ENNReal.toReal_mul, ENNReal.toReal_ofReal] · change cellMass (propensity P x) (outcomeMean P x false) (outcomeMean P x true) b y * ((categoryLaw P) {x}).toReal = _ change _ = P.1.real (singleton (x, b, y)) rw [show ((categoryLaw P) {x}).toReal = zengCategory P x by simpa [Measure.real] using categoryLaw_singleton_real P x] by_cases hx : 0 < zengCategory P x · have hbpos := arm_pos P hP x hx b have hcatne : zengCategory P x ≠ 0 := ne_of_gt hx have hbne : zengArm P x b ≠ 0 := ne_of_gt hbpos rw [show propensity P x = zengArm P x true / zengCategory P x by simp [propensity, hx]] rw [show outcomeMean P x false = zengMean P x false hx from outcomeMean_eq_zengMean P hP x hx false] rw [show outcomeMean P x true = zengMean P x true hx from outcomeMean_eq_zengMean P hP x hx true] have hsfalse := arm_real_split P x false have hstrue := arm_real_split P x true have hcat := arm_sum P x cases b <;> cases y <;> simp [cellMass, bitMass, zengMean, success_real_singleton] <;> field_simp <;> first | (rw [← hcat, hsfalse, hstrue]; ring) | (rw [← hcat, hsfalse]; ring) | (rw [hstrue]; ring) | (rw [hsfalse]; ring) | ring · have hcat0 : zengCategory P x = 0 := le_antisymm (le_of_not_gt hx) measureReal_nonneg have hatom : P.1.real (singleton (x, b, y)) = 0 := by have hsub : singleton (x, b, y) ⊆ {r | r.1 = x} := by intro r hr change r = (x, b, y) at hr subst r rfl apply le_antisymm _ measureReal_nonneg apply le_trans (measureReal_mono hsub (measure_ne_top P.1 _)) simpa [zengCategory] using le_of_eq hcat0 simp [hcat0, hatom] · unfold cellMass apply mul_nonneg · exact bitMass_nonneg _ ((parameters P).he01 x) _ · split · exact bitMass_nonneg _ ((parameters P).hq₁01 x) _ · exact bitMass_nonneg _ ((parameters P).hq₀01 x) _
CausalSmith.Stat.MarRareqLogfrontier.SyntheticCompletion.selected_eq · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/SyntheticCompletion.lean:187
theorem bind_map_eq_prod_map

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
μ :
ν :
f :
α → β → γ
hf :
Measurable (fun z : α × β => f z.1 z.2)
μ.bind (fun x => ν.map (f x)) = (μ.prod ν).map (fun z => f z.1 z.2)
Proof (Lean source)
lemma bind_map_eq_prod_map {α β γ : Type*} [MeasurableSpace α] [MeasurableSpace β] [MeasurableSpace γ] [MeasurableSingletonClass α] [Countable α] (μ : Measure α) (ν : Measure β) [SFinite ν] (f : α → β → γ) (hf : Measurable (fun z : α × β => f z.1 z.2)) : μ.bind (fun x => ν.map (f x)) = (μ.prod ν).map (fun z => f z.1 z.2) := by ext s hs rw [Measure.bind_apply hs (measurable_of_countable _).aemeasurable, Measure.map_apply hf hs, Measure.prod_apply (hs.preimage hf)] apply lintegral_congr intro x have hfx : Measurable (f x) := hf.comp (measurable_const.prodMk measurable_id) rw [Measure.map_apply hfx hs] rfl
CausalSmith.Stat.MarRareqLogfrontier.SyntheticCompletion.bind_map_eq_prod_map · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/SyntheticCompletion.lean:252
theorem ofReal_bernoulli_marginal

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
p q :
ℝ
hp :
p ∈ Icc (0 : ℝ) 1
hq :
q ∈ Icc (0 : ℝ) 1
y :
ofReal (p * bitMass q y) + ofReal ((1 - p) * bitMass q y)
= ofReal (bitMass q y)
Proof (Lean source)
lemma ofReal_bernoulli_marginal (p q : ℝ) (hp : p ∈ Icc (0 : ℝ) 1) (hq : q ∈ Icc (0 : ℝ) 1) (y : Bool) : ofReal (p * bitMass q y) + ofReal ((1 - p) * bitMass q y) = ofReal (bitMass q y) := by have hbp : 0 ≤ bitMass p false := bitMass_nonneg p hp false have hpt : 0 ≤ bitMass p true := bitMass_nonneg p hp true have hbq : 0 ≤ bitMass q y := bitMass_nonneg q hq y rw [← ENNReal.ofReal_add (mul_nonneg hp.1 hbq) (mul_nonneg (sub_nonneg.mpr hp.2) hbq)] congr 1 cases y <;> simp [bitMass] <;> ring
CausalSmith.Stat.MarRareqLogfrontier.SyntheticCompletion.ofReal_bernoulli_marginal · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/SyntheticCompletion.lean:271
theorem remainingPairSetMass_selected

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
q₀ q₁ :
ℝ
hq₀ :
q₀ ∈ Icc (0 : ℝ) 1
hq₁ :
q₁ ∈ Icc (0 : ℝ) 1
a y :
remainingPairSetMass q₀ q₁ {v | (if a then v.2 else v.1) = y}
= ofReal (bitMass (if a then q₁ else q₀) y)
Proof (Lean source)
lemma remainingPairSetMass_selected (q₀ q₁ : ℝ) (hq₀ : q₀ ∈ Icc (0 : ℝ) 1) (hq₁ : q₁ ∈ Icc (0 : ℝ) 1) (a y : Bool) : remainingPairSetMass q₀ q₁ {v | (if a then v.2 else v.1) = y} = ofReal (bitMass (if a then q₁ else q₀) y) := by cases a with | false => simpa [remainingPairSetMass, bitMass, mul_comm] using (ofReal_bernoulli_marginal q₁ q₀ hq₁ hq₀ y) | true => simpa [remainingPairSetMass, bitMass, add_comm] using (ofReal_bernoulli_marginal q₀ q₁ hq₀ hq₁ y)
CausalSmith.Stat.MarRareqLogfrontier.SyntheticCompletion.remainingPairSetMass_selected · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/SyntheticCompletion.lean:286
theorem latent_cell_mass

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
P :
x :
Fin d
b a y :
(parameters P).fullLaw {z | z.1 = x ∧ z.2.1 = b ∧ (if a then z.2.2.2 else z.2.2.1) = y}
= ofReal (bitMass (propensity P x) b * bitMass (if a then outcomeMean P x true else outcomeMean P x false) y) * (categoryLaw P) {x}
Proof (Lean source)
lemma latent_cell_mass {d : ℕ} (P : ZengLaw d) (x : Fin d) (b a y : Bool) : (parameters P).fullLaw {z | z.1 = x ∧ z.2.1 = b ∧ (if a then z.2.2.2 else z.2.2.1) = y} = ofReal (bitMass (propensity P x) b * bitMass (if a then outcomeMean P x true else outcomeMean P x false) y) * (categoryLaw P) {x} := by let t : Set (Bool × Bool) := {v | (if a then v.2 else v.1) = y} have h := (parameters P).conditional_independence_finite ({x} : Set (Fin d)) (by simp) ({b} : Set Bool) t have hset : {z : FullCoord (Fin d) | z.1 ∈ ({x} : Set (Fin d)) ∧ z.2.1 ∈ ({b} : Set Bool) ∧ z.2.2 ∈ t} = {z | z.1 = x ∧ z.2.1 = b ∧ (if a then z.2.2.2 else z.2.2.1) = y} := by ext z simp [t] rw [hset] at h rw [h, MeasureTheory.lintegral_singleton] have he := (parameters P).he01 x have hq₀ := (parameters P).hq₀01 x have hq₁ := (parameters P).hq₁01 x rw [show t = {v | (if a then v.2 else v.1) = y} from rfl, remainingPairSetMass_selected _ _ hq₀ hq₁] have hb : 0 ≤ bitMass (propensity P x) b := bitMass_nonneg _ he b rw [show firstMarkSetMass ((parameters P).e x) {b} = ofReal (bitMass (propensity P x) b) by change firstMarkSetMass (propensity P x) {b} = _ cases b <;> simp [firstMarkSetMass, bitMass]] rw [← ENNReal.ofReal_mul hb] rfl
CausalSmith.Stat.MarRareqLogfrontier.SyntheticCompletion.latent_cell_mass · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/SyntheticCompletion.lean:300
theorem full_joint_mass

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
P :
a :
x :
Fin d
r y :
(fullMeasure P) {w | inCell w (a, x, false) ∧ w.R = r ∧ w.Y = y}
= (parameters P).fullLaw {z | z.1 = x ∧ z.2.1 = (if r then a else !a) ∧ (if a then z.2.2.2 else z.2.2.1) = y} * fairCoin {a}
Proof (Lean source)
lemma full_joint_mass {d : ℕ} (P : ZengLaw d) (a : Bool) (x : Fin d) (r y : Bool) : (fullMeasure P) {w | inCell w (a, x, false) ∧ w.R = r ∧ w.Y = y} = (parameters P).fullLaw {z | z.1 = x ∧ z.2.1 = (if r then a else !a) ∧ (if a then z.2.2.2 else z.2.2.1) = y} * fairCoin {a} := by let E : Set (FullCoord (Fin d)) := {z | z.1 = x ∧ z.2.1 = (if r then a else !a) ∧ (if a then z.2.2.2 else z.2.2.1) = y} have hpre : toFullRecord ⁻¹' {w | inCell w (a, x, false) ∧ w.R = r ∧ w.Y = y} = E ×ˢ ({a} : Set Bool) := by ext z rcases z with ⟨⟨x', b, y₀, y₁⟩, a'⟩ cases a <;> cases a' <;> cases b <;> cases r <;> cases y₀ <;> cases y₁ <;> cases y <;> simp [E, toFullRecord, inCell, FullRecord.S, FullRecord.Y] rw [fullMeasure, Measure.map_apply (by fun_prop) (by simp), hpre, Measure.prod_prod]
CausalSmith.Stat.MarRareqLogfrontier.SyntheticCompletion.full_joint_mass · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/SyntheticCompletion.lean:336
theorem full_joint_mass_real

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
P :
a :
x :
Fin d
r y :
(fullMeasure P).real {w | inCell w (a, x, false) ∧ w.R = r ∧ w.Y = y}
= (1 / 2 : ℝ) * zengCategory P x * bitMass (propensity P x) (if r then a else !a) * bitMass (if a then outcomeMean P x true else outcomeMean P x false) y
Proof (Lean source)
lemma full_joint_mass_real {d : ℕ} (P : ZengLaw d) (a : Bool) (x : Fin d) (r y : Bool) : (fullMeasure P).real {w | inCell w (a, x, false) ∧ w.R = r ∧ w.Y = y} = (1 / 2 : ℝ) * zengCategory P x * bitMass (propensity P x) (if r then a else !a) * bitMass (if a then outcomeMean P x true else outcomeMean P x false) y := by rw [Measure.real, full_joint_mass, latent_cell_mass] rw [ENNReal.toReal_mul, ENNReal.toReal_mul, ENNReal.toReal_ofReal] · rw [show ((categoryLaw P) {x}).toReal = zengCategory P x by simpa [Measure.real] using categoryLaw_singleton_real P x] have hcoin : (fairCoin {a}).toReal = (1 / 2 : ℝ) := by cases a <;> simp [fairCoin] rw [hcoin] ring · exact mul_nonneg (bitMass_nonneg _ ((parameters P).he01 x) _) (bitMass_nonneg _ (by split · exact (parameters P).hq₁01 x · exact (parameters P).hq₀01 x) _)
CausalSmith.Stat.MarRareqLogfrontier.SyntheticCompletion.full_joint_mass_real · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/SyntheticCompletion.lean:359
theorem measureReal_split_bool

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
α :
E :
Set α
hE :
f :
α → Bool
hf :
μ.real E = ∑ b : Bool, μ.real {w | w ∈ E ∧ f w = b}
Proof (Lean source)
lemma measureReal_split_bool {α : Type*} [MeasurableSpace α] (μ : Measure α) [IsFiniteMeasure μ] (E : Set α) (hE : MeasurableSet E) (f : α → Bool) (hf : Measurable f) : μ.real E = ∑ b : Bool, μ.real {w | w ∈ E ∧ f w = b} := by rw [Fintype.sum_bool, ← measureReal_union] · congr 1 ext w cases h : f w <;> simp [h] · rw [Set.disjoint_left] intro a ha hb simp only [Set.mem_setOf_eq] at ha hb simp [ha.2] at hb · exact hE.inter (measurableSet_eq_fun hf measurable_const)
CausalSmith.Stat.MarRareqLogfrontier.SyntheticCompletion.measureReal_split_bool · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/SyntheticCompletion.lean:382
theorem full_cellProb_false

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
P :
a :
x :
Fin d
cellProb (fullLaw P) (a, x, false) = (1 / 2 : ℝ) * zengCategory P x
Proof (Lean source)
lemma full_cellProb_false {d : ℕ} (P : ZengLaw d) (a : Bool) (x : Fin d) : cellProb (fullLaw P) (a, x, false) = (1 / 2 : ℝ) * zengCategory P x := by letI : IsProbabilityMeasure (fullMeasure P) := fullMeasure_probability P unfold cellProb change (fullMeasure P).real {r | inCell r (a, x, false)} = _ rw [measureReal_split_bool (fullMeasure P) {w | inCell w (a, x, false)} (by simp) FullRecord.R (by fun_prop)] simp only [Fintype.sum_bool, Set.mem_setOf_eq, and_assoc] rw [measureReal_split_bool (fullMeasure P) {w | inCell w (a, x, false) ∧ w.R = false} (by simp) FullRecord.Y (by fun_prop), measureReal_split_bool (fullMeasure P) {w | inCell w (a, x, false) ∧ w.R = true} (by simp) FullRecord.Y (by fun_prop)] simp only [Fintype.sum_bool, Set.mem_setOf_eq, and_assoc] simp_rw [full_joint_mass_real] cases a <;> simp [bitMass] <;> ring
CausalSmith.Stat.MarRareqLogfrontier.SyntheticCompletion.full_cellProb_false · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/SyntheticCompletion.lean:397
theorem full_arrived_false

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
P :
a :
x :
Fin d
arrivedCell (fullLaw P) (a, x, false)
= (1 / 2 : ℝ) * zengCategory P x * bitMass (propensity P x) a
Proof (Lean source)
lemma full_arrived_false {d : ℕ} (P : ZengLaw d) (a : Bool) (x : Fin d) : arrivedCell (fullLaw P) (a, x, false) = (1 / 2 : ℝ) * zengCategory P x * bitMass (propensity P x) a := by letI : IsProbabilityMeasure (fullMeasure P) := fullMeasure_probability P unfold arrivedCell change (fullMeasure P).real {r | inCell r (a, x, false) ∧ r.R = true} = _ rw [measureReal_split_bool (fullMeasure P) {w | inCell w (a, x, false) ∧ w.R = true} (by simp) FullRecord.Y (by fun_prop)] simp only [Fintype.sum_bool, Set.mem_setOf_eq, and_assoc] simp_rw [full_joint_mass_real] cases a <;> simp [bitMass] <;> ring
CausalSmith.Stat.MarRareqLogfrontier.SyntheticCompletion.full_arrived_false · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/SyntheticCompletion.lean:417
theorem full_cellR_false

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
P :
a :
x :
Fin d
r :
(fullMeasure P).real {w | inCell w (a, x, false) ∧ w.R = r}
= (1 / 2 : ℝ) * zengCategory P x * bitMass (propensity P x) (if r then a else !a)
Proof (Lean source)
lemma full_cellR_false {d : ℕ} (P : ZengLaw d) (a : Bool) (x : Fin d) (r : Bool) : (fullMeasure P).real {w | inCell w (a, x, false) ∧ w.R = r} = (1 / 2 : ℝ) * zengCategory P x * bitMass (propensity P x) (if r then a else !a) := by letI : IsProbabilityMeasure (fullMeasure P) := fullMeasure_probability P rw [measureReal_split_bool (fullMeasure P) {w | inCell w (a, x, false) ∧ w.R = r} (by simp) FullRecord.Y (by fun_prop)] simp only [Fintype.sum_bool, Set.mem_setOf_eq, and_assoc] simp_rw [full_joint_mass_real] cases a <;> cases r <;> simp [bitMass] <;> ring
CausalSmith.Stat.MarRareqLogfrontier.SyntheticCompletion.full_cellR_false · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/SyntheticCompletion.lean:431
theorem full_cellY_false

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
P :
a :
x :
Fin d
y :
(fullMeasure P).real {w | inCell w (a, x, false) ∧ w.Y = y}
= (1 / 2 : ℝ) * zengCategory P x * bitMass (if a then outcomeMean P x true else outcomeMean P x false) y
Proof (Lean source)
lemma full_cellY_false {d : ℕ} (P : ZengLaw d) (a : Bool) (x : Fin d) (y : Bool) : (fullMeasure P).real {w | inCell w (a, x, false) ∧ w.Y = y} = (1 / 2 : ℝ) * zengCategory P x * bitMass (if a then outcomeMean P x true else outcomeMean P x false) y := by letI : IsProbabilityMeasure (fullMeasure P) := fullMeasure_probability P rw [measureReal_split_bool (fullMeasure P) {w | inCell w (a, x, false) ∧ w.Y = y} (by simp) FullRecord.R (by fun_prop)] simp only [Fintype.sum_bool, Set.mem_setOf_eq, and_assoc] have hreorder (r : Bool) : (fullMeasure P).real {w | inCell w (a, x, false) ∧ w.Y = y ∧ w.R = r} = (fullMeasure P).real {w | inCell w (a, x, false) ∧ w.R = r ∧ w.Y = y} := by congr 1 ext w simp [and_left_comm, and_comm] rw [hreorder false, hreorder true, full_joint_mass_real, full_joint_mass_real] cases a <;> cases y <;> simp [Fintype.sum_bool, bitMass] <;> try ring_nf
CausalSmith.Stat.MarRareqLogfrontier.SyntheticCompletion.full_cellY_false · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/SyntheticCompletion.lean:445
theorem indepFun_map

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
Ω X Y Z :
hφ :
hf :
hg :
h :
IndepFun (f ∘ φ) (g ∘ φ) μ
IndepFun f g (μ.map φ)
Proof (Lean source)
lemma indepFun_map {Ω X Y Z : Type*} [MeasurableSpace Ω] [MeasurableSpace X] [MeasurableSpace Y] [MeasurableSpace Z] {μ : Measure Ω} {φ : Ω → X} {f : X → Y} {g : X → Z} (hφ : Measurable φ) (hf : Measurable f) (hg : Measurable g) (h : IndepFun (f ∘ φ) (g ∘ φ) μ) : IndepFun f g (μ.map φ) := by rw [indepFun_iff_measure_inter_preimage_eq_mul] at h ⊢ intro s t hs ht rw [Measure.map_apply hφ ((hs.preimage hf).inter (ht.preimage hg)), Measure.map_apply hφ (hs.preimage hf), Measure.map_apply hφ (ht.preimage hg)] exact h s t hs ht
CausalSmith.Stat.MarRareqLogfrontier.SyntheticCompletion.indepFun_map · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/SyntheticCompletion.lean:468
theorem fullLaw_randomized

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
P :
Proof (Lean source)
lemma fullLaw_randomized {d : ℕ} (P : ZengLaw d) : RandomizedIndependence (fullLaw P) := by let L := (parameters P).fullLaw letI : IsProbabilityMeasure L := (parameters P).fullLaw_probability have hsource : IndepFun (fun z : FullCoord (Fin d) × Bool => z.2) (fun z => z.1) (L.prod fairCoin) := (indepFun_prod (μ := L) (ν := fairCoin) measurable_id measurable_id).symm apply indepFun_map (φ := toFullRecord) (by fun_prop) (by fun_prop) (by fun_prop) convert hsource.comp measurable_id (measurable_of_finite (fun z : FullCoord (Fin d) => (z.1, false, false, z.2.2.1, z.2.2.2))) using 1 <;> rfl
CausalSmith.Stat.MarRareqLogfrontier.SyntheticCompletion.fullLaw_randomized · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/SyntheticCompletion.lean:480
theorem fullLaw_balanced

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
P :
Proof (Lean source)
lemma fullLaw_balanced {d : ℕ} (P : ZengLaw d) : BalancedRandomization (fullLaw P) := by letI : IsProbabilityMeasure (parameters P).fullLaw := (parameters P).fullLaw_probability rw [BalancedRandomization] change (fullMeasure P).real {r : FullRecord d | r.A = true} = 1 / 2 rw [Measure.real, fullMeasure, Measure.map_apply (by fun_prop) (by simp)] have hpre : toFullRecord ⁻¹' {r : FullRecord d | r.A = true} = univ ×ˢ ({true} : Set Bool) := by ext z simp [toFullRecord] rw [hpre, Measure.prod_prod] simp [fairCoin]
CausalSmith.Stat.MarRareqLogfrontier.SyntheticCompletion.fullLaw_balanced · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/SyntheticCompletion.lean:493
theorem fullLaw_surrogate

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
P :
Proof (Lean source)
lemma fullLaw_surrogate {d : ℕ} (P : ZengLaw d) : SurrogateConsistency (fullLaw P) := by filter_upwards [] with r rfl
CausalSmith.Stat.MarRareqLogfrontier.SyntheticCompletion.fullLaw_surrogate · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/SyntheticCompletion.lean:509
theorem fullLaw_outcome

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
P :
OutcomeConsistency (fullLaw P)
Proof (Lean source)
lemma fullLaw_outcome {d : ℕ} (P : ZengLaw d) : OutcomeConsistency (fullLaw P) := by filter_upwards [] with r rfl
CausalSmith.Stat.MarRareqLogfrontier.SyntheticCompletion.fullLaw_outcome · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/SyntheticCompletion.lean:515
theorem fullMeasure_real_of_surrogate_true

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
P :
E :
hE :
htrue :
∀ w
if
w ∈ E
then
w.S = true
(fullMeasure P).real E = 0
Proof (Lean source)
lemma fullMeasure_real_of_surrogate_true {d : ℕ} (P : ZengLaw d) (E : Set (FullRecord d)) (hE : MeasurableSet E) (htrue : ∀ w, w ∈ E → w.S = true) : (fullMeasure P).real E = 0 := by rw [Measure.real, fullMeasure, Measure.map_apply (by fun_prop) hE] have hpre : toFullRecord ⁻¹' E = ∅ := by ext z constructor · intro hz have h := htrue (toFullRecord z) hz have hf : (false : Bool) = true := by change (if z.2 then false else false) = true at h simpa using h exact Bool.noConfusion hf · simp rw [hpre] simp
CausalSmith.Stat.MarRareqLogfrontier.SyntheticCompletion.fullMeasure_real_of_surrogate_true · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/SyntheticCompletion.lean:521
theorem fullLaw_mar

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
P :
ArrivalMAR (fullLaw P)
Proof (Lean source)
lemma fullLaw_mar {d : ℕ} (P : ZengLaw d) : ArrivalMAR (fullLaw P) := by rintro ⟨a, x, s⟩ y r cases s with | false => change (fullMeasure P).real {w | inCell w (a, x, false) ∧ w.R = r ∧ w.Y = y} * cellProb (fullLaw P) (a, x, false) = (fullMeasure P).real {w | inCell w (a, x, false) ∧ w.R = r} * (fullMeasure P).real {w | inCell w (a, x, false) ∧ w.Y = y} rw [full_joint_mass_real, full_cellProb_false, full_cellR_false, full_cellY_false] ring | true => have hzero (E : Set (FullRecord d)) (hE : MeasurableSet E) (hsub : ∀ w, w ∈ E → inCell w (a, x, true)) : (fullMeasure P).real E = 0 := fullMeasure_real_of_surrogate_true P E hE (fun w hw => (hsub w hw).2.2) change (fullMeasure P).real {w | inCell w (a, x, true) ∧ w.R = r ∧ w.Y = y} * cellProb (fullLaw P) (a, x, true) = (fullMeasure P).real {w | inCell w (a, x, true) ∧ w.R = r} * (fullMeasure P).real {w | inCell w (a, x, true) ∧ w.Y = y} rw [hzero _ (by simp) (by intro w hw; exact hw.1), hzero _ (by simp) (by intro w hw; exact hw.1), hzero _ (by simp) (by intro w hw; exact hw.1)] simp
CausalSmith.Stat.MarRareqLogfrontier.SyntheticCompletion.fullLaw_mar · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/SyntheticCompletion.lean:539
theorem fullLaw_arrival

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
q :
ℝ
P :
hP :
OccupiedCellArrival q (fullLaw P)
Proof (Lean source)
lemma fullLaw_arrival {d : ℕ} {q : ℝ} (P : ZengLaw d) (hP : P ∈ zengDiscreteClass d q) : OccupiedCellArrival q (fullLaw P) := by rintro ⟨a, x, s⟩ hcell cases s with | true => have hz : cellProb (fullLaw P) (a, x, true) = 0 := by unfold cellProb change (fullMeasure P).real {w | inCell w (a, x, true)} = 0 exact fullMeasure_real_of_surrogate_true P _ (by simp) (by intro w hw; exact hw.2.2) rw [hz] at hcell exact (lt_irrefl 0 hcell).elim | false => rw [full_cellProb_false, full_arrived_false] rw [full_cellProb_false] at hcell have hx : 0 < zengCategory P x := by nlinarith have hb := hP.2.2.2 x hx have hprop : propensity P x = zengArm P x true / zengCategory P x := by simp [propensity, hx] rw [hprop] cases a with | false => simp only [bitMass, Bool.false_eq_true, if_false] have hdiv : q ≤ 1 - zengArm P x true / zengCategory P x := by have hu : zengArm P x true / zengCategory P x ≤ 1 - q := (div_le_iff₀ hx).2 (by simpa [mul_comm] using hb.2) linarith simpa [mul_comm, mul_left_comm, mul_assoc] using mul_le_mul_of_nonneg_left hdiv (le_of_lt hcell) | true => simp only [bitMass, Bool.true_eq, if_true] have hdiv : q ≤ zengArm P x true / zengCategory P x := (le_div_iff₀ hx).2 (by simpa [mul_comm] using hb.1) simpa [mul_comm, mul_left_comm, mul_assoc] using mul_le_mul_of_nonneg_left hdiv (le_of_lt hcell)
CausalSmith.Stat.MarRareqLogfrontier.SyntheticCompletion.fullLaw_arrival · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/SyntheticCompletion.lean:568
theorem full_cellContribution_false

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
q :
ℝ
P :
hP :
a :
x :
Fin d
cellContribution (fullLaw P) (a, x, false)
= (1 / 2 : ℝ) * zengCategory P x * (if a then outcomeMean P x true else outcomeMean P x false)
Proof (Lean source)
lemma full_cellContribution_false {d : ℕ} {q : ℝ} (P : ZengLaw d) (hP : P ∈ zengDiscreteClass d q) (a : Bool) (x : Fin d) : cellContribution (fullLaw P) (a, x, false) = (1 / 2 : ℝ) * zengCategory P x * (if a then outcomeMean P x true else outcomeMean P x false) := by by_cases hx : 0 < zengCategory P x · have harr : 0 < arrivedCell (fullLaw P) (a, x, false) := by rw [full_arrived_false] have hb := hP.2.2.2 x hx have hq := hP.1 have hbit : 0 < bitMass (propensity P x) a := by rw [show propensity P x = zengArm P x true / zengCategory P x by simp [propensity, hx]] cases a with | false => simp only [bitMass, Bool.false_eq_true, if_false] have hu : zengArm P x true / zengCategory P x < 1 := by apply (div_lt_one hx).2 nlinarith [hb.2] linarith | true => simp only [bitMass, Bool.true_eq, if_true] exact div_pos (lt_of_lt_of_le (mul_pos hq hx) hb.1) hx positivity unfold cellContribution cellMean rw [if_pos harr, if_pos harr, full_cellProb_false] change (1 / 2 : ℝ) * zengCategory P x * ((fullMeasure P).real {r | inCell r (a, x, false) ∧ r.R = true ∧ r.Y = true} / arrivedCell (fullLaw P) (a, x, false)) = _ rw [full_joint_mass_real, full_arrived_false] have hmass : (1 / 2 : ℝ) * zengCategory P x * bitMass (propensity P x) a ≠ 0 := by rw [← full_arrived_false] exact ne_of_gt harr have hcatne : zengCategory P x ≠ 0 := ne_of_gt hx have hbitne : bitMass (propensity P x) a ≠ 0 := by intro hz apply hmass rw [hz] ring cases a <;> simp [bitMass] at hbitne ⊢ <;> field_simp [hcatne, hbitne] <;> simp · have hx0 : zengCategory P x = 0 := le_antisymm (le_of_not_gt hx) measureReal_nonneg have harr : arrivedCell (fullLaw P) (a, x, false) = 0 := by rw [full_arrived_false, hx0] ring simp [cellContribution, harr, hx0]
CausalSmith.Stat.MarRareqLogfrontier.SyntheticCompletion.full_cellContribution_false · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/SyntheticCompletion.lean:605
theorem full_cellContribution_true

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
P :
a :
x :
Fin d
cellContribution (fullLaw P) (a, x, true) = 0
Proof (Lean source)
lemma full_cellContribution_true {d : ℕ} (P : ZengLaw d) (a : Bool) (x : Fin d) : cellContribution (fullLaw P) (a, x, true) = 0 := by have harr : arrivedCell (fullLaw P) (a, x, true) = 0 := by unfold arrivedCell change (fullMeasure P).real {w | inCell w (a, x, true) ∧ w.R = true} = 0 exact fullMeasure_real_of_surrogate_true P _ (by simp) (by intro w hw; exact hw.1.2.2) simp [cellContribution, harr]
CausalSmith.Stat.MarRareqLogfrontier.SyntheticCompletion.full_cellContribution_true · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/SyntheticCompletion.lean:656
theorem fullLaw_ate

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
hn :
1 ≤ n
hq :
0 < q
hqhalf :
q < 1 / 2
P :
hP :
ate (fullLaw P) = zengATE P
Proof (Lean source)
lemma fullLaw_ate {n d : ℕ} {q : ℝ} (hn : 1 ≤ n) (hq : 0 < q) (hqhalf : q < 1 / 2) (P : ZengLaw d) (hP : P ∈ zengDiscreteClass d q) : ate (fullLaw P) = zengATE P := by have hmodel : UnrestrictedArrivalModelClass n d q (fullLaw P) := { n_pos := hn d_pos := hP.2.2.1 q_pos := hq q_le_one := by linarith randomized := fullLaw_randomized P balanced := fullLaw_balanced P surrogate := fullLaw_surrogate P outcome := fullLaw_outcome P mar := fullLaw_mar P arrival := fullLaw_arrival P hP } rw [unrestricted_cell_identification (fullLaw P) hmodel] unfold cellFunctional zengATE simp only [Fintype.sum_prod_type, Fintype.sum_bool, full_cellContribution_false P hP, full_cellContribution_true P, armSign, Bool.false_eq_true, if_true, if_false, zero_mul, mul_zero, add_zero, zero_add, one_mul, neg_one_mul] rw [← Finset.sum_add_distrib, Finset.mul_sum] apply Finset.sum_congr rfl intro x hxmem by_cases hx : 0 < zengCategory P x · rw [dif_pos hx, outcomeMean_eq_zengMean P hP x hx false, outcomeMean_eq_zengMean P hP x hx true] ring · have hx0 : zengCategory P x = 0 := le_antisymm (le_of_not_gt hx) measureReal_nonneg simp [hx, hx0]
CausalSmith.Stat.MarRareqLogfrontier.SyntheticCompletion.fullLaw_ate · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/SyntheticCompletion.lean:666
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.SyntheticKernel 16 declarations Law-independent fair-coin completion of a discrete observational record.

Law-independent fair-coin completion of a discrete observational record.

def syntheticRecord

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
d :
ℕ
r :
u :
syntheticRecord r u :
⟨r.1, u, false, r.2.1 == u, (r.2.1 == u) && r.2.2⟩
CausalSmith.Stat.MarRareqLogfrontier.syntheticRecord · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/SyntheticKernel.lean:16
def syntheticOneRecord

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
d :
ℕ
r :
syntheticOneRecord r :
(1 / 2 : ℝ≥0∞) • Measure.dirac (syntheticRecord r false)
+ (1 / 2 : ℝ≥0∞) • Measure.dirac (syntheticRecord r true)
CausalSmith.Stat.MarRareqLogfrontier.syntheticOneRecord · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/SyntheticKernel.lean:20
theorem syntheticOneRecord_eq_coin_map Lemma syntheticOneRecord_eq_coin_map in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
r :
= Measure.map (syntheticRecord r) ((1 / 2 : ℝ≥0∞) • Measure.dirac false + (1 / 2 : ℝ≥0∞) • Measure.dirac true)
Proof (Lean source)
lemma syntheticOneRecord_eq_coin_map {d : ℕ} (r : ZengRecord d) : syntheticOneRecord r = Measure.map (syntheticRecord r) ((1 / 2 : ℝ≥0∞) • Measure.dirac false + (1 / 2 : ℝ≥0∞) • Measure.dirac true) := by rw [Measure.map_add _ _ (by fun_prop)] simp [syntheticOneRecord, Measure.map_smul]
CausalSmith.Stat.MarRareqLogfrontier.syntheticOneRecord_eq_coin_map · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/SyntheticKernel.lean:27
theorem observedLaw_eq_bind

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
q :
ℝ
P :
hP :
(fullMeasure P).map obs = P.1.bind (fun r : ZengRecord d => syntheticOneRecord r)
Proof (Lean source)
lemma SyntheticCompletion.observedLaw_eq_bind {d : ℕ} {q : ℝ} (P : ZengLaw d) (hP : P ∈ zengDiscreteClass d q) : (fullMeasure P).map obs = P.1.bind (fun r : ZengRecord d => syntheticOneRecord r) := by let L := (parameters P).fullLaw haveI : IsProbabilityMeasure L := (parameters P).fullLaw_probability have hobs (z : FullCoord (Fin d) × Bool) : obs (toFullRecord z) = syntheticRecord (selectMark z.1) z.2 := by rcases z with ⟨⟨x, b, y₀, y₁⟩, a⟩ cases a <;> cases b <;> cases y₀ <;> cases y₁ <;> rfl have hpair : (L.prod fairCoin).map (fun z : FullCoord (Fin d) × Bool => (selectMark z.1, z.2)) = P.1.prod fairCoin := by change Measure.map (map selectMark id) (L.prod fairCoin) = _ rw [← Measure.map_prod_map (f := selectMark) (g := id) L fairCoin (by fun_prop) measurable_id] rw [(parameters P).selectMark_map, selected_eq P hP] simp calc (fullMeasure P).map obs = (L.prod fairCoin).map (fun z => syntheticRecord (selectMark z.1) z.2) := by rw [fullMeasure, Measure.map_map (by fun_prop) (by fun_prop)] congr 1 funext z exact hobs z _ = (P.1.prod fairCoin).map (fun z => syntheticRecord z.1 z.2) := by rw [← hpair, Measure.map_map (by fun_prop) (by fun_prop)] rfl _ = P.1.bind (fun r => fairCoin.map (syntheticRecord r)) := by exact (bind_map_eq_prod_map P.1 fairCoin syntheticRecord (by fun_prop)).symm _ = P.1.bind (fun r : ZengRecord d => syntheticOneRecord r) := by apply Measure.bind_congr_right filter_upwards [] with r simpa [fairCoin] using (syntheticOneRecord_eq_coin_map r).symm
CausalSmith.Stat.MarRareqLogfrontier.SyntheticCompletion.observedLaw_eq_bind · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/SyntheticKernel.lean:36
def syntheticProductLaw

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
n d :
ℕ
s :
Fin n → ZengRecord d
syntheticProductLaw s :
Measure.pi (fun i => syntheticOneRecord (s i))
CausalSmith.Stat.MarRareqLogfrontier.syntheticProductLaw · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/SyntheticKernel.lean:74
theorem syntheticProductLaw_eq_coin_map Lemma syntheticProductLaw_eq_coin_map in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
s :
Fin n → ZengRecord d
= Measure.map (fun u : Fin n → Bool => fun i => syntheticRecord (s i) (u i)) (Measure.pi (fun _ : Fin n => (1 / 2 : ℝ≥0∞) • Measure.dirac false + (1 / 2 : ℝ≥0∞) • Measure.dirac true))
Proof (Lean source)
lemma syntheticProductLaw_eq_coin_map {n d : ℕ} (s : Fin n → ZengRecord d) : syntheticProductLaw s = Measure.map (fun u : Fin n → Bool => fun i => syntheticRecord (s i) (u i)) (Measure.pi (fun _ : Fin n => (1 / 2 : ℝ≥0∞) • Measure.dirac false + (1 / 2 : ℝ≥0∞) • Measure.dirac true)) := by let coin : Measure Bool := (1 / 2 : ℝ≥0∞) • Measure.dirac false + (1 / 2 : ℝ≥0∞) • Measure.dirac true haveI : IsProbabilityMeasure coin := by refine ⟨?_⟩ simp [coin, ENNReal.inv_two_add_inv_two] letI (i : Fin n) : IsProbabilityMeasure (coin.map (syntheticRecord (s i))) := Measure.isProbabilityMeasure_map (by fun_prop) change syntheticProductLaw s = (Measure.pi (fun _ : Fin n => coin)).map (fun u i => syntheticRecord (s i) (u i)) rw [Measure.pi_map_pi (fun i => by fun_prop)] unfold syntheticProductLaw congr 1 funext i exact syntheticOneRecord_eq_coin_map (s i)
CausalSmith.Stat.MarRareqLogfrontier.syntheticProductLaw_eq_coin_map · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/SyntheticKernel.lean:80
theorem syntheticSample_bind_eq_pi

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
P :
= Measure.pi (fun _ : Fin n => P.1.bind syntheticOneRecord)
Proof (Lean source)
lemma syntheticSample_bind_eq_pi {n d : ℕ} (P : ZengLaw d) : (zengSampleLaw n P).bind syntheticProductLaw = Measure.pi (fun _ : Fin n => P.1.bind syntheticOneRecord) := by let coinPi := Measure.pi (fun _ : Fin n => SyntheticCompletion.fairCoin) haveI : IsProbabilityMeasure P.1 := P.2 haveI : IsProbabilityMeasure coinPi := by dsimp [coinPi] infer_instance have hkernel : syntheticProductLaw = fun s : Fin n → ZengRecord d => coinPi.map (fun u i => syntheticRecord (s i) (u i)) := by funext s simpa [coinPi, SyntheticCompletion.fairCoin] using syntheticProductLaw_eq_coin_map s rw [hkernel] rw [SyntheticCompletion.bind_map_eq_prod_map _ _ _ (measurable_of_finite _)] let e := MeasurableEquiv.arrowProdEquivProdArrow (ZengRecord d) Bool (Fin n) have hpair : ((zengSampleLaw n P).prod coinPi).map e.symm = Measure.pi (fun _ : Fin n => P.1.prod SyntheticCompletion.fairCoin) := by exact (measurePreserving_arrowProdEquivProdArrow (ZengRecord d) Bool (Fin n) (fun _ => P.1) (fun _ => SyntheticCompletion.fairCoin)).symm.map_eq calc ((zengSampleLaw n P).prod coinPi).map (fun z i => syntheticRecord (z.1 i) (z.2 i)) = (((zengSampleLaw n P).prod coinPi).map e.symm).map (fun w i => syntheticRecord (w i).1 (w i).2) := by rw [Measure.map_map (by fun_prop) e.symm.measurable] rfl _ = (Measure.pi (fun _ : Fin n => P.1.prod SyntheticCompletion.fairCoin)).map (fun w i => syntheticRecord (w i).1 (w i).2) := by rw [hpair] _ = Measure.pi (fun _ : Fin n => (P.1.prod SyntheticCompletion.fairCoin).map (fun z => syntheticRecord z.1 z.2)) := by exact Measure.pi_map_pi (μ := fun _ : Fin n => P.1.prod SyntheticCompletion.fairCoin) (f := fun _ z => syntheticRecord z.1 z.2) (fun _ => (measurable_of_finite _).aemeasurable) _ = Measure.pi (fun _ : Fin n => P.1.bind syntheticOneRecord) := by congr 1 funext i rw [← SyntheticCompletion.bind_map_eq_prod_map P.1 SyntheticCompletion.fairCoin syntheticRecord (measurable_of_finite _)] apply Measure.bind_congr_right filter_upwards [] with r simpa [SyntheticCompletion.fairCoin] using (syntheticOneRecord_eq_coin_map r).symm
CausalSmith.Stat.MarRareqLogfrontier.syntheticSample_bind_eq_pi · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/SyntheticKernel.lean:105
theorem syntheticOneRecord_probability Lemma syntheticOneRecord_probability in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
r :
Proof (Lean source)
lemma syntheticOneRecord_probability {d : ℕ} (r : ZengRecord d) : IsProbabilityMeasure (syntheticOneRecord r) := by refine ⟨?_⟩ simp [syntheticOneRecord] exact ENNReal.inv_two_add_inv_two
CausalSmith.Stat.MarRareqLogfrontier.syntheticOneRecord_probability · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/SyntheticKernel.lean:157
theorem syntheticProductLaw_probability Lemma syntheticProductLaw_probability in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
s :
Fin n → ZengRecord d
Proof (Lean source)
CausalSmith.Stat.MarRareqLogfrontier.syntheticProductLaw_probability · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/SyntheticKernel.lean:165
def syntheticProductKernel

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
n d :
ℕ
syntheticProductKernel n d :
Kernel (Fin n → ZengRecord d) (Fin n → ObsRecord d)
Kernel.ofFunOfCountable syntheticProductLaw
CausalSmith.Stat.MarRareqLogfrontier.syntheticProductKernel · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/SyntheticKernel.lean:174
instance syntheticProductKernel_isMarkovKernel

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
CausalSmith.Stat.MarRareqLogfrontier.syntheticProductKernel_isMarkovKernel · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/SyntheticKernel.lean:180

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
n d :
ℕ
T :
syntheticPullbackEstimator T :
by let K := syntheticProductKernel n d letI : IsMarkovKernel T.toBoundedKernel.1 := T.toBoundedKernel.2.1 refine ⟨T.toBoundedKernel.1 ∘ₖ K, inferInstance, ?_⟩ intro s rw [Kernel.comp_apply' _ _ _ (by simp)] simp only [T.toBoundedKernel.2.2] simp
CausalSmith.Stat.MarRareqLogfrontier.syntheticPullbackEstimator · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/SyntheticKernel.lean:186

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
n d :
ℕ
ε :
ℝ
s :
Fin n → ZengRecord d
thetaPoly n d ε s :
ℝ
(∑ u : Fin n → Bool, mixedCountEstimator n d ε (fun i => syntheticRecord (s i) (u i))) / (2 : ℝ) ^ n
theorem sampleLaw_iid

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n :
ℕ
d :
ℕ
P :
IIDSampling n (sampleLaw n P) (fun (i : Fin n) (s : Fin n → ObsRecord d) => s i) P
Proof (Lean source)
lemma sampleLaw_iid (n : ℕ) {d : ℕ} (P : FullLaw d) : IIDSampling n (sampleLaw n P) (fun (i : Fin n) (s : Fin n → ObsRecord d) => s i) P := by let μ : Measure (ObsRecord d) := P.1.map obs letI : IsProbabilityMeasure P.1 := P.2 letI : IsProbabilityMeasure μ := Measure.isProbabilityMeasure_map (by fun_prop : AEMeasurable obs P.1) refine ⟨?_, ?_, ?_⟩ · intro i fun_prop · simpa [sampleLaw, μ] using (iIndepFun_pi (μ := fun _ : Fin n => μ) (X := fun _ : Fin n => id) (by intro i; fun_prop)) · intro i simpa [sampleLaw, μ] using (measurePreserving_eval (fun _ : Fin n => μ) i).map_eq
theorem synthetic_randomization_kernel

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
hn :
1 ≤ n
hq :
0 < q
hqhalf :
q < 1 / 2
P :
hP :
∃ Pstar : FullLaw d,
conclusion 1
conclusion 2
IIDSampling n (sampleLaw n Pstar) (fun (i : Fin n) (s : Fin n → ObsRecord d) => s i) Pstar
conclusion 3
(zengSampleLaw n P).bind syntheticProductLaw = sampleLaw n Pstar
conclusion 4
ate Pstar = zengATE P
Proof (Lean source)
lemma synthetic_randomization_kernel {n d : ℕ} {q : ℝ} (hn : 1 ≤ n) (hq : 0 < q) (hqhalf : q < 1 / 2) (P : ZengLaw d) (hP : P ∈ zengDiscreteClass d q) : ∃ Pstar : FullLaw d, UnrestrictedArrivalModelClass n d q Pstar ∧ IIDSampling n (sampleLaw n Pstar) (fun (i : Fin n) (s : Fin n → ObsRecord d) => s i) Pstar ∧ (zengSampleLaw n P).bind syntheticProductLaw = sampleLaw n Pstar ∧ ate Pstar = zengATE P := by refine ⟨SyntheticCompletion.fullLaw P, ?_, sampleLaw_iid n _, ?_, ?_⟩ · exact { n_pos := hn d_pos := hP.2.2.1 q_pos := hq q_le_one := by linarith randomized := SyntheticCompletion.fullLaw_randomized P balanced := SyntheticCompletion.fullLaw_balanced P surrogate := SyntheticCompletion.fullLaw_surrogate P outcome := SyntheticCompletion.fullLaw_outcome P mar := SyntheticCompletion.fullLaw_mar P arrival := SyntheticCompletion.fullLaw_arrival P hP } · rw [sampleLaw, syntheticSample_bind_eq_pi] congr 1 funext i exact (SyntheticCompletion.observedLaw_eq_bind P hP).symm · exact SyntheticCompletion.fullLaw_ate hn hq hqhalf P hP
CausalSmith.Stat.MarRareqLogfrontier.synthetic_randomization_kernel · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/SyntheticKernel.lean:224
theorem syntheticPullbackEstimator_risk_eq

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
T :
P :
Pstar :
hsample :
(zengSampleLaw n P).bind syntheticProductLaw = sampleLaw n Pstar
htarget :
ate Pstar = zengATE P
zengSquaredRisk (syntheticPullbackEstimator T) P = squaredRisk T Pstar
Proof (Lean source)
lemma syntheticPullbackEstimator_risk_eq {n d : ℕ} (T : Estimator n d) (P : ZengLaw d) (Pstar : FullLaw d) (hsample : (zengSampleLaw n P).bind syntheticProductLaw = sampleLaw n Pstar) (htarget : ate Pstar = zengATE P) : zengSquaredRisk (syntheticPullbackEstimator T) P = squaredRisk T Pstar := by letI : IsProbabilityMeasure Pstar.1 := Pstar.2 letI : IsProbabilityMeasure (Pstar.1.map obs) := Measure.isProbabilityMeasure_map (by fun_prop) letI : IsProbabilityMeasure (sampleLaw n Pstar) := by unfold sampleLaw infer_instance have hF : Integrable (fun s : Fin n → ObsRecord d => ∫ t, (t - ate Pstar) ^ 2 ∂T.toBoundedKernel.1 s) (sampleLaw n Pstar) := Integrable.of_finite unfold zengSquaredRisk squaredRisk rw [← htarget] rw [← hsample] have hmeas : Measurable (syntheticProductLaw (n := n) (d := d)) := (syntheticProductKernel n d).measurable have hFbind : Integrable (fun s : Fin n → ObsRecord d => ∫ t, (t - ate Pstar) ^ 2 ∂T.toBoundedKernel.1 s) ((zengSampleLaw n P).bind syntheticProductLaw) := by rw [hsample] exact hF rw [integral_bind hmeas hFbind] congr 1 funext s letI : IsMarkovKernel T.toBoundedKernel.1 := T.toBoundedKernel.2.1 letI : IsProbabilityMeasure (syntheticProductLaw s) := syntheticProductLaw_probability s letI : IsProbabilityMeasure (T.toBoundedKernel.1 ∘ₘ syntheticProductLaw s) := by infer_instance have hsupp : (T.toBoundedKernel.1 ∘ₘ syntheticProductLaw s) (Icc (-1 : ℝ) 1) = 1 := by rw [Measure.bind_apply measurableSet_Icc T.toBoundedKernel.1.measurable.aemeasurable] simp only [T.toBoundedKernel.2.2] simp have hlossInt : Integrable (fun t : ℝ => (t - ate Pstar) ^ 2) (T.toBoundedKernel.1 ∘ₘ syntheticProductLaw s) := by refine (integrable_const ((1 + |ate Pstar|) ^ 2)).mono' ((measurable_id.sub measurable_const).pow_const 2).aestronglyMeasurable ?_ filter_upwards [(mem_ae_iff_prob_eq_one measurableSet_Icc).2 hsupp] with t ht rcases ht with ⟨htlo, hthi⟩ have htAbs : |t| ≤ 1 := abs_le.mpr ⟨htlo, hthi⟩ rw [Real.norm_eq_abs, abs_of_nonneg (sq_nonneg _), sq_le_sq] have hnonneg : 0 ≤ (1 : ℝ) + |ate Pstar| := by positivity rw [abs_of_nonneg hnonneg] calc |t - ate Pstar| ≤ |t| + |ate Pstar| := abs_sub _ _ _ ≤ 1 + |ate Pstar| := add_le_add_left htAbs _ simpa [syntheticPullbackEstimator, syntheticProductKernel, Kernel.comp_apply, Kernel.ofFunOfCountable] using (ProbabilityTheory.Kernel.integral_comp (κ := Kernel.ofFunOfCountable syntheticProductLaw) (η := T.toBoundedKernel.1) (a := s) (f := fun t : ℝ => (t - ate Pstar) ^ 2) hlossInt)
CausalSmith.Stat.MarRareqLogfrontier.syntheticPullbackEstimator_risk_eq · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/SyntheticKernel.lean:253
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.ZengLower.BoundedRisk 12 declarations Bounded randomized decision class for the fixed-positivity comparison.

Bounded randomized decision class for the fixed-positivity comparison.

def ZengEstimator

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
n d :
ℕ
ZengEstimator n d :
Type
{T : Kernel (Fin n → ZengRecord d) ℝ // IsMarkovKernel T ∧ ∀ s, T s (Icc (-1 : ℝ) 1) = 1}
def zengSampleLaw

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
d :
ℕ
n :
ℕ
P :
zengSampleLaw n P :
Measure.pi (fun _ : Fin n => P.1)
def zengSquaredRisk

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
n d :
ℕ
T :
P :
zengSquaredRisk T P :
ℝ
∫ s, (∫ t, (t - zengATE P) ^ 2 ∂(T.1 s)) ∂(zengSampleLaw n P)

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
n d :
ℕ
f :
(Fin n → ZengRecord d) → ℝ
P :
zengDeterministicRisk f P :
ℝ
∫ s, (f s - zengATE P) ^ 2 ∂(zengSampleLaw n P)
CausalSmith.Stat.MarRareqLogfrontier.zengDeterministicRisk · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/ZengLower/BoundedRisk.lean:32

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
n d :
ℕ
fixedQRate n d :
ℝ
min 1 ((n : ℝ)⁻¹ + ((d : ℝ) / ((n : ℝ) * log (exp 1 + n))) ^ 2)
def zengZeroControlClass

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
d :
ℕ
ε :
ℝ
zengZeroControlClass d ε :
{P | P ∈ zengDiscreteClass d ε ∧ ∀ x : Fin d, ∀ h : 0 < zengCategory P x, zengMean P x false h = 0}
CausalSmith.Stat.MarRareqLogfrontier.zengZeroControlClass · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/ZengLower/BoundedRisk.lean:42
def zengZeroControlRisk

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
n d :
ℕ
ε :
ℝ
zengZeroControlRisk n d ε :
ℝ
minimaxValueReal (E := ZengEstimator n d) (Θ := {P : ZengLaw d // P ∈ zengZeroControlClass d ε}) (fun T P => zengSquaredRisk T P.1)
CausalSmith.Stat.MarRareqLogfrontier.zengZeroControlRisk · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/ZengLower/BoundedRisk.lean:47
def zengMinimaxRisk

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
n d :
ℕ
ε :
ℝ
zengMinimaxRisk n d ε :
ℝ
minimaxValueReal (E := ZengEstimator n d) (Θ := {P : ZengLaw d // P ∈ zengDiscreteClass d ε}) (fun T P => zengSquaredRisk T P.1)
theorem zeng_category_sum

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
P :
∑ x : Fin d, zengCategory P x = 1
Proof (Lean source)
lemma zeng_category_sum {d : ℕ} (P : ZengLaw d) : ∑ x : Fin d, zengCategory P x = 1 := by letI : IsProbabilityMeasure P.1 := P.2 have h := MeasureTheory.sum_measureReal_preimage_singleton (μ := P.1) (s := univ) (f := fun r : ZengRecord d => r.1) (by intro x hx; exact MeasurableSet.of_discrete) calc ∑ x : Fin d, zengCategory P x = ∑ x : Fin d, P.1.real ((fun r : ZengRecord d => r.1) ⁻¹' {x}) := by congr 1 _ = 1 := by simpa using h
theorem zeng_mean_mem_Icc

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
P :
x :
Fin d
b :
h :
0 < zengCategory P x
zengMean P x b h ∈ Icc (0 : ℝ) 1
Proof (Lean source)
lemma zeng_mean_mem_Icc {d : ℕ} (P : ZengLaw d) (x : Fin d) (b : Bool) (h : 0 < zengCategory P x) : zengMean P x b h ∈ Icc (0 : ℝ) 1 := by letI : IsProbabilityMeasure P.1 := P.2 have hnum : 0 ≤ P.1.real {r | r.1 = x ∧ r.2.1 = b ∧ r.2.2 = true} := measureReal_nonneg have hle : P.1.real {r | r.1 = x ∧ r.2.1 = b ∧ r.2.2 = true} ≤ zengArm P x b := by apply measureReal_mono (by intro r hr exact ⟨hr.1, hr.2.1⟩) (by finiteness) have hden : 0 ≤ zengArm P x b := measureReal_nonneg rcases hden.eq_or_lt with hzero | hpos · have hnumzero := le_antisymm (hzero ▸ hle) hnum simp [zengMean, ← hzero, hnumzero, Set.mem_Icc] · simp only [zengMean, Set.mem_Icc] constructor · exact div_nonneg hnum (le_of_lt hpos) · exact (div_le_iff₀ hpos).mpr (by simpa using hle)
theorem zeng_ate_mem_Icc

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
P :
zengATE P ∈ Icc (-1 : ℝ) 1
Proof (Lean source)
lemma zeng_ate_mem_Icc {d : ℕ} (P : ZengLaw d) : zengATE P ∈ Icc (-1 : ℝ) 1 := by letI : IsProbabilityMeasure P.1 := P.2 have hterm (x : Fin d) : -zengCategory P x ≤ (if h : 0 < zengCategory P x then zengCategory P x * (zengMean P x true h - zengMean P x false h) else 0) ∧ (if h : 0 < zengCategory P x then zengCategory P x * (zengMean P x true h - zengMean P x false h) else 0) ≤ zengCategory P x := by by_cases hx : 0 < zengCategory P x · simp only [dif_pos hx] have htrue := zeng_mean_mem_Icc P x true hx have hfalse := zeng_mean_mem_Icc P x false hx rw [Set.mem_Icc] at htrue hfalse constructor · have hd : -1 ≤ zengMean P x true hx - zengMean P x false hx := by linarith [htrue.1, hfalse.2] calc -zengCategory P x = zengCategory P x * (-1) := by ring _ ≤ _ := mul_le_mul_of_nonneg_left hd (le_of_lt hx) · have hd : zengMean P x true hx - zengMean P x false hx ≤ 1 := by linarith [htrue.2, hfalse.1] calc _ ≤ zengCategory P x * 1 := mul_le_mul_of_nonneg_left hd (le_of_lt hx) _ = zengCategory P x := by ring · simp only [dif_neg hx] have hc : 0 ≤ zengCategory P x := measureReal_nonneg constructor <;> linarith have hsum := zeng_category_sum P rw [Set.mem_Icc] constructor · calc (-1 : ℝ) = ∑ x : Fin d, -zengCategory P x := by simp [Finset.sum_neg_distrib, hsum] _ ≤ zengATE P := by simp only [zengATE] exact Finset.sum_le_sum (fun x _ => (hterm x).1) · calc zengATE P ≤ ∑ x : Fin d, zengCategory P x := by simp only [zengATE] exact Finset.sum_le_sum (fun x _ => (hterm x).2) _ = 1 := hsum
theorem zeng_squaredRisk_bounds

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
ε :
ℝ
T :
P :
hP :
conclusion 1
0 ≤ zengSquaredRisk T P
conclusion 2
zengSquaredRisk T P ≤ 4
Proof (Lean source)
lemma zeng_squaredRisk_bounds {n d : ℕ} (ε : ℝ) (T : ZengEstimator n d) (P : ZengLaw d) (hP : P ∈ zengDiscreteClass d ε) : 0 ≤ zengSquaredRisk T P ∧ zengSquaredRisk T P ≤ 4 := by letI : IsProbabilityMeasure P.1 := P.2 letI : IsMarkovKernel T.1 := T.2.1 have hATE := zeng_ate_mem_Icc P rw [Set.mem_Icc] at hATE have hinner_nonneg (s : Fin n → ZengRecord d) : 0 ≤ ∫ t, (t - zengATE P) ^ 2 ∂(T.1 s) := by exact integral_nonneg (fun t => sq_nonneg _) have hinner_le (s : Fin n → ZengRecord d) : (∫ t, (t - zengATE P) ^ 2 ∂(T.1 s)) ≤ 4 := by haveI : IsProbabilityMeasure (T.1 s) := inferInstance have hs : ∀ᵐ t ∂(T.1 s), t ∈ Icc (-1 : ℝ) 1 := (mem_ae_iff_prob_eq_one measurableSet_Icc).mpr (T.2.2 s) have hb : ∀ᵐ t ∂(T.1 s), (t - zengATE P) ^ 2 ≤ 4 := by filter_upwards [hs] with t ht rw [Set.mem_Icc] at ht nlinarith [sq_nonneg (t - zengATE P + 2), sq_nonneg (t - zengATE P - 2)] simpa using (integral_mono_of_nonneg (μ := T.1 s) (Filter.Eventually.of_forall (fun t => sq_nonneg (t - zengATE P))) (integrable_const 4) hb) haveI : IsProbabilityMeasure (zengSampleLaw n P) := by unfold zengSampleLaw infer_instance constructor · exact integral_nonneg hinner_nonneg · simpa [zengSquaredRisk] using (integral_mono_of_nonneg (μ := zengSampleLaw n P) (Filter.Eventually.of_forall hinner_nonneg) (integrable_const 4) (Filter.Eventually.of_forall hinner_le))
CausalSmith.Stat.MarRareqLogfrontier.zeng_squaredRisk_bounds · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/ZengLower/BoundedRisk.lean:143
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.ZengLower.Concentration 1 declarations Chebyshev concentration and conditioning for iid relaxed rare-cell priors.

Chebyshev concentration and conditioning for iid relaxed rare-cell priors.

def iidRareGood

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
d :
ℕ
massRadius targetRadius :
ℝ
z :
iidRareGood ν massRadius targetRadius z :
Prop
clause 1
|(∑ x, (z x).1) - d * ∫ t, t.1 ∂ν| < massRadius
clause 2
|(∑ x, targetFunctional (z x)) - d * ∫ t, targetFunctional t ∂ν| < targetRadius
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.ZengLower.ConditionedPredictiveTV 2 declarations Total-variation cost of conditioning the relaxed iid prior.

Total-variation cost of conditioning the relaxed iid prior.

def relaxedCountKernel

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
d :
ℕ
a0 :
ℝ
lam :
ℝ≥0
relaxedCountKernel d a0 lam :
Kernel (Fin d → MarkedParam) (((ℕ × ℕ) × ℕ) × (Fin d → ((ℕ × ℕ) × ℕ)))
(Kernel.const (Fin d → MarkedParam) (relaxedDummyCountLaw d a0 lam)).prod (coordinatewiseFiniteKernel (markedPoissonKernel (lam : ℝ)) d)
instance relaxedCountKernel_isMarkov

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
noncomputable instance relaxedCountKernel_isMarkov (d : ℕ) (a0 : ℝ) (lam : ℝ≥0) : IsMarkovKernel (relaxedCountKernel d a0 lam) := by unfold relaxedCountKernel infer_instance
CausalSmith.Stat.MarRareqLogfrontier.relaxedCountKernel_isMarkov · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/ZengLower/ConditionedPredictiveTV.lean:53
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.ZengLower.DimensionPadding 13 declarations Zero-mass padding for the finite Zeng experiment.

Zero-mass padding for the finite Zeng experiment.

def padZengRecord

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
r d :
ℕ
h :
r ≤ d
z :
padZengRecord h z :
(castLE h z.1, z.2.1, z.2.2)
def padZengLaw

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
r d :
ℕ
h :
r ≤ d
P :
padZengLaw h P :
⟨P.1.map (padZengRecord h), by letI : IsProbabilityMeasure P.1 := P.2 exact Measure.isProbabilityMeasure_map (measurable_of_finite _).aemeasurable⟩
theorem padZengLaw_category_castLE

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
r d :
ℕ
h :
r ≤ d
P :
x :
Fin r
Proof (Lean source)
lemma padZengLaw_category_castLE {r d : ℕ} (h : r ≤ d) (P : ZengLaw r) (x : Fin r) : zengCategory (padZengLaw h P) (castLE h x) = zengCategory P x := by rw [zengCategory, zengCategory, Measure.real, padZengLaw, Measure.map_apply (measurable_of_finite _) MeasurableSet.of_discrete] apply congrArg toReal congr 1 ext z exact Fin.castLE_injective h |>.eq_iff
CausalSmith.Stat.MarRareqLogfrontier.padZengLaw_category_castLE · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/ZengLower/DimensionPadding.lean:23
theorem padZengLaw_arm_castLE

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
r d :
ℕ
h :
r ≤ d
P :
x :
Fin r
a :
zengArm (padZengLaw h P) (castLE h x) a = zengArm P x a
Proof (Lean source)
lemma padZengLaw_arm_castLE {r d : ℕ} (h : r ≤ d) (P : ZengLaw r) (x : Fin r) (a : Bool) : zengArm (padZengLaw h P) (castLE h x) a = zengArm P x a := by rw [zengArm, zengArm, Measure.real, padZengLaw, Measure.map_apply (measurable_of_finite _) MeasurableSet.of_discrete] apply congrArg toReal congr 1 ext z simp [padZengRecord, Fin.castLE_injective h |>.eq_iff]
theorem padZengLaw_success_castLE

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
r d :
ℕ
h :
r ≤ d
P :
x :
Fin r
a :
(padZengLaw h P).1.real {z | z.1 = castLE h x ∧ z.2.1 = a ∧ z.2.2 = true}
= P.1.real {z | z.1 = x ∧ z.2.1 = a ∧ z.2.2 = true}
Proof (Lean source)
lemma padZengLaw_success_castLE {r d : ℕ} (h : r ≤ d) (P : ZengLaw r) (x : Fin r) (a : Bool) : (padZengLaw h P).1.real {z | z.1 = castLE h x ∧ z.2.1 = a ∧ z.2.2 = true} = P.1.real {z | z.1 = x ∧ z.2.1 = a ∧ z.2.2 = true} := by rw [Measure.real, padZengLaw, Measure.map_apply (measurable_of_finite _) MeasurableSet.of_discrete] apply congrArg toReal congr 1 ext z simp [padZengRecord, Fin.castLE_injective h |>.eq_iff]
CausalSmith.Stat.MarRareqLogfrontier.padZengLaw_success_castLE · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/ZengLower/DimensionPadding.lean:45
theorem padZengLaw_category_new

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
r d :
ℕ
h :
r ≤ d
P :
x :
Fin d
hx :
r ≤ x
Proof (Lean source)
lemma padZengLaw_category_new {r d : ℕ} (h : r ≤ d) (P : ZengLaw r) (x : Fin d) (hx : r ≤ x) : zengCategory (padZengLaw h P) x = 0 := by rw [zengCategory, Measure.real, padZengLaw, Measure.map_apply (measurable_of_finite _) MeasurableSet.of_discrete] have hpre : padZengRecord h ⁻¹' {z : ZengRecord d | z.1 = x} = ∅ := by ext z constructor · intro hz have hv := congrArg (fun w : Fin d => (w : ℕ)) hz simp [padZengRecord] at hv omega · simp rw [hpre] simp
CausalSmith.Stat.MarRareqLogfrontier.padZengLaw_category_new · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/ZengLower/DimensionPadding.lean:58
theorem padZengLaw_mem_class

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
r d :
ℕ
q :
ℝ
h :
r ≤ d
P :
hP :
Proof (Lean source)
lemma padZengLaw_mem_class {r d : ℕ} {q : ℝ} (h : r ≤ d) (P : ZengLaw r) (hP : P ∈ zengDiscreteClass r q) : padZengLaw h P ∈ zengDiscreteClass d q := by refine ⟨hP.1, hP.2.1, hP.2.2.1.trans h, ?_⟩ intro x hx by_cases hxold : (x : ℕ) < r · let x₀ : Fin r := ⟨x, hxold⟩ have he : castLE h x₀ = x := Fin.ext (by rfl) rw [← he, padZengLaw_category_castLE] at hx rw [← he, padZengLaw_category_castLE, padZengLaw_arm_castLE] exact hP.2.2.2 x₀ hx · rw [padZengLaw_category_new h P x (Nat.le_of_not_gt hxold)] at hx linarith
theorem padZengLaw_ate

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
r d :
ℕ
h :
r ≤ d
P :
Proof (Lean source)
lemma padZengLaw_ate {r d : ℕ} (h : r ≤ d) (P : ZengLaw r) : zengATE (padZengLaw h P) = zengATE P := by unfold zengATE rw [← sum_fin_pad h (fun x => if hx : 0 < zengCategory P x then zengCategory P x * (zengMean P x true hx - zengMean P x false hx) else 0)] apply Fintype.sum_congr intro x by_cases hxold : (x : ℕ) < r · let x₀ : Fin r := ⟨x, hxold⟩ have he : castLE h x₀ = x := Fin.ext (by rfl) simp only [hxold, dite_true] have hterm : (if hp : 0 < zengCategory (padZengLaw h P) (castLE h x₀) then zengCategory (padZengLaw h P) (castLE h x₀) * (zengMean (padZengLaw h P) (castLE h x₀) true hp - zengMean (padZengLaw h P) (castLE h x₀) false hp) else 0) = if hp : 0 < zengCategory P x₀ then zengCategory P x₀ * (zengMean P x₀ true hp - zengMean P x₀ false hp) else 0 := by by_cases hp : 0 < zengCategory P x₀ · have hppad : 0 < zengCategory (padZengLaw h P) (castLE h x₀) := by rwa [padZengLaw_category_castLE] rw [dif_pos hp, dif_pos hppad, padZengLaw_category_castLE] unfold zengMean rw [padZengLaw_arm_castLE, padZengLaw_arm_castLE, padZengLaw_success_castLE, padZengLaw_success_castLE] · have hppad : ¬0 < zengCategory (padZengLaw h P) (castLE h x₀) := by rwa [padZengLaw_category_castLE] rw [dif_neg hp, dif_neg hppad] simpa only [he] using hterm · simp only [hxold, dite_false] have hz := padZengLaw_category_new h P x (Nat.le_of_not_gt hxold) rw [dif_neg (by rw [hz]; linarith)]
def padZengSample

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
n r d :
ℕ
h :
r ≤ d
s :
Fin n → ZengRecord r
padZengSample h s :
Fin n → ZengRecord d
fun i => padZengRecord h (s i)
theorem padZengLaw_sample_map

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n r d :
ℕ
h :
r ≤ d
P :
Proof (Lean source)
lemma padZengLaw_sample_map {n r d : ℕ} (h : r ≤ d) (P : ZengLaw r) : (zengSampleLaw n P).map (padZengSample h) = zengSampleLaw n (padZengLaw h P) := by unfold zengSampleLaw padZengSample letI : IsProbabilityMeasure P.1 := P.2 letI : IsProbabilityMeasure ((padZengLaw h P).1) := (padZengLaw h P).2 rw [Measure.pi_map_pi (fun _ => (measurable_of_finite _).aemeasurable)] congr 1
def pullbackZengEstimator

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
n r d :
ℕ
h :
r ≤ d
T :
pullbackZengEstimator h T :
by letI : IsMarkovKernel T.1 := T.2.1 let K := T.1.comap (padZengSample h) (measurable_of_finite _) have hK : IsMarkovKernel K := Kernel.IsMarkovKernel.comap T.1 (measurable_of_finite _) refine ⟨K, hK, ?_⟩ intro s rw [Kernel.comap_apply] exact T.2.2 _
theorem zengSquaredRisk_pullback_padding

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n r d :
ℕ
h :
r ≤ d
T :
P :
Proof (Lean source)
lemma zengSquaredRisk_pullback_padding {n r d : ℕ} (h : r ≤ d) (T : ZengEstimator n d) (P : ZengLaw r) : zengSquaredRisk (pullbackZengEstimator h T) P = zengSquaredRisk T (padZengLaw h P) := by unfold zengSquaredRisk rw [padZengLaw_ate] let g : (Fin n → ZengRecord d) → ℝ := fun s => ∫ t, (t - zengATE P) ^ 2 ∂(T.1 s) have hg : Measurable g := by fun_prop have hi := MeasureTheory.integral_map (μ := zengSampleLaw n P) (measurable_of_finite (padZengSample h)).aemeasurable hg.aestronglyMeasurable rw [padZengLaw_sample_map h P] at hi simpa [g, pullbackZengEstimator, Kernel.comap_apply] using hi.symm
CausalSmith.Stat.MarRareqLogfrontier.zengSquaredRisk_pullback_padding · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/ZengLower/DimensionPadding.lean:165
theorem zengMinimaxRisk_mono_dimension

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n r d :
ℕ
hr :
1 ≤ r
h :
r ≤ d
q :
ℝ
Proof (Lean source)
lemma zengMinimaxRisk_mono_dimension {n r d : ℕ} (hr : 1 ≤ r) (h : r ≤ d) (q : ℝ) : zengMinimaxRisk n r q ≤ zengMinimaxRisk n d q := by let T₀ : ZengEstimator n d := ⟨Kernel.const _ (Measure.dirac 0), inferInstance, by intro s; simp [Kernel.const_apply]⟩ letI : Nonempty (ZengEstimator n d) := ⟨T₀⟩ unfold zengMinimaxRisk apply minimaxValue_le_minimaxValue (bddBelow_range_worstCaseRisk fun _ _ => by unfold zengSquaredRisk positivity) intro T refine ⟨pullbackZengEstimator h T, ?_⟩ change worstCaseRiskReal (fun (_ : Unit) (P : {P : ZengLaw r // P ∈ zengDiscreteClass r q}) => zengSquaredRisk (pullbackZengEstimator h T) P.1) () ≤ worstCaseRiskReal (fun (_ : Unit) (P : {P : ZengLaw d // P ∈ zengDiscreteClass d q}) => zengSquaredRisk T P.1) () apply worstCaseRisk_mono_class_of_nonneg (fun P : {P : ZengLaw r // P ∈ zengDiscreteClass r q} => ⟨padZengLaw h P.1, padZengLaw_mem_class h P.1 P.2⟩) · refine ⟨4, ?_⟩ rintro y ⟨Q, rfl⟩ exact (zeng_squaredRisk_bounds q T Q.1 Q.2).2 · intro Q exact (zeng_squaredRisk_bounds q T Q.1 Q.2).1 · rintro ⟨P, hP⟩ exact (zengSquaredRisk_pullback_padding h T P).le
CausalSmith.Stat.MarRareqLogfrontier.zengMinimaxRisk_mono_dimension · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/ZengLower/DimensionPadding.lean:183
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.ZengLower.Experiment 3 declarations Finite zero-control observational laws for the cited fixed-positivity experiment.

Finite zero-control observational laws for the cited fixed-positivity experiment.

def zengBernWeight

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
p :
ℝ
b :
zengBernWeight p b :
ℝ
if b then p else 1 - p
def zengFiniteTable

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
d :
ℕ
p π μ :
Fin d → ℝ
zengFiniteTable d p π μ :
∑ x : Fin d, ∑ b : Bool, ∑ y : Bool, ofReal (p x * zengBernWeight (π x) b * (if b then zengBernWeight (μ x) y else if y then 0 else 1)) • Measure.dirac (x, b, y)
theorem zeng_finiteTable_zero_control

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
ε :
ℝ
hd :
1 ≤ d
hε :
0 < ε ∧ ε < 1 / 2
p π μ :
Fin d → ℝ
hp :
∀ x, 0 ≤ p x
hsum :
∑ x : Fin d, p x = 1
hπ :
∀ x
if
0 < p x
then
ε ≤ π x ∧ π x ≤ 1 - ε
hμ :
∀ x, 0 ≤ μ x ∧ μ x ≤ 1
∃ P : ZengLaw d,
conclusion 1
P.1 = zengFiniteTable d p π μ
conclusion 2
conclusion 3
zengATE P = ∑ x : Fin d, p x * μ x
Proof (Lean source)
lemma zeng_finiteTable_zero_control (d : ℕ) (ε : ℝ) (hd : 1 ≤ d) (hε : 0 < ε ∧ ε < 1 / 2) (p π μ : Fin d → ℝ) (hp : ∀ x, 0 ≤ p x) (hsum : ∑ x : Fin d, p x = 1) (hπ : ∀ x, 0 < p x → ε ≤ π x ∧ π x ≤ 1 - ε) (hμ : ∀ x, 0 ≤ μ x ∧ μ x ≤ 1) : ∃ P : ZengLaw d, P.1 = zengFiniteTable d p π μ ∧ P ∈ zengZeroControlClass d ε ∧ zengATE P = ∑ x : Fin d, p x * μ x := by have hπ01 (x : Fin d) (hx : 0 < p x) : 0 ≤ π x ∧ π x ≤ 1 := by constructor · exact le_trans (le_of_lt hε.1) (hπ x hx).1 · exact le_trans (hπ x hx).2 (by linarith [hε.1]) let M := zengFiniteTable d p π μ have hM_univ : M univ = 1 := by rw [zengFiniteTable_univ d p π μ hp hπ01 hμ, hsum] norm_num let P : ZengLaw d := ⟨M, ⟨hM_univ⟩⟩ have hcat (x : Fin d) : zengCategory P x = p x := by exact zengFiniteTable_category_real d p π μ hp hπ01 hμ x have harm_true (x : Fin d) : zengArm P x true = p x * π x := by exact zengFiniteTable_true_arm_real d p π μ hp (fun x hx => (hπ01 x hx).1) hμ x have hnum_true (x : Fin d) : P.1.real {r | r.1 = x ∧ r.2.1 = true ∧ r.2.2 = true} = p x * π x * μ x := by exact zengFiniteTable_true_outcome_real d p π μ hp (fun x hx => (hπ01 x hx).1) (fun x => (hμ x).1) x have hnum_false (x : Fin d) : P.1.real {r | r.1 = x ∧ r.2.1 = false ∧ r.2.2 = true} = 0 := by exact zengFiniteTable_false_outcome_real d p π μ x have hmean_true (x : Fin d) (hx : 0 < zengCategory P x) : zengMean P x true hx = μ x := by have hpx : 0 < p x := by simpa [hcat x] using hx have hπx : 0 < π x := lt_of_lt_of_le hε.1 (hπ x hpx).1 rw [zengMean, hnum_true x, harm_true x] field_simp have hmean_false (x : Fin d) (hx : 0 < zengCategory P x) : zengMean P x false hx = 0 := by simp [zengMean, hnum_false x] refine ⟨P, rfl, ?_, ?_⟩ · constructor · refine ⟨hε.1, hε.2, hd, ?_⟩ intro x hx have hpx : 0 < p x := by simpa [hcat x] using hx rw [hcat x, harm_true x] constructor · simpa [mul_comm] using (mul_le_mul_of_nonneg_left (hπ x hpx).1 (hp x)) · simpa [mul_comm] using (mul_le_mul_of_nonneg_left (hπ x hpx).2 (hp x)) · intro x hx exact hmean_false x hx · unfold zengATE apply Finset.sum_congr rfl intro x hx by_cases hpx : 0 < p x · rw [dif_pos (by simpa [hcat x] using hpx)] simp only [hmean_true x, hmean_false x, sub_zero] rw [hcat x] · rw [dif_neg (by simpa [hcat x] using hpx)] have hpx0 : p x = 0 := le_antisymm (le_of_not_gt hpx) (hp x) simp [hpx0]
CausalSmith.Stat.MarRareqLogfrontier.zeng_finiteTable_zero_control · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/ZengLower/Experiment.lean:189
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.ZengLower.FixedPoissonBridge 1 declarations Exact prefix transfer and the remaining many-cell lower-bound obligation.

Exact prefix transfer and the remaining many-cell lower-bound obligation.

instance zengFiniteTable_isFiniteMeasure

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
noncomputable instance zengFiniteTable_isFiniteMeasure (d : ℕ) (p π μ : Fin d → ℝ) : IsFiniteMeasure (zengFiniteTable d p π μ) := by apply IsFiniteMeasure.mk simp [zengFiniteTable]
CausalSmith.Stat.MarRareqLogfrontier.zengFiniteTable_isFiniteMeasure · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/ZengLower/FixedPoissonBridge.lean:45
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.ZengLower.Main 1 declarations The cited fixed-positivity lower bound and its paper-local proof.

The cited fixed-positivity lower bound and its paper-local proof.

the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
ZengTheoremTwoLower :
Sort 0
∀ ε : ℝ,
0 < ε → ε < 1 / 2 → ∃ (cε c₀ : ℝ) (n₀ : ℕ), 0 < cε ∧ 0 < c₀ ∧ ∀ (n d : ℕ), n₀
≤ n → 1 ≤ d → (d : ℝ) ≤ c₀ * n * log n → cε * ((n : ℝ)⁻¹ + ((d : ℝ) / ((n : ℝ) * log n)) ^ 2) ≤ zengZeroControlRisk n d ε
CausalSmith.Stat.MarRareqLogfrontier.ZengTheoremTwoLower · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/ZengLower/Main.lean:13
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.ZengLower.ManyCellComposition 2 declarations Paper moment certificates composed with conditioned fuzzy testing.

Paper moment certificates composed with conditioned fuzzy testing.

def swap

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
ε c₁ c₂ c₄ :
ℝ
n d K :
ℕ
M :
ZengMomentPriorPair ε c₁ c₂ c₄ n d K
swap M :
ZengMomentPriorPair ε c₁ c₂ c₄ n d K
clause 1
prior0 := M.prior1
clause 2
prior1 := M.prior0
clause 3
probability0 := M.probability1
clause 4
probability1 := M.probability0
clause 5
degree_pos := M.degree_pos
clause 6
degree_calibration := M.degree_calibration
clause 7
finite_support := by obtain ⟨s0, s1, hs0, hs1, h0, h1⟩ := M.finite_support exact ⟨s1, s0, hs1, hs0, h1, h0⟩
clause 8
matched_moments := by intro i j k hijk exact (M.matched_moments i j k hijk).symm
clause 9
mean_p_eq := M.mean_p_eq.symm
clause 10
mean_p_le := by rw [← M.mean_p_eq] exact M.mean_p_le
clause 11
separated_pmu := by simpa [abs_sub_comm] using M.separated_pmu
theorem gap_or_swap_gap

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
ε c₁ c₂ c₄ :
ℝ
n d K :
ℕ
M :
ZengMomentPriorPair ε c₁ c₂ c₄ n d K
c₄ / ((n : ℝ) * log n)
≤ (∫ t, targetFunctional t ∂M.prior1)
- ∫ t, targetFunctional t ∂M.prior0 ∨ c₄ / ((n : ℝ) * log n)
≤ (∫ t, targetFunctional t ∂M.swap.prior1)
- ∫ t, targetFunctional t ∂M.swap.prior0
Proof (Lean source)
lemma ZengMomentPriorPair.gap_or_swap_gap {ε c₁ c₂ c₄ : ℝ} {n d K : ℕ} (M : ZengMomentPriorPair ε c₁ c₂ c₄ n d K) : c₄ / ((n : ℝ) * log n) ≤ (∫ t, targetFunctional t ∂M.prior1) - ∫ t, targetFunctional t ∂M.prior0 ∨ c₄ / ((n : ℝ) * log n) ≤ (∫ t, targetFunctional t ∂M.swap.prior1) - ∫ t, targetFunctional t ∂M.swap.prior0 := by let a := (∫ t, targetFunctional t ∂M.prior1) - ∫ t, targetFunctional t ∂M.prior0 have hsep : c₄ / ((n : ℝ) * log n) ≤ |a| := by simpa [a, targetFunctional] using M.separated_pmu by_cases ha : 0 ≤ a · left simpa [abs_of_nonneg ha, a] using hsep · right have hneg : a < 0 := lt_of_not_ge ha simpa [ZengMomentPriorPair.swap, a, abs_of_neg hneg] using hsep
CausalSmith.Stat.MarRareqLogfrontier.ZengMomentPriorPair.gap_or_swap_gap · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/ZengLower/ManyCellComposition.lean:42
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.ZengLower.MomentCertificate 1 declarations Quantitative reciprocal moment certificate required by the Zeng lower bound.

Quantitative reciprocal moment certificate required by the Zeng lower bound.

structure ZengMomentPriorPair

For the specified inputs and assumptions, the mathematical structure records the components specified by this declaration.

Definition (Lean source)
ε c₁ c₂ c₄ :
ℝ
n d K :
ℕ
prior0 :
Measure (ℝ × ℝ × ℝ)
prior1 :
Measure (ℝ × ℝ × ℝ)
probability0 :
probability1 :
degree_pos :
1 ≤ K
degree_calibration :
(K : ℝ) ≤ c₂ * log n ∧ c₂ * log n < (K : ℝ) + 1
finite_support :
∃ s0 s1 : Finset (ℝ × ℝ × ℝ),
prior0 (s0 : Set (ℝ × ℝ × ℝ)) = 1 ∧
prior1 (s1 : Set (ℝ × ℝ × ℝ)) = 1 ∧
(∀ z ∈ s0, 0 ≤ z.1 ∧ z.1 ≤ c₁ * log n / n ∧ ε ≤ z.2.1 ∧ z.2.1 ≤ 1 - ε ∧ 0 ≤ z.2.2 ∧ z.2.2 ≤ 1) ∧
(∀ z ∈ s1, 0 ≤ z.1 ∧ z.1 ≤ c₁ * log n / n ∧ ε ≤ z.2.1 ∧ z.2.1 ≤ 1 - ε ∧ 0 ≤ z.2.2 ∧ z.2.2 ≤ 1)
matched_moments :
∀ i j k : ℕ
if
i + j + k ≤ 3 * K
then
(∫ z, z.1 ^ i * (z.1 * z.2.1) ^ j * (z.1 * z.2.1 * z.2.2) ^ k ∂prior0)
= ∫ z, z.1 ^ i * (z.1 * z.2.1) ^ j * (z.1 * z.2.1 * z.2.2) ^ k ∂prior1
mean_p_eq :
(∫ z, z.1 ∂prior0) = ∫ z, z.1 ∂prior1
mean_p_le :
(∫ z, z.1 ∂prior0) ≤ ((d : ℝ))⁻¹
separated_pmu :
c₄ / ((n : ℝ) * log n) ≤ |(∫ z, z.1 * z.2.2 ∂prior1) - (∫ z, z.1 * z.2.2 ∂prior0)|
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.ZengLower.MomentCertificateProof 1 declarations
theorem exists_triplePriors

Given a paper-local moment-prior pair, a generic triple-prior certificate exists at the same scale and target gap.

Formal statement
ε c₁ c₂ c₄ :
ℝ
n d K :
ℕ
M :
ZengMomentPriorPair ε c₁ c₂ c₄ n d K
Nonempty (TriplePriors K (c₁ * log n / n) ε (c₄ / ((n : ℝ) * log n)))
Proof (Lean source)
theorem ZengMomentPriorPair.exists_triplePriors {ε c₁ c₂ c₄ : ℝ} {n d K : ℕ} (M : ZengMomentPriorPair ε c₁ c₂ c₄ n d K) : Nonempty (TriplePriors K (c₁ * log n / n) ε (c₄ / ((n : ℝ) * log n))) := by letI : IsProbabilityMeasure M.prior0 := M.probability0 letI : IsProbabilityMeasure M.prior1 := M.probability1 let B : Set MarkedParam := {z | 0 ≤ z.1 ∧ z.1 ≤ c₁ * log n / n ∧ ε ≤ z.2.1 ∧ z.2.1 ≤ 1 - ε ∧ 0 ≤ z.2.2 ∧ z.2.2 ≤ 1} obtain ⟨s0, s1, hs0, hs1, h0, h1⟩ := M.finite_support have hsup0 : M.prior0 B = 1 := by apply le_antisymm prob_le_one rw [← hs0] apply measure_mono intro z hz exact h0 z hz have hsup1 : M.prior1 B = 1 := by apply le_antisymm prob_le_one rw [← hs1] apply measure_mono intro z hz exact h1 z hz exact ⟨{ positive_degree := M.degree_pos ν₀ := M.prior0 ν₁ := M.prior1 probability₀ := M.probability0 probability₁ := M.probability1 finite₀ := ⟨s0, hs0⟩ finite₁ := ⟨s1, hs1⟩ supported₀ := hsup0 supported₁ := hsup1 mixed_match := by intro i j k hijk simpa [mixedMonomial] using M.matched_moments i j k hijk mean_p_match := M.mean_p_eq target_gap := by rw [abs_sub_comm] simpa [targetFunctional] using M.separated_pmu }⟩
CausalSmith.Stat.MarRareqLogfrontier.ZengMomentPriorPair.exists_triplePriors · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/ZengLower/MomentCertificateProof.lean:52
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.ZengLower.MomentGapCap 1 declarations
def weaken_separation

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
ε c₁ c₂ c₄ c₄' :
ℝ
n d K :
ℕ
M :
ZengMomentPriorPair ε c₁ c₂ c₄ n d K
hden :
0 ≤ (n : ℝ) * log n
hc₄' :
c₄' ≤ c₄
weaken_separation M hden hc₄' :
ZengMomentPriorPair ε c₁ c₂ c₄' n d K
by refine { M with separated_pmu := ?_ } exact (div_le_div_of_nonneg_right hc₄' hden).trans M.separated_pmu
CausalSmith.Stat.MarRareqLogfrontier.ZengMomentPriorPair.weaken_separation · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/ZengLower/MomentGapCap.lean:8
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.ZengLower.Parametric 20 declarations A two-point zero-control submodel for the parametric term.

A two-point zero-control submodel for the parametric term.

def zengOneCellMass

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
d :
ℕ
x₀ :
Fin d
x :
Fin d
zengOneCellMass x₀ x :
ℝ
if x = x₀ then 1 else 0
theorem zengOneCellMass_nonneg

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
x₀ x :
Fin d
0 ≤ zengOneCellMass x₀ x
Proof (Lean source)
lemma zengOneCellMass_nonneg {d : ℕ} (x₀ x : Fin d) : 0 ≤ zengOneCellMass x₀ x := by unfold zengOneCellMass split <;> norm_num
CausalSmith.Stat.MarRareqLogfrontier.zengOneCellMass_nonneg · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/ZengLower/Parametric.lean:19
theorem zengOneCellMass_sum

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
x₀ :
Fin d
∑ x : Fin d, zengOneCellMass x₀ x = 1
Proof (Lean source)
lemma zengOneCellMass_sum {d : ℕ} (x₀ : Fin d) : ∑ x : Fin d, zengOneCellMass x₀ x = 1 := by simp [zengOneCellMass]
CausalSmith.Stat.MarRareqLogfrontier.zengOneCellMass_sum · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/ZengLower/Parametric.lean:25
theorem zeng_parametric_exists

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
ε u :
ℝ
hd :
1 ≤ d
hε :
0 < ε ∧ ε < 1 / 2
hu :
0 ≤ u ∧ u ≤ 1
∃ P : ZengLaw d,
conclusion 1
P.1 = zengFiniteTable d (zengOneCellMass ⟨0, hd⟩) (fun _ => 1 / 2) (fun _ => u)
conclusion 2
conclusion 3
zengATE P = u
Proof (Lean source)
lemma zeng_parametric_exists (d : ℕ) (ε u : ℝ) (hd : 1 ≤ d) (hε : 0 < ε ∧ ε < 1 / 2) (hu : 0 ≤ u ∧ u ≤ 1) : ∃ P : ZengLaw d, P.1 = zengFiniteTable d (zengOneCellMass ⟨0, hd⟩) (fun _ => 1 / 2) (fun _ => u) ∧ P ∈ zengZeroControlClass d ε ∧ zengATE P = u := by obtain ⟨P, hmeasure, hclass, hATE⟩ := zeng_finiteTable_zero_control d ε hd hε (zengOneCellMass ⟨0, hd⟩) (fun _ => 1 / 2) (fun _ => u) (zengOneCellMass_nonneg ⟨0, hd⟩) (zengOneCellMass_sum ⟨0, hd⟩) (by intro x hx; constructor <;> linarith [hε.2]) (fun _ => hu) refine ⟨P, hmeasure, hclass, ?_⟩ rw [hATE] simp [zengOneCellMass]
CausalSmith.Stat.MarRareqLogfrontier.zeng_parametric_exists · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/ZengLower/Parametric.lean:30
def zengParametricLaw

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
d :
ℕ
ε u :
ℝ
hd :
1 ≤ d
hε :
0 < ε ∧ ε < 1 / 2
hu :
0 ≤ u ∧ u ≤ 1
zengParametricLaw d ε u hd hε hu :
choose (zeng_parametric_exists d ε u hd hε hu)
theorem zengParametricLaw_measure

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
ε u :
ℝ
hd :
1 ≤ d
hε :
0 < ε ∧ ε < 1 / 2
hu :
0 ≤ u ∧ u ≤ 1
(zengParametricLaw d ε u hd hε hu).1
= zengFiniteTable d (zengOneCellMass ⟨0, hd⟩) (fun _ => 1 / 2) (fun _ => u)
Proof (Lean source)
lemma zengParametricLaw_measure (d : ℕ) (ε u : ℝ) (hd : 1 ≤ d) (hε : 0 < ε ∧ ε < 1 / 2) (hu : 0 ≤ u ∧ u ≤ 1) : (zengParametricLaw d ε u hd hε hu).1 = zengFiniteTable d (zengOneCellMass ⟨0, hd⟩) (fun _ => 1 / 2) (fun _ => u) := (Classical.choose_spec (zeng_parametric_exists d ε u hd hε hu)).1
CausalSmith.Stat.MarRareqLogfrontier.zengParametricLaw_measure · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/ZengLower/Parametric.lean:50
theorem zengParametricLaw_mem

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
ε u :
ℝ
hd :
1 ≤ d
hε :
0 < ε ∧ ε < 1 / 2
hu :
0 ≤ u ∧ u ≤ 1
zengParametricLaw d ε u hd hε hu ∈ zengZeroControlClass d ε
Proof (Lean source)
lemma zengParametricLaw_mem (d : ℕ) (ε u : ℝ) (hd : 1 ≤ d) (hε : 0 < ε ∧ ε < 1 / 2) (hu : 0 ≤ u ∧ u ≤ 1) : zengParametricLaw d ε u hd hε hu ∈ zengZeroControlClass d ε := by unfold zengParametricLaw exact (Classical.choose_spec (zeng_parametric_exists d ε u hd hε hu)).2.1
CausalSmith.Stat.MarRareqLogfrontier.zengParametricLaw_mem · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/ZengLower/Parametric.lean:58
theorem zengParametricLaw_ate

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
ε u :
ℝ
hd :
1 ≤ d
hε :
0 < ε ∧ ε < 1 / 2
hu :
0 ≤ u ∧ u ≤ 1
zengATE (zengParametricLaw d ε u hd hε hu) = u
Proof (Lean source)
lemma zengParametricLaw_ate (d : ℕ) (ε u : ℝ) (hd : 1 ≤ d) (hε : 0 < ε ∧ ε < 1 / 2) (hu : 0 ≤ u ∧ u ≤ 1) : zengATE (zengParametricLaw d ε u hd hε hu) = u := by unfold zengParametricLaw exact (Classical.choose_spec (zeng_parametric_exists d ε u hd hε hu)).2.2
CausalSmith.Stat.MarRareqLogfrontier.zengParametricLaw_ate · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/ZengLower/Parametric.lean:66
theorem zengParametricLaw_singleton

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
ε u :
ℝ
hd :
1 ≤ d
hε :
0 < ε ∧ ε < 1 / 2
hu :
0 ≤ u ∧ u ≤ 1
r :
(zengParametricLaw d ε u hd hε hu).1.real {r}
= if r.1 = (⟨0, hd⟩ : Fin d) then if r.2.1 then (if r.2.2 then u / 2 else (1 - u) / 2) else (if r.2.2 then 0 else 1 / 2) else 0
Proof (Lean source)
lemma zengParametricLaw_singleton (d : ℕ) (ε u : ℝ) (hd : 1 ≤ d) (hε : 0 < ε ∧ ε < 1 / 2) (hu : 0 ≤ u ∧ u ≤ 1) (r : ZengRecord d) : (zengParametricLaw d ε u hd hε hu).1.real {r} = if r.1 = (⟨0, hd⟩ : Fin d) then if r.2.1 then (if r.2.2 then u / 2 else (1 - u) / 2) else (if r.2.2 then 0 else 1 / 2) else 0 := by rcases r with ⟨x, b, y⟩ rw [zengParametricLaw_measure] simp [zengFiniteTable, Measure.real, indicator, zengOneCellMass] rw [Finset.sum_eq_single x] · cases b · cases y · by_cases hx : x = (⟨0, hd⟩ : Fin d) · simp [hx, zengBernWeight] norm_num [ENNReal.toReal_ofReal] · simp [hx] · norm_num [zengBernWeight, ENNReal.toReal_ofReal] · cases y · by_cases hx : x = (⟨0, hd⟩ : Fin d) · have hnon : 0 ≤ 1 - u := sub_nonneg.mpr hu.2 simp [hx, zengBernWeight, ENNReal.toReal_ofReal hnon] ring · simp [hx] · by_cases hx : x = (⟨0, hd⟩ : Fin d) · simp [hx, zengBernWeight, ENNReal.toReal_ofReal hu.1] ring · simp [hx] · intro x' hx hne simp [hne] · simp
CausalSmith.Stat.MarRareqLogfrontier.zengParametricLaw_singleton · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/ZengLower/Parametric.lean:74
theorem zengParametricLaw_ac_half

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
ε u :
ℝ
hd :
1 ≤ d
hε :
0 < ε ∧ ε < 1 / 2
hu :
0 ≤ u ∧ u ≤ 1
(zengParametricLaw d ε u hd hε hu).1 ≪ (zengParametricLaw d ε (1 / 2) hd hε (by norm_num)).1
Proof (Lean source)
lemma zengParametricLaw_ac_half (d : ℕ) (ε u : ℝ) (hd : 1 ≤ d) (hε : 0 < ε ∧ ε < 1 / 2) (hu : 0 ≤ u ∧ u ≤ 1) : (zengParametricLaw d ε u hd hε hu).1 ≪ (zengParametricLaw d ε (1 / 2) hd hε (by norm_num)).1 := by intro s hzero rw [zengParametricLaw_measure] at hzero ⊢ simp [zengFiniteTable, zengOneCellMass, zengBernWeight] at hzero ⊢ intro i by_cases hi : i = (⟨0, hd⟩ : Fin d) · subst i have hsupport := hzero (⟨0, hd⟩ : Fin d) norm_num at hsupport simp [hsupport] · simp [hi]
CausalSmith.Stat.MarRareqLogfrontier.zengParametricLaw_ac_half · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/ZengLower/Parametric.lean:108
theorem zengParametricLaw_chiSq_half

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
ε u :
ℝ
hd :
1 ≤ d
hε :
0 < ε ∧ ε < 1 / 2
hu :
0 ≤ u ∧ u ≤ 1
1
+ chiSqDiv (zengParametricLaw d ε u hd hε hu).1 (zengParametricLaw d ε (1 / 2) hd hε (by norm_num)).1
= 1 + 2 * (u - 1 / 2) ^ 2
Proof (Lean source)
lemma zengParametricLaw_chiSq_half (d : ℕ) (ε u : ℝ) (hd : 1 ≤ d) (hε : 0 < ε ∧ ε < 1 / 2) (hu : 0 ≤ u ∧ u ≤ 1) : 1 + chiSqDiv (zengParametricLaw d ε u hd hε hu).1 (zengParametricLaw d ε (1 / 2) hd hε (by norm_num)).1 = 1 + 2 * (u - 1 / 2) ^ 2 := by let P₁ := zengParametricLaw d ε u hd hε hu let P₀ := zengParametricLaw d ε (1 / 2) hd hε (by norm_num) letI : IsProbabilityMeasure P₁.1 := P₁.2 letI : IsProbabilityMeasure P₀.1 := P₀.2 change 1 + chiSqDiv P₁.1 P₀.1 = _ rw [finite_one_add_chiSqDiv _ _ (zengParametricLaw_ac_half d ε u hd hε hu)] simp_rw [zengParametricLaw_singleton] simp only [Fintype.sum_prod_type] simp rw [Finset.sum_eq_single (⟨0, hd⟩ : Fin d)] · norm_num ring · intro x hx hne simp [hne] · simp
CausalSmith.Stat.MarRareqLogfrontier.zengParametricLaw_chiSq_half · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/ZengLower/Parametric.lean:124
def zengParametricStep

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
n :
ℕ
zengParametricStep n :
ℝ
1 / (4 * sqrt n)
theorem zengParametricStep_pos

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n :
ℕ
hn :
1 ≤ n
Proof (Lean source)
lemma zengParametricStep_pos (n : ℕ) (hn : 1 ≤ n) : 0 < zengParametricStep n := by unfold zengParametricStep positivity
CausalSmith.Stat.MarRareqLogfrontier.zengParametricStep_pos · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/ZengLower/Parametric.lean:152
theorem zengParametricStep_le_quarter

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n :
ℕ
hn :
1 ≤ n
zengParametricStep n ≤ 1 / 4
Proof (Lean source)
lemma zengParametricStep_le_quarter (n : ℕ) (hn : 1 ≤ n) : zengParametricStep n ≤ 1 / 4 := by have hnR : (1 : ℝ) ≤ n := by exact_mod_cast hn have hsqrt : (1 : ℝ) ≤ sqrt n := by rw [← Real.sqrt_one] exact Real.sqrt_le_sqrt hnR unfold zengParametricStep rw [div_le_iff₀ (by positivity : (0 : ℝ) < 4 * sqrt n)] nlinarith
CausalSmith.Stat.MarRareqLogfrontier.zengParametricStep_le_quarter · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/ZengLower/Parametric.lean:158
theorem zengParametricPerturbation_mem

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n :
ℕ
hn :
1 ≤ n
conclusion 1
0 ≤ (1 / 2 + zengParametricStep n)
conclusion 2
(1 / 2 + zengParametricStep n) ≤ 1
Proof (Lean source)
lemma zengParametricPerturbation_mem (n : ℕ) (hn : 1 ≤ n) : 0 ≤ (1 / 2 + zengParametricStep n) ∧ (1 / 2 + zengParametricStep n) ≤ 1 := by have hp := zengParametricStep_pos n hn have hq := zengParametricStep_le_quarter n hn constructor <;> linarith
CausalSmith.Stat.MarRareqLogfrontier.zengParametricPerturbation_mem · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/ZengLower/Parametric.lean:169
theorem zengParametricPerturbation_chiSq

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
ε :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hε :
0 < ε ∧ ε < 1 / 2
chiSqDiv (zengParametricLaw d ε (1 / 2 + zengParametricStep n) hd hε (zengParametricPerturbation_mem n hn)).1 (zengParametricLaw d ε (1 / 2) hd hε (by norm_num)).1
≤ (1 / 8 : ℝ) / n
Proof (Lean source)
lemma zengParametricPerturbation_chiSq (n d : ℕ) (ε : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hε : 0 < ε ∧ ε < 1 / 2) : chiSqDiv (zengParametricLaw d ε (1 / 2 + zengParametricStep n) hd hε (zengParametricPerturbation_mem n hn)).1 (zengParametricLaw d ε (1 / 2) hd hε (by norm_num)).1 ≤ (1 / 8 : ℝ) / n := by have hEq := zengParametricLaw_chiSq_half d ε (1 / 2 + zengParametricStep n) hd hε (zengParametricPerturbation_mem n hn) have hchi : chiSqDiv (zengParametricLaw d ε (1 / 2 + zengParametricStep n) hd hε (zengParametricPerturbation_mem n hn)).1 (zengParametricLaw d ε (1 / 2) hd hε (by norm_num)).1 = 2 * (zengParametricStep n) ^ 2 := by linarith rw [hchi] have hnR : (0 : ℝ) < n := by positivity have hsqrt : sqrt (n : ℝ) ≠ 0 := by positivity have hsqrt_sq : (sqrt (n : ℝ)) ^ 2 = n := by rw [Real.sq_sqrt (le_of_lt hnR)] unfold zengParametricStep rw [div_pow] field_simp nlinarith
CausalSmith.Stat.MarRareqLogfrontier.zengParametricPerturbation_chiSq · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/ZengLower/Parametric.lean:177
def ZengParametricDecisionReduction

the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
n d :
ℕ
ε c :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hε :
0 < ε ∧ ε < 1 / 2
0 < c
(∀ A : Set (Fin n → ZengRecord d), MeasurableSet A → (zengSampleLaw n (zengParametricLaw d ε (1 / 2 + zengParametricStep n) hd hε (zengParametricPerturbation_mem n hn))).real Aᶜ + (zengSampleLaw n (zengParametricLaw d ε (1 / 2) hd hε (by norm_num))).real A ≥ c)
T :
ZengParametricDecisionReduction :
Prop
c * (zengParametricStep n) ^ 2 / 8
≤ max (zengSquaredRisk T (zengParametricLaw d ε (1 / 2) hd hε (by norm_num))) (zengSquaredRisk T (zengParametricLaw d ε (1 / 2 + zengParametricStep n) hd hε (zengParametricPerturbation_mem n hn)))
CausalSmith.Stat.MarRareqLogfrontier.ZengParametricDecisionReduction · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/ZengLower/Parametric.lean:204
theorem zengParametricDecisionReduction_proved

the stated mathematical conclusion holds.

Formal statement
Proof (Lean source)
theorem zengParametricDecisionReduction_proved : ZengParametricDecisionReduction := by intro n d ε c hn hd hε hc htest T let P₀ := zengParametricLaw d ε (1 / 2) hd hε (by norm_num) let P₁ := zengParametricLaw d ε (1 / 2 + zengParametricStep n) hd hε (zengParametricPerturbation_mem n hn) let f := kernelMean T.1 zengClip let δ := zengParametricStep n let θ₀ : ℝ := 1 / 2 let θ₁ : ℝ := 1 / 2 + δ let E₀ : Set (Fin n → ZengRecord d) := {s | δ / 2 ≤ |f s - θ₀|} let E₁ : Set (Fin n → ZengRecord d) := {s | δ / 2 ≤ |f s - θ₁|} let A : Set (Fin n → ZengRecord d) := {s | |f s - θ₁| ≤ |f s - θ₀|} letI : IsMarkovKernel T.1 := T.2.1 letI : IsProbabilityMeasure P₀.1 := P₀.2 letI : IsProbabilityMeasure P₁.1 := P₁.2 letI : IsProbabilityMeasure (zengSampleLaw n P₀) := by unfold zengSampleLaw infer_instance letI : IsProbabilityMeasure (zengSampleLaw n P₁) := by unfold zengSampleLaw infer_instance have hδ : 0 < δ := zengParametricStep_pos n hn have hf : Measurable f := Causalean.Stat.measurable_kernelMean T.1 zengClip_measurable have hA : MeasurableSet A := by exact measurableSet_le (continuous_abs.measurable.comp (hf.sub measurable_const)) (continuous_abs.measurable.comp (hf.sub measurable_const)) have hA_E₀ : A ⊆ E₀ := by intro s hs simp only [A, E₀, Set.mem_setOf_eq] at hs ⊢ have htri : δ ≤ |f s - θ₀| + |f s - θ₁| := by have := abs_sub_le θ₁ (f s) θ₀ dsimp [θ₀, θ₁, δ] at this ⊢ norm_num at this rw [abs_of_pos (zengParametricStep_pos n hn)] at this simpa [abs_sub_comm, add_comm] using this linarith have hAc_E₁ : Aᶜ ⊆ E₁ := by intro s hs simp only [A, E₁, Set.mem_compl_iff, Set.mem_setOf_eq, not_le] at hs ⊢ have htri : δ ≤ |f s - θ₀| + |f s - θ₁| := by have := abs_sub_le θ₁ (f s) θ₀ dsimp [θ₀, θ₁, δ] at this ⊢ norm_num at this rw [abs_of_pos (zengParametricStep_pos n hn)] at this simpa [abs_sub_comm, add_comm] using this linarith have htest' : c ≤ (zengSampleLaw n P₁).real E₁ + (zengSampleLaw n P₀).real E₀ := by calc c ≤ (zengSampleLaw n P₁).real Aᶜ + (zengSampleLaw n P₀).real A := htest A hA _ ≤ _ := add_le_add (measureReal_mono hAc_E₁ (by finiteness)) (measureReal_mono hA_E₀ (by finiteness)) have hfbound : ∀ s, f s ∈ Icc (-1 : ℝ) 1 := by intro s rw [Set.mem_Icc, ← abs_le] exact abs_kernelMean_le T.1 (M := 1) zengClip_abs_le s have hint₀ : Integrable (fun s ↦ (f s - θ₀) ^ 2) (zengSampleLaw n P₀) := mse_integrable_of_estimator_bound _ f hf (by norm_num) hfbound have hint₁ : Integrable (fun s ↦ (f s - θ₁) ^ 2) (zengSampleLaw n P₁) := mse_integrable_of_estimator_bound _ f hf (by norm_num) hfbound have hmse₀ : (δ / 2) ^ 2 * (zengSampleLaw n P₀).real E₀ ≤ zengDeterministicRisk f P₀ := by unfold zengDeterministicRisk E₀ rw [zengParametricLaw_ate] have hset : {s | (δ / 2) ^ 2 ≤ (f s - θ₀) ^ 2} = {s | δ / 2 ≤ |f s - θ₀|} := by ext s simp only [Set.mem_setOf_eq] rw [sq_le_sq, abs_of_nonneg (show (0 : ℝ) ≤ δ / 2 by positivity)] rw [← hset] exact mul_meas_ge_le_integral_of_nonneg (Filter.Eventually.of_forall fun s ↦ sq_nonneg _) hint₀ _ have hmse₁ : (δ / 2) ^ 2 * (zengSampleLaw n P₁).real E₁ ≤ zengDeterministicRisk f P₁ := by unfold zengDeterministicRisk E₁ rw [zengParametricLaw_ate] have hset : {s | (δ / 2) ^ 2 ≤ (f s - θ₁) ^ 2} = {s | δ / 2 ≤ |f s - θ₁|} := by ext s simp only [Set.mem_setOf_eq] rw [sq_le_sq, abs_of_nonneg (show (0 : ℝ) ≤ δ / 2 by positivity)] rw [← hset] exact mul_meas_ge_le_integral_of_nonneg (Filter.Eventually.of_forall fun s ↦ sq_nonneg _) hint₁ _ have hmax : c / 2 ≤ max ((zengSampleLaw n P₀).real E₀) ((zengSampleLaw n P₁).real E₁) := by nlinarith [le_max_left ((zengSampleLaw n P₀).real E₀) ((zengSampleLaw n P₁).real E₁), le_max_right ((zengSampleLaw n P₀).real E₀) ((zengSampleLaw n P₁).real E₁)] calc c * δ ^ 2 / 8 ≤ (δ / 2) ^ 2 * max ((zengSampleLaw n P₀).real E₀) ((zengSampleLaw n P₁).real E₁) := by nlinarith [sq_nonneg δ] _ = max ((δ / 2) ^ 2 * (zengSampleLaw n P₀).real E₀) ((δ / 2) ^ 2 * (zengSampleLaw n P₁).real E₁) := by by_cases hle : (zengSampleLaw n P₀).real E₀ ≤ (zengSampleLaw n P₁).real E₁ · rw [max_eq_right hle, max_eq_right] exact mul_le_mul_of_nonneg_left hle (sq_nonneg _) · have hge := le_of_not_ge hle rw [max_eq_left hge, max_eq_left] exact mul_le_mul_of_nonneg_left hge (sq_nonneg _) _ ≤ max (zengDeterministicRisk f P₀) (zengDeterministicRisk f P₁) := max_le_max hmse₀ hmse₁ _ ≤ max (zengSquaredRisk T P₀) (zengSquaredRisk T P₁) := max_le_max (zeng_kernelMean_risk_le T P₀) (zeng_kernelMean_risk_le T P₁)
CausalSmith.Stat.MarRareqLogfrontier.zengParametricDecisionReduction_proved · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/ZengLower/Parametric.lean:286
theorem zeng_parametric_lower_of_decisionReduction

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
∃ c : ℝ,
0 < c
conclusion 1
n d :
ℕ
ε :
ℝ
1 ≤ n
1 ≤ d
0 < ε ∧ ε < 1 / 2
c / n ≤ zengZeroControlRisk n d ε
Proof (Lean source)
theorem zeng_parametric_lower_of_decisionReduction (hdecision : ZengParametricDecisionReduction) : ∃ c : ℝ, 0 < c ∧ ∀ (n d : ℕ) (ε : ℝ), 1 ≤ n → 1 ≤ d → 0 < ε ∧ ε < 1 / 2 → c / n ≤ zengZeroControlRisk n d ε := by obtain ⟨ctest, hctest, htest⟩ := Causalean.Stat.le_cam_two_point_chisq.2 (1 / 8) (by norm_num) refine ⟨ctest / 128, by positivity, ?_⟩ intro n d ε hn hd hε let P₁ := zengParametricLaw d ε (1 / 2 + zengParametricStep n) hd hε (zengParametricPerturbation_mem n hn) let P₀ := zengParametricLaw d ε (1 / 2) hd hε (by norm_num) letI : IsProbabilityMeasure P₁.1 := P₁.2 letI : IsProbabilityMeasure P₀.1 := P₀.2 have hfloor : ∀ A : Set (Fin n → ZengRecord d), MeasurableSet A → (zengSampleLaw n P₁).real Aᶜ + (zengSampleLaw n P₀).real A ≥ ctest := by intro A hA apply htest P₁.1 P₀.1 (zengParametricLaw_ac_half d ε (1 / 2 + zengParametricStep n) hd hε (zengParametricPerturbation_mem n hn)) (Integrable.of_finite) n (by omega) (zengParametricPerturbation_chiSq n d ε hn hd hε) A hA have htwo : ∀ T : ZengEstimator n d, ctest * (zengParametricStep n) ^ 2 / 8 ≤ max (zengSquaredRisk T P₀) (zengSquaredRisk T P₁) := by exact hdecision n d ε ctest hn hd hε hctest hfloor let θ₀ : {P : ZengLaw d // P ∈ zengZeroControlClass d ε} := ⟨P₀, zengParametricLaw_mem d ε (1 / 2) hd hε (by norm_num)⟩ let θ₁ : {P : ZengLaw d // P ∈ zengZeroControlClass d ε} := ⟨P₁, zengParametricLaw_mem d ε (1 / 2 + zengParametricStep n) hd hε (zengParametricPerturbation_mem n hn)⟩ let T₀ : ZengEstimator n d := ⟨Kernel.const _ (Measure.dirac 0), inferInstance, by intro s simp [Kernel.const_apply]⟩ letI : Nonempty (ZengEstimator n d) := ⟨T₀⟩ have hmini : ctest * (zengParametricStep n) ^ 2 / 8 ≤ zengZeroControlRisk n d ε := by apply le_minimaxValue_of_two_point θ₀ θ₁ · intro T refine ⟨4, ?_⟩ rintro r ⟨θ, rfl⟩ exact (zeng_squaredRisk_bounds ε T θ.1 θ.2.1).2 · intro T exact htwo T apply le_trans ?_ hmini have hnR : (0 : ℝ) < n := by positivity have hsqrt : sqrt (n : ℝ) ≠ 0 := by positivity have hsqrt_sq : (sqrt (n : ℝ)) ^ 2 = n := Real.sq_sqrt (le_of_lt hnR) unfold zengParametricStep rw [div_pow] field_simp nlinarith
CausalSmith.Stat.MarRareqLogfrontier.zeng_parametric_lower_of_decisionReduction · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/ZengLower/Parametric.lean:399
theorem zeng_parametric_lower

the stated mathematical conclusion holds.

Formal statement
∃ c : ℝ,
0 < c
conclusion 1
n d :
ℕ
ε :
ℝ
1 ≤ n
1 ≤ d
0 < ε ∧ ε < 1 / 2
c / n ≤ zengZeroControlRisk n d ε
Proof (Lean source)
theorem zeng_parametric_lower : ∃ c : ℝ, 0 < c ∧ ∀ (n d : ℕ) (ε : ℝ), 1 ≤ n → 1 ≤ d → 0 < ε ∧ ε < 1 / 2 → c / n ≤ zengZeroControlRisk n d ε := zeng_parametric_lower_of_decisionReduction zengParametricDecisionReduction_proved
CausalSmith.Stat.MarRareqLogfrontier.zeng_parametric_lower · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/ZengLower/Parametric.lean:458
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.ZengLower.PredictiveProductBridge 7 declarations Product-prior factorization for the current marked-Poisson experiment.

Product-prior factorization for the current marked-Poisson experiment.

def coordinatewiseFiniteKernel

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
K :
Kernel Θ X
d :
ℕ
coordinatewiseFiniteKernel K d :
Kernel (Fin d → Θ) (Fin d → X)
clause 1
| 0 => Kernel.const (Fin 0 → Θ) (Measure.dirac (fun i : Fin 0 => elim0 i))
clause 2
| d + 1
=> let lastK := K.comap (fun z : Fin (d + 1) → Θ => z (last d)) (measurable_pi_apply _) let initK := (coordinatewiseFiniteKernel K d).comap (fun z : Fin (d + 1) → Θ => Fin.init z) (by exact measurable_pi_iff.2 fun i => measurable_pi_apply i.castSucc) (lastK.prod initK).map (piFinSuccAbove (fun _ : Fin (d + 1) => X) (last d)).symm
instance coordinatewiseFiniteKernel_isMarkov

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
noncomputable instance coordinatewiseFiniteKernel_isMarkov {Θ X : Type*} [MeasurableSpace Θ] [MeasurableSpace X] (K : Kernel Θ X) [IsMarkovKernel K] (d : ℕ) : IsMarkovKernel (coordinatewiseFiniteKernel K d) := by induction d with | zero => unfold coordinatewiseFiniteKernel infer_instance | succ d ih => letI : IsMarkovKernel (coordinatewiseFiniteKernel K d) := ih unfold coordinatewiseFiniteKernel exact Kernel.IsMarkovKernel.map _ (piFinSuccAbove (fun _ : Fin (d + 1) => X) (last d)).symm.measurable
CausalSmith.Stat.MarRareqLogfrontier.coordinatewiseFiniteKernel_isMarkov · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/ZengLower/PredictiveProductBridge.lean:35
theorem measurable_poissonMeasure_rate_local

the stated mathematical conclusion holds.

Formal statement
Proof (Lean source)
lemma measurable_poissonMeasure_rate_local : Measurable (fun r : NNReal => poissonMeasure r) := by apply Measure.measurable_of_measurable_coe intro s hs simp only [poissonMeasure, Measure.sum_apply _ hs] apply Measurable.tsum intro k simp only [Measure.smul_apply, Measure.dirac_apply' _ hs, smul_eq_mul] fun_prop
CausalSmith.Stat.MarRareqLogfrontier.measurable_poissonMeasure_rate_local · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/ZengLower/PredictiveProductBridge.lean:56
theorem measurable_markedPoissonLaw_local

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n :
ℝ
Measurable (markedPoissonLaw n)
Proof (Lean source)
lemma measurable_markedPoissonLaw_local (n : ℝ) : Measurable (markedPoissonLaw n) := by have h₁ : Measurable (fun t : MarkedParam => (⟨poissonMeasure (nnRate (n * t.1 * t.2.1 * t.2.2)), inferInstance⟩ : ProbabilityMeasure ℕ)) := Measurable.subtype_mk (measurable_poissonMeasure_rate_local.comp (by unfold nnRate fun_prop)) have h₂ : Measurable (fun t : MarkedParam => (⟨poissonMeasure (nnRate (n * t.1 * t.2.1 * (1 - t.2.2))), inferInstance⟩ : ProbabilityMeasure ℕ)) := Measurable.subtype_mk (measurable_poissonMeasure_rate_local.comp (by unfold nnRate fun_prop)) have h₃ : Measurable (fun t : MarkedParam => (⟨poissonMeasure (nnRate (n * t.1 * (1 - t.2.1))), inferInstance⟩ : ProbabilityMeasure ℕ)) := Measurable.subtype_mk (measurable_poissonMeasure_rate_local.comp (by unfold nnRate fun_prop)) have h₁₂ : Measurable (fun t : MarkedParam => (⟨(poissonMeasure (nnRate (n * t.1 * t.2.1 * t.2.2))).prod (poissonMeasure (nnRate (n * t.1 * t.2.1 * (1 - t.2.2)))), inferInstance⟩ : ProbabilityMeasure (ℕ × ℕ))) := Measurable.subtype_mk (ProbabilityMeasure.measurable_fun_prod.comp (h₁.prodMk h₂)) exact ProbabilityMeasure.measurable_fun_prod.comp (h₁₂.prodMk h₃)
CausalSmith.Stat.MarRareqLogfrontier.measurable_markedPoissonLaw_local · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/ZengLower/PredictiveProductBridge.lean:67
def markedPoissonKernel

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
n :
ℝ
markedPoissonKernel n :
Kernel MarkedParam ((ℕ × ℕ) × ℕ)
clause 1
toFun := markedPoissonLaw n
clause 2
instance markedPoissonKernel_isMarkov

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
noncomputable instance markedPoissonKernel_isMarkov (n : ℝ) : IsMarkovKernel (markedPoissonKernel n) where isProbabilityMeasure t := by change IsProbabilityMeasure (markedPoissonLaw n t) unfold markedPoissonLaw infer_instance
CausalSmith.Stat.MarRareqLogfrontier.markedPoissonKernel_isMarkov · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/ZengLower/PredictiveProductBridge.lean:102
instance relaxedDummyCountLaw_isProbability

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
noncomputable instance relaxedDummyCountLaw_isProbability (d : ℕ) (a0 : ℝ) (lam : ℝ≥0) : IsProbabilityMeasure (relaxedDummyCountLaw d a0 lam) := by unfold relaxedDummyCountLaw infer_instance
CausalSmith.Stat.MarRareqLogfrontier.relaxedDummyCountLaw_isProbability · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/ZengLower/PredictiveProductBridge.lean:110
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.ZengLower.RelaxedExactTransfer 2 declarations Normalization and fixed-sample risk transfer for relaxed Zeng intensities.

Normalization and fixed-sample risk transfer for relaxed Zeng intensities.

def normalizedRelaxedZengLaw

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
d :
ℕ
a0 :
ℝ
z :
normalizedRelaxedZengLaw a0 z P₀ :
ZengLaw (d + 1)
⟨normalizedFiniteMeasure (relaxedZengTable d a0 z) P₀, inferInstance⟩
instance normalizedRelaxedZengLaw_isProbabilityMeasure

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
noncomputable instance normalizedRelaxedZengLaw_isProbabilityMeasure {d : ℕ} (a0 : ℝ) (z : Fin d → MarkedParam) (P₀ : Measure (RelaxedZengRecord d)) [IsProbabilityMeasure P₀] : IsProbabilityMeasure (normalizedRelaxedZengLaw a0 z P₀).1 := (normalizedRelaxedZengLaw a0 z P₀).2
CausalSmith.Stat.MarRareqLogfrontier.normalizedRelaxedZengLaw_isProbabilityMeasure · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/ZengLower/RelaxedExactTransfer.lean:26
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.ZengLower.RelaxedFuzzy 1 declarations Fuzzy testing lower bounds for conditioned iid relaxed rare-cell priors.

Fuzzy testing lower bounds for conditioned iid relaxed rare-cell priors.

def iidRareTargetSum

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
d :
ℕ
z :
iidRareTargetSum z :
ℝ
∑ x, targetFunctional (z x)
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.ZengLower.RelaxedPoissonBridge 2 declarations Finite-intensity Poisson representation of the relaxed Zeng table.

Finite-intensity Poisson representation of the relaxed Zeng table.

instance relaxedZengTable_isFiniteMeasure

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
noncomputable instance relaxedZengTable_isFiniteMeasure (d : ℕ) (a0 : ℝ) (z : Fin d → MarkedParam) : IsFiniteMeasure (relaxedZengTable d a0 z) := by apply IsFiniteMeasure.mk simp [relaxedZengTable]
CausalSmith.Stat.MarRareqLogfrontier.relaxedZengTable_isFiniteMeasure · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/ZengLower/RelaxedPoissonBridge.lean:19
def relaxedDummyCountLaw

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
d :
ℕ
a0 :
ℝ
lam :
ℝ≥0
relaxedDummyCountLaw d a0 lam :
Measure ((ℕ × ℕ) × ℕ)
((poissonMeasure 0).prod (poissonMeasure (lam * (ofReal ((1 - d * a0) / 2)).toNNReal))).prod (poissonMeasure (lam * (ofReal ((1 - d * a0) / 2)).toNNReal))
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.ZengLower.RelaxedPrefixReconstruction 8 declarations This module proves that ordering independent atomless marks and then reading a fixed prefix gives exactly the same observation law as reading the prefix of the uniformly ordered unmarked Poisson sample reconstructed from

Marked and unmarked prefix reconstruction

This module proves that ordering independent atomless marks and then reading a fixed prefix gives exactly the same observation law as reading the prefix of the uniformly ordered unmarked Poisson sample reconstructed from split counts.

def unmarkedPrefixObservations

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
X :
Type u_1
shared
x₀ :
X
n :
ℕ
s :
unmarkedPrefixObservations x₀ n s :
Fin n → X
if h : n ≤ s.count then fun k => s.points (castLE h k) else fun _ => x₀
theorem measurable_unmarkedPrefixObservations

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
X :
Type u_1
shared
x₀ :
X
n :
ℕ
Measurable (unmarkedPrefixObservations x₀ n : FiniteSample X → Fin n → X)
Proof (Lean source)
@[fun_prop] lemma measurable_unmarkedPrefixObservations (x₀ : X) (n : ℕ) : Measurable (unmarkedPrefixObservations x₀ n : FiniteSample X → Fin n → X) := by unfold unmarkedPrefixObservations apply measurable_pi_lambda intro k t ht rw [MeasurableSpace.measurableSet_iInf] intro m change MeasurableSet ((fun x : Fin m → X => (if h : n ≤ m then fun k => x (castLE h k) else fun _ => x₀) k) ⁻¹' t) by_cases h : n ≤ m · simp only [dif_pos h] exact ht.preimage (measurable_pi_apply (castLE h k)) · simp only [dif_neg h] exact measurable_const ht
CausalSmith.Stat.MarRareqLogfrontier.measurable_unmarkedPrefixObservations · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/ZengLower/RelaxedPrefixReconstruction.lean:31
def relaxedZengClip

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
t :
ℝ
relaxedZengClip t :
ℝ
max (-1) (min 1 t)
theorem measurable_relaxedZengClip

the stated mathematical conclusion holds.

Formal statement
Proof (Lean source)
@[fun_prop] lemma measurable_relaxedZengClip : Measurable relaxedZengClip := by unfold relaxedZengClip fun_prop
def unmarkedPrefixDecisionKernel

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
n d :
ℕ
T :
ZengEstimator n (d + 1)
unmarkedPrefixDecisionKernel T x₀ :
T.1 ∘ₖ Kernel.deterministic (unmarkedPrefixObservations x₀ n) (measurable_unmarkedPrefixObservations x₀ n)
instance unmarkedPrefixDecisionKernel_isMarkov

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
instance unmarkedPrefixDecisionKernel_isMarkov {n d : ℕ} (T : ZengEstimator n (d + 1)) (x₀ : RelaxedZengRecord d) : IsMarkovKernel (unmarkedPrefixDecisionKernel T x₀) := by letI : IsMarkovKernel T.1 := T.2.1 unfold unmarkedPrefixDecisionKernel infer_instance
CausalSmith.Stat.MarRareqLogfrontier.unmarkedPrefixDecisionKernel_isMarkov · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/ZengLower/RelaxedPrefixReconstruction.lean:160
def relaxedCountPrefixEstimator

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
n d :
ℕ
T :
ZengEstimator n (d + 1)
relaxedCountPrefixEstimator T x₀ :
(((ℕ × ℕ) × ℕ) × (Fin d → ((ℕ × ℕ) × ℕ))) → ℝ
theorem measurable_relaxedCountPrefixEstimator

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
T :
ZengEstimator n (d + 1)
Proof (Lean source)
CausalSmith.Stat.MarRareqLogfrontier.measurable_relaxedCountPrefixEstimator · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/ZengLower/RelaxedPrefixReconstruction.lean:176
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.ZengLower.RelaxedSplitReconstruction 5 declarations This module reconstructs the full relaxed histogram and then a uniformly ordered raw Poisson sample from the split dummy/rare three-count statistic.

Split-count sufficiency for the relaxed Zeng experiment

This module reconstructs the full relaxed histogram and then a uniformly ordered raw Poisson sample from the split dummy/rare three-count statistic. The reconstruction is parameter-free and remains exact when the dummy cell has both treated-failure and control-failure mass.

def unpackRelaxedThreeCounts

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
d :
ℕ
c :
Fin (d + 1) → ((ℕ × ℕ) × ℕ)
unpackRelaxedThreeCounts c :
clause 1
| (x, true, true) => (c x).1.1
clause 2
| (x, true, false) => (c x).1.2
clause 3
| (x, false, false) => (c x).2
clause 4
| (_x, false, true) => 0
def unsplitRelaxedCounts

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
d :
ℕ
c :
((ℕ × ℕ) × ℕ) × (Fin d → ((ℕ × ℕ) × ℕ))
unsplitRelaxedCounts c :
unpackRelaxedThreeCounts ((piFinSuccAbove (fun _ : Fin (d + 1) => ((ℕ × ℕ) × ℕ)) (last d)).symm c)
theorem measurable_unsplitRelaxedCounts

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
Proof (Lean source)
@[fun_prop] lemma measurable_unsplitRelaxedCounts {d : ℕ} : Measurable (unsplitRelaxedCounts (d := d)) := by fun_prop
CausalSmith.Stat.MarRareqLogfrontier.measurable_unsplitRelaxedCounts · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/ZengLower/RelaxedSplitReconstruction.lean:49
def relaxedSplitReconstructionKernel

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
d :
ℕ
relaxedSplitReconstructionKernel d :
Kernel (((ℕ × ℕ) × ℕ) × (Fin d → ((ℕ × ℕ) × ℕ))) (FiniteSample (RelaxedZengRecord d))
CausalSmith.Stat.MarRareqLogfrontier.relaxedSplitReconstructionKernel · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/ZengLower/RelaxedSplitReconstruction.lean:55
instance relaxedSplitReconstructionKernel_isMarkov

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
CausalSmith.Stat.MarRareqLogfrontier.relaxedSplitReconstructionKernel_isMarkov · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/ZengLower/RelaxedSplitReconstruction.lean:62
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.Helpers.ZengLower.RelaxedTable 3 declarations Relaxed finite-intensity tables for the many-cell lower bound.

Relaxed finite-intensity tables for the many-cell lower bound.

def RelaxedZengRecord

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
d :
ℕ
RelaxedZengRecord d :
Type
ZengRecord (d + 1)
def relaxedEmbedZengRecord

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
d :
ℕ
r :
relaxedEmbedZengRecord r :
(castSucc r.1, r.2)
CausalSmith.Stat.MarRareqLogfrontier.relaxedEmbedZengRecord · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/Helpers/ZengLower/RelaxedTable.lean:20
def relaxedZengTable

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
d :
ℕ
a0 :
ℝ
z :
relaxedZengTable d a0 z :
ofReal ((1 - d * a0) / 2) • Measure.dirac (last d, true, false)
+ ofReal ((1 - d * a0) / 2) • Measure.dirac (last d, false, false)
+ (zengFiniteTable d (fun x => (z x).1) (fun x => (z x).2.1) (fun x => (z x).2.2)).map relaxedEmbedZengRecord
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.PFixedDEffectiveSampleReduction 2 declarations PFixedDEffectiveSampleReduction for the finite rare-arrival experiment.

PFixedDEffectiveSampleReduction for the finite rare-arrival experiment.

theorem fixed_d_frontier_rate_theta

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
n :
ℕ → ℕ
q :
ℕ → ℝ
hn :
∀ t, 1 ≤ n t
hq :
∀ t, 0 < q t
hN :
Tendsto (fun t => effectiveSize (n t) (q t)) atTop atTop
(fun t => frontierRate (n t) d (q t)) =Θ[atTop] (fun t => (effectiveSize (n t) (q t))⁻¹)
Proof (Lean source)
lemma fixed_d_frontier_rate_theta (d : ℕ) (n : ℕ → ℕ) (q : ℕ → ℝ) (hn : ∀ t, 1 ≤ n t) (hq : ∀ t, 0 < q t) (hN : Tendsto (fun t => effectiveSize (n t) (q t)) atTop atTop) : (fun t => frontierRate (n t) d (q t)) =Θ[atTop] (fun t => (effectiveSize (n t) (q t))⁻¹) := by constructor · rw [Asymptotics.isBigO_iff] refine ⟨2, ?_⟩ filter_upwards [hN.eventually_ge_atTop (max 2 ((d : ℝ) ^ 2))] with t ht have hNpos : 0 < effectiveSize (n t) (q t) := by dsimp [effectiveSize] exact mul_pos (by exact_mod_cast hn t) (hq t) have hL : 1 ≤ logScale (n t) (q t) := by change 1 ≤ log (exp 1 + effectiveSize (n t) (q t)) rw [Real.le_log_iff_exp_le (by positivity)] linarith have hdN : (d : ℝ) ^ 2 ≤ effectiveSize (n t) (q t) := le_trans (le_max_right _ _) ht have hden : 0 < effectiveSize (n t) (q t) * logScale (n t) (q t) := mul_pos hNpos (by linarith) have hb : ((d : ℝ) / (effectiveSize (n t) (q t) * logScale (n t) (q t))) ^ 2 ≤ (effectiveSize (n t) (q t))⁻¹ := by rw [div_pow] apply (div_le_iff₀ (pow_pos hden 2)).2 have hL2 : 1 ≤ (logScale (n t) (q t)) ^ 2 := by nlinarith have heq : (effectiveSize (n t) (q t))⁻¹ * (effectiveSize (n t) (q t) * logScale (n t) (q t)) ^ 2 = effectiveSize (n t) (q t) * (logScale (n t) (q t)) ^ 2 := by field_simp [ne_of_gt hNpos] rw [heq] nlinarith [mul_nonneg (le_of_lt hNpos) (sub_nonneg.mpr hL2)] have ha : 0 ≤ (effectiveSize (n t) (q t))⁻¹ := inv_nonneg.mpr (le_of_lt hNpos) have hr : 0 ≤ frontierRate (n t) d (q t) := by unfold frontierRate exact le_min (by norm_num) (add_nonneg ha (sq_nonneg _)) rw [Real.norm_eq_abs, Real.norm_eq_abs, abs_of_nonneg hr, abs_of_nonneg ha] unfold frontierRate exact (min_le_right _ _).trans (by linarith) · rw [Asymptotics.isBigO_iff] refine ⟨1, ?_⟩ filter_upwards [hN.eventually_ge_atTop (max 2 ((d : ℝ) ^ 2))] with t ht have hNpos : 0 < effectiveSize (n t) (q t) := by dsimp [effectiveSize] exact mul_pos (by exact_mod_cast hn t) (hq t) have ha : 0 ≤ (effectiveSize (n t) (q t))⁻¹ := inv_nonneg.mpr (le_of_lt hNpos) have ha1 : (effectiveSize (n t) (q t))⁻¹ ≤ 1 := by apply (inv_le_one₀ hNpos).2 linarith [le_trans (le_max_left (2 : ℝ) ((d : ℝ) ^ 2)) ht] have hr : 0 ≤ frontierRate (n t) d (q t) := by unfold frontierRate exact le_min (by norm_num) (add_nonneg ha (sq_nonneg _)) rw [Real.norm_eq_abs, Real.norm_eq_abs, abs_of_nonneg ha, abs_of_nonneg hr] simp only [one_mul] unfold frontierRate exact le_min ha1 (le_add_of_nonneg_right (sq_nonneg _))
CausalSmith.Stat.MarRareqLogfrontier.fixed_d_frontier_rate_theta · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/PFixedDEffectiveSampleReduction.lean:15
theorem fixed_d_effective_sample_reduction

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ
hd :
1 ≤ d
n :
ℕ → ℕ
q :
ℕ → ℝ
hn :
∀ t, 1 ≤ n t
hq :
∀ t, 0 < q t ∧ q t ≤ 1
hslice :
∀ t, RareArrivalSlice (n t) (q t)
hN :
Tendsto (fun t => effectiveSize (n t) (q t)) atTop atTop
conclusion 1
(fun t => frontierRate (n t) d (q t)) =Θ[atTop] (fun t => (effectiveSize (n t) (q t))⁻¹)
conclusion 2
(fun t => minimaxRisk (n t) d (q t)) =Θ[atTop] (fun t => (effectiveSize (n t) (q t))⁻¹)
conclusion 3
(fun t => noSurrogateRisk (n t) d (q t))
=Θ[atTop] (fun t => (effectiveSize (n t) (q t))⁻¹)
Proof (Lean source)
theorem fixed_d_effective_sample_reduction (d : ℕ) (hd : 1 ≤ d) (n : ℕ → ℕ) (q : ℕ → ℝ) (hn : ∀ t, 1 ≤ n t) (hq : ∀ t, 0 < q t ∧ q t ≤ 1) (hslice : ∀ t, RareArrivalSlice (n t) (q t)) (hN : Tendsto (fun t => effectiveSize (n t) (q t)) atTop atTop) : (fun t => frontierRate (n t) d (q t)) =Θ[atTop] (fun t => (effectiveSize (n t) (q t))⁻¹) ∧ (fun t => minimaxRisk (n t) d (q t)) =Θ[atTop] (fun t => (effectiveSize (n t) (q t))⁻¹) ∧ (fun t => noSurrogateRisk (n t) d (q t)) =Θ[atTop] (fun t => (effectiveSize (n t) (q t))⁻¹) := by refine ⟨fixed_d_frontier_rate_theta d n q hn (fun t => (hq t).1) hN, ?_, ?_⟩ · obtain ⟨c, C, hc, hcC, hbounds⟩ := matched_minimax_frontier have hθ : (fun t => minimaxRisk (n t) d (q t)) =Θ[atTop] (fun t => frontierRate (n t) d (q t)) := by constructor · rw [Asymptotics.isBigO_iff] refine ⟨C, ?_⟩ filter_upwards with t obtain ⟨hl, hu⟩ := hbounds (n t) d (q t) (hn t) hd (hq t).1 (hq t).2 (hslice t) have hr : 0 ≤ frontierRate (n t) d (q t) := by unfold frontierRate exact le_min (by norm_num) (add_nonneg (inv_nonneg.mpr (le_of_lt (mul_pos (by exact_mod_cast hn t) (hq t).1))) (sq_nonneg _)) have hm : 0 ≤ minimaxRisk (n t) d (q t) := le_trans (mul_nonneg (le_of_lt hc) hr) hl rw [Real.norm_eq_abs, Real.norm_eq_abs, abs_of_nonneg hm, abs_of_nonneg hr] exact hu · rw [Asymptotics.isBigO_iff] refine ⟨c⁻¹, ?_⟩ filter_upwards with t obtain ⟨hl, hu⟩ := hbounds (n t) d (q t) (hn t) hd (hq t).1 (hq t).2 (hslice t) have hr : 0 ≤ frontierRate (n t) d (q t) := by unfold frontierRate exact le_min (by norm_num) (add_nonneg (inv_nonneg.mpr (le_of_lt (mul_pos (by exact_mod_cast hn t) (hq t).1))) (sq_nonneg _)) have hm : 0 ≤ minimaxRisk (n t) d (q t) := le_trans (mul_nonneg (le_of_lt hc) hr) hl rw [Real.norm_eq_abs, Real.norm_eq_abs, abs_of_nonneg hr, abs_of_nonneg hm] calc frontierRate (n t) d (q t) ≤ minimaxRisk (n t) d (q t) / c := (le_div_iff₀ hc).2 (by simpa [mul_comm] using hl) _ = c⁻¹ * minimaxRisk (n t) d (q t) := by ring exact hθ.trans (fixed_d_frontier_rate_theta d n q hn (fun t => (hq t).1) hN) · let c : ℝ := 1 / 256 have hc : 0 < c := by norm_num [c] obtain ⟨C, hC, hupp⟩ := mixed_count_upper have hUpper (t : ℕ) : noSurrogateRisk (n t) d (q t) ≤ C * frontierRate (n t) d (q t) := by let f := mixedCountEstimator (n t) d (q t) have hEstimator := mixed_count_estimator_regular (n t) d (q t) let T : Estimator (n t) d := Estimator.ofMap f hEstimator have hrisk : ∀ (T : Estimator (n t) d) (P : {P : FullLaw d // RareArrivalModelClass (n t) d (q t) P ∧ ∀ᵐ r : FullRecord d ∂(P.1), r.S0 = false ∧ r.S1 = false}), 0 ≤ squaredRisk T P.1 := by intro T P exact integral_nonneg (fun s => integral_nonneg (fun y => sq_nonneg _)) have hval : noSurrogateRisk (n t) d (q t) ≤ Causalean.Stat.worstCaseRiskReal (fun (T : Estimator (n t) d) (P : {P : FullLaw d // RareArrivalModelClass (n t) d (q t) P ∧ ∀ᵐ r : FullRecord d ∂(P.1), r.S0 = false ∧ r.S1 = false}) => squaredRisk T P.1) T := minimaxValue_le_worstCaseRisk_of_nonneg hrisk T refine hval.trans ?_ unfold Causalean.Stat.worstCaseRiskReal by_cases hne : Nonempty {P : FullLaw d // RareArrivalModelClass (n t) d (q t) P ∧ ∀ᵐ r : FullRecord d ∂(P.1), r.S0 = false ∧ r.S1 = false} · letI := hne apply ciSup_le intro P have hdet : squaredRisk T P.1 = deterministicRisk f P.1 := by simp [squaredRisk, deterministicRisk, T, Estimator.ofMap, Kernel.deterministic_apply] change squaredRisk T P.1 ≤ C * frontierRate (n t) d (q t) rw [hdet] exact (hupp (n t) d (q t) P.1 P.2.1).1.trans (hupp (n t) d (q t) P.1 P.2.1).2.1 · haveI : IsEmpty {P : FullLaw d // RareArrivalModelClass (n t) d (q t) P ∧ ∀ᵐ r : FullRecord d ∂(P.1), r.S0 = false ∧ r.S1 = false} := not_nonempty_iff.mp hne have hNpos : 0 < effectiveSize (n t) (q t) := by unfold effectiveSize exact mul_pos (by exact_mod_cast hn t) (hq t).1 have hr : 0 ≤ frontierRate (n t) d (q t) := by unfold frontierRate exact le_min (by norm_num) (add_nonneg (inv_nonneg.mpr (le_of_lt hNpos)) (sq_nonneg _)) simpa using (mul_nonneg (le_of_lt hC) hr) have hLower (t : ℕ) : c * min 1 (effectiveSize (n t) (q t))⁻¹ ≤ noSurrogateRisk (n t) d (q t) := by simpa [c] using (oneCell_minimax_risk_floors (q t) (hn t) hd (hq t).1 (hq t).2 (hslice t)).2 constructor · have hO : (fun t => noSurrogateRisk (n t) d (q t)) =O[atTop] (fun t => frontierRate (n t) d (q t)) := by rw [Asymptotics.isBigO_iff] refine ⟨C, ?_⟩ filter_upwards with t have hNpos : 0 < effectiveSize (n t) (q t) := by unfold effectiveSize exact mul_pos (by exact_mod_cast hn t) (hq t).1 have hr : 0 ≤ frontierRate (n t) d (q t) := by unfold frontierRate exact le_min (by norm_num) (add_nonneg (inv_nonneg.mpr (le_of_lt hNpos)) (sq_nonneg _)) have hm : 0 ≤ noSurrogateRisk (n t) d (q t) := by exact le_trans (mul_nonneg (le_of_lt hc) (le_min (by norm_num) (inv_nonneg.mpr (le_of_lt hNpos)))) (hLower t) rw [Real.norm_eq_abs, Real.norm_eq_abs, abs_of_nonneg hm, abs_of_nonneg hr] exact hUpper t exact hO.trans (fixed_d_frontier_rate_theta d n q hn (fun t => (hq t).1) hN).1 · rw [Asymptotics.isBigO_iff] refine ⟨c⁻¹, ?_⟩ filter_upwards [hN.eventually_ge_atTop 1] with t ht have hNpos : 0 < effectiveSize (n t) (q t) := by unfold effectiveSize exact mul_pos (by exact_mod_cast hn t) (hq t).1 have ha : 0 ≤ (effectiveSize (n t) (q t))⁻¹ := inv_nonneg.mpr (le_of_lt hNpos) have ha1 : (effectiveSize (n t) (q t))⁻¹ ≤ 1 := (inv_le_one₀ hNpos).2 ht have hl : c * (effectiveSize (n t) (q t))⁻¹ ≤ noSurrogateRisk (n t) d (q t) := by simpa [min_eq_right ha1] using hLower t have hm : 0 ≤ noSurrogateRisk (n t) d (q t) := le_trans (mul_nonneg (le_of_lt hc) ha) hl rw [Real.norm_eq_abs, Real.norm_eq_abs, abs_of_nonneg ha, abs_of_nonneg hm] calc (effectiveSize (n t) (q t))⁻¹ ≤ noSurrogateRisk (n t) d (q t) / c := (le_div_iff₀ hc).2 (by simpa [mul_comm] using hl) _ = c⁻¹ * noSurrogateRisk (n t) d (q t) := by ring
CausalSmith.Stat.MarRareqLogfrontier.fixed_d_effective_sample_reduction · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/PFixedDEffectiveSampleReduction.lean:74
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.PPhaseBoundaries 5 declarations PPhaseBoundaries for the finite rare-arrival experiment.

PPhaseBoundaries for the finite rare-arrival experiment.

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
a b :
ℕ → ℝ
ha :
∀ t, 0 ≤ a t
hb :
∀ t, 0 ≤ b t
ha0 :
Tendsto (fun t => min 1 (a t + b t)) atTop (nhds 0) ↔ Tendsto b atTop (nhds 0)
Proof (Lean source)
lemma phase_min_rate_tendsto (a b : ℕ → ℝ) (ha : ∀ t, 0 ≤ a t) (hb : ∀ t, 0 ≤ b t) (ha0 : Tendsto a atTop (nhds 0)) : Tendsto (fun t => min 1 (a t + b t)) atTop (nhds 0) ↔ Tendsto b atTop (nhds 0) := by constructor · intro h have hsmall : ∀ᶠ t in atTop, min 1 (a t + b t) < 1 := h.eventually (Iio_mem_nhds (by norm_num : (0 : ℝ) < 1)) have hsum : Tendsto (fun t => a t + b t) atTop (nhds 0) := by apply h.congr' filter_upwards [hsmall] with t ht have hab : a t + b t < 1 := by by_contra hnot have hge : 1 ≤ a t + b t := le_of_not_gt hnot simp [min_eq_left hge] at ht exact min_eq_right (le_of_lt hab) exact squeeze_zero hb (fun t => le_add_of_nonneg_left (ha t)) hsum · intro hb0 have hsum : Tendsto (fun t => a t + b t) atTop (nhds 0) := by convert ha0.add hb0 using 1 <;> simp simpa using ((tendsto_const_nhds : Tendsto (fun _ : ℕ => (1 : ℝ)) atTop (nhds 1)).min hsum)
CausalSmith.Stat.MarRareqLogfrontier.phase_min_rate_tendsto · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/PPhaseBoundaries.lean:14
theorem phase_frontier_rate_tendsto

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ → ℕ
q :
ℕ → ℝ
hn :
∀ t, 1 ≤ n t
hq :
∀ t, 0 < q t
hN :
Tendsto (fun t => effectiveSize (n t) (q t)) atTop atTop
Tendsto (fun t => frontierRate (n t) (d t) (q t)) atTop (nhds 0)
↔ (fun t => (d t : ℝ)) =o[atTop] (fun t => effectiveSize (n t) (q t) * logScale (n t) (q t))
Proof (Lean source)
lemma phase_frontier_rate_tendsto (n d : ℕ → ℕ) (q : ℕ → ℝ) (hn : ∀ t, 1 ≤ n t) (hq : ∀ t, 0 < q t) (hN : Tendsto (fun t => effectiveSize (n t) (q t)) atTop atTop) : Tendsto (fun t => frontierRate (n t) (d t) (q t)) atTop (nhds 0) ↔ (fun t => (d t : ℝ)) =o[atTop] (fun t => effectiveSize (n t) (q t) * logScale (n t) (q t)) := by let a : ℕ → ℝ := fun t => (effectiveSize (n t) (q t))⁻¹ let x : ℕ → ℝ := fun t => (d t : ℝ) / (effectiveSize (n t) (q t) * logScale (n t) (q t)) have hNpos (t : ℕ) : 0 < effectiveSize (n t) (q t) := by unfold effectiveSize exact mul_pos (by exact_mod_cast hn t) (hq t) have hL (t : ℕ) : 0 < logScale (n t) (q t) := by change 0 < log (exp 1 + effectiveSize (n t) (q t)) apply Real.log_pos have : 1 < exp (1 : ℝ) := Real.one_lt_exp_iff.mpr (by norm_num) linarith [hNpos t] have hx (t : ℕ) : 0 ≤ x t := div_nonneg (Nat.cast_nonneg _) (le_of_lt (mul_pos (hNpos t) (hL t))) have ha0 : Tendsto a atTop (nhds 0) := tendsto_inv_atTop_zero.comp hN have hsq : Tendsto (fun t => (x t) ^ 2) atTop (nhds 0) ↔ Tendsto x atTop (nhds 0) := by constructor · intro h have hs := Real.continuous_sqrt.tendsto (0 : ℝ) |>.comp h have hs' : Tendsto (fun t => sqrt ((x t) ^ 2)) atTop (nhds 0) := by convert hs using 1 <;> simp [Function.comp_def] exact hs'.congr' (Eventually.of_forall (fun t => by simp [Real.sqrt_sq_eq_abs, abs_of_nonneg (hx t)])) · intro h convert h.pow 2 using 1 <;> norm_num have hlittle : (fun t => (d t : ℝ)) =o[atTop] (fun t => effectiveSize (n t) (q t) * logScale (n t) (q t)) ↔ Tendsto x atTop (nhds 0) := by have hden : ∀ t, effectiveSize (n t) (q t) * logScale (n t) (q t) = 0 → (d t : ℝ) = 0 := by intro t ht exact False.elim ((ne_of_gt (mul_pos (hNpos t) (hL t))) ht) exact Asymptotics.isLittleO_iff_tendsto hden change Tendsto (fun t => min 1 (a t + (x t) ^ 2)) atTop (nhds 0) ↔ _ rw [phase_min_rate_tendsto a (fun t => (x t) ^ 2) (fun t => inv_nonneg.mpr (le_of_lt (hNpos t))) (fun t => sq_nonneg _) ha0, hsq, hlittle]
CausalSmith.Stat.MarRareqLogfrontier.phase_frontier_rate_tendsto · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/PPhaseBoundaries.lean:39
theorem phase_rate_lower_bigO

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ → ℕ
q :
ℕ → ℝ
hn :
∀ t, 1 ≤ n t
hq :
∀ t, 0 < q t
hN :
Tendsto (fun t => effectiveSize (n t) (q t)) atTop atTop
(fun t => (effectiveSize (n t) (q t))⁻¹)
=O[atTop] (fun t => frontierRate (n t) (d t) (q t))
Proof (Lean source)
lemma phase_rate_lower_bigO (n d : ℕ → ℕ) (q : ℕ → ℝ) (hn : ∀ t, 1 ≤ n t) (hq : ∀ t, 0 < q t) (hN : Tendsto (fun t => effectiveSize (n t) (q t)) atTop atTop) : (fun t => (effectiveSize (n t) (q t))⁻¹) =O[atTop] (fun t => frontierRate (n t) (d t) (q t)) := by rw [Asymptotics.isBigO_iff] refine ⟨1, ?_⟩ filter_upwards [hN.eventually_ge_atTop 1] with t ht have hNpos : 0 < effectiveSize (n t) (q t) := by unfold effectiveSize exact mul_pos (by exact_mod_cast hn t) (hq t) have ha : 0 ≤ (effectiveSize (n t) (q t))⁻¹ := inv_nonneg.mpr (le_of_lt hNpos) have ha1 : (effectiveSize (n t) (q t))⁻¹ ≤ 1 := (inv_le_one₀ hNpos).2 ht have hr : 0 ≤ frontierRate (n t) (d t) (q t) := by unfold frontierRate exact le_min (by norm_num) (add_nonneg ha (sq_nonneg _)) rw [Real.norm_eq_abs, Real.norm_eq_abs, abs_of_nonneg ha, abs_of_nonneg hr] simp only [one_mul] unfold frontierRate exact le_min ha1 (le_add_of_nonneg_right (sq_nonneg _))
CausalSmith.Stat.MarRareqLogfrontier.phase_rate_lower_bigO · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/PPhaseBoundaries.lean:85
theorem phase_dimension_rate_bigO

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ → ℕ
q :
ℕ → ℝ
hn :
∀ t, 1 ≤ n t
hq :
∀ t, 0 < q t
hN :
Tendsto (fun t => effectiveSize (n t) (q t)) atTop atTop
(fun t => frontierRate (n t) (d t) (q t))
=O[atTop] (fun t => (effectiveSize (n t) (q t))⁻¹) ↔ (fun t => (d t : ℝ)) =O[atTop] (fun t => sqrt (effectiveSize (n t) (q t)) * logScale (n t) (q t))
Proof (Lean source)
lemma phase_dimension_rate_bigO (n d : ℕ → ℕ) (q : ℕ → ℝ) (hn : ∀ t, 1 ≤ n t) (hq : ∀ t, 0 < q t) (hN : Tendsto (fun t => effectiveSize (n t) (q t)) atTop atTop) : (fun t => frontierRate (n t) (d t) (q t)) =O[atTop] (fun t => (effectiveSize (n t) (q t))⁻¹) ↔ (fun t => (d t : ℝ)) =O[atTop] (fun t => sqrt (effectiveSize (n t) (q t)) * logScale (n t) (q t)) := by let N : ℕ → ℝ := fun t => effectiveSize (n t) (q t) let L : ℕ → ℝ := fun t => logScale (n t) (q t) let B : ℕ → ℝ := fun t => sqrt (N t) * L t have hNpos (t : ℕ) : 0 < N t := by dsimp [N, effectiveSize] exact mul_pos (by exact_mod_cast hn t) (hq t) have hL (t : ℕ) : 0 < L t := by change 0 < log (exp 1 + N t) apply Real.log_pos have : 1 < exp (1 : ℝ) := Real.one_lt_exp_iff.mpr (by norm_num) linarith [hNpos t] have hB (t : ℕ) : 0 < B t := mul_pos (Real.sqrt_pos.2 (hNpos t)) (hL t) have hden (t : ℕ) : 0 < N t * L t := mul_pos (hNpos t) (hL t) have hident (t : ℕ) : (N t)⁻¹ * (N t * L t)^2 = (B t)^2 := by dsimp [B] simp only [mul_pow, Real.sq_sqrt (le_of_lt (hNpos t))] field_simp [ne_of_gt (hNpos t)] have ha (t : ℕ) : 0 ≤ (N t)⁻¹ := inv_nonneg.mpr (le_of_lt (hNpos t)) have hr (t : ℕ) : 0 ≤ frontierRate (n t) (d t) (q t) := by unfold frontierRate exact le_min (by norm_num) (add_nonneg (ha t) (sq_nonneg _)) constructor · intro hO obtain ⟨c, hc⟩ := Asymptotics.isBigO_iff.mp hO have hrate0 : Tendsto (fun t => frontierRate (n t) (d t) (q t)) atTop (nhds 0) := by have hca : Tendsto (fun t => c * (N t)⁻¹) atTop (nhds 0) := by convert (tendsto_const_nhds : Tendsto (fun _ : ℕ => c) atTop (nhds c)).mul (tendsto_inv_atTop_zero.comp hN) using 1 <;> simp [N] apply squeeze_zero' (Eventually.of_forall hr) ?_ hca filter_upwards [hc] with t ht rw [Real.norm_eq_abs, Real.norm_eq_abs, abs_of_nonneg (hr t), abs_of_nonneg (ha t)] at ht exact ht have hsmall : ∀ᶠ t in atTop, frontierRate (n t) (d t) (q t) < 1 := hrate0.eventually (Iio_mem_nhds (by norm_num : (0 : ℝ) < 1)) rw [Asymptotics.isBigO_iff] refine ⟨max 1 c, ?_⟩ filter_upwards [hc, hsmall] with t hct hst have hsum : (N t)⁻¹ + ((d t : ℝ) / (N t * L t)) ^ 2 < 1 := by by_contra hnot have hge : 1 ≤ (N t)⁻¹ + ((d t : ℝ) / (N t * L t)) ^ 2 := le_of_not_gt hnot simp [frontierRate, N, L, min_eq_left hge] at hst have hrate : frontierRate (n t) (d t) (q t) = (N t)⁻¹ + ((d t : ℝ) / (N t * L t)) ^ 2 := by simp [frontierRate, N, L, min_eq_right (le_of_lt hsum)] rw [Real.norm_eq_abs, Real.norm_eq_abs, abs_of_nonneg (hr t), abs_of_nonneg (ha t), hrate] at hct have hb : ((d t : ℝ) / (N t * L t)) ^ 2 ≤ c * (N t)⁻¹ := by nlinarith [ha t] have hsq : (d t : ℝ)^2 ≤ c * (B t)^2 := by rw [div_pow] at hb have hp := (mul_le_mul_of_nonneg_right hb (le_of_lt (pow_pos (hden t) 2))) rw [div_mul_cancel₀ _ (ne_of_gt (pow_pos (hden t) 2)), mul_assoc, hident] at hp nlinarith have hK : 0 ≤ (max 1 c) * B t := mul_nonneg (by positivity) (le_of_lt (hB t)) have hcm : c ≤ (max 1 c)^2 := by have h1 : 1 ≤ max 1 c := le_max_left _ _ have hc' : c ≤ max 1 c := le_max_right _ _ nlinarith have hdim : (d t : ℝ) ≤ max 1 c * B t := by have hB2 : 0 ≤ (B t)^2 := sq_nonneg _ nlinarith [mul_nonneg (sub_nonneg.mpr hcm) hB2] change ‖(d t : ℝ)‖ ≤ max 1 c * ‖B t‖ have hd0 : (0 : ℝ) ≤ (d t : ℝ) := Nat.cast_nonneg _ rw [Real.norm_eq_abs, Real.norm_eq_abs, abs_of_nonneg hd0, abs_of_nonneg (le_of_lt (hB t))] exact hdim · intro hO obtain ⟨c, hc⟩ := Asymptotics.isBigO_iff.mp hO rw [Asymptotics.isBigO_iff] refine ⟨1 + c^2, ?_⟩ filter_upwards [hc] with t hct rw [Real.norm_eq_abs, Real.norm_eq_abs, abs_of_nonneg (Nat.cast_nonneg _), abs_of_nonneg (le_of_lt (hB t))] at hct have hsq : (d t : ℝ)^2 ≤ c^2 * (B t)^2 := by have hcB : 0 ≤ c * B t := le_trans (Nat.cast_nonneg _) hct nlinarith have hb : ((d t : ℝ) / (N t * L t)) ^ 2 ≤ c^2 * (N t)⁻¹ := by rw [div_pow] apply (div_le_iff₀ (pow_pos (hden t) 2)).2 rw [mul_assoc, hident] exact hsq have hrate : frontierRate (n t) (d t) (q t) ≤ (1 + c^2) * (N t)⁻¹ := by unfold frontierRate calc min 1 ((N t)⁻¹ + ((d t : ℝ) / (N t * L t)) ^ 2) ≤ (N t)⁻¹ + ((d t : ℝ) / (N t * L t)) ^ 2 := min_le_right _ _ _ ≤ (1 + c^2) * (N t)⁻¹ := by nlinarith change ‖frontierRate (n t) (d t) (q t)‖ ≤ (1 + c^2) * ‖(N t)⁻¹‖ simpa only [Real.norm_eq_abs, abs_of_nonneg (hr t), abs_of_nonneg (ha t)] using hrate
CausalSmith.Stat.MarRareqLogfrontier.phase_dimension_rate_bigO · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/PPhaseBoundaries.lean:109
theorem phase_boundaries

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ → ℕ
q :
ℕ → ℝ
hn :
∀ t, 1 ≤ n t
hd :
∀ t, 1 ≤ d t
hq :
∀ t, 0 < q t ∧ q t ≤ 1
hslice :
∀ t, RareArrivalSlice (n t) (q t)
hN :
Tendsto (fun t => effectiveSize (n t) (q t)) atTop atTop
conclusion 1
Tendsto (fun t => minimaxRisk (n t) (d t) (q t)) atTop (nhds 0)
↔ (fun t => (d t : ℝ)) =o[atTop] (fun t => effectiveSize (n t) (q t) * logScale (n t) (q t))
conclusion 2
(fun t => minimaxRisk (n t) (d t) (q t))
=Θ[atTop] (fun t => (effectiveSize (n t) (q t))⁻¹) ↔ (fun t => (d t : ℝ)) =O[atTop] (fun t => sqrt (effectiveSize (n t) (q t)) * logScale (n t) (q t))
Proof (Lean source)
theorem phase_boundaries (n d : ℕ → ℕ) (q : ℕ → ℝ) (hn : ∀ t, 1 ≤ n t) (hd : ∀ t, 1 ≤ d t) (hq : ∀ t, 0 < q t ∧ q t ≤ 1) (hslice : ∀ t, RareArrivalSlice (n t) (q t)) (hN : Tendsto (fun t => effectiveSize (n t) (q t)) atTop atTop) : (Tendsto (fun t => minimaxRisk (n t) (d t) (q t)) atTop (nhds 0) ↔ (fun t => (d t : ℝ)) =o[atTop] (fun t => effectiveSize (n t) (q t) * logScale (n t) (q t))) ∧ ((fun t => minimaxRisk (n t) (d t) (q t)) =Θ[atTop] (fun t => (effectiveSize (n t) (q t))⁻¹) ↔ (fun t => (d t : ℝ)) =O[atTop] (fun t => sqrt (effectiveSize (n t) (q t)) * logScale (n t) (q t))) := by constructor · obtain ⟨c, C, hc, hcC, hbounds⟩ := matched_minimax_frontier have hC : 0 ≤ C := le_trans (le_of_lt hc) hcC have hr (t : ℕ) : 0 ≤ frontierRate (n t) (d t) (q t) := by unfold frontierRate have hNpos : 0 < effectiveSize (n t) (q t) := by unfold effectiveSize exact mul_pos (by exact_mod_cast hn t) (hq t).1 exact le_min (by norm_num) (add_nonneg (inv_nonneg.mpr (le_of_lt hNpos)) (sq_nonneg _)) have hboth (t : ℕ) : c * frontierRate (n t) (d t) (q t) ≤ minimaxRisk (n t) (d t) (q t) ∧ minimaxRisk (n t) (d t) (q t) ≤ C * frontierRate (n t) (d t) (q t) := hbounds (n t) (d t) (q t) (hn t) (hd t) (hq t).1 (hq t).2 (hslice t) have hiff : Tendsto (fun t => minimaxRisk (n t) (d t) (q t)) atTop (nhds 0) ↔ Tendsto (fun t => frontierRate (n t) (d t) (q t)) atTop (nhds 0) := by constructor · intro h apply squeeze_zero hr (fun t => ?_) (by convert (tendsto_const_nhds : Tendsto (fun _ : ℕ => c⁻¹) atTop (nhds c⁻¹)).mul h using 1 <;> simp) have hle := (hboth t).1 have hle' : frontierRate (n t) (d t) (q t) ≤ minimaxRisk (n t) (d t) (q t) / c := (le_div_iff₀ hc).2 (by simpa [mul_comm] using hle) simpa [div_eq_inv_mul] using hle' · intro h apply squeeze_zero (fun t => le_trans (mul_nonneg (le_of_lt hc) (hr t)) (hboth t).1) (fun t => (hboth t).2) convert (tendsto_const_nhds : Tendsto (fun _ : ℕ => C) atTop (nhds C)).mul h using 1 <;> simp exact hiff.trans (phase_frontier_rate_tendsto n d q hn (fun t => (hq t).1) hN) · obtain ⟨c, C, hc, hcC, hbounds⟩ := matched_minimax_frontier have hC : 0 ≤ C := le_trans (le_of_lt hc) hcC have hr (t : ℕ) : 0 ≤ frontierRate (n t) (d t) (q t) := by unfold frontierRate have hNpos : 0 < effectiveSize (n t) (q t) := by unfold effectiveSize exact mul_pos (by exact_mod_cast hn t) (hq t).1 exact le_min (by norm_num) (add_nonneg (inv_nonneg.mpr (le_of_lt hNpos)) (sq_nonneg _)) have hboth (t : ℕ) : c * frontierRate (n t) (d t) (q t) ≤ minimaxRisk (n t) (d t) (q t) ∧ minimaxRisk (n t) (d t) (q t) ≤ C * frontierRate (n t) (d t) (q t) := hbounds (n t) (d t) (q t) (hn t) (hd t) (hq t).1 (hq t).2 (hslice t) have hm (t : ℕ) : 0 ≤ minimaxRisk (n t) (d t) (q t) := le_trans (mul_nonneg (le_of_lt hc) (hr t)) (hboth t).1 have hRiskRate : (fun t => minimaxRisk (n t) (d t) (q t)) =Θ[atTop] (fun t => frontierRate (n t) (d t) (q t)) := by constructor · rw [Asymptotics.isBigO_iff] refine ⟨C, ?_⟩ filter_upwards with t rw [Real.norm_eq_abs, Real.norm_eq_abs, abs_of_nonneg (hm t), abs_of_nonneg (hr t)] exact (hboth t).2 · rw [Asymptotics.isBigO_iff] refine ⟨c⁻¹, ?_⟩ filter_upwards with t rw [Real.norm_eq_abs, Real.norm_eq_abs, abs_of_nonneg (hr t), abs_of_nonneg (hm t)] have hle : frontierRate (n t) (d t) (q t) ≤ minimaxRisk (n t) (d t) (q t) / c := (le_div_iff₀ hc).2 (by simpa [mul_comm] using (hboth t).1) simpa [div_eq_inv_mul] using hle have hbase := phase_rate_lower_bigO n d q hn (fun t => (hq t).1) hN have hdim := phase_dimension_rate_bigO n d q hn (fun t => (hq t).1) hN constructor · intro htheta exact hdim.mp (hRiskRate.2.trans htheta.1) · intro hO exact ⟨hRiskRate.1.trans (hdim.mpr hO), hbase.trans hRiskRate.2⟩
CausalSmith.Stat.MarRareqLogfrontier.phase_boundaries · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/PPhaseBoundaries.lean:212
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.PUnrestrictedCompleteArrivalPhaseBoundary 1 declarations PUnrestrictedCompleteArrivalPhaseBoundary for the finite rare-arrival experiment.

PUnrestrictedCompleteArrivalPhaseBoundary for the finite rare-arrival experiment.

theorem unrestricted_complete_arrival_phase_boundary

the stated mathematical conclusion holds.

Formal statement
∃ c C : ℝ,
0 < c
c ≤ C
conclusion 1
d :
ℕ → ℕ
(∀ n, 1 ≤ d n)
∀ᶠ n : ℕ in atTop, c / (n : ℝ)
≤ unrestrictedMinimaxRisk n (d n) 1 ∧ unrestrictedMinimaxRisk n (d n) 1 ≤ C / (n : ℝ)
Proof (Lean source)
theorem unrestricted_complete_arrival_phase_boundary : ∃ c C : ℝ, 0 < c ∧ c ≤ C ∧ ∀ d : ℕ → ℕ, (∀ n, 1 ≤ d n) → ∀ᶠ n : ℕ in atTop, c / (n : ℝ) ≤ unrestrictedMinimaxRisk n (d n) 1 ∧ unrestrictedMinimaxRisk n (d n) 1 ≤ C / (n : ℝ) := by refine ⟨1 / 256, 4, by norm_num, by norm_num, ?_⟩ intro d hd have hdeficit : ∀ᶠ n : ℕ in atTop, 1 - (1 : ℝ) ≤ (0 : ℝ) / sqrt (n : ℝ) := by simp have hb := unrestricted_near_complete_phase_boundary 0 (by norm_num) d hd (fun _ => 1) (by intro n; norm_num) hdeficit filter_upwards [hb] with n hn simpa [div_eq_mul_inv, mul_comm, mul_assoc] using hn
CausalSmith.Stat.MarRareqLogfrontier.unrestricted_complete_arrival_phase_boundary · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/PUnrestrictedCompleteArrivalPhaseBoundary.lean:14
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.PUnrestrictedFixedQPhaseBoundaries 3 declarations PUnrestrictedFixedQPhaseBoundaries for the finite rare-arrival experiment.

PUnrestrictedFixedQPhaseBoundaries for the finite rare-arrival experiment.

theorem fixedQRate_eq_frontierRate_one

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
Proof (Lean source)
CausalSmith.Stat.MarRareqLogfrontier.fixedQRate_eq_frontierRate_one · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/PUnrestrictedFixedQPhaseBoundaries.lean:15
theorem fixedQRate_tendsto_iff_dimension_littleO

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
d :
ℕ → ℕ
Tendsto (fun n => fixedQRate n (d n)) atTop (nhds 0)
↔ (fun n => (d n : ℝ)) =o[atTop] (fun n => (n : ℝ) * log (exp 1 + n))
Proof (Lean source)
lemma fixedQRate_tendsto_iff_dimension_littleO (d : ℕ → ℕ) : Tendsto (fun n => fixedQRate n (d n)) atTop (nhds 0) ↔ (fun n => (d n : ℝ)) =o[atTop] (fun n => (n : ℝ) * log (exp 1 + n)) := by let a : ℕ → ℝ := fun n => (n : ℝ)⁻¹ let x : ℕ → ℝ := fun n => (d n : ℝ) / ((n : ℝ) * log (exp 1 + n)) have hlog (n : ℕ) : 0 < log (exp 1 + n) := by apply Real.log_pos have : 1 < exp (1 : ℝ) := Real.one_lt_exp_iff.mpr (by norm_num) linarith [Nat.cast_nonneg (α := ℝ) n] have hx (n : ℕ) : 0 ≤ x n := by dsimp [x] exact div_nonneg (Nat.cast_nonneg _) (mul_nonneg (Nat.cast_nonneg _) (le_of_lt (hlog n))) have ha0 : Tendsto a atTop (nhds 0) := by simpa only [a, Function.comp_def] using (tendsto_inv_atTop_zero.comp (tendsto_natCast_atTop_atTop : Tendsto (fun n : ℕ => (n : ℝ)) atTop atTop)) have hsq : Tendsto (fun n => (x n) ^ 2) atTop (nhds 0) ↔ Tendsto x atTop (nhds 0) := by constructor · intro h have hs := Real.continuous_sqrt.tendsto (0 : ℝ) |>.comp h have hs' : Tendsto (fun n => sqrt ((x n) ^ 2)) atTop (nhds 0) := by convert hs using 1 <;> simp [Function.comp_def] exact hs'.congr' (Eventually.of_forall (fun n => by simp [Real.sqrt_sq_eq_abs, abs_of_nonneg (hx n)])) · intro h convert h.pow 2 using 1 <;> norm_num have hlittle : (fun n => (d n : ℝ)) =o[atTop] (fun n => (n : ℝ) * log (exp 1 + n)) ↔ Tendsto x atTop (nhds 0) := by have hden : ∀ᶠ (n : ℕ) in (atTop : Filter ℕ), (n : ℝ) * log (exp 1 + n) = 0 → (d n : ℝ) = 0 := by filter_upwards [eventually_ge_atTop 1] with n hn hzero have hn' : (0 : ℝ) < n := by exact_mod_cast hn exact False.elim ((ne_of_gt (mul_pos hn' (hlog n))) hzero) exact Asymptotics.isLittleO_iff_tendsto' hden change Tendsto (fun n => min 1 (a n + (x n) ^ 2)) atTop (nhds 0) ↔ _ rw [phase_min_rate_tendsto a (fun n => (x n) ^ 2) (fun n => inv_nonneg.mpr (Nat.cast_nonneg _)) (fun n => sq_nonneg _) ha0, hsq, hlittle]
CausalSmith.Stat.MarRareqLogfrontier.fixedQRate_tendsto_iff_dimension_littleO · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/PUnrestrictedFixedQPhaseBoundaries.lean:21
theorem unrestricted_fixed_q_phase_boundaries

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
hZeng_of_gate :
q :
ℝ
hq :
0 < q ∧ q < 1 / 2
conclusion 1
d :
ℕ → ℕ
(∀ n, 1 ≤ d n)
Tendsto (fun n => unrestrictedMinimaxRisk n (d n) q) atTop (nhds 0)
↔ (fun n => (d n : ℝ)) =o[atTop] (fun n => (n : ℝ) * log (exp 1 + n))
conclusion 2
∃ c : ℝ,
0 < c
M :
ℝ
0 < M
∃ C : ℝ,
c ≤ C
d :
ℕ → ℕ
(∀ n, 1 ≤ d n)
(∀ᶠ n in (atTop : Filter ℕ), (d n : ℝ) ≤ M * sqrt n * log (exp 1 + n))
∀ᶠ n in (atTop : Filter ℕ), c * ((n : ℕ) : ℝ)⁻¹
≤ unrestrictedMinimaxRisk n (d n) q ∧
unrestrictedMinimaxRisk n (d n) q ≤ C * ((n : ℕ) : ℝ)⁻¹
conclusion 3
d :
ℕ → ℕ
(∀ n, 1 ≤ d n)
(∃ c C : ℝ, 0 < c ∧ c ≤ C ∧ ∀ᶠ n in (atTop : Filter ℕ), c * ((n : ℕ) : ℝ)⁻¹ ≤ unrestrictedMinimaxRisk n (d n) q ∧ unrestrictedMinimaxRisk n (d n) q ≤ C * ((n : ℕ) : ℝ)⁻¹)
(fun n => (d n : ℝ)) =O[atTop] (fun n => sqrt n * log (exp 1 + n))
Proof (Lean source)
-- @node: prop:unrestricted-fixed-q-phase-boundaries theorem unrestricted_fixed_q_phase_boundaries (hZeng_of_gate : ZengTheoremTwoLower) (q : ℝ) (hq : 0 < q ∧ q < 1 / 2) : (∀ (d : ℕ → ℕ), (∀ n, 1 ≤ d n) → (Tendsto (fun n => unrestrictedMinimaxRisk n (d n) q) atTop (nhds 0) ↔ (fun n => (d n : ℝ)) =o[atTop] (fun n => (n : ℝ) * log (exp 1 + n)))) ∧ (∃ c : ℝ, 0 < c ∧ ∀ M : ℝ, 0 < M → ∃ C : ℝ, c ≤ C ∧ ∀ (d : ℕ → ℕ), (∀ n, 1 ≤ d n) → (∀ᶠ n in (atTop : Filter ℕ), (d n : ℝ) ≤ M * sqrt n * log (exp 1 + n)) → (∀ᶠ n in (atTop : Filter ℕ), c * ((n : ℕ) : ℝ)⁻¹ ≤ unrestrictedMinimaxRisk n (d n) q ∧ unrestrictedMinimaxRisk n (d n) q ≤ C * ((n : ℕ) : ℝ)⁻¹)) ∧ (∀ (d : ℕ → ℕ), (∀ n, 1 ≤ d n) → (∃ c C : ℝ, 0 < c ∧ c ≤ C ∧ ∀ᶠ n in (atTop : Filter ℕ), c * ((n : ℕ) : ℝ)⁻¹ ≤ unrestrictedMinimaxRisk n (d n) q ∧ unrestrictedMinimaxRisk n (d n) q ≤ C * ((n : ℕ) : ℝ)⁻¹) → (fun n => (d n : ℝ)) =O[atTop] (fun n => sqrt n * log (exp 1 + n))) := by obtain ⟨a, B, ha, haB, hfrontier⟩ := unrestricted_fixed_q_minimax_frontier hZeng_of_gate q hq.1 hq.2 have hB : 0 ≤ B := le_trans (le_of_lt ha) haB refine ⟨?_, ?_, ?_⟩ · intro d hd have hrate : Tendsto (fun n => unrestrictedMinimaxRisk n (d n) q) atTop (nhds 0) ↔ Tendsto (fun n => fixedQRate n (d n)) atTop (nhds 0) := by have hr (n : ℕ) : 0 ≤ fixedQRate n (d n) := by unfold fixedQRate exact le_min (by norm_num) (add_nonneg (inv_nonneg.mpr (Nat.cast_nonneg _)) (sq_nonneg _)) have hbound : ∀ᶠ n in (atTop : Filter ℕ), a * fixedQRate n (d n) ≤ unrestrictedMinimaxRisk n (d n) q ∧ unrestrictedMinimaxRisk n (d n) q ≤ B * fixedQRate n (d n) := by filter_upwards [eventually_ge_atTop 1] with n hn obtain ⟨hlo, hhi, _, _⟩ := hfrontier n (d n) hn (hd n) exact ⟨hlo, hhi⟩ constructor · intro h have hupper : Tendsto (fun n => a⁻¹ * unrestrictedMinimaxRisk n (d n) q) atTop (nhds 0) := by convert tendsto_const_nhds.mul h using 1 <;> simp apply squeeze_zero' (Eventually.of_forall hr) ?_ hupper filter_upwards [hbound] with n hn calc fixedQRate n (d n) ≤ unrestrictedMinimaxRisk n (d n) q / a := (le_div_iff₀ ha).2 (by simpa [mul_comm] using hn.1) _ = a⁻¹ * unrestrictedMinimaxRisk n (d n) q := by ring · intro h have hupper : Tendsto (fun n => B * fixedQRate n (d n)) atTop (nhds 0) := by convert tendsto_const_nhds.mul h using 1 <;> simp apply squeeze_zero' ?_ (hbound.mono fun n hn => hn.2) hupper filter_upwards [hbound] with n hn exact (mul_nonneg (le_of_lt ha) (hr n)).trans hn.1 exact hrate.trans (fixedQRate_tendsto_iff_dimension_littleO d) · refine ⟨a, ha, ?_⟩ intro M hM refine ⟨B * (1 + M ^ 2), ?_, ?_⟩ · nlinarith [sq_nonneg M, mul_nonneg hB (sq_nonneg M)] · intro d hd hdim filter_upwards [eventually_ge_atTop 1, hdim] with n hn hdn obtain ⟨hlo, hhi, _, _⟩ := hfrontier n (d n) hn (hd n) have hnpos : (0 : ℝ) < n := by exact_mod_cast hn have hlog : 0 < log (exp 1 + n) := by apply Real.log_pos have he : 1 < exp (1 : ℝ) := Real.one_lt_exp_iff.mpr (by norm_num) linarith have hden : 0 < (n : ℝ) * log (exp 1 + n) := mul_pos hnpos hlog have hroot : (sqrt n) ^ 2 = (n : ℝ) := Real.sq_sqrt (le_of_lt hnpos) have hdim_sq : (d n : ℝ)^2 ≤ M^2 * ((n : ℝ) * log (exp 1 + n)^2) := by have hright : 0 ≤ M * sqrt n * log (exp 1 + n) := by positivity calc (d n : ℝ)^2 ≤ (M * sqrt n * log (exp 1 + n))^2 := by nlinarith [mul_nonneg (sub_nonneg.mpr hdn) (add_nonneg hright (Nat.cast_nonneg (d n)))] _ = M^2 * ((n : ℝ) * log (exp 1 + n)^2) := by rw [mul_pow, mul_pow, hroot] ring have hsq : ((d n : ℝ) / ((n : ℝ) * log (exp 1 + n))) ^ 2 ≤ M^2 * (n : ℝ)⁻¹ := by rw [div_pow] apply (div_le_iff₀ (pow_pos hden 2)).2 have heq : (n : ℝ)⁻¹ * ((n : ℝ) * log (exp 1 + n)) ^ 2 = (n : ℝ) * log (exp 1 + n)^2 := by field_simp [ne_of_gt hnpos] rw [mul_assoc, heq] exact hdim_sq have hinv : (n : ℝ)⁻¹ ≤ 1 := (inv_le_one₀ hnpos).2 (by exact_mod_cast hn) have hrate_low : (n : ℝ)⁻¹ ≤ fixedQRate n (d n) := by unfold fixedQRate exact le_min hinv (le_add_of_nonneg_right (sq_nonneg _)) have hrate_up : fixedQRate n (d n) ≤ (1 + M^2) * (n : ℝ)⁻¹ := by unfold fixedQRate calc min 1 ((n : ℝ)⁻¹ + _) ≤ (n : ℝ)⁻¹ + _ := min_le_right _ _ _ ≤ (1 + M^2) * (n : ℝ)⁻¹ := by nlinarith exact ⟨(mul_le_mul_of_nonneg_left hrate_low (le_of_lt ha)).trans hlo, hhi.trans (by calc B * fixedQRate n (d n) ≤ B * ((1 + M^2) * (n : ℝ)⁻¹) := mul_le_mul_of_nonneg_left hrate_up hB _ = (B * (1 + M^2)) * (n : ℝ)⁻¹ := by ring)⟩ · intro d hd hparam obtain ⟨c, C, hc, hcC, hbound⟩ := hparam have hC : 0 ≤ C := le_trans (le_of_lt hc) hcC have hratebound : ∀ᶠ n in (atTop : Filter ℕ), a * fixedQRate n (d n) ≤ unrestrictedMinimaxRisk n (d n) q ∧ unrestrictedMinimaxRisk n (d n) q ≤ C * (n : ℝ)⁻¹ := by filter_upwards [eventually_ge_atTop 1, hbound] with n hn hbc exact ⟨(hfrontier n (d n) hn (hd n)).1, hbc.2⟩ have hrate0 : Tendsto (fun n => fixedQRate n (d n)) atTop (nhds 0) := by have hupper : Tendsto (fun n : ℕ => (C / a) * (n : ℝ)⁻¹) atTop (nhds 0) := by have hinv : Tendsto (fun n : ℕ => (n : ℝ)⁻¹) atTop (nhds 0) := by simpa only [Function.comp_def] using (tendsto_inv_atTop_zero.comp (tendsto_natCast_atTop_atTop : Tendsto (fun n : ℕ => (n : ℝ)) atTop atTop)) simpa only [mul_zero] using (tendsto_const_nhds : Tendsto (fun _ : ℕ => C / a) atTop (nhds (C / a))).mul hinv apply squeeze_zero' ?_ ?_ hupper · filter_upwards [eventually_ge_atTop 1] with n hn unfold fixedQRate exact le_min (by norm_num) (add_nonneg (inv_nonneg.mpr (Nat.cast_nonneg _)) (sq_nonneg _)) · filter_upwards [hratebound] with n hn calc fixedQRate n (d n) ≤ unrestrictedMinimaxRisk n (d n) q / a := (le_div_iff₀ ha).2 (by simpa [mul_comm] using hn.1) _ ≤ (C / a) * (n : ℝ)⁻¹ := by exact div_le_div_of_nonneg_right hn.2 (le_of_lt ha) |>.trans_eq (by ring) have hsmall : ∀ᶠ n in (atTop : Filter ℕ), fixedQRate n (d n) < 1 := hrate0.eventually (Iio_mem_nhds (by norm_num : (0 : ℝ) < 1)) let K : ℝ := max 1 (C / a) have hK : 0 ≤ K := le_trans (by norm_num) (le_max_left _ _) have hK2 : C / a ≤ K^2 := by have h1 : 1 ≤ K := le_max_left _ _ have h2 : C / a ≤ K := le_max_right _ _ nlinarith rw [Asymptotics.isBigO_iff] refine ⟨K, ?_⟩ filter_upwards [eventually_ge_atTop 1, hratebound, hsmall] with n hn hb hs have hnpos : (0 : ℝ) < n := by exact_mod_cast hn have hlog : 0 < log (exp 1 + n) := by apply Real.log_pos have he : 1 < exp (1 : ℝ) := Real.one_lt_exp_iff.mpr (by norm_num) linarith have hden : 0 < (n : ℝ) * log (exp 1 + n) := mul_pos hnpos hlog have hsum : (n : ℝ)⁻¹ + ((d n : ℝ) / ((n : ℝ) * log (exp 1 + n)))^2 < 1 := by by_contra hnot have hge : 1 ≤ (n : ℝ)⁻¹ + ((d n : ℝ) / ((n : ℝ) * log (exp 1 + n)))^2 := le_of_not_gt hnot simp [fixedQRate, min_eq_left hge] at hs have hsq : ((d n : ℝ) / ((n : ℝ) * log (exp 1 + n)))^2 ≤ (C / a) * (n : ℝ)⁻¹ := by have hr : fixedQRate n (d n) = (n : ℝ)⁻¹ + ((d n : ℝ) / ((n : ℝ) * log (exp 1 + n)))^2 := by simp [fixedQRate, min_eq_right (le_of_lt hsum)] have hu : fixedQRate n (d n) ≤ (C / a) * (n : ℝ)⁻¹ := by calc fixedQRate n (d n) ≤ unrestrictedMinimaxRisk n (d n) q / a := (le_div_iff₀ ha).2 (by simpa [mul_comm] using hb.1) _ ≤ (C / a) * (n : ℝ)⁻¹ := by calc unrestrictedMinimaxRisk n (d n) q / a ≤ (C * (n : ℝ)⁻¹) / a := div_le_div_of_nonneg_right hb.2 (le_of_lt ha) _ = (C / a) * (n : ℝ)⁻¹ := by ring nlinarith [inv_nonneg.mpr (le_of_lt hnpos)] have hdsq : (d n : ℝ)^2 ≤ (C / a) * ((n : ℝ) * log (exp 1 + n)^2) := by rw [div_pow] at hsq have hp := mul_le_mul_of_nonneg_right hsq (le_of_lt (pow_pos hden 2)) have heq : (n : ℝ)⁻¹ * ((n : ℝ) * log (exp 1 + n))^2 = (n : ℝ) * log (exp 1 + n)^2 := by field_simp [ne_of_gt hnpos] rw [div_mul_cancel₀ _ (ne_of_gt (pow_pos hden 2)), mul_assoc, heq] at hp exact hp have hroot : (sqrt n)^2 = (n : ℝ) := Real.sq_sqrt (le_of_lt hnpos) have hdim : (d n : ℝ) ≤ K * (sqrt n * log (exp 1 + n)) := by have hprod : 0 ≤ (n : ℝ) * log (exp 1 + n)^2 := by positivity have hkdsq : (d n : ℝ)^2 ≤ K^2 * ((n : ℝ) * log (exp 1 + n)^2) := by nlinarith [mul_nonneg (sub_nonneg.mpr hK2) hprod] have hright : 0 ≤ K * (sqrt n * log (exp 1 + n)) := by positivity have hright_sq : (K * (sqrt n * log (exp 1 + n)))^2 = K^2 * ((n : ℝ) * log (exp 1 + n)^2) := by rw [mul_pow, mul_pow, hroot] rw [← hright_sq] at hkdsq nlinarith [Nat.cast_nonneg (α := ℝ) (d n)] change ‖(d n : ℝ)‖ ≤ K * ‖Real.sqrt n * log (exp 1 + n)‖ rw [Real.norm_eq_abs, Real.norm_eq_abs, abs_of_nonneg (Nat.cast_nonneg (α := ℝ) (d n)), abs_of_nonneg (mul_nonneg (Real.sqrt_nonneg _) (le_of_lt hlog))] exact hdim
CausalSmith.Stat.MarRareqLogfrontier.unrestricted_fixed_q_phase_boundaries · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/PUnrestrictedFixedQPhaseBoundaries.lean:64
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.PUnrestrictedNearCompletePhaseBoundary 1 declarations A sufficient near-complete window for parametric point risk uniformly in dimension.

A sufficient near-complete window for parametric point risk uniformly in dimension.

theorem unrestricted_near_complete_phase_boundary

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
M :
ℝ
hM :
0 ≤ M
d :
ℕ → ℕ
hd :
∀ n, 1 ≤ d n
q :
ℕ → ℝ
hq :
∀ n, 0 < q n ∧ q n ≤ 1
hdeficit :
∀ᶠ n : ℕ in atTop, 1 - q n ≤ M / sqrt (n : ℝ)
∀ᶠ n : ℕ in atTop, 1 / (256 * (n : ℝ))
≤ unrestrictedMinimaxRisk n (d n) (q n) ∧
unrestrictedMinimaxRisk n (d n) (q n) ≤ (4 + M ^ 2) / (n : ℝ)
Proof (Lean source)
theorem unrestricted_near_complete_phase_boundary (M : ℝ) (hM : 0 ≤ M) (d : ℕ → ℕ) (hd : ∀ n, 1 ≤ d n) (q : ℕ → ℝ) (hq : ∀ n, 0 < q n ∧ q n ≤ 1) (hdeficit : ∀ᶠ n : ℕ in atTop, 1 - q n ≤ M / sqrt (n : ℝ)) : ∀ᶠ n : ℕ in atTop, 1 / (256 * (n : ℝ)) ≤ unrestrictedMinimaxRisk n (d n) (q n) ∧ unrestrictedMinimaxRisk n (d n) (q n) ≤ (4 + M ^ 2) / (n : ℝ) := by obtain ⟨C, hC, hmix, henvelope⟩ := unrestricted_near_complete_arrival_envelope filter_upwards [hdeficit, eventually_ge_atTop (1 : ℕ)] with n hdef hn have hnR : (0 : ℝ) < n := by exact_mod_cast hn obtain ⟨hlower, hupper, hHT⟩ := henvelope n (d n) (q n) hn (hd n) (hq n).1 (hq n).2 refine ⟨hlower, ?_⟩ have hupper' : unrestrictedMinimaxRisk n (d n) (q n) ≤ 4 / (n : ℝ) + (1 - q n) ^ 2 := hupper.trans ((min_le_right _ _).trans (min_le_right _ _)) have hsqrt : 0 < sqrt (n : ℝ) := Real.sqrt_pos.2 hnR have hscaled : (1 - q n) * sqrt (n : ℝ) ≤ M := (le_div_iff₀ hsqrt).1 hdef have hnonneg : 0 ≤ (1 - q n) * sqrt (n : ℝ) := mul_nonneg (sub_nonneg.2 (hq n).2) hsqrt.le have hsquare : ((1 - q n) * sqrt (n : ℝ)) ^ 2 ≤ M ^ 2 := by nlinarith have hbudget : (1 - q n) ^ 2 ≤ M ^ 2 / (n : ℝ) := by apply (le_div_iff₀ hnR).2 simpa only [mul_pow, Real.sq_sqrt hnR.le] using hsquare calc unrestrictedMinimaxRisk n (d n) (q n) ≤ 4 / (n : ℝ) + (1 - q n) ^ 2 := hupper' _ ≤ 4 / (n : ℝ) + M ^ 2 / (n : ℝ) := add_le_add_right hbudget _ _ = (4 + M ^ 2) / (n : ℝ) := by rw [add_div]
CausalSmith.Stat.MarRareqLogfrontier.unrestricted_near_complete_phase_boundary · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/PUnrestrictedNearCompletePhaseBoundary.lean:12
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.PUnrestrictedUniformNearCompleteElbow 1 declarations The near-complete elbow is necessary and sufficient for parametric point risk uniformly over every alphabet size.

The near-complete elbow is necessary and sufficient for parametric point risk uniformly over every alphabet size. Supremum bounds use an upper bound and witnesses above every strictly smaller threshold.

theorem unrestricted_uniform_near_complete_elbow

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
q :
ℕ → ℝ
hq :
∀ n, 0 < q n ∧ q n ≤ 1
conclusion 1
n :
ℕ
1 ≤ n
d :
ℕ
1 ≤ d
(n : ℝ) * unrestrictedMinimaxRisk n d (q n) ≤ 4 + n * (1 - q n) ^ 2
b :
ℝ
b < (1 / 2048 : ℝ) * (1 + n * (1 - q n) ^ 2)
∃ d : ℕ,
1 ≤ d
b < (n : ℝ) * unrestrictedMinimaxRisk n d (q n)
conclusion 2
(∃ (M : ℝ) (n₀ : ℕ), 0 ≤ M ∧ ∀ n, n₀ ≤ n → 1 - q n ≤ M / sqrt (n : ℝ))
↔ (∃ (D : ℝ) (n₀ : ℕ), ∀ n, n₀ ≤ n → ∀ d, 1 ≤ d → unrestrictedMinimaxRisk n d (q n) ≤ D / n)
conclusion 3
n d :
ℕ
1 ≤ n
1 ≤ d
1 / (256 * (n : ℝ)) ≤ unrestrictedMinimaxRisk n d (q n)
conclusion 4
¬ BddAbove (range (fun n : ℕ => sqrt (n : ℝ) * (1 - q n)))
C :
ℝ
∃ᶠ n : ℕ in atTop, C < (n : ℝ) * unrestrictedMinimaxRisk n (1024 * n ^ 2) (q n)
Proof (Lean source)
theorem unrestricted_uniform_near_complete_elbow (q : ℕ → ℝ) (hq : ∀ n, 0 < q n ∧ q n ≤ 1) : (∀ n : ℕ, 1 ≤ n → (∀ d : ℕ, 1 ≤ d → (n : ℝ) * unrestrictedMinimaxRisk n d (q n) ≤ 4 + n * (1 - q n) ^ 2) ∧ (∀ b : ℝ, b < (1 / 2048 : ℝ) * (1 + n * (1 - q n) ^ 2) → ∃ d : ℕ, 1 ≤ d ∧ b < (n : ℝ) * unrestrictedMinimaxRisk n d (q n))) ∧ ((∃ (M : ℝ) (n₀ : ℕ), 0 ≤ M ∧ ∀ n, n₀ ≤ n → 1 - q n ≤ M / sqrt (n : ℝ)) ↔ (∃ (D : ℝ) (n₀ : ℕ), ∀ n, n₀ ≤ n → ∀ d, 1 ≤ d → unrestrictedMinimaxRisk n d (q n) ≤ D / n)) ∧ (∀ n d : ℕ, 1 ≤ n → 1 ≤ d → 1 / (256 * (n : ℝ)) ≤ unrestrictedMinimaxRisk n d (q n)) ∧ (¬ BddAbove (range (fun n : ℕ => sqrt (n : ℝ) * (1 - q n))) → ∀ C : ℝ, ∃ᶠ n : ℕ in atTop, C < (n : ℝ) * unrestrictedMinimaxRisk n (1024 * n ^ 2) (q n)) := by obtain ⟨C₀, hC₀, hmix, henv⟩ := unrestricted_near_complete_arrival_envelope have upper (n d : ℕ) (hn : 1 ≤ n) (hd : 1 ≤ d) : unrestrictedMinimaxRisk n d (q n) ≤ 4 / (n : ℝ) + (1 - q n) ^ 2 := by exact (henv n d (q n) hn hd (hq n).1 (hq n).2).2.1.trans ((min_le_right _ _).trans (min_le_right _ _)) have large (n : ℕ) (hn : 1 ≤ n) : (1 / 2048 : ℝ) * (1 + n * (1 - q n) ^ 2) ≤ (n : ℝ) * unrestrictedMinimaxRisk n (1024 * n ^ 2) (q n) := by have hnR : (0 : ℝ) < n := by exact_mod_cast hn have hl := (unrestricted_large_alphabet_deficit_lower n (1024 * n ^ 2) (q n) hn le_rfl (hq n).1 (hq n).2).2.2.1 have hm := mul_le_mul_of_nonneg_left hl hnR.le have heq : (n : ℝ) * ((1 / 2048 : ℝ) * ((n : ℝ)⁻¹ + (1 - q n) ^ 2)) = (1 / 2048 : ℝ) * (1 + n * (1 - q n) ^ 2) := by field_simp rwa [heq] at hm have alphabet (n : ℕ) (hn : 1 ≤ n) : 1 ≤ 1024 * n ^ 2 := by have : 1 ≤ n ^ 2 := one_le_pow₀ hn omega refine ⟨?_, ?_, ?_, ?_⟩ · intro n hn have hnR : (0 : ℝ) < n := by exact_mod_cast hn constructor · intro d hd have h := mul_le_mul_of_nonneg_left (upper n d hn hd) hnR.le have heq : (n : ℝ) * (4 / (n : ℝ) + (1 - q n) ^ 2) = 4 + n * (1 - q n) ^ 2 := by field_simp rwa [heq] at h · intro b hb exact ⟨1024 * n ^ 2, alphabet n hn, hb.trans_le (large n hn)⟩ · constructor · rintro ⟨M, n₀, hM, hdef⟩ refine ⟨4 + M ^ 2, max n₀ 1, ?_⟩ intro n hn d hd have hn1 : 1 ≤ n := (le_max_right n₀ 1).trans hn have hnR : (0 : ℝ) < n := by exact_mod_cast hn1 have hsqrt : 0 < sqrt (n : ℝ) := Real.sqrt_pos.2 hnR have hscaled := (le_div_iff₀ hsqrt).1 (hdef n ((le_max_left n₀ 1).trans hn)) have hnon : 0 ≤ (1 - q n) * sqrt (n : ℝ) := mul_nonneg (sub_nonneg.2 (hq n).2) hsqrt.le have hsquare : ((1 - q n) * sqrt (n : ℝ)) ^ 2 ≤ M ^ 2 := by nlinarith have hbudget : (1 - q n) ^ 2 ≤ M ^ 2 / (n : ℝ) := by apply (le_div_iff₀ hnR).2 simpa only [mul_pow, Real.sq_sqrt hnR.le] using hsquare calc unrestrictedMinimaxRisk n d (q n) ≤ 4 / (n : ℝ) + (1 - q n) ^ 2 := upper n d hn1 hd _ ≤ 4 / (n : ℝ) + M ^ 2 / (n : ℝ) := add_le_add_right hbudget _ _ = (4 + M ^ 2) / (n : ℝ) := by rw [add_div] · rintro ⟨D, n₀, hD⟩ refine ⟨Real.sqrt (max (2048 * D) 0), max n₀ 1, Real.sqrt_nonneg _, ?_⟩ intro n hn have hn1 : 1 ≤ n := (le_max_right n₀ 1).trans hn have hnR : (0 : ℝ) < n := by exact_mod_cast hn1 have hsqrt : 0 < sqrt (n : ℝ) := Real.sqrt_pos.2 hnR have hbound := mul_le_mul_of_nonneg_left (hD n ((le_max_left n₀ 1).trans hn) _ (alphabet n hn1)) hnR.le have hcancel : (n : ℝ) * (D / (n : ℝ)) = D := by field_simp rw [hcancel] at hbound have hl := (large n hn1).trans hbound have hsq : (sqrt (n : ℝ) * (1 - q n)) ^ 2 = n * (1 - q n) ^ 2 := by rw [mul_pow, Real.sq_sqrt hnR.le] have hM : (sqrt (max (2048 * D) 0)) ^ 2 = max (2048 * D) 0 := Real.sq_sqrt (le_max_right _ _) have hscaled : (1 - q n) * sqrt (n : ℝ) ≤ sqrt (max (2048 * D) 0) := by have := le_max_left (2048 * D) (0 : ℝ) have := Real.sqrt_nonneg (max (2048 * D) 0) nlinarith [sq_nonneg (sqrt (n : ℝ) * (1 - q n) - sqrt (max (2048 * D) 0))] exact (le_div_iff₀ hsqrt).2 hscaled · intro n d hn hd exact (henv n d (q n) hn hd (hq n).1 (hq n).2).1 · intro hunbounded C by_contra hnot have hevent : ∀ᶠ n : ℕ in atTop, (n : ℝ) * unrestrictedMinimaxRisk n (1024 * n ^ 2) (q n) ≤ C := by simpa only [Frequently, not_not, not_lt] using hnot apply hunbounded apply Filter.IsBoundedUnder.bddAbove_range apply Filter.isBoundedUnder_of_eventually_le (a := sqrt (max (2048 * C) 0)) filter_upwards [hevent, eventually_ge_atTop (1 : ℕ)] with n hbound hn have hnR : (0 : ℝ) ≤ n := Nat.cast_nonneg n have hl := (large n hn).trans hbound have hsq : (sqrt (n : ℝ) * (1 - q n)) ^ 2 = n * (1 - q n) ^ 2 := by rw [mul_pow, Real.sq_sqrt hnR] have hM : (sqrt (max (2048 * C) 0)) ^ 2 = max (2048 * C) 0 := Real.sq_sqrt (le_max_right _ _) have := le_max_left (2048 * C) (0 : ℝ) have := Real.sqrt_nonneg (max (2048 * C) 0) nlinarith [sq_nonneg (sqrt (n : ℝ) * (1 - q n) - sqrt (max (2048 * C) 0))]
CausalSmith.Stat.MarRareqLogfrontier.unrestricted_uniform_near_complete_elbow · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/PUnrestrictedUniformNearCompleteElbow.lean:16
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.TConnectedIntervalFrontier 20 declarations TConnectedIntervalFrontier for the finite rare-arrival experiment.

TConnectedIntervalFrontier for the finite rare-arrival experiment.

theorem riskEnvelopeEndpoints_length_le

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q α :
ℝ
s :
Fin n → ObsRecord d
(riskEnvelopeEndpoints n d q α s).2 - (riskEnvelopeEndpoints n d q α s).1
≤ 2 * sqrt (riskEnvelope n d q / α)
Proof (Lean source)
lemma riskEnvelopeEndpoints_length_le (n d : ℕ) (q α : ℝ) (s : Fin n → ObsRecord d) : (riskEnvelopeEndpoints n d q α s).2 - (riskEnvelopeEndpoints n d q α s).1 ≤ 2 * sqrt (riskEnvelope n d q / α) := by unfold riskEnvelopeEndpoints have hlo := le_max_right (-1 : ℝ) (mixedCountEstimator n d q s - sqrt (riskEnvelope n d q / α)) have hhi := min_le_right (1 : ℝ) (mixedCountEstimator n d q s + sqrt (riskEnvelope n d q / α)) linarith
CausalSmith.Stat.MarRareqLogfrontier.riskEnvelopeEndpoints_length_le · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/TConnectedIntervalFrontier.lean:21
theorem riskEnvelopeInterval_contains_of_error_le

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q α :
ℝ
P :
s :
Fin n → ObsRecord d
herror :
|mixedCountEstimator n d q s - ate P| ≤ sqrt (riskEnvelope n d q / α)
ate P ∈ riskEnvelopeInterval n d q α s
Proof (Lean source)
lemma riskEnvelopeInterval_contains_of_error_le (n d : ℕ) (q α : ℝ) (P : FullLaw d) (s : Fin n → ObsRecord d) (herror : |mixedCountEstimator n d q s - ate P| ≤ sqrt (riskEnvelope n d q / α)) : ate P ∈ riskEnvelopeInterval n d q α s := by have htarget := ate_mem_unit_interval P rcases abs_le.mp herror with ⟨hlo, hhi⟩ simp only [riskEnvelopeInterval, riskEnvelopeEndpoints, Set.mem_Icc] at * constructor · exact max_le htarget.1 (by linarith) · exact le_min htarget.2 (by linarith)
CausalSmith.Stat.MarRareqLogfrontier.riskEnvelopeInterval_contains_of_error_le · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/TConnectedIntervalFrontier.lean:35
theorem riskEnvelopeInterval_contains_of_sq_error_le

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q α :
ℝ
P :
s :
Fin n → ObsRecord d
hratio :
0 ≤ riskEnvelope n d q / α
herror :
(mixedCountEstimator n d q s - ate P) ^ 2 ≤ riskEnvelope n d q / α
ate P ∈ riskEnvelopeInterval n d q α s
Proof (Lean source)
lemma riskEnvelopeInterval_contains_of_sq_error_le (n d : ℕ) (q α : ℝ) (P : FullLaw d) (s : Fin n → ObsRecord d) (hratio : 0 ≤ riskEnvelope n d q / α) (herror : (mixedCountEstimator n d q s - ate P) ^ 2 ≤ riskEnvelope n d q / α) : ate P ∈ riskEnvelopeInterval n d q α s := by apply riskEnvelopeInterval_contains_of_error_le have hsqrt : (sqrt (riskEnvelope n d q / α)) ^ 2 = riskEnvelope n d q / α := Real.sq_sqrt hratio have hnonneg := Real.sqrt_nonneg (riskEnvelope n d q / α) nlinarith [abs_nonneg (mixedCountEstimator n d q s - ate P), sq_abs (mixedCountEstimator n d q s - ate P)]
CausalSmith.Stat.MarRareqLogfrontier.riskEnvelopeInterval_contains_of_sq_error_le · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/TConnectedIntervalFrontier.lean:49
theorem riskEnvelopeInterval_coverage_of_positive_envelope

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q α :
ℝ
P :
hα :
0 < α
henv :
0 < riskEnvelope n d q
hrisk :
1 - α ≤ (sampleLaw n P).real {s | ate P ∈ riskEnvelopeInterval n d q α s}
Proof (Lean source)
lemma riskEnvelopeInterval_coverage_of_positive_envelope (n d : ℕ) (q α : ℝ) (P : FullLaw d) (hα : 0 < α) (henv : 0 < riskEnvelope n d q) (hrisk : deterministicRisk (mixedCountEstimator n d q) P ≤ riskEnvelope n d q) : 1 - α ≤ (sampleLaw n P).real {s | ate P ∈ riskEnvelopeInterval n d q α s} := by let μ := sampleLaw n P let f : (Fin n → ObsRecord d) → ℝ := fun s => (mixedCountEstimator n d q s - ate P) ^ 2 let t := riskEnvelope n d q / α letI : IsProbabilityMeasure P.1 := P.2 letI : IsProbabilityMeasure μ := by dsimp [μ, sampleLaw] letI : IsProbabilityMeasure (P.1.map obs) := Measure.isProbabilityMeasure_map (by fun_prop) infer_instance have ht : 0 < t := div_pos henv hα have hmarkov : t * μ.real {s | t ≤ f s} ≤ riskEnvelope n d q := by calc t * μ.real {s | t ≤ f s} ≤ ∫ s, f s ∂μ := mul_meas_ge_le_integral_of_nonneg (Filter.Eventually.of_forall fun s => sq_nonneg _) Integrable.of_finite t _ ≤ riskEnvelope n d q := hrisk let good : Set (Fin n → ObsRecord d) := {s | ate P ∈ riskEnvelopeInterval n d q α s} have hsubset : goodᶜ ⊆ {s | t ≤ f s} := by intro s hnotgood by_contra hlt have hsq : f s ≤ t := le_of_lt (lt_of_not_ge hlt) have hmem := riskEnvelopeInterval_contains_of_sq_error_le n d q α P s (le_of_lt ht) (by simpa [f, t] using hsq) exact hnotgood hmem have hbad : μ.real goodᶜ ≤ α := by have hmono := measureReal_mono (μ := μ) hsubset (measure_ne_top μ _) have hmul := mul_le_mul_of_nonneg_left hmono (le_of_lt ht) have hαne : α ≠ 0 := ne_of_gt hα have henvne : riskEnvelope n d q ≠ 0 := ne_of_gt henv dsimp [t] at hmul hmarkov have hprod : (riskEnvelope n d q / α) * α = riskEnvelope n d q := by field_simp nlinarith have hgood : MeasurableSet good := by classical have heq : ((fun s : Fin n → ObsRecord d => decide (s ∈ good)) ⁻¹' {true}) = good := by ext s simp rw [← heq] exact (measurable_of_finite (fun s : Fin n → ObsRecord d => decide (s ∈ good))) (measurableSet_singleton true) have htotal : μ.real goodᶜ = 1 - μ.real good := by simpa using (measureReal_compl (μ := μ) hgood) dsimp [μ, good] at * linarith
CausalSmith.Stat.MarRareqLogfrontier.riskEnvelopeInterval_coverage_of_positive_envelope · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/TConnectedIntervalFrontier.lean:64
theorem riskEnvelopeInterval_coverage

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q α :
ℝ
P :
hα :
0 < α
hrisk :
1 - α ≤ (sampleLaw n P).real {s | ate P ∈ riskEnvelopeInterval n d q α s}
Proof (Lean source)
lemma riskEnvelopeInterval_coverage (n d : ℕ) (q α : ℝ) (P : FullLaw d) (hα : 0 < α) (hrisk : deterministicRisk (mixedCountEstimator n d q) P ≤ riskEnvelope n d q) : 1 - α ≤ (sampleLaw n P).real {s | ate P ∈ riskEnvelopeInterval n d q α s} := by have henv_nonneg : 0 ≤ riskEnvelope n d q := by have hrisk_nonneg : 0 ≤ deterministicRisk (mixedCountEstimator n d q) P := by unfold deterministicRisk exact integral_nonneg (fun s => sq_nonneg _) exact hrisk_nonneg.trans hrisk rcases eq_or_lt_of_le henv_nonneg with hzero | hpos · let μ := sampleLaw n P let f : (Fin n → ObsRecord d) → ℝ := fun s => (mixedCountEstimator n d q s - ate P) ^ 2 letI : IsProbabilityMeasure P.1 := P.2 letI : IsProbabilityMeasure μ := by dsimp [μ, sampleLaw] letI : IsProbabilityMeasure (P.1.map obs) := Measure.isProbabilityMeasure_map (by fun_prop) infer_instance have hzero_integral : (∫ s, f s ∂μ) = 0 := by have hle : (∫ s, f s ∂μ) ≤ 0 := by simpa [deterministicRisk, μ, f, ← hzero] using hrisk exact le_antisymm hle (integral_nonneg (fun s => sq_nonneg _)) have hae : ∀ᵐ s ∂μ, f s = 0 := (integral_eq_zero_iff_of_nonneg (fun s => sq_nonneg (mixedCountEstimator n d q s - ate P)) Integrable.of_finite).mp hzero_integral let good : Set (Fin n → ObsRecord d) := {s | ate P ∈ riskEnvelopeInterval n d q α s} have hgood : MeasurableSet good := by classical have heq : ((fun s : Fin n → ObsRecord d => decide (s ∈ good)) ⁻¹' {true}) = good := by ext s simp rw [← heq] exact (measurable_of_finite (fun s : Fin n → ObsRecord d => decide (s ∈ good))) (measurableSet_singleton true) have hgoodae : ∀ᵐ s ∂μ, s ∈ good := by filter_upwards [hae] with s hs apply riskEnvelopeInterval_contains_of_sq_error_le n d q α P s · simp [← hzero] · simpa [f, ← hzero] using le_of_eq hs have hprob : μ good = 1 := (mem_ae_iff_prob_eq_one hgood).mp hgoodae have hreal : μ.real good = 1 := by simp [measureReal_def, hprob] change 1 - α ≤ μ.real good rw [hreal] linarith · exact riskEnvelopeInterval_coverage_of_positive_envelope n d q α P hα hpos hrisk
CausalSmith.Stat.MarRareqLogfrontier.riskEnvelopeInterval_coverage · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/TConnectedIntervalFrontier.lean:122
theorem riskEnvelopeEndpoints_risk_le

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q α :
ℝ
P :
Proof (Lean source)
lemma riskEnvelopeEndpoints_risk_le (n d : ℕ) (q α : ℝ) (P : FullLaw d) : deterministicIntervalRisk (riskEnvelopeEndpoints n d q α) P ≤ 2 * sqrt (riskEnvelope n d q / α) := by letI : IsProbabilityMeasure P.1 := P.2 letI : IsProbabilityMeasure (sampleLaw n P) := by unfold sampleLaw letI : IsProbabilityMeasure (P.1.map obs) := Measure.isProbabilityMeasure_map (by fun_prop : AEMeasurable obs P.1) infer_instance unfold deterministicIntervalRisk have hint : Integrable (fun s : Fin n → ObsRecord d => (riskEnvelopeEndpoints n d q α s).2 - (riskEnvelopeEndpoints n d q α s).1) (sampleLaw n P) := Integrable.of_finite have h := integral_mono hint (integrable_const _) (fun s => riskEnvelopeEndpoints_length_le n d q α s) simpa using h
CausalSmith.Stat.MarRareqLogfrontier.riskEnvelopeEndpoints_risk_le · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/TConnectedIntervalFrontier.lean:178
theorem riskEnvelope_interval_upper

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
α :
ℝ
hα :
0 < α
∃ C : ℝ,
0 < C
conclusion 1
n d :
ℕ
q :
ℝ
P :
Proof (Lean source)
lemma riskEnvelope_interval_upper (α : ℝ) (hα : 0 < α) : ∃ C : ℝ, 0 < C ∧ ∀ (n d : ℕ) (q : ℝ) (P : FullLaw d), RareArrivalModelClass n d q P → deterministicIntervalRisk (riskEnvelopeEndpoints n d q α) P ≤ C * sqrt (frontierRate n d q) := by obtain ⟨C₀, hC₀, hupper⟩ := mixed_count_upper refine ⟨2 * sqrt (C₀ / α), by positivity, ?_⟩ intro n d q P hP have henv : riskEnvelope n d q ≤ C₀ * frontierRate n d q := (hupper n d q P hP).2.1 calc deterministicIntervalRisk (riskEnvelopeEndpoints n d q α) P ≤ 2 * sqrt (riskEnvelope n d q / α) := riskEnvelopeEndpoints_risk_le n d q α P _ ≤ 2 * sqrt (C₀ * frontierRate n d q / α) := by gcongr _ = 2 * sqrt (C₀ / α) * sqrt (frontierRate n d q) := by rw [show C₀ * frontierRate n d q / α = (C₀ / α) * frontierRate n d q by ring] rw [Real.sqrt_mul (by positivity : 0 ≤ C₀ / α)] ring
CausalSmith.Stat.MarRareqLogfrontier.riskEnvelope_interval_upper · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/TConnectedIntervalFrontier.lean:200
theorem riskEnvelope_interval_worst_upper

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
α :
ℝ
hα :
0 < α
∃ C : ℝ,
0 < C
conclusion 1
n d :
ℕ
q :
ℝ
1 ≤ n
1 ≤ d
0 < q
≤ C * sqrt (frontierRate n d q)
Proof (Lean source)
lemma riskEnvelope_interval_worst_upper (α : ℝ) (hα : 0 < α) : ∃ C : ℝ, 0 < C ∧ ∀ (n d : ℕ) (q : ℝ), 1 ≤ n → 1 ≤ d → 0 < q → Causalean.Stat.worstCaseRiskReal (fun (_ : Unit) (P : {P : FullLaw d // RareArrivalModelClass n d q P}) => deterministicIntervalRisk (riskEnvelopeEndpoints n d q α) P.1) () ≤ C * sqrt (frontierRate n d q) := by obtain ⟨C, hC, hbound⟩ := riskEnvelope_interval_upper α hα refine ⟨C, hC, ?_⟩ intro n d q hn hd hq unfold Causalean.Stat.worstCaseRiskReal by_cases hne : Nonempty {P : FullLaw d // RareArrivalModelClass n d q P} · letI := hne exact ciSup_le (fun P => hbound n d q P.1 P.2) · haveI : IsEmpty {P : FullLaw d // RareArrivalModelClass n d q P} := not_nonempty_iff.mp hne simp have hN : 0 < effectiveSize n q := by unfold effectiveSize positivity have hrate : 0 ≤ frontierRate n d q := by unfold frontierRate exact le_min (by norm_num) (by positivity) positivity
CausalSmith.Stat.MarRareqLogfrontier.riskEnvelope_interval_worst_upper · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/TConnectedIntervalFrontier.lean:225
def riskEnvelope_connectedInterval

For the specified inputs and assumptions, the object defined here is the quantity, rule, or mathematical structure specified by this declaration.

Definition (Lean source)
n d :
ℕ
q α :
ℝ
s :
Fin n → ObsRecord d
riskEnvelope_connectedInterval n d q α s :
by let e := riskEnvelopeEndpoints n d q α s have hc := (mixed_count_estimator_regular n d q).2 s have hr : 0
≤ sqrt (riskEnvelope n d q / α) := Real.sqrt_nonneg _ have hlo : -1 ≤ e.1 := by dsimp [e, riskEnvelopeEndpoints] exact le_max_left _ _ have hhi : e.2 ≤ 1 := by dsimp [e, riskEnvelopeEndpoints] exact min_le_left _ _ have horder : e.1 ≤ e.2 := by dsimp [e, riskEnvelopeEndpoints] apply le_min · exact max_le (by norm_num) (by linarith [hc.2]) · exact max_le (by linarith [hc.1]) (by linarith) exact ⟨(e.1, e.2), hlo, horder, hhi⟩
CausalSmith.Stat.MarRareqLogfrontier.riskEnvelope_connectedInterval · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/TConnectedIntervalFrontier.lean:252
theorem riskEnvelope_connectedInterval_contains

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q α t :
ℝ
s :
Fin n → ObsRecord d
Proof (Lean source)
CausalSmith.Stat.MarRareqLogfrontier.riskEnvelope_connectedInterval_contains · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/TConnectedIntervalFrontier.lean:272
theorem riskEnvelope_connectedInterval_length

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q α :
ℝ
s :
Fin n → ObsRecord d
Proof (Lean source)
lemma riskEnvelope_connectedInterval_length (n d : ℕ) (q α : ℝ) (s : Fin n → ObsRecord d) : (riskEnvelope_connectedInterval n d q α s).hi - (riskEnvelope_connectedInterval n d q α s).lo = (riskEnvelopeEndpoints n d q α s).2 - (riskEnvelopeEndpoints n d q α s).1 := rfl
CausalSmith.Stat.MarRareqLogfrontier.riskEnvelope_connectedInterval_length · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/TConnectedIntervalFrontier.lean:280
theorem riskEnvelope_honestInterval Lemma riskEnvelope_honestInterval in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q α :
ℝ
hα :
0 < α
HonestInterval n d q α ⟨Kernel.deterministic (riskEnvelope_connectedInterval n d q α) (measurable_of_finite _), inferInstance⟩
Proof (Lean source)
lemma riskEnvelope_honestInterval (n d : ℕ) (q α : ℝ) (hα : 0 < α) : HonestInterval n d q α ⟨Kernel.deterministic (riskEnvelope_connectedInterval n d q α) (measurable_of_finite _), inferInstance⟩ := by intro P hP obtain ⟨C, hC, hupper⟩ := mixed_count_upper have hrisk := hupper n d q P hP have hcoverage := riskEnvelopeInterval_coverage n d q α P hα hrisk.1 let f := riskEnvelope_connectedInterval n d q α let μ := sampleLaw n P let good : Set (Fin n → ObsRecord d) := {s | ate P ∈ riskEnvelopeInterval n d q α s} have hgood : MeasurableSet good := by exact MeasurableSet.of_discrete have heq (s : Fin n → ObsRecord d) : (Kernel.deterministic f (measurable_of_finite _) s).real {I | intervalContains I (ate P)} = good.indicator (fun _ => (1 : ℝ)) s := by have hset : MeasurableSet {I : ConnectedInterval | intervalContains I (ate P)} := by unfold intervalContains have hlo : Measurable (fun I : ConnectedInterval => I.lo) := measurable_connectedInterval_lo have hhi : Measurable (fun I : ConnectedInterval => I.hi) := measurable_connectedInterval_hi have hleft : Measurable (fun I : ConnectedInterval => I.closedLeft) := measurable_const have hright : Measurable (fun I : ConnectedInterval => I.closedRight) := measurable_const have hseteq : {I : ConnectedInterval | (if I.closedLeft = true then I.lo ≤ ate P else I.lo < ate P) ∧ (if I.closedRight = true then ate P ≤ I.hi else ate P < I.hi)} = (({I | I.closedLeft = true} ∩ {I | I.lo ≤ ate P}) ∪ ({I | I.closedLeft = false} ∩ {I | I.lo < ate P})) ∩ (({I | I.closedRight = true} ∩ {I | ate P ≤ I.hi}) ∪ ({I | I.closedRight = false} ∩ {I | ate P < I.hi})) := by ext I by_cases hl : I.closedLeft = true <;> by_cases hr : I.closedRight = true <;> simp [hl, hr] rw [hseteq] measurability rw [Kernel.deterministic_apply, Measure.real, Measure.dirac_apply' _ hset] by_cases hmem : ate P ∈ riskEnvelopeInterval n d q α s <;> simp [good, f, indicator, riskEnvelope_connectedInterval_contains, hmem] change 1 - α ≤ ∫ s, (Kernel.deterministic f (measurable_of_finite _) s).real {I | intervalContains I (ate P)} ∂μ simp_rw [heq] rw [integral_indicator_const _ hgood] simpa [μ, good] using hcoverage
CausalSmith.Stat.MarRareqLogfrontier.riskEnvelope_honestInterval · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/TConnectedIntervalFrontier.lean:288
theorem intervalLengthRisk_le_riskEnvelope_worst

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q α :
ℝ
hα :
0 < α
≤ worstCaseRiskReal (fun (_ : Unit) (P : {P : FullLaw d // RareArrivalModelClass n d q P}) => deterministicIntervalRisk (riskEnvelopeEndpoints n d q α) P.1) ()
Proof (Lean source)
lemma intervalLengthRisk_le_riskEnvelope_worst (n d : ℕ) (q α : ℝ) (hα : 0 < α) : intervalLengthRisk n d q α ≤ worstCaseRiskReal (fun (_ : Unit) (P : {P : FullLaw d // RareArrivalModelClass n d q P}) => deterministicIntervalRisk (riskEnvelopeEndpoints n d q α) P.1) () := by let f := riskEnvelope_connectedInterval n d q α let T : IntervalProcedure n d := IntervalProcedure.ofMap f (measurable_of_finite _) let H : {T : IntervalProcedure n d // HonestInterval n d q α T} := ⟨T, riskEnvelope_honestInterval n d q α hα⟩ have hrisk : ∀ (T : {T : IntervalProcedure n d // HonestInterval n d q α T}) (P : {P : FullLaw d // RareArrivalModelClass n d q P}), 0 ≤ intervalRisk T.1 P.1 := by intro T P exact integral_nonneg (fun s => integral_nonneg (fun I => sub_nonneg.mpr I.ordered)) have hval := minimaxValue_le_worstCaseRisk_of_nonneg hrisk H change intervalLengthRisk n d q α ≤ worstCaseRiskReal (fun (_ : Unit) (P : {P : FullLaw d // RareArrivalModelClass n d q P}) => intervalRisk H.1 P.1) () at hval have heq : (fun (_ : Unit) (P : {P : FullLaw d // RareArrivalModelClass n d q P}) => intervalRisk H.1 P.1) = (fun (_ : Unit) P => deterministicIntervalRisk (riskEnvelopeEndpoints n d q α) P.1) := by funext _ P unfold intervalRisk deterministicIntervalRisk congr 1 funext s change (∫ I : ConnectedInterval, I.hi - I.lo ∂(Kernel.deterministic f (measurable_of_finite _) s)) = (riskEnvelopeEndpoints n d q α s).2 - (riskEnvelopeEndpoints n d q α s).1 have hlo : Measurable (fun I : ConnectedInterval => I.lo) := measurable_connectedInterval_lo have hhi : Measurable (fun I : ConnectedInterval => I.hi) := measurable_connectedInterval_hi have hmeas : StronglyMeasurable (fun I : ConnectedInterval => I.hi - I.lo) := (hhi.sub hlo).stronglyMeasurable rw [Kernel.deterministic_apply, integral_dirac' _ _ hmeas] exact riskEnvelope_connectedInterval_length n d q α s rw [heq] at hval exact hval
CausalSmith.Stat.MarRareqLogfrontier.intervalLengthRisk_le_riskEnvelope_worst · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/TConnectedIntervalFrontier.lean:342
theorem connectedInterval_grid_neighborhood_length

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
s :
Finset ℕ
θ δ w :
ℝ
hδ :
0 ≤ δ
hw :
0 ≤ w
hmeet :
∀ i ∈ s, ∃ x : ℝ, I.lo ≤ x ∧ x ≤ I.hi ∧ |x - (θ + (i : ℝ) * δ)| ≤ w
((s.card : ℝ) - 1) * δ - 2 * w ≤ I.hi - I.lo
Proof (Lean source)
-- @node: connectedInterval_grid_neighborhood_length lemma connectedInterval_grid_neighborhood_length (I : ConnectedInterval) (s : Finset ℕ) (θ δ w : ℝ) (hδ : 0 ≤ δ) (hw : 0 ≤ w) (hmeet : ∀ i ∈ s, ∃ x : ℝ, I.lo ≤ x ∧ x ≤ I.hi ∧ |x - (θ + (i : ℝ) * δ)| ≤ w) : ((s.card : ℝ) - 1) * δ - 2 * w ≤ I.hi - I.lo := by classical obtain hs | hs := s.eq_empty_or_nonempty · subst s simp only [Finset.card_empty, Nat.cast_zero] have hlen := I.ordered nlinarith · have hsub : s ⊆ Icc (s.min' hs) (s.max' hs) := by intro i hi exact Finset.mem_Icc.mpr ⟨s.min'_le i hi, s.le_max' i hi⟩ have hcard := Finset.card_le_card hsub rw [Nat.card_Icc] at hcard have hminmax := s.min'_le_max' hs have hspan : s.card + s.min' hs ≤ s.max' hs + 1 := by omega have hspanR : (s.card : ℝ) - 1 ≤ (s.max' hs : ℝ) - (s.min' hs : ℝ) := by exact_mod_cast (show (s.card : ℤ) - 1 ≤ (s.max' hs : ℤ) - (s.min' hs : ℤ) by omega) obtain ⟨x, hxlo, hxhi, hx⟩ := hmeet (s.min' hs) (s.min'_mem hs) obtain ⟨y, hylo, hyhi, hy⟩ := hmeet (s.max' hs) (s.max'_mem hs) have hx' := (abs_le.mp hx).2 have hy' := (abs_le.mp hy).1 have hmul := mul_le_mul_of_nonneg_right hspanR hδ nlinarith
CausalSmith.Stat.MarRareqLogfrontier.connectedInterval_grid_neighborhood_length · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/TConnectedIntervalFrontier.lean:389
theorem connectedInterval_expected_grid_neighborhood_length

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
θ δ w :
ℝ
hδ :
0 ≤ δ
hw :
0 ≤ w
hcount :
Integrable (fun I => (s I).card : ConnectedInterval → ℝ) ν
hmeet :
∀ I i
if
i ∈ s I
then
∃ x : ℝ, I.lo ≤ x ∧ x ≤ I.hi ∧ |x - (θ + (i : ℝ) * δ)| ≤ w
((∫ I, ((s I).card : ℝ) ∂ν) - 1) * δ - 2 * w ≤ ∫ I, I.hi - I.lo ∂ν
Proof (Lean source)
-- @node: connectedInterval_expected_grid_neighborhood_length lemma connectedInterval_expected_grid_neighborhood_length (ν : Measure ConnectedInterval) [IsProbabilityMeasure ν] (s : ConnectedInterval → Finset ℕ) (θ δ w : ℝ) (hδ : 0 ≤ δ) (hw : 0 ≤ w) (hcount : Integrable (fun I => (s I).card : ConnectedInterval → ℝ) ν) (hmeet : ∀ I i, i ∈ s I → ∃ x : ℝ, I.lo ≤ x ∧ x ≤ I.hi ∧ |x - (θ + (i : ℝ) * δ)| ≤ w) : ((∫ I, ((s I).card : ℝ) ∂ν) - 1) * δ - 2 * w ≤ ∫ I, I.hi - I.lo ∂ν := by have hmeas : Measurable (fun I : ConnectedInterval => I.hi - I.lo) := by fun_prop have hlen : Integrable (fun I : ConnectedInterval => I.hi - I.lo) ν := Integrable.of_bound hmeas.aestronglyMeasurable 2 (Filter.Eventually.of_forall (fun I => by rw [Real.norm_eq_abs, abs_of_nonneg (sub_nonneg.mpr I.ordered)] linarith [I.lower, I.upper])) have hleft : Integrable (fun I => (((s I).card : ℝ) - 1) * δ - 2 * w) ν := ((hcount.sub (integrable_const 1)).mul_const δ).sub (integrable_const (2 * w)) have hbound := integral_mono hleft hlen (fun I => connectedInterval_grid_neighborhood_length I (s I) θ δ w hδ hw (hmeet I)) have heq : (∫ I, (((s I).card : ℝ) - 1) * δ - 2 * w ∂ν) = ((∫ I, ((s I).card : ℝ) ∂ν) - 1) * δ - 2 * w := by integral_linearity simp rw [heq] at hbound exact hbound
CausalSmith.Stat.MarRareqLogfrontier.connectedInterval_expected_grid_neighborhood_length · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/TConnectedIntervalFrontier.lean:420
theorem frontier_min_sum_le_twice_max Lemma frontier_min_sum_le_twice_max in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
a b :
ℝ
min 1 (a + b) ≤ 2 * max (min 1 a) (min 1 b)
Proof (Lean source)
lemma frontier_min_sum_le_twice_max (a b : ℝ) : min 1 (a + b) ≤ 2 * max (min 1 a) (min 1 b) := by by_cases ha1 : a ≤ 1 · by_cases hb1 : b ≤ 1 · simp only [min_eq_right ha1, min_eq_right hb1] by_cases hab : a ≤ b · rw [max_eq_right hab] exact (min_le_right _ _).trans (by linarith) · rw [max_eq_left (le_of_not_ge hab)] exact (min_le_right _ _).trans (by linarith) · have hb1' : 1 ≤ b := le_of_not_ge hb1 rw [min_eq_left hb1', max_eq_right (by simpa [min_eq_right ha1] using ha1)] exact le_trans (min_le_left _ _) (by norm_num) · have ha1' : 1 ≤ a := le_of_not_ge ha1 rw [min_eq_left ha1'] exact le_trans (min_le_left _ _) (by have hmax : 1 ≤ max (1 : ℝ) (min 1 b) := le_max_left _ _ linarith)
CausalSmith.Stat.MarRareqLogfrontier.frontier_min_sum_le_twice_max · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/TConnectedIntervalFrontier.lean:451
theorem frontierRate_le_two_lower_scales

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
≤ 2 * max (min 1 (effectiveSize n q)⁻¹) (min 1 (((d : ℝ) / (effectiveSize n q * logScale n q)) ^ 2))
Proof (Lean source)
lemma frontierRate_le_two_lower_scales (n d : ℕ) (q : ℝ) : frontierRate n d q ≤ 2 * max (min 1 (effectiveSize n q)⁻¹) (min 1 (((d : ℝ) / (effectiveSize n q * logScale n q)) ^ 2)) := by unfold frontierRate exact frontier_min_sum_le_twice_max _ _
CausalSmith.Stat.MarRareqLogfrontier.frontierRate_le_two_lower_scales · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/TConnectedIntervalFrontier.lean:472

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
x :
ℝ
sqrt (min 1 x) = min 1 (sqrt x)
Proof (Lean source)
-- @node: frontier_sqrt_min_one lemma frontier_sqrt_min_one (x : ℝ) : sqrt (min 1 x) = min 1 (sqrt x) := by by_cases hx : x ≤ 1 · rw [min_eq_right hx, min_eq_right (Real.sqrt_le_one.mpr hx)] · have hx' : 1 ≤ x := le_of_not_ge hx have hs : 1 ≤ sqrt x := by simpa using Real.sqrt_le_sqrt hx' rw [min_eq_left hx', min_eq_left hs, Real.sqrt_one]
CausalSmith.Stat.MarRareqLogfrontier.frontier_sqrt_min_one · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/TConnectedIntervalFrontier.lean:480
theorem frontier_interval_lower_of_two_scales

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q c L :
ℝ
hc :
0 ≤ c
hparam :
c * sqrt (min 1 (effectiveSize n q)⁻¹) ≤ L
hmany :
c * sqrt (min 1 (((d : ℝ) / (effectiveSize n q * logScale n q)) ^ 2)) ≤ L
hN :
0 ≤ effectiveSize n q
(c / 2) * sqrt (frontierRate n d q) ≤ L
Proof (Lean source)
-- @node: frontier_interval_lower_of_two_scales lemma frontier_interval_lower_of_two_scales (n d : ℕ) (q c L : ℝ) (hc : 0 ≤ c) (hparam : c * sqrt (min 1 (effectiveSize n q)⁻¹) ≤ L) (hmany : c * sqrt (min 1 (((d : ℝ) / (effectiveSize n q * logScale n q)) ^ 2)) ≤ L) (hN : 0 ≤ effectiveSize n q) : (c / 2) * sqrt (frontierRate n d q) ≤ L := by let A := min 1 (effectiveSize n q)⁻¹ let B := min 1 (((d : ℝ) / (effectiveSize n q * logScale n q)) ^ 2) have hA : 0 ≤ A := le_min (by norm_num) (inv_nonneg.mpr hN) have hmax : 0 ≤ max A B := hA.trans (le_max_left _ _) have hboth : c * sqrt (max A B) ≤ L := by rcases le_total A B with h | h · simpa [max_eq_right h, B] using hmany · simpa [max_eq_left h, A] using hparam have hrate := frontierRate_le_two_lower_scales n d q have hs : sqrt (frontierRate n d q) ≤ 2 * sqrt (max A B) := by apply Real.sqrt_le_iff.mpr refine ⟨by positivity, ?_⟩ have hsq := Real.sq_sqrt hmax change frontierRate n d q ≤ 2 * max A B at hrate nlinarith have hmul := mul_le_mul_of_nonneg_left hs hc linarith
CausalSmith.Stat.MarRareqLogfrontier.frontier_interval_lower_of_two_scales · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/TConnectedIntervalFrontier.lean:491
theorem connected_interval_frontier

At every admissible miscoverage level, connected randomized intervals attain matching frontier bounds.

Formal statement
α :
ℝ
shared
α :
ℝ
0 < α
α < 1
∃ c C : ℝ,
0 < c
c ≤ C
conclusion 1
n d :
ℕ
q :
ℝ
1 ≤ n
1 ≤ d
0 < q
q ≤ 1
c * sqrt (frontierRate n d q) ≤ intervalLengthRisk n d q α
≤ worstCaseRiskReal (fun (_ : Unit) (P : {P : FullLaw d // RareArrivalModelClass n d q P}) => deterministicIntervalRisk (riskEnvelopeEndpoints n d q α) P.1) ()
≤ C * sqrt (frontierRate n d q)
1 - α ≤ (sampleLaw n P).real {s | ate P ∈ riskEnvelopeInterval n d q α s}
Proof (Lean source)
theorem connected_interval_frontier : ∀ α : ℝ, 0 < α → α < 1 → -- @realizes \(\alpha\)(miscoverage level) -- @realizes \(\underline c_\alpha\)(positive interval lower constant) ∃ c C : ℝ, 0 < c ∧ c ≤ C ∧ -- @realizes \(\overline C_\alpha\)(interval upper constant) ∀ (n d : ℕ) (q : ℝ), 1 ≤ n → 1 ≤ d → 0 < q → q ≤ 1 → RareArrivalSlice n q → c * sqrt (frontierRate n d q) ≤ intervalLengthRisk n d q α ∧ intervalLengthRisk n d q α ≤ worstCaseRiskReal (fun (_ : Unit) (P : {P : FullLaw d // RareArrivalModelClass n d q P}) => deterministicIntervalRisk (riskEnvelopeEndpoints n d q α) P.1) () ∧ worstCaseRiskReal (fun (_ : Unit) (P : {P : FullLaw d // RareArrivalModelClass n d q P}) => deterministicIntervalRisk (riskEnvelopeEndpoints n d q α) P.1) () ≤ C * sqrt (frontierRate n d q) ∧ (∀ P : FullLaw d, RareArrivalModelClass n d q P → 1 - α ≤ (sampleLaw n P).real {s | ate P ∈ riskEnvelopeInterval n d q α s}) := by intro α hα hα1 obtain ⟨C, hC, hUpper⟩ := riskEnvelope_interval_worst_upper α hα obtain ⟨c₀, hc₀, hLower⟩ : ∃ c₀ : ℝ, 0 < c₀ ∧ ∀ (n d : ℕ) (q : ℝ), 1 ≤ n → 1 ≤ d → 0 < q → q ≤ 1 → RareArrivalSlice n q → c₀ * sqrt (frontierRate n d q) ≤ intervalLengthRisk n d q α := by obtain ⟨c₁, hc₁, hMany⟩ : ∃ c₁ : ℝ, 0 < c₁ ∧ ∀ (n d : ℕ) (q : ℝ), 1 ≤ n → 1 ≤ d → 0 < q → q ≤ 1 → RareArrivalSlice n q → c₁ * sqrt (min 1 (((d : ℝ) / (effectiveSize n q * logScale n q)) ^ 2)) ≤ intervalLengthRisk n d q α := by let η := exp (-32) obtain ⟨T, D, cAct, hT, hD, hcAct, hActivated⟩ : ∃ (T : ℝ) (D : ℕ) (cAct : ℝ), 1 ≤ T ∧ 1 ≤ D ∧ 0 < cAct ∧ ∀ (n d : ℕ) (q : ℝ), 1 ≤ n → 1 ≤ d → 0 < q → q ≤ 1 → RareArrivalSlice n q → T ≤ effectiveSize n q → (D : ℝ) ≤ (2 * rareMass η n q)⁻¹ ∧ (D ≤ rareCount η n d q → cAct * min 1 ((d : ℝ) / (effectiveSize n q * logScale n q)) ≤ intervalLengthRisk n d q α) := by exact interval_activated_large_regime α hα.le hα1 let cP := 3 * (1 - α) ^ 2 / 512 have hcP : 0 < cP := by dsimp [cP]; positivity refine ⟨min cAct (min (cP * min 1 (sqrt T)⁻¹) (cP / D)), by positivity, ?_⟩ intro n d q hn hd hq hq1 hslice have hN : 0 < effectiveSize n q := by unfold effectiveSize; positivity have hell : 1 ≤ logScale n q := by unfold logScale have h := Real.log_le_log (Real.exp_pos (1 : ℝ)) (show exp 1 ≤ exp 1 + effectiveSize n q by linarith) simpa using h obtain ⟨M, grid, hM, hinj, hgrid, -, hfloor⟩ := oneCell_interval_minimax_floor q α hn hd hq hq1 hslice hα hα1 rw [interval_many_scale_sqrt n d q hN (by linarith)] apply interval_many_scale_of_large_regime η T cP cAct D hT hD hcP hcAct n d q (intervalLengthRisk n d q α) hd hN hell hfloor · intro hNT exact (hActivated n d q hn hd hq hq1 hslice hNT).1 · intro hNT hJ exact (hActivated n d q hn hd hq hq1 hslice hNT).2 hJ let cParam := 3 * (1 - α) ^ 2 / 512 have hcParam : 0 < cParam := by dsimp [cParam]; positivity refine ⟨min cParam c₁ / 2, by positivity, ?_⟩ intro n d q hn hd hq hq1 hslice obtain ⟨M, grid, hM, hinj, hgrid, -, hfloor⟩ := oneCell_interval_minimax_floor q α hn hd hq hq1 hslice hα hα1 apply frontier_interval_lower_of_two_scales n d q (min cParam c₁) _ (le_of_lt (lt_min hcParam hc₁)) · rw [frontier_sqrt_min_one, Real.sqrt_inv] exact (mul_le_mul_of_nonneg_right (min_le_left cParam c₁) (le_min (by norm_num) (by positivity))).trans hfloor · exact (mul_le_mul_of_nonneg_right (min_le_right cParam c₁) (Real.sqrt_nonneg _)).trans (hMany n d q hn hd hq hq1 hslice) · unfold effectiveSize positivity refine ⟨min c₀ C, C, lt_min hc₀ hC, min_le_right _ _, ?_⟩ intro n d q hn hd hq hq1 hslice refine ⟨?_, intervalLengthRisk_le_riskEnvelope_worst n d q α hα, hUpper n d q hn hd hq, ?_⟩ · exact (mul_le_mul_of_nonneg_right (min_le_left c₀ C) (Real.sqrt_nonneg _)).trans (hLower n d q hn hd hq hq1 hslice) · intro P hP obtain ⟨C', hC', hMixed⟩ := mixed_count_upper have hrisk := hMixed n d q P hP exact riskEnvelopeInterval_coverage n d q α P hα hrisk.1
CausalSmith.Stat.MarRareqLogfrontier.connected_interval_frontier · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/TConnectedIntervalFrontier.lean:519
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.TFullExperimentLower 2 declarations TFullExperimentLower for the finite rare-arrival experiment.

TFullExperimentLower for the finite rare-arrival experiment.

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
a b :
ℝ
ha :
0 ≤ a
hb :
0 ≤ b
min 1 (a + b) ≤ min 1 a + min 1 b
Proof (Lean source)
lemma frontier_min_sum_le (a b : ℝ) (ha : 0 ≤ a) (hb : 0 ≤ b) : min 1 (a + b) ≤ min 1 a + min 1 b := by rcases le_total a 1 with ha1 | ha1 · rcases le_total b 1 with hb1 | hb1 · simpa [min_eq_right ha1, min_eq_right hb1] using (min_le_right (1 : ℝ) (a + b)) · rw [min_eq_right ha1, min_eq_left hb1] have : 0 ≤ a := ha exact (min_le_left _ _).trans (by linarith) · rw [min_eq_left ha1] have : 0 ≤ min 1 b := le_min (by norm_num) hb exact (min_le_left _ _).trans (by linarith)
CausalSmith.Stat.MarRareqLogfrontier.frontier_min_sum_le · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/TFullExperimentLower.lean:14
theorem full_experiment_lower

the stated mathematical conclusion holds.

Formal statement
∃ c : ℝ,
0 < c
conclusion 1
n d :
ℕ
q :
ℝ
1 ≤ n
1 ≤ d
0 < q
q ≤ 1
c * frontierRate n d q ≤ minimaxRisk n d q
Proof (Lean source)
theorem full_experiment_lower : ∃ c : ℝ, 0 < c ∧ -- @realizes \(\underline c\)(universal lower constant) ∀ (n d : ℕ) (q : ℝ), 1 ≤ n → 1 ≤ d → 0 < q → q ≤ 1 → RareArrivalSlice n q → c * frontierRate n d q ≤ minimaxRisk n d q := by obtain ⟨c₀, cInterval, hc₀, -, hOne⟩ := one_cell_testing_family obtain ⟨c₁, hc₁, hMany⟩ := activated_fuzzy_lower refine ⟨min c₀ c₁ / 4, by positivity, ?_⟩ intro n d q hn hd hq hq1 hslice obtain ⟨_, hBern, hPoint, _⟩ := hOne n d q hn hd hq hq1 hslice obtain ⟨_, _, _, _, _, hRiskOne⟩ := hPoint let N := effectiveSize n q let L := logScale n q let a := N⁻¹ let b := ((d : ℝ) / (N * L)) ^ 2 have hN : 0 < N := by dsimp [N, effectiveSize] positivity have hL : 1 ≤ L := by change 1 ≤ log (exp 1 + N) rw [Real.le_log_iff_exp_le (by positivity)] linarith have ha : 0 ≤ a := by dsimp [a]; positivity have hb : 0 ≤ b := sq_nonneg _ have hOne' : c₀ * min 1 a ≤ minimaxRisk n d q := hRiskOne.2 have hMany' : sqrt N ≤ d → c₁ * min 1 b ≤ minimaxRisk n d q := by intro h exact hMany n d q hn hd hq hq1 hslice h have hr : frontierRate n d q = min 1 (a + b) := rfl rw [hr] by_cases hdim : sqrt N ≤ d · have hbRisk := hMany' hdim have hmin := frontier_min_sum_le a b ha hb have hmax : min 1 a ≤ max (min 1 a) (min 1 b) := le_max_left _ _ have hmax' : min 1 b ≤ max (min 1 a) (min 1 b) := le_max_right _ _ have hc : 0 < min c₀ c₁ := lt_min hc₀ hc₁ have h₀ : min c₀ c₁ ≤ c₀ := min_le_left _ _ have h₁ : min c₀ c₁ ≤ c₁ := min_le_right _ _ have hma : 0 ≤ min 1 a := le_min (by norm_num) ha have hmb : 0 ≤ min 1 b := le_min (by norm_num) hb have hca := mul_nonneg (sub_nonneg.mpr h₀) hma have hcb := mul_nonneg (sub_nonneg.mpr h₁) hmb have hbound := mul_le_mul_of_nonneg_left hmin (by positivity : 0 ≤ min c₀ c₁ / 4) nlinarith · have hdim' : (d : ℝ) ≤ sqrt N := le_of_not_ge hdim have hN0 : 0 ≤ N := le_of_lt hN have hsqrt := Real.sq_sqrt hN0 have hden : 0 < N * L := mul_pos hN (by linarith) have hb_le : b ≤ a := by dsimp [a, b] have hd0 : 0 ≤ (d : ℝ) := Nat.cast_nonneg _ have hs0 : 0 ≤ sqrt N := Real.sqrt_nonneg _ have hsq : ((d : ℝ) : ℝ) ^ 2 ≤ N := by nlinarith have hNL : 0 < N * L := hden rw [div_pow] apply (div_le_iff₀ (pow_pos hNL 2)).2 have hL2 : 1 ≤ L ^ 2 := by nlinarith have heq : N⁻¹ * (N * L) ^ 2 = N * L ^ 2 := by field_simp [ne_of_gt hN] rw [heq] nlinarith [mul_nonneg hN0 (sub_nonneg.mpr hL2)] have hminb : min 1 b ≤ min 1 a := min_le_min_left 1 hb_le have hmin := frontier_min_sum_le a b ha hb have h₀ : min c₀ c₁ ≤ c₀ := min_le_left _ _ have hma : 0 ≤ min 1 a := le_min (by norm_num) ha have hca := mul_nonneg (sub_nonneg.mpr h₀) hma have hbound := mul_le_mul_of_nonneg_left hmin (by positivity : 0 ≤ min c₀ c₁ / 4) have hcb := mul_le_mul_of_nonneg_left hminb (by positivity : 0 ≤ min c₀ c₁ / 4) nlinarith
CausalSmith.Stat.MarRareqLogfrontier.full_experiment_lower · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/TFullExperimentLower.lean:29
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.TMatchedMinimaxFrontier 1 declarations TMatchedMinimaxFrontier for the finite rare-arrival experiment.

TMatchedMinimaxFrontier for the finite rare-arrival experiment.

theorem matched_minimax_frontier

the stated mathematical conclusion holds.

Formal statement
∃ c C : ℝ,
0 < c
c ≤ C
conclusion 1
n d :
ℕ
q :
ℝ
1 ≤ n
1 ≤ d
0 < q
q ≤ 1
c * frontierRate n d q ≤ minimaxRisk n d q
minimaxRisk n d q ≤ C * frontierRate n d q
Proof (Lean source)
theorem matched_minimax_frontier : -- @realizes \(\underline c\)(lower constant) ∃ c C : ℝ, 0 < c ∧ c ≤ C ∧ -- @realizes \(\overline C\)(upper constant) ∀ (n d : ℕ) (q : ℝ), 1 ≤ n → 1 ≤ d → 0 < q → q ≤ 1 → RareArrivalSlice n q → c * frontierRate n d q ≤ minimaxRisk n d q ∧ minimaxRisk n d q ≤ C * frontierRate n d q := by obtain ⟨c, hc, hlow⟩ := full_experiment_lower obtain ⟨C₀, hC₀, hupp⟩ := mixed_count_upper let C := max c C₀ refine ⟨c, C, hc, le_max_left _ _, ?_⟩ intro n d q hn hd hq hq1 hslice constructor · exact hlow n d q hn hd hq hq1 hslice · let f := mixedCountEstimator n d q have hEstimator := mixed_count_estimator_regular n d q let T : Estimator n d := Estimator.ofMap f hEstimator have hrisk : ∀ (T : Estimator n d) (P : {P : FullLaw d // RareArrivalModelClass n d q P}), 0 ≤ squaredRisk T P.1 := by intro T P exact integral_nonneg (fun s => integral_nonneg (fun t => sq_nonneg _)) have hbound : ∀ (P : {P : FullLaw d // RareArrivalModelClass n d q P}), squaredRisk T P.1 ≤ C * frontierRate n d q := by intro P have h := hupp n d q P.1 P.2 have hdet : squaredRisk T P.1 = deterministicRisk f P.1 := by simp [squaredRisk, deterministicRisk, T, Estimator.ofMap, Kernel.deterministic_apply] rw [hdet] have hN : 0 < effectiveSize n q := by unfold effectiveSize positivity have hrate : 0 ≤ frontierRate n d q := by unfold frontierRate exact le_min (by norm_num) (by positivity) exact (h.1.trans h.2.1).trans (mul_le_mul_of_nonneg_right (le_max_right c C₀) hrate) have hval : minimaxRisk n d q ≤ Causalean.Stat.worstCaseRiskReal (fun (T : Estimator n d) (P : {P : FullLaw d // RareArrivalModelClass n d q P}) => squaredRisk T P.1) T := by exact minimaxValue_le_worstCaseRisk_of_nonneg hrisk T refine hval.trans ?_ unfold Causalean.Stat.worstCaseRiskReal by_cases hne : Nonempty {P : FullLaw d // RareArrivalModelClass n d q P} · letI := hne exact ciSup_le hbound · haveI : IsEmpty {P : FullLaw d // RareArrivalModelClass n d q P} := not_nonempty_iff.mp hne simpa using (show (0 : ℝ) ≤ C * frontierRate n d q from by have hC : 0 ≤ C := le_trans (le_of_lt hC₀) (le_max_right c C₀) have hN : 0 < effectiveSize n q := by unfold effectiveSize positivity have hrate : 0 ≤ frontierRate n d q := by unfold frontierRate exact le_min (by norm_num) (by positivity) exact mul_nonneg hC hrate)
CausalSmith.Stat.MarRareqLogfrontier.matched_minimax_frontier · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/TMatchedMinimaxFrontier.lean:15
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.TMixedCountUpper 1 declarations TMixedCountUpper for the finite rare-arrival experiment.

TMixedCountUpper for the finite rare-arrival experiment.

theorem mixed_count_upper

the stated mathematical conclusion holds.

Formal statement
∃ C : ℝ,
0 < C
conclusion 1
n d :
ℕ
q :
ℝ
P :
Proof (Lean source)
theorem mixed_count_upper : ∃ C : ℝ, 0 < C ∧ -- @realizes \(\overline C\)(universal upper constant) ∀ (n d : ℕ) (q : ℝ) (P : FullLaw d), RareArrivalModelClass n d q P → deterministicRisk (mixedCountEstimator n d q) P ≤ riskEnvelope n d q ∧ riskEnvelope n d q ≤ C * frontierRate n d q ∧ deterministicRisk (mixedCountEstimator n d q) P ≤ auxiliaryMixedRisk n q P := by obtain ⟨C, hC, hcertificate⟩ := uniform_mixed_count_certificate refine ⟨C, hC, ?_⟩ intro n d q P hP obtain ⟨hrisk, hrate⟩ := hcertificate n d q P hP exact ⟨hrisk, hrate, mixed_count_derandomization n d q P⟩
CausalSmith.Stat.MarRareqLogfrontier.mixed_count_upper · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/TMixedCountUpper.lean:17
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.TOneCellTestingFamily 3 declarations Assembly of the one-cell testing family and its honest-interval consequence.

Assembly of the one-cell testing family and its honest-interval consequence.

theorem intervalRisk_bounds

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
P :
conclusion 1
0 ≤ intervalRisk T P
conclusion 2
intervalRisk T P ≤ 2
Proof (Lean source)
lemma intervalRisk_bounds {n d : ℕ} (T : IntervalProcedure n d) (P : FullLaw d) : 0 ≤ intervalRisk T P ∧ intervalRisk T P ≤ 2 := by letI : IsProbabilityMeasure P.1 := P.2 letI : IsProbabilityMeasure (P.1.map obs) := Measure.isProbabilityMeasure_map (by fun_prop) letI : IsProbabilityMeasure (sampleLaw n P) := by unfold sampleLaw; infer_instance letI : IsMarkovKernel T.1 := T.2 have hinner (s : Fin n → ObsRecord d) : 0 ≤ ∫ I : ConnectedInterval, I.hi - I.lo ∂(T.1 s) ∧ (∫ I : ConnectedInterval, I.hi - I.lo ∂(T.1 s)) ≤ 2 := by constructor · exact integral_nonneg (fun I => sub_nonneg.mpr I.ordered) · have hb : ∀ I : ConnectedInterval, I.hi - I.lo ≤ 2 := by intro I linarith [I.lower, I.upper] simpa using integral_mono_of_nonneg (μ := T.1 s) (Filter.Eventually.of_forall (fun I => sub_nonneg.mpr I.ordered)) (integrable_const (2 : ℝ)) (Filter.Eventually.of_forall hb) unfold intervalRisk constructor · exact integral_nonneg (fun s => (hinner s).1) · simpa using integral_mono_of_nonneg (μ := sampleLaw n P) (Filter.Eventually.of_forall (fun s => (hinner s).1)) (integrable_const (2 : ℝ)) (Filter.Eventually.of_forall (fun s => (hinner s).2))
CausalSmith.Stat.MarRareqLogfrontier.intervalRisk_bounds · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/TOneCellTestingFamily.lean:169
theorem oneCell_interval_minimax_floor Lemma oneCell_interval_minimax_floor in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q α :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hq :
0 < q
hq1 :
q ≤ 1
hslice :
hα :
0 < α
hα1 :
α < 1
∃ (M : ℕ) (grid : Fin (M + 1) → ℝ),
0 < M
conclusion 1
i :
grid i ∈ Icc (1 / 4 : ℝ) (3 / 4 : ℝ)
conclusion 2
HonestInterval n d q α I
(3 * (1 - α) ^ 2 / 512) * min 1 (sqrt (effectiveSize n q))⁻¹
≤ ⨆ i, intervalRisk I (oneCellFamilyLaw (⟨0, hd⟩ : Fin d) (max 0 (min 1 (grid i))) q ⟨le_max_left _ _, max_le (by norm_num) (min_le_left _ _)⟩ ⟨hq.le, hq1⟩)
conclusion 3
(3 * (1 - α) ^ 2 / 512) * min 1 (sqrt (effectiveSize n q))⁻¹
≤ intervalLengthRisk n d q α
Proof (Lean source)
lemma oneCell_interval_minimax_floor {n d : ℕ} (q α : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hq : 0 < q) (hq1 : q ≤ 1) (hslice : RareArrivalSlice n q) (hα : 0 < α) (hα1 : α < 1) : ∃ (M : ℕ) (grid : Fin (M + 1) → ℝ), 0 < M ∧ Injective grid ∧ (∀ i, grid i ∈ Icc (1 / 4 : ℝ) (3 / 4 : ℝ)) ∧ (∀ (I : IntervalProcedure n d), HonestInterval n d q α I → (3 * (1 - α) ^ 2 / 512) * min 1 (sqrt (effectiveSize n q))⁻¹ ≤ ⨆ i, intervalRisk I (oneCellFamilyLaw (⟨0, hd⟩ : Fin d) (max 0 (min 1 (grid i))) q ⟨le_max_left _ _, max_le (by norm_num) (min_le_left _ _)⟩ ⟨hq.le, hq1⟩)) ∧ (3 * (1 - α) ^ 2 / 512) * min 1 (sqrt (effectiveSize n q))⁻¹ ≤ intervalLengthRisk n d q α := by let η := (1 - α) / 8 have hη : 0 < η := by dsimp [η]; linarith have hη1 : η ≤ 1 := by dsimp [η]; linarith obtain ⟨M, hMlarge⟩ := exists_nat_ge (8 / (1 - α) : ℝ) have hM : 0 < M := by have : (0 : ℝ) < M := lt_of_lt_of_le (by positivity) hMlarge exact_mod_cast this have hMr : (0 : ℝ) < M := by exact_mod_cast hM have hN : 0 < effectiveSize n q := by unfold effectiveSize; positivity have hsqrt : 0 < sqrt (effectiveSize n q) := Real.sqrt_pos.2 hN let w := min (1 / 4 : ℝ) (η / (4 * sqrt (effectiveSize n q))) have hw : 0 < w := by dsimp [w]; exact lt_min (by norm_num) (by positivity) have hwle : w ≤ 1 / 4 := by dsimp [w]; exact min_le_left _ _ have hwbudget : 2 * effectiveSize n q * w ^ 2 ≤ η ^ 2 / 8 := by have hle : w ≤ η / (4 * sqrt (effectiveSize n q)) := by dsimp [w]; exact min_le_right _ _ have hsquare : w ^ 2 ≤ (η / (4 * sqrt (effectiveSize n q))) ^ 2 := by nlinarith have hsqrt_sq : (sqrt (effectiveSize n q)) ^ 2 = effectiveSize n q := Real.sq_sqrt hN.le rw [div_pow, mul_pow, hsqrt_sq] at hsquare field_simp [ne_of_gt hN] at hsquare ⊢ nlinarith let δ := w / M let grid : Fin (M + 1) → ℝ := fun j => 1 / 2 + (j : ℝ) * δ have hδ : 0 < δ := by dsimp [δ]; positivity have hgrid_inj : Injective grid := by intro i j hij have hcast : (i : ℝ) = (j : ℝ) := by dsimp [grid] at hij have := mul_right_cancel₀ (ne_of_gt hδ) (sub_eq_zero.mp (by linarith : (i : ℝ) * δ - (j : ℝ) * δ = 0)) exact this exact Fin.ext (by exact_mod_cast hcast) have hgrid_mem : ∀ i, grid i ∈ Icc (1 / 4 : ℝ) (3 / 4 : ℝ) := by intro i have hi : (i : ℝ) ≤ M := by exact_mod_cast (Nat.lt_succ_iff.mp i.isLt) have hiz : 0 ≤ (i : ℝ) := by positivity have hterm0 : 0 ≤ (i : ℝ) * δ := mul_nonneg hiz hδ.le have hterm1 : (i : ℝ) * δ ≤ w := by rw [show (i : ℝ) * δ = ((i : ℝ) * w) / M by dsimp [δ]; ring] apply (div_le_iff₀ hMr).2 simpa [mul_comm] using mul_le_mul_of_nonneg_right hi hw.le dsimp [grid] constructor <;> linarith refine ⟨M, grid, hM, hgrid_inj, hgrid_mem, ?_⟩ let x : Fin d := ⟨0, hd⟩ let P₀ := oneCellFamilyLaw x (1 / 2) q (by norm_num) ⟨hq.le, hq1⟩ have hP₀ : RareArrivalModelClass n d q P₀ := oneCellFamilyLaw_model x (1 / 2) q hn hd (by norm_num) hq hq1 hslice have hwscale : (η / 4) * min 1 (sqrt (effectiveSize n q))⁻¹ ≤ w := by dsimp [w] by_cases hc : (1 / 4 : ℝ) ≤ η / (4 * sqrt (effectiveSize n q)) · rw [min_eq_left hc] have hm : min 1 (sqrt (effectiveSize n q))⁻¹ ≤ 1 := min_le_left _ _ have : η / 4 ≤ 1 / 4 := by linarith nlinarith [mul_nonneg hη.le (show 0 ≤ min 1 (sqrt (effectiveSize n q))⁻¹ by exact le_min (by norm_num) (by positivity))] · rw [min_eq_right (le_of_not_ge hc)] have hm : min 1 (sqrt (effectiveSize n q))⁻¹ ≤ (sqrt (effectiveSize n q))⁻¹ := min_le_right _ _ calc η / 4 * min 1 (sqrt (effectiveSize n q))⁻¹ ≤ η / 4 * (sqrt (effectiveSize n q))⁻¹ := mul_le_mul_of_nonneg_left hm (by positivity) _ = η / (4 * sqrt (effectiveSize n q)) := by ring have hproc : ∀ H : {T : IntervalProcedure n d // HonestInterval n d q α T}, (3 * (1 - α) / 4) * w ≤ intervalRisk H.1 P₀ := by intro H have hgrid_unit (j : Fin (M + 1)) : 0 ≤ grid j ∧ grid j ≤ 1 := by rcases hgrid_mem j with ⟨hj0, hj1⟩ constructor <;> linarith let P : Fin (M + 1) → FullLaw d := fun j => oneCellFamilyLaw x (grid j) q (hgrid_unit j) ⟨hq.le, hq1⟩ have hP (j : Fin (M + 1)) : RareArrivalModelClass n d q (P j) := oneCellFamilyLaw_model x (grid j) q hn hd (hgrid_unit j) hq hq1 hslice let μ₀ := H.1.1 ∘ₘ sampleLaw n P₀ let μ : Fin (M + 1) → Measure ConnectedInterval := fun j => H.1.1 ∘ₘ sampleLaw n (P j) letI : IsMarkovKernel H.1.1 := H.1.2 letI : IsProbabilityMeasure P₀.1 := P₀.2 letI : IsProbabilityMeasure (P₀.1.map obs) := Measure.isProbabilityMeasure_map (by fun_prop) letI : IsProbabilityMeasure (sampleLaw n P₀) := by unfold sampleLaw; infer_instance letI : IsProbabilityMeasure μ₀ := by dsimp [μ₀]; infer_instance letI (j : Fin (M + 1)) : IsProbabilityMeasure (P j).1 := (P j).2 letI (j : Fin (M + 1)) : IsProbabilityMeasure ((P j).1.map obs) := Measure.isProbabilityMeasure_map (by fun_prop) letI (j : Fin (M + 1)) : IsProbabilityMeasure (sampleLaw n (P j)) := by unfold sampleLaw; infer_instance letI (j : Fin (M + 1)) : IsProbabilityMeasure (μ j) := by dsimp [μ]; infer_instance have hm := connectedInterval_endpoint_measurable have hhonest : ∀ j, 1 - α ≤ (μ j).real (coverageEvent (fun I : ConnectedInterval => I.lo) (fun I => I.hi) (gridPoint (M := M) (1 / 2) δ j)) := by intro j have hpoint : gridPoint (M := M) (1 / 2) δ j = grid j := by simp [gridPoint, grid, mul_comm] rw [hpoint] have hsub : {I : ConnectedInterval | intervalContains I (grid j)} ⊆ coverageEvent (fun I : ConnectedInterval => I.lo) (fun I => I.hi) (grid j) := by intro I hI cases hl : I.closedLeft <;> cases hr : I.closedRight <;> simp [intervalContains, coverageEvent, hl, hr] at hI ⊢ <;> constructor <;> linarith rw [measureReal_bind_eq_integral (sampleLaw n (P j)) H.1.1 _ (measurableSet_coverageEvent hm.1 hm.2)] calc 1 - α ≤ ∫ s, (H.1.1 s).real {I | intervalContains I (ate (P j))} ∂(sampleLaw n (P j)) := H.2 (P j) (hP j) _ = ∫ s, (H.1.1 s).real {I | intervalContains I (grid j)} ∂(sampleLaw n (P j)) := by rw [oneCellFamilyLaw_ate] _ ≤ ∫ s, (H.1.1 s).real (coverageEvent (fun I : ConnectedInterval => I.lo) (fun I => I.hi) (grid j)) ∂(sampleLaw n (P j)) := by apply integral_mono_of_nonneg · exact Filter.Eventually.of_forall (fun _ => measureReal_nonneg) · exact Integrable.of_bound (H.1.1.measurable_coe (measurableSet_coverageEvent hm.1 hm.2)).ennreal_toReal.aestronglyMeasurable 1 (Filter.Eventually.of_forall fun s => by rw [Real.norm_eq_abs, abs_of_nonneg measureReal_nonneg] exact measureReal_le_one) · exact Filter.Eventually.of_forall (fun _ => measureReal_mono hsub) have htv : ∀ j, tvDist μ₀ (μ j) ≤ η := by intro j have hj : (j : ℝ) * δ ≤ w := by have hi : (j : ℝ) ≤ M := by exact_mod_cast (Nat.lt_succ_iff.mp j.isLt) rw [show (j : ℝ) * δ = ((j : ℝ) * w) / M by dsimp [δ]; ring] apply (div_le_iff₀ hMr).2 simpa [mul_comm] using mul_le_mul_of_nonneg_right hi hw.le have hz0 : 0 ≤ (j : ℝ) * δ := by positivity have hz1 : (j : ℝ) * δ ≤ 1 / 2 := hj.trans (by linarith) have hb : 2 * effectiveSize n q * ((j : ℝ) * δ) ^ 2 ≤ η ^ 2 / 8 := by have hsq : ((j : ℝ) * δ) ^ 2 ≤ w ^ 2 := by nlinarith exact (mul_le_mul_of_nonneg_left hsq (by positivity)).trans hwbudget exact (tvDist_bind_le (sampleLaw n P₀) (sampleLaw n (P j)) H.1.1).trans (by dsimp [P, P₀, grid] simpa [δ, mul_comm] using oneCell_product_tv_le x q ((j : ℝ) * δ) η hn hq hq1 hz0 hz1 hη.le hη1 hb) have hgeneric := honest_interval_length_lower_of_grid_tv_positive μ₀ M μ (1 / 2) δ α η hm.1 hm.2 hδ hα hα1 hMlarge (le_rfl) hhonest htv have hwidth : (M : ℝ) * δ = w := by dsimp [δ] field_simp [ne_of_gt hMr] have hrisk0 := (intervalRisk_bounds H.1 P₀).1 have hreal : (3 * (1 - α) / 4) * ((M : ℝ) * δ) ≤ intervalRisk H.1 P₀ := by rw [← ENNReal.ofReal_le_ofReal_iff hrisk0] rw [intervalRisk_bind_lintegral] simpa [μ₀, intervalLength, max_eq_right] using hgeneric.2.1 simpa [hwidth] using hreal let Iall : ConnectedInterval := ⟨(-1, 1), by norm_num, by norm_num, by norm_num⟩ let Tall : IntervalProcedure n d := ⟨Kernel.const _ (Measure.dirac Iall), inferInstance⟩ have hTall : HonestInterval n d q α Tall := by intro P hP letI : IsProbabilityMeasure P.1 := P.2 letI : IsProbabilityMeasure (P.1.map obs) := Measure.isProbabilityMeasure_map (by fun_prop) letI : IsProbabilityMeasure (sampleLaw n P) := by unfold sampleLaw; infer_instance rcases ate_mem_unit_interval P with ⟨hATE0, hATE1⟩ have heq (s : Fin n → ObsRecord d) : (Tall.1 s).real {I | intervalContains I (ate P)} = 1 := by rw [Kernel.const_apply, Measure.real, Measure.dirac_apply' _ (measurableSet_intervalContains (ate P))] have hmem : Iall ∈ {I : ConnectedInterval | intervalContains I (ate P)} := ⟨hATE0, hATE1⟩ rw [Set.indicator_of_mem hmem] norm_num simp_rw [heq] simp linarith let HAll : {T : IntervalProcedure n d // HonestInterval n d q α T} := ⟨Tall, hTall⟩ letI : Nonempty {T : IntervalProcedure n d // HonestInterval n d q α T} := ⟨HAll⟩ let θ₀ : {P : FullLaw d // RareArrivalModelClass n d q P} := ⟨P₀, hP₀⟩ unfold intervalLengthRisk have hmin : (3 * (1 - α) / 4) * w ≤ minimaxValueReal (fun (T : {T : IntervalProcedure n d // HonestInterval n d q α T}) (P : {P : FullLaw d // RareArrivalModelClass n d q P}) => intervalRisk T.1 P.1) := le_minimaxValue (fun H => (hproc H).trans (le_worstCaseRisk (risk := fun (T : {T : IntervalProcedure n d // HonestInterval n d q α T}) (P : {P : FullLaw d // RareArrivalModelClass n d q P}) => intervalRisk T.1 P.1) (by show BddAbove (range (fun P : {P : FullLaw d // RareArrivalModelClass n d q P} => intervalRisk H.1 P.1)) refine ⟨2, ?_⟩ rintro _ ⟨P, rfl⟩ exact (intervalRisk_bounds H.1 P).2) θ₀)) have hscale : (3 * (1 - α) ^ 2 / 512) * min 1 (sqrt (effectiveSize n q))⁻¹ ≤ (3 * (1 - α) / 4) * w := by have hcoeff : 0 ≤ 3 * (1 - α) / 4 := by positivity have h := mul_le_mul_of_nonneg_left hwscale hcoeff dsimp [η] at h nlinarith [mul_nonneg (sq_nonneg (1 - α)) (show 0 ≤ min 1 (sqrt (effectiveSize n q))⁻¹ by exact le_min (by norm_num) (by positivity))] constructor · intro I hI apply le_trans (hscale.trans (hproc ⟨I, hI⟩)) refine le_ciSup_of_le ?_ (0 : Fin (M + 1)) ?_ · refine ⟨2, ?_⟩ rintro _ ⟨i, rfl⟩ exact (intervalRisk_bounds I _).2 · norm_num [grid, P₀, x] · exact hscale.trans hmin
CausalSmith.Stat.MarRareqLogfrontier.oneCell_interval_minimax_floor · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/TOneCellTestingFamily.lean:196
theorem one_cell_testing_family

the stated mathematical conclusion holds.

Formal statement
∃ (c : ℝ) (cInterval : ℝ → ℝ),
0 < c
conclusion 1
α :
ℝ
0 < α
α < 1
0 < cInterval α
conclusion 2
n d :
ℕ
q :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
0 < q
q ≤ 1
∃ bernoulliFamily : ℝ → FullLaw d,
u ∈ Set.Icc (1 / 4 : ℝ) (3 / 4 : ℝ) :
RareArrivalModelClass n d q (bernoulliFamily u)
∀ᵐ r : FullRecord d ∂((bernoulliFamily u).1), r.X
= (⟨0, hd⟩ : Fin d) ∧ r.S0 = false ∧ r.S1 = false ∧ r.Y0 = false
(bernoulliFamily u).1.real {r | r.R = true} = q
ate (bernoulliFamily u) = u
∃ u₀ ∈ Icc (1 / 4 : ℝ) (3 / 4 : ℝ), ∃ u₁ ∈ Icc (1 / 4 : ℝ) (3 / 4 : ℝ),
u₀ ≠ u₁
T :
c * min 1 (effectiveSize n q)⁻¹
≤ max (squaredRisk T (bernoulliFamily u₀)) (squaredRisk T (bernoulliFamily u₁))
c * min 1 (effectiveSize n q)⁻¹ ≤ minimaxRisk n d q
α :
ℝ
0 < α
α < 1
∃ (M : ℕ) (grid : Fin (M + 1) → ℝ),
0 < M
i :
grid i ∈ Icc (1 / 4 : ℝ) (3 / 4 : ℝ)
HonestInterval n d q α I
cInterval α * min 1 (sqrt (effectiveSize n q))⁻¹
≤ ⨆ i, intervalRisk I (bernoulliFamily (grid i))
cInterval α * min 1 (sqrt (effectiveSize n q))⁻¹ ≤ intervalLengthRisk n d q α
Proof (Lean source)
lemma one_cell_testing_family : ∃ (c : ℝ) (cInterval : ℝ → ℝ), 0 < c ∧ (∀ α : ℝ, 0 < α → α < 1 → 0 < cInterval α) ∧ ∀ (n d : ℕ) (q : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d), 0 < q → q ≤ 1 → RareArrivalSlice n q → ∃ bernoulliFamily : ℝ → FullLaw d, (∀ u ∈ Icc (1 / 4 : ℝ) (3 / 4 : ℝ), RareArrivalModelClass n d q (bernoulliFamily u) ∧ (∀ᵐ r : FullRecord d ∂((bernoulliFamily u).1), r.X = (⟨0, hd⟩ : Fin d) ∧ r.S0 = false ∧ r.S1 = false ∧ r.Y0 = false) ∧ (bernoulliFamily u).1.real {r | r.R = true} = q ∧ ate (bernoulliFamily u) = u) ∧ (∃ u₀ ∈ Icc (1 / 4 : ℝ) (3 / 4 : ℝ), ∃ u₁ ∈ Icc (1 / 4 : ℝ) (3 / 4 : ℝ), u₀ ≠ u₁ ∧ (∀ T : Estimator n d, c * min 1 (effectiveSize n q)⁻¹ ≤ max (squaredRisk T (bernoulliFamily u₀)) (squaredRisk T (bernoulliFamily u₁))) ∧ c * min 1 (effectiveSize n q)⁻¹ ≤ minimaxRisk n d q) ∧ ∀ α : ℝ, 0 < α → α < 1 → ∃ (M : ℕ) (grid : Fin (M + 1) → ℝ), 0 < M ∧ Injective grid ∧ (∀ i, grid i ∈ Icc (1 / 4 : ℝ) (3 / 4 : ℝ)) ∧ (∀ (I : IntervalProcedure n d), HonestInterval n d q α I → cInterval α * min 1 (sqrt (effectiveSize n q))⁻¹ ≤ ⨆ i, intervalRisk I (bernoulliFamily (grid i))) ∧ cInterval α * min 1 (sqrt (effectiveSize n q))⁻¹ ≤ intervalLengthRisk n d q α := by refine ⟨1 / 256, fun α => 3 * (1 - α) ^ 2 / 512, by norm_num, ?_, ?_⟩ · intro α hα hα1 positivity · intro n d q hn hd hq hq1 hslice let x : Fin d := ⟨0, hd⟩ let clamp : ℝ → ℝ := fun u => max 0 (min 1 u) have hclamp_mem (u : ℝ) : 0 ≤ clamp u ∧ clamp u ≤ 1 := by dsimp [clamp] exact ⟨le_max_left _ _, max_le (by norm_num) (min_le_left _ _)⟩ let family : ℝ → FullLaw d := fun u => oneCellFamilyLaw x (clamp u) q (hclamp_mem u) ⟨hq.le, hq1⟩ refine ⟨family, ?_, ?_, ?_⟩ · intro u hu have hu0 : 0 ≤ u := by linarith [hu.1] have hu1 : u ≤ 1 := by linarith [hu.2] have hclamp : clamp u = u := by simp [clamp, min_eq_right hu1, max_eq_right hu0] simpa [family, hclamp] using (⟨oneCellFamilyLaw_model x u q hn hd ⟨hu0, hu1⟩ hq hq1 hslice, oneCellFamilyLaw_support x u q ⟨hu0, hu1⟩ ⟨hq.le, hq1⟩, oneCellFamilyLaw_arrival_mass x u q ⟨hu0, hu1⟩ ⟨hq.le, hq1⟩, oneCellFamilyLaw_ate x u q ⟨hu0, hu1⟩ ⟨hq.le, hq1⟩⟩ : RareArrivalModelClass n d q (oneCellFamilyLaw x u q ⟨hu0, hu1⟩ ⟨hq.le, hq1⟩) ∧ (∀ᵐ r : FullRecord d ∂((oneCellFamilyLaw x u q ⟨hu0, hu1⟩ ⟨hq.le, hq1⟩).1), r.X = x ∧ r.S0 = false ∧ r.S1 = false ∧ r.Y0 = false) ∧ (oneCellFamilyLaw x u q ⟨hu0, hu1⟩ ⟨hq.le, hq1⟩).1.real {r | r.R = true} = q ∧ ate (oneCellFamilyLaw x u q ⟨hu0, hu1⟩ ⟨hq.le, hq1⟩) = u) · have hrisk := oneCell_minimax_risk_floors q hn hd hq hq1 hslice have hstep := oneCellStep_pos n q hn hq have hstep_le := oneCellStep_le_quarter n q have hu₁ : (1 / 2 : ℝ) + oneCellStep n q ∈ Icc (1 / 4) (3 / 4) := by constructor <;> linarith refine ⟨1 / 2, by norm_num, 1 / 2 + oneCellStep n q, hu₁, by linarith, ?_, hrisk.1⟩ have hclamp₀ : clamp (1 / 2) = 1 / 2 := by norm_num [clamp] have hclamp₁ : clamp (1 / 2 + oneCellStep n q) = 1 / 2 + oneCellStep n q := by dsimp [clamp] rw [min_eq_right (by linarith : (1 / 2 : ℝ) + oneCellStep n q ≤ 1), max_eq_right (by linarith : (0 : ℝ) ≤ 1 / 2 + oneCellStep n q)] simpa only [family, hclamp₀, hclamp₁] using oneCell_two_point_risk_floor x q hn hq hq1 · intro α hα hα1 simpa [family, clamp, x] using oneCell_interval_minimax_floor q α hn hd hq hq1 hslice hα hα1
CausalSmith.Stat.MarRareqLogfrontier.one_cell_testing_family · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/TOneCellTestingFamily.lean:436
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.TOneCellTestingRisk 2 declarations Squared-risk consequences of the one-cell observed-law testing family.

Squared-risk consequences of the one-cell observed-law testing family.

theorem oneCell_two_point_risk_floor

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
x :
Fin d
q :
ℝ
hn :
1 ≤ n
hq :
0 < q
hq1 :
q ≤ 1
T :
(1 / 256 : ℝ) * min 1 (effectiveSize n q)⁻¹
≤ max (squaredRisk T (oneCellFamilyLaw x (1 / 2) q (by norm_num) ⟨hq.le, hq1⟩)) (squaredRisk T (oneCellFamilyLaw x (1 / 2 + oneCellStep n q) q (oneCellStep_mem n q hn hq) ⟨hq.le, hq1⟩))
Proof (Lean source)
lemma oneCell_two_point_risk_floor {n d : ℕ} (x : Fin d) (q : ℝ) (hn : 1 ≤ n) (hq : 0 < q) (hq1 : q ≤ 1) : ∀ T : Estimator n d, (1 / 256 : ℝ) * min 1 (effectiveSize n q)⁻¹ ≤ max (squaredRisk T (oneCellFamilyLaw x (1 / 2) q (by norm_num) ⟨hq.le, hq1⟩)) (squaredRisk T (oneCellFamilyLaw x (1 / 2 + oneCellStep n q) q (oneCellStep_mem n q hn hq) ⟨hq.le, hq1⟩)) := by let P₀ := oneCellFamilyLaw x (1 / 2) q (by norm_num) ⟨hq.le, hq1⟩ let P₁ := oneCellFamilyLaw x (1 / 2 + oneCellStep n q) q (oneCellStep_mem n q hn hq) ⟨hq.le, hq1⟩ have hgap : ate P₁ = ate P₀ + oneCellStep n q := by simp [P₀, P₁, oneCellFamilyLaw_ate] have hrisk := complete_arrival_two_point_decision_reduction P₀ P₁ (oneCellStep n q) (1 / 2) (oneCellStep_pos n q hn hq) (by norm_num) hgap (oneCell_product_testing_half x n q hn hq hq1) intro T have hstep := oneCellStep_sq_lower n q hn hq calc (1 / 256 : ℝ) * min 1 (effectiveSize n q)⁻¹ ≤ (1 / 16) * (oneCellStep n q) ^ 2 := by nlinarith _ = (1 / 2) * (oneCellStep n q) ^ 2 / 8 := by ring _ ≤ max (squaredRisk T P₀) (squaredRisk T P₁) := hrisk T
CausalSmith.Stat.MarRareqLogfrontier.oneCell_two_point_risk_floor · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/TOneCellTestingRisk.lean:15
theorem oneCell_minimax_risk_floors

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hq :
0 < q
hq1 :
q ≤ 1
hslice :
conclusion 1
(1 / 256 : ℝ) * min 1 (effectiveSize n q)⁻¹ ≤ minimaxRisk n d q
conclusion 2
(1 / 256 : ℝ) * min 1 (effectiveSize n q)⁻¹ ≤ noSurrogateRisk n d q
Proof (Lean source)
lemma oneCell_minimax_risk_floors {n d : ℕ} (q : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hq : 0 < q) (hq1 : q ≤ 1) (hslice : RareArrivalSlice n q) : (1 / 256 : ℝ) * min 1 (effectiveSize n q)⁻¹ ≤ minimaxRisk n d q ∧ (1 / 256 : ℝ) * min 1 (effectiveSize n q)⁻¹ ≤ noSurrogateRisk n d q := by let x : Fin d := ⟨0, hd⟩ let P₀ := oneCellFamilyLaw x (1 / 2) q (by norm_num) ⟨hq.le, hq1⟩ let P₁ := oneCellFamilyLaw x (1 / 2 + oneCellStep n q) q (oneCellStep_mem n q hn hq) ⟨hq.le, hq1⟩ have hP₀ : RareArrivalModelClass n d q P₀ := oneCellFamilyLaw_model x (1 / 2) q hn hd (by norm_num) hq hq1 hslice have hP₁ : RareArrivalModelClass n d q P₁ := oneCellFamilyLaw_model x (1 / 2 + oneCellStep n q) q hn hd (oneCellStep_mem n q hn hq) hq hq1 hslice have hNS₀ : ∀ᵐ r : FullRecord d ∂P₀.1, r.S0 = false ∧ r.S1 = false := oneCellFamilyLaw_noSurrogate x (1 / 2) q (by norm_num) ⟨hq.le, hq1⟩ have hNS₁ : ∀ᵐ r : FullRecord d ∂P₁.1, r.S0 = false ∧ r.S1 = false := oneCellFamilyLaw_noSurrogate x (1 / 2 + oneCellStep n q) q (oneCellStep_mem n q hn hq) ⟨hq.le, hq1⟩ have htwo : ∀ T : Estimator n d, (1 / 256 : ℝ) * min 1 (effectiveSize n q)⁻¹ ≤ max (squaredRisk T P₀) (squaredRisk T P₁) := by simpa [P₀, P₁] using oneCell_two_point_risk_floor x q hn hq hq1 let T₀ : Estimator n d := Estimator.ofMap (fun _ => 0) ⟨measurable_const, by intro s; norm_num⟩ letI : Nonempty (Estimator n d) := ⟨T₀⟩ constructor · let θ₀ : {P : FullLaw d // RareArrivalModelClass n d q P} := ⟨P₀, hP₀⟩ let θ₁ : {P : FullLaw d // RareArrivalModelClass n d q P} := ⟨P₁, hP₁⟩ unfold minimaxRisk apply le_minimaxValue_of_two_point θ₀ θ₁ · intro T refine ⟨4, ?_⟩ rintro r ⟨θ, rfl⟩ exact (unrestricted_squaredRisk_bounds T θ.1).2 · exact htwo · let θ₀ : {P : FullLaw d // RareArrivalModelClass n d q P ∧ ∀ᵐ r : FullRecord d ∂P.1, r.S0 = false ∧ r.S1 = false} := ⟨P₀, hP₀, hNS₀⟩ let θ₁ : {P : FullLaw d // RareArrivalModelClass n d q P ∧ ∀ᵐ r : FullRecord d ∂P.1, r.S0 = false ∧ r.S1 = false} := ⟨P₁, hP₁, hNS₁⟩ unfold noSurrogateRisk apply le_minimaxValue_of_two_point θ₀ θ₁ · intro T refine ⟨4, ?_⟩ rintro r ⟨θ, rfl⟩ exact (unrestricted_squaredRisk_bounds T θ.1).2 · exact htwo
CausalSmith.Stat.MarRareqLogfrontier.oneCell_minimax_risk_floors · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/TOneCellTestingRisk.lean:43
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.TUniformMixedCountCertificate 1 declarations TUniformMixedCountCertificate for the finite rare-arrival experiment.

TUniformMixedCountCertificate for the finite rare-arrival experiment.

theorem uniform_mixed_count_certificate

the stated mathematical conclusion holds.

Formal statement
∃ C : ℝ,
0 < C
conclusion 1
n d :
ℕ
q :
ℝ
P :
Proof (Lean source)
theorem uniform_mixed_count_certificate : ∃ C : ℝ, 0 < C ∧ -- @realizes \(\overline C\)(universal upper constant) ∀ (n d : ℕ) (q : ℝ) (P : FullLaw d), RareArrivalModelClass n d q P → deterministicRisk (mixedCountEstimator n d q) P ≤ riskEnvelope n d q ∧ riskEnvelope n d q ≤ C * frontierRate n d q := by obtain ⟨C, hC, hcertificate⟩ := unrestricted_uniform_mixed_count_certificate refine ⟨C, hC, ?_⟩ intro n d q P hP have hPplus : UnrestrictedArrivalModelClass n d q P := { n_pos := hP.n_pos d_pos := hP.d_pos q_pos := hP.q_pos q_le_one := hP.q_le_one randomized := hP.randomized balanced := hP.balanced surrogate := hP.surrogate outcome := hP.outcome mar := hP.mar arrival := hP.arrival } obtain ⟨hrisk, hrate⟩ := hcertificate n d q P hPplus hP.iid have hident := unrestricted_cell_identification P hPplus rw [← hident] at hrisk exact ⟨hrisk, hrate⟩
CausalSmith.Stat.MarRareqLogfrontier.uniform_mixed_count_certificate · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/TUniformMixedCountCertificate.lean:16
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.TUnrestrictedCompleteArrivalFrontier 1 declarations The complete-arrival endpoint of the all-kernel near-complete envelope.

The complete-arrival endpoint of the all-kernel near-complete envelope.

theorem unrestricted_complete_arrival_frontier

Uniformly over sample size and alphabet size, the unrestricted complete-arrival frontier has parametric order.

Formal statement
n :
ℕ
shared
d :
ℕ
shared
n d :
ℕ
1 ≤ n
1 ≤ d
conclusion 1
1 / (256 * (n : ℝ)) ≤ unrestrictedMinimaxRisk n d 1
conclusion 3
≤ 4 / (n : ℝ)
Proof (Lean source)
theorem unrestricted_complete_arrival_frontier : ∀ (n d : ℕ), 1 ≤ n → 1 ≤ d → 1 / (256 * (n : ℝ)) ≤ unrestrictedMinimaxRisk n d 1 ∧ unrestrictedMinimaxRisk n d 1 ≤ worstCaseRiskReal (fun (_ : Unit) (P : {P : FullLaw d // UnrestrictedArrivalModelClass n d 1 P}) => deterministicRisk (completeArrivalHTEstimator n d) P.1) () ∧ worstCaseRiskReal (fun (_ : Unit) (P : {P : FullLaw d // UnrestrictedArrivalModelClass n d 1 P}) => deterministicRisk (completeArrivalHTEstimator n d) P.1) () ≤ 4 / (n : ℝ) := by intro n d hn hd obtain ⟨C, hC, hmixed, hnear⟩ := unrestricted_near_complete_arrival_envelope obtain ⟨hlo, _, hhi⟩ := hnear n d 1 hn hd (by norm_num) (by norm_num) exact ⟨hlo, (complete_arrival_frontier_direct n d hn hd).2.1, by simpa using hhi⟩
CausalSmith.Stat.MarRareqLogfrontier.unrestricted_complete_arrival_frontier · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/TUnrestrictedCompleteArrivalFrontier.lean:11
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.TUnrestrictedFixedQMinimaxFrontier 6 declarations TUnrestrictedFixedQMinimaxFrontier for the finite rare-arrival experiment.

TUnrestrictedFixedQMinimaxFrontier for the finite rare-arrival experiment.

theorem fixedQRate_le_frontierRate

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
hn :
1 ≤ n
hq :
0 < q
hq1 :
q ≤ 1
fixedQRate n d ≤ frontierRate n d q
Proof (Lean source)
lemma fixedQRate_le_frontierRate (n d : ℕ) (q : ℝ) (hn : 1 ≤ n) (hq : 0 < q) (hq1 : q ≤ 1) : fixedQRate n d ≤ frontierRate n d q := by have hn0 : (0 : ℝ) < n := by exact_mod_cast (by omega : 0 < n) have hN : 0 < effectiveSize n q := mul_pos hn0 hq have hNle : effectiveSize n q ≤ n := by unfold effectiveSize nlinarith have hlogpos : 0 < logScale n q := by unfold logScale apply Real.log_pos have he : 1 < exp 1 := by nlinarith [Real.add_one_le_exp (1 : ℝ)] linarith have hlogle : logScale n q ≤ log (exp 1 + n) := by unfold logScale exact Real.log_le_log (by positivity) (by linarith) have hden : 0 < effectiveSize n q * logScale n q := mul_pos hN hlogpos have hden' : effectiveSize n q * logScale n q ≤ (n : ℝ) * log (exp 1 + n) := by apply mul_le_mul hNle hlogle hlogpos.le (by positivity) have hfirst : (n : ℝ)⁻¹ ≤ (effectiveSize n q)⁻¹ := by simpa [one_div] using one_div_le_one_div_of_le hN hNle have hsecond : ((d : ℝ) / ((n : ℝ) * log (exp 1 + n))) ^ 2 ≤ ((d : ℝ) / (effectiveSize n q * logScale n q)) ^ 2 := by have hdiv := div_le_div_of_nonneg_left (Nat.cast_nonneg d) hden hden' have hdenBig : 0 < (n : ℝ) * log (exp 1 + n) := lt_of_lt_of_le hden hden' have hdiv0 : 0 ≤ (d : ℝ) / ((n : ℝ) * log (exp 1 + n)) := div_nonneg (Nat.cast_nonneg d) hdenBig.le nlinarith unfold fixedQRate frontierRate exact min_le_min_left 1 (add_le_add hfirst hsecond)
CausalSmith.Stat.MarRareqLogfrontier.fixedQRate_le_frontierRate · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/TUnrestrictedFixedQMinimaxFrontier.lean:18
theorem frontierRate_le_fixedQRate_mul

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
hn :
1 ≤ n
hq :
0 < q
hq1 :
q ≤ 1
frontierRate n d q ≤ ((1 - log q) / q) ^ 2 * fixedQRate n d
Proof (Lean source)
lemma frontierRate_le_fixedQRate_mul (n d : ℕ) (q : ℝ) (hn : 1 ≤ n) (hq : 0 < q) (hq1 : q ≤ 1) : frontierRate n d q ≤ ((1 - log q) / q) ^ 2 * fixedQRate n d := by let N := effectiveSize n q let L := logScale n q let L₁ := log (exp 1 + n) let K := (1 - log q) / q have hn0 : (0 : ℝ) < n := by exact_mod_cast (by omega : 0 < n) have hN : 0 < N := mul_pos hn0 hq have hL : 1 ≤ L := by dsimp [L, logScale] rw [Real.le_log_iff_exp_le (by positivity)] dsimp [N, effectiveSize] at * linarith have hL₁ : 0 < L₁ := by dsimp [L₁] apply Real.log_pos nlinarith [Real.add_one_le_exp (1 : ℝ)] have hlogq : log q ≤ 0 := Real.log_nonpos hq.le hq1 have hlogbound : L₁ ≤ (1 - log q) * L := by have harg : exp 1 + (n : ℝ) ≤ (exp 1 + N) / q := by apply (le_div_iff₀ hq).2 dsimp [N, effectiveSize] nlinarith [Real.exp_pos (1 : ℝ)] have hbase : L₁ ≤ L - log q := by calc L₁ ≤ log ((exp 1 + N) / q) := Real.log_le_log (by positivity) harg _ = L - log q := by rw [Real.log_div (by positivity) (ne_of_gt hq)] rfl have hprod := mul_nonneg (neg_nonneg.mpr hlogq) (sub_nonneg.mpr hL) nlinarith have hK : 1 ≤ K := by dsimp [K] apply (le_div_iff₀ hq).2 linarith have hKpos : 0 < K := lt_of_lt_of_le (by norm_num) hK have hD : 0 < N * L := mul_pos hN (by linarith) have hD₁ : 0 < (n : ℝ) * L₁ := mul_pos hn0 hL₁ have hDen : (n : ℝ) * L₁ ≤ K * (N * L) := by calc (n : ℝ) * L₁ ≤ (n : ℝ) * ((1 - log q) * L) := mul_le_mul_of_nonneg_left hlogbound hn0.le _ = K * (N * L) := by dsimp [K, N, effectiveSize] field_simp have hfirst : N⁻¹ ≤ K ^ 2 * (n : ℝ)⁻¹ := by have hqK : q * K = 1 - log q := by dsimp [K] field_simp have hK2 : 1 ≤ q * K ^ 2 := by nlinarith [mul_nonneg (sub_nonneg.mpr hK) (sub_nonneg.mpr hlogq)] have hN_eq : N = (n : ℝ) * q := rfl have h : 1 / N ≤ K ^ 2 / (n : ℝ) := by apply (div_le_div_iff₀ hN hn0).2 rw [hN_eq] nlinarith [mul_nonneg hn0.le (sub_nonneg.mpr hK2)] simpa [one_div, div_eq_mul_inv] using h have hsecond : ((d : ℝ) / (N * L)) ^ 2 ≤ K ^ 2 * ((d : ℝ) / ((n : ℝ) * L₁)) ^ 2 := by have hdiv : (d : ℝ) / (N * L) ≤ K * ((d : ℝ) / ((n : ℝ) * L₁)) := by have h : (d : ℝ) / (N * L) ≤ (K * d) / ((n : ℝ) * L₁) := by apply (div_le_div_iff₀ hD hD₁).2 have hd0 : 0 ≤ (d : ℝ) := Nat.cast_nonneg _ nlinarith [mul_nonneg hd0 (sub_nonneg.mpr hDen)] convert h using 1 <;> ring have hleft : 0 ≤ (d : ℝ) / (N * L) := div_nonneg (Nat.cast_nonneg _) hD.le nlinarith [sq_nonneg (K * ((d : ℝ) / ((n : ℝ) * L₁)) - ((d : ℝ) / (N * L)))] have hr0 : 0 ≤ (n : ℝ)⁻¹ + ((d : ℝ) / ((n : ℝ) * L₁)) ^ 2 := by positivity have hsum : N⁻¹ + ((d : ℝ) / (N * L)) ^ 2 ≤ K ^ 2 * ((n : ℝ)⁻¹ + ((d : ℝ) / ((n : ℝ) * L₁)) ^ 2) := by nlinarith [hfirst, hsecond] dsimp [frontierRate, fixedQRate, N, L, L₁, K] at * calc min 1 ((effectiveSize n q)⁻¹ + ((d : ℝ) / (effectiveSize n q * logScale n q)) ^ 2) ≤ min 1 (K ^ 2 * ((n : ℝ)⁻¹ + ((d : ℝ) / ((n : ℝ) * log (exp 1 + n))) ^ 2)) := min_le_min_left 1 hsum _ ≤ K ^ 2 * min 1 ((n : ℝ)⁻¹ + ((d : ℝ) / ((n : ℝ) * log (exp 1 + n))) ^ 2) := by rcases le_total ((n : ℝ)⁻¹ + ((d : ℝ) / ((n : ℝ) * log (exp 1 + n))) ^ 2) 1 with h | h · rw [min_eq_right h] exact (min_le_right _ _) · rw [min_eq_left h] exact (min_le_left _ _).trans (by nlinarith [sq_nonneg K])
CausalSmith.Stat.MarRareqLogfrontier.frontierRate_le_fixedQRate_mul · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/TUnrestrictedFixedQMinimaxFrontier.lean:56
theorem unrestricted_fixed_q_frontier_upper

the stated mathematical conclusion holds.

Formal statement
∃ C : ℝ,
0 < C
conclusion 1
n d :
ℕ
q :
ℝ
1 ≤ n
1 ≤ d
0 < q
q < 1 / 2
Proof (Lean source)
lemma unrestricted_fixed_q_frontier_upper : ∃ C : ℝ, 0 < C ∧ ∀ (n d : ℕ) (q : ℝ), 1 ≤ n → 1 ≤ d → 0 < q → q < 1 / 2 → unrestrictedMinimaxRisk n d q ≤ C * frontierRate n d q := by obtain ⟨C, hC, hupper⟩ := unrestricted_mixed_count_upper refine ⟨C, hC, ?_⟩ intro n d q hn hd hq hqhalf let f := mixedCountEstimator n d q have hf := mixed_count_estimator_regular n d q let T : Estimator n d := Estimator.ofMap f hf have hrisk : ∀ (T : Estimator n d) (P : {P : FullLaw d // UnrestrictedArrivalModelClass n d q P}), 0 ≤ squaredRisk T P.1 := by intro T P exact integral_nonneg (fun s => integral_nonneg (fun y => sq_nonneg _)) have hval : unrestrictedMinimaxRisk n d q ≤ Causalean.Stat.worstCaseRiskReal (fun (_ : Unit) (P : {P : FullLaw d // UnrestrictedArrivalModelClass n d q P}) => deterministicRisk f P.1) () := by have h := minimaxValue_le_worstCaseRisk_of_nonneg hrisk T calc unrestrictedMinimaxRisk n d q ≤ Causalean.Stat.worstCaseRiskReal (fun (_ : Unit) (P : {P : FullLaw d // UnrestrictedArrivalModelClass n d q P}) => squaredRisk T P.1) () := by simpa only [unrestrictedMinimaxRisk, Causalean.Stat.worstCaseRiskReal] using h _ = _ := by congr 1 funext _ P simp [squaredRisk, deterministicRisk, T, Estimator.ofMap, Kernel.deterministic_apply] refine le_trans hval ?_ unfold Causalean.Stat.worstCaseRiskReal by_cases hne : Nonempty {P : FullLaw d // UnrestrictedArrivalModelClass n d q P} · letI := hne apply ciSup_le intro P obtain ⟨hriskP, hrateP, _⟩ := hupper n d q P.1 P.2 (sampleLaw_iid n P.1) exact hriskP.trans hrateP · haveI : IsEmpty {P : FullLaw d // UnrestrictedArrivalModelClass n d q P} := not_nonempty_iff.mp hne simp have hrate : 0 ≤ frontierRate n d q := by have hN : 0 < effectiveSize n q := by unfold effectiveSize exact mul_pos (by exact_mod_cast hn) hq have hexp : (1 : ℝ) < exp 1 := by nlinarith [Real.add_one_le_exp (1 : ℝ)] have hlog : 0 < logScale n q := by unfold logScale exact Real.log_pos (by linarith) unfold frontierRate exact le_min (by norm_num) (by positivity) exact mul_nonneg hC.le hrate
CausalSmith.Stat.MarRareqLogfrontier.unrestricted_fixed_q_frontier_upper · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/TUnrestrictedFixedQMinimaxFrontier.lean:148
theorem unrestricted_fixed_q_polynomial_upper

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
q :
ℝ
hq :
0 < q
hqhalf :
q < 1 / 2
∃ C : ℝ,
0 < C
conclusion 1
n d :
ℕ
1 ≤ n
1 ≤ d
Proof (Lean source)
lemma unrestricted_fixed_q_polynomial_upper (q : ℝ) (hq : 0 < q) (hqhalf : q < 1 / 2) : ∃ C : ℝ, 0 < C ∧ ∀ (n d : ℕ), 1 ≤ n → 1 ≤ d → unrestrictedMinimaxRisk n d q ≤ C * fixedQRate n d := by obtain ⟨C, hC, hupper⟩ := unrestricted_fixed_q_frontier_upper let K := ((1 - log q) / q) ^ 2 have hK : 0 < K := by dsimp [K] have hlog : log q ≤ 0 := Real.log_nonpos hq.le (by linarith) exact pow_pos (div_pos (by linarith) hq) _ refine ⟨C * K, mul_pos hC hK, ?_⟩ intro n d hn hd calc unrestrictedMinimaxRisk n d q ≤ C * frontierRate n d q := hupper n d q hn hd hq hqhalf _ ≤ C * (K * fixedQRate n d) := mul_le_mul_of_nonneg_left (frontierRate_le_fixedQRate_mul n d q hn hq (by linarith)) hC.le _ = (C * K) * fixedQRate n d := by ring
CausalSmith.Stat.MarRareqLogfrontier.unrestricted_fixed_q_polynomial_upper · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/TUnrestrictedFixedQMinimaxFrontier.lean:207
theorem zengMinimaxRisk_le_unrestrictedMinimaxRisk

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
hn :
1 ≤ n
hq :
0 < q
hqhalf :
q < 1 / 2
Proof (Lean source)
lemma zengMinimaxRisk_le_unrestrictedMinimaxRisk (n d : ℕ) (q : ℝ) (hn : 1 ≤ n) (hq : 0 < q) (hqhalf : q < 1 / 2) : zengMinimaxRisk n d q ≤ unrestrictedMinimaxRisk n d q := by let φ : {P : ZengLaw d // P ∈ zengDiscreteClass d q} → {P : FullLaw d // UnrestrictedArrivalModelClass n d q P} := fun P => ⟨(synthetic_randomization_kernel hn hq hqhalf P.1 P.2).choose, (synthetic_randomization_kernel hn hq hqhalf P.1 P.2).choose_spec.1⟩ let T₀ : Estimator n d := Estimator.ofMap (fun _ => 0) ⟨measurable_const, by intro s; norm_num⟩ letI : Nonempty (Estimator n d) := ⟨T₀⟩ have hr : ∀ (T : ZengEstimator n d) (P : {P : ZengLaw d // P ∈ zengDiscreteClass d q}), 0 ≤ zengSquaredRisk T P.1 := by intro T P exact (zeng_squaredRisk_bounds q T P.1 P.2).1 unfold zengMinimaxRisk unrestrictedMinimaxRisk apply minimaxValue_le_minimaxValue (bddBelow_range_worstCaseRisk hr) intro T refine ⟨syntheticPullbackEstimator T, ?_⟩ change worstCaseRiskReal (fun (_ : Unit) (P : {P : ZengLaw d // P ∈ zengDiscreteClass d q}) => zengSquaredRisk (syntheticPullbackEstimator T) P.1) () ≤ worstCaseRiskReal (fun (_ : Unit) (P : {P : FullLaw d // UnrestrictedArrivalModelClass n d q P}) => squaredRisk T P.1) () apply worstCaseRisk_mono_class_of_nonneg φ · refine ⟨4, ?_⟩ rintro r ⟨P, rfl⟩ exact (unrestricted_squaredRisk_bounds T P.1).2 · intro P exact (unrestricted_squaredRisk_bounds T P.1).1 · intro P have hspec := (synthetic_randomization_kernel hn hq hqhalf P.1 P.2).choose_spec exact le_of_eq (syntheticPullbackEstimator_risk_eq T P.1 (φ P).1 hspec.2.2.1 hspec.2.2.2)
CausalSmith.Stat.MarRareqLogfrontier.zengMinimaxRisk_le_unrestrictedMinimaxRisk · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/TUnrestrictedFixedQMinimaxFrontier.lean:230
theorem unrestricted_fixed_q_minimax_frontier

Given the cited lower-bound gate, the unrestricted fixed-positivity minimax risk matches the frontier.

Formal statement
hZeng_of_gate :
q :
ℝ
0 < q
q < 1 / 2
∃ c C : ℝ,
0 < c
c ≤ C
conclusion 1
n d :
ℕ
1 ≤ n
1 ≤ d
Proof (Lean source)
theorem unrestricted_fixed_q_minimax_frontier (hZeng_of_gate : ZengTheoremTwoLower) : ∀ q : ℝ, 0 < q → q < 1 / 2 → -- @realizes \(\underline c(q)\)(fixed-q lower constant) ∃ c C : ℝ, 0 < c ∧ c ≤ C ∧ -- @realizes \(\overline C(q)\)(fixed-q upper constant) ∀ (n d : ℕ), 1 ≤ n → 1 ≤ d → c * fixedQRate n d ≤ unrestrictedMinimaxRisk n d q ∧ unrestrictedMinimaxRisk n d q ≤ C * fixedQRate n d ∧ c * frontierRate n d q ≤ unrestrictedMinimaxRisk n d q ∧ unrestrictedMinimaxRisk n d q ≤ C * frontierRate n d q := by intro q hq hqhalf obtain ⟨C₁, hC₁, hupperFront⟩ := unrestricted_fixed_q_frontier_upper obtain ⟨C₂, hC₂, hupperPoly⟩ := unrestricted_fixed_q_polynomial_upper q hq hqhalf have hLower : ∃ c : ℝ, 0 < c ∧ ∀ (n d : ℕ), 1 ≤ n → 1 ≤ d → c * frontierRate n d q ≤ unrestrictedMinimaxRisk n d q := by obtain ⟨_, _, _, hZfixed⟩ := zeng_fixed_positivity_polynomial_frontier hZeng_of_gate obtain ⟨cε, _, hcε, _, hzlower⟩ := hZfixed q hq hqhalf let K := ((1 - log q) / q) ^ 2 have hK : 0 < K := by dsimp [K] have hlog : log q ≤ 0 := Real.log_nonpos hq.le (by linarith) exact pow_pos (div_pos (by linarith) hq) _ refine ⟨cε / K, div_pos hcε hK, ?_⟩ intro n d hn hd calc (cε / K) * frontierRate n d q ≤ (cε / K) * (K * fixedQRate n d) := by exact mul_le_mul_of_nonneg_left (frontierRate_le_fixedQRate_mul n d q hn hq (by linarith)) (div_nonneg hcε.le hK.le) _ = cε * fixedQRate n d := by field_simp _ ≤ zengMinimaxRisk n d q := (hzlower n d hn hd).1 _ ≤ unrestrictedMinimaxRisk n d q := zengMinimaxRisk_le_unrestrictedMinimaxRisk n d q hn hq hqhalf obtain ⟨c, hc, hlower⟩ := hLower let C := max C₁ C₂ + c have hC : 0 < C := by dsimp [C] linarith [le_max_left C₁ C₂] refine ⟨c, C, hc, by dsimp [C]; linarith [le_max_left C₁ C₂], ?_⟩ intro n d hn hd have hfixed : 0 ≤ fixedQRate n d := by unfold fixedQRate exact le_min (by norm_num) (by positivity) have hfront : 0 ≤ frontierRate n d q := by unfold frontierRate have hN : 0 ≤ effectiveSize n q := by unfold effectiveSize positivity exact le_min (by norm_num) (add_nonneg (inv_nonneg.mpr hN) (sq_nonneg _)) have hC₁ : C₁ ≤ C := by dsimp [C]; linarith [le_max_left C₁ C₂] have hC₂ : C₂ ≤ C := by dsimp [C]; linarith [le_max_right C₁ C₂] refine ⟨?_, ?_, hlower n d hn hd, ?_⟩ · exact (mul_le_mul_of_nonneg_left (fixedQRate_le_frontierRate n d q hn hq (by linarith)) hc.le).trans (hlower n d hn hd) · exact (hupperPoly n d hn hd).trans (mul_le_mul_of_nonneg_right hC₂ hfixed) · exact (hupperFront n d q hn hd hq hqhalf).trans (mul_le_mul_of_nonneg_right hC₁ hfront)
CausalSmith.Stat.MarRareqLogfrontier.unrestricted_fixed_q_minimax_frontier · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/TUnrestrictedFixedQMinimaxFrontier.lean:270
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.TUnrestrictedLargeAlphabetDeficitLower 5 declarations The uniform large-alphabet point-risk lower bound for all bounded estimator kernels.

The uniform large-alphabet point-risk lower bound for all bounded estimator kernels.

theorem largeAlphabet_center_separation Lemma largeAlphabet_center_separation in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
q :
ℝ
hq :
0 < q
hq1 :
q ≤ 1
conclusion 1
1 / 2 - q / (1 + q) = (1 - q) / (2 * (1 + q))
conclusion 2
(1 - q) / 4 ≤ 1 / 2 - q / (1 + q)
conclusion 3
1 / 2 - q / (1 + q) ≤ (1 - q) / 2
Proof (Lean source)
-- @node: largeAlphabet_center_separation lemma largeAlphabet_center_separation (q : ℝ) (hq : 0 < q) (hq1 : q ≤ 1) : 1 / 2 - q / (1 + q) = (1 - q) / (2 * (1 + q)) ∧ (1 - q) / 4 ≤ 1 / 2 - q / (1 + q) ∧ 1 / 2 - q / (1 + q) ≤ (1 - q) / 2 := by have hp : 0 < 1 + q := by linarith have heq : 1 / 2 - q / (1 + q) = (1 - q) / (2 * (1 + q)) := by field_simp ring refine ⟨heq, ?_, ?_⟩ · rw [heq] apply (le_div_iff₀ (by positivity : 0 < 2 * (1 + q))).mpr nlinarith · rw [heq] apply (div_le_iff₀ (by positivity : 0 < 2 * (1 + q))).mpr nlinarith
CausalSmith.Stat.MarRareqLogfrontier.largeAlphabet_center_separation · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/TUnrestrictedLargeAlphabetDeficitLower.lean:13
theorem largeAlphabet_prior_bad_probability Lemma largeAlphabet_prior_bad_probability in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q h :
ℝ
hn :
1 ≤ n
hd :
1024 * n ^ 2 ≤ d
hq :
q ≤ 1
hregime :
(n : ℝ)⁻¹ ≤ (1 - q) ^ 2
hsep :
(1 - q) / 4 ≤ h
(binaryCellPrior d).real {ξ | h / 4 < |cellPriorTarget ξ - 1 / 2|} ≤ 1 / 16
Proof (Lean source)
-- @node: largeAlphabet_prior_bad_probability lemma largeAlphabet_prior_bad_probability (n d : ℕ) (q h : ℝ) (hn : 1 ≤ n) (hd : 1024 * n ^ 2 ≤ d) (hq : q ≤ 1) (hregime : (n : ℝ)⁻¹ ≤ (1 - q) ^ 2) (hsep : (1 - q) / 4 ≤ h) : (binaryCellPrior d).real {ξ | h / 4 < |cellPriorTarget ξ - 1 / 2|} ≤ 1 / 16 := by have hnpos : 0 < (n : ℝ) := by exact_mod_cast hn have hnreal : (1 : ℝ) ≤ n := by exact_mod_cast hn have hdreal : 1024 * (n : ℝ) ^ 2 ≤ d := by exact_mod_cast hd have hdpos : 0 < (d : ℝ) := by nlinarith have hdNat : 1 ≤ d := by exact_mod_cast (show (1 : ℝ) ≤ d by nlinarith) have hdelta : 0 < 1 - q := by have hinv : 0 < (n : ℝ)⁻¹ := inv_pos.mpr hnpos nlinarith have hh : 0 < h := by linarith have hsquare : (1 - q) ^ 2 ≤ 16 * h ^ 2 := by nlinarith have hndelta : 1 ≤ (n : ℝ) * (1 - q) ^ 2 := by have hm := mul_le_mul_of_nonneg_left hregime hnpos.le simpa [ne_of_gt hnpos] using hm have hbudget : 64 ≤ (d : ℝ) * h ^ 2 := by have h₁ := mul_le_mul_of_nonneg_left hsquare (by positivity : 0 ≤ (n : ℝ) ^ 2) have h₂ := mul_le_mul_of_nonneg_right hdreal (sq_nonneg h) have h₃ := mul_le_mul_of_nonneg_left hndelta hnpos.le nlinarith refine (binaryCellPrior_target_concentration d hdNat (h / 4) (by positivity)).trans ?_ apply (div_le_iff₀ (by positivity : 0 < 4 * (d : ℝ) * (h / 4) ^ 2)).mpr nlinarith
CausalSmith.Stat.MarRareqLogfrontier.largeAlphabet_prior_bad_probability · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/TUnrestrictedLargeAlphabetDeficitLower.lean:31
theorem largeAlphabet_center_prior_concentration Lemma largeAlphabet_center_prior_concentration in the paper ↗

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
hn :
1 ≤ n
hd :
1024 * n ^ 2 ≤ d
hq :
0 < q
hq1 :
q ≤ 1
hregime :
(n : ℝ)⁻¹ ≤ (1 - q) ^ 2
(binaryCellPrior d).real {ξ | (1 / 2 - q / (1 + q)) / 4 < |cellPriorTarget ξ - 1 / 2|}
≤ 1 / 16
Proof (Lean source)
-- @node: largeAlphabet_center_prior_concentration lemma largeAlphabet_center_prior_concentration (n d : ℕ) (q : ℝ) (hn : 1 ≤ n) (hd : 1024 * n ^ 2 ≤ d) (hq : 0 < q) (hq1 : q ≤ 1) (hregime : (n : ℝ)⁻¹ ≤ (1 - q) ^ 2) : (binaryCellPrior d).real {ξ | (1 / 2 - q / (1 + q)) / 4 < |cellPriorTarget ξ - 1 / 2|} ≤ 1 / 16 := by exact largeAlphabet_prior_bad_probability n d q (1 / 2 - q / (1 + q)) hn hd hq1 hregime (largeAlphabet_center_separation q hq hq1).2.1
CausalSmith.Stat.MarRareqLogfrontier.largeAlphabet_center_prior_concentration · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/TUnrestrictedLargeAlphabetDeficitLower.lean:61
theorem largeAlphabet_deficit_minimax_lower

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
hn :
1 ≤ n
hd :
1024 * n ^ 2 ≤ d
hq :
0 < q
hq1 :
q ≤ 1
hregime :
(n : ℝ)⁻¹ ≤ (1 - q) ^ 2
(1 - q) ^ 2 / 1024 ≤ unrestrictedMinimaxRisk n d q
Proof (Lean source)
-- @node: largeAlphabet_deficit_minimax_lower lemma largeAlphabet_deficit_minimax_lower (n d : ℕ) (q : ℝ) (hn : 1 ≤ n) (hd : 1024 * n ^ 2 ≤ d) (hq : 0 < q) (hq1 : q ≤ 1) (hregime : (n : ℝ)⁻¹ ≤ (1 - q) ^ 2) : (1 - q) ^ 2 / 1024 ≤ unrestrictedMinimaxRisk n d q := by have hdpos : 1 ≤ d := by nlinarith let T₀ : Estimator n d := Estimator.ofMap (fun _ => 0) ⟨measurable_const, by intro s; norm_num⟩ let : Nonempty (Estimator n d) := ⟨T₀⟩ unfold unrestrictedMinimaxRisk apply Causalean.Stat.le_minimaxValue intro T let h : ℝ := 1 / 2 - q / (1 + q) have hsep := (largeAlphabet_center_separation q hq hq1).2.1 have hh : 0 ≤ h := by dsimp [h]; linarith let P := largeAlphabetComparisonLaw d q hdpos hq hq1 let := P.2 let : IsProbabilityMeasure (P.1.map obs) := Measure.isProbabilityMeasure_map (by fun_prop) let : IsProbabilityMeasure (sampleLaw n P) := by unfold sampleLaw infer_instance let E : Set ((Fin n → ObsRecord d) × ℝ) := {z | z.2 ≤ 1 / 2 - h / 2} have hE : MeasurableSet E := by measurability have havg := largeAlphabet_prior_test_risk n d q hdpos hq hq1 T (1 / 2) h hh have hcomp := largeAlphabet_comparison_test_risk (sampleLaw n P) T (1 / 2) h hh have htarget : 1 / 2 - h = ate P := by rw [show ate P = q / (1 + q) from largeAlphabetComparisonLaw_ate d q hdpos hq hq1] dsimp [h] ring rw [htarget] at hcomp change (h ^ 2 / 16) * (sampleLaw n P ⊗ₘ T.1).real Eᶜ ≤ squaredRisk T P at hcomp have htest := largeAlphabet_actual_collision_testing n d q hn hd hq hq1 T E hE have hbad := largeAlphabet_center_prior_concentration n d q hn hd hq hq1 hregime have hscaled := mul_le_mul_of_nonneg_left htest (by positivity : 0 ≤ h ^ 2 / 16) have hpenalty := mul_le_mul_of_nonneg_left hbad (by positivity : 0 ≤ h ^ 2 / 16) have hbayes : h ^ 2 / 32 ≤ (∫ ξ, squaredRisk T (largeAlphabetLaw q ξ hdpos hq hq1) ∂binaryCellPrior d) + squaredRisk T P := by change (h ^ 2 / 16) * (1 - (1 / 8192 : ℝ)) ≤ (h ^ 2 / 16) * ((largeAlphabetSampleMixture n d q hdpos hq hq1 ⊗ₘ T.1).real E + (sampleLaw n P ⊗ₘ T.1).real Eᶜ) at hscaled change (h ^ 2 / 16) * (binaryCellPrior d).real {ξ | h / 4 < |cellPriorTarget ξ - 1 / 2|} ≤ (h ^ 2 / 16) * (1 / 16) at hpenalty change (h ^ 2 / 16) * (largeAlphabetSampleMixture n d q hdpos hq hq1 ⊗ₘ T.1).real E ≤ _ at havg nlinarith only [hscaled, havg, hcomp, hpenalty, sq_nonneg h] have hbdd : BddAbove (range (fun P : {P : FullLaw d // UnrestrictedArrivalModelClass n d q P} => squaredRisk T P.1)) := by refine ⟨4, ?_⟩ rintro _ ⟨P, rfl⟩ exact (unrestricted_squaredRisk_bounds T P.1).2 have hb₀ := largeAlphabet_prior_squaredRisk_le_worst n d q hn hdpos hq hq1 T have hb₁ := le_worstCaseRisk (risk := fun (T : Estimator n d) (P : {P : FullLaw d // UnrestrictedArrivalModelClass n d q P}) => squaredRisk T P.1) (e := T) hbdd ⟨P, largeAlphabetComparisonLaw_model n d q hn hdpos hq hq1⟩ have hsquare : (1 - q) ^ 2 ≤ 16 * h ^ 2 := by change (1 - q) / 4 ≤ h at hsep nlinarith [sq_nonneg (h - (1 - q) / 4)] nlinarith only [hbayes, hb₀, hb₁, hsquare]
CausalSmith.Stat.MarRareqLogfrontier.largeAlphabet_deficit_minimax_lower · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/TUnrestrictedLargeAlphabetDeficitLower.lean:72
theorem unrestricted_large_alphabet_deficit_lower

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
hn :
1 ≤ n
hd :
1024 * n ^ 2 ≤ d
hq :
0 < q
hq1 :
q ≤ 1
conclusion 1
max (1 / (256 * (n : ℝ))) ((1 - q) ^ 2 / 1024) ≤ unrestrictedMinimaxRisk n d q
conclusion 2
unrestrictedMinimaxRisk n d q ≤ 4 / (n : ℝ) + (1 - q) ^ 2
conclusion 3
(1 / 2048 : ℝ) * ((n : ℝ)⁻¹ + (1 - q) ^ 2) ≤ unrestrictedMinimaxRisk n d q
conclusion 4
unrestrictedMinimaxRisk n d q ≤ 4 * ((n : ℝ)⁻¹ + (1 - q) ^ 2)
Proof (Lean source)
theorem unrestricted_large_alphabet_deficit_lower (n d : ℕ) (q : ℝ) (hn : 1 ≤ n) (hd : 1024 * n ^ 2 ≤ d) (hq : 0 < q) (hq1 : q ≤ 1) : max (1 / (256 * (n : ℝ))) ((1 - q) ^ 2 / 1024) ≤ unrestrictedMinimaxRisk n d q ∧ unrestrictedMinimaxRisk n d q ≤ 4 / (n : ℝ) + (1 - q) ^ 2 ∧ (1 / 2048 : ℝ) * ((n : ℝ)⁻¹ + (1 - q) ^ 2) ≤ unrestrictedMinimaxRisk n d q ∧ unrestrictedMinimaxRisk n d q ≤ 4 * ((n : ℝ)⁻¹ + (1 - q) ^ 2) := by have hdpos : 1 ≤ d := by nlinarith obtain ⟨C, hC, _, henvelope⟩ := unrestricted_near_complete_arrival_envelope obtain ⟨hfloor, hupper, _⟩ := henvelope n d q hn hdpos hq hq1 have hupper' : unrestrictedMinimaxRisk n d q ≤ 4 / (n : ℝ) + (1 - q) ^ 2 := hupper.trans ((min_le_right _ _).trans (min_le_right _ _)) have hdeficit : (1 - q) ^ 2 / 1024 ≤ unrestrictedMinimaxRisk n d q := by by_cases hsmall : (1 - q) ^ 2 ≤ (n : ℝ)⁻¹ · refine le_trans ?_ hfloor have hnpos : 0 < (n : ℝ) := by exact_mod_cast hn have heq : 1 / (256 * (n : ℝ)) = (n : ℝ)⁻¹ / 256 := by field_simp rw [heq] nlinarith [inv_nonneg.mpr hnpos.le, sq_nonneg (1 - q)] · have hregime : (n : ℝ)⁻¹ ≤ (1 - q) ^ 2 := (lt_of_not_ge hsmall).le exact largeAlphabet_deficit_minimax_lower n d q hn hd hq hq1 hregime have hmax := max_le hfloor hdeficit refine ⟨hmax, hupper', ?_, ?_⟩ · have hnpos : 0 < (n : ℝ) := by exact_mod_cast hn have heq : 1 / (256 * (n : ℝ)) = (n : ℝ)⁻¹ / 256 := by field_simp rw [heq] at hfloor linarith [inv_nonneg.mpr hnpos.le] · have heq : 4 / (n : ℝ) = 4 * (n : ℝ)⁻¹ := by rw [div_eq_mul_inv] rw [heq] at hupper' nlinarith [sq_nonneg (1 - q)]
CausalSmith.Stat.MarRareqLogfrontier.unrestricted_large_alphabet_deficit_lower · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/TUnrestrictedLargeAlphabetDeficitLower.lean:141
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.TUnrestrictedMixedCountUpper 1 declarations TUnrestrictedMixedCountUpper for the finite rare-arrival experiment.

TUnrestrictedMixedCountUpper for the finite rare-arrival experiment.

theorem unrestricted_mixed_count_upper

the stated mathematical conclusion holds.

Formal statement
∃ C : ℝ,
0 < C
conclusion 1
n d :
ℕ
q :
ℝ
P :
IIDSampling n (sampleLaw n P) (fun (i : Fin n) (s : Fin n → ObsRecord d) => s i) P
Proof (Lean source)
theorem unrestricted_mixed_count_upper : ∃ C : ℝ, 0 < C ∧ -- @realizes \(\overline C\)(universal upper constant) ∀ (n d : ℕ) (q : ℝ) (P : FullLaw d), UnrestrictedArrivalModelClass n d q P → IIDSampling n (sampleLaw n P) (fun (i : Fin n) (s : Fin n → ObsRecord d) => s i) P → deterministicRisk (mixedCountEstimator n d q) P ≤ riskEnvelope n d q ∧ riskEnvelope n d q ≤ C * frontierRate n d q ∧ deterministicRisk (mixedCountEstimator n d q) P ≤ auxiliaryMixedRisk n q P := by obtain ⟨C, hC, hcertificate⟩ := unrestricted_uniform_mixed_count_certificate refine ⟨C, hC, ?_⟩ intro n d q P hP hiid obtain ⟨hrisk, hrate⟩ := hcertificate n d q P hP hiid have hident := unrestricted_cell_identification P hP rw [← hident] at hrisk exact ⟨hrisk, hrate, mixed_count_derandomization n d q P⟩
CausalSmith.Stat.MarRareqLogfrontier.unrestricted_mixed_count_upper · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/TUnrestrictedMixedCountUpper.lean:17
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.TUnrestrictedNearCompleteArrivalEnvelope 4 declarations The all-kernel point-risk envelope at every arrival floor.

The all-kernel point-risk envelope at every arrival floor. The same universal constant also certifies the mixed-count upper theorem. No rare-arrival slice is used.

theorem unrestricted_arrival_floor_mono

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q q' :
ℝ
P :
hq :
0 < q
hqq' :
q ≤ q'
Proof (Lean source)
-- @node: unrestricted_arrival_floor_mono lemma unrestricted_arrival_floor_mono {n d : ℕ} {q q' : ℝ} {P : FullLaw d} (hP : UnrestrictedArrivalModelClass n d q' P) (hq : 0 < q) (hqq' : q ≤ q') : UnrestrictedArrivalModelClass n d q P := by refine ⟨hP.n_pos, hP.d_pos, hq, hqq'.trans hP.q_le_one, hP.randomized, hP.balanced, hP.surrogate, hP.outcome, hP.mar, ?_⟩ intro j hj exact (mul_le_mul_of_nonneg_right hqq' measureReal_nonneg).trans (hP.arrival j hj)
CausalSmith.Stat.MarRareqLogfrontier.unrestricted_arrival_floor_mono · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/TUnrestrictedNearCompleteArrivalEnvelope.lean:14
theorem unrestricted_deterministic_upper

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q b :
ℝ
f :
(Fin n → ObsRecord d) → ℝ
hf :
Measurable f ∧ ∀ s, f s ∈ Icc (-1 : ℝ) 1
hb :
0 ≤ b
hbound :
conclusion 1
conclusion 2
worstCaseRiskReal (fun (_ : Unit) (P : {P : FullLaw d // UnrestrictedArrivalModelClass n d q P}) => deterministicRisk f P.1) ()
≤ b
Proof (Lean source)
-- @node: unrestricted_deterministic_upper lemma unrestricted_deterministic_upper {n d : ℕ} {q b : ℝ} (f : (Fin n → ObsRecord d) → ℝ) (hf : Measurable f ∧ ∀ s, f s ∈ Icc (-1 : ℝ) 1) (hb : 0 ≤ b) (hbound : ∀ P : FullLaw d, UnrestrictedArrivalModelClass n d q P → deterministicRisk f P ≤ b) : unrestrictedMinimaxRisk n d q ≤ b ∧ Causalean.Stat.worstCaseRiskReal (fun (_ : Unit) (P : {P : FullLaw d // UnrestrictedArrivalModelClass n d q P}) => deterministicRisk f P.1) () ≤ b := by have hw : Causalean.Stat.worstCaseRiskReal (fun (_ : Unit) (P : {P : FullLaw d // UnrestrictedArrivalModelClass n d q P}) => deterministicRisk f P.1) () ≤ b := by unfold Causalean.Stat.worstCaseRiskReal by_cases hne : Nonempty {P : FullLaw d // UnrestrictedArrivalModelClass n d q P} · letI := hne exact ciSup_le (fun P => hbound P.1 P.2) · haveI := not_nonempty_iff.mp hne simpa using hb refine ⟨le_trans ?_ hw, hw⟩ let T : Estimator n d := Estimator.ofMap f hf have h := minimaxValue_le_worstCaseRisk_of_nonneg (risk := fun (T : Estimator n d) (P : {P : FullLaw d // UnrestrictedArrivalModelClass n d q P}) => squaredRisk T P.1) (fun T P => (unrestricted_squaredRisk_bounds T P.1).1) T simpa [unrestrictedMinimaxRisk, Causalean.Stat.worstCaseRiskReal, squaredRisk, deterministicRisk, T, Estimator.ofMap, Kernel.deterministic_apply] using h
CausalSmith.Stat.MarRareqLogfrontier.unrestricted_deterministic_upper · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/TUnrestrictedNearCompleteArrivalEnvelope.lean:24
theorem unrestricted_complete_submodel_floor

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
hn :
1 ≤ n
hd :
1 ≤ d
hq :
0 < q
hq1 :
q ≤ 1
1 / (256 * (n : ℝ)) ≤ unrestrictedMinimaxRisk n d q
Proof (Lean source)
-- @node: unrestricted_complete_submodel_floor lemma unrestricted_complete_submodel_floor {n d : ℕ} {q : ℝ} (hn : 1 ≤ n) (hd : 1 ≤ d) (hq : 0 < q) (hq1 : q ≤ 1) : 1 / (256 * (n : ℝ)) ≤ unrestrictedMinimaxRisk n d q := by have hfloor := (complete_arrival_frontier_direct n d hn hd).1 refine hfloor.trans ?_ let T₀ : Estimator n d := Estimator.ofMap (fun _ => 0) ⟨measurable_const, by intro s; norm_num⟩ letI : Nonempty (Estimator n d) := ⟨T₀⟩ apply minimaxValue_mono_class_of_nonneg (risk := fun (T : Estimator n d) (P : {P : FullLaw d // UnrestrictedArrivalModelClass n d 1 P}) => squaredRisk T P.1) (risk' := fun (T : Estimator n d) (P : {P : FullLaw d // UnrestrictedArrivalModelClass n d q P}) => squaredRisk T P.1) (fun P => ⟨P.1, unrestricted_arrival_floor_mono P.2 hq hq1⟩) · exact fun T P => (unrestricted_squaredRisk_bounds T P.1).1 · exact fun T P => (unrestricted_squaredRisk_bounds T P.1).1 · intro T refine ⟨4, ?_⟩ rintro _ ⟨P, rfl⟩ exact (unrestricted_squaredRisk_bounds T P.1).2 · exact fun _ _ => le_rfl
CausalSmith.Stat.MarRareqLogfrontier.unrestricted_complete_submodel_floor · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/TUnrestrictedNearCompleteArrivalEnvelope.lean:53
theorem unrestricted_near_complete_arrival_envelope

the stated mathematical conclusion holds.

Formal statement
∃ C : ℝ,
0 < C
conclusion 1
n d :
ℕ
q :
ℝ
P :
IIDSampling n (sampleLaw n P) (fun (i : Fin n) (s : Fin n → ObsRecord d) => s i) P
conclusion 2
n d :
ℕ
q :
ℝ
1 ≤ n
1 ≤ d
0 < q
q ≤ 1
1 / (256 * (n : ℝ)) ≤ unrestrictedMinimaxRisk n d q
≤ min 1 (min (C * frontierRate n d q) (4 / (n : ℝ) + (1 - q) ^ 2))
≤ 4 / (n : ℝ) + (1 - q) ^ 2
Proof (Lean source)
theorem unrestricted_near_complete_arrival_envelope : ∃ C : ℝ, 0 < C ∧ -- @realizes \(\overline C\)(shared universal upper constant) (∀ (n d : ℕ) (q : ℝ) (P : FullLaw d), UnrestrictedArrivalModelClass n d q P → IIDSampling n (sampleLaw n P) (fun (i : Fin n) (s : Fin n → ObsRecord d) => s i) P → deterministicRisk (mixedCountEstimator n d q) P ≤ riskEnvelope n d q ∧ riskEnvelope n d q ≤ C * frontierRate n d q ∧ deterministicRisk (mixedCountEstimator n d q) P ≤ auxiliaryMixedRisk n q P) ∧ ∀ (n d : ℕ) (q : ℝ), 1 ≤ n → 1 ≤ d → 0 < q → q ≤ 1 → 1 / (256 * (n : ℝ)) ≤ unrestrictedMinimaxRisk n d q ∧ unrestrictedMinimaxRisk n d q ≤ min 1 (min (C * frontierRate n d q) (4 / (n : ℝ) + (1 - q) ^ 2)) ∧ worstCaseRiskReal (fun (_ : Unit) (P : {P : FullLaw d // UnrestrictedArrivalModelClass n d q P}) => deterministicRisk (completeArrivalHTEstimator n d) P.1) () ≤ 4 / (n : ℝ) + (1 - q) ^ 2 := by obtain ⟨C, hC, hmixed⟩ := unrestricted_mixed_count_upper refine ⟨C, hC, hmixed, ?_⟩ intro n d q hn hd hq hq1 have hzero : unrestrictedMinimaxRisk n d q ≤ 1 := by apply (unrestricted_deterministic_upper (fun _ => 0) ⟨measurable_const, by intro s; norm_num⟩ (by norm_num) ?_).1 intro P hP letI : IsProbabilityMeasure P.1 := P.2 letI : IsProbabilityMeasure (P.1.map obs) := Measure.isProbabilityMeasure_map (by fun_prop) letI : IsProbabilityMeasure (sampleLaw n P) := by unfold sampleLaw; infer_instance have ht := ate_mem_unit_interval P have hs : (ate P) ^ 2 ≤ 1 := by nlinarith [ht.1, ht.2] simpa [deterministicRisk] using hs have hrate : 0 ≤ C * frontierRate n d q := by apply mul_nonneg hC.le unfold frontierRate effectiveSize exact le_min (by norm_num) (add_nonneg (inv_nonneg.mpr (mul_nonneg (Nat.cast_nonneg _) hq.le)) (sq_nonneg _)) have hmix : unrestrictedMinimaxRisk n d q ≤ C * frontierRate n d q := by apply (unrestricted_deterministic_upper (mixedCountEstimator n d q) (mixed_count_estimator_regular n d q) hrate ?_).1 intro P hP obtain ⟨hrisk, henv, _⟩ := hmixed n d q P hP (sampleLaw_iid n P) exact hrisk.trans henv have hht := unrestricted_deterministic_upper (q := q) (completeArrivalHTEstimator n d) (complete_arrival_ht_estimator_regular n d) (add_nonneg (div_nonneg (by norm_num) (Nat.cast_nonneg _)) (sq_nonneg _)) (fun P hP => observed_contrast_risk_le P hP) exact ⟨unrestricted_complete_submodel_floor hn hd hq hq1, le_min hzero (le_min hmix hht.1), hht.2⟩
CausalSmith.Stat.MarRareqLogfrontier.unrestricted_near_complete_arrival_envelope · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/TUnrestrictedNearCompleteArrivalEnvelope.lean:78
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.TUnrestrictedUniformMixedCountCertificate 1 declarations TUnrestrictedUniformMixedCountCertificate for the finite rare-arrival experiment.

TUnrestrictedUniformMixedCountCertificate for the finite rare-arrival experiment.

theorem unrestricted_uniform_mixed_count_certificate

the stated mathematical conclusion holds.

Formal statement
∃ C : ℝ,
0 < C
conclusion 1
n d :
ℕ
q :
ℝ
P :
IIDSampling n (sampleLaw n P) (fun (i : Fin n) (s : Fin n → ObsRecord d) => s i) P
(∫ s, (mixedCountEstimator n d q s - cellFunctional P) ^ 2 ∂(sampleLaw n P))
≤ riskEnvelope n d q
riskEnvelope n d q ≤ C * frontierRate n d q
Proof (Lean source)
theorem unrestricted_uniform_mixed_count_certificate : ∃ C : ℝ, 0 < C ∧ -- @realizes \(\overline C\)(universal upper constant) ∀ (n d : ℕ) (q : ℝ) (P : FullLaw d), UnrestrictedArrivalModelClass n d q P → IIDSampling n (sampleLaw n P) (fun (i : Fin n) (s : Fin n → ObsRecord d) => s i) P → (∫ s, (mixedCountEstimator n d q s - cellFunctional P) ^ 2 ∂(sampleLaw n P)) ≤ riskEnvelope n d q ∧ riskEnvelope n d q ≤ C * frontierRate n d q := by obtain ⟨C, hC, hrate⟩ := riskEnvelope_le_frontierRate refine ⟨C, hC, ?_⟩ intro n d q P hP _ exact ⟨unrestricted_auxiliary_risk_envelope n d q P hP, hrate n d q hP.n_pos hP.d_pos hP.q_pos hP.q_le_one⟩
CausalSmith.Stat.MarRareqLogfrontier.unrestricted_uniform_mixed_count_certificate · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/TUnrestrictedUniformMixedCountCertificate.lean:14
CausalSmith.Stat.STAT_MarRareqLogfrontier_Research.TZengFixedPositivityPolynomialFrontier 13 declarations TZengFixedPositivityPolynomialFrontier for the finite rare-arrival experiment.

TZengFixedPositivityPolynomialFrontier for the finite rare-arrival experiment.

theorem zeng_zero_control_risk_le_minimax

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
ε :
ℝ
Proof (Lean source)
lemma zeng_zero_control_risk_le_minimax (n d : ℕ) (ε : ℝ) : zengZeroControlRisk n d ε ≤ zengMinimaxRisk n d ε := by let T₀ : ZengEstimator n d := ⟨Kernel.const _ (Measure.dirac 0), inferInstance, by intro s simp [Kernel.const_apply]⟩ haveI : Nonempty (ZengEstimator n d) := ⟨T₀⟩ let φ : {P : ZengLaw d // P ∈ zengZeroControlClass d ε} → {P : ZengLaw d // P ∈ zengDiscreteClass d ε} := fun P => ⟨P.1, P.2.1⟩ unfold zengZeroControlRisk zengMinimaxRisk apply minimaxValue_mono_class_of_nonneg φ · intro T P exact (zeng_squaredRisk_bounds ε T P.1 P.2.1).1 · intro T P exact (zeng_squaredRisk_bounds ε T P.1 P.2).1 · intro T refine ⟨4, ?_⟩ rintro y ⟨P, rfl⟩ exact (zeng_squaredRisk_bounds ε T P.1 P.2).2 · intro T P exact le_refl _
CausalSmith.Stat.MarRareqLogfrontier.zeng_zero_control_risk_le_minimax · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/TZengFixedPositivityPolynomialFrontier.lean:17
theorem zeng_parametric_minimax_lower

the stated mathematical conclusion holds.

Formal statement
∃ c : ℝ,
0 < c
conclusion 1
n d :
ℕ
ε :
ℝ
1 ≤ n
1 ≤ d
0 < ε
ε < 1 / 2
c / n ≤ zengMinimaxRisk n d ε
Proof (Lean source)
lemma zeng_parametric_minimax_lower : ∃ c : ℝ, 0 < c ∧ ∀ (n d : ℕ) (ε : ℝ), 1 ≤ n → 1 ≤ d → 0 < ε → ε < 1 / 2 → c / n ≤ zengMinimaxRisk n d ε := by obtain ⟨c, hc, hparam⟩ := zeng_parametric_lower refine ⟨c, hc, ?_⟩ intro n d ε hn hd hε0 hε1 exact (hparam n d ε hn hd ⟨hε0, hε1⟩).trans (zeng_zero_control_risk_le_minimax n d ε)
CausalSmith.Stat.MarRareqLogfrontier.zeng_parametric_minimax_lower · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/TZengFixedPositivityPolynomialFrontier.lean:42
theorem thetaPoly_pointwise_jensen

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
ε θ :
ℝ
s :
Fin n → ZengRecord d
(thetaPoly n d ε s - θ) ^ 2
≤ (∑ u : Fin n → Bool, (mixedCountEstimator n d ε (fun i => syntheticRecord (s i) (u i)) - θ) ^ 2) / (2 : ℝ) ^ n
Proof (Lean source)
lemma thetaPoly_pointwise_jensen (n d : ℕ) (ε θ : ℝ) (s : Fin n → ZengRecord d) : (thetaPoly n d ε s - θ) ^ 2 ≤ (∑ u : Fin n → Bool, (mixedCountEstimator n d ε (fun i => syntheticRecord (s i) (u i)) - θ) ^ 2) / (2 : ℝ) ^ n := by let f : (Fin n → Bool) → ℝ := fun u => mixedCountEstimator n d ε (fun i => syntheticRecord (s i) (u i)) - θ have hcard : (Finset.univ : Finset (Fin n → Bool)).card = 2 ^ n := by simp have hcardR : (0 : ℝ) < (2 : ℝ) ^ n := by positivity have hsum : (∑ u : Fin n → Bool, f u) = (2 : ℝ) ^ n * (thetaPoly n d ε s - θ) := by simp only [f, Finset.sum_sub_distrib] simp [thetaPoly, hcard] field_simp have hcs := sq_sum_le_card_mul_sum_sq (s := (Finset.univ : Finset (Fin n → Bool))) (f := f) rw [hcard, Nat.cast_pow, Nat.cast_ofNat, hsum] at hcs change (thetaPoly n d ε s - θ) ^ 2 ≤ (∑ u : Fin n → Bool, f u ^ 2) / (2 : ℝ) ^ n apply (le_div_iff₀ hcardR).2 nlinarith [sq_nonneg ((2 : ℝ) ^ n)]
CausalSmith.Stat.MarRareqLogfrontier.thetaPoly_pointwise_jensen · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/TZengFixedPositivityPolynomialFrontier.lean:55
theorem thetaPoly_regular

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
ε :
ℝ
conclusion 1
conclusion 2
s :
thetaPoly n d ε s ∈ Icc (-1 : ℝ) 1
Proof (Lean source)
lemma thetaPoly_regular (n d : ℕ) (ε : ℝ) : Measurable (thetaPoly n d ε) ∧ ∀ s, thetaPoly n d ε s ∈ Icc (-1 : ℝ) 1 := by constructor · exact measurable_of_finite _ · intro s have hcard : (Finset.univ : Finset (Fin n → Bool)).card = 2 ^ n := by simp have hcardR : (0 : ℝ) < (2 : ℝ) ^ n := by positivity have hlo : -((2 : ℝ) ^ n) ≤ ∑ u : Fin n → Bool, mixedCountEstimator n d ε (fun i => syntheticRecord (s i) (u i)) := by calc -((2 : ℝ) ^ n) = ∑ _u : Fin n → Bool, (-1 : ℝ) := by simp [hcard] _ ≤ _ := Finset.sum_le_sum (fun u _ => (mixed_count_estimator_regular n d ε).2 _ |>.1) have hhi : (∑ u : Fin n → Bool, mixedCountEstimator n d ε (fun i => syntheticRecord (s i) (u i))) ≤ (2 : ℝ) ^ n := by calc _ ≤ ∑ _u : Fin n → Bool, (1 : ℝ) := Finset.sum_le_sum (fun u _ => (mixed_count_estimator_regular n d ε).2 _ |>.2) _ = (2 : ℝ) ^ n := by simp [hcard] change -1 ≤ (∑ u : Fin n → Bool, mixedCountEstimator n d ε (fun i => syntheticRecord (s i) (u i))) / (2 : ℝ) ^ n ∧ (∑ u : Fin n → Bool, mixedCountEstimator n d ε (fun i => syntheticRecord (s i) (u i))) / (2 : ℝ) ^ n ≤ 1 constructor · exact (le_div_iff₀ hcardR).2 (by nlinarith) · exact (div_le_iff₀ hcardR).2 (by nlinarith)
theorem thetaPoly_risk_le_synthetic_average

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
ε :
ℝ
P :
≤ ∫ s, (∑ u : Fin n → Bool, (mixedCountEstimator n d ε (fun i => syntheticRecord (s i) (u i)) - zengATE P) ^ 2) / (2 : ℝ) ^ n ∂(zengSampleLaw n P)
Proof (Lean source)
lemma thetaPoly_risk_le_synthetic_average (n d : ℕ) (ε : ℝ) (P : ZengLaw d) : zengDeterministicRisk (thetaPoly n d ε) P ≤ ∫ s, (∑ u : Fin n → Bool, (mixedCountEstimator n d ε (fun i => syntheticRecord (s i) (u i)) - zengATE P) ^ 2) / (2 : ℝ) ^ n ∂(zengSampleLaw n P) := by letI : IsProbabilityMeasure P.1 := P.2 letI : IsProbabilityMeasure (zengSampleLaw n P) := by unfold zengSampleLaw infer_instance unfold zengDeterministicRisk have hint : Integrable (fun s : Fin n → ZengRecord d => (∑ u : Fin n → Bool, (mixedCountEstimator n d ε (fun i => syntheticRecord (s i) (u i)) - zengATE P) ^ 2) / (2 : ℝ) ^ n) (zengSampleLaw n P) := Integrable.of_finite exact integral_mono_of_nonneg (Filter.Eventually.of_forall (fun s => sq_nonneg _)) hint (Filter.Eventually.of_forall (thetaPoly_pointwise_jensen n d ε (zengATE P)))
CausalSmith.Stat.MarRareqLogfrontier.thetaPoly_risk_le_synthetic_average · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/TZengFixedPositivityPolynomialFrontier.lean:116
theorem zengMinimaxRisk_le_thetaPoly_worst

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
ε :
ℝ
≤ worstCaseRiskReal (fun (_ : Unit) (P : {P : ZengLaw d // P ∈ zengDiscreteClass d ε}) => zengDeterministicRisk (thetaPoly n d ε) P.1) ()
Proof (Lean source)
lemma zengMinimaxRisk_le_thetaPoly_worst (n d : ℕ) (ε : ℝ) : zengMinimaxRisk n d ε ≤ worstCaseRiskReal (fun (_ : Unit) (P : {P : ZengLaw d // P ∈ zengDiscreteClass d ε}) => zengDeterministicRisk (thetaPoly n d ε) P.1) () := by have hregular := thetaPoly_regular n d ε let T : ZengEstimator n d := ⟨Kernel.deterministic (thetaPoly n d ε) hregular.1, inferInstance, by intro s rw [Kernel.deterministic_apply, Measure.dirac_apply] rw [Set.indicator_of_mem (hregular.2 s)] rfl⟩ have hrisk : ∀ (T : ZengEstimator n d) (P : {P : ZengLaw d // P ∈ zengDiscreteClass d ε}), 0 ≤ zengSquaredRisk T P.1 := by intro T P exact integral_nonneg (fun s => integral_nonneg (fun y => sq_nonneg _)) have hval : zengMinimaxRisk n d ε ≤ worstCaseRiskReal (fun (_ : Unit) (P : {P : ZengLaw d // P ∈ zengDiscreteClass d ε}) => zengSquaredRisk T P.1) () := by exact Causalean.Stat.minimaxValue_le_worstCaseRisk_of_nonneg hrisk T have heq : (fun (_ : Unit) (P : {P : ZengLaw d // P ∈ zengDiscreteClass d ε}) => zengSquaredRisk T P.1) = (fun (_ : Unit) P => zengDeterministicRisk (thetaPoly n d ε) P.1) := by funext _ P simp [zengSquaredRisk, zengDeterministicRisk, T, Kernel.deterministic_apply] rw [heq] at hval exact hval
CausalSmith.Stat.MarRareqLogfrontier.zengMinimaxRisk_le_thetaPoly_worst · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/TZengFixedPositivityPolynomialFrontier.lean:140
theorem synthetic_coin_average_integral

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
s :
Fin n → ZengRecord d
F :
(Fin n → ObsRecord d) → ℝ
(∫ o, F o ∂(syntheticProductLaw s))
= (∑ u : Fin n → Bool, F (fun i => syntheticRecord (s i) (u i))) / (2 : ℝ) ^ n
Proof (Lean source)
lemma synthetic_coin_average_integral (n d : ℕ) (s : Fin n → ZengRecord d) (F : (Fin n → ObsRecord d) → ℝ) : (∫ o, F o ∂(syntheticProductLaw s)) = (∑ u : Fin n → Bool, F (fun i => syntheticRecord (s i) (u i))) / (2 : ℝ) ^ n := by let coinPi : Measure (Fin n → Bool) := Measure.pi (fun _ : Fin n => SyntheticCompletion.fairCoin) letI : IsProbabilityMeasure coinPi := by dsimp [coinPi] infer_instance have hmap : syntheticProductLaw s = coinPi.map (fun u i => syntheticRecord (s i) (u i)) := by simpa [coinPi, SyntheticCompletion.fairCoin] using syntheticProductLaw_eq_coin_map s rw [hmap, integral_map (measurable_of_finite _).aemeasurable (measurable_of_finite _).aestronglyMeasurable] rw [integral_fintype (Integrable.of_finite)] have hcoin (u : Fin n → Bool) : coinPi.real {u} = 1 / (2 : ℝ) ^ n := by have hsingle (b : Bool) : (SyntheticCompletion.fairCoin {b}).toReal = (1 / 2 : ℝ) := by cases b <;> simp [SyntheticCompletion.fairCoin] change ((Measure.pi (fun _ : Fin n => SyntheticCompletion.fairCoin)) {u}).toReal = _ rw [Measure.pi_singleton] rw [ENNReal.toReal_prod] simp_rw [hsingle] simp [Finset.prod_const] simp_rw [hcoin] simp only [smul_eq_mul, ← Finset.mul_sum, div_eq_mul_inv, one_mul] ring
CausalSmith.Stat.MarRareqLogfrontier.synthetic_coin_average_integral · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/TZengFixedPositivityPolynomialFrontier.lean:174
theorem thetaPoly_risk_le_completion_risk

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
ε :
ℝ
P :
Pstar :
hsample :
(zengSampleLaw n P).bind syntheticProductLaw = sampleLaw n Pstar
htarget :
ate Pstar = zengATE P
Proof (Lean source)
lemma thetaPoly_risk_le_completion_risk {n d : ℕ} {ε : ℝ} (P : ZengLaw d) (Pstar : FullLaw d) (hsample : (zengSampleLaw n P).bind syntheticProductLaw = sampleLaw n Pstar) (htarget : ate Pstar = zengATE P) : zengDeterministicRisk (thetaPoly n d ε) P ≤ deterministicRisk (mixedCountEstimator n d ε) Pstar := by let F : (Fin n → ObsRecord d) → ℝ := fun o => (mixedCountEstimator n d ε o - zengATE P) ^ 2 have hmeas : Measurable (syntheticProductLaw (n := n) (d := d)) := measurable_of_finite _ have hFbind : Integrable F ((zengSampleLaw n P).bind syntheticProductLaw) := by rw [hsample] letI : IsProbabilityMeasure Pstar.1 := Pstar.2 letI : IsProbabilityMeasure (Pstar.1.map obs) := Measure.isProbabilityMeasure_map (by fun_prop : AEMeasurable obs Pstar.1) unfold sampleLaw exact Integrable.of_finite have hinner (s : Fin n → ZengRecord d) : (∫ o, F o ∂syntheticProductLaw s) = (∑ u : Fin n → Bool, (mixedCountEstimator n d ε (fun i => syntheticRecord (s i) (u i)) - zengATE P) ^ 2) / (2 : ℝ) ^ n := by exact synthetic_coin_average_integral n d s F calc zengDeterministicRisk (thetaPoly n d ε) P ≤ ∫ s, (∑ u : Fin n → Bool, (mixedCountEstimator n d ε (fun i => syntheticRecord (s i) (u i)) - zengATE P) ^ 2) / (2 : ℝ) ^ n ∂(zengSampleLaw n P) := thetaPoly_risk_le_synthetic_average n d ε P _ = ∫ o, F o ∂((zengSampleLaw n P).bind syntheticProductLaw) := by rw [integral_bind hmeas hFbind] simp_rw [hinner] _ = deterministicRisk (mixedCountEstimator n d ε) Pstar := by rw [hsample] simpa [F, deterministicRisk, htarget]
CausalSmith.Stat.MarRareqLogfrontier.thetaPoly_risk_le_completion_risk · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/TZengFixedPositivityPolynomialFrontier.lean:206
theorem thetaPoly_uniform_upper

the stated mathematical conclusion holds.

Formal statement
∃ C : ℝ,
0 < C
conclusion 1
n d :
ℕ
ε :
ℝ
1 ≤ n
1 ≤ d
0 < ε
ε < 1 / 2
worstCaseRiskReal (fun (_ : Unit) (P : {P : ZengLaw d // P ∈ zengDiscreteClass d ε}) => zengDeterministicRisk (thetaPoly n d ε) P.1) ()
≤ C * frontierRate n d ε
Proof (Lean source)
lemma thetaPoly_uniform_upper : ∃ C : ℝ, 0 < C ∧ ∀ (n d : ℕ) (ε : ℝ), 1 ≤ n → 1 ≤ d → 0 < ε → ε < 1 / 2 → Causalean.Stat.worstCaseRiskReal (fun (_ : Unit) (P : {P : ZengLaw d // P ∈ zengDiscreteClass d ε}) => zengDeterministicRisk (thetaPoly n d ε) P.1) () ≤ C * frontierRate n d ε := by obtain ⟨C, hC, hupper⟩ := unrestricted_mixed_count_upper refine ⟨C, hC, ?_⟩ intro n d ε hn hd hε hεhalf unfold Causalean.Stat.worstCaseRiskReal by_cases hne : Nonempty {P : ZengLaw d // P ∈ zengDiscreteClass d ε} · letI := hne apply ciSup_le intro P obtain ⟨Pstar, hclass, hiid, hsample, htarget⟩ := synthetic_randomization_kernel hn hε hεhalf P.1 P.2 have hrisk := thetaPoly_risk_le_completion_risk (ε := ε) P.1 Pstar hsample htarget have hbound := hupper n d ε Pstar hclass hiid nlinarith [hrisk, hbound.1, hbound.2.1] · haveI : IsEmpty {P : ZengLaw d // P ∈ zengDiscreteClass d ε} := not_nonempty_iff.mp hne simp have hrate : 0 ≤ frontierRate n d ε := by unfold frontierRate have hN : 0 < effectiveSize n ε := by unfold effectiveSize positivity positivity exact mul_nonneg hC.le hrate
theorem zeng_frontierRate_le_fixedQRate_mul

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
n d :
ℕ
q :
ℝ
hn :
1 ≤ n
hq :
0 < q
hq1 :
q ≤ 1
frontierRate n d q ≤ ((1 - log q) / q) ^ 2 * fixedQRate n d
Proof (Lean source)
lemma zeng_frontierRate_le_fixedQRate_mul (n d : ℕ) (q : ℝ) (hn : 1 ≤ n) (hq : 0 < q) (hq1 : q ≤ 1) : frontierRate n d q ≤ ((1 - log q) / q) ^ 2 * fixedQRate n d := by let N := effectiveSize n q let L := logScale n q let L₁ := log (exp 1 + n) let K := (1 - log q) / q have hn0 : (0 : ℝ) < n := by exact_mod_cast (by omega : 0 < n) have hN : 0 < N := mul_pos hn0 hq have hL : 1 ≤ L := by dsimp [L, logScale] rw [Real.le_log_iff_exp_le (by positivity)] dsimp [N, effectiveSize] at * linarith have hL₁ : 0 < L₁ := by dsimp [L₁] apply Real.log_pos nlinarith [Real.add_one_le_exp (1 : ℝ)] have hlogq : log q ≤ 0 := Real.log_nonpos hq.le hq1 have hlogbound : L₁ ≤ (1 - log q) * L := by have harg : exp 1 + (n : ℝ) ≤ (exp 1 + N) / q := by apply (le_div_iff₀ hq).2 dsimp [N, effectiveSize] nlinarith [Real.exp_pos (1 : ℝ)] have hbase : L₁ ≤ L - log q := by calc L₁ ≤ log ((exp 1 + N) / q) := Real.log_le_log (by positivity) harg _ = L - log q := by rw [Real.log_div (by positivity) (ne_of_gt hq)] rfl have hprod := mul_nonneg (neg_nonneg.mpr hlogq) (sub_nonneg.mpr hL) nlinarith have hK : 1 ≤ K := by dsimp [K] apply (le_div_iff₀ hq).2 linarith have hKpos : 0 < K := lt_of_lt_of_le (by norm_num) hK have hD : 0 < N * L := mul_pos hN (by linarith) have hD₁ : 0 < (n : ℝ) * L₁ := mul_pos hn0 hL₁ have hDen : (n : ℝ) * L₁ ≤ K * (N * L) := by calc (n : ℝ) * L₁ ≤ (n : ℝ) * ((1 - log q) * L) := mul_le_mul_of_nonneg_left hlogbound hn0.le _ = K * (N * L) := by dsimp [K, N, effectiveSize] field_simp have hfirst : N⁻¹ ≤ K ^ 2 * (n : ℝ)⁻¹ := by have hqK : q * K = 1 - log q := by dsimp [K] field_simp have hK2 : 1 ≤ q * K ^ 2 := by nlinarith [mul_nonneg (sub_nonneg.mpr hK) (sub_nonneg.mpr hlogq)] have hN_eq : N = (n : ℝ) * q := rfl have h : 1 / N ≤ K ^ 2 / (n : ℝ) := by apply (div_le_div_iff₀ hN hn0).2 rw [hN_eq] nlinarith [mul_nonneg hn0.le (sub_nonneg.mpr hK2)] simpa [one_div, div_eq_mul_inv] using h have hsecond : ((d : ℝ) / (N * L)) ^ 2 ≤ K ^ 2 * ((d : ℝ) / ((n : ℝ) * L₁)) ^ 2 := by have hdiv : (d : ℝ) / (N * L) ≤ K * ((d : ℝ) / ((n : ℝ) * L₁)) := by have h : (d : ℝ) / (N * L) ≤ (K * d) / ((n : ℝ) * L₁) := by apply (div_le_div_iff₀ hD hD₁).2 have hd0 : 0 ≤ (d : ℝ) := Nat.cast_nonneg _ nlinarith [mul_nonneg hd0 (sub_nonneg.mpr hDen)] convert h using 1 <;> ring have hleft : 0 ≤ (d : ℝ) / (N * L) := div_nonneg (Nat.cast_nonneg _) hD.le nlinarith [sq_nonneg (K * ((d : ℝ) / ((n : ℝ) * L₁)) - ((d : ℝ) / (N * L)))] have hr0 : 0 ≤ (n : ℝ)⁻¹ + ((d : ℝ) / ((n : ℝ) * L₁)) ^ 2 := by positivity have hsum : N⁻¹ + ((d : ℝ) / (N * L)) ^ 2 ≤ K ^ 2 * ((n : ℝ)⁻¹ + ((d : ℝ) / ((n : ℝ) * L₁)) ^ 2) := by nlinarith [hfirst, hsecond] dsimp [frontierRate, fixedQRate, N, L, L₁, K] at * calc min 1 ((effectiveSize n q)⁻¹ + ((d : ℝ) / (effectiveSize n q * logScale n q)) ^ 2) ≤ min 1 (K ^ 2 * ((n : ℝ)⁻¹ + ((d : ℝ) / ((n : ℝ) * log (exp 1 + n))) ^ 2)) := min_le_min_left 1 hsum _ ≤ K ^ 2 * min 1 ((n : ℝ)⁻¹ + ((d : ℝ) / ((n : ℝ) * log (exp 1 + n))) ^ 2) := by rcases le_total ((n : ℝ)⁻¹ + ((d : ℝ) / ((n : ℝ) * log (exp 1 + n))) ^ 2) 1 with h | h · rw [min_eq_right h] exact (min_le_right _ _) · rw [min_eq_left h] exact (min_le_left _ _).trans (by nlinarith [sq_nonneg K])
CausalSmith.Stat.MarRareqLogfrontier.zeng_frontierRate_le_fixedQRate_mul · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/TZengFixedPositivityPolynomialFrontier.lean:279
theorem zeng_minimax_upper_fixedQ

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
ε :
ℝ
hε :
0 < ε
hεhalf :
ε < 1 / 2
∃ Cε : ℝ,
0 < Cε
conclusion 1
n d :
ℕ
1 ≤ n
1 ≤ d
zengMinimaxRisk n d ε ≤ Cε * fixedQRate n d
Proof (Lean source)
lemma zeng_minimax_upper_fixedQ (ε : ℝ) (hε : 0 < ε) (hεhalf : ε < 1 / 2) : ∃ Cε : ℝ, 0 < Cε ∧ ∀ (n d : ℕ), 1 ≤ n → 1 ≤ d → zengMinimaxRisk n d ε ≤ Cε * fixedQRate n d := by obtain ⟨C, hC, hupper⟩ := thetaPoly_uniform_upper let K := ((1 - log ε) / ε) ^ 2 have hlog : log ε ≤ 0 := Real.log_nonpos hε.le (by linarith) have hK : 0 < K := by dsimp [K] exact pow_pos (div_pos (by linarith) hε) _ refine ⟨C * K, mul_pos hC hK, ?_⟩ intro n d hn hd calc zengMinimaxRisk n d ε ≤ worstCaseRiskReal (fun (_ : Unit) (P : {P : ZengLaw d // P ∈ zengDiscreteClass d ε}) => zengDeterministicRisk (thetaPoly n d ε) P.1) () := zengMinimaxRisk_le_thetaPoly_worst n d ε _ ≤ C * frontierRate n d ε := hupper n d ε hn hd hε hεhalf _ ≤ C * (K * fixedQRate n d) := mul_le_mul_of_nonneg_left (zeng_frontierRate_le_fixedQRate_mul n d ε hn hε (by linarith)) hC.le _ = (C * K) * fixedQRate n d := by ring
theorem zeng_minimax_lower_fixedQ

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
hZeng_of_gate :
ε :
ℝ
hε :
0 < ε
hεhalf :
ε < 1 / 2
∃ c : ℝ,
0 < c
conclusion 1
n d :
ℕ
1 ≤ n
1 ≤ d
c * fixedQRate n d ≤ zengMinimaxRisk n d ε
Proof (Lean source)
lemma zeng_minimax_lower_fixedQ (hZeng_of_gate : ZengTheoremTwoLower) (ε : ℝ) (hε : 0 < ε) (hεhalf : ε < 1 / 2) : ∃ c : ℝ, 0 < c ∧ ∀ (n d : ℕ), 1 ≤ n → 1 ≤ d → c * fixedQRate n d ≤ zengMinimaxRisk n d ε := by obtain ⟨c₀, cdim, n₀, hc₀, hcdim, hgate⟩ := hZeng_of_gate ε hε hεhalf obtain ⟨cp, hcp, hparam⟩ := zeng_parametric_minimax_lower obtain ⟨N₁, hN₁⟩ := exists_nat_ge (2 / cdim) let N := max (max n₀ 3) N₁ have hNpos : 0 < N := by dsimp [N] omega let csat := c₀ * (cdim / 2) ^ 2 have hcsat : 0 < csat := by dsimp [csat]; positivity let c := min (cp / N) (min c₀ csat) have hc : 0 < c := by dsimp [c] exact lt_min (div_pos hcp (by exact_mod_cast hNpos)) (lt_min hc₀ hcsat) refine ⟨c, hc, ?_⟩ intro n d hn hd have hrate_nonneg : 0 ≤ fixedQRate n d := by unfold fixedQRate exact le_min (by norm_num) (by positivity) have hrate_one : fixedQRate n d ≤ 1 := by unfold fixedQRate exact min_le_left _ _ by_cases hnlarge : N ≤ n · have hn₀ : n₀ ≤ n := le_trans (le_max_left _ _) (le_trans (le_max_left _ _) hnlarge) have hn3 : 3 ≤ n := le_trans (le_max_right n₀ 3) (le_trans (le_max_left _ _) hnlarge) have hnposR : (0 : ℝ) < n := by exact_mod_cast (show 0 < n by omega) have hlog : 1 < Real.log n := by rw [Real.lt_log_iff_exp_lt hnposR] have hn3R : (3 : ℝ) ≤ n := by exact_mod_cast hn3 exact Real.exp_one_lt_d9.trans (by nlinarith) have hlogpos : 0 < Real.log n := lt_trans zero_lt_one hlog have hden : 0 < (n : ℝ) * Real.log n := mul_pos hnposR hlogpos have hN₁n : N₁ ≤ n := le_trans (le_max_right (max n₀ 3) N₁) hnlarge have htwo : 2 ≤ cdim * n * Real.log n := by have hbase : 2 ≤ cdim * n := by have hcN : 2 / cdim ≤ (n : ℝ) := hN₁.trans (by exact_mod_cast hN₁n) exact (div_le_iff₀ hcdim).mp hcN |>.trans_eq (by ring) nlinarith [mul_nonneg (show 0 ≤ cdim * n by positivity) (sub_nonneg.mpr hlog.le)] by_cases hdim : (d : ℝ) ≤ cdim * n * Real.log n · have hpublished := (hgate n d hn₀ hd hdim).trans (zeng_zero_control_risk_le_minimax n d ε) have hlog_le : Real.log n ≤ Real.log (exp 1 + n) := by exact Real.log_le_log hnposR (by nlinarith [Real.exp_pos 1]) have hden' : 0 < (n : ℝ) * Real.log (exp 1 + n) := by apply mul_pos hnposR apply Real.log_pos have hnR : (1 : ℝ) ≤ n := by exact_mod_cast hn nlinarith [Real.exp_pos 1] have hfrac : (d : ℝ) / ((n : ℝ) * Real.log (exp 1 + n)) ≤ (d : ℝ) / ((n : ℝ) * Real.log n) := by exact div_le_div_of_nonneg_left (Nat.cast_nonneg _) hden (mul_le_mul_of_nonneg_left hlog_le hnposR.le) have hraw : fixedQRate n d ≤ (n : ℝ)⁻¹ + ((d : ℝ) / ((n : ℝ) * Real.log n)) ^ 2 := by unfold fixedQRate calc min 1 ((n : ℝ)⁻¹ + ((d : ℝ) / ((n : ℝ) * Real.log (exp 1 + n))) ^ 2) ≤ (n : ℝ)⁻¹ + ((d : ℝ) / ((n : ℝ) * Real.log (exp 1 + n))) ^ 2 := min_le_right _ _ _ ≤ _ := by have hf₀ : 0 ≤ (d : ℝ) / ((n : ℝ) * Real.log (exp 1 + n)) := by positivity have hf₁ : 0 ≤ (d : ℝ) / ((n : ℝ) * Real.log n) := by positivity nlinarith [mul_nonneg (sub_nonneg.mpr hfrac) (add_nonneg hf₀ hf₁)] have hc_le : c ≤ c₀ := (min_le_right _ _).trans (min_le_left _ _) calc c * fixedQRate n d ≤ c * ((n : ℝ)⁻¹ + ((d : ℝ) / ((n : ℝ) * Real.log n)) ^ 2) := mul_le_mul_of_nonneg_left hraw hc.le _ ≤ c₀ * ((n : ℝ)⁻¹ + ((d : ℝ) / ((n : ℝ) * Real.log n)) ^ 2) := mul_le_mul_of_nonneg_right hc_le (by positivity) _ ≤ zengMinimaxRisk n d ε := hpublished · let r := ⌊cdim * n * Real.log n⌋₊ have hrpos : 1 ≤ r := by dsimp [r] exact Nat.floor_pos.mpr (le_trans (by norm_num) htwo) have hrleA : (r : ℝ) ≤ cdim * n * Real.log n := by dsimp [r] exact Nat.floor_le (by positivity) have hrle : r ≤ d := by exact_mod_cast hrleA.trans (le_of_not_ge hdim) have hrhalf : cdim / 2 * ((n : ℝ) * Real.log n) ≤ r := by have hfloor := Nat.sub_one_lt_floor (cdim * n * Real.log n) dsimp [r] have hhalf : cdim / 2 * ((n : ℝ) * Real.log n) ≤ cdim * n * Real.log n - 1 := by nlinarith exact hhalf.trans hfloor.le have hpublished := (hgate n r hn₀ hrpos hrleA).trans (zeng_zero_control_risk_le_minimax n r ε) have hmono := zengMinimaxRisk_mono_dimension (n := n) hrpos hrle ε have hratio : cdim / 2 ≤ (r : ℝ) / ((n : ℝ) * Real.log n) := (le_div_iff₀ hden).2 (by simpa using hrhalf) have hsatlower : csat ≤ c₀ * ((n : ℝ)⁻¹ + ((r : ℝ) / ((n : ℝ) * Real.log n)) ^ 2) := by dsimp [csat] have hc0nonneg := hc₀.le have hsq : (cdim / 2) ^ 2 ≤ ((r : ℝ) / ((n : ℝ) * Real.log n)) ^ 2 := by nlinarith nlinarith [mul_nonneg hc0nonneg (inv_nonneg.mpr hnposR.le)] have hc_le_sat : c ≤ csat := (min_le_right _ _).trans (min_le_right _ _) calc c * fixedQRate n d ≤ c := by nlinarith _ ≤ csat := hc_le_sat _ ≤ c₀ * ((n : ℝ)⁻¹ + ((r : ℝ) / ((n : ℝ) * Real.log n)) ^ 2) := hsatlower _ ≤ zengZeroControlRisk n r ε := hgate n r hn₀ hrpos hrleA _ ≤ zengMinimaxRisk n r ε := zeng_zero_control_risk_le_minimax n r ε _ ≤ zengMinimaxRisk n d ε := hmono · have hnN : n ≤ N := by omega have hcpN : cp / N ≤ cp / n := by exact div_le_div_of_nonneg_left hcp.le (by exact_mod_cast hn) (by exact_mod_cast hnN) have hc_le : c ≤ cp / N := min_le_left _ _ calc c * fixedQRate n d ≤ c := by nlinarith _ ≤ cp / N := hc_le _ ≤ cp / n := hcpN _ ≤ zengMinimaxRisk n d ε := hparam n d ε hn hd hε hεhalf
theorem zeng_fixed_positivity_polynomial_frontier

Given the specified inputs and assumptions, the stated mathematical conclusion holds.

Formal statement
hZeng_of_gate :
∃ C_univ : ℝ,
0 < C_univ
conclusion 1
n d :
ℕ
ε :
ℝ
1 ≤ n
1 ≤ d
0 < ε
ε < 1 / 2
worstCaseRiskReal (fun (_ : Unit) (P : {P : ZengLaw d // P ∈ zengDiscreteClass d ε}) => zengDeterministicRisk (thetaPoly n d ε) P.1) ()
≤ C_univ * frontierRate n d ε
conclusion 2
ε :
ℝ
0 < ε
ε < 1 / 2
∃ cε Cε : ℝ,
0 < cε
cε ≤ Cε
n d :
ℕ
1 ≤ n
1 ≤ d
cε * fixedQRate n d ≤ zengMinimaxRisk n d ε
zengMinimaxRisk n d ε ≤ Cε * fixedQRate n d
Proof (Lean source)
theorem zeng_fixed_positivity_polynomial_frontier (hZeng_of_gate : ZengTheoremTwoLower) : ∃ C_univ : ℝ, 0 < C_univ ∧ (∀ (n d : ℕ) (ε : ℝ), 1 ≤ n → 1 ≤ d → 0 < ε → ε < 1 / 2 → worstCaseRiskReal (fun (_ : Unit) (P : {P : ZengLaw d // P ∈ zengDiscreteClass d ε}) => zengDeterministicRisk (thetaPoly n d ε) P.1) () ≤ C_univ * frontierRate n d ε) ∧ (∀ ε : ℝ, 0 < ε → ε < 1 / 2 → ∃ cε Cε : ℝ, 0 < cε ∧ cε ≤ Cε ∧ ∀ (n d : ℕ), 1 ≤ n → 1 ≤ d → cε * fixedQRate n d ≤ zengMinimaxRisk n d ε ∧ zengMinimaxRisk n d ε ≤ Cε * fixedQRate n d) := by obtain ⟨C, hC, hupper⟩ := thetaPoly_uniform_upper refine ⟨C, hC, hupper, ?_⟩ intro ε hε hεhalf obtain ⟨Cu, hCu, hupperFixed⟩ := zeng_minimax_upper_fixedQ ε hε hεhalf obtain ⟨c, hc, hlower⟩ := zeng_minimax_lower_fixedQ hZeng_of_gate ε hε hεhalf let Cε := max Cu c refine ⟨c, Cε, hc, le_max_right _ _, ?_⟩ intro n d hn hd have hrate : 0 ≤ fixedQRate n d := by unfold fixedQRate exact le_min (by norm_num) (by positivity) refine ⟨hlower n d hn hd, ?_⟩ exact (hupperFixed n d hn hd).trans (mul_le_mul_of_nonneg_right (le_max_left Cu c) hrate)
CausalSmith.Stat.MarRareqLogfrontier.zeng_fixed_positivity_polynomial_frontier · CausalSmith/Stat/STAT_MarRareqLogfrontier_Research/TZengFixedPositivityPolynomialFrontier.lean:528