Formalization: Honest Confidence Intervals for Transported Complier Effects with Rough Nuisance Functions

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

CausalSmith.Stat.STAT_TransportCaceRoughnuisanceLength_Research.Basic 84 declarations The law has a full-data population coordinate and an assigned source overlay.

Rough nuisance transported CACE: law and decision class

The law has a full-data population coordinate and an assigned source overlay. Fixed-size source and target experiments are separate factors. The single-population IV and infinite-sequence iid abstractions in Causalean have different carriers (bypass-justified); restricted volume, affine inversion, and Hölder balls are reused.

The covariate space object is defined without additional inputs.

Definition (Lean source)
covariateSpace :
Set ℝ
Icc (0 : ℝ) 1
CausalSmith.Stat.TransportCaceRoughnuisanceLength.covariateSpace · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Basic.lean:30

The parameter space object is defined without additional inputs.

Definition (Lean source)
parameterSpace :
Set ℝ
Icc (-1 : ℝ) 1
CausalSmith.Stat.TransportCaceRoughnuisanceLength.parameterSpace · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Basic.lean:32
def FullData

The full data object is defined without additional inputs.

Definition (Lean source)
FullData :
Type
Bool × ℝ × Bool × Bool × ℝ × ℝ
CausalSmith.Stat.TransportCaceRoughnuisanceLength.FullData · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Basic.lean:34
def Assigned

The assigned object is defined without additional inputs.

Definition (Lean source)
Assigned :
Type
FullData × Bool × Bool × ℝ
CausalSmith.Stat.TransportCaceRoughnuisanceLength.Assigned · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Basic.lean:36
def SourceObs

The source obs object is defined without additional inputs.

Definition (Lean source)
SourceObs :
Type
ℝ × Bool × Bool × ℝ
CausalSmith.Stat.TransportCaceRoughnuisanceLength.SourceObs · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Basic.lean:38

The two sample object is defined from the supplied inputs.

Definition (Lean source)
nS nT :
ℕ
TwoSample nS nT :
Type
(Fin nS → SourceObs) × (Fin nT → ℝ)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.TwoSample · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Basic.lean:40
def population

The population object is defined from the supplied inputs.

Definition (Lean source)
o :
population o :
o.1
CausalSmith.Stat.TransportCaceRoughnuisanceLength.population · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Basic.lean:42
def covariate

The covariate object is defined from the supplied inputs.

Definition (Lean source)
o :
covariate o :
ℝ
o.2.1
CausalSmith.Stat.TransportCaceRoughnuisanceLength.covariate · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Basic.lean:44
def receipt0

The receipt0 object is defined from the supplied inputs.

Definition (Lean source)
o :
receipt0 o :
o.2.2.1
CausalSmith.Stat.TransportCaceRoughnuisanceLength.receipt0 · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Basic.lean:46
def receipt1

The receipt1 object is defined from the supplied inputs.

Definition (Lean source)
o :
receipt1 o :
o.2.2.2.1
CausalSmith.Stat.TransportCaceRoughnuisanceLength.receipt1 · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Basic.lean:48
def outcome0

The outcome0 object is defined from the supplied inputs.

Definition (Lean source)
o :
outcome0 o :
ℝ
o.2.2.2.2.1
CausalSmith.Stat.TransportCaceRoughnuisanceLength.outcome0 · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Basic.lean:50
def outcome1

The outcome1 object is defined from the supplied inputs.

Definition (Lean source)
o :
outcome1 o :
ℝ
o.2.2.2.2.2
CausalSmith.Stat.TransportCaceRoughnuisanceLength.outcome1 · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Basic.lean:52
def boolReal

The bool real object is defined from the supplied inputs.

Definition (Lean source)
b :
boolReal b :
ℝ
if b then 1 else 0
CausalSmith.Stat.TransportCaceRoughnuisanceLength.boolReal · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Basic.lean:54
def potentialReceipt

The potential receipt object is defined from the supplied inputs.

Definition (Lean source)
o :
z :
potentialReceipt o z :
if z then receipt1 o else receipt0 o
CausalSmith.Stat.TransportCaceRoughnuisanceLength.potentialReceipt · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Basic.lean:56
def potentialOutcome

The potential outcome object is defined from the supplied inputs.

Definition (Lean source)
o :
d :
potentialOutcome o d :
ℝ
if d then outcome1 o else outcome0 o
CausalSmith.Stat.TransportCaceRoughnuisanceLength.potentialOutcome · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Basic.lean:59
def complier

The complier object is defined from the supplied inputs.

Definition (Lean source)
o :
complier o :
ℝ
if receipt1 o && !receipt0 o then 1 else 0
CausalSmith.Stat.TransportCaceRoughnuisanceLength.complier · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Basic.lean:62
def observeSource

The observe source object is defined from the supplied inputs.

Definition (Lean source)
o :
observeSource o :
(covariate o.1, o.2.1, o.2.2.1, o.2.2.2)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.observeSource · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Basic.lean:65

The transport law is specified by its full-data, assignment, and sampling laws together with its density, propensity, and arm-mean functions.

Definition (Lean source)
fullLaw :
assignedLaw :
sampleLaw :
∀ nS nT, Measure (TwoSample nS nT)
fS :
ℝ → ℝ
fT :
ℝ → ℝ
e :
ℝ → ℝ
m :
Bool → Bool → ℝ → ℝ
assignmentPotentialOutcome :
Bool → FullData → ℝ
CausalSmith.Stat.TransportCaceRoughnuisanceLength.TransportLaw · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Basic.lean:70
def populationLaw

The population law object is defined from the supplied inputs.

Definition (Lean source)
s :
populationLaw P s :
cond P.fullLaw {o | population o = s}
CausalSmith.Stat.TransportCaceRoughnuisanceLength.populationLaw · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Basic.lean:81
def sourceObsLaw

The source obs law object is defined from the supplied inputs.

Definition (Lean source)
sourceObsLaw P :
P.assignedLaw.map observeSource
CausalSmith.Stat.TransportCaceRoughnuisanceLength.sourceObsLaw · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Basic.lean:85
def sourceXLaw

The source xlaw object is defined from the supplied inputs.

Definition (Lean source)
sourceXLaw P :
CausalSmith.Stat.TransportCaceRoughnuisanceLength.sourceXLaw · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Basic.lean:88
def targetXLaw

The target xlaw object is defined from the supplied inputs.

Definition (Lean source)
targetXLaw P :
CausalSmith.Stat.TransportCaceRoughnuisanceLength.targetXLaw · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Basic.lean:91

The data law object is defined from the supplied inputs.

Definition (Lean source)
nS nT :
ℕ
dataLaw P nS nT :
P.sampleLaw nS nT
CausalSmith.Stat.TransportCaceRoughnuisanceLength.dataLaw · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Basic.lean:94
def armValue

The arm value object is defined from the supplied inputs.

Definition (Lean source)
A :
o :
armValue A o :
ℝ
if A then o.2.2.2 else boolReal o.2.2.1
CausalSmith.Stat.TransportCaceRoughnuisanceLength.armValue · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Basic.lean:99
def assignmentMass

The assignment mass object is defined from the supplied inputs.

Definition (Lean source)
z :
x :
ℝ
assignmentMass P z x :
ℝ
if z then P.e x else 1 - P.e x
CausalSmith.Stat.TransportCaceRoughnuisanceLength.assignmentMass · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Basic.lean:103
def armContrast

The arm contrast object is defined from the supplied inputs.

Definition (Lean source)
A :
x :
ℝ
armContrast P A x :
ℝ
P.m A true x - P.m A false x
CausalSmith.Stat.TransportCaceRoughnuisanceLength.armContrast · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Basic.lean:106
def transportedForm

The transported form object is defined from the supplied inputs.

Definition (Lean source)
A :
transportedForm P A :
ℝ
∫ x in covariateSpace, P.fT x * armContrast P A x
CausalSmith.Stat.TransportCaceRoughnuisanceLength.transportedForm · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Basic.lean:110

The first stage object is defined from the supplied inputs.

Definition (Lean source)
firstStage P :
ℝ
CausalSmith.Stat.TransportCaceRoughnuisanceLength.firstStage · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Basic.lean:113
def targetComplierShare

The target complier share object is defined from the supplied inputs.

Definition (Lean source)
targetComplierShare P :
ℝ
CausalSmith.Stat.TransportCaceRoughnuisanceLength.targetComplierShare · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Basic.lean:116

The target cace object is defined from the supplied inputs.

Definition (Lean source)
targetCACE P :
ℝ
(∫ o, (outcome1 o - outcome0 o) * complier o ∂populationLaw P false) / targetComplierShare P
CausalSmith.Stat.TransportCaceRoughnuisanceLength.targetCACE · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Basic.lean:119
def holderExponent

The holder exponent object is defined without additional inputs.

Definition (Lean source)
holderExponent :
ℝ
1 / 8
CausalSmith.Stat.TransportCaceRoughnuisanceLength.holderExponent · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Basic.lean:126

The threshold object is defined without additional inputs.

Definition (Lean source)
threshold :
ℕ
256
CausalSmith.Stat.TransportCaceRoughnuisanceLength.threshold · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Basic.lean:128

The holder on object is defined from the supplied inputs.

Definition (Lean source)
f :
ℝ → ℝ
L :
ℝ
HolderOn f L :
Prop
clause 1
1 < L
clause 2
HolderBallStd (fun x : Fin 1 → ℝ => f (x 0)) holderExponent L {x | x 0 ∈ covariateSpace}
CausalSmith.Stat.TransportCaceRoughnuisanceLength.HolderOn · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Basic.lean:130

The measurable on covariate object is defined from the supplied inputs.

Definition (Lean source)
f :
ℝ → ℝ
MeasurableOnCovariate f :
Prop
CausalSmith.Stat.TransportCaceRoughnuisanceLength.MeasurableOnCovariate · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Basic.lean:138
def SourceIid

The source iid object is defined from the supplied inputs.

Definition (Lean source)
nS nT :
ℕ
SourceIid P nS nT :
Prop
(dataLaw P nS nT).map fst = Measure.pi (fun _ : Fin nS => sourceObsLaw P)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.SourceIid · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Basic.lean:144
def TargetIid

The target iid object is defined from the supplied inputs.

Definition (Lean source)
nS nT :
ℕ
TargetIid P nS nT :
Prop
(dataLaw P nS nT).map snd = Measure.pi (fun _ : Fin nT => targetXLaw P)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.TargetIid · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Basic.lean:149
def SampleIndependence

The sample independence object is defined from the supplied inputs.

Definition (Lean source)
nS nT :
ℕ
SampleIndependence P nS nT :
Prop
dataLaw P nS nT = ((dataLaw P nS nT).map fst).prod ((dataLaw P nS nT).map snd)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.SampleIndependence · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Basic.lean:154
def SourceDensityBounds

The source density bounds object is defined from the supplied inputs.

Definition (Lean source)
c_f C_f :
ℝ
SourceDensityBounds c_f C_f P :
Prop
clause 1
0 < c_f
c_f < 1
clause 2
1 < C_f
clause 3
clause 4
∀ᵐ o ∂P.fullLaw, covariate o ∈ covariateSpace ∧ outcome0 o ∈ Icc (0 : ℝ) 1 ∧ outcome1 o ∈ Icc (0 : ℝ) 1
clause 5
= (volume.restrict covariateSpace).withDensity (fun x => ofReal (P.fS x))
clause 6
x ∈ covariateSpace :
c_f ≤ P.fS x
P.fS x ≤ C_f
CausalSmith.Stat.TransportCaceRoughnuisanceLength.SourceDensityBounds · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Basic.lean:160
def TargetDensityBounds

The target density bounds object is defined from the supplied inputs.

Definition (Lean source)
c_f C_f :
ℝ
TargetDensityBounds c_f C_f P :
Prop
clause 1
= (volume.restrict covariateSpace).withDensity (fun x => ofReal (P.fT x))
clause 2
x ∈ covariateSpace :
c_f ≤ P.fT x
P.fT x ≤ C_f
clause 3
0 < c_f
CausalSmith.Stat.TransportCaceRoughnuisanceLength.TargetDensityBounds · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Basic.lean:177
def SourceDensityHolder

The source density holder object is defined from the supplied inputs.

Definition (Lean source)
L :
ℝ
SourceDensityHolder L P :
Prop
HolderOn P.fS L
CausalSmith.Stat.TransportCaceRoughnuisanceLength.SourceDensityHolder · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Basic.lean:186
def TargetDensityHolder

The target density holder object is defined from the supplied inputs.

Definition (Lean source)
L :
ℝ
TargetDensityHolder L P :
Prop
HolderOn P.fT L
CausalSmith.Stat.TransportCaceRoughnuisanceLength.TargetDensityHolder · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Basic.lean:191
def PropensityOverlap

The propensity overlap object is defined from the supplied inputs.

Definition (Lean source)
x ∈ covariateSpace :
PropensityOverlap P :
Prop
clause 1
(1 / 4 : ℝ) ≤ P.e x
clause 2
P.e x ≤ 3 / 4
CausalSmith.Stat.TransportCaceRoughnuisanceLength.PropensityOverlap · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Basic.lean:196
def PropensityHolder

The propensity holder object is defined from the supplied inputs.

Definition (Lean source)
L :
ℝ
PropensityHolder L P :
Prop
HolderOn P.e L
CausalSmith.Stat.TransportCaceRoughnuisanceLength.PropensityHolder · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Basic.lean:202
def ArmMeansHolder

The arm means holder object is defined from the supplied inputs.

Definition (Lean source)
L :
ℝ
ArmMeansHolder L P :
Prop
clause 1
A z :
HolderOn (P.m A z) L
clause 2
A z :
MeasurableSet (covariateSpace)
Measurable (indicator covariateSpace (P.m A z))
x ∈ covariateSpace :
P.m A z x ∈ Icc (0 : ℝ) 1
clause 3
A z (B : Set ℝ) :
B ⊆ covariateSpace
∫ o in {o | o.1 ∈ B ∧ o.2.1 = z}, armValue A o ∂sourceObsLaw P
= ∫ x in B, P.fS x * assignmentMass P z x * P.m A z x
CausalSmith.Stat.TransportCaceRoughnuisanceLength.ArmMeansHolder · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Basic.lean:207
def ReceiptConsistency

The receipt consistency object is defined from the supplied inputs.

Definition (Lean source)
ReceiptConsistency P :
Prop
∀ᵐ o ∂P.assignedLaw, o.2.2.1 = potentialReceipt o.1 o.2.1
CausalSmith.Stat.TransportCaceRoughnuisanceLength.ReceiptConsistency · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Basic.lean:219
def OutcomeConsistency

The outcome consistency object is defined from the supplied inputs.

Definition (Lean source)
OutcomeConsistency P :
Prop
clause 1
∀ᵐ o ∂P.assignedLaw, o.2.2.2 = potentialOutcome o.1 o.2.2.1
clause 2
∀ᵐ o ∂P.assignedLaw, o.2.2.2 ∈ Icc (0 : ℝ) 1
CausalSmith.Stat.TransportCaceRoughnuisanceLength.OutcomeConsistency · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Basic.lean:225
def InstrumentRandomization

The instrument randomization object is defined from the supplied inputs.

Definition (Lean source)
InstrumentRandomization P :
Prop
clause 1
IsProbabilityMeasure P.assignedLaw
clause 3
(P.assignedLaw.map (fun o => o.1)) = populationLaw P true
clause 4
(P.assignedLaw {o | o.1 ∈ B ∧ o.2.1 = z}).toReal
= ∫ o in B, assignmentMass P z (covariate o) ∂populationLaw P true
CausalSmith.Stat.TransportCaceRoughnuisanceLength.InstrumentRandomization · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Basic.lean:232
def Exclusion

The exclusion object is defined from the supplied inputs.

Definition (Lean source)
z :
Exclusion P :
Prop
P.assignmentPotentialOutcome z
=ᵐ[P.fullLaw] fun o => potentialOutcome o (potentialReceipt o z)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.Exclusion · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Basic.lean:243
def Monotonicity

The monotonicity object is defined from the supplied inputs.

Definition (Lean source)
Monotonicity P :
Prop
∀ᵐ o ∂P.fullLaw, boolReal (receipt0 o) ≤ boolReal (receipt1 o)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.Monotonicity · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Basic.lean:250

The conditional mean object is defined from the supplied inputs.

Definition (Lean source)
s :
f :
FullData → ℝ
q :
ℝ → ℝ
ConditionalMean P s f q :
Prop
clause 1
clause 2
B :
Set ℝ
∫ o in {o | covariate o ∈ B}, f o ∂populationLaw P s
= ∫ x in B, q x ∂(populationLaw P s).map covariate
CausalSmith.Stat.TransportCaceRoughnuisanceLength.ConditionalMean · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Basic.lean:254
def TransportComplierOutcome

The transport complier outcome object is defined from the supplied inputs.

Definition (Lean source)
TransportComplierOutcome P :
Prop
∃ q : ℝ → ℝ,
clause 1
ConditionalMean P false (fun o => (outcome1 o - outcome0 o) * complier o) q
clause 2
ConditionalMean P true (fun o => (outcome1 o - outcome0 o) * complier o) q
CausalSmith.Stat.TransportCaceRoughnuisanceLength.TransportComplierOutcome · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Basic.lean:263
def TransportComplierShare

The transport complier share object is defined from the supplied inputs.

Definition (Lean source)
TransportComplierShare P :
Prop
∃ q : ℝ → ℝ,
clause 1
ConditionalMean P false complier q
clause 2
ConditionalMean P true complier q
CausalSmith.Stat.TransportCaceRoughnuisanceLength.TransportComplierShare · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Basic.lean:271
def PositiveStrength

The positive strength object is defined from the supplied inputs.

Definition (Lean source)
PositiveStrength P :
Prop
CausalSmith.Stat.TransportCaceRoughnuisanceLength.PositiveStrength · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Basic.lean:278
structure ModelClass

The model class records that the supplied constants, law, and sample size satisfy the statistical assumptions of the transported CACE experiment.

Definition (Lean source)
c_f C_f L :
ℝ
n :
ℕ
sourceIid :
SourceIid P n n

@realizes n(common source-target sample size) @realizes \mathcal M_n(full model class)

targetIid :
TargetIid P n n
independence :
sourceBounds :
targetBounds :
sourceHolder :
targetHolder :
overlap :
propensityHolder :
armHolder :
receipt :
outcome :
randomized :
exclusion :
monotone :
outcomeTransport :
shareTransport :
strength :
CausalSmith.Stat.TransportCaceRoughnuisanceLength.ModelClass · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Basic.lean:283
theorem armContrast_mem_Icc

Bounded arm means imply a contrast in the parameter interval. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
L :
ℝ
hArm :
A :
x :
ℝ
hx :
armContrast P A x ∈ Icc (-1 : ℝ) 1
Proof (Lean source)
-- @node: armContrast_mem_Icc lemma armContrast_mem_Icc (L : ℝ) (P : TransportLaw) (hArm : ArmMeansHolder L P) (A : Bool) (x : ℝ) (hx : x ∈ covariateSpace) : armContrast P A x ∈ Icc (-1 : ℝ) 1 := by -- @realizes \Delta_A(derived range [-1,1]) @realizes T_A(contrast range) have h1 := (hArm.2.1 A true).2.2 x hx have h0 := (hArm.2.1 A false).2.2 x hx change -1 ≤ P.m A true x - P.m A false x ∧ P.m A true x - P.m A false x ≤ 1 exact ⟨by simpa using sub_le_sub h1.1 h0.2, by simpa using sub_le_sub h1.2 h0.1⟩
CausalSmith.Stat.TransportCaceRoughnuisanceLength.armContrast_mem_Icc · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Basic.lean:306
theorem targetDensity_nonneg_of_bounds

The target density is nonnegative on its declared domain. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f :
ℝ
hT :
x :
ℝ
hx :
0 ≤ P.fT x
Proof (Lean source)
-- @node: targetDensity_nonneg_of_bounds lemma targetDensity_nonneg_of_bounds (c_f C_f : ℝ) (P : TransportLaw) (hT : TargetDensityBounds c_f C_f P) (x : ℝ) (hx : x ∈ covariateSpace) : 0 ≤ P.fT x := by -- @realizes f_{\mathrm T}(derived nonnegative density) @realizes T_A(nonnegative target weight) @realizes \mu(nonnegative target weight) exact hT.2.2.le.trans (hT.2.1 x hx).1
CausalSmith.Stat.TransportCaceRoughnuisanceLength.targetDensity_nonneg_of_bounds · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Basic.lean:318
theorem continuousOn

The one-dimensional Hölder condition supplies continuity on the covariate interval. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
f :
ℝ → ℝ
L :
ℝ
hf :
Proof (Lean source)
-- @node: HolderOn.continuousOn lemma HolderOn.continuousOn {f : ℝ → ℝ} {L : ℝ} (hf : HolderOn f L) : ContinuousOn f covariateSpace := by have hc := hf.2.1.continuousOn have hdiag : Continuous (fun x : ℝ => fun _ : Fin 1 => x) := by fun_prop exact hc.comp (s := covariateSpace) hdiag.continuousOn (fun x hx => hx)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.HolderOn.continuousOn · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Basic.lean:325
theorem targetDensity_integral_eq_one

The target probability law normalizes its real density to one. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hP :
ModelClass c_f C_f L P n
(∫ x in covariateSpace, P.fT x) = 1
Proof (Lean source)
-- @node: targetDensity_integral_eq_one lemma targetDensity_integral_eq_one (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hP : ModelClass c_f C_f L P n) : (∫ x in covariateSpace, P.fT x) = 1 := by -- @realizes f_{\mathrm T}(derived probability normalization) @realizes T_A(normalized target density) @realizes \mu(normalized target density) have hf : ContinuousOn P.fT covariateSpace := by first | fun_prop | exact hP.targetHolder.continuousOn have hd : IntegrableOn P.fT covariateSpace := hf.integrableOn_Icc have hn : 0 ≤ᵐ[volume.restrict covariateSpace] P.fT := by filter_upwards [ae_restrict_mem measurableSet_Icc] with x hx exact targetDensity_nonneg_of_bounds c_f C_f P hP.targetBounds x hx have hmass : (∫ x in covariateSpace, P.fT x) = (targetXLaw P univ).toReal := by rw [integral_eq_lintegral_of_nonneg_ae hn hd.aestronglyMeasurable, hP.targetBounds.1, withDensity_apply _ MeasurableSet.univ, Measure.restrict_univ] have hlow : c_f ≤ ∫ x in covariateSpace, P.fT x := by have hconst : IntegrableOn (fun _ : ℝ => c_f) covariateSpace := continuous_const.continuousOn.integrableOn_Icc have h := setIntegral_mono_on hconst hd measurableSet_Icc (fun x hx => (hP.targetBounds.2.1 x hx).1) simpa [covariateSpace, Real.volume_Icc] using h have : IsZeroOrProbabilityMeasure (targetXLaw P) := by unfold targetXLaw populationLaw infer_instance rcases IsZeroOrProbabilityMeasure.measure_univ (μ := targetXLaw P) with hzero | hone · have hz : (∫ x in covariateSpace, P.fT x) = 0 := by simpa [hzero] using hmass exact False.elim (not_le_of_gt hP.targetBounds.2.2 (hz ▸ hlow)) · simpa [hone] using hmass
CausalSmith.Stat.TransportCaceRoughnuisanceLength.targetDensity_integral_eq_one · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Basic.lean:333
theorem transportedForm_mem_Icc

Integrating a bounded arm contrast against the target probability density preserves its range for either observable. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hP :
ModelClass c_f C_f L P n
A :
transportedForm P A ∈ Icc (-1 : ℝ) 1
Proof (Lean source)
-- @node: transportedForm_mem_Icc lemma transportedForm_mem_Icc (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hP : ModelClass c_f C_f L P n) (A : Bool) : transportedForm P A ∈ Icc (-1 : ℝ) 1 := by -- @realizes T_A(derived generic range [-1,1]) have hf : ContinuousOn P.fT covariateSpace := by first | fun_prop | exact hP.targetHolder.continuousOn have hm1 : ContinuousOn (P.m A true) covariateSpace := by exact (hP.armHolder.1 A true).continuousOn have hm0 : ContinuousOn (P.m A false) covariateSpace := by exact (hP.armHolder.1 A false).continuousOn have hd := hf.integrableOn_Icc (μ := volume) have hi : IntegrableOn (fun x => P.fT x * armContrast P A x) covariateSpace := (hf.mul (hm1.sub hm0)).integrableOn_Icc have hnorm := targetDensity_integral_eq_one c_f C_f L P n hP change -1 ≤ (∫ x in covariateSpace, P.fT x * armContrast P A x) ∧ (∫ x in covariateSpace, P.fT x * armContrast P A x) ≤ 1 constructor · have hlow := setIntegral_mono_on hd.neg hi measurableSet_Icc (fun x hx => by have hn := targetDensity_nonneg_of_bounds c_f C_f P hP.targetBounds x hx have hb := (armContrast_mem_Icc L P hP.armHolder A x hx).1 simpa using mul_le_mul_of_nonneg_left hb hn) change (∫ x in covariateSpace, -P.fT x) ≤ (∫ x in covariateSpace, P.fT x * armContrast P A x) at hlow simpa only [integral_neg, hnorm] using hlow · have hupp := setIntegral_mono_on hi hd measurableSet_Icc (fun x hx => by have hn := targetDensity_nonneg_of_bounds c_f C_f P hP.targetBounds x hx have hb := (armContrast_mem_Icc L P hP.armHolder A x hx).2 simpa using mul_le_mul_of_nonneg_left hb hn) simpa only [hnorm] using hupp
CausalSmith.Stat.TransportCaceRoughnuisanceLength.transportedForm_mem_Icc · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Basic.lean:364
theorem firstStage_le_one_of_model

Model membership bounds the positive first stage above by one. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hP :
ModelClass c_f C_f L P n
firstStage P ≤ 1
Proof (Lean source)
-- @node: firstStage_le_one_of_model lemma firstStage_le_one_of_model (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hP : ModelClass c_f C_f L P n) : firstStage P ≤ 1 := by -- @realizes \mu(derived upper bound one) exact (transportedForm_mem_Icc c_f C_f L P n hP false).2
CausalSmith.Stat.TransportCaceRoughnuisanceLength.firstStage_le_one_of_model · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Basic.lean:396
def Geometry

The geometry object is defined without additional inputs.

Definition (Lean source)
Geometry :
Type
(ℝ → ℝ) × (ℝ → ℝ) × (ℝ → ℝ)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.Geometry · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Basic.lean:402
def AdmissibleGeometry

The admissible geometry object is defined from the supplied inputs.

Definition (Lean source)
c_f C_f L :
ℝ
G :
AdmissibleGeometry c_f C_f L G :
Prop
clause 1
HolderOn G.1 L
clause 2
HolderOn G.2.1 L
clause 3
HolderOn G.2.2 L
clause 4
x ∈ covariateSpace :
c_f ≤ G.1 x
G.1 x ≤ C_f
c_f ≤ G.2.1 x
G.2.1 x ≤ C_f
(1 / 4 : ℝ) ≤ G.2.2 x
G.2.2 x ≤ 3 / 4
CausalSmith.Stat.TransportCaceRoughnuisanceLength.AdmissibleGeometry · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Basic.lean:406
structure FixedGeometrySubclass

The fixed-geometry subclass records that the supplied model and geometry meet the required geometric restrictions.

Definition (Lean source)
c_f C_f L :
ℝ
n :
ℕ
G :
sourceIid :
SourceIid P n n
targetIid :
TargetIid P n n
independence :
sourceBounds :
targetBounds :
sourceHolder :
targetHolder :
overlap :
propensityHolder :
armHolder :
receipt :
outcome :
randomized :
exclusion :
monotone :
outcomeTransport :
shareTransport :
strength :
admissible :
AdmissibleGeometry c_f C_f L G
geometry_eq :
∀ x ∈ covariateSpace, P.fS x = G.1 x ∧ P.fT x = G.2.1 x ∧ P.e x = G.2.2 x
CausalSmith.Stat.TransportCaceRoughnuisanceLength.FixedGeometrySubclass · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Basic.lean:418
def IsIntervalPartition

The is interval partition object is defined from the supplied inputs.

Definition (Lean source)
cells :
Finset (Set ℝ)
IsIntervalPartition cells :
Prop
clause 1
cell ∈ cells :
cell ⊆ covariateSpace
cell.Nonempty
clause 2
x ∈ covariateSpace :
∃! cell : Set ℝ,
cell ∈ cells
x ∈ cell
CausalSmith.Stat.TransportCaceRoughnuisanceLength.IsIntervalPartition · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Basic.lean:443
def Partition

The partition object is defined without additional inputs.

Definition (Lean source)
Partition :
Type
{cells : Finset (Set ℝ) // IsIntervalPartition cells}
CausalSmith.Stat.TransportCaceRoughnuisanceLength.Partition · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Basic.lean:448
structure FiniteCellSubclass

The finite-cell subclass records that the supplied model and partition meet the finite-cell restrictions.

Definition (Lean source)
c_f C_f L :
ℝ
n :
ℕ
partition :
sourceIid :
SourceIid P n n
targetIid :
TargetIid P n n
independence :
sourceBounds :
targetBounds :
sourceHolder :
targetHolder :
overlap :
propensityHolder :
armHolder :
receipt :
outcome :
randomized :
exclusion :
monotone :
outcomeTransport :
shareTransport :
strength :
cell_const :
∀ cell ∈ partition.1,
∀ x ∈ cell, ∀ y ∈ cell, P.fS x = P.fS y ∧ P.fT x = P.fT y ∧ P.e x = P.e y
CausalSmith.Stat.TransportCaceRoughnuisanceLength.FiniteCellSubclass · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Basic.lean:454
def markedDensityVector

The marked density vector object is defined from the supplied inputs.

Definition (Lean source)
c_f C_f L :
ℝ
n :
ℕ
_hP :
ModelClass c_f C_f L P n
x :
ℝ
markedDensityVector c_f C_f L P n _hP x :
Fin 7 → ℝ
![P.fT x, P.fS x * (1 - P.e x), P.fS x * P.e x, P.fS x * (1 - P.e x) * P.m true false x, P.fS x * P.e x * P.m true true x, P.fS x * (1 - P.e x) * P.m false false x, P.fS x * P.e x * P.m false true x]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.markedDensityVector · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Basic.lean:480
def Phi

The phi object is defined from the supplied inputs.

Definition (Lean source)
A :
v :
Fin 7 → ℝ
Phi A v :
ℝ
v 0 * ((v (if A then 4 else 6)) / v 2 - (v (if A then 3 else 5)) / v 1)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.Phi · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Basic.lean:493
def knownGeometryEnvelope

The known geometry envelope object is defined from the supplied inputs.

Definition (Lean source)
C_f c_f :
ℝ
knownGeometryEnvelope C_f c_f :
ℝ
4 * C_f / c_f
CausalSmith.Stat.TransportCaceRoughnuisanceLength.knownGeometryEnvelope · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Basic.lean:498
def knownGeometryLengthConstant

The known-geometry expected-length constant, computed from the noncoverage level and the density envelopes.

Definition (Lean source)
α C_f c_f :
ℝ
knownGeometryLengthConstant α C_f c_f :
ℝ
2
+ 8 * knownGeometryEnvelope C_f c_f * (sqrt (2 * log (4 / α)) + exp (-1 / 2))
CausalSmith.Stat.TransportCaceRoughnuisanceLength.knownGeometryLengthConstant · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Basic.lean:503
def knownGeometryRadius Definition 28 in the paper ↗

The known geometry radius object is defined from the supplied inputs.

Definition (Lean source)
α C_f c_f :
ℝ
n :
ℕ
_hα :
0 < α ∧ α < 1
_hC :
1 < C_f
_hc :
0 < c_f ∧ c_f < 1
_hn :
0 < n
knownGeometryRadius α C_f c_f n _hα _hC _hc _hn :
ℝ
knownGeometryEnvelope C_f c_f * sqrt (2 * log (4 / α) / n)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.knownGeometryRadius · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Basic.lean:509
def knownGeometryScore

The known geometry score object is defined from the supplied inputs.

Definition (Lean source)
c_f C_f L :
ℝ
G :
_hG :
AdmissibleGeometry c_f C_f L G
A :
n :
ℕ
_hn :
0 < n
ω :
knownGeometryScore c_f C_f L G _hG A n _hn ω :
ℝ
(1 / (n : ℝ)) * ∑ i : Fin n, G.2.1 (ω.1 i).1 / G.1 (ω.1 i).1 * (boolReal (ω.1 i).2.1 * armValue A (ω.1 i) / G.2.2 (ω.1 i).1 - (1 - boolReal (ω.1 i).2.1) * armValue A (ω.1 i) / (1 - G.2.2 (ω.1 i).1))
CausalSmith.Stat.TransportCaceRoughnuisanceLength.knownGeometryScore · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Basic.lean:518
def knownGeometryInterval

The known geometry interval object is defined from the supplied inputs.

Definition (Lean source)
G :
α C_f c_f L :
ℝ
hG :
AdmissibleGeometry c_f C_f L G
hα :
0 < α ∧ α < 1
hC :
1 < C_f
hc :
0 < c_f ∧ c_f < 1
n :
ℕ
hn :
0 < n
ω :
knownGeometryInterval G α C_f c_f L hG hα hC hc n hn ω :
Set ℝ
by classical let A := affineInversionSet parameterSpace (knownGeometryScore c_f C_f L G hG true n hn ω) (knownGeometryScore c_f C_f L G hG false n hn ω) (2 * knownGeometryRadius α C_f c_f n hα hC hc hn) exact if A.Nonempty then A else {0}
CausalSmith.Stat.TransportCaceRoughnuisanceLength.knownGeometryInterval · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Basic.lean:530
def restrictedLength

The restricted length object is defined from the supplied inputs.

Definition (Lean source)
C :
Set ℝ
restrictedLength C :
ℝ
CausalSmith.Stat.TransportCaceRoughnuisanceLength.restrictedLength · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Basic.lean:548
theorem restrictedLength_mem_Icc Lemma restrictedLength_mem_Icc in the paper ↗

Restricted Lebesgue length always lies between zero and two. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
C :
Set ℝ
restrictedLength C ∈ Icc (0 : ℝ) 2
Proof (Lean source)
-- @node: restrictedLength_mem_Icc lemma restrictedLength_mem_Icc (C : Set ℝ) : restrictedLength C ∈ Icc (0 : ℝ) 2 := by -- @realizes \lambda_{\Theta}(derived length range [0,2]) change 0 ≤ (volume (C ∩ parameterSpace)).toReal ∧ (volume (C ∩ parameterSpace)).toReal ≤ 2 constructor · exact ENNReal.toReal_nonneg · calc (volume (C ∩ parameterSpace)).toReal ≤ (volume parameterSpace).toReal := ENNReal.toReal_mono (by simp [parameterSpace, Real.volume_Icc]) (measure_mono Set.inter_subset_right) _ = 2 := by norm_num [parameterSpace, Real.volume_Icc]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.restrictedLength_mem_Icc · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Basic.lean:551

The expected length object is defined from the supplied inputs.

Definition (Lean source)
nS nT :
ℕ
C :
TwoSample nS nT → Set ℝ
expectedLength P nS nT C :
ℝ
∫ ω, restrictedLength (C ω) ∂dataLaw P nS nT
CausalSmith.Stat.TransportCaceRoughnuisanceLength.expectedLength · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Basic.lean:564
def HonestIntervals

The honest intervals object is defined from the supplied inputs.

Definition (Lean source)
α c_f C_f L :
ℝ
n :
ℕ
HonestIntervals α c_f C_f L n :
Set (TwoSample n n → Set ℝ)
{C | 0 < α ∧ α < 1 ∧ (∀ ω, C ω ⊆ parameterSpace ∧ OrdConnected (C ω)) ∧ MeasurableSet {p : TwoSample n n × ℝ | p.2 ∈ C p.1} ∧ ∀ P, ModelClass c_f C_f L P n → 1 - α ≤ (dataLaw P n n {ω | targetCACE P ∈ C ω}).toReal}
CausalSmith.Stat.TransportCaceRoughnuisanceLength.HonestIntervals · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Basic.lean:571
def StrengthSlice

The strength slice object is defined from the supplied inputs.

Definition (Lean source)
c_f C_f L a :
ℝ
n :
ℕ
StrengthSlice c_f C_f L a n :
{P | 0 < a ∧ a ≤ 1 / 4 ∧ ModelClass c_f C_f L P n ∧ a ≤ firstStage P ∧ firstStage P ≤ 1 / 4}
CausalSmith.Stat.TransportCaceRoughnuisanceLength.StrengthSlice · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Basic.lean:583

The length frontier object is defined from the supplied inputs.

Definition (Lean source)
α c_f C_f L a :
ℝ
n :
ℕ
lengthFrontier α c_f C_f L a n :
ℝ
⨅ (C : {C // C ∈ HonestIntervals α c_f C_f L n}), ⨆ (P : {P // P ∈ StrengthSlice c_f C_f L a n}), expectedLength P.1 n n C.1
CausalSmith.Stat.TransportCaceRoughnuisanceLength.lengthFrontier · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Basic.lean:591
def unequalDataLaw

The unequal data law object is defined from the supplied inputs.

Definition (Lean source)
nS nT :
ℕ
unequalDataLaw P nS nT :
P.sampleLaw nS nT
CausalSmith.Stat.TransportCaceRoughnuisanceLength.unequalDataLaw · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Basic.lean:601
def UnequalModelClass

The unequal model class object is defined from the supplied inputs.

Definition (Lean source)
c_f C_f L :
ℝ
nS nT :
ℕ
UnequalModelClass c_f C_f L P nS nT :
Prop
clause 1
SourceIid P nS nT
clause 2
TargetIid P nS nT
clause 3
clause 4
clause 5
clause 9
clause 10
clause 14
clause 15
clause 18
CausalSmith.Stat.TransportCaceRoughnuisanceLength.UnequalModelClass · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Basic.lean:604
def UnequalHonestIntervals

The unequal honest intervals object is defined from the supplied inputs.

Definition (Lean source)
α c_f C_f L :
ℝ
nS nT :
ℕ
UnequalHonestIntervals α c_f C_f L nS nT :
Set (TwoSample nS nT → Set ℝ)
{C | 0 < α ∧ α < 1 ∧ (∀ ω, C ω ⊆ parameterSpace ∧ OrdConnected (C ω)) ∧ MeasurableSet {p : TwoSample nS nT × ℝ | p.2 ∈ C p.1} ∧ ∀ P, UnequalModelClass c_f C_f L P nS nT → 1 - α ≤ (unequalDataLaw P nS nT {ω | targetCACE P ∈ C ω}).toReal}
CausalSmith.Stat.TransportCaceRoughnuisanceLength.UnequalHonestIntervals · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Basic.lean:615
def unequalSampleFrontier Definition 10 in the paper ↗

The unequal sample frontier object is defined from the supplied inputs.

Definition (Lean source)
α c_f C_f L a :
ℝ
@realizes a(strength-floor parameter)
nS nT :
ℕ
_hS :
0 < nS
_hT :
0 < nT
_ha :
0 < a ∧ a ≤ 1 / 4
_hα :
0 < α ∧ α < 1
unequalSampleFrontier α c_f C_f L a nS nT _hS _hT _ha _hα :
ℝ
⨅ (C : {C // C ∈ UnequalHonestIntervals α c_f C_f L nS nT}), ⨆ (P : {P // UnequalModelClass c_f C_f L P nS nT ∧ a ≤ firstStage P ∧ firstStage P ≤ 1 / 4}), expectedLength P.1 nS nT C.1
CausalSmith.Stat.TransportCaceRoughnuisanceLength.unequalSampleFrontier · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Basic.lean:627
def unequalSampleFrontierQuestion Remark 1 in the paper ↗

The unequal sample frontier question object is defined without additional inputs.

Definition (Lean source)
unequalSampleFrontierQuestion :
_root_.String
"Open: determine the exact piecewise order of R_(N_S,N_T)(a) when source and target counts diverge at unrelated rates, and find one finite-sample honest interval and a matching legal monotone-IV lower family in every phase. " ++ "The equal-count frontier has order min{1,n^(-1/3)/a}; a source-only construction gives an off-diagonal lower term min{1,N_S^(-1/3)/a} when its strength range is nonempty. " ++ "Mixed source-target quadratic and cubic projections have distinct variance powers; the target-limited term and matching multiresolution upper bound remain undetermined. This text poses a question and asserts no solution."
CausalSmith.Stat.TransportCaceRoughnuisanceLength.unequalSampleFrontierQuestion · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Basic.lean:638
CausalSmith.Stat.STAT_TransportCaceRoughnuisanceLength_Research.Helpers.CubicMse 2 declarations Mean-square bound for the exact seven-mark cubic score

Mean-square bound for the exact seven-mark cubic score

theorem cubicEstimator_error_sq_integrable

Model membership implies square integrability of the concrete estimator error, including the zero-statistic fallback at small sample sizes. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hP :
ModelClass c_f C_f L P n
A :
Integrable (fun ω : TwoSample n n => (cubicEstimator c_f C_f ω A - transportedForm P A) ^ 2) (dataLaw P n n)
Proof (Lean source)
@[fun_prop] -- @node: cubicEstimator_error_sq_integrable lemma cubicEstimator_error_sq_integrable (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hP : ModelClass c_f C_f L P n) (A : Bool) : Integrable (fun ω : TwoSample n n => (cubicEstimator c_f C_f ω A - transportedForm P A) ^ 2) (dataLaw P n n) := by let := sourceObsLaw_isProbabilityMeasure c_f C_f L P n hP let := targetXLaw_isProbabilityMeasure c_f C_f L P n hP let : IsProbabilityMeasure (dataLaw P n n) := by rw [dataLaw_eq_source_target_pi c_f C_f L P n hP] infer_instance by_cases hn : n < threshold · simpa only [cubicEstimator, if_pos hn, zero_sub, neg_sq] using (integrable_const (transportedForm P A ^ 2) : Integrable (fun _ : TwoSample n n => transportedForm P A ^ 2) (dataLaw P n n)) · have hn' : threshold ≤ n := Nat.le_of_not_gt hn have hF := cubicEstimator_sub_projectedEstimatorMean_memLp c_f C_f L P n hn' hP A have hBi := integrable_projectedEstimatorMean_sub_transport_sq c_f C_f L P n hn' hP A have hm : trainingSigma n ≤ (inferInstance : MeasurableSpace (TwoSample n n)) := by rw [trainingSigma_eq_comap_flatTrainingProj] exact ((measurable_finsetCoordProj (flatBlock n 0)).comp (sumPiEquivProdPi (FlatObs n)).symm.measurable).comap_le have hBsm : AEStronglyMeasurable (fun ω : TwoSample n n => projectedEstimatorMean c_f C_f L P n hP ω A - transportedForm P A) (dataLaw P n n) := by first | fun_prop | exact (((stronglyMeasurable_projectedEstimatorMean c_f C_f L P n hn' hP A).mono hm).sub stronglyMeasurable_const).aestronglyMeasurable have hB := (memLp_two_iff_integrable_sq hBsm).2 hBi convert (hF.add hB).integrable_sq using 1 <;> ext ω <;> simp only [Pi.add_apply] <;> ring
CausalSmith.Stat.TransportCaceRoughnuisanceLength.cubicEstimator_error_sq_integrable · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse.lean:11
theorem marked_cubic_mse

Given the supplied inputs, the stated result about marked cubic mse holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hf :
0 < c_f ∧ c_f < 1
hF :
1 < C_f
hL :
1 < L
hn :
threshold ≤ n
hP :
ModelClass c_f C_f L P n
A :
(∫ ω, (cubicEstimator c_f C_f ω A - transportedForm P A) ^ 2 ∂dataLaw P n n)
≤ mseEnvelope c_f C_f L * (n : ℝ) ^ (-(2 / 3 : ℝ))
Proof (Lean source)
lemma marked_cubic_mse (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hf : 0 < c_f ∧ c_f < 1) (hF : 1 < C_f) (hL : 1 < L) (hn : threshold ≤ n) (hP : ModelClass c_f C_f L P n) (A : Bool) : (∫ ω, (cubicEstimator c_f C_f ω A - transportedForm P A) ^ 2 ∂dataLaw P n n) ≤ mseEnvelope c_f C_f L * (n : ℝ) ^ (-(2 / 3 : ℝ)) := by -- Roadmap (8) is proved in `pilot_Phi_cubic_taylor_remainder_abs_le`. -- The clipped eighth moment and exact quadratic/cubic conditional variance -- bounds are proved in `pilot_eighth_moment`, -- `quadratic_conditional_variance`, and `cubic_conditional_variance`. -- The exact quadratic and cubic conditional means are proved in -- `condExp_quadraticTerm_eq_quadraticProjectionMean` and -- `condExp_cubicTerm_eq_cubicProjectionMean`. -- `pilot_Phi_cubic_taylor_remainder_integrated_second_moment` proves -- roadmap (9) for the square of the spatially integrated remainder. -- `pilot_error_L1_second_moment` proves the L1 part of roadmap (7). -- `cubic_midpoint_cell_projection_L1_bound` retains the pilot L1 error -- in each exact cubic cell bias, ready for the global sum in roadmap (12). -- `quadraticCellProjectionBias_integrated_sq_sample_rate` proves the -- roadmap (11) rate for the exact midpoint-frozen cell sum, and -- `quadraticCellProjectionBias_eq_sub_projectionMean` identifies its -- difference from the exact conditional mean. -- `quadraticCellProjectionBias_eq_spatial_sub_projectionMean` proves the -- nested-cell bridge, and -- `quadratic_spatial_projection_bias_integrated_sq_sample_rate` gives -- roadmap (11) for the true spatial Taylor term. -- `spatial_pilot_single_residual_cancellation` proves exact cancellation -- for pilot-derived coefficients on every nested correction cell. -- `cubic_spatial_projection_bias_abs_le_L1` proves the global -- pilot-sensitive cubic bias bound (12) for the exact projection mean. -- `cubic_spatial_projection_bias_integrated_sq_resolution_bound` combines -- the exact spatial bias with the pilot L1 second moment, retaining both -- resolution powers in (13); `cubicResolution_inverse_rpow_sample_rate` -- supplies their dyadic sample-size conversion. -- `cubic_spatial_projection_bias_integrated_sq_sample_rate` proves -- roadmap (13) with the exact BC constant, converting both actual rates -- n^(-7/10) and n^(-3/4) to n^(-2/3). -- `combined_spatial_projection_bias_second_moment` proves roadmap (14) -- for the exact spatial remainder and the two projection errors, with -- the exact constant 3(BR+BQ+BC), using an integrable remainder majorant. -- `projectedEstimatorMean_sub_transport_eq_spatial_bias` now identifies -- the exact projected mean's error with this sum, and -- `projectedEstimatorMean_squared_bias_sample_rate` transfers (14) to -- that mean, using coordinate Taylor expansions and spatial integrability. -- `linearProjectionMean_eq_cell_sum` proves that the linear spatial term -- is exactly a finite pilot-cell sum, with no projection bias; -- `stronglyMeasurable_linearProjectionMean` proves its training measurability. -- `linearTerm_sub_projectionMean_eq_centered_cell_sum` identifies the -- exact held-out fluctuation using the model-derived covariate support; -- `condExp_linearTerm_eq_linearProjectionMean` proves its exact training -- conditional mean. `linear_conditional_variance` proves roadmap (19) -- for the exact held-out statistic, retaining signed cell covariances -- to avoid an extra density-envelope factor. The final conditional -- bias--variance assembly remains open. -- `quadratic_conditional_variance_sample_rate` and -- `cubic_conditional_variance_sample_rate` now convert the exact dyadic -- ladders to the sample rates (17)--(18), with constants 60B2 and 310B3. -- `linear_conditional_variance_sample_rate` supplies (19) at the common -- n^(-2/3) rate. Integrability and the total conditional bias--variance -- identity are still needed to assemble these component estimates. -- `linear_conditional_variance_with_memLp` supplies square integrability -- of the exact centered linear correction; the quadratic and cubic -- `_with_memLp` lemmas supply square integrability of the full corrections. -- `centered_corrections_conditional_second_moment_sample_rate` combines -- the three dependent centered corrections with the exact constant in (20). -- `centered_corrections_expected_conditional_second_moment_sample_rate` -- integrates that bound. -- `cubicEstimator_sub_projectedEstimatorMean_eq_centered_corrections` -- identifies the full estimator fluctuation with that centered sum. -- `cubicEstimator_sub_projectedEstimatorMean_memLp` proves its square -- integrability, and `cubicEstimator_fluctuation_second_moment_sample_rate` -- transfers (20) to its unconditional second moment. The remaining step -- is the conditional bias--variance identity and final assembly. -- `projectionKernel_risk_bound` assumes projection bias and risk -- decomposition, so it cannot supply this missing connection. exact cubicEstimator_mse_sample_rate c_f C_f L P n hn hP A
CausalSmith.Stat.TransportCaceRoughnuisanceLength.marked_cubic_mse · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse.lean:53
CausalSmith.Stat.STAT_TransportCaceRoughnuisanceLength_Research.Helpers.CubicMse.Assembly 1 declarations Bias and variance assembly interface

Bias and variance assembly interface

theorem mseEnvelope_positive

Given the supplied inputs, the stated result about mse envelope positive holds.

Formal statement
c_f C_f L :
ℝ
hc :
0 < c_f
hC :
1 < C_f
hL :
1 < L
0 < mseEnvelope c_f C_f L
Proof (Lean source)
lemma mseEnvelope_positive (c_f C_f L : ℝ) (hc : 0 < c_f) (hC : 1 < C_f) (hL : 1 < L) : 0 < mseEnvelope c_f C_f L := by unfold mseEnvelope positivity
CausalSmith.Stat.TransportCaceRoughnuisanceLength.mseEnvelope_positive · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/Assembly.lean:23
CausalSmith.Stat.STAT_TransportCaceRoughnuisanceLength_Research.Helpers.CubicMse.Blocks 4 declarations Exact deterministic four-block partition

Exact deterministic four-block partition

theorem block_card

Given the supplied inputs, the stated result about block card holds.

Formal statement
n :
ℕ
b :
Fin 4
(blockIdx n b).card = blockSize n b
Proof (Lean source)
lemma block_card (n : ℕ) (b : Fin 4) : (blockIdx n b).card = blockSize n b := by let lo := b.val * n / 4 let hi := (b.val + 1) * n / 4 have hprodlo : b.val * n ≤ (b.val + 1) * n := Nat.mul_le_mul_right n (by omega) have hprodhi : (b.val + 1) * n ≤ 4 * n := Nat.mul_le_mul_right n (by omega) have hlo : lo ≤ hi := by dsimp [lo, hi]; omega have hhi : hi ≤ n := by have hb := b.isLt dsimp [hi] omega have hsub : (Finset.univ.filter (fun i : Fin n => i.val < lo)) ⊆ (Finset.univ.filter (fun i : Fin n => i.val < hi)) := by intro i hi' simp only [mem_filter, Finset.mem_univ, true_and] at hi' ⊢ omega have heq : blockIdx n b = (Finset.univ.filter (fun i : Fin n => i.val < hi)) \ (Finset.univ.filter (fun i : Fin n => i.val < lo)) := by ext i simp [blockIdx, lo, hi] omega rw [heq, Finset.card_sdiff, Finset.inter_eq_left.mpr hsub] rw [Fin.card_filter_val_lt, Fin.card_filter_val_lt] simp [Nat.min_eq_right hhi, Nat.min_eq_right (le_trans hlo hhi), blockSize, lo, hi]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.block_card · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/Blocks.lean:8
theorem block_size_lower

Given the supplied inputs, the stated result about block size lower holds.

Formal statement
n :
ℕ
hn :
threshold ≤ n
b :
Fin 4
(n : ℝ) / 5 ≤ blockSize n b
Proof (Lean source)
lemma block_size_lower (n : ℕ) (hn : threshold ≤ n) (b : Fin 4) : (n : ℝ) / 5 ≤ blockSize n b := by apply (div_le_iff₀ (by norm_num : (0 : ℝ) < 5)).2 norm_cast norm_num [threshold] at hn fin_cases b <;> simp only [blockSize] <;> omega
CausalSmith.Stat.TransportCaceRoughnuisanceLength.block_size_lower · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/Blocks.lean:38
def trainingView

The training view object is defined from the supplied inputs.

Definition (Lean source)
n :
ℕ
ω :
trainingView ω :
((fun i => if i ∈ blockIdx n 0 then ω.1 i else (0, false, false, 0)), (fun i => if i ∈ blockIdx n 0 then ω.2 i else 0))
CausalSmith.Stat.TransportCaceRoughnuisanceLength.trainingView · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/Blocks.lean:46
def trainingSigma

The training sigma object is defined from the supplied inputs.

Definition (Lean source)
n :
ℕ
trainingSigma n :
CausalSmith.Stat.TransportCaceRoughnuisanceLength.trainingSigma · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/Blocks.lean:51
CausalSmith.Stat.STAT_TransportCaceRoughnuisanceLength_Research.Helpers.CubicMse.BoundedLinearScores 7 declarations Roadmap (19) uses bounded observation scores rather than the absolute cell-pair envelope in (15).

Density-free variance bounds for linear marked scores

Roadmap (19) uses bounded observation scores rather than the absolute cell-pair envelope in (15). Keeping the signed covariance sum gives a bound independent of the density envelope and of the number of cells.

theorem variance_iidBlockHeight_one_le Lemma variance_iidBlockHeight_one_le in the paper ↗

A bounded score averaged over an actual iid block has variance at most its squared envelope divided by the block size. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
n :
ℕ
S :
hS :
0 < S.card
f :
Ω → ℝ
hf :
C :
ℝ
_hC :
0 ≤ C
hb :
∀ x, |f x| ≤ C
variance (iidBlockHeight 1 S f) (Measure.pi (fun _ : Fin n => μ)) ≤ C ^ 2 / S.card
Proof (Lean source)
-- @node: variance_iidBlockHeight_one_le lemma variance_iidBlockHeight_one_le {Ω : Type*} [MeasurableSpace Ω] [StandardBorelSpace Ω] {μ : Measure Ω} [IsProbabilityMeasure μ] {n : ℕ} (S : Finset (Fin n)) (hS : 0 < S.card) (f : Ω → ℝ) (hf : Measurable f) (C : ℝ) (_hC : 0 ≤ C) (hb : ∀ x, |f x| ≤ C) : variance (iidBlockHeight 1 S f) (Measure.pi (fun _ : Fin n => μ)) ≤ C ^ 2 / S.card := by have hlp : MemLp f 2 μ := MemLp.of_bound hf.aestronglyMeasurable C (by filter_upwards [] with x simpa only [Real.norm_eq_abs] using hb x) have hblock : Measurable (iidBlockHeight 1 S f) := by unfold iidBlockHeight fun_prop rw [← covariance_self hblock.aemeasurable, covariance_iidBlockHeight S hS f f hf hf hlp hlp, covariance_self hf.aemeasurable] have hv := variance_le_sq_of_bounded (μ := μ) (a := -C) (b := C) (X := f) (by filter_upwards [] with x exact abs_le.mp (hb x)) hf.aemeasurable have hv' : variance f μ ≤ C ^ 2 := by convert hv using 1 <;> ring norm_num only [Nat.cast_one, one_pow] calc _ ≤ (1 / (S.card : ℝ)) * C ^ 2 := mul_le_mul_of_nonneg_left hv' (by positivity) _ = C ^ 2 / S.card := by ring
CausalSmith.Stat.TransportCaceRoughnuisanceLength.variance_iidBlockHeight_one_le · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/BoundedLinearScores.lean:18
theorem normalized_iid_cell_covariance_sum_eq_variance Lemma normalized_iid_cell_covariance_sum_eq_variance in the paper ↗

The covariance quadratic form of cell histograms is the variance of the single-record cell score, with the exact iid normalization. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
n K :
ℕ
hK :
0 < K
S :
hS :
0 < S.card
f :
Fin K → Ω → ℝ
hf :
∀ l, Measurable (f l)
hlp :
∀ l, MemLp (f l) 2 μ
c :
Fin K → ℝ
(K : ℝ)⁻¹ ^ 2 * ∑ l : Fin K, ∑ r : Fin K, c l * c r * covariance (iidBlockHeight K S (f l)) (iidBlockHeight K S (f r)) (Measure.pi (fun _ : Fin n => μ))
= variance (fun x => ∑ l : Fin K, c l * f l x) μ / S.card
Proof (Lean source)
-- @node: normalized_iid_cell_covariance_sum_eq_variance lemma normalized_iid_cell_covariance_sum_eq_variance {Ω : Type*} [MeasurableSpace Ω] [StandardBorelSpace Ω] {μ : Measure Ω} [IsProbabilityMeasure μ] {n K : ℕ} (hK : 0 < K) (S : Finset (Fin n)) (hS : 0 < S.card) (f : Fin K → Ω → ℝ) (hf : ∀ l, Measurable (f l)) (hlp : ∀ l, MemLp (f l) 2 μ) (c : Fin K → ℝ) : (K : ℝ)⁻¹ ^ 2 * ∑ l : Fin K, ∑ r : Fin K, c l * c r * covariance (iidBlockHeight K S (f l)) (iidBlockHeight K S (f r)) (Measure.pi (fun _ : Fin n => μ)) = variance (fun x => ∑ l : Fin K, c l * f l x) μ / S.card := by have hKr : (K : ℝ) ≠ 0 := by exact_mod_cast hK.ne' have hsumlp : MemLp (fun x => ∑ l : Fin K, c l * f l x) 2 μ := memLp_finsetSum univ (fun l _ => (hlp l).const_mul (c l)) have hvar : variance (fun x => ∑ l : Fin K, c l * f l x) μ = ∑ l : Fin K, ∑ r : Fin K, c l * c r * covariance (f l) (f r) μ := by rw [← covariance_self hsumlp.aemeasurable, covariance_fun_sum_fun_sum' (fun l _ => (hlp l).const_mul (c l)) (fun r _ => (hlp r).const_mul (c r))] simp_rw [covariance_const_mul_left, covariance_const_mul_right] apply Finset.sum_congr rfl intro l _ apply Finset.sum_congr rfl intro r _ ring rw [hvar] simp_rw [covariance_iidBlockHeight S hS _ _ (hf _) (hf _) (hlp _) (hlp _)] rw [Finset.mul_sum, Finset.sum_div] apply Finset.sum_congr rfl intro l _ rw [Finset.mul_sum, Finset.sum_div] apply Finset.sum_congr rfl intro r _ field_simp
CausalSmith.Stat.TransportCaceRoughnuisanceLength.normalized_iid_cell_covariance_sum_eq_variance · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/BoundedLinearScores.lean:50
theorem abs_weighted_sourceCellScore_sum_le Lemma abs_weighted_sourceCellScore_sum_le in the paper ↗

Bounded coefficients on disjoint cells produce a bounded source score, including outside the covariate support where all cell scores vanish. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
K :
ℕ
hK :
0 < K
i :
Fin 7
c :
Fin K → ℝ
C :
ℝ
hC :
0 ≤ C
hc :
∀ l, |c l| ≤ C
o :
|∑ l : Fin K, c l * sourceCellScore i K l o| ≤ C
Proof (Lean source)
-- @node: abs_weighted_sourceCellScore_sum_le lemma abs_weighted_sourceCellScore_sum_le {K : ℕ} (hK : 0 < K) (i : Fin 7) (c : Fin K → ℝ) (C : ℝ) (hC : 0 ≤ C) (hc : ∀ l, |c l| ≤ C) (o : SourceObs) : |∑ l : Fin K, c l * sourceCellScore i K l o| ≤ C := by classical by_cases hx : o.1 ∈ covariateSpace · obtain ⟨l, hl⟩ := exists_cell_of_mem_covariateSpace hK o.1 hx rw [Finset.sum_eq_single l] · rw [sourceCellScore, if_pos hl, abs_mul, abs_of_nonneg (sourceCellMark_mem_unit_interval i o).1] exact (mul_le_mul_of_nonneg_right (hc l) (sourceCellMark_mem_unit_interval i o).1).trans (by nlinarith [(sourceCellMark_mem_unit_interval i o).2]) · intro r _ hrl rw [sourceCellScore, if_neg (fun hr => Set.disjoint_left.mp (cell_disjoint hK hrl) hr hl), mul_zero] · exact fun h => (h (Finset.mem_univ l)).elim · have hz (l : Fin K) : sourceCellScore i K l o = 0 := by rw [sourceCellScore, if_neg (fun hl => hx (cell_subset_covariateSpace hK l hl))] simp only [hz, mul_zero, Finset.sum_const_zero, abs_zero] exact hC
CausalSmith.Stat.TransportCaceRoughnuisanceLength.abs_weighted_sourceCellScore_sum_le · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/BoundedLinearScores.lean:87
theorem abs_weighted_targetCellScore_sum_le Lemma abs_weighted_targetCellScore_sum_le in the paper ↗

The target score has the same cell-disjointness bound, with unit marks. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
K :
ℕ
hK :
0 < K
c :
Fin K → ℝ
C :
ℝ
hC :
0 ≤ C
hc :
∀ l, |c l| ≤ C
x :
ℝ
|∑ l : Fin K, c l * targetCellScore K l x| ≤ C
Proof (Lean source)
-- @node: abs_weighted_targetCellScore_sum_le lemma abs_weighted_targetCellScore_sum_le {K : ℕ} (hK : 0 < K) (c : Fin K → ℝ) (C : ℝ) (hC : 0 ≤ C) (hc : ∀ l, |c l| ≤ C) (x : ℝ) : |∑ l : Fin K, c l * targetCellScore K l x| ≤ C := by classical by_cases hx : x ∈ covariateSpace · obtain ⟨l, hl⟩ := exists_cell_of_mem_covariateSpace hK x hx rw [Finset.sum_eq_single l] · simpa [targetCellScore, hl] using hc l · intro r _ hrl rw [targetCellScore, if_neg (fun hr => Set.disjoint_left.mp (cell_disjoint hK hrl) hr hl), mul_zero] · exact fun h => (h (Finset.mem_univ l)).elim · have hz (l : Fin K) : targetCellScore K l x = 0 := by rw [targetCellScore, if_neg (fun hl => hx (cell_subset_covariateSpace hK l hl))] simp only [hz, mul_zero, Finset.sum_const_zero, abs_zero] exact hC
CausalSmith.Stat.TransportCaceRoughnuisanceLength.abs_weighted_targetCellScore_sum_le · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/BoundedLinearScores.lean:112
theorem normalized_source_cell_covariance_sum_le

The signed source cell-pair sum retains cancellation and costs only C² / m, with no density or resolution factor. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n K :
ℕ
hP :
ModelClass c_f C_f L P n
hK :
0 < K
S :
hS :
0 < S.card
i :
Fin 7
c :
Fin K → ℝ
C :
ℝ
hC :
0 ≤ C
hc :
∀ l, |c l| ≤ C
(K : ℝ)⁻¹ ^ 2 * ∑ l : Fin K, ∑ r : Fin K, c l * c r * covariance (iidBlockHeight K S (sourceCellScore i K l)) (iidBlockHeight K S (sourceCellScore i K r)) (Measure.pi (fun _ : Fin n => sourceObsLaw P))
≤ C ^ 2 / S.card
Proof (Lean source)
-- @node: normalized_source_cell_covariance_sum_le lemma normalized_source_cell_covariance_sum_le (c_f C_f L : ℝ) (P : TransportLaw) (n K : ℕ) (hP : ModelClass c_f C_f L P n) (hK : 0 < K) (S : Finset (Fin n)) (hS : 0 < S.card) (i : Fin 7) (c : Fin K → ℝ) (C : ℝ) (hC : 0 ≤ C) (hc : ∀ l, |c l| ≤ C) : (K : ℝ)⁻¹ ^ 2 * ∑ l : Fin K, ∑ r : Fin K, c l * c r * covariance (iidBlockHeight K S (sourceCellScore i K l)) (iidBlockHeight K S (sourceCellScore i K r)) (Measure.pi (fun _ : Fin n => sourceObsLaw P)) ≤ C ^ 2 / S.card := by let : IsProbabilityMeasure (sourceObsLaw P) := sourceObsLaw_isProbabilityMeasure c_f C_f L P n hP have hlp (l : Fin K) : MemLp (sourceCellScore i K l) 2 (sourceObsLaw P) := memLp_two_of_mem_unit_interval (measurable_sourceCellScore i K l) (sourceCellScore_mem_unit_interval i K l) rw [normalized_iid_cell_covariance_sum_eq_variance hK S hS _ (measurable_sourceCellScore i K) hlp c] apply div_le_div_of_nonneg_right _ (Nat.cast_nonneg _) have hv := variance_le_sq_of_bounded (μ := sourceObsLaw P) (a := -C) (b := C) (X := fun o => ∑ l : Fin K, c l * sourceCellScore i K l o) (by filter_upwards [] with o exact abs_le.mp (abs_weighted_sourceCellScore_sum_le hK i c C hC hc o)) (by fun_prop) convert hv using 1 <;> first | ring | rfl
CausalSmith.Stat.TransportCaceRoughnuisanceLength.normalized_source_cell_covariance_sum_le · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/BoundedLinearScores.lean:132
theorem normalized_target_cell_covariance_sum_le

The target channel obeys the identical density-free variance bound. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n K :
ℕ
hP :
ModelClass c_f C_f L P n
hK :
0 < K
S :
hS :
0 < S.card
c :
Fin K → ℝ
C :
ℝ
hC :
0 ≤ C
hc :
∀ l, |c l| ≤ C
(K : ℝ)⁻¹ ^ 2 * ∑ l : Fin K, ∑ r : Fin K, c l * c r * covariance (iidBlockHeight K S (targetCellScore K l)) (iidBlockHeight K S (targetCellScore K r)) (Measure.pi (fun _ : Fin n => targetXLaw P))
≤ C ^ 2 / S.card
Proof (Lean source)
-- @node: normalized_target_cell_covariance_sum_le lemma normalized_target_cell_covariance_sum_le (c_f C_f L : ℝ) (P : TransportLaw) (n K : ℕ) (hP : ModelClass c_f C_f L P n) (hK : 0 < K) (S : Finset (Fin n)) (hS : 0 < S.card) (c : Fin K → ℝ) (C : ℝ) (hC : 0 ≤ C) (hc : ∀ l, |c l| ≤ C) : (K : ℝ)⁻¹ ^ 2 * ∑ l : Fin K, ∑ r : Fin K, c l * c r * covariance (iidBlockHeight K S (targetCellScore K l)) (iidBlockHeight K S (targetCellScore K r)) (Measure.pi (fun _ : Fin n => targetXLaw P)) ≤ C ^ 2 / S.card := by let : IsProbabilityMeasure (targetXLaw P) := targetXLaw_isProbabilityMeasure c_f C_f L P n hP have hlp (l : Fin K) : MemLp (targetCellScore K l) 2 (targetXLaw P) := memLp_two_of_mem_unit_interval (measurable_targetCellScore K l) (targetCellScore_mem_unit_interval K l) rw [normalized_iid_cell_covariance_sum_eq_variance hK S hS _ (measurable_targetCellScore K) hlp c] apply div_le_div_of_nonneg_right _ (Nat.cast_nonneg _) have hv := variance_le_sq_of_bounded (μ := targetXLaw P) (a := -C) (b := C) (X := fun x => ∑ l : Fin K, c l * targetCellScore K l x) (by filter_upwards [] with x exact abs_le.mp (abs_weighted_targetCellScore_sum_le hK c C hC hc x)) (by fun_prop) convert hv using 1 <;> first | ring | rfl
CausalSmith.Stat.TransportCaceRoughnuisanceLength.normalized_target_cell_covariance_sum_le · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/BoundedLinearScores.lean:159
theorem normalized_flatBlockHeight_covariance_sum_le

The signed covariance bound survives the flattening of the actual source and target experiment, for every marked coordinate. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n K :
ℕ
hP :
ModelClass c_f C_f L P n
hK :
0 < K
b :
Fin 4
hcard :
0 < (blockIdx n b).card
i :
Fin 7
c :
Fin K → ℝ
C :
ℝ
hC :
0 ≤ C
hc :
∀ l, |c l| ≤ C
(K : ℝ)⁻¹ ^ 2 * ∑ l : Fin K, ∑ r : Fin K, c l * c r * covariance (fun z => flatBlockHeight i b l (finsetCoordProj (flatBlock n b) z)) (fun z => flatBlockHeight i b r (finsetCoordProj (flatBlock n b) z)) (Measure.pi (flatLaw P n))
≤ C ^ 2 / blockSize n b
Proof (Lean source)
-- @node: normalized_flatBlockHeight_covariance_sum_le lemma normalized_flatBlockHeight_covariance_sum_le (c_f C_f L : ℝ) (P : TransportLaw) (n K : ℕ) (hP : ModelClass c_f C_f L P n) (hK : 0 < K) (b : Fin 4) (hcard : 0 < (blockIdx n b).card) (i : Fin 7) (c : Fin K → ℝ) (C : ℝ) (hC : 0 ≤ C) (hc : ∀ l, |c l| ≤ C) : (K : ℝ)⁻¹ ^ 2 * ∑ l : Fin K, ∑ r : Fin K, c l * c r * covariance (fun z => flatBlockHeight i b l (finsetCoordProj (flatBlock n b) z)) (fun z => flatBlockHeight i b r (finsetCoordProj (flatBlock n b) z)) (Measure.pi (flatLaw P n)) ≤ C ^ 2 / blockSize n b := by rw [← block_card] by_cases hi : i = 0 · subst i simp_rw [flatBlockHeight_proj_target] have hcov (l r : Fin K) := covariance_flatLaw_target c_f C_f L P n hP (iidBlockHeight K (blockIdx n b) (targetCellScore K l)) (iidBlockHeight K (blockIdx n b) (targetCellScore K r)) (by unfold iidBlockHeight; fun_prop) (by unfold iidBlockHeight; fun_prop) simp_rw [hcov] exact normalized_target_cell_covariance_sum_le c_f C_f L P n K hP hK (blockIdx n b) hcard c C hC hc · simp_rw [flatBlockHeight_proj_source i hi] have hcov (l r : Fin K) := covariance_flatLaw_source c_f C_f L P n hP (iidBlockHeight K (blockIdx n b) (sourceCellScore i K l)) (iidBlockHeight K (blockIdx n b) (sourceCellScore i K r)) (by unfold iidBlockHeight; fun_prop) (by unfold iidBlockHeight; fun_prop) simp_rw [hcov] exact normalized_source_cell_covariance_sum_le c_f C_f L P n K hP hK (blockIdx n b) hcard i c C hC hc
CausalSmith.Stat.TransportCaceRoughnuisanceLength.normalized_flatBlockHeight_covariance_sum_le · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/BoundedLinearScores.lean:185
CausalSmith.Stat.STAT_TransportCaceRoughnuisanceLength_Research.Helpers.CubicMse.Cancellation 3 declarations Exact cancellation of one within-cell projection residual

Exact cancellation of one within-cell projection residual

def cellAverage

The cell average object is defined from the supplied inputs.

Definition (Lean source)
f :
ℝ → ℝ
K :
ℕ
ℓ :
Fin K
cellAverage f K ℓ :
ℝ
(K : ℝ) * ∫ x in cell K ℓ, f x
theorem one_residual_cell_cancellation

Given the supplied inputs, the stated result about one residual cell cancellation holds.

Formal statement
c_f C_f L :
ℝ
n K :
ℕ
hP :
ModelClass c_f C_f L P n
hK :
0 < K
ℓ :
Fin K
i :
Fin 7
∫ x in cell K ℓ, (markedDensityVector c_f C_f L P n hP x i - cellAverage (fun y => markedDensityVector c_f C_f L P n hP y i) K ℓ)
= 0
Proof (Lean source)
lemma one_residual_cell_cancellation (c_f C_f L : ℝ) (P : TransportLaw) (n K : ℕ) (hP : ModelClass c_f C_f L P n) (hK : 0 < K) (ℓ : Fin K) (i : Fin 7) : ∫ x in cell K ℓ, (markedDensityVector c_f C_f L P n hP x i - cellAverage (fun y => markedDensityVector c_f C_f L P n hP y i) K ℓ) = 0 := by let f := fun x => markedDensityVector c_f C_f L P n hP x i have hKreal : (0 : ℝ) < K := by exact_mod_cast hK have hcell : volume (cell K ℓ) = ofReal (1 / (K : ℝ)) := by unfold cell split_ifs with hlast · have hlast' : (ℓ.val : ℝ) + 1 = K := by exact_mod_cast hlast simp only [Real.volume_Icc] congr 1 field_simp linarith · simp only [Real.volume_Ico] congr 1 field_simp ring have hfinite : volume (cell K ℓ) ≠ ⊤ := by rw [hcell]; exact ENNReal.ofReal_ne_top have havg : cellAverage f K ℓ = ⨍ x in cell K ℓ, f x := by rw [MeasureTheory.setAverage_eq] have hreal : volume.real (cell K ℓ) = 1 / (K : ℝ) := by rw [real, hcell] simp [hKreal.le] simp only [cellAverage, hreal, smul_eq_mul] congr 1 field_simp change ∫ x in cell K ℓ, f x - cellAverage f K ℓ = 0 rw [havg] exact MeasureTheory.setAverage_sub_setAverage hfinite f
CausalSmith.Stat.TransportCaceRoughnuisanceLength.one_residual_cell_cancellation · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/Cancellation.lean:14
theorem one_residual_cell_product_cancellation

Any cell-constant Taylor coefficient and any finite collection of cell-constant projected factors can multiply one residual without changing its zero integral. This covers every one-residual quadratic and cubic term. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n K q :
ℕ
hP :
ModelClass c_f C_f L P n
hK :
0 < K
ℓ :
Fin K
i :
Fin 7
a :
ℝ → ℝ
d :
Fin q → ℝ → ℝ
a₀ :
ℝ
d₀ :
Fin q → ℝ
ha :
∀ x ∈ cell K ℓ, a x = a₀
hd :
∀ j, ∀ x ∈ cell K ℓ, d j x = d₀ j
(∫ x in cell K ℓ, a x * (∏ j : Fin q, d j x) * (markedDensityVector c_f C_f L P n hP x i - cellAverage (fun y => markedDensityVector c_f C_f L P n hP y i) K ℓ))
= 0
Proof (Lean source)
-- @node: one_residual_cell_product_cancellation lemma one_residual_cell_product_cancellation (c_f C_f L : ℝ) (P : TransportLaw) (n K q : ℕ) (hP : ModelClass c_f C_f L P n) (hK : 0 < K) (ℓ : Fin K) (i : Fin 7) (a : ℝ → ℝ) (d : Fin q → ℝ → ℝ) (a₀ : ℝ) (d₀ : Fin q → ℝ) (ha : ∀ x ∈ cell K ℓ, a x = a₀) (hd : ∀ j, ∀ x ∈ cell K ℓ, d j x = d₀ j) : (∫ x in cell K ℓ, a x * (∏ j : Fin q, d j x) * (markedDensityVector c_f C_f L P n hP x i - cellAverage (fun y => markedDensityVector c_f C_f L P n hP y i) K ℓ)) = 0 := by classical calc _ = ∫ x in cell K ℓ, (a₀ * ∏ j : Fin q, d₀ j) * (markedDensityVector c_f C_f L P n hP x i - cellAverage (fun y => markedDensityVector c_f C_f L P n hP y i) K ℓ) := by apply setIntegral_congr_fun (by unfold cell; split_ifs <;> measurability) intro x hx dsimp only rw [ha x hx] congr 2 exact Finset.prod_congr rfl (fun j _ => hd j x hx) _ = (a₀ * ∏ j : Fin q, d₀ j) * ∫ x in cell K ℓ, (markedDensityVector c_f C_f L P n hP x i - cellAverage (fun y => markedDensityVector c_f C_f L P n hP y i) K ℓ) := integral_const_mul _ _ _ = 0 := by rw [one_residual_cell_cancellation c_f C_f L P n K hP hK ℓ i, mul_zero]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.one_residual_cell_product_cancellation · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/Cancellation.lean:50
CausalSmith.Stat.STAT_TransportCaceRoughnuisanceLength_Research.Helpers.CubicMse.CellMoments 37 declarations Product-law and bounded-mark facts for histogram cells

Product-law and bounded-mark facts for histogram cells

theorem dataLaw_eq_source_target_pi

The three sampling assumptions identify the full observed-data law with the product of the source and target iid laws. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hP :
ModelClass c_f C_f L P n
dataLaw P n n
= (Measure.pi (fun _ : Fin n => sourceObsLaw P)).prod (Measure.pi (fun _ : Fin n => targetXLaw P))
Proof (Lean source)
lemma dataLaw_eq_source_target_pi (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hP : ModelClass c_f C_f L P n) : dataLaw P n n = (Measure.pi (fun _ : Fin n => sourceObsLaw P)).prod (Measure.pi (fun _ : Fin n => targetXLaw P)) := by rw [hP.independence, hP.sourceIid, hP.targetIid]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.dataLaw_eq_source_target_pi · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/CellMoments.lean:16
def FlatIndex

A single dependent product carrier for the source and target arrays. This is the carrier expected by the conditional independence lemmas for coordinate blocks. For the displayed assumptions and inputs, the stated object is defined.

Definition (Lean source)
n :
ℕ
FlatIndex n :
Type
Sum (Fin n) (Fin n)
def FlatObs

The flat obs object is defined from the supplied inputs.

Definition (Lean source)
n :
ℕ
FlatObs n :
FlatIndex n → Type
clause 1
| .inl _ => SourceObs
clause 2
| .inr _ => ℝ
instance flatObsMeasurableSpace

The flat obs measurable space object is defined from the supplied inputs.

Definition (Lean source)
noncomputable instance flatObsMeasurableSpace (n : ℕ) (i : FlatIndex n) : MeasurableSpace (FlatObs n i) := by cases i <;> simp only [FlatObs] <;> infer_instance
CausalSmith.Stat.TransportCaceRoughnuisanceLength.flatObsMeasurableSpace · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/CellMoments.lean:34
def flatLaw

The flat law object is defined from the supplied inputs.

Definition (Lean source)
n :
ℕ
i :
flatLaw P n i :
clause 1
| .inl _ => sourceObsLaw P
clause 2
| .inr _ => targetXLaw P
def flattenSample

The flatten sample object is defined from the supplied inputs.

Definition (Lean source)
n :
ℕ
i :
flattenSample n i :
theorem map_flattenSample_dataLaw

The model assumptions identify the flattened sample with one dependent Measure.pi. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hP :
ModelClass c_f C_f L P n
(dataLaw P n n).map (flattenSample n) = Measure.pi (flatLaw P n)
Proof (Lean source)
lemma map_flattenSample_dataLaw (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hP : ModelClass c_f C_f L P n) : (dataLaw P n n).map (flattenSample n) = Measure.pi (flatLaw P n) := by letI : IsProbabilityMeasure P.assignedLaw := hP.randomized.1 letI : IsFiniteMeasure (sourceObsLaw P) := by unfold sourceObsLaw infer_instance letI : IsProbabilityMeasure P.fullLaw := hP.sourceBounds.2.2.1 letI : IsFiniteMeasure (targetXLaw P) := by unfold targetXLaw populationLaw infer_instance letI : ∀ i, SigmaFinite (flatLaw P n i) := fun i => by cases i <;> simp only [flatLaw] <;> infer_instance rw [dataLaw_eq_source_target_pi c_f C_f L P n hP] exact (MeasureTheory.measurePreserving_sumPiEquivProdPi_symm (flatLaw P n)).map_eq
CausalSmith.Stat.TransportCaceRoughnuisanceLength.map_flattenSample_dataLaw · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/CellMoments.lean:51
def flatBlock

The flat block object is defined from the supplied inputs.

Definition (Lean source)
n :
ℕ
b :
Fin 4
flatBlock n b :
(blockIdx n b).image inl ∪ (blockIdx n b).image inr
theorem inl_mem_flatBlock

Given the supplied inputs, the stated result about inl mem flat block holds.

Formal statement
n :
ℕ
b :
Fin 4
r :
Fin n
inl r ∈ flatBlock n b ↔ r ∈ blockIdx n b
Proof (Lean source)
lemma inl_mem_flatBlock {n : ℕ} {b : Fin 4} (r : Fin n) : inl r ∈ flatBlock n b ↔ r ∈ blockIdx n b := by simp [flatBlock]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.inl_mem_flatBlock · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/CellMoments.lean:73
theorem inr_mem_flatBlock

Given the supplied inputs, the stated result about inr mem flat block holds.

Formal statement
n :
ℕ
b :
Fin 4
r :
Fin n
inr r ∈ flatBlock n b ↔ r ∈ blockIdx n b
Proof (Lean source)
lemma inr_mem_flatBlock {n : ℕ} {b : Fin 4} (r : Fin n) : inr r ∈ flatBlock n b ↔ r ∈ blockIdx n b := by simp [flatBlock]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.inr_mem_flatBlock · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/CellMoments.lean:78
theorem blockIdx_disjoint

Given the supplied inputs, the stated result about block idx disjoint holds.

Formal statement
n :
ℕ
b c :
Fin 4
hbc :
b ≠ c
Proof (Lean source)
lemma blockIdx_disjoint {n : ℕ} {b c : Fin 4} (hbc : b ≠ c) : Disjoint (blockIdx n b) (blockIdx n c) := by rw [Finset.disjoint_left] intro r hrb hrc fin_cases b <;> fin_cases c <;> simp [blockIdx] at hrb hrc ⊢ <;> omega
CausalSmith.Stat.TransportCaceRoughnuisanceLength.blockIdx_disjoint · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/CellMoments.lean:83
theorem flatBlock_disjoint

Given the supplied inputs, the stated result about flat block disjoint holds.

Formal statement
n :
ℕ
b c :
Fin 4
hbc :
b ≠ c
Proof (Lean source)
lemma flatBlock_disjoint {n : ℕ} {b c : Fin 4} (hbc : b ≠ c) : Disjoint (flatBlock n b) (flatBlock n c) := by rw [Finset.disjoint_left] intro i hib hic cases i with | inl r => rw [inl_mem_flatBlock] at hib hic exact Finset.disjoint_left.mp (blockIdx_disjoint hbc) hib hic | inr r => rw [inr_mem_flatBlock] at hib hic exact Finset.disjoint_left.mp (blockIdx_disjoint hbc) hib hic
CausalSmith.Stat.TransportCaceRoughnuisanceLength.flatBlock_disjoint · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/CellMoments.lean:90
theorem flatBlock_training_disjoint

Given the supplied inputs, the stated result about flat block training disjoint holds.

Formal statement
n :
ℕ
t :
Fin 3
Disjoint (flatBlock n 0) (flatBlock n t.succ)
Proof (Lean source)
lemma flatBlock_training_disjoint (n : ℕ) (t : Fin 3) : Disjoint (flatBlock n 0) (flatBlock n t.succ) := flatBlock_disjoint (Fin.succ_ne_zero t).symm
CausalSmith.Stat.TransportCaceRoughnuisanceLength.flatBlock_training_disjoint · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/CellMoments.lean:103
theorem flatBlock_eval_pairwise

Given the supplied inputs, the stated result about flat block eval pairwise holds.

Formal statement
n :
ℕ
Pairwise (fun s t : Fin 3 => Disjoint (flatBlock n s.succ) (flatBlock n t.succ))
Proof (Lean source)
lemma flatBlock_eval_pairwise (n : ℕ) : Pairwise (fun s t : Fin 3 => Disjoint (flatBlock n s.succ) (flatBlock n t.succ)) := by intro s t hst exact flatBlock_disjoint ((Fin.succ_injective 3).ne hst)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.flatBlock_eval_pairwise · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/CellMoments.lean:108
def flatMask

The flat mask object is defined from the supplied inputs.

Definition (Lean source)
n :
ℕ
b :
Fin 4
x :
(i : FlatIndex n) → FlatObs n i
i :
flatMask n b x i :
fun i
=> by classical cases i with | inl r => exact if inl r ∈ flatBlock n b then x (inl r) else (0, false, false, 0) | inr r => exact if inr r ∈ flatBlock n b then x (inr r) else 0
theorem flattenSample_trainingView

Given the supplied inputs, the stated result about flatten sample training view holds.

Formal statement
n :
ℕ
w :
Proof (Lean source)
lemma flattenSample_trainingView {n : ℕ} (w : TwoSample n n) : flattenSample n (trainingView w) = flatMask n 0 (flattenSample n w) := by funext i cases i with | inl r => simp [flattenSample, trainingView, flatMask, inl_mem_flatBlock, MeasurableEquiv.coe_sumPiEquivProdPi_symm] | inr r => simp [flattenSample, trainingView, flatMask, inr_mem_flatBlock, MeasurableEquiv.coe_sumPiEquivProdPi_symm]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.flattenSample_trainingView · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/CellMoments.lean:123
def flatReconstruct

The flat reconstruct object is defined from the supplied inputs.

Definition (Lean source)
n :
ℕ
b :
Fin 4
z :
(i : {i // i ∈ flatBlock n b}) → FlatObs n i.val
i :
flatReconstruct n b z i :
fun i
=> by classical by_cases hi : i ∈ flatBlock n b · exact z ⟨i, hi⟩ · cases i with | inl _ => exact (0, false, false, 0) | inr _ => exact 0
CausalSmith.Stat.TransportCaceRoughnuisanceLength.flatReconstruct · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/CellMoments.lean:135
theorem measurable_flatReconstruct

Given the supplied inputs, the stated result about measurable flat reconstruct holds.

Formal statement
n :
ℕ
b :
Fin 4
Proof (Lean source)
@[fun_prop] lemma measurable_flatReconstruct (n : ℕ) (b : Fin 4) : Measurable (flatReconstruct n b) := by rw [measurable_pi_iff] intro i unfold flatReconstruct split_ifs with hi · exact measurable_pi_apply (⟨i, hi⟩ : {j // j ∈ flatBlock n b}) · cases i <;> fun_prop
CausalSmith.Stat.TransportCaceRoughnuisanceLength.measurable_flatReconstruct · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/CellMoments.lean:147
theorem flatReconstruct_proj_eq_mask

Given the supplied inputs, the stated result about flat reconstruct proj eq mask holds.

Formal statement
n :
ℕ
b :
Fin 4
x :
(i : FlatIndex n) → FlatObs n i
Proof (Lean source)
lemma flatReconstruct_proj_eq_mask (n : ℕ) (b : Fin 4) (x : (i : FlatIndex n) → FlatObs n i) : flatReconstruct n b (finsetCoordProj (flatBlock n b) x) = flatMask n b x := by funext i cases i with | inl r => simp only [flatReconstruct, flatMask] split_ifs with hi <;> rfl | inr r => simp only [flatReconstruct, flatMask] split_ifs with hi <;> rfl
CausalSmith.Stat.TransportCaceRoughnuisanceLength.flatReconstruct_proj_eq_mask · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/CellMoments.lean:158
theorem proj_flatMask_eq_proj

Given the supplied inputs, the stated result about proj flat mask eq proj holds.

Formal statement
n :
ℕ
b :
Fin 4
x :
(i : FlatIndex n) → FlatObs n i
Proof (Lean source)
lemma proj_flatMask_eq_proj (n : ℕ) (b : Fin 4) (x : (i : FlatIndex n) → FlatObs n i) : finsetCoordProj (flatBlock n b) (flatMask n b x) = finsetCoordProj (flatBlock n b) x := by funext i rcases i with ⟨i, hi⟩ cases i <;> simp [finsetCoordProj, flatMask, hi]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.proj_flatMask_eq_proj · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/CellMoments.lean:171
def flatTrainingProj

The flat training proj object is defined from the supplied inputs.

Definition (Lean source)
n :
ℕ
flatTrainingProj n :
((i : {i // i ∈ flatBlock n 0}) → FlatObs n i.val)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.flatTrainingProj · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/CellMoments.lean:180
theorem flatTrainingProj_trainingView

Given the supplied inputs, the stated result about flat training proj training view holds.

Formal statement
n :
ℕ
w :
Proof (Lean source)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.flatTrainingProj_trainingView · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/CellMoments.lean:185
theorem trainingView_eq_unflatten_reconstruct_proj

Given the supplied inputs, the stated result about training view eq unflatten reconstruct proj holds.

Formal statement
n :
ℕ
w :
Proof (Lean source)
lemma trainingView_eq_unflatten_reconstruct_proj {n : ℕ} (w : TwoSample n n) : trainingView w = (sumPiEquivProdPi (FlatObs n)) (flatReconstruct n 0 (flatTrainingProj n w)) := by apply (sumPiEquivProdPi (FlatObs n)).symm.injective rw [MeasurableEquiv.symm_apply_apply] change flattenSample n (trainingView w) = flatReconstruct n 0 (flatTrainingProj n w) rw [flattenSample_trainingView] exact (flatReconstruct_proj_eq_mask n 0 (flattenSample n w)).symm
CausalSmith.Stat.TransportCaceRoughnuisanceLength.trainingView_eq_unflatten_reconstruct_proj · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/CellMoments.lean:191
theorem trainingSigma_eq_comap_flatTrainingProj

The paper's zero-filled training view generates the same sigma algebra as the flattened finite-coordinate projection used by the conditional product library. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
n :
ℕ
Proof (Lean source)
lemma trainingSigma_eq_comap_flatTrainingProj (n : ℕ) : trainingSigma n = comap (flatTrainingProj n) inferInstance := by apply le_antisymm · apply comap_le have hcomp := (sumPiEquivProdPi (FlatObs n)).measurable.comp ((measurable_flatReconstruct n 0).comp (comap_measurable (flatTrainingProj n))) convert hcomp using 1 funext w exact trainingView_eq_unflatten_reconstruct_proj w · apply comap_le have hcomp := (measurable_finsetCoordProj (flatBlock n 0)).comp ((sumPiEquivProdPi (FlatObs n)).symm.measurable.comp (comap_measurable trainingView)) convert hcomp using 1 funext w exact (flatTrainingProj_trainingView w).symm
CausalSmith.Stat.TransportCaceRoughnuisanceLength.trainingSigma_eq_comap_flatTrainingProj · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/CellMoments.lean:202
theorem targetXLaw_isProbabilityMeasure

The target marginal is a probability measure. Positivity of the conditioning event is forced by the strictly positive density lower envelope. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hP :
ModelClass c_f C_f L P n
Proof (Lean source)
lemma targetXLaw_isProbabilityMeasure (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hP : ModelClass c_f C_f L P n) : IsProbabilityMeasure (targetXLaw P) := by letI : IsProbabilityMeasure P.fullLaw := hP.sourceBounds.2.2.1 have hc : 0 < c_f := hP.sourceBounds.1.1 have htarget_univ : targetXLaw P univ ≠ 0 := by rw [hP.targetBounds.1, withDensity_apply _ MeasurableSet.univ, Measure.restrict_univ] apply ne_of_gt calc 0 < ofReal c_f * volume covariateSpace := by rw [show volume covariateSpace = 1 by simp [covariateSpace]] simp [ENNReal.ofReal_pos.2 hc] _ = ∫⁻ _x, ofReal c_f ∂(volume.restrict covariateSpace) := by simp _ ≤ ∫⁻ x, ofReal (P.fT x) ∂(volume.restrict covariateSpace) := by apply lintegral_mono_ae filter_upwards [ae_restrict_mem (by simp [covariateSpace] : MeasurableSet covariateSpace)] with x hx exact ENNReal.ofReal_le_ofReal (hP.targetBounds.2.1 x hx).1 have hevent : P.fullLaw {o | population o = false} ≠ 0 := by intro hevent_zero apply htarget_univ unfold targetXLaw populationLaw rw [ProbabilityTheory.cond_eq_zero_of_meas_eq_zero hevent_zero] simp letI : IsProbabilityMeasure (populationLaw P false) := by unfold populationLaw exact ProbabilityTheory.cond_isProbabilityMeasure hevent unfold targetXLaw apply Measure.isProbabilityMeasure_map apply aemeasurable unfold covariate fun_prop
CausalSmith.Stat.TransportCaceRoughnuisanceLength.targetXLaw_isProbabilityMeasure · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/CellMoments.lean:222
theorem sourceObsLaw_isProbabilityMeasure

Given the supplied inputs, the stated result about source obs law is probability measure holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hP :
ModelClass c_f C_f L P n
Proof (Lean source)
lemma sourceObsLaw_isProbabilityMeasure (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hP : ModelClass c_f C_f L P n) : IsProbabilityMeasure (sourceObsLaw P) := by letI : IsProbabilityMeasure P.assignedLaw := hP.randomized.1 unfold sourceObsLaw apply Measure.isProbabilityMeasure_map apply aemeasurable unfold observeSource covariate fun_prop
CausalSmith.Stat.TransportCaceRoughnuisanceLength.sourceObsLaw_isProbabilityMeasure · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/CellMoments.lean:256
theorem flatLaw_isProbabilityMeasure

Given the supplied inputs, the stated result about flat law is probability measure holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hP :
ModelClass c_f C_f L P n
i :
Proof (Lean source)
lemma flatLaw_isProbabilityMeasure (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hP : ModelClass c_f C_f L P n) (i : FlatIndex n) : IsProbabilityMeasure (flatLaw P n i) := by cases i with | inl r => simp only [flatLaw] exact sourceObsLaw_isProbabilityMeasure c_f C_f L P n hP | inr r => simp only [flatLaw] exact targetXLaw_isProbabilityMeasure c_f C_f L P n hP
CausalSmith.Stat.TransportCaceRoughnuisanceLength.flatLaw_isProbabilityMeasure · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/CellMoments.lean:266
theorem measurableSet_cell

Given the supplied inputs, the stated result about measurable set cell holds.

Formal statement
K :
ℕ
l :
Fin K
MeasurableSet (cell K l)
Proof (Lean source)
lemma measurableSet_cell (K : ℕ) (l : Fin K) : MeasurableSet (cell K l) := by unfold cell split_ifs <;> measurability
CausalSmith.Stat.TransportCaceRoughnuisanceLength.measurableSet_cell · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/CellMoments.lean:278
theorem cell_subset_covariateSpace

Given the supplied inputs, the stated result about cell subset covariate space holds.

Formal statement
K :
ℕ
hK :
0 < K
l :
Fin K
cell K l ⊆ covariateSpace
Proof (Lean source)
lemma cell_subset_covariateSpace {K : ℕ} (hK : 0 < K) (l : Fin K) : cell K l ⊆ covariateSpace := by have hKr : (0 : ℝ) < K := by exact_mod_cast hK intro x hx unfold cell at hx unfold covariateSpace split_ifs at hx · constructor · exact le_trans (div_nonneg (by positivity) hKr.le) hx.1 · exact hx.2 · constructor · exact le_trans (div_nonneg (by positivity) hKr.le) hx.1 · have hl : (l.val : ℝ) + 1 ≤ K := by exact_mod_cast l.isLt exact le_trans hx.2.le ((div_le_one hKr).2 hl)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.cell_subset_covariateSpace · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/CellMoments.lean:283
theorem volume_cell

Given the supplied inputs, the stated result about volume cell holds.

Formal statement
K :
ℕ
hK :
0 < K
l :
Fin K
volume (cell K l) = ofReal (1 / (K : ℝ))
Proof (Lean source)
lemma volume_cell {K : ℕ} (hK : 0 < K) (l : Fin K) : volume (cell K l) = ofReal (1 / (K : ℝ)) := by have hKr : (0 : ℝ) < K := by exact_mod_cast hK unfold cell split_ifs with hlast · have hlast' : (l.val : ℝ) + 1 = K := by exact_mod_cast hlast simp only [Real.volume_Icc] congr 1 field_simp linarith · simp only [Real.volume_Ico] congr 1 field_simp ring
theorem cell_disjoint

Given the supplied inputs, the stated result about cell disjoint holds.

Formal statement
K :
ℕ
hK :
0 < K
l r :
Fin K
hlr :
l ≠ r
Disjoint (cell K l) (cell K r)
Proof (Lean source)
lemma cell_disjoint {K : ℕ} (hK : 0 < K) {l r : Fin K} (hlr : l ≠ r) : Disjoint (cell K l) (cell K r) := by rw [Set.disjoint_left] intro x hxl hxr have hKr : (0 : ℝ) < K := by exact_mod_cast hK rcases lt_or_gt_of_ne (Fin.val_ne_of_ne hlr) with hltr | hrtl · have hlnot : l.val + 1 ≠ K := by omega unfold cell at hxl hxr simp only [hlnot, if_false] at hxl split_ifs at hxr all_goals have hstep : (l.val : ℝ) + 1 ≤ r.val := by exact_mod_cast (show l.val + 1 ≤ r.val by omega) have hdiv : ((l.val : ℝ) + 1) / K ≤ (r.val : ℝ) / K := (div_le_div_iff_of_pos_right hKr).2 hstep linarith [hxl.2, hxr.1, hdiv] · have hrnot : r.val + 1 ≠ K := by omega unfold cell at hxl hxr simp only [hrnot, if_false] at hxr split_ifs at hxl all_goals have hstep : (r.val : ℝ) + 1 ≤ l.val := by exact_mod_cast (show r.val + 1 ≤ l.val by omega) have hdiv : ((r.val : ℝ) + 1) / K ≤ (l.val : ℝ) / K := (div_le_div_iff_of_pos_right hKr).2 hstep linarith [hxr.2, hxl.1, hdiv]
theorem target_cell_mass_le

Either source or target covariate mass of one regular cell is at most C_f / K. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n K :
ℕ
hP :
ModelClass c_f C_f L P n
hK :
0 < K
l :
Fin K
(targetXLaw P (cell K l)).toReal ≤ C_f / K
Proof (Lean source)
lemma target_cell_mass_le (c_f C_f L : ℝ) (P : TransportLaw) (n K : ℕ) (hP : ModelClass c_f C_f L P n) (hK : 0 < K) (l : Fin K) : (targetXLaw P (cell K l)).toReal ≤ C_f / K := by have hC : 0 ≤ C_f := le_trans (by norm_num) hP.sourceBounds.2.1.le have hmeas := measurableSet_cell K l rw [hP.targetBounds.1, withDensity_apply _ hmeas] have hmono : ∫⁻ x in cell K l, ofReal (P.fT x) ∂(volume.restrict covariateSpace) ≤ ∫⁻ _x in cell K l, ofReal C_f ∂(volume.restrict covariateSpace) := by apply lintegral_mono_ae filter_upwards [ae_restrict_mem hmeas] with x hx exact ENNReal.ofReal_le_ofReal (hP.targetBounds.2.1 x (cell_subset_covariateSpace hK l hx)).2 have hsub := cell_subset_covariateSpace hK l have hrhs_top : ∫⁻ _x in cell K l, ofReal C_f ∂(volume.restrict covariateSpace) ≠ ⊤ := by rw [setLIntegral_const, Measure.restrict_apply hmeas, inter_eq_left.mpr hsub, volume_cell hK] finiteness apply le_trans (ENNReal.toReal_mono hrhs_top hmono) rw [setLIntegral_const, Measure.restrict_apply hmeas, inter_eq_left.mpr hsub, volume_cell hK] simp [ENNReal.toReal_mul, hC, div_eq_mul_inv]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.target_cell_mass_le · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/CellMoments.lean:342
theorem source_cell_mass_le

Given the supplied inputs, the stated result about source cell mass le holds.

Formal statement
c_f C_f L :
ℝ
n K :
ℕ
hP :
ModelClass c_f C_f L P n
hK :
0 < K
l :
Fin K
(sourceXLaw P (cell K l)).toReal ≤ C_f / K
Proof (Lean source)
lemma source_cell_mass_le (c_f C_f L : ℝ) (P : TransportLaw) (n K : ℕ) (hP : ModelClass c_f C_f L P n) (hK : 0 < K) (l : Fin K) : (sourceXLaw P (cell K l)).toReal ≤ C_f / K := by have hC : 0 ≤ C_f := le_trans (by norm_num) hP.sourceBounds.2.1.le have hmeas := measurableSet_cell K l rw [hP.sourceBounds.2.2.2.2.1, withDensity_apply _ hmeas] have hmono : ∫⁻ x in cell K l, ofReal (P.fS x) ∂(volume.restrict covariateSpace) ≤ ∫⁻ _x in cell K l, ofReal C_f ∂(volume.restrict covariateSpace) := by apply lintegral_mono_ae filter_upwards [ae_restrict_mem hmeas] with x hx exact ENNReal.ofReal_le_ofReal (hP.sourceBounds.2.2.2.2.2 x (cell_subset_covariateSpace hK l hx)).2 have hsub := cell_subset_covariateSpace hK l have hrhs_top : ∫⁻ _x in cell K l, ofReal C_f ∂(volume.restrict covariateSpace) ≠ ⊤ := by rw [setLIntegral_const, Measure.restrict_apply hmeas, inter_eq_left.mpr hsub, volume_cell hK] finiteness apply le_trans (ENNReal.toReal_mono hrhs_top hmono) rw [setLIntegral_const, Measure.restrict_apply hmeas, inter_eq_left.mpr hsub, volume_cell hK] simp [ENNReal.toReal_mul, hC, div_eq_mul_inv]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.source_cell_mass_le · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/CellMoments.lean:366
theorem condExp_comp_flattenSample

Conditional expectations given the paper's training view are the pullbacks of conditional expectations given block zero in the flattened product experiment. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hP :
ModelClass c_f C_f L P n
f :
((i : FlatIndex n) → FlatObs n i) → ℝ
hf :
Integrable f (Measure.pi (flatLaw P n))
=ᵐ[dataLaw P n n] (condExp (comap (finsetCoordProj (flatBlock n 0)) inferInstance) (Measure.pi (flatLaw P n)) f) ∘ flattenSample n
Proof (Lean source)
lemma condExp_comp_flattenSample (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hP : ModelClass c_f C_f L P n) (f : ((i : FlatIndex n) → FlatObs n i) → ℝ) (hf : Integrable f (Measure.pi (flatLaw P n))) : condExp (trainingSigma n) (dataLaw P n n) (f ∘ flattenSample n) =ᵐ[dataLaw P n n] (condExp (comap (finsetCoordProj (flatBlock n 0)) inferInstance) (Measure.pi (flatLaw P n)) f) ∘ flattenSample n := by letI : IsProbabilityMeasure (sourceObsLaw P) := sourceObsLaw_isProbabilityMeasure c_f C_f L P n hP letI : IsProbabilityMeasure (targetXLaw P) := targetXLaw_isProbabilityMeasure c_f C_f L P n hP letI : ∀ i, IsProbabilityMeasure (flatLaw P n i) := fun i => flatLaw_isProbabilityMeasure c_f C_f L P n hP i letI : IsProbabilityMeasure (dataLaw P n n) := by rw [dataLaw_eq_source_target_pi c_f C_f L P n hP] infer_instance have h := condExp_comp_of_map_eq (flattenSample n) (sumPiEquivProdPi (FlatObs n)).symm.measurable (map_flattenSample_dataLaw c_f C_f L P n hP) (comap (finsetCoordProj (flatBlock n 0)) inferInstance) (comap_le (measurable_finsetCoordProj (flatBlock n 0))) hf rw [trainingSigma_eq_comap_flatTrainingProj] change condExp (comap (finsetCoordProj (flatBlock n 0) ∘ flattenSample n) inferInstance) (dataLaw P n n) (f ∘ flattenSample n) =ᵐ[dataLaw P n n] _ simpa only [MeasurableSpace.comap_comp] using h
CausalSmith.Stat.TransportCaceRoughnuisanceLength.condExp_comp_flattenSample · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/CellMoments.lean:391
theorem measurable_channelX

Given the supplied inputs, the stated result about measurable channel x holds.

Formal statement
n :
ℕ
i :
Fin 7
r :
Fin n
Measurable (fun ω : TwoSample n n => channelX ω i r)
Proof (Lean source)
@[fun_prop] lemma measurable_channelX {n : ℕ} (i : Fin 7) (r : Fin n) : Measurable (fun ω : TwoSample n n => channelX ω i r) := by unfold channelX sourceChannel split_ifs <;> fun_prop
CausalSmith.Stat.TransportCaceRoughnuisanceLength.measurable_channelX · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/CellMoments.lean:424
theorem measurable_channelMark

Given the supplied inputs, the stated result about measurable channel mark holds.

Formal statement
n :
ℕ
i :
Fin 7
r :
Fin n
Measurable (fun ω : TwoSample n n => channelMark ω i r)
Proof (Lean source)
@[fun_prop] lemma measurable_channelMark {n : ℕ} (i : Fin 7) (r : Fin n) : Measurable (fun ω : TwoSample n n => channelMark ω i r) := by fin_cases i <;> simp [channelMark] <;> fun_prop
CausalSmith.Stat.TransportCaceRoughnuisanceLength.measurable_channelMark · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/CellMoments.lean:431
theorem channelMark_mem_unit_interval

Every empirical channel mark is deterministically between zero and one. The outcome channels are clipped in the statistic itself. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
n :
ℕ
ω :
i :
Fin 7
r :
Fin n
channelMark ω i r ∈ Icc (0 : ℝ) 1
Proof (Lean source)
lemma channelMark_mem_unit_interval {n : ℕ} (ω : TwoSample n n) (i : Fin 7) (r : Fin n) : channelMark ω i r ∈ Icc (0 : ℝ) 1 := by have hclip (y : ℝ) : max 0 (min 1 y) ∈ Icc (0 : ℝ) 1 := by constructor · exact le_max_left _ _ · exact max_le (by norm_num) (min_le_left _ _) fin_cases i <;> simp [channelMark, boolReal, Set.mem_Icc] <;> split_ifs <;> simp_all [Set.mem_Icc, (hclip _).1, (hclip _).2]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.channelMark_mem_unit_interval · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/CellMoments.lean:438
CausalSmith.Stat.STAT_TransportCaceRoughnuisanceLength_Research.Helpers.CubicMse.CenteredCubicCells 7 declarations This proves the three-residual member of roadmap (16) for the actual marked histograms, with bounded training-measurable coefficients.

Conditional variance of the fully centered cubic cell component

This proves the three-residual member of roadmap (16) for the actual marked histograms, with bounded training-measurable coefficients. The block covariance factorization is derived from the product experiment, rather than supplied as a premise of the variance bound.

def flatCenteredCellScore

A held-out cell histogram centered at its exact experiment mean. For the displayed assumptions and inputs, the stated object is defined.

Definition (Lean source)
n K :
ℕ
i :
Fin 7
b :
Fin 4
l :
Fin K
z :
(a : {a // a ∈ flatBlock n b}) → FlatObs n a.val
flatCenteredCellScore P i b l z :
ℝ
- ∫ x, flatBlockHeight i b l (finsetCoordProj (flatBlock n b) x) ∂Measure.pi (flatLaw P n)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.flatCenteredCellScore · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/CenteredCubicCells.lean:24
def flatCenteredCubicCell

The fully centered three-block product in a single histogram cell. For the displayed assumptions and inputs, the stated object is defined.

Definition (Lean source)
n K :
ℕ
i :
Fin 3 → Fin 7
l :
Fin K
x :
(a : FlatIndex n) → FlatObs n a
flatCenteredCubicCell P i l x :
ℝ
∏ t : Fin 3, flatCenteredCellScore P (i t) t.succ l (finsetCoordProj (flatBlock n t.succ) x)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.flatCenteredCubicCell · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/CenteredCubicCells.lean:33
theorem flatCenteredCubicCell_memLp

Independence of the three evaluation blocks preserves square integrability of their centered histogram product. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n K :
ℕ
hn :
threshold ≤ n
hP :
ModelClass c_f C_f L P n
i :
Fin 3 → Fin 7
l :
Fin K
MemLp (flatCenteredCubicCell P i l) 2 (Measure.pi (flatLaw P n))
Proof (Lean source)
-- @node: flatCenteredCubicCell_memLp lemma flatCenteredCubicCell_memLp (c_f C_f L : ℝ) (P : TransportLaw) (n K : ℕ) (hn : threshold ≤ n) (hP : ModelClass c_f C_f L P n) (i : Fin 3 → Fin 7) (l : Fin K) : MemLp (flatCenteredCubicCell P i l) 2 (Measure.pi (flatLaw P n)) := by let : ∀ a, StandardBorelSpace (FlatObs n a) := fun a => by cases a <;> dsimp [FlatObs] <;> infer_instance let : ∀ a, IsProbabilityMeasure (flatLaw P n a) := fun a => flatLaw_isProbabilityMeasure c_f C_f L P n hP a apply memLp_threeBlockProduct (flatLaw P n) (fun t : Fin 3 => flatBlock n t.succ) (flatBlock_eval_pairwise n) (fun t => flatCenteredCellScore P (i t) t.succ l) · intro t exact (measurable_flatBlockHeight (i t) t.succ l).sub measurable_const · intro t exact (flatBlockHeight_memLp c_f C_f L P n K hn hP (i t) t.succ l).sub (memLp_const _)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.flatCenteredCubicCell_memLp · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/CenteredCubicCells.lean:42
theorem condExp_flatCenteredCubicCell_zero

The fully centered cubic histogram cell product has zero training-conditional mean, derived from the disjoint evaluation blocks. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n K :
ℕ
hn :
threshold ≤ n
hP :
ModelClass c_f C_f L P n
i :
Fin 3 → Fin 7
l :
Fin K
condExp (comap (finsetCoordProj (Ω := FlatObs n) (flatBlock n 0)) pi) (Measure.pi (flatLaw P n)) (flatCenteredCubicCell P i l)
=ᵐ[Measure.pi (flatLaw P n)] (0 : ((a : FlatIndex n) → FlatObs n a) → ℝ)
Proof (Lean source)
-- @node: condExp_flatCenteredCubicCell_zero lemma condExp_flatCenteredCubicCell_zero (c_f C_f L : ℝ) (P : TransportLaw) (n K : ℕ) (hn : threshold ≤ n) (hP : ModelClass c_f C_f L P n) (i : Fin 3 → Fin 7) (l : Fin K) : condExp (comap (finsetCoordProj (Ω := FlatObs n) (flatBlock n 0)) pi) (Measure.pi (flatLaw P n)) (flatCenteredCubicCell P i l) =ᵐ[Measure.pi (flatLaw P n)] (0 : ((a : FlatIndex n) → FlatObs n a) → ℝ) := by let : ∀ a, StandardBorelSpace (FlatObs n a) := fun a => by cases a <;> dsimp [FlatObs] <;> infer_instance let : ∀ a, IsProbabilityMeasure (flatLaw P n a) := fun a => flatLaw_isProbabilityMeasure c_f C_f L P n hP a apply condExp_threeBlockProduct_zero (flatLaw P n) (flatBlock n 0) (fun t : Fin 3 => flatBlock n t.succ) (flatBlock_training_disjoint n) (flatBlock_eval_pairwise n) (fun t => flatCenteredCellScore P (i t) t.succ l) · intro t exact (measurable_flatBlockHeight (i t) t.succ l).sub measurable_const · intro t exact (flatBlockHeight_memLp c_f C_f L P n K hn hP (i t) t.succ l).sub (memLp_const _) · intro t exact condExp_centeredBlockScore_zero (flatLaw P n) (flatBlock n 0) (flatBlock n t.succ) (flatBlock_training_disjoint n t) (flatBlockHeight (i t) t.succ l) (measurable_flatBlockHeight _ _ _) (flatBlockHeight_memLp c_f C_f L P n K hn hP (i t) t.succ l)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.condExp_flatCenteredCubicCell_zero · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/CenteredCubicCells.lean:62
theorem condExp_flatCenteredCubicCell_cross

The conditional cross moment of actual centered cubic histogram products is exactly the product of three blockwise histogram covariances. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n K :
ℕ
hn :
threshold ≤ n
hP :
ModelClass c_f C_f L P n
i j :
Fin 3 → Fin 7
l r :
Fin K
condExp (comap (finsetCoordProj (Ω := FlatObs n) (flatBlock n 0)) pi) (Measure.pi (flatLaw P n)) (fun x => flatCenteredCubicCell P i l x * flatCenteredCubicCell P j r x)
=ᵐ[Measure.pi (flatLaw P n)] (fun _ => ∏ t : Fin 3, covariance (fun x => flatBlockHeight (i t) t.succ l (finsetCoordProj (flatBlock n t.succ) x)) (fun x => flatBlockHeight (j t) t.succ r (finsetCoordProj (flatBlock n t.succ) x)) (Measure.pi (flatLaw P n)))
Proof (Lean source)
-- @node: condExp_flatCenteredCubicCell_cross lemma condExp_flatCenteredCubicCell_cross (c_f C_f L : ℝ) (P : TransportLaw) (n K : ℕ) (hn : threshold ≤ n) (hP : ModelClass c_f C_f L P n) (i j : Fin 3 → Fin 7) (l r : Fin K) : condExp (comap (finsetCoordProj (Ω := FlatObs n) (flatBlock n 0)) pi) (Measure.pi (flatLaw P n)) (fun x => flatCenteredCubicCell P i l x * flatCenteredCubicCell P j r x) =ᵐ[Measure.pi (flatLaw P n)] (fun _ => ∏ t : Fin 3, covariance (fun x => flatBlockHeight (i t) t.succ l (finsetCoordProj (flatBlock n t.succ) x)) (fun x => flatBlockHeight (j t) t.succ r (finsetCoordProj (flatBlock n t.succ) x)) (Measure.pi (flatLaw P n))) := by let : ∀ a, StandardBorelSpace (FlatObs n a) := fun a => by cases a <;> dsimp [FlatObs] <;> infer_instance let : ∀ a, IsProbabilityMeasure (flatLaw P n a) := fun a => flatLaw_isProbabilityMeasure c_f C_f L P n hP a have hmain := condExp_threeBlockCross (flatLaw P n) (flatBlock n 0) (fun t : Fin 3 => flatBlock n t.succ) (flatBlock_training_disjoint n) (flatBlock_eval_pairwise n) (fun t => flatCenteredCellScore P (i t) t.succ l) (fun t => flatCenteredCellScore P (j t) t.succ r) (fun t => (measurable_flatBlockHeight (i t) t.succ l).sub measurable_const) (fun t => (measurable_flatBlockHeight (j t) t.succ r).sub measurable_const) (fun t => (flatBlockHeight_memLp c_f C_f L P n K hn hP (i t) t.succ l).sub (memLp_const _)) (fun t => (flatBlockHeight_memLp c_f C_f L P n K hn hP (j t) t.succ r).sub (memLp_const _)) have hcross (t : Fin 3) := condExp_centeredBlockCross_eq_covariance (flatLaw P n) (flatBlock n 0) (flatBlock n t.succ) (flatBlock_training_disjoint n t) (flatBlockHeight (i t) t.succ l) (flatBlockHeight (j t) t.succ r) (measurable_flatBlockHeight _ _ _) (measurable_flatBlockHeight _ _ _) filter_upwards [hmain, hcross 0, hcross 1, hcross 2] with x hx h0 h1 h2 simpa only [flatCenteredCubicCell, flatCenteredCellScore, threeBlockProduct, Fin.prod_univ_three, h0, h1, h2] using hx
CausalSmith.Stat.TransportCaceRoughnuisanceLength.condExp_flatCenteredCubicCell_cross · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/CenteredCubicCells.lean:91
theorem conditional_variance_centeredCubic_cellAverage

The three-residual part of the exact cubic histogram sum satisfies the K² / m³ + 1 / m³ conditional variance bound in roadmap (16). The training coefficient can be random; only its measurability and envelope are needed. Covariance factorization is proved above for the actual histograms. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n K :
ℕ
hn :
threshold ≤ n
hP :
ModelClass c_f C_f L P n
hK :
0 < K
i :
Fin 3 → Fin 7
c :
Fin K → ((a : FlatIndex n) → FlatObs n a) → ℝ
C :
ℝ
hC :
0 ≤ C
hcmeas :
hc :
∀ᵐ x ∂Measure.pi (flatLaw P n), ∀ l, |c l x| ≤ C
∀ᵐ x ∂Measure.pi (flatLaw P n), condExp (comap (finsetCoordProj (Ω := FlatObs n) (flatBlock n 0)) pi) (Measure.pi (flatLaw P n)) (fun y => ((K : ℝ)⁻¹ * ∑ l : Fin K, c l y * flatCenteredCubicCell P i l y - condExp (comap (finsetCoordProj (Ω := FlatObs n) (flatBlock n 0)) pi) (Measure.pi (flatLaw P n)) (fun z => (K : ℝ)⁻¹ * ∑ l : Fin K, c l z * flatCenteredCubicCell P i l z) y) ^ 2) x
≤ C ^ 2 * (1 + C_f + C_f ^ 2) ^ 3 * ((K : ℝ) ^ 2 / ((n : ℝ) / 5) ^ 3 + 1 / ((n : ℝ) / 5) ^ 3)
Proof (Lean source)
-- @node: conditional_variance_centeredCubic_cellAverage lemma conditional_variance_centeredCubic_cellAverage (c_f C_f L : ℝ) (P : TransportLaw) (n K : ℕ) (hn : threshold ≤ n) (hP : ModelClass c_f C_f L P n) (hK : 0 < K) (i : Fin 3 → Fin 7) (c : Fin K → ((a : FlatIndex n) → FlatObs n a) → ℝ) (C : ℝ) (hC : 0 ≤ C) (hcmeas : ∀ l, StronglyMeasurable[ comap (finsetCoordProj (Ω := FlatObs n) (flatBlock n 0)) MeasurableSpace.pi] (c l)) (hc : ∀ᵐ x ∂Measure.pi (flatLaw P n), ∀ l, |c l x| ≤ C) : ∀ᵐ x ∂Measure.pi (flatLaw P n), condExp (comap (finsetCoordProj (Ω := FlatObs n) (flatBlock n 0)) MeasurableSpace.pi) (Measure.pi (flatLaw P n)) (fun y => ((K : ℝ)⁻¹ * ∑ l : Fin K, c l y * flatCenteredCubicCell P i l y - condExp (comap (finsetCoordProj (Ω := FlatObs n) (flatBlock n 0)) MeasurableSpace.pi) (Measure.pi (flatLaw P n)) (fun z => (K : ℝ)⁻¹ * ∑ l : Fin K, c l z * flatCenteredCubicCell P i l z) y) ^ 2) x ≤ C ^ 2 * (1 + C_f + C_f ^ 2) ^ 3 * ((K : ℝ) ^ 2 / ((n : ℝ) / 5) ^ 3 + 1 / ((n : ℝ) / 5) ^ 3) := by let : ∀ a, StandardBorelSpace (FlatObs n a) := fun a => by cases a <;> dsimp [FlatObs] <;> infer_instance let : ∀ a, IsProbabilityMeasure (flatLaw P n a) := fun a => flatLaw_isProbabilityMeasure c_f C_f L P n hP a let μ := Measure.pi (flatLaw P n) let m := comap (finsetCoordProj (Ω := FlatObs n) (flatBlock n 0)) MeasurableSpace.pi letI : MeasurableSpace ((a : FlatIndex n) → FlatObs n a) := MeasurableSpace.pi let X (l : Fin K) := flatCenteredCubicCell P (n := n) i l let κ (t : Fin 3) (l r : Fin K) := covariance (fun x => flatBlockHeight (i t) t.succ l (finsetCoordProj (flatBlock n t.succ) x)) (fun x => flatBlockHeight (i t) t.succ r (finsetCoordProj (flatBlock n t.succ) x)) μ have hm : m ≤ (inferInstance : MeasurableSpace ((a : FlatIndex n) → FlatObs n a)) := (measurable_finsetCoordProj (Ω := FlatObs n) (flatBlock n 0)).comap_le have hlp (l : Fin K) : MemLp (X l) 2 μ := flatCenteredCubicCell_memLp c_f C_f L P n K hn hP i l have hz (l : Fin K) : condExp m μ (X l) =ᵐ[μ] (0 : ((a : FlatIndex n) → FlatObs n a) → ℝ) := condExp_flatCenteredCubicCell_zero c_f C_f L P n K hn hP i l have hx (l r : Fin K) : condExp m μ (fun x => X l x * X r x) =ᵐ[μ] (fun _ => ∏ t : Fin 3, κ t l r) := condExp_flatCenteredCubicCell_cross c_f C_f L P n K hn hP i i l r have hnpos : (0 : ℝ) < n := by norm_num [threshold] at hn exact_mod_cast (show 0 < n by omega) have hB : 0 < (n : ℝ) / 5 := by positivity have hCf : 0 ≤ C_f := le_trans (by norm_num) hP.sourceBounds.2.1.le have hKr : (1 : ℝ) ≤ K := by exact_mod_cast hK have hV : 0 ≤ 1 + C_f + C_f ^ 2 := by positivity have hcard (t : Fin 3) : 0 < (blockIdx n t.succ).card := by rw [block_card] exact_mod_cast (lt_of_lt_of_le hB (block_size_lower n hn t.succ)) apply conditional_variance_weighted_centered_cells (q := 2) hm hK X c κ C (1 + C_f + C_f ^ 2) ((n : ℝ) / 5) hC hV hB hcmeas hc hlp hz hx · intro t l have hb := flatBlockHeight_same_cell_covariance_le c_f C_f L P n K hP hK t.succ (hcard t) l (i t) (i t) have hnum : (K : ℝ) * C_f + C_f ^ 2 ≤ (1 + C_f + C_f ^ 2) * K := by nlinarith [mul_nonneg (sq_nonneg C_f) (sub_nonneg.mpr hKr)] have hd := block_size_lower n hn t.succ rw [← block_card] at hd exact hb.trans (div_le_div₀ (by positivity) hnum hB hd) · intro t l r hlr have hb := flatBlockHeight_off_cell_covariance_le c_f C_f L P n K hP hK t.succ (hcard t) hlr (i t) (i t) have hd := block_size_lower n hn t.succ rw [← block_card] at hd exact hb.trans (div_le_div₀ hV (by linarith) hB hd)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.conditional_variance_centeredCubic_cellAverage · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/CenteredCubicCells.lean:130
theorem flatCenteredCubicCell_flattenSample

The flattened centered product is precisely the product of the paper's three held-out marked histograms at a cell midpoint, each minus its exact mean. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
n K :
ℕ
hn :
threshold ≤ n
hK :
0 < K
i :
Fin 3 → Fin 7
l :
Fin K
ω :
= ∏ t : Fin 3, (markedHistogram ω (i t) K t.succ (midpoint K l) - ∫ x, flatBlockHeight (i t) t.succ l (finsetCoordProj (flatBlock n t.succ) x) ∂Measure.pi (flatLaw P n))
Proof (Lean source)
-- @node: flatCenteredCubicCell_flattenSample lemma flatCenteredCubicCell_flattenSample (P : TransportLaw) {n K : ℕ} (hn : threshold ≤ n) (hK : 0 < K) (i : Fin 3 → Fin 7) (l : Fin K) (ω : TwoSample n n) : flatCenteredCubicCell P i l (flattenSample n ω) = ∏ t : Fin 3, (markedHistogram ω (i t) K t.succ (midpoint K l) - ∫ x, flatBlockHeight (i t) t.succ l (finsetCoordProj (flatBlock n t.succ) x) ∂Measure.pi (flatLaw P n)) := by unfold flatCenteredCubicCell flatCenteredCellScore apply Finset.prod_congr rfl intro t _ rw [flatBlockHeight_proj hn hK] simp only [flattenSample, MeasurableEquiv.apply_symm_apply]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.flatCenteredCubicCell_flattenSample · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/CenteredCubicCells.lean:203
CausalSmith.Stat.STAT_TransportCaceRoughnuisanceLength_Research.Helpers.CubicMse.CenteredPairCells 3 declarations Roadmap (16) for two actual centered histograms on distinct evaluation blocks.

Two-residual contributions to quadratic and cubic variance

Roadmap (16) for two actual centered histograms on distinct evaluation blocks. The same statement handles all three two-block subsets of the cubic statistic.

def flatCenteredPairCell

The product of two centered cell heights on distinct evaluation blocks. For the displayed assumptions and inputs, the stated object is defined.

Definition (Lean source)
n K :
ℕ
i :
Fin 2 → Fin 7
b :
Fin 2 → Fin 3
l :
Fin K
x :
(a : FlatIndex n) → FlatObs n a
flatCenteredPairCell P i b l x :
ℝ
∏ t : Fin 2, flatCenteredCellScore P (i t) (b t).succ l (finsetCoordProj (flatBlock n (b t).succ) x)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.flatCenteredPairCell · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/CenteredPairCells.lean:17
theorem conditional_variance_centeredPair_cellAverage

The two-residual member obeys the exact C² V² (K+1)/(n/5)² conditional variance estimate, derived from disjoint-block independence. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n K :
ℕ
hn :
threshold ≤ n
hP :
ModelClass c_f C_f L P n
hK :
0 < K
i :
Fin 2 → Fin 7
b :
Fin 2 → Fin 3
hb :
c :
Fin K → ((a : FlatIndex n) → FlatObs n a) → ℝ
C :
ℝ
hC :
0 ≤ C
hcmeas :
hc :
∀ᵐ x ∂Measure.pi (flatLaw P n), ∀ l, |c l x| ≤ C
∀ᵐ x ∂Measure.pi (flatLaw P n), condExp (comap (finsetCoordProj (Ω := FlatObs n) (flatBlock n 0)) pi) (Measure.pi (flatLaw P n)) (fun y => ((K : ℝ)⁻¹ * ∑ l : Fin K, c l y * flatCenteredPairCell P i b l y - condExp (comap (finsetCoordProj (Ω := FlatObs n) (flatBlock n 0)) pi) (Measure.pi (flatLaw P n)) (fun z => (K : ℝ)⁻¹ * ∑ l : Fin K, c l z * flatCenteredPairCell P i b l z) y) ^ 2) x
≤ C ^ 2 * (1 + C_f + C_f ^ 2) ^ 2 * ((K : ℝ) ^ 1 / ((n : ℝ) / 5) ^ 2 + 1 / ((n : ℝ) / 5) ^ 2)
Proof (Lean source)
-- @node: conditional_variance_centeredPair_cellAverage lemma conditional_variance_centeredPair_cellAverage (c_f C_f L : ℝ) (P : TransportLaw) (n K : ℕ) (hn : threshold ≤ n) (hP : ModelClass c_f C_f L P n) (hK : 0 < K) (i : Fin 2 → Fin 7) (b : Fin 2 → Fin 3) (hb : Injective b) (c : Fin K → ((a : FlatIndex n) → FlatObs n a) → ℝ) (C : ℝ) (hC : 0 ≤ C) (hcmeas : ∀ l, StronglyMeasurable[ comap (finsetCoordProj (Ω := FlatObs n) (flatBlock n 0)) MeasurableSpace.pi] (c l)) (hc : ∀ᵐ x ∂Measure.pi (flatLaw P n), ∀ l, |c l x| ≤ C) : ∀ᵐ x ∂Measure.pi (flatLaw P n), condExp (comap (finsetCoordProj (Ω := FlatObs n) (flatBlock n 0)) MeasurableSpace.pi) (Measure.pi (flatLaw P n)) (fun y => ((K : ℝ)⁻¹ * ∑ l : Fin K, c l y * flatCenteredPairCell P i b l y - condExp (comap (finsetCoordProj (Ω := FlatObs n) (flatBlock n 0)) MeasurableSpace.pi) (Measure.pi (flatLaw P n)) (fun z => (K : ℝ)⁻¹ * ∑ l : Fin K, c l z * flatCenteredPairCell P i b l z) y) ^ 2) x ≤ C ^ 2 * (1 + C_f + C_f ^ 2) ^ 2 * ((K : ℝ) ^ 1 / ((n : ℝ) / 5) ^ 2 + 1 / ((n : ℝ) / 5) ^ 2) := by let : ∀ a, StandardBorelSpace (FlatObs n a) := fun a => by cases a <;> dsimp [FlatObs] <;> infer_instance let : ∀ a, IsProbabilityMeasure (flatLaw P n a) := fun a => flatLaw_isProbabilityMeasure c_f C_f L P n hP a let μ := Measure.pi (flatLaw P n) let m := comap (finsetCoordProj (Ω := FlatObs n) (flatBlock n 0)) MeasurableSpace.pi let : MeasurableSpace ((a : FlatIndex n) → FlatObs n a) := MeasurableSpace.pi let X (l : Fin K) := flatCenteredPairCell P (n := n) i b l let κ (t : Fin 2) (l r : Fin K) := covariance (fun x => flatBlockHeight (i t) (b t).succ l (finsetCoordProj (flatBlock n (b t).succ) x)) (fun x => flatBlockHeight (i t) (b t).succ r (finsetCoordProj (flatBlock n (b t).succ) x)) μ have hm : m ≤ (inferInstance : MeasurableSpace ((a : FlatIndex n) → FlatObs n a)) := (measurable_finsetCoordProj (Ω := FlatObs n) (flatBlock n 0)).comap_le let F (t : Fin 2) (l : Fin K) := flatCenteredCellScore P (n := n) (i t) (b t).succ l have hf (t : Fin 2) (l : Fin K) : Measurable (F t l) := (measurable_flatBlockHeight (i t) (b t).succ l).sub measurable_const have hflp (t : Fin 2) (l : Fin K) : MemLp (fun x => F t l (finsetCoordProj (flatBlock n (b t).succ) x)) 2 μ := (flatBlockHeight_memLp c_f C_f L P n K hn hP (i t) (b t).succ l).sub (memLp_const _) have hX (l : Fin K) : X l = (fun x => F 0 l (finsetCoordProj (flatBlock n (b 0).succ) x) * F 1 l (finsetCoordProj (flatBlock n (b 1).succ) x)) := by funext x simp only [X, flatCenteredPairCell, Fin.prod_univ_two, F] have hdisj : Disjoint (flatBlock n (b 0).succ) (flatBlock n (b 1).succ) := flatBlock_eval_pairwise n (hb.ne (by decide : (0 : Fin 2) ≠ 1)) have hind := condIndepFun_eval_pair (flatLaw P n) (flatBlock n 0) (fun t : Fin 3 => flatBlock n t.succ) (flatBlock_training_disjoint n) (flatBlock_eval_pairwise n) (b 0) (b 1) (hb.ne (by decide : (0 : Fin 2) ≠ 1)) have hprod (l : Fin K) : Integrable (fun x => F 0 l (finsetCoordProj (flatBlock n (b 0).succ) x) * F 1 l (finsetCoordProj (flatBlock n (b 1).succ) x)) μ := integrable_twoBlockProduct (flatLaw P n) _ _ hdisj (F 0 l) (F 1 l) (hf 0 l) (hf 1 l) ((hflp 0 l).integrable (by norm_num)) ((hflp 1 l).integrable (by norm_num)) have hlp (l : Fin K) : MemLp (X l) 2 μ := by have hs := integrable_twoBlockProduct (flatLaw P n) _ _ hdisj (fun z => F 0 l z ^ 2) (fun z => F 1 l z ^ 2) ((hf 0 l).pow_const 2) ((hf 1 l).pow_const 2) ((hflp 0 l).integrable_sq) ((hflp 1 l).integrable_sq) apply (memLp_two_iff_integrable_sq ?_).mpr · simpa only [X, flatCenteredPairCell, Fin.prod_univ_two, mul_pow, F] using hs · rw [hX] exact (((hf 0 l).comp (measurable_finsetCoordProj _)).mul ((hf 1 l).comp (measurable_finsetCoordProj _))).aestronglyMeasurable have hz (l : Fin K) : condExp m μ (X l) =ᵐ[μ] (0 : ((a : FlatIndex n) → FlatObs n a) → ℝ) := by have hp := condExp_mul_of_condIndep hm (measurable_finsetCoordProj (flatBlock n (b 0).succ)) (measurable_finsetCoordProj (flatBlock n (b 1).succ)) hind (hf 0 l) (hf 1 l) ((hflp 0 l).integrable (by norm_num)) ((hflp 1 l).integrable (by norm_num)) (hprod l) have hz0 := condExp_centeredBlockScore_zero (flatLaw P n) (flatBlock n 0) (flatBlock n (b 0).succ) (flatBlock_training_disjoint n (b 0)) (flatBlockHeight (i 0) (b 0).succ l) (measurable_flatBlockHeight _ _ _) (flatBlockHeight_memLp c_f C_f L P n K hn hP (i 0) (b 0).succ l) rw [hX] filter_upwards [hp, hz0] with x hp hz0 change condExp m μ (fun y => F 0 l (finsetCoordProj (flatBlock n (b 0).succ) y) * F 1 l (finsetCoordProj (flatBlock n (b 1).succ) y)) x = 0 simpa only [X, flatCenteredPairCell, Fin.prod_univ_two, F, flatCenteredCellScore, Pi.mul_apply, hz0, Pi.zero_apply, zero_mul, μ, m] using hp have hx (l r : Fin K) : condExp m μ (fun x => X l x * X r x) =ᵐ[μ] (fun _ => ∏ t : Fin 2, κ t l r) := by let G (t : Fin 2) := fun z => F t l z * F t r z have hg (t : Fin 2) : Measurable (G t) := (hf t l).mul (hf t r) have hgi (t : Fin 2) : Integrable (fun x => G t (finsetCoordProj (flatBlock n (b t).succ) x)) μ := (hflp t l).integrable_mul (hflp t r) have hgp := integrable_twoBlockProduct (flatLaw P n) _ _ hdisj (G 0) (G 1) (hg 0) (hg 1) (hgi 0) (hgi 1) have hp := condExp_mul_of_condIndep hm (measurable_finsetCoordProj (flatBlock n (b 0).succ)) (measurable_finsetCoordProj (flatBlock n (b 1).succ)) hind (hg 0) (hg 1) (hgi 0) (hgi 1) hgp have hcross (t : Fin 2) := condExp_centeredBlockCross_eq_covariance (flatLaw P n) (flatBlock n 0) (flatBlock n (b t).succ) (flatBlock_training_disjoint n (b t)) (flatBlockHeight (i t) (b t).succ l) (flatBlockHeight (i t) (b t).succ r) (measurable_flatBlockHeight _ _ _) (measurable_flatBlockHeight _ _ _) have heq : (fun x => X l x * X r x) = (fun x => G 0 (finsetCoordProj (flatBlock n (b 0).succ) x) * G 1 (finsetCoordProj (flatBlock n (b 1).succ) x)) := by funext x simp only [X, flatCenteredPairCell, Fin.prod_univ_two, G, F] ring rw [heq] filter_upwards [hp, hcross 0, hcross 1] with x hp h0 h1 simpa only [G, F, flatCenteredCellScore, μ, m, Pi.mul_apply, h0, h1, Fin.prod_univ_two, κ] using hp have hnpos : (0 : ℝ) < n := by norm_num [threshold] at hn exact_mod_cast (show 0 < n by omega) have hB : 0 < (n : ℝ) / 5 := by positivity have hCf : 0 ≤ C_f := le_trans (by norm_num) hP.sourceBounds.2.1.le have hKr : (1 : ℝ) ≤ K := by exact_mod_cast hK have hV : 0 ≤ 1 + C_f + C_f ^ 2 := by positivity have hcard (t : Fin 2) : 0 < (blockIdx n (b t).succ).card := by rw [block_card] exact_mod_cast (lt_of_lt_of_le hB (block_size_lower n hn (b t).succ)) apply conditional_variance_weighted_centered_cells (q := 1) hm hK X c κ C (1 + C_f + C_f ^ 2) ((n : ℝ) / 5) hC hV hB hcmeas hc hlp hz hx · intro t l have hb := flatBlockHeight_same_cell_covariance_le c_f C_f L P n K hP hK (b t).succ (hcard t) l (i t) (i t) have hnum : (K : ℝ) * C_f + C_f ^ 2 ≤ (1 + C_f + C_f ^ 2) * K := by nlinarith [mul_nonneg (sq_nonneg C_f) (sub_nonneg.mpr hKr)] have hd := block_size_lower n hn (b t).succ rw [← block_card] at hd exact hb.trans (div_le_div₀ (by positivity) hnum hB hd) · intro t l r hlr have hb := flatBlockHeight_off_cell_covariance_le c_f C_f L P n K hP hK (b t).succ (hcard t) hlr (i t) (i t) have hd := block_size_lower n hn (b t).succ rw [← block_card] at hd exact hb.trans (div_le_div₀ hV (by linarith) hB hd)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.conditional_variance_centeredPair_cellAverage · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/CenteredPairCells.lean:25
theorem flatCenteredPairCell_flattenSample

The flattened pair is exactly the product of two of the paper's marked histograms at a cell midpoint, centered at their experiment means. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
n K :
ℕ
hn :
threshold ≤ n
hK :
0 < K
i :
Fin 2 → Fin 7
b :
Fin 2 → Fin 3
l :
Fin K
ω :
= ∏ t : Fin 2, (markedHistogram ω (i t) K (b t).succ (midpoint K l) - ∫ x, flatBlockHeight (i t) (b t).succ l (finsetCoordProj (flatBlock n (b t).succ) x) ∂Measure.pi (flatLaw P n))
Proof (Lean source)
-- @node: flatCenteredPairCell_flattenSample lemma flatCenteredPairCell_flattenSample (P : TransportLaw) {n K : ℕ} (hn : threshold ≤ n) (hK : 0 < K) (i : Fin 2 → Fin 7) (b : Fin 2 → Fin 3) (l : Fin K) (ω : TwoSample n n) : flatCenteredPairCell P i b l (flattenSample n ω) = ∏ t : Fin 2, (markedHistogram ω (i t) K (b t).succ (midpoint K l) - ∫ x, flatBlockHeight (i t) (b t).succ l (finsetCoordProj (flatBlock n (b t).succ) x) ∂Measure.pi (flatLaw P n)) := by unfold flatCenteredPairCell flatCenteredCellScore apply Finset.prod_congr rfl intro t _ rw [flatBlockHeight_proj hn hK] simp only [flattenSample, MeasurableEquiv.apply_symm_apply]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.flatCenteredPairCell_flattenSample · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/CenteredPairCells.lean:167
CausalSmith.Stat.STAT_TransportCaceRoughnuisanceLength_Research.Helpers.CubicMse.CenteredSingleCells 1 declarations Roadmap (16) for a single centered histogram factor, with the actual finite product experiment and a bounded training-measurable cell coefficient.

One-residual contributions to quadratic and cubic variance

Roadmap (16) for a single centered histogram factor, with the actual finite product experiment and a bounded training-measurable cell coefficient.

theorem conditional_variance_centeredSingle_cellAverage

The one-residual member of the subset expansion obeys the exact 2 C² V / (n/5) conditional variance estimate. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n K :
ℕ
hn :
threshold ≤ n
hP :
ModelClass c_f C_f L P n
hK :
0 < K
i :
Fin 7
b :
Fin 3
c :
Fin K → ((a : FlatIndex n) → FlatObs n a) → ℝ
C :
ℝ
hC :
0 ≤ C
hcmeas :
hc :
∀ᵐ x ∂Measure.pi (flatLaw P n), ∀ l, |c l x| ≤ C
∀ᵐ x ∂Measure.pi (flatLaw P n), condExp (comap (finsetCoordProj (Ω := FlatObs n) (flatBlock n 0)) pi) (Measure.pi (flatLaw P n)) (fun y => ((K : ℝ)⁻¹ * ∑ l : Fin K, c l y * flatCenteredCellScore P i b.succ l (finsetCoordProj (flatBlock n b.succ) y) - condExp (comap (finsetCoordProj (Ω := FlatObs n) (flatBlock n 0)) pi) (Measure.pi (flatLaw P n)) (fun z => (K : ℝ)⁻¹ * ∑ l : Fin K, c l z * flatCenteredCellScore P i b.succ l (finsetCoordProj (flatBlock n b.succ) z)) y) ^ 2) x
≤ C ^ 2 * (1 + C_f + C_f ^ 2) ^ 1 * ((K : ℝ) ^ 0 / ((n : ℝ) / 5) ^ 1 + 1 / ((n : ℝ) / 5) ^ 1)
Proof (Lean source)
-- @node: conditional_variance_centeredSingle_cellAverage lemma conditional_variance_centeredSingle_cellAverage (c_f C_f L : ℝ) (P : TransportLaw) (n K : ℕ) (hn : threshold ≤ n) (hP : ModelClass c_f C_f L P n) (hK : 0 < K) (i : Fin 7) (b : Fin 3) (c : Fin K → ((a : FlatIndex n) → FlatObs n a) → ℝ) (C : ℝ) (hC : 0 ≤ C) (hcmeas : ∀ l, StronglyMeasurable[ comap (finsetCoordProj (Ω := FlatObs n) (flatBlock n 0)) MeasurableSpace.pi] (c l)) (hc : ∀ᵐ x ∂Measure.pi (flatLaw P n), ∀ l, |c l x| ≤ C) : ∀ᵐ x ∂Measure.pi (flatLaw P n), condExp (comap (finsetCoordProj (Ω := FlatObs n) (flatBlock n 0)) MeasurableSpace.pi) (Measure.pi (flatLaw P n)) (fun y => ((K : ℝ)⁻¹ * ∑ l : Fin K, c l y * flatCenteredCellScore P i b.succ l (finsetCoordProj (flatBlock n b.succ) y) - condExp (comap (finsetCoordProj (Ω := FlatObs n) (flatBlock n 0)) MeasurableSpace.pi) (Measure.pi (flatLaw P n)) (fun z => (K : ℝ)⁻¹ * ∑ l : Fin K, c l z * flatCenteredCellScore P i b.succ l (finsetCoordProj (flatBlock n b.succ) z)) y) ^ 2) x ≤ C ^ 2 * (1 + C_f + C_f ^ 2) ^ 1 * ((K : ℝ) ^ 0 / ((n : ℝ) / 5) ^ 1 + 1 / ((n : ℝ) / 5) ^ 1) := by let : ∀ a, StandardBorelSpace (FlatObs n a) := fun a => by cases a <;> dsimp [FlatObs] <;> infer_instance let : ∀ a, IsProbabilityMeasure (flatLaw P n a) := fun a => flatLaw_isProbabilityMeasure c_f C_f L P n hP a -- Condition on the training view of the actual product experiment. let μ := Measure.pi (flatLaw P n) let m := comap (finsetCoordProj (Ω := FlatObs n) (flatBlock n 0)) MeasurableSpace.pi let : MeasurableSpace ((a : FlatIndex n) → FlatObs n a) := MeasurableSpace.pi let X (l : Fin K) (x : (a : FlatIndex n) → FlatObs n a) := flatCenteredCellScore P i b.succ l (finsetCoordProj (flatBlock n b.succ) x) let κ (_t : Fin 1) (l r : Fin K) := covariance (fun x => flatBlockHeight i b.succ l (finsetCoordProj (flatBlock n b.succ) x)) (fun x => flatBlockHeight i b.succ r (finsetCoordProj (flatBlock n b.succ) x)) μ have hm : m ≤ (inferInstance : MeasurableSpace ((a : FlatIndex n) → FlatObs n a)) := (measurable_finsetCoordProj (Ω := FlatObs n) (flatBlock n 0)).comap_le have hlp (l : Fin K) : MemLp (X l) 2 μ := (flatBlockHeight_memLp c_f C_f L P n K hn hP i b.succ l).sub (memLp_const _) have hz (l : Fin K) : condExp m μ (X l) =ᵐ[μ] (0 : ((a : FlatIndex n) → FlatObs n a) → ℝ) := condExp_centeredBlockScore_zero (flatLaw P n) (flatBlock n 0) (flatBlock n b.succ) (flatBlock_training_disjoint n b) (flatBlockHeight i b.succ l) (measurable_flatBlockHeight _ _ _) (flatBlockHeight_memLp c_f C_f L P n K hn hP i b.succ l) have hx (l r : Fin K) : condExp m μ (fun x => X l x * X r x) =ᵐ[μ] (fun _ => ∏ t : Fin 1, κ t l r) := by simpa only [Fin.prod_univ_one, X, κ, flatCenteredCellScore, μ, m] using condExp_centeredBlockCross_eq_covariance (flatLaw P n) (flatBlock n 0) (flatBlock n b.succ) (flatBlock_training_disjoint n b) (flatBlockHeight i b.succ l) (flatBlockHeight i b.succ r) (measurable_flatBlockHeight _ _ _) (measurable_flatBlockHeight _ _ _) have hnpos : (0 : ℝ) < n := by norm_num [threshold] at hn exact_mod_cast (show 0 < n by omega) have hB : 0 < (n : ℝ) / 5 := by positivity have hCf : 0 ≤ C_f := le_trans (by norm_num) hP.sourceBounds.2.1.le have hKr : (1 : ℝ) ≤ K := by exact_mod_cast hK have hV : 0 ≤ 1 + C_f + C_f ^ 2 := by positivity have hcard (t : Fin 1) : 0 < (blockIdx n b.succ).card := by rw [block_card] exact_mod_cast (lt_of_lt_of_le hB (block_size_lower n hn b.succ)) apply conditional_variance_weighted_centered_cells (q := 0) hm hK X c κ C (1 + C_f + C_f ^ 2) ((n : ℝ) / 5) hC hV hB hcmeas hc hlp hz hx · intro t l have hb := flatBlockHeight_same_cell_covariance_le c_f C_f L P n K hP hK b.succ (hcard t) l (i) (i) have hnum : (K : ℝ) * C_f + C_f ^ 2 ≤ (1 + C_f + C_f ^ 2) * K := by nlinarith [mul_nonneg (sq_nonneg C_f) (sub_nonneg.mpr hKr)] have hd := block_size_lower n hn b.succ rw [← block_card] at hd exact hb.trans (div_le_div₀ (by positivity) hnum hB hd) · intro t l r hlr have hb := flatBlockHeight_off_cell_covariance_le c_f C_f L P n K hP hK b.succ (hcard t) hlr (i) (i) have hd := block_size_lower n hn b.succ rw [← block_card] at hd exact hb.trans (div_le_div₀ hV (by linarith) hB hd)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.conditional_variance_centeredSingle_cellAverage · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/CenteredSingleCells.lean:17
CausalSmith.Stat.STAT_TransportCaceRoughnuisanceLength_Research.Helpers.CubicMse.CombinedBias 4 declarations This module proves roadmap (14) for the exact integrated Taylor remainder and the exact quadratic and cubic projection errors, with constant 3(BR+BQ+BC).

Combined spatial Taylor and projection bias

This module proves roadmap (14) for the exact integrated Taylor remainder and the exact quadratic and cubic projection errors, with constant 3(BR+BQ+BC). The identification with the full statistic's conditional bias remains separate.

def spatialTaylorRemainder

The integrated exact third-order Taylor remainder. For the displayed assumptions and inputs, the stated object is defined.

Definition (Lean source)
c_f C_f L :
ℝ
n :
ℕ
hP :
ModelClass c_f C_f L P n
ω :
A :
spatialTaylorRemainder c_f C_f L P n hP ω A :
ℝ
∫ x in covariateSpace, (let v := pilot c_f C_f ω x let h := markedDensityVector c_f C_f L P n hP x - v Phi A (markedDensityVector c_f C_f L P n hP x) - (Phi A v + iteratedFDeriv ℝ 1 (Phi A) v ![h] + iteratedFDeriv ℝ 2 (Phi A) v ![h, h] / 2 + iteratedFDeriv ℝ 3 (Phi A) v ![h, h, h] / 6))
CausalSmith.Stat.TransportCaceRoughnuisanceLength.spatialTaylorRemainder · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/CombinedBias.lean:18
def spatialCubicProjectionBias

The spatial cubic Taylor term minus its exact projection mean. For the displayed assumptions and inputs, the stated object is defined.

Definition (Lean source)
c_f C_f L :
ℝ
n :
ℕ
hP :
ModelClass c_f C_f L P n
ω :
A :
spatialCubicProjectionBias c_f C_f L P n hP ω A :
ℝ
(∑ i : Fin 7, ∑ j : Fin 7, ∑ k : Fin 7, ∫ x in covariateSpace, (dPhi3 A (pilot c_f C_f ω x) i j k / 6) * (markedDensityVector c_f C_f L P n hP x i - pilot c_f C_f ω x i) * (markedDensityVector c_f C_f L P n hP x j - pilot c_f C_f ω x j) * (markedDensityVector c_f C_f L P n hP x k - pilot c_f C_f ω x k))
- cubicProjectionMean c_f C_f L P n hP ω A
CausalSmith.Stat.TransportCaceRoughnuisanceLength.spatialCubicProjectionBias · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/CombinedBias.lean:30

Three real summands cost at most three times their squared norms. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
r q c :
ℝ
(r + q + c) ^ 2 ≤ 3 * (r ^ 2 + q ^ 2 + c ^ 2)
Proof (Lean source)
-- @node: sq_three_bias_terms_le lemma sq_three_bias_terms_le (r q c : ℝ) : (r + q + c) ^ 2 ≤ 3 * (r ^ 2 + q ^ 2 + c ^ 2) := by nlinarith [sq_nonneg (r - q), sq_nonneg (r - c), sq_nonneg (q - c)]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.sq_three_bias_terms_le · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/CombinedBias.lean:41
theorem combined_spatial_projection_bias_second_moment

Roadmap (14): the exact spatial Taylor remainder plus the quadratic and cubic projection errors has the paper's combined squared-bias bound. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hn :
threshold ≤ n
hP :
ModelClass c_f C_f L P n
A :
H :
3 * (1 + C_f) * L
A2 :
2 * (1 + C_f + C_f ^ 2) * (5 : ℝ) ^ (1 / 5 : ℝ)
+ (2 : ℝ) ^ (5 / 4 : ℝ) * H ^ 2 * (5 : ℝ) ^ (1 / 5 : ℝ)
BR :
(M / 24) ^ 2 * (7 : ℝ) ^ (8 : ℕ) * pilotEighthConstant C_f L
BQ :
(7 : ℝ) ^ 4 * M ^ 2 * H ^ 4 * (2 : ℝ) ^ (1 / 2 : ℝ) * (5 : ℝ) ^ (2 / 3 : ℝ)
C1 :
(M / 2) * (7 : ℝ) ^ 2 * H ^ 2
C2 :
(M / 6) * (7 : ℝ) ^ 3 * H ^ 3
BC :
2 * (C1 ^ 2 * (7 : ℝ) ^ 2 * A2 * (2 : ℝ) ^ (1 / 2 : ℝ) * (5 : ℝ) ^ (1 / 2 : ℝ) + C2 ^ 2 * (2 : ℝ) ^ (3 / 4 : ℝ) * (5 : ℝ) ^ (3 / 4 : ℝ))
(∫ ω, (spatialTaylorRemainder c_f C_f L P n hP ω A + quadraticCellProjectionBias c_f C_f L P n (quadraticResolution n) hP ω A + spatialCubicProjectionBias c_f C_f L P n hP ω A) ^ 2 ∂dataLaw P n n)
≤ 3 * (BR + BQ + BC) * (n : ℝ) ^ (-(2 / 3 : ℝ))
Proof (Lean source)
-- @node: combined_spatial_projection_bias_second_moment lemma combined_spatial_projection_bias_second_moment (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hn : threshold ≤ n) (hP : ModelClass c_f C_f L P n) (A : Bool) : let H := 3 * (1 + C_f) * L let M := fourthDerivativeEnvelope c_f C_f let A2 := 2 * (1 + C_f + C_f ^ 2) * (5 : ℝ) ^ (1 / 5 : ℝ) + (2 : ℝ) ^ (5 / 4 : ℝ) * H ^ 2 * (5 : ℝ) ^ (1 / 5 : ℝ) let BR := (M / 24) ^ 2 * (7 : ℝ) ^ (8 : ℕ) * pilotEighthConstant C_f L let BQ := (7 : ℝ) ^ 4 * M ^ 2 * H ^ 4 * (2 : ℝ) ^ (1 / 2 : ℝ) * (5 : ℝ) ^ (2 / 3 : ℝ) let C1 := (M / 2) * (7 : ℝ) ^ 2 * H ^ 2 let C2 := (M / 6) * (7 : ℝ) ^ 3 * H ^ 3 let BC := 2 * (C1 ^ 2 * (7 : ℝ) ^ 2 * A2 * (2 : ℝ) ^ (1 / 2 : ℝ) * (5 : ℝ) ^ (1 / 2 : ℝ) + C2 ^ 2 * (2 : ℝ) ^ (3 / 4 : ℝ) * (5 : ℝ) ^ (3 / 4 : ℝ)) (∫ ω, (spatialTaylorRemainder c_f C_f L P n hP ω A + quadraticCellProjectionBias c_f C_f L P n (quadraticResolution n) hP ω A + spatialCubicProjectionBias c_f C_f L P n hP ω A) ^ 2 ∂dataLaw P n n) ≤ 3 * (BR + BQ + BC) * (n : ℝ) ^ (-(2 / 3 : ℝ)) := by dsimp only let μ := dataLaw P n n let := sourceObsLaw_isProbabilityMeasure c_f C_f L P n hP let := targetXLaw_isProbabilityMeasure c_f C_f L P n hP let : IsProbabilityMeasure μ := by dsimp [μ] rw [dataLaw_eq_source_target_pi c_f C_f L P n hP]; infer_instance let H := 3 * (1 + C_f) * L let M := fourthDerivativeEnvelope c_f C_f let A2 := 2 * (1 + C_f + C_f ^ 2) * (5 : ℝ) ^ (1 / 5 : ℝ) + (2 : ℝ) ^ (5 / 4 : ℝ) * H ^ 2 * (5 : ℝ) ^ (1 / 5 : ℝ) let BR := (M / 24) ^ 2 * (7 : ℝ) ^ (8 : ℕ) * pilotEighthConstant C_f L let BQ := (7 : ℝ) ^ 4 * M ^ 2 * H ^ 4 * (2 : ℝ) ^ (1 / 2 : ℝ) * (5 : ℝ) ^ (2 / 3 : ℝ) let C1 := (M / 2) * (7 : ℝ) ^ 2 * H ^ 2 let C2 := (M / 6) * (7 : ℝ) ^ 3 * H ^ 3 let BC := 2 * (C1 ^ 2 * (7 : ℝ) ^ 2 * A2 * (2 : ℝ) ^ (1 / 2 : ℝ) * (5 : ℝ) ^ (1 / 2 : ℝ) + C2 ^ 2 * (2 : ℝ) ^ (3 / 4 : ℝ) * (5 : ℝ) ^ (3 / 4 : ℝ)) let rate := (n : ℝ) ^ (-(2 / 3 : ℝ)) let q := 1 / (cubicResolution n : ℝ) let a := C1 * (q ^ holderExponent) ^ 2 let b := C2 * (q ^ holderExponent) ^ 3 let e (i : Fin 7) (ω : TwoSample n n) := ∫ x in covariateSpace, |markedDensityVector c_f C_f L P n hP x i - pilot c_f C_f ω x i| let S (ω : TwoSample n n) := 2 * a ^ 2 * 7 * (∑ i : Fin 7, e i ω ^ 2) + 2 * b ^ 2 have he (i : Fin 7) : Integrable (fun ω => e i ω ^ 2) μ := integrable_pilot_error_L1_sq c_f C_f L P n hn hP i have hS : Integrable S μ := ((integrable_finsetSum univ (fun i _ => he i)).const_mul _).add (integrable_const _) have hC : 0 ≤ C_f := hP.sourceBounds.2.1.le.trans' (by norm_num) have hA2 : 0 ≤ A2 := by dsimp [A2]; positivity have hSm : (∫ ω, S ω ∂μ) ≤ BC * rate := by calc _ = 2 * a ^ 2 * 7 * (∑ i : Fin 7, ∫ ω, e i ω ^ 2 ∂μ) + 2 * b ^ 2 := by dsimp only [S] rw [integral_add ((integrable_finsetSum univ (fun i _ => he i)).const_mul _) (integrable_const _), integral_const_mul, integral_finsetSum univ (fun i _ => he i)] simp _ ≤ 2 * a ^ 2 * 7 * (∑ _i : Fin 7, A2 * (n : ℝ) ^ (-(1 / 5 : ℝ))) + 2 * b ^ 2 := by gcongr simpa only [e, A2, H, abs_sub_comm] using pilot_error_L1_second_moment c_f C_f L P n hn hP i _ = 2 * a ^ 2 * (7 : ℝ) ^ 2 * (A2 * (n : ℝ) ^ (-(1 / 5 : ℝ))) + 2 * b ^ 2 := by simp; ring _ ≤ _ := cubic_bias_resolution_terms_sample_rate n hn C1 C2 A2 hA2 have hSp (ω : TwoSample n n) : spatialCubicProjectionBias c_f C_f L P n hP ω A ^ 2 ≤ S ω := by have habs := cubic_spatial_projection_bias_abs_le_L1 c_f C_f L P n hn hP ω A have habs' : |spatialCubicProjectionBias c_f C_f L P n hP ω A| ≤ a * ∑ i : Fin 7, e i ω + b := by convert habs using 1 <;> first | rfl | dsimp [a, b, C1, C2, H, M, q]; ring have hp := pow_le_pow_left₀ (abs_nonneg _) habs' 2 rw [sq_abs] at hp have hs : (∑ i : Fin 7, e i ω) ^ 2 ≤ (7 : ℝ) * ∑ i : Fin 7, e i ω ^ 2 := by simpa using (sq_sum_le_card_mul_sum_sq (s := univ) (f := fun i : Fin 7 => e i ω)) have hw := mul_le_mul_of_nonneg_left hs (by positivity : 0 ≤ 2 * a ^ 2) dsimp only [S] nlinarith [sq_nonneg (a * ∑ i : Fin 7, e i ω - b)] have hRm := pilotRemainderMajorant_sample_rate c_f C_f L P n hn hP have hRi := (pilotRemainderMajorant_integrable_sq_and_moment c_f C_f L P n hn hP).1 calc _ ≤ ∫ ω, 3 * (pilotRemainderMajorant c_f C_f L P n hP ω ^ 2 + BQ * rate + S ω) ∂μ := by apply integral_mono_of_nonneg (Filter.Eventually.of_forall fun ω => sq_nonneg _) (((hRi.add (integrable_const _)).add hS).const_mul _) filter_upwards [] with ω apply (sq_three_bias_terms_le _ _ _).trans apply mul_le_mul_of_nonneg_left _ (by norm_num) apply add_le_add _ (hSp ω) apply add_le_add _ (quadraticCellProjectionBias_sq_sample_rate c_f C_f L P n hn hP ω A) simpa only [sq_abs, spatialTaylorRemainder] using pow_le_pow_left₀ (abs_nonneg _) (pilot_remainder_integral_abs_le_majorant c_f C_f L P n hn hP A ω) 2 _ = 3 * ((∫ ω, pilotRemainderMajorant c_f C_f L P n hP ω ^ 2 ∂μ) + BQ * rate + ∫ ω, S ω ∂μ) := by have hadd := integral_add (hRi.add (integrable_const (BQ * rate))) hS have hadd2 := integral_add hRi (integrable_const (BQ * rate)) simp only [Pi.add_apply] at hadd hadd2 rw [integral_const_mul] rw [hadd, hadd2] simp [μ] _ ≤ 3 * (BR * rate + BQ * rate + BC * rate) := by gcongr _ = _ := by ring
CausalSmith.Stat.TransportCaceRoughnuisanceLength.combined_spatial_projection_bias_second_moment · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/CombinedBias.lean:47
CausalSmith.Stat.STAT_TransportCaceRoughnuisanceLength_Research.Helpers.CubicMse.ConditionalBlockCovariance 4 declarations These adapters derive centering and cross-moment factorization from disjoint blocks of a finite product experiment.

Conditional moments of centered held-out block scores

These adapters derive centering and cross-moment factorization from disjoint blocks of a finite product experiment.

theorem condExp_blockScore_eq_integral Lemma condExp_blockScore_eq_integral in the paper ↗

Given the supplied inputs, the stated result about cond exp block score eq integral holds.

Formal statement
ι :
Type u_1
ι → Type u_2
shared
μ :
(i : ι) → Measure (Ω i)
shared
S T :
hST :
f :
((i : {i // i ∈ T}) → Ω i.val) → ℝ
hf :
condExp (comap (finsetCoordProj (Ω := Ω) S) pi) (Measure.pi μ) (fun x => f (finsetCoordProj T x))
=ᵐ[Measure.pi μ] (fun _ => ∫ x, f (finsetCoordProj T x) ∂Measure.pi μ)
Proof (Lean source)
lemma condExp_blockScore_eq_integral (S T : Finset ι) (hST : Disjoint S T) (f : ((i : {i // i ∈ T}) → Ω i.val) → ℝ) (hf : Measurable f) : condExp (comap (finsetCoordProj (Ω := Ω) S) pi) (Measure.pi μ) (fun x => f (finsetCoordProj T x)) =ᵐ[Measure.pi μ] (fun _ => ∫ x, f (finsetCoordProj T x) ∂Measure.pi μ) := by let F := fun x : (∀ i, Ω i) => f (finsetCoordProj T x) have hF : StronglyMeasurable[comap F inferInstance] F := (show Measurable[comap F inferInstance] F from comap_measurable F).stronglyMeasurable have hi := indepFun_pi_of_disjoint (Ω := Ω) μ hST have hft : (ofFinite ι) = (inferInstance : Fintype ι) := Subsingleton.elim _ _ have hpi : @Measure.pi ι Ω (ofFinite ι) _ μ = Measure.pi μ := congrArg (fun fi : Fintype ι => @Measure.pi ι Ω fi _ μ) hft have hindProj : Indep (comap (finsetCoordProj (Ω := Ω) T) pi) (comap (finsetCoordProj (Ω := Ω) S) pi) (Measure.pi μ) := by apply (IndepFun_iff_Indep _ _ _).mp change (fun x : ∀ i, Ω i => fun i : {i // i ∈ T} => x i.val) ⟂ᵢ[Measure.pi μ] (fun x : ∀ i, Ω i => fun i : {i // i ∈ S} => x i.val) simpa only [hpi] using hi.symm have hind : Indep (comap F inferInstance) (comap (finsetCoordProj (Ω := Ω) S) pi) (Measure.pi μ) := by apply indep_of_indep_of_le_left hindProj rw [show F = f ∘ finsetCoordProj T by rfl, ← MeasurableSpace.comap_comp] exact comap_mono hf.comap_le exact condExp_indep_eq (hf.comp (measurable_finsetCoordProj T)).comap_le (measurable_finsetCoordProj S).comap_le hF hind
CausalSmith.Stat.TransportCaceRoughnuisanceLength.condExp_blockScore_eq_integral · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/ConditionalBlockCovariance.lean:23
theorem condExp_centeredBlockScore_zero Lemma condExp_centeredBlockScore_zero in the paper ↗

Given the supplied inputs, the stated result about cond exp centered block score zero holds.

Formal statement
ι :
Type u_1
ι → Type u_2
shared
μ :
(i : ι) → Measure (Ω i)
shared
S T :
hST :
f :
((i : {i // i ∈ T}) → Ω i.val) → ℝ
hf :
hfLp :
MemLp (fun x : ∀ i, Ω i => f (finsetCoordProj T x)) 2 (Measure.pi μ)
condExp (comap (finsetCoordProj (Ω := Ω) S) pi) (Measure.pi μ) (fun x => f (finsetCoordProj T x) - ∫ y, f (finsetCoordProj T y) ∂Measure.pi μ)
=ᵐ[Measure.pi μ] (0 : (∀ i, Ω i) → ℝ)
Proof (Lean source)
lemma condExp_centeredBlockScore_zero (S T : Finset ι) (hST : Disjoint S T) (f : ((i : {i // i ∈ T}) → Ω i.val) → ℝ) (hf : Measurable f) (hfLp : MemLp (fun x : ∀ i, Ω i => f (finsetCoordProj T x)) 2 (Measure.pi μ)) : condExp (comap (finsetCoordProj (Ω := Ω) S) pi) (Measure.pi μ) (fun x => f (finsetCoordProj T x) - ∫ y, f (finsetCoordProj T y) ∂Measure.pi μ) =ᵐ[Measure.pi μ] (0 : (∀ i, Ω i) → ℝ) := by let m := ∫ y, f (finsetCoordProj T y) ∂Measure.pi μ have hmain := condExp_blockScore_eq_integral μ S T hST (fun z => f z - m) (hf.sub measurable_const) have hfint := hfLp.integrable (by norm_num) have hconst : Integrable (fun _ : (∀ i, Ω i) => m) (Measure.pi μ) := integrable_const m have hint : (∫ x, f (finsetCoordProj T x) - m ∂Measure.pi μ) = 0 := by rw [integral_sub hfint hconst, integral_const, probReal_univ, one_smul] simp [m] rw [hint] at hmain filter_upwards [hmain] with x hx change _ = (0 : ℝ) simpa only [m] using hx
CausalSmith.Stat.TransportCaceRoughnuisanceLength.condExp_centeredBlockScore_zero · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/ConditionalBlockCovariance.lean:57
theorem condExp_centeredBlockCross_eq_covariance Lemma condExp_centeredBlockCross_eq_covariance in the paper ↗

Given the supplied inputs, the stated result about cond exp centered block cross eq covariance holds.

Formal statement
ι :
Type u_1
ι → Type u_2
shared
μ :
(i : ι) → Measure (Ω i)
shared
S T :
hST :
f g :
((i : {i // i ∈ T}) → Ω i.val) → ℝ
hf :
hg :
condExp (comap (finsetCoordProj (Ω := Ω) S) pi) (Measure.pi μ) (fun x => (f (finsetCoordProj T x) - ∫ y, f (finsetCoordProj T y) ∂Measure.pi μ) * (g (finsetCoordProj T x) - ∫ y, g (finsetCoordProj T y) ∂Measure.pi μ))
=ᵐ[Measure.pi μ] (fun _ => cov[(fun x => f (finsetCoordProj T x)), (fun x => g (finsetCoordProj T x)); Measure.pi μ])
Proof (Lean source)
lemma condExp_centeredBlockCross_eq_covariance (S T : Finset ι) (hST : Disjoint S T) (f g : ((i : {i // i ∈ T}) → Ω i.val) → ℝ) (hf : Measurable f) (hg : Measurable g) : condExp (comap (finsetCoordProj (Ω := Ω) S) pi) (Measure.pi μ) (fun x => (f (finsetCoordProj T x) - ∫ y, f (finsetCoordProj T y) ∂Measure.pi μ) * (g (finsetCoordProj T x) - ∫ y, g (finsetCoordProj T y) ∂Measure.pi μ)) =ᵐ[Measure.pi μ] (fun _ => cov[(fun x => f (finsetCoordProj T x)), (fun x => g (finsetCoordProj T x)); Measure.pi μ]) := by have hmain := condExp_blockScore_eq_integral μ S T hST (fun z => (f z - ∫ y, f (finsetCoordProj T y) ∂Measure.pi μ) * (g z - ∫ y, g (finsetCoordProj T y) ∂Measure.pi μ)) ((hf.sub measurable_const).mul (hg.sub measurable_const)) simpa only [covariance] using hmain
CausalSmith.Stat.TransportCaceRoughnuisanceLength.condExp_centeredBlockCross_eq_covariance · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/ConditionalBlockCovariance.lean:82
theorem condCov_centeredThreeBlock_eq_prod_covariance Lemma condCov_centeredThreeBlock_eq_prod_covariance in the paper ↗

Given the supplied inputs, the stated result about cond cov centered three block eq prod covariance holds.

Formal statement
ι :
Type u_1
ι → Type u_2
shared
μ :
(i : ι) → Measure (Ω i)
shared
B0 :
B :
Fin 3 → Finset ι
htrain :
∀ t, Disjoint B0 (B t)
heval :
Pairwise (fun s t : Fin 3 => Disjoint (B s) (B t))
f g :
(t : Fin 3) → ((i : {i // i ∈ B t}) → Ω i.val) → ℝ
hf :
∀ t, Measurable (f t)
hg :
∀ t, Measurable (g t)
hfLp :
∀ t, MemLp (fun x : ∀ i, Ω i => f t (finsetCoordProj (B t) x)) 2 (Measure.pi μ)
hgLp :
∀ t, MemLp (fun x : ∀ i, Ω i => g t (finsetCoordProj (B t) x)) 2 (Measure.pi μ)
fc :
fun t z
=> f t z
- ∫ x, f t (finsetCoordProj (B t) x) ∂Measure.pi μ (: (t : Fin 3) → ((i : {i // i ∈ B t}) → Ω i.val) → ℝ)
gc :
fun t z
=> g t z
- ∫ x, g t (finsetCoordProj (B t) x) ∂Measure.pi μ (: (t : Fin 3) → ((i : {i // i ∈ B t}) → Ω i.val) → ℝ)
(fun x => condExp (comap (finsetCoordProj (Ω := Ω) B0) pi) (Measure.pi μ) (fun y => threeBlockProduct B fc y * threeBlockProduct B gc y) x - condExp (comap (finsetCoordProj (Ω := Ω) B0) pi) (Measure.pi μ) (threeBlockProduct B fc) x * condExp (comap (finsetCoordProj (Ω := Ω) B0) pi) (Measure.pi μ) (threeBlockProduct B gc) x)
=ᵐ[Measure.pi μ] (fun _ => ∏ t : Fin 3, cov[(fun x => f t (finsetCoordProj (B t) x)), (fun x => g t (finsetCoordProj (B t) x)); Measure.pi μ])
Proof (Lean source)
lemma condCov_centeredThreeBlock_eq_prod_covariance (B0 : Finset ι) (B : Fin 3 → Finset ι) (htrain : ∀ t, Disjoint B0 (B t)) (heval : Pairwise (fun s t : Fin 3 => Disjoint (B s) (B t))) (f g : (t : Fin 3) → ((i : {i // i ∈ B t}) → Ω i.val) → ℝ) (hf : ∀ t, Measurable (f t)) (hg : ∀ t, Measurable (g t)) (hfLp : ∀ t, MemLp (fun x : ∀ i, Ω i => f t (finsetCoordProj (B t) x)) 2 (Measure.pi μ)) (hgLp : ∀ t, MemLp (fun x : ∀ i, Ω i => g t (finsetCoordProj (B t) x)) 2 (Measure.pi μ)) : let fc : (t : Fin 3) → ((i : {i // i ∈ B t}) → Ω i.val) → ℝ := fun t z => f t z - ∫ x, f t (finsetCoordProj (B t) x) ∂Measure.pi μ let gc : (t : Fin 3) → ((i : {i // i ∈ B t}) → Ω i.val) → ℝ := fun t z => g t z - ∫ x, g t (finsetCoordProj (B t) x) ∂Measure.pi μ (fun x => condExp (comap (finsetCoordProj (Ω := Ω) B0) pi) (Measure.pi μ) (fun y => threeBlockProduct B fc y * threeBlockProduct B gc y) x - condExp (comap (finsetCoordProj (Ω := Ω) B0) pi) (Measure.pi μ) (threeBlockProduct B fc) x * condExp (comap (finsetCoordProj (Ω := Ω) B0) pi) (Measure.pi μ) (threeBlockProduct B gc) x) =ᵐ[Measure.pi μ] (fun _ => ∏ t : Fin 3, cov[(fun x => f t (finsetCoordProj (B t) x)), (fun x => g t (finsetCoordProj (B t) x)); Measure.pi μ]) := by dsimp only let fc : (t : Fin 3) → ((i : {i // i ∈ B t}) → Ω i.val) → ℝ := fun t z => f t z - ∫ x, f t (finsetCoordProj (B t) x) ∂Measure.pi μ let gc : (t : Fin 3) → ((i : {i // i ∈ B t}) → Ω i.val) → ℝ := fun t z => g t z - ∫ x, g t (finsetCoordProj (B t) x) ∂Measure.pi μ have hfcmeas (t : Fin 3) : Measurable (fc t) := (hf t).sub measurable_const have hgcmeas (t : Fin 3) : Measurable (gc t) := (hg t).sub measurable_const have hfcLp (t : Fin 3) : MemLp (fun x : ∀ i, Ω i => fc t (finsetCoordProj (B t) x)) 2 (Measure.pi μ) := (hfLp t).sub (memLp_const _) have hgcLp (t : Fin 3) : MemLp (fun x : ∀ i, Ω i => gc t (finsetCoordProj (B t) x)) 2 (Measure.pi μ) := (hgLp t).sub (memLp_const _) have hfc0 (t : Fin 3) := condExp_centeredBlockScore_zero μ B0 (B t) (htrain t) (f t) (hf t) (hfLp t) have hgc0 (t : Fin 3) := condExp_centeredBlockScore_zero μ B0 (B t) (htrain t) (g t) (hg t) (hgLp t) have hmain := condCov_threeBlockProduct μ B0 B htrain heval fc gc hfcmeas hgcmeas hfcLp hgcLp hfc0 hgc0 have hcross (t : Fin 3) := condExp_centeredBlockCross_eq_covariance μ B0 (B t) (htrain t) (f t) (g t) (hf t) (hg t) filter_upwards [hmain, hcross 0, hcross 1, hcross 2] with x hx h0 h1 h2 simpa only [fc, gc, Fin.prod_univ_three, h0, h1, h2] using hx
CausalSmith.Stat.TransportCaceRoughnuisanceLength.condCov_centeredThreeBlock_eq_prod_covariance · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/ConditionalBlockCovariance.lean:105
CausalSmith.Stat.STAT_TransportCaceRoughnuisanceLength_Research.Helpers.CubicMse.ConditionalCellSum 5 declarations Roadmap (16) follows by expanding the square under conditional expectation, using the factored block covariances, and counting diagonal and off-diagonal cell pairs.

Conditional second moments of centered cell sums

Roadmap (16) follows by expanding the square under conditional expectation, using the factored block covariances, and counting diagonal and off-diagonal cell pairs. Training coefficients may depend on the conditioned observation.

theorem condExp_sq_cellSum_eq_sum_cross Lemma condExp_sq_cellSum_eq_sum_cross in the paper ↗

The conditional second moment of a finite sum is its ordered cross-moment sum. No independence between the cells is needed. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
K :
ℕ
Y :
Fin K → Ω → ℝ
hcross :
∀ l r, Integrable (fun ω => Y l ω * Y r ω) μ
condExp m μ (fun ω => (∑ l : Fin K, Y l ω) ^ 2)
=ᵐ[μ] (fun ω => ∑ l : Fin K, ∑ r : Fin K, condExp m μ (fun ξ => Y l ξ * Y r ξ) ω)
Proof (Lean source)
-- @node: condExp_sq_cellSum_eq_sum_cross lemma condExp_sq_cellSum_eq_sum_cross {Ω : Type*} [mΩ : MeasurableSpace Ω] {μ : Measure Ω} {m : MeasurableSpace Ω} {K : ℕ} (Y : Fin K → Ω → ℝ) (hcross : ∀ l r, Integrable (fun ω => Y l ω * Y r ω) μ) : condExp m μ (fun ω => (∑ l : Fin K, Y l ω) ^ 2) =ᵐ[μ] (fun ω => ∑ l : Fin K, ∑ r : Fin K, condExp m μ (fun ξ => Y l ξ * Y r ξ) ω) := by have hsquare : (fun ω => (∑ l : Fin K, Y l ω) ^ 2) = (fun ω => ∑ l : Fin K, ∑ r : Fin K, Y l ω * Y r ω) := by funext ω simp only [pow_two, Finset.sum_mul, Finset.mul_sum] exact Finset.sum_comm rw [hsquare] have houter := condExp_finsetSum (s := univ) (f := fun l ω => ∑ r : Fin K, Y l ω * Y r ω) (fun l _ => integrable_finsetSum _ (fun r _ => hcross l r)) m have hinner (l : Fin K) := condExp_finsetSum (s := univ) (f := fun r ω => Y l ω * Y r ω) (fun r _ => hcross l r) m filter_upwards [houter, ae_all_iff.mpr hinner] with ω ho hi simp only [Finset.sum_fn, Finset.sum_apply] at ho hi rw [ho] exact Finset.sum_congr rfl fun l _ => hi l
CausalSmith.Stat.TransportCaceRoughnuisanceLength.condExp_sq_cellSum_eq_sum_cross · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/ConditionalCellSum.lean:19
theorem condExp_sq_cellSum_factored_le Lemma condExp_sq_cellSum_factored_le in the paper ↗

Conditional version of the diagonal/off-diagonal cell-pair bound. The cross-moment identity is supplied by independent evaluation blocks and the training-coefficient pull-out lemma. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
K q :
ℕ
Y :
Fin K → Ω → ℝ
c :
Fin K → Ω → ℝ
κ :
Fin q → Fin K → Fin K → ℝ
C D O :
ℝ
hC :
0 ≤ C
hD :
0 ≤ D
hO :
0 ≤ O
hcross :
∀ l r, Integrable (fun ω => Y l ω * Y r ω) μ
hfactor :
∀ l r,
condExp m μ (fun ξ => Y l ξ * Y r ξ) =ᵐ[μ] (fun ω => c l ω * c r ω * ∏ t : Fin q, κ t l r)
hc :
∀ᵐ ω ∂μ, ∀ l, |c l ω| ≤ C
hκdiag :
∀ t l, |κ t l l| ≤ D
hκoff :
∀ t l r
if
l ≠ r
then
|κ t l r| ≤ O
∀ᵐ ω ∂μ, condExp m μ (fun ξ => (∑ l : Fin K, Y l ξ) ^ 2) ω
≤ (K : ℝ) * C ^ 2 * D ^ q + (K : ℝ) ^ 2 * C ^ 2 * O ^ q
Proof (Lean source)
-- @node: condExp_sq_cellSum_factored_le lemma condExp_sq_cellSum_factored_le {Ω : Type*} [mΩ : MeasurableSpace Ω] {μ : Measure Ω} {m : MeasurableSpace Ω} {K q : ℕ} (Y : Fin K → Ω → ℝ) (c : Fin K → Ω → ℝ) (κ : Fin q → Fin K → Fin K → ℝ) (C D O : ℝ) (hC : 0 ≤ C) (hD : 0 ≤ D) (hO : 0 ≤ O) (hcross : ∀ l r, Integrable (fun ω => Y l ω * Y r ω) μ) (hfactor : ∀ l r, condExp m μ (fun ξ => Y l ξ * Y r ξ) =ᵐ[μ] (fun ω => c l ω * c r ω * ∏ t : Fin q, κ t l r)) (hc : ∀ᵐ ω ∂μ, ∀ l, |c l ω| ≤ C) (hκdiag : ∀ t l, |κ t l l| ≤ D) (hκoff : ∀ t l r, l ≠ r → |κ t l r| ≤ O) : ∀ᵐ ω ∂μ, condExp m μ (fun ξ => (∑ l : Fin K, Y l ξ) ^ 2) ω ≤ (K : ℝ) * C ^ 2 * D ^ q + (K : ℝ) ^ 2 * C ^ 2 * O ^ q := by have hall : ∀ᵐ ω ∂μ, ∀ l r, condExp m μ (fun ξ => Y l ξ * Y r ξ) ω = c l ω * c r ω * ∏ t : Fin q, κ t l r := ae_all_iff.mpr fun l => ae_all_iff.mpr (hfactor l) filter_upwards [@condExp_sq_cellSum_eq_sum_cross Ω mΩ μ m K Y hcross, hall, hc] with ω hsum hf hcω rw [hsum] calc _ = ∑ l : Fin K, ∑ r : Fin K, c l ω * c r ω * ∏ t : Fin q, κ t l r := by apply Finset.sum_congr rfl intro l _ exact Finset.sum_congr rfl fun r _ => hf l r _ ≤ |∑ l : Fin K, ∑ r : Fin K, c l ω * c r ω * ∏ t : Fin q, κ t l r| := le_abs_self _ _ ≤ _ := abs_cellPair_product_sum_le (fun l => c l ω) κ C D O hC hD hO hcω hκdiag hκoff
CausalSmith.Stat.TransportCaceRoughnuisanceLength.condExp_sq_cellSum_factored_le · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/ConditionalCellSum.lean:46
theorem condExp_cellAverage_zero Lemma condExp_cellAverage_zero in the paper ↗

A normalized cell sum of conditionally centered summands is conditionally centered, even when its coefficients depend on training. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
K :
ℕ
Y :
Fin K → Ω → ℝ
hY :
∀ l, Integrable (Y l) μ
hzero :
∀ l, condExp m μ (Y l) =ᵐ[μ] (0 : Ω → ℝ)
condExp m μ (fun ω => (K : ℝ)⁻¹ * ∑ l : Fin K, Y l ω) =ᵐ[μ] (0 : Ω → ℝ)
Proof (Lean source)
-- @node: condExp_cellAverage_zero lemma condExp_cellAverage_zero {Ω : Type*} [mΩ : MeasurableSpace Ω] {μ : Measure Ω} {m : MeasurableSpace Ω} {K : ℕ} (Y : Fin K → Ω → ℝ) (hY : ∀ l, Integrable (Y l) μ) (hzero : ∀ l, condExp m μ (Y l) =ᵐ[μ] (0 : Ω → ℝ)) : condExp m μ (fun ω => (K : ℝ)⁻¹ * ∑ l : Fin K, Y l ω) =ᵐ[μ] (0 : Ω → ℝ) := by have hsum := condExp_finsetSum (μ := μ) (s := univ) (f := Y) (fun l _ => hY l) m have hscale := condExp_smul (μ := μ) (K : ℝ)⁻¹ (fun ω => ∑ l : Fin K, Y l ω) m filter_upwards [hsum, hscale, ae_all_iff.mpr hzero] with ω hs ht hz simp only [Finset.sum_fn, Finset.sum_apply] at hs simp only [Pi.smul_def, smul_eq_mul] at ht rw [ht, hs] simp only [hz, Pi.zero_apply, Finset.sum_const_zero, mul_zero]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.condExp_cellAverage_zero · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/ConditionalCellSum.lean:82
theorem condExp_sq_cellAverage_factored_le Lemma condExp_sq_cellAverage_factored_le in the paper ↗

The exact normalized diagonal/off-diagonal bound in roadmap (16), for q+1 centered residual blocks. Taking q=0,1,2 gives all nonempty subsets in the quadratic and cubic expansions. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
K q :
ℕ
hK :
0 < K
Y :
Fin K → Ω → ℝ
c :
Fin K → Ω → ℝ
κ :
Fin (q + 1) → Fin K → Fin K → ℝ
C V B :
ℝ
hC :
0 ≤ C
hV :
0 ≤ V
hB :
0 < B
hcross :
∀ l r, Integrable (fun ω => Y l ω * Y r ω) μ
hfactor :
∀ l r,
condExp m μ (fun ξ => Y l ξ * Y r ξ)
=ᵐ[μ] (fun ω => c l ω * c r ω * ∏ t : Fin (q + 1), κ t l r)
hc :
∀ᵐ ω ∂μ, ∀ l, |c l ω| ≤ C
hκdiag :
∀ t l, |κ t l l| ≤ V * K / B
hκoff :
∀ t l r
if
l ≠ r
then
|κ t l r| ≤ V / B
∀ᵐ ω ∂μ, condExp m μ (fun ξ => ((K : ℝ)⁻¹ * ∑ l : Fin K, Y l ξ) ^ 2) ω
≤ C ^ 2 * V ^ (q + 1) * ((K : ℝ) ^ q / B ^ (q + 1) + 1 / B ^ (q + 1))
Proof (Lean source)
-- @node: condExp_sq_cellAverage_factored_le lemma condExp_sq_cellAverage_factored_le {Ω : Type*} [mΩ : MeasurableSpace Ω] {μ : Measure Ω} {m : MeasurableSpace Ω} {K q : ℕ} (hK : 0 < K) (Y : Fin K → Ω → ℝ) (c : Fin K → Ω → ℝ) (κ : Fin (q + 1) → Fin K → Fin K → ℝ) (C V B : ℝ) (hC : 0 ≤ C) (hV : 0 ≤ V) (hB : 0 < B) (hcross : ∀ l r, Integrable (fun ω => Y l ω * Y r ω) μ) (hfactor : ∀ l r, condExp m μ (fun ξ => Y l ξ * Y r ξ) =ᵐ[μ] (fun ω => c l ω * c r ω * ∏ t : Fin (q + 1), κ t l r)) (hc : ∀ᵐ ω ∂μ, ∀ l, |c l ω| ≤ C) (hκdiag : ∀ t l, |κ t l l| ≤ V * K / B) (hκoff : ∀ t l r, l ≠ r → |κ t l r| ≤ V / B) : ∀ᵐ ω ∂μ, condExp m μ (fun ξ => ((K : ℝ)⁻¹ * ∑ l : Fin K, Y l ξ) ^ 2) ω ≤ C ^ 2 * V ^ (q + 1) * ((K : ℝ) ^ q / B ^ (q + 1) + 1 / B ^ (q + 1)) := by have hKr : (0 : ℝ) < K := by exact_mod_cast hK have hbound := @condExp_sq_cellSum_factored_le Ω mΩ μ m K (q + 1) Y c κ C (V * K / B) (V / B) hC (by positivity) (by positivity) hcross hfactor hc hκdiag hκoff have hscale := condExp_smul (μ := μ) ((K : ℝ)⁻¹ ^ 2) (fun ξ => (∑ l : Fin K, Y l ξ) ^ 2) m have heq : (fun ξ => ((K : ℝ)⁻¹ * ∑ l : Fin K, Y l ξ) ^ 2) = ((K : ℝ)⁻¹ ^ 2) • (fun ξ => (∑ l : Fin K, Y l ξ) ^ 2) := by funext ξ simp only [Pi.smul_apply, smul_eq_mul, mul_pow] rw [heq] filter_upwards [hbound, hscale] with ω hb hs simp only [Pi.smul_apply, smul_eq_mul] at hs rw [hs] calc _ ≤ (K : ℝ)⁻¹ ^ 2 * ((K : ℝ) * C ^ 2 * (V * K / B) ^ (q + 1) + (K : ℝ) ^ 2 * C ^ 2 * (V / B) ^ (q + 1)) := mul_le_mul_of_nonneg_left hb (sq_nonneg _) _ = _ := by simp only [div_pow, mul_pow, pow_succ] field_simp
CausalSmith.Stat.TransportCaceRoughnuisanceLength.condExp_sq_cellAverage_factored_le · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/ConditionalCellSum.lean:102
theorem conditional_variance_cellAverage_factored_le Lemma conditional_variance_cellAverage_factored_le in the paper ↗

Conditional variance of the normalized cell sum equals its centered second moment and satisfies the factored bound. This joins conditional centering with the cell-pair computation rather than assuming a variance estimate. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
K q :
ℕ
hK :
0 < K
Y :
Fin K → Ω → ℝ
c :
Fin K → Ω → ℝ
κ :
Fin (q + 1) → Fin K → Fin K → ℝ
C V B :
ℝ
hC :
0 ≤ C
hV :
0 ≤ V
hB :
0 < B
hY :
∀ l, Integrable (Y l) μ
hzero :
∀ l, condExp m μ (Y l) =ᵐ[μ] (0 : Ω → ℝ)
hcross :
∀ l r, Integrable (fun ω => Y l ω * Y r ω) μ
hfactor :
∀ l r,
condExp m μ (fun ξ => Y l ξ * Y r ξ)
=ᵐ[μ] (fun ω => c l ω * c r ω * ∏ t : Fin (q + 1), κ t l r)
hc :
∀ᵐ ω ∂μ, ∀ l, |c l ω| ≤ C
hκdiag :
∀ t l, |κ t l l| ≤ V * K / B
hκoff :
∀ t l r
if
l ≠ r
then
|κ t l r| ≤ V / B
∀ᵐ ω ∂μ, condExp m μ (fun ξ => ((K : ℝ)⁻¹ * ∑ l : Fin K, Y l ξ - condExp m μ (fun ζ => (K : ℝ)⁻¹ * ∑ l : Fin K, Y l ζ) ξ) ^ 2) ω
≤ C ^ 2 * V ^ (q + 1) * ((K : ℝ) ^ q / B ^ (q + 1) + 1 / B ^ (q + 1))
Proof (Lean source)
-- @node: conditional_variance_cellAverage_factored_le lemma conditional_variance_cellAverage_factored_le {Ω : Type*} [mΩ : MeasurableSpace Ω] {μ : Measure Ω} {m : MeasurableSpace Ω} {K q : ℕ} (hK : 0 < K) (Y : Fin K → Ω → ℝ) (c : Fin K → Ω → ℝ) (κ : Fin (q + 1) → Fin K → Fin K → ℝ) (C V B : ℝ) (hC : 0 ≤ C) (hV : 0 ≤ V) (hB : 0 < B) (hY : ∀ l, Integrable (Y l) μ) (hzero : ∀ l, condExp m μ (Y l) =ᵐ[μ] (0 : Ω → ℝ)) (hcross : ∀ l r, Integrable (fun ω => Y l ω * Y r ω) μ) (hfactor : ∀ l r, condExp m μ (fun ξ => Y l ξ * Y r ξ) =ᵐ[μ] (fun ω => c l ω * c r ω * ∏ t : Fin (q + 1), κ t l r)) (hc : ∀ᵐ ω ∂μ, ∀ l, |c l ω| ≤ C) (hκdiag : ∀ t l, |κ t l l| ≤ V * K / B) (hκoff : ∀ t l r, l ≠ r → |κ t l r| ≤ V / B) : ∀ᵐ ω ∂μ, condExp m μ (fun ξ => ((K : ℝ)⁻¹ * ∑ l : Fin K, Y l ξ - condExp m μ (fun ζ => (K : ℝ)⁻¹ * ∑ l : Fin K, Y l ζ) ξ) ^ 2) ω ≤ C ^ 2 * V ^ (q + 1) * ((K : ℝ) ^ q / B ^ (q + 1) + 1 / B ^ (q + 1)) := by have hz := @condExp_cellAverage_zero Ω mΩ μ m K Y hY hzero have heq := condExp_congr_ae (m := m) (show (fun ξ => ((K : ℝ)⁻¹ * ∑ l : Fin K, Y l ξ - condExp m μ (fun ζ => (K : ℝ)⁻¹ * ∑ l : Fin K, Y l ζ) ξ) ^ 2) =ᵐ[μ] (fun ξ => ((K : ℝ)⁻¹ * ∑ l : Fin K, Y l ξ) ^ 2) by filter_upwards [hz] with ξ hξ rw [hξ] simp only [Pi.zero_apply, sub_zero]) have hb := @condExp_sq_cellAverage_factored_le Ω mΩ μ m K q hK Y c κ C V B hC hV hB hcross hfactor hc hκdiag hκoff exact heq.trans_le hb
CausalSmith.Stat.TransportCaceRoughnuisanceLength.conditional_variance_cellAverage_factored_le · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/ConditionalCellSum.lean:145
CausalSmith.Stat.STAT_TransportCaceRoughnuisanceLength_Research.Helpers.CubicMse.CubicBiasMoments 4 declarations The spatial L1 pilot moments and the exact single-residual cancellation bound give the squared cubic bias, retaining both resolution powers in roadmap (13) before dyadic sample-rate conversion.

Second moment of the exact cubic projection bias

The spatial L1 pilot moments and the exact single-residual cancellation bound give the squared cubic bias, retaining both resolution powers in roadmap (13) before dyadic sample-rate conversion.

theorem affine_seven_error_second_moment Lemma affine_seven_error_second_moment in the paper ↗

Squaring an affine finite-error bound costs twice the squared offset and twice the coordinate count times the sum of coordinate second moments. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
Ω :
r :
Ω → ℝ
e :
Fin 7 → Ω → ℝ
a b R :
ℝ
he :
∀ i, Integrable (fun ω => e i ω ^ 2) μ
hm :
∀ i, (∫ ω, e i ω ^ 2 ∂μ) ≤ R
hr :
∀ ω, |r ω| ≤ a * ∑ i, e i ω + b
(∫ ω, r ω ^ 2 ∂μ) ≤ 2 * a ^ 2 * (7 : ℝ) ^ 2 * R + 2 * b ^ 2
Proof (Lean source)
-- @node: affine_seven_error_second_moment lemma affine_seven_error_second_moment {Ω : Type*} [MeasurableSpace Ω] (μ : Measure Ω) [IsProbabilityMeasure μ] (r : Ω → ℝ) (e : Fin 7 → Ω → ℝ) (a b R : ℝ) (he : ∀ i, Integrable (fun ω => e i ω ^ 2) μ) (hm : ∀ i, (∫ ω, e i ω ^ 2 ∂μ) ≤ R) (hr : ∀ ω, |r ω| ≤ a * ∑ i, e i ω + b) : (∫ ω, r ω ^ 2 ∂μ) ≤ 2 * a ^ 2 * (7 : ℝ) ^ 2 * R + 2 * b ^ 2 := by have hpoint (ω : Ω) : r ω ^ 2 ≤ 2 * a ^ 2 * 7 * (∑ i, e i ω ^ 2) + 2 * b ^ 2 := by have hs : (∑ i, e i ω) ^ 2 ≤ (7 : ℝ) * ∑ i, e i ω ^ 2 := by simpa using (sq_sum_le_card_mul_sum_sq (s := univ) (f := fun i : Fin 7 => e i ω)) have hp := pow_le_pow_left₀ (abs_nonneg (r ω)) (hr ω) 2 rw [sq_abs] at hp have hw := mul_le_mul_of_nonneg_left hs (by positivity : 0 ≤ 2 * a ^ 2) nlinarith [sq_nonneg (a * ∑ i, e i ω - b)] calc _ ≤ ∫ ω, 2 * a ^ 2 * 7 * (∑ i, e i ω ^ 2) + 2 * b ^ 2 ∂μ := by apply integral_mono_of_nonneg (Filter.Eventually.of_forall fun ω => sq_nonneg _) (((integrable_finsetSum univ (fun i _ => he i)).const_mul _).add (integrable_const _)) exact Filter.Eventually.of_forall hpoint _ = 2 * a ^ 2 * 7 * (∑ i, ∫ ω, e i ω ^ 2 ∂μ) + 2 * b ^ 2 := by rw [integral_add ((integrable_finsetSum univ (fun i _ => he i)).const_mul _) (integrable_const _), integral_const_mul, integral_finsetSum univ (fun i _ => he i)] simp _ ≤ 2 * a ^ 2 * 7 * (∑ _i : Fin 7, R) + 2 * b ^ 2 := by gcongr exact hm i _ = _ := by simp; ring
CausalSmith.Stat.TransportCaceRoughnuisanceLength.affine_seven_error_second_moment · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/CubicBiasMoments.lean:17
theorem cubicResolution_inverse_rpow_sample_rate

Dyadic rounding and the exact block size control every nonnegative power of the inverse cubic resolution, with the constants in roadmap (13). Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
n :
ℕ
hn :
threshold ≤ n
p :
ℝ
hp :
0 ≤ p
(1 / (cubicResolution n : ℝ)) ^ p ≤ (2 : ℝ) ^ p * (5 : ℝ) ^ p * (n : ℝ) ^ (-p)
Proof (Lean source)
-- @node: cubicResolution_inverse_rpow_sample_rate lemma cubicResolution_inverse_rpow_sample_rate (n : ℕ) (hn : threshold ≤ n) (p : ℝ) (hp : 0 ≤ p) : (1 / (cubicResolution n : ℝ)) ^ p ≤ (2 : ℝ) ^ p * (5 : ℝ) ^ p * (n : ℝ) ^ (-p) := by have hnpos : (0 : ℝ) < n := by exact_mod_cast (show 0 < n by norm_num [threshold] at hn; omega) have hl : (n : ℝ) / 5 / 2 ≤ (cubicResolution n : ℝ) := by have h := (dyadicResolution_power_bounds n hn 1 (by norm_num)).1 simp only [Real.rpow_one] at h exact (div_le_div_of_nonneg_right (block_size_lower n hn 0) (by norm_num)).trans h have h := Real.rpow_le_rpow_of_nonpos (by positivity : (0 : ℝ) < (n : ℝ) / 5 / 2) hl (neg_nonpos.mpr hp) calc _ = (cubicResolution n : ℝ) ^ (-p) := by rw [Real.div_rpow (by norm_num) (by positivity), Real.one_rpow, Real.rpow_neg (by positivity)] simp only [one_div] _ ≤ ((n : ℝ) / 5 / 2) ^ (-p) := h _ = _ := by rw [Real.div_rpow (by positivity) (by norm_num), Real.div_rpow hnpos.le (by norm_num), Real.rpow_neg (by norm_num : (0 : ℝ) ≤ 5), Real.rpow_neg (by norm_num : (0 : ℝ) ≤ 2)] field_simp
CausalSmith.Stat.TransportCaceRoughnuisanceLength.cubicResolution_inverse_rpow_sample_rate · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/CubicBiasMoments.lean:52
theorem integrable_pilot_error_L1_sq

The squared spatial L1 pilot error is integrable: joint measurability and clipping provide a uniform bound on the unit covariate interval. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hn :
threshold ≤ n
hP :
ModelClass c_f C_f L P n
i :
Fin 7
Integrable (fun ω => (∫ x in covariateSpace, |markedDensityVector c_f C_f L P n hP x i - pilot c_f C_f ω x i|) ^ 2) (dataLaw P n n)
Proof (Lean source)
-- @node: integrable_pilot_error_L1_sq lemma integrable_pilot_error_L1_sq (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hn : threshold ≤ n) (hP : ModelClass c_f C_f L P n) (i : Fin 7) : Integrable (fun ω => (∫ x in covariateSpace, |markedDensityVector c_f C_f L P n hP x i - pilot c_f C_f ω x i|) ^ 2) (dataLaw P n n) := by let := sourceObsLaw_isProbabilityMeasure c_f C_f L P n hP let := targetXLaw_isProbabilityMeasure c_f C_f L P n hP let : IsProbabilityMeasure (dataLaw P n n) := by rw [dataLaw_eq_source_target_pi c_f C_f L P n hP]; infer_instance let ν := volume.restrict covariateSpace let : IsProbabilityMeasure ν := ⟨by simp [ν, covariateSpace]⟩ let F := covariateSpace.indicator (fun x => markedDensityVector c_f C_f L P n hP x i) let g := fun (ω : TwoSample n n) (x : ℝ) => |F x - pilot c_f C_f ω x i| have hg : Measurable (uncurry g) := by have hF := measurable_markedDensityVector_indicator c_f C_f L P n hP i dsimp [g, uncurry] fun_prop have hC : 0 ≤ C_f := hP.sourceBounds.2.1.le.trans' (by norm_num) have hb (ω : TwoSample n n) : ∀ᵐ x ∂ν, |g ω x| ≤ 2 * C_f := by apply ae_restrict_of_forall_mem measurableSet_Icc intro x hx change x ∈ covariateSpace at hx dsimp [g, F] rw [Set.indicator_of_mem hx, abs_abs] simpa only [two_mul] using (abs_sub _ _).trans (add_le_add (clippingRectangle_coordinate_abs_le c_f C_f hP.sourceBounds.1.1 hC _ (markedDensityVector_mem_clippingRectangle c_f C_f L P n hP x hx) i) (clippingRectangle_coordinate_abs_le c_f C_f hP.sourceBounds.1.1 hC _ (pilot_mem_clippingRectangle c_f C_f L P n hn hP ω x) i)) have heq (ω : TwoSample n n) : (∫ x in covariateSpace, |markedDensityVector c_f C_f L P n hP x i - pilot c_f C_f ω x i|) = ∫ x, g ω x ∂ν := by apply setIntegral_congr_fun measurableSet_Icc intro x hx change x ∈ covariateSpace at hx dsimp [g, F] rw [Set.indicator_of_mem hx] simp_rw [heq] apply Integrable.of_bound (hg.stronglyMeasurable.integral_prod_right.pow 2).aestronglyMeasurable ((2 * C_f) ^ 2) filter_upwards [] with ω rw [Real.norm_eq_abs, abs_of_nonneg (sq_nonneg _)] have habs : |∫ x, g ω x ∂ν| ≤ 2 * C_f := (abs_integral_le_integral_abs.trans (integral_mono_of_nonneg (Filter.Eventually.of_forall fun x => abs_nonneg _) (integrable_const (2 * C_f)) (hb ω))).trans_eq (by simp) simpa only [sq_abs, Pi.pow_apply] using pow_le_pow_left₀ (abs_nonneg _) habs 2
CausalSmith.Stat.TransportCaceRoughnuisanceLength.integrable_pilot_error_L1_sq · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/CubicBiasMoments.lean:80
theorem cubic_spatial_projection_bias_integrated_sq_resolution_bound

The exact spatial cubic bias has the two second-moment terms of roadmap (13): the squared resolution modulus times the pilot L1 rate, and the sixth power of that modulus. No stochastic content is assumed. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hn :
threshold ≤ n
hP :
ModelClass c_f C_f L P n
A :
B :
3 * (1 + C_f) * L * (1 / (cubicResolution n : ℝ)) ^ holderExponent
a :
(fourthDerivativeEnvelope c_f C_f / 2) * (7 : ℝ) ^ 2 * B ^ 2
b :
(fourthDerivativeEnvelope c_f C_f / 6) * (7 : ℝ) ^ 3 * B ^ 3
A2 :
2 * (1 + C_f + C_f ^ 2) * (5 : ℝ) ^ (1 / 5 : ℝ)
+ (2 : ℝ) ^ (5 / 4 : ℝ) * (3 * (1 + C_f) * L) ^ 2 * (5 : ℝ) ^ (1 / 5 : ℝ)
(∫ ω, ((∑ i : Fin 7, ∑ j : Fin 7, ∑ k : Fin 7, ∫ x in covariateSpace, (dPhi3 A (pilot c_f C_f ω x) i j k / 6) * (markedDensityVector c_f C_f L P n hP x i - pilot c_f C_f ω x i) * (markedDensityVector c_f C_f L P n hP x j - pilot c_f C_f ω x j) * (markedDensityVector c_f C_f L P n hP x k - pilot c_f C_f ω x k)) - cubicProjectionMean c_f C_f L P n hP ω A) ^ 2 ∂dataLaw P n n)
≤ 2 * a ^ 2 * (7 : ℝ) ^ 2 * (A2 * (n : ℝ) ^ (-(1 / 5 : ℝ))) + 2 * b ^ 2
Proof (Lean source)
-- @node: cubic_spatial_projection_bias_integrated_sq_resolution_bound lemma cubic_spatial_projection_bias_integrated_sq_resolution_bound (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hn : threshold ≤ n) (hP : ModelClass c_f C_f L P n) (A : Bool) : let B := 3 * (1 + C_f) * L * (1 / (cubicResolution n : ℝ)) ^ holderExponent let a := (fourthDerivativeEnvelope c_f C_f / 2) * (7 : ℝ) ^ 2 * B ^ 2 let b := (fourthDerivativeEnvelope c_f C_f / 6) * (7 : ℝ) ^ 3 * B ^ 3 let A2 := 2 * (1 + C_f + C_f ^ 2) * (5 : ℝ) ^ (1 / 5 : ℝ) + (2 : ℝ) ^ (5 / 4 : ℝ) * (3 * (1 + C_f) * L) ^ 2 * (5 : ℝ) ^ (1 / 5 : ℝ) (∫ ω, ((∑ i : Fin 7, ∑ j : Fin 7, ∑ k : Fin 7, ∫ x in covariateSpace, (dPhi3 A (pilot c_f C_f ω x) i j k / 6) * (markedDensityVector c_f C_f L P n hP x i - pilot c_f C_f ω x i) * (markedDensityVector c_f C_f L P n hP x j - pilot c_f C_f ω x j) * (markedDensityVector c_f C_f L P n hP x k - pilot c_f C_f ω x k)) - cubicProjectionMean c_f C_f L P n hP ω A) ^ 2 ∂dataLaw P n n) ≤ 2 * a ^ 2 * (7 : ℝ) ^ 2 * (A2 * (n : ℝ) ^ (-(1 / 5 : ℝ))) + 2 * b ^ 2 := by dsimp only let := sourceObsLaw_isProbabilityMeasure c_f C_f L P n hP let := targetXLaw_isProbabilityMeasure c_f C_f L P n hP let : IsProbabilityMeasure (dataLaw P n n) := by rw [dataLaw_eq_source_target_pi c_f C_f L P n hP]; infer_instance apply affine_seven_error_second_moment (dataLaw P n n) _ (fun i ω => ∫ x in covariateSpace, |markedDensityVector c_f C_f L P n hP x i - pilot c_f C_f ω x i|) · exact fun i => integrable_pilot_error_L1_sq c_f C_f L P n hn hP i · intro i simpa only [abs_sub_comm] using pilot_error_L1_second_moment c_f C_f L P n hn hP i · intro ω exact cubic_spatial_projection_bias_abs_le_L1 c_f C_f L P n hn hP ω A
CausalSmith.Stat.TransportCaceRoughnuisanceLength.cubic_spatial_projection_bias_integrated_sq_resolution_bound · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/CubicBiasMoments.lean:133
CausalSmith.Stat.STAT_TransportCaceRoughnuisanceLength_Research.Helpers.CubicMse.CubicBiasRate 2 declarations The two terms in roadmap (13) have rates n^(-7/10) and n^(-3/4).

Sample rate of the exact spatial cubic projection bias

The two terms in roadmap (13) have rates n^(-7/10) and n^(-3/4). Dyadic rounding and exponent comparison give the stated BC n^(-2/3) bound.

theorem cubic_bias_resolution_terms_sample_rate

Convert both resolution powers in the cubic squared-bias bound, keeping exactly the computable constant BC from roadmap (13). Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
n :
ℕ
hn :
threshold ≤ n
C1 C2 A2 :
ℝ
hA2 :
0 ≤ A2
q :
1 / (cubicResolution n : ℝ) (: ℝ)
2 * (C1 * (q ^ holderExponent) ^ 2) ^ 2 * (7 : ℝ) ^ 2 * (A2 * (n : ℝ) ^ (-(1 / 5 : ℝ)))
+ 2 * (C2 * (q ^ holderExponent) ^ 3) ^ 2
≤ 2 * (C1 ^ 2 * (7 : ℝ) ^ 2 * A2 * (2 : ℝ) ^ (1 / 2 : ℝ) * (5 : ℝ) ^ (1 / 2 : ℝ) + C2 ^ 2 * (2 : ℝ) ^ (3 / 4 : ℝ) * (5 : ℝ) ^ (3 / 4 : ℝ)) * (n : ℝ) ^ (-(2 / 3 : ℝ))
Proof (Lean source)
-- @node: cubic_bias_resolution_terms_sample_rate lemma cubic_bias_resolution_terms_sample_rate (n : ℕ) (hn : threshold ≤ n) (C1 C2 A2 : ℝ) (hA2 : 0 ≤ A2) : let q : ℝ := 1 / (cubicResolution n : ℝ) 2 * (C1 * (q ^ holderExponent) ^ 2) ^ 2 * (7 : ℝ) ^ 2 * (A2 * (n : ℝ) ^ (-(1 / 5 : ℝ))) + 2 * (C2 * (q ^ holderExponent) ^ 3) ^ 2 ≤ 2 * (C1 ^ 2 * (7 : ℝ) ^ 2 * A2 * (2 : ℝ) ^ (1 / 2 : ℝ) * (5 : ℝ) ^ (1 / 2 : ℝ) + C2 ^ 2 * (2 : ℝ) ^ (3 / 4 : ℝ) * (5 : ℝ) ^ (3 / 4 : ℝ)) * (n : ℝ) ^ (-(2 / 3 : ℝ)) := by dsimp only let q : ℝ := 1 / (cubicResolution n : ℝ) have hq : 0 ≤ q := by dsimp [q]; positivity have hn1 : (1 : ℝ) ≤ n := by exact_mod_cast (show 1 ≤ n by norm_num [threshold] at hn; omega) have hnpos : (0 : ℝ) < n := lt_of_lt_of_le (by norm_num) hn1 have hp4 : (q ^ holderExponent) ^ (4 : ℕ) = q ^ (1 / 2 : ℝ) := by rw [← Real.rpow_natCast, ← Real.rpow_mul hq] norm_num [holderExponent] have hp6 : (q ^ holderExponent) ^ (6 : ℕ) = q ^ (3 / 4 : ℝ) := by rw [← Real.rpow_natCast, ← Real.rpow_mul hq] norm_num [holderExponent] have hhalf : q ^ (1 / 2 : ℝ) * (n : ℝ) ^ (-(1 / 5 : ℝ)) ≤ (2 : ℝ) ^ (1 / 2 : ℝ) * (5 : ℝ) ^ (1 / 2 : ℝ) * (n : ℝ) ^ (-(2 / 3 : ℝ)) := by calc _ ≤ ((2 : ℝ) ^ (1 / 2 : ℝ) * (5 : ℝ) ^ (1 / 2 : ℝ) * (n : ℝ) ^ (-(1 / 2 : ℝ))) * (n : ℝ) ^ (-(1 / 5 : ℝ)) := mul_le_mul_of_nonneg_right (cubicResolution_inverse_rpow_sample_rate n hn (1 / 2) (by norm_num)) (Real.rpow_nonneg hnpos.le _) _ = (2 : ℝ) ^ (1 / 2 : ℝ) * (5 : ℝ) ^ (1 / 2 : ℝ) * (n : ℝ) ^ (-(7 / 10 : ℝ)) := by rw [mul_assoc, ← Real.rpow_add hnpos] norm_num _ ≤ _ := mul_le_mul_of_nonneg_left (Real.rpow_le_rpow_of_exponent_le hn1 (by norm_num)) (by positivity) have hthree : q ^ (3 / 4 : ℝ) ≤ (2 : ℝ) ^ (3 / 4 : ℝ) * (5 : ℝ) ^ (3 / 4 : ℝ) * (n : ℝ) ^ (-(2 / 3 : ℝ)) := (cubicResolution_inverse_rpow_sample_rate n hn (3 / 4) (by norm_num)).trans (mul_le_mul_of_nonneg_left (Real.rpow_le_rpow_of_exponent_le hn1 (by norm_num)) (by positivity)) calc _ = (2 * C1 ^ 2 * (7 : ℝ) ^ 2 * A2) * (q ^ (1 / 2 : ℝ) * (n : ℝ) ^ (-(1 / 5 : ℝ))) + (2 * C2 ^ 2) * q ^ (3 / 4 : ℝ) := by change 2 * (C1 * (q ^ holderExponent) ^ 2) ^ 2 * (7 : ℝ) ^ 2 * (A2 * (n : ℝ) ^ (-(1 / 5 : ℝ))) + 2 * (C2 * (q ^ holderExponent) ^ 3) ^ 2 = _ rw [mul_pow, mul_pow, ← pow_mul, ← pow_mul] norm_num only at * rw [hp4, hp6] ring _ ≤ (2 * C1 ^ 2 * (7 : ℝ) ^ 2 * A2) * ((2 : ℝ) ^ (1 / 2 : ℝ) * (5 : ℝ) ^ (1 / 2 : ℝ) * (n : ℝ) ^ (-(2 / 3 : ℝ))) + (2 * C2 ^ 2) * ((2 : ℝ) ^ (3 / 4 : ℝ) * (5 : ℝ) ^ (3 / 4 : ℝ) * (n : ℝ) ^ (-(2 / 3 : ℝ))) := add_le_add (mul_le_mul_of_nonneg_left hhalf (by positivity)) (mul_le_mul_of_nonneg_left hthree (by positivity)) _ = _ := by ring
CausalSmith.Stat.TransportCaceRoughnuisanceLength.cubic_bias_resolution_terms_sample_rate · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/CubicBiasRate.lean:15
theorem cubic_spatial_projection_bias_integrated_sq_sample_rate

The exact spatial cubic Taylor term minus the exact cubic projection mean has the sample-size bound (13), with the paper's BC constant. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hn :
threshold ≤ n
hP :
ModelClass c_f C_f L P n
A :
H :
3 * (1 + C_f) * L
A2 :
2 * (1 + C_f + C_f ^ 2) * (5 : ℝ) ^ (1 / 5 : ℝ)
+ (2 : ℝ) ^ (5 / 4 : ℝ) * H ^ 2 * (5 : ℝ) ^ (1 / 5 : ℝ)
C1 :
(M / 2) * (7 : ℝ) ^ 2 * H ^ 2
C2 :
(M / 6) * (7 : ℝ) ^ 3 * H ^ 3
BC :
2 * (C1 ^ 2 * (7 : ℝ) ^ 2 * A2 * (2 : ℝ) ^ (1 / 2 : ℝ) * (5 : ℝ) ^ (1 / 2 : ℝ) + C2 ^ 2 * (2 : ℝ) ^ (3 / 4 : ℝ) * (5 : ℝ) ^ (3 / 4 : ℝ))
(∫ ω, ((∑ i : Fin 7, ∑ j : Fin 7, ∑ k : Fin 7, ∫ x in covariateSpace, (dPhi3 A (pilot c_f C_f ω x) i j k / 6) * (markedDensityVector c_f C_f L P n hP x i - pilot c_f C_f ω x i) * (markedDensityVector c_f C_f L P n hP x j - pilot c_f C_f ω x j) * (markedDensityVector c_f C_f L P n hP x k - pilot c_f C_f ω x k)) - cubicProjectionMean c_f C_f L P n hP ω A) ^ 2 ∂dataLaw P n n)
≤ BC * (n : ℝ) ^ (-(2 / 3 : ℝ))
Proof (Lean source)
-- @node: cubic_spatial_projection_bias_integrated_sq_sample_rate lemma cubic_spatial_projection_bias_integrated_sq_sample_rate (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hn : threshold ≤ n) (hP : ModelClass c_f C_f L P n) (A : Bool) : let H := 3 * (1 + C_f) * L let M := fourthDerivativeEnvelope c_f C_f let A2 := 2 * (1 + C_f + C_f ^ 2) * (5 : ℝ) ^ (1 / 5 : ℝ) + (2 : ℝ) ^ (5 / 4 : ℝ) * H ^ 2 * (5 : ℝ) ^ (1 / 5 : ℝ) let C1 := (M / 2) * (7 : ℝ) ^ 2 * H ^ 2 let C2 := (M / 6) * (7 : ℝ) ^ 3 * H ^ 3 let BC := 2 * (C1 ^ 2 * (7 : ℝ) ^ 2 * A2 * (2 : ℝ) ^ (1 / 2 : ℝ) * (5 : ℝ) ^ (1 / 2 : ℝ) + C2 ^ 2 * (2 : ℝ) ^ (3 / 4 : ℝ) * (5 : ℝ) ^ (3 / 4 : ℝ)) (∫ ω, ((∑ i : Fin 7, ∑ j : Fin 7, ∑ k : Fin 7, ∫ x in covariateSpace, (dPhi3 A (pilot c_f C_f ω x) i j k / 6) * (markedDensityVector c_f C_f L P n hP x i - pilot c_f C_f ω x i) * (markedDensityVector c_f C_f L P n hP x j - pilot c_f C_f ω x j) * (markedDensityVector c_f C_f L P n hP x k - pilot c_f C_f ω x k)) - cubicProjectionMean c_f C_f L P n hP ω A) ^ 2 ∂dataLaw P n n) ≤ BC * (n : ℝ) ^ (-(2 / 3 : ℝ)) := by dsimp only have hC : 0 ≤ C_f := le_trans (by norm_num) hP.sourceBounds.2.1.le have hA2 : 0 ≤ 2 * (1 + C_f + C_f ^ 2) * (5 : ℝ) ^ (1 / 5 : ℝ) + (2 : ℝ) ^ (5 / 4 : ℝ) * (3 * (1 + C_f) * L) ^ 2 * (5 : ℝ) ^ (1 / 5 : ℝ) := by positivity apply (cubic_spatial_projection_bias_integrated_sq_resolution_bound c_f C_f L P n hn hP A).trans convert cubic_bias_resolution_terms_sample_rate n hn ((fourthDerivativeEnvelope c_f C_f / 2) * (7 : ℝ) ^ 2 * (3 * (1 + C_f) * L) ^ 2) ((fourthDerivativeEnvelope c_f C_f / 6) * (7 : ℝ) ^ 3 * (3 * (1 + C_f) * L) ^ 3) _ hA2 using 1 <;> first | rfl | ring
CausalSmith.Stat.TransportCaceRoughnuisanceLength.cubic_spatial_projection_bias_integrated_sq_sample_rate · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/CubicBiasRate.lean:80
CausalSmith.Stat.STAT_TransportCaceRoughnuisanceLength_Research.Helpers.CubicMse.CubicBlockCovariance 4 declarations Uniform covariance bounds for flattened histogram blocks

Uniform covariance bounds for flattened histogram blocks

theorem measurable_iidBlockHeight

Given the supplied inputs, the stated result about measurable iid block height holds.

Formal statement
Ω :
n K :
ℕ
S :
f :
Ω → ℝ
hf :
Proof (Lean source)
@[fun_prop] lemma measurable_iidBlockHeight {Ω : Type*} [MeasurableSpace Ω] {n K : ℕ} (S : Finset (Fin n)) (f : Ω → ℝ) (hf : Measurable f) : Measurable (iidBlockHeight K S f) := by unfold iidBlockHeight fun_prop
CausalSmith.Stat.TransportCaceRoughnuisanceLength.measurable_iidBlockHeight · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/CubicBlockCovariance.lean:12
theorem iidBlockHeight_memLp_of_unit_interval

Given the supplied inputs, the stated result about iid block height mem lp of unit interval holds.

Formal statement
Ω :
n K :
ℕ
S :
hS :
0 < S.card
f :
Ω → ℝ
hf :
hunit :
∀ x, f x ∈ Icc (0 : ℝ) 1
MemLp (iidBlockHeight K S f) 2 (Measure.pi (fun _ : Fin n => μ))
Proof (Lean source)
lemma iidBlockHeight_memLp_of_unit_interval {Ω : Type*} [MeasurableSpace Ω] {μ : Measure Ω} [IsProbabilityMeasure μ] {n K : ℕ} (S : Finset (Fin n)) (hS : 0 < S.card) (f : Ω → ℝ) (hf : Measurable f) (hunit : ∀ x, f x ∈ Icc (0 : ℝ) 1) : MemLp (iidBlockHeight K S f) 2 (Measure.pi (fun _ : Fin n => μ)) := by have hmeas := measurable_iidBlockHeight (K := K) S f hf apply MemLp.of_bound hmeas.aestronglyMeasurable K filter_upwards [] with x have hsum_nonneg : 0 ≤ ∑ r ∈ S, f (x r) := Finset.sum_nonneg fun r _ => (hunit (x r)).1 have hsum_le : (∑ r ∈ S, f (x r)) ≤ S.card := by simpa using Finset.sum_le_card_nsmul S (fun r => f (x r)) 1 (fun r _ => (hunit (x r)).2) unfold iidBlockHeight change |(K : ℝ) / S.card * ∑ r ∈ S, f (x r)| ≤ K rw [abs_of_nonneg (mul_nonneg (by positivity) hsum_nonneg)] calc (K : ℝ) / S.card * ∑ r ∈ S, f (x r) ≤ (K : ℝ) / S.card * S.card := mul_le_mul_of_nonneg_left hsum_le (by positivity) _ = K := by have hcard : (S.card : ℝ) ≠ 0 := by exact_mod_cast hS.ne' field_simp
CausalSmith.Stat.TransportCaceRoughnuisanceLength.iidBlockHeight_memLp_of_unit_interval · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/CubicBlockCovariance.lean:20
theorem flatBlockHeight_same_cell_covariance_le

The covariance of two flattened block heights is bounded uniformly over source and target channels on the same histogram cell. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n K :
ℕ
hP :
ModelClass c_f C_f L P n
hK :
0 < K
b :
Fin 4
hb :
0 < (blockIdx n b).card
l :
Fin K
i j :
Fin 7
|cov[(fun x : (a : FlatIndex n) → FlatObs n a => flatBlockHeight i b l (finsetCoordProj (flatBlock n b) x)), (fun x : (a : FlatIndex n) → FlatObs n a => flatBlockHeight j b l (finsetCoordProj (flatBlock n b) x)); Measure.pi (flatLaw P n)]|
≤ ((K : ℝ) * C_f + C_f ^ 2) / (blockIdx n b).card
Proof (Lean source)
lemma flatBlockHeight_same_cell_covariance_le (c_f C_f L : ℝ) (P : TransportLaw) (n K : ℕ) (hP : ModelClass c_f C_f L P n) (hK : 0 < K) (b : Fin 4) (hb : 0 < (blockIdx n b).card) (l : Fin K) (i j : Fin 7) : |cov[(fun x : (a : FlatIndex n) → FlatObs n a => flatBlockHeight i b l (finsetCoordProj (flatBlock n b) x)), (fun x : (a : FlatIndex n) → FlatObs n a => flatBlockHeight j b l (finsetCoordProj (flatBlock n b) x)); Measure.pi (flatLaw P n)]| ≤ ((K : ℝ) * C_f + C_f ^ 2) / (blockIdx n b).card := by letI : IsProbabilityMeasure (sourceObsLaw P) := sourceObsLaw_isProbabilityMeasure c_f C_f L P n hP letI : IsProbabilityMeasure (targetXLaw P) := targetXLaw_isProbabilityMeasure c_f C_f L P n hP by_cases hi : i = 0 · subst i by_cases hj : j = 0 · subst j simp_rw [flatBlockHeight_proj_target] rw [covariance_flatLaw_target c_f C_f L P n hP] · exact target_iidBlockHeight_same_cell_covariance_le c_f C_f L P n K hP hK (blockIdx n b) hb l · exact measurable_iidBlockHeight _ _ (measurable_targetCellScore K l) · exact measurable_iidBlockHeight _ _ (measurable_targetCellScore K l) · simp_rw [flatBlockHeight_proj_target, flatBlockHeight_proj_source j hj] rw [covariance_comm] rw [covariance_flatLaw_source_target_zero c_f C_f L P n hP] · simp have hC : 0 ≤ C_f := le_trans (by norm_num) hP.sourceBounds.2.1.le positivity · exact iidBlockHeight_memLp_of_unit_interval _ hb _ (measurable_sourceCellScore j K l) (sourceCellScore_mem_unit_interval j K l) · exact iidBlockHeight_memLp_of_unit_interval _ hb _ (measurable_targetCellScore K l) (targetCellScore_mem_unit_interval K l) · by_cases hj : j = 0 · subst j simp_rw [flatBlockHeight_proj_source i hi, flatBlockHeight_proj_target] rw [covariance_flatLaw_source_target_zero c_f C_f L P n hP] · simp have hC : 0 ≤ C_f := le_trans (by norm_num) hP.sourceBounds.2.1.le positivity · exact iidBlockHeight_memLp_of_unit_interval _ hb _ (measurable_sourceCellScore i K l) (sourceCellScore_mem_unit_interval i K l) · exact iidBlockHeight_memLp_of_unit_interval _ hb _ (measurable_targetCellScore K l) (targetCellScore_mem_unit_interval K l) · simp_rw [flatBlockHeight_proj_source i hi, flatBlockHeight_proj_source j hj] rw [covariance_flatLaw_source c_f C_f L P n hP] · exact source_iidBlockHeight_same_cell_covariance_le c_f C_f L P n K hP hK (blockIdx n b) hb l i j · exact measurable_iidBlockHeight _ _ (measurable_sourceCellScore i K l) · exact measurable_iidBlockHeight _ _ (measurable_sourceCellScore j K l)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.flatBlockHeight_same_cell_covariance_le · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/CubicBlockCovariance.lean:46
theorem flatBlockHeight_off_cell_covariance_le

The covariance of two flattened block heights is bounded uniformly over source and target channels on distinct histogram cells. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n K :
ℕ
hP :
ModelClass c_f C_f L P n
hK :
0 < K
b :
Fin 4
hb :
0 < (blockIdx n b).card
l r :
Fin K
hlr :
l ≠ r
i j :
Fin 7
|cov[(fun x : (a : FlatIndex n) → FlatObs n a => flatBlockHeight i b l (finsetCoordProj (flatBlock n b) x)), (fun x : (a : FlatIndex n) → FlatObs n a => flatBlockHeight j b r (finsetCoordProj (flatBlock n b) x)); Measure.pi (flatLaw P n)]|
≤ C_f ^ 2 / (blockIdx n b).card
Proof (Lean source)
lemma flatBlockHeight_off_cell_covariance_le (c_f C_f L : ℝ) (P : TransportLaw) (n K : ℕ) (hP : ModelClass c_f C_f L P n) (hK : 0 < K) (b : Fin 4) (hb : 0 < (blockIdx n b).card) {l r : Fin K} (hlr : l ≠ r) (i j : Fin 7) : |cov[(fun x : (a : FlatIndex n) → FlatObs n a => flatBlockHeight i b l (finsetCoordProj (flatBlock n b) x)), (fun x : (a : FlatIndex n) → FlatObs n a => flatBlockHeight j b r (finsetCoordProj (flatBlock n b) x)); Measure.pi (flatLaw P n)]| ≤ C_f ^ 2 / (blockIdx n b).card := by letI : IsProbabilityMeasure (sourceObsLaw P) := sourceObsLaw_isProbabilityMeasure c_f C_f L P n hP letI : IsProbabilityMeasure (targetXLaw P) := targetXLaw_isProbabilityMeasure c_f C_f L P n hP by_cases hi : i = 0 · subst i by_cases hj : j = 0 · subst j simp_rw [flatBlockHeight_proj_target] rw [covariance_flatLaw_target c_f C_f L P n hP] · exact target_iidBlockHeight_off_cell_covariance_le c_f C_f L P n K hP hK (blockIdx n b) hb hlr · exact measurable_iidBlockHeight _ _ (measurable_targetCellScore K l) · exact measurable_iidBlockHeight _ _ (measurable_targetCellScore K r) · simp_rw [flatBlockHeight_proj_target, flatBlockHeight_proj_source j hj] rw [covariance_comm] rw [covariance_flatLaw_source_target_zero c_f C_f L P n hP] · simp positivity · exact iidBlockHeight_memLp_of_unit_interval _ hb _ (measurable_sourceCellScore j K r) (sourceCellScore_mem_unit_interval j K r) · exact iidBlockHeight_memLp_of_unit_interval _ hb _ (measurable_targetCellScore K l) (targetCellScore_mem_unit_interval K l) · by_cases hj : j = 0 · subst j simp_rw [flatBlockHeight_proj_source i hi, flatBlockHeight_proj_target] rw [covariance_flatLaw_source_target_zero c_f C_f L P n hP] · simp positivity · exact iidBlockHeight_memLp_of_unit_interval _ hb _ (measurable_sourceCellScore i K l) (sourceCellScore_mem_unit_interval i K l) · exact iidBlockHeight_memLp_of_unit_interval _ hb _ (measurable_targetCellScore K r) (targetCellScore_mem_unit_interval K r) · simp_rw [flatBlockHeight_proj_source i hi, flatBlockHeight_proj_source j hj] rw [covariance_flatLaw_source c_f C_f L P n hP] · exact source_iidBlockHeight_off_cell_covariance_le c_f C_f L P n K hP hK (blockIdx n b) hb hlr i j · exact measurable_iidBlockHeight _ _ (measurable_sourceCellScore i K l) · exact measurable_iidBlockHeight _ _ (measurable_sourceCellScore j K r)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.flatBlockHeight_off_cell_covariance_le · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/CubicBlockCovariance.lean:105
CausalSmith.Stat.STAT_TransportCaceRoughnuisanceLength_Research.Helpers.CubicMse.CubicDerivative 21 declarations Second and third coordinate derivative envelopes at the clipped pilot

Second and third coordinate derivative envelopes at the clipped pilot

The density vector object is defined without additional inputs.

Definition (Lean source)
DensityVector :
Type
Fin 7 → ℝ
def densityCoord

The density coord object is defined from the supplied inputs.

Definition (Lean source)
r :
Fin 7
densityCoord r :
DensityVector →L[ℝ] ℝ
ContinuousLinearMap.proj r
def cubicRatioTerm

The cubic ratio term object is defined from the supplied inputs.

Definition (Lean source)
a b c :
Fin 7
cubicRatioTerm a b c v :
ℝ
v a * v b * (v c)⁻¹
def cubicRatioD1

The cubic ratio d1 object is defined from the supplied inputs.

Definition (Lean source)
a b c :
Fin 7
cubicRatioD1 a b c v :
DensityVector →L[ℝ] ℝ
(v a * v b) • (-(v c)⁻¹ ^ 2 • densityCoord c)
+ (v c)⁻¹ • (v a • densityCoord b + v b • densityCoord a)
def cubicRatioD1Apply

The cubic ratio d1 apply object is defined from the supplied inputs.

Definition (Lean source)
a b c :
Fin 7
cubicRatioD1Apply a b c h v :
ℝ
(v a * v b) * (-(v c)⁻¹ ^ 2 * h c) + (v c)⁻¹ * (h a * v b + v a * h b)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.cubicRatioD1Apply · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/CubicDerivative.lean:35
def cubicRatioD2Apply

The cubic ratio d2 apply object is defined from the supplied inputs.

Definition (Lean source)
a b c :
Fin 7
h k v :
cubicRatioD2Apply a b c h k v :
ℝ
(h a * k b + k a * h b) * (v c)⁻¹
- (h a * v b + v a * h b) * k c * (v c)⁻¹ ^ 2
- (k a * v b + v a * k b) * h c * (v c)⁻¹ ^ 2
+ 2 * v a * v b * h c * k c * (v c)⁻¹ ^ 3
CausalSmith.Stat.TransportCaceRoughnuisanceLength.cubicRatioD2Apply · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/CubicDerivative.lean:42
def cubicRatioD3Apply

The cubic ratio d3 apply object is defined from the supplied inputs.

Definition (Lean source)
a b c :
Fin 7
h k l v :
cubicRatioD3Apply a b c h k l v :
ℝ
-(h a * k b + k a * h b) * l c * (v c)⁻¹ ^ 2
- ((h a * l b + l a * h b) * k c + (k a * l b + l a * k b) * h c) * (v c)⁻¹ ^ 2
+ 2 * (h a * v b + v a * h b) * k c * l c * (v c)⁻¹ ^ 3
+ 2 * (k a * v b + v a * k b) * h c * l c * (v c)⁻¹ ^ 3
+ 2 * (l a * v b + v a * l b) * h c * k c * (v c)⁻¹ ^ 3
- 6 * v a * v b * h c * k c * l c * (v c)⁻¹ ^ 4
CausalSmith.Stat.TransportCaceRoughnuisanceLength.cubicRatioD3Apply · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/CubicDerivative.lean:51
theorem hasFDerivAt_cubicRatioTerm

Given the supplied inputs, the stated result about has fderiv at cubic ratio term holds.

Formal statement
a b c :
Fin 7
hc :
v c ≠ 0
Proof (Lean source)
lemma hasFDerivAt_cubicRatioTerm (a b c : Fin 7) (v : DensityVector) (hc : v c ≠ 0) : HasFDerivAt (cubicRatioTerm a b c) (cubicRatioD1 a b c v) v := by have ha := (densityCoord a).hasFDerivAt (x := v) have hb := (densityCoord b).hasFDerivAt (x := v) have hc' := (densityCoord c).hasFDerivAt (x := v) have hi := (hasFDerivAt_inv hc).comp v hc' refine ((ha.mul hb).mul hi).congr_fderiv ?_ ext h simp [cubicRatioD1, densityCoord, Function.comp_apply, ContinuousLinearMap.toSpanSingleton_apply] field_simp [hc] <;> simp
CausalSmith.Stat.TransportCaceRoughnuisanceLength.hasFDerivAt_cubicRatioTerm · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/CubicDerivative.lean:63
theorem cubicRatioD1_apply

Given the supplied inputs, the stated result about cubic ratio d1 apply holds.

Formal statement
a b c :
Fin 7
cubicRatioD1 a b c v h = cubicRatioD1Apply a b c h v
Proof (Lean source)
lemma cubicRatioD1_apply (a b c : Fin 7) (v h : DensityVector) : cubicRatioD1 a b c v h = cubicRatioD1Apply a b c h v := by simp only [cubicRatioD1, cubicRatioD1Apply, densityCoord, ContinuousLinearMap.add_apply, ContinuousLinearMap.smul_apply, ContinuousLinearMap.proj_apply, smul_eq_mul] ring
CausalSmith.Stat.TransportCaceRoughnuisanceLength.cubicRatioD1_apply · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/CubicDerivative.lean:79
theorem fderiv_cubicRatioD1Apply

Given the supplied inputs, the stated result about fderiv cubic ratio d1 apply holds.

Formal statement
a b c :
Fin 7
v h k :
hc :
v c ≠ 0
fderiv ℝ (fun y => cubicRatioD1Apply a b c k y) v h = cubicRatioD2Apply a b c h k v
Proof (Lean source)
lemma fderiv_cubicRatioD1Apply (a b c : Fin 7) (v h k : DensityVector) (hc : v c ≠ 0) : fderiv ℝ (fun y => cubicRatioD1Apply a b c k y) v h = cubicRatioD2Apply a b c h k v := by have ha := (densityCoord a).hasFDerivAt (x := v) have hb := (densityCoord b).hasFDerivAt (x := v) have hc' := (densityCoord c).hasFDerivAt (x := v) have hi := (hasFDerivAt_inv hc).comp v hc' have hp := ha.mul hb have hi2 := hi.mul hi have hs := (ha.mul_const (k b)).add (hb.mul_const (k a)) have ht := (hp.mul (hi2.mul_const (-k c))).add (hi.mul hs) have ht' := ht.congr_of_eventuallyEq (f₁ := fun y => cubicRatioD1Apply a b c k y) (Filter.Eventually.of_forall (fun y => by simp [cubicRatioD1Apply, densityCoord, Function.comp_apply] ring)) rw [ht'.fderiv] simp [cubicRatioD2Apply, densityCoord, Function.comp_apply, ContinuousLinearMap.toSpanSingleton_apply] field_simp [hc] <;> ring
CausalSmith.Stat.TransportCaceRoughnuisanceLength.fderiv_cubicRatioD1Apply · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/CubicDerivative.lean:88
theorem fderiv_cubicRatioD2Apply

Given the supplied inputs, the stated result about fderiv cubic ratio d2 apply holds.

Formal statement
a b c :
Fin 7
v h k l :
hc :
v c ≠ 0
fderiv ℝ (fun y => cubicRatioD2Apply a b c k l y) v h = cubicRatioD3Apply a b c h k l v
Proof (Lean source)
lemma fderiv_cubicRatioD2Apply (a b c : Fin 7) (v h k l : DensityVector) (hc : v c ≠ 0) : fderiv ℝ (fun y => cubicRatioD2Apply a b c k l y) v h = cubicRatioD3Apply a b c h k l v := by have ha := (densityCoord a).hasFDerivAt (x := v) have hb := (densityCoord b).hasFDerivAt (x := v) have hc' := (densityCoord c).hasFDerivAt (x := v) have hi := (hasFDerivAt_inv hc).comp v hc' have hi2 := hi.mul hi have hi3 := hi2.mul hi have hp := ha.mul hb have ht1 := hi.const_mul (k a * l b + l a * k b) have hsk := (hb.const_mul (k a)).add (ha.mul_const (k b)) have hsl := (hb.const_mul (l a)).add (ha.mul_const (l b)) have ht2 := ((hsk.mul_const (l c)).mul hi2) have ht3 := ((hsl.mul_const (k c)).mul hi2) have ht4 := (hp.mul hi3).const_mul (2 * k c * l c) have ht := ((ht1.sub ht2).sub ht3).add ht4 have ht' := ht.congr_of_eventuallyEq (f₁ := fun y => cubicRatioD2Apply a b c k l y) (Filter.Eventually.of_forall (fun y => by simp [cubicRatioD2Apply, densityCoord, Function.comp_apply] ring)) rw [ht'.fderiv] simp [cubicRatioD3Apply, densityCoord, Function.comp_apply, ContinuousLinearMap.toSpanSingleton_apply] field_simp [hc] <;> ring
CausalSmith.Stat.TransportCaceRoughnuisanceLength.fderiv_cubicRatioD2Apply · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/CubicDerivative.lean:112
theorem iteratedFDeriv_one_cubicRatioTerm

Given the supplied inputs, the stated result about iterated fderiv one cubic ratio term holds.

Formal statement
a b c :
Fin 7
hc :
v c ≠ 0
iteratedFDeriv ℝ 1 (cubicRatioTerm a b c) v ![h] = cubicRatioD1Apply a b c h v
Proof (Lean source)
lemma iteratedFDeriv_one_cubicRatioTerm (a b c : Fin 7) (v h : DensityVector) (hc : v c ≠ 0) : iteratedFDeriv ℝ 1 (cubicRatioTerm a b c) v ![h] = cubicRatioD1Apply a b c h v := by rw [iteratedFDeriv_one_apply, (hasFDerivAt_cubicRatioTerm a b c v hc).fderiv] exact cubicRatioD1_apply a b c v h
CausalSmith.Stat.TransportCaceRoughnuisanceLength.iteratedFDeriv_one_cubicRatioTerm · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/CubicDerivative.lean:142
theorem iteratedFDeriv_two_cubicRatioTerm

Given the supplied inputs, the stated result about iterated fderiv two cubic ratio term holds.

Formal statement
a b c :
Fin 7
v h k :
hc :
v c ≠ 0
iteratedFDeriv ℝ 2 (cubicRatioTerm a b c) v ![h, k] = cubicRatioD2Apply a b c h k v
Proof (Lean source)
lemma iteratedFDeriv_two_cubicRatioTerm (a b c : Fin 7) (v h k : DensityVector) (hc : v c ≠ 0) : iteratedFDeriv ℝ 2 (cubicRatioTerm a b c) v ![h, k] = cubicRatioD2Apply a b c h k v := by have hs : ContDiffAt ℝ 2 (cubicRatioTerm a b c) v := by unfold cubicRatioTerm fun_prop have hd : DifferentiableAt ℝ (iteratedFDeriv ℝ 1 (cubicRatioTerm a b c)) v := hs.differentiableAt_iteratedFDeriv (by norm_num) rw [hd.iteratedFDeriv_succ_apply_left'] have hne : ∀ᶠ y in nhds v, y c ≠ 0 := (densityCoord c).continuous.continuousAt.eventually_ne hc have heq : (fun y => iteratedFDeriv ℝ 1 (cubicRatioTerm a b c) y (Fin.tail ![h, k])) =ᶠ[nhds v] (fun y => cubicRatioD1Apply a b c k y) := by filter_upwards [hne] with y hy simpa using iteratedFDeriv_one_cubicRatioTerm a b c y k hy rw [heq.fderiv_eq] simpa using fderiv_cubicRatioD1Apply a b c v h k hc
CausalSmith.Stat.TransportCaceRoughnuisanceLength.iteratedFDeriv_two_cubicRatioTerm · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/CubicDerivative.lean:151
theorem iteratedFDeriv_three_cubicRatioTerm

Given the supplied inputs, the stated result about iterated fderiv three cubic ratio term holds.

Formal statement
a b c :
Fin 7
v h k l :
hc :
v c ≠ 0
iteratedFDeriv ℝ 3 (cubicRatioTerm a b c) v ![h, k, l] = cubicRatioD3Apply a b c h k l v
Proof (Lean source)
lemma iteratedFDeriv_three_cubicRatioTerm (a b c : Fin 7) (v h k l : DensityVector) (hc : v c ≠ 0) : iteratedFDeriv ℝ 3 (cubicRatioTerm a b c) v ![h, k, l] = cubicRatioD3Apply a b c h k l v := by have hs : ContDiffAt ℝ 3 (cubicRatioTerm a b c) v := by unfold cubicRatioTerm fun_prop have hd : DifferentiableAt ℝ (iteratedFDeriv ℝ 2 (cubicRatioTerm a b c)) v := hs.differentiableAt_iteratedFDeriv (by norm_num) rw [hd.iteratedFDeriv_succ_apply_left'] have hne : ∀ᶠ y in nhds v, y c ≠ 0 := (densityCoord c).continuous.continuousAt.eventually_ne hc have heq : (fun y => iteratedFDeriv ℝ 2 (cubicRatioTerm a b c) y (Fin.tail ![h, k, l])) =ᶠ[nhds v] (fun y => cubicRatioD2Apply a b c k l y) := by filter_upwards [hne] with y hy simpa using iteratedFDeriv_two_cubicRatioTerm a b c y k l hy rw [heq.fderiv_eq] simpa using fderiv_cubicRatioD2Apply a b c v h k l hc
CausalSmith.Stat.TransportCaceRoughnuisanceLength.iteratedFDeriv_three_cubicRatioTerm · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/CubicDerivative.lean:174
theorem iteratedFDeriv_three_Phi

Given the supplied inputs, the stated result about iterated fderiv three phi holds.

Formal statement
A :
h k l :
h1 :
v 1 ≠ 0
h2 :
v 2 ≠ 0
iteratedFDeriv ℝ 3 (Phi A) v ![h, k, l]
= cubicRatioD3Apply 0 (if A then 4 else 6) 2 h k l v
- cubicRatioD3Apply 0 (if A then 3 else 5) 1 h k l v
Proof (Lean source)
lemma iteratedFDeriv_three_Phi (A : Bool) (v : DensityVector) (h k l : DensityVector) (h1 : v 1 ≠ 0) (h2 : v 2 ≠ 0) : iteratedFDeriv ℝ 3 (Phi A) v ![h, k, l] = cubicRatioD3Apply 0 (if A then 4 else 6) 2 h k l v - cubicRatioD3Apply 0 (if A then 3 else 5) 1 h k l v := by cases A with | false => have hs2 : ContDiffAt ℝ 3 (cubicRatioTerm 0 6 2) v := by unfold cubicRatioTerm fun_prop have hs1 : ContDiffAt ℝ 3 (cubicRatioTerm 0 5 1) v := by unfold cubicRatioTerm fun_prop have heq : Phi false = cubicRatioTerm 0 6 2 - cubicRatioTerm 0 5 1 := by funext y simp [Phi, cubicRatioTerm, div_eq_mul_inv] ring rw [heq, iteratedFDeriv_sub_apply hs2 hs1] change iteratedFDeriv ℝ 3 (cubicRatioTerm 0 6 2) v ![h, k, l] - iteratedFDeriv ℝ 3 (cubicRatioTerm 0 5 1) v ![h, k, l] = _ rw [ iteratedFDeriv_three_cubicRatioTerm 0 6 2 v h k l h2, iteratedFDeriv_three_cubicRatioTerm 0 5 1 v h k l h1] simp | true => have hs2 : ContDiffAt ℝ 3 (cubicRatioTerm 0 4 2) v := by unfold cubicRatioTerm fun_prop have hs1 : ContDiffAt ℝ 3 (cubicRatioTerm 0 3 1) v := by unfold cubicRatioTerm fun_prop have heq : Phi true = cubicRatioTerm 0 4 2 - cubicRatioTerm 0 3 1 := by funext y simp [Phi, cubicRatioTerm, div_eq_mul_inv] ring rw [heq, iteratedFDeriv_sub_apply hs2 hs1] change iteratedFDeriv ℝ 3 (cubicRatioTerm 0 4 2) v ![h, k, l] - iteratedFDeriv ℝ 3 (cubicRatioTerm 0 3 1) v ![h, k, l] = _ rw [ iteratedFDeriv_three_cubicRatioTerm 0 4 2 v h k l h2, iteratedFDeriv_three_cubicRatioTerm 0 3 1 v h k l h1] simp
CausalSmith.Stat.TransportCaceRoughnuisanceLength.iteratedFDeriv_three_Phi · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/CubicDerivative.lean:197
theorem iteratedFDeriv_two_Phi

Given the supplied inputs, the stated result about iterated fderiv two phi holds.

Formal statement
A :
h1 :
v 1 ≠ 0
h2 :
v 2 ≠ 0
iteratedFDeriv ℝ 2 (Phi A) v ![h, k]
= cubicRatioD2Apply 0 (if A then 4 else 6) 2 h k v
- cubicRatioD2Apply 0 (if A then 3 else 5) 1 h k v
Proof (Lean source)
lemma iteratedFDeriv_two_Phi (A : Bool) (v : DensityVector) (h k : DensityVector) (h1 : v 1 ≠ 0) (h2 : v 2 ≠ 0) : iteratedFDeriv ℝ 2 (Phi A) v ![h, k] = cubicRatioD2Apply 0 (if A then 4 else 6) 2 h k v - cubicRatioD2Apply 0 (if A then 3 else 5) 1 h k v := by cases A with | false => have hs2 : ContDiffAt ℝ 2 (cubicRatioTerm 0 6 2) v := by unfold cubicRatioTerm fun_prop have hs1 : ContDiffAt ℝ 2 (cubicRatioTerm 0 5 1) v := by unfold cubicRatioTerm fun_prop have heq : Phi false = cubicRatioTerm 0 6 2 - cubicRatioTerm 0 5 1 := by funext y simp [Phi, cubicRatioTerm, div_eq_mul_inv] ring rw [heq, iteratedFDeriv_sub_apply hs2 hs1] change iteratedFDeriv ℝ 2 (cubicRatioTerm 0 6 2) v ![h, k] - iteratedFDeriv ℝ 2 (cubicRatioTerm 0 5 1) v ![h, k] = _ rw [ iteratedFDeriv_two_cubicRatioTerm 0 6 2 v h k h2, iteratedFDeriv_two_cubicRatioTerm 0 5 1 v h k h1] simp | true => have hs2 : ContDiffAt ℝ 2 (cubicRatioTerm 0 4 2) v := by unfold cubicRatioTerm fun_prop have hs1 : ContDiffAt ℝ 2 (cubicRatioTerm 0 3 1) v := by unfold cubicRatioTerm fun_prop have heq : Phi true = cubicRatioTerm 0 4 2 - cubicRatioTerm 0 3 1 := by funext y simp [Phi, cubicRatioTerm, div_eq_mul_inv] ring rw [heq, iteratedFDeriv_sub_apply hs2 hs1] change iteratedFDeriv ℝ 2 (cubicRatioTerm 0 4 2) v ![h, k] - iteratedFDeriv ℝ 2 (cubicRatioTerm 0 3 1) v ![h, k] = _ rw [ iteratedFDeriv_two_cubicRatioTerm 0 4 2 v h k h2, iteratedFDeriv_two_cubicRatioTerm 0 3 1 v h k h1] simp
CausalSmith.Stat.TransportCaceRoughnuisanceLength.iteratedFDeriv_two_Phi · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/CubicDerivative.lean:242
theorem cubicRatioD2_basis_abs_le

The explicit second derivative of one marked ratio has a uniform coordinate bound. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
a b c i j :
Fin 7
C R :
ℝ
hC :
1 < C
hR :
1 < R
ha :
|v a| ≤ C
hb :
|v b| ≤ C
hc :
|(v c)⁻¹| ≤ R
|cubicRatioD2Apply a b c (basis i) (basis j) v| ≤ 24 * (1 + C) ^ 2 * R ^ 5
Proof (Lean source)
-- @node: cubicRatioD2_basis_abs_le lemma cubicRatioD2_basis_abs_le (a b c i j : Fin 7) (v : DensityVector) (C R : ℝ) (hC : 1 < C) (hR : 1 < R) (ha : |v a| ≤ C) (hb : |v b| ≤ C) (hc : |(v c)⁻¹| ≤ R) : |cubicRatioD2Apply a b c (basis i) (basis j) v| ≤ 24 * (1 + C) ^ 2 * R ^ 5 := by have hC0 : 0 ≤ C := by linarith have hR0 : 0 ≤ R := by linarith have hd (s r : Fin 7) : |basis s r| ≤ 1 := by by_cases hrs : r = s <;> simp [basis, hrs] have hpair : |basis i a * basis j b + basis j a * basis i b| ≤ 2 := by calc _ ≤ |basis i a| * |basis j b| + |basis j a| * |basis i b| := by simpa only [abs_mul] using abs_add_le (basis i a * basis j b) (basis j a * basis i b) _ ≤ 1 * 1 + 1 * 1 := by gcongr <;> apply hd _ = 2 := by norm_num have hlinear (s : Fin 7) : |basis s a * v b + v a * basis s b| ≤ 2 * C := by calc _ ≤ |basis s a| * |v b| + |v a| * |basis s b| := by simpa only [abs_mul] using abs_add_le (basis s a * v b) (v a * basis s b) _ ≤ 1 * C + C * 1 := by gcongr <;> first | apply hd | exact ha | exact hb _ = 2 * C := by ring have ht1 : |(basis i a * basis j b + basis j a * basis i b) * (v c)⁻¹| ≤ 2 * R := by rw [abs_mul] exact mul_le_mul hpair hc (abs_nonneg _) (by norm_num) have ht2 (s t : Fin 7) : |(basis s a * v b + v a * basis s b) * basis t c * (v c)⁻¹ ^ 2| ≤ 2 * C * R ^ 2 := by simp only [abs_mul, abs_pow] calc _ ≤ (2 * C) * 1 * R ^ 2 := by gcongr <;> first | apply hlinear | apply hd | exact hc _ = _ := by ring have ht4 : |2 * v a * v b * basis i c * basis j c * (v c)⁻¹ ^ 3| ≤ 2 * C ^ 2 * R ^ 3 := by simp only [abs_mul, abs_pow] norm_num have hp : (|v c| ^ 3)⁻¹ ≤ R ^ 3 := by simpa only [abs_inv, inv_pow] using pow_le_pow_left₀ (abs_nonneg _) hc 3 calc _ ≤ 2 * C * C * 1 * 1 * R ^ 3 := by gcongr <;> first | exact ha | exact hb | apply hd | exact hp _ = _ := by ring have hraw : |cubicRatioD2Apply a b c (basis i) (basis j) v| ≤ 2 * R + 4 * C * R ^ 2 + 2 * C ^ 2 * R ^ 3 := by unfold cubicRatioD2Apply calc _ ≤ |(basis i a * basis j b + basis j a * basis i b) * (v c)⁻¹ - (basis i a * v b + v a * basis i b) * basis j c * (v c)⁻¹ ^ 2 - (basis j a * v b + v a * basis j b) * basis i c * (v c)⁻¹ ^ 2| + |2 * v a * v b * basis i c * basis j c * (v c)⁻¹ ^ 3| := abs_add_le _ _ _ ≤ _ := by have hsub := abs_sub ((basis i a * basis j b + basis j a * basis i b) * (v c)⁻¹ - (basis i a * v b + v a * basis i b) * basis j c * (v c)⁻¹ ^ 2) ((basis j a * v b + v a * basis j b) * basis i c * (v c)⁻¹ ^ 2) have hsub' := abs_sub ((basis i a * basis j b + basis j a * basis i b) * (v c)⁻¹) ((basis i a * v b + v a * basis i b) * basis j c * (v c)⁻¹ ^ 2) linarith [ht2 i j, ht2 j i] have hp1 : R ≤ R ^ 5 := by simpa using pow_le_pow_right₀ hR.le (show 1 ≤ 5 by omega) have hp2 : R ^ 2 ≤ R ^ 5 := pow_le_pow_right₀ hR.le (by omega) have hp3 : R ^ 3 ≤ R ^ 5 := pow_le_pow_right₀ hR.le (by omega) have hC1 : 1 ≤ (1 + C) ^ 2 := by nlinarith have hC2 : C ≤ (1 + C) ^ 2 := by nlinarith [sq_nonneg C] have hC3 : C ^ 2 ≤ (1 + C) ^ 2 := by nlinarith have h1 := mul_le_mul hC1 hp1 hR0 (by positivity : 0 ≤ (1 + C) ^ 2) have h2 := mul_le_mul hC2 hp2 (by positivity) (by positivity : 0 ≤ (1 + C) ^ 2) have h3 := mul_le_mul hC3 hp3 (by positivity) (by positivity : 0 ≤ (1 + C) ^ 2) exact hraw.trans (by nlinarith [mul_nonneg (sq_nonneg (1 + C)) (by positivity : 0 ≤ R ^ 5)])
CausalSmith.Stat.TransportCaceRoughnuisanceLength.cubicRatioD2_basis_abs_le · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/CubicDerivative.lean:286
theorem dPhi2_abs_le

The second coordinate derivative has the same deterministic envelope as orders zero and one. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f :
ℝ
hf :
0 < c_f ∧ c_f < 1
hC :
1 < C_f
A :
v :
Fin 7 → ℝ
hv :
i j :
Fin 7
|iteratedFDeriv ℝ 2 (Phi A) v ![basis i, basis j]| ≤ fourthDerivativeEnvelope c_f C_f
Proof (Lean source)
-- @node: dPhi2_abs_le lemma dPhi2_abs_le (c_f C_f : ℝ) (hf : 0 < c_f ∧ c_f < 1) (hC : 1 < C_f) (A : Bool) (v : Fin 7 → ℝ) (hv : clippingRectangle c_f C_f v) (i j : Fin 7) : |iteratedFDeriv ℝ 2 (Phi A) v ![basis i, basis j]| ≤ fourthDerivativeEnvelope c_f C_f := by have ht : |v 0| ≤ C_f := by rw [abs_of_nonneg (le_trans hf.1.le hv.1.1)] exact hv.1.2 have hm (b : Fin 7) (hb : 3 ≤ b.val) : |v b| ≤ C_f := by have hbnd := hv.2.2.2 b hb rw [abs_of_nonneg hbnd.1] linarith [hbnd.2] have hq (c : Fin 7) (hc : c_f / 4 ≤ v c) : v c ≠ 0 ∧ |(v c)⁻¹| ≤ 4 / c_f := by have hpos : 0 < v c := by linarith refine ⟨ne_of_gt hpos, ?_⟩ rw [abs_of_nonneg (inv_pos.mpr hpos).le] calc (v c)⁻¹ ≤ (c_f / 4)⁻¹ := (inv_le_inv₀ hpos (div_pos hf.1 (by norm_num))).2 hc _ = 4 / c_f := by ring have h1 := hq 1 hv.2.1.1 have h2 := hq 2 hv.2.2.1.1 have hR : 1 < 4 / c_f := (lt_div_iff₀ hf.1).2 (by linarith [hf.2]) rw [iteratedFDeriv_two_Phi A v (basis i) (basis j) h1.1 h2.1] have hp := cubicRatioD2_basis_abs_le 0 (if A then 4 else 6) 2 i j v C_f (4 / c_f) hC hR ht (hm _ (by cases A <;> decide)) h2.2 have hn := cubicRatioD2_basis_abs_le 0 (if A then 3 else 5) 1 i j v C_f (4 / c_f) hC hR ht (hm _ (by cases A <;> decide)) h1.2 exact (abs_sub _ _).trans (by unfold fourthDerivativeEnvelope; linarith)
theorem cubicRatioD3_basis_abs_le

Given the supplied inputs, the stated result about cubic ratio d3 basis abs le holds.

Formal statement
a b c i j k :
Fin 7
C R :
ℝ
hC :
1 < C
hR :
1 < R
ha0 :
0 ≤ v a
haC :
v a ≤ C
hb0 :
0 ≤ v b
hbC :
v b ≤ C
hc0 :
0 < v c
hcR :
(v c)⁻¹ ≤ R
|cubicRatioD3Apply a b c (basis i) (basis j) (basis k) v| ≤ 24 * (1 + C) ^ 2 * R ^ 5
Proof (Lean source)
lemma cubicRatioD3_basis_abs_le (a b c i j k : Fin 7) (v : DensityVector) (C R : ℝ) (hC : 1 < C) (hR : 1 < R) (ha0 : 0 ≤ v a) (haC : v a ≤ C) (hb0 : 0 ≤ v b) (hbC : v b ≤ C) (hc0 : 0 < v c) (hcR : (v c)⁻¹ ≤ R) : |cubicRatioD3Apply a b c (basis i) (basis j) (basis k) v| ≤ 24 * (1 + C) ^ 2 * R ^ 5 := by have hdir (s r : Fin 7) : |basis s r| ≤ 1 := by by_cases hrs : r = s <;> simp [basis, hrs] have hi0 : 0 ≤ (v c)⁻¹ := (inv_pos.mpr hc0).le have hR0 : 0 ≤ R := le_trans (by norm_num) hR.le have haAbs : |v a| ≤ C := by simpa [abs_of_nonneg ha0] using haC have hbAbs : |v b| ≤ C := by simpa [abs_of_nonneg hb0] using hbC have hInvAbs : |(v c)⁻¹| ≤ R := by simpa [abs_of_nonneg hi0] using hcR have hs1 : |basis i a * basis j b + basis j a * basis i b| ≤ 2 := by calc _ ≤ |basis i a * basis j b| + |basis j a * basis i b| := abs_add_le _ _ _ ≤ 2 := by rw [abs_mul, abs_mul] have hia := hdir i a have hjb := hdir j b have hja := hdir j a have hib := hdir i b nlinarith [abs_nonneg (basis i a), abs_nonneg (basis j b), abs_nonneg (basis j a), abs_nonneg (basis i b), mul_nonneg (sub_nonneg.mpr hia) (abs_nonneg (basis j b)), mul_nonneg (sub_nonneg.mpr hjb) (abs_nonneg (basis i a)), mul_nonneg (sub_nonneg.mpr hja) (abs_nonneg (basis i b)), mul_nonneg (sub_nonneg.mpr hib) (abs_nonneg (basis j a))] have hs2 : |(basis i a * basis k b + basis k a * basis i b) * basis j c + (basis j a * basis k b + basis k a * basis j b) * basis i c| ≤ 4 := by calc _ ≤ |basis i a * basis k b + basis k a * basis i b| * |basis j c| + |basis j a * basis k b + basis k a * basis j b| * |basis i c| := by simpa only [abs_mul] using abs_add_le ((basis i a * basis k b + basis k a * basis i b) * basis j c) ((basis j a * basis k b + basis k a * basis j b) * basis i c) _ ≤ 4 := by have h1 : |basis i a * basis k b + basis k a * basis i b| ≤ 2 := by calc _ ≤ |basis i a * basis k b| + |basis k a * basis i b| := abs_add_le _ _ _ ≤ 2 := by rw [abs_mul, abs_mul] nlinarith [hdir i a, hdir k b, hdir k a, hdir i b, abs_nonneg (basis i a), abs_nonneg (basis k b), abs_nonneg (basis k a), abs_nonneg (basis i b)] have h2 : |basis j a * basis k b + basis k a * basis j b| ≤ 2 := by calc _ ≤ |basis j a * basis k b| + |basis k a * basis j b| := abs_add_le _ _ _ ≤ 2 := by rw [abs_mul, abs_mul] nlinarith [hdir j a, hdir k b, hdir k a, hdir j b, abs_nonneg (basis j a), abs_nonneg (basis k b), abs_nonneg (basis k a), abs_nonneg (basis j b)] nlinarith [hdir j c, hdir i c, abs_nonneg (basis j c), abs_nonneg (basis i c), mul_nonneg (sub_nonneg.mpr h1) (abs_nonneg (basis j c)), mul_nonneg (sub_nonneg.mpr h2) (abs_nonneg (basis i c))] have hpair (s : Fin 7) : |basis s a * v b + v a * basis s b| ≤ 2 * C := by calc _ ≤ |basis s a| * |v b| + |v a| * |basis s b| := by simpa only [abs_mul] using abs_add_le (basis s a * v b) (v a * basis s b) _ ≤ 2 * C := by have hC0 : 0 ≤ C := le_trans (by norm_num) hC.le nlinarith [hdir s a, hdir s b, abs_nonneg (basis s a), abs_nonneg (basis s b), haAbs, hbAbs, mul_nonneg (sub_nonneg.mpr (hdir s a)) (abs_nonneg (v b)), mul_nonneg (sub_nonneg.mpr hbAbs) (abs_nonneg (basis s a)), mul_nonneg (sub_nonneg.mpr haAbs) (abs_nonneg (basis s b)), mul_nonneg (sub_nonneg.mpr (hdir s b)) (abs_nonneg (v a))] have hraw : |cubicRatioD3Apply a b c (basis i) (basis j) (basis k) v| ≤ 6 * R ^ 2 + 12 * C * R ^ 3 + 6 * C ^ 2 * R ^ 4 := by unfold cubicRatioD3Apply have habs6 (x1 x2 x3 x4 x5 x6 : ℝ) : |x1 + x2 + x3 + x4 + x5 + x6| ≤ |x1| + |x2| + |x3| + |x4| + |x5| + |x6| := by calc _ ≤ |x1 + x2 + x3 + x4 + x5| + |x6| := abs_add_le _ _ _ ≤ (|x1 + x2 + x3 + x4| + |x5|) + |x6| := by gcongr; exact abs_add_le _ _ _ ≤ ((|x1 + x2 + x3| + |x4|) + |x5|) + |x6| := by gcongr; exact abs_add_le _ _ _ ≤ (((|x1 + x2| + |x3|) + |x4|) + |x5|) + |x6| := by gcongr; exact abs_add_le _ _ _ ≤ ((((|x1| + |x2|) + |x3|) + |x4|) + |x5|) + |x6| := by gcongr; exact abs_add_le _ _ _ = _ := by ring calc _ ≤ |-(basis i a * basis j b + basis j a * basis i b) * basis k c * (v c)⁻¹ ^ 2| + |((basis i a * basis k b + basis k a * basis i b) * basis j c + (basis j a * basis k b + basis k a * basis j b) * basis i c) * (v c)⁻¹ ^ 2| + |2 * (basis i a * v b + v a * basis i b) * basis j c * basis k c * (v c)⁻¹ ^ 3| + |2 * (basis j a * v b + v a * basis j b) * basis i c * basis k c * (v c)⁻¹ ^ 3| + |2 * (basis k a * v b + v a * basis k b) * basis i c * basis j c * (v c)⁻¹ ^ 3| + |6 * v a * v b * basis i c * basis j c * basis k c * (v c)⁻¹ ^ 4| := by calc _ = |(-(basis i a * basis j b + basis j a * basis i b) * basis k c * (v c)⁻¹ ^ 2) + (-((basis i a * basis k b + basis k a * basis i b) * basis j c + (basis j a * basis k b + basis k a * basis j b) * basis i c) * (v c)⁻¹ ^ 2) + (2 * (basis i a * v b + v a * basis i b) * basis j c * basis k c * (v c)⁻¹ ^ 3) + (2 * (basis j a * v b + v a * basis j b) * basis i c * basis k c * (v c)⁻¹ ^ 3) + (2 * (basis k a * v b + v a * basis k b) * basis i c * basis j c * (v c)⁻¹ ^ 3) + (-6 * v a * v b * basis i c * basis j c * basis k c * (v c)⁻¹ ^ 4)| := by congr 1 ring _ ≤ |-(basis i a * basis j b + basis j a * basis i b) * basis k c * (v c)⁻¹ ^ 2| + |-((basis i a * basis k b + basis k a * basis i b) * basis j c + (basis j a * basis k b + basis k a * basis j b) * basis i c) * (v c)⁻¹ ^ 2| + |2 * (basis i a * v b + v a * basis i b) * basis j c * basis k c * (v c)⁻¹ ^ 3| + |2 * (basis j a * v b + v a * basis j b) * basis i c * basis k c * (v c)⁻¹ ^ 3| + |2 * (basis k a * v b + v a * basis k b) * basis i c * basis j c * (v c)⁻¹ ^ 3| + |-6 * v a * v b * basis i c * basis j c * basis k c * (v c)⁻¹ ^ 4| := habs6 _ _ _ _ _ _ _ = _ := by rw [show -((basis i a * basis k b + basis k a * basis i b) * basis j c + (basis j a * basis k b + basis k a * basis j b) * basis i c) * (v c)⁻¹ ^ 2 = -(((basis i a * basis k b + basis k a * basis i b) * basis j c + (basis j a * basis k b + basis k a * basis j b) * basis i c) * (v c)⁻¹ ^ 2) by ring, abs_neg] rw [show -6 * v a * v b * basis i c * basis j c * basis k c * (v c)⁻¹ ^ 4 = -(6 * v a * v b * basis i c * basis j c * basis k c * (v c)⁻¹ ^ 4) by ring, abs_neg] _ ≤ 6 * R ^ 2 + 12 * C * R ^ 3 + 6 * C ^ 2 * R ^ 4 := by simp only [abs_mul, abs_neg, abs_pow] norm_num have hC0 : 0 ≤ C := le_trans (by norm_num) hC.le have hT1 : |basis i a * basis j b + basis j a * basis i b| * |basis k c| * |(v c)⁻¹| ^ 2 ≤ 2 * R ^ 2 := by have hp : |basis i a * basis j b + basis j a * basis i b| * |basis k c| ≤ 2 := by nlinarith [hs1, hdir k c, abs_nonneg (basis k c), mul_nonneg (sub_nonneg.mpr hs1) (abs_nonneg (basis k c)), mul_nonneg (sub_nonneg.mpr (hdir k c)) (abs_nonneg (basis i a * basis j b + basis j a * basis i b))] exact mul_le_mul hp (pow_le_pow_left₀ (abs_nonneg _) hInvAbs 2) (by positivity) (by positivity) have hT2 : |(basis i a * basis k b + basis k a * basis i b) * basis j c + (basis j a * basis k b + basis k a * basis j b) * basis i c| * |(v c)⁻¹| ^ 2 ≤ 4 * R ^ 2 := by exact mul_le_mul hs2 (pow_le_pow_left₀ (abs_nonneg _) hInvAbs 2) (by positivity) (by positivity) have hT3 (s t u : Fin 7) : 2 * |basis s a * v b + v a * basis s b| * |basis t c| * |basis u c| * |(v c)⁻¹| ^ 3 ≤ 4 * C * R ^ 3 := by have hp : 2 * |basis s a * v b + v a * basis s b| * |basis t c| * |basis u c| ≤ 4 * C := by have hp1 := mul_le_mul (hpair s) (hdir t c) (abs_nonneg (basis t c)) (by positivity : 0 ≤ 2 * C) have hp2 := mul_le_mul hp1 (hdir u c) (abs_nonneg (basis u c)) (by positivity : 0 ≤ 2 * C * 1) nlinarith exact mul_le_mul hp (pow_le_pow_left₀ (abs_nonneg _) hInvAbs 3) (by positivity) (by positivity) have hT4 : 6 * |v a| * |v b| * |basis i c| * |basis j c| * |basis k c| * |(v c)⁻¹| ^ 4 ≤ 6 * C ^ 2 * R ^ 4 := by have hp : 6 * |v a| * |v b| * |basis i c| * |basis j c| * |basis k c| ≤ 6 * C ^ 2 := by have hab := mul_le_mul haAbs hbAbs (abs_nonneg (v b)) (by positivity : 0 ≤ C) have habi := mul_le_mul hab (hdir i c) (abs_nonneg (basis i c)) (by positivity : 0 ≤ C * C) have habij := mul_le_mul habi (hdir j c) (abs_nonneg (basis j c)) (by positivity : 0 ≤ C * C * 1) have habijk := mul_le_mul habij (hdir k c) (abs_nonneg (basis k c)) (by positivity : 0 ≤ C * C * 1 * 1) nlinarith exact mul_le_mul hp (pow_le_pow_left₀ (abs_nonneg _) hInvAbs 4) (by positivity) (by positivity) have hsum := add_le_add (add_le_add (add_le_add (add_le_add (add_le_add hT1 hT2) (hT3 i j k)) (hT3 j i k)) (hT3 k i j)) hT4 have hsum' := hsum simp only [abs_inv, abs_of_pos hc0, inv_pow] at hsum' rw [abs_of_pos hc0] nlinarith calc _ ≤ 6 * R ^ 2 + 12 * C * R ^ 3 + 6 * C ^ 2 * R ^ 4 := hraw _ ≤ 24 * (1 + C) ^ 2 * R ^ 5 := by have hR2 : R ^ 2 ≤ R ^ 5 := pow_le_pow_right₀ hR.le (by omega) have hR3 : R ^ 3 ≤ R ^ 5 := pow_le_pow_right₀ hR.le (by omega) have hR4 : R ^ 4 ≤ R ^ 5 := pow_le_pow_right₀ hR.le (by omega) have hC0 : 0 ≤ C := le_trans (by norm_num) hC.le have hC_sq : C ^ 2 ≤ (1 + C) ^ 2 := by nlinarith have hC_lin : C ≤ (1 + C) ^ 2 := by nlinarith [sq_nonneg C] nlinarith [mul_le_mul_of_nonneg_left hR2 (by positivity : 0 ≤ 6 * (1 + C) ^ 2), mul_le_mul_of_nonneg_left hR3 (by positivity : 0 ≤ 12 * (1 + C) ^ 2), mul_le_mul hC_sq hR4 (by positivity) (by positivity)]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.cubicRatioD3_basis_abs_le · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/CubicDerivative.lean:387
theorem dPhi3_abs_le

Given the supplied inputs, the stated result about d phi3 abs le holds.

Formal statement
c_f C_f :
ℝ
hf :
0 < c_f ∧ c_f < 1
hC :
1 < C_f
A :
v :
Fin 7 → ℝ
hv :
i j k :
Fin 7
|iteratedFDeriv ℝ 3 (Phi A) v ![basis i, basis j, basis k]|
Proof (Lean source)
lemma dPhi3_abs_le (c_f C_f : ℝ) (hf : 0 < c_f ∧ c_f < 1) (hC : 1 < C_f) (A : Bool) (v : Fin 7 → ℝ) (hv : clippingRectangle c_f C_f v) (i j k : Fin 7) : |iteratedFDeriv ℝ 3 (Phi A) v ![basis i, basis j, basis k]| ≤ fourthDerivativeEnvelope c_f C_f := by rcases hv with ⟨hv0, hv1, hv2, hvmark⟩ have hC0 : 0 < C_f := lt_trans (by norm_num) hC have hv0nonneg : 0 ≤ v 0 := le_trans hf.1.le hv0.1 have hv1pos : 0 < v 1 := lt_of_lt_of_le (by nlinarith [hf.1]) hv1.1 have hv2pos : 0 < v 2 := lt_of_lt_of_le (by nlinarith [hf.1]) hv2.1 have hR : 1 < 4 / c_f := (lt_div_iff₀ hf.1).2 (by nlinarith [hf.2]) have hinv (q : ℝ) (hq : c_f / 4 ≤ q) : q⁻¹ ≤ 4 / c_f := by have hqpos : 0 < q := lt_of_lt_of_le (by nlinarith [hf.1]) hq calc q⁻¹ ≤ (c_f / 4)⁻¹ := (inv_le_inv₀ hqpos (by nlinarith [hf.1] : 0 < c_f / 4)).2 hq _ = 4 / c_f := by field_simp have hmarkC (r : Fin 7) (hr : 3 ≤ r.val) : 0 ≤ v r ∧ v r ≤ C_f := by have hrange := hvmark r hr exact ⟨hrange.1, le_trans hrange.2 (by nlinarith [hC0])⟩ have hterm (b c : Fin 7) (hb : 3 ≤ b.val) (hcpos : 0 < v c) (hclower : c_f / 4 ≤ v c) : |cubicRatioD3Apply 0 b c (basis i) (basis j) (basis k) v| ≤ 24 * (1 + C_f) ^ 2 * (4 / c_f) ^ 5 := by have hbnd := hmarkC b hb exact cubicRatioD3_basis_abs_le 0 b c i j k v C_f (4 / c_f) hC hR hv0nonneg hv0.2 hbnd.1 hbnd.2 hcpos (hinv (v c) hclower) have h1ne : v 1 ≠ 0 := ne_of_gt hv1pos have h2ne : v 2 ≠ 0 := ne_of_gt hv2pos rw [iteratedFDeriv_three_Phi A v (basis i) (basis j) (basis k) h1ne h2ne] cases A with | false => calc |cubicRatioD3Apply 0 6 2 (basis i) (basis j) (basis k) v - cubicRatioD3Apply 0 5 1 (basis i) (basis j) (basis k) v| ≤ |cubicRatioD3Apply 0 6 2 (basis i) (basis j) (basis k) v| + |cubicRatioD3Apply 0 5 1 (basis i) (basis j) (basis k) v| := abs_sub _ _ _ ≤ 48 * (1 + C_f) ^ 2 * (4 / c_f) ^ 5 := by nlinarith [hterm 6 2 (by norm_num) hv2pos hv2.1, hterm 5 1 (by norm_num) hv1pos hv1.1] _ = fourthDerivativeEnvelope c_f C_f := by rfl | true => calc |cubicRatioD3Apply 0 4 2 (basis i) (basis j) (basis k) v - cubicRatioD3Apply 0 3 1 (basis i) (basis j) (basis k) v| ≤ |cubicRatioD3Apply 0 4 2 (basis i) (basis j) (basis k) v| + |cubicRatioD3Apply 0 3 1 (basis i) (basis j) (basis k) v| := abs_sub _ _ _ ≤ 48 * (1 + C_f) ^ 2 * (4 / c_f) ^ 5 := by nlinarith [hterm 4 2 (by norm_num) hv2pos hv2.1, hterm 3 1 (by norm_num) hv1pos hv1.1] _ = fourthDerivativeEnvelope c_f C_f := by rfl
theorem pilot_mem_clippingRectangle

Given the supplied inputs, the stated result about pilot mem clipping rectangle holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hn :
threshold ≤ n
hP :
ModelClass c_f C_f L P n
w :
x :
ℝ
clippingRectangle c_f C_f (pilot c_f C_f w x)
Proof (Lean source)
lemma pilot_mem_clippingRectangle (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hn : threshold ≤ n) (hP : ModelClass c_f C_f L P n) (w : TwoSample n n) (x : ℝ) : clippingRectangle c_f C_f (pilot c_f C_f w x) := by have hc : 0 < c_f := hP.sourceBounds.1.1 have hC : 1 < C_f := hP.sourceBounds.2.1 have hcfC : c_f < C_f := lt_trans hP.sourceBounds.1.2 hC simp only [pilot, if_neg (Nat.not_lt_of_ge hn)] rw [clippingRectangle] constructor · simp [clipChannel, clip] linarith constructor · simp [clipChannel, clip] linarith constructor · simp [clipChannel, clip] linarith intro i hi fin_cases i <;> simp_all [clipChannel, clip] <;> linarith
CausalSmith.Stat.TransportCaceRoughnuisanceLength.pilot_mem_clippingRectangle · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/CubicDerivative.lean:632
CausalSmith.Stat.STAT_TransportCaceRoughnuisanceLength_Research.Helpers.CubicMse.CubicProjectionBias 6 declarations The cubic Taylor projection error is assembled from the exact cell errors.

Exact spatial cubic projection bias

The cubic Taylor projection error is assembled from the exact cell errors. Nested pilot cells identify it with the spatial Taylor term minus the exact conditional mean, retaining all seven coordinates and the factor one sixth.

def cubicCellProjectionBias

The exact cubic projection error summed over coordinates and cells. For the displayed assumptions and inputs, the stated object is defined.

Definition (Lean source)
c_f C_f L :
ℝ
n K :
ℕ
hP :
ModelClass c_f C_f L P n
ω :
A :
cubicCellProjectionBias c_f C_f L P n K hP ω A :
ℝ
F :
markedDensityVector c_f C_f L P n hP
∑ i : Fin 7, ∑ j : Fin 7, ∑ k : Fin 7, ∑ l : Fin K, let t := pilot c_f C_f ω (midpoint K l) let a := fun q
=> cellAverage (fun y => F y q) K l ∫ x in cell K l, (dPhi3 A t i j k / 6) * ((F x i - t i) * (F x j - t j) * (F x k - t k) - (a i - t i) * (a j - t j) * (a k - t k))
CausalSmith.Stat.TransportCaceRoughnuisanceLength.cubicCellProjectionBias · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/CubicProjectionBias.lean:16
theorem cubicCellProjectionBias_eq_sub_projectionMean

The midpoint cell sum is the exact cubic Taylor term minus the projection polynomial appearing in the conditional mean. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hP :
ModelClass c_f C_f L P n
ω :
A :
cubicCellProjectionBias c_f C_f L P n (cubicResolution n) hP ω A
= (∑ i : Fin 7, ∑ j : Fin 7, ∑ k : Fin 7, ∑ l : Fin (cubicResolution n), ∫ x in cell (cubicResolution n) l, (dPhi3 A (pilot c_f C_f ω (midpoint (cubicResolution n) l)) i j k / 6) * (markedDensityVector c_f C_f L P n hP x i - pilot c_f C_f ω (midpoint (cubicResolution n) l) i) * (markedDensityVector c_f C_f L P n hP x j - pilot c_f C_f ω (midpoint (cubicResolution n) l) j) * (markedDensityVector c_f C_f L P n hP x k - pilot c_f C_f ω (midpoint (cubicResolution n) l) k))
- cubicProjectionMean c_f C_f L P n hP ω A
Proof (Lean source)
-- @node: cubicCellProjectionBias_eq_sub_projectionMean lemma cubicCellProjectionBias_eq_sub_projectionMean (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hP : ModelClass c_f C_f L P n) (ω : TwoSample n n) (A : Bool) : cubicCellProjectionBias c_f C_f L P n (cubicResolution n) hP ω A = (∑ i : Fin 7, ∑ j : Fin 7, ∑ k : Fin 7, ∑ l : Fin (cubicResolution n), ∫ x in cell (cubicResolution n) l, (dPhi3 A (pilot c_f C_f ω (midpoint (cubicResolution n) l)) i j k / 6) * (markedDensityVector c_f C_f L P n hP x i - pilot c_f C_f ω (midpoint (cubicResolution n) l) i) * (markedDensityVector c_f C_f L P n hP x j - pilot c_f C_f ω (midpoint (cubicResolution n) l) j) * (markedDensityVector c_f C_f L P n hP x k - pilot c_f C_f ω (midpoint (cubicResolution n) l) k)) - cubicProjectionMean c_f C_f L P n hP ω A := by classical let K := cubicResolution n let F := markedDensityVector c_f C_f L P n hP have hK : 0 < K := by dsimp [K] unfold cubicResolution dyadicResolution split_ifs <;> positivity have hcell (i j k : Fin 7) (l : Fin K) (ti tj tk c : ℝ) : (∫ x in cell K l, c * ((F x i - ti) * (F x j - tj) * (F x k - tk) - (cellAverage (fun y => F y i) K l - ti) * (cellAverage (fun y => F y j) K l - tj) * (cellAverage (fun y => F y k) K l - tk))) = (∫ x in cell K l, c * (F x i - ti) * (F x j - tj) * (F x k - tk)) - (K : ℝ)⁻¹ * (c * (cellAverage (fun y => F y i) K l - ti) * (cellAverage (fun y => F y j) K l - tj) * (cellAverage (fun y => F y k) K l - tk)) := by have hi := markedDensityVector_continuousOn c_f C_f L P n hP i have hj := markedDensityVector_continuousOn c_f C_f L P n hP j have hk := markedDensityVector_continuousOn c_f C_f L P n hP k have hint : IntegrableOn (fun x => c * (F x i - ti) * (F x j - tj) * (F x k - tk)) (cell K l) := (show ContinuousOn _ covariateSpace by dsimp [F]; fun_prop).integrableOn_Icc.mono_set (cell_subset_covariateSpace hK l) have hfinite : volume (cell K l) ≠ ⊤ := by rw [volume_cell hK l] exact ENNReal.ofReal_ne_top conv_lhs => arg 2; ext x; rw [mul_sub, ← mul_assoc, ← mul_assoc, ← mul_assoc] rw [integral_sub hint (integrableOn_const hfinite)] rw [setIntegral_const, Measure.real, volume_cell hK l, ENNReal.toReal_ofReal (by positivity)] simp only [smul_eq_mul, one_div] ring dsimp only [K, F] at hcell rw [cubicProjectionMean_eq] unfold cubicCellProjectionBias dsimp only simp_rw [hcell, Finset.sum_sub_distrib, ← Finset.mul_sum] congr 1 congr 1 apply Finset.sum_congr rfl intro i hi apply Finset.sum_congr rfl intro j hj apply Finset.sum_congr rfl intro k hk apply Finset.sum_congr rfl intro l hl ring
CausalSmith.Stat.TransportCaceRoughnuisanceLength.cubicCellProjectionBias_eq_sub_projectionMean · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/CubicProjectionBias.lean:31
theorem cubicCellProjectionBias_eq_spatial_sub_projectionMean

Nested pilot constancy identifies the cubic cell bias with the true spatial cubic Taylor term minus its exact conditional projection mean. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hP :
ModelClass c_f C_f L P n
ω :
A :
cubicCellProjectionBias c_f C_f L P n (cubicResolution n) hP ω A
= (∑ i : Fin 7, ∑ j : Fin 7, ∑ k : Fin 7, ∫ x in covariateSpace, (dPhi3 A (pilot c_f C_f ω x) i j k / 6) * (markedDensityVector c_f C_f L P n hP x i - pilot c_f C_f ω x i) * (markedDensityVector c_f C_f L P n hP x j - pilot c_f C_f ω x j) * (markedDensityVector c_f C_f L P n hP x k - pilot c_f C_f ω x k))
- cubicProjectionMean c_f C_f L P n hP ω A
Proof (Lean source)
-- @node: cubicCellProjectionBias_eq_spatial_sub_projectionMean lemma cubicCellProjectionBias_eq_spatial_sub_projectionMean (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hP : ModelClass c_f C_f L P n) (ω : TwoSample n n) (A : Bool) : cubicCellProjectionBias c_f C_f L P n (cubicResolution n) hP ω A = (∑ i : Fin 7, ∑ j : Fin 7, ∑ k : Fin 7, ∫ x in covariateSpace, (dPhi3 A (pilot c_f C_f ω x) i j k / 6) * (markedDensityVector c_f C_f L P n hP x i - pilot c_f C_f ω x i) * (markedDensityVector c_f C_f L P n hP x j - pilot c_f C_f ω x j) * (markedDensityVector c_f C_f L P n hP x k - pilot c_f C_f ω x k)) - cubicProjectionMean c_f C_f L P n hP ω A := by classical have hK : 0 < cubicResolution n := by unfold cubicResolution dyadicResolution split_ifs <;> positivity have hterm (i j k : Fin 7) := spatial_pilot_monomial_eq_cell_sum c_f C_f hK (pilotResolution_dvd_correctionResolutions n).2 ω (markedDensityVector c_f C_f L P n hP) (markedDensityVector_continuousOn c_f C_f L P n hP) (fun v => dPhi3 A v i j k / 6) ![i, j, k] simp [Fin.prod_univ_three] at hterm simp_rw [← mul_assoc] at hterm rw [cubicCellProjectionBias_eq_sub_projectionMean] simp_rw [hterm]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.cubicCellProjectionBias_eq_spatial_sub_projectionMean · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/CubicProjectionBias.lean:98
theorem pilot_error_cell_L1_sum_eq

Summing midpoint-frozen cellwise pilot errors gives their exact spatial L1 norm. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f :
ℝ
n K :
ℕ
hK :
0 < K
hdiv :
ω :
F :
ℝ → ℝ
i :
Fin 7
(∑ l : Fin K, ∫ x in cell K l, |F x - pilot c_f C_f ω (midpoint K l) i|)
= ∫ x in covariateSpace, |F x - pilot c_f C_f ω x i|
Proof (Lean source)
-- @node: pilot_error_cell_L1_sum_eq lemma pilot_error_cell_L1_sum_eq (c_f C_f : ℝ) {n K : ℕ} (hK : 0 < K) (hdiv : pilotResolution n ∣ K) (ω : TwoSample n n) (F : ℝ → ℝ) (hF : ContinuousOn F covariateSpace) (i : Fin 7) : (∑ l : Fin K, ∫ x in cell K l, |F x - pilot c_f C_f ω (midpoint K l) i|) = ∫ x in covariateSpace, |F x - pilot c_f C_f ω x i| := by classical let f := fun x => |F x - pilot c_f C_f ω x i| let g := fun (l : Fin K) x => |F x - pilot c_f C_f ω (midpoint K l) i| have heq (l : Fin K) : EqOn f (g l) (cell K l) := by intro x hx dsimp [f, g] rw [pilot_eq_midpoint_of_refinement c_f C_f hK hdiv ω l hx] have hi (l : Fin K) : IntegrableOn f (cell K l) := by have hg : ContinuousOn (g l) covariateSpace := by dsimp [g] fun_prop exact (integrableOn_congr_fun (heq l) (measurableSet_cell K l)).2 (hg.integrableOn_Icc.mono_set (cell_subset_covariateSpace hK l)) change (∑ l : Fin K, ∫ x in cell K l, g l x) = ∫ x in covariateSpace, f x rw [← iUnion_cell_eq_covariateSpace hK, integral_iUnion_fintype (fun l => measurableSet_cell K l) (fun l r hlr => cell_disjoint hK hlr) hi] apply Finset.sum_congr rfl intro l _ exact (setIntegral_congr_fun (measurableSet_cell K l) (heq l)).symm
CausalSmith.Stat.TransportCaceRoughnuisanceLength.pilot_error_cell_L1_sum_eq · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/CubicProjectionBias.lean:125
theorem cubicCellProjectionBias_abs_le_L1

Roadmap (12): after exact single-residual cancellation, the global cubic bias retains the pilot L1 error, with the constants C1 and C2 of the paper. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n K :
ℕ
hn :
threshold ≤ n
hP :
ModelClass c_f C_f L P n
hK :
0 < K
hdiv :
ω :
A :
B :
3 * (1 + C_f) * L * (1 / (K : ℝ)) ^ holderExponent
|cubicCellProjectionBias c_f C_f L P n K hP ω A|
≤ (fourthDerivativeEnvelope c_f C_f / 2) * (7 : ℝ) ^ 2 * B ^ 2 * (∑ i : Fin 7, ∫ x in covariateSpace, |markedDensityVector c_f C_f L P n hP x i - pilot c_f C_f ω x i|)
+ (fourthDerivativeEnvelope c_f C_f / 6) * (7 : ℝ) ^ 3 * B ^ 3
Proof (Lean source)
-- @node: cubicCellProjectionBias_abs_le_L1 lemma cubicCellProjectionBias_abs_le_L1 (c_f C_f L : ℝ) (P : TransportLaw) (n K : ℕ) (hn : threshold ≤ n) (hP : ModelClass c_f C_f L P n) (hK : 0 < K) (hdiv : pilotResolution n ∣ K) (ω : TwoSample n n) (A : Bool) : let B := 3 * (1 + C_f) * L * (1 / (K : ℝ)) ^ holderExponent |cubicCellProjectionBias c_f C_f L P n K hP ω A| ≤ (fourthDerivativeEnvelope c_f C_f / 2) * (7 : ℝ) ^ 2 * B ^ 2 * (∑ i : Fin 7, ∫ x in covariateSpace, |markedDensityVector c_f C_f L P n hP x i - pilot c_f C_f ω x i|) + (fourthDerivativeEnvelope c_f C_f / 6) * (7 : ℝ) ^ 3 * B ^ 3 := by classical dsimp only let B := 3 * (1 + C_f) * L * (1 / (K : ℝ)) ^ holderExponent let M := fourthDerivativeEnvelope c_f C_f let E := fun (i : Fin 7) (l : Fin K) => ∫ x in cell K l, |markedDensityVector c_f C_f L P n hP x i - pilot c_f C_f ω (midpoint K l) i| have hKr : (K : ℝ) ≠ 0 := by exact_mod_cast (Nat.ne_of_gt hK) have he (i : Fin 7) := pilot_error_cell_L1_sum_eq c_f C_f hK hdiv ω (fun x => markedDensityVector c_f C_f L P n hP x i) (markedDensityVector_continuousOn c_f C_f L P n hP i) i unfold cubicCellProjectionBias dsimp only calc _ ≤ ∑ i : Fin 7, ∑ j : Fin 7, ∑ k : Fin 7, ∑ l : Fin K, (M / 6) * (B ^ 2 * (E i l + E j l + E k l) + B ^ 3 / (K : ℝ)) := by apply (Finset.abs_sum_le_sum_abs _ _).trans apply Finset.sum_le_sum intro i _ apply (Finset.abs_sum_le_sum_abs _ _).trans apply Finset.sum_le_sum intro j _ apply (Finset.abs_sum_le_sum_abs _ _).trans apply Finset.sum_le_sum intro k _ apply (Finset.abs_sum_le_sum_abs _ _).trans apply Finset.sum_le_sum intro l _ exact cubic_midpoint_cell_projection_L1_bound c_f C_f L P n K hn hP hK ω A l i j k _ = _ := by simp only [mul_add, Finset.sum_add_distrib, ← Finset.mul_sum] simp only [Finset.sum_const, Finset.card_univ, Fintype.card_fin, nsmul_eq_mul] simp_rw [show ∀ i, (∑ l : Fin K, E i l) = ∫ x in covariateSpace, |markedDensityVector c_f C_f L P n hP x i - pilot c_f C_f ω x i| from he] simp only [← Finset.mul_sum] dsimp [M, B] field_simp ring
CausalSmith.Stat.TransportCaceRoughnuisanceLength.cubicCellProjectionBias_abs_le_L1 · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/CubicProjectionBias.lean:154
theorem cubic_spatial_projection_bias_abs_le_L1

The pilot-sensitive roadmap (12) bound applies to the spatial cubic Taylor term and the exact projection mean, without extra premises. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hn :
threshold ≤ n
hP :
ModelClass c_f C_f L P n
ω :
A :
B :
3 * (1 + C_f) * L * (1 / (cubicResolution n : ℝ)) ^ holderExponent
|(∑ i : Fin 7, ∑ j : Fin 7, ∑ k : Fin 7, ∫ x in covariateSpace, (dPhi3 A (pilot c_f C_f ω x) i j k / 6) * (markedDensityVector c_f C_f L P n hP x i - pilot c_f C_f ω x i) * (markedDensityVector c_f C_f L P n hP x j - pilot c_f C_f ω x j) * (markedDensityVector c_f C_f L P n hP x k - pilot c_f C_f ω x k))
- cubicProjectionMean c_f C_f L P n hP ω A|
≤ (fourthDerivativeEnvelope c_f C_f / 2) * (7 : ℝ) ^ 2 * B ^ 2 * (∑ i : Fin 7, ∫ x in covariateSpace, |markedDensityVector c_f C_f L P n hP x i - pilot c_f C_f ω x i|)
+ (fourthDerivativeEnvelope c_f C_f / 6) * (7 : ℝ) ^ 3 * B ^ 3
Proof (Lean source)
-- @node: cubic_spatial_projection_bias_abs_le_L1 lemma cubic_spatial_projection_bias_abs_le_L1 (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hn : threshold ≤ n) (hP : ModelClass c_f C_f L P n) (ω : TwoSample n n) (A : Bool) : let B := 3 * (1 + C_f) * L * (1 / (cubicResolution n : ℝ)) ^ holderExponent |(∑ i : Fin 7, ∑ j : Fin 7, ∑ k : Fin 7, ∫ x in covariateSpace, (dPhi3 A (pilot c_f C_f ω x) i j k / 6) * (markedDensityVector c_f C_f L P n hP x i - pilot c_f C_f ω x i) * (markedDensityVector c_f C_f L P n hP x j - pilot c_f C_f ω x j) * (markedDensityVector c_f C_f L P n hP x k - pilot c_f C_f ω x k)) - cubicProjectionMean c_f C_f L P n hP ω A| ≤ (fourthDerivativeEnvelope c_f C_f / 2) * (7 : ℝ) ^ 2 * B ^ 2 * (∑ i : Fin 7, ∫ x in covariateSpace, |markedDensityVector c_f C_f L P n hP x i - pilot c_f C_f ω x i|) + (fourthDerivativeEnvelope c_f C_f / 6) * (7 : ℝ) ^ 3 * B ^ 3 := by dsimp only rw [← cubicCellProjectionBias_eq_spatial_sub_projectionMean] have hK : 0 < cubicResolution n := by unfold cubicResolution dyadicResolution split_ifs <;> positivity exact cubicCellProjectionBias_abs_le_L1 c_f C_f L P n (cubicResolution n) hn hP hK (pilotResolution_dvd_correctionResolutions n).2 ω A
CausalSmith.Stat.TransportCaceRoughnuisanceLength.cubic_spatial_projection_bias_abs_le_L1 · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/CubicProjectionBias.lean:207
CausalSmith.Stat.STAT_TransportCaceRoughnuisanceLength_Research.Helpers.CubicMse.CubicResolution 2 declarations Elementary bounds for the cubic dyadic resolution

Elementary bounds for the cubic dyadic resolution

theorem cubicResolution_le_blockSize

Given the supplied inputs, the stated result about cubic resolution le block size holds.

Formal statement
n :
ℕ
hn :
threshold ≤ n
Proof (Lean source)
lemma cubicResolution_le_blockSize (n : ℕ) (hn : threshold ≤ n) : cubicResolution n ≤ blockSize n 0 := by have hnpos : (0 : ℝ) < n := by norm_num [threshold] at hn exact_mod_cast (show 0 < n by omega) have hm_lower := block_size_lower n hn 0 have hmpos : (0 : ℝ) < blockSize n 0 := lt_of_lt_of_le (div_pos hnpos (by norm_num)) hm_lower have hm_one : (1 : ℝ) ≤ blockSize n 0 := by norm_num [threshold] at hn norm_num [blockSize] omega have hlogm : 0 ≤ log (blockSize n 0 : ℝ) := Real.log_nonneg hm_one have hlog2 : 0 < log 2 := Real.log_pos (by norm_num) let q : ℝ := log (blockSize n 0 : ℝ) / log 2 have hq : 0 ≤ q := div_nonneg hlogm hlog2.le have hfloor : ((Nat.floor q : ℕ) : ℝ) ≤ q := Nat.floor_le hq have hrpow : (2 : ℝ) ^ ((Nat.floor q : ℕ) : ℝ) ≤ (2 : ℝ) ^ q := Real.rpow_le_rpow_of_exponent_le (by norm_num) hfloor have hpowq : (2 : ℝ) ^ q = blockSize n 0 := by rw [Real.rpow_def_of_pos (by norm_num : (0 : ℝ) < 2)] rw [show log 2 * q = log (blockSize n 0 : ℝ) by dsimp [q] field_simp] exact Real.exp_log hmpos unfold cubicResolution dyadicResolution simp only [if_neg (Nat.not_lt_of_ge hn)] simp only [one_mul] change 2 ^ Nat.floor q ≤ blockSize n 0 have hcast : ((2 ^ Nat.floor q : ℕ) : ℝ) ≤ (blockSize n 0 : ℝ) := by rw [Nat.cast_pow, Nat.cast_ofNat, ← Real.rpow_natCast] exact hrpow.trans_eq hpowq exact_mod_cast hcast
CausalSmith.Stat.TransportCaceRoughnuisanceLength.cubicResolution_le_blockSize · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/CubicResolution.lean:9
theorem cubicResolution_le_n

Given the supplied inputs, the stated result about cubic resolution le n holds.

Formal statement
n :
ℕ
hn :
threshold ≤ n
Proof (Lean source)
lemma cubicResolution_le_n (n : ℕ) (hn : threshold ≤ n) : cubicResolution n ≤ n := by exact (cubicResolution_le_blockSize n hn).trans (by simp only [blockSize] omega)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.cubicResolution_le_n · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/CubicResolution.lean:44
CausalSmith.Stat.STAT_TransportCaceRoughnuisanceLength_Research.Helpers.CubicMse.CubicVariance 3 declarations Constants for the cubic conditional variance calculation

Constants for the cubic conditional variance calculation

def cubicVarianceConstant

The cubic variance constant object is defined from the supplied inputs.

Definition (Lean source)
c_f C_f :
ℝ
cubicVarianceConstant c_f C_f :
ℝ
d :
7 (: ℝ)
U :
2 * (1 + C_f)
V :
1 + C_f + C_f ^ 2
d ^ 6 * (2 ^ (3 : ℕ) - 1) ^ 2 * M ^ 2 * (1 + U) ^ 6 * (1 + V) ^ 3
CausalSmith.Stat.TransportCaceRoughnuisanceLength.cubicVarianceConstant · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/CubicVariance.lean:15
theorem cubic_conditional_variance_with_memLp

Given the supplied inputs, the stated result about cubic conditional variance with mem lp holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hn :
threshold ≤ n
hP :
ModelClass c_f C_f L P n
A :
conclusion 1
MemLp (fun ξ : TwoSample n n => cubicTerm c_f C_f ξ A) 2 (dataLaw P n n)
conclusion 2
∀ᵐ ω ∂dataLaw P n n, condExp (trainingSigma n) (dataLaw P n n) (fun ξ : TwoSample n n => (cubicTerm c_f C_f ξ A - condExp (trainingSigma n) (dataLaw P n n) (fun ζ : TwoSample n n => cubicTerm c_f C_f ζ A) ξ) ^ 2) ω
≤ cubicVarianceConstant c_f C_f * ((n : ℝ) ^ (-1 : ℝ) + (cubicResolution n : ℝ) * (n : ℝ) ^ (-2 : ℝ) + (cubicResolution n : ℝ) ^ 2 * (n : ℝ) ^ (-3 : ℝ))
Proof (Lean source)
lemma cubic_conditional_variance_with_memLp (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hn : threshold ≤ n) (hP : ModelClass c_f C_f L P n) (A : Bool) : MemLp (fun ξ : TwoSample n n => cubicTerm c_f C_f ξ A) 2 (dataLaw P n n) ∧ (∀ᵐ ω ∂dataLaw P n n, condExp (trainingSigma n) (dataLaw P n n) (fun ξ : TwoSample n n => (cubicTerm c_f C_f ξ A - condExp (trainingSigma n) (dataLaw P n n) (fun ζ : TwoSample n n => cubicTerm c_f C_f ζ A) ξ) ^ 2) ω ≤ cubicVarianceConstant c_f C_f * ((n : ℝ) ^ (-1 : ℝ) + (cubicResolution n : ℝ) * (n : ℝ) ^ (-2 : ℝ) + (cubicResolution n : ℝ) ^ 2 * (n : ℝ) ^ (-3 : ℝ))) := by classical let K := cubicResolution n have hK : 0 < K := by dsimp [K, cubicResolution, dyadicResolution] split_ifs <;> positivity have hnpos : (0 : ℝ) < n := by exact_mod_cast (show 0 < n by norm_num [threshold] at hn; omega) let E := sumPiEquivProdPi (FlatObs n) have hEembed : @MeasurableEmbedding (TwoSample n n) ((a : FlatIndex n) → FlatObs n a) inferInstance MeasurableSpace.pi (flattenSample n) := by exact (sumPiEquivProdPi (FlatObs n)).symm.measurableEmbedding let μ := Measure.pi (flatLaw P n) let m := comap (finsetCoordProj (Ω := FlatObs n) (flatBlock n 0)) MeasurableSpace.pi let M := fourthDerivativeEnvelope c_f C_f let U := 2 * (1 + C_f) let V := 1 + C_f + C_f ^ 2 let C := M * (1 + U) ^ 2 / 6 let R := (n : ℝ) ^ (-1 : ℝ) + (K : ℝ) * (n : ℝ) ^ (-2 : ℝ) + (K : ℝ) ^ 2 * (n : ℝ) ^ (-3 : ℝ) let B := M ^ 2 * (1 + U) ^ 6 * (1 + V) ^ 3 * R let shift (i : Fin 7) (l : Fin K) (z : (a : FlatIndex n) → FlatObs n a) := cellAverage (fun y => markedDensityVector c_f C_f L P n hP y i) K l - pilot c_f C_f (E z) (midpoint K l) i let coeff (q : Fin 7 × Fin 7 × Fin 7 × Fin 7) (l : Fin K) (z : (a : FlatIndex n) → FlatObs n a) := let a := (1 / 6 : ℝ) * dPhi3 A (pilot c_f C_f (E z) (midpoint K l)) q.2.1 q.2.2.1 q.2.2.2 ![a, a * shift q.2.1 l z, a * shift q.2.2.1 l z, a * shift q.2.2.2 l z, a * shift q.2.1 l z * shift q.2.2.1 l z, a * shift q.2.1 l z * shift q.2.2.2 l z, a * shift q.2.2.1 l z * shift q.2.2.2 l z] q.1 let leaf (q : Fin 7 × Fin 7 × Fin 7 × Fin 7) (l : Fin K) (z : (a : FlatIndex n) → FlatObs n a) := ![flatCenteredCubicCell P ![q.2.1, q.2.2.1, q.2.2.2] l z, flatCenteredPairCell P ![q.2.2.1, q.2.2.2] ![1, 2] l z, flatCenteredPairCell P ![q.2.1, q.2.2.2] ![0, 2] l z, flatCenteredPairCell P ![q.2.1, q.2.2.1] ![0, 1] l z, flatCenteredCellScore P q.2.2.2 3 l (finsetCoordProj (flatBlock n 3) z), flatCenteredCellScore P q.2.2.1 2 l (finsetCoordProj (flatBlock n 2) z), flatCenteredCellScore P q.2.1 1 l (finsetCoordProj (flatBlock n 1) z)] q.1 let Y (q : Fin 7 × Fin 7 × Fin 7 × Fin 7) (z : (a : FlatIndex n) → FlatObs n a) := (K : ℝ)⁻¹ * ∑ l : Fin K, coeff q l z * leaf q l z let Z (z : (a : FlatIndex n) → FlatObs n a) := ∑ q : Fin 7 × Fin 7 × Fin 7 × Fin 7, Y q z let G (z : (a : FlatIndex n) → FlatObs n a) := (K : ℝ)⁻¹ * ∑ i : Fin 7, ∑ j : Fin 7, ∑ k : Fin 7, ∑ l : Fin K, (1 / 6 : ℝ) * dPhi3 A (pilot c_f C_f (E z) (midpoint K l)) i j k * shift i l z * shift j l z * shift k l z let F (z : (a : FlatIndex n) → FlatObs n a) := cubicTerm c_f C_f (E z) A letI : ∀ a, StandardBorelSpace (FlatObs n a) := fun a => by cases a <;> dsimp [FlatObs] <;> infer_instance letI : ∀ a, IsProbabilityMeasure (flatLaw P n a) := fun a => flatLaw_isProbabilityMeasure c_f C_f L P n hP a have hm : m ≤ (MeasurableSpace.pi : MeasurableSpace ((a : FlatIndex n) → FlatObs n a)) := by dsimp [m] exact (measurable_finsetCoordProj (Ω := FlatObs n) (flatBlock n 0)).comap_le have hM : 0 ≤ M := by dsimp [M, fourthDerivativeEnvelope] have hc : 0 < c_f := hP.sourceBounds.1.1 positivity have hU : 0 ≤ U := by dsimp [U] have := hP.sourceBounds.2.1 positivity have hV : 0 ≤ V := by dsimp [V] nlinarith [sq_nonneg C_f] have hC : 0 ≤ C := by dsimp [C]; positivity have hcoeff_meas (q : Fin 7 × Fin 7 × Fin 7 × Fin 7) (l : Fin K) : StronglyMeasurable[m] (coeff q l) := by rcases q with ⟨t, i, j, k⟩ have hd := stronglyMeasurable_dPhi3_pilot_flatTraining c_f C_f L P n hn hP A (midpoint K l) i j k have hs (r : Fin 7) : StronglyMeasurable[m] (shift r l) := stronglyMeasurable_const.sub (stronglyMeasurable_pilot_eval_flatTraining c_f C_f n (midpoint K l) r) fin_cases t all_goals change StronglyMeasurable[m] _ dsimp only [coeff] · exact hd.const_mul (1 / 6) · exact (hd.const_mul (1 / 6)).mul (hs i) · exact (hd.const_mul (1 / 6)).mul (hs j) · exact (hd.const_mul (1 / 6)).mul (hs k) · exact ((hd.const_mul (1 / 6)).mul (hs i)).mul (hs j) · exact ((hd.const_mul (1 / 6)).mul (hs i)).mul (hs k) · exact ((hd.const_mul (1 / 6)).mul (hs j)).mul (hs k) have hcoeff (q : Fin 7 × Fin 7 × Fin 7 × Fin 7) : ∀ᵐ z ∂μ, ∀ l, |coeff q l z| ≤ C := by filter_upwards [] with z intro l rcases q with ⟨t, i, j, k⟩ have hd := dPhi3_abs_le c_f C_f hP.sourceBounds.1 hP.sourceBounds.2.1 A (pilot c_f C_f (E z) (midpoint K l)) (pilot_mem_clippingRectangle c_f C_f L P n hn hP (E z) (midpoint K l)) i j k have hsi := abs_trainingShift_le c_f C_f L P n K hn hP hK (E z) l i have hsj := abs_trainingShift_le c_f C_f L P n K hn hP hK (E z) l j have hsk := abs_trainingShift_le c_f C_f L P n K hn hP hK (E z) l k change |dPhi3 A (pilot c_f C_f (E z) (midpoint K l)) i j k| ≤ M at hd change |shift i l z| ≤ U at hsi change |shift j l z| ≤ U at hsj change |shift k l z| ≤ U at hsk have h16 : (0 : ℝ) ≤ 1 / 6 := by norm_num have hbase : |(1 / 6 : ℝ) * dPhi3 A (pilot c_f C_f (E z) (midpoint K l)) i j k| ≤ M / 6 := by rw [abs_mul, abs_of_nonneg h16] exact (mul_le_mul_of_nonneg_left hd h16).trans_eq (by ring) have h0 : M / 6 ≤ C := by dsimp [C] nlinarith [mul_nonneg hM hU, sq_nonneg U] have h1 : M / 6 * U ≤ C := by dsimp [C] nlinarith [mul_nonneg hM hU, mul_nonneg hM (sq_nonneg U)] have h2 : M / 6 * U * U ≤ C := by dsimp [C] nlinarith [mul_nonneg hM hU] fin_cases t · exact hbase.trans h0 · change |(1 / 6 : ℝ) * dPhi3 A (pilot c_f C_f (E z) (midpoint K l)) i j k * shift i l z| ≤ C rw [abs_mul]; exact (mul_le_mul hbase hsi (abs_nonneg _) (by positivity)).trans h1 · change |(1 / 6 : ℝ) * dPhi3 A (pilot c_f C_f (E z) (midpoint K l)) i j k * shift j l z| ≤ C rw [abs_mul]; exact (mul_le_mul hbase hsj (abs_nonneg _) (by positivity)).trans h1 · change |(1 / 6 : ℝ) * dPhi3 A (pilot c_f C_f (E z) (midpoint K l)) i j k * shift k l z| ≤ C rw [abs_mul]; exact (mul_le_mul hbase hsk (abs_nonneg _) (by positivity)).trans h1 · change |(1 / 6 : ℝ) * dPhi3 A (pilot c_f C_f (E z) (midpoint K l)) i j k * shift i l z * shift j l z| ≤ C rw [abs_mul, abs_mul] exact (mul_le_mul (mul_le_mul hbase hsi (abs_nonneg _) (by positivity)) hsj (abs_nonneg _) (by positivity)).trans h2 · change |(1 / 6 : ℝ) * dPhi3 A (pilot c_f C_f (E z) (midpoint K l)) i j k * shift i l z * shift k l z| ≤ C rw [abs_mul, abs_mul] exact (mul_le_mul (mul_le_mul hbase hsi (abs_nonneg _) (by positivity)) hsk (abs_nonneg _) (by positivity)).trans h2 · change |(1 / 6 : ℝ) * dPhi3 A (pilot c_f C_f (E z) (midpoint K l)) i j k * shift j l z * shift k l z| ≤ C rw [abs_mul, abs_mul] exact (mul_le_mul (mul_le_mul hbase hsj (abs_nonneg _) (by positivity)) hsk (abs_nonneg _) (by positivity)).trans h2 have hleaf_lp (q : Fin 7 × Fin 7 × Fin 7 × Fin 7) (l : Fin K) : MemLp (leaf q l) 2 μ := by rcases q with ⟨t, i, j, k⟩ fin_cases t · simpa [leaf, μ] using flatCenteredCubicCell_memLp c_f C_f L P n K hn hP ![i, j, k] l · simpa [leaf, μ] using flatCenteredPairCell_memLp c_f C_f L P n K hn hP ![j, k] ![1, 2] (by intro a b hab; fin_cases a <;> fin_cases b <;> simp_all) l · simpa [leaf, μ] using flatCenteredPairCell_memLp c_f C_f L P n K hn hP ![i, k] ![0, 2] (by intro a b hab; fin_cases a <;> fin_cases b <;> simp_all) l · simpa [leaf, μ] using flatCenteredPairCell_memLp c_f C_f L P n K hn hP ![i, j] ![0, 1] (by intro a b hab; fin_cases a <;> fin_cases b <;> simp_all) l · simpa [leaf, μ] using flatCenteredCellScore_comp_memLp c_f C_f L P n K hn hP k 3 l · simpa [leaf, μ] using flatCenteredCellScore_comp_memLp c_f C_f L P n K hn hP j 2 l · simpa [leaf, μ] using flatCenteredCellScore_comp_memLp c_f C_f L P n K hn hP i 1 l have hYlp (q : Fin 7 × Fin 7 × Fin 7 × Fin 7) : MemLp (Y q) 2 μ := by have hterm (l : Fin K) : MemLp (fun z => coeff q l z * leaf q l z) 2 μ := by have hmeas := ((hcoeff_meas q l).mono hm).aestronglyMeasurable.mul (hleaf_lp q l).aestronglyMeasurable apply (memLp_two_iff_integrable_sq hmeas).2 have hb : ∀ᵐ z ∂μ, ‖(coeff q l z) ^ 2‖ ≤ C ^ 2 := by filter_upwards [hcoeff q] with z hz simp only [Real.norm_eq_abs, abs_pow] exact (sq_le_sq₀ (abs_nonneg _) hC).2 (hz l) have hb' : ∀ᵐ z ∂μ, ‖((coeff q l) * (coeff q l)) z‖ ≤ C ^ 2 := by simpa only [Pi.mul_apply, pow_two] using hb have hi := (hleaf_lp q l).integrable_sq.bdd_mul (((hcoeff_meas q l).mono hm).mul ((hcoeff_meas q l).mono hm)).aestronglyMeasurable hb' convert hi using 1 funext z dsimp only [Pi.mul_apply] ring exact (memLp_finsetSum univ (fun l _ => hterm l)).const_mul (K : ℝ)⁻¹ have hZlp : MemLp Z 2 μ := by simpa only [Z] using memLp_finsetSum univ (fun q _ => hYlp q) have hgterm_meas (i j k : Fin 7) (l : Fin K) : StronglyMeasurable[m] (fun z => (1 / 6 : ℝ) * dPhi3 A (pilot c_f C_f (E z) (midpoint K l)) i j k * shift i l z * shift j l z * shift k l z) := by have hd := stronglyMeasurable_dPhi3_pilot_flatTraining c_f C_f L P n hn hP A (midpoint K l) i j k have hs (r : Fin 7) : StronglyMeasurable[m] (shift r l) := stronglyMeasurable_const.sub (stronglyMeasurable_pilot_eval_flatTraining c_f C_f n (midpoint K l) r) exact ((((hd.const_mul (1 / 6)).mul (hs i)).mul (hs j)).mul (hs k)) have hGmeas : StronglyMeasurable[m] G := by simpa only [G, Finset.sum_apply] using ((Finset.stronglyMeasurable_sum univ fun i _ => Finset.stronglyMeasurable_sum univ fun j _ => Finset.stronglyMeasurable_sum univ fun k _ => Finset.stronglyMeasurable_sum univ fun l _ => hgterm_meas i j k l)).const_mul (K : ℝ)⁻¹ have hGlp : MemLp G 2 μ := by have hgterm (i j k : Fin 7) (l : Fin K) : MemLp (fun z => (1 / 6 : ℝ) * dPhi3 A (pilot c_f C_f (E z) (midpoint K l)) i j k * shift i l z * shift j l z * shift k l z) 2 μ := by refine MemLp.of_bound ((hgterm_meas i j k l).mono hm).aestronglyMeasurable (M * U ^ 3) ?_ filter_upwards [] with z simp only [Real.norm_eq_abs, abs_mul] have hd := dPhi3_abs_le c_f C_f hP.sourceBounds.1 hP.sourceBounds.2.1 A (pilot c_f C_f (E z) (midpoint K l)) (pilot_mem_clippingRectangle c_f C_f L P n hn hP (E z) (midpoint K l)) i j k have hsi := abs_trainingShift_le c_f C_f L P n K hn hP hK (E z) l i have hsj := abs_trainingShift_le c_f C_f L P n K hn hP hK (E z) l j have hsk := abs_trainingShift_le c_f C_f L P n K hn hP hK (E z) l k change |dPhi3 A (pilot c_f C_f (E z) (midpoint K l)) i j k| ≤ M at hd change |shift i l z| ≤ U at hsi change |shift j l z| ≤ U at hsj change |shift k l z| ≤ U at hsk calc |(1 / 6 : ℝ)| * |dPhi3 A (pilot c_f C_f (E z) (midpoint K l)) i j k| * |shift i l z| * |shift j l z| * |shift k l z| ≤ 1 * M * U * U * U := by gcongr <;> norm_num _ = M * U ^ 3 := by ring have hs1 (i j k : Fin 7) : MemLp (fun z => ∑ l : Fin K, (1 / 6 : ℝ) * dPhi3 A (pilot c_f C_f (E z) (midpoint K l)) i j k * -- … truncated; follow the source link for the rest …
CausalSmith.Stat.TransportCaceRoughnuisanceLength.cubic_conditional_variance_with_memLp · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/CubicVariance.lean:32
theorem cubic_conditional_variance

The exact cubic correction variance bound. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hn :
threshold ≤ n
hP :
ModelClass c_f C_f L P n
A :
∀ᵐ ω ∂dataLaw P n n, condExp (trainingSigma n) (dataLaw P n n) (fun ξ : TwoSample n n => (cubicTerm c_f C_f ξ A - condExp (trainingSigma n) (dataLaw P n n) (fun ζ : TwoSample n n => cubicTerm c_f C_f ζ A) ξ) ^ 2) ω
≤ cubicVarianceConstant c_f C_f * ((n : ℝ) ^ (-1 : ℝ) + (cubicResolution n : ℝ) * (n : ℝ) ^ (-2 : ℝ) + (cubicResolution n : ℝ) ^ 2 * (n : ℝ) ^ (-3 : ℝ))
Proof (Lean source)
-- @node: cubic_conditional_variance lemma cubic_conditional_variance (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hn : threshold ≤ n) (hP : ModelClass c_f C_f L P n) (A : Bool) : ∀ᵐ ω ∂dataLaw P n n, condExp (trainingSigma n) (dataLaw P n n) (fun ξ : TwoSample n n => (cubicTerm c_f C_f ξ A - condExp (trainingSigma n) (dataLaw P n n) (fun ζ : TwoSample n n => cubicTerm c_f C_f ζ A) ξ) ^ 2) ω ≤ cubicVarianceConstant c_f C_f * ((n : ℝ) ^ (-1 : ℝ) + (cubicResolution n : ℝ) * (n : ℝ) ^ (-2 : ℝ) + (cubicResolution n : ℝ) ^ 2 * (n : ℝ) ^ (-3 : ℝ)) := by exact (cubic_conditional_variance_with_memLp c_f C_f L P n hn hP A).2
CausalSmith.Stat.TransportCaceRoughnuisanceLength.cubic_conditional_variance · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/CubicVariance.lean:561
CausalSmith.Stat.STAT_TransportCaceRoughnuisanceLength_Research.Helpers.CubicMse.ExactBiasAssembly 12 declarations This module turns the exact quadratic and cubic cell projection identities into quantitative bounds.

Cellwise projection-bias assembly for the exact cubic statistic

This module turns the exact quadratic and cubic cell projection identities into quantitative bounds. It isolates the deterministic part of the bias calculation from the conditional-expectation argument for the held-out histogram blocks.

theorem condExp_add_eq_shift_of_centered

In a decomposition into a conditionally centered fluctuation and a training-measurable shift, the shift is the exact conditional mean. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
hm :
m ≤ mΩ
SigmaFinite (μ.trim hm)
z g :
Ω → ℝ
hz :
hg :
hgm :
hz0 :
condExp m μ z =ᵐ[μ] (0 : Ω → ℝ)
condExp m μ (z + g) =ᵐ[μ] g
Proof (Lean source)
lemma condExp_add_eq_shift_of_centered {Ω : Type*} [mΩ : MeasurableSpace Ω] {μ : Measure Ω} {m : MeasurableSpace Ω} (hm : m ≤ mΩ) [SigmaFinite (μ.trim hm)] (z g : Ω → ℝ) (hz : Integrable z μ) (hg : Integrable g μ) (hgm : StronglyMeasurable[m] g) (hz0 : condExp m μ z =ᵐ[μ] (0 : Ω → ℝ)) : condExp m μ (z + g) =ᵐ[μ] g := by have hadd := condExp_add hz hg m have hfix := condExp_of_stronglyMeasurable hm hgm hg rw [hfix] at hadd filter_upwards [hadd, hz0] with x hx hz0x simp only [Pi.add_apply] at hx rw [hx, hz0x] simp only [Pi.zero_apply, zero_add]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.condExp_add_eq_shift_of_centered · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/ExactBiasAssembly.lean:23
theorem condExp_weighted_cellAverage_zero

A normalized finite cell sum remains conditionally centered after multiplication by cellwise training-measurable coefficients. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
K :
ℕ
hm :
m ≤ mΩ
SigmaFinite (μ.trim hm)
c X :
Fin K → Ω → ℝ
hc :
∀ l, StronglyMeasurable[m] (c l)
hX :
∀ l, Integrable (X l) μ
hprod :
∀ l, Integrable (fun x => c l x * X l x) μ
hzero :
∀ l, condExp m μ (X l) =ᵐ[μ] (0 : Ω → ℝ)
condExp m μ (fun x => (K : ℝ)⁻¹ * ∑ l : Fin K, c l x * X l x) =ᵐ[μ] (0 : Ω → ℝ)
Proof (Lean source)
lemma condExp_weighted_cellAverage_zero {Ω : Type*} [mΩ : MeasurableSpace Ω] {μ : Measure Ω} {m : MeasurableSpace Ω} {K : ℕ} (hm : m ≤ mΩ) [SigmaFinite (μ.trim hm)] (c X : Fin K → Ω → ℝ) (hc : ∀ l, StronglyMeasurable[m] (c l)) (hX : ∀ l, Integrable (X l) μ) (hprod : ∀ l, Integrable (fun x => c l x * X l x) μ) (hzero : ∀ l, condExp m μ (X l) =ᵐ[μ] (0 : Ω → ℝ)) : condExp m μ (fun x => (K : ℝ)⁻¹ * ∑ l : Fin K, c l x * X l x) =ᵐ[μ] (0 : Ω → ℝ) := by have hterm (l : Fin K) : condExp m μ (fun x => c l x * X l x) =ᵐ[μ] (0 : Ω → ℝ) := by have hpull := condExp_mul_of_stronglyMeasurable_left (hc l) (hprod l) (hX l) filter_upwards [hpull, hzero l] with x hp hx change condExp m μ (c l * X l) x = (0 : Ω → ℝ) x rw [hp] simp only [Pi.mul_apply, Pi.zero_apply] rw [hx, Pi.zero_apply, mul_zero] exact @condExp_cellAverage_zero Ω mΩ μ m K (fun l x => c l x * X l x) hprod hterm
CausalSmith.Stat.TransportCaceRoughnuisanceLength.condExp_weighted_cellAverage_zero · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/ExactBiasAssembly.lean:40
theorem condExp_flatCenteredCellScore_zero

A single centered held-out histogram cell has zero conditional mean given the training block. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n K :
ℕ
hn :
threshold ≤ n
hP :
ModelClass c_f C_f L P n
i :
Fin 7
b :
Fin 3
l :
Fin K
condExp (comap (finsetCoordProj (Ω := FlatObs n) (flatBlock n 0)) pi) (Measure.pi (flatLaw P n)) (fun x => flatCenteredCellScore P i b.succ l (finsetCoordProj (flatBlock n b.succ) x))
=ᵐ[Measure.pi (flatLaw P n)] (0 : ((a : FlatIndex n) → FlatObs n a) → ℝ)
Proof (Lean source)
lemma condExp_flatCenteredCellScore_zero (c_f C_f L : ℝ) (P : TransportLaw) (n K : ℕ) (hn : threshold ≤ n) (hP : ModelClass c_f C_f L P n) (i : Fin 7) (b : Fin 3) (l : Fin K) : condExp (comap (finsetCoordProj (Ω := FlatObs n) (flatBlock n 0)) pi) (Measure.pi (flatLaw P n)) (fun x => flatCenteredCellScore P i b.succ l (finsetCoordProj (flatBlock n b.succ) x)) =ᵐ[Measure.pi (flatLaw P n)] (0 : ((a : FlatIndex n) → FlatObs n a) → ℝ) := by letI : ∀ a, StandardBorelSpace (FlatObs n a) := fun a => by cases a <;> dsimp [FlatObs] <;> infer_instance letI : ∀ a, IsProbabilityMeasure (flatLaw P n a) := fun a => flatLaw_isProbabilityMeasure c_f C_f L P n hP a exact condExp_centeredBlockScore_zero (flatLaw P n) (flatBlock n 0) (flatBlock n b.succ) (flatBlock_training_disjoint n b) (flatBlockHeight i b.succ l) (measurable_flatBlockHeight _ _ _) (flatBlockHeight_memLp c_f C_f L P n K hn hP i b.succ l)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.condExp_flatCenteredCellScore_zero · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/ExactBiasAssembly.lean:64
theorem condExp_flatCenteredPairCell_zero

The product of two centered held-out histogram cells from distinct evaluation blocks has zero conditional mean given training. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n K :
ℕ
hn :
threshold ≤ n
hP :
ModelClass c_f C_f L P n
i :
Fin 2 → Fin 7
b :
Fin 2 → Fin 3
hb :
l :
Fin K
condExp (comap (finsetCoordProj (Ω := FlatObs n) (flatBlock n 0)) pi) (Measure.pi (flatLaw P n)) (flatCenteredPairCell P i b l)
=ᵐ[Measure.pi (flatLaw P n)] (0 : ((a : FlatIndex n) → FlatObs n a) → ℝ)
Proof (Lean source)
lemma condExp_flatCenteredPairCell_zero (c_f C_f L : ℝ) (P : TransportLaw) (n K : ℕ) (hn : threshold ≤ n) (hP : ModelClass c_f C_f L P n) (i : Fin 2 → Fin 7) (b : Fin 2 → Fin 3) (hb : Injective b) (l : Fin K) : condExp (comap (finsetCoordProj (Ω := FlatObs n) (flatBlock n 0)) pi) (Measure.pi (flatLaw P n)) (flatCenteredPairCell P i b l) =ᵐ[Measure.pi (flatLaw P n)] (0 : ((a : FlatIndex n) → FlatObs n a) → ℝ) := by letI : ∀ a, StandardBorelSpace (FlatObs n a) := fun a => by cases a <;> dsimp [FlatObs] <;> infer_instance letI : ∀ a, IsProbabilityMeasure (flatLaw P n a) := fun a => flatLaw_isProbabilityMeasure c_f C_f L P n hP a let μ := Measure.pi (flatLaw P n) let m := comap (finsetCoordProj (Ω := FlatObs n) (flatBlock n 0)) pi let F (t : Fin 2) := flatCenteredCellScore P (n := n) (i t) (b t).succ l have hf (t : Fin 2) : Measurable (F t) := (measurable_flatBlockHeight (i t) (b t).succ l).sub measurable_const have hflp (t : Fin 2) : MemLp (fun x => F t (finsetCoordProj (flatBlock n (b t).succ) x)) 2 μ := (flatBlockHeight_memLp c_f C_f L P n K hn hP (i t) (b t).succ l).sub (memLp_const _) have hdisj : Disjoint (flatBlock n (b 0).succ) (flatBlock n (b 1).succ) := flatBlock_eval_pairwise n (hb.ne (by decide : (0 : Fin 2) ≠ 1)) have hind := condIndepFun_eval_pair (flatLaw P n) (flatBlock n 0) (fun t : Fin 3 => flatBlock n t.succ) (flatBlock_training_disjoint n) (flatBlock_eval_pairwise n) (b 0) (b 1) (hb.ne (by decide : (0 : Fin 2) ≠ 1)) have hprod : Integrable (fun x => F 0 (finsetCoordProj (flatBlock n (b 0).succ) x) * F 1 (finsetCoordProj (flatBlock n (b 1).succ) x)) μ := integrable_twoBlockProduct (flatLaw P n) _ _ hdisj (F 0) (F 1) (hf 0) (hf 1) ((hflp 0).integrable (by norm_num)) ((hflp 1).integrable (by norm_num)) have hp := condExp_mul_of_condIndep (show m ≤ pi from (measurable_finsetCoordProj (Ω := FlatObs n) (flatBlock n 0)).comap_le) (measurable_finsetCoordProj (flatBlock n (b 0).succ)) (measurable_finsetCoordProj (flatBlock n (b 1).succ)) hind (hf 0) (hf 1) ((hflp 0).integrable (by norm_num)) ((hflp 1).integrable (by norm_num)) hprod have hz0 := condExp_flatCenteredCellScore_zero c_f C_f L P n K hn hP (i 0) (b 0) l change condExp m μ (flatCenteredPairCell P i b l) =ᵐ[μ] _ have heq : flatCenteredPairCell P i b l = (fun y => F 0 (finsetCoordProj (flatBlock n (b 0).succ) y) * F 1 (finsetCoordProj (flatBlock n (b 1).succ) y)) := by funext y simp only [F, flatCenteredPairCell, Fin.prod_univ_two] rw [heq] filter_upwards [hp, hz0] with x hp hz0 rw [hp] change condExp m μ (fun y => F 0 (finsetCoordProj (flatBlock n (b 0).succ) y)) x * condExp m μ (fun y => F 1 (finsetCoordProj (flatBlock n (b 1).succ) y)) x = 0 rw [hz0] simp only [Pi.zero_apply, zero_mul]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.condExp_flatCenteredPairCell_zero · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/ExactBiasAssembly.lean:84
def quadraticProjectionMean

The training-measurable quadratic projection polynomial: every held-out residual is replaced by its exact cell-mean shift. For the displayed assumptions and inputs, the stated object is defined.

Definition (Lean source)
c_f C_f L :
ℝ
n :
ℕ
hP :
ModelClass c_f C_f L P n
ω :
A :
quadraticProjectionMean c_f C_f L P n hP ω A :
ℝ
(K : ℝ)⁻¹ * ∑ i : Fin 7, ∑ j : Fin 7, ∑ l : Fin K, (1 / 2 : ℝ) * dPhi2 A (pilot c_f C_f ω (midpoint K l)) i j * (cellAverage (fun y => markedDensityVector c_f C_f L P n hP y i) K l - pilot c_f C_f ω (midpoint K l) i) * (cellAverage (fun y => markedDensityVector c_f C_f L P n hP y j) K l - pilot c_f C_f ω (midpoint K l) j)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.quadraticProjectionMean · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/ExactBiasAssembly.lean:145
def cubicProjectionMean

The training-measurable cubic projection polynomial: every held-out residual is replaced by its exact cell-mean shift. For the displayed assumptions and inputs, the stated object is defined.

Definition (Lean source)
c_f C_f L :
ℝ
n :
ℕ
hP :
ModelClass c_f C_f L P n
ω :
A :
cubicProjectionMean c_f C_f L P n hP ω A :
ℝ
(K : ℝ)⁻¹ * ∑ i : Fin 7, ∑ j : Fin 7, ∑ k : Fin 7, ∑ l : Fin K, (1 / 6 : ℝ) * dPhi3 A (pilot c_f C_f ω (midpoint K l)) i j k * (cellAverage (fun y => markedDensityVector c_f C_f L P n hP y i) K l - pilot c_f C_f ω (midpoint K l) i) * (cellAverage (fun y => markedDensityVector c_f C_f L P n hP y j) K l - pilot c_f C_f ω (midpoint K l) j) * (cellAverage (fun y => markedDensityVector c_f C_f L P n hP y k) K l - pilot c_f C_f ω (midpoint K l) k)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.cubicProjectionMean · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/ExactBiasAssembly.lean:159
theorem quadraticProjectionMean_eq

The explicit finite-sum formula defining the quadratic projection mean. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hP :
ModelClass c_f C_f L P n
ω :
A :
quadraticProjectionMean c_f C_f L P n hP ω A
= let K := quadraticResolution n (K : ℝ)⁻¹ * ∑ i : Fin 7, ∑ j : Fin 7, ∑ l : Fin K, (1 / 2 : ℝ) * dPhi2 A (pilot c_f C_f ω (midpoint K l)) i j * (cellAverage (fun y => markedDensityVector c_f C_f L P n hP y i) K l - pilot c_f C_f ω (midpoint K l) i) * (cellAverage (fun y => markedDensityVector c_f C_f L P n hP y j) K l - pilot c_f C_f ω (midpoint K l) j)
Proof (Lean source)
lemma quadraticProjectionMean_eq (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hP : ModelClass c_f C_f L P n) (ω : TwoSample n n) (A : Bool) : quadraticProjectionMean c_f C_f L P n hP ω A = let K := quadraticResolution n (K : ℝ)⁻¹ * ∑ i : Fin 7, ∑ j : Fin 7, ∑ l : Fin K, (1 / 2 : ℝ) * dPhi2 A (pilot c_f C_f ω (midpoint K l)) i j * (cellAverage (fun y => markedDensityVector c_f C_f L P n hP y i) K l - pilot c_f C_f ω (midpoint K l) i) * (cellAverage (fun y => markedDensityVector c_f C_f L P n hP y j) K l - pilot c_f C_f ω (midpoint K l) j) := by rfl
CausalSmith.Stat.TransportCaceRoughnuisanceLength.quadraticProjectionMean_eq · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/ExactBiasAssembly.lean:175
theorem cubicProjectionMean_eq

The explicit finite-sum formula defining the cubic projection mean. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hP :
ModelClass c_f C_f L P n
ω :
A :
cubicProjectionMean c_f C_f L P n hP ω A
= let K := cubicResolution n (K : ℝ)⁻¹ * ∑ i : Fin 7, ∑ j : Fin 7, ∑ k : Fin 7, ∑ l : Fin K, (1 / 6 : ℝ) * dPhi3 A (pilot c_f C_f ω (midpoint K l)) i j k * (cellAverage (fun y => markedDensityVector c_f C_f L P n hP y i) K l - pilot c_f C_f ω (midpoint K l) i) * (cellAverage (fun y => markedDensityVector c_f C_f L P n hP y j) K l - pilot c_f C_f ω (midpoint K l) j) * (cellAverage (fun y => markedDensityVector c_f C_f L P n hP y k) K l - pilot c_f C_f ω (midpoint K l) k)
Proof (Lean source)
lemma cubicProjectionMean_eq (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hP : ModelClass c_f C_f L P n) (ω : TwoSample n n) (A : Bool) : cubicProjectionMean c_f C_f L P n hP ω A = let K := cubicResolution n (K : ℝ)⁻¹ * ∑ i : Fin 7, ∑ j : Fin 7, ∑ k : Fin 7, ∑ l : Fin K, (1 / 6 : ℝ) * dPhi3 A (pilot c_f C_f ω (midpoint K l)) i j k * (cellAverage (fun y => markedDensityVector c_f C_f L P n hP y i) K l - pilot c_f C_f ω (midpoint K l) i) * (cellAverage (fun y => markedDensityVector c_f C_f L P n hP y j) K l - pilot c_f C_f ω (midpoint K l) j) * (cellAverage (fun y => markedDensityVector c_f C_f L P n hP y k) K l - pilot c_f C_f ω (midpoint K l) k) := by rfl
CausalSmith.Stat.TransportCaceRoughnuisanceLength.cubicProjectionMean_eq · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/ExactBiasAssembly.lean:189
theorem stronglyMeasurable_quadraticProjectionMean

The quadratic projection polynomial is measurable with respect to the training sigma algebra. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hn :
threshold ≤ n
hP :
ModelClass c_f C_f L P n
A :
StronglyMeasurable[trainingSigma n] (fun ω => quadraticProjectionMean c_f C_f L P n hP ω A)
Proof (Lean source)
lemma stronglyMeasurable_quadraticProjectionMean (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hn : threshold ≤ n) (hP : ModelClass c_f C_f L P n) (A : Bool) : StronglyMeasurable[trainingSigma n] (fun ω => quadraticProjectionMean c_f C_f L P n hP ω A) := by let K := quadraticResolution n have hd (i j : Fin 7) (l : Fin K) : StronglyMeasurable[trainingSigma n] (fun ω => dPhi2 A (pilot c_f C_f ω (midpoint K l)) i j) := stronglyMeasurable_dPhi2_pilot_trainingSigma c_f C_f L P n hn hP A (midpoint K l) i j have hs (i : Fin 7) (l : Fin K) : StronglyMeasurable[trainingSigma n] (fun ω => cellAverage (fun y => markedDensityVector c_f C_f L P n hP y i) K l - pilot c_f C_f ω (midpoint K l) i) := stronglyMeasurable_const.sub (stronglyMeasurable_pilot_eval_trainingSigma c_f C_f (midpoint K l) i) unfold quadraticProjectionMean dsimp only fun_prop
CausalSmith.Stat.TransportCaceRoughnuisanceLength.stronglyMeasurable_quadraticProjectionMean · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/ExactBiasAssembly.lean:205
theorem stronglyMeasurable_cubicProjectionMean

The cubic projection polynomial is measurable with respect to the training sigma algebra. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hn :
threshold ≤ n
hP :
ModelClass c_f C_f L P n
A :
StronglyMeasurable[trainingSigma n] (fun ω => cubicProjectionMean c_f C_f L P n hP ω A)
Proof (Lean source)
lemma stronglyMeasurable_cubicProjectionMean (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hn : threshold ≤ n) (hP : ModelClass c_f C_f L P n) (A : Bool) : StronglyMeasurable[trainingSigma n] (fun ω => cubicProjectionMean c_f C_f L P n hP ω A) := by let K := cubicResolution n have hd (i j k : Fin 7) (l : Fin K) : StronglyMeasurable[trainingSigma n] (fun ω => dPhi3 A (pilot c_f C_f ω (midpoint K l)) i j k) := stronglyMeasurable_dPhi3_pilot_trainingSigma c_f C_f L P n hn hP A (midpoint K l) i j k have hs (i : Fin 7) (l : Fin K) : StronglyMeasurable[trainingSigma n] (fun ω => cellAverage (fun y => markedDensityVector c_f C_f L P n hP y i) K l - pilot c_f C_f ω (midpoint K l) i) := stronglyMeasurable_const.sub (stronglyMeasurable_pilot_eval_trainingSigma c_f C_f (midpoint K l) i) unfold cubicProjectionMean dsimp only fun_prop
CausalSmith.Stat.TransportCaceRoughnuisanceLength.stronglyMeasurable_cubicProjectionMean · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/ExactBiasAssembly.lean:227
theorem markedDensity_sub_cellAverage_abs_le

A marked-density coordinate differs from its cell average by at most the common Hölder modulus times the cell width. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n K :
ℕ
hP :
ModelClass c_f C_f L P n
hK :
0 < K
l :
Fin K
x :
ℝ
hx :
x ∈ cell K l
i :
Fin 7
|markedDensityVector c_f C_f L P n hP x i
- cellAverage (fun y => markedDensityVector c_f C_f L P n hP y i) K l|
≤ 3 * (1 + C_f) * L * (1 / (K : ℝ)) ^ holderExponent
Proof (Lean source)
lemma markedDensity_sub_cellAverage_abs_le (c_f C_f L : ℝ) (P : TransportLaw) (n K : ℕ) (hP : ModelClass c_f C_f L P n) (hK : 0 < K) (l : Fin K) (x : ℝ) (hx : x ∈ cell K l) (i : Fin 7) : |markedDensityVector c_f C_f L P n hP x i - cellAverage (fun y => markedDensityVector c_f C_f L P n hP y i) K l| ≤ 3 * (1 + C_f) * L * (1 / (K : ℝ)) ^ holderExponent := by rw [abs_sub_comm] exact markedDensityVector_cell_bias c_f C_f L P n K hP hK l x hx i
CausalSmith.Stat.TransportCaceRoughnuisanceLength.markedDensity_sub_cellAverage_abs_le · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/ExactBiasAssembly.lean:249
theorem markedDensity_quadratic_cell_projection_abs_le

The integral of a quadratic Taylor monomial loses only the product of two within-cell projection residuals. Its absolute size is bounded explicitly. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n K :
ℕ
hP :
ModelClass c_f C_f L P n
hK :
0 < K
l :
Fin K
i j :
Fin 7
ti tj c :
ℝ
F :
markedDensityVector c_f C_f L P n hP
ai :
cellAverage (fun y => F y i) K l
aj :
cellAverage (fun y => F y j) K l
|∫ x in cell K l, c * ((F x i - ti) * (F x j - tj) - (ai - ti) * (aj - tj))|
≤ |c| * (3 * (1 + C_f) * L * (1 / (K : ℝ)) ^ holderExponent) ^ 2 / (K : ℝ)
Proof (Lean source)
lemma markedDensity_quadratic_cell_projection_abs_le (c_f C_f L : ℝ) (P : TransportLaw) (n K : ℕ) (hP : ModelClass c_f C_f L P n) (hK : 0 < K) (l : Fin K) (i j : Fin 7) (ti tj c : ℝ) : let F := markedDensityVector c_f C_f L P n hP let ai := cellAverage (fun y => F y i) K l let aj := cellAverage (fun y => F y j) K l |∫ x in cell K l, c * ((F x i - ti) * (F x j - tj) - (ai - ti) * (aj - tj))| ≤ |c| * (3 * (1 + C_f) * L * (1 / (K : ℝ)) ^ holderExponent) ^ 2 / (K : ℝ) := by dsimp only rw [markedDensity_quadratic_cell_projection_identity c_f C_f L P n K hP hK l i j ti tj c] have hKr : (0 : ℝ) < K := by exact_mod_cast hK let B := 3 * (1 + C_f) * L * (1 / (K : ℝ)) ^ holderExponent have hB : 0 ≤ B := by dsimp [B] have hC : 0 ≤ C_f := le_trans (by norm_num) hP.sourceBounds.2.1.le have hL : 0 ≤ L := hP.sourceHolder.1.le.trans' (by norm_num) positivity have hi : IntegrableOn (fun x => c * ((markedDensityVector c_f C_f L P n hP x i - cellAverage (fun y => markedDensityVector c_f C_f L P n hP y i) K l) * (markedDensityVector c_f C_f L P n hP x j - cellAverage (fun y => markedDensityVector c_f C_f L P n hP y j) K l))) (cell K l) := by have hci := markedDensityVector_continuousOn c_f C_f L P n hP i have hcj := markedDensityVector_continuousOn c_f C_f L P n hP j have hc : ContinuousOn (fun x => c * ((markedDensityVector c_f C_f L P n hP x i - cellAverage (fun y => markedDensityVector c_f C_f L P n hP y i) K l) * (markedDensityVector c_f C_f L P n hP x j - cellAverage (fun y => markedDensityVector c_f C_f L P n hP y j) K l))) covariateSpace := by fun_prop exact hc.integrableOn_Icc.mono_set (cell_subset_covariateSpace hK l) have hfinite : volume (cell K l) ≠ ⊤ := by rw [volume_cell hK l] exact ENNReal.ofReal_ne_top calc _ ≤ ∫ x in cell K l, |c * ((markedDensityVector c_f C_f L P n hP x i - cellAverage (fun y => markedDensityVector c_f C_f L P n hP y i) K l) * (markedDensityVector c_f C_f L P n hP x j - cellAverage (fun y => markedDensityVector c_f C_f L P n hP y j) K l))| := by simpa only [Real.norm_eq_abs] using norm_integral_le_integral_norm (fun x => c * ((markedDensityVector c_f C_f L P n hP x i - cellAverage (fun y => markedDensityVector c_f C_f L P n hP y i) K l) * (markedDensityVector c_f C_f L P n hP x j - cellAverage (fun y => markedDensityVector c_f C_f L P n hP y j) K l))) _ ≤ ∫ _x in cell K l, |c| * B ^ 2 := by apply setIntegral_mono_on hi.norm (integrableOn_const hfinite) (measurableSet_cell K l) intro x hx simp only [Real.norm_eq_abs, abs_mul] have hri := markedDensity_sub_cellAverage_abs_le c_f C_f L P n K hP hK l x hx i have hrj := markedDensity_sub_cellAverage_abs_le c_f C_f L P n K hP hK l x hx j change _ ≤ B at hri hrj apply mul_le_mul_of_nonneg_left _ (abs_nonneg c) calc _ ≤ B * B := mul_le_mul hri hrj (abs_nonneg _) hB _ = B ^ 2 := by ring _ = |c| * B ^ 2 / (K : ℝ) := by rw [setIntegral_const, Measure.real, volume_cell hK l, ENNReal.toReal_ofReal (by positivity)] simp only [smul_eq_mul] ring _ = _ := by rfl
CausalSmith.Stat.TransportCaceRoughnuisanceLength.markedDensity_quadratic_cell_projection_abs_le · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/ExactBiasAssembly.lean:260
CausalSmith.Stat.STAT_TransportCaceRoughnuisanceLength_Research.Helpers.CubicMse.ExactConditionalMeans 1 declarations This module exports the exact training-conditional means of both held-out histogram corrections.

Exact conditional means of the quadratic and cubic corrections

This module exports the exact training-conditional means of both held-out histogram corrections. The quadratic proof is split into its own dependency; this file supplies the cubic identity.

theorem condExp_cubicTerm_eq_cubicProjectionMean

The exact training-conditional mean of the cubic correction is its cellwise projection polynomial. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hn :
threshold ≤ n
hP :
ModelClass c_f C_f L P n
A :
condExp (trainingSigma n) (dataLaw P n n) (fun ω : TwoSample n n => cubicTerm c_f C_f ω A)
=ᵐ[dataLaw P n n] (fun ω => cubicProjectionMean c_f C_f L P n hP ω A)
Proof (Lean source)
lemma condExp_cubicTerm_eq_cubicProjectionMean (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hn : threshold ≤ n) (hP : ModelClass c_f C_f L P n) (A : Bool) : condExp (trainingSigma n) (dataLaw P n n) (fun ω : TwoSample n n => cubicTerm c_f C_f ω A) =ᵐ[dataLaw P n n] (fun ω => cubicProjectionMean c_f C_f L P n hP ω A) := by classical let K := cubicResolution n have hK : 0 < K := by dsimp [K, cubicResolution, dyadicResolution] split_ifs <;> positivity let E := sumPiEquivProdPi (FlatObs n) have hEembed : @MeasurableEmbedding (TwoSample n n) ((a : FlatIndex n) → FlatObs n a) inferInstance MeasurableSpace.pi (flattenSample n) := (sumPiEquivProdPi (FlatObs n)).symm.measurableEmbedding let μ := Measure.pi (flatLaw P n) let m := comap (finsetCoordProj (Ω := FlatObs n) (flatBlock n 0)) MeasurableSpace.pi let M := fourthDerivativeEnvelope c_f C_f let U := 2 * (1 + C_f) let C := M * (1 + U) ^ 2 / 6 let shift (i : Fin 7) (l : Fin K) (z : (a : FlatIndex n) → FlatObs n a) := cellAverage (fun y => markedDensityVector c_f C_f L P n hP y i) K l - pilot c_f C_f (E z) (midpoint K l) i let coeff (q : Fin 7 × Fin 7 × Fin 7 × Fin 7) (l : Fin K) (z : (a : FlatIndex n) → FlatObs n a) := let a := (1 / 6 : ℝ) * dPhi3 A (pilot c_f C_f (E z) (midpoint K l)) q.2.1 q.2.2.1 q.2.2.2 ![a, a * shift q.2.1 l z, a * shift q.2.2.1 l z, a * shift q.2.2.2 l z, a * shift q.2.1 l z * shift q.2.2.1 l z, a * shift q.2.1 l z * shift q.2.2.2 l z, a * shift q.2.2.1 l z * shift q.2.2.2 l z] q.1 let leaf (q : Fin 7 × Fin 7 × Fin 7 × Fin 7) (l : Fin K) (z : (a : FlatIndex n) → FlatObs n a) := ![flatCenteredCubicCell P ![q.2.1, q.2.2.1, q.2.2.2] l z, flatCenteredPairCell P ![q.2.2.1, q.2.2.2] ![1, 2] l z, flatCenteredPairCell P ![q.2.1, q.2.2.2] ![0, 2] l z, flatCenteredPairCell P ![q.2.1, q.2.2.1] ![0, 1] l z, flatCenteredCellScore P q.2.2.2 3 l (finsetCoordProj (flatBlock n 3) z), flatCenteredCellScore P q.2.2.1 2 l (finsetCoordProj (flatBlock n 2) z), flatCenteredCellScore P q.2.1 1 l (finsetCoordProj (flatBlock n 1) z)] q.1 let Y (q : Fin 7 × Fin 7 × Fin 7 × Fin 7) (z : (a : FlatIndex n) → FlatObs n a) := (K : ℝ)⁻¹ * ∑ l : Fin K, coeff q l z * leaf q l z let Z (z : (a : FlatIndex n) → FlatObs n a) := ∑ q : Fin 7 × Fin 7 × Fin 7 × Fin 7, Y q z let G (z : (a : FlatIndex n) → FlatObs n a) := (K : ℝ)⁻¹ * ∑ i : Fin 7, ∑ j : Fin 7, ∑ k : Fin 7, ∑ l : Fin K, (1 / 6 : ℝ) * dPhi3 A (pilot c_f C_f (E z) (midpoint K l)) i j k * shift i l z * shift j l z * shift k l z let F (z : (a : FlatIndex n) → FlatObs n a) := cubicTerm c_f C_f (E z) A letI : ∀ a, StandardBorelSpace (FlatObs n a) := fun a => by cases a <;> dsimp [FlatObs] <;> infer_instance letI : ∀ a, IsProbabilityMeasure (flatLaw P n a) := fun a => flatLaw_isProbabilityMeasure c_f C_f L P n hP a have hm : m ≤ (MeasurableSpace.pi : MeasurableSpace ((a : FlatIndex n) → FlatObs n a)) := by dsimp [m] exact (measurable_finsetCoordProj (Ω := FlatObs n) (flatBlock n 0)).comap_le have hM : 0 ≤ M := by dsimp [M, fourthDerivativeEnvelope] have hc := hP.sourceBounds.1.1 positivity have hU : 0 ≤ U := by dsimp [U] have := hP.sourceBounds.2.1 positivity have hC : 0 ≤ C := by dsimp [C]; positivity have hcoeff_meas (q : Fin 7 × Fin 7 × Fin 7 × Fin 7) (l : Fin K) : StronglyMeasurable[m] (coeff q l) := by rcases q with ⟨t, i, j, k⟩ have hd := stronglyMeasurable_dPhi3_pilot_flatTraining c_f C_f L P n hn hP A (midpoint K l) i j k have hs (r : Fin 7) : StronglyMeasurable[m] (shift r l) := stronglyMeasurable_const.sub (stronglyMeasurable_pilot_eval_flatTraining c_f C_f n (midpoint K l) r) fin_cases t all_goals change StronglyMeasurable[m] _; dsimp only [coeff] · exact hd.const_mul (1 / 6) · exact (hd.const_mul (1 / 6)).mul (hs i) · exact (hd.const_mul (1 / 6)).mul (hs j) · exact (hd.const_mul (1 / 6)).mul (hs k) · exact ((hd.const_mul (1 / 6)).mul (hs i)).mul (hs j) · exact ((hd.const_mul (1 / 6)).mul (hs i)).mul (hs k) · exact ((hd.const_mul (1 / 6)).mul (hs j)).mul (hs k) have hcoeff (q : Fin 7 × Fin 7 × Fin 7 × Fin 7) : ∀ᵐ z ∂μ, ∀ l, |coeff q l z| ≤ C := by filter_upwards [] with z intro l rcases q with ⟨t, i, j, k⟩ have hd := dPhi3_abs_le c_f C_f hP.sourceBounds.1 hP.sourceBounds.2.1 A (pilot c_f C_f (E z) (midpoint K l)) (pilot_mem_clippingRectangle c_f C_f L P n hn hP (E z) (midpoint K l)) i j k have hi := abs_trainingShift_le c_f C_f L P n K hn hP hK (E z) l i have hj := abs_trainingShift_le c_f C_f L P n K hn hP hK (E z) l j have hk := abs_trainingShift_le c_f C_f L P n K hn hP hK (E z) l k change |dPhi3 A (pilot c_f C_f (E z) (midpoint K l)) i j k| ≤ M at hd change |shift i l z| ≤ U at hi change |shift j l z| ≤ U at hj change |shift k l z| ≤ U at hk have hb : |(1 / 6 : ℝ) * dPhi3 A (pilot c_f C_f (E z) (midpoint K l)) i j k| ≤ M / 6 := by rw [abs_mul, abs_of_nonneg (by norm_num : (0 : ℝ) ≤ 1 / 6)] nlinarith have h0 : M / 6 ≤ C := by dsimp [C] nlinarith [mul_nonneg hM hU, sq_nonneg U] have h1 : M / 6 * U ≤ C := by dsimp [C] nlinarith [mul_nonneg hM hU, mul_nonneg hM (sq_nonneg U)] have h2 : M / 6 * U * U ≤ C := by dsimp [C] nlinarith [mul_nonneg hM hU] have hb0 : 0 ≤ M / 6 := div_nonneg hM (by norm_num) fin_cases t all_goals dsimp [coeff] · exact hb.trans h0 · rw [abs_mul]; exact (mul_le_mul hb hi (abs_nonneg _) hb0).trans h1 · rw [abs_mul]; exact (mul_le_mul hb hj (abs_nonneg _) hb0).trans h1 · rw [abs_mul]; exact (mul_le_mul hb hk (abs_nonneg _) hb0).trans h1 · rw [abs_mul, abs_mul] exact (mul_le_mul (mul_le_mul hb hi (abs_nonneg _) hb0) hj (abs_nonneg _) (mul_nonneg hb0 hU)).trans h2 · rw [abs_mul, abs_mul] exact (mul_le_mul (mul_le_mul hb hi (abs_nonneg _) hb0) hk (abs_nonneg _) (mul_nonneg hb0 hU)).trans h2 · rw [abs_mul, abs_mul] exact (mul_le_mul (mul_le_mul hb hj (abs_nonneg _) hb0) hk (abs_nonneg _) (mul_nonneg hb0 hU)).trans h2 have hleaf_lp (q : Fin 7 × Fin 7 × Fin 7 × Fin 7) (l : Fin K) : MemLp (leaf q l) 2 μ := by rcases q with ⟨t, i, j, k⟩ fin_cases t · simpa [leaf, μ] using flatCenteredCubicCell_memLp c_f C_f L P n K hn hP ![i, j, k] l · simpa [leaf, μ] using flatCenteredPairCell_memLp c_f C_f L P n K hn hP ![j, k] ![1, 2] (by intro a b hab; fin_cases a <;> fin_cases b <;> simp_all) l · simpa [leaf, μ] using flatCenteredPairCell_memLp c_f C_f L P n K hn hP ![i, k] ![0, 2] (by intro a b hab; fin_cases a <;> fin_cases b <;> simp_all) l · simpa [leaf, μ] using flatCenteredPairCell_memLp c_f C_f L P n K hn hP ![i, j] ![0, 1] (by intro a b hab; fin_cases a <;> fin_cases b <;> simp_all) l · simpa [leaf, μ] using flatCenteredCellScore_comp_memLp c_f C_f L P n K hn hP k 3 l · simpa [leaf, μ] using flatCenteredCellScore_comp_memLp c_f C_f L P n K hn hP j 2 l · simpa [leaf, μ] using flatCenteredCellScore_comp_memLp c_f C_f L P n K hn hP i 1 l have hterm (q : Fin 7 × Fin 7 × Fin 7 × Fin 7) (l : Fin K) : Integrable (fun z => coeff q l z * leaf q l z) μ := by apply (hleaf_lp q l).integrable (by norm_num) |>.bdd_mul ((hcoeff_meas q l).mono hm).aestronglyMeasurable filter_upwards [hcoeff q] with z hz simpa only [Real.norm_eq_abs] using hz l have hYint (q : Fin 7 × Fin 7 × Fin 7 × Fin 7) : Integrable (Y q) μ := (integrable_finsetSum univ (fun l _ => hterm q l)).const_mul (K : ℝ)⁻¹ have hleaf_zero (q : Fin 7 × Fin 7 × Fin 7 × Fin 7) (l : Fin K) : condExp m μ (leaf q l) =ᵐ[μ] (0 : ((a : FlatIndex n) → FlatObs n a) → ℝ) := by rcases q with ⟨t, i, j, k⟩ fin_cases t · simpa [leaf, m, μ] using condExp_flatCenteredCubicCell_zero c_f C_f L P n K hn hP ![i, j, k] l · simpa [leaf, m, μ] using condExp_flatCenteredPairCell_zero c_f C_f L P n K hn hP ![j, k] ![1, 2] (by intro a b hab; fin_cases a <;> fin_cases b <;> simp_all) l · simpa [leaf, m, μ] using condExp_flatCenteredPairCell_zero c_f C_f L P n K hn hP ![i, k] ![0, 2] (by intro a b hab; fin_cases a <;> fin_cases b <;> simp_all) l · simpa [leaf, m, μ] using condExp_flatCenteredPairCell_zero c_f C_f L P n K hn hP ![i, j] ![0, 1] (by intro a b hab; fin_cases a <;> fin_cases b <;> simp_all) l · simpa [leaf, m, μ] using condExp_flatCenteredCellScore_zero c_f C_f L P n K hn hP k 2 l · simpa [leaf, m, μ] using condExp_flatCenteredCellScore_zero c_f C_f L P n K hn hP j 1 l · simpa [leaf, m, μ] using condExp_flatCenteredCellScore_zero c_f C_f L P n K hn hP i 0 l have hYzero (q : Fin 7 × Fin 7 × Fin 7 × Fin 7) : condExp m μ (Y q) =ᵐ[μ] (0 : ((a : FlatIndex n) → FlatObs n a) → ℝ) := @condExp_weighted_cellAverage_zero ((a : FlatIndex n) → FlatObs n a) MeasurableSpace.pi μ m K hm _ (coeff q) (leaf q) (hcoeff_meas q) (fun l => (hleaf_lp q l).integrable (by norm_num)) (hterm q) (hleaf_zero q) have hZint : Integrable Z μ := by simpa only [Z] using integrable_finsetSum univ (fun q _ => hYint q) have hZzero : condExp m μ Z =ᵐ[μ] (0 : ((a : FlatIndex n) → FlatObs n a) → ℝ) := by have hs := condExp_finsetSum (μ := μ) (s := univ) (f := Y) (fun q _ => hYint q) m filter_upwards [hs, ae_all_iff.mpr hYzero] with z hs hz simp only [Finset.sum_fn, Finset.sum_apply] at hs dsimp only [Z] rw [hs] simp only [hz, Pi.zero_apply, Finset.sum_const_zero] have hgterm_meas (i j k : Fin 7) (l : Fin K) : StronglyMeasurable[m] (fun z => (1 / 6 : ℝ) * dPhi3 A (pilot c_f C_f (E z) (midpoint K l)) i j k * shift i l z * shift j l z * shift k l z) := by have hd := stronglyMeasurable_dPhi3_pilot_flatTraining c_f C_f L P n hn hP A (midpoint K l) i j k have hs (r : Fin 7) : StronglyMeasurable[m] (shift r l) := stronglyMeasurable_const.sub (stronglyMeasurable_pilot_eval_flatTraining c_f C_f n (midpoint K l) r) exact (((hd.const_mul (1 / 6)).mul (hs i)).mul (hs j)).mul (hs k) have hGmeas : StronglyMeasurable[m] G := by simpa only [G, Finset.sum_apply] using ((Finset.stronglyMeasurable_sum univ fun i _ => Finset.stronglyMeasurable_sum univ fun j _ => Finset.stronglyMeasurable_sum univ fun k _ => Finset.stronglyMeasurable_sum univ fun l _ => hgterm_meas i j k l)).const_mul (K : ℝ)⁻¹ have hGlp : MemLp G 2 μ := by have ht (i j k : Fin 7) (l : Fin K) : MemLp (fun z => (1 / 6 : ℝ) * dPhi3 A (pilot c_f C_f (E z) (midpoint K l)) i j k * shift i l z * shift j l z * shift k l z) 2 μ := by refine MemLp.of_bound ((hgterm_meas i j k l).mono hm).aestronglyMeasurable (M * U ^ 3) ?_ filter_upwards [] with z simp only [Real.norm_eq_abs, abs_mul] have hd := dPhi3_abs_le c_f C_f hP.sourceBounds.1 hP.sourceBounds.2.1 A (pilot c_f C_f (E z) (midpoint K l)) (pilot_mem_clippingRectangle c_f C_f L P n hn hP (E z) (midpoint K l)) i j k have hi := abs_trainingShift_le c_f C_f L P n K hn hP hK (E z) l i have hj := abs_trainingShift_le c_f C_f L P n K hn hP hK (E z) l j have hk := abs_trainingShift_le c_f C_f L P n K hn hP hK (E z) l k change |dPhi3 A (pilot c_f C_f (E z) (midpoint K l)) i j k| ≤ M at hd change |shift i l z| ≤ U at hi change |shift j l z| ≤ U at hj change |shift k l z| ≤ U at hk calc _ ≤ 1 * M * U * U * U := by gcongr <;> norm_num _ = M * U ^ 3 := by ring have hs1 (i j k : Fin 7) : MemLp (fun z => ∑ l : Fin K, (1 / 6 : ℝ) * dPhi3 A (pilot c_f C_f (E z) (midpoint K l)) i j k * shift i l z * shift j l z * shift k l z) 2 μ := memLp_finsetSum univ (fun l _ => ht i j k l) have hs2 (i j : Fin 7) : MemLp (fun z => ∑ k : Fin 7, ∑ l : Fin K, (1 / 6 : ℝ) * dPhi3 A (pilot c_f C_f (E z) (midpoint K l)) i j k * shift i l z * shift j l z * shift k l z) 2 μ := memLp_finsetSum univ (fun k _ => hs1 i j k) have hs3 (i : Fin 7) : MemLp (fun z => ∑ j : Fin 7, ∑ k : Fin 7, ∑ l : Fin K, (1 / 6 : ℝ) * dPhi3 A (pilot c_f C_f (E z) (midpoint K l)) i j k * shift i l z * shift j l z * shift k l z) 2 μ := memLp_finsetSum univ (fun j _ => hs2 i j) have hs4 : MemLp (fun z => ∑ i : Fin 7, ∑ j : Fin 7, ∑ k : Fin 7, ∑ l : Fin K, (1 / 6 : ℝ) * dPhi3 A (pilot c_f C_f (E z) (midpoint K l)) i j k * shift i l z * shift j l z * shift k l z) 2 μ := memLp_finsetSum univ (fun i _ => hs3 i) exact hs4.const_mul (K : ℝ)⁻¹ have hGint : Integrable G μ := hGlp.integrable (by norm_num) have hdecomp : F = Z + G := by funext z dsimp only [F, Z, Y, G] unfold cubicTerm dsimp only change (1 / (6 * (K : ℝ))) * ∑ i : Fin 7, ∑ j : Fin 7, ∑ k : Fin 7, ∑ l : Fin K, dPhi3 A (pilot c_f C_f (E z) (midpoint K l)) i j k * residual c_f C_f (E z) i K 1 (midpoint K l) * residual c_f C_f (E z) j K 2 (midpoint K l) * -- … truncated; follow the source link for the rest …
CausalSmith.Stat.TransportCaceRoughnuisanceLength.condExp_cubicTerm_eq_cubicProjectionMean · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/ExactConditionalMeans.lean:19
CausalSmith.Stat.STAT_TransportCaceRoughnuisanceLength_Research.Helpers.CubicMse.ExactConditionalMeansQuadratic 1 declarations This module identifies the training-conditional mean of the held-out quadratic histogram correction with its deterministic cellwise projection polynomial.

Exact conditional mean of the quadratic correction

This module identifies the training-conditional mean of the held-out quadratic histogram correction with its deterministic cellwise projection polynomial.

theorem condExp_quadraticTerm_eq_quadraticProjectionMean

The exact training-conditional mean of the quadratic correction is its cellwise projection polynomial. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hn :
threshold ≤ n
hP :
ModelClass c_f C_f L P n
A :
condExp (trainingSigma n) (dataLaw P n n) (fun ω : TwoSample n n => quadraticTerm c_f C_f ω A)
=ᵐ[dataLaw P n n] (fun ω => quadraticProjectionMean c_f C_f L P n hP ω A)
Proof (Lean source)
lemma condExp_quadraticTerm_eq_quadraticProjectionMean (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hn : threshold ≤ n) (hP : ModelClass c_f C_f L P n) (A : Bool) : condExp (trainingSigma n) (dataLaw P n n) (fun ω : TwoSample n n => quadraticTerm c_f C_f ω A) =ᵐ[dataLaw P n n] (fun ω => quadraticProjectionMean c_f C_f L P n hP ω A) := by classical let K := quadraticResolution n have hK : 0 < K := by dsimp [K, quadraticResolution, dyadicResolution] split_ifs <;> positivity let E := sumPiEquivProdPi (FlatObs n) have hEembed : @MeasurableEmbedding (TwoSample n n) ((a : FlatIndex n) → FlatObs n a) inferInstance MeasurableSpace.pi (flattenSample n) := (sumPiEquivProdPi (FlatObs n)).symm.measurableEmbedding let μ := Measure.pi (flatLaw P n) let m := comap (finsetCoordProj (Ω := FlatObs n) (flatBlock n 0)) MeasurableSpace.pi let M := fourthDerivativeEnvelope c_f C_f let U := 2 * (1 + C_f) let C := M * (1 + U) / 2 let shift (i : Fin 7) (l : Fin K) (z : (a : FlatIndex n) → FlatObs n a) := cellAverage (fun y => markedDensityVector c_f C_f L P n hP y i) K l - pilot c_f C_f (E z) (midpoint K l) i let coeff (q : Fin 3 × Fin 7 × Fin 7) (l : Fin K) (z : (a : FlatIndex n) → FlatObs n a) := ![(1 / 2 : ℝ) * dPhi2 A (pilot c_f C_f (E z) (midpoint K l)) q.2.1 q.2.2, (1 / 2 : ℝ) * dPhi2 A (pilot c_f C_f (E z) (midpoint K l)) q.2.1 q.2.2 * shift q.2.1 l z, (1 / 2 : ℝ) * dPhi2 A (pilot c_f C_f (E z) (midpoint K l)) q.2.1 q.2.2 * shift q.2.2 l z] q.1 let leaf (q : Fin 3 × Fin 7 × Fin 7) (l : Fin K) (z : (a : FlatIndex n) → FlatObs n a) := ![flatCenteredPairCell P ![q.2.1, q.2.2] ![0, 1] l z, flatCenteredCellScore P q.2.2 2 l (finsetCoordProj (flatBlock n 2) z), flatCenteredCellScore P q.2.1 1 l (finsetCoordProj (flatBlock n 1) z)] q.1 let Y (q : Fin 3 × Fin 7 × Fin 7) (z : (a : FlatIndex n) → FlatObs n a) := (K : ℝ)⁻¹ * ∑ l : Fin K, coeff q l z * leaf q l z let Z (z : (a : FlatIndex n) → FlatObs n a) := ∑ q : Fin 3 × Fin 7 × Fin 7, Y q z let G (z : (a : FlatIndex n) → FlatObs n a) := (K : ℝ)⁻¹ * ∑ i : Fin 7, ∑ j : Fin 7, ∑ l : Fin K, (1 / 2 : ℝ) * dPhi2 A (pilot c_f C_f (E z) (midpoint K l)) i j * shift i l z * shift j l z let F (z : (a : FlatIndex n) → FlatObs n a) := quadraticTerm c_f C_f (E z) A letI : ∀ a, StandardBorelSpace (FlatObs n a) := fun a => by cases a <;> dsimp [FlatObs] <;> infer_instance letI : ∀ a, IsProbabilityMeasure (flatLaw P n a) := fun a => flatLaw_isProbabilityMeasure c_f C_f L P n hP a have hm : m ≤ (MeasurableSpace.pi : MeasurableSpace ((a : FlatIndex n) → FlatObs n a)) := by dsimp [m] exact (measurable_finsetCoordProj (Ω := FlatObs n) (flatBlock n 0)).comap_le have hM : 0 ≤ M := by dsimp [M, fourthDerivativeEnvelope] have hc := hP.sourceBounds.1.1 positivity have hU : 0 ≤ U := by dsimp [U] have := hP.sourceBounds.2.1 positivity have hC : 0 ≤ C := by dsimp [C]; positivity have hcoeff_meas (q : Fin 3 × Fin 7 × Fin 7) (l : Fin K) : StronglyMeasurable[m] (coeff q l) := by rcases q with ⟨t, i, j⟩ have hd := stronglyMeasurable_dPhi2_pilot_flatTraining c_f C_f L P n hn hP A (midpoint K l) i j have hs (r : Fin 7) : StronglyMeasurable[m] (shift r l) := stronglyMeasurable_const.sub (stronglyMeasurable_pilot_eval_flatTraining c_f C_f n (midpoint K l) r) fin_cases t · exact hd.const_mul (1 / 2) · exact (hd.const_mul (1 / 2)).mul (hs i) · exact (hd.const_mul (1 / 2)).mul (hs j) have hcoeff (q : Fin 3 × Fin 7 × Fin 7) : ∀ᵐ z ∂μ, ∀ l, |coeff q l z| ≤ C := by filter_upwards [] with z intro l rcases q with ⟨t, i, j⟩ have hd := dPhi2_abs_le c_f C_f hP.sourceBounds.1 hP.sourceBounds.2.1 A (pilot c_f C_f (E z) (midpoint K l)) (pilot_mem_clippingRectangle c_f C_f L P n hn hP (E z) (midpoint K l)) i j have hsi := abs_trainingShift_le c_f C_f L P n K hn hP hK (E z) l i have hsj := abs_trainingShift_le c_f C_f L P n K hn hP hK (E z) l j change |dPhi2 A (pilot c_f C_f (E z) (midpoint K l)) i j| ≤ M at hd change |shift i l z| ≤ U at hsi change |shift j l z| ≤ U at hsj have hhalf : (0 : ℝ) ≤ 1 / 2 := by norm_num fin_cases t · change |(1 / 2 : ℝ) * dPhi2 A (pilot c_f C_f (E z) (midpoint K l)) i j| ≤ C rw [abs_mul, abs_of_nonneg hhalf] dsimp [C] nlinarith [mul_nonneg hM hU] · change |(1 / 2 : ℝ) * dPhi2 A (pilot c_f C_f (E z) (midpoint K l)) i j * shift i l z| ≤ C rw [abs_mul, abs_mul, abs_of_nonneg hhalf] dsimp [C] calc _ ≤ 1 / 2 * M * U := by gcongr _ ≤ M * (1 + U) / 2 := by nlinarith [mul_nonneg hM hU] · change |(1 / 2 : ℝ) * dPhi2 A (pilot c_f C_f (E z) (midpoint K l)) i j * shift j l z| ≤ C rw [abs_mul, abs_mul, abs_of_nonneg hhalf] dsimp [C] calc _ ≤ 1 / 2 * M * U := by gcongr _ ≤ M * (1 + U) / 2 := by nlinarith [mul_nonneg hM hU] have hleaf_lp (q : Fin 3 × Fin 7 × Fin 7) (l : Fin K) : MemLp (leaf q l) 2 μ := by rcases q with ⟨t, i, j⟩ fin_cases t · simpa [leaf, μ] using flatCenteredPairCell_memLp c_f C_f L P n K hn hP ![i, j] ![0, 1] (by intro a b hab; fin_cases a <;> fin_cases b <;> simp_all) l · simpa [leaf, μ] using flatCenteredCellScore_comp_memLp c_f C_f L P n K hn hP j 2 l · simpa [leaf, μ] using flatCenteredCellScore_comp_memLp c_f C_f L P n K hn hP i 1 l have hterm (q : Fin 3 × Fin 7 × Fin 7) (l : Fin K) : Integrable (fun z => coeff q l z * leaf q l z) μ := by apply (hleaf_lp q l).integrable (by norm_num) |>.bdd_mul ((hcoeff_meas q l).mono hm).aestronglyMeasurable filter_upwards [hcoeff q] with z hz simpa only [Real.norm_eq_abs] using hz l have hYint (q : Fin 3 × Fin 7 × Fin 7) : Integrable (Y q) μ := (integrable_finset_sum univ (fun l _ => hterm q l)).const_mul (K : ℝ)⁻¹ have hleaf_zero (q : Fin 3 × Fin 7 × Fin 7) (l : Fin K) : condExp m μ (leaf q l) =ᵐ[μ] (0 : ((a : FlatIndex n) → FlatObs n a) → ℝ) := by rcases q with ⟨t, i, j⟩ fin_cases t · simpa [leaf, m, μ] using condExp_flatCenteredPairCell_zero c_f C_f L P n K hn hP ![i, j] ![0, 1] (by intro a b hab; fin_cases a <;> fin_cases b <;> simp_all) l · simpa [leaf, m, μ] using condExp_flatCenteredCellScore_zero c_f C_f L P n K hn hP j 1 l · simpa [leaf, m, μ] using condExp_flatCenteredCellScore_zero c_f C_f L P n K hn hP i 0 l have hYzero (q : Fin 3 × Fin 7 × Fin 7) : condExp m μ (Y q) =ᵐ[μ] (0 : ((a : FlatIndex n) → FlatObs n a) → ℝ) := by exact @condExp_weighted_cellAverage_zero ((a : FlatIndex n) → FlatObs n a) MeasurableSpace.pi μ m K hm _ (coeff q) (leaf q) (hcoeff_meas q) (fun l => (hleaf_lp q l).integrable (by norm_num)) (hterm q) (hleaf_zero q) have hZint : Integrable Z μ := by simpa only [Z] using integrable_finset_sum univ (fun q _ => hYint q) have hZzero : condExp m μ Z =ᵐ[μ] (0 : ((a : FlatIndex n) → FlatObs n a) → ℝ) := by have hs := condExp_finsetSum (μ := μ) (s := univ) (f := Y) (fun q _ => hYint q) m filter_upwards [hs, ae_all_iff.mpr hYzero] with z hs hz simp only [Finset.sum_fn, Finset.sum_apply] at hs dsimp only [Z] rw [hs] simp only [hz, Pi.zero_apply, Finset.sum_const_zero] have hGmeas : StronglyMeasurable[m] G := by have ht (i j : Fin 7) (l : Fin K) : StronglyMeasurable[m] (fun z => (1 / 2 : ℝ) * dPhi2 A (pilot c_f C_f (E z) (midpoint K l)) i j * shift i l z * shift j l z) := by have hd := stronglyMeasurable_dPhi2_pilot_flatTraining c_f C_f L P n hn hP A (midpoint K l) i j have hs (r : Fin 7) : StronglyMeasurable[m] (shift r l) := stronglyMeasurable_const.sub (stronglyMeasurable_pilot_eval_flatTraining c_f C_f n (midpoint K l) r) exact ((hd.const_mul (1 / 2)).mul (hs i)).mul (hs j) simpa only [G, Finset.sum_apply] using ((Finset.stronglyMeasurable_sum univ fun i _ => Finset.stronglyMeasurable_sum univ fun j _ => Finset.stronglyMeasurable_sum univ fun l _ => ht i j l)).const_mul (K : ℝ)⁻¹ have hGlp : MemLp G 2 μ := by have ht (i j : Fin 7) (l : Fin K) : MemLp (fun z => (1 / 2 : ℝ) * dPhi2 A (pilot c_f C_f (E z) (midpoint K l)) i j * shift i l z * shift j l z) 2 μ := by have htm : StronglyMeasurable[m] (fun z => (1 / 2 : ℝ) * dPhi2 A (pilot c_f C_f (E z) (midpoint K l)) i j * shift i l z * shift j l z) := by have hd := stronglyMeasurable_dPhi2_pilot_flatTraining c_f C_f L P n hn hP A (midpoint K l) i j have hs (r : Fin 7) : StronglyMeasurable[m] (shift r l) := stronglyMeasurable_const.sub (stronglyMeasurable_pilot_eval_flatTraining c_f C_f n (midpoint K l) r) exact ((hd.const_mul (1 / 2)).mul (hs i)).mul (hs j) refine MemLp.of_bound (htm.mono hm).aestronglyMeasurable (M * U ^ 2) ?_ filter_upwards [] with z simp only [Real.norm_eq_abs, abs_mul] have hd := dPhi2_abs_le c_f C_f hP.sourceBounds.1 hP.sourceBounds.2.1 A (pilot c_f C_f (E z) (midpoint K l)) (pilot_mem_clippingRectangle c_f C_f L P n hn hP (E z) (midpoint K l)) i j have hi := abs_trainingShift_le c_f C_f L P n K hn hP hK (E z) l i have hj := abs_trainingShift_le c_f C_f L P n K hn hP hK (E z) l j change |dPhi2 A (pilot c_f C_f (E z) (midpoint K l)) i j| ≤ M at hd change |shift i l z| ≤ U at hi change |shift j l z| ≤ U at hj calc _ ≤ 1 * M * U * U := by gcongr <;> norm_num _ = M * U ^ 2 := by ring have hs1 (i j : Fin 7) : MemLp (fun z => ∑ l : Fin K, (1 / 2 : ℝ) * dPhi2 A (pilot c_f C_f (E z) (midpoint K l)) i j * shift i l z * shift j l z) 2 μ := memLp_finsetSum univ (fun l _ => ht i j l) have hs2 (i : Fin 7) : MemLp (fun z => ∑ j : Fin 7, ∑ l : Fin K, (1 / 2 : ℝ) * dPhi2 A (pilot c_f C_f (E z) (midpoint K l)) i j * shift i l z * shift j l z) 2 μ := memLp_finsetSum univ (fun j _ => hs1 i j) have hs3 : MemLp (fun z => ∑ i : Fin 7, ∑ j : Fin 7, ∑ l : Fin K, (1 / 2 : ℝ) * dPhi2 A (pilot c_f C_f (E z) (midpoint K l)) i j * shift i l z * shift j l z) 2 μ := memLp_finsetSum univ (fun i _ => hs2 i) exact hs3.const_mul (K : ℝ)⁻¹ have hGint : Integrable G μ := hGlp.integrable (by norm_num) have hdecomp : F = Z + G := by funext z dsimp only [F, Z, Y, G] unfold quadraticTerm dsimp only change (1 / (2 * (K : ℝ))) * ∑ i : Fin 7, ∑ j : Fin 7, ∑ l : Fin K, dPhi2 A (pilot c_f C_f (E z) (midpoint K l)) i j * residual c_f C_f (E z) i K 1 (midpoint K l) * residual c_f C_f (E z) j K 2 (midpoint K l) = _ simp only [Pi.add_apply] rw [Fintype.sum_prod_type] simp_rw [Fintype.sum_prod_type] rw [Fin.sum_univ_three] simp [coeff, leaf] simp only [← Finset.mul_sum, ← Finset.sum_add_distrib] rw [← mul_add, ← mul_add, ← mul_add, mul_assoc] apply congrArg (fun x : ℝ => (K : ℝ)⁻¹ * x) simp only [← Finset.sum_add_distrib, Finset.mul_sum] apply Finset.sum_congr rfl intro i _ apply Finset.sum_congr rfl intro j _ apply Finset.sum_congr rfl intro l _ have hdec := quadratic_residual_three_subset_decomposition c_f C_f L P hn hP hK (E z) i j l dsimp only at hdec simp only [E, MeasurableEquiv.symm_apply_apply] at hdec dsimp only [shift] simp [flatCenteredPairCell, Fin.prod_univ_two] linear_combination ((1 / 2 : ℝ) * dPhi2 A (pilot c_f C_f (E z) (midpoint K l)) i j) * hdec have hFint : Integrable F μ := by rw [hdecomp] -- … truncated; follow the source link for the rest …
CausalSmith.Stat.TransportCaceRoughnuisanceLength.condExp_quadraticTerm_eq_quadraticProjectionMean · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/ExactConditionalMeansQuadratic.lean:19
CausalSmith.Stat.STAT_TransportCaceRoughnuisanceLength_Research.Helpers.CubicMse.ExactFluctuation 3 declarations The pilot integral cancels from the fluctuation about the projected mean.

Exact estimator fluctuation and its integrated variance bound

The pilot integral cancels from the fluctuation about the projected mean. The three exact conditional means then identify this fluctuation with the centered corrections in roadmap (20).

theorem cubicEstimator_sub_projectedEstimatorMean_eq_centered_corrections

The full estimator fluctuation is exactly the sum of the three centered corrections, almost surely under the two-sample experiment. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hn :
threshold ≤ n
hP :
ModelClass c_f C_f L P n
A :
(fun ω : TwoSample n n => cubicEstimator c_f C_f ω A - projectedEstimatorMean c_f C_f L P n hP ω A)
=ᵐ[dataLaw P n n] (fun ω => (linearTerm c_f C_f ω A - condExp (trainingSigma n) (dataLaw P n n) (fun ξ => linearTerm c_f C_f ξ A) ω) + (quadraticTerm c_f C_f ω A - condExp (trainingSigma n) (dataLaw P n n) (fun ξ => quadraticTerm c_f C_f ξ A) ω) + (cubicTerm c_f C_f ω A - condExp (trainingSigma n) (dataLaw P n n) (fun ξ => cubicTerm c_f C_f ξ A) ω))
Proof (Lean source)
-- @node: cubicEstimator_sub_projectedEstimatorMean_eq_centered_corrections lemma cubicEstimator_sub_projectedEstimatorMean_eq_centered_corrections (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hn : threshold ≤ n) (hP : ModelClass c_f C_f L P n) (A : Bool) : (fun ω : TwoSample n n => cubicEstimator c_f C_f ω A - projectedEstimatorMean c_f C_f L P n hP ω A) =ᵐ[dataLaw P n n] (fun ω => (linearTerm c_f C_f ω A - condExp (trainingSigma n) (dataLaw P n n) (fun ξ => linearTerm c_f C_f ξ A) ω) + (quadraticTerm c_f C_f ω A - condExp (trainingSigma n) (dataLaw P n n) (fun ξ => quadraticTerm c_f C_f ξ A) ω) + (cubicTerm c_f C_f ω A - condExp (trainingSigma n) (dataLaw P n n) (fun ξ => cubicTerm c_f C_f ξ A) ω)) := by have hl := condExp_linearTerm_eq_linearProjectionMean c_f C_f L P n hn hP A have hq := condExp_quadraticTerm_eq_quadraticProjectionMean c_f C_f L P n hn hP A have hc := condExp_cubicTerm_eq_cubicProjectionMean c_f C_f L P n hn hP A filter_upwards [hl, hq, hc] with ω hl hq hc rw [hl, hq, hc] simp only [cubicEstimator, not_lt.mpr hn, ↓reduceIte, projectedEstimatorMean] ring
CausalSmith.Stat.TransportCaceRoughnuisanceLength.cubicEstimator_sub_projectedEstimatorMean_eq_centered_corrections · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/ExactFluctuation.lean:19
theorem cubicEstimator_sub_projectedEstimatorMean_memLp

The fluctuation of the exact full statistic is square integrable, using square integrability already established by the component variance proofs. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hn :
threshold ≤ n
hP :
ModelClass c_f C_f L P n
A :
MemLp (fun ω : TwoSample n n => cubicEstimator c_f C_f ω A - projectedEstimatorMean c_f C_f L P n hP ω A) 2 (dataLaw P n n)
Proof (Lean source)
-- @node: cubicEstimator_sub_projectedEstimatorMean_memLp lemma cubicEstimator_sub_projectedEstimatorMean_memLp (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hn : threshold ≤ n) (hP : ModelClass c_f C_f L P n) (A : Bool) : MemLp (fun ω : TwoSample n n => cubicEstimator c_f C_f ω A - projectedEstimatorMean c_f C_f L P n hP ω A) 2 (dataLaw P n n) := by have hl := (linear_conditional_variance_with_memLp c_f C_f L P n hn hP A).1 have hq := (quadratic_conditional_variance_with_memLp c_f C_f L P n hn hP A).1 have hc := (cubic_conditional_variance_with_memLp c_f C_f L P n hn hP A).1 have hsum := (hl.add (hq.sub (hq.condExp (m := trainingSigma n) (by norm_num)))).add (hc.sub (hc.condExp (m := trainingSigma n) (by norm_num))) exact MemLp.ae_eq (cubicEstimator_sub_projectedEstimatorMean_eq_centered_corrections c_f C_f L P n hn hP A).symm hsum
CausalSmith.Stat.TransportCaceRoughnuisanceLength.cubicEstimator_sub_projectedEstimatorMean_memLp · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/ExactFluctuation.lean:42
theorem cubicEstimator_fluctuation_second_moment_sample_rate

Roadmap (20) bounds the unconditional second moment of the exact full estimator's fluctuation about its projected mean. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hn :
threshold ≤ n
hP :
ModelClass c_f C_f L P n
A :
(∫ ω, (cubicEstimator c_f C_f ω A - projectedEstimatorMean c_f C_f L P n hP ω A) ^ 2 ∂dataLaw P n n)
≤ 3 * (10 * (7 : ℝ) ^ 2 * (fourthDerivativeEnvelope c_f C_f) ^ 2 + 60 * quadVarianceConstant c_f C_f + 310 * cubicVarianceConstant c_f C_f) * (n : ℝ) ^ (-(2 / 3 : ℝ))
Proof (Lean source)
-- @node: cubicEstimator_fluctuation_second_moment_sample_rate lemma cubicEstimator_fluctuation_second_moment_sample_rate (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hn : threshold ≤ n) (hP : ModelClass c_f C_f L P n) (A : Bool) : (∫ ω, (cubicEstimator c_f C_f ω A - projectedEstimatorMean c_f C_f L P n hP ω A) ^ 2 ∂dataLaw P n n) ≤ 3 * (10 * (7 : ℝ) ^ 2 * (fourthDerivativeEnvelope c_f C_f) ^ 2 + 60 * quadVarianceConstant c_f C_f + 310 * cubicVarianceConstant c_f C_f) * (n : ℝ) ^ (-(2 / 3 : ℝ)) := by let := sourceObsLaw_isProbabilityMeasure c_f C_f L P n hP let := targetXLaw_isProbabilityMeasure c_f C_f L P n hP let : IsProbabilityMeasure (dataLaw P n n) := by rw [dataLaw_eq_source_target_pi c_f C_f L P n hP] infer_instance have hm : trainingSigma n ≤ (inferInstance : MeasurableSpace (TwoSample n n)) := by rw [trainingSigma_eq_comap_flatTrainingProj] exact ((measurable_finsetCoordProj (flatBlock n 0)).comp (sumPiEquivProdPi (FlatObs n)).symm.measurable).comap_le have heq := cubicEstimator_sub_projectedEstimatorMean_eq_centered_corrections c_f C_f L P n hn hP A have hsquare := heq.fun_comp (fun z : ℝ => z ^ 2) have hi := integral_congr_ae hsquare simp only [Function.comp_apply] at hi rw [hi, ← integral_condExp hm] exact centered_corrections_expected_conditional_second_moment_sample_rate c_f C_f L P n hn hP A
CausalSmith.Stat.TransportCaceRoughnuisanceLength.cubicEstimator_fluctuation_second_moment_sample_rate · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/ExactFluctuation.lean:59
CausalSmith.Stat.STAT_TransportCaceRoughnuisanceLength_Research.Helpers.CubicMse.ExactStatisticBridge 23 declarations This file identifies the abstract block-centering constants with the marked-density cell averages used by the quadratic and cubic statistics.

Exact bridges from histogram residuals to centered block scores

This file identifies the abstract block-centering constants with the marked-density cell averages used by the quadratic and cubic statistics. It also records that the clipped pilot and its Taylor coefficients are measurable with respect to the training block.

theorem integral_flatBlockHeight_eq_cellAverage

The mean of every flattened held-out block height is the corresponding marked-density cell average. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n K :
ℕ
hn :
threshold ≤ n
hP :
ModelClass c_f C_f L P n
hK :
0 < K
i :
Fin 7
b :
Fin 4
l :
Fin K
(∫ x, flatBlockHeight i b l (finsetCoordProj (flatBlock n b) x) ∂Measure.pi (flatLaw P n))
= cellAverage (fun y => markedDensityVector c_f C_f L P n hP y i) K l
Proof (Lean source)
lemma integral_flatBlockHeight_eq_cellAverage (c_f C_f L : ℝ) (P : TransportLaw) (n K : ℕ) (hn : threshold ≤ n) (hP : ModelClass c_f C_f L P n) (hK : 0 < K) (i : Fin 7) (b : Fin 4) (l : Fin K) : (∫ x, flatBlockHeight i b l (finsetCoordProj (flatBlock n b) x) ∂Measure.pi (flatLaw P n)) = cellAverage (fun y => markedDensityVector c_f C_f L P n hP y i) K l := by letI : IsProbabilityMeasure (sourceObsLaw P) := sourceObsLaw_isProbabilityMeasure c_f C_f L P n hP letI : IsProbabilityMeasure (targetXLaw P) := targetXLaw_isProbabilityMeasure c_f C_f L P n hP letI : ∀ a, IsProbabilityMeasure (flatLaw P n a) := fun a => flatLaw_isProbabilityMeasure c_f C_f L P n hP a have hcard : 0 < (blockIdx n b).card := by rw [block_card] exact blockSize_pos_of_threshold n hn b let E := sumPiEquivProdPi (FlatObs n) let μS := Measure.pi (fun _ : Fin n => sourceObsLaw P) let μT := Measure.pi (fun _ : Fin n => targetXLaw P) by_cases hi : i = 0 · subst i have hfun : (fun x : (a : FlatIndex n) → FlatObs n a => flatBlockHeight 0 b l (finsetCoordProj (flatBlock n b) x)) = (fun p : (Fin n → SourceObs) × (Fin n → ℝ) => iidBlockHeight K (blockIdx n b) (targetCellScore K l) p.2) ∘ E := by funext x exact flatBlockHeight_proj_target x b l rw [hfun] have hE := measurePreserving_sumPiEquivProdPi (flatLaw P n) have hg : AEStronglyMeasurable (fun p : (Fin n → SourceObs) × (Fin n → ℝ) => iidBlockHeight K (blockIdx n b) (targetCellScore K l) p.2) ((Measure.pi (flatLaw P n)).map E) := by rw [hE.map_eq] exact (by unfold iidBlockHeight; fun_prop : Measurable _).aestronglyMeasurable have htransfer0 := (integral_map hE.measurable.aemeasurable hg).symm rw [hE.map_eq] at htransfer0 have htransfer : (∫ x, ((fun p : (Fin n → SourceObs) × (Fin n → ℝ) => iidBlockHeight K (blockIdx n b) (targetCellScore K l) p.2) ∘ E) x ∂Measure.pi (flatLaw P n)) = ∫ p, iidBlockHeight K (blockIdx n b) (targetCellScore K l) p.2 ∂μS.prod μT := by simpa [E, μS, μT, flatLaw] using htransfer0 rw [htransfer] have hsnd := measurePreserving_snd (μ := μS) (ν := μT) have hs : AEStronglyMeasurable (iidBlockHeight K (blockIdx n b) (targetCellScore K l)) ((μS.prod μT).map snd) := by rw [hsnd.map_eq] fun_prop have htransfer' := (integral_map hsnd.measurable.aemeasurable hs).symm rw [hsnd.map_eq] at htransfer' rw [htransfer'] simpa [μS, μT, markedDensityVector] using target_bin_height_mean_eq_cellAverage c_f C_f L P n K hP hK (blockIdx n b) hcard l · have hfun : (fun x : (a : FlatIndex n) → FlatObs n a => flatBlockHeight i b l (finsetCoordProj (flatBlock n b) x)) = (fun p : (Fin n → SourceObs) × (Fin n → ℝ) => iidBlockHeight K (blockIdx n b) (sourceCellScore i K l) p.1) ∘ E := by funext x exact flatBlockHeight_proj_source i hi x b l rw [hfun] have hE := measurePreserving_sumPiEquivProdPi (flatLaw P n) have hg : AEStronglyMeasurable (fun p : (Fin n → SourceObs) × (Fin n → ℝ) => iidBlockHeight K (blockIdx n b) (sourceCellScore i K l) p.1) ((Measure.pi (flatLaw P n)).map E) := by rw [hE.map_eq] exact (by unfold iidBlockHeight; fun_prop : Measurable _).aestronglyMeasurable have htransfer0 := (integral_map hE.measurable.aemeasurable hg).symm rw [hE.map_eq] at htransfer0 have htransfer : (∫ x, ((fun p : (Fin n → SourceObs) × (Fin n → ℝ) => iidBlockHeight K (blockIdx n b) (sourceCellScore i K l) p.1) ∘ E) x ∂Measure.pi (flatLaw P n)) = ∫ p, iidBlockHeight K (blockIdx n b) (sourceCellScore i K l) p.1 ∂μS.prod μT := by simpa [E, μS, μT, flatLaw] using htransfer0 rw [htransfer] have hfst := measurePreserving_fst (μ := μS) (ν := μT) have hs : AEStronglyMeasurable (iidBlockHeight K (blockIdx n b) (sourceCellScore i K l)) ((μS.prod μT).map fst) := by rw [hfst.map_eq] fun_prop have htransfer' := (integral_map hfst.measurable.aemeasurable hs).symm rw [hfst.map_eq] at htransfer' rw [htransfer'] simpa [μS, μT] using source_bin_height_mean_eq_cellAverage c_f C_f L P n K hP hK (blockIdx n b) hcard l i hi
CausalSmith.Stat.TransportCaceRoughnuisanceLength.integral_flatBlockHeight_eq_cellAverage · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/ExactStatisticBridge.lean:24
theorem residual_eq_flatCenteredCellScore_add_trainingShift

At a cell midpoint, each exact histogram residual is its block-centered score plus the training shift from the true cell average to the clipped pilot. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n K :
ℕ
hn :
threshold ≤ n
hP :
ModelClass c_f C_f L P n
hK :
0 < K
ω :
i :
Fin 7
b :
Fin 4
l :
Fin K
residual c_f C_f ω i K b (midpoint K l)
+ (cellAverage (fun y => markedDensityVector c_f C_f L P n hP y i) K l - pilot c_f C_f ω (midpoint K l) i)
Proof (Lean source)
lemma residual_eq_flatCenteredCellScore_add_trainingShift (c_f C_f L : ℝ) (P : TransportLaw) {n K : ℕ} (hn : threshold ≤ n) (hP : ModelClass c_f C_f L P n) (hK : 0 < K) (ω : TwoSample n n) (i : Fin 7) (b : Fin 4) (l : Fin K) : residual c_f C_f ω i K b (midpoint K l) = flatCenteredCellScore P i b l (finsetCoordProj (flatBlock n b) (flattenSample n ω)) + (cellAverage (fun y => markedDensityVector c_f C_f L P n hP y i) K l - pilot c_f C_f ω (midpoint K l) i) := by unfold residual flatCenteredCellScore rw [flatBlockHeight_proj hn hK, integral_flatBlockHeight_eq_cellAverage c_f C_f L P n K hn hP hK] simp only [flattenSample, MeasurableEquiv.apply_symm_apply] ring
CausalSmith.Stat.TransportCaceRoughnuisanceLength.residual_eq_flatCenteredCellScore_add_trainingShift · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/ExactStatisticBridge.lean:120
theorem channelX_trainingView

A training-block channel covariate is unchanged by the training view. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
n :
ℕ
ω :
i :
Fin 7
r :
Fin n
hr :
r ∈ blockIdx n 0
channelX (trainingView ω) i r = channelX ω i r
Proof (Lean source)
lemma channelX_trainingView {n : ℕ} (ω : TwoSample n n) (i : Fin 7) (r : Fin n) (hr : r ∈ blockIdx n 0) : channelX (trainingView ω) i r = channelX ω i r := by unfold channelX split_ifs <;> simp [trainingView, hr]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.channelX_trainingView · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/ExactStatisticBridge.lean:137
theorem channelMark_trainingView

A training-block channel mark is unchanged by the training view. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
n :
ℕ
ω :
i :
Fin 7
r :
Fin n
hr :
r ∈ blockIdx n 0
Proof (Lean source)
lemma channelMark_trainingView {n : ℕ} (ω : TwoSample n n) (i : Fin 7) (r : Fin n) (hr : r ∈ blockIdx n 0) : channelMark (trainingView ω) i r = channelMark ω i r := by simp [channelMark, trainingView, hr]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.channelMark_trainingView · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/ExactStatisticBridge.lean:144
theorem markedHistogram_trainingView

The block-zero histogram only sees the training view. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
n :
ℕ
ω :
i :
Fin 7
K :
ℕ
x :
ℝ
markedHistogram (trainingView ω) i K 0 x = markedHistogram ω i K 0 x
Proof (Lean source)
lemma markedHistogram_trainingView {n : ℕ} (ω : TwoSample n n) (i : Fin 7) (K : ℕ) (x : ℝ) : markedHistogram (trainingView ω) i K 0 x = markedHistogram ω i K 0 x := by unfold markedHistogram split_ifs with hn · rfl · apply Finset.sum_congr rfl intro l _ split_ifs · congr 1 apply Finset.sum_congr rfl intro r hr rw [channelMark_trainingView ω i r hr, channelX_trainingView ω i r hr] · rfl
CausalSmith.Stat.TransportCaceRoughnuisanceLength.markedHistogram_trainingView · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/ExactStatisticBridge.lean:150
theorem pilot_trainingView

The clipped pilot only sees the training view. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f :
ℝ
n :
ℕ
ω :
x :
ℝ
pilot c_f C_f (trainingView ω) x = pilot c_f C_f ω x
Proof (Lean source)
lemma pilot_trainingView (c_f C_f : ℝ) {n : ℕ} (ω : TwoSample n n) (x : ℝ) : pilot c_f C_f (trainingView ω) x = pilot c_f C_f ω x := by unfold pilot split_ifs · rfl · funext i rw [markedHistogram_trainingView]
theorem measurable_pilot_eval

A fixed pilot coordinate is measurable in the full sample. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f :
ℝ
n :
ℕ
x :
ℝ
i :
Fin 7
Measurable (fun ω : TwoSample n n => pilot c_f C_f ω x i)
Proof (Lean source)
@[fun_prop] lemma measurable_pilot_eval (c_f C_f : ℝ) {n : ℕ} (x : ℝ) (i : Fin 7) : Measurable (fun ω : TwoSample n n => pilot c_f C_f ω x i) := by by_cases hn : n < threshold · simp only [pilot, if_pos hn] fun_prop · simp only [pilot, if_neg hn] unfold clipChannel clip split_ifs <;> exact measurable_const.max (measurable_const.min (measurable_markedHistogram i (pilotResolution n) 0 x))
CausalSmith.Stat.TransportCaceRoughnuisanceLength.measurable_pilot_eval · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/ExactStatisticBridge.lean:176
theorem stronglyMeasurable_pilot_eval_trainingSigma

A fixed pilot coordinate is strongly measurable with respect to the training σ-algebra. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f :
ℝ
n :
ℕ
x :
ℝ
i :
Fin 7
StronglyMeasurable[trainingSigma n] (fun ω : TwoSample n n => pilot c_f C_f ω x i)
Proof (Lean source)
@[fun_prop] lemma stronglyMeasurable_pilot_eval_trainingSigma (c_f C_f : ℝ) {n : ℕ} (x : ℝ) (i : Fin 7) : StronglyMeasurable[trainingSigma n] (fun ω : TwoSample n n => pilot c_f C_f ω x i) := by have h : StronglyMeasurable[trainingSigma n] ((fun ω : TwoSample n n => pilot c_f C_f ω x i) ∘ trainingView) := (measurable_pilot_eval c_f C_f (n := n) x i).stronglyMeasurable.comp_measurable (comap_measurable (trainingView (n := n))) convert h using 1 funext ω exact (congrFun (pilot_trainingView c_f C_f ω x) i).symm
CausalSmith.Stat.TransportCaceRoughnuisanceLength.stronglyMeasurable_pilot_eval_trainingSigma · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/ExactStatisticBridge.lean:189
theorem dPhi2_pilot_eq_explicit

At the clipped pilot, the second derivative coefficient equals its explicit rational formula. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hn :
threshold ≤ n
hP :
ModelClass c_f C_f L P n
A :
x :
ℝ
i j :
Fin 7
ω :
dPhi2 A (pilot c_f C_f ω x) i j
= cubicRatioD2Apply 0 (if A then 4 else 6) 2 (basis i) (basis j) (pilot c_f C_f ω x)
- cubicRatioD2Apply 0 (if A then 3 else 5) 1 (basis i) (basis j) (pilot c_f C_f ω x)
Proof (Lean source)
lemma dPhi2_pilot_eq_explicit (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hn : threshold ≤ n) (hP : ModelClass c_f C_f L P n) (A : Bool) (x : ℝ) (i j : Fin 7) (ω : TwoSample n n) : dPhi2 A (pilot c_f C_f ω x) i j = cubicRatioD2Apply 0 (if A then 4 else 6) 2 (basis i) (basis j) (pilot c_f C_f ω x) - cubicRatioD2Apply 0 (if A then 3 else 5) 1 (basis i) (basis j) (pilot c_f C_f ω x) := by have hv := pilot_mem_clippingRectangle c_f C_f L P n hn hP ω x have hcf : 0 < c_f := hP.sourceBounds.1.1 have h1 : pilot c_f C_f ω x 1 ≠ 0 := ne_of_gt (lt_of_lt_of_le (by positivity : 0 < c_f / 4) hv.2.1.1) have h2 : pilot c_f C_f ω x 2 ≠ 0 := ne_of_gt (lt_of_lt_of_le (by positivity : 0 < c_f / 4) hv.2.2.1.1) unfold dPhi2 exact iteratedFDeriv_two_Phi A (pilot c_f C_f ω x) (basis i) (basis j) h1 h2
CausalSmith.Stat.TransportCaceRoughnuisanceLength.dPhi2_pilot_eq_explicit · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/ExactStatisticBridge.lean:204
theorem dPhi3_pilot_eq_explicit

At the clipped pilot, the third derivative coefficient equals its explicit rational formula. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hn :
threshold ≤ n
hP :
ModelClass c_f C_f L P n
A :
x :
ℝ
i j k :
Fin 7
ω :
dPhi3 A (pilot c_f C_f ω x) i j k
= cubicRatioD3Apply 0 (if A then 4 else 6) 2 (basis i) (basis j) (basis k) (pilot c_f C_f ω x)
- cubicRatioD3Apply 0 (if A then 3 else 5) 1 (basis i) (basis j) (basis k) (pilot c_f C_f ω x)
Proof (Lean source)
lemma dPhi3_pilot_eq_explicit (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hn : threshold ≤ n) (hP : ModelClass c_f C_f L P n) (A : Bool) (x : ℝ) (i j k : Fin 7) (ω : TwoSample n n) : dPhi3 A (pilot c_f C_f ω x) i j k = cubicRatioD3Apply 0 (if A then 4 else 6) 2 (basis i) (basis j) (basis k) (pilot c_f C_f ω x) - cubicRatioD3Apply 0 (if A then 3 else 5) 1 (basis i) (basis j) (basis k) (pilot c_f C_f ω x) := by have hv := pilot_mem_clippingRectangle c_f C_f L P n hn hP ω x have hcf : 0 < c_f := hP.sourceBounds.1.1 have h1 : pilot c_f C_f ω x 1 ≠ 0 := ne_of_gt (lt_of_lt_of_le (by positivity : 0 < c_f / 4) hv.2.1.1) have h2 : pilot c_f C_f ω x 2 ≠ 0 := ne_of_gt (lt_of_lt_of_le (by positivity : 0 < c_f / 4) hv.2.2.1.1) unfold dPhi3 exact iteratedFDeriv_three_Phi A (pilot c_f C_f ω x) (basis i) (basis j) (basis k) h1 h2
CausalSmith.Stat.TransportCaceRoughnuisanceLength.dPhi3_pilot_eq_explicit · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/ExactStatisticBridge.lean:224
theorem stronglyMeasurable_dPhi2_pilot_trainingSigma

Every quadratic Taylor coefficient evaluated at the clipped pilot is strongly measurable with respect to the training σ-algebra. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hn :
threshold ≤ n
hP :
ModelClass c_f C_f L P n
A :
x :
ℝ
i j :
Fin 7
StronglyMeasurable[trainingSigma n] (fun ω : TwoSample n n => dPhi2 A (pilot c_f C_f ω x) i j)
Proof (Lean source)
lemma stronglyMeasurable_dPhi2_pilot_trainingSigma (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hn : threshold ≤ n) (hP : ModelClass c_f C_f L P n) (A : Bool) (x : ℝ) (i j : Fin 7) : StronglyMeasurable[trainingSigma n] (fun ω : TwoSample n n => dPhi2 A (pilot c_f C_f ω x) i j) := by have hexplicit : StronglyMeasurable[trainingSigma n] (fun ω : TwoSample n n => cubicRatioD2Apply 0 (if A then 4 else 6) 2 (basis i) (basis j) (pilot c_f C_f ω x) - cubicRatioD2Apply 0 (if A then 3 else 5) 1 (basis i) (basis j) (pilot c_f C_f ω x)) := by unfold cubicRatioD2Apply basis fun_prop convert hexplicit using 1 funext ω exact dPhi2_pilot_eq_explicit c_f C_f L P n hn hP A x i j ω
CausalSmith.Stat.TransportCaceRoughnuisanceLength.stronglyMeasurable_dPhi2_pilot_trainingSigma · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/ExactStatisticBridge.lean:244
theorem stronglyMeasurable_dPhi3_pilot_trainingSigma

Every cubic Taylor coefficient evaluated at the clipped pilot is strongly measurable with respect to the training σ-algebra. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hn :
threshold ≤ n
hP :
ModelClass c_f C_f L P n
A :
x :
ℝ
i j k :
Fin 7
StronglyMeasurable[trainingSigma n] (fun ω : TwoSample n n => dPhi3 A (pilot c_f C_f ω x) i j k)
Proof (Lean source)
lemma stronglyMeasurable_dPhi3_pilot_trainingSigma (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hn : threshold ≤ n) (hP : ModelClass c_f C_f L P n) (A : Bool) (x : ℝ) (i j k : Fin 7) : StronglyMeasurable[trainingSigma n] (fun ω : TwoSample n n => dPhi3 A (pilot c_f C_f ω x) i j k) := by have hexplicit : StronglyMeasurable[trainingSigma n] (fun ω : TwoSample n n => cubicRatioD3Apply 0 (if A then 4 else 6) 2 (basis i) (basis j) (basis k) (pilot c_f C_f ω x) - cubicRatioD3Apply 0 (if A then 3 else 5) 1 (basis i) (basis j) (basis k) (pilot c_f C_f ω x)) := by unfold cubicRatioD3Apply basis fun_prop convert hexplicit using 1 funext ω exact dPhi3_pilot_eq_explicit c_f C_f L P n hn hP A x i j k ω
CausalSmith.Stat.TransportCaceRoughnuisanceLength.stronglyMeasurable_dPhi3_pilot_trainingSigma · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/ExactStatisticBridge.lean:263
theorem quadratic_residual_three_subset_decomposition

The exact quadratic residual product, after removing its training-only part, is the sum of its three nonempty centered subsets. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n K :
ℕ
hn :
threshold ≤ n
hP :
ModelClass c_f C_f L P n
hK :
0 < K
ω :
i j :
Fin 7
l :
Fin K
si :
cellAverage (fun y => markedDensityVector c_f C_f L P n hP y i) K l
- pilot c_f C_f ω (midpoint K l) i
sj :
cellAverage (fun y => markedDensityVector c_f C_f L P n hP y j) K l
- pilot c_f C_f ω (midpoint K l) j
residual c_f C_f ω i K 1 (midpoint K l) * residual c_f C_f ω j K 2 (midpoint K l)
- si * sj
= Xi * Xj + si * Xj + sj * Xi
Proof (Lean source)
lemma quadratic_residual_three_subset_decomposition (c_f C_f L : ℝ) (P : TransportLaw) {n K : ℕ} (hn : threshold ≤ n) (hP : ModelClass c_f C_f L P n) (hK : 0 < K) (ω : TwoSample n n) (i j : Fin 7) (l : Fin K) : let Xi := flatCenteredCellScore P i 1 l (finsetCoordProj (flatBlock n 1) (flattenSample n ω)) let Xj := flatCenteredCellScore P j 2 l (finsetCoordProj (flatBlock n 2) (flattenSample n ω)) let si := cellAverage (fun y => markedDensityVector c_f C_f L P n hP y i) K l - pilot c_f C_f ω (midpoint K l) i let sj := cellAverage (fun y => markedDensityVector c_f C_f L P n hP y j) K l - pilot c_f C_f ω (midpoint K l) j residual c_f C_f ω i K 1 (midpoint K l) * residual c_f C_f ω j K 2 (midpoint K l) - si * sj = Xi * Xj + si * Xj + sj * Xi := by dsimp only rw [residual_eq_flatCenteredCellScore_add_trainingShift c_f C_f L P hn hP hK ω i 1 l, residual_eq_flatCenteredCellScore_add_trainingShift c_f C_f L P hn hP hK ω j 2 l] ring
CausalSmith.Stat.TransportCaceRoughnuisanceLength.quadratic_residual_three_subset_decomposition · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/ExactStatisticBridge.lean:282
theorem cubic_residual_seven_subset_decomposition

The exact cubic residual product, after removing its training-only part, is the sum of its seven nonempty centered subsets. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n K :
ℕ
hn :
threshold ≤ n
hP :
ModelClass c_f C_f L P n
hK :
0 < K
ω :
i j k :
Fin 7
l :
Fin K
si :
cellAverage (fun y => markedDensityVector c_f C_f L P n hP y i) K l
- pilot c_f C_f ω (midpoint K l) i
sj :
cellAverage (fun y => markedDensityVector c_f C_f L P n hP y j) K l
- pilot c_f C_f ω (midpoint K l) j
sk :
cellAverage (fun y => markedDensityVector c_f C_f L P n hP y k) K l
- pilot c_f C_f ω (midpoint K l) k
residual c_f C_f ω i K 1 (midpoint K l) * residual c_f C_f ω j K 2 (midpoint K l) * residual c_f C_f ω k K 3 (midpoint K l)
- si * sj * sk
= Xi * Xj * Xk
+ si * Xj * Xk
+ sj * Xi * Xk
+ sk * Xi * Xj
+ si * sj * Xk
+ si * sk * Xj
+ sj * sk * Xi
Proof (Lean source)
lemma cubic_residual_seven_subset_decomposition (c_f C_f L : ℝ) (P : TransportLaw) {n K : ℕ} (hn : threshold ≤ n) (hP : ModelClass c_f C_f L P n) (hK : 0 < K) (ω : TwoSample n n) (i j k : Fin 7) (l : Fin K) : let Xi := flatCenteredCellScore P i 1 l (finsetCoordProj (flatBlock n 1) (flattenSample n ω)) let Xj := flatCenteredCellScore P j 2 l (finsetCoordProj (flatBlock n 2) (flattenSample n ω)) let Xk := flatCenteredCellScore P k 3 l (finsetCoordProj (flatBlock n 3) (flattenSample n ω)) let si := cellAverage (fun y => markedDensityVector c_f C_f L P n hP y i) K l - pilot c_f C_f ω (midpoint K l) i let sj := cellAverage (fun y => markedDensityVector c_f C_f L P n hP y j) K l - pilot c_f C_f ω (midpoint K l) j let sk := cellAverage (fun y => markedDensityVector c_f C_f L P n hP y k) K l - pilot c_f C_f ω (midpoint K l) k residual c_f C_f ω i K 1 (midpoint K l) * residual c_f C_f ω j K 2 (midpoint K l) * residual c_f C_f ω k K 3 (midpoint K l) - si * sj * sk = Xi * Xj * Xk + si * Xj * Xk + sj * Xi * Xk + sk * Xi * Xj + si * sj * Xk + si * sk * Xj + sj * sk * Xi := by dsimp only rw [residual_eq_flatCenteredCellScore_add_trainingShift c_f C_f L P hn hP hK ω i 1 l, residual_eq_flatCenteredCellScore_add_trainingShift c_f C_f L P hn hP hK ω j 2 l, residual_eq_flatCenteredCellScore_add_trainingShift c_f C_f L P hn hP hK ω k 3 l] ring
CausalSmith.Stat.TransportCaceRoughnuisanceLength.cubic_residual_seven_subset_decomposition · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/ExactStatisticBridge.lean:308
theorem flatCenteredCellScore_comp_memLp

A single centered held-out cell score is square integrable under the flattened product experiment. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n K :
ℕ
hn :
threshold ≤ n
hP :
ModelClass c_f C_f L P n
i :
Fin 7
b :
Fin 4
l :
Fin K
MemLp (fun x => flatCenteredCellScore P i b l (finsetCoordProj (flatBlock n b) x)) 2 (Measure.pi (flatLaw P n))
Proof (Lean source)
lemma flatCenteredCellScore_comp_memLp (c_f C_f L : ℝ) (P : TransportLaw) (n K : ℕ) (hn : threshold ≤ n) (hP : ModelClass c_f C_f L P n) (i : Fin 7) (b : Fin 4) (l : Fin K) : MemLp (fun x => flatCenteredCellScore P i b l (finsetCoordProj (flatBlock n b) x)) 2 (Measure.pi (flatLaw P n)) := by let : ∀ a, IsProbabilityMeasure (flatLaw P n a) := fun a => flatLaw_isProbabilityMeasure c_f C_f L P n hP a exact (flatBlockHeight_memLp c_f C_f L P n K hn hP i b l).sub (memLp_const _)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.flatCenteredCellScore_comp_memLp · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/ExactStatisticBridge.lean:343
theorem flatCenteredPairCell_memLp

A product of centered scores from two distinct evaluation blocks is square integrable under the flattened product experiment. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n K :
ℕ
hn :
threshold ≤ n
hP :
ModelClass c_f C_f L P n
i :
Fin 2 → Fin 7
b :
Fin 2 → Fin 3
hb :
l :
Fin K
MemLp (flatCenteredPairCell P i b l) 2 (Measure.pi (flatLaw P n))
Proof (Lean source)
lemma flatCenteredPairCell_memLp (c_f C_f L : ℝ) (P : TransportLaw) (n K : ℕ) (hn : threshold ≤ n) (hP : ModelClass c_f C_f L P n) (i : Fin 2 → Fin 7) (b : Fin 2 → Fin 3) (hb : Injective b) (l : Fin K) : MemLp (flatCenteredPairCell P i b l) 2 (Measure.pi (flatLaw P n)) := by let : ∀ a, StandardBorelSpace (FlatObs n a) := fun a => by cases a <;> dsimp [FlatObs] <;> infer_instance let : ∀ a, IsProbabilityMeasure (flatLaw P n a) := fun a => flatLaw_isProbabilityMeasure c_f C_f L P n hP a let μ := Measure.pi (flatLaw P n) let F (t : Fin 2) := flatCenteredCellScore P (n := n) (i t) (b t).succ l have hf (t : Fin 2) : Measurable (F t) := (measurable_flatBlockHeight (i t) (b t).succ l).sub measurable_const have hflp (t : Fin 2) : MemLp (fun x => F t (finsetCoordProj (flatBlock n (b t).succ) x)) 2 μ := flatCenteredCellScore_comp_memLp c_f C_f L P n K hn hP (i t) (b t).succ l have hdisj : Disjoint (flatBlock n (b 0).succ) (flatBlock n (b 1).succ) := flatBlock_eval_pairwise n (hb.ne (by decide : (0 : Fin 2) ≠ 1)) have hs := integrable_twoBlockProduct (flatLaw P n) (flatBlock n (b 0).succ) (flatBlock n (b 1).succ) hdisj (fun z => F 0 z ^ 2) (fun z => F 1 z ^ 2) ((hf 0).pow_const 2) ((hf 1).pow_const 2) ((hflp 0).integrable_sq) ((hflp 1).integrable_sq) apply (memLp_two_iff_integrable_sq ?_).mpr · simpa only [flatCenteredPairCell, Fin.prod_univ_two, mul_pow, F, μ] using hs · have hm : Measurable (fun x => F 0 (finsetCoordProj (flatBlock n (b 0).succ) x) * F 1 (finsetCoordProj (flatBlock n (b 1).succ) x)) := ((hf 0).comp (measurable_finsetCoordProj _)).mul ((hf 1).comp (measurable_finsetCoordProj _)) have hmeas : Measurable (flatCenteredPairCell (n := n) P i b l : ((a : FlatIndex n) → FlatObs n a) → ℝ) := by have heq : (flatCenteredPairCell (n := n) P i b l : ((a : FlatIndex n) → FlatObs n a) → ℝ) = fun x => F 0 (finsetCoordProj (flatBlock n (b 0).succ) x) * F 1 (finsetCoordProj (flatBlock n (b 1).succ) x) := by funext x simp only [flatCenteredPairCell, Fin.prod_univ_two, F] rw [heq] exact hm exact hmeas.aestronglyMeasurable
CausalSmith.Stat.TransportCaceRoughnuisanceLength.flatCenteredPairCell_memLp · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/ExactStatisticBridge.lean:354
theorem measurable_unflattenSample_flatTraining

Unflattening the product experiment is measurable from the block-zero sigma algebra to the paper's training sigma algebra. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
n :
ℕ
Proof (Lean source)
lemma measurable_unflattenSample_flatTraining (n : ℕ) : @Measurable ((a : FlatIndex n) → FlatObs n a) (TwoSample n n) (comap (finsetCoordProj (Ω := FlatObs n) (flatBlock n 0)) pi) (trainingSigma n) (sumPiEquivProdPi (FlatObs n)) := by rw [trainingSigma_eq_comap_flatTrainingProj] rw [measurable_iff_comap_le] rw [MeasurableSpace.comap_comp] have heq : flatTrainingProj n ∘ sumPiEquivProdPi (FlatObs n) = finsetCoordProj (flatBlock n 0) := by funext x simp only [flatTrainingProj, flattenSample, MeasurableEquiv.symm_apply_apply, Function.comp_apply] rw [heq]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.measurable_unflattenSample_flatTraining · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/ExactStatisticBridge.lean:400
theorem stronglyMeasurable_pilot_eval_flatTraining

Pilot coordinates pulled back to the flattened experiment are measurable with respect to block zero. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f :
ℝ
n :
ℕ
x :
ℝ
i :
Fin 7
StronglyMeasurable[ comap (finsetCoordProj (Ω := FlatObs n) (flatBlock n 0)) pi] (fun z => pilot c_f C_f (sumPiEquivProdPi (FlatObs n) z) x i)
Proof (Lean source)
lemma stronglyMeasurable_pilot_eval_flatTraining (c_f C_f : ℝ) (n : ℕ) (x : ℝ) (i : Fin 7) : StronglyMeasurable[ comap (finsetCoordProj (Ω := FlatObs n) (flatBlock n 0)) pi] (fun z => pilot c_f C_f (sumPiEquivProdPi (FlatObs n) z) x i) := (stronglyMeasurable_pilot_eval_trainingSigma c_f C_f x i).comp_measurable (measurable_unflattenSample_flatTraining n)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.stronglyMeasurable_pilot_eval_flatTraining · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/ExactStatisticBridge.lean:417
theorem stronglyMeasurable_dPhi2_pilot_flatTraining

Quadratic derivative coefficients pulled back to the flattened experiment are measurable with respect to block zero. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hn :
threshold ≤ n
hP :
ModelClass c_f C_f L P n
A :
x :
ℝ
i j :
Fin 7
StronglyMeasurable[ comap (finsetCoordProj (Ω := FlatObs n) (flatBlock n 0)) pi] (fun z => dPhi2 A (pilot c_f C_f (sumPiEquivProdPi (FlatObs n) z) x) i j)
Proof (Lean source)
lemma stronglyMeasurable_dPhi2_pilot_flatTraining (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hn : threshold ≤ n) (hP : ModelClass c_f C_f L P n) (A : Bool) (x : ℝ) (i j : Fin 7) : StronglyMeasurable[ comap (finsetCoordProj (Ω := FlatObs n) (flatBlock n 0)) pi] (fun z => dPhi2 A (pilot c_f C_f (sumPiEquivProdPi (FlatObs n) z) x) i j) := (stronglyMeasurable_dPhi2_pilot_trainingSigma c_f C_f L P n hn hP A x i j).comp_measurable (measurable_unflattenSample_flatTraining n)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.stronglyMeasurable_dPhi2_pilot_flatTraining · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/ExactStatisticBridge.lean:429
theorem stronglyMeasurable_dPhi3_pilot_flatTraining

Cubic derivative coefficients pulled back to the flattened experiment are measurable with respect to block zero. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hn :
threshold ≤ n
hP :
ModelClass c_f C_f L P n
A :
x :
ℝ
i j k :
Fin 7
StronglyMeasurable[ comap (finsetCoordProj (Ω := FlatObs n) (flatBlock n 0)) pi] (fun z => dPhi3 A (pilot c_f C_f (sumPiEquivProdPi (FlatObs n) z) x) i j k)
Proof (Lean source)
lemma stronglyMeasurable_dPhi3_pilot_flatTraining (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hn : threshold ≤ n) (hP : ModelClass c_f C_f L P n) (A : Bool) (x : ℝ) (i j k : Fin 7) : StronglyMeasurable[ comap (finsetCoordProj (Ω := FlatObs n) (flatBlock n 0)) pi] (fun z => dPhi3 A (pilot c_f C_f (sumPiEquivProdPi (FlatObs n) z) x) i j k) := (stronglyMeasurable_dPhi3_pilot_trainingSigma c_f C_f L P n hn hP A x i j k).comp_measurable (measurable_unflattenSample_flatTraining n)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.stronglyMeasurable_dPhi3_pilot_flatTraining · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/ExactStatisticBridge.lean:442
theorem markedDensityVector_mem_Icc_zero_Cf

Every marked-density coordinate is nonnegative and bounded by the common model envelope. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hP :
ModelClass c_f C_f L P n
x :
ℝ
hx :
i :
Fin 7
markedDensityVector c_f C_f L P n hP x i ∈ Icc 0 C_f
Proof (Lean source)
lemma markedDensityVector_mem_Icc_zero_Cf (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hP : ModelClass c_f C_f L P n) (x : ℝ) (hx : x ∈ covariateSpace) (i : Fin 7) : markedDensityVector c_f C_f L P n hP x i ∈ Icc 0 C_f := by have hv := markedDensityVector_mem_clippingRectangle c_f C_f L P n hP x hx have hc : 0 < c_f := hP.sourceBounds.1.1 have hC : 0 < C_f := lt_trans (by norm_num) hP.sourceBounds.2.1 rcases hv with ⟨h0, h1, h2, hr⟩ fin_cases i · simpa using (show _ ∈ Icc (0 : ℝ) C_f from ⟨hc.le.trans h0.1, h0.2⟩) · simpa using (show _ ∈ Icc (0 : ℝ) C_f from ⟨by linarith [h1.1], by linarith [h1.2]⟩) · simpa using (show _ ∈ Icc (0 : ℝ) C_f from ⟨by linarith [h2.1], by linarith [h2.2]⟩) · have h := hr 3 (by norm_num); simpa using (show _ ∈ Icc (0 : ℝ) C_f from ⟨h.1, by linarith [h.2]⟩) · have h := hr 4 (by norm_num); simpa using (show _ ∈ Icc (0 : ℝ) C_f from ⟨h.1, by linarith [h.2]⟩) · have h := hr 5 (by norm_num); simpa using (show _ ∈ Icc (0 : ℝ) C_f from ⟨h.1, by linarith [h.2]⟩) · have h := hr 6 (by norm_num); simpa using (show _ ∈ Icc (0 : ℝ) C_f from ⟨h.1, by linarith [h.2]⟩)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.markedDensityVector_mem_Icc_zero_Cf · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/ExactStatisticBridge.lean:455
theorem abs_cellAverage_markedDensityVector_le

A marked-density cell average has absolute value at most the common model envelope. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n K :
ℕ
hP :
ModelClass c_f C_f L P n
hK :
0 < K
l :
Fin K
i :
Fin 7
|cellAverage (fun y => markedDensityVector c_f C_f L P n hP y i) K l| ≤ C_f
Proof (Lean source)
lemma abs_cellAverage_markedDensityVector_le (c_f C_f L : ℝ) (P : TransportLaw) (n K : ℕ) (hP : ModelClass c_f C_f L P n) (hK : 0 < K) (l : Fin K) (i : Fin 7) : |cellAverage (fun y => markedDensityVector c_f C_f L P n hP y i) K l| ≤ C_f := by have hKr : (0 : ℝ) < K := by exact_mod_cast hK have hC : 0 ≤ C_f := (lt_trans (by norm_num) hP.sourceBounds.2.1).le have hmeas := measurableSet_cell K l have hfinite : volume (cell K l) ≠ ⊤ := by rw [volume_cell hK l] exact ENNReal.ofReal_ne_top have hint : IntegrableOn (fun y => markedDensityVector c_f C_f L P n hP y i) (cell K l) := ((markedDensityVector_continuousOn c_f C_f L P n hP i).integrableOn_Icc).mono_set (cell_subset_covariateSpace hK l) have hlo : 0 ≤ ∫ y in cell K l, markedDensityVector c_f C_f L P n hP y i := integral_nonneg_of_ae (ae_restrict_of_forall_mem hmeas fun y hy => (markedDensityVector_mem_Icc_zero_Cf c_f C_f L P n hP y (cell_subset_covariateSpace hK l hy) i).1) have hhi : (∫ y in cell K l, markedDensityVector c_f C_f L P n hP y i) ≤ ∫ _y in cell K l, C_f := integral_mono_ae hint (integrableOn_const hfinite) (ae_restrict_of_forall_mem hmeas fun y hy => (markedDensityVector_mem_Icc_zero_Cf c_f C_f L P n hP y (cell_subset_covariateSpace hK l hy) i).2) have hreal : (volume.restrict (cell K l)).real univ = 1 / (K : ℝ) := by rw [Measure.real, Measure.restrict_apply_univ, volume_cell hK l, ENNReal.toReal_ofReal (by positivity)] rw [integral_const, hreal] at hhi simp only [smul_eq_mul] at hhi unfold cellAverage rw [abs_of_nonneg (mul_nonneg hKr.le hlo)] calc (K : ℝ) * ∫ y in cell K l, markedDensityVector c_f C_f L P n hP y i ≤ (K : ℝ) * (C_f * (1 / (K : ℝ))) := mul_le_mul_of_nonneg_left (by simpa [mul_comm] using hhi) hKr.le _ = C_f := by field_simp
CausalSmith.Stat.TransportCaceRoughnuisanceLength.abs_cellAverage_markedDensityVector_le · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/ExactStatisticBridge.lean:474
theorem abs_trainingShift_le

The deterministic training shift in every residual is bounded by the uniform envelope used by the variance constants. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n K :
ℕ
hn :
threshold ≤ n
hP :
ModelClass c_f C_f L P n
hK :
0 < K
ω :
l :
Fin K
i :
Fin 7
|cellAverage (fun y => markedDensityVector c_f C_f L P n hP y i) K l
- pilot c_f C_f ω (midpoint K l) i|
≤ 2 * (1 + C_f)
Proof (Lean source)
lemma abs_trainingShift_le (c_f C_f L : ℝ) (P : TransportLaw) (n K : ℕ) (hn : threshold ≤ n) (hP : ModelClass c_f C_f L P n) (hK : 0 < K) (ω : TwoSample n n) (l : Fin K) (i : Fin 7) : |cellAverage (fun y => markedDensityVector c_f C_f L P n hP y i) K l - pilot c_f C_f ω (midpoint K l) i| ≤ 2 * (1 + C_f) := by have hp := pilot_mem_clippingRectangle c_f C_f L P n hn hP ω (midpoint K l) have hc : 0 < c_f := hP.sourceBounds.1.1 have hC : 0 < C_f := lt_trans (by norm_num) hP.sourceBounds.2.1 have hpabs : |pilot c_f C_f ω (midpoint K l) i| ≤ C_f := by rcases hp with ⟨h0, h1, h2, hr⟩ fin_cases i · change |pilot c_f C_f ω (midpoint K l) 0| ≤ C_f rw [abs_of_nonneg (hc.le.trans h0.1)] exact h0.2 · change |pilot c_f C_f ω (midpoint K l) 1| ≤ C_f rw [abs_of_nonneg (by linarith [h1.1] : 0 ≤ pilot c_f C_f ω (midpoint K l) 1)] linarith [h1.2] · change |pilot c_f C_f ω (midpoint K l) 2| ≤ C_f rw [abs_of_nonneg (by linarith [h2.1] : 0 ≤ pilot c_f C_f ω (midpoint K l) 2)] linarith [h2.2] · change |pilot c_f C_f ω (midpoint K l) 3| ≤ C_f have h := hr 3 (by norm_num); rw [abs_of_nonneg h.1]; linarith [h.2] · change |pilot c_f C_f ω (midpoint K l) 4| ≤ C_f have h := hr 4 (by norm_num); rw [abs_of_nonneg h.1]; linarith [h.2] · change |pilot c_f C_f ω (midpoint K l) 5| ≤ C_f have h := hr 5 (by norm_num); rw [abs_of_nonneg h.1]; linarith [h.2] · change |pilot c_f C_f ω (midpoint K l) 6| ≤ C_f have h := hr 6 (by norm_num); rw [abs_of_nonneg h.1]; linarith [h.2] exact (abs_sub _ _).trans (by have ha := abs_cellAverage_markedDensityVector_le c_f C_f L P n K hP hK l i linarith)
CausalSmith.Stat.STAT_TransportCaceRoughnuisanceLength_Research.Helpers.CubicMse.FinalAssembly 9 declarations Final mean-square assembly for the exact cubic estimator

Final mean-square assembly for the exact cubic estimator

theorem stronglyMeasurable_pilotIntegral

The pilot plug-in integral only uses the training sample. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f :
ℝ
n :
ℕ
A :
StronglyMeasurable[trainingSigma n] (fun ω : TwoSample n n => pilotIntegral c_f C_f ω A)
Proof (Lean source)
@[fun_prop] lemma stronglyMeasurable_pilotIntegral (c_f C_f : ℝ) (n : ℕ) (A : Bool) : StronglyMeasurable[trainingSigma n] (fun ω : TwoSample n n => pilotIntegral c_f C_f ω A) := by have hK : 0 < pilotResolution n := by unfold pilotResolution dyadicResolution split_ifs <;> positivity have heq (ω : TwoSample n n) : pilotIntegral c_f C_f ω A = (pilotResolution n : ℝ)⁻¹ * ∑ l : Fin (pilotResolution n), Phi A (pilot c_f C_f ω (midpoint (pilotResolution n) l)) := by rw [pilotIntegral, intervalIntegral.integral_of_le (by norm_num : (0 : ℝ) ≤ 1)] rw [← integral_Icc_eq_integral_Ioc] simpa [covariateSpace] using integral_pilot_composition_eq_cell_sum c_f C_f hK (dvd_refl _) ω (Phi A) simp_rw [heq] apply stronglyMeasurable_const.mul apply Finset.stronglyMeasurable_fun_sum intro l _ unfold Phi fun_prop
CausalSmith.Stat.TransportCaceRoughnuisanceLength.stronglyMeasurable_pilotIntegral · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/FinalAssembly.lean:12
theorem stronglyMeasurable_projectedEstimatorMean

The exact projected estimator mean only uses the training sample. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hn :
threshold ≤ n
hP :
ModelClass c_f C_f L P n
A :
StronglyMeasurable[trainingSigma n] (fun ω : TwoSample n n => projectedEstimatorMean c_f C_f L P n hP ω A)
Proof (Lean source)
@[fun_prop] lemma stronglyMeasurable_projectedEstimatorMean (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hn : threshold ≤ n) (hP : ModelClass c_f C_f L P n) (A : Bool) : StronglyMeasurable[trainingSigma n] (fun ω : TwoSample n n => projectedEstimatorMean c_f C_f L P n hP ω A) := by unfold projectedEstimatorMean exact (((stronglyMeasurable_pilotIntegral c_f C_f n A).add (stronglyMeasurable_linearProjectionMean c_f C_f L P n hn hP A)).add (stronglyMeasurable_quadraticProjectionMean c_f C_f L P n hn hP A)).add (stronglyMeasurable_cubicProjectionMean c_f C_f L P n hn hP A)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.stronglyMeasurable_projectedEstimatorMean · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/FinalAssembly.lean:35
theorem integrable_projectedEstimatorMean_sub_transport_sq

The squared error of the exact projected mean is integrable. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hn :
threshold ≤ n
hP :
ModelClass c_f C_f L P n
A :
Integrable (fun ω : TwoSample n n => (projectedEstimatorMean c_f C_f L P n hP ω A - transportedForm P A) ^ 2) (dataLaw P n n)
Proof (Lean source)
lemma integrable_projectedEstimatorMean_sub_transport_sq (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hn : threshold ≤ n) (hP : ModelClass c_f C_f L P n) (A : Bool) : Integrable (fun ω : TwoSample n n => (projectedEstimatorMean c_f C_f L P n hP ω A - transportedForm P A) ^ 2) (dataLaw P n n) := by let μ := dataLaw P n n let := sourceObsLaw_isProbabilityMeasure c_f C_f L P n hP let := targetXLaw_isProbabilityMeasure c_f C_f L P n hP let : IsProbabilityMeasure μ := by dsimp [μ] rw [dataLaw_eq_source_target_pi c_f C_f L P n hP] infer_instance let H := 3 * (1 + C_f) * L let M := fourthDerivativeEnvelope c_f C_f let A2 := 2 * (1 + C_f + C_f ^ 2) * (5 : ℝ) ^ (1 / 5 : ℝ) + (2 : ℝ) ^ (5 / 4 : ℝ) * H ^ 2 * (5 : ℝ) ^ (1 / 5 : ℝ) let BQ := (7 : ℝ) ^ 4 * M ^ 2 * H ^ 4 * (2 : ℝ) ^ (1 / 2 : ℝ) * (5 : ℝ) ^ (2 / 3 : ℝ) let C1 := (M / 2) * (7 : ℝ) ^ 2 * H ^ 2 let C2 := (M / 6) * (7 : ℝ) ^ 3 * H ^ 3 let rate := (n : ℝ) ^ (-(2 / 3 : ℝ)) let q := 1 / (cubicResolution n : ℝ) let a := C1 * (q ^ holderExponent) ^ 2 let b := C2 * (q ^ holderExponent) ^ 3 let e (i : Fin 7) (ω : TwoSample n n) := ∫ x in covariateSpace, |markedDensityVector c_f C_f L P n hP x i - pilot c_f C_f ω x i| let S (ω : TwoSample n n) := 2 * a ^ 2 * 7 * (∑ i : Fin 7, e i ω ^ 2) + 2 * b ^ 2 have he (i : Fin 7) : Integrable (fun ω => e i ω ^ 2) μ := integrable_pilot_error_L1_sq c_f C_f L P n hn hP i have hS : Integrable S μ := ((integrable_finsetSum univ (fun i _ => he i)).const_mul _).add (integrable_const _) have hSp (ω : TwoSample n n) : spatialCubicProjectionBias c_f C_f L P n hP ω A ^ 2 ≤ S ω := by have habs := cubic_spatial_projection_bias_abs_le_L1 c_f C_f L P n hn hP ω A have habs' : |spatialCubicProjectionBias c_f C_f L P n hP ω A| ≤ a * ∑ i : Fin 7, e i ω + b := by convert habs using 1 <;> first | rfl | dsimp [a, b, C1, C2, H, M, q]; ring have hp := pow_le_pow_left₀ (abs_nonneg _) habs' 2 rw [sq_abs] at hp have hs : (∑ i : Fin 7, e i ω) ^ 2 ≤ (7 : ℝ) * ∑ i : Fin 7, e i ω ^ 2 := by simpa using (sq_sum_le_card_mul_sum_sq (s := univ) (f := fun i : Fin 7 => e i ω)) have hw := mul_le_mul_of_nonneg_left hs (by positivity : 0 ≤ 2 * a ^ 2) dsimp only [S] nlinarith [sq_nonneg (a * ∑ i : Fin 7, e i ω - b)] have hRi := (pilotRemainderMajorant_integrable_sq_and_moment c_f C_f L P n hn hP).1 have hmajorant : Integrable (fun ω => 3 * (pilotRemainderMajorant c_f C_f L P n hP ω ^ 2 + BQ * rate + S ω)) μ := (((hRi.add (integrable_const _)).add hS).const_mul _) have hm : trainingSigma n ≤ (inferInstance : MeasurableSpace (TwoSample n n)) := by rw [trainingSigma_eq_comap_flatTrainingProj] exact ((measurable_finsetCoordProj (flatBlock n 0)).comp (sumPiEquivProdPi (FlatObs n)).symm.measurable).comap_le refine hmajorant.mono' ?_ ?_ · exact ((((stronglyMeasurable_projectedEstimatorMean c_f C_f L P n hn hP A).mono hm).sub stronglyMeasurable_const).pow 2).aestronglyMeasurable · filter_upwards [] with ω rw [Real.norm_eq_abs, abs_of_nonneg (sq_nonneg _), projectedEstimatorMean_sub_transport_eq_spatial_bias, neg_sq] apply (sq_three_bias_terms_le _ _ _).trans apply mul_le_mul_of_nonneg_left _ (by norm_num) apply add_le_add _ (hSp ω) apply add_le_add _ (quadraticCellProjectionBias_sq_sample_rate c_f C_f L P n hn hP ω A) simpa only [sq_abs, spatialTaylorRemainder] using pow_le_pow_left₀ (abs_nonneg _) (pilot_remainder_integral_abs_le_majorant c_f C_f L P n hn hP A ω) 2
CausalSmith.Stat.TransportCaceRoughnuisanceLength.integrable_projectedEstimatorMean_sub_transport_sq · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/FinalAssembly.lean:48
theorem condExp_sub_condExp_eq_zero

A variable minus its conditional expectation is conditionally centered. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
Ω :
μ :
hm :
m ≤ mΩ
X :
Ω → ℝ
hX :
condExp m μ (X - condExp m μ X) =ᵐ[μ] (0 : Ω → ℝ)
Proof (Lean source)
lemma condExp_sub_condExp_eq_zero {Ω : Type*} [mΩ : MeasurableSpace Ω] (m : MeasurableSpace Ω) (μ : @Measure Ω mΩ) [IsFiniteMeasure μ] (hm : m ≤ mΩ) {X : Ω → ℝ} (hX : Integrable X μ) : condExp m μ (X - condExp m μ X) =ᵐ[μ] (0 : Ω → ℝ) := by have hceint : Integrable (condExp m μ X) μ := integrable_condExp have hsub := condExp_sub hX hceint m have htower := condExp_condExp_of_le (μ := μ) (f := X) (le_refl m) hm filter_upwards [hsub, htower] with ω hsubω htowerω rw [hsubω] change condExp m μ X ω - condExp m μ (condExp m μ X) ω = 0 rw [htowerω] simp
CausalSmith.Stat.TransportCaceRoughnuisanceLength.condExp_sub_condExp_eq_zero · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/FinalAssembly.lean:119
theorem integrable_of_sub_condExp_memLp

Integrability follows from square integrability after conditional centering. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
Ω :
μ :
X :
Ω → ℝ
hX :
MemLp (fun ω => X ω - condExp m μ X ω) 2 μ
Proof (Lean source)
lemma integrable_of_sub_condExp_memLp {Ω : Type*} [mΩ : MeasurableSpace Ω] (m : MeasurableSpace Ω) (μ : @Measure Ω mΩ) [IsFiniteMeasure μ] {X : Ω → ℝ} (hX : MemLp (fun ω => X ω - condExp m μ X ω) 2 μ) : Integrable X μ := by by_contra hn have hzero := condExp_of_not_integrable (m := m) hn have heq : (fun ω => X ω - condExp m μ X ω) =ᵐ[μ] X := by filter_upwards [] with ω rw [hzero] simp exact hn ((hX.integrable (by norm_num)).congr heq)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.integrable_of_sub_condExp_memLp · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/FinalAssembly.lean:133
theorem condExp_cubicEstimator_sub_projectedEstimatorMean_eq_zero

The exact estimator fluctuation has zero training-conditional mean. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hn :
threshold ≤ n
hP :
ModelClass c_f C_f L P n
A :
condExp (trainingSigma n) (dataLaw P n n) (fun ω : TwoSample n n => cubicEstimator c_f C_f ω A - projectedEstimatorMean c_f C_f L P n hP ω A)
=ᵐ[dataLaw P n n] (0 : TwoSample n n → ℝ)
Proof (Lean source)
lemma condExp_cubicEstimator_sub_projectedEstimatorMean_eq_zero (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hn : threshold ≤ n) (hP : ModelClass c_f C_f L P n) (A : Bool) : condExp (trainingSigma n) (dataLaw P n n) (fun ω : TwoSample n n => cubicEstimator c_f C_f ω A - projectedEstimatorMean c_f C_f L P n hP ω A) =ᵐ[dataLaw P n n] (0 : TwoSample n n → ℝ) := by let := sourceObsLaw_isProbabilityMeasure c_f C_f L P n hP let := targetXLaw_isProbabilityMeasure c_f C_f L P n hP let : IsProbabilityMeasure (dataLaw P n n) := by rw [dataLaw_eq_source_target_pi c_f C_f L P n hP] infer_instance have hm : trainingSigma n ≤ (inferInstance : MeasurableSpace (TwoSample n n)) := by rw [trainingSigma_eq_comap_flatTrainingProj] exact ((measurable_finsetCoordProj (flatBlock n 0)).comp (sumPiEquivProdPi (FlatObs n)).symm.measurable).comap_le let Xl := fun ω : TwoSample n n => linearTerm c_f C_f ω A let Xq := fun ω : TwoSample n n => quadraticTerm c_f C_f ω A let Xc := fun ω : TwoSample n n => cubicTerm c_f C_f ω A let Zl := fun ω => Xl ω - condExp (trainingSigma n) (dataLaw P n n) Xl ω let Zq := fun ω => Xq ω - condExp (trainingSigma n) (dataLaw P n n) Xq ω let Zc := fun ω => Xc ω - condExp (trainingSigma n) (dataLaw P n n) Xc ω have hlp := (linear_conditional_variance_with_memLp c_f C_f L P n hn hP A).1 have hqp := (quadratic_conditional_variance_with_memLp c_f C_f L P n hn hP A).1 have hcp := (cubic_conditional_variance_with_memLp c_f C_f L P n hn hP A).1 have hli : Integrable Xl (dataLaw P n n) := integrable_of_sub_condExp_memLp (trainingSigma n) (dataLaw P n n) (by simpa [Xl] using hlp) have hqi : Integrable Xq (dataLaw P n n) := hqp.integrable (by norm_num) have hci : Integrable Xc (dataLaw P n n) := hcp.integrable (by norm_num) have hzli : Integrable Zl (dataLaw P n n) := hli.sub integrable_condExp have hzqi : Integrable Zq (dataLaw P n n) := hqi.sub integrable_condExp have hzci : Integrable Zc (dataLaw P n n) := hci.sub integrable_condExp have hzl0' := condExp_sub_condExp_eq_zero (trainingSigma n) (dataLaw P n n) hm hli have hzq0' := condExp_sub_condExp_eq_zero (trainingSigma n) (dataLaw P n n) hm hqi have hzc0' := condExp_sub_condExp_eq_zero (trainingSigma n) (dataLaw P n n) hm hci have hzl0 : condExp (trainingSigma n) (dataLaw P n n) Zl =ᵐ[dataLaw P n n] (0 : TwoSample n n → ℝ) := by apply (condExp_congr_ae _).trans hzl0' filter_upwards [] with ω rfl have hzq0 : condExp (trainingSigma n) (dataLaw P n n) Zq =ᵐ[dataLaw P n n] (0 : TwoSample n n → ℝ) := by apply (condExp_congr_ae _).trans hzq0' filter_upwards [] with ω rfl have hzc0 : condExp (trainingSigma n) (dataLaw P n n) Zc =ᵐ[dataLaw P n n] (0 : TwoSample n n → ℝ) := by apply (condExp_congr_ae _).trans hzc0' filter_upwards [] with ω rfl have hsum : condExp (trainingSigma n) (dataLaw P n n) (fun ω => Zl ω + Zq ω + Zc ω) =ᵐ[dataLaw P n n] condExp (trainingSigma n) (dataLaw P n n) Zl + condExp (trainingSigma n) (dataLaw P n n) Zq + condExp (trainingSigma n) (dataLaw P n n) Zc := (condExp_add (hzli.add hzqi) hzci (trainingSigma n)).trans ((condExp_add hzli hzqi (trainingSigma n)).add (Filter.Eventually.of_forall fun _ => rfl)) have hsum0 : condExp (trainingSigma n) (dataLaw P n n) (fun ω => Zl ω + Zq ω + Zc ω) =ᵐ[dataLaw P n n] (0 : TwoSample n n → ℝ) := by filter_upwards [hsum, hzl0, hzq0, hzc0] with ω hs hl hq hc rw [hs] change condExp (trainingSigma n) (dataLaw P n n) Zl ω + condExp (trainingSigma n) (dataLaw P n n) Zq ω + condExp (trainingSigma n) (dataLaw P n n) Zc ω = 0 rw [hl, hq, hc] simp exact (condExp_congr_ae (cubicEstimator_sub_projectedEstimatorMean_eq_centered_corrections c_f C_f L P n hn hP A)).trans hsum0
CausalSmith.Stat.TransportCaceRoughnuisanceLength.condExp_cubicEstimator_sub_projectedEstimatorMean_eq_zero · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/FinalAssembly.lean:145
theorem integral_projected_bias_mul_fluctuation_eq_zero

The fluctuation is orthogonal to the training-measurable projected bias. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hn :
threshold ≤ n
hP :
ModelClass c_f C_f L P n
A :
(∫ ω, (projectedEstimatorMean c_f C_f L P n hP ω A - transportedForm P A) * (cubicEstimator c_f C_f ω A - projectedEstimatorMean c_f C_f L P n hP ω A) ∂dataLaw P n n)
= 0
Proof (Lean source)
lemma integral_projected_bias_mul_fluctuation_eq_zero (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hn : threshold ≤ n) (hP : ModelClass c_f C_f L P n) (A : Bool) : (∫ ω, (projectedEstimatorMean c_f C_f L P n hP ω A - transportedForm P A) * (cubicEstimator c_f C_f ω A - projectedEstimatorMean c_f C_f L P n hP ω A) ∂dataLaw P n n) = 0 := by let := sourceObsLaw_isProbabilityMeasure c_f C_f L P n hP let := targetXLaw_isProbabilityMeasure c_f C_f L P n hP let : IsProbabilityMeasure (dataLaw P n n) := by rw [dataLaw_eq_source_target_pi c_f C_f L P n hP] infer_instance let μ := dataLaw P n n let F := fun ω : TwoSample n n => cubicEstimator c_f C_f ω A - projectedEstimatorMean c_f C_f L P n hP ω A let B := fun ω : TwoSample n n => projectedEstimatorMean c_f C_f L P n hP ω A - transportedForm P A have hm : trainingSigma n ≤ (inferInstance : MeasurableSpace (TwoSample n n)) := by rw [trainingSigma_eq_comap_flatTrainingProj] exact ((measurable_finsetCoordProj (flatBlock n 0)).comp (sumPiEquivProdPi (FlatObs n)).symm.measurable).comap_le have hF : MemLp F 2 μ := cubicEstimator_sub_projectedEstimatorMean_memLp c_f C_f L P n hn hP A have hBsm : StronglyMeasurable[trainingSigma n] B := by dsimp [B] exact (stronglyMeasurable_projectedEstimatorMean c_f C_f L P n hn hP A).sub stronglyMeasurable_const have hB : MemLp B 2 μ := by apply (memLp_two_iff_integrable_sq (μ := μ) (hBsm.mono hm).aestronglyMeasurable).2 simpa [B, μ] using integrable_projectedEstimatorMean_sub_transport_sq c_f C_f L P n hn hP A have hprod : Integrable (B * F) μ := hB.integrable_mul hF have hpull := condExp_mul_of_stronglyMeasurable_left hBsm hprod (hF.integrable (by norm_num)) have hF0 := condExp_cubicEstimator_sub_projectedEstimatorMean_eq_zero c_f C_f L P n hn hP A calc (∫ ω, B ω * F ω ∂μ) = ∫ ω, condExp (trainingSigma n) μ (B * F) ω ∂μ := (integral_condExp (μ := μ) (f := B * F) hm).symm _ = ∫ ω, B ω * condExp (trainingSigma n) μ F ω ∂μ := integral_congr_ae hpull _ = 0 := by apply integral_eq_zero_of_ae filter_upwards [hF0] with ω hω rw [hω] simp
CausalSmith.Stat.TransportCaceRoughnuisanceLength.integral_projected_bias_mul_fluctuation_eq_zero · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/FinalAssembly.lean:218
theorem cubicEstimator_mse_eq_fluctuation_add_projected_bias

Squared error is the sum of fluctuation risk and projected squared bias. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hn :
threshold ≤ n
hP :
ModelClass c_f C_f L P n
A :
(∫ ω, (cubicEstimator c_f C_f ω A - transportedForm P A) ^ 2 ∂dataLaw P n n)
= (∫ ω, (cubicEstimator c_f C_f ω A - projectedEstimatorMean c_f C_f L P n hP ω A) ^ 2 ∂dataLaw P n n)
+ ∫ ω, (projectedEstimatorMean c_f C_f L P n hP ω A - transportedForm P A) ^ 2 ∂dataLaw P n n
Proof (Lean source)
lemma cubicEstimator_mse_eq_fluctuation_add_projected_bias (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hn : threshold ≤ n) (hP : ModelClass c_f C_f L P n) (A : Bool) : (∫ ω, (cubicEstimator c_f C_f ω A - transportedForm P A) ^ 2 ∂dataLaw P n n) = (∫ ω, (cubicEstimator c_f C_f ω A - projectedEstimatorMean c_f C_f L P n hP ω A) ^ 2 ∂dataLaw P n n) + ∫ ω, (projectedEstimatorMean c_f C_f L P n hP ω A - transportedForm P A) ^ 2 ∂dataLaw P n n := by let μ := dataLaw P n n let F := fun ω : TwoSample n n => cubicEstimator c_f C_f ω A - projectedEstimatorMean c_f C_f L P n hP ω A let B := fun ω : TwoSample n n => projectedEstimatorMean c_f C_f L P n hP ω A - transportedForm P A have hF : MemLp F 2 μ := cubicEstimator_sub_projectedEstimatorMean_memLp c_f C_f L P n hn hP A have hBi : Integrable (fun ω => B ω ^ 2) μ := by simpa [B, μ] using integrable_projectedEstimatorMean_sub_transport_sq c_f C_f L P n hn hP A have hBsm : AEStronglyMeasurable B μ := by let := sourceObsLaw_isProbabilityMeasure c_f C_f L P n hP let := targetXLaw_isProbabilityMeasure c_f C_f L P n hP have hm : trainingSigma n ≤ (inferInstance : MeasurableSpace (TwoSample n n)) := by rw [trainingSigma_eq_comap_flatTrainingProj] exact ((measurable_finsetCoordProj (flatBlock n 0)).comp (sumPiEquivProdPi (FlatObs n)).symm.measurable).comap_le exact (((stronglyMeasurable_projectedEstimatorMean c_f C_f L P n hn hP A).mono hm).sub stronglyMeasurable_const).aestronglyMeasurable have hB : MemLp B 2 μ := (memLp_two_iff_integrable_sq hBsm).2 hBi have hcross : (∫ ω, B ω * F ω ∂μ) = 0 := by simpa [B, F, μ] using integral_projected_bias_mul_fluctuation_eq_zero c_f C_f L P n hn hP A have hexpand (ω : TwoSample n n) : (cubicEstimator c_f C_f ω A - transportedForm P A) ^ 2 = F ω ^ 2 + B ω ^ 2 + 2 * (B ω * F ω) := by dsimp [F, B] ring calc _ = ∫ ω, (F ω ^ 2 + B ω ^ 2 + 2 * (B ω * F ω)) ∂μ := by apply integral_congr_ae filter_upwards [] with ω exact hexpand ω _ = (∫ ω, F ω ^ 2 ∂μ) + (∫ ω, B ω ^ 2 ∂μ) + 2 * ∫ ω, B ω * F ω ∂μ := by have hadd1 := integral_add (hF.integrable_sq.add hBi) ((hB.integrable_mul hF).const_mul 2) have hadd2 := integral_add hF.integrable_sq hBi simp only [Pi.add_apply, Pi.mul_apply] at hadd1 hadd2 rw [hadd1, hadd2, integral_const_mul] _ = _ := by rw [hcross]; ring
CausalSmith.Stat.TransportCaceRoughnuisanceLength.cubicEstimator_mse_eq_fluctuation_add_projected_bias · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/FinalAssembly.lean:265
theorem cubicEstimator_mse_sample_rate

The exact fluctuation and projected-bias bounds assemble to the frozen mean-square envelope. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hn :
threshold ≤ n
hP :
ModelClass c_f C_f L P n
A :
(∫ ω, (cubicEstimator c_f C_f ω A - transportedForm P A) ^ 2 ∂dataLaw P n n)
≤ mseEnvelope c_f C_f L * (n : ℝ) ^ (-(2 / 3 : ℝ))
Proof (Lean source)
lemma cubicEstimator_mse_sample_rate (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hn : threshold ≤ n) (hP : ModelClass c_f C_f L P n) (A : Bool) : (∫ ω, (cubicEstimator c_f C_f ω A - transportedForm P A) ^ 2 ∂dataLaw P n n) ≤ mseEnvelope c_f C_f L * (n : ℝ) ^ (-(2 / 3 : ℝ)) := by let V := 3 * (10 * (7 : ℝ) ^ 2 * (fourthDerivativeEnvelope c_f C_f) ^ 2 + 60 * quadVarianceConstant c_f C_f + 310 * cubicVarianceConstant c_f C_f) let H := 3 * (1 + C_f) * L let M := fourthDerivativeEnvelope c_f C_f let A2 := 2 * (1 + C_f + C_f ^ 2) * (5 : ℝ) ^ (1 / 5 : ℝ) + (2 : ℝ) ^ (5 / 4 : ℝ) * H ^ 2 * (5 : ℝ) ^ (1 / 5 : ℝ) let BR := (M / 24) ^ 2 * (7 : ℝ) ^ (8 : ℕ) * pilotEighthConstant C_f L let BQ := (7 : ℝ) ^ 4 * M ^ 2 * H ^ 4 * (2 : ℝ) ^ (1 / 2 : ℝ) * (5 : ℝ) ^ (2 / 3 : ℝ) let C1 := (M / 2) * (7 : ℝ) ^ 2 * H ^ 2 let C2 := (M / 6) * (7 : ℝ) ^ 3 * H ^ 3 let BC := 2 * (C1 ^ 2 * (7 : ℝ) ^ 2 * A2 * (2 : ℝ) ^ (1 / 2 : ℝ) * (5 : ℝ) ^ (1 / 2 : ℝ) + C2 ^ 2 * (2 : ℝ) ^ (3 / 4 : ℝ) * (5 : ℝ) ^ (3 / 4 : ℝ)) let B := 3 * (BR + BQ + BC) have hv : (∫ ω, (cubicEstimator c_f C_f ω A - projectedEstimatorMean c_f C_f L P n hP ω A) ^ 2 ∂dataLaw P n n) ≤ V * (n : ℝ) ^ (-(2 / 3 : ℝ)) := by exact cubicEstimator_fluctuation_second_moment_sample_rate c_f C_f L P n hn hP A have hb : (∫ ω, (projectedEstimatorMean c_f C_f L P n hP ω A - transportedForm P A) ^ 2 ∂dataLaw P n n) ≤ B * (n : ℝ) ^ (-(2 / 3 : ℝ)) := by exact projectedEstimatorMean_squared_bias_sample_rate c_f C_f L P n hn hP A have hconst : V + B = mseEnvelope c_f C_f L := by dsimp [V, B, BR, BQ, BC, C1, C2, A2, H, M] unfold mseEnvelope pilotEighthConstant quadVarianceConstant cubicVarianceConstant fourthDerivativeEnvelope dsimp only ring rw [cubicEstimator_mse_eq_fluctuation_add_projected_bias c_f C_f L P n hn hP A] calc _ ≤ V * (n : ℝ) ^ (-(2 / 3 : ℝ)) + B * (n : ℝ) ^ (-(2 / 3 : ℝ)) := add_le_add hv hb _ = (V + B) * (n : ℝ) ^ (-(2 / 3 : ℝ)) := by ring _ = _ := by rw [hconst]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.cubicEstimator_mse_sample_rate · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/FinalAssembly.lean:317
CausalSmith.Stat.STAT_TransportCaceRoughnuisanceLength_Research.Helpers.CubicMse.FlatHistogramBlocks 11 declarations Histogram scores on flattened held-out blocks

Histogram scores on flattened held-out blocks

def flatBlockHeight

The flat block height object is defined from the supplied inputs.

Definition (Lean source)
n K :
ℕ
i :
Fin 7
b :
Fin 4
l :
Fin K
z :
(a : {a // a ∈ flatBlock n b}) → FlatObs n a.val
flatBlockHeight i b l z :
ℝ
if i
= 0 then iidBlockHeight K (blockIdx n b) (targetCellScore K l) (fun r => flatReconstruct n b z (inr r)) else iidBlockHeight K (blockIdx n b) (sourceCellScore i K l) (fun r => flatReconstruct n b z (inl r))
theorem measurable_flatBlockHeight

Given the supplied inputs, the stated result about measurable flat block height holds.

Formal statement
n K :
ℕ
i :
Fin 7
b :
Fin 4
l :
Fin K
Measurable (flatBlockHeight (n := n) i b l)
Proof (Lean source)
@[fun_prop] lemma measurable_flatBlockHeight {n K : ℕ} (i : Fin 7) (b : Fin 4) (l : Fin K) : Measurable (flatBlockHeight (n := n) i b l) := by unfold flatBlockHeight iidBlockHeight split_ifs · fun_prop · fun_prop
CausalSmith.Stat.TransportCaceRoughnuisanceLength.measurable_flatBlockHeight · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/FlatHistogramBlocks.lean:24
theorem flatBlockHeight_proj

Given the supplied inputs, the stated result about flat block height proj holds.

Formal statement
n K :
ℕ
hn :
threshold ≤ n
hK :
0 < K
x :
(a : FlatIndex n) → FlatObs n a
i :
Fin 7
b :
Fin 4
l :
Fin K
Proof (Lean source)
lemma flatBlockHeight_proj {n K : ℕ} (hn : threshold ≤ n) (hK : 0 < K) (x : (a : FlatIndex n) → FlatObs n a) (i : Fin 7) (b : Fin 4) (l : Fin K) : flatBlockHeight i b l (finsetCoordProj (flatBlock n b) x) = markedHistogram (sumPiEquivProdPi (FlatObs n) x) i K b (midpoint K l) := by by_cases hi : i = 0 · subst i rw [markedHistogram_midpoint_target hn hK] simp only [flatBlockHeight, if_true] unfold iidBlockHeight congr 1 apply Finset.sum_congr rfl intro r hr simp [flatReconstruct, inr_mem_flatBlock, hr, sumPiEquivProdPi, finsetCoordProj] · rw [markedHistogram_midpoint_source hn hK _ i hi] simp only [flatBlockHeight, if_neg hi] unfold iidBlockHeight congr 1 apply Finset.sum_congr rfl intro r hr simp [flatReconstruct, inl_mem_flatBlock, hr, sumPiEquivProdPi, finsetCoordProj]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.flatBlockHeight_proj · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/FlatHistogramBlocks.lean:33
theorem flatBlockHeight_proj_target

Given the supplied inputs, the stated result about flat block height proj target holds.

Formal statement
n K :
ℕ
x :
(a : FlatIndex n) → FlatObs n a
b :
Fin 4
l :
Fin K
Proof (Lean source)
lemma flatBlockHeight_proj_target {n K : ℕ} (x : (a : FlatIndex n) → FlatObs n a) (b : Fin 4) (l : Fin K) : flatBlockHeight 0 b l (finsetCoordProj (flatBlock n b) x) = iidBlockHeight K (blockIdx n b) (targetCellScore K l) ((sumPiEquivProdPi (FlatObs n) x).2) := by simp only [flatBlockHeight, if_true] unfold iidBlockHeight congr 1 apply Finset.sum_congr rfl intro r hr simp [flatReconstruct, inr_mem_flatBlock, hr, finsetCoordProj, sumPiEquivProdPi]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.flatBlockHeight_proj_target · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/FlatHistogramBlocks.lean:58
theorem flatBlockHeight_proj_source

Given the supplied inputs, the stated result about flat block height proj source holds.

Formal statement
n K :
ℕ
i :
Fin 7
hi :
i ≠ 0
x :
(a : FlatIndex n) → FlatObs n a
b :
Fin 4
l :
Fin K
Proof (Lean source)
lemma flatBlockHeight_proj_source {n K : ℕ} (i : Fin 7) (hi : i ≠ 0) (x : (a : FlatIndex n) → FlatObs n a) (b : Fin 4) (l : Fin K) : flatBlockHeight i b l (finsetCoordProj (flatBlock n b) x) = iidBlockHeight K (blockIdx n b) (sourceCellScore i K l) ((sumPiEquivProdPi (FlatObs n) x).1) := by simp only [flatBlockHeight, if_neg hi] unfold iidBlockHeight congr 1 apply Finset.sum_congr rfl intro r hr simp [flatReconstruct, inl_mem_flatBlock, hr, finsetCoordProj, sumPiEquivProdPi]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.flatBlockHeight_proj_source · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/FlatHistogramBlocks.lean:73
theorem covariance_flatLaw_source

Given the supplied inputs, the stated result about covariance flat law source holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hP :
ModelClass c_f C_f L P n
f g :
(Fin n → SourceObs) → ℝ
hf :
hg :
covariance (fun x : (a : FlatIndex n) → FlatObs n a => f ((sumPiEquivProdPi (FlatObs n) x).1)) (fun x => g ((sumPiEquivProdPi (FlatObs n) x).1)) (Measure.pi (flatLaw P n))
= covariance f g (Measure.pi (fun _ : Fin n => sourceObsLaw P))
Proof (Lean source)
lemma covariance_flatLaw_source (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hP : ModelClass c_f C_f L P n) (f g : (Fin n → SourceObs) → ℝ) (hf : Measurable f) (hg : Measurable g) : covariance (fun x : (a : FlatIndex n) → FlatObs n a => f ((sumPiEquivProdPi (FlatObs n) x).1)) (fun x => g ((sumPiEquivProdPi (FlatObs n) x).1)) (Measure.pi (flatLaw P n)) = covariance f g (Measure.pi (fun _ : Fin n => sourceObsLaw P)) := by letI : IsProbabilityMeasure (sourceObsLaw P) := sourceObsLaw_isProbabilityMeasure c_f C_f L P n hP letI : IsProbabilityMeasure (targetXLaw P) := targetXLaw_isProbabilityMeasure c_f C_f L P n hP letI : ∀ a, IsProbabilityMeasure (flatLaw P n a) := fun a => flatLaw_isProbabilityMeasure c_f C_f L P n hP a let E := sumPiEquivProdPi (FlatObs n) let μS := Measure.pi (fun _ : Fin n => sourceObsLaw P) let μT := Measure.pi (fun _ : Fin n => targetXLaw P) have hprod : covariance (fun p : (Fin n → SourceObs) × (Fin n → ℝ) => f p.1) (fun p => g p.1) (μS.prod μT) = covariance f g μS := by have h := covariance_map hf.aestronglyMeasurable hg.aestronglyMeasurable measurable_fst.aemeasurable (μ := μS.prod μT) rw [measurePreserving_fst.map_eq] at h exact h.symm have hE := covariance_map_equiv (fun p : (Fin n → SourceObs) × (Fin n → ℝ) => f p.1) (fun p => g p.1) E (μ := Measure.pi (flatLaw P n)) have hmap := (measurePreserving_sumPiEquivProdPi (flatLaw P n)).map_eq change covariance (fun x => f (E x).1) (fun x => g (E x).1) (Measure.pi (flatLaw P n)) = _ rw [← hprod] have hE' := hE.symm rw [hmap] at hE' simpa [E, μS, μT, flatLaw, Function.comp_def] using hE'
CausalSmith.Stat.TransportCaceRoughnuisanceLength.covariance_flatLaw_source · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/FlatHistogramBlocks.lean:87
theorem covariance_flatLaw_target

Given the supplied inputs, the stated result about covariance flat law target holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hP :
ModelClass c_f C_f L P n
f g :
(Fin n → ℝ) → ℝ
hf :
hg :
covariance (fun x : (a : FlatIndex n) → FlatObs n a => f ((sumPiEquivProdPi (FlatObs n) x).2)) (fun x => g ((sumPiEquivProdPi (FlatObs n) x).2)) (Measure.pi (flatLaw P n))
= covariance f g (Measure.pi (fun _ : Fin n => targetXLaw P))
Proof (Lean source)
lemma covariance_flatLaw_target (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hP : ModelClass c_f C_f L P n) (f g : (Fin n → ℝ) → ℝ) (hf : Measurable f) (hg : Measurable g) : covariance (fun x : (a : FlatIndex n) → FlatObs n a => f ((sumPiEquivProdPi (FlatObs n) x).2)) (fun x => g ((sumPiEquivProdPi (FlatObs n) x).2)) (Measure.pi (flatLaw P n)) = covariance f g (Measure.pi (fun _ : Fin n => targetXLaw P)) := by letI : IsProbabilityMeasure (sourceObsLaw P) := sourceObsLaw_isProbabilityMeasure c_f C_f L P n hP letI : IsProbabilityMeasure (targetXLaw P) := targetXLaw_isProbabilityMeasure c_f C_f L P n hP letI : ∀ a, IsProbabilityMeasure (flatLaw P n a) := fun a => flatLaw_isProbabilityMeasure c_f C_f L P n hP a let E := sumPiEquivProdPi (FlatObs n) let μS := Measure.pi (fun _ : Fin n => sourceObsLaw P) let μT := Measure.pi (fun _ : Fin n => targetXLaw P) have hprod : covariance (fun p : (Fin n → SourceObs) × (Fin n → ℝ) => f p.2) (fun p => g p.2) (μS.prod μT) = covariance f g μT := by have h := covariance_map hf.aestronglyMeasurable hg.aestronglyMeasurable measurable_snd.aemeasurable (μ := μS.prod μT) rw [measurePreserving_snd.map_eq] at h exact h.symm have hE := covariance_map_equiv (fun p : (Fin n → SourceObs) × (Fin n → ℝ) => f p.2) (fun p => g p.2) E (μ := Measure.pi (flatLaw P n)) have hmap := (measurePreserving_sumPiEquivProdPi (flatLaw P n)).map_eq change covariance (fun x => f (E x).2) (fun x => g (E x).2) (Measure.pi (flatLaw P n)) = _ rw [← hprod] have hE' := hE.symm rw [hmap] at hE' simpa [E, μS, μT, flatLaw, Function.comp_def] using hE'
CausalSmith.Stat.TransportCaceRoughnuisanceLength.covariance_flatLaw_target · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/FlatHistogramBlocks.lean:126
theorem covariance_flatLaw_source_target_zero

Given the supplied inputs, the stated result about covariance flat law source target zero holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hP :
ModelClass c_f C_f L P n
f :
(Fin n → SourceObs) → ℝ
g :
(Fin n → ℝ) → ℝ
hf :
MemLp f 2 (Measure.pi (fun _ : Fin n => sourceObsLaw P))
hg :
MemLp g 2 (Measure.pi (fun _ : Fin n => targetXLaw P))
covariance (fun x : (a : FlatIndex n) → FlatObs n a => f ((sumPiEquivProdPi (FlatObs n) x).1)) (fun x => g ((sumPiEquivProdPi (FlatObs n) x).2)) (Measure.pi (flatLaw P n))
= 0
Proof (Lean source)
lemma covariance_flatLaw_source_target_zero (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hP : ModelClass c_f C_f L P n) (f : (Fin n → SourceObs) → ℝ) (g : (Fin n → ℝ) → ℝ) (hf : MemLp f 2 (Measure.pi (fun _ : Fin n => sourceObsLaw P))) (hg : MemLp g 2 (Measure.pi (fun _ : Fin n => targetXLaw P))) : covariance (fun x : (a : FlatIndex n) → FlatObs n a => f ((sumPiEquivProdPi (FlatObs n) x).1)) (fun x => g ((sumPiEquivProdPi (FlatObs n) x).2)) (Measure.pi (flatLaw P n)) = 0 := by letI : IsProbabilityMeasure (sourceObsLaw P) := sourceObsLaw_isProbabilityMeasure c_f C_f L P n hP letI : IsProbabilityMeasure (targetXLaw P) := targetXLaw_isProbabilityMeasure c_f C_f L P n hP letI : ∀ a, IsProbabilityMeasure (flatLaw P n a) := fun a => flatLaw_isProbabilityMeasure c_f C_f L P n hP a let E := sumPiEquivProdPi (FlatObs n) let μS := Measure.pi (fun _ : Fin n => sourceObsLaw P) let μT := Measure.pi (fun _ : Fin n => targetXLaw P) have hprod : covariance (fun p : (Fin n → SourceObs) × (Fin n → ℝ) => f p.1) (fun p => g p.2) (μS.prod μT) = 0 := covariance_fst_snd_prod hf hg have hE := covariance_map_equiv (fun p : (Fin n → SourceObs) × (Fin n → ℝ) => f p.1) (fun p => g p.2) E (μ := Measure.pi (flatLaw P n)) have hmap := (measurePreserving_sumPiEquivProdPi (flatLaw P n)).map_eq change covariance (fun x => f (E x).1) (fun x => g (E x).2) (Measure.pi (flatLaw P n)) = 0 have hE' := hE.symm rw [hmap] at hE' have hE'' : covariance ((fun p : (Fin n → SourceObs) × (Fin n → ℝ) => f p.1) ∘ E) ((fun p => g p.2) ∘ E) (Measure.pi (flatLaw P n)) = covariance (fun p => f p.1) (fun p => g p.2) (μS.prod μT) := by simpa [μS, μT, flatLaw] using hE' rw [hprod] at hE'' simpa [E, Function.comp_def] using hE''
CausalSmith.Stat.TransportCaceRoughnuisanceLength.covariance_flatLaw_source_target_zero · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/FlatHistogramBlocks.lean:165
theorem flatBlockHeight_nonneg

Given the supplied inputs, the stated result about flat block height nonneg holds.

Formal statement
n K :
ℕ
i :
Fin 7
b :
Fin 4
l :
Fin K
z :
(a : {a // a ∈ flatBlock n b}) → FlatObs n a.val
0 ≤ flatBlockHeight i b l z
Proof (Lean source)
lemma flatBlockHeight_nonneg {n K : ℕ} (i : Fin 7) (b : Fin 4) (l : Fin K) (z : (a : {a // a ∈ flatBlock n b}) → FlatObs n a.val) : 0 ≤ flatBlockHeight i b l z := by unfold flatBlockHeight iidBlockHeight split_ifs · exact mul_nonneg (by positivity) (Finset.sum_nonneg fun r _ => (targetCellScore_mem_unit_interval K l _).1) · exact mul_nonneg (by positivity) (Finset.sum_nonneg fun r _ => (sourceCellScore_mem_unit_interval i K l _).1)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.flatBlockHeight_nonneg · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/FlatHistogramBlocks.lean:205
theorem flatBlockHeight_le

Given the supplied inputs, the stated result about flat block height le holds.

Formal statement
n K :
ℕ
b :
Fin 4
hcard :
0 < (blockIdx n b).card
i :
Fin 7
l :
Fin K
z :
(a : {a // a ∈ flatBlock n b}) → FlatObs n a.val
flatBlockHeight i b l z ≤ K
Proof (Lean source)
lemma flatBlockHeight_le {n K : ℕ} (b : Fin 4) (hcard : 0 < (blockIdx n b).card) (i : Fin 7) (l : Fin K) (z : (a : {a // a ∈ flatBlock n b}) → FlatObs n a.val) : flatBlockHeight i b l z ≤ K := by have hsum_target : (∑ r ∈ blockIdx n b, targetCellScore K l (flatReconstruct n b z (inr r))) ≤ (blockIdx n b).card := by simpa using Finset.sum_le_card_nsmul (blockIdx n b) (fun r => targetCellScore K l (flatReconstruct n b z (inr r))) 1 (fun r _ => (targetCellScore_mem_unit_interval K l _).2) have hsum_source : (∑ r ∈ blockIdx n b, sourceCellScore i K l (flatReconstruct n b z (inl r))) ≤ (blockIdx n b).card := by simpa using Finset.sum_le_card_nsmul (blockIdx n b) (fun r => sourceCellScore i K l (flatReconstruct n b z (inl r))) 1 (fun r _ => (sourceCellScore_mem_unit_interval i K l _).2) unfold flatBlockHeight iidBlockHeight split_ifs · calc (K : ℝ) / (blockIdx n b).card * _ ≤ (K : ℝ) / (blockIdx n b).card * (blockIdx n b).card := mul_le_mul_of_nonneg_left hsum_target (by positivity) _ = K := by have hc : ((blockIdx n b).card : ℝ) ≠ 0 := by exact_mod_cast hcard.ne' field_simp · calc (K : ℝ) / (blockIdx n b).card * _ ≤ (K : ℝ) / (blockIdx n b).card * (blockIdx n b).card := mul_le_mul_of_nonneg_left hsum_source (by positivity) _ = K := by have hc : ((blockIdx n b).card : ℝ) ≠ 0 := by exact_mod_cast hcard.ne' field_simp
theorem flatBlockHeight_memLp

Given the supplied inputs, the stated result about flat block height mem lp holds.

Formal statement
c_f C_f L :
ℝ
n K :
ℕ
hn :
threshold ≤ n
hP :
ModelClass c_f C_f L P n
i :
Fin 7
b :
Fin 4
l :
Fin K
MemLp (fun x : (a : FlatIndex n) → FlatObs n a => flatBlockHeight i b l (finsetCoordProj (flatBlock n b) x)) 2 (Measure.pi (flatLaw P n))
Proof (Lean source)
lemma flatBlockHeight_memLp (c_f C_f L : ℝ) (P : TransportLaw) (n K : ℕ) (hn : threshold ≤ n) (hP : ModelClass c_f C_f L P n) (i : Fin 7) (b : Fin 4) (l : Fin K) : MemLp (fun x : (a : FlatIndex n) → FlatObs n a => flatBlockHeight i b l (finsetCoordProj (flatBlock n b) x)) 2 (Measure.pi (flatLaw P n)) := by letI : ∀ a, IsProbabilityMeasure (flatLaw P n a) := fun a => flatLaw_isProbabilityMeasure c_f C_f L P n hP a have hcard : 0 < (blockIdx n b).card := by rw [block_card] have hlo := block_size_lower n hn b have hnpos : (0 : ℝ) < n := by norm_num [threshold] at hn exact_mod_cast (show 0 < n by omega) exact_mod_cast (lt_of_lt_of_le (div_pos hnpos (by norm_num)) hlo) apply MemLp.of_bound ((measurable_flatBlockHeight (n := n) i b l).comp (measurable_finsetCoordProj (flatBlock n b))).aestronglyMeasurable K filter_upwards [] with x change |flatBlockHeight (n := n) i b l (finsetCoordProj (flatBlock n b) x)| ≤ K rw [abs_of_nonneg (flatBlockHeight_nonneg i b l _)] exact flatBlockHeight_le b hcard i l _
CausalSmith.Stat.TransportCaceRoughnuisanceLength.flatBlockHeight_memLp · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/FlatHistogramBlocks.lean:252
CausalSmith.Stat.STAT_TransportCaceRoughnuisanceLength_Research.Helpers.CubicMse.FourthDerivative 6 declarations Explicit differentiation of the two marked ratios completes the roadmap's fourth-order envelope on the deterministic clipping rectangle.

Fourth coordinate derivative of the observable transport integrand

Explicit differentiation of the two marked ratios completes the roadmap's fourth-order envelope on the deterministic clipping rectangle.

def cubicRatioD4Apply

The cubic ratio d4 apply object is defined from the supplied inputs.

Definition (Lean source)
a b c :
Fin 7
h k l m v :
cubicRatioD4Apply a b c h k l m v :
ℝ
2 * (h a * k b + k a * h b) * l c * m c * (v c)⁻¹ ^ 3
+ 2 * (h a * l b + l a * h b) * k c * m c * (v c)⁻¹ ^ 3
+ 2 * (h a * m b + m a * h b) * k c * l c * (v c)⁻¹ ^ 3
+ 2 * (k a * l b + l a * k b) * h c * m c * (v c)⁻¹ ^ 3
+ 2 * (k a * m b + m a * k b) * h c * l c * (v c)⁻¹ ^ 3
+ 2 * (l a * m b + m a * l b) * h c * k c * (v c)⁻¹ ^ 3
- 6 * (h a * v b + v a * h b) * k c * l c * m c * (v c)⁻¹ ^ 4
- 6 * (k a * v b + v a * k b) * h c * l c * m c * (v c)⁻¹ ^ 4
- 6 * (l a * v b + v a * l b) * h c * k c * m c * (v c)⁻¹ ^ 4
- 6 * (m a * v b + v a * m b) * h c * k c * l c * (v c)⁻¹ ^ 4
+ 24 * v a * v b * h c * k c * l c * m c * (v c)⁻¹ ^ 5
theorem fderiv_cubicRatioD3Apply

Given the supplied inputs, the stated result about fderiv cubic ratio d3 apply holds.

Formal statement
a b c :
Fin 7
v h k l m :
hc :
v c ≠ 0
fderiv ℝ (fun y => cubicRatioD3Apply a b c k l m y) v h
= cubicRatioD4Apply a b c h k l m v
Proof (Lean source)
lemma fderiv_cubicRatioD3Apply (a b c : Fin 7) (v h k l m : DensityVector) (hc : v c ≠ 0) : fderiv ℝ (fun y => cubicRatioD3Apply a b c k l m y) v h = cubicRatioD4Apply a b c h k l m v := by have ha := (densityCoord a).hasFDerivAt (x := v) have hb := (densityCoord b).hasFDerivAt (x := v) have hc' := (densityCoord c).hasFDerivAt (x := v) have hi := (hasFDerivAt_inv hc).comp v hc' have hi2 := hi.mul hi have hi3 := hi2.mul hi have hi4 := hi3.mul hi have hp := ha.mul hb have hs (s : DensityVector) := (hb.const_mul (s a)).add (ha.mul_const (s b)) have ht1 := hi2.const_mul (-(k a * l b + l a * k b) * m c) have ht2 := hi2.const_mul (-((k a * m b + m a * k b) * l c + (l a * m b + m a * l b) * k c)) have ht3 := ((hs k).mul hi3).const_mul (2 * l c * m c) have ht4 := ((hs l).mul hi3).const_mul (2 * k c * m c) have ht5 := ((hs m).mul hi3).const_mul (2 * k c * l c) have ht6 := (hp.mul hi4).const_mul (6 * k c * l c * m c) have ht := ((((ht1.add ht2).add ht3).add ht4).add ht5).sub ht6 have ht' := ht.congr_of_eventuallyEq (f₁ := fun y => cubicRatioD3Apply a b c k l m y) (Filter.Eventually.of_forall (fun y => by simp [cubicRatioD3Apply, densityCoord, Function.comp_apply] ring)) rw [ht'.fderiv] simp [cubicRatioD4Apply, densityCoord, Function.comp_apply, ContinuousLinearMap.toSpanSingleton_apply] field_simp [hc] <;> ring
CausalSmith.Stat.TransportCaceRoughnuisanceLength.fderiv_cubicRatioD3Apply · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/FourthDerivative.lean:31
theorem iteratedFDeriv_four_cubicRatioTerm

Given the supplied inputs, the stated result about iterated fderiv four cubic ratio term holds.

Formal statement
a b c :
Fin 7
v h k l m :
hc :
v c ≠ 0
iteratedFDeriv ℝ 4 (cubicRatioTerm a b c) v ![h, k, l, m]
= cubicRatioD4Apply a b c h k l m v
Proof (Lean source)
lemma iteratedFDeriv_four_cubicRatioTerm (a b c : Fin 7) (v h k l m : DensityVector) (hc : v c ≠ 0) : iteratedFDeriv ℝ 4 (cubicRatioTerm a b c) v ![h, k, l, m] = cubicRatioD4Apply a b c h k l m v := by have hs : ContDiffAt ℝ 4 (cubicRatioTerm a b c) v := by unfold cubicRatioTerm fun_prop have hd : DifferentiableAt ℝ (iteratedFDeriv ℝ 3 (cubicRatioTerm a b c)) v := hs.differentiableAt_iteratedFDeriv (by norm_num) rw [hd.iteratedFDeriv_succ_apply_left'] have hne : ∀ᶠ y in nhds v, y c ≠ 0 := (densityCoord c).continuous.continuousAt.eventually_ne hc have heq : (fun y => iteratedFDeriv ℝ 3 (cubicRatioTerm a b c) y (Fin.tail ![h, k, l, m])) =ᶠ[nhds v] (fun y => cubicRatioD3Apply a b c k l m y) := by filter_upwards [hne] with y hy simpa using iteratedFDeriv_three_cubicRatioTerm a b c y k l m hy rw [heq.fderiv_eq] simpa using fderiv_cubicRatioD3Apply a b c v h k l m hc
CausalSmith.Stat.TransportCaceRoughnuisanceLength.iteratedFDeriv_four_cubicRatioTerm · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/FourthDerivative.lean:64
theorem iteratedFDeriv_four_Phi

Given the supplied inputs, the stated result about iterated fderiv four phi holds.

Formal statement
A :
h k l m :
h1 :
v 1 ≠ 0
h2 :
v 2 ≠ 0
iteratedFDeriv ℝ 4 (Phi A) v ![h, k, l, m]
= cubicRatioD4Apply 0 (if A then 4 else 6) 2 h k l m v
- cubicRatioD4Apply 0 (if A then 3 else 5) 1 h k l m v
Proof (Lean source)
lemma iteratedFDeriv_four_Phi (A : Bool) (v : DensityVector) (h k l m : DensityVector) (h1 : v 1 ≠ 0) (h2 : v 2 ≠ 0) : iteratedFDeriv ℝ 4 (Phi A) v ![h, k, l, m] = cubicRatioD4Apply 0 (if A then 4 else 6) 2 h k l m v - cubicRatioD4Apply 0 (if A then 3 else 5) 1 h k l m v := by cases A with | false => have hs2 : ContDiffAt ℝ 4 (cubicRatioTerm 0 6 2) v := by unfold cubicRatioTerm fun_prop have hs1 : ContDiffAt ℝ 4 (cubicRatioTerm 0 5 1) v := by unfold cubicRatioTerm fun_prop have heq : Phi false = cubicRatioTerm 0 6 2 - cubicRatioTerm 0 5 1 := by funext y simp [Phi, cubicRatioTerm, div_eq_mul_inv] ring rw [heq, iteratedFDeriv_sub_apply hs2 hs1] change iteratedFDeriv ℝ 4 (cubicRatioTerm 0 6 2) v ![h, k, l, m] - iteratedFDeriv ℝ 4 (cubicRatioTerm 0 5 1) v ![h, k, l, m] = _ rw [ iteratedFDeriv_four_cubicRatioTerm 0 6 2 v h k l m h2, iteratedFDeriv_four_cubicRatioTerm 0 5 1 v h k l m h1] simp | true => have hs2 : ContDiffAt ℝ 4 (cubicRatioTerm 0 4 2) v := by unfold cubicRatioTerm fun_prop have hs1 : ContDiffAt ℝ 4 (cubicRatioTerm 0 3 1) v := by unfold cubicRatioTerm fun_prop have heq : Phi true = cubicRatioTerm 0 4 2 - cubicRatioTerm 0 3 1 := by funext y simp [Phi, cubicRatioTerm, div_eq_mul_inv] ring rw [heq, iteratedFDeriv_sub_apply hs2 hs1] change iteratedFDeriv ℝ 4 (cubicRatioTerm 0 4 2) v ![h, k, l, m] - iteratedFDeriv ℝ 4 (cubicRatioTerm 0 3 1) v ![h, k, l, m] = _ rw [ iteratedFDeriv_four_cubicRatioTerm 0 4 2 v h k l m h2, iteratedFDeriv_four_cubicRatioTerm 0 3 1 v h k l m h1] simp
CausalSmith.Stat.TransportCaceRoughnuisanceLength.iteratedFDeriv_four_Phi · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/FourthDerivative.lean:87
theorem cubicRatioD4_basis_abs_le

Given the supplied inputs, the stated result about cubic ratio d4 basis abs le holds.

Formal statement
a b c i j k l :
Fin 7
C R :
ℝ
hC :
1 < C
hR :
1 < R
ha :
|v a| ≤ C
hb :
|v b| ≤ C
hc :
|(v c)⁻¹| ≤ R
|cubicRatioD4Apply a b c (basis i) (basis j) (basis k) (basis l) v|
≤ 24 * (1 + C) ^ 2 * R ^ 5
Proof (Lean source)
lemma cubicRatioD4_basis_abs_le (a b c i j k l : Fin 7) (v : DensityVector) (C R : ℝ) (hC : 1 < C) (hR : 1 < R) (ha : |v a| ≤ C) (hb : |v b| ≤ C) (hc : |(v c)⁻¹| ≤ R) : |cubicRatioD4Apply a b c (basis i) (basis j) (basis k) (basis l) v| ≤ 24 * (1 + C) ^ 2 * R ^ 5 := by have hC0 : 0 ≤ C := by linarith have hR0 : 0 ≤ R := by linarith have hd (s r : Fin 7) : |basis s r| ≤ 1 := by by_cases hrs : r = s <;> simp [basis, hrs] have hpair (s t : Fin 7) : |basis s a * basis t b + basis t a * basis s b| ≤ 2 := by calc _ ≤ |basis s a| * |basis t b| + |basis t a| * |basis s b| := by simpa only [abs_mul] using abs_add_le (basis s a * basis t b) (basis t a * basis s b) _ ≤ 1 * 1 + 1 * 1 := by gcongr <;> apply hd _ = 2 := by norm_num have hlinear (s : Fin 7) : |basis s a * v b + v a * basis s b| ≤ 2 * C := by calc _ ≤ |basis s a| * |v b| + |v a| * |basis s b| := by simpa only [abs_mul] using abs_add_le (basis s a * v b) (v a * basis s b) _ ≤ 1 * C + C * 1 := by gcongr <;> first | apply hd | exact ha | exact hb _ = 2 * C := by ring have hp (s t u w : Fin 7) : |2 * (basis s a * basis t b + basis t a * basis s b) * basis u c * basis w c * (v c)⁻¹ ^ 3| ≤ 4 * R ^ 3 := by simp only [abs_mul, abs_pow] calc _ ≤ |(2 : ℝ)| * 2 * 1 * 1 * R ^ 3 := by gcongr <;> first | apply hpair | apply hd | exact hc _ = _ := by norm_num have hs (s t u w : Fin 7) : |6 * (basis s a * v b + v a * basis s b) * basis t c * basis u c * basis w c * (v c)⁻¹ ^ 4| ≤ 12 * C * R ^ 4 := by simp only [abs_mul, abs_pow] calc _ ≤ |(6 : ℝ)| * (2 * C) * 1 * 1 * 1 * R ^ 4 := by gcongr <;> first | apply hlinear | apply hd | exact hc _ = _ := by norm_num <;> ring <;> simp have ht : |24 * v a * v b * basis i c * basis j c * basis k c * basis l c * (v c)⁻¹ ^ 5| ≤ 24 * C ^ 2 * R ^ 5 := by simp only [abs_mul, abs_pow] calc _ ≤ |(24 : ℝ)| * C * C * 1 * 1 * 1 * 1 * R ^ 5 := by gcongr <;> first | exact ha | exact hb | apply hd | exact hc _ = _ := by norm_num <;> ring <;> simp have hraw : |cubicRatioD4Apply a b c (basis i) (basis j) (basis k) (basis l) v| ≤ 24 * R ^ 3 + 48 * C * R ^ 4 + 24 * C ^ 2 * R ^ 5 := by unfold cubicRatioD4Apply have hab1 := abs_add_le (2 * (basis i a * basis j b + basis j a * basis i b) * basis k c * basis l c * (v c)⁻¹ ^ 3) (2 * (basis i a * basis k b + basis k a * basis i b) * basis j c * basis l c * (v c)⁻¹ ^ 3) have hab2 := abs_add_le (2 * (basis i a * basis j b + basis j a * basis i b) * basis k c * basis l c * (v c)⁻¹ ^ 3 + 2 * (basis i a * basis k b + basis k a * basis i b) * basis j c * basis l c * (v c)⁻¹ ^ 3) (2 * (basis i a * basis l b + basis l a * basis i b) * basis j c * basis k c * (v c)⁻¹ ^ 3) have hab3 := abs_add_le (2 * (basis i a * basis j b + basis j a * basis i b) * basis k c * basis l c * (v c)⁻¹ ^ 3 + 2 * (basis i a * basis k b + basis k a * basis i b) * basis j c * basis l c * (v c)⁻¹ ^ 3 + 2 * (basis i a * basis l b + basis l a * basis i b) * basis j c * basis k c * (v c)⁻¹ ^ 3) (2 * (basis j a * basis k b + basis k a * basis j b) * basis i c * basis l c * (v c)⁻¹ ^ 3) have hab4 := abs_add_le (2 * (basis i a * basis j b + basis j a * basis i b) * basis k c * basis l c * (v c)⁻¹ ^ 3 + 2 * (basis i a * basis k b + basis k a * basis i b) * basis j c * basis l c * (v c)⁻¹ ^ 3 + 2 * (basis i a * basis l b + basis l a * basis i b) * basis j c * basis k c * (v c)⁻¹ ^ 3 + 2 * (basis j a * basis k b + basis k a * basis j b) * basis i c * basis l c * (v c)⁻¹ ^ 3) (2 * (basis j a * basis l b + basis l a * basis j b) * basis i c * basis k c * (v c)⁻¹ ^ 3) have hab5 := abs_add_le (2 * (basis i a * basis j b + basis j a * basis i b) * basis k c * basis l c * (v c)⁻¹ ^ 3 + 2 * (basis i a * basis k b + basis k a * basis i b) * basis j c * basis l c * (v c)⁻¹ ^ 3 + 2 * (basis i a * basis l b + basis l a * basis i b) * basis j c * basis k c * (v c)⁻¹ ^ 3 + 2 * (basis j a * basis k b + basis k a * basis j b) * basis i c * basis l c * (v c)⁻¹ ^ 3 + 2 * (basis j a * basis l b + basis l a * basis j b) * basis i c * basis k c * (v c)⁻¹ ^ 3) (2 * (basis k a * basis l b + basis l a * basis k b) * basis i c * basis j c * (v c)⁻¹ ^ 3) have hab6 := abs_sub (2 * (basis i a * basis j b + basis j a * basis i b) * basis k c * basis l c * (v c)⁻¹ ^ 3 + 2 * (basis i a * basis k b + basis k a * basis i b) * basis j c * basis l c * (v c)⁻¹ ^ 3 + 2 * (basis i a * basis l b + basis l a * basis i b) * basis j c * basis k c * (v c)⁻¹ ^ 3 + 2 * (basis j a * basis k b + basis k a * basis j b) * basis i c * basis l c * (v c)⁻¹ ^ 3 + 2 * (basis j a * basis l b + basis l a * basis j b) * basis i c * basis k c * (v c)⁻¹ ^ 3 + 2 * (basis k a * basis l b + basis l a * basis k b) * basis i c * basis j c * (v c)⁻¹ ^ 3) (6 * (basis i a * v b + v a * basis i b) * basis j c * basis k c * basis l c * (v c)⁻¹ ^ 4) have hab7 := abs_sub (2 * (basis i a * basis j b + basis j a * basis i b) * basis k c * basis l c * (v c)⁻¹ ^ 3 + 2 * (basis i a * basis k b + basis k a * basis i b) * basis j c * basis l c * (v c)⁻¹ ^ 3 + 2 * (basis i a * basis l b + basis l a * basis i b) * basis j c * basis k c * (v c)⁻¹ ^ 3 + 2 * (basis j a * basis k b + basis k a * basis j b) * basis i c * basis l c * (v c)⁻¹ ^ 3 + 2 * (basis j a * basis l b + basis l a * basis j b) * basis i c * basis k c * (v c)⁻¹ ^ 3 + 2 * (basis k a * basis l b + basis l a * basis k b) * basis i c * basis j c * (v c)⁻¹ ^ 3 - 6 * (basis i a * v b + v a * basis i b) * basis j c * basis k c * basis l c * (v c)⁻¹ ^ 4) (6 * (basis j a * v b + v a * basis j b) * basis i c * basis k c * basis l c * (v c)⁻¹ ^ 4) have hab8 := abs_sub (2 * (basis i a * basis j b + basis j a * basis i b) * basis k c * basis l c * (v c)⁻¹ ^ 3 + 2 * (basis i a * basis k b + basis k a * basis i b) * basis j c * basis l c * (v c)⁻¹ ^ 3 + 2 * (basis i a * basis l b + basis l a * basis i b) * basis j c * basis k c * (v c)⁻¹ ^ 3 + 2 * (basis j a * basis k b + basis k a * basis j b) * basis i c * basis l c * (v c)⁻¹ ^ 3 + 2 * (basis j a * basis l b + basis l a * basis j b) * basis i c * basis k c * (v c)⁻¹ ^ 3 + 2 * (basis k a * basis l b + basis l a * basis k b) * basis i c * basis j c * (v c)⁻¹ ^ 3 - 6 * (basis i a * v b + v a * basis i b) * basis j c * basis k c * basis l c * (v c)⁻¹ ^ 4 - 6 * (basis j a * v b + v a * basis j b) * basis i c * basis k c * basis l c * (v c)⁻¹ ^ 4) (6 * (basis k a * v b + v a * basis k b) * basis i c * basis j c * basis l c * (v c)⁻¹ ^ 4) have hab9 := abs_sub (2 * (basis i a * basis j b + basis j a * basis i b) * basis k c * basis l c * (v c)⁻¹ ^ 3 + 2 * (basis i a * basis k b + basis k a * basis i b) * basis j c * basis l c * (v c)⁻¹ ^ 3 + 2 * (basis i a * basis l b + basis l a * basis i b) * basis j c * basis k c * (v c)⁻¹ ^ 3 + 2 * (basis j a * basis k b + basis k a * basis j b) * basis i c * basis l c * (v c)⁻¹ ^ 3 + 2 * (basis j a * basis l b + basis l a * basis j b) * basis i c * basis k c * (v c)⁻¹ ^ 3 + 2 * (basis k a * basis l b + basis l a * basis k b) * basis i c * basis j c * (v c)⁻¹ ^ 3 - 6 * (basis i a * v b + v a * basis i b) * basis j c * basis k c * basis l c * (v c)⁻¹ ^ 4 - 6 * (basis j a * v b + v a * basis j b) * basis i c * basis k c * basis l c * (v c)⁻¹ ^ 4 - 6 * (basis k a * v b + v a * basis k b) * basis i c * basis j c * basis l c * (v c)⁻¹ ^ 4) (6 * (basis l a * v b + v a * basis l b) * basis i c * basis j c * basis k c * (v c)⁻¹ ^ 4) have hab10 := abs_add_le (2 * (basis i a * basis j b + basis j a * basis i b) * basis k c * basis l c * (v c)⁻¹ ^ 3 + 2 * (basis i a * basis k b + basis k a * basis i b) * basis j c * basis l c * (v c)⁻¹ ^ 3 + 2 * (basis i a * basis l b + basis l a * basis i b) * basis j c * basis k c * (v c)⁻¹ ^ 3 + 2 * (basis j a * basis k b + basis k a * basis j b) * basis i c * basis l c * (v c)⁻¹ ^ 3 + 2 * (basis j a * basis l b + basis l a * basis j b) * basis i c * basis k c * (v c)⁻¹ ^ 3 + 2 * (basis k a * basis l b + basis l a * basis k b) * basis i c * basis j c * (v c)⁻¹ ^ 3 - 6 * (basis i a * v b + v a * basis i b) * basis j c * basis k c * basis l c * (v c)⁻¹ ^ 4 - 6 * (basis j a * v b + v a * basis j b) * basis i c * basis k c * basis l c * (v c)⁻¹ ^ 4 - 6 * (basis k a * v b + v a * basis k b) * basis i c * basis j c * basis l c * (v c)⁻¹ ^ 4 - 6 * (basis l a * v b + v a * basis l b) * basis i c * basis j c * basis k c * (v c)⁻¹ ^ 4) (24 * v a * v b * basis i c * basis j c * basis k c * basis l c * (v c)⁻¹ ^ 5) linarith [hp i j k l, hp i k j l, hp i l j k, hp j k i l, hp j l i k, hp k l i j, hs i j k l, hs j i k l, hs k i j l, hs l i j k, ht] have h3 : R ^ 3 ≤ R ^ 5 := pow_le_pow_right₀ hR.le (by omega) have h4 : R ^ 4 ≤ R ^ 5 := pow_le_pow_right₀ hR.le (by omega) calc _ ≤ 24 * R ^ 3 + 48 * C * R ^ 4 + 24 * C ^ 2 * R ^ 5 := hraw _ ≤ 24 * R ^ 5 + 48 * C * R ^ 5 + 24 * C ^ 2 * R ^ 5 := by gcongr _ = _ := by ring
CausalSmith.Stat.TransportCaceRoughnuisanceLength.cubicRatioD4_basis_abs_le · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/FourthDerivative.lean:132
theorem dPhi4_abs_le

Given the supplied inputs, the stated result about d phi4 abs le holds.

Formal statement
c_f C_f :
ℝ
hf :
0 < c_f ∧ c_f < 1
hC :
1 < C_f
A :
v :
Fin 7 → ℝ
hv :
i j k l :
Fin 7
|iteratedFDeriv ℝ 4 (Phi A) v ![basis i, basis j, basis k, basis l]|
Proof (Lean source)
lemma dPhi4_abs_le (c_f C_f : ℝ) (hf : 0 < c_f ∧ c_f < 1) (hC : 1 < C_f) (A : Bool) (v : Fin 7 → ℝ) (hv : clippingRectangle c_f C_f v) (i j k l : Fin 7) : |iteratedFDeriv ℝ 4 (Phi A) v ![basis i, basis j, basis k, basis l]| ≤ fourthDerivativeEnvelope c_f C_f := by have ht : |v 0| ≤ C_f := by rw [abs_of_nonneg (le_trans hf.1.le hv.1.1)] exact hv.1.2 have hm (b : Fin 7) (hb : 3 ≤ b.val) : |v b| ≤ C_f := by have hbnd := hv.2.2.2 b hb rw [abs_of_nonneg hbnd.1] linarith [hbnd.2] have hq (c : Fin 7) (hc : c_f / 4 ≤ v c) : v c ≠ 0 ∧ |(v c)⁻¹| ≤ 4 / c_f := by have hpos : 0 < v c := by linarith refine ⟨ne_of_gt hpos, ?_⟩ rw [abs_of_nonneg (inv_pos.mpr hpos).le] calc (v c)⁻¹ ≤ (c_f / 4)⁻¹ := (inv_le_inv₀ hpos (div_pos hf.1 (by norm_num))).2 hc _ = 4 / c_f := by ring have h1 := hq 1 hv.2.1.1 have h2 := hq 2 hv.2.2.1.1 have hR : 1 < 4 / c_f := (lt_div_iff₀ hf.1).2 (by linarith [hf.2]) rw [iteratedFDeriv_four_Phi A v (basis i) (basis j) (basis k) (basis l) h1.1 h2.1] have hp := cubicRatioD4_basis_abs_le 0 (if A then 4 else 6) 2 i j k l v C_f (4 / c_f) hC hR ht (hm _ (by cases A <;> decide)) h2.2 have hn := cubicRatioD4_basis_abs_le 0 (if A then 3 else 5) 1 i j k l v C_f (4 / c_f) hC hR ht (hm _ (by cases A <;> decide)) h1.2 exact (abs_sub _ _).trans (by unfold fourthDerivativeEnvelope; linarith)
CausalSmith.Stat.STAT_TransportCaceRoughnuisanceLength_Research.Helpers.CubicMse.HistogramCellRepresentation 5 declarations Histogram cell heights as iid block averages

Histogram cell heights as iid block averages

theorem midpoint_mem_cell

Given the supplied inputs, the stated result about midpoint mem cell holds.

Formal statement
K :
ℕ
hK :
0 < K
l :
Fin K
midpoint K l ∈ cell K l
Proof (Lean source)
lemma midpoint_mem_cell {K : ℕ} (hK : 0 < K) (l : Fin K) : midpoint K l ∈ cell K l := by have hKr : (0 : ℝ) < K := by exact_mod_cast hK unfold midpoint cell split_ifs with hlast · constructor · apply (div_le_div_iff_of_pos_right hKr).2 norm_num · apply (div_le_one hKr).2 have hl : (l.val : ℝ) + 1 = K := by exact_mod_cast hlast linarith · constructor · apply (div_le_div_iff_of_pos_right hKr).2 norm_num · apply (div_lt_div_iff_of_pos_right hKr).2 norm_num
theorem midpoint_mem_cell_iff

Given the supplied inputs, the stated result about midpoint mem cell iff holds.

Formal statement
K :
ℕ
hK :
0 < K
l r :
Fin K
midpoint K l ∈ cell K r ↔ r = l
Proof (Lean source)
lemma midpoint_mem_cell_iff {K : ℕ} (hK : 0 < K) (l r : Fin K) : midpoint K l ∈ cell K r ↔ r = l := by constructor · intro hmem by_contra hne exact Set.disjoint_left.mp (cell_disjoint hK hne) hmem (midpoint_mem_cell hK l) · intro hrl simpa [hrl] using midpoint_mem_cell hK l
theorem sourceCellMark_eq_channelMark

Given the supplied inputs, the stated result about source cell mark eq channel mark holds.

Formal statement
n :
ℕ
w :
i :
Fin 7
hi :
i ≠ 0
r :
Fin n
sourceCellMark i (w.1 r) = channelMark w i r
Proof (Lean source)
lemma sourceCellMark_eq_channelMark {n : ℕ} (w : TwoSample n n) (i : Fin 7) (hi : i ≠ 0) (r : Fin n) : sourceCellMark i (w.1 r) = channelMark w i r := by fin_cases i <;> simp_all [sourceCellMark, channelMark, boolReal]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.sourceCellMark_eq_channelMark · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/HistogramCellRepresentation.lean:39
theorem markedHistogram_midpoint_target

Given the supplied inputs, the stated result about marked histogram midpoint target holds.

Formal statement
n K :
ℕ
hn :
threshold ≤ n
hK :
0 < K
w :
b :
Fin 4
l :
Fin K
Proof (Lean source)
lemma markedHistogram_midpoint_target {n K : ℕ} (hn : threshold ≤ n) (hK : 0 < K) (w : TwoSample n n) (b : Fin 4) (l : Fin K) : markedHistogram w 0 K b (midpoint K l) = iidBlockHeight K (blockIdx n b) (targetCellScore K l) w.2 := by classical unfold markedHistogram iidBlockHeight simp only [if_neg (Nat.not_lt_of_ge hn)] rw [Finset.sum_eq_single l] · rw [if_pos (midpoint_mem_cell hK l)] rw [block_card] congr 1 apply Finset.sum_congr rfl intro r _ simp [channelMark, channelX, sourceChannel, targetCellScore] · intro r _ hrl rw [if_neg] exact fun hmem => hrl (midpoint_mem_cell_iff hK l r |>.mp hmem) · exact fun hl => (hl (Finset.mem_univ l)).elim
CausalSmith.Stat.TransportCaceRoughnuisanceLength.markedHistogram_midpoint_target · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/HistogramCellRepresentation.lean:44
theorem markedHistogram_midpoint_source

Given the supplied inputs, the stated result about marked histogram midpoint source holds.

Formal statement
n K :
ℕ
hn :
threshold ≤ n
hK :
0 < K
w :
i :
Fin 7
hi :
i ≠ 0
b :
Fin 4
l :
Fin K
Proof (Lean source)
lemma markedHistogram_midpoint_source {n K : ℕ} (hn : threshold ≤ n) (hK : 0 < K) (w : TwoSample n n) (i : Fin 7) (hi : i ≠ 0) (b : Fin 4) (l : Fin K) : markedHistogram w i K b (midpoint K l) = iidBlockHeight K (blockIdx n b) (sourceCellScore i K l) w.1 := by classical unfold markedHistogram iidBlockHeight simp only [if_neg (Nat.not_lt_of_ge hn)] rw [Finset.sum_eq_single l] · rw [if_pos (midpoint_mem_cell hK l)] rw [block_card] congr 1 apply Finset.sum_congr rfl intro r _ rw [← sourceCellMark_eq_channelMark w i hi r] have hsource : sourceChannel i = true := by simp [sourceChannel, hi] simp [channelX, hsource, sourceCellScore] · intro r _ hrl rw [if_neg] exact fun hmem => hrl (midpoint_mem_cell_iff hK l r |>.mp hmem) · exact fun hl => (hl (Finset.mem_univ l)).elim
CausalSmith.Stat.TransportCaceRoughnuisanceLength.markedHistogram_midpoint_source · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/HistogramCellRepresentation.lean:64
CausalSmith.Stat.STAT_TransportCaceRoughnuisanceLength_Research.Helpers.CubicMse.IidBlockAverage 6 declarations Covariance of iid block histogram heights

Covariance of iid block histogram heights

def iidBlockHeight

The iid block height object is defined from the supplied inputs.

Definition (Lean source)
Ω :
Type*
n :
ℕ
K :
ℕ
S :
f :
Ω → ℝ
x :
Fin n → Ω
iidBlockHeight K S f x :
ℝ
(K : ℝ) / S.card * ∑ r ∈ S, f (x r)
theorem covariance_iidBlockHeight

Given the supplied inputs, the stated result about covariance iid block height holds.

Formal statement
n K :
ℕ
S :
hS :
0 < S.card
f g :
Ω → ℝ
hfmeas :
hgmeas :
hf :
MemLp f 2 μ
hg :
MemLp g 2 μ
cov[iidBlockHeight K S f, iidBlockHeight K S g; Measure.pi (fun _ : Fin n => μ)]
= (K : ℝ) ^ 2 / S.card * cov[f, g; μ]
Proof (Lean source)
lemma covariance_iidBlockHeight {Ω : Type*} [MeasurableSpace Ω] [StandardBorelSpace Ω] {μ : Measure Ω} [IsProbabilityMeasure μ] {n K : ℕ} (S : Finset (Fin n)) (hS : 0 < S.card) (f g : Ω → ℝ) (hfmeas : Measurable f) (hgmeas : Measurable g) (hf : MemLp f 2 μ) (hg : MemLp g 2 μ) : cov[iidBlockHeight K S f, iidBlockHeight K S g; Measure.pi (fun _ : Fin n => μ)] = (K : ℝ) ^ 2 / S.card * cov[f, g; μ] := by let ν : Measure (Fin n → Ω) := Measure.pi (fun _ : Fin n => μ) let X : Fin n → (Fin n → Ω) → ℝ := fun r x => f (x r) let Y : Fin n → (Fin n → Ω) → ℝ := fun r x => g (x r) have hX (r : Fin n) : MemLp (X r) 2 ν := by exact hf.comp_measurePreserving (measurePreserving_eval (fun _ : Fin n => μ) r) have hY (r : Fin n) : MemLp (Y r) 2 ν := by exact hg.comp_measurePreserving (measurePreserving_eval (fun _ : Fin n => μ) r) have hcoord (r s : Fin n) : cov[X r, Y s; ν] = if r = s then cov[f, g; μ] else 0 := by by_cases hrs : r = s · subst s simp only [if_pos rfl] have hpres := measurePreserving_eval (fun _ : Fin n => μ) r have hfmap : AEStronglyMeasurable f (ν.map (Function.eval r)) := by rw [hpres.map_eq] exact hf.aestronglyMeasurable have hgmap : AEStronglyMeasurable g (ν.map (Function.eval r)) := by rw [hpres.map_eq] exact hg.aestronglyMeasurable have hmap := covariance_map hfmap hgmap hpres.measurable.aemeasurable rw [hpres.map_eq] at hmap exact hmap.symm · simp only [if_neg hrs] have hind := indepFun_pi_of_disjoint (Ω := fun _ : Fin n => Ω) (fun _ : Fin n => μ) (show Disjoint ({r} : Finset (Fin n)) {s} by simpa) have hind' : IndepFun (X r) (Y s) ν := by have hcomp := hind.comp (hfmeas.comp (measurable_pi_apply (⟨r, Finset.mem_singleton_self r⟩ : {i // i ∈ ({r} : Finset (Fin n))}))) (hgmeas.comp (measurable_pi_apply (⟨s, Finset.mem_singleton_self s⟩ : {i // i ∈ ({s} : Finset (Fin n))}))) have hF : (ofFinite (Fin n)) = (inferInstance : Fintype (Fin n)) := Subsingleton.elim _ _ have hpi : @Measure.pi (Fin n) (fun _ => Ω) (ofFinite (Fin n)) (fun _ => inferInstance) (fun _ => μ) = Measure.pi (fun _ : Fin n => μ) := congrArg (fun fi : Fintype (Fin n) => @Measure.pi (Fin n) (fun _ => Ω) fi (fun _ => inferInstance) (fun _ => μ)) hF simpa only [hpi, ν, X, Y, finsetCoordProj, Function.comp_def] using hcomp exact hind'.covariance_eq_zero (hX r) (hY s) have hsum : cov[(fun x => ∑ r ∈ S, X r x), (fun x => ∑ s ∈ S, Y s x); ν] = S.card * cov[f, g; μ] := by rw [covariance_fun_sum_fun_sum' (fun r _ => hX r) (fun s _ => hY s)] simp_rw [hcoord] calc ∑ r ∈ S, ∑ s ∈ S, (if r = s then cov[f, g; μ] else 0) = ∑ r ∈ S, cov[f, g; μ] := by apply Finset.sum_congr rfl intro r hr simp [eq_comm, hr] _ = (S.card : ℝ) * cov[f, g; μ] := by simp change cov[(fun x => ((K : ℝ) / S.card) * (∑ r ∈ S, X r x)), (fun x => ((K : ℝ) / S.card) * (∑ s ∈ S, Y s x)); ν] = _ rw [covariance_const_mul_left, covariance_const_mul_right, hsum] have hcard : (S.card : ℝ) ≠ 0 := by exact_mod_cast hS.ne' field_simp
CausalSmith.Stat.TransportCaceRoughnuisanceLength.covariance_iidBlockHeight · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/IidBlockAverage.lean:18
theorem source_iidBlockHeight_same_cell_covariance_le

Given the supplied inputs, the stated result about source iid block height same cell covariance le holds.

Formal statement
c_f C_f L :
ℝ
n K :
ℕ
hP :
ModelClass c_f C_f L P n
hK :
0 < K
S :
hS :
0 < S.card
l :
Fin K
i j :
Fin 7
|cov[iidBlockHeight K S (sourceCellScore i K l), iidBlockHeight K S (sourceCellScore j K l); Measure.pi (fun _ : Fin n => sourceObsLaw P)]|
≤ ((K : ℝ) * C_f + C_f ^ 2) / S.card
Proof (Lean source)
lemma source_iidBlockHeight_same_cell_covariance_le (c_f C_f L : ℝ) (P : TransportLaw) (n K : ℕ) (hP : ModelClass c_f C_f L P n) (hK : 0 < K) (S : Finset (Fin n)) (hS : 0 < S.card) (l : Fin K) (i j : Fin 7) : |cov[iidBlockHeight K S (sourceCellScore i K l), iidBlockHeight K S (sourceCellScore j K l); Measure.pi (fun _ : Fin n => sourceObsLaw P)]| ≤ ((K : ℝ) * C_f + C_f ^ 2) / S.card := by letI : IsProbabilityMeasure (sourceObsLaw P) := sourceObsLaw_isProbabilityMeasure c_f C_f L P n hP have hfi := memLp_two_of_mem_unit_interval (μ := sourceObsLaw P) (measurable_sourceCellScore i K l) (sourceCellScore_mem_unit_interval i K l) have hfj := memLp_two_of_mem_unit_interval (μ := sourceObsLaw P) (measurable_sourceCellScore j K l) (sourceCellScore_mem_unit_interval j K l) rw [covariance_iidBlockHeight S hS _ _ (measurable_sourceCellScore i K l) (measurable_sourceCellScore j K l) hfi hfj, abs_mul, abs_of_nonneg (div_nonneg (sq_nonneg (K : ℝ)) (by positivity))] have hsingle := source_same_cell_covariance_le c_f C_f L P n K hP hK l i j apply le_trans (mul_le_mul_of_nonneg_left hsingle (div_nonneg (sq_nonneg (K : ℝ)) (by positivity))) have hKr : (K : ℝ) ≠ 0 := by exact_mod_cast hK.ne' have hSr : (S.card : ℝ) ≠ 0 := by exact_mod_cast hS.ne' field_simp exact le_rfl
CausalSmith.Stat.TransportCaceRoughnuisanceLength.source_iidBlockHeight_same_cell_covariance_le · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/IidBlockAverage.lean:85
theorem source_iidBlockHeight_off_cell_covariance_le

Given the supplied inputs, the stated result about source iid block height off cell covariance le holds.

Formal statement
c_f C_f L :
ℝ
n K :
ℕ
hP :
ModelClass c_f C_f L P n
hK :
0 < K
S :
hS :
0 < S.card
l r :
Fin K
hlr :
l ≠ r
i j :
Fin 7
|cov[iidBlockHeight K S (sourceCellScore i K l), iidBlockHeight K S (sourceCellScore j K r); Measure.pi (fun _ : Fin n => sourceObsLaw P)]|
≤ C_f ^ 2 / S.card
Proof (Lean source)
lemma source_iidBlockHeight_off_cell_covariance_le (c_f C_f L : ℝ) (P : TransportLaw) (n K : ℕ) (hP : ModelClass c_f C_f L P n) (hK : 0 < K) (S : Finset (Fin n)) (hS : 0 < S.card) {l r : Fin K} (hlr : l ≠ r) (i j : Fin 7) : |cov[iidBlockHeight K S (sourceCellScore i K l), iidBlockHeight K S (sourceCellScore j K r); Measure.pi (fun _ : Fin n => sourceObsLaw P)]| ≤ C_f ^ 2 / S.card := by letI : IsProbabilityMeasure (sourceObsLaw P) := sourceObsLaw_isProbabilityMeasure c_f C_f L P n hP have hfi := memLp_two_of_mem_unit_interval (μ := sourceObsLaw P) (measurable_sourceCellScore i K l) (sourceCellScore_mem_unit_interval i K l) have hfj := memLp_two_of_mem_unit_interval (μ := sourceObsLaw P) (measurable_sourceCellScore j K r) (sourceCellScore_mem_unit_interval j K r) rw [covariance_iidBlockHeight S hS _ _ (measurable_sourceCellScore i K l) (measurable_sourceCellScore j K r) hfi hfj, abs_mul, abs_of_nonneg (div_nonneg (sq_nonneg (K : ℝ)) (by positivity))] have hsingle := source_off_cell_covariance_le c_f C_f L P n K hP hK hlr i j apply le_trans (mul_le_mul_of_nonneg_left hsingle (div_nonneg (sq_nonneg (K : ℝ)) (by positivity))) have hKr : (K : ℝ) ≠ 0 := by exact_mod_cast hK.ne' have hSr : (S.card : ℝ) ≠ 0 := by exact_mod_cast hS.ne' field_simp exact le_rfl
CausalSmith.Stat.TransportCaceRoughnuisanceLength.source_iidBlockHeight_off_cell_covariance_le · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/IidBlockAverage.lean:111
theorem target_iidBlockHeight_same_cell_covariance_le

Given the supplied inputs, the stated result about target iid block height same cell covariance le holds.

Formal statement
c_f C_f L :
ℝ
n K :
ℕ
hP :
ModelClass c_f C_f L P n
hK :
0 < K
S :
hS :
0 < S.card
l :
Fin K
|cov[iidBlockHeight K S (targetCellScore K l), iidBlockHeight K S (targetCellScore K l); Measure.pi (fun _ : Fin n => targetXLaw P)]|
≤ ((K : ℝ) * C_f + C_f ^ 2) / S.card
Proof (Lean source)
lemma target_iidBlockHeight_same_cell_covariance_le (c_f C_f L : ℝ) (P : TransportLaw) (n K : ℕ) (hP : ModelClass c_f C_f L P n) (hK : 0 < K) (S : Finset (Fin n)) (hS : 0 < S.card) (l : Fin K) : |cov[iidBlockHeight K S (targetCellScore K l), iidBlockHeight K S (targetCellScore K l); Measure.pi (fun _ : Fin n => targetXLaw P)]| ≤ ((K : ℝ) * C_f + C_f ^ 2) / S.card := by letI : IsProbabilityMeasure (targetXLaw P) := targetXLaw_isProbabilityMeasure c_f C_f L P n hP have hf := memLp_two_of_mem_unit_interval (μ := targetXLaw P) (measurable_targetCellScore K l) (targetCellScore_mem_unit_interval K l) rw [covariance_iidBlockHeight S hS _ _ (measurable_targetCellScore K l) (measurable_targetCellScore K l) hf hf, abs_mul, abs_of_nonneg (div_nonneg (sq_nonneg (K : ℝ)) (by positivity))] have hsingle := target_same_cell_covariance_le c_f C_f L P n K hP hK l apply le_trans (mul_le_mul_of_nonneg_left hsingle (div_nonneg (sq_nonneg (K : ℝ)) (by positivity))) have hKr : (K : ℝ) ≠ 0 := by exact_mod_cast hK.ne' have hSr : (S.card : ℝ) ≠ 0 := by exact_mod_cast hS.ne' field_simp exact le_rfl
CausalSmith.Stat.TransportCaceRoughnuisanceLength.target_iidBlockHeight_same_cell_covariance_le · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/IidBlockAverage.lean:136
theorem target_iidBlockHeight_off_cell_covariance_le

Given the supplied inputs, the stated result about target iid block height off cell covariance le holds.

Formal statement
c_f C_f L :
ℝ
n K :
ℕ
hP :
ModelClass c_f C_f L P n
hK :
0 < K
S :
hS :
0 < S.card
l r :
Fin K
hlr :
l ≠ r
|cov[iidBlockHeight K S (targetCellScore K l), iidBlockHeight K S (targetCellScore K r); Measure.pi (fun _ : Fin n => targetXLaw P)]|
≤ C_f ^ 2 / S.card
Proof (Lean source)
lemma target_iidBlockHeight_off_cell_covariance_le (c_f C_f L : ℝ) (P : TransportLaw) (n K : ℕ) (hP : ModelClass c_f C_f L P n) (hK : 0 < K) (S : Finset (Fin n)) (hS : 0 < S.card) {l r : Fin K} (hlr : l ≠ r) : |cov[iidBlockHeight K S (targetCellScore K l), iidBlockHeight K S (targetCellScore K r); Measure.pi (fun _ : Fin n => targetXLaw P)]| ≤ C_f ^ 2 / S.card := by letI : IsProbabilityMeasure (targetXLaw P) := targetXLaw_isProbabilityMeasure c_f C_f L P n hP have hfl := memLp_two_of_mem_unit_interval (μ := targetXLaw P) (measurable_targetCellScore K l) (targetCellScore_mem_unit_interval K l) have hfr := memLp_two_of_mem_unit_interval (μ := targetXLaw P) (measurable_targetCellScore K r) (targetCellScore_mem_unit_interval K r) rw [covariance_iidBlockHeight S hS _ _ (measurable_targetCellScore K l) (measurable_targetCellScore K r) hfl hfr, abs_mul, abs_of_nonneg (div_nonneg (sq_nonneg (K : ℝ)) (by positivity))] have hsingle := target_off_cell_covariance_le c_f C_f L P n K hP hK hlr apply le_trans (mul_le_mul_of_nonneg_left hsingle (div_nonneg (sq_nonneg (K : ℝ)) (by positivity))) have hKr : (K : ℝ) ≠ 0 := by exact_mod_cast hK.ne' have hSr : (S.card : ℝ) ≠ 0 := by exact_mod_cast hS.ne' field_simp exact le_rfl
CausalSmith.Stat.TransportCaceRoughnuisanceLength.target_iidBlockHeight_off_cell_covariance_le · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/IidBlockAverage.lean:160
CausalSmith.Stat.STAT_TransportCaceRoughnuisanceLength_Research.Helpers.CubicMse.IntegratedRemainder 6 declarations Jensen and Fubini turn the clipped pilot eighth moment into the integrated remainder bound in roadmap (9), without adding regularity assumptions.

Spatial integration of the cubic Taylor remainder

Jensen and Fubini turn the clipped pilot eighth moment into the integrated remainder bound in roadmap (9), without adding regularity assumptions.

theorem sq_integral_le_majorant_second_moment Lemma sq_integral_le_majorant_second_moment in the paper ↗

A bounded nonnegative majorant controls the square of a spatial integral by its second moment under a probability measure. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
X :
r g :
X → ℝ
C :
ℝ
hg :
hb :
∀ᵐ x ∂ν, |g x| ≤ C
hr :
∀ᵐ x ∂ν, |r x| ≤ g x
(∫ x, r x ∂ν) ^ 2 ≤ ∫ x, (g x) ^ 2 ∂ν
Proof (Lean source)
-- @node: sq_integral_le_majorant_second_moment lemma sq_integral_le_majorant_second_moment {X : Type*} [MeasurableSpace X] (ν : Measure X) [IsProbabilityMeasure ν] (r g : X → ℝ) (C : ℝ) (hg : Measurable g) (hb : ∀ᵐ x ∂ν, |g x| ≤ C) (hr : ∀ᵐ x ∂ν, |r x| ≤ g x) : (∫ x, r x ∂ν) ^ 2 ≤ ∫ x, (g x) ^ 2 ∂ν := by have hlp : MemLp g 2 ν := MemLp.of_bound hg.aestronglyMeasurable C (by simpa only [Real.norm_eq_abs] using hb) have habs : |∫ x, r x ∂ν| ≤ ∫ x, g x ∂ν := abs_integral_le_integral_abs.trans (integral_mono_of_nonneg (Filter.Eventually.of_forall fun x => abs_nonneg _) (hlp.integrable (by norm_num)) hr) have hj := ProbabilityTheory.variance_nonneg g ν rw [ProbabilityTheory.variance_eq_sub hlp] at hj calc _ ≤ (∫ x, g x ∂ν) ^ 2 := by simpa only [sq_abs] using pow_le_pow_left₀ (abs_nonneg _) habs 2 _ ≤ _ := sub_nonneg.mp hj
CausalSmith.Stat.TransportCaceRoughnuisanceLength.sq_integral_le_majorant_second_moment · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/IntegratedRemainder.lean:17
theorem integrated_second_moment_le_of_majorant Lemma integrated_second_moment_le_of_majorant in the paper ↗

Joint measurability and a bounded majorant justify Fubini in the integrated second-moment estimate. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
μ :
ν :
r g :
Ω → X → ℝ
C B :
ℝ
hg :
hb :
∀ ω, ∀ᵐ x ∂ν, |g ω x| ≤ C
hr :
∀ ω, ∀ᵐ x ∂ν, |r ω x| ≤ g ω x
hmoment :
∀ᵐ x ∂ν, (∫ ω, (g ω x) ^ 2 ∂μ) ≤ B
(∫ ω, (∫ x, r ω x ∂ν) ^ 2 ∂μ) ≤ B
Proof (Lean source)
-- @node: integrated_second_moment_le_of_majorant lemma integrated_second_moment_le_of_majorant {Ω X : Type*} [MeasurableSpace Ω] [MeasurableSpace X] (μ : Measure Ω) (ν : Measure X) [IsProbabilityMeasure μ] [IsProbabilityMeasure ν] (r g : Ω → X → ℝ) (C B : ℝ) (hg : Measurable (uncurry g)) (hb : ∀ ω, ∀ᵐ x ∂ν, |g ω x| ≤ C) (hr : ∀ ω, ∀ᵐ x ∂ν, |r ω x| ≤ g ω x) (hmoment : ∀ᵐ x ∂ν, (∫ ω, (g ω x) ^ 2 ∂μ) ≤ B) : (∫ ω, (∫ x, r ω x ∂ν) ^ 2 ∂μ) ≤ B := by have hi : Integrable (fun p : Ω × X => (g p.1 p.2) ^ 2) (μ.prod ν) := by apply Integrable.of_bound (hg.pow_const 2).aestronglyMeasurable (C ^ 2) rw [Measure.ae_prod_iff_ae_ae (measurableSet_le (hg.pow_const 2).norm measurable_const)] filter_upwards [] with ω filter_upwards [hb ω] with x hx simpa only [uncurry, Real.norm_eq_abs, abs_pow, sq_abs] using pow_le_pow_left₀ (abs_nonneg _) hx 2 calc _ ≤ ∫ ω, ∫ x, (g ω x) ^ 2 ∂ν ∂μ := by apply integral_mono_of_nonneg (Filter.Eventually.of_forall fun ω => sq_nonneg _) hi.integral_prod_left filter_upwards [] with ω exact sq_integral_le_majorant_second_moment ν (r ω) (g ω) C (hg.comp (measurable_const.prodMk measurable_id)) (hb ω) (hr ω) _ = ∫ x, ∫ ω, (g ω x) ^ 2 ∂μ ∂ν := integral_integral_swap hi _ ≤ ∫ _x, B ∂ν := integral_mono_ae hi.integral_prod_right (integrable_const B) hmoment _ = B := by simp
CausalSmith.Stat.TransportCaceRoughnuisanceLength.integrated_second_moment_le_of_majorant · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/IntegratedRemainder.lean:39
theorem measurable_markedHistogram_joint

The histogram is jointly measurable in the sample and covariate. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
n :
ℕ
i :
Fin 7
K :
ℕ
b :
Fin 4
Measurable (fun p : TwoSample n n × ℝ => markedHistogram p.1 i K b p.2)
Proof (Lean source)
@[fun_prop] -- @node: measurable_markedHistogram_joint lemma measurable_markedHistogram_joint {n : ℕ} (i : Fin 7) (K : ℕ) (b : Fin 4) : Measurable (fun p : TwoSample n n × ℝ => markedHistogram p.1 i K b p.2) := by classical unfold markedHistogram split_ifs · fun_prop · apply Finset.measurable_sum intro l hl apply Measurable.ite ((measurableSet_cell K l).preimage measurable_snd) · apply Measurable.const_mul apply Finset.measurable_sum intro r hr apply mul ((measurable_channelMark i r).comp measurable_fst) exact Measurable.ite ((measurableSet_cell K l).preimage ((measurable_channelX i r).comp measurable_fst)) measurable_const measurable_const · fun_prop
CausalSmith.Stat.TransportCaceRoughnuisanceLength.measurable_markedHistogram_joint · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/IntegratedRemainder.lean:70
theorem measurable_pilot_joint

Clipping preserves joint measurability of the pilot. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f :
ℝ
n :
ℕ
i :
Fin 7
Measurable (fun p : TwoSample n n × ℝ => pilot c_f C_f p.1 p.2 i)
Proof (Lean source)
@[fun_prop] -- @node: measurable_pilot_joint lemma measurable_pilot_joint (c_f C_f : ℝ) {n : ℕ} (i : Fin 7) : Measurable (fun p : TwoSample n n × ℝ => pilot c_f C_f p.1 p.2 i) := by classical unfold pilot split_ifs · fun_prop · unfold clipChannel clip dsimp only split_ifs <;> fun_prop
CausalSmith.Stat.TransportCaceRoughnuisanceLength.measurable_pilot_joint · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/IntegratedRemainder.lean:90
theorem measurable_markedDensityVector_indicator

The true marked density, extended by zero outside its covariate domain, is measurable; continuity on that domain provides this regularity. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hP :
ModelClass c_f C_f L P n
i :
Fin 7
Measurable (covariateSpace.indicator (fun x => markedDensityVector c_f C_f L P n hP x i))
Proof (Lean source)
-- @node: measurable_markedDensityVector_indicator lemma measurable_markedDensityVector_indicator (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hP : ModelClass c_f C_f L P n) (i : Fin 7) : Measurable (covariateSpace.indicator (fun x => markedDensityVector c_f C_f L P n hP x i)) := by classical exact (markedDensityVector_continuousOn c_f C_f L P n hP i).measurable_piecewise continuousOn_const measurableSet_Icc
CausalSmith.Stat.TransportCaceRoughnuisanceLength.measurable_markedDensityVector_indicator · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/IntegratedRemainder.lean:103
theorem pilot_Phi_cubic_taylor_remainder_integrated_second_moment

Roadmap (9): the expected square of the spatially integrated exact cubic Taylor remainder is bounded by the clipped pilot eighth moment. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hn :
threshold ≤ n
hP :
ModelClass c_f C_f L P n
A :
(∫ ω, (∫ x in covariateSpace, (let v := pilot c_f C_f ω x let h := markedDensityVector c_f C_f L P n hP x - v Phi A (markedDensityVector c_f C_f L P n hP x) - (Phi A v + iteratedFDeriv ℝ 1 (Phi A) v ![h] + iteratedFDeriv ℝ 2 (Phi A) v ![h, h] / 2 + iteratedFDeriv ℝ 3 (Phi A) v ![h, h, h] / 6))) ^ 2 ∂dataLaw P n n)
≤ (fourthDerivativeEnvelope c_f C_f / 24) ^ 2 * (7 : ℝ) ^ (8 : ℕ) * pilotEighthConstant C_f L * (n : ℝ) ^ (-(4 / 5 : ℝ))
Proof (Lean source)
-- @node: pilot_Phi_cubic_taylor_remainder_integrated_second_moment lemma pilot_Phi_cubic_taylor_remainder_integrated_second_moment (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hn : threshold ≤ n) (hP : ModelClass c_f C_f L P n) (A : Bool) : (∫ ω, (∫ x in covariateSpace, (let v := pilot c_f C_f ω x let h := markedDensityVector c_f C_f L P n hP x - v Phi A (markedDensityVector c_f C_f L P n hP x) - (Phi A v + iteratedFDeriv ℝ 1 (Phi A) v ![h] + iteratedFDeriv ℝ 2 (Phi A) v ![h, h] / 2 + iteratedFDeriv ℝ 3 (Phi A) v ![h, h, h] / 6))) ^ 2 ∂dataLaw P n n) ≤ (fourthDerivativeEnvelope c_f C_f / 24) ^ 2 * (7 : ℝ) ^ (8 : ℕ) * pilotEighthConstant C_f L * (n : ℝ) ^ (-(4 / 5 : ℝ)) := by classical let μ := dataLaw P n n let ν := volume.restrict covariateSpace let : IsProbabilityMeasure (sourceObsLaw P) := sourceObsLaw_isProbabilityMeasure c_f C_f L P n hP let : IsProbabilityMeasure (targetXLaw P) := targetXLaw_isProbabilityMeasure c_f C_f L P n hP have hprob : IsProbabilityMeasure μ := by dsimp [μ] rw [dataLaw_eq_source_target_pi c_f C_f L P n hP] infer_instance let := hprob have hvol : IsProbabilityMeasure ν := ⟨by simp [ν, covariateSpace]⟩ let := hvol let F (x : ℝ) (i : Fin 7) := covariateSpace.indicator (fun y => markedDensityVector c_f C_f L P n hP y i) x let e (ω : TwoSample n n) (x : ℝ) (i : Fin 7) := pilot c_f C_f ω x i - F x i let M := fourthDerivativeEnvelope c_f C_f / 24 let g (ω : TwoSample n n) (x : ℝ) := M * (∑ i : Fin 7, |e ω x i|) ^ 4 let r (ω : TwoSample n n) (x : ℝ) := let v := pilot c_f C_f ω x let h := markedDensityVector c_f C_f L P n hP x - v Phi A (markedDensityVector c_f C_f L P n hP x) - (Phi A v + iteratedFDeriv ℝ 1 (Phi A) v ![h] + iteratedFDeriv ℝ 2 (Phi A) v ![h, h] / 2 + iteratedFDeriv ℝ 3 (Phi A) v ![h, h, h] / 6) have hc := hP.sourceBounds.1.1 have hC : 0 ≤ C_f := le_trans (by norm_num) hP.sourceBounds.2.1.le have hM : 0 ≤ M := by dsimp [M, fourthDerivativeEnvelope]; positivity have he_meas (i : Fin 7) : Measurable (fun p : TwoSample n n × ℝ => e p.1 p.2 i) := (measurable_pilot_joint c_f C_f i).sub ((measurable_markedDensityVector_indicator c_f C_f L P n hP i).comp measurable_snd) have hg : Measurable (uncurry g) := by dsimp [g, uncurry] fun_prop have he_bound (ω : TwoSample n n) (x : ℝ) (hx : x ∈ covariateSpace) (i : Fin 7) : |e ω x i| ≤ 2 * C_f := by dsimp [e, F] rw [Set.indicator_of_mem hx] simpa only [two_mul] using (abs_sub _ _).trans (add_le_add (clippingRectangle_coordinate_abs_le c_f C_f hc hC _ (pilot_mem_clippingRectangle c_f C_f L P n hn hP ω x) i) (clippingRectangle_coordinate_abs_le c_f C_f hc hC _ (markedDensityVector_mem_clippingRectangle c_f C_f L P n hP x hx) i)) have hbound (ω : TwoSample n n) : ∀ᵐ x ∂ν, |g ω x| ≤ M * (14 * C_f) ^ 4 := by apply ae_restrict_of_forall_mem measurableSet_Icc intro x hx have hs : (∑ i : Fin 7, |e ω x i|) ≤ 14 * C_f := by calc _ ≤ ∑ _i : Fin 7, 2 * C_f := Finset.sum_le_sum fun i _ => he_bound ω x hx i _ = _ := by simp; ring dsimp [g] rw [abs_of_nonneg (by positivity)] exact mul_le_mul_of_nonneg_left (pow_le_pow_left₀ (Finset.sum_nonneg fun _ _ => abs_nonneg _) hs 4) hM have hr (ω : TwoSample n n) : ∀ᵐ x ∂ν, |r ω x| ≤ g ω x := by apply ae_restrict_of_forall_mem measurableSet_Icc intro x hx change x ∈ covariateSpace at hx have ht := pilot_Phi_cubic_taylor_remainder_abs_le c_f C_f L P n hn hP A ω x hx simpa [r, g, M, e, F, hx, Pi.sub_apply, abs_sub_comm] using ht have hmoment : ∀ᵐ x ∂ν, (∫ ω, (g ω x) ^ 2 ∂μ) ≤ M ^ 2 * (7 : ℝ) ^ (8 : ℕ) * pilotEighthConstant C_f L * (n : ℝ) ^ (-(4 / 5 : ℝ)) := by apply ae_restrict_of_forall_mem measurableSet_Icc intro x hx change x ∈ covariateSpace at hx have hi (i : Fin 7) : Integrable (fun ω => |e ω x i| ^ (8 : ℕ)) μ := by simpa [e, F, hx, μ] using integrable_pilot_error_eighth c_f C_f L P n hn hP x hx i calc _ ≤ ∫ ω, (M ^ 2 * (7 : ℝ) ^ (7 : ℕ)) * ∑ i : Fin 7, |e ω x i| ^ (8 : ℕ) ∂μ := by apply integral_mono_of_nonneg (Filter.Eventually.of_forall fun ω => sq_nonneg _) ((integrable_finsetSum univ (fun i _ => hi i)).const_mul _) filter_upwards [] with ω dsimp only [g] rw [mul_pow, ← pow_mul] rw [mul_assoc] exact mul_le_mul_of_nonneg_left (sum_abs_eighth_le (e ω x)) (sq_nonneg _) _ = (M ^ 2 * (7 : ℝ) ^ (7 : ℕ)) * ∑ i : Fin 7, ∫ ω, |e ω x i| ^ (8 : ℕ) ∂μ := by rw [integral_const_mul, integral_finsetSum univ (fun i _ => hi i)] _ ≤ (M ^ 2 * (7 : ℝ) ^ (7 : ℕ)) * ∑ _i : Fin 7, pilotEighthConstant C_f L * (n : ℝ) ^ (-(4 / 5 : ℝ)) := by apply mul_le_mul_of_nonneg_left _ (by positivity) apply Finset.sum_le_sum intro i _ simpa [e, F, hx, μ] using pilot_eighth_moment c_f C_f L P n hn hP i x hx _ = _ := by simp; ring exact integrated_second_moment_le_of_majorant μ ν r g (M * (14 * C_f) ^ 4) _ hg hbound hr hmoment
CausalSmith.Stat.TransportCaceRoughnuisanceLength.pilot_Phi_cubic_taylor_remainder_integrated_second_moment · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/IntegratedRemainder.lean:114
CausalSmith.Stat.STAT_TransportCaceRoughnuisanceLength_Research.Helpers.CubicMse.LinearCellVariance 2 declarations Training coefficients pull out of the exact cell cross moments.

Conditional second moments of bounded linear cell scores

Training coefficients pull out of the exact cell cross moments. The signed covariance quadratic form is bounded by the single-record envelope, yielding the density-free per-coordinate bound needed in roadmap (19).

theorem condExp_sq_weighted_cellAverage_eq_covariance_sum Lemma condExp_sq_weighted_cellAverage_eq_covariance_sum in the paper ↗

The conditional square of a weighted normalized cell sum equals its signed covariance quadratic form, keeping cancellation between cells. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
hm :
m ≤ mΩ
K :
ℕ
X c :
Fin K → Ω → ℝ
κ :
Fin K → Fin K → ℝ
C :
ℝ
hC :
0 ≤ C
hcmeas :
∀ l, StronglyMeasurable[m] (c l)
hc :
∀ᵐ x ∂μ, ∀ l, |c l x| ≤ C
hlp :
∀ l, MemLp (X l) 2 μ
hcross :
∀ l r, condExp m μ (fun x => X l x * X r x) =ᵐ[μ] (fun _ => κ l r)
condExp m μ (fun x => ((K : ℝ)⁻¹ * ∑ l : Fin K, c l x * X l x) ^ 2)
=ᵐ[μ] (fun x => (K : ℝ)⁻¹ ^ 2 * ∑ l : Fin K, ∑ r : Fin K, c l x * c r x * κ l r)
Proof (Lean source)
-- @node: condExp_sq_weighted_cellAverage_eq_covariance_sum lemma condExp_sq_weighted_cellAverage_eq_covariance_sum {Ω : Type*} [mΩ : MeasurableSpace Ω] {μ : Measure Ω} {m : MeasurableSpace Ω} (hm : m ≤ mΩ) {K : ℕ} (X c : Fin K → Ω → ℝ) (κ : Fin K → Fin K → ℝ) (C : ℝ) (hC : 0 ≤ C) (hcmeas : ∀ l, StronglyMeasurable[m] (c l)) (hc : ∀ᵐ x ∂μ, ∀ l, |c l x| ≤ C) (hlp : ∀ l, MemLp (X l) 2 μ) (hcross : ∀ l r, condExp m μ (fun x => X l x * X r x) =ᵐ[μ] (fun _ => κ l r)) : condExp m μ (fun x => ((K : ℝ)⁻¹ * ∑ l : Fin K, c l x * X l x) ^ 2) =ᵐ[μ] (fun x => (K : ℝ)⁻¹ ^ 2 * ∑ l : Fin K, ∑ r : Fin K, c l x * c r x * κ l r) := by let Y (l : Fin K) (x : Ω) := c l x * X l x have hbound (l r : Fin K) : ∀ᵐ x ∂μ, ‖c l x * c r x‖ ≤ C ^ 2 := by filter_upwards [hc] with x hx simpa only [Real.norm_eq_abs, abs_mul, pow_two] using mul_le_mul (hx l) (hx r) (abs_nonneg _) hC have hint (l r : Fin K) : Integrable (fun x => Y l x * Y r x) μ := by have hi := ((hlp l).integrable_mul (hlp r)).bdd_mul (((hcmeas l).mono hm).mul ((hcmeas r).mono hm)).aestronglyMeasurable (hbound l r) convert hi using 1 funext x dsimp [Y, Pi.mul_apply] ring have hfactor (l r : Fin K) : condExp m μ (fun x => Y l x * Y r x) =ᵐ[μ] (fun x => c l x * c r x * κ l r) := by have hi := ((hlp l).integrable_mul (hlp r)).bdd_mul (((hcmeas l).mono hm).mul ((hcmeas r).mono hm)).aestronglyMeasurable (hbound l r) have hp := condExp_mul_of_stronglyMeasurable_left ((hcmeas l).mul (hcmeas r)) hi ((hlp l).integrable_mul (hlp r)) have heq : (fun x => Y l x * Y r x) = (fun x => (c l x * c r x) * (X l x * X r x)) := by funext x dsimp [Y] ring rw [heq] filter_upwards [hp, hcross l r] with x hp hx change condExp m μ (fun x => (c l x * c r x) * (X l x * X r x)) x = c l x * c r x * condExp m μ (fun x => X l x * X r x) x at hp rw [hx] at hp exact hp have hs := @condExp_sq_cellSum_eq_sum_cross Ω mΩ μ m K Y hint have hscale := condExp_smul (μ := μ) ((K : ℝ)⁻¹ ^ 2) (fun x => (∑ l : Fin K, Y l x) ^ 2) m have heq : (fun x => ((K : ℝ)⁻¹ * ∑ l : Fin K, c l x * X l x) ^ 2) = ((K : ℝ)⁻¹ ^ 2) • (fun x => (∑ l : Fin K, Y l x) ^ 2) := by funext x simp only [Pi.smul_apply, smul_eq_mul, mul_pow, Y] rw [heq] have hall := ae_all_iff.mpr (fun l => ae_all_iff.mpr (hfactor l)) filter_upwards [hs, hscale, hall] with x hs ht hx simp only [Pi.smul_apply, smul_eq_mul] at ht rw [ht, hs] congr 1 exact Finset.sum_congr rfl fun l _ => Finset.sum_congr rfl fun r _ => hx l r
CausalSmith.Stat.TransportCaceRoughnuisanceLength.condExp_sq_weighted_cellAverage_eq_covariance_sum · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/LinearCellVariance.lean:19
theorem condExp_sq_bounded_linear_cellAverage_le

Each bounded training-weighted marked coordinate in a held-out block has conditional second moment at most 5 C² / n. This is the sharp per-coordinate ingredient of the linear variance estimate (19). Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n K :
ℕ
hn :
threshold ≤ n
hP :
ModelClass c_f C_f L P n
hK :
0 < K
i :
Fin 7
b :
Fin 3
c :
Fin K → ((a : FlatIndex n) → FlatObs n a) → ℝ
C :
ℝ
hC :
0 ≤ C
hcmeas :
hc :
∀ᵐ x ∂Measure.pi (flatLaw P n), ∀ l, |c l x| ≤ C
∀ᵐ x ∂Measure.pi (flatLaw P n), condExp (comap (finsetCoordProj (Ω := FlatObs n) (flatBlock n 0)) pi) (Measure.pi (flatLaw P n)) (fun y => ((K : ℝ)⁻¹ * ∑ l : Fin K, c l y * flatCenteredCellScore P i b.succ l (finsetCoordProj (flatBlock n b.succ) y)) ^ 2) x
≤ 5 * C ^ 2 * (n : ℝ) ^ (-1 : ℝ)
Proof (Lean source)
-- @node: condExp_sq_bounded_linear_cellAverage_le lemma condExp_sq_bounded_linear_cellAverage_le (c_f C_f L : ℝ) (P : TransportLaw) (n K : ℕ) (hn : threshold ≤ n) (hP : ModelClass c_f C_f L P n) (hK : 0 < K) (i : Fin 7) (b : Fin 3) (c : Fin K → ((a : FlatIndex n) → FlatObs n a) → ℝ) (C : ℝ) (hC : 0 ≤ C) (hcmeas : ∀ l, StronglyMeasurable[ comap (finsetCoordProj (Ω := FlatObs n) (flatBlock n 0)) MeasurableSpace.pi] (c l)) (hc : ∀ᵐ x ∂Measure.pi (flatLaw P n), ∀ l, |c l x| ≤ C) : ∀ᵐ x ∂Measure.pi (flatLaw P n), condExp (comap (finsetCoordProj (Ω := FlatObs n) (flatBlock n 0)) MeasurableSpace.pi) (Measure.pi (flatLaw P n)) (fun y => ((K : ℝ)⁻¹ * ∑ l : Fin K, c l y * flatCenteredCellScore P i b.succ l (finsetCoordProj (flatBlock n b.succ) y)) ^ 2) x ≤ 5 * C ^ 2 * (n : ℝ) ^ (-1 : ℝ) := by let : ∀ a, StandardBorelSpace (FlatObs n a) := fun a => by cases a <;> dsimp [FlatObs] <;> infer_instance let : ∀ a, IsProbabilityMeasure (flatLaw P n a) := fun a => flatLaw_isProbabilityMeasure c_f C_f L P n hP a let μ := Measure.pi (flatLaw P n) let m := comap (finsetCoordProj (Ω := FlatObs n) (flatBlock n 0)) MeasurableSpace.pi let X (l : Fin K) (z : (a : FlatIndex n) → FlatObs n a) := flatCenteredCellScore P i b.succ l (finsetCoordProj (flatBlock n b.succ) z) let κ (l r : Fin K) := covariance (fun z => flatBlockHeight i b.succ l (finsetCoordProj (flatBlock n b.succ) z)) (fun z => flatBlockHeight i b.succ r (finsetCoordProj (flatBlock n b.succ) z)) μ have hm : m ≤ (MeasurableSpace.pi : MeasurableSpace ((a : FlatIndex n) → FlatObs n a)) := (measurable_finsetCoordProj (Ω := FlatObs n) (flatBlock n 0)).comap_le have hlp (l : Fin K) : MemLp (X l) 2 μ := flatCenteredCellScore_comp_memLp c_f C_f L P n K hn hP i b.succ l have hx (l r : Fin K) : condExp m μ (fun z => X l z * X r z) =ᵐ[μ] (fun _ => κ l r) := by exact condExp_centeredBlockCross_eq_covariance (flatLaw P n) (flatBlock n 0) (flatBlock n b.succ) (flatBlock_training_disjoint n b) (flatBlockHeight i b.succ l) (flatBlockHeight i b.succ r) (measurable_flatBlockHeight _ _ _) (measurable_flatBlockHeight _ _ _) have heq := @condExp_sq_weighted_cellAverage_eq_covariance_sum ((a : FlatIndex n) → FlatObs n a) MeasurableSpace.pi μ m hm K X c κ C hC hcmeas hc hlp hx have hnpos : (0 : ℝ) < n := by exact_mod_cast (show 0 < n by norm_num [threshold] at hn; omega) have hB : 0 < (n : ℝ) / 5 := by positivity have hsize := block_size_lower n hn b.succ have hcard : 0 < (blockIdx n b.succ).card := by rw [block_card] exact_mod_cast lt_of_lt_of_le hB hsize filter_upwards [heq, hc] with z hz hc rw [hz] calc _ ≤ C ^ 2 / blockSize n b.succ := normalized_flatBlockHeight_covariance_sum_le c_f C_f L P n K hP hK b.succ hcard i (fun l => c l z) C hC hc _ ≤ C ^ 2 / ((n : ℝ) / 5) := div_le_div_of_nonneg_left (sq_nonneg C) hB hsize _ = 5 * C ^ 2 * (n : ℝ) ^ (-1 : ℝ) := by rw [Real.rpow_neg_one] ring
CausalSmith.Stat.TransportCaceRoughnuisanceLength.condExp_sq_bounded_linear_cellAverage_le · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/LinearCellVariance.lean:82
CausalSmith.Stat.STAT_TransportCaceRoughnuisanceLength_Research.Helpers.CubicMse.LinearProjectionMean 5 declarations The spatial linear Taylor term has no projection bias: on any refinement of the pilot partition it is exactly the weighted sum of cell-average shifts.

Exact finite-cell representation of the linear projected mean

The spatial linear Taylor term has no projection bias: on any refinement of the pilot partition it is exactly the weighted sum of cell-average shifts.

theorem integral_linear_cell_eq_average_shift Lemma integral_linear_cell_eq_average_shift in the paper ↗

A linear cell integral is exactly its cell-average shift times cell width. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
K :
ℕ
hK :
0 < K
l :
Fin K
f :
ℝ → ℝ
hf :
IntegrableOn f (cell K l)
a t :
ℝ
(∫ x in cell K l, a * (f x - t)) = (K : ℝ)⁻¹ * a * (cellAverage f K l - t)
Proof (Lean source)
-- @node: integral_linear_cell_eq_average_shift lemma integral_linear_cell_eq_average_shift {K : ℕ} (hK : 0 < K) (l : Fin K) (f : ℝ → ℝ) (hf : IntegrableOn f (cell K l)) (a t : ℝ) : (∫ x in cell K l, a * (f x - t)) = (K : ℝ)⁻¹ * a * (cellAverage f K l - t) := by have hKr : (K : ℝ) ≠ 0 := by exact_mod_cast hK.ne' have hfinite : volume (cell K l) ≠ ⊤ := by rw [volume_cell hK l] exact ENNReal.ofReal_ne_top rw [integral_const_mul, integral_sub hf (integrableOn_const hfinite), setIntegral_const, Measure.real, volume_cell hK l, ENNReal.toReal_ofReal (by positivity)] simp only [smul_eq_mul, one_div, cellAverage] field_simp
CausalSmith.Stat.TransportCaceRoughnuisanceLength.integral_linear_cell_eq_average_shift · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/LinearProjectionMean.lean:15
theorem linearProjectionMean_eq_cell_sum

The linear projected mean has an exact finite-cell formula on every refinement of the pilot partition, with no spatial approximation error. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n K :
ℕ
hP :
ModelClass c_f C_f L P n
hK :
0 < K
hdiv :
ω :
A :
linearProjectionMean c_f C_f L P n hP ω A
= (K : ℝ)⁻¹ * ∑ i : Fin 7, ∑ l : Fin K, dPhi1 A (pilot c_f C_f ω (midpoint K l)) i * (cellAverage (fun y => markedDensityVector c_f C_f L P n hP y i) K l - pilot c_f C_f ω (midpoint K l) i)
Proof (Lean source)
-- @node: linearProjectionMean_eq_cell_sum lemma linearProjectionMean_eq_cell_sum (c_f C_f L : ℝ) (P : TransportLaw) (n K : ℕ) (hP : ModelClass c_f C_f L P n) (hK : 0 < K) (hdiv : pilotResolution n ∣ K) (ω : TwoSample n n) (A : Bool) : linearProjectionMean c_f C_f L P n hP ω A = (K : ℝ)⁻¹ * ∑ i : Fin 7, ∑ l : Fin K, dPhi1 A (pilot c_f C_f ω (midpoint K l)) i * (cellAverage (fun y => markedDensityVector c_f C_f L P n hP y i) K l - pilot c_f C_f ω (midpoint K l) i) := by classical have hterm (i : Fin 7) := spatial_pilot_monomial_eq_cell_sum c_f C_f hK hdiv ω (markedDensityVector c_f C_f L P n hP) (markedDensityVector_continuousOn c_f C_f L P n hP) (fun v => dPhi1 A v i) (![i] : Fin 1 → Fin 7) simp only [Fin.prod_univ_one, Matrix.cons_val_zero] at hterm unfold linearProjectionMean simp_rw [hterm] rw [Finset.mul_sum] apply Finset.sum_congr rfl intro i _ rw [Finset.mul_sum] apply Finset.sum_congr rfl intro l _ rw [integral_linear_cell_eq_average_shift hK l _ ((markedDensityVector_continuousOn c_f C_f L P n hP i).integrableOn_Icc.mono_set (cell_subset_covariateSpace hK l))] ring
CausalSmith.Stat.TransportCaceRoughnuisanceLength.linearProjectionMean_eq_cell_sum · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/LinearProjectionMean.lean:31
theorem dPhi1_eq_explicit

The first coordinate derivative has the explicit rational formula on its natural domain, where both assignment densities are nonzero. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
A :
i :
Fin 7
h1 :
v 1 ≠ 0
h2 :
v 2 ≠ 0
dPhi1 A v i
= cubicRatioD1Apply 0 (if A then 4 else 6) 2 (basis i) v
- cubicRatioD1Apply 0 (if A then 3 else 5) 1 (basis i) v
Proof (Lean source)
-- @node: dPhi1_eq_explicit lemma dPhi1_eq_explicit (A : Bool) (v : DensityVector) (i : Fin 7) (h1 : v 1 ≠ 0) (h2 : v 2 ≠ 0) : dPhi1 A v i = cubicRatioD1Apply 0 (if A then 4 else 6) 2 (basis i) v - cubicRatioD1Apply 0 (if A then 3 else 5) 1 (basis i) v := by have heq : Phi A = cubicRatioTerm 0 (if A then 4 else 6) 2 - cubicRatioTerm 0 (if A then 3 else 5) 1 := by funext y cases A <;> simp [Phi, cubicRatioTerm, div_eq_mul_inv] <;> ring have hd := (hasFDerivAt_cubicRatioTerm 0 (if A then 4 else 6) 2 v h2).sub (hasFDerivAt_cubicRatioTerm 0 (if A then 3 else 5) 1 v h1) rw [dPhi1, heq, hd.fderiv, sub_apply, cubicRatioD1_apply, cubicRatioD1_apply]
theorem stronglyMeasurable_dPhi1_pilot_trainingSigma

The linear coefficient evaluated at the clipped pilot is measurable with respect to training; no held-out observation enters this coefficient. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hn :
threshold ≤ n
hP :
ModelClass c_f C_f L P n
A :
x :
ℝ
i :
Fin 7
StronglyMeasurable[trainingSigma n] (fun ω : TwoSample n n => dPhi1 A (pilot c_f C_f ω x) i)
Proof (Lean source)
@[fun_prop] -- @node: stronglyMeasurable_dPhi1_pilot_trainingSigma lemma stronglyMeasurable_dPhi1_pilot_trainingSigma (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hn : threshold ≤ n) (hP : ModelClass c_f C_f L P n) (A : Bool) (x : ℝ) (i : Fin 7) : StronglyMeasurable[trainingSigma n] (fun ω : TwoSample n n => dPhi1 A (pilot c_f C_f ω x) i) := by have hexplicit : StronglyMeasurable[trainingSigma n] (fun ω : TwoSample n n => cubicRatioD1Apply 0 (if A then 4 else 6) 2 (basis i) (pilot c_f C_f ω x) - cubicRatioD1Apply 0 (if A then 3 else 5) 1 (basis i) (pilot c_f C_f ω x)) := by unfold cubicRatioD1Apply basis fun_prop convert hexplicit using 1 funext ω have hv := pilot_mem_clippingRectangle c_f C_f L P n hn hP ω x have hcf : 0 < c_f := hP.sourceBounds.1.1 exact dPhi1_eq_explicit A _ i (ne_of_gt (lt_of_lt_of_le (by positivity : 0 < c_f / 4) hv.2.1.1)) (ne_of_gt (lt_of_lt_of_le (by positivity : 0 < c_f / 4) hv.2.2.1.1))
CausalSmith.Stat.TransportCaceRoughnuisanceLength.stronglyMeasurable_dPhi1_pilot_trainingSigma · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/LinearProjectionMean.lean:78
theorem stronglyMeasurable_linearProjectionMean

The spatial linear projected mean is training measurable, as follows from its exact finite-cell representation. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hn :
threshold ≤ n
hP :
ModelClass c_f C_f L P n
A :
StronglyMeasurable[trainingSigma n] (fun ω : TwoSample n n => linearProjectionMean c_f C_f L P n hP ω A)
Proof (Lean source)
@[fun_prop] -- @node: stronglyMeasurable_linearProjectionMean lemma stronglyMeasurable_linearProjectionMean (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hn : threshold ≤ n) (hP : ModelClass c_f C_f L P n) (A : Bool) : StronglyMeasurable[trainingSigma n] (fun ω : TwoSample n n => linearProjectionMean c_f C_f L P n hP ω A) := by have hK : 0 < pilotResolution n := by unfold pilotResolution dyadicResolution split_ifs <;> positivity simp_rw [linearProjectionMean_eq_cell_sum c_f C_f L P n (pilotResolution n) hP hK (dvd_refl _) ] fun_prop
CausalSmith.Stat.TransportCaceRoughnuisanceLength.stronglyMeasurable_linearProjectionMean · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/LinearProjectionMean.lean:101
CausalSmith.Stat.STAT_TransportCaceRoughnuisanceLength_Research.Helpers.CubicMse.LinearStatisticBridge 8 declarations The empirical linear correction and its pilot subtraction are represented on the pilot partition.

Exact cell representation of the held-out linear statistic

The empirical linear correction and its pilot subtraction are represented on the pilot partition. This connects the actual observation-level statistic to the centered histogram scores used in the conditional moment arguments.

theorem integral_pilot_composition_eq_cell_sum

An arbitrary function of the pilot integrates exactly as a midpoint sum on any refinement of the pilot partition. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f :
ℝ
n K :
ℕ
hK :
0 < K
hdiv :
ω :
g :
(∫ x in covariateSpace, g (pilot c_f C_f ω x))
= (K : ℝ)⁻¹ * ∑ l : Fin K, g (pilot c_f C_f ω (midpoint K l))
Proof (Lean source)
-- @node: integral_pilot_composition_eq_cell_sum lemma integral_pilot_composition_eq_cell_sum (c_f C_f : ℝ) {n K : ℕ} (hK : 0 < K) (hdiv : pilotResolution n ∣ K) (ω : TwoSample n n) (g : DensityVector → ℝ) : (∫ x in covariateSpace, g (pilot c_f C_f ω x)) = (K : ℝ)⁻¹ * ∑ l : Fin K, g (pilot c_f C_f ω (midpoint K l)) := by classical have heq (l : Fin K) : EqOn (fun x => g (pilot c_f C_f ω x)) (fun _ => g (pilot c_f C_f ω (midpoint K l))) (cell K l) := by intro x hx dsimp only rw [pilot_eq_midpoint_of_refinement c_f C_f hK hdiv ω l hx] have hfinite (l : Fin K) : volume (cell K l) ≠ ⊤ := by rw [volume_cell hK l] exact ENNReal.ofReal_ne_top have hi (l : Fin K) : IntegrableOn (fun x => g (pilot c_f C_f ω x)) (cell K l) := (integrableOn_congr_fun (heq l) (measurableSet_cell K l)).2 (integrableOn_const (hfinite l)) rw [← iUnion_cell_eq_covariateSpace hK, integral_iUnion_fintype (fun l => measurableSet_cell K l) (fun l r hlr => cell_disjoint hK hlr) hi, Finset.mul_sum] apply Finset.sum_congr rfl intro l _ rw [setIntegral_congr_fun (measurableSet_cell K l) (heq l), setIntegral_const, Measure.real, volume_cell hK l, ENNReal.toReal_ofReal (by positivity)] simp [smul_eq_mul, one_div]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.integral_pilot_composition_eq_cell_sum · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/LinearStatisticBridge.lean:18
theorem pilot_coefficient_eq_cell_indicator_sum

A pilot coefficient at an observed covariate equals its unique cell coefficient. The support condition is supplied by the model's covariate law. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f :
ℝ
n K :
ℕ
hK :
0 < K
hdiv :
ω :
g :
x :
ℝ
hx :
g (pilot c_f C_f ω x)
= ∑ l : Fin K, g (pilot c_f C_f ω (midpoint K l)) * (if x ∈ cell K l then 1 else 0)
Proof (Lean source)
-- @node: pilot_coefficient_eq_cell_indicator_sum lemma pilot_coefficient_eq_cell_indicator_sum (c_f C_f : ℝ) {n K : ℕ} (hK : 0 < K) (hdiv : pilotResolution n ∣ K) (ω : TwoSample n n) (g : DensityVector → ℝ) {x : ℝ} (hx : x ∈ covariateSpace) : g (pilot c_f C_f ω x) = ∑ l : Fin K, g (pilot c_f C_f ω (midpoint K l)) * (if x ∈ cell K l then 1 else 0) := by classical obtain ⟨l, hl⟩ := exists_cell_of_mem_covariateSpace hK x hx rw [Finset.sum_eq_single l] · rw [if_pos hl, mul_one, pilot_eq_midpoint_of_refinement c_f C_f hK hdiv ω l hl] · intro r _ hrl rw [if_neg (fun hr => Set.disjoint_left.mp (cell_disjoint hK hrl) hr hl), mul_zero] · exact fun h => (h (Finset.mem_univ l)).elim
CausalSmith.Stat.TransportCaceRoughnuisanceLength.pilot_coefficient_eq_cell_indicator_sum · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/LinearStatisticBridge.lean:50
theorem marked_average_pilot_coefficient_eq_histogram_sum

The observation-level marked average is exactly a weighted histogram midpoint sum. This uses the actual block normalization, including unequal block sizes, and holds whenever its observations lie in the covariate region. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f :
ℝ
n K :
ℕ
hn :
threshold ≤ n
hK :
0 < K
hdiv :
ω :
i :
Fin 7
b :
Fin 4
g :
hsupport :
∀ r ∈ blockIdx n b, channelX ω i r ∈ covariateSpace
(1 / (blockSize n b : ℝ)) * ∑ r ∈ blockIdx n b, channelMark ω i r * g (pilot c_f C_f ω (channelX ω i r))
= (K : ℝ)⁻¹ * ∑ l : Fin K, g (pilot c_f C_f ω (midpoint K l)) * markedHistogram ω i K b (midpoint K l)
Proof (Lean source)
-- @node: marked_average_pilot_coefficient_eq_histogram_sum lemma marked_average_pilot_coefficient_eq_histogram_sum (c_f C_f : ℝ) {n K : ℕ} (hn : threshold ≤ n) (hK : 0 < K) (hdiv : pilotResolution n ∣ K) (ω : TwoSample n n) (i : Fin 7) (b : Fin 4) (g : DensityVector → ℝ) (hsupport : ∀ r ∈ blockIdx n b, channelX ω i r ∈ covariateSpace) : (1 / (blockSize n b : ℝ)) * ∑ r ∈ blockIdx n b, channelMark ω i r * g (pilot c_f C_f ω (channelX ω i r)) = (K : ℝ)⁻¹ * ∑ l : Fin K, g (pilot c_f C_f ω (midpoint K l)) * markedHistogram ω i K b (midpoint K l) := by classical have hh (l : Fin K) : markedHistogram ω i K b (midpoint K l) = (K : ℝ) / blockSize n b * ∑ r ∈ blockIdx n b, channelMark ω i r * (if channelX ω i r ∈ cell K l then 1 else 0) := by unfold markedHistogram simp only [if_neg (Nat.not_lt_of_ge hn)] rw [Finset.sum_eq_single l, if_pos (midpoint_mem_cell hK l)] · intro r _ hrl rw [if_neg (fun h => hrl ((midpoint_mem_cell_iff hK l r).mp h))] · exact fun h => (h (Finset.mem_univ l)).elim have heq : (∑ r ∈ blockIdx n b, channelMark ω i r * g (pilot c_f C_f ω (channelX ω i r))) = ∑ l : Fin K, g (pilot c_f C_f ω (midpoint K l)) * ∑ r ∈ blockIdx n b, channelMark ω i r * (if channelX ω i r ∈ cell K l then 1 else 0) := by have hrw : (∑ r ∈ blockIdx n b, channelMark ω i r * g (pilot c_f C_f ω (channelX ω i r))) = ∑ r ∈ blockIdx n b, channelMark ω i r * ∑ l : Fin K, g (pilot c_f C_f ω (midpoint K l)) * (if channelX ω i r ∈ cell K l then 1 else 0) := by apply Finset.sum_congr rfl intro r hr rw [pilot_coefficient_eq_cell_indicator_sum c_f C_f hK hdiv ω g (hsupport r hr)] rw [hrw] simp_rw [Finset.mul_sum] rw [Finset.sum_comm] apply Finset.sum_congr rfl intro l _ apply Finset.sum_congr rfl intro r _ ring rw [heq] simp_rw [hh] rw [Finset.mul_sum, Finset.mul_sum] apply Finset.sum_congr rfl intro l _ have hKr : (K : ℝ) ≠ 0 := by exact_mod_cast hK.ne' field_simp
CausalSmith.Stat.TransportCaceRoughnuisanceLength.marked_average_pilot_coefficient_eq_histogram_sum · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/LinearStatisticBridge.lean:69
theorem linearTerm_eq_residual_cell_sum

On samples in the covariate support, the exact linear correction is the cell sum of pilot coefficients times block-one histogram residuals. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f :
ℝ
n K :
ℕ
hn :
threshold ≤ n
hK :
0 < K
hdiv :
ω :
A :
hsupport :
∀ i r
if
r ∈ blockIdx n 1
then
linearTerm c_f C_f ω A
= (K : ℝ)⁻¹ * ∑ i : Fin 7, ∑ l : Fin K, dPhi1 A (pilot c_f C_f ω (midpoint K l)) i * residual c_f C_f ω i K 1 (midpoint K l)
Proof (Lean source)
-- @node: linearTerm_eq_residual_cell_sum lemma linearTerm_eq_residual_cell_sum (c_f C_f : ℝ) {n K : ℕ} (hn : threshold ≤ n) (hK : 0 < K) (hdiv : pilotResolution n ∣ K) (ω : TwoSample n n) (A : Bool) (hsupport : ∀ i r, r ∈ blockIdx n 1 → channelX ω i r ∈ covariateSpace) : linearTerm c_f C_f ω A = (K : ℝ)⁻¹ * ∑ i : Fin 7, ∑ l : Fin K, dPhi1 A (pilot c_f C_f ω (midpoint K l)) i * residual c_f C_f ω i K 1 (midpoint K l) := by classical unfold linearTerm rw [Finset.mul_sum] apply Finset.sum_congr rfl intro i _ rw [marked_average_pilot_coefficient_eq_histogram_sum c_f C_f hn hK hdiv ω i 1 (fun v => dPhi1 A v i) (hsupport i)] have hp := integral_pilot_composition_eq_cell_sum c_f C_f hK hdiv ω (fun v => dPhi1 A v i * v i) rw [intervalIntegral.integral_of_le (by norm_num : (0 : ℝ) ≤ 1), ← integral_Icc_eq_integral_Ioc, show Icc (0 : ℝ) 1 = covariateSpace from rfl, hp, ← mul_sub, ← Finset.sum_sub_distrib] congr 1 apply Finset.sum_congr rfl intro l _ simp only [residual, mul_sub]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.linearTerm_eq_residual_cell_sum · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/LinearStatisticBridge.lean:122
theorem ae_channelX_mem_covariateSpace

Every recorded covariate lies in the covariate region almost surely under the model's actual two-sample experiment. Both marginal density identities are used, and no support hypothesis is added to the model. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hP :
ModelClass c_f C_f L P n
∀ᵐ ω ∂dataLaw P n n, ∀ i r, channelX ω i r ∈ covariateSpace
Proof (Lean source)
-- @node: ae_channelX_mem_covariateSpace lemma ae_channelX_mem_covariateSpace (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hP : ModelClass c_f C_f L P n) : ∀ᵐ ω ∂dataLaw P n n, ∀ i r, channelX ω i r ∈ covariateSpace := by have hregion : MeasurableSet covariateSpace := measurableSet_Icc have hS : ∀ᵐ x ∂sourceXLaw P, x ∈ covariateSpace := by rw [hP.sourceBounds.2.2.2.2.1] exact (withDensity_absolutelyContinuous _ _).ae_le (ae_restrict_mem hregion) have hT : ∀ᵐ x ∂targetXLaw P, x ∈ covariateSpace := by rw [hP.targetBounds.1] exact (withDensity_absolutelyContinuous _ _).ae_le (ae_restrict_mem hregion) have hobs : ∀ᵐ o ∂sourceObsLaw P, o.1 ∈ covariateSpace := (ae_map_iff (μ := sourceObsLaw P) measurable_fst.aemeasurable hregion).mp hS let : IsProbabilityMeasure (sourceObsLaw P) := sourceObsLaw_isProbabilityMeasure c_f C_f L P n hP let : IsProbabilityMeasure (targetXLaw P) := targetXLaw_isProbabilityMeasure c_f C_f L P n hP have hsource : ∀ᵐ z ∂Measure.pi (fun _ : Fin n => sourceObsLaw P), ∀ r, (z r).1 ∈ covariateSpace := ae_all_iff.mpr (fun r => (Measure.quasiMeasurePreserving_eval (fun _ : Fin n => sourceObsLaw P) r).ae hobs) have htarget : ∀ᵐ z ∂Measure.pi (fun _ : Fin n => targetXLaw P), ∀ r, z r ∈ covariateSpace := ae_all_iff.mpr (fun r => (Measure.quasiMeasurePreserving_eval (fun _ : Fin n => targetXLaw P) r).ae hT) rw [dataLaw_eq_source_target_pi c_f C_f L P n hP] have hs := (measurePreserving_fst (μ := Measure.pi (fun _ : Fin n => sourceObsLaw P)) (ν := Measure.pi (fun _ : Fin n => targetXLaw P))).quasiMeasurePreserving.ae hsource have ht := (measurePreserving_snd (μ := Measure.pi (fun _ : Fin n => sourceObsLaw P)) (ν := Measure.pi (fun _ : Fin n => targetXLaw P))).quasiMeasurePreserving.ae htarget filter_upwards [hs, ht] with ω hs ht intro i r unfold channelX split_ifs · exact hs r · exact ht r
CausalSmith.Stat.TransportCaceRoughnuisanceLength.ae_channelX_mem_covariateSpace · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/LinearStatisticBridge.lean:150
theorem linearTerm_sub_projectionMean_eq_centered_cell_sum

The exact held-out linear statistic is almost surely a centered block-one cell sum plus its spatial projected mean. This is the genuine statistic bridge needed for its conditional mean and variance. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n K :
ℕ
hn :
threshold ≤ n
hP :
ModelClass c_f C_f L P n
hK :
0 < K
hdiv :
A :
(fun ω : TwoSample n n => linearTerm c_f C_f ω A - linearProjectionMean c_f C_f L P n hP ω A)
=ᵐ[dataLaw P n n] (fun ω => (K : ℝ)⁻¹ * ∑ i : Fin 7, ∑ l : Fin K, dPhi1 A (pilot c_f C_f ω (midpoint K l)) i * flatCenteredCellScore P i 1 l (finsetCoordProj (flatBlock n 1) (flattenSample n ω)))
Proof (Lean source)
-- @node: linearTerm_sub_projectionMean_eq_centered_cell_sum lemma linearTerm_sub_projectionMean_eq_centered_cell_sum (c_f C_f L : ℝ) (P : TransportLaw) (n K : ℕ) (hn : threshold ≤ n) (hP : ModelClass c_f C_f L P n) (hK : 0 < K) (hdiv : pilotResolution n ∣ K) (A : Bool) : (fun ω : TwoSample n n => linearTerm c_f C_f ω A - linearProjectionMean c_f C_f L P n hP ω A) =ᵐ[dataLaw P n n] (fun ω => (K : ℝ)⁻¹ * ∑ i : Fin 7, ∑ l : Fin K, dPhi1 A (pilot c_f C_f ω (midpoint K l)) i * flatCenteredCellScore P i 1 l (finsetCoordProj (flatBlock n 1) (flattenSample n ω))) := by classical filter_upwards [ae_channelX_mem_covariateSpace c_f C_f L P n hP] with ω hω rw [linearTerm_eq_residual_cell_sum c_f C_f hn hK hdiv ω A (fun i r _ => hω i r), linearProjectionMean_eq_cell_sum c_f C_f L P n K hP hK hdiv ω A, ← mul_sub, ← Finset.sum_sub_distrib] congr 1 apply Finset.sum_congr rfl intro i _ rw [← Finset.sum_sub_distrib] apply Finset.sum_congr rfl intro l _ rw [residual_eq_flatCenteredCellScore_add_trainingShift c_f C_f L P hn hP hK] ring
CausalSmith.Stat.TransportCaceRoughnuisanceLength.linearTerm_sub_projectionMean_eq_centered_cell_sum · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/LinearStatisticBridge.lean:190
theorem dPhi1_abs_le

The first derivative uses the same explicit envelope as the higher Taylor coefficients. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f :
ℝ
hf :
0 < c_f ∧ c_f < 1
hF :
1 < C_f
A :
hv :
i :
Fin 7
|dPhi1 A v i| ≤ fourthDerivativeEnvelope c_f C_f
Proof (Lean source)
-- @node: dPhi1_abs_le lemma dPhi1_abs_le (c_f C_f : ℝ) (hf : 0 < c_f ∧ c_f < 1) (hF : 1 < C_f) (A : Bool) (v : DensityVector) (hv : clippingRectangle c_f C_f v) (i : Fin 7) : |dPhi1 A v i| ≤ fourthDerivativeEnvelope c_f C_f := by have hb : coordinateBasis i = basis i := by funext j simp [coordinateBasis, basis, eq_comm] simpa only [dPhi1, iteratedFDeriv_one_apply, hb, Matrix.cons_val_zero] using Phi_first_derivative_abs_le_fourthDerivativeEnvelope c_f C_f hf hF A v hv i
theorem condExp_linearTerm_eq_linearProjectionMean

The held-out linear correction has exactly its spatial linear Taylor term as conditional mean. Training coefficients pull out of the conditional expectation, and the centered block-one histograms have mean zero. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hn :
threshold ≤ n
hP :
ModelClass c_f C_f L P n
A :
condExp (trainingSigma n) (dataLaw P n n) (fun ω : TwoSample n n => linearTerm c_f C_f ω A)
=ᵐ[dataLaw P n n] (fun ω => linearProjectionMean c_f C_f L P n hP ω A)
Proof (Lean source)
-- @node: condExp_linearTerm_eq_linearProjectionMean lemma condExp_linearTerm_eq_linearProjectionMean (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hn : threshold ≤ n) (hP : ModelClass c_f C_f L P n) (A : Bool) : condExp (trainingSigma n) (dataLaw P n n) (fun ω : TwoSample n n => linearTerm c_f C_f ω A) =ᵐ[dataLaw P n n] (fun ω => linearProjectionMean c_f C_f L P n hP ω A) := by classical let K := pilotResolution n have hK : 0 < K := by dsimp [K, pilotResolution, dyadicResolution] split_ifs <;> positivity let E := sumPiEquivProdPi (FlatObs n) have hEembed : @MeasurableEmbedding (TwoSample n n) ((a : FlatIndex n) → FlatObs n a) inferInstance MeasurableSpace.pi (flattenSample n) := (sumPiEquivProdPi (FlatObs n)).symm.measurableEmbedding let μ := Measure.pi (flatLaw P n) let m := comap (finsetCoordProj (Ω := FlatObs n) (flatBlock n 0)) MeasurableSpace.pi let c (i : Fin 7) (l : Fin K) (z : (a : FlatIndex n) → FlatObs n a) := dPhi1 A (pilot c_f C_f (E z) (midpoint K l)) i let X (i : Fin 7) (l : Fin K) (z : (a : FlatIndex n) → FlatObs n a) := flatCenteredCellScore P i 1 l (finsetCoordProj (flatBlock n 1) z) let shift (i : Fin 7) (l : Fin K) (z : (a : FlatIndex n) → FlatObs n a) := cellAverage (fun y => markedDensityVector c_f C_f L P n hP y i) K l - pilot c_f C_f (E z) (midpoint K l) i let Y (i : Fin 7) (z : (a : FlatIndex n) → FlatObs n a) := (K : ℝ)⁻¹ * ∑ l : Fin K, c i l z * X i l z let Z (z : (a : FlatIndex n) → FlatObs n a) := ∑ i : Fin 7, Y i z let G (z : (a : FlatIndex n) → FlatObs n a) := (K : ℝ)⁻¹ * ∑ i : Fin 7, ∑ l : Fin K, c i l z * shift i l z let F := Z + G let : ∀ a, IsProbabilityMeasure (flatLaw P n a) := fun a => flatLaw_isProbabilityMeasure c_f C_f L P n hP a have hm : m ≤ (MeasurableSpace.pi : MeasurableSpace ((a : FlatIndex n) → FlatObs n a)) := (measurable_finsetCoordProj (Ω := FlatObs n) (flatBlock n 0)).comap_le have hcmeas (i : Fin 7) (l : Fin K) : StronglyMeasurable[m] (c i l) := (stronglyMeasurable_dPhi1_pilot_trainingSigma c_f C_f L P n hn hP A (midpoint K l) i).comp_measurable (measurable_unflattenSample_flatTraining n) have hsmeas (i : Fin 7) (l : Fin K) : StronglyMeasurable[m] (shift i l) := stronglyMeasurable_const.sub (stronglyMeasurable_pilot_eval_flatTraining c_f C_f n (midpoint K l) i) have hc (i : Fin 7) (l : Fin K) (z : (a : FlatIndex n) → FlatObs n a) : |c i l z| ≤ fourthDerivativeEnvelope c_f C_f := dPhi1_abs_le c_f C_f hP.sourceBounds.1 hP.sourceBounds.2.1 A _ (pilot_mem_clippingRectangle c_f C_f L P n hn hP (E z) (midpoint K l)) i have hXlp (i : Fin 7) (l : Fin K) : MemLp (X i l) 2 μ := flatCenteredCellScore_comp_memLp c_f C_f L P n K hn hP i 1 l have hprod (i : Fin 7) (l : Fin K) : Integrable (fun z => c i l z * X i l z) μ := by apply (hXlp i l).integrable (by norm_num) |>.bdd_mul ((hcmeas i l).mono hm).aestronglyMeasurable filter_upwards [] with z simpa only [Real.norm_eq_abs] using hc i l z have hYint (i : Fin 7) : Integrable (Y i) μ := (integrable_finsetSum univ (fun l _ => hprod i l)).const_mul (K : ℝ)⁻¹ have hYzero (i : Fin 7) : condExp m μ (Y i) =ᵐ[μ] (0 : ((a : FlatIndex n) → FlatObs n a) → ℝ) := by exact @condExp_weighted_cellAverage_zero ((a : FlatIndex n) → FlatObs n a) MeasurableSpace.pi μ m K hm _ (c i) (X i) (hcmeas i) (fun l => (hXlp i l).integrable (by norm_num)) (hprod i) (fun l => condExp_flatCenteredCellScore_zero c_f C_f L P n K hn hP i 0 l) have hZint : Integrable Z μ := integrable_finsetSum univ (fun i _ => hYint i) have hZzero : condExp m μ Z =ᵐ[μ] (0 : ((a : FlatIndex n) → FlatObs n a) → ℝ) := by have hs := condExp_finsetSum (μ := μ) (s := univ) (f := Y) (fun i _ => hYint i) m filter_upwards [hs, ae_all_iff.mpr hYzero] with z hs hz simp only [Finset.sum_fn, Finset.sum_apply] at hs change condExp m μ (fun z => ∑ i : Fin 7, Y i z) z = 0 rw [hs] simp only [hz, Pi.zero_apply, Finset.sum_const_zero] have hGmeas : StronglyMeasurable[m] G := by simpa only [G, Finset.sum_apply, Pi.mul_apply] using ((Finset.stronglyMeasurable_sum univ fun i _ => Finset.stronglyMeasurable_sum univ fun l _ => (hcmeas i l).mul (hsmeas i l)).const_mul (K : ℝ)⁻¹) have hGint : Integrable G μ := by have ht (i : Fin 7) (l : Fin K) : Integrable (fun z => c i l z * shift i l z) μ := by apply Integrable.of_bound (((hcmeas i l).mul (hsmeas i l)).mono hm).aestronglyMeasurable (fourthDerivativeEnvelope c_f C_f * (2 * (1 + C_f))) filter_upwards [] with z rw [Real.norm_eq_abs, Pi.mul_apply, abs_mul] have hb := abs_trainingShift_le c_f C_f L P n K hn hP hK (E z) l i exact mul_le_mul (hc i l z) hb (abs_nonneg _) (le_trans (abs_nonneg _) (hc i l z)) exact (integrable_finsetSum univ (fun i _ => integrable_finsetSum univ (fun l _ => ht i l))).const_mul (K : ℝ)⁻¹ have hFint : Integrable F μ := hZint.add hGint have hflat : condExp m μ F =ᵐ[μ] G := @condExp_add_eq_shift_of_centered ((a : FlatIndex n) → FlatObs n a) MeasurableSpace.pi μ m hm _ Z G hZint hGint hGmeas hZzero have hcompG : G ∘ flattenSample n = fun ω => linearProjectionMean c_f C_f L P n hP ω A := by funext ω rw [linearProjectionMean_eq_cell_sum c_f C_f L P n K hP hK (dvd_refl _)] simp [G, c, shift, E, Function.comp_apply] have hcompF : F ∘ flattenSample n =ᵐ[dataLaw P n n] (fun ω => linearTerm c_f C_f ω A) := by have hb := linearTerm_sub_projectionMean_eq_centered_cell_sum c_f C_f L P n K hn hP hK (dvd_refl _) A filter_upwards [hb] with ω hω have hg := congrFun hcompG ω dsimp [F, Function.comp_apply, Pi.add_apply] rw [show G (flattenSample n ω) = linearProjectionMean c_f C_f L P n hP ω A from hg] dsimp [Z, Y, c, X, E] simp only [flattenSample, MeasurableEquiv.apply_symm_apply] rw [← Finset.mul_sum] linear_combination -hω have hpull := condExp_comp_flattenSample c_f C_f L P n hP F hFint have hflat_pull : ∀ᵐ ω ∂dataLaw P n n, @condExp ((a : FlatIndex n) → FlatObs n a) ℝ m MeasurableSpace.pi _ _ μ F (flattenSample n ω) = G (flattenSample n ω) := by have hmap : @Measure.map _ _ _ MeasurableSpace.pi (flattenSample n) (dataLaw P n n) = μ := map_flattenSample_dataLaw c_f C_f L P n hP have hp : ∀ᵐ z ∂(@Measure.map _ _ _ MeasurableSpace.pi (flattenSample n) (dataLaw P n n)), @condExp ((a : FlatIndex n) → FlatObs n a) ℝ m MeasurableSpace.pi _ _ μ F z = G z := by rw [hmap] exact hflat exact (@MeasurableEmbedding.ae_map_iff (TwoSample n n) ((a : FlatIndex n) → FlatObs n a) inferInstance MeasurableSpace.pi (flattenSample n) hEembed (fun z => @condExp ((a : FlatIndex n) → FlatObs n a) ℝ m MeasurableSpace.pi _ _ μ F z = G z) (dataLaw P n n)).mp hp have hcongr := condExp_congr_ae (m := trainingSigma n) hcompF filter_upwards [hpull, hflat_pull, hcongr] with ω hp hf hc rw [← hc, hp] exact hf.trans (congrFun hcompG ω)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.condExp_linearTerm_eq_linearProjectionMean · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/LinearStatisticBridge.lean:233
CausalSmith.Stat.STAT_TransportCaceRoughnuisanceLength_Research.Helpers.CubicMse.LinearVariance 2 declarations The exact observation statistic is represented by its centered pilot-cell sum.

Conditional variance of the exact held-out linear correction

The exact observation statistic is represented by its centered pilot-cell sum. Bounded training derivatives and the signed iid covariance bound give roadmap (19), with the stated constant and no added assumptions.

theorem linear_conditional_variance_with_memLp

Roadmap (19) for the actual linear correction, conditioned on the two training blocks. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hn :
threshold ≤ n
hP :
ModelClass c_f C_f L P n
A :
conclusion 1
MemLp (fun ξ : TwoSample n n => linearTerm c_f C_f ξ A - condExp (trainingSigma n) (dataLaw P n n) (fun ζ : TwoSample n n => linearTerm c_f C_f ζ A) ξ) 2 (dataLaw P n n)
conclusion 2
∀ᵐ ω ∂dataLaw P n n, condExp (trainingSigma n) (dataLaw P n n) (fun ξ : TwoSample n n => (linearTerm c_f C_f ξ A - condExp (trainingSigma n) (dataLaw P n n) (fun ζ : TwoSample n n => linearTerm c_f C_f ζ A) ξ) ^ 2) ω
≤ 10 * (7 : ℝ) ^ 2 * (fourthDerivativeEnvelope c_f C_f) ^ 2 * (n : ℝ) ^ (-1 : ℝ)
Proof (Lean source)
-- @node: linear_conditional_variance_with_memLp lemma linear_conditional_variance_with_memLp (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hn : threshold ≤ n) (hP : ModelClass c_f C_f L P n) (A : Bool) : MemLp (fun ξ : TwoSample n n => linearTerm c_f C_f ξ A - condExp (trainingSigma n) (dataLaw P n n) (fun ζ : TwoSample n n => linearTerm c_f C_f ζ A) ξ) 2 (dataLaw P n n) ∧ (∀ᵐ ω ∂dataLaw P n n, condExp (trainingSigma n) (dataLaw P n n) (fun ξ : TwoSample n n => (linearTerm c_f C_f ξ A - condExp (trainingSigma n) (dataLaw P n n) (fun ζ : TwoSample n n => linearTerm c_f C_f ζ A) ξ) ^ 2) ω ≤ 10 * (7 : ℝ) ^ 2 * (fourthDerivativeEnvelope c_f C_f) ^ 2 * (n : ℝ) ^ (-1 : ℝ)) := by classical let K := pilotResolution n have hK : 0 < K := by dsimp [K, pilotResolution, dyadicResolution] split_ifs <;> positivity let E := sumPiEquivProdPi (FlatObs n) have hembed : @MeasurableEmbedding (TwoSample n n) ((a : FlatIndex n) → FlatObs n a) inferInstance MeasurableSpace.pi (flattenSample n) := (sumPiEquivProdPi (FlatObs n)).symm.measurableEmbedding let μ := Measure.pi (flatLaw P n) let m := comap (finsetCoordProj (Ω := FlatObs n) (flatBlock n 0)) MeasurableSpace.pi let M := fourthDerivativeEnvelope c_f C_f let c (i : Fin 7) (l : Fin K) (z : (a : FlatIndex n) → FlatObs n a) := dPhi1 A (pilot c_f C_f (E z) (midpoint K l)) i let X (i : Fin 7) (l : Fin K) (z : (a : FlatIndex n) → FlatObs n a) := flatCenteredCellScore P i 1 l (finsetCoordProj (flatBlock n 1) z) let Y (i : Fin 7) (z : (a : FlatIndex n) → FlatObs n a) := (K : ℝ)⁻¹ * ∑ l : Fin K, c i l z * X i l z let Z (z : (a : FlatIndex n) → FlatObs n a) := ∑ i : Fin 7, Y i z let : ∀ a, IsProbabilityMeasure (flatLaw P n a) := fun a => flatLaw_isProbabilityMeasure c_f C_f L P n hP a have hm : m ≤ (MeasurableSpace.pi : MeasurableSpace ((a : FlatIndex n) → FlatObs n a)) := (measurable_finsetCoordProj (Ω := FlatObs n) (flatBlock n 0)).comap_le have hM : 0 ≤ M := by dsimp [M, fourthDerivativeEnvelope] have := hP.sourceBounds.1.1 positivity have hcmeas (i : Fin 7) (l : Fin K) : StronglyMeasurable[m] (c i l) := (stronglyMeasurable_dPhi1_pilot_trainingSigma c_f C_f L P n hn hP A (midpoint K l) i).comp_measurable (measurable_unflattenSample_flatTraining n) have hc (i : Fin 7) (l : Fin K) (z : (a : FlatIndex n) → FlatObs n a) : |c i l z| ≤ M := dPhi1_abs_le c_f C_f hP.sourceBounds.1 hP.sourceBounds.2.1 A _ (pilot_mem_clippingRectangle c_f C_f L P n hn hP (E z) (midpoint K l)) i have hXlp (i : Fin 7) (l : Fin K) : MemLp (X i l) 2 μ := flatCenteredCellScore_comp_memLp c_f C_f L P n K hn hP i 1 l have hYlp (i : Fin 7) : MemLp (Y i) 2 μ := by have ht (l : Fin K) : MemLp (fun z => c i l z * X i l z) 2 μ := by apply (hXlp i l).of_le_mul (c := M) (((hcmeas i l).mono hm).aestronglyMeasurable.mul (hXlp i l).aestronglyMeasurable) filter_upwards [] with z simp only [Real.norm_eq_abs, Pi.mul_apply, abs_mul] exact mul_le_mul_of_nonneg_right (hc i l z) (abs_nonneg _) exact (memLp_finsetSum univ (fun l _ => ht l)).const_mul (K : ℝ)⁻¹ have hZlp : MemLp Z 2 μ := memLp_finsetSum univ (fun i _ => hYlp i) have hYbound (i : Fin 7) : ∀ᵐ z ∂μ, condExp m μ (fun y => (Y i y) ^ 2) z ≤ 5 * M ^ 2 * (n : ℝ) ^ (-1 : ℝ) := condExp_sq_bounded_linear_cellAverage_le c_f C_f L P n K hn hP hK i 0 (c i) M hM (hcmeas i) (by filter_upwards [] with z; exact fun l => hc i l z) have hagg := @condExp_sq_finsetSum_le ((a : FlatIndex n) → FlatObs n a) (Fin 7) MeasurableSpace.pi μ m univ Y (5 * M ^ 2 * (n : ℝ) ^ (-1 : ℝ)) (fun i _ => hYlp i) (fun i _ => hYbound i) have hflat : ∀ᵐ z ∂μ, condExp m μ (fun y => (Z y) ^ 2) z ≤ 10 * (7 : ℝ) ^ 2 * M ^ 2 * (n : ℝ) ^ (-1 : ℝ) := by filter_upwards [hagg] with z hz have hnpos : (0 : ℝ) < n := by exact_mod_cast (show 0 < n by norm_num [threshold] at hn; omega) change condExp m μ (fun y => (Z y) ^ 2) z ≤ _ norm_num only [Finset.card_univ, Fintype.card_fin, Nat.cast_ofNat] at hz apply hz.trans have hb : 0 ≤ M ^ 2 * (n : ℝ) ^ (-1 : ℝ) := by positivity nlinarith have hbridge : Z ∘ flattenSample n =ᵐ[dataLaw P n n] (fun ω => linearTerm c_f C_f ω A - linearProjectionMean c_f C_f L P n hP ω A) := by have hb := linearTerm_sub_projectionMean_eq_centered_cell_sum c_f C_f L P n K hn hP hK (dvd_refl _) A filter_upwards [hb] with ω hω dsimp [Z, Y, c, X, E, Function.comp_apply] simp only [flattenSample, MeasurableEquiv.apply_symm_apply] rw [← Finset.mul_sum] exact hω.symm have hmean := condExp_linearTerm_eq_linearProjectionMean c_f C_f L P n hn hP A have hsquare : (fun ξ => (linearTerm c_f C_f ξ A - condExp (trainingSigma n) (dataLaw P n n) (fun ζ => linearTerm c_f C_f ζ A) ξ) ^ 2) =ᵐ[dataLaw P n n] (fun z => (Z z) ^ 2) ∘ flattenSample n := by filter_upwards [hbridge, hmean] with ξ hb hm simp only [Function.comp_apply] at hb ⊢ rw [hm, hb] have houter := condExp_comp_flattenSample c_f C_f L P n hP (fun z => (Z z) ^ 2) hZlp.integrable_sq have hmap : @Measure.map _ _ _ MeasurableSpace.pi (flattenSample n) (dataLaw P n n) = μ := map_flattenSample_dataLaw c_f C_f L P n hP have hpull : ∀ᵐ ω ∂dataLaw P n n, condExp m μ (fun y => (Z y) ^ 2) (flattenSample n ω) ≤ 10 * (7 : ℝ) ^ 2 * M ^ 2 * (n : ℝ) ^ (-1 : ℝ) := by have hp : ∀ᵐ z ∂(@Measure.map _ _ _ MeasurableSpace.pi (flattenSample n) (dataLaw P n n)), @condExp ((a : FlatIndex n) → FlatObs n a) ℝ m MeasurableSpace.pi _ _ μ (fun y => (Z y) ^ 2) z ≤ 10 * (7 : ℝ) ^ 2 * M ^ 2 * (n : ℝ) ^ (-1 : ℝ) := by rw [hmap] exact hflat exact (@MeasurableEmbedding.ae_map_iff (TwoSample n n) ((a : FlatIndex n) → FlatObs n a) inferInstance MeasurableSpace.pi (flattenSample n) hembed _ (dataLaw P n n)).mp hp have hcongr := condExp_congr_ae (m := trainingSigma n) hsquare constructor · letI : MeasurableSpace ((a : FlatIndex n) → FlatObs n a) := MeasurableSpace.pi have hlp : MemLp Z 2 (@Measure.map _ _ _ MeasurableSpace.pi (flattenSample n) (dataLaw P n n)) := by rw [hmap] exact hZlp have hp := hlp.comp_of_map (mβ := MeasurableSpace.pi) hembed.measurable.aemeasurable apply (memLp_congr_ae (show Z ∘ flattenSample n =ᵐ[dataLaw P n n] _ from ?_)).mp hp filter_upwards [hbridge, hmean] with ξ hb hm simp only [Function.comp_apply] at hb ⊢ rw [hm] exact hb · filter_upwards [hcongr, houter, hpull] with ω hc ho hb rw [hc, ho] exact hb
CausalSmith.Stat.TransportCaceRoughnuisanceLength.linear_conditional_variance_with_memLp · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/LinearVariance.lean:19
theorem linear_conditional_variance

Roadmap (19) for the exact linear correction. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hn :
threshold ≤ n
hP :
ModelClass c_f C_f L P n
A :
∀ᵐ ω ∂dataLaw P n n, condExp (trainingSigma n) (dataLaw P n n) (fun ξ : TwoSample n n => (linearTerm c_f C_f ξ A - condExp (trainingSigma n) (dataLaw P n n) (fun ζ : TwoSample n n => linearTerm c_f C_f ζ A) ξ) ^ 2) ω
≤ 10 * (7 : ℝ) ^ 2 * (fourthDerivativeEnvelope c_f C_f) ^ 2 * (n : ℝ) ^ (-1 : ℝ)
Proof (Lean source)
-- @node: linear_conditional_variance lemma linear_conditional_variance (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hn : threshold ≤ n) (hP : ModelClass c_f C_f L P n) (A : Bool) : ∀ᵐ ω ∂dataLaw P n n, condExp (trainingSigma n) (dataLaw P n n) (fun ξ : TwoSample n n => (linearTerm c_f C_f ξ A - condExp (trainingSigma n) (dataLaw P n n) (fun ζ : TwoSample n n => linearTerm c_f C_f ζ A) ξ) ^ 2) ω ≤ 10 * (7 : ℝ) ^ 2 * (fourthDerivativeEnvelope c_f C_f) ^ 2 * (n : ℝ) ^ (-1 : ℝ) := by exact (linear_conditional_variance_with_memLp c_f C_f L P n hn hP A).2
CausalSmith.Stat.TransportCaceRoughnuisanceLength.linear_conditional_variance · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/LinearVariance.lean:154
CausalSmith.Stat.STAT_TransportCaceRoughnuisanceLength_Research.Helpers.CubicMse.MarkedCellCovariance 21 declarations Single-record marked cell covariance bounds

Single-record marked cell covariance bounds

def sourceCellMark

The source cell mark object is defined from the supplied inputs.

Definition (Lean source)
i :
Fin 7
o :
sourceCellMark i o :
ℝ
if i.val
= 1 then boolReal (!o.2.1) else if i.val = 2 then boolReal o.2.1 else if i.val = 3 then boolReal (!o.2.1) * max 0 (min 1 o.2.2.2) else if i.val = 4 then boolReal o.2.1 * max 0 (min 1 o.2.2.2) else if i.val = 5 then boolReal (!o.2.1) * boolReal o.2.2.1 else if i.val = 6 then boolReal o.2.1 * boolReal o.2.2.1 else 0
def sourceCellScore

The source cell score object is defined from the supplied inputs.

Definition (Lean source)
i :
Fin 7
K :
ℕ
l :
Fin K
o :
sourceCellScore i K l o :
ℝ
by classical exact if o.1 ∈ cell K l then sourceCellMark i o else 0
def targetCellScore

The target cell score object is defined from the supplied inputs.

Definition (Lean source)
K :
ℕ
l :
Fin K
x :
ℝ
targetCellScore K l x :
ℝ
by classical exact if x ∈ cell K l then 1 else 0
theorem sourceCellMark_mem_unit_interval

Given the supplied inputs, the stated result about source cell mark mem unit interval holds.

Formal statement
i :
Fin 7
o :
sourceCellMark i o ∈ Icc (0 : ℝ) 1
Proof (Lean source)
lemma sourceCellMark_mem_unit_interval (i : Fin 7) (o : SourceObs) : sourceCellMark i o ∈ Icc (0 : ℝ) 1 := by have hclip (y : ℝ) : max 0 (min 1 y) ∈ Icc (0 : ℝ) 1 := by constructor · exact le_max_left _ _ · exact max_le (by norm_num) (min_le_left _ _) rcases o with ⟨x, z, d, y⟩ fin_cases i <;> cases z <;> cases d <;> simp [sourceCellMark, boolReal, Set.mem_Icc, (hclip y).1, (hclip y).2]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.sourceCellMark_mem_unit_interval · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/MarkedCellCovariance.lean:32
theorem measurable_sourceCellMark

Given the supplied inputs, the stated result about measurable source cell mark holds.

Formal statement
i :
Fin 7
Proof (Lean source)
@[fun_prop] lemma measurable_sourceCellMark (i : Fin 7) : Measurable (sourceCellMark i) := by unfold sourceCellMark fin_cases i <;> simp <;> fun_prop
CausalSmith.Stat.TransportCaceRoughnuisanceLength.measurable_sourceCellMark · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/MarkedCellCovariance.lean:43
theorem measurable_sourceCellScore

Given the supplied inputs, the stated result about measurable source cell score holds.

Formal statement
i :
Fin 7
K :
ℕ
l :
Fin K
Proof (Lean source)
@[fun_prop] lemma measurable_sourceCellScore (i : Fin 7) (K : ℕ) (l : Fin K) : Measurable (sourceCellScore i K l) := by unfold sourceCellScore exact Measurable.ite ((measurableSet_cell K l).preimage measurable_fst) (measurable_sourceCellMark i) measurable_const
CausalSmith.Stat.TransportCaceRoughnuisanceLength.measurable_sourceCellScore · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/MarkedCellCovariance.lean:49
theorem measurable_targetCellScore

Given the supplied inputs, the stated result about measurable target cell score holds.

Formal statement
K :
ℕ
l :
Fin K
Proof (Lean source)
@[fun_prop] lemma measurable_targetCellScore (K : ℕ) (l : Fin K) : Measurable (targetCellScore K l) := by unfold targetCellScore exact Measurable.ite (measurableSet_cell K l) measurable_const measurable_const
CausalSmith.Stat.TransportCaceRoughnuisanceLength.measurable_targetCellScore · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/MarkedCellCovariance.lean:57
theorem sourceCellScore_mem_unit_interval

Given the supplied inputs, the stated result about source cell score mem unit interval holds.

Formal statement
i :
Fin 7
K :
ℕ
l :
Fin K
o :
sourceCellScore i K l o ∈ Icc (0 : ℝ) 1
Proof (Lean source)
lemma sourceCellScore_mem_unit_interval (i : Fin 7) (K : ℕ) (l : Fin K) (o : SourceObs) : sourceCellScore i K l o ∈ Icc (0 : ℝ) 1 := by unfold sourceCellScore split_ifs · exact sourceCellMark_mem_unit_interval i o · simp
CausalSmith.Stat.TransportCaceRoughnuisanceLength.sourceCellScore_mem_unit_interval · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/MarkedCellCovariance.lean:64
theorem targetCellScore_mem_unit_interval

Given the supplied inputs, the stated result about target cell score mem unit interval holds.

Formal statement
K :
ℕ
l :
Fin K
x :
ℝ
targetCellScore K l x ∈ Icc (0 : ℝ) 1
Proof (Lean source)
lemma targetCellScore_mem_unit_interval (K : ℕ) (l : Fin K) (x : ℝ) : targetCellScore K l x ∈ Icc (0 : ℝ) 1 := by unfold targetCellScore split_ifs <;> simp
CausalSmith.Stat.TransportCaceRoughnuisanceLength.targetCellScore_mem_unit_interval · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/MarkedCellCovariance.lean:72
theorem sourceCellScore_le_indicator

Given the supplied inputs, the stated result about source cell score le indicator holds.

Formal statement
i :
Fin 7
K :
ℕ
l :
Fin K
o :
sourceCellScore i K l o ≤ (fst ⁻¹' cell K l).indicator (fun _ => (1 : ℝ)) o
Proof (Lean source)
lemma sourceCellScore_le_indicator (i : Fin 7) (K : ℕ) (l : Fin K) (o : SourceObs) : sourceCellScore i K l o ≤ (fst ⁻¹' cell K l).indicator (fun _ => (1 : ℝ)) o := by unfold sourceCellScore by_cases ho : o.1 ∈ cell K l · simp [ho, (sourceCellMark_mem_unit_interval i o).2] · simp [ho]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.sourceCellScore_le_indicator · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/MarkedCellCovariance.lean:78
theorem targetCellScore_le_indicator

Given the supplied inputs, the stated result about target cell score le indicator holds.

Formal statement
K :
ℕ
l :
Fin K
x :
ℝ
targetCellScore K l x ≤ (cell K l).indicator (fun _ => (1 : ℝ)) x
Proof (Lean source)
lemma targetCellScore_le_indicator (K : ℕ) (l : Fin K) (x : ℝ) : targetCellScore K l x ≤ (cell K l).indicator (fun _ => (1 : ℝ)) x := by unfold targetCellScore by_cases hx : x ∈ cell K l <;> simp [hx]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.targetCellScore_le_indicator · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/MarkedCellCovariance.lean:88
theorem memLp_two_of_mem_unit_interval

Given the supplied inputs, the stated result about mem lp two of mem unit interval holds.

Formal statement
Ω :
f :
Ω → ℝ
hf :
hunit :
∀ x, f x ∈ Icc (0 : ℝ) 1
MemLp f 2 μ
Proof (Lean source)
lemma memLp_two_of_mem_unit_interval {Ω : Type*} [MeasurableSpace Ω] {μ : Measure Ω} [IsFiniteMeasure μ] {f : Ω → ℝ} (hf : Measurable f) (hunit : ∀ x, f x ∈ Icc (0 : ℝ) 1) : MemLp f 2 μ := by apply MemLp.of_bound hf.aestronglyMeasurable 1 filter_upwards [] with x rw [Real.norm_eq_abs, abs_of_nonneg (hunit x).1] exact (hunit x).2
CausalSmith.Stat.TransportCaceRoughnuisanceLength.memLp_two_of_mem_unit_interval · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/MarkedCellCovariance.lean:94
theorem integral_bounded_score_le_measureReal

Given the supplied inputs, the stated result about integral bounded score le measure real holds.

Formal statement
Ω :
S :
Set Ω
hS :
f :
Ω → ℝ
hf :
hunit :
∀ x, f x ∈ Icc (0 : ℝ) 1
hle :
∀ x, f x ≤ S.indicator (fun _ => (1 : ℝ)) x
conclusion 1
0 ≤ ∫ x, f x ∂μ
conclusion 2
∫ x, f x ∂μ ≤ μ.real S
Proof (Lean source)
lemma integral_bounded_score_le_measureReal {Ω : Type*} [MeasurableSpace Ω] {μ : Measure Ω} [IsFiniteMeasure μ] {S : Set Ω} (hS : MeasurableSet S) {f : Ω → ℝ} (hf : Measurable f) (hunit : ∀ x, f x ∈ Icc (0 : ℝ) 1) (hle : ∀ x, f x ≤ S.indicator (fun _ => (1 : ℝ)) x) : 0 ≤ ∫ x, f x ∂μ ∧ ∫ x, f x ∂μ ≤ μ.real S := by have hfint : Integrable f μ := (memLp_two_of_mem_unit_interval hf hunit).integrable (by norm_num) have hind : Integrable (S.indicator (fun _ => (1 : ℝ))) μ := (integrable_const (1 : ℝ)).indicator hS constructor · exact integral_nonneg fun x => (hunit x).1 · rw [← integral_indicator_one hS] exact integral_mono hfint hind hle
CausalSmith.Stat.TransportCaceRoughnuisanceLength.integral_bounded_score_le_measureReal · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/MarkedCellCovariance.lean:104
theorem abs_covariance_bounded_on_event

Given the supplied inputs, the stated result about abs covariance bounded on event holds.

Formal statement
Ω :
S :
Set Ω
hS :
f g :
Ω → ℝ
hf :
hg :
hfunit :
∀ x, f x ∈ Icc (0 : ℝ) 1
hgunit :
∀ x, g x ∈ Icc (0 : ℝ) 1
hfsupp :
∀ x, f x ≤ S.indicator (fun _ => (1 : ℝ)) x
hgsupp :
∀ x, g x ≤ S.indicator (fun _ => (1 : ℝ)) x
p :
ℝ
hp :
0 ≤ p
hmass :
μ.real S ≤ p
|cov[f, g; μ]| ≤ p + p ^ 2
Proof (Lean source)
lemma abs_covariance_bounded_on_event {Ω : Type*} [MeasurableSpace Ω] {μ : Measure Ω} [IsProbabilityMeasure μ] {S : Set Ω} (hS : MeasurableSet S) {f g : Ω → ℝ} (hf : Measurable f) (hg : Measurable g) (hfunit : ∀ x, f x ∈ Icc (0 : ℝ) 1) (hgunit : ∀ x, g x ∈ Icc (0 : ℝ) 1) (hfsupp : ∀ x, f x ≤ S.indicator (fun _ => (1 : ℝ)) x) (hgsupp : ∀ x, g x ≤ S.indicator (fun _ => (1 : ℝ)) x) {p : ℝ} (hp : 0 ≤ p) (hmass : μ.real S ≤ p) : |cov[f, g; μ]| ≤ p + p ^ 2 := by have hfLp := memLp_two_of_mem_unit_interval (μ := μ) hf hfunit have hgLp := memLp_two_of_mem_unit_interval (μ := μ) hg hgunit have hfi := integral_bounded_score_le_measureReal (μ := μ) hS hf hfunit hfsupp have hgi := integral_bounded_score_le_measureReal (μ := μ) hS hg hgunit hgsupp have hfgunit (x : Ω) : f x * g x ∈ Icc (0 : ℝ) 1 := by constructor · exact mul_nonneg (hfunit x).1 (hgunit x).1 · calc f x * g x ≤ f x * 1 := mul_le_mul_of_nonneg_left (hgunit x).2 (hfunit x).1 _ ≤ 1 := by simpa using (hfunit x).2 have hfgsupp (x : Ω) : f x * g x ≤ S.indicator (fun _ => (1 : ℝ)) x := by by_cases hx : x ∈ S · simp [hx, (hfgunit x).2] · have hf0 : f x = 0 := by have := hfsupp x simp [hx] at this linarith [(hfunit x).1] simp [hx, hf0] have hfg := integral_bounded_score_le_measureReal (μ := μ) hS (hf.mul hg) hfgunit hfgsupp have hfg' : 0 ≤ ∫ x, f x * g x ∂μ ∧ ∫ x, f x * g x ∂μ ≤ μ.real S := by simpa [Pi.mul_apply] using hfg rw [covariance_eq_sub hfLp hgLp] calc |∫ x, f x * g x ∂μ - (∫ x, f x ∂μ) * ∫ x, g x ∂μ| ≤ |∫ x, f x * g x ∂μ| + |(∫ x, f x ∂μ) * ∫ x, g x ∂μ| := abs_sub _ _ _ = (∫ x, f x * g x ∂μ) + (∫ x, f x ∂μ) * ∫ x, g x ∂μ := by rw [abs_of_nonneg hfg'.1, abs_of_nonneg (mul_nonneg hfi.1 hgi.1)] _ ≤ p + p ^ 2 := by nlinarith [hfi.2.trans hmass, hgi.2.trans hmass, hfg'.2.trans hmass]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.abs_covariance_bounded_on_event · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/MarkedCellCovariance.lean:120
theorem abs_covariance_le_sq_of_cross_zero

Given the supplied inputs, the stated result about abs covariance le sq of cross zero holds.

Formal statement
Ω :
f g :
Ω → ℝ
hf :
MemLp f 2 μ
hg :
MemLp g 2 μ
p :
ℝ
hp :
0 ≤ p
hf0 :
0 ≤ ∫ x, f x ∂μ
hg0 :
0 ≤ ∫ x, g x ∂μ
hfle :
∫ x, f x ∂μ ≤ p
hgle :
∫ x, g x ∂μ ≤ p
hcross :
∫ x, f x * g x ∂μ = 0
|cov[f, g; μ]| ≤ p ^ 2
Proof (Lean source)
lemma abs_covariance_le_sq_of_cross_zero {Ω : Type*} [MeasurableSpace Ω] {μ : Measure Ω} [IsProbabilityMeasure μ] {f g : Ω → ℝ} (hf : MemLp f 2 μ) (hg : MemLp g 2 μ) {p : ℝ} (hp : 0 ≤ p) (hf0 : 0 ≤ ∫ x, f x ∂μ) (hg0 : 0 ≤ ∫ x, g x ∂μ) (hfle : ∫ x, f x ∂μ ≤ p) (hgle : ∫ x, g x ∂μ ≤ p) (hcross : ∫ x, f x * g x ∂μ = 0) : |cov[f, g; μ]| ≤ p ^ 2 := by have hcross' : ∫ x, (f * g) x ∂μ = 0 := by simpa [Pi.mul_apply] using hcross rw [covariance_eq_sub hf hg, hcross', zero_sub, abs_neg, abs_of_nonneg (mul_nonneg hf0 hg0)] nlinarith
CausalSmith.Stat.TransportCaceRoughnuisanceLength.abs_covariance_le_sq_of_cross_zero · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/MarkedCellCovariance.lean:163
theorem abs_covariance_bounded_on_disjoint_events

Given the supplied inputs, the stated result about abs covariance bounded on disjoint events holds.

Formal statement
Ω :
S T :
Set Ω
hS :
hT :
hST :
f g :
Ω → ℝ
hf :
hg :
hfunit :
∀ x, f x ∈ Icc (0 : ℝ) 1
hgunit :
∀ x, g x ∈ Icc (0 : ℝ) 1
hfsupp :
∀ x, f x ≤ S.indicator (fun _ => (1 : ℝ)) x
hgsupp :
∀ x, g x ≤ T.indicator (fun _ => (1 : ℝ)) x
p :
ℝ
hp :
0 ≤ p
hSmass :
μ.real S ≤ p
hTmass :
μ.real T ≤ p
|cov[f, g; μ]| ≤ p ^ 2
Proof (Lean source)
lemma abs_covariance_bounded_on_disjoint_events {Ω : Type*} [MeasurableSpace Ω] {μ : Measure Ω} [IsProbabilityMeasure μ] {S T : Set Ω} (hS : MeasurableSet S) (hT : MeasurableSet T) (hST : Disjoint S T) {f g : Ω → ℝ} (hf : Measurable f) (hg : Measurable g) (hfunit : ∀ x, f x ∈ Icc (0 : ℝ) 1) (hgunit : ∀ x, g x ∈ Icc (0 : ℝ) 1) (hfsupp : ∀ x, f x ≤ S.indicator (fun _ => (1 : ℝ)) x) (hgsupp : ∀ x, g x ≤ T.indicator (fun _ => (1 : ℝ)) x) {p : ℝ} (hp : 0 ≤ p) (hSmass : μ.real S ≤ p) (hTmass : μ.real T ≤ p) : |cov[f, g; μ]| ≤ p ^ 2 := by have hfLp := memLp_two_of_mem_unit_interval (μ := μ) hf hfunit have hgLp := memLp_two_of_mem_unit_interval (μ := μ) hg hgunit have hfi := integral_bounded_score_le_measureReal (μ := μ) hS hf hfunit hfsupp have hgi := integral_bounded_score_le_measureReal (μ := μ) hT hg hgunit hgsupp have hzero (x : Ω) : f x * g x = 0 := by by_cases hxS : x ∈ S · have hxT : x ∉ T := Set.disjoint_left.mp hST hxS have hg0 : g x = 0 := by have := hgsupp x simp [hxT] at this linarith [(hgunit x).1] simp [hg0] · have hf0 : f x = 0 := by have := hfsupp x simp [hxS] at this linarith [(hfunit x).1] simp [hf0] have hcross : ∫ x, f x * g x ∂μ = 0 := by simp_rw [hzero] simp exact abs_covariance_le_sq_of_cross_zero hfLp hgLp hp hfi.1 hgi.1 (hfi.2.trans hSmass) (hgi.2.trans hTmass) hcross
CausalSmith.Stat.TransportCaceRoughnuisanceLength.abs_covariance_bounded_on_disjoint_events · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/MarkedCellCovariance.lean:176
theorem source_event_mass_le

Given the supplied inputs, the stated result about source event mass le holds.

Formal statement
c_f C_f L :
ℝ
n K :
ℕ
hP :
ModelClass c_f C_f L P n
hK :
0 < K
l :
Fin K
(sourceObsLaw P).real (fst ⁻¹' cell K l) ≤ C_f / K
Proof (Lean source)
lemma source_event_mass_le (c_f C_f L : ℝ) (P : TransportLaw) (n K : ℕ) (hP : ModelClass c_f C_f L P n) (hK : 0 < K) (l : Fin K) : (sourceObsLaw P).real (fst ⁻¹' cell K l) ≤ C_f / K := by calc (sourceObsLaw P).real (fst ⁻¹' cell K l) = (sourceXLaw P (cell K l)).toReal := by rw [Measure.real_def, sourceXLaw, Measure.map_apply measurable_fst (measurableSet_cell K l)] _ ≤ C_f / K := source_cell_mass_le c_f C_f L P n K hP hK l
theorem source_same_cell_covariance_le

Given the supplied inputs, the stated result about source same cell covariance le holds.

Formal statement
c_f C_f L :
ℝ
n K :
ℕ
hP :
ModelClass c_f C_f L P n
hK :
0 < K
l :
Fin K
i j :
Fin 7
≤ C_f / K + (C_f / K) ^ 2
Proof (Lean source)
lemma source_same_cell_covariance_le (c_f C_f L : ℝ) (P : TransportLaw) (n K : ℕ) (hP : ModelClass c_f C_f L P n) (hK : 0 < K) (l : Fin K) (i j : Fin 7) : |cov[sourceCellScore i K l, sourceCellScore j K l; sourceObsLaw P]| ≤ C_f / K + (C_f / K) ^ 2 := by letI : IsProbabilityMeasure (sourceObsLaw P) := sourceObsLaw_isProbabilityMeasure c_f C_f L P n hP apply abs_covariance_bounded_on_event ((measurableSet_cell K l).preimage measurable_fst) (measurable_sourceCellScore i K l) (measurable_sourceCellScore j K l) (sourceCellScore_mem_unit_interval i K l) (sourceCellScore_mem_unit_interval j K l) (sourceCellScore_le_indicator i K l) (sourceCellScore_le_indicator j K l) · exact div_nonneg (le_of_lt (lt_trans (by norm_num) hP.sourceBounds.2.1)) (by positivity) · exact source_event_mass_le c_f C_f L P n K hP hK l
CausalSmith.Stat.TransportCaceRoughnuisanceLength.source_same_cell_covariance_le · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/MarkedCellCovariance.lean:222
theorem source_off_cell_covariance_le

Given the supplied inputs, the stated result about source off cell covariance le holds.

Formal statement
c_f C_f L :
ℝ
n K :
ℕ
hP :
ModelClass c_f C_f L P n
hK :
0 < K
l r :
Fin K
hlr :
l ≠ r
i j :
Fin 7
|cov[sourceCellScore i K l, sourceCellScore j K r; sourceObsLaw P]| ≤ (C_f / K) ^ 2
Proof (Lean source)
lemma source_off_cell_covariance_le (c_f C_f L : ℝ) (P : TransportLaw) (n K : ℕ) (hP : ModelClass c_f C_f L P n) (hK : 0 < K) {l r : Fin K} (hlr : l ≠ r) (i j : Fin 7) : |cov[sourceCellScore i K l, sourceCellScore j K r; sourceObsLaw P]| ≤ (C_f / K) ^ 2 := by letI : IsProbabilityMeasure (sourceObsLaw P) := sourceObsLaw_isProbabilityMeasure c_f C_f L P n hP apply abs_covariance_bounded_on_disjoint_events ((measurableSet_cell K l).preimage measurable_fst) ((measurableSet_cell K r).preimage measurable_fst) ((cell_disjoint hK hlr).preimage (Prod.fst : SourceObs → ℝ)) (measurable_sourceCellScore i K l) (measurable_sourceCellScore j K r) (sourceCellScore_mem_unit_interval i K l) (sourceCellScore_mem_unit_interval j K r) (sourceCellScore_le_indicator i K l) (sourceCellScore_le_indicator j K r) · exact div_nonneg (le_of_lt (lt_trans (by norm_num) hP.sourceBounds.2.1)) (by positivity) · exact source_event_mass_le c_f C_f L P n K hP hK l · exact source_event_mass_le c_f C_f L P n K hP hK r
CausalSmith.Stat.TransportCaceRoughnuisanceLength.source_off_cell_covariance_le · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/MarkedCellCovariance.lean:240
theorem target_same_cell_covariance_le

Given the supplied inputs, the stated result about target same cell covariance le holds.

Formal statement
c_f C_f L :
ℝ
n K :
ℕ
hP :
ModelClass c_f C_f L P n
hK :
0 < K
l :
Fin K
|cov[targetCellScore K l, targetCellScore K l; targetXLaw P]| ≤ C_f / K + (C_f / K) ^ 2
Proof (Lean source)
lemma target_same_cell_covariance_le (c_f C_f L : ℝ) (P : TransportLaw) (n K : ℕ) (hP : ModelClass c_f C_f L P n) (hK : 0 < K) (l : Fin K) : |cov[targetCellScore K l, targetCellScore K l; targetXLaw P]| ≤ C_f / K + (C_f / K) ^ 2 := by letI : IsProbabilityMeasure (targetXLaw P) := targetXLaw_isProbabilityMeasure c_f C_f L P n hP apply abs_covariance_bounded_on_event (measurableSet_cell K l) (measurable_targetCellScore K l) (measurable_targetCellScore K l) (targetCellScore_mem_unit_interval K l) (targetCellScore_mem_unit_interval K l) (targetCellScore_le_indicator K l) (targetCellScore_le_indicator K l) · exact div_nonneg (le_of_lt (lt_trans (by norm_num) hP.sourceBounds.2.1)) (by positivity) · exact target_cell_mass_le c_f C_f L P n K hP hK l
CausalSmith.Stat.TransportCaceRoughnuisanceLength.target_same_cell_covariance_le · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/MarkedCellCovariance.lean:262
theorem target_off_cell_covariance_le

Given the supplied inputs, the stated result about target off cell covariance le holds.

Formal statement
c_f C_f L :
ℝ
n K :
ℕ
hP :
ModelClass c_f C_f L P n
hK :
0 < K
l r :
Fin K
hlr :
l ≠ r
|cov[targetCellScore K l, targetCellScore K r; targetXLaw P]| ≤ (C_f / K) ^ 2
Proof (Lean source)
lemma target_off_cell_covariance_le (c_f C_f L : ℝ) (P : TransportLaw) (n K : ℕ) (hP : ModelClass c_f C_f L P n) (hK : 0 < K) {l r : Fin K} (hlr : l ≠ r) : |cov[targetCellScore K l, targetCellScore K r; targetXLaw P]| ≤ (C_f / K) ^ 2 := by letI : IsProbabilityMeasure (targetXLaw P) := targetXLaw_isProbabilityMeasure c_f C_f L P n hP apply abs_covariance_bounded_on_disjoint_events (measurableSet_cell K l) (measurableSet_cell K r) (cell_disjoint hK hlr) (measurable_targetCellScore K l) (measurable_targetCellScore K r) (targetCellScore_mem_unit_interval K l) (targetCellScore_mem_unit_interval K r) (targetCellScore_le_indicator K l) (targetCellScore_le_indicator K r) · exact div_nonneg (le_of_lt (lt_trans (by norm_num) hP.sourceBounds.2.1)) (by positivity) · exact target_cell_mass_le c_f C_f L P n K hP hK l · exact target_cell_mass_le c_f C_f L P n K hP hK r
CausalSmith.Stat.TransportCaceRoughnuisanceLength.target_off_cell_covariance_le · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/MarkedCellCovariance.lean:277
CausalSmith.Stat.STAT_TransportCaceRoughnuisanceLength_Research.Helpers.CubicMse.NestedCells 5 declarations Dyadic divisibility puts each evaluation cell inside a pilot cell.

Nested evaluation cells and the clipped pilot

Dyadic divisibility puts each evaluation cell inside a pilot cell. Consequently histograms, the clipped pilot, and Taylor coefficients are constant there, including the closed right endpoint of the final cell.

theorem dyadicResolution_dvd_of_le Lemma dyadicResolution_dvd_of_le in the paper ↗

Increasing the exponent preserves divisibility of the exact dyadic resolutions. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
n :
ℕ
p q :
ℝ
hpq :
p ≤ q
Proof (Lean source)
-- @node: dyadicResolution_dvd_of_le lemma dyadicResolution_dvd_of_le (n : ℕ) (p q : ℝ) (hpq : p ≤ q) : dyadicResolution n p ∣ dyadicResolution n q := by unfold dyadicResolution split_ifs with hn · exact dvd_refl 1 · apply pow_dvd_pow apply Nat.floor_mono apply mul_le_mul_of_nonneg_right hpq have hm : (1 : ℝ) ≤ blockSize n 0 := by exact_mod_cast blockSize_pos_of_threshold n (Nat.le_of_not_gt hn) 0 exact div_nonneg (Real.log_nonneg hm) (Real.log_pos (by norm_num)).le
CausalSmith.Stat.TransportCaceRoughnuisanceLength.dyadicResolution_dvd_of_le · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/NestedCells.lean:16
theorem pilotResolution_dvd_correctionResolutions Lemma pilotResolution_dvd_correctionResolutions in the paper ↗

Both correction resolutions refine the pilot partition. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
n :
ℕ
conclusion 2
Proof (Lean source)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.pilotResolution_dvd_correctionResolutions · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/NestedCells.lean:30

For an integer refinement, every fine cell is contained in a coarse cell. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
J K :
ℕ
hJ :
0 < J
hK :
0 < K
hJK :
J ∣ K
l :
Fin K
∃ r : Fin J, cell K l ⊆ cell J r
Proof (Lean source)
-- @node: cell_refinement_exists lemma cell_refinement_exists {J K : ℕ} (hJ : 0 < J) (hK : 0 < K) (hJK : J ∣ K) (l : Fin K) : ∃ r : Fin J, cell K l ⊆ cell J r := by obtain ⟨m, rfl⟩ := hJK have hm : 0 < m := by nlinarith have hr : l.val / m < J := (Nat.div_lt_iff_lt_mul hm).2 (by simpa [Nat.mul_comm] using l.isLt) let r : Fin J := ⟨l.val / m, hr⟩ refine ⟨r, ?_⟩ have hlo : r.val * m ≤ l.val := by dsimp [r] exact Nat.div_mul_le_self _ _ have hhi : l.val + 1 ≤ (r.val + 1) * m := by have hd := Nat.mod_lt l.val hm have he := Nat.mod_add_div l.val m dsimp [r] nlinarith have hJr : (0 : ℝ) < J := by exact_mod_cast hJ have hmr : (0 : ℝ) < m := by exact_mod_cast hm have hKr : (0 : ℝ) < J * m := mul_pos hJr hmr have hlower : (r.val : ℝ) / J ≤ (l.val : ℝ) / (J * m) := by apply (div_le_div_iff₀ hJr hKr).2 have hh : (r.val : ℝ) * m ≤ l.val := by exact_mod_cast hlo nlinarith have hupper : ((l.val : ℝ) + 1) / (J * m) ≤ ((r.val : ℝ) + 1) / J := by apply (div_le_div_iff₀ hKr hJr).2 have hh : (l.val : ℝ) + 1 ≤ (r.val + 1) * m := by exact_mod_cast hhi nlinarith intro x hx have hxspace := cell_subset_covariateSpace hK l hx unfold cell at hx ⊢ simp only [Nat.cast_mul] at hx split_ifs at hx ⊢ with hf hc hc · exact ⟨hlower.trans hx.1, hx.2⟩ · exact ⟨hlower.trans hx.1, hxspace.2⟩ · have hlast : r.val + 1 = J := by have hrl := r.isLt nlinarith exact (hf hlast).elim · exact ⟨hlower.trans hx.1, hx.2.trans_le hupper⟩
CausalSmith.Stat.TransportCaceRoughnuisanceLength.cell_refinement_exists · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/NestedCells.lean:38
theorem markedHistogram_eq_of_mem_cell

A marked histogram takes the same value at any two points in one cell. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
n K :
ℕ
hK :
0 < K
ω :
i :
Fin 7
b :
Fin 4
l :
Fin K
x y :
ℝ
hx :
x ∈ cell K l
hy :
y ∈ cell K l
markedHistogram ω i K b x = markedHistogram ω i K b y
Proof (Lean source)
-- @node: markedHistogram_eq_of_mem_cell lemma markedHistogram_eq_of_mem_cell {n K : ℕ} (hK : 0 < K) (ω : TwoSample n n) (i : Fin 7) (b : Fin 4) (l : Fin K) {x y : ℝ} (hx : x ∈ cell K l) (hy : y ∈ cell K l) : markedHistogram ω i K b x = markedHistogram ω i K b y := by classical unfold markedHistogram split_ifs · rfl · apply Finset.sum_congr rfl intro r _ have hmem : x ∈ cell K r ↔ y ∈ cell K r := by by_cases hrl : r = l · subst r exact iff_of_true hx hy · have hd := Set.disjoint_left.mp (cell_disjoint hK hrl) exact iff_of_false (fun h => hd h hx) (fun h => hd h hy) simp only [hmem]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.markedHistogram_eq_of_mem_cell · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/NestedCells.lean:79
theorem pilot_eq_midpoint_of_refinement

On any partition refining the pilot partition, the pilot equals its midpoint value throughout each cell. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f :
ℝ
n K :
ℕ
hK :
0 < K
hdiv :
ω :
l :
Fin K
x :
ℝ
hx :
x ∈ cell K l
pilot c_f C_f ω x = pilot c_f C_f ω (midpoint K l)
Proof (Lean source)
-- @node: pilot_eq_midpoint_of_refinement lemma pilot_eq_midpoint_of_refinement (c_f C_f : ℝ) {n K : ℕ} (hK : 0 < K) (hdiv : pilotResolution n ∣ K) (ω : TwoSample n n) (l : Fin K) {x : ℝ} (hx : x ∈ cell K l) : pilot c_f C_f ω x = pilot c_f C_f ω (midpoint K l) := by have hJ : 0 < pilotResolution n := by unfold pilotResolution dyadicResolution split_ifs <;> positivity obtain ⟨r, hr⟩ := cell_refinement_exists hJ hK hdiv l unfold pilot split_ifs · rfl · funext i rw [markedHistogram_eq_of_mem_cell hJ ω i 0 r (hr hx) (hr (midpoint_mem_cell hK l))]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.pilot_eq_midpoint_of_refinement · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/NestedCells.lean:99
CausalSmith.Stat.STAT_TransportCaceRoughnuisanceLength_Research.Helpers.CubicMse.PilotEighthMoment 9 declarations The bounded iid sum theorem cancels singleton index patterns and counts the survivors.

Eighth-moment closure for the exact clipped pilot

The bounded iid sum theorem cancels singleton index patterns and counts the survivors. Scaling the bin sums, transferring them to the two-sample experiment, and applying clipping and the dyadic resolution bounds gives equation (5).

theorem iidBlockHeight_eighth_moment_le Lemma iidBlockHeight_eighth_moment_le in the paper ↗

Normalize the exact eighth-moment bound for a bounded iid bin sum. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
Ω :
n K :
ℕ
S :
hS :
0 < S.card
hK :
0 < K
f :
Ω → ℝ
hf :
hb :
∀ y, f y ∈ Icc (0 : ℝ) 1
V :
ℝ
hV :
0 ≤ V
hv :
variance f μ ≤ V / K
(∫ x, (iidBlockHeight K S f x - (K : ℝ) * ∫ y, f y ∂μ) ^ 8 ∂Measure.pi (fun _ : Fin n => μ))
≤ (factorial 8 : ℝ) * (V ^ 4 * ((K : ℝ) / S.card) ^ 4 + V * ((K : ℝ) / S.card) ^ 7)
Proof (Lean source)
-- @node: iidBlockHeight_eighth_moment_le lemma iidBlockHeight_eighth_moment_le {Ω : Type*} [MeasurableSpace Ω] {μ : Measure Ω} [IsProbabilityMeasure μ] {n K : ℕ} (S : Finset (Fin n)) (hS : 0 < S.card) (hK : 0 < K) (f : Ω → ℝ) (hf : Measurable f) (hb : ∀ y, f y ∈ Icc (0 : ℝ) 1) (V : ℝ) (hV : 0 ≤ V) (hv : variance f μ ≤ V / K) : (∫ x, (iidBlockHeight K S f x - (K : ℝ) * ∫ y, f y ∂μ) ^ 8 ∂Measure.pi (fun _ : Fin n => μ)) ≤ (factorial 8 : ℝ) * (V ^ 4 * ((K : ℝ) / S.card) ^ 4 + V * ((K : ℝ) / S.card) ^ 7) := by have hm : (0 : ℝ) < S.card := Nat.cast_pos.mpr hS have hk : (0 : ℝ) < K := Nat.cast_pos.mpr hK have hid (x : Fin n → Ω) : iidBlockHeight K S f x - (K : ℝ) * ∫ y, f y ∂μ = ((K : ℝ) / S.card) * ∑ r ∈ S, (f (x r) - ∫ y, f y ∂μ) := by simp only [iidBlockHeight, Finset.sum_sub_distrib, Finset.sum_const, nsmul_eq_mul] field_simp simp_rw [hid, mul_pow] rw [integral_const_mul] have hsum := iid_centered_bounded_sum_eighth_moment μ f hf (fun y => (hb y).1) (fun y => (hb y).2) S have hvar0 := variance_nonneg f μ have hscaled := mul_le_mul_of_nonneg_left hv hm.le have hpow := pow_le_pow_left₀ (mul_nonneg hm.le hvar0) hscaled 4 calc _ ≤ ((K : ℝ) / S.card) ^ 8 * ((factorial 8 : ℝ) * (((S.card : ℝ) * variance f μ) ^ 4 + (S.card : ℝ) * variance f μ)) := mul_le_mul_of_nonneg_left hsum (by positivity) _ ≤ ((K : ℝ) / S.card) ^ 8 * ((factorial 8 : ℝ) * (((S.card : ℝ) * (V / K)) ^ 4 + (S.card : ℝ) * (V / K))) := by gcongr _ = _ := by field_simp <;> ring
CausalSmith.Stat.TransportCaceRoughnuisanceLength.iidBlockHeight_eighth_moment_le · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/PilotEighthMoment.lean:18
theorem bin_variance_envelope_le Lemma bin_variance_envelope_le in the paper ↗

The one-record covariance envelope implies the roadmap's variance factor. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
C :
ℝ
K :
ℕ
hK :
0 < K
C / K + (C / K) ^ 2 ≤ (1 + C + C ^ 2) / K
Proof (Lean source)
-- @node: bin_variance_envelope_le lemma bin_variance_envelope_le (C : ℝ) {K : ℕ} (hK : 0 < K) : C / K + (C / K) ^ 2 ≤ (1 + C + C ^ 2) / K := by have hk : (0 : ℝ) < K := Nat.cast_pos.mpr hK have hk1 : (1 : ℝ) ≤ K := by exact_mod_cast hK apply (le_div_iff₀ hk).2 field_simp nlinarith [sq_nonneg C, mul_nonneg (sq_nonneg C) (sub_nonneg.mpr hk1)]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.bin_variance_envelope_le · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/PilotEighthMoment.lean:52
theorem source_bin_height_eighth_moment_le

The exact source bin height has the eighth-moment bound in equation (3). Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n K :
ℕ
hP :
ModelClass c_f C_f L P n
hK :
0 < K
S :
hS :
0 < S.card
l :
Fin K
i :
Fin 7
(∫ x, (iidBlockHeight K S (sourceCellScore i K l) x - (K : ℝ) * ∫ o, sourceCellScore i K l o ∂sourceObsLaw P) ^ 8 ∂Measure.pi (fun _ : Fin n => sourceObsLaw P))
≤ (factorial 8 : ℝ) * ((1 + C_f + C_f ^ 2) ^ 4 * ((K : ℝ) / S.card) ^ 4 + (1 + C_f + C_f ^ 2) * ((K : ℝ) / S.card) ^ 7)
Proof (Lean source)
-- @node: source_bin_height_eighth_moment_le lemma source_bin_height_eighth_moment_le (c_f C_f L : ℝ) (P : TransportLaw) (n K : ℕ) (hP : ModelClass c_f C_f L P n) (hK : 0 < K) (S : Finset (Fin n)) (hS : 0 < S.card) (l : Fin K) (i : Fin 7) : (∫ x, (iidBlockHeight K S (sourceCellScore i K l) x - (K : ℝ) * ∫ o, sourceCellScore i K l o ∂sourceObsLaw P) ^ 8 ∂Measure.pi (fun _ : Fin n => sourceObsLaw P)) ≤ (factorial 8 : ℝ) * ((1 + C_f + C_f ^ 2) ^ 4 * ((K : ℝ) / S.card) ^ 4 + (1 + C_f + C_f ^ 2) * ((K : ℝ) / S.card) ^ 7) := by letI : IsProbabilityMeasure (sourceObsLaw P) := sourceObsLaw_isProbabilityMeasure c_f C_f L P n hP have hv := source_same_cell_covariance_le c_f C_f L P n K hP hK l i i rw [covariance_self (measurable_sourceCellScore i K l).aemeasurable] at hv apply iidBlockHeight_eighth_moment_le S hS hK _ (measurable_sourceCellScore i K l) (sourceCellScore_mem_unit_interval i K l) _ · nlinarith [sq_nonneg C_f] · exact (le_abs_self _).trans (hv.trans (bin_variance_envelope_le C_f hK))
CausalSmith.Stat.TransportCaceRoughnuisanceLength.source_bin_height_eighth_moment_le · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/PilotEighthMoment.lean:62
theorem target_bin_height_eighth_moment_le

The exact target bin height has the eighth-moment bound in equation (3). Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n K :
ℕ
hP :
ModelClass c_f C_f L P n
hK :
0 < K
S :
hS :
0 < S.card
l :
Fin K
(∫ x, (iidBlockHeight K S (targetCellScore K l) x - (K : ℝ) * ∫ o, targetCellScore K l o ∂targetXLaw P) ^ 8 ∂Measure.pi (fun _ : Fin n => targetXLaw P))
≤ (factorial 8 : ℝ) * ((1 + C_f + C_f ^ 2) ^ 4 * ((K : ℝ) / S.card) ^ 4 + (1 + C_f + C_f ^ 2) * ((K : ℝ) / S.card) ^ 7)
Proof (Lean source)
-- @node: target_bin_height_eighth_moment_le lemma target_bin_height_eighth_moment_le (c_f C_f L : ℝ) (P : TransportLaw) (n K : ℕ) (hP : ModelClass c_f C_f L P n) (hK : 0 < K) (S : Finset (Fin n)) (hS : 0 < S.card) (l : Fin K) : (∫ x, (iidBlockHeight K S (targetCellScore K l) x - (K : ℝ) * ∫ o, targetCellScore K l o ∂targetXLaw P) ^ 8 ∂Measure.pi (fun _ : Fin n => targetXLaw P)) ≤ (factorial 8 : ℝ) * ((1 + C_f + C_f ^ 2) ^ 4 * ((K : ℝ) / S.card) ^ 4 + (1 + C_f + C_f ^ 2) * ((K : ℝ) / S.card) ^ 7) := by letI : IsProbabilityMeasure (targetXLaw P) := targetXLaw_isProbabilityMeasure c_f C_f L P n hP have hv := target_same_cell_covariance_le c_f C_f L P n K hP hK l rw [covariance_self (measurable_targetCellScore K l).aemeasurable] at hv apply iidBlockHeight_eighth_moment_le S hS hK _ (measurable_targetCellScore K l) (targetCellScore_mem_unit_interval K l) _ · nlinarith [sq_nonneg C_f] · exact (le_abs_self _).trans (hv.trans (bin_variance_envelope_le C_f hK))
CausalSmith.Stat.TransportCaceRoughnuisanceLength.target_bin_height_eighth_moment_le · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/PilotEighthMoment.lean:83
theorem source_markedHistogram_eighth_moment_le

Transfer the eighth bin moment to the actual source sample channel. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n K :
ℕ
hn :
threshold ≤ n
hP :
ModelClass c_f C_f L P n
hK :
0 < K
b :
Fin 4
l :
Fin K
i :
Fin 7
hi :
i ≠ 0
(∫ w, (markedHistogram w i K b (midpoint K l) - cellAverage (fun y => markedDensityVector c_f C_f L P n hP y i) K l) ^ 8 ∂dataLaw P n n)
≤ (factorial 8 : ℝ) * ((1 + C_f + C_f ^ 2) ^ 4 * ((K : ℝ) / blockSize n b) ^ 4 + (1 + C_f + C_f ^ 2) * ((K : ℝ) / blockSize n b) ^ 7)
Proof (Lean source)
-- @node: source_markedHistogram_eighth_moment_le lemma source_markedHistogram_eighth_moment_le (c_f C_f L : ℝ) (P : TransportLaw) (n K : ℕ) (hn : threshold ≤ n) (hP : ModelClass c_f C_f L P n) (hK : 0 < K) (b : Fin 4) (l : Fin K) (i : Fin 7) (hi : i ≠ 0) : (∫ w, (markedHistogram w i K b (midpoint K l) - cellAverage (fun y => markedDensityVector c_f C_f L P n hP y i) K l) ^ 8 ∂dataLaw P n n) ≤ (factorial 8 : ℝ) * ((1 + C_f + C_f ^ 2) ^ 4 * ((K : ℝ) / blockSize n b) ^ 4 + (1 + C_f + C_f ^ 2) * ((K : ℝ) / blockSize n b) ^ 7) := by letI : IsProbabilityMeasure (sourceObsLaw P) := sourceObsLaw_isProbabilityMeasure c_f C_f L P n hP letI : IsProbabilityMeasure (targetXLaw P) := targetXLaw_isProbabilityMeasure c_f C_f L P n hP have hcard : 0 < (blockIdx n b).card := by rw [block_card] exact blockSize_pos_of_threshold n hn b have hmean : (K : ℝ) * (∫ o, sourceCellScore i K l o ∂sourceObsLaw P) = cellAverage (fun y => markedDensityVector c_f C_f L P n hP y i) K l := by rw [sourceCellScore_integral_eq_density c_f C_f L P n K hP hK l i hi] rfl simp_rw [markedHistogram_midpoint_source hn hK _ i hi] rw [dataLaw_eq_source_target_pi c_f C_f L P n hP] let g := fun x : Fin n → SourceObs => (iidBlockHeight K (blockIdx n b) (sourceCellScore i K l) x - cellAverage (fun y => markedDensityVector c_f C_f L P n hP y i) K l) ^ 8 have hg : Measurable g := by dsimp [g] fun_prop have hp := measurePreserving_fst (μ := Measure.pi (fun _ : Fin n => sourceObsLaw P)) (ν := Measure.pi (fun _ : Fin n => targetXLaw P)) have hm : AEStronglyMeasurable g (((Measure.pi (fun _ : Fin n => sourceObsLaw P)).prod (Measure.pi (fun _ : Fin n => targetXLaw P))).map fst) := by rw [hp.map_eq] exact hg.aestronglyMeasurable have htransfer := (integral_map hp.measurable.aemeasurable hm).symm rw [hp.map_eq] at htransfer change (∫ w, g w.1 ∂(Measure.pi (fun _ : Fin n => sourceObsLaw P)).prod (Measure.pi (fun _ : Fin n => targetXLaw P))) ≤ _ rw [htransfer] have h := source_bin_height_eighth_moment_le c_f C_f L P n K hP hK (blockIdx n b) hcard l i simpa only [g, hmean, block_card] using h
CausalSmith.Stat.TransportCaceRoughnuisanceLength.source_markedHistogram_eighth_moment_le · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/PilotEighthMoment.lean:104
theorem target_markedHistogram_eighth_moment_le

Transfer the eighth bin moment to the actual target sample channel. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n K :
ℕ
hn :
threshold ≤ n
hP :
ModelClass c_f C_f L P n
hK :
0 < K
b :
Fin 4
l :
Fin K
(∫ w, (markedHistogram w 0 K b (midpoint K l) - cellAverage P.fT K l) ^ 8 ∂dataLaw P n n)
≤ (factorial 8 : ℝ) * ((1 + C_f + C_f ^ 2) ^ 4 * ((K : ℝ) / blockSize n b) ^ 4 + (1 + C_f + C_f ^ 2) * ((K : ℝ) / blockSize n b) ^ 7)
Proof (Lean source)
-- @node: target_markedHistogram_eighth_moment_le lemma target_markedHistogram_eighth_moment_le (c_f C_f L : ℝ) (P : TransportLaw) (n K : ℕ) (hn : threshold ≤ n) (hP : ModelClass c_f C_f L P n) (hK : 0 < K) (b : Fin 4) (l : Fin K) : (∫ w, (markedHistogram w 0 K b (midpoint K l) - cellAverage P.fT K l) ^ 8 ∂dataLaw P n n) ≤ (factorial 8 : ℝ) * ((1 + C_f + C_f ^ 2) ^ 4 * ((K : ℝ) / blockSize n b) ^ 4 + (1 + C_f + C_f ^ 2) * ((K : ℝ) / blockSize n b) ^ 7) := by letI : IsProbabilityMeasure (sourceObsLaw P) := sourceObsLaw_isProbabilityMeasure c_f C_f L P n hP letI : IsProbabilityMeasure (targetXLaw P) := targetXLaw_isProbabilityMeasure c_f C_f L P n hP have hcard : 0 < (blockIdx n b).card := by rw [block_card] exact blockSize_pos_of_threshold n hn b have hmean : (K : ℝ) * (targetXLaw P (cell K l)).toReal = cellAverage P.fT K l := by change (K : ℝ) * (targetXLaw P).real (cell K l) = _ rw [← integral_indicator_one (measurableSet_cell K l)] change (K : ℝ) * (∫ y, targetCellScore K l y ∂targetXLaw P) = _ rw [targetCellScore_integral_eq_density c_f C_f L P n K hP hK] rfl simp_rw [markedHistogram_midpoint_target hn hK] rw [dataLaw_eq_source_target_pi c_f C_f L P n hP] let g := fun x : Fin n → ℝ => (iidBlockHeight K (blockIdx n b) (targetCellScore K l) x - cellAverage P.fT K l) ^ 8 have hg : Measurable g := by dsimp [g] fun_prop have hp := measurePreserving_snd (μ := Measure.pi (fun _ : Fin n => sourceObsLaw P)) (ν := Measure.pi (fun _ : Fin n => targetXLaw P)) have hm : AEStronglyMeasurable g (((Measure.pi (fun _ : Fin n => sourceObsLaw P)).prod (Measure.pi (fun _ : Fin n => targetXLaw P))).map snd) := by rw [hp.map_eq] exact hg.aestronglyMeasurable have htransfer := (integral_map hp.measurable.aemeasurable hm).symm rw [hp.map_eq] at htransfer change (∫ w, g w.2 ∂(Measure.pi (fun _ : Fin n => sourceObsLaw P)).prod (Measure.pi (fun _ : Fin n => targetXLaw P))) ≤ _ rw [htransfer] have h := target_bin_height_eighth_moment_le c_f C_f L P n K hP hK (blockIdx n b) hcard l have hscoreMean : (∫ y, targetCellScore K l y ∂targetXLaw P) = (targetXLaw P (cell K l)).toReal := integral_indicator_one (measurableSet_cell K l) rw [hscoreMean] at h simpa only [g, hmean, block_card] using h
CausalSmith.Stat.TransportCaceRoughnuisanceLength.target_markedHistogram_eighth_moment_le · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/PilotEighthMoment.lean:150
theorem markedHistogram_eighth_moment_le

All seven observable histogram channels obey equation (3). Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n K :
ℕ
hn :
threshold ≤ n
hP :
ModelClass c_f C_f L P n
hK :
0 < K
b :
Fin 4
l :
Fin K
i :
Fin 7
(∫ w, (markedHistogram w i K b (midpoint K l) - cellAverage (fun y => markedDensityVector c_f C_f L P n hP y i) K l) ^ 8 ∂dataLaw P n n)
≤ (factorial 8 : ℝ) * ((1 + C_f + C_f ^ 2) ^ 4 * ((K : ℝ) / blockSize n b) ^ 4 + (1 + C_f + C_f ^ 2) * ((K : ℝ) / blockSize n b) ^ 7)
Proof (Lean source)
-- @node: markedHistogram_eighth_moment_le lemma markedHistogram_eighth_moment_le (c_f C_f L : ℝ) (P : TransportLaw) (n K : ℕ) (hn : threshold ≤ n) (hP : ModelClass c_f C_f L P n) (hK : 0 < K) (b : Fin 4) (l : Fin K) (i : Fin 7) : (∫ w, (markedHistogram w i K b (midpoint K l) - cellAverage (fun y => markedDensityVector c_f C_f L P n hP y i) K l) ^ 8 ∂dataLaw P n n) ≤ (factorial 8 : ℝ) * ((1 + C_f + C_f ^ 2) ^ 4 * ((K : ℝ) / blockSize n b) ^ 4 + (1 + C_f + C_f ^ 2) * ((K : ℝ) / blockSize n b) ^ 7) := by by_cases hi : i = 0 · subst i simpa only [markedDensityVector, Matrix.cons_val_zero] using target_markedHistogram_eighth_moment_le c_f C_f L P n K hn hP hK b l · exact source_markedHistogram_eighth_moment_le c_f C_f L P n K hn hP hK b l i hi
CausalSmith.Stat.TransportCaceRoughnuisanceLength.markedHistogram_eighth_moment_le · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/PilotEighthMoment.lean:202
theorem integrable_markedHistogram_centered_eighth

The bounded histogram makes its centered eighth power integrable for every fixed cell. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n K :
ℕ
hn :
threshold ≤ n
hP :
ModelClass c_f C_f L P n
hK :
0 < K
i :
Fin 7
b :
Fin 4
l :
Fin K
c :
ℝ
Integrable (fun w : TwoSample n n => |markedHistogram w i K b (midpoint K l) - c| ^ 8) (dataLaw P n n)
Proof (Lean source)
-- @node: integrable_markedHistogram_centered_eighth lemma integrable_markedHistogram_centered_eighth (c_f C_f L : ℝ) (P : TransportLaw) (n K : ℕ) (hn : threshold ≤ n) (hP : ModelClass c_f C_f L P n) (hK : 0 < K) (i : Fin 7) (b : Fin 4) (l : Fin K) (c : ℝ) : Integrable (fun w : TwoSample n n => |markedHistogram w i K b (midpoint K l) - c| ^ 8) (dataLaw P n n) := by letI : IsProbabilityMeasure (sourceObsLaw P) := sourceObsLaw_isProbabilityMeasure c_f C_f L P n hP letI : IsProbabilityMeasure (targetXLaw P) := targetXLaw_isProbabilityMeasure c_f C_f L P n hP have hprob : IsProbabilityMeasure (dataLaw P n n) := by rw [dataLaw_eq_source_target_pi c_f C_f L P n hP] infer_instance letI := hprob apply (integrable_const (((K : ℝ) + |c|) ^ 8)).mono' · fun_prop · filter_upwards [] with w have hb := markedHistogram_mem_Icc hn hK w i b l have hab : |markedHistogram w i K b (midpoint K l) - c| ≤ K + |c| := (abs_sub _ _).trans (by rw [abs_of_nonneg hb.1]; linarith [hb.2]) simpa only [Real.norm_eq_abs, abs_pow, abs_abs] using pow_le_pow_left₀ (abs_nonneg _) hab 8
CausalSmith.Stat.TransportCaceRoughnuisanceLength.integrable_markedHistogram_centered_eighth · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/PilotEighthMoment.lean:220
theorem pilot_eighth_moment

Given the supplied inputs, the stated result about pilot eighth moment holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hn :
threshold ≤ n
hP :
ModelClass c_f C_f L P n
i :
Fin 7
x :
ℝ
hx :
(∫ ω, |pilot c_f C_f ω x i - markedDensityVector c_f C_f L P n hP x i| ^ (8 : ℕ) ∂dataLaw P n n)
≤ pilotEighthConstant C_f L * (n : ℝ) ^ (-(4 / 5 : ℝ))
Proof (Lean source)
lemma pilot_eighth_moment (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hn : threshold ≤ n) (hP : ModelClass c_f C_f L P n) (i : Fin 7) (x : ℝ) (hx : x ∈ covariateSpace) : (∫ ω, |pilot c_f C_f ω x i - markedDensityVector c_f C_f L P n hP x i| ^ (8 : ℕ) ∂dataLaw P n n) ≤ pilotEighthConstant C_f L * (n : ℝ) ^ (-(4 / 5 : ℝ)) := by have hK : 0 < pilotResolution n := by unfold pilotResolution dyadicResolution split_ifs <;> positivity obtain ⟨l, hl⟩ := exists_cell_of_mem_covariateSpace hK x hx let m := cellAverage (fun y => markedDensityVector c_f C_f L P n hP y i) (pilotResolution n) l let V := 1 + C_f + C_f ^ 2 let B := 2 ^ (8 : ℕ) * (3 * (1 + C_f) * L) ^ (8 : ℕ) * (5 : ℝ) ^ (4 / 5 : ℝ) * (n : ℝ) ^ (-(4 / 5 : ℝ)) letI : IsProbabilityMeasure (sourceObsLaw P) := sourceObsLaw_isProbabilityMeasure c_f C_f L P n hP letI : IsProbabilityMeasure (targetXLaw P) := targetXLaw_isProbabilityMeasure c_f C_f L P n hP have hprob : IsProbabilityMeasure (dataLaw P n n) := by rw [dataLaw_eq_source_target_pi c_f C_f L P n hP]; infer_instance letI := hprob have hi := integrable_markedHistogram_centered_eighth c_f C_f L P n (pilotResolution n) hn hP hK i 0 l m have hp (w : TwoSample n n) := pilot_error_eighth_sample_rate_split c_f C_f L P n hn hP w l x hl i simp_rw [markedHistogram_eq_midpoint_on_cell hK _ i 0 l x hl] at hp have hbound := integral_mono_of_nonneg (Filter.Eventually.of_forall (fun w => pow_nonneg (abs_nonneg _) 8)) ((hi.const_mul (2 ^ (7 : ℕ))).add (integrable_const B)) (Filter.Eventually.of_forall hp) simp only [Pi.add_apply] at hbound rw [integral_add (hi.const_mul (2 ^ (7 : ℕ))) (integrable_const B), integral_const_mul, integral_const] at hbound simp only [Measure.real, measure_univ, ENNReal.toReal_one, one_smul] at hbound have heven (z : ℝ) : |z| ^ (8 : ℕ) = z ^ (8 : ℕ) := by rw [show (8 : ℕ) = 2 * 4 from rfl, pow_mul, sq_abs, ← pow_mul] simp_rw [heven] at hbound ⊢ have hv := markedHistogram_eighth_moment_le c_f C_f L P n (pilotResolution n) hn hP hK 0 l i have hscales := pilotResolution_eighth_fluctuation_scales n hn have hV : 0 ≤ V := by dsimp [V]; nlinarith [sq_nonneg (C_f + 1 / 2)] have hfluct := add_le_add (mul_le_mul_of_nonneg_left hscales.1 (pow_nonneg hV 4)) (mul_le_mul_of_nonneg_left hscales.2 hV) have hscaled := mul_le_mul_of_nonneg_left hfluct (show 0 ≤ (2 : ℝ) ^ (7 : ℕ) * (factorial 8 : ℝ) by positivity) calc _ ≤ 2 ^ (7 : ℕ) * (∫ w, (markedHistogram w i (pilotResolution n) 0 (midpoint (pilotResolution n) l) - m) ^ 8 ∂dataLaw P n n) + B := hbound _ ≤ 2 ^ (7 : ℕ) * ((factorial 8 : ℝ) * (V ^ 4 * ((pilotResolution n : ℝ) / blockSize n 0) ^ 4 + V * ((pilotResolution n : ℝ) / blockSize n 0) ^ 7)) + B := add_le_add (mul_le_mul_of_nonneg_left hv (show (0 : ℝ) ≤ 2 ^ (7 : ℕ) by norm_num)) le_rfl _ ≤ pilotEighthConstant C_f L * (n : ℝ) ^ (-(4 / 5 : ℝ)) := by dsimp [pilotEighthConstant, V, B] at hscaled ⊢ nlinarith only [hscaled]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.pilot_eighth_moment · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/PilotEighthMoment.lean:246
CausalSmith.Stat.STAT_TransportCaceRoughnuisanceLength_Research.Helpers.CubicMse.PilotMoments 12 declarations Clipped pilot moment bounds

Clipped pilot moment bounds

Given the supplied inputs, the stated result about abs clip sub le holds.

Formal statement
lo hi x y :
ℝ
hlo :
lo ≤ y
hhi :
y ≤ hi
|clip lo hi x - y| ≤ |x - y|
Proof (Lean source)
lemma abs_clip_sub_le (lo hi x y : ℝ) (hlo : lo ≤ y) (hhi : y ≤ hi) : |clip lo hi x - y| ≤ |x - y| := by have hmin : |min hi x - y| ≤ |x - y| := by rcases le_total x hi with hx | hx · rw [min_eq_right hx] · rw [min_eq_left hx] rw [abs_of_nonneg (by linarith), abs_of_nonneg (by linarith)] linarith have hmax : |max lo (min hi x) - y| ≤ |min hi x - y| := by rcases le_total lo (min hi x) with hx | hx · rw [max_eq_right hx] · rw [max_eq_left hx] rw [abs_of_nonpos (by linarith), abs_of_nonpos (by linarith)] linarith exact le_trans hmax hmin
CausalSmith.Stat.TransportCaceRoughnuisanceLength.abs_clip_sub_le · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/PilotMoments.lean:14
theorem pilot_error_le_histogram_error

Given the supplied inputs, the stated result about pilot error le histogram error holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hn :
threshold ≤ n
hP :
ModelClass c_f C_f L P n
ω :
x :
ℝ
hx :
i :
Fin 7
|pilot c_f C_f ω x i - markedDensityVector c_f C_f L P n hP x i|
≤ |markedHistogram ω i (pilotResolution n) 0 x - markedDensityVector c_f C_f L P n hP x i|
Proof (Lean source)
lemma pilot_error_le_histogram_error (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hn : threshold ≤ n) (hP : ModelClass c_f C_f L P n) (ω : TwoSample n n) (x : ℝ) (hx : x ∈ covariateSpace) (i : Fin 7) : |pilot c_f C_f ω x i - markedDensityVector c_f C_f L P n hP x i| ≤ |markedHistogram ω i (pilotResolution n) 0 x - markedDensityVector c_f C_f L P n hP x i| := by have hrect := markedDensityVector_mem_clippingRectangle c_f C_f L P n hP x hx rcases hrect with ⟨h0, h1, h2, hrest⟩ have hlarge : ¬ n < threshold := by omega rw [pilot, if_neg hlarge] fin_cases i <;> simp only [clipChannel, if_true] <;> apply abs_clip_sub_le <;> first | exact h0.1 | exact h0.2 | exact h1.1 | exact h1.2 | exact h2.1 | exact h2.2 | exact (hrest _ (by decide)).1 | exact (hrest _ (by decide)).2
CausalSmith.Stat.TransportCaceRoughnuisanceLength.pilot_error_le_histogram_error · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/PilotMoments.lean:32
theorem HolderOn_abs_sub_le

The one-dimensional Hölder-ball condition controls function increments. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
f :
ℝ → ℝ
L :
ℝ
hf :
x y :
ℝ
hx :
hy :
|f x - f y| ≤ L * |x - y| ^ holderExponent
Proof (Lean source)
-- @node: HolderOn_abs_sub_le lemma HolderOn_abs_sub_le (f : ℝ → ℝ) (L : ℝ) (hf : HolderOn f L) (x y : ℝ) (hx : x ∈ covariateSpace) (hy : y ∈ covariateSpace) : |f x - f y| ≤ L * |x - y| ^ holderExponent := by have hceil : ⌈holderExponent⌉₊ = 1 := by apply (Nat.ceil_eq_iff (by decide)).2 norm_num [holderExponent] have h := hf.2.2.2 ![x] (by simpa using hx) ![y] (by simpa using hy) rw [hceil] at h simp only [Nat.sub_self, Nat.cast_zero, sub_zero] at h change ‖(continuousMultilinearCurryFin0 ℝ (Fin 1 → ℝ) ℝ).symm (f x) - (continuousMultilinearCurryFin0 ℝ (Fin 1 → ℝ) ℝ).symm (f y)‖ ≤ L * ‖![x] - ![y]‖ ^ holderExponent at h rw [← map_sub, LinearIsometryEquiv.norm_map] at h have heq : (![x] - ![y] : Fin 1 → ℝ) = fun _ => x - y := by ext i; fin_cases i; rfl simpa [heq, pi_norm_const, Real.norm_eq_abs] using h
CausalSmith.Stat.TransportCaceRoughnuisanceLength.HolderOn_abs_sub_le · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/PilotMoments.lean:50
theorem markedDensityVector_holder_modulus

All seven marked densities have the common Hölder modulus used in the pilot analysis. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hP :
ModelClass c_f C_f L P n
x y :
ℝ
hx :
hy :
i :
Fin 7
|markedDensityVector c_f C_f L P n hP x i - markedDensityVector c_f C_f L P n hP y i|
≤ 3 * (1 + C_f) * L * |x - y| ^ holderExponent
Proof (Lean source)
-- @node: markedDensityVector_holder_modulus lemma markedDensityVector_holder_modulus (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hP : ModelClass c_f C_f L P n) (x y : ℝ) (hx : x ∈ covariateSpace) (hy : y ∈ covariateSpace) (i : Fin 7) : |markedDensityVector c_f C_f L P n hP x i - markedDensityVector c_f C_f L P n hP y i| ≤ 3 * (1 + C_f) * L * |x - y| ^ holderExponent := by let d := |x - y| ^ holderExponent have hd : 0 ≤ d := Real.rpow_nonneg (abs_nonneg _) _ have hL : 0 ≤ L := hP.sourceHolder.1.le.trans' (by norm_num) have hC : 0 ≤ C_f := hP.sourceBounds.2.1.le.trans' (by norm_num) have hs := HolderOn_abs_sub_le P.fS L hP.sourceHolder x y hx hy have ht := HolderOn_abs_sub_le P.fT L hP.targetHolder x y hx hy have he := HolderOn_abs_sub_le P.e L hP.propensityHolder x y hx hy have hm (A z : Bool) := HolderOn_abs_sub_le (P.m A z) L (hP.armHolder.1 A z) x y hx hy have hfs (z : ℝ) (hz : z ∈ covariateSpace) : |P.fS z| ≤ C_f := by have hb := hP.sourceBounds.2.2.2.2.2 z hz rw [abs_of_nonneg (le_trans hP.sourceBounds.1.1.le hb.1)] exact hb.2 have hem (z : ℝ) (hz : z ∈ covariateSpace) : |P.e z| ≤ 1 ∧ |1 - P.e z| ≤ 1 := by have hb := hP.overlap z hz constructor <;> rw [abs_le] <;> constructor <;> linarith [hb.1, hb.2] have hmul (a b c e A B H J : ℝ) (ha : |a| ≤ A) (he' : |e| ≤ B) (hab : |a - b| ≤ H) (hce : |c - e| ≤ J) (hA : 0 ≤ A) (hB : 0 ≤ B) : |a * c - b * e| ≤ A * J + H * B := by calc _ = |a * (c - e) + (a - b) * e| := by congr 1; ring _ ≤ |a| * |c - e| + |a - b| * |e| := by simpa only [abs_mul] using abs_add_le (a * (c - e)) ((a - b) * e) _ ≤ _ := add_le_add (mul_le_mul ha hce (abs_nonneg _) hA) (mul_le_mul hab he' (abs_nonneg _) (le_trans (abs_nonneg _) hab)) have hq (z : Bool) : |P.fS x * (if z then P.e x else 1 - P.e x) - P.fS y * (if z then P.e y else 1 - P.e y)| ≤ (1 + C_f) * L * d := by have heg : |(if z then P.e x else 1 - P.e x) - (if z then P.e y else 1 - P.e y)| ≤ L * d := by cases z · change |1 - P.e x - (1 - P.e y)| ≤ _ rw [show 1 - P.e x - (1 - P.e y) = -(P.e x - P.e y) by ring, abs_neg] exact he · exact he have hgb : |(if z then P.e y else 1 - P.e y)| ≤ 1 := by cases z <;> simp only [Bool.false_eq_true, if_false, if_true] · exact (hem y hy).2 · exact (hem y hy).1 have hh := hmul _ _ _ _ C_f 1 (L * d) (L * d) (hfs x hx) hgb hs heg hC (by norm_num) convert hh using 1 <;> ring have hr (A z : Bool) : |P.fS x * (if z then P.e x else 1 - P.e x) * P.m A z x - P.fS y * (if z then P.e y else 1 - P.e y) * P.m A z y| ≤ 3 * (1 + C_f) * L * d := by have hqa : |P.fS x * (if z then P.e x else 1 - P.e x)| ≤ C_f := by rw [abs_mul] have hgb : |(if z then P.e x else 1 - P.e x)| ≤ 1 := by cases z · exact (hem x hx).2 · exact (hem x hx).1 simpa using mul_le_mul (hfs x hx) hgb (abs_nonneg _) hC have hmb : |P.m A z y| ≤ 1 := by have hb := (hP.armHolder.2.1 A z).2.2 y hy simpa [abs_of_nonneg hb.1] using hb.2 have hh := hmul _ _ _ _ C_f 1 ((1 + C_f) * L * d) (L * d) hqa hmb (hq z) (hm A z) hC (by norm_num) exact hh.trans (by nlinarith [mul_nonneg hC (mul_nonneg hL hd)]) have hq' (z : Bool) : |P.fS x * (if z then P.e x else 1 - P.e x) - P.fS y * (if z then P.e y else 1 - P.e y)| ≤ 3 * (1 + C_f) * L * d := (hq z).trans (by nlinarith [mul_nonneg (by linarith : 0 ≤ 1 + C_f) (mul_nonneg hL hd)]) fin_cases i · exact ht.trans (by nlinarith [mul_nonneg hC (mul_nonneg hL hd), mul_nonneg hL hd]) · exact hq' false · exact hq' true · exact hr true false · exact hr true true · exact hr false false · exact hr false true
CausalSmith.Stat.TransportCaceRoughnuisanceLength.markedDensityVector_holder_modulus · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/PilotMoments.lean:69

Splitting an error at an intermediate value costs at most the factor 2⁷ in its eighth power. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
u v w :
ℝ
|u - w| ^ (8 : ℕ) ≤ 2 ^ (7 : ℕ) * (|u - v| ^ (8 : ℕ) + |v - w| ^ (8 : ℕ))
Proof (Lean source)
-- @node: abs_sub_eighth_le lemma abs_sub_eighth_le (u v w : ℝ) : |u - w| ^ (8 : ℕ) ≤ 2 ^ (7 : ℕ) * (|u - v| ^ (8 : ℕ) + |v - w| ^ (8 : ℕ)) := by calc _ ≤ (|u - v| + |v - w|) ^ (8 : ℕ) := pow_le_pow_left₀ (abs_nonneg _) (abs_sub_le u v w) 8 _ ≤ _ := by simpa using add_pow_le (abs_nonneg (u - v)) (abs_nonneg (v - w)) 8
CausalSmith.Stat.TransportCaceRoughnuisanceLength.abs_sub_eighth_le · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/PilotMoments.lean:153
theorem pilot_error_eighth_split

The clipped pilot's eighth-power error splits into histogram fluctuation and deterministic bias. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hn :
threshold ≤ n
hP :
ModelClass c_f C_f L P n
ω :
x :
ℝ
hx :
i :
Fin 7
center :
ℝ
|pilot c_f C_f ω x i - markedDensityVector c_f C_f L P n hP x i| ^ (8 : ℕ)
≤ 2 ^ (7 : ℕ) * (|markedHistogram ω i (pilotResolution n) 0 x - center| ^ (8 : ℕ) + |center - markedDensityVector c_f C_f L P n hP x i| ^ (8 : ℕ))
Proof (Lean source)
-- @node: pilot_error_eighth_split lemma pilot_error_eighth_split (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hn : threshold ≤ n) (hP : ModelClass c_f C_f L P n) (ω : TwoSample n n) (x : ℝ) (hx : x ∈ covariateSpace) (i : Fin 7) (center : ℝ) : |pilot c_f C_f ω x i - markedDensityVector c_f C_f L P n hP x i| ^ (8 : ℕ) ≤ 2 ^ (7 : ℕ) * (|markedHistogram ω i (pilotResolution n) 0 x - center| ^ (8 : ℕ) + |center - markedDensityVector c_f C_f L P n hP x i| ^ (8 : ℕ)) := by exact (pow_le_pow_left₀ (abs_nonneg _) (pilot_error_le_histogram_error c_f C_f L P n hn hP ω x hx i) 8).trans (abs_sub_eighth_le _ center _)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.pilot_error_eighth_split · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/PilotMoments.lean:162
theorem centered_unit_mark_abs_le_one Lemma centered_unit_mark_abs_le_one in the paper ↗

Every centered bounded bin mark lies in the unit ball. This controls all multiplicities in the eighth-power index-pattern expansion. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
Ω :
f :
Ω → ℝ
hf :
hb :
∀ x, f x ∈ Icc (0 : ℝ) 1
x :
Ω
|f x - ∫ y, f y ∂μ| ≤ 1
Proof (Lean source)
-- @node: centered_unit_mark_abs_le_one lemma centered_unit_mark_abs_le_one {Ω : Type*} [MeasurableSpace Ω] (μ : Measure Ω) [IsProbabilityMeasure μ] (f : Ω → ℝ) (hf : Measurable f) (hb : ∀ x, f x ∈ Icc (0 : ℝ) 1) (x : Ω) : |f x - ∫ y, f y ∂μ| ≤ 1 := by have hi : Integrable f μ := by apply Integrable.of_bound hf.aestronglyMeasurable 1 filter_upwards [] with y simpa only [Real.norm_eq_abs, abs_of_nonneg (hb y).1] using (hb y).2 have hmean0 : 0 ≤ ∫ y, f y ∂μ := integral_nonneg (fun y => (hb y).1) have hmean1 : (∫ y, f y ∂μ) ≤ 1 := by simpa using integral_mono hi (integrable_const (1 : ℝ)) (fun y => (hb y).2) rw [abs_le] constructor <;> linarith [(hb x).1, (hb x).2]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.centered_unit_mark_abs_le_one · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/PilotMoments.lean:176
theorem centered_unit_mark_multiplicity_moment_le Lemma centered_unit_mark_multiplicity_moment_le in the paper ↗

Every multiplicity of at least two is controlled by the centered second moment of a bounded bin mark. Independence can then multiply these bounds over the distinct indices in a surviving eighth-power term. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
Ω :
f :
Ω → ℝ
hf :
hb :
∀ x, f x ∈ Icc (0 : ℝ) 1
k :
ℕ
hk :
2 ≤ k
|∫ x, (f x - ∫ y, f y ∂μ) ^ k ∂μ| ≤ ∫ x, (f x - ∫ y, f y ∂μ) ^ 2 ∂μ
Proof (Lean source)
-- @node: centered_unit_mark_multiplicity_moment_le lemma centered_unit_mark_multiplicity_moment_le {Ω : Type*} [MeasurableSpace Ω] (μ : Measure Ω) [IsProbabilityMeasure μ] (f : Ω → ℝ) (hf : Measurable f) (hb : ∀ x, f x ∈ Icc (0 : ℝ) 1) (k : ℕ) (hk : 2 ≤ k) : |∫ x, (f x - ∫ y, f y ∂μ) ^ k ∂μ| ≤ ∫ x, (f x - ∫ y, f y ∂μ) ^ 2 ∂μ := by have hunit := centered_unit_mark_abs_le_one μ f hf hb have hpoint (x : Ω) : |f x - ∫ y, f y ∂μ| ^ k ≤ (f x - ∫ y, f y ∂μ) ^ 2 := by have hp : |f x - ∫ y, f y ∂μ| ^ (k - 2) ≤ 1 := pow_le_one₀ (abs_nonneg _) (hunit x) rw [show k = 2 + (k - 2) by omega, pow_add] simpa only [sq_abs, mul_one] using mul_le_mul_of_nonneg_left hp (sq_nonneg |f x - ∫ y, f y ∂μ|) have hi2 : Integrable (fun x => (f x - ∫ y, f y ∂μ) ^ 2) μ := by apply Integrable.of_bound (by fun_prop) 1 filter_upwards [] with x simpa only [Real.norm_eq_abs, abs_pow, sq_abs] using pow_le_one₀ (abs_nonneg _) (hunit x) (n := 2) calc _ ≤ ∫ x, |(f x - ∫ y, f y ∂μ) ^ k| ∂μ := abs_integral_le_integral_abs _ ≤ _ := integral_mono_of_nonneg (Filter.Eventually.of_forall (fun x => abs_nonneg _)) hi2 (Filter.Eventually.of_forall (fun x => by simpa only [abs_pow] using hpoint x))
CausalSmith.Stat.TransportCaceRoughnuisanceLength.centered_unit_mark_multiplicity_moment_le · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/PilotMoments.lean:193
theorem integral_centered_unit_mark_eq_zero Lemma integral_centered_unit_mark_eq_zero in the paper ↗

Centering a bounded bin mark removes the singleton moment exactly. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
Ω :
f :
Ω → ℝ
hf :
hb :
∀ x, f x ∈ Icc (0 : ℝ) 1
(∫ x, (f x - ∫ y, f y ∂μ) ∂μ) = 0
Proof (Lean source)
-- @node: integral_centered_unit_mark_eq_zero lemma integral_centered_unit_mark_eq_zero {Ω : Type*} [MeasurableSpace Ω] (μ : Measure Ω) [IsProbabilityMeasure μ] (f : Ω → ℝ) (hf : Measurable f) (hb : ∀ x, f x ∈ Icc (0 : ℝ) 1) : (∫ x, (f x - ∫ y, f y ∂μ) ∂μ) = 0 := by have hi : Integrable f μ := by apply Integrable.of_bound hf.aestronglyMeasurable 1 filter_upwards [] with x simpa only [Real.norm_eq_abs, abs_of_nonneg (hb x).1] using (hb x).2 rw [integral_sub hi (integrable_const _)] simp
CausalSmith.Stat.TransportCaceRoughnuisanceLength.integral_centered_unit_mark_eq_zero · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/PilotMoments.lean:222
theorem iid_centered_unit_mark_singleton_monomial_zero Lemma iid_centered_unit_mark_singleton_monomial_zero in the paper ↗

In the product experiment, any monomial with a singleton sample index has zero expectation. This is the exact cancellation used before counting the surviving eighth-power index patterns. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
Ω :
f :
Ω → ℝ
hf :
hb :
∀ x, f x ∈ Icc (0 : ℝ) 1
n :
ℕ
k :
Fin n → ℕ
r :
Fin n
hr :
k r = 1
(∫ x : Fin n → Ω, ∏ j, (f (x j) - ∫ y, f y ∂μ) ^ k j ∂Measure.pi (fun _ : Fin n => μ)) = 0
Proof (Lean source)
-- @node: iid_centered_unit_mark_singleton_monomial_zero lemma iid_centered_unit_mark_singleton_monomial_zero {Ω : Type*} [MeasurableSpace Ω] (μ : Measure Ω) [IsProbabilityMeasure μ] (f : Ω → ℝ) (hf : Measurable f) (hb : ∀ x, f x ∈ Icc (0 : ℝ) 1) {n : ℕ} (k : Fin n → ℕ) (r : Fin n) (hr : k r = 1) : (∫ x : Fin n → Ω, ∏ j, (f (x j) - ∫ y, f y ∂μ) ^ k j ∂Measure.pi (fun _ : Fin n => μ)) = 0 := by rw [integral_fintype_prod_eq_prod (fun j x => (f x - ∫ y, f y ∂μ) ^ k j)] apply Finset.prod_eq_zero (Finset.mem_univ r) rw [hr] simp only [pow_one] exact integral_centered_unit_mark_eq_zero μ f hf hb
CausalSmith.Stat.TransportCaceRoughnuisanceLength.iid_centered_unit_mark_singleton_monomial_zero · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/PilotMoments.lean:235
theorem iid_centered_unit_mark_surviving_monomial_le Lemma iid_centered_unit_mark_surviving_monomial_le in the paper ↗

For a surviving monomial, independence bounds the product of the multiplicity moments by one variance factor per distinct sample index. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
Ω :
f :
Ω → ℝ
hf :
hb :
∀ x, f x ∈ Icc (0 : ℝ) 1
m :
ℕ
k :
Fin m → ℕ
hk :
∀ j, 2 ≤ k j
|∫ x : Fin m → Ω, ∏ j, (f (x j) - ∫ y, f y ∂μ) ^ k j ∂Measure.pi (fun _ : Fin m => μ)|
≤ (∫ x, (f x - ∫ y, f y ∂μ) ^ 2 ∂μ) ^ m
Proof (Lean source)
-- @node: iid_centered_unit_mark_surviving_monomial_le lemma iid_centered_unit_mark_surviving_monomial_le {Ω : Type*} [MeasurableSpace Ω] (μ : Measure Ω) [IsProbabilityMeasure μ] (f : Ω → ℝ) (hf : Measurable f) (hb : ∀ x, f x ∈ Icc (0 : ℝ) 1) {m : ℕ} (k : Fin m → ℕ) (hk : ∀ j, 2 ≤ k j) : |∫ x : Fin m → Ω, ∏ j, (f (x j) - ∫ y, f y ∂μ) ^ k j ∂Measure.pi (fun _ : Fin m => μ)| ≤ (∫ x, (f x - ∫ y, f y ∂μ) ^ 2 ∂μ) ^ m := by rw [integral_fintype_prod_eq_prod (fun j x => (f x - ∫ y, f y ∂μ) ^ k j), Finset.abs_prod] calc _ ≤ ∏ _j : Fin m, (∫ x, (f x - ∫ y, f y ∂μ) ^ 2 ∂μ) := by apply Finset.prod_le_prod · intro j hj exact abs_nonneg _ · intro j hj exact centered_unit_mark_multiplicity_moment_le μ f hf hb (k j) (hk j) _ = _ := by simp
CausalSmith.Stat.TransportCaceRoughnuisanceLength.iid_centered_unit_mark_surviving_monomial_le · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/PilotMoments.lean:252
def pilotEighthConstant

The pilot eighth constant object is defined from the supplied inputs.

Definition (Lean source)
C_f L :
ℝ
pilotEighthConstant C_f L :
ℝ
H :
3 * (1 + C_f) * L
V :
1 + C_f + C_f ^ 2
2 ^ (7 : ℕ) * (factorial 8 : ℝ) * (V ^ 4 * 5 ^ ((4 : ℝ) / 5) + V * 5 ^ ((7 : ℝ) / 5))
+ 2 ^ (8 : ℕ) * H ^ 8 * 5 ^ ((4 : ℝ) / 5)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.pilotEighthConstant · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/PilotMoments.lean:272
CausalSmith.Stat.STAT_TransportCaceRoughnuisanceLength_Research.Helpers.CubicMse.PilotProjection 12 declarations The seven marked densities have Hölder modulus 3 (1 + C_f) L.

Deterministic cell projection bias for the clipped pilot

The seven marked densities have Hölder modulus 3 (1 + C_f) L. Cell averaging therefore introduces at most this modulus times the cell width to power 1/8. Together with clipping contraction, this separates eighth-power pilot error into histogram fluctuation and a deterministic projection contribution.

Two points in the same histogram cell are separated by at most its width. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
K :
ℕ
hK :
0 < K
l :
Fin K
x y :
ℝ
hx :
x ∈ cell K l
hy :
y ∈ cell K l
|x - y| ≤ 1 / (K : ℝ)
Proof (Lean source)
-- @node: cell_distance_le_inv lemma cell_distance_le_inv {K : ℕ} (hK : 0 < K) (l : Fin K) (x y : ℝ) (hx : x ∈ cell K l) (hy : y ∈ cell K l) : |x - y| ≤ 1 / (K : ℝ) := by have hKr : (0 : ℝ) < K := by exact_mod_cast hK unfold cell at hx hy split_ifs at hx hy with hlast · have hl : (l.val : ℝ) + 1 = K := by exact_mod_cast hlast have hwidth : 1 - (l.val : ℝ) / K = 1 / K := by apply (eq_div_iff hKr.ne').2 field_simp linarith rw [abs_le] constructor <;> linarith [hx.1, hx.2, hy.1, hy.2] · rw [abs_le] have hwidth : ((l.val : ℝ) + 1) / K - (l.val : ℝ) / K = 1 / K := by ring constructor <;> linarith [hx.1, hx.2, hy.1, hy.2]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.cell_distance_le_inv · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/PilotProjection.lean:18
theorem cellAverage_sub_le_of_oscillation Lemma cellAverage_sub_le_of_oscillation in the paper ↗

Averaging on a cell preserves a uniform bound on oscillation around a fixed value. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
K :
ℕ
hK :
0 < K
l :
Fin K
f :
ℝ → ℝ
c B :
ℝ
hf :
IntegrableOn f (cell K l)
hB :
∀ y ∈ cell K l, |f y - c| ≤ B
|cellAverage f K l - c| ≤ B
Proof (Lean source)
-- @node: cellAverage_sub_le_of_oscillation lemma cellAverage_sub_le_of_oscillation {K : ℕ} (hK : 0 < K) (l : Fin K) (f : ℝ → ℝ) (c B : ℝ) (hf : IntegrableOn f (cell K l)) (hB : ∀ y ∈ cell K l, |f y - c| ≤ B) : |cellAverage f K l - c| ≤ B := by have hKr : (0 : ℝ) < K := by exact_mod_cast hK have hvol := volume_cell hK l have hreal : (volume.restrict (cell K l)).real univ = 1 / (K : ℝ) := by rw [Measure.real, Measure.restrict_apply_univ, hvol, ENNReal.toReal_ofReal (by positivity)] let : IsFiniteMeasure (volume.restrict (cell K l)) := ⟨by rw [Measure.restrict_apply_univ, hvol]; exact ENNReal.ofReal_lt_top⟩ have hi : Integrable (fun y => f y - c) (volume.restrict (cell K l)) := hf.sub (integrable_const c) have heq : cellAverage f K l - c = (K : ℝ) * ∫ y in cell K l, f y - c := by rw [integral_sub hf (integrable_const c), integral_const] simp only [smul_eq_mul] rw [hreal] unfold cellAverage field_simp rw [heq, abs_mul, abs_of_pos hKr] calc (K : ℝ) * |∫ y in cell K l, f y - c| ≤ (K : ℝ) * ∫ y in cell K l, |f y - c| := by gcongr simpa only [Real.norm_eq_abs] using norm_integral_le_integral_norm (fun y => f y - c) _ ≤ (K : ℝ) * ∫ _y in cell K l, B := by apply mul_le_mul_of_nonneg_left _ hKr.le exact integral_mono_ae hi.abs (integrable_const B) (ae_restrict_of_forall_mem (measurableSet_cell K l) fun y hy => hB y hy) _ = B := by rw [integral_const] simp only [smul_eq_mul] rw [hreal] field_simp
CausalSmith.Stat.TransportCaceRoughnuisanceLength.cellAverage_sub_le_of_oscillation · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/PilotProjection.lean:37
theorem markedDensityVector_continuousOn

Each marked density is continuous on the covariate interval. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hP :
ModelClass c_f C_f L P n
i :
Fin 7
ContinuousOn (fun x => markedDensityVector c_f C_f L P n hP x i) covariateSpace
Proof (Lean source)
-- @node: markedDensityVector_continuousOn lemma markedDensityVector_continuousOn (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hP : ModelClass c_f C_f L P n) (i : Fin 7) : ContinuousOn (fun x => markedDensityVector c_f C_f L P n hP x i) covariateSpace := by have hc (f : ℝ → ℝ) (hf : HolderOn f L) : ContinuousOn f covariateSpace := by have hmap : ContinuousOn (fun x : ℝ => ![x]) covariateSpace := by fun_prop have hmaps : MapsTo (fun x : ℝ => ![x]) covariateSpace {v : Fin 1 → ℝ | v 0 ∈ covariateSpace} := by intro x hx; simpa using hx simpa [Function.comp_def] using hf.2.1.continuousOn.comp hmap hmaps have hs := hc P.fS hP.sourceHolder have ht := hc P.fT hP.targetHolder have he := hc P.e hP.propensityHolder have hm (A z : Bool) := hc (P.m A z) (hP.armHolder.1 A z) fin_cases i <;> dsimp [markedDensityVector] <;> fun_prop
CausalSmith.Stat.TransportCaceRoughnuisanceLength.markedDensityVector_continuousOn · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/PilotProjection.lean:74
theorem markedDensityVector_cell_bias

The marked-density projection bias is bounded by the common Hölder modulus times cell width. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n K :
ℕ
hP :
ModelClass c_f C_f L P n
hK :
0 < K
l :
Fin K
x :
ℝ
hx :
x ∈ cell K l
i :
Fin 7
|cellAverage (fun y => markedDensityVector c_f C_f L P n hP y i) K l
- markedDensityVector c_f C_f L P n hP x i|
≤ 3 * (1 + C_f) * L * (1 / (K : ℝ)) ^ holderExponent
Proof (Lean source)
-- @node: markedDensityVector_cell_bias lemma markedDensityVector_cell_bias (c_f C_f L : ℝ) (P : TransportLaw) (n K : ℕ) (hP : ModelClass c_f C_f L P n) (hK : 0 < K) (l : Fin K) (x : ℝ) (hx : x ∈ cell K l) (i : Fin 7) : |cellAverage (fun y => markedDensityVector c_f C_f L P n hP y i) K l - markedDensityVector c_f C_f L P n hP x i| ≤ 3 * (1 + C_f) * L * (1 / (K : ℝ)) ^ holderExponent := by have hc := markedDensityVector_continuousOn c_f C_f L P n hP i have hint : IntegrableOn (fun y => markedDensityVector c_f C_f L P n hP y i) (cell K l) := (hc.integrableOn_Icc).mono_set (cell_subset_covariateSpace hK l) apply cellAverage_sub_le_of_oscillation hK l _ _ _ hint intro y hy have hxy := markedDensityVector_holder_modulus c_f C_f L P n hP y x (cell_subset_covariateSpace hK l hy) (cell_subset_covariateSpace hK l hx) i refine hxy.trans ?_ apply mul_le_mul_of_nonneg_left (Real.rpow_le_rpow (abs_nonneg _) (cell_distance_le_inv hK l y x hy hx) (by norm_num [holderExponent])) have hC : 0 ≤ C_f := hP.sourceBounds.2.1.le.trans' (by norm_num) have hL : 0 ≤ L := hP.sourceHolder.1.le.trans' (by norm_num) positivity
CausalSmith.Stat.TransportCaceRoughnuisanceLength.markedDensityVector_cell_bias · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/PilotProjection.lean:91
theorem pilot_error_eighth_projection_bound

The clipped pilot's eighth-power error is controlled by its centered histogram fluctuation plus the explicit H⁸/K₀ projection-bias contribution. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hn :
threshold ≤ n
hP :
ModelClass c_f C_f L P n
ω :
l :
Fin (pilotResolution n)
x :
ℝ
hx :
x ∈ cell (pilotResolution n) l
i :
Fin 7
|pilot c_f C_f ω x i - markedDensityVector c_f C_f L P n hP x i| ^ (8 : ℕ)
≤ 2 ^ (7 : ℕ) * (|markedHistogram ω i (pilotResolution n) 0 x - cellAverage (fun y => markedDensityVector c_f C_f L P n hP y i) (pilotResolution n) l| ^ (8 : ℕ) + (3 * (1 + C_f) * L) ^ (8 : ℕ) / (pilotResolution n : ℝ))
Proof (Lean source)
-- @node: pilot_error_eighth_projection_bound lemma pilot_error_eighth_projection_bound (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hn : threshold ≤ n) (hP : ModelClass c_f C_f L P n) (ω : TwoSample n n) (l : Fin (pilotResolution n)) (x : ℝ) (hx : x ∈ cell (pilotResolution n) l) (i : Fin 7) : |pilot c_f C_f ω x i - markedDensityVector c_f C_f L P n hP x i| ^ (8 : ℕ) ≤ 2 ^ (7 : ℕ) * (|markedHistogram ω i (pilotResolution n) 0 x - cellAverage (fun y => markedDensityVector c_f C_f L P n hP y i) (pilotResolution n) l| ^ (8 : ℕ) + (3 * (1 + C_f) * L) ^ (8 : ℕ) / (pilotResolution n : ℝ)) := by have hK : 0 < pilotResolution n := by unfold pilotResolution dyadicResolution split_ifs <;> positivity have hb := markedDensityVector_cell_bias c_f C_f L P n (pilotResolution n) hP hK l x hx i have hp := pow_le_pow_left₀ (abs_nonneg _) hb 8 have heq : (3 * (1 + C_f) * L * (1 / (pilotResolution n : ℝ)) ^ holderExponent) ^ (8 : ℕ) = (3 * (1 + C_f) * L) ^ (8 : ℕ) / (pilotResolution n : ℝ) := by have hwidth : 0 ≤ 1 / (pilotResolution n : ℝ) := (one_div_pos.mpr (Nat.cast_pos.mpr hK)).le rw [mul_pow, ← Real.rpow_mul_natCast hwidth, show holderExponent * ((8 : ℕ) : ℝ) = 1 by norm_num [holderExponent], Real.rpow_one] ring rw [heq] at hp exact (pilot_error_eighth_split c_f C_f L P n hn hP ω x (cell_subset_covariateSpace hK l hx) i (cellAverage (fun y => markedDensityVector c_f C_f L P n hP y i) (pilotResolution n) l)).trans (mul_le_mul_of_nonneg_left (add_le_add le_rfl hp) (by norm_num))
CausalSmith.Stat.TransportCaceRoughnuisanceLength.pilot_error_eighth_projection_bound · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/PilotProjection.lean:115
theorem pilot_eighth_projection_bias_rate

The deterministic eighth-power pilot bias has precisely the constant in equation (6). Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
n :
ℕ
hn :
threshold ≤ n
C_f L :
ℝ
2 ^ (7 : ℕ) * ((3 * (1 + C_f) * L) ^ (8 : ℕ) / (pilotResolution n : ℝ))
≤ 2 ^ (8 : ℕ) * (3 * (1 + C_f) * L) ^ (8 : ℕ) * (5 : ℝ) ^ (4 / 5 : ℝ) * (n : ℝ) ^ (-(4 / 5 : ℝ))
Proof (Lean source)
-- @node: pilot_eighth_projection_bias_rate lemma pilot_eighth_projection_bias_rate (n : ℕ) (hn : threshold ≤ n) (C_f L : ℝ) : 2 ^ (7 : ℕ) * ((3 * (1 + C_f) * L) ^ (8 : ℕ) / (pilotResolution n : ℝ)) ≤ 2 ^ (8 : ℕ) * (3 * (1 + C_f) * L) ^ (8 : ℕ) * (5 : ℝ) ^ (4 / 5 : ℝ) * (n : ℝ) ^ (-(4 / 5 : ℝ)) := by have h := mul_le_mul_of_nonneg_left (pilotResolution_inv_le_sample_rate n hn) (show 0 ≤ (2 : ℝ) ^ (7 : ℕ) * (3 * (1 + C_f) * L) ^ (8 : ℕ) by positivity) convert h using 1 <;> first | rfl | ring
CausalSmith.Stat.TransportCaceRoughnuisanceLength.pilot_eighth_projection_bias_rate · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/PilotProjection.lean:150
theorem pilot_error_eighth_sample_rate_split

Clipping and the exact dyadic bias rate reduce the pointwise pilot error to its centered histogram fluctuation, without a stochastic bound as a premise. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hn :
threshold ≤ n
hP :
ModelClass c_f C_f L P n
ω :
x :
ℝ
hx :
x ∈ cell (pilotResolution n) l
i :
Fin 7
|pilot c_f C_f ω x i - markedDensityVector c_f C_f L P n hP x i| ^ (8 : ℕ)
≤ 2 ^ (7 : ℕ) * |markedHistogram ω i (pilotResolution n) 0 x
- cellAverage (fun y => markedDensityVector c_f C_f L P n hP y i) (pilotResolution n) l| ^ (8 : ℕ)
+ 2 ^ (8 : ℕ) * (3 * (1 + C_f) * L) ^ (8 : ℕ) * (5 : ℝ) ^ (4 / 5 : ℝ) * (n : ℝ) ^ (-(4 / 5 : ℝ))
Proof (Lean source)
-- @node: pilot_error_eighth_sample_rate_split lemma pilot_error_eighth_sample_rate_split (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hn : threshold ≤ n) (hP : ModelClass c_f C_f L P n) (ω : TwoSample n n) (l : Fin (pilotResolution n)) (x : ℝ) (hx : x ∈ cell (pilotResolution n) l) (i : Fin 7) : |pilot c_f C_f ω x i - markedDensityVector c_f C_f L P n hP x i| ^ (8 : ℕ) ≤ 2 ^ (7 : ℕ) * |markedHistogram ω i (pilotResolution n) 0 x - cellAverage (fun y => markedDensityVector c_f C_f L P n hP y i) (pilotResolution n) l| ^ (8 : ℕ) + 2 ^ (8 : ℕ) * (3 * (1 + C_f) * L) ^ (8 : ℕ) * (5 : ℝ) ^ (4 / 5 : ℝ) * (n : ℝ) ^ (-(4 / 5 : ℝ)) := by have h := pilot_error_eighth_projection_bound c_f C_f L P n hn hP ω l x hx i rw [mul_add] at h exact h.trans (add_le_add_right (pilot_eighth_projection_bias_rate n hn C_f L) _)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.pilot_error_eighth_sample_rate_split · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/PilotProjection.lean:161
theorem quadratic_cell_projection_identity Lemma quadratic_cell_projection_identity in the paper ↗

After removing the two one-residual terms, the quadratic projection error is exactly the product of the two within-cell residuals. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
K :
ℕ
hK :
0 < K
l :
Fin K
f g :
ℝ → ℝ
d e c :
ℝ
hf0 :
(∫ x in cell K l, f x) = 0
hg0 :
(∫ x in cell K l, g x) = 0
(∫ x in cell K l, c * ((d + f x) * (e + g x) - d * e)) = ∫ x in cell K l, c * (f x * g x)
Proof (Lean source)
-- @node: quadratic_cell_projection_identity lemma quadratic_cell_projection_identity {K : ℕ} (hK : 0 < K) (l : Fin K) (f g : ℝ → ℝ) (hf : ContinuousOn f covariateSpace) (hg : ContinuousOn g covariateSpace) (d e c : ℝ) (hf0 : (∫ x in cell K l, f x) = 0) (hg0 : (∫ x in cell K l, g x) = 0) : (∫ x in cell K l, c * ((d + f x) * (e + g x) - d * e)) = ∫ x in cell K l, c * (f x * g x) := by have hi (u : ℝ → ℝ) (hu : ContinuousOn u covariateSpace) : IntegrableOn u (cell K l) := hu.integrableOn_Icc.mono_set (cell_subset_covariateSpace hK l) have hfg : ContinuousOn (fun x => c * (f x * g x)) covariateSpace := by fun_prop have hdf : ContinuousOn (fun x => (c * e) * f x) covariateSpace := by fun_prop have hdg : ContinuousOn (fun x => (c * d) * g x) covariateSpace := by fun_prop have hsum : ContinuousOn (fun x => c * (f x * g x) + (c * e) * f x) covariateSpace := by fun_prop have hpoint : (fun x => c * ((d + f x) * (e + g x) - d * e)) = (fun x => (c * (f x * g x) + (c * e) * f x) + (c * d) * g x) := by funext x ring rw [hpoint, integral_add (hi _ hsum) (hi _ hdg), integral_add (hi _ hfg) (hi _ hdf)] simp only [integral_const_mul, hf0, hg0, mul_zero, add_zero]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.quadratic_cell_projection_identity · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/PilotProjection.lean:180
theorem cubic_cell_projection_identity Lemma cubic_cell_projection_identity in the paper ↗

The cubic projection error has precisely the three two-residual terms and the three-residual term; every single-residual contribution cancels. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
K :
ℕ
hK :
0 < K
l :
Fin K
f g h :
ℝ → ℝ
d e b c :
ℝ
hf0 :
(∫ x in cell K l, f x) = 0
hg0 :
(∫ x in cell K l, g x) = 0
hh0 :
(∫ x in cell K l, h x) = 0
(∫ x in cell K l, c * ((d + f x) * (e + g x) * (b + h x) - d * e * b))
= ∫ x in cell K l, c * (d * g x * h x + e * f x * h x + b * f x * g x + f x * g x * h x)
Proof (Lean source)
-- @node: cubic_cell_projection_identity lemma cubic_cell_projection_identity {K : ℕ} (hK : 0 < K) (l : Fin K) (f g h : ℝ → ℝ) (hf : ContinuousOn f covariateSpace) (hg : ContinuousOn g covariateSpace) (hh : ContinuousOn h covariateSpace) (d e b c : ℝ) (hf0 : (∫ x in cell K l, f x) = 0) (hg0 : (∫ x in cell K l, g x) = 0) (hh0 : (∫ x in cell K l, h x) = 0) : (∫ x in cell K l, c * ((d + f x) * (e + g x) * (b + h x) - d * e * b)) = ∫ x in cell K l, c * (d * g x * h x + e * f x * h x + b * f x * g x + f x * g x * h x) := by let R : ℝ → ℝ := fun x => c * (d * g x * h x + e * f x * h x + b * f x * g x + f x * g x * h x) have hi (u : ℝ → ℝ) (hu : ContinuousOn u covariateSpace) : IntegrableOn u (cell K l) := hu.integrableOn_Icc.mono_set (cell_subset_covariateSpace hK l) have hR : ContinuousOn R covariateSpace := by dsimp [R]; fun_prop have h1 : ContinuousOn (fun x => (c * e * b) * f x) covariateSpace := by fun_prop have h2 : ContinuousOn (fun x => (c * d * b) * g x) covariateSpace := by fun_prop have h3 : ContinuousOn (fun x => (c * d * e) * h x) covariateSpace := by fun_prop have hR1 : ContinuousOn (fun x => R x + (c * e * b) * f x) covariateSpace := hR.add h1 have hR2 : ContinuousOn (fun x => (R x + (c * e * b) * f x) + (c * d * b) * g x) covariateSpace := hR1.add h2 have hpoint : (fun x => c * ((d + f x) * (e + g x) * (b + h x) - d * e * b)) = (fun x => ((R x + (c * e * b) * f x) + (c * d * b) * g x) + (c * d * e) * h x) := by funext x dsimp [R] ring rw [hpoint, integral_add (hi _ hR2) (hi _ h3), integral_add (hi _ hR1) (hi _ h2), integral_add (hi _ hR) (hi _ h1)] simp only [integral_const_mul, hf0, hg0, hh0, mul_zero, add_zero] simp only [R, integral_const_mul]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.cubic_cell_projection_identity · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/PilotProjection.lean:206
theorem markedDensity_cell_residual_continuousOn

Within-cell marked-density residuals retain the already proved continuity. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n K :
ℕ
hP :
ModelClass c_f C_f L P n
l :
Fin K
i :
Fin 7
ContinuousOn (fun x => markedDensityVector c_f C_f L P n hP x i - cellAverage (fun y => markedDensityVector c_f C_f L P n hP y i) K l) covariateSpace
Proof (Lean source)
-- @node: markedDensity_cell_residual_continuousOn lemma markedDensity_cell_residual_continuousOn (c_f C_f L : ℝ) (P : TransportLaw) (n K : ℕ) (hP : ModelClass c_f C_f L P n) (l : Fin K) (i : Fin 7) : ContinuousOn (fun x => markedDensityVector c_f C_f L P n hP x i - cellAverage (fun y => markedDensityVector c_f C_f L P n hP y i) K l) covariateSpace := by have hf := markedDensityVector_continuousOn c_f C_f L P n hP i fun_prop
CausalSmith.Stat.TransportCaceRoughnuisanceLength.markedDensity_cell_residual_continuousOn · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/PilotProjection.lean:244
theorem markedDensity_quadratic_cell_projection_identity

Exact quadratic Taylor projection identity for the actual marked densities and arbitrary cell values of the pilot and Taylor coefficient. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n K :
ℕ
hP :
ModelClass c_f C_f L P n
hK :
0 < K
l :
Fin K
i j :
Fin 7
ti tj c :
ℝ
F :
markedDensityVector c_f C_f L P n hP
ai :
cellAverage (fun y => F y i) K l
aj :
cellAverage (fun y => F y j) K l
(∫ x in cell K l, c * ((F x i - ti) * (F x j - tj) - (ai - ti) * (aj - tj)))
= ∫ x in cell K l, c * ((F x i - ai) * (F x j - aj))
Proof (Lean source)
-- @node: markedDensity_quadratic_cell_projection_identity lemma markedDensity_quadratic_cell_projection_identity (c_f C_f L : ℝ) (P : TransportLaw) (n K : ℕ) (hP : ModelClass c_f C_f L P n) (hK : 0 < K) (l : Fin K) (i j : Fin 7) (ti tj c : ℝ) : let F := markedDensityVector c_f C_f L P n hP let ai := cellAverage (fun y => F y i) K l let aj := cellAverage (fun y => F y j) K l (∫ x in cell K l, c * ((F x i - ti) * (F x j - tj) - (ai - ti) * (aj - tj))) = ∫ x in cell K l, c * ((F x i - ai) * (F x j - aj)) := by dsimp only convert quadratic_cell_projection_identity hK l (fun x => markedDensityVector c_f C_f L P n hP x i - cellAverage (fun y => markedDensityVector c_f C_f L P n hP y i) K l) (fun x => markedDensityVector c_f C_f L P n hP x j - cellAverage (fun y => markedDensityVector c_f C_f L P n hP y j) K l) (markedDensity_cell_residual_continuousOn c_f C_f L P n K hP l i) (markedDensity_cell_residual_continuousOn c_f C_f L P n K hP l j) (cellAverage (fun y => markedDensityVector c_f C_f L P n hP y i) K l - ti) (cellAverage (fun y => markedDensityVector c_f C_f L P n hP y j) K l - tj) c (one_residual_cell_cancellation c_f C_f L P n K hP hK l i) (one_residual_cell_cancellation c_f C_f L P n K hP hK l j) using 1 congr 1 funext x ring
CausalSmith.Stat.TransportCaceRoughnuisanceLength.markedDensity_quadratic_cell_projection_identity · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/PilotProjection.lean:255
theorem markedDensity_cubic_cell_projection_identity

Exact cubic Taylor projection identity for the actual marked densities. Only products with two or three within-cell residuals survive integration. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n K :
ℕ
hP :
ModelClass c_f C_f L P n
hK :
0 < K
l :
Fin K
i j k :
Fin 7
ti tj tk c :
ℝ
F :
markedDensityVector c_f C_f L P n hP
ai :
cellAverage (fun y => F y i) K l
aj :
cellAverage (fun y => F y j) K l
ak :
cellAverage (fun y => F y k) K l
ei :
fun x => F x i - ai
ej :
fun x => F x j - aj
ek :
fun x => F x k - ak
(∫ x in cell K l, c * ((F x i - ti) * (F x j - tj) * (F x k - tk) - (ai - ti) * (aj - tj) * (ak - tk)))
= ∫ x in cell K l, c * ((ai - ti) * ej x * ek x + (aj - tj) * ei x * ek x + (ak - tk) * ei x * ej x + ei x * ej x * ek x)
Proof (Lean source)
-- @node: markedDensity_cubic_cell_projection_identity lemma markedDensity_cubic_cell_projection_identity (c_f C_f L : ℝ) (P : TransportLaw) (n K : ℕ) (hP : ModelClass c_f C_f L P n) (hK : 0 < K) (l : Fin K) (i j k : Fin 7) (ti tj tk c : ℝ) : let F := markedDensityVector c_f C_f L P n hP let ai := cellAverage (fun y => F y i) K l let aj := cellAverage (fun y => F y j) K l let ak := cellAverage (fun y => F y k) K l let ei := fun x => F x i - ai let ej := fun x => F x j - aj let ek := fun x => F x k - ak (∫ x in cell K l, c * ((F x i - ti) * (F x j - tj) * (F x k - tk) - (ai - ti) * (aj - tj) * (ak - tk))) = ∫ x in cell K l, c * ((ai - ti) * ej x * ek x + (aj - tj) * ei x * ek x + (ak - tk) * ei x * ej x + ei x * ej x * ek x) := by dsimp only convert cubic_cell_projection_identity hK l (fun x => markedDensityVector c_f C_f L P n hP x i - cellAverage (fun y => markedDensityVector c_f C_f L P n hP y i) K l) (fun x => markedDensityVector c_f C_f L P n hP x j - cellAverage (fun y => markedDensityVector c_f C_f L P n hP y j) K l) (fun x => markedDensityVector c_f C_f L P n hP x k - cellAverage (fun y => markedDensityVector c_f C_f L P n hP y k) K l) (markedDensity_cell_residual_continuousOn c_f C_f L P n K hP l i) (markedDensity_cell_residual_continuousOn c_f C_f L P n K hP l j) (markedDensity_cell_residual_continuousOn c_f C_f L P n K hP l k) (cellAverage (fun y => markedDensityVector c_f C_f L P n hP y i) K l - ti) (cellAverage (fun y => markedDensityVector c_f C_f L P n hP y j) K l - tj) (cellAverage (fun y => markedDensityVector c_f C_f L P n hP y k) K l - tk) c (one_residual_cell_cancellation c_f C_f L P n K hP hK l i) (one_residual_cell_cancellation c_f C_f L P n K hP hK l j) (one_residual_cell_cancellation c_f C_f L P n K hP hK l k) using 1 congr 1 funext x ring
CausalSmith.Stat.TransportCaceRoughnuisanceLength.markedDensity_cubic_cell_projection_identity · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/PilotProjection.lean:282
CausalSmith.Stat.STAT_TransportCaceRoughnuisanceLength_Research.Helpers.CubicMse.PilotSampling 11 declarations This implements the mean and fluctuation calculation in equation (2) of the marked-cubic proof for the bounded, observable bin scores.

Exact means and second moments of the pilot bin averages

This implements the mean and fluctuation calculation in equation (2) of the marked-cubic proof for the bounded, observable bin scores. The eighth-moment index-pattern calculation remains a separate step.

theorem integral_iidBlockHeight Lemma integral_iidBlockHeight in the paper ↗

A normalized block height has mean K times the one-record bin mean. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
Ω :
n K :
ℕ
S :
hS :
0 < S.card
f :
Ω → ℝ
hf :
(∫ x, iidBlockHeight K S f x ∂Measure.pi (fun _ : Fin n => μ)) = (K : ℝ) * ∫ y, f y ∂μ
Proof (Lean source)
-- @node: integral_iidBlockHeight lemma integral_iidBlockHeight {Ω : Type*} [MeasurableSpace Ω] {μ : Measure Ω} [IsProbabilityMeasure μ] {n K : ℕ} (S : Finset (Fin n)) (hS : 0 < S.card) (f : Ω → ℝ) (hf : Integrable f μ) : (∫ x, iidBlockHeight K S f x ∂Measure.pi (fun _ : Fin n => μ)) = (K : ℝ) * ∫ y, f y ∂μ := by have hcoord (r : Fin n) : (∫ x, f (x r) ∂Measure.pi (fun _ : Fin n => μ)) = ∫ y, f y ∂μ := by have hp := measurePreserving_eval (fun _ : Fin n => μ) r have hm : AEStronglyMeasurable f ((Measure.pi (fun _ : Fin n => μ)).map (Function.eval r)) := by rw [hp.map_eq] exact hf.aestronglyMeasurable simpa only [hp.map_eq] using (integral_map hp.measurable.aemeasurable hm).symm have hint (r : Fin n) : Integrable (fun x : Fin n → Ω => f (x r)) (Measure.pi (fun _ : Fin n => μ)) := (measurePreserving_eval (fun _ : Fin n => μ) r).integrable_comp_of_integrable hf unfold iidBlockHeight rw [integral_const_mul, integral_finset_sum S (fun r _ => hint r)] simp_rw [hcoord] simp only [Finset.sum_const, nsmul_eq_mul] have hcard : (S.card : ℝ) ≠ 0 := Nat.cast_ne_zero.mpr hS.ne' field_simp
CausalSmith.Stat.TransportCaceRoughnuisanceLength.integral_iidBlockHeight · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/PilotSampling.lean:19
theorem iidBlockHeight_centered_second_moment Lemma iidBlockHeight_centered_second_moment in the paper ↗

Centering at the exact bin mean turns the second moment into self-covariance. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
Ω :
n K :
ℕ
S :
hS :
0 < S.card
f :
Ω → ℝ
hf :
(∫ x, (iidBlockHeight K S f x - (K : ℝ) * ∫ y, f y ∂μ) ^ 2 ∂Measure.pi (fun _ : Fin n => μ))
= cov[iidBlockHeight K S f, iidBlockHeight K S f; Measure.pi (fun _ : Fin n => μ)]
Proof (Lean source)
-- @node: iidBlockHeight_centered_second_moment lemma iidBlockHeight_centered_second_moment {Ω : Type*} [MeasurableSpace Ω] {μ : Measure Ω} [IsProbabilityMeasure μ] {n K : ℕ} (S : Finset (Fin n)) (hS : 0 < S.card) (f : Ω → ℝ) (hf : Integrable f μ) : (∫ x, (iidBlockHeight K S f x - (K : ℝ) * ∫ y, f y ∂μ) ^ 2 ∂Measure.pi (fun _ : Fin n => μ)) = cov[iidBlockHeight K S f, iidBlockHeight K S f; Measure.pi (fun _ : Fin n => μ)] := by rw [covariance, integral_iidBlockHeight S hS f hf] simp only [pow_two]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.iidBlockHeight_centered_second_moment · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/PilotSampling.lean:46
theorem source_bin_height_second_moment_le

The exact source bin average obeys the roadmap's V K / m bound. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n K :
ℕ
hP :
ModelClass c_f C_f L P n
hK :
0 < K
S :
hS :
0 < S.card
l :
Fin K
i :
Fin 7
(∫ x, (iidBlockHeight K S (sourceCellScore i K l) x - (K : ℝ) * ∫ o, sourceCellScore i K l o ∂sourceObsLaw P) ^ 2 ∂Measure.pi (fun _ : Fin n => sourceObsLaw P))
≤ (1 + C_f + C_f ^ 2) * K / S.card
Proof (Lean source)
-- @node: source_bin_height_second_moment_le lemma source_bin_height_second_moment_le (c_f C_f L : ℝ) (P : TransportLaw) (n K : ℕ) (hP : ModelClass c_f C_f L P n) (hK : 0 < K) (S : Finset (Fin n)) (hS : 0 < S.card) (l : Fin K) (i : Fin 7) : (∫ x, (iidBlockHeight K S (sourceCellScore i K l) x - (K : ℝ) * ∫ o, sourceCellScore i K l o ∂sourceObsLaw P) ^ 2 ∂Measure.pi (fun _ : Fin n => sourceObsLaw P)) ≤ (1 + C_f + C_f ^ 2) * K / S.card := by letI : IsProbabilityMeasure (sourceObsLaw P) := sourceObsLaw_isProbabilityMeasure c_f C_f L P n hP have hf := (memLp_two_of_mem_unit_interval (μ := sourceObsLaw P) (measurable_sourceCellScore i K l) (sourceCellScore_mem_unit_interval i K l)).integrable (by norm_num) rw [iidBlockHeight_centered_second_moment S hS _ hf] have hcov := source_iidBlockHeight_same_cell_covariance_le c_f C_f L P n K hP hK S hS l i i refine (le_abs_self _).trans (hcov.trans ?_) apply div_le_div_of_nonneg_right _ (by positivity) have hKr : (1 : ℝ) ≤ K := by exact_mod_cast hK nlinarith [sq_nonneg C_f, mul_nonneg (sq_nonneg C_f) (sub_nonneg.mpr hKr)]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.source_bin_height_second_moment_le · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/PilotSampling.lean:59
theorem target_bin_height_second_moment_le

The exact target bin average obeys the same V K / m bound. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n K :
ℕ
hP :
ModelClass c_f C_f L P n
hK :
0 < K
S :
hS :
0 < S.card
l :
Fin K
(∫ x, (iidBlockHeight K S (targetCellScore K l) x - (K : ℝ) * (targetXLaw P (cell K l)).toReal) ^ 2 ∂Measure.pi (fun _ : Fin n => targetXLaw P))
≤ (1 + C_f + C_f ^ 2) * K / S.card
Proof (Lean source)
-- @node: target_bin_height_second_moment_le lemma target_bin_height_second_moment_le (c_f C_f L : ℝ) (P : TransportLaw) (n K : ℕ) (hP : ModelClass c_f C_f L P n) (hK : 0 < K) (S : Finset (Fin n)) (hS : 0 < S.card) (l : Fin K) : (∫ x, (iidBlockHeight K S (targetCellScore K l) x - (K : ℝ) * (targetXLaw P (cell K l)).toReal) ^ 2 ∂Measure.pi (fun _ : Fin n => targetXLaw P)) ≤ (1 + C_f + C_f ^ 2) * K / S.card := by letI : IsProbabilityMeasure (targetXLaw P) := targetXLaw_isProbabilityMeasure c_f C_f L P n hP have hf := (memLp_two_of_mem_unit_interval (μ := targetXLaw P) (measurable_targetCellScore K l) (targetCellScore_mem_unit_interval K l)).integrable (by norm_num) have hmean : (∫ y, targetCellScore K l y ∂targetXLaw P) = (targetXLaw P (cell K l)).toReal := by change (∫ y, (cell K l).indicator (fun _ => (1 : ℝ)) y ∂targetXLaw P) = _ exact integral_indicator_one (measurableSet_cell K l) rw [← hmean, iidBlockHeight_centered_second_moment S hS _ hf] have hcov := target_iidBlockHeight_same_cell_covariance_le c_f C_f L P n K hP hK S hS l refine (le_abs_self _).trans (hcov.trans ?_) apply div_le_div_of_nonneg_right _ (by positivity) have hKr : (1 : ℝ) ≤ K := by exact_mod_cast hK nlinarith [sq_nonneg C_f, mul_nonneg (sq_nonneg C_f) (sub_nonneg.mpr hKr)]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.target_bin_height_second_moment_le · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/PilotSampling.lean:82
theorem targetCellScore_integral_eq_density

The target bin probability is the integral of its marked density. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n K :
ℕ
hP :
ModelClass c_f C_f L P n
hK :
0 < K
l :
Fin K
(∫ y, targetCellScore K l y ∂targetXLaw P) = ∫ y in cell K l, P.fT y
Proof (Lean source)
-- @node: targetCellScore_integral_eq_density lemma targetCellScore_integral_eq_density (c_f C_f L : ℝ) (P : TransportLaw) (n K : ℕ) (hP : ModelClass c_f C_f L P n) (hK : 0 < K) (l : Fin K) : (∫ y, targetCellScore K l y ∂targetXLaw P) = ∫ y in cell K l, P.fT y := by rw [target_integral_eq_density_integral c_f C_f L P n hP] have hpoint : (fun y => P.fT y * targetCellScore K l y) = (cell K l).indicator P.fT := by funext y simp only [targetCellScore, indicator] split_ifs <;> simp rw [hpoint, integral_indicator (measurableSet_cell K l), Measure.restrict_restrict_of_subset (cell_subset_covariateSpace hK l)]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.targetCellScore_integral_eq_density · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/PilotSampling.lean:108
theorem target_bin_height_mean_eq_cellAverage

The target block height is unbiased for the exact Lebesgue cell average. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n K :
ℕ
hP :
ModelClass c_f C_f L P n
hK :
0 < K
S :
hS :
0 < S.card
l :
Fin K
(∫ x, iidBlockHeight K S (targetCellScore K l) x ∂Measure.pi (fun _ : Fin n => targetXLaw P))
= cellAverage P.fT K l
Proof (Lean source)
-- @node: target_bin_height_mean_eq_cellAverage lemma target_bin_height_mean_eq_cellAverage (c_f C_f L : ℝ) (P : TransportLaw) (n K : ℕ) (hP : ModelClass c_f C_f L P n) (hK : 0 < K) (S : Finset (Fin n)) (hS : 0 < S.card) (l : Fin K) : (∫ x, iidBlockHeight K S (targetCellScore K l) x ∂Measure.pi (fun _ : Fin n => targetXLaw P)) = cellAverage P.fT K l := by letI : IsProbabilityMeasure (targetXLaw P) := targetXLaw_isProbabilityMeasure c_f C_f L P n hP have hf := (memLp_two_of_mem_unit_interval (μ := targetXLaw P) (measurable_targetCellScore K l) (targetCellScore_mem_unit_interval K l)).integrable (by norm_num) rw [integral_iidBlockHeight S hS _ hf, targetCellScore_integral_eq_density c_f C_f L P n K hP hK] rfl
CausalSmith.Stat.TransportCaceRoughnuisanceLength.target_bin_height_mean_eq_cellAverage · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/PilotSampling.lean:123
theorem target_markedHistogram_second_moment_le

The target histogram in the actual two-sample experiment satisfies equation (2). Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n K :
ℕ
hn :
threshold ≤ n
hP :
ModelClass c_f C_f L P n
hK :
0 < K
b :
Fin 4
l :
Fin K
(∫ w, (markedHistogram w 0 K b (midpoint K l) - cellAverage P.fT K l) ^ 2 ∂dataLaw P n n)
≤ (1 + C_f + C_f ^ 2) * K / blockSize n b
Proof (Lean source)
-- @node: target_markedHistogram_second_moment_le lemma target_markedHistogram_second_moment_le (c_f C_f L : ℝ) (P : TransportLaw) (n K : ℕ) (hn : threshold ≤ n) (hP : ModelClass c_f C_f L P n) (hK : 0 < K) (b : Fin 4) (l : Fin K) : (∫ w, (markedHistogram w 0 K b (midpoint K l) - cellAverage P.fT K l) ^ 2 ∂dataLaw P n n) ≤ (1 + C_f + C_f ^ 2) * K / blockSize n b := by letI : IsProbabilityMeasure (sourceObsLaw P) := sourceObsLaw_isProbabilityMeasure c_f C_f L P n hP letI : IsProbabilityMeasure (targetXLaw P) := targetXLaw_isProbabilityMeasure c_f C_f L P n hP have hcard : 0 < (blockIdx n b).card := by rw [block_card] exact blockSize_pos_of_threshold n hn b have hmean : (K : ℝ) * (targetXLaw P (cell K l)).toReal = cellAverage P.fT K l := by change (K : ℝ) * (targetXLaw P).real (cell K l) = _ rw [← integral_indicator_one (measurableSet_cell K l)] change (K : ℝ) * (∫ y, targetCellScore K l y ∂targetXLaw P) = _ rw [targetCellScore_integral_eq_density c_f C_f L P n K hP hK] rfl simp_rw [markedHistogram_midpoint_target hn hK] rw [dataLaw_eq_source_target_pi c_f C_f L P n hP] let g := fun x : Fin n → ℝ => (iidBlockHeight K (blockIdx n b) (targetCellScore K l) x - cellAverage P.fT K l) ^ 2 have hg : Measurable g := by dsimp [g] fun_prop have hp := measurePreserving_snd (μ := Measure.pi (fun _ : Fin n => sourceObsLaw P)) (ν := Measure.pi (fun _ : Fin n => targetXLaw P)) have hm : AEStronglyMeasurable g (((Measure.pi (fun _ : Fin n => sourceObsLaw P)).prod (Measure.pi (fun _ : Fin n => targetXLaw P))).map snd) := by rw [hp.map_eq] exact hg.aestronglyMeasurable have htransfer := (integral_map hp.measurable.aemeasurable hm).symm rw [hp.map_eq] at htransfer change (∫ w, g w.2 ∂(Measure.pi (fun _ : Fin n => sourceObsLaw P)).prod (Measure.pi (fun _ : Fin n => targetXLaw P))) ≤ _ rw [htransfer] have h := target_bin_height_second_moment_le c_f C_f L P n K hP hK (blockIdx n b) hcard l simpa only [g, hmean, block_card] using h
CausalSmith.Stat.TransportCaceRoughnuisanceLength.target_markedHistogram_second_moment_le · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/PilotSampling.lean:139
theorem sourceCellScore_integral_eq_density

Clipping the source mark preserves its observable mean, since outcomes lie in [0,1]. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n K :
ℕ
hP :
ModelClass c_f C_f L P n
hK :
0 < K
l :
Fin K
i :
Fin 7
hi :
i ≠ 0
(∫ o, sourceCellScore i K l o ∂sourceObsLaw P)
= ∫ y in cell K l, markedDensityVector c_f C_f L P n hP y i
Proof (Lean source)
-- @node: sourceCellScore_integral_eq_density lemma sourceCellScore_integral_eq_density (c_f C_f L : ℝ) (P : TransportLaw) (n K : ℕ) (hP : ModelClass c_f C_f L P n) (hK : 0 < K) (l : Fin K) (i : Fin 7) (hi : i ≠ 0) : (∫ o, sourceCellScore i K l o ∂sourceObsLaw P) = ∫ y in cell K l, markedDensityVector c_f C_f L P n hP y i := by have hobs : Measurable (observeSource : Assigned → SourceObs) := by unfold observeSource covariate fun_prop have hy : ∀ᵐ o ∂sourceObsLaw P, o.2.2.2 ∈ Icc (0 : ℝ) 1 := by rw [sourceObsLaw] apply (ae_map_iff hobs.aemeasurable (by measurability)).2 exact hP.outcome.2 have hscore : (∫ o, sourceCellScore i K l o ∂sourceObsLaw P) = ∫ o in {o : SourceObs | o.1 ∈ cell K l}, coordinateMark i o ∂sourceObsLaw P := by have hset : MeasurableSet {o : SourceObs | o.1 ∈ cell K l} := (measurableSet_cell K l).preimage measurable_fst rw [← integral_indicator hset] apply integral_congr_ae filter_upwards [hy] with o ho have hclip : max 0 (min 1 o.2.2.2) = o.2.2.2 := by rw [min_eq_right ho.2, max_eq_right ho.1] fin_cases i <;> simp_all [sourceCellScore, sourceCellMark, coordinateMark, indicator, hclip] rw [hscore] have hB := measurableSet_cell K l have hsub := cell_subset_covariateSpace hK l fin_cases i · exact (hi rfl).elim · simpa [markedDensityVector, coordinateMark, boolReal, assignmentMass] using ((source_assignment_density c_f C_f L P n hP false _ hB hsub).trans (source_assignment_mark_integral P false _ hB).symm).symm · simpa [markedDensityVector, coordinateMark, boolReal, assignmentMass] using ((source_assignment_density c_f C_f L P n hP true _ hB hsub).trans (source_assignment_mark_integral P true _ hB).symm).symm · simpa [markedDensityVector, coordinateMark, armValue, assignmentMass, boolReal] using (source_marked_arm_density c_f C_f L P n hP true false _ hB hsub).symm · simpa [markedDensityVector, coordinateMark, armValue, assignmentMass, boolReal] using (source_marked_arm_density c_f C_f L P n hP true true _ hB hsub).symm · simpa [markedDensityVector, coordinateMark, armValue, assignmentMass, boolReal] using (source_marked_arm_density c_f C_f L P n hP false false _ hB hsub).symm · simpa [markedDensityVector, coordinateMark, armValue, assignmentMass, boolReal] using (source_marked_arm_density c_f C_f L P n hP false true _ hB hsub).symm
CausalSmith.Stat.TransportCaceRoughnuisanceLength.sourceCellScore_integral_eq_density · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/PilotSampling.lean:184
theorem source_bin_height_mean_eq_cellAverage

Every source bin height is unbiased for its marked-density cell average. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n K :
ℕ
hP :
ModelClass c_f C_f L P n
hK :
0 < K
S :
hS :
0 < S.card
l :
Fin K
i :
Fin 7
hi :
i ≠ 0
(∫ x, iidBlockHeight K S (sourceCellScore i K l) x ∂Measure.pi (fun _ : Fin n => sourceObsLaw P))
= cellAverage (fun y => markedDensityVector c_f C_f L P n hP y i) K l
Proof (Lean source)
-- @node: source_bin_height_mean_eq_cellAverage lemma source_bin_height_mean_eq_cellAverage (c_f C_f L : ℝ) (P : TransportLaw) (n K : ℕ) (hP : ModelClass c_f C_f L P n) (hK : 0 < K) (S : Finset (Fin n)) (hS : 0 < S.card) (l : Fin K) (i : Fin 7) (hi : i ≠ 0) : (∫ x, iidBlockHeight K S (sourceCellScore i K l) x ∂Measure.pi (fun _ : Fin n => sourceObsLaw P)) = cellAverage (fun y => markedDensityVector c_f C_f L P n hP y i) K l := by letI : IsProbabilityMeasure (sourceObsLaw P) := sourceObsLaw_isProbabilityMeasure c_f C_f L P n hP have hf := (memLp_two_of_mem_unit_interval (μ := sourceObsLaw P) (measurable_sourceCellScore i K l) (sourceCellScore_mem_unit_interval i K l)).integrable (by norm_num) rw [integral_iidBlockHeight S hS _ hf, sourceCellScore_integral_eq_density c_f C_f L P n K hP hK l i hi] rfl
CausalSmith.Stat.TransportCaceRoughnuisanceLength.source_bin_height_mean_eq_cellAverage · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/PilotSampling.lean:229
theorem source_markedHistogram_second_moment_le

Every source histogram in the actual two-sample experiment satisfies equation (2). Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n K :
ℕ
hn :
threshold ≤ n
hP :
ModelClass c_f C_f L P n
hK :
0 < K
b :
Fin 4
l :
Fin K
i :
Fin 7
hi :
i ≠ 0
(∫ w, (markedHistogram w i K b (midpoint K l) - cellAverage (fun y => markedDensityVector c_f C_f L P n hP y i) K l) ^ 2 ∂dataLaw P n n)
≤ (1 + C_f + C_f ^ 2) * K / blockSize n b
Proof (Lean source)
-- @node: source_markedHistogram_second_moment_le lemma source_markedHistogram_second_moment_le (c_f C_f L : ℝ) (P : TransportLaw) (n K : ℕ) (hn : threshold ≤ n) (hP : ModelClass c_f C_f L P n) (hK : 0 < K) (b : Fin 4) (l : Fin K) (i : Fin 7) (hi : i ≠ 0) : (∫ w, (markedHistogram w i K b (midpoint K l) - cellAverage (fun y => markedDensityVector c_f C_f L P n hP y i) K l) ^ 2 ∂dataLaw P n n) ≤ (1 + C_f + C_f ^ 2) * K / blockSize n b := by letI : IsProbabilityMeasure (sourceObsLaw P) := sourceObsLaw_isProbabilityMeasure c_f C_f L P n hP letI : IsProbabilityMeasure (targetXLaw P) := targetXLaw_isProbabilityMeasure c_f C_f L P n hP have hcard : 0 < (blockIdx n b).card := by rw [block_card] exact blockSize_pos_of_threshold n hn b have hmean : (K : ℝ) * (∫ o, sourceCellScore i K l o ∂sourceObsLaw P) = cellAverage (fun y => markedDensityVector c_f C_f L P n hP y i) K l := by rw [sourceCellScore_integral_eq_density c_f C_f L P n K hP hK l i hi] rfl simp_rw [markedHistogram_midpoint_source hn hK _ i hi] rw [dataLaw_eq_source_target_pi c_f C_f L P n hP] let g := fun x : Fin n → SourceObs => (iidBlockHeight K (blockIdx n b) (sourceCellScore i K l) x - cellAverage (fun y => markedDensityVector c_f C_f L P n hP y i) K l) ^ 2 have hg : Measurable g := by dsimp [g] fun_prop have hp := measurePreserving_fst (μ := Measure.pi (fun _ : Fin n => sourceObsLaw P)) (ν := Measure.pi (fun _ : Fin n => targetXLaw P)) have hm : AEStronglyMeasurable g (((Measure.pi (fun _ : Fin n => sourceObsLaw P)).prod (Measure.pi (fun _ : Fin n => targetXLaw P))).map fst) := by rw [hp.map_eq] exact hg.aestronglyMeasurable have htransfer := (integral_map hp.measurable.aemeasurable hm).symm rw [hp.map_eq] at htransfer change (∫ w, g w.1 ∂(Measure.pi (fun _ : Fin n => sourceObsLaw P)).prod (Measure.pi (fun _ : Fin n => targetXLaw P))) ≤ _ rw [htransfer] have h := source_bin_height_second_moment_le c_f C_f L P n K hP hK (blockIdx n b) hcard l i simpa only [g, hmean, block_card] using h
CausalSmith.Stat.TransportCaceRoughnuisanceLength.source_markedHistogram_second_moment_le · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/PilotSampling.lean:247
theorem markedHistogram_second_moment_le

All seven actual marked histogram channels satisfy the common cellwise second-moment bound. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n K :
ℕ
hn :
threshold ≤ n
hP :
ModelClass c_f C_f L P n
hK :
0 < K
b :
Fin 4
l :
Fin K
i :
Fin 7
(∫ w, (markedHistogram w i K b (midpoint K l) - cellAverage (fun y => markedDensityVector c_f C_f L P n hP y i) K l) ^ 2 ∂dataLaw P n n)
≤ (1 + C_f + C_f ^ 2) * K / blockSize n b
Proof (Lean source)
-- @node: markedHistogram_second_moment_le lemma markedHistogram_second_moment_le (c_f C_f L : ℝ) (P : TransportLaw) (n K : ℕ) (hn : threshold ≤ n) (hP : ModelClass c_f C_f L P n) (hK : 0 < K) (b : Fin 4) (l : Fin K) (i : Fin 7) : (∫ w, (markedHistogram w i K b (midpoint K l) - cellAverage (fun y => markedDensityVector c_f C_f L P n hP y i) K l) ^ 2 ∂dataLaw P n n) ≤ (1 + C_f + C_f ^ 2) * K / blockSize n b := by by_cases hi : i = 0 · subst i simpa only [markedDensityVector, Matrix.cons_val_zero] using target_markedHistogram_second_moment_le c_f C_f L P n K hn hP hK b l · exact source_markedHistogram_second_moment_le c_f C_f L P n K hn hP hK b l i hi
CausalSmith.Stat.TransportCaceRoughnuisanceLength.markedHistogram_second_moment_le · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/PilotSampling.lean:290
CausalSmith.Stat.STAT_TransportCaceRoughnuisanceLength_Research.Helpers.CubicMse.PilotSecondMoment 8 declarations The exact bin variance and Hölder projection bias give equation (5)'s second-moment bound, with the constant A₂ used in the cubic projection bias.

The clipped pilot's second-moment rate

The exact bin variance and Hölder projection bias give equation (5)'s second-moment bound, with the constant A₂ used in the cubic projection bias.

theorem markedHistogram_eq_midpoint_on_cell

Histogram heights are constant throughout each cell, including its endpoint convention. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
n K :
ℕ
hK :
0 < K
w :
i :
Fin 7
b :
Fin 4
l :
Fin K
x :
ℝ
hx :
x ∈ cell K l
markedHistogram w i K b x = markedHistogram w i K b (midpoint K l)
Proof (Lean source)
-- @node: markedHistogram_eq_midpoint_on_cell lemma markedHistogram_eq_midpoint_on_cell {n K : ℕ} (hK : 0 < K) (w : TwoSample n n) (i : Fin 7) (b : Fin 4) (l : Fin K) (x : ℝ) (hx : x ∈ cell K l) : markedHistogram w i K b x = markedHistogram w i K b (midpoint K l) := by classical have hmem (r : Fin K) : x ∈ cell K r ↔ r = l := by constructor · intro hr by_contra hne exact Set.disjoint_left.mp (cell_disjoint hK hne) hr hx · rintro rfl exact hx unfold markedHistogram simp_rw [hmem, midpoint_mem_cell_iff hK]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.markedHistogram_eq_midpoint_on_cell · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/PilotSecondMoment.lean:16
theorem measurable_markedHistogram

At a fixed point, the bounded bin statistic is measurable in the data. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
n :
ℕ
i :
Fin 7
K :
ℕ
b :
Fin 4
x :
ℝ
Measurable (fun w : TwoSample n n => markedHistogram w i K b x)
Proof (Lean source)
@[fun_prop] -- @node: measurable_markedHistogram lemma measurable_markedHistogram {n : ℕ} (i : Fin 7) (K : ℕ) (b : Fin 4) (x : ℝ) : Measurable (fun w : TwoSample n n => markedHistogram w i K b x) := by classical unfold markedHistogram split_ifs · fun_prop · apply Finset.measurable_sum intro l hl split_ifs · apply Measurable.const_mul apply Finset.measurable_sum intro r hr apply mul (measurable_channelMark i r) exact Measurable.ite ((measurableSet_cell K l).preimage (measurable_channelX i r)) measurable_const measurable_const · fun_prop
CausalSmith.Stat.TransportCaceRoughnuisanceLength.measurable_markedHistogram · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/PilotSecondMoment.lean:33
theorem markedHistogram_mem_Icc

A cell histogram lies between zero and its normalization K. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
n K :
ℕ
hn :
threshold ≤ n
hK :
0 < K
w :
i :
Fin 7
b :
Fin 4
l :
Fin K
markedHistogram w i K b (midpoint K l) ∈ Icc (0 : ℝ) K
Proof (Lean source)
-- @node: markedHistogram_mem_Icc lemma markedHistogram_mem_Icc {n K : ℕ} (hn : threshold ≤ n) (hK : 0 < K) (w : TwoSample n n) (i : Fin 7) (b : Fin 4) (l : Fin K) : markedHistogram w i K b (midpoint K l) ∈ Icc (0 : ℝ) K := by classical have hm : (0 : ℝ) < blockSize n b := Nat.cast_pos.mpr (blockSize_pos_of_threshold n hn b) have hscore (r : Fin n) : channelMark w i r * (if channelX w i r ∈ cell K l then 1 else 0) ∈ Icc (0 : ℝ) 1 := by split_ifs <;> simp_all [channelMark_mem_unit_interval w i r] have hs0 : 0 ≤ ∑ r ∈ blockIdx n b, channelMark w i r * (if channelX w i r ∈ cell K l then 1 else 0) := Finset.sum_nonneg (fun r _ => (hscore r).1) have hs1 : (∑ r ∈ blockIdx n b, channelMark w i r * (if channelX w i r ∈ cell K l then 1 else 0)) ≤ blockSize n b := by calc _ ≤ ∑ _r ∈ blockIdx n b, (1 : ℝ) := Finset.sum_le_sum (fun r _ => (hscore r).2) _ = _ := by simp [block_card] unfold markedHistogram rw [if_neg (Nat.not_lt_of_ge hn), Finset.sum_eq_single l] · rw [if_pos (midpoint_mem_cell hK l)] constructor · exact mul_nonneg (div_nonneg (by positivity) hm.le) hs0 · calc _ ≤ (K : ℝ) / blockSize n b * blockSize n b := mul_le_mul_of_nonneg_left hs1 (by positivity) _ = K := by field_simp · intro r _ hr rw [if_neg (fun h => hr ((midpoint_mem_cell_iff hK l r).mp h))] · simp
CausalSmith.Stat.TransportCaceRoughnuisanceLength.markedHistogram_mem_Icc · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/PilotSecondMoment.lean:53
theorem integrable_markedHistogram_centered_sq

Fixed centered histogram squares are integrable; their deterministic bound supplies regularity. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n K :
ℕ
hn :
threshold ≤ n
hP :
ModelClass c_f C_f L P n
hK :
0 < K
i :
Fin 7
b :
Fin 4
l :
Fin K
c :
ℝ
Integrable (fun w : TwoSample n n => (markedHistogram w i K b (midpoint K l) - c) ^ 2) (dataLaw P n n)
Proof (Lean source)
-- @node: integrable_markedHistogram_centered_sq lemma integrable_markedHistogram_centered_sq (c_f C_f L : ℝ) (P : TransportLaw) (n K : ℕ) (hn : threshold ≤ n) (hP : ModelClass c_f C_f L P n) (hK : 0 < K) (i : Fin 7) (b : Fin 4) (l : Fin K) (c : ℝ) : Integrable (fun w : TwoSample n n => (markedHistogram w i K b (midpoint K l) - c) ^ 2) (dataLaw P n n) := by let : IsProbabilityMeasure (sourceObsLaw P) := sourceObsLaw_isProbabilityMeasure c_f C_f L P n hP let : IsProbabilityMeasure (targetXLaw P) := targetXLaw_isProbabilityMeasure c_f C_f L P n hP have hprob : IsProbabilityMeasure (dataLaw P n n) := by rw [dataLaw_eq_source_target_pi c_f C_f L P n hP] infer_instance let := hprob apply (integrable_const (((K : ℝ) + |c|) ^ 2)).mono' · fun_prop · filter_upwards [] with w have hb := markedHistogram_mem_Icc hn hK w i b l have hab : |markedHistogram w i K b (midpoint K l) - c| ≤ K + |c| := by exact (abs_sub _ _).trans (by rw [abs_of_nonneg hb.1]; linarith [hb.2]) simpa only [Real.norm_eq_abs, abs_pow, sq_abs] using pow_le_pow_left₀ (abs_nonneg _) hab 2
CausalSmith.Stat.TransportCaceRoughnuisanceLength.integrable_markedHistogram_centered_sq · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/PilotSecondMoment.lean:85
theorem pilot_second_moment_cell_bound

Clipping, bin variance, and the exact Hölder cell bias control pilot risk before rate substitution. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hn :
threshold ≤ n
hP :
ModelClass c_f C_f L P n
i :
Fin 7
l :
Fin (pilotResolution n)
x :
ℝ
hx :
x ∈ cell (pilotResolution n) l
(∫ w, (pilot c_f C_f w x i - markedDensityVector c_f C_f L P n hP x i) ^ 2 ∂dataLaw P n n)
≤ 2 * (1 + C_f + C_f ^ 2) * pilotResolution n / blockSize n 0
+ 2 * (3 * (1 + C_f) * L) ^ 2 * (1 / (pilotResolution n : ℝ)) ^ (1 / 4 : ℝ)
Proof (Lean source)
-- @node: pilot_second_moment_cell_bound lemma pilot_second_moment_cell_bound (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hn : threshold ≤ n) (hP : ModelClass c_f C_f L P n) (i : Fin 7) (l : Fin (pilotResolution n)) (x : ℝ) (hx : x ∈ cell (pilotResolution n) l) : (∫ w, (pilot c_f C_f w x i - markedDensityVector c_f C_f L P n hP x i) ^ 2 ∂dataLaw P n n) ≤ 2 * (1 + C_f + C_f ^ 2) * pilotResolution n / blockSize n 0 + 2 * (3 * (1 + C_f) * L) ^ 2 * (1 / (pilotResolution n : ℝ)) ^ (1 / 4 : ℝ) := by have hK : 0 < pilotResolution n := by unfold pilotResolution dyadicResolution split_ifs <;> positivity let m := cellAverage (fun y => markedDensityVector c_f C_f L P n hP y i) (pilotResolution n) l let F := markedDensityVector c_f C_f L P n hP x i let B := 3 * (1 + C_f) * L * (1 / (pilotResolution n : ℝ)) ^ holderExponent have hb : |m - F| ≤ B := markedDensityVector_cell_bias c_f C_f L P n (pilotResolution n) hP hK l x hx i have hp (w : TwoSample n n) : (pilot c_f C_f w x i - F) ^ 2 ≤ 2 * (markedHistogram w i (pilotResolution n) 0 (midpoint (pilotResolution n) l) - m) ^ 2 + 2 * B ^ 2 := by have hc := pilot_error_le_histogram_error c_f C_f L P n hn hP w x (cell_subset_covariateSpace hK l hx) i have hsplit := abs_sub_le (markedHistogram w i (pilotResolution n) 0 x) m F have hpow := pow_le_pow_left₀ (abs_nonneg _) hc 2 have htriangle := pow_le_pow_left₀ (abs_nonneg _) hsplit 2 have hsum := add_pow_le (abs_nonneg (markedHistogram w i (pilotResolution n) 0 x - m)) (abs_nonneg (m - F)) 2 have hb2 := pow_le_pow_left₀ (abs_nonneg _) hb 2 change |pilot c_f C_f w x i - F| ≤ |markedHistogram w i (pilotResolution n) 0 x - F| at hc rw [markedHistogram_eq_midpoint_on_cell hK w i 0 l x hx] at hpow htriangle hsum change |pilot c_f C_f w x i - F| ^ 2 ≤ |markedHistogram w i (pilotResolution n) 0 (midpoint (pilotResolution n) l) - F| ^ 2 at hpow simp only [sq_abs, Nat.reduceSub, pow_one] at hpow htriangle hsum hb2 nlinarith let : IsProbabilityMeasure (sourceObsLaw P) := sourceObsLaw_isProbabilityMeasure c_f C_f L P n hP let : IsProbabilityMeasure (targetXLaw P) := targetXLaw_isProbabilityMeasure c_f C_f L P n hP have hprob : IsProbabilityMeasure (dataLaw P n n) := by rw [dataLaw_eq_source_target_pi c_f C_f L P n hP]; infer_instance let := hprob have hi := integrable_markedHistogram_centered_sq c_f C_f L P n (pilotResolution n) hn hP hK i 0 l m have hbound := integral_mono_of_nonneg (Filter.Eventually.of_forall (fun w => sq_nonneg (pilot c_f C_f w x i - F))) ((hi.const_mul 2).add (integrable_const (2 * B ^ 2))) (Filter.Eventually.of_forall hp) simp only [Pi.add_apply] at hbound rw [integral_add (hi.const_mul 2) (integrable_const (2 * B ^ 2)), integral_const_mul, integral_const] at hbound simp only [Measure.real, measure_univ, ENNReal.toReal_one, one_smul] at hbound have hv := markedHistogram_second_moment_le c_f C_f L P n (pilotResolution n) hn hP hK 0 l i have hB : B ^ 2 = (3 * (1 + C_f) * L) ^ 2 * (1 / (pilotResolution n : ℝ)) ^ (1 / 4 : ℝ) := by dsimp [B] rw [mul_pow, ← Real.rpow_mul_natCast (by positivity : 0 ≤ 1 / (pilotResolution n : ℝ))] norm_num [holderExponent] rw [hB] at hbound dsimp [m] at hbound refine hbound.trans ?_ convert add_le_add_right (mul_le_mul_of_nonneg_left hv (by norm_num : (0 : ℝ) ≤ 2)) (2 * ((3 * (1 + C_f) * L) ^ 2 * (1 / (pilotResolution n : ℝ)) ^ (1 / 4 : ℝ))) using 1 <;> ring
CausalSmith.Stat.TransportCaceRoughnuisanceLength.pilot_second_moment_cell_bound · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/PilotSecondMoment.lean:110
theorem pilot_second_bias_scale_le

The dyadic pilot bias has the exact second-moment constant from equation (6). Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
n :
ℕ
hn :
threshold ≤ n
2 * (1 / (pilotResolution n : ℝ)) ^ (1 / 4 : ℝ)
≤ (2 : ℝ) ^ (5 / 4 : ℝ) * (5 : ℝ) ^ (1 / 5 : ℝ) * (n : ℝ) ^ (-(1 / 5 : ℝ))
Proof (Lean source)
-- @node: pilot_second_bias_scale_le lemma pilot_second_bias_scale_le (n : ℕ) (hn : threshold ≤ n) : 2 * (1 / (pilotResolution n : ℝ)) ^ (1 / 4 : ℝ) ≤ (2 : ℝ) ^ (5 / 4 : ℝ) * (5 : ℝ) ^ (1 / 5 : ℝ) * (n : ℝ) ^ (-(1 / 5 : ℝ)) := by have h := Real.rpow_le_rpow (by positivity : 0 ≤ 1 / (pilotResolution n : ℝ)) (pilotResolution_inv_le_sample_rate n hn) (by norm_num : (0 : ℝ) ≤ 1 / 4) rw [Real.mul_rpow (by positivity) (by positivity), Real.mul_rpow (by positivity) (by positivity), ← Real.rpow_mul (by norm_num : (0 : ℝ) ≤ 5), ← Real.rpow_mul (by positivity : (0 : ℝ) ≤ n)] at h norm_num at h have htwo : (2 : ℝ) * (2 : ℝ) ^ (1 / 4 : ℝ) = (2 : ℝ) ^ (5 / 4 : ℝ) := by rw [show (5 / 4 : ℝ) = 1 + 1 / 4 by norm_num, Real.rpow_add (by norm_num : (0 : ℝ) < 2), Real.rpow_one] have hscaled := mul_le_mul_of_nonneg_left h (by norm_num : (0 : ℝ) ≤ 2) rw [← mul_assoc 2, ← mul_assoc 2, htwo] at hscaled simpa only [one_div, mul_assoc] using hscaled
CausalSmith.Stat.TransportCaceRoughnuisanceLength.pilot_second_bias_scale_le · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/PilotSecondMoment.lean:177
theorem exists_cell_of_mem_covariateSpace Lemma exists_cell_of_mem_covariateSpace in the paper ↗

Every covariate belongs to a histogram cell; the final cell includes one. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
K :
ℕ
hK :
0 < K
x :
ℝ
hx :
∃ l : Fin K, x ∈ cell K l
Proof (Lean source)
-- @node: exists_cell_of_mem_covariateSpace lemma exists_cell_of_mem_covariateSpace {K : ℕ} (hK : 0 < K) (x : ℝ) (hx : x ∈ covariateSpace) : ∃ l : Fin K, x ∈ cell K l := by have hKr : (0 : ℝ) < K := Nat.cast_pos.mpr hK change 0 ≤ x ∧ x ≤ 1 at hx by_cases hx1 : x = 1 · refine ⟨⟨K - 1, by omega⟩, ?_⟩ have hlast : K - 1 + 1 = K := by omega simp only [cell, hlast, if_true, Set.mem_Icc, hx1] constructor · apply (div_le_one hKr).2 exact_mod_cast (show K - 1 ≤ K by omega) · rfl · have hxlt : x < 1 := lt_of_le_of_ne hx.2 hx1 have hfloor : ⌊x * K⌋₊ < K := by apply (Nat.floor_lt (mul_nonneg hx.1 hKr.le)).2 nlinarith refine ⟨⟨⌊x * K⌋₊, hfloor⟩, ?_⟩ have hlo : (⌊x * K⌋₊ : ℝ) / K ≤ x := by apply (div_le_iff₀ hKr).2 exact Nat.floor_le (mul_nonneg hx.1 hKr.le) have hhi : x < ((⌊x * K⌋₊ : ℝ) + 1) / K := by apply (lt_div_iff₀ hKr).2 exact Nat.lt_floor_add_one (x * K) unfold cell split_ifs · exact ⟨hlo, hx.2⟩ · exact ⟨hlo, hhi⟩
CausalSmith.Stat.TransportCaceRoughnuisanceLength.exists_cell_of_mem_covariateSpace · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/PilotSecondMoment.lean:197
theorem pilot_second_moment

The clipped pilot satisfies the second-moment part of equation (5), with exactly A₂ from equation (6), uniformly over the seven channels and [0,1]. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hn :
threshold ≤ n
hP :
ModelClass c_f C_f L P n
i :
Fin 7
x :
ℝ
hx :
(∫ w, (pilot c_f C_f w x i - markedDensityVector c_f C_f L P n hP x i) ^ 2 ∂dataLaw P n n)
≤ (2 * (1 + C_f + C_f ^ 2) * (5 : ℝ) ^ (1 / 5 : ℝ) + (2 : ℝ) ^ (5 / 4 : ℝ) * (3 * (1 + C_f) * L) ^ 2 * (5 : ℝ) ^ (1 / 5 : ℝ)) * (n : ℝ) ^ (-(1 / 5 : ℝ))
Proof (Lean source)
-- @node: pilot_second_moment lemma pilot_second_moment (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hn : threshold ≤ n) (hP : ModelClass c_f C_f L P n) (i : Fin 7) (x : ℝ) (hx : x ∈ covariateSpace) : (∫ w, (pilot c_f C_f w x i - markedDensityVector c_f C_f L P n hP x i) ^ 2 ∂dataLaw P n n) ≤ (2 * (1 + C_f + C_f ^ 2) * (5 : ℝ) ^ (1 / 5 : ℝ) + (2 : ℝ) ^ (5 / 4 : ℝ) * (3 * (1 + C_f) * L) ^ 2 * (5 : ℝ) ^ (1 / 5 : ℝ)) * (n : ℝ) ^ (-(1 / 5 : ℝ)) := by have hK : 0 < pilotResolution n := by unfold pilotResolution dyadicResolution split_ifs <;> positivity obtain ⟨l, hl⟩ := exists_cell_of_mem_covariateSpace hK x hx have hb := pilot_second_moment_cell_bound c_f C_f L P n hn hP i l x hl have hv := pilotResolution_ratio_rpow_le n hn 1 (by norm_num) rw [Real.rpow_one] at hv have hV : 0 ≤ 2 * (1 + C_f + C_f ^ 2) := by have hC := hP.sourceBounds.2.1 positivity have hv' := mul_le_mul_of_nonneg_left hv hV have hd := mul_le_mul_of_nonneg_left (pilot_second_bias_scale_le n hn) (sq_nonneg (3 * (1 + C_f) * L)) refine hb.trans ?_ convert add_le_add hv' hd using 1 <;> ring
CausalSmith.Stat.TransportCaceRoughnuisanceLength.pilot_second_moment · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/PilotSecondMoment.lean:227
CausalSmith.Stat.STAT_TransportCaceRoughnuisanceLength_Research.Helpers.CubicMse.QuadVariance 3 declarations Constants for the quadratic conditional variance calculation

Constants for the quadratic conditional variance calculation

def quadVarianceConstant

The quad variance constant object is defined from the supplied inputs.

Definition (Lean source)
c_f C_f :
ℝ
quadVarianceConstant c_f C_f :
ℝ
d :
7 (: ℝ)
U :
2 * (1 + C_f)
V :
1 + C_f + C_f ^ 2
d ^ 4 * (2 ^ (2 : ℕ) - 1) ^ 2 * M ^ 2 * (1 + U) ^ 4 * (1 + V) ^ 2
CausalSmith.Stat.TransportCaceRoughnuisanceLength.quadVarianceConstant · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/QuadVariance.lean:13
theorem quadratic_conditional_variance_with_memLp

Given the supplied inputs, the stated result about quadratic conditional variance with mem lp holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hn :
threshold ≤ n
hP :
ModelClass c_f C_f L P n
A :
conclusion 1
MemLp (fun ξ : TwoSample n n => quadraticTerm c_f C_f ξ A) 2 (dataLaw P n n)
conclusion 2
∀ᵐ ω ∂dataLaw P n n, condExp (trainingSigma n) (dataLaw P n n) (fun ξ : TwoSample n n => (quadraticTerm c_f C_f ξ A - condExp (trainingSigma n) (dataLaw P n n) (fun ζ : TwoSample n n => quadraticTerm c_f C_f ζ A) ξ) ^ 2) ω
≤ quadVarianceConstant c_f C_f * ((n : ℝ) ^ (-1 : ℝ) + (quadraticResolution n : ℝ) * (n : ℝ) ^ (-2 : ℝ))
Proof (Lean source)
lemma quadratic_conditional_variance_with_memLp (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hn : threshold ≤ n) (hP : ModelClass c_f C_f L P n) (A : Bool) : MemLp (fun ξ : TwoSample n n => quadraticTerm c_f C_f ξ A) 2 (dataLaw P n n) ∧ (∀ᵐ ω ∂dataLaw P n n, condExp (trainingSigma n) (dataLaw P n n) (fun ξ : TwoSample n n => (quadraticTerm c_f C_f ξ A - condExp (trainingSigma n) (dataLaw P n n) (fun ζ : TwoSample n n => quadraticTerm c_f C_f ζ A) ξ) ^ 2) ω ≤ quadVarianceConstant c_f C_f * ((n : ℝ) ^ (-1 : ℝ) + (quadraticResolution n : ℝ) * (n : ℝ) ^ (-2 : ℝ))) := by classical let K := quadraticResolution n have hK : 0 < K := by dsimp [K, quadraticResolution, dyadicResolution] split_ifs <;> positivity have hnpos : (0 : ℝ) < n := by exact_mod_cast (show 0 < n by norm_num [threshold] at hn; omega) let E := sumPiEquivProdPi (FlatObs n) have hEembed : @MeasurableEmbedding (TwoSample n n) ((a : FlatIndex n) → FlatObs n a) inferInstance MeasurableSpace.pi (flattenSample n) := by exact (sumPiEquivProdPi (FlatObs n)).symm.measurableEmbedding let μ := Measure.pi (flatLaw P n) let m := comap (finsetCoordProj (Ω := FlatObs n) (flatBlock n 0)) MeasurableSpace.pi let M := fourthDerivativeEnvelope c_f C_f let U := 2 * (1 + C_f) let V := 1 + C_f + C_f ^ 2 let C := M * (1 + U) / 2 let R := (n : ℝ) ^ (-1 : ℝ) + (K : ℝ) * (n : ℝ) ^ (-2 : ℝ) let B := M ^ 2 * (1 + U) ^ 4 * (1 + V) ^ 2 * R let shift (i : Fin 7) (l : Fin K) (z : (a : FlatIndex n) → FlatObs n a) := cellAverage (fun y => markedDensityVector c_f C_f L P n hP y i) K l - pilot c_f C_f (E z) (midpoint K l) i let coeff (q : Fin 3 × Fin 7 × Fin 7) (l : Fin K) (z : (a : FlatIndex n) → FlatObs n a) := ![(1 / 2 : ℝ) * dPhi2 A (pilot c_f C_f (E z) (midpoint K l)) q.2.1 q.2.2, (1 / 2 : ℝ) * dPhi2 A (pilot c_f C_f (E z) (midpoint K l)) q.2.1 q.2.2 * shift q.2.1 l z, (1 / 2 : ℝ) * dPhi2 A (pilot c_f C_f (E z) (midpoint K l)) q.2.1 q.2.2 * shift q.2.2 l z] q.1 let leaf (q : Fin 3 × Fin 7 × Fin 7) (l : Fin K) (z : (a : FlatIndex n) → FlatObs n a) := ![flatCenteredPairCell P ![q.2.1, q.2.2] ![0, 1] l z, flatCenteredCellScore P q.2.2 2 l (finsetCoordProj (flatBlock n 2) z), flatCenteredCellScore P q.2.1 1 l (finsetCoordProj (flatBlock n 1) z)] q.1 let Y (q : Fin 3 × Fin 7 × Fin 7) (z : (a : FlatIndex n) → FlatObs n a) := (K : ℝ)⁻¹ * ∑ l : Fin K, coeff q l z * leaf q l z let Z (z : (a : FlatIndex n) → FlatObs n a) := ∑ q : Fin 3 × Fin 7 × Fin 7, Y q z let G (z : (a : FlatIndex n) → FlatObs n a) := (K : ℝ)⁻¹ * ∑ i : Fin 7, ∑ j : Fin 7, ∑ l : Fin K, (1 / 2 : ℝ) * dPhi2 A (pilot c_f C_f (E z) (midpoint K l)) i j * shift i l z * shift j l z let F (z : (a : FlatIndex n) → FlatObs n a) := quadraticTerm c_f C_f (E z) A letI : ∀ a, StandardBorelSpace (FlatObs n a) := fun a => by cases a <;> dsimp [FlatObs] <;> infer_instance letI : ∀ a, IsProbabilityMeasure (flatLaw P n a) := fun a => flatLaw_isProbabilityMeasure c_f C_f L P n hP a have hm : m ≤ (MeasurableSpace.pi : MeasurableSpace ((a : FlatIndex n) → FlatObs n a)) := by dsimp [m] exact (measurable_finsetCoordProj (Ω := FlatObs n) (flatBlock n 0)).comap_le have hM : 0 ≤ M := by dsimp [M, fourthDerivativeEnvelope] have hc : 0 < c_f := hP.sourceBounds.1.1 positivity have hU : 0 ≤ U := by dsimp [U] have := hP.sourceBounds.2.1 positivity have hV : 0 ≤ V := by dsimp [V] nlinarith [sq_nonneg C_f] have hC : 0 ≤ C := by dsimp [C]; positivity have hcoeff_meas (q : Fin 3 × Fin 7 × Fin 7) (l : Fin K) : StronglyMeasurable[m] (coeff q l) := by rcases q with ⟨t, i, j⟩ have hd := stronglyMeasurable_dPhi2_pilot_flatTraining c_f C_f L P n hn hP A (midpoint K l) i j have hs (k : Fin 7) : StronglyMeasurable[m] (shift k l) := by exact stronglyMeasurable_const.sub (stronglyMeasurable_pilot_eval_flatTraining c_f C_f n (midpoint K l) k) fin_cases t · change StronglyMeasurable[m] (fun z => (1 / 2 : ℝ) * dPhi2 A (pilot c_f C_f (E z) (midpoint K l)) i j) exact hd.const_mul (1 / 2) · change StronglyMeasurable[m] (fun z => (1 / 2 : ℝ) * dPhi2 A (pilot c_f C_f (E z) (midpoint K l)) i j * shift i l z) exact (hd.const_mul (1 / 2)).mul (hs i) · change StronglyMeasurable[m] (fun z => (1 / 2 : ℝ) * dPhi2 A (pilot c_f C_f (E z) (midpoint K l)) i j * shift j l z) exact (hd.const_mul (1 / 2)).mul (hs j) have hcoeff (q : Fin 3 × Fin 7 × Fin 7) : ∀ᵐ z ∂μ, ∀ l, |coeff q l z| ≤ C := by filter_upwards [] with z intro l rcases q with ⟨t, i, j⟩ have hd := dPhi2_abs_le c_f C_f hP.sourceBounds.1 hP.sourceBounds.2.1 A (pilot c_f C_f (E z) (midpoint K l)) (pilot_mem_clippingRectangle c_f C_f L P n hn hP (E z) (midpoint K l)) i j have hsi := abs_trainingShift_le c_f C_f L P n K hn hP hK (E z) l i have hsj := abs_trainingShift_le c_f C_f L P n K hn hP hK (E z) l j change |dPhi2 A (pilot c_f C_f (E z) (midpoint K l)) i j| ≤ M at hd change |shift i l z| ≤ U at hsi change |shift j l z| ≤ U at hsj have hhalf : (0 : ℝ) ≤ 1 / 2 := by norm_num fin_cases t · change |(1 / 2 : ℝ) * dPhi2 A (pilot c_f C_f (E z) (midpoint K l)) i j| ≤ C rw [abs_mul, abs_of_nonneg hhalf] dsimp [C] calc 1 / 2 * |dPhi2 A (pilot c_f C_f (E z) (midpoint K l)) i j| ≤ 1 / 2 * M := mul_le_mul_of_nonneg_left hd hhalf _ ≤ M * (1 + U) / 2 := by nlinarith [mul_nonneg hM hU] · change |(1 / 2 : ℝ) * dPhi2 A (pilot c_f C_f (E z) (midpoint K l)) i j * shift i l z| ≤ C rw [abs_mul, abs_mul, abs_of_nonneg hhalf] dsimp [C] calc 1 / 2 * |dPhi2 A (pilot c_f C_f (E z) (midpoint K l)) i j| * |shift i l z| ≤ 1 / 2 * M * U := by gcongr _ ≤ M * (1 + U) / 2 := by nlinarith [mul_nonneg hM hU] · change |(1 / 2 : ℝ) * dPhi2 A (pilot c_f C_f (E z) (midpoint K l)) i j * shift j l z| ≤ C rw [abs_mul, abs_mul, abs_of_nonneg hhalf] dsimp [C] calc 1 / 2 * |dPhi2 A (pilot c_f C_f (E z) (midpoint K l)) i j| * |shift j l z| ≤ 1 / 2 * M * U := by gcongr _ ≤ M * (1 + U) / 2 := by nlinarith [mul_nonneg hM hU] have hleaf_lp (q : Fin 3 × Fin 7 × Fin 7) (l : Fin K) : MemLp (leaf q l) 2 μ := by rcases q with ⟨t, i, j⟩ fin_cases t · simpa [leaf, μ] using flatCenteredPairCell_memLp c_f C_f L P n K hn hP ![i, j] ![0, 1] (by intro a b hab; fin_cases a <;> fin_cases b <;> simp_all) l · simpa [leaf, μ] using flatCenteredCellScore_comp_memLp c_f C_f L P n K hn hP j 2 l · simpa [leaf, μ] using flatCenteredCellScore_comp_memLp c_f C_f L P n K hn hP i 1 l have hYlp (q : Fin 3 × Fin 7 × Fin 7) : MemLp (Y q) 2 μ := by have hterm (l : Fin K) : MemLp (fun z => coeff q l z * leaf q l z) 2 μ := by have hmeas := ((hcoeff_meas q l).mono hm).aestronglyMeasurable.mul (hleaf_lp q l).aestronglyMeasurable apply (memLp_two_iff_integrable_sq hmeas).2 have hb : ∀ᵐ z ∂μ, ‖(coeff q l z) ^ 2‖ ≤ C ^ 2 := by filter_upwards [hcoeff q] with z hz simp only [Real.norm_eq_abs, abs_pow] have hzl := hz l exact (sq_le_sq₀ (abs_nonneg _) hC).2 hzl have hb' : ∀ᵐ z ∂μ, ‖((coeff q l) * (coeff q l)) z‖ ≤ C ^ 2 := by simpa only [Pi.mul_apply, pow_two] using hb have hi := (hleaf_lp q l).integrable_sq.bdd_mul (((hcoeff_meas q l).mono hm).mul ((hcoeff_meas q l).mono hm)).aestronglyMeasurable hb' convert hi using 1 funext z dsimp only [Pi.mul_apply] ring exact (memLp_finsetSum univ (fun l _ => hterm l)).const_mul (K : ℝ)⁻¹ have hZlp : MemLp Z 2 μ := by simpa only [Z] using (memLp_finsetSum univ (fun q _ => hYlp q)) have hgterm_meas (i j : Fin 7) (l : Fin K) : StronglyMeasurable[m] (fun z => (1 / 2 : ℝ) * dPhi2 A (pilot c_f C_f (E z) (midpoint K l)) i j * shift i l z * shift j l z) := by have hd := stronglyMeasurable_dPhi2_pilot_flatTraining c_f C_f L P n hn hP A (midpoint K l) i j have hsi : StronglyMeasurable[m] (shift i l) := stronglyMeasurable_const.sub (stronglyMeasurable_pilot_eval_flatTraining c_f C_f n (midpoint K l) i) have hsj : StronglyMeasurable[m] (shift j l) := stronglyMeasurable_const.sub (stronglyMeasurable_pilot_eval_flatTraining c_f C_f n (midpoint K l) j) exact ((hd.const_mul (1 / 2)).mul hsi).mul hsj have hGmeas : StronglyMeasurable[m] G := by simpa only [G, Finset.sum_apply] using (((Finset.stronglyMeasurable_sum univ fun i _ => Finset.stronglyMeasurable_sum univ fun j _ => Finset.stronglyMeasurable_sum univ fun l _ => hgterm_meas i j l)).const_mul (K : ℝ)⁻¹) have hGlp : MemLp G 2 μ := by have hgterm (i j : Fin 7) (l : Fin K) : MemLp (fun z => (1 / 2 : ℝ) * dPhi2 A (pilot c_f C_f (E z) (midpoint K l)) i j * shift i l z * shift j l z) 2 μ := by refine MemLp.of_bound ((hgterm_meas i j l).mono hm).aestronglyMeasurable (M * U ^ 2) ?_ filter_upwards [] with z simp only [Real.norm_eq_abs, abs_mul] have hd := dPhi2_abs_le c_f C_f hP.sourceBounds.1 hP.sourceBounds.2.1 A (pilot c_f C_f (E z) (midpoint K l)) (pilot_mem_clippingRectangle c_f C_f L P n hn hP (E z) (midpoint K l)) i j have hsi := abs_trainingShift_le c_f C_f L P n K hn hP hK (E z) l i have hsj := abs_trainingShift_le c_f C_f L P n K hn hP hK (E z) l j change |dPhi2 A (pilot c_f C_f (E z) (midpoint K l)) i j| ≤ M at hd change |shift i l z| ≤ U at hsi change |shift j l z| ≤ U at hsj have h12 : |(1 / 2 : ℝ)| ≤ 1 := by norm_num calc |(1 / 2 : ℝ)| * |dPhi2 A (pilot c_f C_f (E z) (midpoint K l)) i j| * |shift i l z| * |shift j l z| ≤ 1 * M * U * U := by gcongr _ = M * U ^ 2 := by ring have hs1 (i j : Fin 7) : MemLp (fun z => ∑ l : Fin K, (1 / 2 : ℝ) * dPhi2 A (pilot c_f C_f (E z) (midpoint K l)) i j * shift i l z * shift j l z) 2 μ := memLp_finsetSum univ (fun l _ => hgterm i j l) have hs2 (i : Fin 7) : MemLp (fun z => ∑ j : Fin 7, ∑ l : Fin K, (1 / 2 : ℝ) * dPhi2 A (pilot c_f C_f (E z) (midpoint K l)) i j * shift i l z * shift j l z) 2 μ := memLp_finsetSum univ (fun j _ => hs1 i j) have hs3 : MemLp (fun z => ∑ i : Fin 7, ∑ j : Fin 7, ∑ l : Fin K, (1 / 2 : ℝ) * dPhi2 A (pilot c_f C_f (E z) (midpoint K l)) i j * shift i l z * shift j l z) 2 μ := memLp_finsetSum univ (fun i _ => hs2 i) exact hs3.const_mul (K : ℝ)⁻¹ have hdecomp : F = Z + G := by funext z dsimp only [F, Z, Y, G] unfold quadraticTerm dsimp only change (1 / (2 * (K : ℝ))) * ∑ i : Fin 7, ∑ j : Fin 7, ∑ l : Fin K, dPhi2 A (pilot c_f C_f (E z) (midpoint K l)) i j * residual c_f C_f (E z) i K 1 (midpoint K l) * residual c_f C_f (E z) j K 2 (midpoint K l) = _ simp only [Pi.add_apply] rw [Fintype.sum_prod_type] simp_rw [Fintype.sum_prod_type] rw [Fin.sum_univ_three] simp [coeff, leaf] simp only [← Finset.mul_sum, ← Finset.sum_add_distrib] rw [← mul_add, ← mul_add, ← mul_add] rw [mul_assoc] apply congrArg (fun x : ℝ => (K : ℝ)⁻¹ * x) simp only [← Finset.sum_add_distrib, Finset.mul_sum] apply Finset.sum_congr rfl intro i _ apply Finset.sum_congr rfl intro j _ apply Finset.sum_congr rfl -- … truncated; follow the source link for the rest …
CausalSmith.Stat.TransportCaceRoughnuisanceLength.quadratic_conditional_variance_with_memLp · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/QuadVariance.lean:28
theorem quadratic_conditional_variance

The exact quadratic correction variance bound. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hn :
threshold ≤ n
hP :
ModelClass c_f C_f L P n
A :
∀ᵐ ω ∂dataLaw P n n, condExp (trainingSigma n) (dataLaw P n n) (fun ξ : TwoSample n n => (quadraticTerm c_f C_f ξ A - condExp (trainingSigma n) (dataLaw P n n) (fun ζ : TwoSample n n => quadraticTerm c_f C_f ζ A) ξ) ^ 2) ω
≤ quadVarianceConstant c_f C_f * ((n : ℝ) ^ (-1 : ℝ) + (quadraticResolution n : ℝ) * (n : ℝ) ^ (-2 : ℝ))
Proof (Lean source)
-- @node: quadratic_conditional_variance lemma quadratic_conditional_variance (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hn : threshold ≤ n) (hP : ModelClass c_f C_f L P n) (A : Bool) : ∀ᵐ ω ∂dataLaw P n n, condExp (trainingSigma n) (dataLaw P n n) (fun ξ : TwoSample n n => (quadraticTerm c_f C_f ξ A - condExp (trainingSigma n) (dataLaw P n n) (fun ζ : TwoSample n n => quadraticTerm c_f C_f ζ A) ξ) ^ 2) ω ≤ quadVarianceConstant c_f C_f * ((n : ℝ) ^ (-1 : ℝ) + (quadraticResolution n : ℝ) * (n : ℝ) ^ (-2 : ℝ)) := by exact (quadratic_conditional_variance_with_memLp c_f C_f L P n hn hP A).2
CausalSmith.Stat.TransportCaceRoughnuisanceLength.quadratic_conditional_variance · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/QuadVariance.lean:459
CausalSmith.Stat.STAT_TransportCaceRoughnuisanceLength_Research.Helpers.CubicMse.QuadraticProjectionBias 6 declarations The exact cell cancellation identity gives the deterministic quadratic bias bound.

Summed quadratic projection bias

The exact cell cancellation identity gives the deterministic quadratic bias bound. Dyadic rounding and the block-size lower bound give its squared sample-size rate, with the constant BQ in roadmap (11).

def quadraticCellProjectionBias

The quadratic Taylor projection error, summed over all marked coordinates and cells with the pilot frozen at each cell midpoint. For the displayed assumptions and inputs, the stated object is defined.

Definition (Lean source)
c_f C_f L :
ℝ
n K :
ℕ
hP :
ModelClass c_f C_f L P n
ω :
A :
quadraticCellProjectionBias c_f C_f L P n K hP ω A :
ℝ
∑ i : Fin 7, ∑ j : Fin 7, ∑ l : Fin K, ∫ x in cell K l, (dPhi2 A (pilot c_f C_f ω (midpoint K l)) i j / 2) * ((markedDensityVector c_f C_f L P n hP x i - pilot c_f C_f ω (midpoint K l) i) * (markedDensityVector c_f C_f L P n hP x j - pilot c_f C_f ω (midpoint K l) j) - (cellAverage (fun y => markedDensityVector c_f C_f L P n hP y i) K l - pilot c_f C_f ω (midpoint K l) i) * (cellAverage (fun y => markedDensityVector c_f C_f L P n hP y j) K l - pilot c_f C_f ω (midpoint K l) j))
CausalSmith.Stat.TransportCaceRoughnuisanceLength.quadraticCellProjectionBias · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/QuadraticProjectionBias.lean:18
theorem quadraticCellProjectionBias_abs_le

Exact cancellation of the single-residual terms bounds the total quadratic projection bias by half the coordinate count squared times the derivative and squared Hölder envelopes. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n K :
ℕ
hn :
threshold ≤ n
hP :
ModelClass c_f C_f L P n
hK :
0 < K
ω :
A :
|quadraticCellProjectionBias c_f C_f L P n K hP ω A|
≤ ((7 : ℝ) ^ 2 / 2) * fourthDerivativeEnvelope c_f C_f * (3 * (1 + C_f) * L * (1 / (K : ℝ)) ^ holderExponent) ^ 2
Proof (Lean source)
-- @node: quadraticCellProjectionBias_abs_le lemma quadraticCellProjectionBias_abs_le (c_f C_f L : ℝ) (P : TransportLaw) (n K : ℕ) (hn : threshold ≤ n) (hP : ModelClass c_f C_f L P n) (hK : 0 < K) (ω : TwoSample n n) (A : Bool) : |quadraticCellProjectionBias c_f C_f L P n K hP ω A| ≤ ((7 : ℝ) ^ 2 / 2) * fourthDerivativeEnvelope c_f C_f * (3 * (1 + C_f) * L * (1 / (K : ℝ)) ^ holderExponent) ^ 2 := by classical let B := 3 * (1 + C_f) * L * (1 / (K : ℝ)) ^ holderExponent let M := fourthDerivativeEnvelope c_f C_f have hKr : (0 : ℝ) < K := by exact_mod_cast hK have hM : 0 ≤ M := by have hc := hP.sourceBounds.1.1 dsimp [M, fourthDerivativeEnvelope] positivity have hc (i j : Fin 7) (l : Fin K) : |dPhi2 A (pilot c_f C_f ω (midpoint K l)) i j / 2| ≤ M / 2 := by rw [abs_div, abs_of_pos (by norm_num : (0 : ℝ) < 2)] exact div_le_div_of_nonneg_right (dPhi2_abs_le c_f C_f hP.sourceBounds.1 hP.sourceBounds.2.1 A _ (pilot_mem_clippingRectangle c_f C_f L P n hn hP ω (midpoint K l)) i j) (by norm_num) unfold quadraticCellProjectionBias calc _ ≤ ∑ i : Fin 7, ∑ j : Fin 7, ∑ l : Fin K, M / 2 * B ^ 2 / (K : ℝ) := by apply (Finset.abs_sum_le_sum_abs _ _).trans apply Finset.sum_le_sum intro i hi apply (Finset.abs_sum_le_sum_abs _ _).trans apply Finset.sum_le_sum intro j hj apply (Finset.abs_sum_le_sum_abs _ _).trans apply Finset.sum_le_sum intro l hl exact (markedDensity_quadratic_cell_projection_abs_le c_f C_f L P n K hP hK l i j (pilot c_f C_f ω (midpoint K l) i) (pilot c_f C_f ω (midpoint K l) j) (dPhi2 A (pilot c_f C_f ω (midpoint K l)) i j / 2)).trans (div_le_div_of_nonneg_right (mul_le_mul_of_nonneg_right (hc i j l) (sq_nonneg B)) hKr.le) _ = _ := by simp only [Finset.sum_const, Finset.card_univ, Fintype.card_fin, nsmul_eq_mul] dsimp [M, B] field_simp
CausalSmith.Stat.TransportCaceRoughnuisanceLength.quadraticCellProjectionBias_abs_le · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/QuadraticProjectionBias.lean:36
theorem quadraticResolution_inverse_half_rate

The inverse quadratic resolution has the explicit rate required by the quadratic projection bias, including the factor lost to dyadic rounding. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
n :
ℕ
hn :
threshold ≤ n
(1 / (quadraticResolution n : ℝ)) ^ (1 / 2 : ℝ)
≤ (2 : ℝ) ^ (1 / 2 : ℝ) * (5 : ℝ) ^ (2 / 3 : ℝ) * (n : ℝ) ^ (-(2 / 3 : ℝ))
Proof (Lean source)
-- @node: quadraticResolution_inverse_half_rate lemma quadraticResolution_inverse_half_rate (n : ℕ) (hn : threshold ≤ n) : (1 / (quadraticResolution n : ℝ)) ^ (1 / 2 : ℝ) ≤ (2 : ℝ) ^ (1 / 2 : ℝ) * (5 : ℝ) ^ (2 / 3 : ℝ) * (n : ℝ) ^ (-(2 / 3 : ℝ)) := by have hnpos : (0 : ℝ) < n := by exact_mod_cast (show 0 < n by norm_num [threshold] at hn; omega) have hm := Real.rpow_le_rpow (div_pos hnpos (by norm_num)).le (block_size_lower n hn 0) (by norm_num : (0 : ℝ) ≤ 4 / 3) have hlow := (quadraticResolution_power_bounds n hn).1 have hl : ((n : ℝ) / 5) ^ (4 / 3 : ℝ) / 2 ≤ (quadraticResolution n : ℝ) := (div_le_div_of_nonneg_right hm (by norm_num)).trans hlow have hbase : 0 < ((n : ℝ) / 5) ^ (4 / 3 : ℝ) / 2 := by positivity have h := Real.rpow_le_rpow_of_nonpos hbase hl (by norm_num : -(1 / 2 : ℝ) ≤ 0) calc _ = (quadraticResolution n : ℝ) ^ (-(1 / 2 : ℝ)) := by rw [Real.div_rpow (by norm_num) (by positivity), Real.one_rpow, Real.rpow_neg (by positivity)] simp only [one_div] _ ≤ (((n : ℝ) / 5) ^ (4 / 3 : ℝ) / 2) ^ (-(1 / 2 : ℝ)) := h _ = _ := by rw [Real.div_rpow (by positivity) (by norm_num), ← Real.rpow_mul (by positivity)] norm_num rw [Real.div_rpow hnpos.le (by norm_num), Real.rpow_neg (by norm_num : (0 : ℝ) ≤ 5), Real.rpow_neg (by norm_num : (0 : ℝ) ≤ 2)] field_simp
CausalSmith.Stat.TransportCaceRoughnuisanceLength.quadraticResolution_inverse_half_rate · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/QuadraticProjectionBias.lean:86
theorem quadraticCellProjectionBias_sq_sample_rate

The squared exact cellwise quadratic projection bias obeys roadmap (11) with the computable constant used in the MSE envelope. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hn :
threshold ≤ n
hP :
ModelClass c_f C_f L P n
ω :
A :
(quadraticCellProjectionBias c_f C_f L P n (quadraticResolution n) hP ω A) ^ 2
≤ (7 : ℝ) ^ 4 * (fourthDerivativeEnvelope c_f C_f) ^ 2 * (3 * (1 + C_f) * L) ^ 4 * (2 : ℝ) ^ (1 / 2 : ℝ) * (5 : ℝ) ^ (2 / 3 : ℝ) * (n : ℝ) ^ (-(2 / 3 : ℝ))
Proof (Lean source)
-- @node: quadraticCellProjectionBias_sq_sample_rate lemma quadraticCellProjectionBias_sq_sample_rate (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hn : threshold ≤ n) (hP : ModelClass c_f C_f L P n) (ω : TwoSample n n) (A : Bool) : (quadraticCellProjectionBias c_f C_f L P n (quadraticResolution n) hP ω A) ^ 2 ≤ (7 : ℝ) ^ 4 * (fourthDerivativeEnvelope c_f C_f) ^ 2 * (3 * (1 + C_f) * L) ^ 4 * (2 : ℝ) ^ (1 / 2 : ℝ) * (5 : ℝ) ^ (2 / 3 : ℝ) * (n : ℝ) ^ (-(2 / 3 : ℝ)) := by have hK : 0 < quadraticResolution n := by unfold quadraticResolution dyadicResolution split_ifs <;> positivity let H := 3 * (1 + C_f) * L let M := fourthDerivativeEnvelope c_f C_f let q : ℝ := 1 / (quadraticResolution n : ℝ) have hq : 0 ≤ q := by dsimp [q]; positivity have hM : 0 ≤ M := by have hc := hP.sourceBounds.1.1 dsimp [M, fourthDerivativeEnvelope] positivity have hH : 0 ≤ H := by have hC := hP.sourceBounds.2.1 have hL := hP.sourceHolder.1 dsimp [H] positivity have habs := quadraticCellProjectionBias_abs_le c_f C_f L P n (quadraticResolution n) hn hP hK ω A have hs := pow_le_pow_left₀ (abs_nonneg _) habs 2 rw [sq_abs] at hs have hp : (q ^ holderExponent) ^ (4 : ℕ) = q ^ (1 / 2 : ℝ) := by rw [← Real.rpow_natCast, ← Real.rpow_mul hq] norm_num [holderExponent] have heq : (((7 : ℝ) ^ 2 / 2) * M * (H * q ^ holderExponent) ^ 2) ^ 2 = ((7 : ℝ) ^ 4 * M ^ 2 * H ^ 4 / 4) * q ^ (1 / 2 : ℝ) := by calc _ = ((7 : ℝ) ^ 4 * M ^ 2 * H ^ 4 / 4) * (q ^ holderExponent) ^ (4 : ℕ) := by ring _ = _ := by rw [hp] change _ ≤ (((7 : ℝ) ^ 2 / 2) * M * (H * q ^ holderExponent) ^ 2) ^ 2 at hs rw [heq] at hs have hr := quadraticResolution_inverse_half_rate n hn change q ^ (1 / 2 : ℝ) ≤ _ at hr calc _ ≤ ((7 : ℝ) ^ 4 * M ^ 2 * H ^ 4 / 4) * q ^ (1 / 2 : ℝ) := hs _ ≤ ((7 : ℝ) ^ 4 * M ^ 2 * H ^ 4 / 4) * ((2 : ℝ) ^ (1 / 2 : ℝ) * (5 : ℝ) ^ (2 / 3 : ℝ) * (n : ℝ) ^ (-(2 / 3 : ℝ))) := mul_le_mul_of_nonneg_left hr (by positivity) _ ≤ _ := by change _ ≤ (7 : ℝ) ^ 4 * M ^ 2 * H ^ 4 * (2 : ℝ) ^ (1 / 2 : ℝ) * (5 : ℝ) ^ (2 / 3 : ℝ) * (n : ℝ) ^ (-(2 / 3 : ℝ)) have ht : 0 ≤ (7 : ℝ) ^ 4 * M ^ 2 * H ^ 4 * (2 : ℝ) ^ (1 / 2 : ℝ) * (5 : ℝ) ^ (2 / 3 : ℝ) * (n : ℝ) ^ (-(2 / 3 : ℝ)) := by positivity nlinarith
CausalSmith.Stat.TransportCaceRoughnuisanceLength.quadraticCellProjectionBias_sq_sample_rate · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/QuadraticProjectionBias.lean:117
theorem quadraticCellProjectionBias_eq_sub_projectionMean

The summed cell bias is exactly the midpoint-frozen quadratic Taylor integral minus the projection polynomial that is the statistic's conditional mean. This identity keeps the exact coefficient and all seven coordinates. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hP :
ModelClass c_f C_f L P n
ω :
A :
= (∑ i : Fin 7, ∑ j : Fin 7, ∑ l : Fin (quadraticResolution n), ∫ x in cell (quadraticResolution n) l, (dPhi2 A (pilot c_f C_f ω (midpoint (quadraticResolution n) l)) i j / 2) * (markedDensityVector c_f C_f L P n hP x i - pilot c_f C_f ω (midpoint (quadraticResolution n) l) i) * (markedDensityVector c_f C_f L P n hP x j - pilot c_f C_f ω (midpoint (quadraticResolution n) l) j))
- quadraticProjectionMean c_f C_f L P n hP ω A
Proof (Lean source)
-- @node: quadraticCellProjectionBias_eq_sub_projectionMean lemma quadraticCellProjectionBias_eq_sub_projectionMean (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hP : ModelClass c_f C_f L P n) (ω : TwoSample n n) (A : Bool) : quadraticCellProjectionBias c_f C_f L P n (quadraticResolution n) hP ω A = (∑ i : Fin 7, ∑ j : Fin 7, ∑ l : Fin (quadraticResolution n), ∫ x in cell (quadraticResolution n) l, (dPhi2 A (pilot c_f C_f ω (midpoint (quadraticResolution n) l)) i j / 2) * (markedDensityVector c_f C_f L P n hP x i - pilot c_f C_f ω (midpoint (quadraticResolution n) l) i) * (markedDensityVector c_f C_f L P n hP x j - pilot c_f C_f ω (midpoint (quadraticResolution n) l) j)) - quadraticProjectionMean c_f C_f L P n hP ω A := by classical let K := quadraticResolution n have hK : 0 < K := by dsimp [K] unfold quadraticResolution dyadicResolution split_ifs <;> positivity have hcell (i j : Fin 7) (l : Fin K) (ti tj c : ℝ) : (∫ x in cell K l, c * ((markedDensityVector c_f C_f L P n hP x i - ti) * (markedDensityVector c_f C_f L P n hP x j - tj) - (cellAverage (fun y => markedDensityVector c_f C_f L P n hP y i) K l - ti) * (cellAverage (fun y => markedDensityVector c_f C_f L P n hP y j) K l - tj))) = (∫ x in cell K l, c * (markedDensityVector c_f C_f L P n hP x i - ti) * (markedDensityVector c_f C_f L P n hP x j - tj)) - (K : ℝ)⁻¹ * (c * (cellAverage (fun y => markedDensityVector c_f C_f L P n hP y i) K l - ti) * (cellAverage (fun y => markedDensityVector c_f C_f L P n hP y j) K l - tj)) := by have hi := markedDensityVector_continuousOn c_f C_f L P n hP i have hj := markedDensityVector_continuousOn c_f C_f L P n hP j have hint : IntegrableOn (fun x => c * (markedDensityVector c_f C_f L P n hP x i - ti) * (markedDensityVector c_f C_f L P n hP x j - tj)) (cell K l) := (show ContinuousOn _ covariateSpace by fun_prop).integrableOn_Icc.mono_set (cell_subset_covariateSpace hK l) have hfinite : volume (cell K l) ≠ ⊤ := by rw [volume_cell hK l] exact ENNReal.ofReal_ne_top conv_lhs => arg 2; ext x; rw [mul_sub, ← mul_assoc, ← mul_assoc] rw [integral_sub hint (integrableOn_const hfinite), setIntegral_const, Measure.real, volume_cell hK l, ENNReal.toReal_ofReal (by positivity)] simp only [smul_eq_mul, one_div] dsimp only [K] at hcell rw [quadraticProjectionMean_eq] unfold quadraticCellProjectionBias dsimp only simp_rw [hcell, Finset.sum_sub_distrib, ← Finset.mul_sum] congr 1 congr 1 apply Finset.sum_congr rfl intro i hi apply Finset.sum_congr rfl intro j hj apply Finset.sum_congr rfl intro l hl ring
CausalSmith.Stat.TransportCaceRoughnuisanceLength.quadraticCellProjectionBias_eq_sub_projectionMean · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/QuadraticProjectionBias.lean:175
theorem quadraticCellProjectionBias_integrated_sq_sample_rate

The deterministic quadratic bias bound also holds after averaging over training data, without any extra regularity premise. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hn :
threshold ≤ n
hP :
ModelClass c_f C_f L P n
A :
(∫ ω, (quadraticCellProjectionBias c_f C_f L P n (quadraticResolution n) hP ω A) ^ 2 ∂dataLaw P n n)
≤ (7 : ℝ) ^ 4 * (fourthDerivativeEnvelope c_f C_f) ^ 2 * (3 * (1 + C_f) * L) ^ 4 * (2 : ℝ) ^ (1 / 2 : ℝ) * (5 : ℝ) ^ (2 / 3 : ℝ) * (n : ℝ) ^ (-(2 / 3 : ℝ))
Proof (Lean source)
-- @node: quadraticCellProjectionBias_integrated_sq_sample_rate lemma quadraticCellProjectionBias_integrated_sq_sample_rate (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hn : threshold ≤ n) (hP : ModelClass c_f C_f L P n) (A : Bool) : (∫ ω, (quadraticCellProjectionBias c_f C_f L P n (quadraticResolution n) hP ω A) ^ 2 ∂dataLaw P n n) ≤ (7 : ℝ) ^ 4 * (fourthDerivativeEnvelope c_f C_f) ^ 2 * (3 * (1 + C_f) * L) ^ 4 * (2 : ℝ) ^ (1 / 2 : ℝ) * (5 : ℝ) ^ (2 / 3 : ℝ) * (n : ℝ) ^ (-(2 / 3 : ℝ)) := by let : IsProbabilityMeasure (sourceObsLaw P) := sourceObsLaw_isProbabilityMeasure c_f C_f L P n hP let : IsProbabilityMeasure (targetXLaw P) := targetXLaw_isProbabilityMeasure c_f C_f L P n hP let : IsProbabilityMeasure (dataLaw P n n) := by rw [dataLaw_eq_source_target_pi c_f C_f L P n hP] infer_instance calc _ ≤ ∫ _ω : TwoSample n n, (7 : ℝ) ^ 4 * (fourthDerivativeEnvelope c_f C_f) ^ 2 * (3 * (1 + C_f) * L) ^ 4 * (2 : ℝ) ^ (1 / 2 : ℝ) * (5 : ℝ) ^ (2 / 3 : ℝ) * (n : ℝ) ^ (-(2 / 3 : ℝ)) ∂dataLaw P n n := by apply integral_mono_of_nonneg (Filter.Eventually.of_forall fun ω => sq_nonneg _) (integrable_const _) exact Filter.Eventually.of_forall fun ω => quadraticCellProjectionBias_sq_sample_rate c_f C_f L P n hn hP ω A _ = _ := by simp
CausalSmith.Stat.TransportCaceRoughnuisanceLength.quadraticCellProjectionBias_integrated_sq_sample_rate · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/QuadraticProjectionBias.lean:238
CausalSmith.Stat.STAT_TransportCaceRoughnuisanceLength_Research.Helpers.CubicMse.RemainderMajorant 4 declarations The nonnegative fourth-order pilot-error envelope has an integrable square and the exact BR bound.

Integrable majorant for the integrated Taylor remainder

The nonnegative fourth-order pilot-error envelope has an integrable square and the exact BR bound. This permits combining bias components without assuming measurability or integrability of their Taylor representations.

def pilotRemainderMajorant

The spatial integral of the fourth-order Taylor remainder envelope. For the displayed assumptions and inputs, the stated object is defined.

Definition (Lean source)
c_f C_f L :
ℝ
n :
ℕ
hP :
ModelClass c_f C_f L P n
ω :
pilotRemainderMajorant c_f C_f L P n hP ω :
ℝ
∫ x in covariateSpace, (fourthDerivativeEnvelope c_f C_f / 24) * (∑ i : Fin 7, |pilot c_f C_f ω x i - markedDensityVector c_f C_f L P n hP x i|) ^ 4
CausalSmith.Stat.TransportCaceRoughnuisanceLength.pilotRemainderMajorant · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/RemainderMajorant.lean:16
theorem pilotRemainderMajorant_integrable_sq_and_moment

Clipping and the eighth pilot moment give an integrable squared remainder envelope and the exact second-moment constant BR. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hn :
threshold ≤ n
hP :
ModelClass c_f C_f L P n
conclusion 1
Integrable (fun ω => pilotRemainderMajorant c_f C_f L P n hP ω ^ 2) (dataLaw P n n)
conclusion 2
(∫ ω, pilotRemainderMajorant c_f C_f L P n hP ω ^ 2 ∂dataLaw P n n)
≤ (fourthDerivativeEnvelope c_f C_f / 24) ^ 2 * (7 : ℝ) ^ (8 : ℕ) * pilotEighthConstant C_f L * (n : ℝ) ^ (-(4 / 5 : ℝ))
Proof (Lean source)
-- @node: pilotRemainderMajorant_integrable_sq_and_moment lemma pilotRemainderMajorant_integrable_sq_and_moment (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hn : threshold ≤ n) (hP : ModelClass c_f C_f L P n) : Integrable (fun ω => pilotRemainderMajorant c_f C_f L P n hP ω ^ 2) (dataLaw P n n) ∧ (∫ ω, pilotRemainderMajorant c_f C_f L P n hP ω ^ 2 ∂dataLaw P n n) ≤ (fourthDerivativeEnvelope c_f C_f / 24) ^ 2 * (7 : ℝ) ^ (8 : ℕ) * pilotEighthConstant C_f L * (n : ℝ) ^ (-(4 / 5 : ℝ)) := by classical let μ := dataLaw P n n let ν := volume.restrict covariateSpace let : IsProbabilityMeasure (sourceObsLaw P) := sourceObsLaw_isProbabilityMeasure c_f C_f L P n hP let : IsProbabilityMeasure (targetXLaw P) := targetXLaw_isProbabilityMeasure c_f C_f L P n hP have hprob : IsProbabilityMeasure μ := by dsimp [μ] rw [dataLaw_eq_source_target_pi c_f C_f L P n hP] infer_instance let := hprob have hvol : IsProbabilityMeasure ν := ⟨by simp [ν, covariateSpace]⟩ let := hvol let F (x : ℝ) (i : Fin 7) := covariateSpace.indicator (fun y => markedDensityVector c_f C_f L P n hP y i) x let e (ω : TwoSample n n) (x : ℝ) (i : Fin 7) := pilot c_f C_f ω x i - F x i let M := fourthDerivativeEnvelope c_f C_f / 24 let g (ω : TwoSample n n) (x : ℝ) := M * (∑ i : Fin 7, |e ω x i|) ^ 4 have hc := hP.sourceBounds.1.1 have hC : 0 ≤ C_f := le_trans (by norm_num) hP.sourceBounds.2.1.le have hM : 0 ≤ M := by dsimp [M, fourthDerivativeEnvelope]; positivity have he_meas (i : Fin 7) : Measurable (fun p : TwoSample n n × ℝ => e p.1 p.2 i) := (measurable_pilot_joint c_f C_f i).sub ((measurable_markedDensityVector_indicator c_f C_f L P n hP i).comp measurable_snd) have hg : Measurable (uncurry g) := by dsimp [g, uncurry] fun_prop have he_bound (ω : TwoSample n n) (x : ℝ) (hx : x ∈ covariateSpace) (i : Fin 7) : |e ω x i| ≤ 2 * C_f := by dsimp [e, F] rw [Set.indicator_of_mem hx] simpa only [two_mul] using (abs_sub _ _).trans (add_le_add (clippingRectangle_coordinate_abs_le c_f C_f hc hC _ (pilot_mem_clippingRectangle c_f C_f L P n hn hP ω x) i) (clippingRectangle_coordinate_abs_le c_f C_f hc hC _ (markedDensityVector_mem_clippingRectangle c_f C_f L P n hP x hx) i)) have hbound (ω : TwoSample n n) : ∀ᵐ x ∂ν, |g ω x| ≤ M * (14 * C_f) ^ 4 := by apply ae_restrict_of_forall_mem measurableSet_Icc intro x hx have hs : (∑ i : Fin 7, |e ω x i|) ≤ 14 * C_f := by calc _ ≤ ∑ _i : Fin 7, 2 * C_f := Finset.sum_le_sum fun i _ => he_bound ω x hx i _ = _ := by simp; ring dsimp [g] rw [abs_of_nonneg (by positivity)] exact mul_le_mul_of_nonneg_left (pow_le_pow_left₀ (Finset.sum_nonneg fun _ _ => abs_nonneg _) hs 4) hM have hmoment : ∀ᵐ x ∂ν, (∫ ω, (g ω x) ^ 2 ∂μ) ≤ M ^ 2 * (7 : ℝ) ^ (8 : ℕ) * pilotEighthConstant C_f L * (n : ℝ) ^ (-(4 / 5 : ℝ)) := by apply ae_restrict_of_forall_mem measurableSet_Icc intro x hx change x ∈ covariateSpace at hx have hi (i : Fin 7) : Integrable (fun ω => |e ω x i| ^ (8 : ℕ)) μ := by simpa [e, F, hx, μ] using integrable_pilot_error_eighth c_f C_f L P n hn hP x hx i calc _ ≤ ∫ ω, (M ^ 2 * (7 : ℝ) ^ (7 : ℕ)) * ∑ i : Fin 7, |e ω x i| ^ (8 : ℕ) ∂μ := by apply integral_mono_of_nonneg (Filter.Eventually.of_forall fun ω => sq_nonneg _) ((integrable_finsetSum univ (fun i _ => hi i)).const_mul _) filter_upwards [] with ω dsimp only [g] rw [mul_pow, ← pow_mul] rw [mul_assoc] exact mul_le_mul_of_nonneg_left (sum_abs_eighth_le (e ω x)) (sq_nonneg _) _ = (M ^ 2 * (7 : ℝ) ^ (7 : ℕ)) * ∑ i : Fin 7, ∫ ω, |e ω x i| ^ (8 : ℕ) ∂μ := by rw [integral_const_mul, integral_finsetSum univ (fun i _ => hi i)] _ ≤ (M ^ 2 * (7 : ℝ) ^ (7 : ℕ)) * ∑ _i : Fin 7, pilotEighthConstant C_f L * (n : ℝ) ^ (-(4 / 5 : ℝ)) := by apply mul_le_mul_of_nonneg_left _ (by positivity) apply Finset.sum_le_sum intro i _ simpa [e, F, hx, μ] using pilot_eighth_moment c_f C_f L P n hn hP i x hx _ = _ := by simp; ring have hnonneg (ω : TwoSample n n) : ∀ᵐ x ∂ν, 0 ≤ g ω x := by filter_upwards [] with x dsimp [g] positivity have hr (ω : TwoSample n n) : ∀ᵐ x ∂ν, |g ω x| ≤ g ω x := by filter_upwards [hnonneg ω] with x hx rw [abs_of_nonneg hx] have hm := integrated_second_moment_le_of_majorant μ ν g g (M * (14 * C_f) ^ 4) _ hg hbound hr hmoment have heq (ω : TwoSample n n) : pilotRemainderMajorant c_f C_f L P n hP ω = ∫ x, g ω x ∂ν := by apply setIntegral_congr_fun measurableSet_Icc intro x hx change x ∈ covariateSpace at hx simp [g, M, e, F, hx] have hi : Integrable (fun ω => (∫ x, g ω x ∂ν) ^ 2) μ := by apply Integrable.of_bound (hg.stronglyMeasurable.integral_prod_right.pow 2).aestronglyMeasurable ((M * (14 * C_f) ^ 4) ^ 2) filter_upwards [] with ω rw [Real.norm_eq_abs, abs_of_nonneg (sq_nonneg _)] have habs : |∫ x, g ω x ∂ν| ≤ M * (14 * C_f) ^ 4 := (abs_integral_le_integral_abs.trans (integral_mono_of_nonneg (Filter.Eventually.of_forall fun x => abs_nonneg _) (integrable_const _) (hbound ω))).trans_eq (by simp) simpa only [sq_abs, Pi.pow_apply] using pow_le_pow_left₀ (abs_nonneg _) habs 2 constructor · simpa only [← heq] using hi · simpa only [← heq] using hm
CausalSmith.Stat.TransportCaceRoughnuisanceLength.pilotRemainderMajorant_integrable_sq_and_moment · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/RemainderMajorant.lean:24
theorem pilot_remainder_integral_abs_le_majorant

The exact spatial Taylor remainder is dominated by its nonnegative, integrable spatial envelope. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hn :
threshold ≤ n
hP :
ModelClass c_f C_f L P n
A :
ω :
|∫ x in covariateSpace, (let v := pilot c_f C_f ω x let h := markedDensityVector c_f C_f L P n hP x - v Phi A (markedDensityVector c_f C_f L P n hP x) - (Phi A v + iteratedFDeriv ℝ 1 (Phi A) v ![h] + iteratedFDeriv ℝ 2 (Phi A) v ![h, h] / 2 + iteratedFDeriv ℝ 3 (Phi A) v ![h, h, h] / 6))|
≤ pilotRemainderMajorant c_f C_f L P n hP ω
Proof (Lean source)
-- @node: pilot_remainder_integral_abs_le_majorant lemma pilot_remainder_integral_abs_le_majorant (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hn : threshold ≤ n) (hP : ModelClass c_f C_f L P n) (A : Bool) (ω : TwoSample n n) : |∫ x in covariateSpace, (let v := pilot c_f C_f ω x let h := markedDensityVector c_f C_f L P n hP x - v Phi A (markedDensityVector c_f C_f L P n hP x) - (Phi A v + iteratedFDeriv ℝ 1 (Phi A) v ![h] + iteratedFDeriv ℝ 2 (Phi A) v ![h, h] / 2 + iteratedFDeriv ℝ 3 (Phi A) v ![h, h, h] / 6))| ≤ pilotRemainderMajorant c_f C_f L P n hP ω := by let ν := volume.restrict covariateSpace let : IsProbabilityMeasure ν := ⟨by simp [ν, covariateSpace]⟩ let F (x : ℝ) (i : Fin 7) := covariateSpace.indicator (fun y => markedDensityVector c_f C_f L P n hP y i) x let g (x : ℝ) := (fourthDerivativeEnvelope c_f C_f / 24) * (∑ i : Fin 7, |pilot c_f C_f ω x i - F x i|) ^ 4 have hc := hP.sourceBounds.1.1 have hC : 0 ≤ C_f := hP.sourceBounds.2.1.le.trans' (by norm_num) have hM : 0 ≤ fourthDerivativeEnvelope c_f C_f / 24 := by unfold fourthDerivativeEnvelope positivity have hF (i : Fin 7) : Measurable (fun x => F x i) := measurable_markedDensityVector_indicator c_f C_f L P n hP i have hg : Measurable g := by dsimp [g] fun_prop have hb : ∀ᵐ x ∂ν, |g x| ≤ (fourthDerivativeEnvelope c_f C_f / 24) * (14 * C_f) ^ 4 := by apply ae_restrict_of_forall_mem measurableSet_Icc intro x hx change x ∈ covariateSpace at hx have he (i : Fin 7) : |pilot c_f C_f ω x i - F x i| ≤ 2 * C_f := by dsimp [F] rw [Set.indicator_of_mem hx] simpa only [two_mul] using (abs_sub _ _).trans (add_le_add (clippingRectangle_coordinate_abs_le c_f C_f hc hC _ (pilot_mem_clippingRectangle c_f C_f L P n hn hP ω x) i) (clippingRectangle_coordinate_abs_le c_f C_f hc hC _ (markedDensityVector_mem_clippingRectangle c_f C_f L P n hP x hx) i)) have hs : (∑ i : Fin 7, |pilot c_f C_f ω x i - F x i|) ≤ 14 * C_f := by calc _ ≤ ∑ _i : Fin 7, 2 * C_f := Finset.sum_le_sum fun i _ => he i _ = _ := by simp; ring dsimp [g] rw [abs_of_nonneg (by positivity)] exact mul_le_mul_of_nonneg_left (pow_le_pow_left₀ (Finset.sum_nonneg fun _ _ => abs_nonneg _) hs 4) hM have hi : Integrable g ν := Integrable.of_bound hg.aestronglyMeasurable _ (by simpa only [Real.norm_eq_abs] using hb) have heq : (∫ x, g x ∂ν) = pilotRemainderMajorant c_f C_f L P n hP ω := by apply setIntegral_congr_fun measurableSet_Icc intro x hx change x ∈ covariateSpace at hx simp [g, F, hx] rw [← heq] apply abs_integral_le_integral_abs.trans (integral_mono_of_nonneg (Filter.Eventually.of_forall fun x => abs_nonneg _) hi _) apply ae_restrict_of_forall_mem measurableSet_Icc intro x hx change x ∈ covariateSpace at hx simpa [g, F, hx, abs_sub_comm] using pilot_Phi_cubic_taylor_remainder_abs_le c_f C_f L P n hn hP A ω x hx
CausalSmith.Stat.TransportCaceRoughnuisanceLength.pilot_remainder_integral_abs_le_majorant · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/RemainderMajorant.lean:146
theorem pilotRemainderMajorant_sample_rate

The remainder envelope has the common n^(-2/3) rate needed in (14). Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hn :
threshold ≤ n
hP :
ModelClass c_f C_f L P n
(∫ ω, pilotRemainderMajorant c_f C_f L P n hP ω ^ 2 ∂dataLaw P n n)
≤ ((fourthDerivativeEnvelope c_f C_f / 24) ^ 2 * (7 : ℝ) ^ (8 : ℕ) * pilotEighthConstant C_f L) * (n : ℝ) ^ (-(2 / 3 : ℝ))
Proof (Lean source)
-- @node: pilotRemainderMajorant_sample_rate lemma pilotRemainderMajorant_sample_rate (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hn : threshold ≤ n) (hP : ModelClass c_f C_f L P n) : (∫ ω, pilotRemainderMajorant c_f C_f L P n hP ω ^ 2 ∂dataLaw P n n) ≤ ((fourthDerivativeEnvelope c_f C_f / 24) ^ 2 * (7 : ℝ) ^ (8 : ℕ) * pilotEighthConstant C_f L) * (n : ℝ) ^ (-(2 / 3 : ℝ)) := by have hn1 : (1 : ℝ) ≤ n := by exact_mod_cast (show 1 ≤ n by norm_num [threshold] at hn; omega) have hC : 0 ≤ C_f := hP.sourceBounds.2.1.le.trans' (by norm_num) have hA8 : 0 ≤ pilotEighthConstant C_f L := by unfold pilotEighthConstant positivity exact (pilotRemainderMajorant_integrable_sq_and_moment c_f C_f L P n hn hP).2.trans (mul_le_mul_of_nonneg_left (Real.rpow_le_rpow_of_exponent_le hn1 (by norm_num)) (by positivity))
CausalSmith.Stat.TransportCaceRoughnuisanceLength.pilotRemainderMajorant_sample_rate · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/RemainderMajorant.lean:215
CausalSmith.Stat.STAT_TransportCaceRoughnuisanceLength_Research.Helpers.CubicMse.RemainderMoments 4 declarations The finite-dimensional Jensen inequality and the clipped pilot eighth moment control the squared remainder with the constants in roadmap (9).

Pointwise second moment of the exact cubic Taylor remainder

The finite-dimensional Jensen inequality and the clipped pilot eighth moment control the squared remainder with the constants in roadmap (9). The spatial integral and the projection-bias assembly remain separate proof obligations.

Given the supplied inputs, the stated result about sum abs eighth le holds.

Formal statement
v :
Fin 7 → ℝ
(∑ i, |v i|) ^ (8 : ℕ) ≤ (7 : ℝ) ^ (7 : ℕ) * ∑ i, |v i| ^ (8 : ℕ)
Proof (Lean source)
lemma sum_abs_eighth_le (v : Fin 7 → ℝ) : (∑ i, |v i|) ^ (8 : ℕ) ≤ (7 : ℝ) ^ (7 : ℕ) * ∑ i, |v i| ^ (8 : ℕ) := by have h := Real.rpow_sum_le_const_mul_sum_rpow_of_nonneg (s := univ) (f := fun i => |v i|) (p := (8 : ℝ)) (by norm_num) (fun i _ => abs_nonneg (v i)) norm_num [Real.rpow_natCast] at h norm_num exact h
theorem clippingRectangle_coordinate_abs_le Lemma clippingRectangle_coordinate_abs_le in the paper ↗

Given the supplied inputs, the stated result about clipping rectangle coordinate abs le holds.

Formal statement
c_f C_f :
ℝ
hc :
0 < c_f
hC :
0 ≤ C_f
v :
Fin 7 → ℝ
hv :
i :
Fin 7
|v i| ≤ C_f
Proof (Lean source)
lemma clippingRectangle_coordinate_abs_le (c_f C_f : ℝ) (hc : 0 < c_f) (hC : 0 ≤ C_f) (v : Fin 7 → ℝ) (hv : clippingRectangle c_f C_f v) (i : Fin 7) : |v i| ≤ C_f := by rcases hv with ⟨h0, h1, h2, hr⟩ fin_cases i · change |v 0| ≤ C_f rw [abs_of_nonneg (hc.le.trans h0.1)]; exact h0.2 · change |v 1| ≤ C_f rw [abs_of_nonneg (by linarith [h1.1] : 0 ≤ v 1)]; linarith [h1.2] · change |v 2| ≤ C_f rw [abs_of_nonneg (by linarith [h2.1] : 0 ≤ v 2)]; linarith [h2.2] · change |v 3| ≤ C_f have h := hr 3 (by norm_num) rw [abs_of_nonneg h.1]; linarith [h.2] · change |v 4| ≤ C_f have h := hr 4 (by norm_num) rw [abs_of_nonneg h.1]; linarith [h.2] · change |v 5| ≤ C_f have h := hr 5 (by norm_num) rw [abs_of_nonneg h.1]; linarith [h.2] · change |v 6| ≤ C_f have h := hr 6 (by norm_num) rw [abs_of_nonneg h.1]; linarith [h.2]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.clippingRectangle_coordinate_abs_le · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/RemainderMoments.lean:31
theorem integrable_pilot_error_eighth

Given the supplied inputs, the stated result about integrable pilot error eighth holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hn :
threshold ≤ n
hP :
ModelClass c_f C_f L P n
x :
ℝ
hx :
i :
Fin 7
Integrable (fun ω => |pilot c_f C_f ω x i - markedDensityVector c_f C_f L P n hP x i| ^ (8 : ℕ)) (dataLaw P n n)
Proof (Lean source)
lemma integrable_pilot_error_eighth (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hn : threshold ≤ n) (hP : ModelClass c_f C_f L P n) (x : ℝ) (hx : x ∈ covariateSpace) (i : Fin 7) : Integrable (fun ω => |pilot c_f C_f ω x i - markedDensityVector c_f C_f L P n hP x i| ^ (8 : ℕ)) (dataLaw P n n) := by letI : IsProbabilityMeasure (sourceObsLaw P) := sourceObsLaw_isProbabilityMeasure c_f C_f L P n hP letI : IsProbabilityMeasure (targetXLaw P) := targetXLaw_isProbabilityMeasure c_f C_f L P n hP have hprob : IsProbabilityMeasure (dataLaw P n n) := by rw [dataLaw_eq_source_target_pi c_f C_f L P n hP]; infer_instance letI := hprob have hc := hP.sourceBounds.1.1 have hC : 0 ≤ C_f := le_trans (by norm_num) hP.sourceBounds.2.1.le have hm : Measurable (fun ω : TwoSample n n => |pilot c_f C_f ω x i - markedDensityVector c_f C_f L P n hP x i| ^ (8 : ℕ)) := by fun_prop apply Integrable.of_bound hm.aestronglyMeasurable ((2 * C_f) ^ (8 : ℕ)) filter_upwards [] with ω rw [Real.norm_eq_abs, abs_of_nonneg (by positivity)] apply pow_le_pow_left₀ (abs_nonneg _) _ simpa only [two_mul] using (abs_sub _ _).trans (add_le_add (clippingRectangle_coordinate_abs_le c_f C_f hc hC _ (pilot_mem_clippingRectangle c_f C_f L P n hn hP ω x) i) (clippingRectangle_coordinate_abs_le c_f C_f hc hC _ (markedDensityVector_mem_clippingRectangle c_f C_f L P n hP x hx) i))
CausalSmith.Stat.TransportCaceRoughnuisanceLength.integrable_pilot_error_eighth · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/RemainderMoments.lean:57
theorem pilot_Phi_cubic_taylor_remainder_second_moment

Given the supplied inputs, the stated result about pilot phi cubic taylor remainder second moment holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hn :
threshold ≤ n
hP :
ModelClass c_f C_f L P n
A :
x :
ℝ
hx :
(∫ ω, (let v := pilot c_f C_f ω x let h := markedDensityVector c_f C_f L P n hP x - v Phi A (markedDensityVector c_f C_f L P n hP x) - (Phi A v + iteratedFDeriv ℝ 1 (Phi A) v ![h] + iteratedFDeriv ℝ 2 (Phi A) v ![h, h] / 2 + iteratedFDeriv ℝ 3 (Phi A) v ![h, h, h] / 6)) ^ 2 ∂dataLaw P n n)
≤ (fourthDerivativeEnvelope c_f C_f / 24) ^ 2 * (7 : ℝ) ^ (8 : ℕ) * pilotEighthConstant C_f L * (n : ℝ) ^ (-(4 / 5 : ℝ))
Proof (Lean source)
lemma pilot_Phi_cubic_taylor_remainder_second_moment (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hn : threshold ≤ n) (hP : ModelClass c_f C_f L P n) (A : Bool) (x : ℝ) (hx : x ∈ covariateSpace) : (∫ ω, (let v := pilot c_f C_f ω x let h := markedDensityVector c_f C_f L P n hP x - v Phi A (markedDensityVector c_f C_f L P n hP x) - (Phi A v + iteratedFDeriv ℝ 1 (Phi A) v ![h] + iteratedFDeriv ℝ 2 (Phi A) v ![h, h] / 2 + iteratedFDeriv ℝ 3 (Phi A) v ![h, h, h] / 6)) ^ 2 ∂dataLaw P n n) ≤ (fourthDerivativeEnvelope c_f C_f / 24) ^ 2 * (7 : ℝ) ^ (8 : ℕ) * pilotEighthConstant C_f L * (n : ℝ) ^ (-(4 / 5 : ℝ)) := by let μ := dataLaw P n n let e (ω : TwoSample n n) (i : Fin 7) := pilot c_f C_f ω x i - markedDensityVector c_f C_f L P n hP x i let B := (fourthDerivativeEnvelope c_f C_f / 24) ^ 2 * (7 : ℝ) ^ (7 : ℕ) have hi (i : Fin 7) : Integrable (fun ω => |e ω i| ^ (8 : ℕ)) μ := integrable_pilot_error_eighth c_f C_f L P n hn hP x hx i have hB : 0 ≤ B := by dsimp [B]; positivity calc _ ≤ ∫ ω, B * ∑ i, |e ω i| ^ (8 : ℕ) ∂μ := by apply integral_mono_of_nonneg (Filter.Eventually.of_forall fun _ => sq_nonneg _) ((integrable_finsetSum univ (fun i _ => hi i)).const_mul B) filter_upwards [] with ω have ht := pilot_Phi_cubic_taylor_remainder_abs_le c_f C_f L P n hn hP A ω x hx have hp := pow_le_pow_left₀ (abs_nonneg _) ht 2 rw [sq_abs] at hp calc _ ≤ _ := hp _ = (fourthDerivativeEnvelope c_f C_f / 24) ^ 2 * (∑ i, |e ω i|) ^ (8 : ℕ) := by simp only [Pi.sub_apply, abs_sub_comm, e, mul_pow, ← pow_mul] _ ≤ _ := by dsimp only [B] rw [mul_assoc] exact mul_le_mul_of_nonneg_left (sum_abs_eighth_le (e ω)) (sq_nonneg _) _ = B * ∑ i, ∫ ω, |e ω i| ^ (8 : ℕ) ∂μ := by rw [integral_const_mul, integral_finsetSum univ (fun i _ => hi i)] _ ≤ B * ∑ _i : Fin 7, pilotEighthConstant C_f L * (n : ℝ) ^ (-(4 / 5 : ℝ)) := by apply mul_le_mul_of_nonneg_left _ hB exact Finset.sum_le_sum fun i _ => pilot_eighth_moment c_f C_f L P n hn hP i x hx _ = _ := by simp [B]; ring
CausalSmith.Stat.TransportCaceRoughnuisanceLength.pilot_Phi_cubic_taylor_remainder_second_moment · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/RemainderMoments.lean:86
CausalSmith.Stat.STAT_TransportCaceRoughnuisanceLength_Research.Helpers.CubicMse.ResolutionBounds 8 declarations These bounds implement equation (1) of the marked-cubic MSE proof, including its exact floor-based resolutions and the block-size conversion to sample size.

Dyadic resolutions and the deterministic pilot bias rate

These bounds implement equation (1) of the marked-cubic MSE proof, including its exact floor-based resolutions and the block-size conversion to sample size.

theorem blockSize_pos_of_threshold

Every block is nonempty above the threshold. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
n :
ℕ
hn :
threshold ≤ n
b :
Fin 4
0 < blockSize n b
Proof (Lean source)
-- @node: blockSize_pos_of_threshold lemma blockSize_pos_of_threshold (n : ℕ) (hn : threshold ≤ n) (b : Fin 4) : 0 < blockSize n b := by have hnpos : (0 : ℝ) < n := by exact_mod_cast (show 0 < n by norm_num [threshold] at hn; omega) exact_mod_cast lt_of_lt_of_le (div_pos hnpos (by norm_num)) (block_size_lower n hn b)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.blockSize_pos_of_threshold · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/ResolutionBounds.lean:14
theorem blockSize_le_sampleSize Lemma blockSize_le_sampleSize in the paper ↗

The exact block size never exceeds the sample size. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
n :
ℕ
b :
Fin 4
blockSize n b ≤ n
Proof (Lean source)
-- @node: blockSize_le_sampleSize lemma blockSize_le_sampleSize (n : ℕ) (b : Fin 4) : blockSize n b ≤ n := by fin_cases b <;> simp only [blockSize] <;> omega
CausalSmith.Stat.TransportCaceRoughnuisanceLength.blockSize_le_sampleSize · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/ResolutionBounds.lean:22
theorem dyadicResolution_power_bounds

Rounding down a base-two logarithm loses at most a factor of two. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
n :
ℕ
hn :
threshold ≤ n
p :
ℝ
hp :
0 ≤ p
conclusion 1
(blockSize n 0 : ℝ) ^ p / 2 ≤ (dyadicResolution n p : ℝ)
conclusion 2
(dyadicResolution n p : ℝ) ≤ (blockSize n 0 : ℝ) ^ p
Proof (Lean source)
-- @node: dyadicResolution_power_bounds lemma dyadicResolution_power_bounds (n : ℕ) (hn : threshold ≤ n) (p : ℝ) (hp : 0 ≤ p) : (blockSize n 0 : ℝ) ^ p / 2 ≤ (dyadicResolution n p : ℝ) ∧ (dyadicResolution n p : ℝ) ≤ (blockSize n 0 : ℝ) ^ p := by have hmpos : (0 : ℝ) < blockSize n 0 := Nat.cast_pos.mpr (blockSize_pos_of_threshold n hn 0) have hmone : (1 : ℝ) ≤ blockSize n 0 := by exact_mod_cast (blockSize_pos_of_threshold n hn 0) have hlog2 : 0 < log 2 := Real.log_pos (by norm_num) let q : ℝ := p * (log (blockSize n 0 : ℝ) / log 2) have hq : 0 ≤ q := mul_nonneg hp (div_nonneg (Real.log_nonneg hmone) hlog2.le) have heq : (2 : ℝ) ^ q = (blockSize n 0 : ℝ) ^ p := by rw [Real.rpow_def_of_pos (by norm_num : (0 : ℝ) < 2), Real.rpow_def_of_pos hmpos] congr 1 dsimp [q] field_simp have hlow := Real.rpow_le_rpow_of_exponent_le (by norm_num : (1 : ℝ) ≤ 2) (Nat.floor_le hq) have hhigh := Real.rpow_le_rpow_of_exponent_le (by norm_num : (1 : ℝ) ≤ 2) (Nat.lt_floor_add_one q).le rw [Real.rpow_add (by norm_num : (0 : ℝ) < 2), Real.rpow_one, Real.rpow_natCast, heq] at hhigh rw [Real.rpow_natCast, heq] at hlow simp only [dyadicResolution, if_neg (Nat.not_lt_of_ge hn), Nat.cast_pow, Nat.cast_ofNat] constructor · linarith · exact hlow
CausalSmith.Stat.TransportCaceRoughnuisanceLength.dyadicResolution_power_bounds · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/ResolutionBounds.lean:27
theorem pilotResolution_power_bounds

The pilot resolution has exactly the bounds used for its moments. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
n :
ℕ
hn :
threshold ≤ n
conclusion 1
(blockSize n 0 : ℝ) ^ (4 / 5 : ℝ) / 2 ≤ (pilotResolution n : ℝ)
conclusion 2
(pilotResolution n : ℝ) ≤ (blockSize n 0 : ℝ) ^ (4 / 5 : ℝ)
Proof (Lean source)
-- @node: pilotResolution_power_bounds lemma pilotResolution_power_bounds (n : ℕ) (hn : threshold ≤ n) : (blockSize n 0 : ℝ) ^ (4 / 5 : ℝ) / 2 ≤ (pilotResolution n : ℝ) ∧ (pilotResolution n : ℝ) ≤ (blockSize n 0 : ℝ) ^ (4 / 5 : ℝ) := by exact dyadicResolution_power_bounds n hn (4 / 5) (by norm_num)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.pilotResolution_power_bounds · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/ResolutionBounds.lean:59
theorem quadraticResolution_power_bounds

The quadratic resolution has exactly the bounds used for its variance and bias. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
n :
ℕ
hn :
threshold ≤ n
conclusion 1
(blockSize n 0 : ℝ) ^ (4 / 3 : ℝ) / 2 ≤ (quadraticResolution n : ℝ)
conclusion 2
(quadraticResolution n : ℝ) ≤ (blockSize n 0 : ℝ) ^ (4 / 3 : ℝ)
Proof (Lean source)
-- @node: quadraticResolution_power_bounds lemma quadraticResolution_power_bounds (n : ℕ) (hn : threshold ≤ n) : (blockSize n 0 : ℝ) ^ (4 / 3 : ℝ) / 2 ≤ (quadraticResolution n : ℝ) ∧ (quadraticResolution n : ℝ) ≤ (blockSize n 0 : ℝ) ^ (4 / 3 : ℝ) := by exact dyadicResolution_power_bounds n hn (4 / 3) (by norm_num)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.quadraticResolution_power_bounds · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/ResolutionBounds.lean:66
theorem pilotResolution_inv_le_sample_rate

The inverse pilot resolution supplies the deterministic eighth-power bias rate. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
n :
ℕ
hn :
threshold ≤ n
1 / (pilotResolution n : ℝ) ≤ 2 * (5 : ℝ) ^ (4 / 5 : ℝ) * (n : ℝ) ^ (-(4 / 5 : ℝ))
Proof (Lean source)
-- @node: pilotResolution_inv_le_sample_rate lemma pilotResolution_inv_le_sample_rate (n : ℕ) (hn : threshold ≤ n) : 1 / (pilotResolution n : ℝ) ≤ 2 * (5 : ℝ) ^ (4 / 5 : ℝ) * (n : ℝ) ^ (-(4 / 5 : ℝ)) := by have hnpos : (0 : ℝ) < n := by exact_mod_cast (show 0 < n by norm_num [threshold] at hn; omega) have hmpos : (0 : ℝ) < blockSize n 0 := Nat.cast_pos.mpr (blockSize_pos_of_threshold n hn 0) have hKpos : (0 : ℝ) < pilotResolution n := by unfold pilotResolution dyadicResolution split_ifs <;> positivity have hlow := (pilotResolution_power_bounds n hn).1 have hm := Real.rpow_le_rpow (div_pos hnpos (by norm_num)).le (block_size_lower n hn 0) (by norm_num : (0 : ℝ) ≤ 4 / 5) have hpow : (n : ℝ) ^ (4 / 5 : ℝ) / (5 : ℝ) ^ (4 / 5 : ℝ) / 2 ≤ (pilotResolution n : ℝ) := by rw [← Real.div_rpow hnpos.le (by norm_num)] linarith have h5 : (0 : ℝ) < (5 : ℝ) ^ (4 / 5 : ℝ) := Real.rpow_pos_of_pos (by norm_num) _ have hnPow : (0 : ℝ) < (n : ℝ) ^ (4 / 5 : ℝ) := Real.rpow_pos_of_pos hnpos _ rw [Real.rpow_neg hnpos.le, ← one_div] apply (div_le_iff₀ hKpos).2 rw [show 2 * (5 : ℝ) ^ (4 / 5 : ℝ) * (1 / (n : ℝ) ^ (4 / 5 : ℝ)) * (pilotResolution n : ℝ) = (2 * (5 : ℝ) ^ (4 / 5 : ℝ) * (pilotResolution n : ℝ)) / (n : ℝ) ^ (4 / 5 : ℝ) by ring] apply (le_div_iff₀ hnPow).2 have hmul := (div_le_iff₀ h5).mp ((div_le_iff₀ (by norm_num : (0 : ℝ) < 2)).mp hpow) nlinarith
CausalSmith.Stat.TransportCaceRoughnuisanceLength.pilotResolution_inv_le_sample_rate · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/ResolutionBounds.lean:73
theorem pilotResolution_ratio_rpow_le

Every nonnegative power of the pilot fluctuation scale has its explicit sample-size rate. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
n :
ℕ
hn :
threshold ≤ n
p :
ℝ
hp :
0 ≤ p
((pilotResolution n : ℝ) / (blockSize n 0 : ℝ)) ^ p
≤ (5 : ℝ) ^ (p / 5) * (n : ℝ) ^ (-(p / 5))
Proof (Lean source)
-- @node: pilotResolution_ratio_rpow_le lemma pilotResolution_ratio_rpow_le (n : ℕ) (hn : threshold ≤ n) (p : ℝ) (hp : 0 ≤ p) : ((pilotResolution n : ℝ) / (blockSize n 0 : ℝ)) ^ p ≤ (5 : ℝ) ^ (p / 5) * (n : ℝ) ^ (-(p / 5)) := by have hnpos : (0 : ℝ) < n := by exact_mod_cast (show 0 < n by norm_num [threshold] at hn; omega) have hmpos : (0 : ℝ) < blockSize n 0 := Nat.cast_pos.mpr (blockSize_pos_of_threshold n hn 0) have hratio : (pilotResolution n : ℝ) / (blockSize n 0 : ℝ) ≤ (blockSize n 0 : ℝ) ^ (-(1 / 5 : ℝ)) := by calc _ ≤ (blockSize n 0 : ℝ) ^ (4 / 5 : ℝ) / (blockSize n 0 : ℝ) := div_le_div_of_nonneg_right (pilotResolution_power_bounds n hn).2 hmpos.le _ = _ := by nth_rw 2 [← Real.rpow_one (blockSize n 0 : ℝ)] rw [← Real.rpow_sub hmpos] norm_num have hpow := Real.rpow_le_rpow (by positivity : (0 : ℝ) ≤ (pilotResolution n : ℝ) / (blockSize n 0 : ℝ)) hratio hp rw [← Real.rpow_mul hmpos.le] at hpow have hexp : (-(1 / 5 : ℝ)) * p = -(p / 5) := by ring rw [hexp] at hpow have hsample := Real.rpow_le_rpow_of_nonpos (div_pos hnpos (by norm_num)) (block_size_lower n hn 0) (by linarith : -(p / 5) ≤ 0) refine hpow.trans (hsample.trans_eq ?_) rw [Real.div_rpow hnpos.le (by norm_num), Real.rpow_neg (by norm_num : (0 : ℝ) ≤ 5)] field_simp
CausalSmith.Stat.TransportCaceRoughnuisanceLength.pilotResolution_ratio_rpow_le · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/ResolutionBounds.lean:104
theorem pilotResolution_eighth_fluctuation_scales

Both histogram fluctuation terms in the eighth-moment roadmap are bounded at rate n⁻⁴ᐟ⁵. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
n :
ℕ
hn :
threshold ≤ n
conclusion 1
((pilotResolution n : ℝ) / (blockSize n 0 : ℝ)) ^ (4 : ℕ)
≤ (5 : ℝ) ^ (4 / 5 : ℝ) * (n : ℝ) ^ (-(4 / 5 : ℝ))
conclusion 2
((pilotResolution n : ℝ) / (blockSize n 0 : ℝ)) ^ (7 : ℕ)
≤ (5 : ℝ) ^ (7 / 5 : ℝ) * (n : ℝ) ^ (-(4 / 5 : ℝ))
Proof (Lean source)
-- @node: pilotResolution_eighth_fluctuation_scales lemma pilotResolution_eighth_fluctuation_scales (n : ℕ) (hn : threshold ≤ n) : ((pilotResolution n : ℝ) / (blockSize n 0 : ℝ)) ^ (4 : ℕ) ≤ (5 : ℝ) ^ (4 / 5 : ℝ) * (n : ℝ) ^ (-(4 / 5 : ℝ)) ∧ ((pilotResolution n : ℝ) / (blockSize n 0 : ℝ)) ^ (7 : ℕ) ≤ (5 : ℝ) ^ (7 / 5 : ℝ) * (n : ℝ) ^ (-(4 / 5 : ℝ)) := by constructor · simpa only [Real.rpow_ofNat] using pilotResolution_ratio_rpow_le n hn 4 (by norm_num) · have h := pilotResolution_ratio_rpow_le n hn 7 (by norm_num) rw [Real.rpow_ofNat] at h refine h.trans ?_ apply mul_le_mul_of_nonneg_left _ (Real.rpow_nonneg (by norm_num) _) apply Real.rpow_le_rpow_of_exponent_le · exact_mod_cast (show 1 ≤ n by norm_num [threshold] at hn; omega) · norm_num
CausalSmith.Stat.TransportCaceRoughnuisanceLength.pilotResolution_eighth_fluctuation_scales · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/ResolutionBounds.lean:134
CausalSmith.Stat.STAT_TransportCaceRoughnuisanceLength_Research.Helpers.CubicMse.SharpProjectionBias 5 declarations The surviving two-residual terms retain the absolute training shifts rather than a uniform envelope.

Pilot-sensitive cubic projection bias

The surviving two-residual terms retain the absolute training shifts rather than a uniform envelope. This is the cellwise estimate needed in roadmap (12). The integrated pilot moment supplies the L1 control in roadmap (7).

theorem cubic_residual_integral_abs_le_shifts Lemma cubic_residual_integral_abs_le_shifts in the paper ↗

The four surviving cubic residual terms are bounded while retaining each projected pilot error as a factor. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
K :
ℕ
hK :
0 < K
l :
Fin K
f g h :
ℝ → ℝ
d e b c B :
ℝ
hB :
0 ≤ B
hfB :
∀ x ∈ cell K l, |f x| ≤ B
hgB :
∀ x ∈ cell K l, |g x| ≤ B
hhB :
∀ x ∈ cell K l, |h x| ≤ B
|∫ x in cell K l, c * (d * g x * h x + e * f x * h x + b * f x * g x + f x * g x * h x)|
≤ |c| * ((|d| + |e| + |b|) * B ^ 2 + B ^ 3) / (K : ℝ)
Proof (Lean source)
-- @node: cubic_residual_integral_abs_le_shifts lemma cubic_residual_integral_abs_le_shifts {K : ℕ} (hK : 0 < K) (l : Fin K) (f g h : ℝ → ℝ) (hf : ContinuousOn f covariateSpace) (hg : ContinuousOn g covariateSpace) (hh : ContinuousOn h covariateSpace) (d e b c B : ℝ) (hB : 0 ≤ B) (hfB : ∀ x ∈ cell K l, |f x| ≤ B) (hgB : ∀ x ∈ cell K l, |g x| ≤ B) (hhB : ∀ x ∈ cell K l, |h x| ≤ B) : |∫ x in cell K l, c * (d * g x * h x + e * f x * h x + b * f x * g x + f x * g x * h x)| ≤ |c| * ((|d| + |e| + |b|) * B ^ 2 + B ^ 3) / (K : ℝ) := by let R := fun x => c * (d * g x * h x + e * f x * h x + b * f x * g x + f x * g x * h x) have hi : IntegrableOn R (cell K l) := by exact (show ContinuousOn R covariateSpace by dsimp [R]; fun_prop).integrableOn_Icc.mono_set (cell_subset_covariateSpace hK l) have hfinite : volume (cell K l) ≠ ⊤ := by rw [volume_cell hK l] exact ENNReal.ofReal_ne_top have hpoint (x : ℝ) (hx : x ∈ cell K l) : |R x| ≤ |c| * ((|d| + |e| + |b|) * B ^ 2 + B ^ 3) := by have h1 : |d * g x * h x| ≤ |d| * B ^ 2 := by simp only [abs_mul] calc _ ≤ |d| * B * B := by gcongr · exact hgB x hx · exact hhB x hx _ = _ := by ring have h2 : |e * f x * h x| ≤ |e| * B ^ 2 := by simp only [abs_mul] calc _ ≤ |e| * B * B := by gcongr · exact hfB x hx · exact hhB x hx _ = _ := by ring have h3 : |b * f x * g x| ≤ |b| * B ^ 2 := by simp only [abs_mul] calc _ ≤ |b| * B * B := by gcongr · exact hfB x hx · exact hgB x hx _ = _ := by ring have h4 : |f x * g x * h x| ≤ B ^ 3 := by simp only [abs_mul] calc _ ≤ B * B * B := by gcongr · exact hfB x hx · exact hgB x hx · exact hhB x hx _ = _ := by ring dsimp [R] rw [abs_mul] apply mul_le_mul_of_nonneg_left _ (abs_nonneg c) calc |_ + _ + _ + _| ≤ |d * g x * h x| + |e * f x * h x| + |b * f x * g x| + |f x * g x * h x| := (abs_add_le _ _).trans (add_le_add ((abs_add_le _ _).trans (add_le_add (abs_add_le _ _) le_rfl)) le_rfl) _ ≤ |d| * B ^ 2 + |e| * B ^ 2 + |b| * B ^ 2 + B ^ 3 := add_le_add (add_le_add (add_le_add h1 h2) h3) h4 _ = _ := by ring calc _ ≤ ∫ x in cell K l, |R x| := abs_integral_le_integral_abs _ ≤ ∫ _x in cell K l, |c| * ((|d| + |e| + |b|) * B ^ 2 + B ^ 3) := setIntegral_mono_on hi.abs (integrableOn_const hfinite) (measurableSet_cell K l) hpoint _ = _ := by rw [setIntegral_const, Measure.real, volume_cell hK l, ENNReal.toReal_ofReal (by positivity)] simp only [smul_eq_mul] ring
CausalSmith.Stat.TransportCaceRoughnuisanceLength.cubic_residual_integral_abs_le_shifts · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/SharpProjectionBias.lean:17
theorem markedDensity_cubic_cell_projection_abs_le_shifts

Exact single-residual cancellation yields a cubic cell bias bound with three individual projected pilot errors, as required by roadmap (12). Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n K :
ℕ
hP :
ModelClass c_f C_f L P n
hK :
0 < K
l :
Fin K
i j k :
Fin 7
ti tj tk c :
ℝ
F :
markedDensityVector c_f C_f L P n hP
ai :
cellAverage (fun y => F y i) K l
aj :
cellAverage (fun y => F y j) K l
ak :
cellAverage (fun y => F y k) K l
B :
3 * (1 + C_f) * L * (1 / (K : ℝ)) ^ holderExponent
|∫ x in cell K l, c * ((F x i - ti) * (F x j - tj) * (F x k - tk) - (ai - ti) * (aj - tj) * (ak - tk))|
≤ |c| * ((|ai - ti| + |aj - tj| + |ak - tk|) * B ^ 2 + B ^ 3) / (K : ℝ)
Proof (Lean source)
-- @node: markedDensity_cubic_cell_projection_abs_le_shifts lemma markedDensity_cubic_cell_projection_abs_le_shifts (c_f C_f L : ℝ) (P : TransportLaw) (n K : ℕ) (hP : ModelClass c_f C_f L P n) (hK : 0 < K) (l : Fin K) (i j k : Fin 7) (ti tj tk c : ℝ) : let F := markedDensityVector c_f C_f L P n hP let ai := cellAverage (fun y => F y i) K l let aj := cellAverage (fun y => F y j) K l let ak := cellAverage (fun y => F y k) K l let B := 3 * (1 + C_f) * L * (1 / (K : ℝ)) ^ holderExponent |∫ x in cell K l, c * ((F x i - ti) * (F x j - tj) * (F x k - tk) - (ai - ti) * (aj - tj) * (ak - tk))| ≤ |c| * ((|ai - ti| + |aj - tj| + |ak - tk|) * B ^ 2 + B ^ 3) / (K : ℝ) := by dsimp only rw [markedDensity_cubic_cell_projection_identity c_f C_f L P n K hP hK l i j k ti tj tk c] apply cubic_residual_integral_abs_le_shifts hK l _ _ _ (markedDensity_cell_residual_continuousOn c_f C_f L P n K hP l i) (markedDensity_cell_residual_continuousOn c_f C_f L P n K hP l j) (markedDensity_cell_residual_continuousOn c_f C_f L P n K hP l k) · have hC : 0 ≤ C_f := hP.sourceBounds.2.1.le.trans' (by norm_num) have hL : 0 ≤ L := hP.sourceHolder.1.le.trans' (by norm_num) positivity · intro x hx exact markedDensity_sub_cellAverage_abs_le c_f C_f L P n K hP hK l x hx i · intro x hx exact markedDensity_sub_cellAverage_abs_le c_f C_f L P n K hP hK l x hx j · intro x hx exact markedDensity_sub_cellAverage_abs_le c_f C_f L P n K hP hK l x hx k
CausalSmith.Stat.TransportCaceRoughnuisanceLength.markedDensity_cubic_cell_projection_abs_le_shifts · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/SharpProjectionBias.lean:95
theorem cellAverage_sub_abs_div_le_integral_abs Lemma cellAverage_sub_abs_div_le_integral_abs in the paper ↗

A projected error divided by the cell resolution is at most the cell's L1 error; no uniform bound on the pilot error is substituted. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
K :
ℕ
hK :
0 < K
l :
Fin K
f :
ℝ → ℝ
t :
ℝ
hf :
IntegrableOn f (cell K l)
|cellAverage f K l - t| / (K : ℝ) ≤ ∫ x in cell K l, |f x - t|
Proof (Lean source)
-- @node: cellAverage_sub_abs_div_le_integral_abs lemma cellAverage_sub_abs_div_le_integral_abs {K : ℕ} (hK : 0 < K) (l : Fin K) (f : ℝ → ℝ) (t : ℝ) (hf : IntegrableOn f (cell K l)) : |cellAverage f K l - t| / (K : ℝ) ≤ ∫ x in cell K l, |f x - t| := by have hKr : (0 : ℝ) < K := by exact_mod_cast hK have hfinite : volume (cell K l) ≠ ⊤ := by rw [volume_cell hK l] exact ENNReal.ofReal_ne_top have heq : cellAverage f K l - t = (K : ℝ) * ∫ x in cell K l, f x - t := by rw [integral_sub hf (integrableOn_const hfinite), setIntegral_const, Measure.real, volume_cell hK l, ENNReal.toReal_ofReal (by positivity)] dsimp [cellAverage] field_simp rw [heq, abs_mul, abs_of_pos hKr, mul_div_cancel_left₀ _ hKr.ne'] exact abs_integral_le_integral_abs
CausalSmith.Stat.TransportCaceRoughnuisanceLength.cellAverage_sub_abs_div_le_integral_abs · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/SharpProjectionBias.lean:126
theorem pilot_error_L1_second_moment

Roadmap (7): the clipped pilot's spatial L1 error has the same squared moment rate as its pointwise error, by Jensen and Fubini. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hn :
threshold ≤ n
hP :
ModelClass c_f C_f L P n
i :
Fin 7
(∫ ω, (∫ x in covariateSpace, |pilot c_f C_f ω x i - markedDensityVector c_f C_f L P n hP x i|) ^ 2 ∂dataLaw P n n)
≤ (2 * (1 + C_f + C_f ^ 2) * (5 : ℝ) ^ (1 / 5 : ℝ) + (2 : ℝ) ^ (5 / 4 : ℝ) * (3 * (1 + C_f) * L) ^ 2 * (5 : ℝ) ^ (1 / 5 : ℝ)) * (n : ℝ) ^ (-(1 / 5 : ℝ))
Proof (Lean source)
-- @node: pilot_error_L1_second_moment lemma pilot_error_L1_second_moment (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hn : threshold ≤ n) (hP : ModelClass c_f C_f L P n) (i : Fin 7) : (∫ ω, (∫ x in covariateSpace, |pilot c_f C_f ω x i - markedDensityVector c_f C_f L P n hP x i|) ^ 2 ∂dataLaw P n n) ≤ (2 * (1 + C_f + C_f ^ 2) * (5 : ℝ) ^ (1 / 5 : ℝ) + (2 : ℝ) ^ (5 / 4 : ℝ) * (3 * (1 + C_f) * L) ^ 2 * (5 : ℝ) ^ (1 / 5 : ℝ)) * (n : ℝ) ^ (-(1 / 5 : ℝ)) := by classical let μ := dataLaw P n n let ν := volume.restrict covariateSpace let : IsProbabilityMeasure (sourceObsLaw P) := sourceObsLaw_isProbabilityMeasure c_f C_f L P n hP let : IsProbabilityMeasure (targetXLaw P) := targetXLaw_isProbabilityMeasure c_f C_f L P n hP let : IsProbabilityMeasure μ := by dsimp [μ] rw [dataLaw_eq_source_target_pi c_f C_f L P n hP] infer_instance let : IsProbabilityMeasure ν := ⟨by simp [ν, covariateSpace]⟩ let F := covariateSpace.indicator (fun x => markedDensityVector c_f C_f L P n hP x i) let g := fun (ω : TwoSample n n) (x : ℝ) => |pilot c_f C_f ω x i - F x| have hg : Measurable (uncurry g) := by have hF := measurable_markedDensityVector_indicator c_f C_f L P n hP i dsimp [g, F, uncurry] fun_prop have hC : 0 ≤ C_f := hP.sourceBounds.2.1.le.trans' (by norm_num) have hb (ω : TwoSample n n) : ∀ᵐ x ∂ν, |g ω x| ≤ 2 * C_f := by apply ae_restrict_of_forall_mem measurableSet_Icc intro x hx change x ∈ covariateSpace at hx dsimp [g, F] rw [Set.indicator_of_mem hx, abs_abs] simpa only [two_mul] using (abs_sub _ _).trans (add_le_add (clippingRectangle_coordinate_abs_le c_f C_f hP.sourceBounds.1.1 hC _ (pilot_mem_clippingRectangle c_f C_f L P n hn hP ω x) i) (clippingRectangle_coordinate_abs_le c_f C_f hP.sourceBounds.1.1 hC _ (markedDensityVector_mem_clippingRectangle c_f C_f L P n hP x hx) i)) have hm : ∀ᵐ x ∂ν, (∫ ω, (g ω x) ^ 2 ∂μ) ≤ (2 * (1 + C_f + C_f ^ 2) * (5 : ℝ) ^ (1 / 5 : ℝ) + (2 : ℝ) ^ (5 / 4 : ℝ) * (3 * (1 + C_f) * L) ^ 2 * (5 : ℝ) ^ (1 / 5 : ℝ)) * (n : ℝ) ^ (-(1 / 5 : ℝ)) := by apply ae_restrict_of_forall_mem measurableSet_Icc intro x hx change x ∈ covariateSpace at hx simpa only [g, F, Set.indicator_of_mem hx, sq_abs, μ] using pilot_second_moment c_f C_f L P n hn hP i x hx have hj := integrated_second_moment_le_of_majorant μ ν g g (2 * C_f) _ hg hb (fun ω => Filter.Eventually.of_forall fun x => (abs_of_nonneg (abs_nonneg _)).le) hm have heq (ω : TwoSample n n) : (∫ x in covariateSpace, |pilot c_f C_f ω x i - markedDensityVector c_f C_f L P n hP x i|) = ∫ x, g ω x ∂ν := by apply setIntegral_congr_fun measurableSet_Icc intro x hx change x ∈ covariateSpace at hx dsimp [g, F] rw [Set.indicator_of_mem hx] simpa only [heq, μ] using hj
CausalSmith.Stat.TransportCaceRoughnuisanceLength.pilot_error_L1_second_moment · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/SharpProjectionBias.lean:144
theorem cubic_midpoint_cell_projection_L1_bound

The exact cubic Taylor coefficient gives a cell bias controlled by the three L1 pilot errors and the third power of the Hölder projection modulus. Summing this inequality yields the constants C1 and C2 in roadmap (12). Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n K :
ℕ
hn :
threshold ≤ n
hP :
ModelClass c_f C_f L P n
hK :
0 < K
ω :
A :
l :
Fin K
i j k :
Fin 7
F :
markedDensityVector c_f C_f L P n hP
t :
pilot c_f C_f ω (midpoint K l)
a :
fun q => cellAverage (fun y => F y q) K l
B :
3 * (1 + C_f) * L * (1 / (K : ℝ)) ^ holderExponent
|∫ x in cell K l, (dPhi3 A t i j k / 6) * ((F x i - t i) * (F x j - t j) * (F x k - t k) - (a i - t i) * (a j - t j) * (a k - t k))|
≤ (fourthDerivativeEnvelope c_f C_f / 6) * (B ^ 2 * ((∫ x in cell K l, |F x i - t i|) + (∫ x in cell K l, |F x j - t j|) + (∫ x in cell K l, |F x k - t k|)) + B ^ 3 / (K : ℝ))
Proof (Lean source)
-- @node: cubic_midpoint_cell_projection_L1_bound lemma cubic_midpoint_cell_projection_L1_bound (c_f C_f L : ℝ) (P : TransportLaw) (n K : ℕ) (hn : threshold ≤ n) (hP : ModelClass c_f C_f L P n) (hK : 0 < K) (ω : TwoSample n n) (A : Bool) (l : Fin K) (i j k : Fin 7) : let F := markedDensityVector c_f C_f L P n hP let t := pilot c_f C_f ω (midpoint K l) let a := fun q => cellAverage (fun y => F y q) K l let B := 3 * (1 + C_f) * L * (1 / (K : ℝ)) ^ holderExponent |∫ x in cell K l, (dPhi3 A t i j k / 6) * ((F x i - t i) * (F x j - t j) * (F x k - t k) - (a i - t i) * (a j - t j) * (a k - t k))| ≤ (fourthDerivativeEnvelope c_f C_f / 6) * (B ^ 2 * ((∫ x in cell K l, |F x i - t i|) + (∫ x in cell K l, |F x j - t j|) + (∫ x in cell K l, |F x k - t k|)) + B ^ 3 / (K : ℝ)) := by dsimp only let F := markedDensityVector c_f C_f L P n hP let t := pilot c_f C_f ω (midpoint K l) let B := 3 * (1 + C_f) * L * (1 / (K : ℝ)) ^ holderExponent have hKr : (0 : ℝ) < K := by exact_mod_cast hK have hB : 0 ≤ B := by have hC : 0 ≤ C_f := hP.sourceBounds.2.1.le.trans' (by norm_num) have hL : 0 ≤ L := hP.sourceHolder.1.le.trans' (by norm_num) dsimp [B] positivity have hc : |dPhi3 A t i j k / 6| ≤ fourthDerivativeEnvelope c_f C_f / 6 := by rw [abs_div, abs_of_pos (by norm_num : (0 : ℝ) < 6)] exact div_le_div_of_nonneg_right (dPhi3_abs_le c_f C_f hP.sourceBounds.1 hP.sourceBounds.2.1 A t (pilot_mem_clippingRectangle c_f C_f L P n hn hP ω (midpoint K l)) i j k) (by norm_num) have hshift (q : Fin 7) : |cellAverage (fun y => F y q) K l - t q| / (K : ℝ) ≤ ∫ x in cell K l, |F x q - t q| := cellAverage_sub_abs_div_le_integral_abs hK l _ _ ((markedDensityVector_continuousOn c_f C_f L P n hP q).integrableOn_Icc.mono_set (cell_subset_covariateSpace hK l)) have hs := add_le_add (add_le_add (hshift i) (hshift j)) (hshift k) calc _ ≤ |dPhi3 A t i j k / 6| * ((|cellAverage (fun y => F y i) K l - t i| + |cellAverage (fun y => F y j) K l - t j| + |cellAverage (fun y => F y k) K l - t k|) * B ^ 2 + B ^ 3) / (K : ℝ) := markedDensity_cubic_cell_projection_abs_le_shifts c_f C_f L P n K hP hK l i j k (t i) (t j) (t k) (dPhi3 A t i j k / 6) _ ≤ (fourthDerivativeEnvelope c_f C_f / 6) * ((|cellAverage (fun y => F y i) K l - t i| + |cellAverage (fun y => F y j) K l - t j| + |cellAverage (fun y => F y k) K l - t k|) * B ^ 2 + B ^ 3) / (K : ℝ) := by apply div_le_div_of_nonneg_right _ hKr.le exact mul_le_mul_of_nonneg_right hc (by positivity) _ = (fourthDerivativeEnvelope c_f C_f / 6) * (B ^ 2 * (|cellAverage (fun y => F y i) K l - t i| / (K : ℝ) + |cellAverage (fun y => F y j) K l - t j| / (K : ℝ) + |cellAverage (fun y => F y k) K l - t k| / (K : ℝ)) + B ^ 3 / (K : ℝ)) := by ring _ ≤ _ := by apply mul_le_mul_of_nonneg_left _ (by have hcf := hP.sourceBounds.1.1 unfold fourthDerivativeEnvelope positivity) exact add_le_add (mul_le_mul_of_nonneg_left hs (sq_nonneg B)) le_rfl
CausalSmith.Stat.TransportCaceRoughnuisanceLength.cubic_midpoint_cell_projection_L1_bound · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/SharpProjectionBias.lean:208
CausalSmith.Stat.STAT_TransportCaceRoughnuisanceLength_Research.Helpers.CubicMse.SpatialProjectionBridge 5 declarations The pilot is constant on each nested cell, so the spatial quadratic Taylor term is exactly the midpoint-frozen cell sum.

Spatial Taylor terms and exact projection means

The pilot is constant on each nested cell, so the spatial quadratic Taylor term is exactly the midpoint-frozen cell sum. Its difference from the exact conditional quadratic mean has the already established BQ bound.

theorem iUnion_cell_eq_covariateSpace Lemma iUnion_cell_eq_covariateSpace in the paper ↗

The histogram cells form an exact finite partition, including the endpoint one. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
K :
ℕ
hK :
0 < K
(⋃ l : Fin K, cell K l) = covariateSpace
Proof (Lean source)
-- @node: iUnion_cell_eq_covariateSpace lemma iUnion_cell_eq_covariateSpace {K : ℕ} (hK : 0 < K) : (⋃ l : Fin K, cell K l) = covariateSpace := by ext x constructor · intro hx obtain ⟨l, hl⟩ := mem_iUnion.mp hx exact cell_subset_covariateSpace hK l hl · intro hx obtain ⟨l, hl⟩ := exists_cell_of_mem_covariateSpace hK x hx exact mem_iUnion.mpr ⟨l, hl⟩
CausalSmith.Stat.TransportCaceRoughnuisanceLength.iUnion_cell_eq_covariateSpace · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/SpatialProjectionBridge.lean:16
theorem spatial_pilot_monomial_eq_cell_sum

Integration of a Taylor monomial is exactly the sum over nested cells with its pilot and coefficient frozen at the cell midpoint. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f :
ℝ
n K q :
ℕ
hK :
0 < K
hdiv :
ω :
F :
ℝ → Fin 7 → ℝ
hF :
∀ i, ContinuousOn (fun x => F x i) covariateSpace
a :
(Fin 7 → ℝ) → ℝ
idx :
Fin q → Fin 7
(∫ x in covariateSpace, a (pilot c_f C_f ω x) * ∏ j : Fin q, (F x (idx j) - pilot c_f C_f ω x (idx j)))
= ∑ l : Fin K, ∫ x in cell K l, a (pilot c_f C_f ω (midpoint K l)) * ∏ j : Fin q, (F x (idx j) - pilot c_f C_f ω (midpoint K l) (idx j))
Proof (Lean source)
-- @node: spatial_pilot_monomial_eq_cell_sum lemma spatial_pilot_monomial_eq_cell_sum (c_f C_f : ℝ) {n K q : ℕ} (hK : 0 < K) (hdiv : pilotResolution n ∣ K) (ω : TwoSample n n) (F : ℝ → Fin 7 → ℝ) (hF : ∀ i, ContinuousOn (fun x => F x i) covariateSpace) (a : (Fin 7 → ℝ) → ℝ) (idx : Fin q → Fin 7) : (∫ x in covariateSpace, a (pilot c_f C_f ω x) * ∏ j : Fin q, (F x (idx j) - pilot c_f C_f ω x (idx j))) = ∑ l : Fin K, ∫ x in cell K l, a (pilot c_f C_f ω (midpoint K l)) * ∏ j : Fin q, (F x (idx j) - pilot c_f C_f ω (midpoint K l) (idx j)) := by classical let f := fun x => a (pilot c_f C_f ω x) * ∏ j : Fin q, (F x (idx j) - pilot c_f C_f ω x (idx j)) let g := fun (l : Fin K) x => a (pilot c_f C_f ω (midpoint K l)) * ∏ j : Fin q, (F x (idx j) - pilot c_f C_f ω (midpoint K l) (idx j)) have heq (l : Fin K) : EqOn f (g l) (cell K l) := by intro x hx dsimp [f, g] rw [pilot_eq_midpoint_of_refinement c_f C_f hK hdiv ω l hx] have hi (l : Fin K) : IntegrableOn f (cell K l) := by have hg : ContinuousOn (g l) covariateSpace := by dsimp [g] fun_prop have hgint : IntegrableOn (g l) (cell K l) := hg.integrableOn_Icc.mono_set (cell_subset_covariateSpace hK l) exact (integrableOn_congr_fun (heq l) (measurableSet_cell K l)).2 hgint change (∫ x in covariateSpace, f x) = ∑ l : Fin K, ∫ x in cell K l, g l x rw [← iUnion_cell_eq_covariateSpace hK, integral_iUnion_fintype (fun l => measurableSet_cell K l) (fun l r hlr => cell_disjoint hK hlr) hi] apply Finset.sum_congr rfl intro l _ exact setIntegral_congr_fun (measurableSet_cell K l) (heq l)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.spatial_pilot_monomial_eq_cell_sum · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/SpatialProjectionBridge.lean:29
theorem spatial_pilot_single_residual_cancellation

Every spatial Taylor monomial with exactly one within-cell residual has zero cell integral: the pilot-derived coefficient and all projected factors are constant on that cell. This covers every quadratic and cubic single-residual term without an extra constancy premise. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n K q :
ℕ
hP :
ModelClass c_f C_f L P n
hK :
0 < K
hdiv :
ω :
l :
Fin K
i :
Fin 7
a :
(Fin 7 → ℝ) → ℝ
idx :
Fin q → Fin 7
(∫ x in cell K l, a (pilot c_f C_f ω x) * (∏ j : Fin q, (cellAverage (fun y => markedDensityVector c_f C_f L P n hP y (idx j)) K l - pilot c_f C_f ω x (idx j))) * (markedDensityVector c_f C_f L P n hP x i - cellAverage (fun y => markedDensityVector c_f C_f L P n hP y i) K l))
= 0
Proof (Lean source)
-- @node: spatial_pilot_single_residual_cancellation lemma spatial_pilot_single_residual_cancellation (c_f C_f L : ℝ) (P : TransportLaw) (n K q : ℕ) (hP : ModelClass c_f C_f L P n) (hK : 0 < K) (hdiv : pilotResolution n ∣ K) (ω : TwoSample n n) (l : Fin K) (i : Fin 7) (a : (Fin 7 → ℝ) → ℝ) (idx : Fin q → Fin 7) : (∫ x in cell K l, a (pilot c_f C_f ω x) * (∏ j : Fin q, (cellAverage (fun y => markedDensityVector c_f C_f L P n hP y (idx j)) K l - pilot c_f C_f ω x (idx j))) * (markedDensityVector c_f C_f L P n hP x i - cellAverage (fun y => markedDensityVector c_f C_f L P n hP y i) K l)) = 0 := by apply one_residual_cell_product_cancellation c_f C_f L P n K q hP hK l i (fun x => a (pilot c_f C_f ω x)) (fun j x => cellAverage (fun y => markedDensityVector c_f C_f L P n hP y (idx j)) K l - pilot c_f C_f ω x (idx j)) (a (pilot c_f C_f ω (midpoint K l))) (fun j => cellAverage (fun y => markedDensityVector c_f C_f L P n hP y (idx j)) K l - pilot c_f C_f ω (midpoint K l) (idx j)) · intro x hx rw [pilot_eq_midpoint_of_refinement c_f C_f hK hdiv ω l hx] · intro j x hx rw [pilot_eq_midpoint_of_refinement c_f C_f hK hdiv ω l hx]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.spatial_pilot_single_residual_cancellation · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/SpatialProjectionBridge.lean:64
theorem quadraticCellProjectionBias_eq_spatial_sub_projectionMean

The exact quadratic projection bias is the spatial quadratic Taylor term minus the exact conditional mean of the quadratic statistic. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hP :
ModelClass c_f C_f L P n
ω :
A :
= (∑ i : Fin 7, ∑ j : Fin 7, ∫ x in covariateSpace, (dPhi2 A (pilot c_f C_f ω x) i j / 2) * (markedDensityVector c_f C_f L P n hP x i - pilot c_f C_f ω x i) * (markedDensityVector c_f C_f L P n hP x j - pilot c_f C_f ω x j))
- quadraticProjectionMean c_f C_f L P n hP ω A
Proof (Lean source)
-- @node: quadraticCellProjectionBias_eq_spatial_sub_projectionMean lemma quadraticCellProjectionBias_eq_spatial_sub_projectionMean (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hP : ModelClass c_f C_f L P n) (ω : TwoSample n n) (A : Bool) : quadraticCellProjectionBias c_f C_f L P n (quadraticResolution n) hP ω A = (∑ i : Fin 7, ∑ j : Fin 7, ∫ x in covariateSpace, (dPhi2 A (pilot c_f C_f ω x) i j / 2) * (markedDensityVector c_f C_f L P n hP x i - pilot c_f C_f ω x i) * (markedDensityVector c_f C_f L P n hP x j - pilot c_f C_f ω x j)) - quadraticProjectionMean c_f C_f L P n hP ω A := by classical have hK : 0 < quadraticResolution n := by unfold quadraticResolution dyadicResolution split_ifs <;> positivity have hterm (i j : Fin 7) := spatial_pilot_monomial_eq_cell_sum c_f C_f hK (pilotResolution_dvd_correctionResolutions n).1 ω (markedDensityVector c_f C_f L P n hP) (markedDensityVector_continuousOn c_f C_f L P n hP) (fun v => dPhi2 A v i j / 2) ![i, j] simp only [Fin.prod_univ_two, Matrix.cons_val_zero, Matrix.cons_val_one] at hterm simp_rw [← mul_assoc] at hterm rw [quadraticCellProjectionBias_eq_sub_projectionMean] simp_rw [hterm]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.quadraticCellProjectionBias_eq_spatial_sub_projectionMean · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/SpatialProjectionBridge.lean:93
theorem quadratic_spatial_projection_bias_integrated_sq_sample_rate

Roadmap (11) applies directly to the true spatial Taylor term, without a midpoint approximation or any extra assumption on the training data. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hn :
threshold ≤ n
hP :
ModelClass c_f C_f L P n
A :
(∫ ω, ((∑ i : Fin 7, ∑ j : Fin 7, ∫ x in covariateSpace, (dPhi2 A (pilot c_f C_f ω x) i j / 2) * (markedDensityVector c_f C_f L P n hP x i - pilot c_f C_f ω x i) * (markedDensityVector c_f C_f L P n hP x j - pilot c_f C_f ω x j)) - quadraticProjectionMean c_f C_f L P n hP ω A) ^ 2 ∂dataLaw P n n)
≤ (7 : ℝ) ^ 4 * (fourthDerivativeEnvelope c_f C_f) ^ 2 * (3 * (1 + C_f) * L) ^ 4 * (2 : ℝ) ^ (1 / 2 : ℝ) * (5 : ℝ) ^ (2 / 3 : ℝ) * (n : ℝ) ^ (-(2 / 3 : ℝ))
Proof (Lean source)
-- @node: quadratic_spatial_projection_bias_integrated_sq_sample_rate lemma quadratic_spatial_projection_bias_integrated_sq_sample_rate (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hn : threshold ≤ n) (hP : ModelClass c_f C_f L P n) (A : Bool) : (∫ ω, ((∑ i : Fin 7, ∑ j : Fin 7, ∫ x in covariateSpace, (dPhi2 A (pilot c_f C_f ω x) i j / 2) * (markedDensityVector c_f C_f L P n hP x i - pilot c_f C_f ω x i) * (markedDensityVector c_f C_f L P n hP x j - pilot c_f C_f ω x j)) - quadraticProjectionMean c_f C_f L P n hP ω A) ^ 2 ∂dataLaw P n n) ≤ (7 : ℝ) ^ 4 * (fourthDerivativeEnvelope c_f C_f) ^ 2 * (3 * (1 + C_f) * L) ^ 4 * (2 : ℝ) ^ (1 / 2 : ℝ) * (5 : ℝ) ^ (2 / 3 : ℝ) * (n : ℝ) ^ (-(2 / 3 : ℝ)) := by simp_rw [← quadraticCellProjectionBias_eq_spatial_sub_projectionMean c_f C_f L P n hP] exact quadraticCellProjectionBias_integrated_sq_sample_rate c_f C_f L P n hn hP A
CausalSmith.Stat.TransportCaceRoughnuisanceLength.quadratic_spatial_projection_bias_integrated_sq_sample_rate · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/SpatialProjectionBridge.lean:119
CausalSmith.Stat.STAT_TransportCaceRoughnuisanceLength_Research.Helpers.CubicMse.SpatialTaylorAssembly 14 declarations These identities connect the Fréchet Taylor remainder to the coordinate sums used in the exact quadratic and cubic projection means.

Coordinate and spatial assembly of the exact Taylor polynomial

These identities connect the Fréchet Taylor remainder to the coordinate sums used in the exact quadratic and cubic projection means.

theorem density_multilinear_diagonal_expansion Lemma density_multilinear_diagonal_expansion in the paper ↗

Expansion of a multilinear form on the diagonal in the estimator's basis. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
q :
ℕ
T :
ContinuousMultilinearMap ℝ (fun _ : Fin q => Fin 7 → ℝ) ℝ
h :
Fin 7 → ℝ
T (fun _ => h)
= ∑ idx : Fin q → Fin 7, (∏ j : Fin q, h (idx j)) * T (fun j => basis (idx j))
Proof (Lean source)
-- @node: density_multilinear_diagonal_expansion lemma density_multilinear_diagonal_expansion {q : ℕ} (T : ContinuousMultilinearMap ℝ (fun _ : Fin q => Fin 7 → ℝ) ℝ) (h : Fin 7 → ℝ) : T (fun _ => h) = ∑ idx : Fin q → Fin 7, (∏ j : Fin q, h (idx j)) * T (fun j => basis (idx j)) := by classical have hh : (∑ i : Fin 7, h i • basis i) = h := by ext j simp [basis, Finset.sum_apply] calc T (fun _ => h) = T (fun _ => ∑ i : Fin 7, h i • basis i) := by rw [hh] _ = ∑ idx : Fin q → Fin 7, T (fun j => h (idx j) • basis (idx j)) := T.map_sum (fun _ i => h i • basis i) _ = _ := by simp_rw [T.map_smul_univ, smul_eq_mul]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.density_multilinear_diagonal_expansion · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/SpatialTaylorAssembly.lean:15

Reindexing a sum over a finite tuple by its first entry and its tail. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
q :
ℕ
f :
(Fin (q + 1) → Fin 7) → ℝ
(∑ idx, f idx) = ∑ i : Fin 7, ∑ idx : Fin q → Fin 7, f (cons i idx)
Proof (Lean source)
-- @node: sum_density_tuple_cons lemma sum_density_tuple_cons {q : ℕ} (f : (Fin (q + 1) → Fin 7) → ℝ) : (∑ idx, f idx) = ∑ i : Fin 7, ∑ idx : Fin q → Fin 7, f (cons i idx) := by classical rw [← Equiv.sum_comp (Fin.consEquiv (fun _ : Fin (q + 1) => Fin 7))] exact Fintype.sum_prod_type _
CausalSmith.Stat.TransportCaceRoughnuisanceLength.sum_density_tuple_cons · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/SpatialTaylorAssembly.lean:32
theorem iteratedFDeriv_one_eq_coordinate_sum

The first Fréchet Taylor term is the exact coordinate linear polynomial. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
A :
v h :
Fin 7 → ℝ
iteratedFDeriv ℝ 1 (Phi A) v ![h] = ∑ i : Fin 7, dPhi1 A v i * h i
Proof (Lean source)
-- @node: iteratedFDeriv_one_eq_coordinate_sum lemma iteratedFDeriv_one_eq_coordinate_sum (A : Bool) (v h : Fin 7 → ℝ) : iteratedFDeriv ℝ 1 (Phi A) v ![h] = ∑ i : Fin 7, dPhi1 A v i * h i := by have hv : (![h] : Fin 1 → Fin 7 → ℝ) = fun _ => h := by ext j; fin_cases j; rfl rw [hv, density_multilinear_diagonal_expansion, sum_density_tuple_cons] simp [dPhi1, iteratedFDeriv_one_apply, mul_comm]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.iteratedFDeriv_one_eq_coordinate_sum · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/SpatialTaylorAssembly.lean:40
theorem iteratedFDeriv_two_eq_coordinate_sum

The second Fréchet Taylor term is the exact ordered coordinate sum. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
A :
v h :
Fin 7 → ℝ
iteratedFDeriv ℝ 2 (Phi A) v ![h, h] = ∑ i : Fin 7, ∑ j : Fin 7, dPhi2 A v i j * h i * h j
Proof (Lean source)
-- @node: iteratedFDeriv_two_eq_coordinate_sum lemma iteratedFDeriv_two_eq_coordinate_sum (A : Bool) (v h : Fin 7 → ℝ) : iteratedFDeriv ℝ 2 (Phi A) v ![h, h] = ∑ i : Fin 7, ∑ j : Fin 7, dPhi2 A v i j * h i * h j := by have hv : (![h, h] : Fin 2 → Fin 7 → ℝ) = fun _ => h := by ext j; fin_cases j <;> rfl rw [hv, density_multilinear_diagonal_expansion, sum_density_tuple_cons] simp_rw [sum_density_tuple_cons] simp only [dPhi2, Finset.univ_unique, Nat.reduceAdd, Fin.prod_univ_two, Fin.isValue, Fin.cons_zero, Fin.cons_one, Finset.sum_singleton, mul_comm, mul_left_comm, mul_assoc] apply Finset.sum_congr rfl intro i _ apply Finset.sum_congr rfl intro j _ congr 3 ext r; fin_cases r <;> rfl
CausalSmith.Stat.TransportCaceRoughnuisanceLength.iteratedFDeriv_two_eq_coordinate_sum · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/SpatialTaylorAssembly.lean:49
theorem iteratedFDeriv_three_eq_coordinate_sum

The third Fréchet Taylor term is the exact ordered coordinate sum. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
A :
v h :
Fin 7 → ℝ
iteratedFDeriv ℝ 3 (Phi A) v ![h, h, h]
= ∑ i : Fin 7, ∑ j : Fin 7, ∑ k : Fin 7, dPhi3 A v i j k * h i * h j * h k
Proof (Lean source)
-- @node: iteratedFDeriv_three_eq_coordinate_sum lemma iteratedFDeriv_three_eq_coordinate_sum (A : Bool) (v h : Fin 7 → ℝ) : iteratedFDeriv ℝ 3 (Phi A) v ![h, h, h] = ∑ i : Fin 7, ∑ j : Fin 7, ∑ k : Fin 7, dPhi3 A v i j k * h i * h j * h k := by have hv : (![h, h, h] : Fin 3 → Fin 7 → ℝ) = fun _ => h := by ext j; fin_cases j <;> rfl rw [hv, density_multilinear_diagonal_expansion, sum_density_tuple_cons] simp_rw [sum_density_tuple_cons] simp only [dPhi3, Finset.univ_unique, Nat.reduceAdd, Fin.prod_univ_three, Fin.isValue, Fin.cons_zero, Fin.cons_one, Finset.sum_singleton, mul_comm, mul_left_comm, mul_assoc] apply Finset.sum_congr rfl intro i _ apply Finset.sum_congr rfl intro j _ apply Finset.sum_congr rfl intro k _ congr 4 ext r; fin_cases r <;> rfl
CausalSmith.Stat.TransportCaceRoughnuisanceLength.iteratedFDeriv_three_eq_coordinate_sum · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/SpatialTaylorAssembly.lean:67
theorem integrableOn_spatial_pilot_composition

A function continuous in the spatial argument at each fixed pilot value is integrable on the compact covariate region: the pilot has finitely many values. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f :
ℝ
n :
ℕ
ω :
g :
(Fin 7 → ℝ) → ℝ → ℝ
hg :
IntegrableOn (fun x => g (pilot c_f C_f ω x) x) covariateSpace
Proof (Lean source)
-- @node: integrableOn_spatial_pilot_composition lemma integrableOn_spatial_pilot_composition (c_f C_f : ℝ) {n : ℕ} (ω : TwoSample n n) (g : (Fin 7 → ℝ) → ℝ → ℝ) (hg : ∀ v, ContinuousOn (g v) covariateSpace) : IntegrableOn (fun x => g (pilot c_f C_f ω x) x) covariateSpace := by have hK : 0 < pilotResolution n := by unfold pilotResolution dyadicResolution split_ifs <;> positivity rw [← iUnion_cell_eq_covariateSpace hK, integrableOn_finite_iUnion] intro l have hi : IntegrableOn (g (pilot c_f C_f ω (midpoint (pilotResolution n) l))) covariateSpace := (hg _).integrableOn_Icc apply (integrableOn_congr_fun (s := cell (pilotResolution n) l) (g := g (pilot c_f C_f ω (midpoint (pilotResolution n) l))) (by intro x hx exact congrArg (fun v => g v x) (pilot_eq_midpoint_of_refinement c_f C_f hK (dvd_refl _) ω l hx)) (measurableSet_cell _ _)).2 exact hi.mono_set (cell_subset_covariateSpace hK l)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.integrableOn_spatial_pilot_composition · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/SpatialTaylorAssembly.lean:88
theorem integrableOn_spatial_pilot_monomial

Every spatial coordinate Taylor monomial is integrable, without additional regularity assumptions on the data or a pilot-dependent coefficient. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n q :
ℕ
hP :
ModelClass c_f C_f L P n
ω :
a :
(Fin 7 → ℝ) → ℝ
idx :
Fin q → Fin 7
IntegrableOn (fun x => a (pilot c_f C_f ω x) * ∏ j : Fin q, (markedDensityVector c_f C_f L P n hP x (idx j) - pilot c_f C_f ω x (idx j))) covariateSpace
Proof (Lean source)
-- @node: integrableOn_spatial_pilot_monomial lemma integrableOn_spatial_pilot_monomial (c_f C_f L : ℝ) (P : TransportLaw) (n q : ℕ) (hP : ModelClass c_f C_f L P n) (ω : TwoSample n n) (a : (Fin 7 → ℝ) → ℝ) (idx : Fin q → Fin 7) : IntegrableOn (fun x => a (pilot c_f C_f ω x) * ∏ j : Fin q, (markedDensityVector c_f C_f L P n hP x (idx j) - pilot c_f C_f ω x (idx j))) covariateSpace := by apply integrableOn_spatial_pilot_composition c_f C_f ω (fun v x => a v * ∏ j : Fin q, (markedDensityVector c_f C_f L P n hP x (idx j) - v (idx j))) intro v have hF (i : Fin 7) := markedDensityVector_continuousOn c_f C_f L P n hP i fun_prop
CausalSmith.Stat.TransportCaceRoughnuisanceLength.integrableOn_spatial_pilot_monomial · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/SpatialTaylorAssembly.lean:111
theorem holderOn_continuousOn_covariateSpace

If a function satisfies the stated Hölder condition, then it is continuous on the covariate region.

Formal statement
f :
ℝ → ℝ
L :
ℝ
hf :
Proof (Lean source)
-- @node: holderOn_continuousOn_covariateSpace @[fun_prop] lemma holderOn_continuousOn_covariateSpace {f : ℝ → ℝ} {L : ℝ} (hf : HolderOn f L) : ContinuousOn f covariateSpace := by have hmap : ContinuousOn (fun x : ℝ => ![x]) covariateSpace := by fun_prop have hmaps : Set.MapsTo (fun x : ℝ => ![x]) covariateSpace {v : Fin 1 → ℝ | v 0 ∈ covariateSpace} := by intro x hx simpa using hx simpa [Function.comp_def] using hf.2.1.continuousOn.comp hmap hmaps
CausalSmith.Stat.TransportCaceRoughnuisanceLength.holderOn_continuousOn_covariateSpace · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/SpatialTaylorAssembly.lean:127
theorem spatialTaylorRemainder_eq_transport_sub_coordinate_terms

The exact spatial Taylor polynomial and remainder integrate to the transported form. All ordered coordinate sums retain their factorial factors. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hP :
ModelClass c_f C_f L P n
ω :
A :
spatialTaylorRemainder c_f C_f L P n hP ω A
- (pilotIntegral c_f C_f ω A + (∑ i : Fin 7, ∫ x in covariateSpace, dPhi1 A (pilot c_f C_f ω x) i * (markedDensityVector c_f C_f L P n hP x i - pilot c_f C_f ω x i)) + (∑ i : Fin 7, ∑ j : Fin 7, ∫ x in covariateSpace, (dPhi2 A (pilot c_f C_f ω x) i j / 2) * (markedDensityVector c_f C_f L P n hP x i - pilot c_f C_f ω x i) * (markedDensityVector c_f C_f L P n hP x j - pilot c_f C_f ω x j)) + (∑ i : Fin 7, ∑ j : Fin 7, ∑ k : Fin 7, ∫ x in covariateSpace, (dPhi3 A (pilot c_f C_f ω x) i j k / 6) * (markedDensityVector c_f C_f L P n hP x i - pilot c_f C_f ω x i) * (markedDensityVector c_f C_f L P n hP x j - pilot c_f C_f ω x j) * (markedDensityVector c_f C_f L P n hP x k - pilot c_f C_f ω x k)))
Proof (Lean source)
-- @node: spatialTaylorRemainder_eq_transport_sub_coordinate_terms lemma spatialTaylorRemainder_eq_transport_sub_coordinate_terms (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hP : ModelClass c_f C_f L P n) (ω : TwoSample n n) (A : Bool) : spatialTaylorRemainder c_f C_f L P n hP ω A = transportedForm P A - (pilotIntegral c_f C_f ω A + (∑ i : Fin 7, ∫ x in covariateSpace, dPhi1 A (pilot c_f C_f ω x) i * (markedDensityVector c_f C_f L P n hP x i - pilot c_f C_f ω x i)) + (∑ i : Fin 7, ∑ j : Fin 7, ∫ x in covariateSpace, (dPhi2 A (pilot c_f C_f ω x) i j / 2) * (markedDensityVector c_f C_f L P n hP x i - pilot c_f C_f ω x i) * (markedDensityVector c_f C_f L P n hP x j - pilot c_f C_f ω x j)) + (∑ i : Fin 7, ∑ j : Fin 7, ∑ k : Fin 7, ∫ x in covariateSpace, (dPhi3 A (pilot c_f C_f ω x) i j k / 6) * (markedDensityVector c_f C_f L P n hP x i - pilot c_f C_f ω x i) * (markedDensityVector c_f C_f L P n hP x j - pilot c_f C_f ω x j) * (markedDensityVector c_f C_f L P n hP x k - pilot c_f C_f ω x k))) := by let F := markedDensityVector c_f C_f L P n hP let v := pilot c_f C_f ω let h := fun x => F x - v x let l := fun i x => dPhi1 A (v x) i * h x i let q := fun i j x => (dPhi2 A (v x) i j / 2) * h x i * h x j let c := fun i j k x => (dPhi3 A (v x) i j k / 6) * h x i * h x j * h x k have hl (i : Fin 7) : IntegrableOn (l i) covariateSpace := by simpa [l, h, v, F] using integrableOn_spatial_pilot_monomial c_f C_f L P n 1 hP ω (fun v => dPhi1 A v i) ![i] have hq (i j : Fin 7) : IntegrableOn (q i j) covariateSpace := by simpa [q, h, v, F, Fin.prod_univ_two, mul_assoc] using integrableOn_spatial_pilot_monomial c_f C_f L P n 2 hP ω (fun v => dPhi2 A v i j / 2) ![i, j] have hc (i j k : Fin 7) : IntegrableOn (c i j k) covariateSpace := by simpa [c, h, v, F, Fin.prod_univ_three, mul_assoc] using integrableOn_spatial_pilot_monomial c_f C_f L P n 3 hP ω (fun v => dPhi3 A v i j k / 6) ![i, j, k] have hp : IntegrableOn (fun x => Phi A (v x)) covariateSpace := integrableOn_spatial_pilot_composition c_f C_f ω (fun v _ => Phi A v) (fun _ => continuousOn_const) have ht : IntegrableOn (fun x => Phi A (F x)) covariateSpace := by have hT := holderOn_continuousOn_covariateSpace hP.targetHolder have hm1 := holderOn_continuousOn_covariateSpace (hP.armHolder.1 A true) have hm0 := holderOn_continuousOn_covariateSpace (hP.armHolder.1 A false) have hi : IntegrableOn (fun x => P.fT x * armContrast P A x) covariateSpace := (hT.mul (hm1.sub hm0)).integrableOn_Icc exact (integrableOn_congr_fun (fun x hx => Phi_markedDensityVector_eq_transport_integrand c_f C_f L P n hP A x hx) measurableSet_Icc).2 hi have hls := integrable_finsetSum univ (fun i _ => hl i) have hqs := integrable_finsetSum univ (fun i _ => integrable_finsetSum univ (fun j _ => hq i j)) have hcs := integrable_finsetSum univ (fun i _ => integrable_finsetSum univ (fun j _ => integrable_finsetSum univ (fun k _ => hc i j k))) have heq : spatialTaylorRemainder c_f C_f L P n hP ω A = ∫ x in covariateSpace, Phi A (F x) - (Phi A (v x) + (∑ i, l i x) + (∑ i, ∑ j, q i j x) + (∑ i, ∑ j, ∑ k, c i j k x)) := by unfold spatialTaylorRemainder apply setIntegral_congr_fun measurableSet_Icc intro x _ dsimp only rw [iteratedFDeriv_one_eq_coordinate_sum, iteratedFDeriv_two_eq_coordinate_sum, iteratedFDeriv_three_eq_coordinate_sum] simp only [Finset.sum_div] simp only [l, q, c, h, v, F, Pi.sub_apply, div_mul_eq_mul_div] rw [heq] have hsub := integral_sub ht (((hp.add hls).add hqs).add hcs) have hadd3 := integral_add ((hp.add hls).add hqs) hcs have hadd2 := integral_add (hp.add hls) hqs have hadd1 := integral_add hp hls simp only [Pi.add_apply] at hsub hadd3 hadd2 hadd1 rw [hsub, hadd3, hadd2, hadd1] rw [integral_finsetSum _ (fun i _ => hl i), integral_finsetSum _ (fun i _ => integrable_finsetSum _ (fun j _ => hq i j)), integral_finsetSum _ (fun i _ => integrable_finsetSum _ (fun j _ => integrable_finsetSum _ (fun k _ => hc i j k)))] simp_rw [integral_finsetSum _ (fun j _ => hq _ j), integral_finsetSum _ (fun j _ => integrable_finsetSum _ (fun k _ => hc _ j k)), integral_finsetSum _ (fun k _ => hc _ _ k)] have ht' : (∫ x in covariateSpace, Phi A (F x)) = transportedForm P A := by rw [transportedForm_eq_integral_Phi_markedDensityVector c_f C_f L P n hP A] simp [F, covariateSpace, intervalIntegral.integral_of_le (by norm_num : (0 : ℝ) ≤ 1), integral_Icc_eq_integral_Ioc] have hp' : (∫ x in covariateSpace, Phi A (v x)) = pilotIntegral c_f C_f ω A := by simp [pilotIntegral, v, covariateSpace, intervalIntegral.integral_of_le (by norm_num : (0 : ℝ) ≤ 1), integral_Icc_eq_integral_Ioc] rw [ht', hp'] rfl
CausalSmith.Stat.TransportCaceRoughnuisanceLength.spatialTaylorRemainder_eq_transport_sub_coordinate_terms · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/SpatialTaylorAssembly.lean:138
def linearProjectionMean

The spatial linear Taylor term, the proposed conditional mean of the held-out linear statistic in roadmap (10). For the displayed assumptions and inputs, the stated object is defined.

Definition (Lean source)
c_f C_f L :
ℝ
n :
ℕ
hP :
ModelClass c_f C_f L P n
ω :
A :
linearProjectionMean c_f C_f L P n hP ω A :
ℝ
∑ i : Fin 7, ∫ x in covariateSpace, dPhi1 A (pilot c_f C_f ω x) i * (markedDensityVector c_f C_f L P n hP x i - pilot c_f C_f ω x i)
def projectedEstimatorMean

The projected mean of the exact cubic statistic. Identification with conditional expectation still requires the held-out linear mean identity. For the displayed assumptions and inputs, the stated object is defined.

Definition (Lean source)
c_f C_f L :
ℝ
n :
ℕ
hP :
ModelClass c_f C_f L P n
ω :
A :
projectedEstimatorMean c_f C_f L P n hP ω A :
ℝ
pilotIntegral c_f C_f ω A
+ linearProjectionMean c_f C_f L P n hP ω A
+ quadraticProjectionMean c_f C_f L P n hP ω A
+ cubicProjectionMean c_f C_f L P n hP ω A
CausalSmith.Stat.TransportCaceRoughnuisanceLength.projectedEstimatorMean · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/SpatialTaylorAssembly.lean:236
theorem projectedEstimatorMean_sub_transport_eq_spatial_bias

The exact projected mean has precisely the three spatial errors from roadmap (14), with a common negative sign. No bias term is omitted. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hP :
ModelClass c_f C_f L P n
ω :
A :
projectedEstimatorMean c_f C_f L P n hP ω A - transportedForm P A
= -(spatialTaylorRemainder c_f C_f L P n hP ω A + quadraticCellProjectionBias c_f C_f L P n (quadraticResolution n) hP ω A + spatialCubicProjectionBias c_f C_f L P n hP ω A)
Proof (Lean source)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.projectedEstimatorMean_sub_transport_eq_spatial_bias · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/SpatialTaylorAssembly.lean:245
theorem projectedEstimatorMean_squared_bias_integral_eq

The exact projected mean's squared bias is the expression already bounded by combined_spatial_projection_bias_second_moment in roadmap (14). Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hP :
ModelClass c_f C_f L P n
A :
(∫ ω, (projectedEstimatorMean c_f C_f L P n hP ω A - transportedForm P A) ^ 2 ∂dataLaw P n n)
= ∫ ω, (spatialTaylorRemainder c_f C_f L P n hP ω A + quadraticCellProjectionBias c_f C_f L P n (quadraticResolution n) hP ω A + spatialCubicProjectionBias c_f C_f L P n hP ω A) ^ 2 ∂dataLaw P n n
Proof (Lean source)
-- @node: projectedEstimatorMean_squared_bias_integral_eq lemma projectedEstimatorMean_squared_bias_integral_eq (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hP : ModelClass c_f C_f L P n) (A : Bool) : (∫ ω, (projectedEstimatorMean c_f C_f L P n hP ω A - transportedForm P A) ^ 2 ∂dataLaw P n n) = ∫ ω, (spatialTaylorRemainder c_f C_f L P n hP ω A + quadraticCellProjectionBias c_f C_f L P n (quadraticResolution n) hP ω A + spatialCubicProjectionBias c_f C_f L P n hP ω A) ^ 2 ∂dataLaw P n n := by apply integral_congr_ae filter_upwards [] with ω rw [projectedEstimatorMean_sub_transport_eq_spatial_bias, neg_sq]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.projectedEstimatorMean_squared_bias_integral_eq · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/SpatialTaylorAssembly.lean:260
theorem projectedEstimatorMean_squared_bias_sample_rate

Roadmap (14) holds for the exact projected estimator mean, with the paper's explicit constant 3(BR+BQ+BC). Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hn :
threshold ≤ n
hP :
ModelClass c_f C_f L P n
A :
H :
3 * (1 + C_f) * L
A2 :
2 * (1 + C_f + C_f ^ 2) * (5 : ℝ) ^ (1 / 5 : ℝ)
+ (2 : ℝ) ^ (5 / 4 : ℝ) * H ^ 2 * (5 : ℝ) ^ (1 / 5 : ℝ)
BR :
(M / 24) ^ 2 * (7 : ℝ) ^ (8 : ℕ) * pilotEighthConstant C_f L
BQ :
(7 : ℝ) ^ 4 * M ^ 2 * H ^ 4 * (2 : ℝ) ^ (1 / 2 : ℝ) * (5 : ℝ) ^ (2 / 3 : ℝ)
C1 :
(M / 2) * (7 : ℝ) ^ 2 * H ^ 2
C2 :
(M / 6) * (7 : ℝ) ^ 3 * H ^ 3
BC :
2 * (C1 ^ 2 * (7 : ℝ) ^ 2 * A2 * (2 : ℝ) ^ (1 / 2 : ℝ) * (5 : ℝ) ^ (1 / 2 : ℝ) + C2 ^ 2 * (2 : ℝ) ^ (3 / 4 : ℝ) * (5 : ℝ) ^ (3 / 4 : ℝ))
(∫ ω, (projectedEstimatorMean c_f C_f L P n hP ω A - transportedForm P A) ^ 2 ∂dataLaw P n n)
≤ 3 * (BR + BQ + BC) * (n : ℝ) ^ (-(2 / 3 : ℝ))
Proof (Lean source)
-- @node: projectedEstimatorMean_squared_bias_sample_rate lemma projectedEstimatorMean_squared_bias_sample_rate (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hn : threshold ≤ n) (hP : ModelClass c_f C_f L P n) (A : Bool) : let H := 3 * (1 + C_f) * L let M := fourthDerivativeEnvelope c_f C_f let A2 := 2 * (1 + C_f + C_f ^ 2) * (5 : ℝ) ^ (1 / 5 : ℝ) + (2 : ℝ) ^ (5 / 4 : ℝ) * H ^ 2 * (5 : ℝ) ^ (1 / 5 : ℝ) let BR := (M / 24) ^ 2 * (7 : ℝ) ^ (8 : ℕ) * pilotEighthConstant C_f L let BQ := (7 : ℝ) ^ 4 * M ^ 2 * H ^ 4 * (2 : ℝ) ^ (1 / 2 : ℝ) * (5 : ℝ) ^ (2 / 3 : ℝ) let C1 := (M / 2) * (7 : ℝ) ^ 2 * H ^ 2 let C2 := (M / 6) * (7 : ℝ) ^ 3 * H ^ 3 let BC := 2 * (C1 ^ 2 * (7 : ℝ) ^ 2 * A2 * (2 : ℝ) ^ (1 / 2 : ℝ) * (5 : ℝ) ^ (1 / 2 : ℝ) + C2 ^ 2 * (2 : ℝ) ^ (3 / 4 : ℝ) * (5 : ℝ) ^ (3 / 4 : ℝ)) (∫ ω, (projectedEstimatorMean c_f C_f L P n hP ω A - transportedForm P A) ^ 2 ∂dataLaw P n n) ≤ 3 * (BR + BQ + BC) * (n : ℝ) ^ (-(2 / 3 : ℝ)) := by dsimp only rw [projectedEstimatorMean_squared_bias_integral_eq] exact combined_spatial_projection_bias_second_moment c_f C_f L P n hn hP A
CausalSmith.Stat.TransportCaceRoughnuisanceLength.projectedEstimatorMean_squared_bias_sample_rate · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/SpatialTaylorAssembly.lean:275
CausalSmith.Stat.STAT_TransportCaceRoughnuisanceLength_Research.Helpers.CubicMse.SubsetAggregation 2 declarations Cell-pair aggregation for one, two, or three residual blocks

Cell-pair aggregation for one, two, or three residual blocks

theorem abs_cellPair_product_sum_le

The diagonal/off-diagonal cell-pair estimate uniformly for any finite number q of factored residual blocks. The cubic proof consumes q=1,2,3. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
K q :
ℕ
c :
Fin K → ℝ
κ :
Fin q → Fin K → Fin K → ℝ
C D O :
ℝ
hC :
0 ≤ C
hD :
0 ≤ D
hO :
0 ≤ O
hc :
∀ l, |c l| ≤ C
hκdiag :
∀ t l, |κ t l l| ≤ D
hκoff :
∀ t l r
if
l ≠ r
then
|κ t l r| ≤ O
|∑ l : Fin K, ∑ r : Fin K, c l * c r * ∏ t : Fin q, κ t l r|
≤ (K : ℝ) * C ^ 2 * D ^ q + (K : ℝ) ^ 2 * C ^ 2 * O ^ q
Proof (Lean source)
lemma abs_cellPair_product_sum_le {K q : ℕ} (c : Fin K → ℝ) (κ : Fin q → Fin K → Fin K → ℝ) (C D O : ℝ) (hC : 0 ≤ C) (hD : 0 ≤ D) (hO : 0 ≤ O) (hc : ∀ l, |c l| ≤ C) (hκdiag : ∀ t l, |κ t l l| ≤ D) (hκoff : ∀ t l r, l ≠ r → |κ t l r| ≤ O) : |∑ l : Fin K, ∑ r : Fin K, c l * c r * ∏ t : Fin q, κ t l r| ≤ (K : ℝ) * C ^ 2 * D ^ q + (K : ℝ) ^ 2 * C ^ 2 * O ^ q := by calc |∑ l : Fin K, ∑ r : Fin K, c l * c r * ∏ t : Fin q, κ t l r| ≤ ∑ l : Fin K, ∑ r : Fin K, |c l * c r * ∏ t : Fin q, κ t l r| := by exact (Finset.abs_sum_le_sum_abs _ _).trans (Finset.sum_le_sum fun _ _ => Finset.abs_sum_le_sum_abs _ _) _ ≤ ∑ l : Fin K, ∑ r : Fin K, if l = r then C ^ 2 * D ^ q else C ^ 2 * O ^ q := by apply Finset.sum_le_sum intro l _ apply Finset.sum_le_sum intro r _ rw [abs_mul, abs_mul, Finset.abs_prod] have hcc : |c l| * |c r| ≤ C ^ 2 := by simpa [pow_two] using mul_le_mul (hc l) (hc r) (abs_nonneg _) hC by_cases hlr : l = r · subst r simp only [if_pos rfl] have hp : ∏ t : Fin q, |κ t l l| ≤ D ^ q := by calc ∏ t : Fin q, |κ t l l| ≤ ∏ _t : Fin q, D := Finset.prod_le_prod (fun _ _ => abs_nonneg _) (fun t _ => hκdiag t l) _ = D ^ q := by simp exact mul_le_mul hcc hp (Finset.prod_nonneg fun _ _ => abs_nonneg _) (sq_nonneg C) · simp only [if_neg hlr] have hp : ∏ t : Fin q, |κ t l r| ≤ O ^ q := by calc ∏ t : Fin q, |κ t l r| ≤ ∏ _t : Fin q, O := Finset.prod_le_prod (fun _ _ => abs_nonneg _) (fun t _ => hκoff t l r hlr) _ = O ^ q := by simp exact mul_le_mul hcc hp (Finset.prod_nonneg fun _ _ => abs_nonneg _) (sq_nonneg C) _ ≤ ∑ l : Fin K, (C ^ 2 * D ^ q + (K : ℝ) * C ^ 2 * O ^ q) := by apply Finset.sum_le_sum intro l _ rw [← Finset.add_sum_erase _ _ (Finset.mem_univ l)] simp only [if_pos rfl] have hnonneg : 0 ≤ C ^ 2 * O ^ q := mul_nonneg (sq_nonneg C) (pow_nonneg hO q) have herase : ∑ r ∈ Finset.univ.erase l, (if l = r then C ^ 2 * D ^ q else C ^ 2 * O ^ q) = (Finset.univ.erase l).card * (C ^ 2 * O ^ q) := by calc _ = ∑ _r ∈ Finset.univ.erase l, C ^ 2 * O ^ q := by apply Finset.sum_congr rfl intro r hr simp only [Finset.mem_erase] at hr simp [hr.1.symm] _ = _ := by simp rw [herase] have hcard : (((Finset.univ.erase l).card : ℕ) : ℝ) ≤ K := by norm_cast simp simpa [mul_assoc] using mul_le_mul_of_nonneg_right hcard hnonneg _ = (K : ℝ) * C ^ 2 * D ^ q + (K : ℝ) ^ 2 * C ^ 2 * O ^ q := by simp [Finset.sum_const, nsmul_eq_mul] ring
CausalSmith.Stat.TransportCaceRoughnuisanceLength.abs_cellPair_product_sum_le · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/SubsetAggregation.lean:12
theorem variance_cellSum_factored_le Lemma variance_cellSum_factored_le in the paper ↗

Variance of a cell sum after a q-block conditional covariance has factored into its blockwise cell-pair covariances. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
Ω :
K q :
ℕ
Y :
Fin K → Ω → ℝ
c :
Fin K → ℝ
κ :
Fin q → Fin K → Fin K → ℝ
C D O :
ℝ
hC :
0 ≤ C
hD :
0 ≤ D
hO :
0 ≤ O
hY :
∀ l, MemLp (Y l) 2 μ
hcov :
∀ l r, covariance (Y l) (Y r) μ = c l * c r * ∏ t : Fin q, κ t l r
hc :
∀ l, |c l| ≤ C
hκdiag :
∀ t l, |κ t l l| ≤ D
hκoff :
∀ t l r
if
l ≠ r
then
|κ t l r| ≤ O
variance (fun ω => ∑ l : Fin K, Y l ω) μ
≤ (K : ℝ) * C ^ 2 * D ^ q + (K : ℝ) ^ 2 * C ^ 2 * O ^ q
Proof (Lean source)
-- @node: variance_cellSum_factored_le lemma variance_cellSum_factored_le {Ω : Type*} [MeasurableSpace Ω] {μ : Measure Ω} [IsProbabilityMeasure μ] {K q : ℕ} (Y : Fin K → Ω → ℝ) (c : Fin K → ℝ) (κ : Fin q → Fin K → Fin K → ℝ) (C D O : ℝ) (hC : 0 ≤ C) (hD : 0 ≤ D) (hO : 0 ≤ O) (hY : ∀ l, MemLp (Y l) 2 μ) (hcov : ∀ l r, covariance (Y l) (Y r) μ = c l * c r * ∏ t : Fin q, κ t l r) (hc : ∀ l, |c l| ≤ C) (hκdiag : ∀ t l, |κ t l l| ≤ D) (hκoff : ∀ t l r, l ≠ r → |κ t l r| ≤ O) : variance (fun ω => ∑ l : Fin K, Y l ω) μ ≤ (K : ℝ) * C ^ 2 * D ^ q + (K : ℝ) ^ 2 * C ^ 2 * O ^ q := by rw [ProbabilityTheory.variance_fun_sum hY] calc ∑ l : Fin K, ∑ r : Fin K, covariance (Y l) (Y r) μ = ∑ l : Fin K, ∑ r : Fin K, c l * c r * ∏ t : Fin q, κ t l r := by apply Finset.sum_congr rfl intro l _ apply Finset.sum_congr rfl intro r _ exact hcov l r _ ≤ |∑ l : Fin K, ∑ r : Fin K, c l * c r * ∏ t : Fin q, κ t l r| := le_abs_self _ _ ≤ _ := abs_cellPair_product_sum_le c κ C D O hC hD hO hc hκdiag hκoff
CausalSmith.Stat.TransportCaceRoughnuisanceLength.variance_cellSum_factored_le · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/SubsetAggregation.lean:78
CausalSmith.Stat.STAT_TransportCaceRoughnuisanceLength_Research.Helpers.CubicMse.TaylorRemainder 5 declarations Exact cubic Taylor remainder for the marked transport integrand

Exact cubic Taylor remainder for the marked transport integrand

theorem cubicRatio_cubic_taylor_remainder_eq

The remainder after the degree-three Taylor polynomial of a marked ratio has an exact factored rational expression. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
a b c :
Fin 7
hc :
v c ≠ 0
hc' :
v c + h c ≠ 0
cubicRatioTerm a b c (v + h)
- (cubicRatioTerm a b c v + cubicRatioD1Apply a b c h v + cubicRatioD2Apply a b c h h v / 2 + cubicRatioD3Apply a b c h h h v / 6)
= (h c) ^ 2 * (v c * h a - v a * h c) * (v c * h b - v b * h c) * (v c)⁻¹ ^ 4 * (v c + h c)⁻¹
Proof (Lean source)
-- @node: cubicRatio_cubic_taylor_remainder_eq lemma cubicRatio_cubic_taylor_remainder_eq (a b c : Fin 7) (v h : DensityVector) (hc : v c ≠ 0) (hc' : v c + h c ≠ 0) : cubicRatioTerm a b c (v + h) - (cubicRatioTerm a b c v + cubicRatioD1Apply a b c h v + cubicRatioD2Apply a b c h h v / 2 + cubicRatioD3Apply a b c h h h v / 6) = (h c) ^ 2 * (v c * h a - v a * h c) * (v c * h b - v b * h c) * (v c)⁻¹ ^ 4 * (v c + h c)⁻¹ := by simp only [cubicRatioTerm, cubicRatioD1Apply, cubicRatioD2Apply, cubicRatioD3Apply, Pi.add_apply] field_simp ring
CausalSmith.Stat.TransportCaceRoughnuisanceLength.cubicRatio_cubic_taylor_remainder_eq · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/TaylorRemainder.lean:11
theorem cubicRatio_cubic_taylor_remainder_abs_le

Bounding the factored remainder uses only endpoint denominator bounds and the sum of the absolute coordinate increments. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
a b c :
Fin 7
C R S :
ℝ
hC :
0 ≤ C
_hR :
0 ≤ R
hS :
0 ≤ S
hc :
v c ≠ 0
hc' :
v c + h c ≠ 0
ha :
|v a| ≤ C
hb :
|v b| ≤ C
hq :
|v c| ≤ C
hRa :
|(v c)⁻¹| ≤ R
hRb :
|(v c + h c)⁻¹| ≤ R
hSc :
|h c| ≤ S
hSa :
|h a| + |h c| ≤ S
hSb :
|h b| + |h c| ≤ S
|cubicRatioTerm a b c (v + h)
- (cubicRatioTerm a b c v + cubicRatioD1Apply a b c h v + cubicRatioD2Apply a b c h h v / 2 + cubicRatioD3Apply a b c h h h v / 6)|
≤ C ^ 2 * R ^ 5 * S ^ 4
Proof (Lean source)
-- @node: cubicRatio_cubic_taylor_remainder_abs_le lemma cubicRatio_cubic_taylor_remainder_abs_le (a b c : Fin 7) (v h : DensityVector) (C R S : ℝ) (hC : 0 ≤ C) (_hR : 0 ≤ R) (hS : 0 ≤ S) (hc : v c ≠ 0) (hc' : v c + h c ≠ 0) (ha : |v a| ≤ C) (hb : |v b| ≤ C) (hq : |v c| ≤ C) (hRa : |(v c)⁻¹| ≤ R) (hRb : |(v c + h c)⁻¹| ≤ R) (hSc : |h c| ≤ S) (hSa : |h a| + |h c| ≤ S) (hSb : |h b| + |h c| ≤ S) : |cubicRatioTerm a b c (v + h) - (cubicRatioTerm a b c v + cubicRatioD1Apply a b c h v + cubicRatioD2Apply a b c h h v / 2 + cubicRatioD3Apply a b c h h h v / 6)| ≤ C ^ 2 * R ^ 5 * S ^ 4 := by rw [cubicRatio_cubic_taylor_remainder_eq a b c v h hc hc'] have hfactor (j : Fin 7) (hj : |v j| ≤ C) (hs : |h j| + |h c| ≤ S) : |v c * h j - v j * h c| ≤ C * S := by calc _ ≤ |v c * h j| + |v j * h c| := abs_sub _ _ _ = |v c| * |h j| + |v j| * |h c| := by rw [abs_mul, abs_mul] _ ≤ C * |h j| + C * |h c| := by gcongr _ = C * (|h j| + |h c|) := by ring _ ≤ C * S := mul_le_mul_of_nonneg_left hs hC simp only [abs_mul, abs_pow] calc _ ≤ S ^ 2 * (C * S) * (C * S) * R ^ 4 * R := by gcongr · exact hfactor a ha hSa · exact hfactor b hb hSb _ = _ := by ring
CausalSmith.Stat.TransportCaceRoughnuisanceLength.cubicRatio_cubic_taylor_remainder_abs_le · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/TaylorRemainder.lean:27
theorem abs_pair_le_density_increment_sum

Two distinct coordinate increments are bounded by the full coordinate sum used in the Taylor remainder. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
i j :
Fin 7
hij :
i ≠ j
|h i| + |h j| ≤ ∑ r : Fin 7, |h r|
Proof (Lean source)
-- @node: abs_pair_le_density_increment_sum lemma abs_pair_le_density_increment_sum (h : DensityVector) (i j : Fin 7) (hij : i ≠ j) : |h i| + |h j| ≤ ∑ r : Fin 7, |h r| := by classical have hs := Finset.sum_le_sum_of_subset_of_nonneg (show ({i, j} : Finset (Fin 7)) ⊆ univ from Finset.subset_univ _) (fun r _ _ => abs_nonneg (h r)) simpa [Finset.sum_pair hij] using hs
CausalSmith.Stat.TransportCaceRoughnuisanceLength.abs_pair_le_density_increment_sum · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/TaylorRemainder.lean:60
theorem Phi_cubic_taylor_remainder_abs_le

Roadmap (8), with the paper's constant: the exact third-order Taylor polynomial of either transport channel leaves a fourth-order remainder. Both endpoints lie in the clipping rectangle, so all denominators are positive. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f :
ℝ
hf :
0 < c_f
hF :
1 < C_f
A :
hv :
hw :
clippingRectangle c_f C_f (v + h)
|Phi A (v + h)
- (Phi A v + iteratedFDeriv ℝ 1 (Phi A) v ![h] + iteratedFDeriv ℝ 2 (Phi A) v ![h, h] / 2 + iteratedFDeriv ℝ 3 (Phi A) v ![h, h, h] / 6)|
≤ (fourthDerivativeEnvelope c_f C_f / 24) * (∑ r : Fin 7, |h r|) ^ 4
Proof (Lean source)
-- @node: Phi_cubic_taylor_remainder_abs_le lemma Phi_cubic_taylor_remainder_abs_le (c_f C_f : ℝ) (hf : 0 < c_f) (hF : 1 < C_f) (A : Bool) (v h : DensityVector) (hv : clippingRectangle c_f C_f v) (hw : clippingRectangle c_f C_f (v + h)) : |Phi A (v + h) - (Phi A v + iteratedFDeriv ℝ 1 (Phi A) v ![h] + iteratedFDeriv ℝ 2 (Phi A) v ![h, h] / 2 + iteratedFDeriv ℝ 3 (Phi A) v ![h, h, h] / 6)| ≤ (fourthDerivativeEnvelope c_f C_f / 24) * (∑ r : Fin 7, |h r|) ^ 4 := by classical let S := ∑ r : Fin 7, |h r| have hS : 0 ≤ S := Finset.sum_nonneg fun _ _ => abs_nonneg _ have hC : 0 ≤ C_f := by linarith have hR : 0 ≤ 4 / c_f := by positivity have hvalue (i : Fin 7) : |v i| ≤ C_f := by by_cases hi0 : i = 0 · subst i rw [abs_of_nonneg (hf.le.trans hv.1.1)] exact hv.1.2 by_cases hi1 : i = 1 · subst i rw [abs_of_nonneg (le_trans (by positivity) hv.2.1.1)] linarith [hv.2.1.2] by_cases hi2 : i = 2 · subst i rw [abs_of_nonneg (le_trans (by positivity) hv.2.2.1.1)] linarith [hv.2.2.1.2] have hi3 : 3 ≤ i.val := by have hn0 : i.val ≠ 0 := fun he => hi0 (Fin.ext he) have hn1 : i.val ≠ 1 := fun he => hi1 (Fin.ext he) have hn2 : i.val ≠ 2 := fun he => hi2 (Fin.ext he) omega have hb := hv.2.2.2 i hi3 rw [abs_of_nonneg hb.1] linarith [hb.2] have hden (q : ℝ) (hq : c_f / 4 ≤ q) : q ≠ 0 ∧ |q⁻¹| ≤ 4 / c_f := by have hqp : 0 < q := by linarith refine ⟨ne_of_gt hqp, ?_⟩ rw [abs_of_nonneg (inv_pos.mpr hqp).le] calc q⁻¹ ≤ (c_f / 4)⁻¹ := (inv_le_inv₀ hqp (by positivity)).2 hq _ = 4 / c_f := by field_simp have h1 := hden (v 1) hv.2.1.1 have h2 := hden (v 2) hv.2.2.1.1 have hw1 := hden (v 1 + h 1) hw.2.1.1 have hw2 := hden (v 2 + h 2) hw.2.2.1.1 let T (b c : Fin 7) := cubicRatioTerm 0 b c (v + h) - (cubicRatioTerm 0 b c v + cubicRatioD1Apply 0 b c h v + cubicRatioD2Apply 0 b c h h v / 2 + cubicRatioD3Apply 0 b c h h h v / 6) have hbound (b c : Fin 7) (hb : 3 ≤ b.val) (hc : c = 1 ∨ c = 2) : |T b c| ≤ C_f ^ 2 * (4 / c_f) ^ 5 * S ^ 4 := by have hc0 : (0 : Fin 7) ≠ c := by rcases hc with rfl | rfl <;> decide have hbc : b ≠ c := by intro heq subst b rcases hc with rfl | rfl <;> norm_num at hb have hq := Or.elim hc (fun heq => heq ▸ h1) (fun heq => heq ▸ h2) have hwq := Or.elim hc (fun heq => heq ▸ hw1) (fun heq => heq ▸ hw2) exact cubicRatio_cubic_taylor_remainder_abs_le 0 b c v h C_f (4 / c_f) S hC hR hS hq.1 hwq.1 (hvalue 0) (hvalue b) (hvalue c) hq.2 hwq.2 (Finset.single_le_sum (fun r _ => abs_nonneg (h r)) (Finset.mem_univ c)) (abs_pair_le_density_increment_sum h 0 c hc0) (abs_pair_le_density_increment_sum h b c hbc) have hplus := hbound (if A then 4 else 6) 2 (by cases A <;> decide) (inr rfl) have hminus := hbound (if A then 3 else 5) 1 (by cases A <;> decide) (inl rfl) have heq : Phi A (v + h) - (Phi A v + iteratedFDeriv ℝ 1 (Phi A) v ![h] + iteratedFDeriv ℝ 2 (Phi A) v ![h, h] / 2 + iteratedFDeriv ℝ 3 (Phi A) v ![h, h, h] / 6) = T (if A then 4 else 6) 2 - T (if A then 3 else 5) 1 := by rw [iteratedFDeriv_one_Phi_apply A v h h1.1 h2.1, iteratedFDeriv_two_Phi A v h h h1.1 h2.1, iteratedFDeriv_three_Phi A v h h h h1.1 h2.1] simp only [T, Phi, cubicRatioTerm, cubicRatioD1Apply, div_eq_mul_inv, Pi.add_apply] ring rw [heq] calc _ ≤ |T (if A then 4 else 6) 2| + |T (if A then 3 else 5) 1| := abs_sub _ _ _ ≤ 2 * C_f ^ 2 * (4 / c_f) ^ 5 * S ^ 4 := by linarith _ ≤ 2 * (1 + C_f) ^ 2 * (4 / c_f) ^ 5 * S ^ 4 := by gcongr linarith _ = _ := by dsimp [fourthDerivativeEnvelope, S]; ring
CausalSmith.Stat.TransportCaceRoughnuisanceLength.Phi_cubic_taylor_remainder_abs_le · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/TaylorRemainder.lean:71
theorem pilot_Phi_cubic_taylor_remainder_abs_le

The exact clipped pilot and true marked-density vector satisfy the fourth-order Taylor bound used by the MSE proof, pointwise on the covariate support. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hn :
threshold ≤ n
hP :
ModelClass c_f C_f L P n
A :
ω :
x :
ℝ
hx :
v :
pilot c_f C_f ω x
h :
markedDensityVector c_f C_f L P n hP x - v
|Phi A (markedDensityVector c_f C_f L P n hP x)
- (Phi A v + iteratedFDeriv ℝ 1 (Phi A) v ![h] + iteratedFDeriv ℝ 2 (Phi A) v ![h, h] / 2 + iteratedFDeriv ℝ 3 (Phi A) v ![h, h, h] / 6)|
≤ (fourthDerivativeEnvelope c_f C_f / 24) * (∑ r : Fin 7, |h r|) ^ 4
Proof (Lean source)
-- @node: pilot_Phi_cubic_taylor_remainder_abs_le lemma pilot_Phi_cubic_taylor_remainder_abs_le (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hn : threshold ≤ n) (hP : ModelClass c_f C_f L P n) (A : Bool) (ω : TwoSample n n) (x : ℝ) (hx : x ∈ covariateSpace) : let v := pilot c_f C_f ω x let h := markedDensityVector c_f C_f L P n hP x - v |Phi A (markedDensityVector c_f C_f L P n hP x) - (Phi A v + iteratedFDeriv ℝ 1 (Phi A) v ![h] + iteratedFDeriv ℝ 2 (Phi A) v ![h, h] / 2 + iteratedFDeriv ℝ 3 (Phi A) v ![h, h, h] / 6)| ≤ (fourthDerivativeEnvelope c_f C_f / 24) * (∑ r : Fin 7, |h r|) ^ 4 := by dsimp only have heq : pilot c_f C_f ω x + (markedDensityVector c_f C_f L P n hP x - pilot c_f C_f ω x) = markedDensityVector c_f C_f L P n hP x := add_sub_cancel _ _ have hw : clippingRectangle c_f C_f (pilot c_f C_f ω x + (markedDensityVector c_f C_f L P n hP x - pilot c_f C_f ω x)) := by rw [heq] exact markedDensityVector_mem_clippingRectangle c_f C_f L P n hP x hx have hr := Phi_cubic_taylor_remainder_abs_le c_f C_f hP.sourceBounds.1.1 hP.sourceBounds.2.1 A (pilot c_f C_f ω x) (markedDensityVector c_f C_f L P n hP x - pilot c_f C_f ω x) (pilot_mem_clippingRectangle c_f C_f L P n hn hP ω x) hw simpa only [heq] using hr
CausalSmith.Stat.TransportCaceRoughnuisanceLength.pilot_Phi_cubic_taylor_remainder_abs_le · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/TaylorRemainder.lean:161
CausalSmith.Stat.STAT_TransportCaceRoughnuisanceLength_Research.Helpers.CubicMse.TotalVariance 3 declarations The heterogeneous Cauchy--Schwarz inequality retains the three distinct paper constants and does not require independence between corrections.

Aggregation of the three exact centered correction variances

The heterogeneous Cauchy--Schwarz inequality retains the three distinct paper constants and does not require independence between corrections.

theorem condExp_sq_finsetSum_le_sum_bounds Lemma condExp_sq_finsetSum_le_sum_bounds in the paper ↗

Conditional second moments of a finite sum are bounded by the cardinality times the sum of the individual bounds, even for dependent summands. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
s :
Y :
ι → Ω → ℝ
B :
ι → ℝ
hY :
∀ i ∈ s, MemLp (Y i) 2 μ
hb :
∀ i ∈ s, ∀ᵐ x ∂μ, condExp m μ (fun y => (Y i y) ^ 2) x ≤ B i
∀ᵐ x ∂μ, condExp m μ (fun y => (∑ i ∈ s, Y i y) ^ 2) x ≤ (s.card : ℝ) * ∑ i ∈ s, B i
Proof (Lean source)
-- @node: condExp_sq_finsetSum_le_sum_bounds lemma condExp_sq_finsetSum_le_sum_bounds {Ω ι : Type*} [MeasurableSpace Ω] {μ : Measure Ω} {m : MeasurableSpace Ω} (s : Finset ι) (Y : ι → Ω → ℝ) (B : ι → ℝ) (hY : ∀ i ∈ s, MemLp (Y i) 2 μ) (hb : ∀ i ∈ s, ∀ᵐ x ∂μ, condExp m μ (fun y => (Y i y) ^ 2) x ≤ B i) : ∀ᵐ x ∂μ, condExp m μ (fun y => (∑ i ∈ s, Y i y) ^ 2) x ≤ (s.card : ℝ) * ∑ i ∈ s, B i := by have hYsq : ∀ i ∈ s, Integrable (fun x => (Y i x) ^ 2) μ := fun i hi => (hY i hi).integrable_sq let Q : Ω → ℝ := (s.card : ℝ) • (fun y => ∑ i ∈ s, (Y i y) ^ 2) have hsumSq : Integrable (fun y => ∑ i ∈ s, (Y i y) ^ 2) μ := integrable_finsetSum s hYsq have hQ : Integrable Q μ := hsumSq.const_mul _ have hsumLp : MemLp (fun y => ∑ i ∈ s, Y i y) 2 μ := memLp_finsetSum s hY have hleft : Integrable (fun y => (∑ i ∈ s, Y i y) ^ 2) μ := hsumLp.integrable_sq have hmono := condExp_mono hleft hQ (by filter_upwards [] with y exact sq_sum_le_card_mul_sum_sq (s := s) (f := fun i => Y i y)) (m := m) have hsum := condExp_finsetSum (μ := μ) (s := s) (f := fun i y => (Y i y) ^ 2) hYsq m have hscale := condExp_smul (μ := μ) (s.card : ℝ) (fun y => ∑ i ∈ s, (Y i y) ^ 2) m have hall : ∀ᵐ x ∂μ, ∀ i ∈ s, condExp m μ (fun y => (Y i y) ^ 2) x ≤ B i := by exact (eventually_finset_ball).2 hb filter_upwards [hmono, hsum, hscale, hall] with x hmono hsum hscale hall change condExp m μ Q x = _ at hscale simp only [Pi.smul_apply, smul_eq_mul] at hscale have hsum' : condExp m μ (fun y => ∑ i ∈ s, (Y i y) ^ 2) x = ∑ i ∈ s, condExp m μ (fun y => (Y i y) ^ 2) x := by simpa only [Finset.sum_fn, Finset.sum_apply] using hsum rw [hscale, hsum'] at hmono have hsumle : (∑ i ∈ s, condExp m μ (fun y => (Y i y) ^ 2) x) ≤ ∑ i ∈ s, B i := Finset.sum_le_sum fun i hi => hall i hi calc condExp m μ (fun y => (∑ i ∈ s, Y i y) ^ 2) x ≤ (s.card : ℝ) * ∑ i ∈ s, condExp m μ (fun y => (Y i y) ^ 2) x := hmono _ ≤ (s.card : ℝ) * ∑ i ∈ s, B i := mul_le_mul_of_nonneg_left hsumle (Nat.cast_nonneg _)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.condExp_sq_finsetSum_le_sum_bounds · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/TotalVariance.lean:17
theorem centered_corrections_conditional_second_moment_sample_rate

Roadmap (20) for the sum of the three exact conditionally centered corrections. Square integrability is derived from the component proofs. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hn :
threshold ≤ n
hP :
ModelClass c_f C_f L P n
A :
∀ᵐ ω ∂dataLaw P n n, condExp (trainingSigma n) (dataLaw P n n) (fun ξ : TwoSample n n => ((linearTerm c_f C_f ξ A - condExp (trainingSigma n) (dataLaw P n n) (fun ζ => linearTerm c_f C_f ζ A) ξ) + (quadraticTerm c_f C_f ξ A - condExp (trainingSigma n) (dataLaw P n n) (fun ζ => quadraticTerm c_f C_f ζ A) ξ) + (cubicTerm c_f C_f ξ A - condExp (trainingSigma n) (dataLaw P n n) (fun ζ => cubicTerm c_f C_f ζ A) ξ)) ^ 2) ω
≤ 3 * (10 * (7 : ℝ) ^ 2 * (fourthDerivativeEnvelope c_f C_f) ^ 2 + 60 * quadVarianceConstant c_f C_f + 310 * cubicVarianceConstant c_f C_f) * (n : ℝ) ^ (-(2 / 3 : ℝ))
Proof (Lean source)
-- @node: centered_corrections_conditional_second_moment_sample_rate lemma centered_corrections_conditional_second_moment_sample_rate (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hn : threshold ≤ n) (hP : ModelClass c_f C_f L P n) (A : Bool) : ∀ᵐ ω ∂dataLaw P n n, condExp (trainingSigma n) (dataLaw P n n) (fun ξ : TwoSample n n => ((linearTerm c_f C_f ξ A - condExp (trainingSigma n) (dataLaw P n n) (fun ζ => linearTerm c_f C_f ζ A) ξ) + (quadraticTerm c_f C_f ξ A - condExp (trainingSigma n) (dataLaw P n n) (fun ζ => quadraticTerm c_f C_f ζ A) ξ) + (cubicTerm c_f C_f ξ A - condExp (trainingSigma n) (dataLaw P n n) (fun ζ => cubicTerm c_f C_f ζ A) ξ)) ^ 2) ω ≤ 3 * (10 * (7 : ℝ) ^ 2 * (fourthDerivativeEnvelope c_f C_f) ^ 2 + 60 * quadVarianceConstant c_f C_f + 310 * cubicVarianceConstant c_f C_f) * (n : ℝ) ^ (-(2 / 3 : ℝ)) := by classical let μ := dataLaw P n n let m := trainingSigma n letI : MeasurableSpace (TwoSample n n) := Prod.instMeasurableSpace let F : Fin 3 → TwoSample n n → ℝ := ![fun ξ => linearTerm c_f C_f ξ A, fun ξ => quadraticTerm c_f C_f ξ A, fun ξ => cubicTerm c_f C_f ξ A] let Y : Fin 3 → TwoSample n n → ℝ := fun i ξ => F i ξ - condExp m μ (F i) ξ let B : Fin 3 → ℝ := ![10 * (7 : ℝ) ^ 2 * (fourthDerivativeEnvelope c_f C_f) ^ 2, 60 * quadVarianceConstant c_f C_f, 310 * cubicVarianceConstant c_f C_f] have hlp : ∀ i : Fin 3, MemLp (Y i) 2 μ := by intro i fin_cases i · exact (linear_conditional_variance_with_memLp c_f C_f L P n hn hP A).1 · have hp := (quadratic_conditional_variance_with_memLp c_f C_f L P n hn hP A).1 exact hp.sub (hp.condExp (by norm_num)) · have hp := (cubic_conditional_variance_with_memLp c_f C_f L P n hn hP A).1 exact hp.sub (hp.condExp (by norm_num)) have hb : ∀ i : Fin 3, ∀ᵐ ω ∂μ, condExp m μ (fun ξ => (Y i ξ) ^ 2) ω ≤ B i * (n : ℝ) ^ (-(2 / 3 : ℝ)) := by intro i fin_cases i · exact linear_conditional_variance_sample_rate c_f C_f L P n hn hP A · exact quadratic_conditional_variance_sample_rate c_f C_f L P n hn hP A · exact cubic_conditional_variance_sample_rate c_f C_f L P n hn hP A have hagg := condExp_sq_finsetSum_le_sum_bounds (μ := μ) (m := m) univ Y (fun i => B i * (n : ℝ) ^ (-(2 / 3 : ℝ))) (fun i _ => hlp i) (fun i _ => hb i) simp only [Fin.sum_univ_three] at hagg filter_upwards [hagg] with ω hω change condExp m μ (fun ξ => (Y 0 ξ + Y 1 ξ + Y 2 ξ) ^ 2) ω ≤ _ apply hω.trans_eq simp only [Finset.card_univ, Fintype.card_fin, Nat.cast_ofNat] dsimp [B] ring
CausalSmith.Stat.TransportCaceRoughnuisanceLength.centered_corrections_conditional_second_moment_sample_rate · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/TotalVariance.lean:64
theorem centered_corrections_expected_conditional_second_moment_sample_rate

Integrating the combined conditional bound gives the expected variance constant in roadmap (20). Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hn :
threshold ≤ n
hP :
ModelClass c_f C_f L P n
A :
(∫ ω, condExp (trainingSigma n) (dataLaw P n n) (fun ξ : TwoSample n n => ((linearTerm c_f C_f ξ A - condExp (trainingSigma n) (dataLaw P n n) (fun ζ => linearTerm c_f C_f ζ A) ξ) + (quadraticTerm c_f C_f ξ A - condExp (trainingSigma n) (dataLaw P n n) (fun ζ => quadraticTerm c_f C_f ζ A) ξ) + (cubicTerm c_f C_f ξ A - condExp (trainingSigma n) (dataLaw P n n) (fun ζ => cubicTerm c_f C_f ζ A) ξ)) ^ 2) ω ∂dataLaw P n n)
≤ 3 * (10 * (7 : ℝ) ^ 2 * (fourthDerivativeEnvelope c_f C_f) ^ 2 + 60 * quadVarianceConstant c_f C_f + 310 * cubicVarianceConstant c_f C_f) * (n : ℝ) ^ (-(2 / 3 : ℝ))
Proof (Lean source)
-- @node: centered_corrections_expected_conditional_second_moment_sample_rate lemma centered_corrections_expected_conditional_second_moment_sample_rate (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hn : threshold ≤ n) (hP : ModelClass c_f C_f L P n) (A : Bool) : (∫ ω, condExp (trainingSigma n) (dataLaw P n n) (fun ξ : TwoSample n n => ((linearTerm c_f C_f ξ A - condExp (trainingSigma n) (dataLaw P n n) (fun ζ => linearTerm c_f C_f ζ A) ξ) + (quadraticTerm c_f C_f ξ A - condExp (trainingSigma n) (dataLaw P n n) (fun ζ => quadraticTerm c_f C_f ζ A) ξ) + (cubicTerm c_f C_f ξ A - condExp (trainingSigma n) (dataLaw P n n) (fun ζ => cubicTerm c_f C_f ζ A) ξ)) ^ 2) ω ∂dataLaw P n n) ≤ 3 * (10 * (7 : ℝ) ^ 2 * (fourthDerivativeEnvelope c_f C_f) ^ 2 + 60 * quadVarianceConstant c_f C_f + 310 * cubicVarianceConstant c_f C_f) * (n : ℝ) ^ (-(2 / 3 : ℝ)) := by let := sourceObsLaw_isProbabilityMeasure c_f C_f L P n hP let := targetXLaw_isProbabilityMeasure c_f C_f L P n hP let : IsProbabilityMeasure (dataLaw P n n) := by rw [dataLaw_eq_source_target_pi c_f C_f L P n hP] infer_instance have hb := centered_corrections_conditional_second_moment_sample_rate c_f C_f L P n hn hP A have hi := integral_mono_ae integrable_condExp (integrable_const (3 * (10 * (7 : ℝ) ^ 2 * (fourthDerivativeEnvelope c_f C_f) ^ 2 + 60 * quadVarianceConstant c_f C_f + 310 * cubicVarianceConstant c_f C_f) * (n : ℝ) ^ (-(2 / 3 : ℝ)))) hb simpa using hi
CausalSmith.Stat.TransportCaceRoughnuisanceLength.centered_corrections_expected_conditional_second_moment_sample_rate · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/TotalVariance.lean:125
CausalSmith.Stat.STAT_TransportCaceRoughnuisanceLength_Research.Helpers.CubicMse.VarianceAggregation 2 declarations This module supplies the finite-family Cauchy--Schwarz step used to assemble the nonempty residual subsets in the quadratic and cubic statistics.

Finite conditional second-moment aggregation

This module supplies the finite-family Cauchy--Schwarz step used to assemble the nonempty residual subsets in the quadratic and cubic statistics.

theorem sub_condExp_add_stronglyMeasurable

Adding an integrable quantity measurable with respect to the conditioning sigma algebra does not change conditional centering. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
hm :
m ≤ mΩ
SigmaFinite (μ.trim hm)
f g :
Ω → ℝ
hf :
hg :
hgm :
(fun x => (f x + g x) - condExp m μ (f + g) x) =ᵐ[μ] (fun x => f x - condExp m μ f x)
Proof (Lean source)
lemma sub_condExp_add_stronglyMeasurable {Ω : Type*} [mΩ : MeasurableSpace Ω] {μ : Measure Ω} {m : MeasurableSpace Ω} (hm : m ≤ mΩ) [SigmaFinite (μ.trim hm)] (f g : Ω → ℝ) (hf : Integrable f μ) (hg : Integrable g μ) (hgm : StronglyMeasurable[m] g) : (fun x => (f x + g x) - condExp m μ (f + g) x) =ᵐ[μ] (fun x => f x - condExp m μ f x) := by have hadd := condExp_add hf hg m have hfix := condExp_of_stronglyMeasurable hm hgm hg rw [hfix] at hadd filter_upwards [hadd] with x hadd simp only [Pi.add_apply] at hadd rw [hadd] ring
CausalSmith.Stat.TransportCaceRoughnuisanceLength.sub_condExp_add_stronglyMeasurable · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/VarianceAggregation.lean:18
theorem condExp_sq_finsetSum_le

A uniform conditional second-moment bound for a finite family controls the conditional second moment of its sum with the square of the family size. No independence between different family members is required. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
s :
Y :
ι → Ω → ℝ
B :
ℝ
hY :
∀ i ∈ s, MemLp (Y i) 2 μ
hb :
∀ i ∈ s, ∀ᵐ x ∂μ, condExp m μ (fun y => (Y i y) ^ 2) x ≤ B
∀ᵐ x ∂μ, condExp m μ (fun y => (∑ i ∈ s, Y i y) ^ 2) x ≤ (s.card : ℝ) ^ 2 * B
Proof (Lean source)
lemma condExp_sq_finsetSum_le {Ω ι : Type*} [MeasurableSpace Ω] {μ : Measure Ω} {m : MeasurableSpace Ω} (s : Finset ι) (Y : ι → Ω → ℝ) (B : ℝ) (hY : ∀ i ∈ s, MemLp (Y i) 2 μ) (hb : ∀ i ∈ s, ∀ᵐ x ∂μ, condExp m μ (fun y => (Y i y) ^ 2) x ≤ B) : ∀ᵐ x ∂μ, condExp m μ (fun y => (∑ i ∈ s, Y i y) ^ 2) x ≤ (s.card : ℝ) ^ 2 * B := by have hYsq : ∀ i ∈ s, Integrable (fun x => (Y i x) ^ 2) μ := fun i hi => (hY i hi).integrable_sq let Q : Ω → ℝ := (s.card : ℝ) • (fun y => ∑ i ∈ s, (Y i y) ^ 2) have hsumSq : Integrable (fun y => ∑ i ∈ s, (Y i y) ^ 2) μ := integrable_finsetSum s hYsq have hQ : Integrable Q μ := hsumSq.const_mul _ have hsumLp : MemLp (fun y => ∑ i ∈ s, Y i y) 2 μ := memLp_finsetSum s hY have hleft : Integrable (fun y => (∑ i ∈ s, Y i y) ^ 2) μ := hsumLp.integrable_sq have hmono := condExp_mono hleft hQ (by filter_upwards [] with y exact sq_sum_le_card_mul_sum_sq (s := s) (f := fun i => Y i y)) (m := m) have hsum := condExp_finsetSum (μ := μ) (s := s) (f := fun i y => (Y i y) ^ 2) hYsq m have hscale := condExp_smul (μ := μ) (s.card : ℝ) (fun y => ∑ i ∈ s, (Y i y) ^ 2) m have hall : ∀ᵐ x ∂μ, ∀ i ∈ s, condExp m μ (fun y => (Y i y) ^ 2) x ≤ B := by exact (eventually_finset_ball).2 hb filter_upwards [hmono, hsum, hscale, hall] with x hmono hsum hscale hall change condExp m μ Q x = _ at hscale simp only [Pi.smul_apply, smul_eq_mul] at hscale have hsum' : condExp m μ (fun y => ∑ i ∈ s, (Y i y) ^ 2) x = ∑ i ∈ s, condExp m μ (fun y => (Y i y) ^ 2) x := by simpa only [Finset.sum_fn, Finset.sum_apply] using hsum rw [hscale, hsum'] at hmono have hsumle : (∑ i ∈ s, condExp m μ (fun y => (Y i y) ^ 2) x) ≤ ∑ _i ∈ s, B := Finset.sum_le_sum fun i hi => hall i hi calc condExp m μ (fun y => (∑ i ∈ s, Y i y) ^ 2) x ≤ (s.card : ℝ) * ∑ i ∈ s, condExp m μ (fun y => (Y i y) ^ 2) x := hmono _ ≤ (s.card : ℝ) * ∑ _i ∈ s, B := mul_le_mul_of_nonneg_left hsumle (Nat.cast_nonneg _) _ = (s.card : ℝ) ^ 2 * B := by simp [pow_two] ring
CausalSmith.Stat.TransportCaceRoughnuisanceLength.condExp_sq_finsetSum_le · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/VarianceAggregation.lean:35
CausalSmith.Stat.STAT_TransportCaceRoughnuisanceLength_Research.Helpers.CubicMse.VarianceRates 6 declarations The dyadic resolution bounds convert the conditional variance ladders to roadmap (17)--(19), with the paper's constants.

Sample-rate bounds for the exact correction variances

The dyadic resolution bounds convert the conditional variance ladders to roadmap (17)--(19), with the paper's constants. These estimates apply to the exact held-out sums and retain their conditional centering.

theorem inverse_sampleSize_le_mse_rate

The parametric variance rate is bounded by the target MSE rate. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
n :
ℕ
hn :
threshold ≤ n
(n : ℝ) ^ (-1 : ℝ) ≤ (n : ℝ) ^ (-(2 / 3 : ℝ))
Proof (Lean source)
-- @node: inverse_sampleSize_le_mse_rate lemma inverse_sampleSize_le_mse_rate (n : ℕ) (hn : threshold ≤ n) : (n : ℝ) ^ (-1 : ℝ) ≤ (n : ℝ) ^ (-(2 / 3 : ℝ)) := by apply Real.rpow_le_rpow_of_exponent_le · exact_mod_cast (show 1 ≤ n by norm_num [threshold] at hn; omega) · norm_num
CausalSmith.Stat.TransportCaceRoughnuisanceLength.inverse_sampleSize_le_mse_rate · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/VarianceRates.lean:19
theorem quadratic_variance_ladder_sample_rate

The quadratic ladder has rate n⁻²ᐟ³ for the actual dyadic resolution. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
n :
ℕ
hn :
threshold ≤ n
(n : ℝ) ^ (-1 : ℝ) + (quadraticResolution n : ℝ) * (n : ℝ) ^ (-2 : ℝ)
≤ 2 * (n : ℝ) ^ (-(2 / 3 : ℝ))
Proof (Lean source)
-- @node: quadratic_variance_ladder_sample_rate lemma quadratic_variance_ladder_sample_rate (n : ℕ) (hn : threshold ≤ n) : (n : ℝ) ^ (-1 : ℝ) + (quadraticResolution n : ℝ) * (n : ℝ) ^ (-2 : ℝ) ≤ 2 * (n : ℝ) ^ (-(2 / 3 : ℝ)) := by have hnpos : (0 : ℝ) < n := by exact_mod_cast (show 0 < n by norm_num [threshold] at hn; omega) have hK : (quadraticResolution n : ℝ) ≤ (n : ℝ) ^ (4 / 3 : ℝ) := (quadraticResolution_power_bounds n hn).2.trans (Real.rpow_le_rpow (Nat.cast_nonneg _) (by exact_mod_cast blockSize_le_sampleSize n 0) (by norm_num)) have hterm : (quadraticResolution n : ℝ) * (n : ℝ) ^ (-2 : ℝ) ≤ (n : ℝ) ^ (-(2 / 3 : ℝ)) := by calc _ ≤ (n : ℝ) ^ (4 / 3 : ℝ) * (n : ℝ) ^ (-2 : ℝ) := mul_le_mul_of_nonneg_right hK (Real.rpow_nonneg hnpos.le _) _ = _ := by rw [← Real.rpow_add hnpos]; norm_num linarith [inverse_sampleSize_le_mse_rate n hn]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.quadratic_variance_ladder_sample_rate · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/VarianceRates.lean:27
theorem cubic_variance_ladder_sample_rate

Both higher cubic ladder terms are at most the parametric rate. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
n :
ℕ
hn :
threshold ≤ n
(n : ℝ) ^ (-1 : ℝ)
+ (cubicResolution n : ℝ) * (n : ℝ) ^ (-2 : ℝ)
+ (cubicResolution n : ℝ) ^ 2 * (n : ℝ) ^ (-3 : ℝ)
≤ 3 * (n : ℝ) ^ (-(2 / 3 : ℝ))
Proof (Lean source)
-- @node: cubic_variance_ladder_sample_rate lemma cubic_variance_ladder_sample_rate (n : ℕ) (hn : threshold ≤ n) : (n : ℝ) ^ (-1 : ℝ) + (cubicResolution n : ℝ) * (n : ℝ) ^ (-2 : ℝ) + (cubicResolution n : ℝ) ^ 2 * (n : ℝ) ^ (-3 : ℝ) ≤ 3 * (n : ℝ) ^ (-(2 / 3 : ℝ)) := by have hnpos : (0 : ℝ) < n := by exact_mod_cast (show 0 < n by norm_num [threshold] at hn; omega) have hK : (cubicResolution n : ℝ) ≤ n := by exact_mod_cast cubicResolution_le_n n hn have hterm2 : (cubicResolution n : ℝ) * (n : ℝ) ^ (-2 : ℝ) ≤ (n : ℝ) ^ (-1 : ℝ) := by calc _ ≤ (n : ℝ) * (n : ℝ) ^ (-2 : ℝ) := mul_le_mul_of_nonneg_right hK (Real.rpow_nonneg hnpos.le _) _ = _ := by nth_rw 1 [← Real.rpow_one (n : ℝ)]; rw [← Real.rpow_add hnpos]; norm_num have hterm3 : (cubicResolution n : ℝ) ^ 2 * (n : ℝ) ^ (-3 : ℝ) ≤ (n : ℝ) ^ (-1 : ℝ) := by calc _ ≤ (n : ℝ) ^ (2 : ℕ) * (n : ℝ) ^ (-3 : ℝ) := mul_le_mul_of_nonneg_right (pow_le_pow_left₀ (Nat.cast_nonneg _) hK 2) (Real.rpow_nonneg hnpos.le _) _ = _ := by rw [← Real.rpow_natCast, ← Real.rpow_add hnpos]; norm_num linarith [inverse_sampleSize_le_mse_rate n hn]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.cubic_variance_ladder_sample_rate · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/VarianceRates.lean:46
theorem quadratic_conditional_variance_sample_rate

Roadmap (17), after converting the exact quadratic resolution to sample size. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hn :
threshold ≤ n
hP :
ModelClass c_f C_f L P n
A :
∀ᵐ ω ∂dataLaw P n n, condExp (trainingSigma n) (dataLaw P n n) (fun ξ : TwoSample n n => (quadraticTerm c_f C_f ξ A - condExp (trainingSigma n) (dataLaw P n n) (fun ζ : TwoSample n n => quadraticTerm c_f C_f ζ A) ξ) ^ 2) ω
≤ 60 * quadVarianceConstant c_f C_f * (n : ℝ) ^ (-(2 / 3 : ℝ))
Proof (Lean source)
-- @node: quadratic_conditional_variance_sample_rate lemma quadratic_conditional_variance_sample_rate (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hn : threshold ≤ n) (hP : ModelClass c_f C_f L P n) (A : Bool) : ∀ᵐ ω ∂dataLaw P n n, condExp (trainingSigma n) (dataLaw P n n) (fun ξ : TwoSample n n => (quadraticTerm c_f C_f ξ A - condExp (trainingSigma n) (dataLaw P n n) (fun ζ : TwoSample n n => quadraticTerm c_f C_f ζ A) ξ) ^ 2) ω ≤ 60 * quadVarianceConstant c_f C_f * (n : ℝ) ^ (-(2 / 3 : ℝ)) := by have hB : 0 ≤ quadVarianceConstant c_f C_f := by unfold quadVarianceConstant dsimp only positivity filter_upwards [quadratic_conditional_variance c_f C_f L P n hn hP A] with ω hω apply hω.trans have hb := mul_le_mul_of_nonneg_left (quadratic_variance_ladder_sample_rate n hn) hB have hr : 0 ≤ (n : ℝ) ^ (-(2 / 3 : ℝ)) := Real.rpow_nonneg (Nat.cast_nonneg _) _ nlinarith
CausalSmith.Stat.TransportCaceRoughnuisanceLength.quadratic_conditional_variance_sample_rate · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/VarianceRates.lean:71
theorem cubic_conditional_variance_sample_rate

Roadmap (18), after converting the exact cubic resolution to sample size. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hn :
threshold ≤ n
hP :
ModelClass c_f C_f L P n
A :
∀ᵐ ω ∂dataLaw P n n, condExp (trainingSigma n) (dataLaw P n n) (fun ξ : TwoSample n n => (cubicTerm c_f C_f ξ A - condExp (trainingSigma n) (dataLaw P n n) (fun ζ : TwoSample n n => cubicTerm c_f C_f ζ A) ξ) ^ 2) ω
≤ 310 * cubicVarianceConstant c_f C_f * (n : ℝ) ^ (-(2 / 3 : ℝ))
Proof (Lean source)
-- @node: cubic_conditional_variance_sample_rate lemma cubic_conditional_variance_sample_rate (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hn : threshold ≤ n) (hP : ModelClass c_f C_f L P n) (A : Bool) : ∀ᵐ ω ∂dataLaw P n n, condExp (trainingSigma n) (dataLaw P n n) (fun ξ : TwoSample n n => (cubicTerm c_f C_f ξ A - condExp (trainingSigma n) (dataLaw P n n) (fun ζ : TwoSample n n => cubicTerm c_f C_f ζ A) ξ) ^ 2) ω ≤ 310 * cubicVarianceConstant c_f C_f * (n : ℝ) ^ (-(2 / 3 : ℝ)) := by have hB : 0 ≤ cubicVarianceConstant c_f C_f := by unfold cubicVarianceConstant dsimp only have hC : 0 < C_f := lt_trans (by norm_num) hP.sourceBounds.2.1 positivity filter_upwards [cubic_conditional_variance c_f C_f L P n hn hP A] with ω hω apply hω.trans have hb := mul_le_mul_of_nonneg_left (cubic_variance_ladder_sample_rate n hn) hB have hr : 0 ≤ (n : ℝ) ^ (-(2 / 3 : ℝ)) := Real.rpow_nonneg (Nat.cast_nonneg _) _ nlinarith
CausalSmith.Stat.TransportCaceRoughnuisanceLength.cubic_conditional_variance_sample_rate · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/VarianceRates.lean:92
theorem linear_conditional_variance_sample_rate

Roadmap (19) expressed at the common target MSE rate. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hn :
threshold ≤ n
hP :
ModelClass c_f C_f L P n
A :
∀ᵐ ω ∂dataLaw P n n, condExp (trainingSigma n) (dataLaw P n n) (fun ξ : TwoSample n n => (linearTerm c_f C_f ξ A - condExp (trainingSigma n) (dataLaw P n n) (fun ζ : TwoSample n n => linearTerm c_f C_f ζ A) ξ) ^ 2) ω
≤ 10 * (7 : ℝ) ^ 2 * (fourthDerivativeEnvelope c_f C_f) ^ 2 * (n : ℝ) ^ (-(2 / 3 : ℝ))
Proof (Lean source)
-- @node: linear_conditional_variance_sample_rate lemma linear_conditional_variance_sample_rate (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hn : threshold ≤ n) (hP : ModelClass c_f C_f L P n) (A : Bool) : ∀ᵐ ω ∂dataLaw P n n, condExp (trainingSigma n) (dataLaw P n n) (fun ξ : TwoSample n n => (linearTerm c_f C_f ξ A - condExp (trainingSigma n) (dataLaw P n n) (fun ζ : TwoSample n n => linearTerm c_f C_f ζ A) ξ) ^ 2) ω ≤ 10 * (7 : ℝ) ^ 2 * (fourthDerivativeEnvelope c_f C_f) ^ 2 * (n : ℝ) ^ (-(2 / 3 : ℝ)) := by filter_upwards [linear_conditional_variance c_f C_f L P n hn hP A] with ω hω exact hω.trans (mul_le_mul_of_nonneg_left (inverse_sampleSize_le_mse_rate n hn) (by positivity))
CausalSmith.Stat.TransportCaceRoughnuisanceLength.linear_conditional_variance_sample_rate · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/VarianceRates.lean:114
CausalSmith.Stat.STAT_TransportCaceRoughnuisanceLength_Research.Helpers.CubicMse.WeightedCenteredCells 1 declarations The coefficient pull-out and integrability argument in roadmap (16), uniformly for every nonempty subset of evaluation blocks.

Bounded training coefficients in centered cell averages

The coefficient pull-out and integrability argument in roadmap (16), uniformly for every nonempty subset of evaluation blocks.

theorem conditional_variance_weighted_centered_cells Lemma conditional_variance_weighted_centered_cells in the paper ↗

Bounded training coefficients preserve the factored centered-cell variance estimate. The input cross moments are identities, rather than variance gates. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
Ω :
hm :
m ≤ mΩ
K q :
ℕ
hK :
0 < K
X :
Fin K → Ω → ℝ
c :
Fin K → Ω → ℝ
κ :
Fin (q + 1) → Fin K → Fin K → ℝ
C V B :
ℝ
hC :
0 ≤ C
hV :
0 ≤ V
hB :
0 < B
hcmeas :
∀ l, StronglyMeasurable[m] (c l)
hc :
∀ᵐ x ∂μ, ∀ l, |c l x| ≤ C
hlp :
∀ l, MemLp (X l) 2 μ
hzero :
∀ l, condExp m μ (X l) =ᵐ[μ] (0 : Ω → ℝ)
hfactor :
∀ l r, condExp m μ (fun x => X l x * X r x) =ᵐ[μ] (fun _ => ∏ t : Fin (q + 1), κ t l r)
hdiag :
∀ t l, |κ t l l| ≤ V * K / B
hoff :
∀ t l r
if
l ≠ r
then
|κ t l r| ≤ V / B
∀ᵐ x ∂μ, condExp m μ (fun y => ((K : ℝ)⁻¹ * ∑ l : Fin K, c l y * X l y - condExp m μ (fun z => (K : ℝ)⁻¹ * ∑ l : Fin K, c l z * X l z) y) ^ 2) x
≤ C ^ 2 * V ^ (q + 1) * ((K : ℝ) ^ q / B ^ (q + 1) + 1 / B ^ (q + 1))
Proof (Lean source)
-- @node: conditional_variance_weighted_centered_cells lemma conditional_variance_weighted_centered_cells {Ω : Type*} [mΩ : MeasurableSpace Ω] {μ : Measure Ω} [IsProbabilityMeasure μ] {m : MeasurableSpace Ω} (hm : m ≤ mΩ) {K q : ℕ} (hK : 0 < K) (X : Fin K → Ω → ℝ) (c : Fin K → Ω → ℝ) (κ : Fin (q + 1) → Fin K → Fin K → ℝ) (C V B : ℝ) (hC : 0 ≤ C) (hV : 0 ≤ V) (hB : 0 < B) (hcmeas : ∀ l, StronglyMeasurable[m] (c l)) (hc : ∀ᵐ x ∂μ, ∀ l, |c l x| ≤ C) (hlp : ∀ l, MemLp (X l) 2 μ) (hzero : ∀ l, condExp m μ (X l) =ᵐ[μ] (0 : Ω → ℝ)) (hfactor : ∀ l r, condExp m μ (fun x => X l x * X r x) =ᵐ[μ] (fun _ => ∏ t : Fin (q + 1), κ t l r)) (hdiag : ∀ t l, |κ t l l| ≤ V * K / B) (hoff : ∀ t l r, l ≠ r → |κ t l r| ≤ V / B) : ∀ᵐ x ∂μ, condExp m μ (fun y => ((K : ℝ)⁻¹ * ∑ l : Fin K, c l y * X l y - condExp m μ (fun z => (K : ℝ)⁻¹ * ∑ l : Fin K, c l z * X l z) y) ^ 2) x ≤ C ^ 2 * V ^ (q + 1) * ((K : ℝ) ^ q / B ^ (q + 1) + 1 / B ^ (q + 1)) := by let : MeasurableSpace Ω := mΩ let Y (l : Fin K) (x : Ω) := c l x * X l x have hca (l : Fin K) : AEStronglyMeasurable (c l) μ := ((hcmeas l).mono hm).aestronglyMeasurable have hcb (l : Fin K) : ∀ᵐ x ∂μ, ‖c l x‖ ≤ C := by filter_upwards [hc] with x hx simpa only [Real.norm_eq_abs] using hx l have hcab (l r : Fin K) : ∀ᵐ x ∂μ, ‖c l x * c r x‖ ≤ C ^ 2 := by filter_upwards [hc] with x hx simpa only [Real.norm_eq_abs, abs_mul, pow_two] using mul_le_mul (hx l) (hx r) (abs_nonneg _) hC have hxi (l : Fin K) : Integrable (X l) μ := (hlp l).integrable (by norm_num) have hyi (l : Fin K) : Integrable (Y l) μ := (hxi l).bdd_mul (hca l) (hcb l) have hxij (l r : Fin K) : Integrable (fun x => X l x * X r x) μ := (hlp l).integrable_mul (hlp r) have hyij (l r : Fin K) : Integrable (fun x => Y l x * Y r x) μ := by have h := (hxij l r).bdd_mul ((hca l).mul (hca r)) (hcab l r) convert h using 1 funext x dsimp [Y] ring have hy0 (l : Fin K) : condExp m μ (Y l) =ᵐ[μ] (0 : Ω → ℝ) := by have hp := condExp_mul_of_stronglyMeasurable_left (hcmeas l) (hyi l) (hxi l) have hz : condExp m μ (X l) =ᵐ[μ] (0 : Ω → ℝ) := hzero l filter_upwards [hp, hz] with x hp hz change condExp m μ (Y l) x = c l x * condExp m μ (X l) x at hp rw [hz] at hp simpa only [Pi.zero_apply, mul_zero] using hp have hyfactor (l r : Fin K) : condExp m μ (fun x => Y l x * Y r x) =ᵐ[μ] (fun x => c l x * c r x * ∏ t : Fin (q + 1), κ t l r) := by have hab : StronglyMeasurable[m] (fun x => c l x * c r x) := (hcmeas l).mul (hcmeas r) have habi := (hxij l r).bdd_mul ((hca l).mul (hca r)) (hcab l r) have hp := condExp_mul_of_stronglyMeasurable_left hab habi (hxij l r) have heq : (fun x => Y l x * Y r x) = (fun x => (c l x * c r x) * (X l x * X r x)) := by funext x dsimp [Y] ring rw [heq] have hx : condExp m μ (fun x => X l x * X r x) =ᵐ[μ] (fun _ => ∏ t : Fin (q + 1), κ t l r) := hfactor l r filter_upwards [hp, hx] with x hp hx change condExp m μ (fun x => (c l x * c r x) * (X l x * X r x)) x = c l x * c r x * condExp m μ (fun x => X l x * X r x) x at hp rw [hx] at hp exact hp exact conditional_variance_cellAverage_factored_le hK Y c κ C V B hC hV hB hyi hy0 hyij hyfactor hc hdiag hoff
CausalSmith.Stat.TransportCaceRoughnuisanceLength.conditional_variance_weighted_centered_cells · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/CubicMse/WeightedCenteredCells.lean:16
CausalSmith.Stat.STAT_TransportCaceRoughnuisanceLength_Research.Helpers.Estimator 29 declarations Four-block marked histogram score and affine inversion

Four-block marked histogram score and affine inversion

The block idx object is defined from the supplied inputs.

Definition (Lean source)
n :
ℕ
b :
Fin 4
blockIdx n b :
Finset.univ.filter (fun i => b.val * n / 4 ≤ i.val ∧ i.val < (b.val + 1) * n / 4)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.blockIdx · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Estimator.lean:17

The block size object is defined from the supplied inputs.

Definition (Lean source)
n :
ℕ
b :
Fin 4
blockSize n b :
ℕ
(b.val + 1) * n / 4 - b.val * n / 4
CausalSmith.Stat.TransportCaceRoughnuisanceLength.blockSize · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Estimator.lean:21
def dyadicResolution

The dyadic resolution object is defined from the supplied inputs.

Definition (Lean source)
n :
ℕ
power :
ℝ
dyadicResolution n power :
ℕ
if n < threshold then 1 else 2 ^ Nat.floor (power * (log (blockSize n 0 : ℝ) / log 2))
CausalSmith.Stat.TransportCaceRoughnuisanceLength.dyadicResolution · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Estimator.lean:24

The pilot resolution object is defined from the supplied inputs.

Definition (Lean source)
n :
ℕ
pilotResolution n :
ℕ
CausalSmith.Stat.TransportCaceRoughnuisanceLength.pilotResolution · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Estimator.lean:29
def quadraticResolution Definition 20 in the paper ↗

The quadratic resolution object is defined from the supplied inputs.

Definition (Lean source)
n :
ℕ
quadraticResolution n :
ℕ
CausalSmith.Stat.TransportCaceRoughnuisanceLength.quadraticResolution · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Estimator.lean:32

The cubic resolution object is defined from the supplied inputs.

Definition (Lean source)
n :
ℕ
cubicResolution n :
ℕ
CausalSmith.Stat.TransportCaceRoughnuisanceLength.cubicResolution · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Estimator.lean:35
def cell

The cell object is defined from the supplied inputs.

Definition (Lean source)
K :
ℕ
ℓ :
Fin K
cell K ℓ :
Set ℝ
if ℓ.val + 1
= K then Icc ((ℓ.val : ℝ) / K) 1 else Ico ((ℓ.val : ℝ) / K) (((ℓ.val : ℝ) + 1) / K)
def midpoint

The midpoint object is defined from the supplied inputs.

Definition (Lean source)
K :
ℕ
ℓ :
Fin K
midpoint K ℓ :
ℝ
((ℓ.val : ℝ) + 1 / 2) / K
CausalSmith.Stat.TransportCaceRoughnuisanceLength.midpoint · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Estimator.lean:44
def sourceChannel

The source channel object is defined from the supplied inputs.

Definition (Lean source)
i :
Fin 7
sourceChannel i :
i.val ≠ 0
CausalSmith.Stat.TransportCaceRoughnuisanceLength.sourceChannel · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Estimator.lean:47
def channelX

The channel x object is defined from the supplied inputs.

Definition (Lean source)
n :
ℕ
ω :
i :
Fin 7
r :
Fin n
channelX ω i r :
ℝ
if sourceChannel i then (ω.1 r).1 else ω.2 r
CausalSmith.Stat.TransportCaceRoughnuisanceLength.channelX · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Estimator.lean:51
def channelMark

The channel mark object is defined from the supplied inputs.

Definition (Lean source)
n :
ℕ
ω :
i :
Fin 7
r :
Fin n
channelMark ω i r :
ℝ
if i.val
= 0 then 1 else if i.val = 1 then boolReal (!(ω.1 r).2.1) else if i.val = 2 then boolReal (ω.1 r).2.1 else if i.val = 3 then boolReal (!(ω.1 r).2.1) * max 0 (min 1 (ω.1 r).2.2.2) else if i.val = 4 then boolReal (ω.1 r).2.1 * max 0 (min 1 (ω.1 r).2.2.2) else if i.val = 5 then boolReal (!(ω.1 r).2.1) * boolReal (ω.1 r).2.2.1 else boolReal (ω.1 r).2.1 * boolReal (ω.1 r).2.2.1
CausalSmith.Stat.TransportCaceRoughnuisanceLength.channelMark · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Estimator.lean:54

The marked histogram object is defined from the supplied inputs.

Definition (Lean source)
n :
ℕ
ω :
i :
Fin 7
K :
ℕ
b :
Fin 4
x :
ℝ
markedHistogram ω i K b x :
ℝ
by classical exact if n < threshold then 0 else ∑ ℓ : Fin K, if x ∈ cell K ℓ then (K : ℝ) / blockSize n b * ∑ r ∈ blockIdx n b, channelMark ω i r * if channelX ω i r ∈ cell K ℓ then 1 else 0 else 0
CausalSmith.Stat.TransportCaceRoughnuisanceLength.markedHistogram · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Estimator.lean:66
def clip

The clip object is defined from the supplied inputs.

Definition (Lean source)
lo hi x :
ℝ
clip lo hi x :
ℝ
max lo (min hi x)
def clipChannel

The clip channel object is defined from the supplied inputs.

Definition (Lean source)
c_f C_f :
ℝ
i :
Fin 7
x :
ℝ
clipChannel c_f C_f i x :
ℝ
if i.val
= 0 then clip c_f C_f x else if i.val = 1 || i.val = 2 then clip (c_f / 4) (3 * C_f / 4) x else clip 0 (3 * C_f / 4) x
CausalSmith.Stat.TransportCaceRoughnuisanceLength.clipChannel · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Estimator.lean:81

The pilot object is defined from the supplied inputs.

Definition (Lean source)
c_f C_f :
ℝ
n :
ℕ
ω :
x :
ℝ
pilot c_f C_f ω x :
Fin 7 → ℝ
if n < threshold then ![1, 1 / 2, 1 / 2, 0, 0, 0, 0] else fun i
=> clipChannel c_f C_f i (markedHistogram ω i (pilotResolution n) 0 x)

The residual object is defined from the supplied inputs.

Definition (Lean source)
c_f C_f :
ℝ
n :
ℕ
ω :
i :
Fin 7
K :
ℕ
b :
Fin 4
x :
ℝ
residual c_f C_f ω i K b x :
ℝ
markedHistogram ω i K b x - pilot c_f C_f ω x i
CausalSmith.Stat.TransportCaceRoughnuisanceLength.residual · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Estimator.lean:94
def basis

The basis object is defined from the supplied inputs.

Definition (Lean source)
i :
Fin 7
basis i :
Fin 7 → ℝ
fun j => if j = i then 1 else 0
def dPhi1

The d phi1 object is defined from the supplied inputs.

Definition (Lean source)
A :
v :
Fin 7 → ℝ
i :
Fin 7
dPhi1 A v i :
ℝ
fderiv ℝ (Phi A) v (basis i)
def dPhi2

The d phi2 object is defined from the supplied inputs.

Definition (Lean source)
A :
v :
Fin 7 → ℝ
i j :
Fin 7
dPhi2 A v i j :
ℝ
iteratedFDeriv ℝ 2 (Phi A) v ![basis i, basis j]
def dPhi3

The d phi3 object is defined from the supplied inputs.

Definition (Lean source)
A :
v :
Fin 7 → ℝ
i j k :
Fin 7
dPhi3 A v i j k :
ℝ
iteratedFDeriv ℝ 3 (Phi A) v ![basis i, basis j, basis k]
def pilotIntegral

The pilot integral object is defined from the supplied inputs.

Definition (Lean source)
c_f C_f :
ℝ
n :
ℕ
ω :
A :
pilotIntegral c_f C_f ω A :
ℝ
∫ x in (0 : ℝ)..1, Phi A (pilot c_f C_f ω x)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.pilotIntegral · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Estimator.lean:114
def linearTerm

The linear term object is defined from the supplied inputs.

Definition (Lean source)
c_f C_f :
ℝ
n :
ℕ
ω :
A :
linearTerm c_f C_f ω A :
ℝ
∑ i : Fin 7, ( ((1 / (blockSize n 1 : ℝ)) * ∑ r ∈ blockIdx n 1, channelMark ω i r * dPhi1 A (pilot c_f C_f ω (channelX ω i r)) i) - (∫ x in (0 : ℝ)..1, dPhi1 A (pilot c_f C_f ω x) i * pilot c_f C_f ω x i))
CausalSmith.Stat.TransportCaceRoughnuisanceLength.linearTerm · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Estimator.lean:119
def quadraticTerm

The quadratic term object is defined from the supplied inputs.

Definition (Lean source)
c_f C_f :
ℝ
n :
ℕ
ω :
A :
quadraticTerm c_f C_f ω A :
ℝ
(1 / (2 * (K : ℝ))) * ∑ i : Fin 7, ∑ j : Fin 7, ∑ ℓ : Fin K, dPhi2 A (pilot c_f C_f ω (midpoint K ℓ)) i j * residual c_f C_f ω i K 1 (midpoint K ℓ) * residual c_f C_f ω j K 2 (midpoint K ℓ)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.quadraticTerm · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Estimator.lean:130
def cubicTerm

The cubic term object is defined from the supplied inputs.

Definition (Lean source)
c_f C_f :
ℝ
n :
ℕ
ω :
A :
cubicTerm c_f C_f ω A :
ℝ
(1 / (6 * (K : ℝ))) * ∑ i : Fin 7, ∑ j : Fin 7, ∑ k : Fin 7, ∑ ℓ : Fin K, dPhi3 A (pilot c_f C_f ω (midpoint K ℓ)) i j k * residual c_f C_f ω i K 1 (midpoint K ℓ) * residual c_f C_f ω j K 2 (midpoint K ℓ) * residual c_f C_f ω k K 3 (midpoint K ℓ)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.cubicTerm · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Estimator.lean:140
def cubicEstimator

The cubic estimator object is defined from the supplied inputs.

Definition (Lean source)
c_f C_f :
ℝ
n :
ℕ
ω :
A :
cubicEstimator c_f C_f ω A :
ℝ
if n < threshold then 0 else pilotIntegral c_f C_f ω A
+ linearTerm c_f C_f ω A
+ quadraticTerm c_f C_f ω A
+ cubicTerm c_f C_f ω A
CausalSmith.Stat.TransportCaceRoughnuisanceLength.cubicEstimator · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Estimator.lean:153
def mseEnvelope

The mse envelope object is defined from the supplied inputs.

Definition (Lean source)
c_f C_f L :
ℝ
mseEnvelope c_f C_f L :
ℝ
d :
7 (: ℝ)
U :
2 * (1 + C_f)
H :
3 * (1 + C_f) * L
V :
1 + C_f + C_f ^ 2
M :
48 * (1 + C_f) ^ 2 * (4 / c_f) ^ 5
A2 :
2 * V * 5 ^ ((1 : ℝ) / 5) + 2 ^ ((5 : ℝ) / 4) * H ^ 2 * 5 ^ ((1 : ℝ) / 5)
A8 :
2 ^ (7 : ℕ) * (factorial 8 : ℝ) * (V ^ 4 * 5 ^ ((4 : ℝ) / 5) + V * 5 ^ ((7 : ℝ) / 5))
+ 2 ^ (8 : ℕ) * H ^ 8 * 5 ^ ((4 : ℝ) / 5)
BR :
(M / 24) ^ 2 * d ^ 8 * A8
BQ :
d ^ 4 * M ^ 2 * H ^ 4 * 2 ^ ((1 : ℝ) / 2) * 5 ^ ((2 : ℝ) / 3)
C1 :
(M / 2) * d ^ 2 * H ^ 2
C2 :
(M / 6) * d ^ 3 * H ^ 3
BC :
2 * (C1 ^ 2 * d ^ 2 * A2 * 2 ^ ((1 : ℝ) / 2) * 5 ^ ((1 : ℝ) / 2) + C2 ^ 2 * 2 ^ ((3 : ℝ) / 4) * 5 ^ ((3 : ℝ) / 4))
B2 :
d ^ 4 * (2 ^ (2 : ℕ) - 1) ^ 2 * M ^ 2 * (1 + U) ^ 4 * (1 + V) ^ 2
B3 :
d ^ 6 * (2 ^ (3 : ℕ) - 1) ^ 2 * M ^ 2 * (1 + U) ^ 6 * (1 + V) ^ 3
3 * (BR + BQ + BC) + 3 * (10 * d ^ 2 * M ^ 2 + 60 * B2 + 310 * B3)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.mseEnvelope · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Estimator.lean:160
def scoreRadius

The score radius object is defined from the supplied inputs.

Definition (Lean source)
α c_f C_f L :
ℝ
n :
ℕ
scoreRadius α c_f C_f L n :
ℝ
sqrt (2 * mseEnvelope c_f C_f L / α) * (n : ℝ) ^ (-(1 / 3 : ℝ))
CausalSmith.Stat.TransportCaceRoughnuisanceLength.scoreRadius · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Estimator.lean:187

The score inversion object is defined from the supplied inputs.

Definition (Lean source)
α c_f C_f L :
ℝ
n :
ℕ
ω :
scoreInversion α c_f C_f L ω :
Set ℝ
CausalSmith.Stat.TransportCaceRoughnuisanceLength.scoreInversion · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Estimator.lean:193
def scoreInterval

The score interval object is defined from the supplied inputs.

Definition (Lean source)
α c_f C_f L :
ℝ
n :
ℕ
ω :
scoreInterval α c_f C_f L ω :
Set ℝ
by classical exact if n < threshold then parameterSpace else if (scoreInversion α c_f C_f L ω).Nonempty then scoreInversion α c_f C_f L ω else {0}
CausalSmith.Stat.TransportCaceRoughnuisanceLength.scoreInterval · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Estimator.lean:203
CausalSmith.Stat.STAT_TransportCaceRoughnuisanceLength_Research.Helpers.Identification_Part1 19 declarations Conditional IV identities and transported CACE

Conditional IV identities and transported CACE

theorem potentialOutcome_difference Lemma potentialOutcome_difference in the paper ↗

Given the supplied inputs, the stated result about potential outcome difference holds.

Formal statement
o :
= (outcome1 o - outcome0 o) * (boolReal (receipt1 o) - boolReal (receipt0 o))
Proof (Lean source)
lemma potentialOutcome_difference (o : FullData) : potentialOutcome o (receipt1 o) - potentialOutcome o (receipt0 o) = (outcome1 o - outcome0 o) * (boolReal (receipt1 o) - boolReal (receipt0 o)) := by cases receipt0 o <;> cases receipt1 o <;> simp [potentialOutcome, boolReal]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.potentialOutcome_difference · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Identification_Part1.lean:12
theorem monotone_receipt_difference_eq_complier

Given the supplied inputs, the stated result about monotone receipt difference eq complier holds.

Formal statement
hmono :
∀ᵐ o ∂P.fullLaw, boolReal (receipt1 o) - boolReal (receipt0 o) = complier o
Proof (Lean source)
lemma monotone_receipt_difference_eq_complier (P : TransportLaw) (hmono : Monotonicity P) : ∀ᵐ o ∂P.fullLaw, boolReal (receipt1 o) - boolReal (receipt0 o) = complier o := by filter_upwards [hmono] with o ho cases h0 : receipt0 o <;> cases h1 : receipt1 o <;> simp [boolReal, complier, h0, h1] at ho ⊢; norm_num at ho
CausalSmith.Stat.TransportCaceRoughnuisanceLength.monotone_receipt_difference_eq_complier · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Identification_Part1.lean:21
theorem potentialOutcome_difference_eq_complier

Given the supplied inputs, the stated result about potential outcome difference eq complier holds.

Formal statement
hmono :
∀ᵐ o ∂P.fullLaw, potentialOutcome o (receipt1 o) - potentialOutcome o (receipt0 o)
= (outcome1 o - outcome0 o) * complier o
Proof (Lean source)
lemma potentialOutcome_difference_eq_complier (P : TransportLaw) (hmono : Monotonicity P) : ∀ᵐ o ∂P.fullLaw, potentialOutcome o (receipt1 o) - potentialOutcome o (receipt0 o) = (outcome1 o - outcome0 o) * complier o := by filter_upwards [monotone_receipt_difference_eq_complier P hmono] with o ho rw [potentialOutcome_difference, ho]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.potentialOutcome_difference_eq_complier · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Identification_Part1.lean:31
theorem conditionalMean_congr_full_ae

Given the supplied inputs, the stated result about conditional mean congr full ae holds.

Formal statement
s :
f g :
FullData → ℝ
q :
ℝ → ℝ
hfg :
f =ᵐ[P.fullLaw] g
hg :
ConditionalMean P s g q
ConditionalMean P s f q
Proof (Lean source)
lemma conditionalMean_congr_full_ae (P : TransportLaw) (s : Bool) (f g : FullData → ℝ) (q : ℝ → ℝ) (hfg : f =ᵐ[P.fullLaw] g) (hg : ConditionalMean P s g q) : ConditionalMean P s f q := by refine ⟨hg.1, ?_⟩ intro B hB have hcov : Measurable (covariate : FullData → ℝ) := by unfold covariate fun_prop have hset : MeasurableSet {o : FullData | covariate o ∈ B} := hB.preimage hcov have hcond : f =ᵐ[populationLaw P s] g := (ProbabilityTheory.cond_absolutelyContinuous : (populationLaw P s).AbsolutelyContinuous P.fullLaw).ae_le hfg calc (∫ o in {o | covariate o ∈ B}, f o ∂populationLaw P s) = ∫ o in {o | covariate o ∈ B}, g o ∂populationLaw P s := setIntegral_congr_ae₀ hset.nullMeasurableSet (hcond.mono fun _ ho _ => ho) _ = ∫ x in B, q x ∂(populationLaw P s).map covariate := hg.2 B hB
CausalSmith.Stat.TransportCaceRoughnuisanceLength.conditionalMean_congr_full_ae · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Identification_Part1.lean:41
theorem integral_complier_eq_targetComplierShare

Given the supplied inputs, the stated result about integral complier eq target complier share holds.

Formal statement
(∫ o, complier o ∂populationLaw P false) = targetComplierShare P
Proof (Lean source)
lemma integral_complier_eq_targetComplierShare (P : TransportLaw) : (∫ o, complier o ∂populationLaw P false) = targetComplierShare P := by let s : Set FullData := {o | complier o = 1} have hs : MeasurableSet s := by have hm0 : Measurable (receipt0 : FullData → Bool) := by unfold receipt0 fun_prop have hm1 : Measurable (receipt1 : FullData → Bool) := by unfold receipt1 fun_prop dsimp [s, complier] measurability have hpoint : (fun o : FullData => complier o) = s.indicator (1 : FullData → ℝ) := by funext o simp only [s, indicator, Set.mem_ofPred_eq, Pi.one_apply] split_ifs <;> simp_all [complier] rw [hpoint, integral_indicator_one hs] rfl
CausalSmith.Stat.TransportCaceRoughnuisanceLength.integral_complier_eq_targetComplierShare · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Identification_Part1.lean:63

the stated result about measurable complier holds.

Formal statement
Measurable (complier : FullData → ℝ)
Proof (Lean source)
lemma measurable_complier : Measurable (complier : FullData → ℝ) := by have hm0 : Measurable (receipt0 : FullData → Bool) := by unfold receipt0; fun_prop have hm1 : Measurable (receipt1 : FullData → Bool) := by unfold receipt1; fun_prop have hs : MeasurableSet {o : FullData | receipt1 o = true ∧ receipt0 o = false} := (hm1 (measurableSet_singleton true)).inter (hm0 (measurableSet_singleton false)) have hite : Measurable (fun o : FullData => if o ∈ {o : FullData | receipt1 o = true ∧ receipt0 o = false} then (1 : ℝ) else 0) := measurable_const.ite hs measurable_const convert hite using 1 funext o simp [complier]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.measurable_complier · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Identification_Part1.lean:84
theorem targetCACE_mem_parameterSpace

Given the supplied inputs, the stated result about target cace mem parameter space holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hP :
ModelClass c_f C_f L P n
Proof (Lean source)
lemma targetCACE_mem_parameterSpace (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hP : ModelClass c_f C_f L P n) (hfirst : firstStage P = targetComplierShare P) : targetCACE P ∈ parameterSpace := by let μ := populationLaw P false haveI : IsProbabilityMeasure P.fullLaw := hP.sourceBounds.2.2.1 haveI : IsFiniteMeasure μ := by dsimp [μ, populationLaw] infer_instance have hsupport : ∀ᵐ o ∂μ, outcome0 o ∈ Icc (0 : ℝ) 1 ∧ outcome1 o ∈ Icc (0 : ℝ) 1 := by apply (ProbabilityTheory.cond_absolutelyContinuous : μ.AbsolutelyContinuous P.fullLaw).ae_le filter_upwards [hP.sourceBounds.2.2.2.1] with o ho exact ⟨ho.2.1, ho.2.2⟩ have hcomp : Integrable complier μ := by apply Integrable.of_bound measurable_complier.aestronglyMeasurable 1 filter_upwards [] with o simp only [complier] split_ifs <;> norm_num have hnum : Integrable (fun o => (outcome1 o - outcome0 o) * complier o) μ := by have hm : Measurable (fun o : FullData => (outcome1 o - outcome0 o) * complier o) := by have hm0 : Measurable (outcome0 : FullData → ℝ) := by unfold outcome0; fun_prop have hm1 : Measurable (outcome1 : FullData → ℝ) := by unfold outcome1; fun_prop exact (hm1.sub hm0).mul measurable_complier apply Integrable.of_bound hm.aestronglyMeasurable 1 filter_upwards [hsupport] with o ho rcases ho with ⟨h0, h1⟩ simp only [complier] split_ifs · simpa using abs_le.mpr (show -(1 : ℝ) ≤ outcome1 o - outcome0 o ∧ outcome1 o - outcome0 o ≤ 1 by constructor <;> linarith [h0.1, h0.2, h1.1, h1.2]) · norm_num have hbound : (∀ᵐ o ∂μ, -complier o ≤ (outcome1 o - outcome0 o) * complier o) ∧ (∀ᵐ o ∂μ, (outcome1 o - outcome0 o) * complier o ≤ complier o) := by have hb : ∀ᵐ o ∂μ, -complier o ≤ (outcome1 o - outcome0 o) * complier o ∧ (outcome1 o - outcome0 o) * complier o ≤ complier o := by filter_upwards [hsupport] with o ho rcases ho with ⟨h0, h1⟩ simp only [complier] split_ifs <;> simp_all <;> constructor <;> nlinarith [h0.1, h0.2, h1.1, h1.2] exact ⟨hb.mono (fun _ h => h.1), hb.mono (fun _ h => h.2)⟩ have hlo := integral_mono_ae hcomp.neg hnum hbound.1 have hhi := integral_mono_ae hnum hcomp hbound.2 have hpos : 0 < targetComplierShare P := by rw [← hfirst] exact hP.strength rw [parameterSpace, Set.mem_Icc, targetCACE] rw [← integral_complier_eq_targetComplierShare P] at hpos ⊢ constructor · apply (le_div_iff₀ hpos).2 change (∫ x, -complier x ∂μ) ≤ _ at hlo rw [integral_neg] at hlo simpa using hlo · apply (div_le_iff₀ hpos).2 simpa using hhi
CausalSmith.Stat.TransportCaceRoughnuisanceLength.targetCACE_mem_parameterSpace · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Identification_Part1.lean:98
theorem target_integral_eq_density_integral

Given the supplied inputs, the stated result about target integral eq density integral holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hP :
ModelClass c_f C_f L P n
f :
ℝ → ℝ
(∫ x, f x ∂targetXLaw P) = ∫ x in covariateSpace, P.fT x * f x
Proof (Lean source)
lemma target_integral_eq_density_integral (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hP : ModelClass c_f C_f L P n) (f : ℝ → ℝ) : (∫ x, f x ∂targetXLaw P) = ∫ x in covariateSpace, P.fT x * f x := by have hcont : ContinuousOn P.fT covariateSpace := by have hcd := hP.targetHolder.2.1.continuousOn have hmap : ContinuousOn (fun x : ℝ => ![x]) covariateSpace := by fun_prop have hmaps : MapsTo (fun x : ℝ => ![x]) covariateSpace {v : Fin 1 → ℝ | v 0 ∈ covariateSpace} := by intro x hx simpa using hx simpa [Function.comp_def, Matrix.cons_val_zero] using hcd.comp hmap hmaps have hae : AEMeasurable (fun x : ℝ => ofReal (P.fT x)) (volume.restrict covariateSpace) := (hcont.aemeasurable measurableSet_Icc).ennreal_ofReal have hfinite : ∀ᵐ x ∂volume.restrict covariateSpace, ofReal (P.fT x) < ⊤ := by filter_upwards [] with x; simp have hden := integral_withDensity_eq_integral_toReal_smul₀ (f := fun x : ℝ => ofReal (P.fT x)) hae hfinite f rw [hP.targetBounds.1] rw [hden] apply setIntegral_congr_fun measurableSet_Icc intro x hx simp [ENNReal.toReal_ofReal (le_trans hP.sourceBounds.1.1.le (hP.targetBounds.2.1 x hx).1)]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.target_integral_eq_density_integral · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Identification_Part1.lean:157
theorem source_setIntegral_eq_density_integral

Given the supplied inputs, the stated result about source set integral eq density integral holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hP :
ModelClass c_f C_f L P n
B :
Set ℝ
hB :
hsub :
f :
ℝ → ℝ
(∫ x in B, f x ∂sourceXLaw P) = ∫ x in B, P.fS x * f x
Proof (Lean source)
lemma source_setIntegral_eq_density_integral (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hP : ModelClass c_f C_f L P n) (B : Set ℝ) (hB : MeasurableSet B) (hsub : B ⊆ covariateSpace) (f : ℝ → ℝ) : (∫ x in B, f x ∂sourceXLaw P) = ∫ x in B, P.fS x * f x := by have hcont : ContinuousOn P.fS covariateSpace := by have hcd := hP.sourceHolder.2.1.continuousOn have hmap : ContinuousOn (fun x : ℝ => ![x]) covariateSpace := by fun_prop have hmaps : MapsTo (fun x : ℝ => ![x]) covariateSpace {v : Fin 1 → ℝ | v 0 ∈ covariateSpace} := by intro x hx simpa using hx simpa [Function.comp_def, Matrix.cons_val_zero] using hcd.comp hmap hmaps have hae : AEMeasurable (fun x : ℝ => ofReal (P.fS x)) ((volume.restrict covariateSpace).restrict B) := (hcont.aemeasurable measurableSet_Icc).ennreal_ofReal.restrict have hfinite : ∀ᵐ x ∂(volume.restrict covariateSpace).restrict B, ofReal (P.fS x) < ⊤ := by filter_upwards [] with x; simp have hden := setIntegral_withDensity_eq_setIntegral_toReal_smul₀ (f := fun x : ℝ => ofReal (P.fS x)) (s := B) hae hfinite f hB rw [hP.sourceBounds.2.2.2.2.1] calc _ = ∫ x in B, (ofReal (P.fS x)).toReal • f x ∂volume := by simpa only [Measure.restrict_restrict_of_subset hsub] using hden _ = _ := by apply setIntegral_congr_fun hB intro x hx simp [ENNReal.toReal_ofReal (le_trans hP.sourceBounds.1.1.le (hP.sourceBounds.2.2.2.2.2 x (hsub hx)).1)]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.source_setIntegral_eq_density_integral · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Identification_Part1.lean:186
theorem assignment_slice_eq_withDensity

Given the supplied inputs, the stated result about assignment slice eq with density holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hP :
ModelClass c_f C_f L P n
z :
(P.assignedLaw.restrict {o : Assigned | o.2.1 = z}).map fst
= (populationLaw P true).withDensity (fun o => ofReal (assignmentMass P z (covariate o)))
Proof (Lean source)
lemma assignment_slice_eq_withDensity (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hP : ModelClass c_f C_f L P n) (z : Bool) : (P.assignedLaw.restrict {o : Assigned | o.2.1 = z}).map Prod.fst = (populationLaw P true).withDensity (fun o => ofReal (assignmentMass P z (covariate o))) := by haveI : IsProbabilityMeasure P.assignedLaw := hP.randomized.1 haveI : IsProbabilityMeasure P.fullLaw := hP.sourceBounds.2.2.1 haveI : IsFiniteMeasure (populationLaw P true) := by refine ⟨?_⟩ by_cases hp : P.fullLaw {o | population o = true} = 0 · simp [populationLaw, cond, hp] · simp only [populationLaw, cond, Measure.coe_smul, Pi.smul_apply, MeasurableSet.univ, Measure.restrict_apply, Set.univ_inter, smul_eq_mul] rw [ENNReal.inv_mul_cancel hp (measure_ne_top P.fullLaw _)] exact ENNReal.one_lt_top have hfst : Measurable (Prod.fst : Assigned → FullData) := by fun_prop have hZ : MeasurableSet {o : Assigned | o.2.1 = z} := by measurability have hsupport : ∀ᵐ o ∂populationLaw P true, covariate o ∈ covariateSpace := by apply (ProbabilityTheory.cond_absolutelyContinuous : (populationLaw P true).AbsolutelyContinuous P.fullLaw).ae_le exact hP.sourceBounds.2.2.2.1.mono fun _ ho => ho.1 have hmass : AEMeasurable (fun o : FullData => assignmentMass P z (covariate o)) (populationLaw P true) := by have hcov : Measurable (covariate : FullData → ℝ) := by unfold covariate; fun_prop have hsupported : Measurable (fun o : FullData => covariateSpace.indicator (assignmentMass P z) (covariate o)) := (measurable_assignmentMassOnCovariate P z hP.randomized.2.1).comp hcov refine hsupported.aemeasurable.congr ?_ filter_upwards [hsupport] with o ho simp [ho] have hmass_nonneg : ∀ᵐ o ∂populationLaw P true, 0 ≤ assignmentMass P z (covariate o) := by filter_upwards [hsupport] with o ho rcases hP.overlap (covariate o) ho with ⟨he0, he1⟩ cases z <;> simp [assignmentMass] <;> linarith have hmass_le_one : ∀ᵐ o ∂populationLaw P true, ofReal (assignmentMass P z (covariate o)) ≤ 1 := by filter_upwards [hsupport] with o ho rcases hP.overlap (covariate o) ho with ⟨he0, he1⟩ cases z <;> simp [assignmentMass, ENNReal.ofReal_le_one] <;> linarith ext B hB have hrhs_ne : ((populationLaw P true).withDensity (fun o => ofReal (assignmentMass P z (covariate o))) B) ≠ ⊤ := by rw [withDensity_apply _ hB] exact ne_of_lt (lt_of_le_of_lt (setLIntegral_le_lintegral _ _) (lt_of_le_of_lt (lintegral_mono_ae hmass_le_one) (by simp))) apply (ENNReal.toReal_eq_toReal_iff' (measure_ne_top _ _) hrhs_ne).mp rw [Measure.map_apply hfst hB, Measure.restrict_apply (hB.preimage hfst)] have hden := setIntegral_withDensity_eq_setIntegral_toReal_smul₀ (μ := populationLaw P true) (f := fun o : FullData => ofReal (assignmentMass P z (covariate o))) (s := B) hmass.ennreal_ofReal.restrict (by simp) (fun _ => (1 : ℝ)) hB calc (P.assignedLaw (Prod.fst ⁻¹' B ∩ {o : Assigned | o.2.1 = z})).toReal = ∫ o in B, assignmentMass P z (covariate o) ∂populationLaw P true := by have hevent : Prod.fst ⁻¹' B ∩ {o : Assigned | o.2.1 = z} = {o : Assigned | o.1 ∈ B ∧ o.2.1 = z} := by ext o simp rw [hevent] exact hP.randomized.2.2.2 B hB z _ = ∫ o in B, (ofReal (assignmentMass P z (covariate o))).toReal • (1 : ℝ) ∂populationLaw P true := by refine setIntegral_congr_ae hB ?_ filter_upwards [hmass_nonneg] with o ho simp [ENNReal.toReal_ofReal ho] _ = ∫ o in B, (1 : ℝ) ∂ (populationLaw P true).withDensity (fun o => ofReal (assignmentMass P z (covariate o))) := hden.symm _ = (((populationLaw P true).withDensity (fun o => ofReal (assignmentMass P z (covariate o)))) B).toReal := by simp [Measure.real]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.assignment_slice_eq_withDensity · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Identification_Part1.lean:221
theorem assignment_slice_integral_eq

Given the supplied inputs, the stated result about assignment slice integral eq holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hP :
ModelClass c_f C_f L P n
z :
f :
FullData → ℝ
(∫ a, f a.1 ∂P.assignedLaw.restrict {a : Assigned | a.2.1 = z})
= ∫ o, assignmentMass P z (covariate o) * f o ∂populationLaw P true
Proof (Lean source)
lemma assignment_slice_integral_eq (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hP : ModelClass c_f C_f L P n) (z : Bool) (f : FullData → ℝ) (hf : AEStronglyMeasurable f (populationLaw P true)) : (∫ a, f a.1 ∂P.assignedLaw.restrict {a : Assigned | a.2.1 = z}) = ∫ o, assignmentMass P z (covariate o) * f o ∂populationLaw P true := by have hfst : Measurable (Prod.fst : Assigned → FullData) := by fun_prop have hsupport : ∀ᵐ o ∂populationLaw P true, covariate o ∈ covariateSpace := by apply (ProbabilityTheory.cond_absolutelyContinuous : (populationLaw P true).AbsolutelyContinuous P.fullLaw).ae_le exact hP.sourceBounds.2.2.2.1.mono fun _ ho => ho.1 have hmass : AEMeasurable (fun o : FullData => assignmentMass P z (covariate o)) (populationLaw P true) := by have hcov : Measurable (covariate : FullData → ℝ) := by unfold covariate; fun_prop have hsupported : Measurable (fun o : FullData => covariateSpace.indicator (assignmentMass P z) (covariate o)) := (measurable_assignmentMassOnCovariate P z hP.randomized.2.1).comp hcov refine hsupported.aemeasurable.congr ?_ filter_upwards [hsupport] with o ho simp [ho] have hmass_nonneg : ∀ᵐ o ∂populationLaw P true, 0 ≤ assignmentMass P z (covariate o) := by filter_upwards [hsupport] with o ho rcases hP.overlap (covariate o) ho with ⟨he0, he1⟩ cases z <;> simp [assignmentMass] <;> linarith have hden := integral_withDensity_eq_integral_toReal_smul₀ (μ := populationLaw P true) (f := fun o : FullData => ofReal (assignmentMass P z (covariate o))) hmass.ennreal_ofReal (by simp) f have hfmap : AEStronglyMeasurable f ((P.assignedLaw.restrict {a : Assigned | a.2.1 = z}).map Prod.fst) := by rw [assignment_slice_eq_withDensity c_f C_f L P n hP z] exact AEStronglyMeasurable.mono_ac (withDensity_absolutelyContinuous _ _) hf calc (∫ a, f a.1 ∂P.assignedLaw.restrict {a : Assigned | a.2.1 = z}) = ∫ o, f o ∂(P.assignedLaw.restrict {a : Assigned | a.2.1 = z}).map Prod.fst := (integral_map hfst.aemeasurable hfmap).symm _ = ∫ o, f o ∂(populationLaw P true).withDensity (fun o => ofReal (assignmentMass P z (covariate o))) := by rw [assignment_slice_eq_withDensity c_f C_f L P n hP z] _ = ∫ o, (ofReal (assignmentMass P z (covariate o))).toReal • f o ∂populationLaw P true := hden _ = _ := by apply integral_congr_ae filter_upwards [hmass_nonneg] with o ho simp [ENNReal.toReal_ofReal ho]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.assignment_slice_integral_eq · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Identification_Part1.lean:298
def potentialArmValue

The potential arm value object is defined from the supplied inputs.

Definition (Lean source)
A z :
o :
potentialArmValue A z o :
ℝ
if A then potentialOutcome o (potentialReceipt o z) else boolReal (potentialReceipt o z)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.potentialArmValue · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Identification_Part1.lean:344
theorem observed_armValue_eq_potentialArmValue

Given the supplied inputs, the stated result about observed arm value eq potential arm value holds.

Formal statement
A z :
hreceipt :
houtcome :
(fun a : Assigned => armValue A (observeSource a))
=ᵐ[ P.assignedLaw.restrict {a : Assigned | a.2.1 = z}] fun a => potentialArmValue A z a.1
Proof (Lean source)
lemma observed_armValue_eq_potentialArmValue (P : TransportLaw) (A z : Bool) (hreceipt : ReceiptConsistency P) (houtcome : OutcomeConsistency P) : (fun a : Assigned => armValue A (observeSource a)) =ᵐ[ P.assignedLaw.restrict {a : Assigned | a.2.1 = z}] fun a => potentialArmValue A z a.1 := by have hZ : MeasurableSet {a : Assigned | a.2.1 = z} := by measurability filter_upwards [ae_restrict_of_ae hreceipt, ae_restrict_of_ae houtcome.1, ae_restrict_mem hZ] with a hD hY hz cases A <;> simp [armValue, observeSource, potentialArmValue, hD, hY, hz]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.observed_armValue_eq_potentialArmValue · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Identification_Part1.lean:351
theorem source_arm_potential_integral

Given the supplied inputs, the stated result about source arm potential integral holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hP :
ModelClass c_f C_f L P n
A z :
B :
Set ℝ
hB :
hsub :
(∫ x in B, P.fS x * assignmentMass P z x * P.m A z x)
= ∫ o in {o : FullData | covariate o ∈ B}, assignmentMass P z (covariate o) * potentialArmValue A z o ∂populationLaw P true
Proof (Lean source)
lemma source_arm_potential_integral (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hP : ModelClass c_f C_f L P n) (A z : Bool) (B : Set ℝ) (hB : MeasurableSet B) (hsub : B ⊆ covariateSpace) : (∫ x in B, P.fS x * assignmentMass P z x * P.m A z x) = ∫ o in {o : FullData | covariate o ∈ B}, assignmentMass P z (covariate o) * potentialArmValue A z o ∂populationLaw P true := by let Sobs : Set SourceObs := {o | o.1 ∈ B} let Sfull : Set Assigned := {a | covariate a.1 ∈ B} let Z : Set Assigned := {a | a.2.1 = z} let f : FullData → ℝ := potentialArmValue A z have hSobs : MeasurableSet Sobs := by dsimp [Sobs]; measurability have hSfull : MeasurableSet Sfull := by dsimp [Sfull] have hcov : Measurable (covariate : FullData → ℝ) := by unfold covariate; fun_prop exact hB.preimage (hcov.comp (by fun_prop)) have hZ : MeasurableSet Z := by dsimp [Z]; measurability have hobs : Measurable (observeSource : Assigned → SourceObs) := by unfold observeSource covariate fun_prop have hmark : AEStronglyMeasurable (fun o : SourceObs => (if o.2.1 = z then (1 : ℝ) else 0) * armValue A o) (sourceObsLaw P) := by apply Measurable.aestronglyMeasurable have hZobs : MeasurableSet {o : SourceObs | o.2.1 = z} := by measurability have hmz : Measurable (fun o : SourceObs => if o.2.1 = z then (1 : ℝ) else 0) := measurable_const.ite hZobs measurable_const have hmarm : Measurable (armValue A) := by cases A · change Measurable (fun o : SourceObs => boolReal o.2.2.1) exact (measurable_of_finite boolReal).comp (by fun_prop) · change Measurable (fun o : SourceObs => o.2.2.2) fun_prop exact hmz.mul hmarm have hf : Measurable f := by have hr0 : Measurable (receipt0 : FullData → Bool) := by unfold receipt0; fun_prop have hr1 : Measurable (receipt1 : FullData → Bool) := by unfold receipt1; fun_prop have hy0 : Measurable (outcome0 : FullData → ℝ) := by unfold outcome0; fun_prop have hy1 : Measurable (outcome1 : FullData → ℝ) := by unfold outcome1; fun_prop have hbool : Measurable (boolReal : Bool → ℝ) := measurable_of_finite _ cases A <;> cases z · change Measurable (fun o => boolReal (receipt0 o)) exact hbool.comp hr0 · change Measurable (fun o => boolReal (receipt1 o)) exact hbool.comp hr1 · change Measurable (fun o => if receipt0 o then outcome1 o else outcome0 o) exact hy1.ite (hr0 (measurableSet_singleton true)) hy0 · change Measurable (fun o => if receipt1 o then outcome1 o else outcome0 o) exact hy1.ite (hr1 (measurableSet_singleton true)) hy0 have hcons := observed_armValue_eq_potentialArmValue P A z hP.receipt hP.outcome have hcons_ind : Z.indicator (fun a : Assigned => armValue A (observeSource a)) =ᵐ[ P.assignedLaw] Z.indicator (fun a => f a.1) := by exact (ae_eq_restrict_iff_indicator_ae_eq hZ).mp (by simpa [Z, f] using hcons) have hassigned : (∫ a in Sfull, (if a.2.1 = z then (1 : ℝ) else 0) * armValue A (observeSource a) ∂P.assignedLaw) = ∫ a, Sfull.indicator (fun a => f a.1) a ∂P.assignedLaw.restrict Z := by rw [← integral_indicator hSfull, ← integral_indicator hZ] apply integral_congr_ae filter_upwards [hcons_ind] with a ha calc Sfull.indicator (fun a : Assigned => (if a.2.1 = z then (1 : ℝ) else 0) * armValue A (observeSource a)) a = Sfull.indicator (Z.indicator (fun a => armValue A (observeSource a))) a := by by_cases hSa : a ∈ Sfull · by_cases hZa : a ∈ Z · have hz : a.2.1 = z := by simpa [Z] using hZa simp [indicator, hSa, hZa, hz] · have hz : a.2.1 ≠ z := by simpa [Z] using hZa simp [indicator, hSa, hZa, hz] · simp [indicator, hSa] _ = Sfull.indicator (Z.indicator (fun a => f a.1)) a := by by_cases hSa : a ∈ Sfull · simpa [indicator, hSa] using ha · simp [indicator, hSa] _ = Z.indicator (Sfull.indicator (fun a => f a.1)) a := by by_cases hSa : a ∈ Sfull <;> by_cases hZa : a ∈ Z <;> simp [indicator, hSa, hZa] calc (∫ x in B, P.fS x * assignmentMass P z x * P.m A z x) = ∫ o in Sobs, (if o.2.1 = z then (1 : ℝ) else 0) * armValue A o ∂sourceObsLaw P := source_marked_arm_density c_f C_f L P n hP A z B hB hsub _ = ∫ a in Sfull, (if a.2.1 = z then (1 : ℝ) else 0) * armValue A (observeSource a) ∂P.assignedLaw := by rw [sourceObsLaw] simpa [Sobs, Sfull, observeSource] using setIntegral_map hSobs hmark hobs.aemeasurable _ = ∫ a, Sfull.indicator (fun a => f a.1) a ∂P.assignedLaw.restrict Z := hassigned _ = ∫ a, ({o : FullData | covariate o ∈ B}.indicator f) a.1 ∂P.assignedLaw.restrict Z := by apply integral_congr_ae filter_upwards [] with a by_cases ha : covariate a.1 ∈ B <;> simp [Sfull, indicator, ha] _ = ∫ o, assignmentMass P z (covariate o) * ({o : FullData | covariate o ∈ B}.indicator f) o ∂populationLaw P true := by simpa [Z] using assignment_slice_integral_eq c_f C_f L P n hP z ({o : FullData | covariate o ∈ B}.indicator f) ((hf.indicator (hB.preimage (by unfold covariate; fun_prop))).aestronglyMeasurable) _ = ∫ o, {o : FullData | covariate o ∈ B}.indicator (fun o => assignmentMass P z (covariate o) * potentialArmValue A z o) o ∂populationLaw P true := by apply integral_congr_ae filter_upwards [] with o by_cases ho : covariate o ∈ B <;> simp [indicator, ho, f] _ = _ := integral_indicator (hB.preimage (by unfold covariate; fun_prop))
CausalSmith.Stat.TransportCaceRoughnuisanceLength.source_arm_potential_integral · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Identification_Part1.lean:363
theorem measurable_ae_eq_of_forall_setIntegral_eq Lemma measurable_ae_eq_of_forall_setIntegral_eq in the paper ↗

Given the supplied inputs, the stated result about measurable ae eq of forall set integral eq holds.

Formal statement
α :
f g :
α → ℝ
hf :
hg :
hfg :
∀ B : Set α
then
∫ x in B, f x ∂μ = ∫ x in B, g x ∂μ
f =ᵐ[μ] g
Proof (Lean source)
lemma measurable_ae_eq_of_forall_setIntegral_eq {α : Type*} [MeasurableSpace α] (μ : Measure α) [IsFiniteMeasure μ] (f g : α → ℝ) (hf : Measurable f) (hg : Measurable g) (hfg : ∀ B : Set α, MeasurableSet B → ∫ x in B, f x ∂μ = ∫ x in B, g x ∂μ) : f =ᵐ[μ] g := by let E : ℕ → Set α := fun k => {x | |f x| ≤ k ∧ |g x| ≤ k} have hE : ∀ k, MeasurableSet (E k) := by intro k exact (measurableSet_Iic.preimage (continuous_abs.measurable.comp hf)).inter (measurableSet_Iic.preimage (continuous_abs.measurable.comp hg)) have hUnion : ⋃ k, E k = univ := by ext x simp only [Set.mem_iUnion, Set.mem_univ, iff_true] obtain ⟨kf, hkf⟩ := exists_nat_ge |f x| obtain ⟨kg, hkg⟩ := exists_nat_ge |g x| exact ⟨max kf kg, hkf.trans (by exact_mod_cast le_max_left kf kg), hkg.trans (by exact_mod_cast le_max_right kf kg)⟩ have hlocal : ∀ k, f =ᵐ[μ.restrict (E k)] g := by intro k have hfint : Integrable f (μ.restrict (E k)) := by apply Integrable.of_bound hf.aestronglyMeasurable.restrict k filter_upwards [ae_restrict_mem (hE k)] with x hx exact hx.1 have hgint : Integrable g (μ.restrict (E k)) := by apply Integrable.of_bound hg.aestronglyMeasurable.restrict k filter_upwards [ae_restrict_mem (hE k)] with x hx exact hx.2 apply hfint.ae_eq_of_forall_setIntegral_eq f g hgint intro B hB _ simpa only [Measure.restrict_restrict hB] using hfg (B ∩ E k) (hB.inter (hE k)) have hu : f =ᵐ[μ.restrict (⋃ k, E k)] g := (ae_eq_restrict_iUnion_iff E f g).2 hlocal simpa [hUnion] using hu
CausalSmith.Stat.TransportCaceRoughnuisanceLength.measurable_ae_eq_of_forall_setIntegral_eq · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Identification_Part1.lean:477
theorem target_absolutelyContinuous_source

Given the supplied inputs, the stated result about target absolutely continuous source holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hP :
ModelClass c_f C_f L P n
Proof (Lean source)
lemma target_absolutelyContinuous_source (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hP : ModelClass c_f C_f L P n) : targetXLaw P ≪ sourceXLaw P := by let μ := volume.restrict covariateSpace have hcontS : ContinuousOn P.fS covariateSpace := by have hcd := hP.sourceHolder.2.1.continuousOn have hmap : ContinuousOn (fun x : ℝ => ![x]) covariateSpace := by fun_prop have hmaps : MapsTo (fun x : ℝ => ![x]) covariateSpace {v : Fin 1 → ℝ | v 0 ∈ covariateSpace} := by intro x hx simpa using hx simpa [Function.comp_def, Matrix.cons_val_zero] using hcd.comp hmap hmaps have hmeasS : AEMeasurable (fun x => ofReal (P.fS x)) μ := (hcontS.aemeasurable measurableSet_Icc).ennreal_ofReal have hnonzeroS : ∀ᵐ x ∂μ, ofReal (P.fS x) ≠ 0 := by filter_upwards [ae_restrict_mem measurableSet_Icc] with x hx exact ne_of_gt (ENNReal.ofReal_pos.2 (lt_of_lt_of_le hP.sourceBounds.1.1 (hP.sourceBounds.2.2.2.2.2 x hx).1)) rw [hP.targetBounds.1, hP.sourceBounds.2.2.2.2.1] exact (withDensity_absolutelyContinuous μ _).trans (withDensity_absolutelyContinuous' hmeasS hnonzeroS)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.target_absolutelyContinuous_source · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Identification_Part1.lean:515
def armMeanVersion

The arm mean version object is defined from the supplied inputs.

Definition (Lean source)
A z :
armMeanVersion P A z :
ℝ → ℝ
covariateSpace.indicator (P.m A z)
theorem armMeanVersion_measurable

Given the supplied inputs, the stated result about arm mean version measurable holds.

Formal statement
L :
ℝ
hP :
A z :
Proof (Lean source)
lemma armMeanVersion_measurable (L : ℝ) (P : TransportLaw) (hP : ArmMeansHolder L P) (A z : Bool) : Measurable (armMeanVersion P A z) := by exact hP.2.1 A z |>.2.1
CausalSmith.Stat.TransportCaceRoughnuisanceLength.armMeanVersion_measurable · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Identification_Part1.lean:543
theorem armMeanVersion_ae_eq

Given the supplied inputs, the stated result about arm mean version ae eq holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hP :
ModelClass c_f C_f L P n
A z :
armMeanVersion P A z =ᵐ[sourceXLaw P] P.m A z
Proof (Lean source)
lemma armMeanVersion_ae_eq (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hP : ModelClass c_f C_f L P n) (A z : Bool) : armMeanVersion P A z =ᵐ[sourceXLaw P] P.m A z := by have hsupp : ∀ᵐ x ∂sourceXLaw P, x ∈ covariateSpace := by rw [hP.sourceBounds.2.2.2.2.1] exact (withDensity_absolutelyContinuous _ _).ae_le (ae_restrict_mem measurableSet_Icc) filter_upwards [hsupp] with x hx simp [armMeanVersion, Set.indicator_of_mem hx]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.armMeanVersion_ae_eq · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Identification_Part1.lean:550
CausalSmith.Stat.STAT_TransportCaceRoughnuisanceLength_Research.Helpers.Identification_Part2 6 declarations Conditional IV identities and transported CACE

Conditional IV identities and transported CACE

theorem armMeanVersion_conditionalMean

Given the supplied inputs, the stated result about arm mean version conditional mean holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hP :
ModelClass c_f C_f L P n
A z :
ConditionalMean P true (potentialArmValue A z) (armMeanVersion P A z)
Proof (Lean source)
lemma armMeanVersion_conditionalMean (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hP : ModelClass c_f C_f L P n) (A z : Bool) : ConditionalMean P true (potentialArmValue A z) (armMeanVersion P A z) := by let μ := populationLaw P true let m0 : MeasurableSpace FullData := inferInstance have hcov : @Measurable FullData ℝ m0 _ covariate := by simpa [m0] using (show Measurable (covariate : FullData → ℝ) by unfold covariate; fun_prop) let q := armMeanVersion P A z let f := potentialArmValue A z let w : FullData → ℝ := fun o => assignmentMass P z (covariate o) haveI : IsProbabilityMeasure P.fullLaw := hP.sourceBounds.2.2.1 haveI : IsFiniteMeasure μ := by refine ⟨?_⟩ by_cases hp : P.fullLaw {o | population o = true} = 0 · simp [μ, populationLaw, cond, hp] · simp only [μ, populationLaw, cond, Measure.coe_smul, Pi.smul_apply, MeasurableSet.univ, Measure.restrict_apply, Set.univ_inter, smul_eq_mul] rw [ENNReal.inv_mul_cancel hp (measure_ne_top P.fullLaw _)] exact ENNReal.one_lt_top have hq : Measurable q := armMeanVersion_measurable L P hP.armHolder A z have hf : @Measurable FullData ℝ m0 _ f := by have hr0 : @Measurable FullData Bool m0 _ receipt0 := by simpa [m0] using (show Measurable (receipt0 : FullData → Bool) by unfold receipt0; fun_prop) have hr1 : @Measurable FullData Bool m0 _ receipt1 := by simpa [m0] using (show Measurable (receipt1 : FullData → Bool) by unfold receipt1; fun_prop) have hy0 : @Measurable FullData ℝ m0 _ outcome0 := by simpa [m0] using (show Measurable (outcome0 : FullData → ℝ) by unfold outcome0; fun_prop) have hy1 : @Measurable FullData ℝ m0 _ outcome1 := by simpa [m0] using (show Measurable (outcome1 : FullData → ℝ) by unfold outcome1; fun_prop) have hbool : Measurable (boolReal : Bool → ℝ) := measurable_of_finite _ cases A <;> cases z · change Measurable (fun o => boolReal (receipt0 o)); exact hbool.comp hr0 · change Measurable (fun o => boolReal (receipt1 o)); exact hbool.comp hr1 · change Measurable (fun o => if receipt0 o then outcome1 o else outcome0 o) exact hy1.ite (hr0 (measurableSet_singleton true)) hy0 · change Measurable (fun o => if receipt1 o then outcome1 o else outcome0 o) exact hy1.ite (hr1 (measurableSet_singleton true)) hy0 have hsupp : ∀ᵐ o ∂μ, covariate o ∈ covariateSpace := by apply (ProbabilityTheory.cond_absolutelyContinuous : μ.AbsolutelyContinuous P.fullLaw).ae_le exact hP.sourceBounds.2.2.2.1.mono fun _ ho => ho.1 have hw : AEMeasurable w μ := by have hsupported : @Measurable FullData ℝ m0 _ (fun o => covariateSpace.indicator (assignmentMass P z) (covariate o)) := (measurable_assignmentMassOnCovariate P z hP.randomized.2.1).comp hcov refine hsupported.aemeasurable.congr ?_ filter_upwards [hsupp] with o ho simp [w, ho] have hwpos : ∀ᵐ o ∂μ, 0 < w o := by filter_upwards [hsupp] with o ho rcases hP.overlap (covariate o) ho with ⟨he0, he1⟩ cases z <;> simp [w, assignmentMass] <;> linarith have hbounds : ∀ᵐ o ∂μ, covariate o ∈ covariateSpace ∧ outcome0 o ∈ Icc (0 : ℝ) 1 ∧ outcome1 o ∈ Icc (0 : ℝ) 1 := (ProbabilityTheory.cond_absolutelyContinuous : μ.AbsolutelyContinuous P.fullLaw).ae_le hP.sourceBounds.2.2.2.1 have hfbd : ∀ᵐ o ∂μ, ‖f o‖ ≤ 1 := by filter_upwards [hbounds] with o ho rcases ho with ⟨_, h0, h1⟩ cases A <;> cases z <;> simp [f, potentialArmValue, potentialReceipt, potentialOutcome, boolReal] <;> split <;> simp_all [Real.norm_eq_abs, abs_le] <;> nlinarith [h0.1, h0.2, h1.1, h1.2] have hfint : Integrable f μ := by exact Integrable.of_bound hf.aestronglyMeasurable 1 hfbd have hwbd : ∀ᵐ o ∂μ, ‖w o‖ ≤ 1 := by filter_upwards [hsupp] with o ho rcases hP.overlap (covariate o) ho with ⟨he0, he1⟩ have hw0 : 0 ≤ w o := by cases z <;> simp [w, assignmentMass] <;> linarith have hw1 : w o ≤ 1 := by cases z <;> simp [w, assignmentMass] <;> linarith simpa [Real.norm_eq_abs, abs_of_nonneg hw0] using hw1 have hwfint : Integrable (w * f) μ := by apply Integrable.of_bound (hw.mul hf.aemeasurable).aestronglyMeasurable 1 filter_upwards [hwbd, hfbd] with o hwo hfo simp only [Pi.mul_apply, norm_mul] nlinarith [norm_nonneg (w o), norm_nonneg (f o)] have hgint : Integrable (w * fun o => q (covariate o)) μ := by apply Integrable.of_bound ((hw.mul (hq.comp hcov).aemeasurable).aestronglyMeasurable) 1 filter_upwards [hwbd, hsupp] with o hwo ho have hqbd : ‖q (covariate o)‖ ≤ 1 := by have hm := hP.armHolder.2.1 A z |>.2.2 (covariate o) ho simp [q, armMeanVersion, Set.indicator_of_mem ho, Real.norm_eq_abs, abs_le] exact ⟨by linarith [hm.1], hm.2⟩ simp only [Pi.mul_apply, norm_mul] change ‖w o‖ * ‖q (covariate o)‖ ≤ 1 nlinarith [norm_nonneg (w o), norm_nonneg (q (covariate o))] have hwX : Measurable (covariateSpace.indicator (assignmentMass P z)) := measurable_assignmentMassOnCovariate P z hP.randomized.2.1 have hXLaw : sourceXLaw P = μ.map covariate := by have hobs : Measurable (observeSource : Assigned → SourceObs) := by unfold observeSource covariate fun_prop calc sourceXLaw P = P.assignedLaw.map (fun o : Assigned => covariate o.1) := by rw [sourceXLaw, sourceObsLaw, Measure.map_map (by fun_prop) hobs] rfl _ = (P.assignedLaw.map fst).map covariate := by rw [Measure.map_map hcov (by fun_prop)] rfl _ = μ.map covariate := by change (P.assignedLaw.map fst).map covariate = (populationLaw P true).map covariate rw [hP.randomized.2.2.1] let mX : MeasurableSpace FullData := MeasurableSpace.comap covariate Real.measurableSpace have hmX : mX ≤ m0 := hcov.comap_le haveI : IsFiniteMeasure (μ.trim hmX) := isFiniteMeasure_trim hmX haveI : SigmaFinite (μ.trim hmX) := inferInstance letI : MeasurableSpace FullData := m0 have hw_mX : AEStronglyMeasurable[mX] w μ := by have hsupported : Measurable[mX] (fun o : FullData => covariateSpace.indicator (assignmentMass P z) (covariate o)) := (measurable_assignmentMassOnCovariate P z hP.randomized.2.1).comp (comap_measurable covariate) refine hsupported.aestronglyMeasurable.congr ?_ filter_upwards [hsupp] with o ho simp [w, ho] have hweighted : (w * fun o => q (covariate o)) =ᵐ[μ] μ[w * f | mX] := by apply ae_eq_condExp_of_forall_setIntegral_eq hmX hwfint (fun _ _ _ => hgint.integrableOn) · intro C hC _ obtain ⟨B, hB, rfl⟩ := MeasurableSpace.measurableSet_comap.mp hC let B0 := B ∩ covariateSpace have hB0 : MeasurableSet B0 := hB.inter measurableSet_Icc have hsub : B0 ⊆ covariateSpace := inter_subset_right have hpreB : MeasurableSet {o : FullData | covariate o ∈ B} := hB.preimage hcov have hpreB0 : MeasurableSet {o : FullData | covariate o ∈ B0} := hB0.preimage hcov have hsetae : {o : FullData | covariate o ∈ B} =ᵐ[μ] {o : FullData | covariate o ∈ B0} := by filter_upwards [hsupp] with o ho apply propext constructor · intro hBo exact ⟨hBo, ho⟩ · intro hBo exact hBo.1 have hrestrict (r : FullData → ℝ) : (∫ o in {o : FullData | covariate o ∈ B}, r o ∂μ) = ∫ o in {o : FullData | covariate o ∈ B0}, r o ∂μ := by rw [← integral_indicator hpreB, ← integral_indicator hpreB0] exact integral_congr_ae (indicator_ae_eq_of_ae_eq_set hsetae) calc (∫ o in {o : FullData | covariate o ∈ B}, (w * fun o => q (covariate o)) o ∂μ) = ∫ o in {o : FullData | covariate o ∈ B0}, (w * fun o => q (covariate o)) o ∂μ := hrestrict _ _ = ∫ o in {o : FullData | covariate o ∈ B0}, covariateSpace.indicator (assignmentMass P z) (covariate o) * q (covariate o) ∂μ := by apply setIntegral_congr_fun hpreB0 intro o ho simp [w, hsub ho] _ = ∫ x in B0, covariateSpace.indicator (assignmentMass P z) x * q x ∂sourceXLaw P := by rw [hXLaw] exact (setIntegral_map hB0 (hwX.mul hq).aestronglyMeasurable hcov.aemeasurable).symm _ = ∫ x in B0, assignmentMass P z x * q x ∂sourceXLaw P := by apply setIntegral_congr_fun hB0 intro x hx simp [hsub hx] _ = ∫ x in B0, P.fS x * (assignmentMass P z x * q x) := source_setIntegral_eq_density_integral c_f C_f L P n hP B0 hB0 hsub _ _ = ∫ x in B0, P.fS x * assignmentMass P z x * P.m A z x := by apply setIntegral_congr_fun hB0 intro x hx simp [q, armMeanVersion, Set.indicator_of_mem (hsub hx), mul_assoc] _ = ∫ o in {o : FullData | covariate o ∈ B0}, assignmentMass P z (covariate o) * potentialArmValue A z o ∂μ := source_arm_potential_integral c_f C_f L P n hP A z B0 hB0 hsub _ = ∫ o in {o : FullData | covariate o ∈ B}, (w * f) o ∂μ := by rw [hrestrict] rfl · exact (hw_mX.mul ((hq.comp (comap_measurable covariate)).aestronglyMeasurable)) have hpull : μ[w * f | mX] =ᵐ[μ] w * μ[f | mX] := condExp_mul_of_aestronglyMeasurable_left hw_mX hwfint hfint have hqce_comp : (fun o => q (covariate o)) =ᵐ[μ] μ[f | mX] := by filter_upwards [hweighted, hpull, hwpos] with o h1 h2 hpos dsimp only [Pi.mul_apply] at h1 h2 rw [h2] at h1 exact (mul_left_cancel₀ (ne_of_gt hpos) h1) refine ⟨hq, ?_⟩ intro B hB have hpre : MeasurableSet[mX] {o : FullData | covariate o ∈ B} := by exact MeasurableSpace.measurableSet_comap.mpr ⟨B, hB, rfl⟩ calc (∫ o in {o : FullData | covariate o ∈ B}, f o ∂μ) = ∫ o in {o : FullData | covariate o ∈ B}, (μ[f | mX]) o ∂μ := (setIntegral_condExp hmX hfint hpre).symm _ = ∫ o in {o : FullData | covariate o ∈ B}, q (covariate o) ∂μ := setIntegral_congr_ae (hmX _ hpre) (hqce_comp.symm.mono fun _ ho _ => ho) _ = ∫ x in B, q x ∂μ.map covariate := by exact (setIntegral_map hB hq.aestronglyMeasurable hcov.aemeasurable).symm _ = _ := by rfl
CausalSmith.Stat.TransportCaceRoughnuisanceLength.armMeanVersion_conditionalMean · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Identification_Part2.lean:13
theorem sourceXLaw_eq_source_population_map

Given the supplied inputs, the stated result about source xlaw eq source population map holds.

Formal statement
Proof (Lean source)
lemma sourceXLaw_eq_source_population_map (P : TransportLaw) (hP : InstrumentRandomization P) : sourceXLaw P = (populationLaw P true).map covariate := by have hcov : Measurable (covariate : FullData → ℝ) := by unfold covariate fun_prop have hobs : Measurable (observeSource : Assigned → SourceObs) := by unfold observeSource covariate fun_prop calc sourceXLaw P = P.assignedLaw.map (fun o : Assigned => covariate o.1) := by rw [sourceXLaw, sourceObsLaw, Measure.map_map (by fun_prop) hobs] rfl _ = (P.assignedLaw.map fst).map covariate := by rw [Measure.map_map hcov (by fun_prop)] rfl _ = (populationLaw P true).map covariate := by rw [hP.2.2.1]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.sourceXLaw_eq_source_population_map · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Identification_Part2.lean:217
theorem conditionalMean_unique_source

Given the supplied inputs, the stated result about conditional mean unique source holds.

Formal statement
f :
FullData → ℝ
q r :
ℝ → ℝ
hq :
ConditionalMean P true f q
hr :
ConditionalMean P true f r
q =ᵐ[sourceXLaw P] r
Proof (Lean source)
lemma conditionalMean_unique_source (P : TransportLaw) (hP : InstrumentRandomization P) (f : FullData → ℝ) (q r : ℝ → ℝ) (hq : ConditionalMean P true f q) (hr : ConditionalMean P true f r) : q =ᵐ[sourceXLaw P] r := by haveI : IsProbabilityMeasure P.assignedLaw := hP.1 haveI : IsFiniteMeasure (sourceXLaw P) := by dsimp [sourceXLaw, sourceObsLaw] infer_instance apply measurable_ae_eq_of_forall_setIntegral_eq (sourceXLaw P) q r hq.1 hr.1 intro B hB rw [sourceXLaw_eq_source_population_map P hP] exact (hq.2 B hB).symm.trans (hr.2 B hB)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.conditionalMean_unique_source · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Identification_Part2.lean:237
theorem conditionalMean_sub

Given the supplied inputs, the difference of two conditional means is the conditional mean of the difference.

Formal statement
s :
f₁ f₀ :
FullData → ℝ
q₁ q₀ :
ℝ → ℝ
h₁ :
ConditionalMean P s f₁ q₁
h₀ :
ConditionalMean P s f₀ q₀
hf₁ :
hf₀ :
hq₁ :
hq₀ :
ConditionalMean P s (f₁ - f₀) (q₁ - q₀)
Proof (Lean source)
lemma conditionalMean_sub (P : TransportLaw) (s : Bool) (f₁ f₀ : FullData → ℝ) (q₁ q₀ : ℝ → ℝ) (h₁ : ConditionalMean P s f₁ q₁) (h₀ : ConditionalMean P s f₀ q₀) (hf₁ : Integrable f₁ (populationLaw P s)) (hf₀ : Integrable f₀ (populationLaw P s)) (hq₁ : Integrable q₁ ((populationLaw P s).map covariate)) (hq₀ : Integrable q₀ ((populationLaw P s).map covariate)) : ConditionalMean P s (f₁ - f₀) (q₁ - q₀) := by refine ⟨h₁.1.sub h₀.1, ?_⟩ intro B hB rw [integral_sub' hf₁.integrableOn hf₀.integrableOn, integral_sub' hq₁.integrableOn hq₀.integrableOn, h₁.2 B hB, h₀.2 B hB]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.conditionalMean_sub · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Identification_Part2.lean:252
theorem armContrastVersion_conditionalMean

Given the supplied inputs, the stated result about arm contrast version conditional mean holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hP :
ModelClass c_f C_f L P n
A :
Proof (Lean source)
lemma armContrastVersion_conditionalMean (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hP : ModelClass c_f C_f L P n) (A : Bool) : ConditionalMean P true (potentialArmValue A true - potentialArmValue A false) (armMeanVersion P A true - armMeanVersion P A false) := by let μ := populationLaw P true haveI : IsProbabilityMeasure P.fullLaw := hP.sourceBounds.2.2.1 haveI : IsFiniteMeasure μ := by refine ⟨?_⟩ by_cases hp : P.fullLaw {o | population o = true} = 0 · simp [μ, populationLaw, cond, hp] · simp only [μ, populationLaw, cond, Measure.coe_smul, Pi.smul_apply, MeasurableSet.univ, Measure.restrict_apply, Set.univ_inter, smul_eq_mul] rw [ENNReal.inv_mul_cancel hp (measure_ne_top P.fullLaw _)] exact ENNReal.one_lt_top haveI : IsFiniteMeasure (μ.map covariate) := by infer_instance have hmeasF (z : Bool) : Measurable (potentialArmValue A z) := by have hr0 : Measurable (receipt0 : FullData → Bool) := by unfold receipt0; fun_prop have hr1 : Measurable (receipt1 : FullData → Bool) := by unfold receipt1; fun_prop have hy0 : Measurable (outcome0 : FullData → ℝ) := by unfold outcome0; fun_prop have hy1 : Measurable (outcome1 : FullData → ℝ) := by unfold outcome1; fun_prop have hbool : Measurable (boolReal : Bool → ℝ) := measurable_of_finite _ cases A <;> cases z · change Measurable (fun o => boolReal (receipt0 o)); exact hbool.comp hr0 · change Measurable (fun o => boolReal (receipt1 o)); exact hbool.comp hr1 · change Measurable (fun o => if receipt0 o then outcome1 o else outcome0 o) exact hy1.ite (hr0 (measurableSet_singleton true)) hy0 · change Measurable (fun o => if receipt1 o then outcome1 o else outcome0 o) exact hy1.ite (hr1 (measurableSet_singleton true)) hy0 have hbounds : ∀ᵐ o ∂μ, outcome0 o ∈ Icc (0 : ℝ) 1 ∧ outcome1 o ∈ Icc (0 : ℝ) 1 := by apply (ProbabilityTheory.cond_absolutelyContinuous : μ.AbsolutelyContinuous P.fullLaw).ae_le exact hP.sourceBounds.2.2.2.1.mono fun _ ho => ⟨ho.2.1, ho.2.2⟩ have hintF (z : Bool) : Integrable (potentialArmValue A z) μ := by apply Integrable.of_bound (hmeasF z).aestronglyMeasurable 1 filter_upwards [hbounds] with o ho rcases ho with ⟨h0, h1⟩ cases A <;> cases z <;> simp [potentialArmValue, potentialReceipt, potentialOutcome, boolReal, Real.norm_eq_abs, abs_le] <;> split <;> simp_all [Real.norm_eq_abs, abs_le] <;> nlinarith [h0.1, h0.2, h1.1, h1.2] have hintQ (z : Bool) : Integrable (armMeanVersion P A z) (μ.map covariate) := by apply Integrable.of_bound (armMeanVersion_measurable L P hP.armHolder A z).aestronglyMeasurable 1 filter_upwards [] with x by_cases hx : x ∈ covariateSpace · have hm := hP.armHolder.2.1 A z |>.2.2 x hx simp [armMeanVersion, Set.indicator_of_mem hx, Real.norm_eq_abs, abs_le] exact ⟨by linarith [hm.1], hm.2⟩ · simp [armMeanVersion, hx] exact conditionalMean_sub P true _ _ _ _ (armMeanVersion_conditionalMean c_f C_f L P n hP A true) (armMeanVersion_conditionalMean c_f C_f L P n hP A false) (hintF true) (hintF false) (hintQ true) (hintQ false)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.armContrastVersion_conditionalMean · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Identification_Part2.lean:267
theorem transported_cace_identification

Given the supplied inputs, the stated result about transported cace identification holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hf :
0 < c_f ∧ c_f < 1
hF :
1 < C_f
hL :
1 < L
hP :
ModelClass c_f C_f L P n
conclusion 1
z :
∃ qDz : ℝ → ℝ,
ConditionalMean P true (fun o => boolReal (potentialReceipt o z)) qDz
P.m false z =ᵐ[sourceXLaw P] qDz
∃ qYz : ℝ → ℝ,
ConditionalMean P true (fun o => potentialOutcome o (potentialReceipt o z)) qYz
P.m true z =ᵐ[sourceXLaw P] qYz
conclusion 2
∃ qD qY : ℝ → ℝ,
ConditionalMean P true (fun o => boolReal (receipt1 o) - boolReal (receipt0 o)) qD
ConditionalMean P true (fun o => potentialOutcome o (receipt1 o) - potentialOutcome o (receipt0 o)) qY
ConditionalMean P false complier qD
ConditionalMean P true complier qD
ConditionalMean P false (fun o => (outcome1 o - outcome0 o) * complier o) qY
ConditionalMean P true (fun o => (outcome1 o - outcome0 o) * complier o) qY
conclusion 3
∀ᵐ o ∂P.fullLaw, boolReal (receipt1 o) - boolReal (receipt0 o) = complier o
conclusion 5
= ∫ o, (outcome1 o - outcome0 o) * complier o ∂populationLaw P false
conclusion 7
Proof (Lean source)
lemma transported_cace_identification (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hf : 0 < c_f ∧ c_f < 1) (hF : 1 < C_f) (hL : 1 < L) (hP : ModelClass c_f C_f L P n) : (∀ z : Bool, (∃ qDz : ℝ → ℝ, ConditionalMean P true (fun o => boolReal (potentialReceipt o z)) qDz ∧ P.m false z =ᵐ[sourceXLaw P] qDz) ∧ (∃ qYz : ℝ → ℝ, ConditionalMean P true (fun o => potentialOutcome o (potentialReceipt o z)) qYz ∧ P.m true z =ᵐ[sourceXLaw P] qYz)) ∧ (∃ qD qY : ℝ → ℝ, ConditionalMean P true (fun o => boolReal (receipt1 o) - boolReal (receipt0 o)) qD ∧ ConditionalMean P true (fun o => potentialOutcome o (receipt1 o) - potentialOutcome o (receipt0 o)) qY ∧ ConditionalMean P false complier qD ∧ ConditionalMean P true complier qD ∧ ConditionalMean P false (fun o => (outcome1 o - outcome0 o) * complier o) qY ∧ ConditionalMean P true (fun o => (outcome1 o - outcome0 o) * complier o) qY ∧ armContrast P false =ᵐ[targetXLaw P] qD ∧ armContrast P true =ᵐ[targetXLaw P] qY) ∧ (∀ᵐ o ∂P.fullLaw, boolReal (receipt1 o) - boolReal (receipt0 o) = complier o) ∧ firstStage P = targetComplierShare P ∧ transportedForm P true = ∫ o, (outcome1 o - outcome0 o) * complier o ∂populationLaw P false ∧ targetCACE P = transportedForm P true / firstStage P ∧ targetCACE P ∈ parameterSpace := by have hident : ∃ qD qY : ℝ → ℝ, ConditionalMean P true (fun o => boolReal (receipt1 o) - boolReal (receipt0 o)) qD ∧ ConditionalMean P true (fun o => potentialOutcome o (receipt1 o) - potentialOutcome o (receipt0 o)) qY ∧ ConditionalMean P false complier qD ∧ ConditionalMean P true complier qD ∧ ConditionalMean P false (fun o => (outcome1 o - outcome0 o) * complier o) qY ∧ ConditionalMean P true (fun o => (outcome1 o - outcome0 o) * complier o) qY ∧ armContrast P false =ᵐ[targetXLaw P] qD ∧ armContrast P true =ᵐ[targetXLaw P] qY := by obtain ⟨qD, hqDtarget, hqDsource⟩ := hP.shareTransport obtain ⟨qY, hqYtarget, hqYsource⟩ := hP.outcomeTransport have hreceipt := conditionalMean_congr_full_ae P true (fun o => boolReal (receipt1 o) - boolReal (receipt0 o)) complier qD (monotone_receipt_difference_eq_complier P hP.monotone) hqDsource have houtcome := conditionalMean_congr_full_ae P true (fun o => potentialOutcome o (receipt1 o) - potentialOutcome o (receipt0 o)) (fun o => (outcome1 o - outcome0 o) * complier o) qY (potentialOutcome_difference_eq_complier P hP.monotone) hqYsource have harm : armContrast P false =ᵐ[targetXLaw P] qD ∧ armContrast P true =ᵐ[targetXLaw P] qY := by have hraw (A : Bool) : armContrast P A =ᵐ[sourceXLaw P] (armMeanVersion P A true - armMeanVersion P A false) := by filter_upwards [armMeanVersion_ae_eq c_f C_f L P n hP A true, armMeanVersion_ae_eq c_f C_f L P n hP A false] with x h1 h0 change P.m A true x - P.m A false x = armMeanVersion P A true x - armMeanVersion P A false x rw [h1, h0] have hreceipt' : ConditionalMean P true (potentialArmValue false true - potentialArmValue false false) qD := by change ConditionalMean P true (fun o => boolReal (receipt1 o) - boolReal (receipt0 o)) qD exact hreceipt have houtcome' : ConditionalMean P true (potentialArmValue true true - potentialArmValue true false) qY := by change ConditionalMean P true (fun o => potentialOutcome o (receipt1 o) - potentialOutcome o (receipt0 o)) qY exact houtcome have hvD := conditionalMean_unique_source P hP.randomized _ _ _ (armContrastVersion_conditionalMean c_f C_f L P n hP false) hreceipt' have hvY := conditionalMean_unique_source P hP.randomized _ _ _ (armContrastVersion_conditionalMean c_f C_f L P n hP true) houtcome' have hsD := (hraw false).trans hvD have hsY := (hraw true).trans hvY exact ⟨(target_absolutelyContinuous_source c_f C_f L P n hP).ae_le hsD, (target_absolutelyContinuous_source c_f C_f L P n hP).ae_le hsY⟩ exact ⟨qD, qY, hreceipt, houtcome, hqDtarget, hqDsource, hqYtarget, hqYsource, harm.1, harm.2⟩ obtain ⟨qD, qY, hqDsrc, hqYsrc, hqD, hqDsrc2, hqY, hqYsrc2, haeD, haeY⟩ := hident have hfirst : firstStage P = targetComplierShare P := by calc firstStage P = ∫ x in covariateSpace, P.fT x * armContrast P false x := rfl _ = ∫ x, armContrast P false x ∂targetXLaw P := (target_integral_eq_density_integral c_f C_f L P n hP _).symm _ = ∫ x, qD x ∂targetXLaw P := integral_congr_ae haeD _ = ∫ o, complier o ∂populationLaw P false := by have h := hqD.2 univ MeasurableSet.univ simpa [targetXLaw] using h.symm _ = targetComplierShare P := integral_complier_eq_targetComplierShare P have hout : transportedForm P true = ∫ o, (outcome1 o - outcome0 o) * complier o ∂populationLaw P false := by calc transportedForm P true = ∫ x in covariateSpace, P.fT x * armContrast P true x := rfl _ = ∫ x, armContrast P true x ∂targetXLaw P := (target_integral_eq_density_integral c_f C_f L P n hP _).symm _ = ∫ x, qY x ∂targetXLaw P := integral_congr_ae haeY _ = ∫ o, (outcome1 o - outcome0 o) * complier o ∂populationLaw P false := by have h := hqY.2 univ MeasurableSet.univ simpa [targetXLaw] using h.symm refine ⟨?_, ?_, monotone_receipt_difference_eq_complier P hP.monotone, hfirst, hout, ?_, ?_⟩ · intro z constructor · refine ⟨armMeanVersion P false z, ?_, ?_⟩ · change ConditionalMean P true (potentialArmValue false z) _ exact armMeanVersion_conditionalMean c_f C_f L P n hP false z · exact (armMeanVersion_ae_eq c_f C_f L P n hP false z).symm · refine ⟨armMeanVersion P true z, ?_, ?_⟩ · change ConditionalMean P true (potentialArmValue true z) _ exact armMeanVersion_conditionalMean c_f C_f L P n hP true z · exact (armMeanVersion_ae_eq c_f C_f L P n hP true z).symm · exact ⟨qD, qY, hqDsrc, hqYsrc, hqD, hqDsrc2, hqY, hqYsrc2, haeD, haeY⟩ · rw [targetCACE, hout, hfirst] · exact targetCACE_mem_parameterSpace c_f C_f L P n hP hfirst
CausalSmith.Stat.TransportCaceRoughnuisanceLength.transported_cace_identification · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Identification_Part2.lean:326
CausalSmith.Stat.STAT_TransportCaceRoughnuisanceLength_Research.Helpers.LegalMixture 2 declarations Legal full-elbow monotone-IV mixture

Legal full-elbow monotone-IV mixture

theorem calibrated_mixture_amplitude Lemma calibrated_mixture_amplitude in the paper ↗

Choose an amplitude below any positive membership ceiling while satisfying the exponential distance calibration in roadmap (29). Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
α cap :
ℝ
hα :
α < 1
hcap :
0 < cap
∃ c : ℝ,
conclusion 1
0 < c
conclusion 2
c ≤ cap
conclusion 3
c ≤ 1 / 100
conclusion 4
exp (mixConstant * c ^ 4) ≤ 1 + (1 - α) ^ 2
Proof (Lean source)
-- @node: calibrated_mixture_amplitude lemma calibrated_mixture_amplitude (α cap : ℝ) (hα : α < 1) (hcap : 0 < cap) : ∃ c : ℝ, 0 < c ∧ c ≤ cap ∧ c ≤ 1 / 100 ∧ exp (mixConstant * c ^ 4) ≤ 1 + (1 - α) ^ 2 := by have hgap : exp (mixConstant * (0 : ℝ) ^ 4) < 1 + (1 - α) ^ 2 := by simp only [zero_pow (by norm_num : 4 ≠ 0), mul_zero, Real.exp_zero] nlinarith [sq_pos_of_pos (show 0 < 1 - α by linarith)] have hcont : ContinuousAt (fun c : ℝ => exp (mixConstant * c ^ 4)) 0 := by fun_prop have hevent := hcont.tendsto.eventually (gt_mem_nhds hgap) obtain ⟨δ, hδ, hnear⟩ := Metric.eventually_nhds_iff.mp hevent let c := min cap (min (1 / 100 : ℝ) (δ / 2)) have hc : 0 < c := lt_min hcap (lt_min (by norm_num) (half_pos hδ)) refine ⟨c, hc, min_le_left _ _, (min_le_right _ _).trans (min_le_left _ _), ?_⟩ apply le_of_lt (hnear ?_) rw [Real.dist_eq, sub_zero, abs_of_pos hc] have := (min_le_right cap (min (1 / 100 : ℝ) (δ / 2))).trans (min_le_right (1 / 100 : ℝ) (δ / 2)) change c < δ linarith
CausalSmith.Stat.TransportCaceRoughnuisanceLength.calibrated_mixture_amplitude · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture.lean:14
theorem legal_iv_mixture_full_elbow

Given the supplied inputs, the stated result about legal iv mixture full elbow holds.

Formal statement
α c_f C_f L :
ℝ
hα :
0 < α ∧ α < 1
hf :
0 < c_f ∧ c_f < 1
hF :
1 < C_f
hL :
1 < L
∃ cStar : ℝ,
0 < cStar
cStar < 1
conclusion 1
n :
ℕ
threshold ≤ n
a :
ℝ
0 < a
a ≤ 1 / 4
LowerAdmissible n a cStar
conclusion 2
n :
ℕ
threshold ≤ n
a :
ℝ
0 < a
a ≤ 1 / 4
τ :
ℝ
τ ∈ Icc (-1 : ℝ) 1
sgn :
legalIVComponent a n cStar τ sgn ∈ StrengthSlice c_f C_f L a n
s :
x ∈ covariateSpace :
lowerPointwiseMean a n cStar τ sgn s complier x = actualStrength a n
lowerPointwiseMean a n cStar τ sgn s (fun o => (outcome1 o - outcome0 o) * complier o) x
= -(tiledPerturbation cStar n sgn x * coupledPerturbation cStar τ n sgn x) / (1 / 4 - tiledPerturbation cStar n sgn x ^ 2)
ConditionalMean (legalIVComponent a n cStar τ sgn) s complier (fun _ => actualStrength a n)
ConditionalMean (legalIVComponent a n cStar τ sgn) s (fun o => (outcome1 o - outcome0 o) * complier o) (fun x => -(tiledPerturbation cStar n sgn x * coupledPerturbation cStar τ n sgn x) / (1 / 4 - tiledPerturbation cStar n sgn x ^ 2))
firstStage (legalIVComponent a n cStar τ sgn) = actualStrength a n
targetCACE (legalIVComponent a n cStar τ sgn)
= -(τ * separation cStar n) / actualStrength a n
1 + chiSqDiv (lowerMixture a n cStar τ) (dataLaw (mixtureCenter a n) n n)
≤ exp (mixConstant * cStar ^ 4)
tvDist (lowerMixture a n cStar τ) (dataLaw (mixtureCenter a n) n n)
≤ (1 - α) / 2
(lowerMixture a n cStar τ) ≪ (dataLaw (mixtureCenter a n) n n)
Integrable (fun ω : TwoSample n n => (((lowerMixture a n cStar τ).rnDeriv (dataLaw (mixtureCenter a n) n n) ω).toReal - 1) ^ 2) (dataLaw (mixtureCenter a n) n n)
mixtureCenter a n ∈ StrengthSlice c_f C_f L a n
2 ^ ((3 : ℝ) / 4) * cStar ^ 2 * (n : ℝ) ^ (-(1 / 3 : ℝ)) ≤ separation cStar n
separation cStar n ≤ 4 * cStar ^ 2 * (n : ℝ) ^ (-(1 / 3 : ℝ))
Proof (Lean source)
lemma legal_iv_mixture_full_elbow (α c_f C_f L : ℝ) (hα : 0 < α ∧ α < 1) (hf : 0 < c_f ∧ c_f < 1) (hF : 1 < C_f) (hL : 1 < L) : ∃ cStar : ℝ, 0 < cStar ∧ cStar < 1 ∧ -- @realizes c_{\star}(chosen amplitude in (0,1)) (∀ n : ℕ, threshold ≤ n → ∀ a : ℝ, 0 < a → a ≤ 1 / 4 → LowerAdmissible n a cStar) ∧ ∀ n : ℕ, threshold ≤ n → ∀ a : ℝ, 0 < a → a ≤ 1 / 4 → (∀ τ : ℝ, τ ∈ Icc (-1 : ℝ) 1 → (∀ sgn : Fin (lowerCells n) → Bool, legalIVComponent a n cStar τ sgn ∈ StrengthSlice c_f C_f L a n ∧ (∀ s : Bool, (∀ x ∈ covariateSpace, lowerPointwiseMean a n cStar τ sgn s complier x = actualStrength a n ∧ lowerPointwiseMean a n cStar τ sgn s (fun o => (outcome1 o - outcome0 o) * complier o) x = -(tiledPerturbation cStar n sgn x * coupledPerturbation cStar τ n sgn x) / (1 / 4 - tiledPerturbation cStar n sgn x ^ 2)) ∧ ConditionalMean (legalIVComponent a n cStar τ sgn) s complier (fun _ => actualStrength a n) ∧ ConditionalMean (legalIVComponent a n cStar τ sgn) s (fun o => (outcome1 o - outcome0 o) * complier o) (fun x => -(tiledPerturbation cStar n sgn x * coupledPerturbation cStar τ n sgn x) / (1 / 4 - tiledPerturbation cStar n sgn x ^ 2))) ∧ firstStage (legalIVComponent a n cStar τ sgn) = actualStrength a n ∧ targetCACE (legalIVComponent a n cStar τ sgn) = -(τ * separation cStar n) / actualStrength a n) ∧ 1 + chiSqDiv (lowerMixture a n cStar τ) (dataLaw (mixtureCenter a n) n n) ≤ exp (mixConstant * cStar ^ 4) ∧ tvDist (lowerMixture a n cStar τ) (dataLaw (mixtureCenter a n) n n) ≤ (1 - α) / 2 ∧ (lowerMixture a n cStar τ) ≪ (dataLaw (mixtureCenter a n) n n) ∧ Integrable (fun ω : TwoSample n n => (((lowerMixture a n cStar τ).rnDeriv (dataLaw (mixtureCenter a n) n n) ω).toReal - 1) ^ 2) (dataLaw (mixtureCenter a n) n n)) ∧ mixtureCenter a n ∈ StrengthSlice c_f C_f L a n ∧ firstStage (mixtureCenter a n) = actualStrength a n ∧ targetCACE (mixtureCenter a n) = 0 ∧ 2 ^ ((3 : ℝ) / 4) * cStar ^ 2 * (n : ℝ) ^ (-(1 / 3 : ℝ)) ≤ separation cStar n ∧ separation cStar n ≤ 4 * cStar ^ 2 * (n : ℝ) ^ (-(1 / 3 : ℝ)) := by obtain ⟨cMax, hcMax, hcMax1, hmember⟩ := legal_mixture_membership α c_f C_f L hα hf hF hL obtain ⟨cStar, hcStar, hcap, hsmall, hcal⟩ := calibrated_mixture_amplitude α cMax hα.2 hcMax have hc : 0 < cStar ∧ cStar ≤ 1 / 100 := ⟨hcStar, hsmall⟩ have hcStar1 : cStar < 1 := lt_of_le_of_lt hcap hcMax1 refine ⟨cStar, hcStar, hcStar1, ?_, ?_⟩ · intro n hn a ha ha4 exact lower_admissible_of_small_amplitude n a cStar hn ⟨ha, ha4⟩ hc · intro n hn a ha ha4 have hmem := hmember cStar hcStar hcap n hn a ha ha4 have hmargin := legal_mixture_margins a n cStar 0 (fun _ => false) hn ⟨ha, ha4⟩ hc (by norm_num) have hsep := legal_mixture_separation n hn cStar hc refine ⟨?_, hmem.2, hmargin.2.2.2.1, hmargin.2.2.2.2, hsep.1, hsep.2⟩ intro τ hτ have hdist := legal_mixture_distance α a n cStar τ hτ hn ⟨ha, ha4⟩ hα ⟨hcStar, hsmall, hcal⟩ have hfinite := legal_mixture_finite_chiSquare a n cStar τ hτ hn ⟨ha, ha4⟩ hc refine ⟨?_, hdist.1, hdist.2, hfinite.1, hfinite.2⟩ intro sgn have hm := legal_mixture_margins a n cStar τ sgn hn ⟨ha, ha4⟩ hc hτ have hDomain : LowerExperimentDomain n a cStar := ⟨by have : 256 ≤ n := hn; omega, lower_admissible_of_small_amplitude n a cStar hn ⟨ha, ha4⟩ hc⟩ have hcomponent : (legalIVMixture a n cStar τ hn ⟨ha, ha4⟩ hDomain hcStar1 hτ sgn).1 ∈ StrengthSlice c_f C_f L a n := hmem.1 τ hτ sgn refine ⟨hcomponent, ?_, hm.2.1, hm.2.2.1⟩ intro s refine ⟨?_, (hm.1 s).1, (hm.1 s).2⟩ intro x _ exact lowerPointwiseMean_complier_margins a n cStar τ sgn s x (actualStrength_bounds a n hn ⟨ha, ha4⟩).1.ne'
CausalSmith.Stat.TransportCaceRoughnuisanceLength.legal_iv_mixture_full_elbow · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture.lean:38
CausalSmith.Stat.STAT_TransportCaceRoughnuisanceLength_Research.Helpers.LegalMixture.ArmHolder 9 declarations Finite summation identifies the receipt and outcome arm means in roadmap (10); the rational outcome mean is controlled using the overlap denominator.

Exact arm means of the primitive lower experiment

Finite summation identifies the receipt and outcome arm means in roadmap (10); the rational outcome mean is controlled using the overlap denominator.

theorem armMeanFrom_primitive_receipt_eq Lemma armMeanFrom_primitive_receipt_eq in the paper ↗

The primitive receipt arm mean is the baseline receipt probability. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
a u v x :
ℝ
ha :
a ≠ 0
z :
armMeanFrom (fun _ => primitiveMass a u v) false z x = receiptBase a z
Proof (Lean source)
-- @node: armMeanFrom_primitive_receipt_eq lemma armMeanFrom_primitive_receipt_eq (a u v x : ℝ) (ha : a ≠ 0) (z : Bool) : armMeanFrom (fun _ => primitiveMass a u v) false z x = receiptBase a z := by cases z <;> simp [armMeanFrom, primitiveMass, complierMargin, receiptBase, sign, boolReal] all_goals field_simp; ring
CausalSmith.Stat.TransportCaceRoughnuisanceLength.armMeanFrom_primitive_receipt_eq · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/ArmHolder.lean:15
theorem armMeanFrom_primitive_outcome_eq Lemma armMeanFrom_primitive_outcome_eq in the paper ↗

The exact outcome arm mean agrees with roadmap (10) on the overlap domain. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
a u v x :
ℝ
ha :
a ≠ 0
hu :
|u| ≤ 1 / 100
z :
armMeanFrom (fun _ => primitiveMass a u v) true z x = 1 / 2 + v / (1 + 2 * sign z * u)
Proof (Lean source)
-- @node: armMeanFrom_primitive_outcome_eq lemma armMeanFrom_primitive_outcome_eq (a u v x : ℝ) (ha : a ≠ 0) (hu : |u| ≤ 1 / 100) (z : Bool) : armMeanFrom (fun _ => primitiveMass a u v) true z x = 1 / 2 + v / (1 + 2 * sign z * u) := by have hul : -(1 / 100 : ℝ) ≤ u := (abs_le.mp hu).1 have huh : u ≤ 1 / 100 := (abs_le.mp hu).2 have hp : (1 / 2 : ℝ) + u ≠ 0 := by linarith have hm : (1 / 2 : ℝ) - u ≠ 0 := by linarith have hp' : (1 : ℝ) + 2 * u ≠ 0 := by linarith have hm' : (1 : ℝ) - 2 * u ≠ 0 := by linarith have hq : (1 / 4 : ℝ) - u ^ 2 ≠ 0 := by have : u ^ 2 ≤ (1 / 100 : ℝ) ^ 2 := by nlinarith [sq_nonneg (u + 1 / 100), sq_nonneg (u - 1 / 100)] linarith cases z <;> simp [armMeanFrom, primitiveMass, complierMargin, receiptBase, sign, boolReal, assignmentWeight] all_goals field_simp [ha, hp, hm, hp', hm', hq, show 1 - u ^ 2 * 4 ≠ 0 by nlinarith [sq_nonneg (u + 1 / 100), sq_nonneg (u - 1 / 100)], show 1 - u * 2 ≠ 0 by linarith, show 1 + u * 2 ≠ 0 by linarith] <;> ring_nf all_goals field_simp [show 1 - u ^ 2 * 4 ≠ 0 by nlinarith [sq_nonneg (u + 1 / 100), sq_nonneg (u - 1 / 100)], show 1 - u * 2 ≠ 0 by linarith, show 1 + u * 2 ≠ 0 by linarith] <;> ring
CausalSmith.Stat.TransportCaceRoughnuisanceLength.armMeanFrom_primitive_outcome_eq · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/ArmHolder.lean:23
theorem rational_arm_mean_abs_sub_le Lemma rational_arm_mean_abs_sub_le in the paper ↗

On the small-amplitude overlap domain the rational arm mean has Lipschitz constant two as a function of the tiled perturbation. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
u v τ :
ℝ
z :
hu :
|u| ≤ 1 / 100
hv :
|v| ≤ 1 / 100
hτ :
|τ| ≤ 1
|(1 / 2 + τ * u / (1 + 2 * sign z * u)) - (1 / 2 + τ * v / (1 + 2 * sign z * v))|
≤ 2 * |u - v|
Proof (Lean source)
-- @node: rational_arm_mean_abs_sub_le lemma rational_arm_mean_abs_sub_le (u v τ : ℝ) (z : Bool) (hu : |u| ≤ 1 / 100) (hv : |v| ≤ 1 / 100) (hτ : |τ| ≤ 1) : |(1 / 2 + τ * u / (1 + 2 * sign z * u)) - (1 / 2 + τ * v / (1 + 2 * sign z * v))| ≤ 2 * |u - v| := by have hs : |sign z| = 1 := by cases z <;> norm_num [sign] have hdu : (49 / 50 : ℝ) ≤ 1 + 2 * sign z * u := by have h := (abs_le.mp (show |sign z * u| ≤ 1 / 100 by simpa [abs_mul, hs] using hu)).1 linarith have hdv : (49 / 50 : ℝ) ≤ 1 + 2 * sign z * v := by have h := (abs_le.mp (show |sign z * v| ≤ 1 / 100 by simpa [abs_mul, hs] using hv)).1 linarith have hpu : 0 < 1 + 2 * sign z * u := by linarith have hpv : 0 < 1 + 2 * sign z * v := by linarith have hid : (1 / 2 + τ * u / (1 + 2 * sign z * u)) - (1 / 2 + τ * v / (1 + 2 * sign z * v)) = τ * (u - v) / ((1 + 2 * sign z * u) * (1 + 2 * sign z * v)) := by field_simp [ne_of_gt hpu, ne_of_gt hpv] <;> ring_nf field_simp [show 1 + u * sign z * 2 ≠ 0 by nlinarith [hpu]] <;> ring rw [hid, abs_div, abs_mul, abs_of_pos (mul_pos hpu hpv)] apply (div_le_iff₀ (mul_pos hpu hpv)).2 have hprod : (49 / 50 : ℝ) ^ 2 ≤ (1 + 2 * sign z * u) * (1 + 2 * sign z * v) := by simpa only [pow_two] using mul_le_mul hdu hdv (by norm_num) hpu.le have hnum : |τ| * |u - v| ≤ |u - v| := by simpa using mul_le_mul_of_nonneg_right hτ (abs_nonneg (u - v)) have hden : 1 ≤ 2 * ((1 + 2 * sign z * u) * (1 + 2 * sign z * v)) := by linarith have := mul_le_mul_of_nonneg_right hden (abs_nonneg (u - v)) nlinarith
CausalSmith.Stat.TransportCaceRoughnuisanceLength.rational_arm_mean_abs_sub_le · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/ArmHolder.lean:51
theorem rational_tiled_arm_mean_holderOn

The exact rational outcome arm mean has radius L under the amplitude ceiling used for roadmap (12). Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
cStar τ L :
ℝ
n :
ℕ
sgn :
z :
hc :
0 ≤ cStar
hsmall :
cStar ≤ 1 / 100
hcap :
cStar ≤ (L - 3 / 4) / (6 * pi)
hτ :
τ ∈ Icc (-1 : ℝ) 1
hn :
threshold ≤ n
hL :
1 < L
HolderOn (fun x => 1 / 2 + τ * tiledPerturbation cStar n sgn x / (1 + 2 * sign z * tiledPerturbation cStar n sgn x)) L
Proof (Lean source)
-- @node: rational_tiled_arm_mean_holderOn lemma rational_tiled_arm_mean_holderOn (cStar τ L : ℝ) (n : ℕ) (sgn : Fin (lowerCells n) → Bool) (z : Bool) (hc : 0 ≤ cStar) (hsmall : cStar ≤ 1 / 100) (hcap : cStar ≤ (L - 3 / 4) / (6 * pi)) (hτ : τ ∈ Icc (-1 : ℝ) 1) (hn : threshold ≤ n) (hL : 1 < L) : HolderOn (fun x => 1 / 2 + τ * tiledPerturbation cStar n sgn x / (1 + 2 * sign z * tiledPerturbation cStar n sgn x)) L := by have hnpos : 0 < n := by have : 256 ≤ n := hn; omega have hu (x : ℝ) : |tiledPerturbation cStar n sgn x| ≤ 1 / 100 := (tiledPerturbation_abs_le_lowerHeight cStar n sgn x hc).trans ((lowerHeight_le_amplitude cStar n hc hn).trans hsmall) have ht : |τ| ≤ 1 := abs_le.mpr hτ have hs : |sign z| = 1 := by cases z <;> norm_num [sign] have hd (x : ℝ) : 0 < 1 + 2 * sign z * tiledPerturbation cStar n sgn x := by have h := (abs_le.mp (show |sign z * tiledPerturbation cStar n sgn x| ≤ 1 / 100 by simpa [abs_mul, hs] using hu x)).1 linarith have hcL : 2 * (cStar * (1 + 2 * pi)) ≤ L := by have hb := (le_div_iff₀ (by positivity : 0 < 6 * pi)).mp hcap have hp : 2 * (1 + 2 * pi) ≤ 6 * pi := by linarith [Real.two_le_pi] have := mul_le_mul_of_nonneg_left hp hc nlinarith apply holderOn_of_bound_modulus _ L hL · have hcont := tiledPerturbation_continuousOn cStar n sgn hc hnpos exact continuousOn_const.add ((continuousOn_const.mul hcont).div (continuousOn_const.add (continuousOn_const.mul hcont)) (fun x _ => ne_of_gt (hd x))) · intro x hx have hb := rational_arm_mean_abs_sub_le (tiledPerturbation cStar n sgn x) 0 τ z (hu x) (by norm_num) ht simp only [mul_zero, zero_div, add_zero, sub_zero] at hb calc |1 / 2 + τ * tiledPerturbation cStar n sgn x / (1 + 2 * sign z * tiledPerturbation cStar n sgn x)| ≤ |(1 / 2 + τ * tiledPerturbation cStar n sgn x / (1 + 2 * sign z * tiledPerturbation cStar n sgn x)) - 1 / 2| + |(1 / 2 : ℝ)| := by have hh := abs_add_le ((1 / 2 + τ * tiledPerturbation cStar n sgn x / (1 + 2 * sign z * tiledPerturbation cStar n sgn x)) - 1 / 2) (1 / 2) simpa only [sub_add_cancel] using hh _ ≤ 2 * |tiledPerturbation cStar n sgn x| + 1 / 2 := by simpa only [abs_of_pos (by norm_num : (0 : ℝ) < 1 / 2), add_comm] using add_le_add_right hb |(1 / 2 : ℝ)| _ ≤ L := by linarith [hu x] · intro x hx y hy exact (rational_arm_mean_abs_sub_le _ _ τ z (hu x) (hu y) ht).trans ((mul_le_mul_of_nonneg_left (tiledPerturbation_holder_modulus cStar n sgn hc hnpos x y hx hy) (by norm_num : (0 : ℝ) ≤ 2)).trans (by simpa only [mul_assoc] using mul_le_mul_of_nonneg_right hcL (Real.rpow_nonneg (abs_nonneg (x - y)) holderExponent)))
CausalSmith.Stat.TransportCaceRoughnuisanceLength.rational_tiled_arm_mean_holderOn · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/ArmHolder.lean:85
theorem legalIVComponent_arm_means_holder

All four primitive arm means satisfy the Hölder clause of model membership, using the exact finite-sum formulas rather than contrasts alone. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
a cStar τ L :
ℝ
n :
ℕ
sgn :
ha :
0 < a ∧ a ≤ 1 / 4
hc :
0 ≤ cStar
hsmall :
cStar ≤ 1 / 100
hcap :
cStar ≤ (L - 3 / 4) / (6 * pi)
hτ :
τ ∈ Icc (-1 : ℝ) 1
hn :
threshold ≤ n
hL :
1 < L
A z :
HolderOn ((legalIVComponent a n cStar τ sgn).m A z) L
Proof (Lean source)
-- @node: legalIVComponent_arm_means_holder lemma legalIVComponent_arm_means_holder (a cStar τ L : ℝ) (n : ℕ) (sgn : Fin (lowerCells n) → Bool) (ha : 0 < a ∧ a ≤ 1 / 4) (hc : 0 ≤ cStar) (hsmall : cStar ≤ 1 / 100) (hcap : cStar ≤ (L - 3 / 4) / (6 * pi)) (hτ : τ ∈ Icc (-1 : ℝ) 1) (hn : threshold ≤ n) (hL : 1 < L) : ∀ A z, HolderOn ((legalIVComponent a n cStar τ sgn).m A z) L := by have hb := actualStrength_bounds a n hn ha have hu (x : ℝ) : |tiledPerturbation cStar n sgn x| ≤ 1 / 100 := (tiledPerturbation_abs_le_lowerHeight cStar n sgn x hc).trans ((lowerHeight_le_amplitude cStar n hc hn).trans hsmall) intro A z cases A · have hm : (legalIVComponent a n cStar τ sgn).m false z = fun _ => receiptBase (actualStrength a n) z := by funext x exact armMeanFrom_primitive_receipt_eq _ _ _ x (ne_of_gt hb.1) z rw [hm] apply const_holderOn _ L hL cases z <;> simp [receiptBase, sign] <;> rw [abs_of_nonneg (by linarith)] <;> linarith [hb.2] · have hm : (legalIVComponent a n cStar τ sgn).m true z = fun x => 1 / 2 + τ * tiledPerturbation cStar n sgn x / (1 + 2 * sign z * tiledPerturbation cStar n sgn x) := by funext x exact armMeanFrom_primitive_outcome_eq _ _ _ x (ne_of_gt hb.1) (hu x) z rw [hm] exact rational_tiled_arm_mean_holderOn cStar τ L n sgn z hc hsmall hcap hτ hn hL
CausalSmith.Stat.TransportCaceRoughnuisanceLength.legalIVComponent_arm_means_holder · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/ArmHolder.lean:139
theorem mixtureCenter_arm_means_holder

The center's four arm means belong to the same Hölder ball. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
a L :
ℝ
n :
ℕ
ha :
0 < a ∧ a ≤ 1 / 4
hn :
threshold ≤ n
hL :
1 < L
A z :
HolderOn ((mixtureCenter a n).m A z) L
Proof (Lean source)
-- @node: mixtureCenter_arm_means_holder lemma mixtureCenter_arm_means_holder (a L : ℝ) (n : ℕ) (ha : 0 < a ∧ a ≤ 1 / 4) (hn : threshold ≤ n) (hL : 1 < L) : ∀ A z, HolderOn ((mixtureCenter a n).m A z) L := by have hb := actualStrength_bounds a n hn ha intro A z cases A · have hm : (mixtureCenter a n).m false z = fun _ => receiptBase (actualStrength a n) z := by funext x exact armMeanFrom_primitive_receipt_eq _ 0 0 x (ne_of_gt hb.1) z rw [hm] apply const_holderOn _ L hL cases z <;> simp [receiptBase, sign] <;> rw [abs_of_nonneg (by linarith)] <;> linarith [hb.2] · have hm : (mixtureCenter a n).m true z = fun _ => (1 / 2 : ℝ) := by funext x simpa only [mixtureCenter, lawFromMass, zero_div, add_zero] using armMeanFrom_primitive_outcome_eq (actualStrength a n) 0 0 x (ne_of_gt hb.1) (by norm_num) z rw [hm] exact const_holderOn (1 / 2) L hL (by norm_num; linarith)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.mixtureCenter_arm_means_holder · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/ArmHolder.lean:170
theorem armMeanFrom_measurable_of Lemma armMeanFrom_measurable_of in the paper ↗

Coordinatewise measurability of primitive masses implies measurable arm means. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
mass :
ℝ → Bool → Bool → Bool → Bool → ℝ
hm :
∀ d0 d1 y0 y1, Measurable fun x => mass x d0 d1 y0 y1
A z :
Proof (Lean source)
-- @node: armMeanFrom_measurable_of @[fun_prop] lemma armMeanFrom_measurable_of (mass : ℝ → Bool → Bool → Bool → Bool → ℝ) (hm : ∀ d0 d1 y0 y1, Measurable fun x => mass x d0 d1 y0 y1) (A z : Bool) : Measurable (armMeanFrom mass A z) := by unfold armMeanFrom fun_prop
CausalSmith.Stat.TransportCaceRoughnuisanceLength.armMeanFrom_measurable_of · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/ArmHolder.lean:191
theorem legalIVComponent_arm_means_regular

All four component arm means are measurable and lie in the unit interval. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
a cStar τ :
ℝ
n :
ℕ
sgn :
ha :
0 < a ∧ a ≤ 1 / 4
hc :
0 ≤ cStar
hsmall :
cStar ≤ 1 / 100
hτ :
τ ∈ Icc (-1 : ℝ) 1
hn :
threshold ≤ n
A z :
conclusion 1
MeasurableSet covariateSpace
conclusion 2
Measurable (indicator covariateSpace ((legalIVComponent a n cStar τ sgn).m A z))
conclusion 3
x ∈ covariateSpace :
(legalIVComponent a n cStar τ sgn).m A z x ∈ Icc (0 : ℝ) 1
Proof (Lean source)
-- @node: legalIVComponent_arm_means_regular lemma legalIVComponent_arm_means_regular (a cStar τ : ℝ) (n : ℕ) (sgn : Fin (lowerCells n) → Bool) (ha : 0 < a ∧ a ≤ 1 / 4) (hc : 0 ≤ cStar) (hsmall : cStar ≤ 1 / 100) (hτ : τ ∈ Icc (-1 : ℝ) 1) (hn : threshold ≤ n) : ∀ A z, MeasurableSet covariateSpace ∧ Measurable (indicator covariateSpace ((legalIVComponent a n cStar τ sgn).m A z)) ∧ ∀ x ∈ covariateSpace, (legalIVComponent a n cStar τ sgn).m A z x ∈ Icc (0 : ℝ) 1 := by have hb := actualStrength_bounds a n hn ha have hu (x : ℝ) : |tiledPerturbation cStar n sgn x| ≤ 1 / 100 := (tiledPerturbation_abs_le_lowerHeight cStar n sgn x hc).trans ((lowerHeight_le_amplitude cStar n hc hn).trans hsmall) intro A z have hm : Measurable ((legalIVComponent a n cStar τ sgn).m A z) := by change Measurable (armMeanFrom (lowerMass a n cStar τ sgn) A z) exact armMeanFrom_measurable_of _ (lowerMass_measurable a n cStar τ sgn) A z refine ⟨measurableSet_Icc, hm.indicator measurableSet_Icc, ?_⟩ intro x hx cases A · change armMeanFrom (lowerMass a n cStar τ sgn) false z x ∈ _ rw [show armMeanFrom (lowerMass a n cStar τ sgn) false z x = receiptBase (actualStrength a n) z from armMeanFrom_primitive_receipt_eq _ _ _ x (ne_of_gt hb.1) z] cases z <;> simp [receiptBase, sign, mem_Icc] <;> constructor <;> linarith [hb.2] · change armMeanFrom (lowerMass a n cStar τ sgn) true z x ∈ _ rw [show armMeanFrom (lowerMass a n cStar τ sgn) true z x = 1 / 2 + τ * tiledPerturbation cStar n sgn x / (1 + 2 * sign z * tiledPerturbation cStar n sgn x) from armMeanFrom_primitive_outcome_eq _ _ _ x (ne_of_gt hb.1) (hu x) z] have hdiff := rational_arm_mean_abs_sub_le (tiledPerturbation cStar n sgn x) 0 τ z (hu x) (by norm_num) (abs_le.mpr hτ) simp only [mul_zero, zero_div, add_zero, sub_zero] at hdiff have hdiff' := abs_le.mp hdiff constructor <;> linarith [hu x]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.legalIVComponent_arm_means_regular · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/ArmHolder.lean:200
theorem mixtureCenter_arm_means_regular

The center's constant arm means are measurable and lie in the unit interval. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
a :
ℝ
n :
ℕ
ha :
0 < a ∧ a ≤ 1 / 4
hn :
threshold ≤ n
A z :
conclusion 1
MeasurableSet covariateSpace
conclusion 2
Measurable (indicator covariateSpace ((mixtureCenter a n).m A z))
conclusion 3
x ∈ covariateSpace :
(mixtureCenter a n).m A z x ∈ Icc (0 : ℝ) 1
Proof (Lean source)
-- @node: mixtureCenter_arm_means_regular lemma mixtureCenter_arm_means_regular (a : ℝ) (n : ℕ) (ha : 0 < a ∧ a ≤ 1 / 4) (hn : threshold ≤ n) : ∀ A z, MeasurableSet covariateSpace ∧ Measurable (indicator covariateSpace ((mixtureCenter a n).m A z)) ∧ ∀ x ∈ covariateSpace, (mixtureCenter a n).m A z x ∈ Icc (0 : ℝ) 1 := by have hb := actualStrength_bounds a n hn ha intro A z have hm : Measurable ((mixtureCenter a n).m A z) := by change Measurable (armMeanFrom (fun _ => primitiveMass (actualStrength a n) 0 0) A z) fun_prop refine ⟨measurableSet_Icc, hm.indicator measurableSet_Icc, ?_⟩ intro x hx cases A · change armMeanFrom (fun _ => primitiveMass (actualStrength a n) 0 0) false z x ∈ _ rw [armMeanFrom_primitive_receipt_eq _ 0 0 x (ne_of_gt hb.1) z] cases z <;> simp [receiptBase, sign, mem_Icc] <;> constructor <;> linarith [hb.2] · change armMeanFrom (fun _ => primitiveMass (actualStrength a n) 0 0) true z x ∈ _ rw [armMeanFrom_primitive_outcome_eq _ 0 0 x (ne_of_gt hb.1) (by norm_num) z] norm_num
CausalSmith.Stat.TransportCaceRoughnuisanceLength.mixtureCenter_arm_means_regular · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/ArmHolder.lean:236
CausalSmith.Stat.STAT_TransportCaceRoughnuisanceLength_Research.Helpers.LegalMixture.Assembly 14 declarations Legal-mixture two-channel assembly

Legal-mixture two-channel assembly

def covariateCenter_isProbability

The covariate center is probability object is defined without additional inputs.

Definition (Lean source)
covariateCenter_isProbability :
by apply isProbabilityMeasure_iff.mpr simp [covariateSpace]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.covariateCenter_isProbability · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/Assembly.lean:12
def lowerExplicitSource_isProbability

The lower explicit source is probability object is defined from the supplied inputs.

Definition (Lean source)
a :
ℝ
n :
ℕ
cStar τ :
ℝ
sgn :
hb :
0 < actualStrength a n ∧ actualStrength a n ≤ 1 / 4
hAdm :
LowerAdmissible n a cStar
hτ :
τ ∈ Icc (-1 : ℝ) 1
lowerExplicitSource_isProbability a n cStar τ sgn hb hAdm hτ :
CausalSmith.Stat.TransportCaceRoughnuisanceLength.lowerExplicitSource_isProbability · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/Assembly.lean:18
def lowerTargetDensity_isProbability

The lower target density is probability object is defined from the supplied inputs.

Definition (Lean source)
a :
ℝ
shared
cStar :
ℝ
n :
ℕ
sgn :
hn :
0 < n
hAdm :
LowerAdmissible n a cStar
lowerTargetDensity_isProbability cStar n sgn hn hAdm :
IsProbabilityMeasure ((volume.restrict covariateSpace).withDensity (fun x => ofReal (1 + tiledPerturbation cStar n sgn x)))
by apply isProbabilityMeasure_iff.mpr apply targetDensity_univ cStar n sgn hn intro x have hu := tiledPerturbation_abs_le_lowerHeight cStar n sgn x hAdm.1.le have hu' : |tiledPerturbation cStar n sgn x|
≤ 3 / 16 := le_trans hu hAdm.2.1 linarith [neg_abs_le (tiledPerturbation cStar n sgn x)]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.lowerTargetDensity_isProbability · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/Assembly.lean:32
theorem legal_dataLaw_eq_product

Given the supplied inputs, the stated result about legal data law eq product holds.

Formal statement
a :
ℝ
n :
ℕ
cStar τ :
ℝ
sgn :
hb :
0 < actualStrength a n ∧ actualStrength a n ≤ 1 / 4
hAdm :
LowerAdmissible n a cStar
hτ :
τ ∈ Icc (-1 : ℝ) 1
hn :
0 < n
dataLaw (legalIVComponent a n cStar τ sgn) n n
= (Measure.pi (fun _ : Fin n => explicitSourceLaw (actualStrength a n) (tiledPerturbation cStar n sgn) (fun x => τ * tiledPerturbation cStar n sgn x))).prod (Measure.pi (fun _ : Fin n => (volume.restrict covariateSpace).withDensity (fun x => ofReal (1 + tiledPerturbation cStar n sgn x))))
Proof (Lean source)
lemma legal_dataLaw_eq_product (a : ℝ) (n : ℕ) (cStar τ : ℝ) (sgn : Fin (lowerCells n) → Bool) (hb : 0 < actualStrength a n ∧ actualStrength a n ≤ 1 / 4) (hAdm : LowerAdmissible n a cStar) (hτ : τ ∈ Icc (-1 : ℝ) 1) (hn : 0 < n) : dataLaw (legalIVComponent a n cStar τ sgn) n n = (Measure.pi (fun _ : Fin n => explicitSourceLaw (actualStrength a n) (tiledPerturbation cStar n sgn) (fun x => τ * tiledPerturbation cStar n sgn x))).prod (Measure.pi (fun _ : Fin n => (volume.restrict covariateSpace).withDensity (fun x => ofReal (1 + tiledPerturbation cStar n sgn x)))) := by unfold dataLaw legalIVComponent lawFromMass dsimp rw [lowerSourceLaw_eq_explicit a n cStar τ sgn hb hAdm hτ, legalTargetLaw_eq_density a n cStar τ sgn hb hAdm hτ hn] rfl
CausalSmith.Stat.TransportCaceRoughnuisanceLength.legal_dataLaw_eq_product · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/Assembly.lean:46
theorem center_dataLaw_eq_product

Given the supplied inputs, the stated result about center data law eq product holds.

Formal statement
a :
ℝ
n :
ℕ
hb :
0 < actualStrength a n ∧ actualStrength a n ≤ 1 / 4
= (Measure.pi (fun _ : Fin n => explicitSourceLaw (actualStrength a n) (fun _ => 0) (fun _ => 0))).prod (Measure.pi (fun _ : Fin n => volume.restrict covariateSpace))
Proof (Lean source)
lemma center_dataLaw_eq_product (a : ℝ) (n : ℕ) (hb : 0 < actualStrength a n ∧ actualStrength a n ≤ 1 / 4) : dataLaw (mixtureCenter a n) n n = (Measure.pi (fun _ : Fin n => explicitSourceLaw (actualStrength a n) (fun _ => 0) (fun _ => 0))).prod (Measure.pi (fun _ : Fin n => volume.restrict covariateSpace)) := by unfold dataLaw mixtureCenter lawFromMass dsimp rw [centerSourceLaw_eq_explicit a n hb, centerTargetLaw_eq_volume a n hb]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.center_dataLaw_eq_product · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/Assembly.lean:66
theorem lowerMixture_eq_uniformMixture

Given the supplied inputs, the stated result about lower mixture eq uniform mixture holds.

Formal statement
a :
ℝ
n :
ℕ
cStar τ :
ℝ
hb :
0 < actualStrength a n ∧ actualStrength a n ≤ 1 / 4
hAdm :
LowerAdmissible n a cStar
hτ :
τ ∈ Icc (-1 : ℝ) 1
hn :
0 < n
lowerMixture a n cStar τ
= uniformMixture (fun sgn : Fin (lowerCells n) → Bool => (Measure.pi (fun _ : Fin n => explicitSourceLaw (actualStrength a n) (tiledPerturbation cStar n sgn) (fun x => τ * tiledPerturbation cStar n sgn x))).prod (Measure.pi (fun _ : Fin n => (volume.restrict covariateSpace).withDensity (fun x => ofReal (1 + tiledPerturbation cStar n sgn x)))))
Proof (Lean source)
lemma lowerMixture_eq_uniformMixture (a : ℝ) (n : ℕ) (cStar τ : ℝ) (hb : 0 < actualStrength a n ∧ actualStrength a n ≤ 1 / 4) (hAdm : LowerAdmissible n a cStar) (hτ : τ ∈ Icc (-1 : ℝ) 1) (hn : 0 < n) : lowerMixture a n cStar τ = uniformMixture (fun sgn : Fin (lowerCells n) → Bool => (Measure.pi (fun _ : Fin n => explicitSourceLaw (actualStrength a n) (tiledPerturbation cStar n sgn) (fun x => τ * tiledPerturbation cStar n sgn x))).prod (Measure.pi (fun _ : Fin n => (volume.restrict covariateSpace).withDensity (fun x => ofReal (1 + tiledPerturbation cStar n sgn x))))) := by classical unfold lowerMixture uniformMixture mixture simp_rw [legal_dataLaw_eq_product a n cStar τ _ hb hAdm hτ hn] rw [Finset.smul_sum] simp [Fintype.card_fun, Fintype.card_fin]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.lowerMixture_eq_uniformMixture · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/Assembly.lean:78
theorem uniformMixture_finite_chiSquare Lemma uniformMixture_finite_chiSquare in the paper ↗

Finite mixtures inherit domination and square-integrable density deviations from their integrable pairwise density products. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
Ω S :
Type*
Nonempty S
Q :
S → Measure Ω
hac :
∀ s, Q s ≪ P
hpair :
∀ s t, Integrable (fun x => ((Q s).rnDeriv P x).toReal * ((Q t).rnDeriv P x).toReal) P
conclusion 1
(uniformMixture Q) ≪ P
conclusion 2
Integrable (fun x => (((uniformMixture Q).rnDeriv P x).toReal - 1) ^ 2) P
Proof (Lean source)
-- @node: uniformMixture_finite_chiSquare lemma uniformMixture_finite_chiSquare {Ω S : Type*} [MeasurableSpace Ω] [Fintype S] [Nonempty S] (Q : S → Measure Ω) (P : Measure Ω) [IsProbabilityMeasure P] [∀ s, IsProbabilityMeasure (Q s)] (hac : ∀ s, Q s ≪ P) (hpair : ∀ s t, Integrable (fun x => ((Q s).rnDeriv P x).toReal * ((Q t).rnDeriv P x).toReal) P) : (uniformMixture Q) ≪ P ∧ Integrable (fun x => (((uniformMixture Q).rnDeriv P x).toReal - 1) ^ 2) P := by classical let M := uniformMixture Q let d (s : S) (x : Ω) : ℝ := ((Q s).rnDeriv P x).toReal let p (x : Ω) : ℝ := (M.rnDeriv P x).toReal let card : ℝ := Fintype.card S letI : IsProbabilityMeasure M := Causalean.Stat.Minimax.Mixture.uniformMixture_isProbability Q have hdouble : Integrable (fun x => ∑ s : S, ∑ t : S, d s x * d t x) P := by exact integrable_finsetSum univ (fun s _ => integrable_finsetSum univ (fun t _ => hpair s t)) have hpoint : ∀ᵐ x ∂P, p x ^ 2 = (∑ s : S, ∑ t : S, d s x * d t x) / card ^ 2 := by filter_upwards [uniformMixture_rnDeriv Q P] with x hx change p x = (∑ s : S, d s x) / card at hx rw [hx, div_pow, sq, Finset.sum_mul_sum] have hsq : Integrable (fun x => p x ^ 2) P := (hdouble.div_const (card ^ 2)).congr (hpoint.mono fun x hx => hx.symm) have hp : Integrable p P := Measure.integrable_toReal_rnDeriv have hdev : Integrable (fun x => (p x - 1) ^ 2) P := by have heq : (fun x => (p x - 1) ^ 2) = (fun x => p x ^ 2 - 2 * p x + 1) := by funext x ring rw [heq] exact (hsq.sub (hp.const_mul 2)).add (integrable_const 1) exact ⟨Causalean.Stat.Minimax.Mixture.uniformMixture_absolutelyContinuous Q P hac, hdev⟩
CausalSmith.Stat.TransportCaceRoughnuisanceLength.uniformMixture_finite_chiSquare · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/Assembly.lean:102
theorem tv_uniformMixture_le_half_sqrt

Given the supplied inputs, the stated result about tv uniform mixture le half sqrt holds.

Formal statement
Ω S :
Type*
Nonempty S
Q :
S → Measure Ω
hac :
∀ s, Q s ≪ P
hpair :
∀ s t, Integrable (fun x => ((Q s).rnDeriv P x).toReal * ((Q t).rnDeriv P x).toReal) P
≤ (1 / 2) * sqrt (chiSqDiv (uniformMixture Q) P)
Proof (Lean source)
lemma tv_uniformMixture_le_half_sqrt {Ω S : Type*} [MeasurableSpace Ω] [Fintype S] [Nonempty S] (Q : S → Measure Ω) (P : Measure Ω) [IsProbabilityMeasure P] [∀ s, IsProbabilityMeasure (Q s)] (hac : ∀ s, Q s ≪ P) (hpair : ∀ s t, Integrable (fun x => ((Q s).rnDeriv P x).toReal * ((Q t).rnDeriv P x).toReal) P) : tvDist (uniformMixture Q) P ≤ (1 / 2) * sqrt (chiSqDiv (uniformMixture Q) P) := by letI := uniformMixture_isProbability Q have h := uniformMixture_finite_chiSquare Q P hac hpair exact tvDist_le_half_sqrt_chiSqDiv _ P h.1 h.2
CausalSmith.Stat.TransportCaceRoughnuisanceLength.tv_uniformMixture_le_half_sqrt · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/Assembly.lean:145
theorem sourceOverlapCoefficient_le

Given the supplied inputs, the stated result about source overlap coefficient le holds.

Formal statement
b τ :
ℝ
hb :
0 ≤ b ∧ b ≤ 1 / 4
hτ :
τ ∈ Icc (-1 : ℝ) 1
conclusion 1
conclusion 2
sourceOverlapCoefficient b τ + 1 ≤ 139 / 15
Proof (Lean source)
lemma sourceOverlapCoefficient_le (b τ : ℝ) (hb : 0 ≤ b ∧ b ≤ 1 / 4) (hτ : τ ∈ Icc (-1 : ℝ) 1) : 0 ≤ sourceOverlapCoefficient b τ ∧ sourceOverlapCoefficient b τ + 1 ≤ 139 / 15 := by have hbden : (15 / 16 : ℝ) ≤ 1 - b ^ 2 := by nlinarith [sq_nonneg b] have hbden0 : 0 < 1 - b ^ 2 := lt_of_lt_of_le (by norm_num) hbden have hτsq : τ ^ 2 ≤ 1 := by nlinarith [hτ.1, hτ.2] have hfrac : τ ^ 2 / (1 - b ^ 2) ≤ 16 / 15 := by apply (div_le_iff₀ hbden0).2 nlinarith [sq_nonneg τ] unfold sourceOverlapCoefficient constructor · positivity · calc 4 + 4 * τ ^ 2 / (1 - b ^ 2) + 1 = 4 + 4 * (τ ^ 2 / (1 - b ^ 2)) + 1 := by ring _ ≤ 4 + 4 * (16 / 15 : ℝ) + 1 := by gcongr _ = 139 / 15 := by norm_num
CausalSmith.Stat.TransportCaceRoughnuisanceLength.sourceOverlapCoefficient_le · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/Assembly.lean:161
theorem sample_height_exponent_bound

Given the supplied inputs, the stated result about sample height exponent bound holds.

Formal statement
n K :
ℕ
cStar G :
ℝ
hn :
0 < n
hK :
0 < K
hbase :
(n : ℝ) ^ ((4 : ℝ) / 3) ≤ K
hG0 :
0 ≤ G
hG :
G ≤ 139 / 15
((((n : ℝ) * (G * (cStar * (K : ℝ) ^ (-(1 / 8 : ℝ))) ^ 2 / 2)) ^ 2) / (2 * (K : ℝ)))
≤ mixConstant * cStar ^ 4
Proof (Lean source)
lemma sample_height_exponent_bound (n K : ℕ) (cStar G : ℝ) (hn : 0 < n) (hK : 0 < K) (hbase : (n : ℝ) ^ ((4 : ℝ) / 3) ≤ K) (hG0 : 0 ≤ G) (hG : G ≤ 139 / 15) : ((((n : ℝ) * (G * (cStar * (K : ℝ) ^ (-(1 / 8 : ℝ))) ^ 2 / 2)) ^ 2) / (2 * (K : ℝ))) ≤ mixConstant * cStar ^ 4 := by have hnR : (0 : ℝ) < n := by exact_mod_cast hn have hKR : (0 : ℝ) < K := by exact_mod_cast hK have hpow : (n : ℝ) ^ 2 ≤ (K : ℝ) ^ ((3 : ℝ) / 2) := by have h := Real.rpow_le_rpow (by positivity : 0 ≤ (n : ℝ) ^ ((4 : ℝ) / 3)) hbase (by norm_num : (0 : ℝ) ≤ 3 / 2) rw [← Real.rpow_mul hnR.le] at h norm_num at h ⊢ simpa [Real.rpow_natCast] using h have hGsq : G ^ 2 ≤ (139 / 15 : ℝ) ^ 2 := by nlinarith have hscale : (K : ℝ) ^ ((3 : ℝ) / 2) * ((K : ℝ) ^ (-(1 / 8 : ℝ))) ^ 4 / (K : ℝ) = 1 := by rw [← Real.rpow_mul_natCast hKR.le] norm_num rw [← Real.rpow_add hKR] norm_num exact Nat.ne_of_gt hK unfold mixConstant have hc4 : 0 ≤ cStar ^ 4 := by positivity have hkfac : 0 ≤ ((K : ℝ) ^ (-(1 / 8 : ℝ))) ^ 4 := by positivity have hmul := mul_le_mul hpow hGsq (sq_nonneg G) (by positivity : 0 ≤ (K : ℝ) ^ ((3 : ℝ) / 2)) calc ((n : ℝ) * (G * (cStar * (K : ℝ) ^ (-(1 / 8 : ℝ))) ^ 2 / 2)) ^ 2 / (2 * (K : ℝ)) = ((n : ℝ) ^ 2 * G ^ 2 * cStar ^ 4 * ((K : ℝ) ^ (-(1 / 8 : ℝ))) ^ 4) / (8 * (K : ℝ)) := by ring _ ≤ (((K : ℝ) ^ ((3 : ℝ) / 2)) * (139 / 15 : ℝ) ^ 2 * cStar ^ 4 * ((K : ℝ) ^ (-(1 / 8 : ℝ))) ^ 4) / (8 * (K : ℝ)) := by gcongr _ = (19321 / 1800 : ℝ) * cStar ^ 4 := by rw [show ((K : ℝ) ^ ((3 : ℝ) / 2) * (139 / 15 : ℝ) ^ 2 * cStar ^ 4 * ((K : ℝ) ^ (-(1 / 8 : ℝ))) ^ 4) / (8 * (K : ℝ)) = ((139 / 15 : ℝ) ^ 2 / 8) * cStar ^ 4 * (((K : ℝ) ^ ((3 : ℝ) / 2) * ((K : ℝ) ^ (-(1 / 8 : ℝ))) ^ 4) / K) by ring] rw [hscale] norm_num
CausalSmith.Stat.TransportCaceRoughnuisanceLength.sample_height_exponent_bound · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/Assembly.lean:182
theorem legal_twoChannel_exp_bound

Given the supplied inputs, the stated result about legal two channel exp bound holds.

Formal statement
a :
ℝ
n :
ℕ
cStar τ :
ℝ
hτ :
τ ∈ Icc (-1 : ℝ) 1
hn :
threshold ≤ n
ha :
0 < a ∧ a ≤ 1 / 4
hc :
0 < cStar ∧ cStar ≤ 1 / 100
1 + chiSqDiv (lowerMixture a n cStar τ) (dataLaw (mixtureCenter a n) n n)
≤ exp ((((n : ℝ) * (sourceOverlapCoefficient (actualStrength a n) τ * lowerHeight cStar n ^ 2 / 2) + (n : ℝ) * (lowerHeight cStar n ^ 2 / 2)) ^ 2) / (2 * (lowerCells n : ℝ)))
Proof (Lean source)
lemma legal_twoChannel_exp_bound (a : ℝ) (n : ℕ) (cStar τ : ℝ) (hτ : τ ∈ Icc (-1 : ℝ) 1) (hn : threshold ≤ n) (ha : 0 < a ∧ a ≤ 1 / 4) (hc : 0 < cStar ∧ cStar ≤ 1 / 100) : 1 + chiSqDiv (lowerMixture a n cStar τ) (dataLaw (mixtureCenter a n) n n) ≤ exp ((((n : ℝ) * (sourceOverlapCoefficient (actualStrength a n) τ * lowerHeight cStar n ^ 2 / 2) + (n : ℝ) * (lowerHeight cStar n ^ 2 / 2)) ^ 2) / (2 * (lowerCells n : ℝ))) := by let K := lowerCells n let a0 := actualStrength a n let μ1 := explicitSourceLaw a0 (fun _ => 0) (fun _ => 0) let μ2 := volume.restrict covariateSpace let Q1 : (Fin K → Bool) → Measure SourceObs := fun s => explicitSourceLaw a0 (tiledPerturbation cStar n s) (fun x => τ * tiledPerturbation cStar n s x) let Q2 : (Fin K → Bool) → Measure ℝ := fun s => μ2.withDensity (fun x => ofReal (1 + tiledPerturbation cStar n s x)) let L1 : (Fin K → Bool) → SourceObs → ℝ := fun s => sourceObsLikelihood a0 τ (tiledPerturbation cStar n s) let L2 : (Fin K → Bool) → ℝ → ℝ := fun s x => 1 + tiledPerturbation cStar n s x have hb := actualStrength_bounds a n hn ha have ha0 : 0 < a0 ∧ a0 < 1 := ⟨hb.1, lt_of_le_of_lt hb.2 (by norm_num)⟩ have hAdm := lower_admissible_of_small_amplitude n a cStar hn ha hc have hn0 : 0 < n := by have : 256 ≤ n := hn; omega have hK : 0 < K := by unfold K lowerCells exact Nat.ceil_pos.mpr (by positivity) letI : NeZero K := ⟨Nat.ne_of_gt hK⟩ letI : IsProbabilityMeasure μ1 := explicitCenterSourceLaw_isProbability a0 ha0 letI : IsProbabilityMeasure μ2 := covariateCenter_isProbability letI : ∀ s, IsProbabilityMeasure (Q1 s) := fun s => lowerExplicitSource_isProbability a n cStar τ s hb hAdm hτ letI : ∀ s, IsProbabilityMeasure (Q2 s) := fun s => lowerTargetDensity_isProbability cStar n s hn0 hAdm have hL1 (s : Fin K → Bool) : Measurable (L1 s) := sourceObsLikelihood_measurable a0 τ _ (tiledPerturbation_measurable cStar n s) have hL2 (s : Fin K → Bool) : Measurable (L2 s) := measurable_const.add (tiledPerturbation_measurable cStar n s) have hL10 (s : Fin K → Bool) (o : SourceObs) : 0 ≤ L1 s o := lowerSourceLikelihood_nonneg a n cStar τ s hb hAdm hτ o have hL20 (s : Fin K → Bool) (x : ℝ) : 0 ≤ L2 s x := by have hu := tiledPerturbation_abs_le_lowerHeight cStar n s x hAdm.1.le have hu' : |tiledPerturbation cStar n s x| ≤ 3 / 16 := le_trans hu hAdm.2.1 linarith [neg_abs_le (tiledPerturbation cStar n s x)] have hQ1 (s : Fin K → Bool) : Q1 s = μ1.withDensity (fun o => ofReal (L1 s o)) := by exact explicitSourceLaw_eq_withDensity a0 τ (tiledPerturbation cStar n s) ha0 (tiledPerturbation_measurable cStar n s) have hQ2 (s : Fin K → Bool) : Q2 s = μ2.withDensity (fun x => ofReal (L2 s x)) := rfl have hInt1 (s t : Fin K → Bool) : Integrable (fun o => L1 s o * L1 t o) μ1 := sourceLikelihood_pair_integrable a0 τ cStar n s t ha0 have hInt2 (s t : Fin K → Bool) : Integrable (fun x => L2 s x * L2 t x) μ2 := targetLikelihood_pair_integrable cStar n s t hn0 have hPair1 (s t : Fin K → Bool) : (∫ o, L1 s o * L1 t o ∂μ1) = 1 + (sourceOverlapCoefficient a0 τ * lowerHeight cStar n ^ 2 / 2) * innerSign s t / (K : ℝ) := sourceLikelihood_pair_integral a0 τ cStar n s t ha0 (hL10 s) (hL10 t) hn0 have hPair2 (s t : Fin K → Bool) : (∫ x, L2 s x * L2 t x ∂μ2) = 1 + (lowerHeight cStar n ^ 2 / 2) * innerSign s t / (K : ℝ) := targetLikelihood_pair_integral cStar n s t hn0 have hmain := one_add_chiSqDiv_uniformMixture_twoChannel_sign_le_exp K n n μ1 μ2 Q1 Q2 L1 L2 hL1 hL2 hL10 hL20 hQ1 hQ2 hInt1 hInt2 (sourceOverlapCoefficient a0 τ * lowerHeight cStar n ^ 2 / 2) (lowerHeight cStar n ^ 2 / 2) hPair1 hPair2 rw [← lowerMixture_eq_uniformMixture a n cStar τ hb hAdm hτ hn0, ← center_dataLaw_eq_product a n hb] at hmain exact hmain
CausalSmith.Stat.TransportCaceRoughnuisanceLength.legal_twoChannel_exp_bound · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/Assembly.lean:232
theorem legal_mixture_finite_chiSquare_support

The legal product mixture has an integrable squared likelihood deviation. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
a :
ℝ
n :
ℕ
cStar τ :
ℝ
hτ :
τ ∈ Icc (-1 : ℝ) 1
hn :
threshold ≤ n
ha :
0 < a ∧ a ≤ 1 / 4
hc :
0 < cStar ∧ cStar ≤ 1 / 100
conclusion 1
(lowerMixture a n cStar τ) ≪ (dataLaw (mixtureCenter a n) n n)
conclusion 2
Integrable (fun ω : TwoSample n n => (((lowerMixture a n cStar τ).rnDeriv (dataLaw (mixtureCenter a n) n n) ω).toReal - 1) ^ 2) (dataLaw (mixtureCenter a n) n n)
Proof (Lean source)
-- @node: legal_mixture_finite_chiSquare_support lemma legal_mixture_finite_chiSquare_support (a : ℝ) (n : ℕ) (cStar τ : ℝ) (hτ : τ ∈ Icc (-1 : ℝ) 1) (hn : threshold ≤ n) (ha : 0 < a ∧ a ≤ 1 / 4) (hc : 0 < cStar ∧ cStar ≤ 1 / 100) : (lowerMixture a n cStar τ) ≪ (dataLaw (mixtureCenter a n) n n) ∧ Integrable (fun ω : TwoSample n n => (((lowerMixture a n cStar τ).rnDeriv (dataLaw (mixtureCenter a n) n n) ω).toReal - 1) ^ 2) (dataLaw (mixtureCenter a n) n n) := by let K := lowerCells n let a0 := actualStrength a n let μ1 := explicitSourceLaw a0 (fun _ => 0) (fun _ => 0) let μ2 := volume.restrict covariateSpace let Q1 : (Fin K → Bool) → Measure SourceObs := fun s => explicitSourceLaw a0 (tiledPerturbation cStar n s) (fun x => τ * tiledPerturbation cStar n s x) let Q2 : (Fin K → Bool) → Measure ℝ := fun s => μ2.withDensity (fun x => ofReal (1 + tiledPerturbation cStar n s x)) let L1 : (Fin K → Bool) → SourceObs → ℝ := fun s => sourceObsLikelihood a0 τ (tiledPerturbation cStar n s) let L2 : (Fin K → Bool) → ℝ → ℝ := fun s x => 1 + tiledPerturbation cStar n s x let Q : (Fin K → Bool) → Measure (TwoSample n n) := fun s => (Measure.pi (fun _ : Fin n => Q1 s)).prod (Measure.pi (fun _ : Fin n => Q2 s)) let P : Measure (TwoSample n n) := (Measure.pi (fun _ : Fin n => μ1)).prod (Measure.pi (fun _ : Fin n => μ2)) have hb := actualStrength_bounds a n hn ha have ha0 : 0 < a0 ∧ a0 < 1 := ⟨hb.1, lt_of_le_of_lt hb.2 (by norm_num)⟩ have hAdm := lower_admissible_of_small_amplitude n a cStar hn ha hc have hn0 : 0 < n := by have : 256 ≤ n := hn; omega have hK : 0 < K := by unfold K lowerCells exact Nat.ceil_pos.mpr (by positivity) letI : NeZero K := ⟨Nat.ne_of_gt hK⟩ letI : IsProbabilityMeasure μ1 := explicitCenterSourceLaw_isProbability a0 ha0 letI : IsProbabilityMeasure μ2 := covariateCenter_isProbability letI : ∀ s, IsProbabilityMeasure (Q1 s) := fun s => lowerExplicitSource_isProbability a n cStar τ s hb hAdm hτ letI : ∀ s, IsProbabilityMeasure (Q2 s) := fun s => lowerTargetDensity_isProbability cStar n s hn0 hAdm letI : IsProbabilityMeasure P := by unfold P; infer_instance letI : ∀ s, IsProbabilityMeasure (Q s) := fun s => by unfold Q; infer_instance have hL1 (s : Fin K → Bool) : Measurable (L1 s) := sourceObsLikelihood_measurable a0 τ _ (tiledPerturbation_measurable cStar n s) have hL2 (s : Fin K → Bool) : Measurable (L2 s) := measurable_const.add (tiledPerturbation_measurable cStar n s) have hL10 (s : Fin K → Bool) (o : SourceObs) : 0 ≤ L1 s o := lowerSourceLikelihood_nonneg a n cStar τ s hb hAdm hτ o have hL20 (s : Fin K → Bool) (x : ℝ) : 0 ≤ L2 s x := by have hu := tiledPerturbation_abs_le_lowerHeight cStar n s x hAdm.1.le have hu' : |tiledPerturbation cStar n s x| ≤ 3 / 16 := le_trans hu hAdm.2.1 linarith [neg_abs_le (tiledPerturbation cStar n s x)] have hQ1 (s : Fin K → Bool) : Q1 s = μ1.withDensity (fun o => ofReal (L1 s o)) := explicitSourceLaw_eq_withDensity a0 τ _ ha0 (tiledPerturbation_measurable cStar n s) have hQ2 (s : Fin K → Bool) : Q2 s = μ2.withDensity (fun x => ofReal (L2 s x)) := rfl have hInt1 (s t : Fin K → Bool) : Integrable (fun o => L1 s o * L1 t o) μ1 := sourceLikelihood_pair_integrable a0 τ cStar n s t ha0 have hInt2 (s t : Fin K → Bool) : Integrable (fun x => L2 s x * L2 t x) μ2 := targetLikelihood_pair_integrable cStar n s t hn0 have hac (s : Fin K → Bool) : Q s ≪ P := by unfold Q P exact (iid_absolutelyContinuous_of_likelihood μ1 (Q1 s) (L1 s) (hQ1 s) n).prod (iid_absolutelyContinuous_of_likelihood μ2 (Q2 s) (L2 s) (hQ2 s) n) have hpair (s t : Fin K → Bool) : Integrable (fun x => ((Q s).rnDeriv P x).toReal * ((Q t).rnDeriv P x).toReal) P := by unfold Q P apply product_pair_integrable · exact iid_absolutelyContinuous_of_likelihood μ1 (Q1 s) (L1 s) (hQ1 s) n · exact iid_absolutelyContinuous_of_likelihood μ1 (Q1 t) (L1 t) (hQ1 t) n · exact iid_absolutelyContinuous_of_likelihood μ2 (Q2 s) (L2 s) (hQ2 s) n · exact iid_absolutelyContinuous_of_likelihood μ2 (Q2 t) (L2 t) (hQ2 t) n · exact iid_pair_integrable_of_likelihood μ1 (Q1 s) (Q1 t) (L1 s) (L1 t) (hL1 s) (hL1 t) (hL10 s) (hL10 t) (hQ1 s) (hQ1 t) (hInt1 s t) n · exact iid_pair_integrable_of_likelihood μ2 (Q2 s) (Q2 t) (L2 s) (L2 t) (hL2 s) (hL2 t) (hL20 s) (hL20 t) (hQ2 s) (hQ2 t) (hInt2 s t) n have h := uniformMixture_finite_chiSquare Q P hac hpair rw [← lowerMixture_eq_uniformMixture a n cStar τ hb hAdm hτ hn0] at h dsimp [P, μ1, μ2, a0] at h rw [← center_dataLaw_eq_product a n hb] at h exact h
CausalSmith.Stat.TransportCaceRoughnuisanceLength.legal_mixture_finite_chiSquare_support · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/Assembly.lean:317
theorem legal_tv_le_half_sqrt_chi

Given the supplied inputs, the stated result about legal tv le half sqrt chi holds.

Formal statement
a :
ℝ
n :
ℕ
cStar τ :
ℝ
hτ :
τ ∈ Icc (-1 : ℝ) 1
hn :
threshold ≤ n
ha :
0 < a ∧ a ≤ 1 / 4
hc :
0 < cStar ∧ cStar ≤ 1 / 100
tvDist (lowerMixture a n cStar τ) (dataLaw (mixtureCenter a n) n n)
≤ (1 / 2) * sqrt (chiSqDiv (lowerMixture a n cStar τ) (dataLaw (mixtureCenter a n) n n))
Proof (Lean source)
lemma legal_tv_le_half_sqrt_chi (a : ℝ) (n : ℕ) (cStar τ : ℝ) (hτ : τ ∈ Icc (-1 : ℝ) 1) (hn : threshold ≤ n) (ha : 0 < a ∧ a ≤ 1 / 4) (hc : 0 < cStar ∧ cStar ≤ 1 / 100) : tvDist (lowerMixture a n cStar τ) (dataLaw (mixtureCenter a n) n n) ≤ (1 / 2) * sqrt (chiSqDiv (lowerMixture a n cStar τ) (dataLaw (mixtureCenter a n) n n)) := by let K := lowerCells n let a0 := actualStrength a n let μ1 := explicitSourceLaw a0 (fun _ => 0) (fun _ => 0) let μ2 := volume.restrict covariateSpace let Q1 : (Fin K → Bool) → Measure SourceObs := fun s => explicitSourceLaw a0 (tiledPerturbation cStar n s) (fun x => τ * tiledPerturbation cStar n s x) let Q2 : (Fin K → Bool) → Measure ℝ := fun s => μ2.withDensity (fun x => ofReal (1 + tiledPerturbation cStar n s x)) let L1 : (Fin K → Bool) → SourceObs → ℝ := fun s => sourceObsLikelihood a0 τ (tiledPerturbation cStar n s) let L2 : (Fin K → Bool) → ℝ → ℝ := fun s x => 1 + tiledPerturbation cStar n s x let Q : (Fin K → Bool) → Measure (TwoSample n n) := fun s => (Measure.pi (fun _ : Fin n => Q1 s)).prod (Measure.pi (fun _ : Fin n => Q2 s)) let P : Measure (TwoSample n n) := (Measure.pi (fun _ : Fin n => μ1)).prod (Measure.pi (fun _ : Fin n => μ2)) have hb := actualStrength_bounds a n hn ha have ha0 : 0 < a0 ∧ a0 < 1 := ⟨hb.1, lt_of_le_of_lt hb.2 (by norm_num)⟩ have hAdm := lower_admissible_of_small_amplitude n a cStar hn ha hc have hn0 : 0 < n := by have : 256 ≤ n := hn; omega have hK : 0 < K := by unfold K lowerCells exact Nat.ceil_pos.mpr (by positivity) letI : NeZero K := ⟨Nat.ne_of_gt hK⟩ letI : IsProbabilityMeasure μ1 := explicitCenterSourceLaw_isProbability a0 ha0 letI : IsProbabilityMeasure μ2 := covariateCenter_isProbability letI : ∀ s, IsProbabilityMeasure (Q1 s) := fun s => lowerExplicitSource_isProbability a n cStar τ s hb hAdm hτ letI : ∀ s, IsProbabilityMeasure (Q2 s) := fun s => lowerTargetDensity_isProbability cStar n s hn0 hAdm letI : IsProbabilityMeasure P := by unfold P; infer_instance letI : ∀ s, IsProbabilityMeasure (Q s) := fun s => by unfold Q; infer_instance have hL1 (s : Fin K → Bool) : Measurable (L1 s) := sourceObsLikelihood_measurable a0 τ _ (tiledPerturbation_measurable cStar n s) have hL2 (s : Fin K → Bool) : Measurable (L2 s) := measurable_const.add (tiledPerturbation_measurable cStar n s) have hL10 (s : Fin K → Bool) (o : SourceObs) : 0 ≤ L1 s o := lowerSourceLikelihood_nonneg a n cStar τ s hb hAdm hτ o have hL20 (s : Fin K → Bool) (x : ℝ) : 0 ≤ L2 s x := by have hu := tiledPerturbation_abs_le_lowerHeight cStar n s x hAdm.1.le have hu' : |tiledPerturbation cStar n s x| ≤ 3 / 16 := le_trans hu hAdm.2.1 linarith [neg_abs_le (tiledPerturbation cStar n s x)] have hQ1 (s : Fin K → Bool) : Q1 s = μ1.withDensity (fun o => ofReal (L1 s o)) := explicitSourceLaw_eq_withDensity a0 τ _ ha0 (tiledPerturbation_measurable cStar n s) have hQ2 (s : Fin K → Bool) : Q2 s = μ2.withDensity (fun x => ofReal (L2 s x)) := rfl have hInt1 (s t : Fin K → Bool) : Integrable (fun o => L1 s o * L1 t o) μ1 := sourceLikelihood_pair_integrable a0 τ cStar n s t ha0 have hInt2 (s t : Fin K → Bool) : Integrable (fun x => L2 s x * L2 t x) μ2 := targetLikelihood_pair_integrable cStar n s t hn0 have hac (s : Fin K → Bool) : Q s ≪ P := by unfold Q P exact (iid_absolutelyContinuous_of_likelihood μ1 (Q1 s) (L1 s) (hQ1 s) n).prod (iid_absolutelyContinuous_of_likelihood μ2 (Q2 s) (L2 s) (hQ2 s) n) have hpair (s t : Fin K → Bool) : Integrable (fun x => ((Q s).rnDeriv P x).toReal * ((Q t).rnDeriv P x).toReal) P := by unfold Q P apply product_pair_integrable · exact iid_absolutelyContinuous_of_likelihood μ1 (Q1 s) (L1 s) (hQ1 s) n · exact iid_absolutelyContinuous_of_likelihood μ1 (Q1 t) (L1 t) (hQ1 t) n · exact iid_absolutelyContinuous_of_likelihood μ2 (Q2 s) (L2 s) (hQ2 s) n · exact iid_absolutelyContinuous_of_likelihood μ2 (Q2 t) (L2 t) (hQ2 t) n · exact iid_pair_integrable_of_likelihood μ1 (Q1 s) (Q1 t) (L1 s) (L1 t) (hL1 s) (hL1 t) (hL10 s) (hL10 t) (hQ1 s) (hQ1 t) (hInt1 s t) n · exact iid_pair_integrable_of_likelihood μ2 (Q2 s) (Q2 t) (L2 s) (L2 t) (hL2 s) (hL2 t) (hL20 s) (hL20 t) (hQ2 s) (hQ2 t) (hInt2 s t) n have h := tv_uniformMixture_le_half_sqrt Q P hac hpair change tvDist (uniformMixture Q) P ≤ _ at h rw [← lowerMixture_eq_uniformMixture a n cStar τ hb hAdm hτ hn0] at h dsimp [P, μ1, μ2, a0] at h rw [← center_dataLaw_eq_product a n hb] at h exact h
CausalSmith.Stat.TransportCaceRoughnuisanceLength.legal_tv_le_half_sqrt_chi · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/Assembly.lean:416
theorem legal_chi_exp_bound

Given the supplied inputs, the stated result about legal chi exp bound holds.

Formal statement
a :
ℝ
n :
ℕ
cStar τ :
ℝ
hτ :
τ ∈ Icc (-1 : ℝ) 1
hn :
threshold ≤ n
ha :
0 < a ∧ a ≤ 1 / 4
hc :
0 < cStar ∧ cStar ≤ 1 / 100
1 + chiSqDiv (lowerMixture a n cStar τ) (dataLaw (mixtureCenter a n) n n)
≤ exp (mixConstant * cStar ^ 4)
Proof (Lean source)
lemma legal_chi_exp_bound (a : ℝ) (n : ℕ) (cStar τ : ℝ) (hτ : τ ∈ Icc (-1 : ℝ) 1) (hn : threshold ≤ n) (ha : 0 < a ∧ a ≤ 1 / 4) (hc : 0 < cStar ∧ cStar ≤ 1 / 100) : 1 + chiSqDiv (lowerMixture a n cStar τ) (dataLaw (mixtureCenter a n) n n) ≤ exp (mixConstant * cStar ^ 4) := by have hraw := legal_twoChannel_exp_bound a n cStar τ hτ hn ha hc apply hraw.trans apply Real.exp_le_exp.mpr have hb := actualStrength_bounds a n hn ha have hG := sourceOverlapCoefficient_le (actualStrength a n) τ ⟨hb.1.le, hb.2⟩ hτ have hn0 : 0 < n := by have : 256 ≤ n := hn; omega have hK : 0 < lowerCells n := by unfold lowerCells exact Nat.ceil_pos.mpr (by positivity) have hbase : (n : ℝ) ^ ((4 : ℝ) / 3) ≤ lowerCells n := by unfold lowerCells exact Nat.le_ceil _ have hscale := sample_height_exponent_bound n (lowerCells n) cStar (sourceOverlapCoefficient (actualStrength a n) τ + 1) hn0 hK hbase (by linarith [hG.1]) hG.2 have heq : (((n : ℝ) * (sourceOverlapCoefficient (actualStrength a n) τ * lowerHeight cStar n ^ 2 / 2) + (n : ℝ) * (lowerHeight cStar n ^ 2 / 2)) ^ 2) / (2 * (lowerCells n : ℝ)) = (((n : ℝ) * ((sourceOverlapCoefficient (actualStrength a n) τ + 1) * (cStar * (lowerCells n : ℝ) ^ (-(1 / 8 : ℝ))) ^ 2 / 2)) ^ 2) / (2 * (lowerCells n : ℝ)) := by unfold lowerHeight ring rw [heq] exact hscale
CausalSmith.Stat.TransportCaceRoughnuisanceLength.legal_chi_exp_bound · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/Assembly.lean:518
CausalSmith.Stat.STAT_TransportCaceRoughnuisanceLength_Research.Helpers.LegalMixture.Assignment 9 declarations The primitive construction records consistent receipt and outcome values.

Randomized assignment and independent product sampling

The primitive construction records consistent receipt and outcome values. A normalized binary assignment kernel preserves the primitive marginal and provides the conditional event identity in roadmap (13)--(18).

The assignment overlay draws the instrument and records its consistent observables. For the displayed assumptions and inputs, the stated object is defined.

Definition (Lean source)
e :
ℝ → ℝ
o :
membershipAssignmentKernel e o :
+ ofReal (1 - e (covariate o)) • Measure.dirac (o, false, potentialReceipt o false, potentialOutcome o (potentialReceipt o false))
CausalSmith.Stat.TransportCaceRoughnuisanceLength.membershipAssignmentKernel · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/Assignment.lean:17
theorem membershipAssignmentKernel_measurable

If the assignment propensity is measurable, then the induced assignment kernel is measurable.

Formal statement
e :
ℝ → ℝ
he :
Proof (Lean source)
-- @node: membershipAssignmentKernel_measurable @[fun_prop] lemma membershipAssignmentKernel_measurable (e : ℝ → ℝ) (he : Measurable e) : Measurable (membershipAssignmentKernel e) := by have hc : Measurable covariate := by unfold covariate; fun_prop have hr (z : Bool) : Measurable (fun o : FullData => (o, z, potentialReceipt o z, potentialOutcome o (potentialReceipt o z))) := by unfold potentialReceipt potentialOutcome receipt0 receipt1 outcome0 outcome1 cases z <;> simp only [Bool.false_eq_true, if_false, if_true] all_goals apply prodMk measurable_id apply prodMk measurable_const apply prodMk (by fun_prop) exact Measurable.ite (measurableSet_eq_fun (by fun_prop) measurable_const) (by fun_prop) (by fun_prop) refine Measure.measurable_of_measurable_coe _ fun B hB => ?_ simp only [membershipAssignmentKernel, Measure.add_apply, Measure.smul_apply, smul_eq_mul, Measure.dirac_apply' _ hB] exact ((he.comp hc).ennreal_ofReal.mul (measurable_one.indicator (hB.preimage (hr true)))).add ((measurable_const.sub (he.comp hc)).ennreal_ofReal.mul (measurable_one.indicator (hB.preimage (hr false))))
CausalSmith.Stat.TransportCaceRoughnuisanceLength.membershipAssignmentKernel_measurable · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/Assignment.lean:27
theorem assignedFrom_consistency Lemma assignedFrom_consistency in the paper ↗

The assigned overlay is supported on consistent receipt and outcome records. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
e :
ℝ → ℝ
he :
∀ᵐ o ∂assignedFrom μ e, o.2.2.1
= potentialReceipt o.1 o.2.1 ∧ o.2.2.2 = potentialOutcome o.1 o.2.2.1
Proof (Lean source)
-- @node: assignedFrom_consistency lemma assignedFrom_consistency (μ : Measure FullData) (e : ℝ → ℝ) (he : Measurable e) : ∀ᵐ o ∂assignedFrom μ e, o.2.2.1 = potentialReceipt o.1 o.2.1 ∧ o.2.2.2 = potentialOutcome o.1 o.2.2.1 := by have hbad : MeasurableSet {o : Assigned | ¬ (o.2.2.1 = potentialReceipt o.1 o.2.1 ∧ o.2.2.2 = potentialOutcome o.1 o.2.2.1)} := by have hr : Measurable (fun o : Assigned => potentialReceipt o.1 o.2.1) := by unfold potentialReceipt receipt0 receipt1 exact Measurable.ite (measurableSet_eq_fun (by fun_prop) measurable_const) (by fun_prop) (by fun_prop) have hy : Measurable (fun o : Assigned => potentialOutcome o.1 o.2.2.1) := by unfold potentialOutcome outcome0 outcome1 exact Measurable.ite (measurableSet_eq_fun (by fun_prop) measurable_const) (by fun_prop) (by fun_prop) exact ((measurableSet_eq_fun (by fun_prop) hr).inter (measurableSet_eq_fun (by fun_prop) hy)).compl rw [ae_iff] change (μ.bind (membershipAssignmentKernel e)) _ = 0 rw [Measure.bind_apply hbad (membershipAssignmentKernel_measurable e he).aemeasurable] apply lintegral_eq_zero_of_ae_eq_zero exact Filter.Eventually.of_forall (fun o => by simp [membershipAssignmentKernel, Measure.add_apply, Measure.smul_apply])
CausalSmith.Stat.TransportCaceRoughnuisanceLength.assignedFrom_consistency · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/Assignment.lean:50

Assignment preserves the primitive marginal for unit-interval propensities. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
e :
ℝ → ℝ
he :
hb :
∀ᵐ o ∂μ, e (covariate o) ∈ Icc (0 : ℝ) 1
(assignedFrom μ e).map fst = μ
Proof (Lean source)
-- @node: assignedFrom_map_fst lemma assignedFrom_map_fst (μ : Measure FullData) (e : ℝ → ℝ) (he : Measurable e) (hb : ∀ᵐ o ∂μ, e (covariate o) ∈ Icc (0 : ℝ) 1) : (assignedFrom μ e).map fst = μ := by ext B hB rw [Measure.map_apply measurable_fst hB] change (μ.bind (membershipAssignmentKernel e)) (fst ⁻¹' B) = μ B rw [Measure.bind_apply (hB.preimage measurable_fst) (membershipAssignmentKernel_measurable e he).aemeasurable] calc _ = ∫⁻ o, B.indicator 1 o ∂μ := by apply lintegral_congr_ae filter_upwards [hb] with o ho have hw : ofReal (e (covariate o)) + ofReal (1 - e (covariate o)) = 1 := by rw [← ENNReal.ofReal_add ho.1 (sub_nonneg.mpr ho.2)] simp simp only [membershipAssignmentKernel, Measure.add_apply, Measure.smul_apply, smul_eq_mul, Measure.dirac_apply' _ (hB.preimage measurable_fst)] by_cases hoB : o ∈ B <;> simp [hoB, indicator, hw] _ = μ B := by simp [lintegral_indicator, hB]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.assignedFrom_map_fst · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/Assignment.lean:77
theorem assignedFrom_isProbability Lemma assignedFrom_isProbability in the paper ↗

A probability primitive marginal gives a probability assigned overlay. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
e :
ℝ → ℝ
he :
hb :
∀ᵐ o ∂μ, e (covariate o) ∈ Icc (0 : ℝ) 1
Proof (Lean source)
-- @node: assignedFrom_isProbability lemma assignedFrom_isProbability (μ : Measure FullData) [IsProbabilityMeasure μ] (e : ℝ → ℝ) (he : Measurable e) (hb : ∀ᵐ o ∂μ, e (covariate o) ∈ Icc (0 : ℝ) 1) : IsProbabilityMeasure (assignedFrom μ e) := by constructor have h := congrArg (fun ν : Measure FullData => ν univ) (assignedFrom_map_fst μ e he hb) simpa only [Measure.map_apply measurable_fst MeasurableSet.univ, preimage_univ, measure_univ] using h
CausalSmith.Stat.TransportCaceRoughnuisanceLength.assignedFrom_isProbability · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/Assignment.lean:100
theorem assignedFrom_instrument_event Lemma assignedFrom_instrument_event in the paper ↗

The assignment event probability is the integral of its conditional instrument mass. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
e :
ℝ → ℝ
he :
hb :
∀ o, e (covariate o) ∈ Icc (0 : ℝ) 1
hB :
z :
(assignedFrom μ e {o | o.1 ∈ B ∧ o.2.1 = z}).toReal
= ∫ o in B, (if z then e (covariate o) else 1 - e (covariate o)) ∂μ
Proof (Lean source)
-- @node: assignedFrom_instrument_event lemma assignedFrom_instrument_event (μ : Measure FullData) (e : ℝ → ℝ) (he : Measurable e) (hb : ∀ o, e (covariate o) ∈ Icc (0 : ℝ) 1) (B : Set FullData) (hB : MeasurableSet B) (z : Bool) : (assignedFrom μ e {o | o.1 ∈ B ∧ o.2.1 = z}).toReal = ∫ o in B, (if z then e (covariate o) else 1 - e (covariate o)) ∂μ := by have hset : MeasurableSet {o : Assigned | o.1 ∈ B ∧ o.2.1 = z} := (hB.preimage measurable_fst).inter (measurableSet_eq_fun (by fun_prop) measurable_const) have hnonneg : ∀ o : FullData, 0 ≤ (if z then e (covariate o) else 1 - e (covariate o)) := by intro o cases z · exact sub_nonneg.mpr (hb o).2 · exact (hb o).1 change ((μ.bind (membershipAssignmentKernel e)) _).toReal = _ rw [Measure.bind_apply hset (membershipAssignmentKernel_measurable e he).aemeasurable] have heq : (∫⁻ o, membershipAssignmentKernel e o {o | o.1 ∈ B ∧ o.2.1 = z} ∂μ) = ∫⁻ o in B, ofReal (if z then e (covariate o) else 1 - e (covariate o)) ∂μ := by rw [← lintegral_indicator hB] apply lintegral_congr intro o cases z <;> by_cases ho : o ∈ B <;> simp [membershipAssignmentKernel, Measure.add_apply, Measure.smul_apply, Measure.dirac_apply' _ hset, indicator, ho] rw [heq] symm apply integral_eq_lintegral_of_nonneg_ae (Filter.Eventually.of_forall hnonneg) have hc : Measurable covariate := by unfold covariate; fun_prop cases z · exact (measurable_const.sub (he.comp hc)).aestronglyMeasurable · exact (he.comp hc).aestronglyMeasurable
CausalSmith.Stat.TransportCaceRoughnuisanceLength.assignedFrom_instrument_event · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/Assignment.lean:111
theorem assignedFrom_outcome_bounds Lemma assignedFrom_outcome_bounds in the paper ↗

Primitive binary outcomes remain bounded after randomized assignment. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
e :
ℝ → ℝ
he :
hb :
∀ᵐ o ∂μ, e (covariate o) ∈ Icc (0 : ℝ) 1
hy :
∀ᵐ o ∂μ, outcome0 o ∈ Icc (0 : ℝ) 1 ∧ outcome1 o ∈ Icc (0 : ℝ) 1
∀ᵐ o ∂assignedFrom μ e, o.2.2.2 ∈ Icc (0 : ℝ) 1
Proof (Lean source)
-- @node: assignedFrom_outcome_bounds lemma assignedFrom_outcome_bounds (μ : Measure FullData) (e : ℝ → ℝ) (he : Measurable e) (hb : ∀ᵐ o ∂μ, e (covariate o) ∈ Icc (0 : ℝ) 1) (hy : ∀ᵐ o ∂μ, outcome0 o ∈ Icc (0 : ℝ) 1 ∧ outcome1 o ∈ Icc (0 : ℝ) 1) : ∀ᵐ o ∂assignedFrom μ e, o.2.2.2 ∈ Icc (0 : ℝ) 1 := by have hmap := assignedFrom_map_fst μ e he hb rw [← hmap] at hy have hs := ae_of_ae_map measurable_fst.aemeasurable hy filter_upwards [hs, assignedFrom_consistency μ e he] with o ho hc rw [hc.2] cases hd : o.2.2.1 <;> simp [potentialOutcome, ho.1, ho.2]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.assignedFrom_outcome_bounds · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/Assignment.lean:146
theorem lawFromMass_assignment_conditions

The primitive-law assignment construction satisfies consistency and randomization. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
fS fT e :
ℝ → ℝ
mass :
ℝ → Bool → Bool → Bool → Bool → ℝ
hm :
∀ d0 d1 y0 y1, Measurable fun x => mass x d0 d1 y0 y1
hm0 :
∀ x d0 d1 y0 y1, 0 ≤ mass x d0 d1 y0 y1
hsum :
∀ x, ∑ d0 : Bool, ∑ d1 : Bool, ∑ y0 : Bool, ∑ y1 : Bool, mass x d0 d1 y0 y1 = 1
hS :
((volume.restrict covariateSpace).withDensity (fun x => ofReal (fS x))) univ = 1
he :
hb :
∀ x, e x ∈ Icc (0 : ℝ) 1
hpop :
conclusion 1
conclusion 2
conclusion 3
Proof (Lean source)
-- @node: lawFromMass_assignment_conditions lemma lawFromMass_assignment_conditions (fS fT e : ℝ → ℝ) (mass : ℝ → Bool → Bool → Bool → Bool → ℝ) (hm : ∀ d0 d1 y0 y1, Measurable fun x => mass x d0 d1 y0 y1) (hm0 : ∀ x d0 d1 y0 y1, 0 ≤ mass x d0 d1 y0 y1) (hsum : ∀ x, ∑ d0 : Bool, ∑ d1 : Bool, ∑ y0 : Bool, ∑ y1 : Bool, mass x d0 d1 y0 y1 = 1) (hS : ((volume.restrict covariateSpace).withDensity (fun x => ofReal (fS x))) univ = 1) (he : Measurable e) (hb : ∀ x, e x ∈ Icc (0 : ℝ) 1) (hpop : populationLaw (lawFromMass fS fT e mass) true = primitivePopulation true fS mass) : ReceiptConsistency (lawFromMass fS fT e mass) ∧ OutcomeConsistency (lawFromMass fS fT e mass) ∧ InstrumentRandomization (lawFromMass fS fT e mass) := by let μ := primitivePopulation true fS mass have : IsProbabilityMeasure μ := ⟨by change primitivePopulation true fS mass univ = 1 rw [primitivePopulation_univ true fS mass hm hm0 hsum, hS]⟩ have heμ : ∀ᵐ o ∂μ, e (covariate o) ∈ Icc (0 : ℝ) 1 := Filter.Eventually.of_forall (fun o => hb (covariate o)) have hc := assignedFrom_consistency μ e he refine ⟨hc.mono (fun _ h => h.1), ⟨hc.mono (fun _ h => h.2), ?_⟩, ?_⟩ · exact assignedFrom_outcome_bounds μ e he heμ (primitivePopulation_outcome_bounds true fS mass hm) · refine ⟨assignedFrom_isProbability μ e he heμ, ?_, ?_, ?_⟩ · exact he.indicator measurableSet_Icc · rw [hpop] exact assignedFrom_map_fst μ e he heμ · intro B hB z rw [hpop] exact assignedFrom_instrument_event μ e he (fun o => hb (covariate o)) B hB z
CausalSmith.Stat.TransportCaceRoughnuisanceLength.lawFromMass_assignment_conditions · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/Assignment.lean:159
theorem lawFromMass_sampling_conditions

Both product-sample marginals and their independence follow from normalized channels. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
fS fT e :
ℝ → ℝ
mass :
ℝ → Bool → Bool → Bool → Bool → ℝ
nS nT :
ℕ
conclusion 1
SourceIid (lawFromMass fS fT e mass) nS nT
conclusion 2
TargetIid (lawFromMass fS fT e mass) nS nT
conclusion 3
SampleIndependence (lawFromMass fS fT e mass) nS nT
Proof (Lean source)
-- @node: lawFromMass_sampling_conditions lemma lawFromMass_sampling_conditions (fS fT e : ℝ → ℝ) (mass : ℝ → Bool → Bool → Bool → Bool → ℝ) [IsProbabilityMeasure (sourceObsLaw (lawFromMass fS fT e mass))] [IsProbabilityMeasure (targetXLaw (lawFromMass fS fT e mass))] (nS nT : ℕ) : SourceIid (lawFromMass fS fT e mass) nS nT ∧ TargetIid (lawFromMass fS fT e mass) nS nT ∧ SampleIndependence (lawFromMass fS fT e mass) nS nT := by have hd : dataLaw (lawFromMass fS fT e mass) nS nT = (Measure.pi (fun _ : Fin nS => sourceObsLaw (lawFromMass fS fT e mass))).prod (Measure.pi (fun _ : Fin nT => targetXLaw (lawFromMass fS fT e mass))) := rfl have hS : SourceIid (lawFromMass fS fT e mass) nS nT := by rw [SourceIid, hd, Measure.map_fst_prod] simp have hT : TargetIid (lawFromMass fS fT e mass) nS nT := by rw [TargetIid, hd, Measure.map_snd_prod] simp exact ⟨hS, hT, by rw [SampleIndependence, hS, hT, hd]⟩
CausalSmith.Stat.TransportCaceRoughnuisanceLength.lawFromMass_sampling_conditions · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/Assignment.lean:193
CausalSmith.Stat.STAT_TransportCaceRoughnuisanceLength_Research.Helpers.LegalMixture.CenterMembership 5 declarations The finite primitive populations give the same conditional complier margins in both populations.

Assignment and transport conditions of the mixture components and center

The finite primitive populations give the same conditional complier margins in both populations. Their assignment kernels satisfy randomization and consistency, completing the law-level clauses in roadmap (13)--(18).

theorem mixtureCenter_populationLaw_eq_primitive Lemma mixtureCenter_populationLaw_eq_primitive in the paper ↗

Either center population is the corresponding normalized primitive population. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
a :
ℝ
n :
ℕ
hb :
0 < actualStrength a n ∧ actualStrength a n ≤ 1 / 4
s :
= primitivePopulation s (fun _ => 1) (fun _ => primitiveMass (actualStrength a n) 0 0)
Proof (Lean source)
-- @node: mixtureCenter_populationLaw_eq_primitive lemma mixtureCenter_populationLaw_eq_primitive (a : ℝ) (n : ℕ) (hb : 0 < actualStrength a n ∧ actualStrength a n ≤ 1 / 4) (s : Bool) : populationLaw (mixtureCenter a n) s = primitivePopulation s (fun _ => 1) (fun _ => primitiveMass (actualStrength a n) 0 0) := by let mass : ℝ → Bool → Bool → Bool → Bool → ℝ := fun _ => primitiveMass (actualStrength a n) 0 0 have hm : ∀ d0 d1 y0 y1, Measurable fun x => mass x d0 d1 y0 y1 := fun _ _ _ _ => measurable_const have hm0 : ∀ x d0 d1 y0 y1, 0 ≤ mass x d0 d1 y0 y1 := by intro x d0 d1 y0 y1 exact primitiveMass_nonneg_of_bounds (actualStrength a n) 0 0 hb (by norm_num) (by norm_num) (by nlinarith [hb.1]) d0 d1 y0 y1 have hsum (x : ℝ) : ∑ d0 : Bool, ∑ d1 : Bool, ∑ y0 : Bool, ∑ y1 : Bool, mass x d0 d1 y0 y1 = 1 := primitiveMass_sum (actualStrength a n) 0 0 (ne_of_gt hb.1) (by norm_num) have hu (t : Bool) : primitivePopulation t (fun _ => 1) mass univ = 1 := by rw [primitivePopulation_univ t _ mass hm hm0 hsum] simp [covariateSpace] unfold populationLaw mixtureCenter lawFromMass dsimp cases s · apply cond_half_supported_mixture_event · unfold population; measurability · simpa using primitivePopulation_population_event true false (fun _ => 1) mass hm · simpa using (primitivePopulation_population_event false false (fun _ => 1) mass hm).trans (by simpa using hu false) · exact hu false · rw [add_comm] apply cond_half_supported_mixture_event · unfold population; measurability · simpa using primitivePopulation_population_event false true (fun _ => 1) mass hm · simpa using (primitivePopulation_population_event true true (fun _ => 1) mass hm).trans (by simpa using hu true) · exact hu true
CausalSmith.Stat.TransportCaceRoughnuisanceLength.mixtureCenter_populationLaw_eq_primitive · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/CenterMembership.lean:16
theorem legalIVComponent_assignment_conditions

The component assignment realizes randomized encouragement and consistent records. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
a :
ℝ
n :
ℕ
cStar τ :
ℝ
sgn :
hb :
0 < actualStrength a n ∧ actualStrength a n ≤ 1 / 4
hAdm :
LowerAdmissible n a cStar
hτ :
τ ∈ Icc (-1 : ℝ) 1
hn :
0 < n
conclusion 1
conclusion 2
conclusion 3
Proof (Lean source)
-- @node: legalIVComponent_assignment_conditions lemma legalIVComponent_assignment_conditions (a : ℝ) (n : ℕ) (cStar τ : ℝ) (sgn : Fin (lowerCells n) → Bool) (hb : 0 < actualStrength a n ∧ actualStrength a n ≤ 1 / 4) (hAdm : LowerAdmissible n a cStar) (hτ : τ ∈ Icc (-1 : ℝ) 1) (hn : 0 < n) : ReceiptConsistency (legalIVComponent a n cStar τ sgn) ∧ OutcomeConsistency (legalIVComponent a n cStar τ sgn) ∧ InstrumentRandomization (legalIVComponent a n cStar τ sgn) := by apply lawFromMass_assignment_conditions · exact lowerMass_measurable a n cStar τ sgn · exact lowerMass_nonneg a n cStar τ sgn hb hAdm hτ · intro x apply primitiveMass_sum _ _ _ (ne_of_gt hb.1) have hu := (tiledPerturbation_abs_le_lowerHeight cStar n sgn x hAdm.1.le).trans hAdm.2.1 nlinarith [sq_abs (tiledPerturbation cStar n sgn x), abs_nonneg (tiledPerturbation cStar n sgn x)] · simp [covariateSpace] · exact measurable_const.add (tiledPerturbation_measurable cStar n sgn) · intro x exact lowerAssignmentWeight_mem_Icc a n cStar τ sgn hAdm x true · simpa only [legalIVComponent, if_true] using legalIVComponent_populationLaw_eq_primitive a n cStar τ sgn hb hAdm hτ hn true
CausalSmith.Stat.TransportCaceRoughnuisanceLength.legalIVComponent_assignment_conditions · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/CenterMembership.lean:53
theorem mixtureCenter_assignment_conditions

The center assignment also realizes the model's consistency and randomization clauses. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
a :
ℝ
n :
ℕ
hb :
0 < actualStrength a n ∧ actualStrength a n ≤ 1 / 4
Proof (Lean source)
-- @node: mixtureCenter_assignment_conditions lemma mixtureCenter_assignment_conditions (a : ℝ) (n : ℕ) (hb : 0 < actualStrength a n ∧ actualStrength a n ≤ 1 / 4) : ReceiptConsistency (mixtureCenter a n) ∧ OutcomeConsistency (mixtureCenter a n) ∧ InstrumentRandomization (mixtureCenter a n) := by apply lawFromMass_assignment_conditions · exact fun _ _ _ _ => measurable_const · intro x d0 d1 y0 y1 exact primitiveMass_nonneg_of_bounds (actualStrength a n) 0 0 hb (by norm_num) (by norm_num) (by nlinarith [hb.1]) d0 d1 y0 y1 · intro x exact primitiveMass_sum (actualStrength a n) 0 0 (ne_of_gt hb.1) (by norm_num) · simp [covariateSpace] · exact measurable_const · intro x; norm_num · exact mixtureCenter_populationLaw_eq_primitive a n hb true
CausalSmith.Stat.TransportCaceRoughnuisanceLength.mixtureCenter_assignment_conditions · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/CenterMembership.lean:77
theorem mixtureCenter_conditionalMean_of_pointwise

A bounded finite primitive mean gives the center's conditional mean in either population. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
a :
ℝ
n :
ℕ
hb :
0 < actualStrength a n ∧ actualStrength a n ≤ 1 / 4
s :
f :
FullData → ℝ
hf :
bound :
ℝ
hbound :
∀ x d0 d1 y0 y1, ‖f (s, x, d0, d1, boolReal y0, boolReal y1)‖ ≤ bound
q :
ℝ → ℝ
hq :
hmean :
∀ x,
(∑ d0 : Bool, ∑ d1 : Bool, ∑ y0 : Bool, ∑ y1 : Bool, primitiveMass (actualStrength a n) 0 0 d0 d1 y0 y1 * f (s, x, d0, d1, boolReal y0, boolReal y1))
= q x
ConditionalMean (mixtureCenter a n) s f q
Proof (Lean source)
-- @node: mixtureCenter_conditionalMean_of_pointwise lemma mixtureCenter_conditionalMean_of_pointwise (a : ℝ) (n : ℕ) (hb : 0 < actualStrength a n ∧ actualStrength a n ≤ 1 / 4) (s : Bool) (f : FullData → ℝ) (hf : Measurable f) (bound : ℝ) (hbound : ∀ x d0 d1 y0 y1, ‖f (s, x, d0, d1, boolReal y0, boolReal y1)‖ ≤ bound) (q : ℝ → ℝ) (hq : Measurable q) (hmean : ∀ x, (∑ d0 : Bool, ∑ d1 : Bool, ∑ y0 : Bool, ∑ y1 : Bool, primitiveMass (actualStrength a n) 0 0 d0 d1 y0 y1 * f (s, x, d0, d1, boolReal y0, boolReal y1)) = q x) : ConditionalMean (mixtureCenter a n) s f q := by let mass : ℝ → Bool → Bool → Bool → Bool → ℝ := fun _ => primitiveMass (actualStrength a n) 0 0 have hm : ∀ d0 d1 y0 y1, Measurable fun x => mass x d0 d1 y0 y1 := fun _ _ _ _ => measurable_const have hm0 : ∀ x d0 d1 y0 y1, 0 ≤ mass x d0 d1 y0 y1 := by intro x d0 d1 y0 y1 exact primitiveMass_nonneg_of_bounds (actualStrength a n) 0 0 hb (by norm_num) (by norm_num) (by nlinarith [hb.1]) d0 d1 y0 y1 have hsum (x : ℝ) : ∑ d0 : Bool, ∑ d1 : Bool, ∑ y0 : Bool, ∑ y1 : Bool, mass x d0 d1 y0 y1 = 1 := primitiveMass_sum (actualStrength a n) 0 0 (ne_of_gt hb.1) (by norm_num) have : IsFiniteMeasure ((volume.restrict covariateSpace).withDensity (fun _ => ofReal (1 : ℝ))) := by simp only [ENNReal.ofReal_one] rw [show (fun _ : ℝ => (1 : ℝ≥0∞)) = 1 from rfl, withDensity_one] change IsFiniteMeasure (volume.restrict (Icc (0 : ℝ) 1)); infer_instance refine ⟨hq, ?_⟩ intro B hB rw [mixtureCenter_populationLaw_eq_primitive a n hb s, map_covariate_primitivePopulation s (fun _ => 1) mass measurable_const hm hm0 hsum, primitivePopulation_setIntegral s (fun _ => 1) mass hm hm0 hsum f hf bound hbound B hB] apply setIntegral_congr_fun hB exact fun x _ => hmean x
CausalSmith.Stat.TransportCaceRoughnuisanceLength.mixtureCenter_conditionalMean_of_pointwise · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/CenterMembership.lean:95
theorem mixtureCenter_conditional_complier_margins

Both center populations have the same constant share and zero weighted outcome margins. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
a :
ℝ
n :
ℕ
hb :
0 < actualStrength a n ∧ actualStrength a n ≤ 1 / 4
s :
conclusion 1
ConditionalMean (mixtureCenter a n) s complier (fun _ => actualStrength a n)
conclusion 2
ConditionalMean (mixtureCenter a n) s (fun o => (outcome1 o - outcome0 o) * complier o) (fun _ => 0)
Proof (Lean source)
-- @node: mixtureCenter_conditional_complier_margins lemma mixtureCenter_conditional_complier_margins (a : ℝ) (n : ℕ) (hb : 0 < actualStrength a n ∧ actualStrength a n ≤ 1 / 4) (s : Bool) : ConditionalMean (mixtureCenter a n) s complier (fun _ => actualStrength a n) ∧ ConditionalMean (mixtureCenter a n) s (fun o => (outcome1 o - outcome0 o) * complier o) (fun _ => 0) := by have hm : Measurable complier := by have hset : MeasurableSet {o : FullData | receipt1 o = true ∧ receipt0 o = false} := (measurableSet_eq_fun (by unfold receipt1; fun_prop) measurable_const).inter (measurableSet_eq_fun (by unfold receipt0; fun_prop) measurable_const) convert (measurable_const : Measurable (fun _ : FullData => (1 : ℝ))).ite hset (measurable_const : Measurable (fun _ : FullData => (0 : ℝ))) using 1 · funext o; simp [complier] · infer_instance have hy : Measurable (fun o : FullData => (outcome1 o - outcome0 o) * complier o) := by unfold outcome1 outcome0 fun_prop constructor · apply mixtureCenter_conditionalMean_of_pointwise a n hb s complier hm 1 · intro x d0 d1 y0 y1 cases d0 <;> cases d1 <;> norm_num [complier, receipt0, receipt1] · exact measurable_const · intro x simpa [complier, receipt0, receipt1] using primitiveMass_complier_sum (actualStrength a n) 0 0 (ne_of_gt hb.1) · apply mixtureCenter_conditionalMean_of_pointwise a n hb s _ hy 1 · intro x d0 d1 y0 y1 cases d0 <;> cases d1 <;> cases y0 <;> cases y1 <;> norm_num [complier, receipt0, receipt1, outcome0, outcome1, boolReal] · exact measurable_const · intro x simpa [complier, receipt0, receipt1, outcome0, outcome1] using primitiveMass_complier_outcome_sum (actualStrength a n) 0 0 (ne_of_gt hb.1)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.mixtureCenter_conditional_complier_margins · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/CenterMembership.lean:130
CausalSmith.Stat.STAT_TransportCaceRoughnuisanceLength_Research.Helpers.LegalMixture.ChannelLaws 12 declarations One-observation channel laws for the legal mixture

One-observation channel laws for the legal mixture

def sourceObsLikelihood

For the source-arm strength, the tilt parameter, the covariate perturbation, and an observed source record, source observation likelihood is the likelihood of that record's encoded latent cell.

Definition (Lean source)
a τ :
ℝ
u :
ℝ → ℝ
o :
sourceObsLikelihood a τ u o :
ℝ
sourceLikelihood a τ (u o.1) (o.2.1, o.2.2.1, o.2.2.2 = 1)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.sourceObsLikelihood · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/ChannelLaws.lean:13
theorem sourceObsLikelihood_eq_cell

Given the supplied inputs, the stated result about source obs likelihood eq cell holds.

Formal statement
a τ :
ℝ
u :
ℝ → ℝ
o :
sourceObsLikelihood a τ u o = sourceLikelihood a τ (u o.1) (o.2.1, o.2.2.1, o.2.2.2 = 1)
Proof (Lean source)
lemma sourceObsLikelihood_eq_cell (a τ : ℝ) (u : ℝ → ℝ) (o : SourceObs) : sourceObsLikelihood a τ u o = sourceLikelihood a τ (u o.1) (o.2.1, o.2.2.1, o.2.2.2 = 1) := rfl
CausalSmith.Stat.TransportCaceRoughnuisanceLength.sourceObsLikelihood_eq_cell · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/ChannelLaws.lean:18
theorem sourceObsLikelihood_on_cell

Given the supplied inputs, the stated result about source obs likelihood on cell holds.

Formal statement
a τ :
ℝ
u :
ℝ → ℝ
x :
ℝ
Proof (Lean source)
lemma sourceObsLikelihood_on_cell (a τ : ℝ) (u : ℝ → ℝ) (x : ℝ) (c : SourceCell) : sourceObsLikelihood a τ u (sourceCellObservation x c) = sourceLikelihood a τ (u x) c := by rcases c with ⟨z, d, y⟩ cases y <;> simp [sourceObsLikelihood, sourceCellObservation, boolReal]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.sourceObsLikelihood_on_cell · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/ChannelLaws.lean:24
theorem sourceObsLikelihood_measurable

Given the supplied inputs, the stated result about source obs likelihood measurable holds.

Formal statement
a τ :
ℝ
u :
ℝ → ℝ
hu :
Proof (Lean source)
lemma sourceObsLikelihood_measurable (a τ : ℝ) (u : ℝ → ℝ) (hu : Measurable u) : Measurable (sourceObsLikelihood a τ u) := by have hcell (z d y : Bool) : Measurable fun o : SourceObs => sourceLikelihood a τ (u o.1) (z, d, y) := by unfold sourceLikelihood sourceDirection sourceCenterMass sourceCellMass assignmentWeight receiptOutcomeCell receiptBase sign cases z <;> cases d <;> cases y <;> simp <;> fun_prop have hz : MeasurableSet {o : SourceObs | o.2.1 = true} := by measurability have hd : MeasurableSet {o : SourceObs | o.2.2.1 = true} := by measurability have hy : MeasurableSet {o : SourceObs | o.2.2.2 = 1} := by measurability have hpiece : Measurable fun o : SourceObs => if o.2.1 then if o.2.2.1 then if o.2.2.2 = 1 then sourceLikelihood a τ (u o.1) (true, true, true) else sourceLikelihood a τ (u o.1) (true, true, false) else if o.2.2.2 = 1 then sourceLikelihood a τ (u o.1) (true, false, true) else sourceLikelihood a τ (u o.1) (true, false, false) else if o.2.2.1 then if o.2.2.2 = 1 then sourceLikelihood a τ (u o.1) (false, true, true) else sourceLikelihood a τ (u o.1) (false, true, false) else if o.2.2.2 = 1 then sourceLikelihood a τ (u o.1) (false, false, true) else sourceLikelihood a τ (u o.1) (false, false, false) := by exact Measurable.ite hz (Measurable.ite hd (Measurable.ite hy (hcell true true true) (hcell true true false)) (Measurable.ite hy (hcell true false true) (hcell true false false))) (Measurable.ite hd (Measurable.ite hy (hcell false true true) (hcell false true false)) (Measurable.ite hy (hcell false false true) (hcell false false false))) convert hpiece using 1 funext o rcases o with ⟨x, z, d, y⟩ cases z <;> cases d <;> by_cases h : y = 1 <;> simp [sourceObsLikelihood, h]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.sourceObsLikelihood_measurable · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/ChannelLaws.lean:32
theorem explicitSourceLaw_apply

Given the supplied inputs, the stated result about explicit source law apply holds.

Formal statement
a :
ℝ
u v :
ℝ → ℝ
hu :
hv :
hA :
= encodedCellSetMass (volume.restrict covariateSpace) (fun x c => ofReal (sourceCellMass a (u x) (v x) c)) sourceCellObservation A
Proof (Lean source)
lemma explicitSourceLaw_apply (a : ℝ) (u v : ℝ → ℝ) (hu : Measurable u) (hv : Measurable v) (A : Set SourceObs) (hA : MeasurableSet A) : explicitSourceLaw a u v A = encodedCellSetMass (volume.restrict covariateSpace) (fun x c => ofReal (sourceCellMass a (u x) (v x) c)) sourceCellObservation A := by classical unfold explicitSourceLaw encodedCellSetMass have hk : Measurable fun x => ∑ c : SourceCell, ofReal (sourceCellMass a (u x) (v x) c) • Measure.dirac (sourceCellObservation x c) := by refine Measure.measurable_of_measurable_coe _ fun B hB => ?_ simp only [Measure.finsetSum_apply] apply Finset.measurable_fun_sum intro c hc simp only [Measure.smul_apply, smul_eq_mul, Measure.dirac_apply' _ hB] have hm : Measurable fun x => sourceCellMass a (u x) (v x) c := by rcases c with ⟨z, d, y⟩ cases z <;> cases d <;> cases y <;> simp [sourceCellMass, assignmentWeight, receiptOutcomeCell, receiptBase, sign] <;> fun_prop (disch := assumption) exact hm.ennreal_ofReal.mul (measurable_one.indicator (hB.preimage (sourceCellObservation_measurable c))) rw [Measure.bind_apply hA hk.aemeasurable] apply lintegral_congr intro x simp only [Measure.finsetSum_apply, Measure.smul_apply, smul_eq_mul, Measure.dirac_apply' _ hA] apply Finset.sum_congr rfl intro c hc simp [indicator]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.explicitSourceLaw_apply · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/ChannelLaws.lean:66
theorem explicitSourceLaw_eq_withDensity

Given the supplied inputs, the stated result about explicit source law eq with density holds.

Formal statement
a τ :
ℝ
u :
ℝ → ℝ
ha :
0 < a ∧ a < 1
hu :
explicitSourceLaw a u (fun x => τ * u x)
= (explicitSourceLaw a (fun _ => 0) (fun _ => 0)).withDensity (fun o => ofReal (sourceObsLikelihood a τ u o))
Proof (Lean source)
lemma explicitSourceLaw_eq_withDensity (a τ : ℝ) (u : ℝ → ℝ) (ha : 0 < a ∧ a < 1) (hu : Measurable u) : explicitSourceLaw a u (fun x => τ * u x) = (explicitSourceLaw a (fun _ => 0) (fun _ => 0)).withDensity (fun o => ofReal (sourceObsLikelihood a τ u o)) := by apply eq_withDensity_of_encodedCellSetMass (volume.restrict covariateSpace) (explicitSourceLaw a (fun _ => 0) (fun _ => 0)) (explicitSourceLaw a u (fun x => τ * u x)) (fun _ c => ofReal (sourceCenterMass a c)) (fun x c => ofReal (sourceCellMass a (u x) (τ * u x) c)) sourceCellObservation (sourceObsLikelihood a τ u) · intro c exact measurable_const · exact sourceCellObservation_measurable · exact sourceObsLikelihood_measurable a τ u hu · intro A hA simpa [sourceCenterMass] using explicitSourceLaw_apply a (fun _ => 0) (fun _ => 0) measurable_const measurable_const A hA · intro A hA exact explicitSourceLaw_apply a u (fun x => τ * u x) hu (measurable_const.mul hu) A hA · intro x c have hp := sourceCenterMass_pos a ha c have hreal : sourceCellMass a (u x) (τ * u x) c = sourceCenterMass a c * sourceLikelihood a τ (u x) c := by rw [sourceCellMass_affine] unfold sourceLikelihood field_simp [ne_of_gt hp] rw [sourceObsLikelihood_on_cell] rw [← ENNReal.ofReal_mul (le_of_lt hp), ← hreal]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.explicitSourceLaw_eq_withDensity · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/ChannelLaws.lean:100
theorem sourceCellMass_nonneg_of_primitive

Given the supplied inputs, the stated result about source cell mass nonneg of primitive holds.

Formal statement
a u v :
ℝ
ha :
a ≠ 0
hu :
u ^ 2 ≠ 1 / 4
hm :
∀ d0 d1 y0 y1, 0 ≤ primitiveMass a u v d0 d1 y0 y1
he :
∀ z, 0 ≤ assignmentWeight u z
0 ≤ sourceCellMass a u v c
Proof (Lean source)
lemma sourceCellMass_nonneg_of_primitive (a u v : ℝ) (ha : a ≠ 0) (hu : u ^ 2 ≠ 1 / 4) (hm : ∀ d0 d1 y0 y1, 0 ≤ primitiveMass a u v d0 d1 y0 y1) (he : ∀ z, 0 ≤ assignmentWeight u z) (c : SourceCell) : 0 ≤ sourceCellMass a u v c := by rcases c with ⟨z, d, y⟩ rw [← observedPrimitiveMass_eq a u v ha hu z d y] apply mul_nonneg (he z) unfold observedPrimitiveMass apply Finset.sum_nonneg intro d0 hd0 apply Finset.sum_nonneg intro d1 hd1 apply Finset.sum_nonneg intro y0 hy0 apply Finset.sum_nonneg intro y1 hy1 split_ifs · exact hm d0 d1 y0 y1 · exact le_rfl
CausalSmith.Stat.TransportCaceRoughnuisanceLength.sourceCellMass_nonneg_of_primitive · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/ChannelLaws.lean:134
theorem sourceObsLikelihood_nonneg_of_cellMass

Given the supplied inputs, the stated result about source obs likelihood nonneg of cell mass holds.

Formal statement
a τ :
ℝ
u :
ℝ → ℝ
ha :
0 < a ∧ a < 1
hq0 :
∀ x c, 0 ≤ sourceCellMass a (u x) (τ * u x) c
o :
0 ≤ sourceObsLikelihood a τ u o
Proof (Lean source)
lemma sourceObsLikelihood_nonneg_of_cellMass (a τ : ℝ) (u : ℝ → ℝ) (ha : 0 < a ∧ a < 1) (hq0 : ∀ x c, 0 ≤ sourceCellMass a (u x) (τ * u x) c) (o : SourceObs) : 0 ≤ sourceObsLikelihood a τ u o := by let c : SourceCell := (o.2.1, o.2.2.1, o.2.2.2 = 1) have hp := sourceCenterMass_pos a ha c have hreal : sourceCellMass a (u o.1) (τ * u o.1) c = sourceCenterMass a c * sourceLikelihood a τ (u o.1) c := by rw [sourceCellMass_affine] unfold sourceLikelihood field_simp [ne_of_gt hp] have hq := hq0 o.1 c rw [hreal] at hq unfold sourceObsLikelihood nlinarith
CausalSmith.Stat.TransportCaceRoughnuisanceLength.sourceObsLikelihood_nonneg_of_cellMass · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/ChannelLaws.lean:156
theorem primitiveMass_sum

Given the supplied inputs, the stated result about primitive mass sum holds.

Formal statement
a u v :
ℝ
ha :
a ≠ 0
hu :
u ^ 2 ≠ 1 / 4
∑ d0 : Bool, ∑ d1 : Bool, ∑ y0 : Bool, ∑ y1 : Bool, primitiveMass a u v d0 d1 y0 y1 = 1
Proof (Lean source)
lemma primitiveMass_sum (a u v : ℝ) (ha : a ≠ 0) (hu : u ^ 2 ≠ 1 / 4) : ∑ d0 : Bool, ∑ d1 : Bool, ∑ y0 : Bool, ∑ y1 : Bool, primitiveMass a u v d0 d1 y0 y1 = 1 := by have hp : 1 + 2 * u ≠ 0 := by intro h apply hu nlinarith have hm : 1 - 2 * u ≠ 0 := by intro h apply hu nlinarith simp [Fintype.sum_bool, primitiveMass, complierMargin, receiptBase, assignmentWeight, sign] field_simp [ha, hp, hm] ring
theorem actualStrength_bounds

Given the supplied inputs, the stated result about actual strength bounds holds.

Formal statement
a :
ℝ
n :
ℕ
hn :
threshold ≤ n
ha :
0 < a ∧ a ≤ 1 / 4
conclusion 1
conclusion 2
actualStrength a n ≤ 1 / 4
Proof (Lean source)
lemma actualStrength_bounds (a : ℝ) (n : ℕ) (hn : threshold ≤ n) (ha : 0 < a ∧ a ≤ 1 / 4) : 0 < actualStrength a n ∧ actualStrength a n ≤ 1 / 4 := by have hn64 : (64 : ℝ) ≤ n := by exact_mod_cast (show 64 ≤ n by have : 256 ≤ n := hn; omega) have hpow : (n : ℝ) ^ (-(1 / 3 : ℝ)) ≤ 1 / 4 := by have h := Real.rpow_le_rpow_of_nonpos (by norm_num : (0 : ℝ) < 64) hn64 (by norm_num : (-(1 / 3 : ℝ)) ≤ 0) norm_num at h ⊢ exact h unfold actualStrength constructor · exact lt_of_lt_of_le ha.1 (le_max_left _ _) · exact max_le ha.2 hpow
CausalSmith.Stat.TransportCaceRoughnuisanceLength.actualStrength_bounds · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/ChannelLaws.lean:191
theorem tiledPerturbation_zero

Given the supplied inputs, the stated result about tiled perturbation zero holds.

Formal statement
n :
ℕ
sgn :
x :
ℝ
tiledPerturbation 0 n sgn x = 0
Proof (Lean source)
lemma tiledPerturbation_zero (n : ℕ) (sgn : Fin (lowerCells n) → Bool) (x : ℝ) : tiledPerturbation 0 n sgn x = 0 := by simp [tiledPerturbation, lowerHeight]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.tiledPerturbation_zero · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/ChannelLaws.lean:207
theorem centerSourceLaw_eq_explicit

Given the supplied inputs, the stated result about center source law eq explicit holds.

Formal statement
a :
ℝ
n :
ℕ
hb :
0 < actualStrength a n ∧ actualStrength a n ≤ 1 / 4
Measure.map observeSource (assignedFrom (primitivePopulation true (fun _ => 1) (fun _ => primitiveMass (actualStrength a n) 0 0)) (fun _ => 1 / 2))
= explicitSourceLaw (actualStrength a n) (fun _ => 0) (fun _ => 0)
Proof (Lean source)
lemma centerSourceLaw_eq_explicit (a : ℝ) (n : ℕ) (hb : 0 < actualStrength a n ∧ actualStrength a n ≤ 1 / 4) : Measure.map observeSource (assignedFrom (primitivePopulation true (fun _ => 1) (fun _ => primitiveMass (actualStrength a n) 0 0)) (fun _ => 1 / 2)) = explicitSourceLaw (actualStrength a n) (fun _ => 0) (fun _ => 0) := by let sgn : Fin (lowerCells n) → Bool := fun _ => false have hm : ∀ x d0 d1 y0 y1, 0 ≤ lowerMass a n 0 0 sgn x d0 d1 y0 y1 := by intro x d0 d1 y0 y1 simp only [lowerMass, tiledPerturbation_zero, coupledPerturbation, zero_mul] exact primitiveMass_nonneg_of_bounds (actualStrength a n) 0 0 hb (by norm_num) (by norm_num) (by nlinarith [hb.1]) d0 d1 y0 y1 have he : ∀ x z, 0 ≤ assignmentWeight (tiledPerturbation 0 n sgn x) z := by intro x z rw [tiledPerturbation_zero] cases z <;> norm_num [assignmentWeight] have h := sourceLaw_eq_explicit_of_nonneg a n 0 0 sgn hm he hb.1 (by intro x rw [tiledPerturbation_zero] norm_num) have hu : tiledPerturbation 0 n sgn = fun _ => 0 := by funext x exact tiledPerturbation_zero n sgn x have hv : coupledPerturbation 0 0 n sgn = fun _ => 0 := by funext x simp [coupledPerturbation] have hlm : lowerMass a n 0 0 sgn = fun _ => primitiveMass (actualStrength a n) 0 0 := by funext x d0 d1 y0 y1 simp [lowerMass, tiledPerturbation_zero, coupledPerturbation] rw [hu, hv, hlm] at h simpa using h
CausalSmith.Stat.TransportCaceRoughnuisanceLength.centerSourceLaw_eq_explicit · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/ChannelLaws.lean:214
CausalSmith.Stat.STAT_TransportCaceRoughnuisanceLength_Research.Helpers.LegalMixture.ChiSquare 2 declarations Finite sign-mixture chi-square and total-variation estimates

Finite sign-mixture chi-square and total-variation estimates

theorem legal_mixture_finite_chiSquare

The legal uniform mixture has an absolutely continuous likelihood with an integrable squared real density deviation relative to the center experiment. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
a :
ℝ
n :
ℕ
cStar τ :
ℝ
hτ :
τ ∈ Icc (-1 : ℝ) 1
hn :
threshold ≤ n
ha :
0 < a ∧ a ≤ 1 / 4
hc :
0 < cStar ∧ cStar ≤ 1 / 100
conclusion 1
(lowerMixture a n cStar τ) ≪ (dataLaw (mixtureCenter a n) n n)
conclusion 2
Integrable (fun ω : TwoSample n n => (((lowerMixture a n cStar τ).rnDeriv (dataLaw (mixtureCenter a n) n n) ω).toReal - 1) ^ 2) (dataLaw (mixtureCenter a n) n n)
Proof (Lean source)
-- @node: legal_mixture_finite_chiSquare lemma legal_mixture_finite_chiSquare (a : ℝ) (n : ℕ) (cStar τ : ℝ) (hτ : τ ∈ Icc (-1 : ℝ) 1) (hn : threshold ≤ n) (ha : 0 < a ∧ a ≤ 1 / 4) (hc : 0 < cStar ∧ cStar ≤ 1 / 100) : (lowerMixture a n cStar τ) ≪ (dataLaw (mixtureCenter a n) n n) ∧ Integrable (fun ω : TwoSample n n => (((lowerMixture a n cStar τ).rnDeriv (dataLaw (mixtureCenter a n) n n) ω).toReal - 1) ^ 2) (dataLaw (mixtureCenter a n) n n) := by exact legal_mixture_finite_chiSquare_support a n cStar τ hτ hn ha hc
CausalSmith.Stat.TransportCaceRoughnuisanceLength.legal_mixture_finite_chiSquare · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/ChiSquare.lean:12
theorem legal_mixture_distance

Given the supplied inputs, the stated result about legal mixture distance holds.

Formal statement
α a :
ℝ
n :
ℕ
cStar τ :
ℝ
hτ :
τ ∈ Icc (-1 : ℝ) 1
hn :
threshold ≤ n
ha :
0 < a ∧ a ≤ 1 / 4
hα :
0 < α ∧ α < 1
hc :
0 < cStar ∧ cStar ≤ 1 / 100 ∧ exp (mixConstant * cStar ^ 4) ≤ 1 + (1 - α) ^ 2
conclusion 1
1 + chiSqDiv (lowerMixture a n cStar τ) (dataLaw (mixtureCenter a n) n n)
≤ exp (mixConstant * cStar ^ 4)
conclusion 2
tvDist (lowerMixture a n cStar τ) (dataLaw (mixtureCenter a n) n n)
≤ (1 - α) / 2
Proof (Lean source)
lemma legal_mixture_distance (α a : ℝ) (n : ℕ) (cStar τ : ℝ) (hτ : τ ∈ Icc (-1 : ℝ) 1) (hn : threshold ≤ n) (ha : 0 < a ∧ a ≤ 1 / 4) (hα : 0 < α ∧ α < 1) (hc : 0 < cStar ∧ cStar ≤ 1 / 100 ∧ exp (mixConstant * cStar ^ 4) ≤ 1 + (1 - α) ^ 2) : 1 + chiSqDiv (lowerMixture a n cStar τ) (dataLaw (mixtureCenter a n) n n) ≤ exp (mixConstant * cStar ^ 4) ∧ tvDist (lowerMixture a n cStar τ) (dataLaw (mixtureCenter a n) n n) ≤ (1 - α) / 2 := by have hsmall : 0 < cStar ∧ cStar ≤ 1 / 100 := ⟨hc.1, hc.2.1⟩ have hchi := legal_chi_exp_bound a n cStar τ hτ hn ha hsmall refine ⟨hchi, ?_⟩ have htv := legal_tv_le_half_sqrt_chi a n cStar τ hτ hn ha hsmall have hchi' : chiSqDiv (lowerMixture a n cStar τ) (dataLaw (mixtureCenter a n) n n) ≤ (1 - α) ^ 2 := by linarith [hc.2.2] have hsqrt : sqrt (chiSqDiv (lowerMixture a n cStar τ) (dataLaw (mixtureCenter a n) n n)) ≤ 1 - α := by rw [Real.sqrt_le_iff] exact ⟨by linarith [hα.2], hchi'⟩ calc tvDist (lowerMixture a n cStar τ) (dataLaw (mixtureCenter a n) n n) ≤ (1 / 2) * sqrt (chiSqDiv (lowerMixture a n cStar τ) (dataLaw (mixtureCenter a n) n n)) := htv _ ≤ (1 - α) / 2 := by nlinarith
CausalSmith.Stat.TransportCaceRoughnuisanceLength.legal_mixture_distance · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/ChiSquare.lean:24
CausalSmith.Stat.STAT_TransportCaceRoughnuisanceLength_Research.Helpers.LegalMixture.ConditionalMargins 9 declarations The normalized primitive kernel disintegrates along its covariate coordinate.

Conditional integration of the primitive finite law

The normalized primitive kernel disintegrates along its covariate coordinate.

theorem primitiveKernel_integrable Lemma primitiveKernel_integrable in the paper ↗

Every real function is integrable against the finite primitive kernel. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
s :
x :
ℝ
mass :
ℝ → Bool → Bool → Bool → Bool → ℝ
f :
FullData → ℝ
Proof (Lean source)
-- @node: primitiveKernel_integrable lemma primitiveKernel_integrable (s : Bool) (x : ℝ) (mass : ℝ → Bool → Bool → Bool → Bool → ℝ) (f : FullData → ℝ) : Integrable f (primitiveKernel s x mass) := by classical unfold primitiveKernel apply integrable_finsetSum_measure.mpr intro d0 _ apply integrable_finsetSum_measure.mpr intro d1 _ apply integrable_finsetSum_measure.mpr intro y0 _ apply integrable_finsetSum_measure.mpr intro y1 _ exact (integrable_dirac (by simp)).smul_measure (by simp)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.primitiveKernel_integrable · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/ConditionalMargins.lean:17
theorem primitiveKernel_integral Lemma primitiveKernel_integral in the paper ↗

The primitive kernel integrates a function by the displayed sixteen-cell sum. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
s :
x :
ℝ
mass :
ℝ → Bool → Bool → Bool → Bool → ℝ
hm0 :
∀ d0 d1 y0 y1, 0 ≤ mass x d0 d1 y0 y1
f :
FullData → ℝ
(∫ o, f o ∂primitiveKernel s x mass)
= ∑ d0 : Bool, ∑ d1 : Bool, ∑ y0 : Bool, ∑ y1 : Bool, mass x d0 d1 y0 y1 * f (s, x, d0, d1, boolReal y0, boolReal y1)
Proof (Lean source)
-- @node: primitiveKernel_integral lemma primitiveKernel_integral (s : Bool) (x : ℝ) (mass : ℝ → Bool → Bool → Bool → Bool → ℝ) (hm0 : ∀ d0 d1 y0 y1, 0 ≤ mass x d0 d1 y0 y1) (f : FullData → ℝ) : (∫ o, f o ∂primitiveKernel s x mass) = ∑ d0 : Bool, ∑ d1 : Bool, ∑ y0 : Bool, ∑ y1 : Bool, mass x d0 d1 y0 y1 * f (s, x, d0, d1, boolReal y0, boolReal y1) := by classical have hi := primitiveKernel_integrable s x mass f unfold primitiveKernel at hi ⊢ rw [integral_finsetSum_measure (integrable_finsetSum_measure.mp hi)] apply Finset.sum_congr rfl intro d0 hd0 have hi1 := integrable_finsetSum_measure.mp hi d0 hd0 rw [integral_finsetSum_measure (integrable_finsetSum_measure.mp hi1)] apply Finset.sum_congr rfl intro d1 hd1 have hi2 := integrable_finsetSum_measure.mp hi1 d1 hd1 rw [integral_finsetSum_measure (integrable_finsetSum_measure.mp hi2)] apply Finset.sum_congr rfl intro y0 hy0 have hi3 := integrable_finsetSum_measure.mp hi2 y0 hy0 rw [integral_finsetSum_measure (integrable_finsetSum_measure.mp hi3)] apply Finset.sum_congr rfl intro y1 hy1 simp [integral_smul_measure, integral_dirac, ENNReal.toReal_ofReal (hm0 _ _ _ _)]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.primitiveKernel_integral · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/ConditionalMargins.lean:34
theorem primitivePopulation_setIntegral Lemma primitivePopulation_setIntegral in the paper ↗

A bounded observable on the primitive atoms disintegrates over every covariate set. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
s :
density :
ℝ → ℝ
mass :
ℝ → Bool → Bool → Bool → Bool → ℝ
IsFiniteMeasure ((volume.restrict covariateSpace).withDensity (fun x => ofReal (density x)))
hm :
∀ d0 d1 y0 y1, Measurable fun x => mass x d0 d1 y0 y1
hm0 :
∀ x d0 d1 y0 y1, 0 ≤ mass x d0 d1 y0 y1
hsum :
∀ x, ∑ d0 : Bool, ∑ d1 : Bool, ∑ y0 : Bool, ∑ y1 : Bool, mass x d0 d1 y0 y1 = 1
f :
FullData → ℝ
hf :
bound :
ℝ
hbound :
∀ x d0 d1 y0 y1, ‖f (s, x, d0, d1, boolReal y0, boolReal y1)‖ ≤ bound
B :
Set ℝ
hB :
(∫ o in {o | covariate o ∈ B}, f o ∂primitivePopulation s density mass)
= ∫ x in B, (∑ d0 : Bool, ∑ d1 : Bool, ∑ y0 : Bool, ∑ y1 : Bool, mass x d0 d1 y0 y1 * f (s, x, d0, d1, boolReal y0, boolReal y1)) ∂(volume.restrict covariateSpace).withDensity (fun x => ofReal (density x))
Proof (Lean source)
-- @node: primitivePopulation_setIntegral lemma primitivePopulation_setIntegral (s : Bool) (density : ℝ → ℝ) (mass : ℝ → Bool → Bool → Bool → Bool → ℝ) [IsFiniteMeasure ((volume.restrict covariateSpace).withDensity (fun x => ofReal (density x)))] (hm : ∀ d0 d1 y0 y1, Measurable fun x => mass x d0 d1 y0 y1) (hm0 : ∀ x d0 d1 y0 y1, 0 ≤ mass x d0 d1 y0 y1) (hsum : ∀ x, ∑ d0 : Bool, ∑ d1 : Bool, ∑ y0 : Bool, ∑ y1 : Bool, mass x d0 d1 y0 y1 = 1) (f : FullData → ℝ) (hf : Measurable f) (bound : ℝ) (hbound : ∀ x d0 d1 y0 y1, ‖f (s, x, d0, d1, boolReal y0, boolReal y1)‖ ≤ bound) (B : Set ℝ) (hB : MeasurableSet B) : (∫ o in {o | covariate o ∈ B}, f o ∂primitivePopulation s density mass) = ∫ x in B, (∑ d0 : Bool, ∑ d1 : Bool, ∑ y0 : Bool, ∑ y1 : Bool, mass x d0 d1 y0 y1 * f (s, x, d0, d1, boolReal y0, boolReal y1)) ∂(volume.restrict covariateSpace).withDensity (fun x => ofReal (density x)) := by classical let μ := (volume.restrict covariateSpace).withDensity (fun x => ofReal (density x)) let κ : Kernel ℝ FullData := ⟨fun x => primitiveKernel s x mass, primitiveKernel_measurable_of s mass hm⟩ have : IsMarkovKernel κ := ⟨fun x => isProbabilityMeasure_iff.mpr (primitiveKernel_univ s x mass (hm0 x) (hsum x))⟩ let atom (x : ℝ) (i : Bool × Bool × Bool × Bool) : FullData := (s, x, i.1, i.2.1, boolReal i.2.2.1, boolReal i.2.2.2) let weight (x : ℝ) (i : Bool × Bool × Bool × Bool) : ℝ := mass x i.1 i.2.1 i.2.2.1 i.2.2.2 have hw : ∀ x i, 0 ≤ weight x i := fun x i => hm0 x _ _ _ _ have hn : ∀ x, ∑ i, weight x i = 1 := by intro x simpa only [weight, Fintype.sum_prod_type] using hsum x have hk : ∀ x, κ x = ∑ i, ofReal (weight x i) • Measure.dirac (atom x i) := by intro x change primitiveKernel s x mass = _ simp only [primitiveKernel, weight, atom, Fintype.sum_prod_type] have hint : Integrable f (κ ∘ₘ μ) := by apply (Measure.integrable_comp_iff hf.aestronglyMeasurable).mpr refine ⟨Filter.Eventually.of_forall (fun x => primitiveKernel_integrable s x mass f), ?_⟩ have heq (x : ℝ) : (∫ o, ‖f o‖ ∂κ x) = ∑ i, weight x i * ‖f (atom x i)‖ := by exact integral_finiteAtomicKernel κ atom weight hw hk (fun o => ‖f o‖) x (primitiveKernel_integrable s x mass (fun o => ‖f o‖)) simp_rw [heq] have hmeas : Measurable (fun x => ∑ i, weight x i * ‖f (atom x i)‖) := by apply Finset.measurable_fun_sum intro i _ exact (hm _ _ _ _).mul ((hf.comp (by dsimp [atom]; fun_prop)).norm) apply (integrable_const bound).mono' hmeas.aestronglyMeasurable filter_upwards [] with x rw [Real.norm_eq_abs, abs_of_nonneg (Finset.sum_nonneg (fun i _ => mul_nonneg (hw x i) (norm_nonneg _)))] calc ∑ i, weight x i * ‖f (atom x i)‖ ≤ ∑ i, weight x i * bound := by apply Finset.sum_le_sum intro i _ exact mul_le_mul_of_nonneg_left (hbound x _ _ _ _) (hw x i) _ = bound := by rw [← Finset.sum_mul, hn]; simp have h := setIntegral_finiteAtomicKernel μ κ atom weight hw hk covariate (by unfold covariate; fun_prop) (by intro x i; rfl) B hB f hint change (∫ o in {o | covariate o ∈ B}, f o ∂primitivePopulation s density mass) = _ at h simpa only [μ, weight, atom, Fintype.sum_prod_type] using h
CausalSmith.Stat.TransportCaceRoughnuisanceLength.primitivePopulation_setIntegral · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/ConditionalMargins.lean:63
theorem primitivePopulation_univ Lemma primitivePopulation_univ in the paper ↗

Normalized primitive masses preserve the total base mass. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
s :
density :
ℝ → ℝ
mass :
ℝ → Bool → Bool → Bool → Bool → ℝ
hm :
∀ d0 d1 y0 y1, Measurable fun x => mass x d0 d1 y0 y1
hm0 :
∀ x d0 d1 y0 y1, 0 ≤ mass x d0 d1 y0 y1
hsum :
∀ x, ∑ d0 : Bool, ∑ d1 : Bool, ∑ y0 : Bool, ∑ y1 : Bool, mass x d0 d1 y0 y1 = 1
primitivePopulation s density mass univ
= ((volume.restrict covariateSpace).withDensity (fun x => ofReal (density x))) univ
Proof (Lean source)
-- @node: primitivePopulation_univ lemma primitivePopulation_univ (s : Bool) (density : ℝ → ℝ) (mass : ℝ → Bool → Bool → Bool → Bool → ℝ) (hm : ∀ d0 d1 y0 y1, Measurable fun x => mass x d0 d1 y0 y1) (hm0 : ∀ x d0 d1 y0 y1, 0 ≤ mass x d0 d1 y0 y1) (hsum : ∀ x, ∑ d0 : Bool, ∑ d1 : Bool, ∑ y0 : Bool, ∑ y1 : Bool, mass x d0 d1 y0 y1 = 1) : primitivePopulation s density mass univ = ((volume.restrict covariateSpace).withDensity (fun x => ofReal (density x))) univ := by unfold primitivePopulation rw [Measure.bind_apply MeasurableSet.univ (primitiveKernel_measurable_of s mass hm).aemeasurable] simp_rw [primitiveKernel_univ s _ mass (hm0 _) (hsum _)] simp
CausalSmith.Stat.TransportCaceRoughnuisanceLength.primitivePopulation_univ · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/ConditionalMargins.lean:130
theorem cond_half_supported_mixture_event Lemma cond_half_supported_mixture_event in the paper ↗

Conditioning a half-mixture on a population event selects its supported component. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
source target :
hS :
hs :
source S = 0
ht :
target S = 1
hu :
target univ = 1
cond ((1 / 2 : ℝ≥0∞) • source + (1 / 2 : ℝ≥0∞) • target) S = target
Proof (Lean source)
-- @node: cond_half_supported_mixture_event lemma cond_half_supported_mixture_event (source target : Measure FullData) (S : Set FullData) (hS : MeasurableSet S) (hs : source S = 0) (ht : target S = 1) (hu : target univ = 1) : cond ((1 / 2 : ℝ≥0∞) • source + (1 / 2 : ℝ≥0∞) • target) S = target := by have hmass : ((1 / 2 : ℝ≥0∞) • source + (1 / 2 : ℝ≥0∞) • target) S = 1 / 2 := by simp [Measure.add_apply, Measure.smul_apply, hs, ht] have hrs : source.restrict S = 0 := Measure.restrict_eq_zero.mpr hs have hrt : target.restrict S = target := by apply Measure.restrict_eq_self_of_ae_mem rw [ae_iff] change target (Sᶜ) = 0 rw [measure_compl hS (by rw [ht]; simp), hu, ht] simp unfold cond rw [hmass, Measure.restrict_add, Measure.restrict_smul, Measure.restrict_smul, hrs, hrt] simp only [smul_zero, zero_add] rw [← mul_smul, ENNReal.inv_mul_cancel (by norm_num) (by norm_num)] exact one_smul _ _
CausalSmith.Stat.TransportCaceRoughnuisanceLength.cond_half_supported_mixture_event · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/ConditionalMargins.lean:147
theorem legalIVComponent_populationLaw_eq_primitive Lemma legalIVComponent_populationLaw_eq_primitive in the paper ↗

The legal law's conditional population is exactly its primitive mixture component. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
a :
ℝ
n :
ℕ
cStar τ :
ℝ
sgn :
hb :
0 < actualStrength a n ∧ actualStrength a n ≤ 1 / 4
hAdm :
LowerAdmissible n a cStar
hτ :
τ ∈ Icc (-1 : ℝ) 1
hn :
0 < n
s :
populationLaw (legalIVComponent a n cStar τ sgn) s
= primitivePopulation s (fun x => if s then 1 else 1 + tiledPerturbation cStar n sgn x) (lowerMass a n cStar τ sgn)
Proof (Lean source)
-- @node: legalIVComponent_populationLaw_eq_primitive lemma legalIVComponent_populationLaw_eq_primitive (a : ℝ) (n : ℕ) (cStar τ : ℝ) (sgn : Fin (lowerCells n) → Bool) (hb : 0 < actualStrength a n ∧ actualStrength a n ≤ 1 / 4) (hAdm : LowerAdmissible n a cStar) (hτ : τ ∈ Icc (-1 : ℝ) 1) (hn : 0 < n) (s : Bool) : populationLaw (legalIVComponent a n cStar τ sgn) s = primitivePopulation s (fun x => if s then 1 else 1 + tiledPerturbation cStar n sgn x) (lowerMass a n cStar τ sgn) := by let mass := lowerMass a n cStar τ sgn have hm := lowerMass_measurable a n cStar τ sgn have hm0 := lowerMass_nonneg a n cStar τ sgn hb hAdm hτ have hsum (x : ℝ) : ∑ d0 : Bool, ∑ d1 : Bool, ∑ y0 : Bool, ∑ y1 : Bool, mass x d0 d1 y0 y1 = 1 := by apply primitiveMass_sum _ _ _ (ne_of_gt hb.1) have h := tiledPerturbation_abs_le_lowerHeight cStar n sgn x hAdm.1.le have h' := le_trans h hAdm.2.1 nlinarith [sq_abs (tiledPerturbation cStar n sgn x), abs_nonneg (tiledPerturbation cStar n sgn x)] have hsource : primitivePopulation true (fun _ => 1) mass univ = 1 := by rw [primitivePopulation_univ true _ mass hm hm0 hsum] simp [covariateSpace] have htarget : primitivePopulation false (fun x => 1 + tiledPerturbation cStar n sgn x) mass univ = 1 := by rw [primitivePopulation_univ false _ mass hm hm0 hsum] apply targetDensity_univ cStar n sgn hn intro x have h := tiledPerturbation_abs_le_lowerHeight cStar n sgn x hAdm.1.le have h' := le_trans h hAdm.2.1 linarith [neg_abs_le (tiledPerturbation cStar n sgn x)] unfold populationLaw legalIVComponent lawFromMass dsimp cases s · apply cond_half_supported_mixture_event · unfold population; measurability · simpa using primitivePopulation_population_event true false (fun _ => 1) mass hm · simpa using (primitivePopulation_population_event false false (fun x => 1 + tiledPerturbation cStar n sgn x) mass hm).trans (by simpa using htarget) · exact htarget · rw [add_comm] apply cond_half_supported_mixture_event · unfold population; measurability · simpa using primitivePopulation_population_event false true (fun x => 1 + tiledPerturbation cStar n sgn x) mass hm · simpa using (primitivePopulation_population_event true true (fun _ => 1) mass hm).trans (by simpa using hsource) · exact hsource
CausalSmith.Stat.TransportCaceRoughnuisanceLength.legalIVComponent_populationLaw_eq_primitive · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/ConditionalMargins.lean:169
theorem legalIVComponent_conditionalMean_of_pointwise

A measurable finite-cell mean is a conditional mean under either legal population. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
a :
ℝ
n :
ℕ
cStar τ :
ℝ
sgn :
hb :
0 < actualStrength a n ∧ actualStrength a n ≤ 1 / 4
hAdm :
LowerAdmissible n a cStar
hτ :
τ ∈ Icc (-1 : ℝ) 1
hn :
0 < n
s :
f :
FullData → ℝ
hf :
bound :
ℝ
hbound :
∀ x d0 d1 y0 y1, ‖f (s, x, d0, d1, boolReal y0, boolReal y1)‖ ≤ bound
q :
ℝ → ℝ
hq :
hmean :
∀ x, lowerPointwiseMean a n cStar τ sgn s f x = q x
ConditionalMean (legalIVComponent a n cStar τ sgn) s f q
Proof (Lean source)
-- @node: legalIVComponent_conditionalMean_of_pointwise lemma legalIVComponent_conditionalMean_of_pointwise (a : ℝ) (n : ℕ) (cStar τ : ℝ) (sgn : Fin (lowerCells n) → Bool) (hb : 0 < actualStrength a n ∧ actualStrength a n ≤ 1 / 4) (hAdm : LowerAdmissible n a cStar) (hτ : τ ∈ Icc (-1 : ℝ) 1) (hn : 0 < n) (s : Bool) (f : FullData → ℝ) (hf : Measurable f) (bound : ℝ) (hbound : ∀ x d0 d1 y0 y1, ‖f (s, x, d0, d1, boolReal y0, boolReal y1)‖ ≤ bound) (q : ℝ → ℝ) (hq : Measurable q) (hmean : ∀ x, lowerPointwiseMean a n cStar τ sgn s f x = q x) : ConditionalMean (legalIVComponent a n cStar τ sgn) s f q := by let density : ℝ → ℝ := fun x => if s then 1 else 1 + tiledPerturbation cStar n sgn x let mass := lowerMass a n cStar τ sgn let μ := (volume.restrict covariateSpace).withDensity (fun x => ofReal (density x)) have hm := lowerMass_measurable a n cStar τ sgn have hm0 := lowerMass_nonneg a n cStar τ sgn hb hAdm hτ have hsum (x : ℝ) : ∑ d0 : Bool, ∑ d1 : Bool, ∑ y0 : Bool, ∑ y1 : Bool, mass x d0 d1 y0 y1 = 1 := by apply primitiveMass_sum _ _ _ (ne_of_gt hb.1) have h := tiledPerturbation_abs_le_lowerHeight cStar n sgn x hAdm.1.le have h' := le_trans h hAdm.2.1 nlinarith [sq_abs (tiledPerturbation cStar n sgn x), abs_nonneg (tiledPerturbation cStar n sgn x)] have hdensity : Measurable density := by cases s · exact measurable_const.add (tiledPerturbation_measurable cStar n sgn) · exact measurable_const have : IsProbabilityMeasure μ := by apply isProbabilityMeasure_iff.mpr cases s · apply targetDensity_univ cStar n sgn hn intro x have h := tiledPerturbation_abs_le_lowerHeight cStar n sgn x hAdm.1.le have h' := le_trans h hAdm.2.1 linarith [neg_abs_le (tiledPerturbation cStar n sgn x)] · simp [μ, density, covariateSpace] refine ⟨hq, ?_⟩ intro B hB rw [legalIVComponent_populationLaw_eq_primitive a n cStar τ sgn hb hAdm hτ hn s] rw [map_covariate_primitivePopulation s density mass hdensity hm hm0 hsum] rw [primitivePopulation_setIntegral s density mass hm hm0 hsum f hf bound hbound B hB] apply setIntegral_congr_fun hB intro x _ exact hmean x
CausalSmith.Stat.TransportCaceRoughnuisanceLength.legalIVComponent_conditionalMean_of_pointwise · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/ConditionalMargins.lean:218
theorem legalIVComponent_conditional_complier_margins

The primitive complier margins give both transport conditional means. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
a :
ℝ
n :
ℕ
cStar τ :
ℝ
sgn :
hb :
0 < actualStrength a n ∧ actualStrength a n ≤ 1 / 4
hAdm :
LowerAdmissible n a cStar
hτ :
τ ∈ Icc (-1 : ℝ) 1
hn :
0 < n
s :
conclusion 1
ConditionalMean (legalIVComponent a n cStar τ sgn) s complier (fun _ => actualStrength a n)
conclusion 2
ConditionalMean (legalIVComponent a n cStar τ sgn) s (fun o => (outcome1 o - outcome0 o) * complier o) (fun x => -(tiledPerturbation cStar n sgn x * coupledPerturbation cStar τ n sgn x) / (1 / 4 - tiledPerturbation cStar n sgn x ^ 2))
Proof (Lean source)
-- @node: legalIVComponent_conditional_complier_margins lemma legalIVComponent_conditional_complier_margins (a : ℝ) (n : ℕ) (cStar τ : ℝ) (sgn : Fin (lowerCells n) → Bool) (hb : 0 < actualStrength a n ∧ actualStrength a n ≤ 1 / 4) (hAdm : LowerAdmissible n a cStar) (hτ : τ ∈ Icc (-1 : ℝ) 1) (hn : 0 < n) (s : Bool) : ConditionalMean (legalIVComponent a n cStar τ sgn) s complier (fun _ => actualStrength a n) ∧ ConditionalMean (legalIVComponent a n cStar τ sgn) s (fun o => (outcome1 o - outcome0 o) * complier o) (fun x => -(tiledPerturbation cStar n sgn x * coupledPerturbation cStar τ n sgn x) / (1 / 4 - tiledPerturbation cStar n sgn x ^ 2)) := by classical have hm : Measurable complier := by have h0 : Measurable receipt0 := by unfold receipt0; fun_prop have h1 : Measurable receipt1 := by unfold receipt1; fun_prop have hset : MeasurableSet {o : FullData | receipt1 o = true ∧ receipt0 o = false} := ((measurableSet_singleton true).preimage h1).inter ((measurableSet_singleton false).preimage h0) convert (measurable_const : Measurable (fun _ : FullData => (1 : ℝ))).ite hset (measurable_const : Measurable (fun _ : FullData => (0 : ℝ))) using 1 · funext o simp [complier] · infer_instance have hY : Measurable (fun o : FullData => (outcome1 o - outcome0 o) * complier o) := by unfold outcome1 outcome0 fun_prop have hpoint (x : ℝ) := lowerPointwiseMean_complier_margins a n cStar τ sgn s x (ne_of_gt hb.1) constructor · apply legalIVComponent_conditionalMean_of_pointwise a n cStar τ sgn hb hAdm hτ hn s complier hm 1 · intro x d0 d1 y0 y1 cases d0 <;> cases d1 <;> norm_num [complier, receipt1, receipt0] · exact measurable_const · exact fun x => (hpoint x).1 · apply legalIVComponent_conditionalMean_of_pointwise a n cStar τ sgn hb hAdm hτ hn s _ hY 1 · intro x d0 d1 y0 y1 cases d0 <;> cases d1 <;> cases y0 <;> cases y1 <;> norm_num [complier, receipt1, receipt0, outcome1, outcome0, boolReal] · have hu := tiledPerturbation_measurable cStar n sgn exact (hu.mul (measurable_const.mul hu)).neg.div (measurable_const.sub (hu.pow_const 2)) · exact fun x => (hpoint x).2
CausalSmith.Stat.TransportCaceRoughnuisanceLength.legalIVComponent_conditional_complier_margins · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/ConditionalMargins.lean:265
theorem mixtureCenter_targetCACE_zero

The center's target effect vanishes by its primitive complier outcome margins. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
a :
ℝ
n :
ℕ
hb :
0 < actualStrength a n ∧ actualStrength a n ≤ 1 / 4
Proof (Lean source)
-- @node: mixtureCenter_targetCACE_zero lemma mixtureCenter_targetCACE_zero (a : ℝ) (n : ℕ) (hb : 0 < actualStrength a n ∧ actualStrength a n ≤ 1 / 4) : targetCACE (mixtureCenter a n) = 0 := by classical let mass : ℝ → Bool → Bool → Bool → Bool → ℝ := fun _ => primitiveMass (actualStrength a n) 0 0 have hm : ∀ d0 d1 y0 y1, Measurable fun x => mass x d0 d1 y0 y1 := fun _ _ _ _ => measurable_const have hm0 : ∀ x d0 d1 y0 y1, 0 ≤ mass x d0 d1 y0 y1 := by intro x d0 d1 y0 y1 exact primitiveMass_nonneg_of_bounds (actualStrength a n) 0 0 hb (by norm_num) (by norm_num) (by nlinarith [hb.1]) d0 d1 y0 y1 have hsum (x : ℝ) : ∑ d0 : Bool, ∑ d1 : Bool, ∑ y0 : Bool, ∑ y1 : Bool, mass x d0 d1 y0 y1 = 1 := primitiveMass_sum (actualStrength a n) 0 0 (ne_of_gt hb.1) (by norm_num) have hu (s : Bool) : primitivePopulation s (fun _ => 1) mass univ = 1 := by rw [primitivePopulation_univ s _ mass hm hm0 hsum] simp [covariateSpace] have hpop : populationLaw (mixtureCenter a n) false = primitivePopulation false (fun _ => 1) mass := by unfold populationLaw mixtureCenter lawFromMass dsimp apply cond_half_supported_mixture_event · unfold population; measurability · simpa using primitivePopulation_population_event true false (fun _ => 1) mass hm · simpa using (primitivePopulation_population_event false false (fun _ => 1) mass hm).trans (by simpa using hu false) · exact hu false have hmC : Measurable complier := by have h0 : Measurable receipt0 := by unfold receipt0; fun_prop have h1 : Measurable receipt1 := by unfold receipt1; fun_prop have hset : MeasurableSet {o : FullData | receipt1 o = true ∧ receipt0 o = false} := ((measurableSet_singleton true).preimage h1).inter ((measurableSet_singleton false).preimage h0) convert (measurable_const : Measurable (fun _ : FullData => (1 : ℝ))).ite hset (measurable_const : Measurable (fun _ : FullData => (0 : ℝ))) using 1 · funext o simp [complier] · infer_instance have hY : Measurable (fun o : FullData => (outcome1 o - outcome0 o) * complier o) := by unfold outcome1 outcome0 fun_prop have hbound (x : ℝ) (d0 d1 y0 y1 : Bool) : ‖(outcome1 (false, x, d0, d1, boolReal y0, boolReal y1) - outcome0 (false, x, d0, d1, boolReal y0, boolReal y1)) * complier (false, x, d0, d1, boolReal y0, boolReal y1)‖ ≤ (1 : ℝ) := by cases d0 <;> cases d1 <;> cases y0 <;> cases y1 <;> norm_num [complier, receipt1, receipt0, outcome1, outcome0, boolReal] have : IsFiniteMeasure ((volume.restrict covariateSpace).withDensity (fun _ => ofReal (1 : ℝ))) := by simp only [ENNReal.ofReal_one] change IsFiniteMeasure ((volume.restrict covariateSpace).withDensity 1) rw [withDensity_one] change IsFiniteMeasure (volume.restrict (Icc (0 : ℝ) 1)) infer_instance have h := primitivePopulation_setIntegral false (fun _ => 1) mass hm hm0 hsum (fun o => (outcome1 o - outcome0 o) * complier o) hY 1 hbound univ MeasurableSet.univ simp only [Set.mem_univ, Set.ofPred_true, Measure.restrict_univ] at h have hmean (x : ℝ) := primitiveMass_complier_outcome_sum (actualStrength a n) 0 0 (ne_of_gt hb.1) false x change (∫ o, (outcome1 o - outcome0 o) * complier o ∂primitivePopulation false (fun _ => 1) mass) = _ at h simp_rw [show ∀ x, (∑ d0 : Bool, ∑ d1 : Bool, ∑ y0 : Bool, ∑ y1 : Bool, mass x d0 d1 y0 y1 * ((outcome1 (false, x, d0, d1, boolReal y0, boolReal y1) - outcome0 (false, x, d0, d1, boolReal y0, boolReal y1)) * complier (false, x, d0, d1, boolReal y0, boolReal y1))) = 0 by intro x; simpa [mass] using hmean x] at h simp only [integral_zero] at h unfold targetCACE rw [hpop, h, zero_div]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.mixtureCenter_targetCACE_zero · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/ConditionalMargins.lean:311
CausalSmith.Stat.STAT_TransportCaceRoughnuisanceLength_Research.Helpers.LegalMixture.Likelihood 45 declarations Likelihood identities for the legal finite sign mixture

Likelihood identities for the legal finite sign mixture

def encodedCellSetMass

The encoded cell set mass object is defined from the supplied inputs.

Definition (Lean source)
X C Ω :
ν :
m :
X → C → ℝ≥0∞
obs :
X → C → Ω
A :
Set Ω
encodedCellSetMass ν m obs A :
ℝ≥0∞
by classical exact ∫⁻ x, ∑ c : C, if obs x c ∈ A then m x c else 0 ∂ν
CausalSmith.Stat.TransportCaceRoughnuisanceLength.encodedCellSetMass · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/Likelihood.lean:15
theorem eq_withDensity_of_encodedCellSetMass

Given the supplied inputs, the encoded-cell measure is the stated density tilt of the base measure.

Formal statement
ν :
μ Q :
p q :
X → C → ℝ≥0∞
obs :
X → C → Ω
L :
Ω → ℝ
hp :
∀ c, Measurable fun x => p x c
hobs :
∀ c, Measurable fun x => obs x c
hL :
hμ :
∀ A
then
μ A = encodedCellSetMass ν p obs A
hQ :
∀ A
then
Q A = encodedCellSetMass ν q obs A
hratio :
∀ x c, q x c = p x c * ofReal (L (obs x c))
Q = μ.withDensity (fun z => ofReal (L z))
Proof (Lean source)
lemma eq_withDensity_of_encodedCellSetMass {X C Ω : Type*} [MeasurableSpace X] [MeasurableSpace Ω] [Fintype C] (ν : Measure X) (μ Q : Measure Ω) (p q : X → C → ℝ≥0∞) (obs : X → C → Ω) (L : Ω → ℝ) (hp : ∀ c, Measurable fun x => p x c) (hobs : ∀ c, Measurable fun x => obs x c) (hL : Measurable L) (hμ : ∀ A, MeasurableSet A → μ A = encodedCellSetMass ν p obs A) (hQ : ∀ A, MeasurableSet A → Q A = encodedCellSetMass ν q obs A) (hratio : ∀ x c, q x c = p x c * ofReal (L (obs x c))) : Q = μ.withDensity (fun z => ofReal (L z)) := by classical let k : X → Measure Ω := fun x => ∑ c : C, p x c • Measure.dirac (obs x c) have hk : Measurable k := by unfold k refine Measure.measurable_of_measurable_coe _ fun s hs => ?_ simp only [Measure.finsetSum_apply] apply Finset.measurable_fun_sum intro c hc simp only [Measure.smul_apply, smul_eq_mul, Measure.dirac_apply' _ hs] exact (hp c).mul (measurable_one.indicator (hs.preimage (hobs c))) have hμbind : μ = ν.bind k := by ext A hA rw [hμ A hA, Measure.bind_apply hA hk.aemeasurable] unfold encodedCellSetMass k apply lintegral_congr intro x simp only [Measure.finsetSum_apply, Measure.smul_apply, smul_eq_mul, Measure.dirac_apply' _ hA] apply Finset.sum_congr rfl intro c hc simp [indicator] let f : Ω → ℝ≥0∞ := fun z => ofReal (L z) have hf : Measurable f := hL.ennreal_ofReal ext A hA have hg : Measurable (A.indicator f) := hf.indicator hA calc Q A = ∫⁻ x, ∑ c : C, if obs x c ∈ A then q x c else 0 ∂ν := hQ A hA _ = ∫⁻ x, ∑ c : C, if obs x c ∈ A then p x c * f (obs x c) else 0 ∂ν := by apply lintegral_congr intro x apply Finset.sum_congr rfl intro c hc simp only [hratio] rfl _ = (μ.withDensity f) A := by rw [withDensity_apply _ hA, ← lintegral_indicator hA, hμbind] rw [Measure.lintegral_bind hk.aemeasurable hg.aemeasurable] apply lintegral_congr intro x change (∑ c : C, if obs x c ∈ A then p x c * f (obs x c) else 0) = ∫⁻ z, A.indicator f z ∂k x unfold k rw [lintegral_finsetSum_measure] simp_rw [lintegral_smul_measure, lintegral_dirac' _ hg] apply Finset.sum_congr rfl intro c hc simp [indicator, smul_eq_mul]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.eq_withDensity_of_encodedCellSetMass · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/Likelihood.lean:22
def SourceCell

The source cell object is defined without additional inputs.

Definition (Lean source)
SourceCell :
Type
Bool × Bool × Bool
def sourceCellMass

The source cell mass object is defined from the supplied inputs.

Definition (Lean source)
a u v :
ℝ
sourceCellMass a u v c :
ℝ
assignmentWeight u c.1 * receiptOutcomeCell a c.1 c.2.1 c.2.2 + v * sign c.2.2 / 4
def sourceCenterMass

The source center mass object is defined from the supplied inputs.

Definition (Lean source)
a :
ℝ
sourceCenterMass a c :
ℝ
CausalSmith.Stat.TransportCaceRoughnuisanceLength.sourceCenterMass · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/Likelihood.lean:98
def sourceDirection

The source direction object is defined from the supplied inputs.

Definition (Lean source)
a τ :
ℝ
sourceDirection a τ c :
ℝ
sign c.1 * receiptOutcomeCell a c.1 c.2.1 c.2.2 + τ * sign c.2.2 / 4
def sourceLikelihood

The source likelihood object is defined from the supplied inputs.

Definition (Lean source)
a τ u :
ℝ
sourceLikelihood a τ u c :
ℝ
1 + u * sourceDirection a τ c / sourceCenterMass a c
def observedPrimitiveMass

The observed primitive mass object is defined from the supplied inputs.

Definition (Lean source)
a u v :
ℝ
z d y :
observedPrimitiveMass a u v z d y :
ℝ
∑ d0 : Bool, ∑ d1 : Bool, ∑ y0 : Bool, ∑ y1 : Bool, if potentialReceipt (true, 0, d0, d1, boolReal y0, boolReal y1) z
= d ∧
potentialOutcome (true, 0, d0, d1, boolReal y0, boolReal y1) d
= boolReal y then primitiveMass a u v d0 d1 y0 y1 else 0
CausalSmith.Stat.TransportCaceRoughnuisanceLength.observedPrimitiveMass · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/Likelihood.lean:111
theorem observedPrimitiveMass_eq

Given the supplied inputs, the stated result about observed primitive mass eq holds.

Formal statement
a u v :
ℝ
ha :
a ≠ 0
hu :
u ^ 2 ≠ 1 / 4
z d y :
assignmentWeight u z * observedPrimitiveMass a u v z d y = sourceCellMass a u v (z, d, y)
Proof (Lean source)
lemma observedPrimitiveMass_eq (a u v : ℝ) (ha : a ≠ 0) (hu : u ^ 2 ≠ 1 / 4) (z d y : Bool) : assignmentWeight u z * observedPrimitiveMass a u v z d y = sourceCellMass a u v (z, d, y) := by have hplus : 1 + u * 2 ≠ 0 := by intro h apply hu nlinarith have hminus : 1 - u * 2 ≠ 0 := by intro h apply hu nlinarith have hquad : 1 - u ^ 2 * 4 ≠ 0 := by intro h apply hu nlinarith have hplus' : 2 * u + 1 ≠ 0 := by intro h; apply hplus; linarith have hminus' : 1 - 2 * u ≠ 0 := by intro h; apply hminus; linarith have hminus'' : 2 * u - 1 ≠ 0 := by intro h; apply hminus; linarith have hquad' : 4 * u ^ 2 - 1 ≠ 0 := by intro h; apply hquad; linarith cases z <;> cases d <;> cases y <;> simp [observedPrimitiveMass, sourceCellMass, primitiveMass, potentialReceipt, potentialOutcome, receipt0, receipt1, outcome0, outcome1, boolReal, assignmentWeight, receiptOutcomeCell, receiptBase, complierMargin, sign] <;> field_simp [ha, hplus, hminus, hquad, hplus', hminus', hminus'', hquad'] <;> apply (mul_left_cancel₀ hplus) <;> field_simp [ha, hplus, hminus, hquad, hplus', hminus', hminus'', hquad'] <;> ring
CausalSmith.Stat.TransportCaceRoughnuisanceLength.observedPrimitiveMass_eq · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/Likelihood.lean:120
theorem sourceCellMass_affine

Given the supplied inputs, the stated result about source cell mass affine holds.

Formal statement
a τ u :
ℝ
sourceCellMass a u (τ * u) c = sourceCenterMass a c + u * sourceDirection a τ c
Proof (Lean source)
lemma sourceCellMass_affine (a τ u : ℝ) (c : SourceCell) : sourceCellMass a u (τ * u) c = sourceCenterMass a c + u * sourceDirection a τ c := by rcases c with ⟨z, d, y⟩ cases z <;> cases y <;> simp [sourceCellMass, sourceCenterMass, sourceDirection, assignmentWeight, sign] <;> ring
CausalSmith.Stat.TransportCaceRoughnuisanceLength.sourceCellMass_affine · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/Likelihood.lean:154
theorem sourceCenterMass_pos

Given the supplied inputs, the stated result about source center mass pos holds.

Formal statement
a :
ℝ
ha :
0 < a ∧ a < 1
Proof (Lean source)
lemma sourceCenterMass_pos (a : ℝ) (ha : 0 < a ∧ a < 1) (c : SourceCell) : 0 < sourceCenterMass a c := by rcases c with ⟨z, d, y⟩ cases z <;> cases d <;> cases y <;> simp [sourceCenterMass, sourceCellMass, assignmentWeight, receiptOutcomeCell, receiptBase, sign] <;> linarith
CausalSmith.Stat.TransportCaceRoughnuisanceLength.sourceCenterMass_pos · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/Likelihood.lean:162
theorem sourceCenterMass_sum

Given the supplied inputs, the stated result about source center mass sum holds.

Formal statement
a :
ℝ
∑ c : SourceCell, sourceCenterMass a c = 1
Proof (Lean source)
lemma sourceCenterMass_sum (a : ℝ) : ∑ c : SourceCell, sourceCenterMass a c = 1 := by rw [Fintype.sum_prod_type] simp_rw [Fintype.sum_prod_type, Fintype.sum_bool] simp [sourceCenterMass, sourceCellMass, assignmentWeight, receiptOutcomeCell, receiptBase, sign] ring
CausalSmith.Stat.TransportCaceRoughnuisanceLength.sourceCenterMass_sum · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/Likelihood.lean:170
theorem sourceDirection_sum

Given the supplied inputs, the stated result about source direction sum holds.

Formal statement
a τ :
ℝ
∑ c : SourceCell, sourceDirection a τ c = 0
Proof (Lean source)
lemma sourceDirection_sum (a τ : ℝ) : ∑ c : SourceCell, sourceDirection a τ c = 0 := by rw [Fintype.sum_prod_type] simp_rw [Fintype.sum_prod_type, Fintype.sum_bool] simp [sourceDirection, receiptOutcomeCell, receiptBase, sign] ring
CausalSmith.Stat.TransportCaceRoughnuisanceLength.sourceDirection_sum · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/Likelihood.lean:179
def sourceOverlapCoefficient

The source overlap coefficient object is defined from the supplied inputs.

Definition (Lean source)
a τ :
ℝ
sourceOverlapCoefficient a τ :
ℝ
4 + 4 * τ ^ 2 / (1 - a ^ 2)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.sourceOverlapCoefficient · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/Likelihood.lean:187
theorem sourceDirection_sq_sum

Given the supplied inputs, the stated result about source direction sq sum holds.

Formal statement
a τ :
ℝ
ha :
a ≠ 1
ha' :
a ≠ -1
Proof (Lean source)
lemma sourceDirection_sq_sum (a τ : ℝ) (ha : a ≠ 1) (ha' : a ≠ -1) : (∑ c : SourceCell, sourceDirection a τ c ^ 2 / sourceCenterMass a c) = sourceOverlapCoefficient a τ := by have h₁ : 1 - a ≠ 0 := sub_ne_zero.mpr ha.symm have h₂ : 1 + a ≠ 0 := by intro h; apply ha'; linarith have h₃ : 1 - a ^ 2 ≠ 0 := by intro h apply mul_ne_zero h₁ h₂ nlinarith have hinv₁ : (1 - a)⁻¹ = (1 + a) / (1 - a ^ 2) := by field_simp [h₁, h₃] ring have hinv₂ : (1 + a)⁻¹ = (1 - a) / (1 - a ^ 2) := by field_simp [h₂, h₃] ring rw [Fintype.sum_prod_type] simp_rw [Fintype.sum_prod_type, Fintype.sum_bool] simp [sourceDirection, sourceCenterMass, sourceCellMass, assignmentWeight, receiptOutcomeCell, receiptBase, sign, sourceOverlapCoefficient] field_simp [h₁, h₂] ring_nf rw [hinv₁, hinv₂] field_simp [h₃] ring
CausalSmith.Stat.TransportCaceRoughnuisanceLength.sourceDirection_sq_sum · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/Likelihood.lean:191
theorem sourceLikelihood_pair_sum

Given the supplied inputs, the stated result about source likelihood pair sum holds.

Formal statement
a τ u w :
ℝ
ha :
0 < a ∧ a < 1
∑ c : SourceCell, sourceCenterMass a c * (sourceLikelihood a τ u c * sourceLikelihood a τ w c)
= 1 + u * w * sourceOverlapCoefficient a τ
Proof (Lean source)
lemma sourceLikelihood_pair_sum (a τ u w : ℝ) (ha : 0 < a ∧ a < 1) : ∑ c : SourceCell, sourceCenterMass a c * (sourceLikelihood a τ u c * sourceLikelihood a τ w c) = 1 + u * w * sourceOverlapCoefficient a τ := by have hpos (c : SourceCell) := sourceCenterMass_pos a ha c simp_rw [sourceLikelihood] have hexpand (c : SourceCell) : sourceCenterMass a c * ((1 + u * sourceDirection a τ c / sourceCenterMass a c) * (1 + w * sourceDirection a τ c / sourceCenterMass a c)) = sourceCenterMass a c + (u + w) * sourceDirection a τ c + u * w * (sourceDirection a τ c ^ 2 / sourceCenterMass a c) := by field_simp [ne_of_gt (hpos c)] ring simp_rw [hexpand] rw [Finset.sum_add_distrib, Finset.sum_add_distrib, sourceCenterMass_sum] simp_rw [← Finset.mul_sum] rw [sourceDirection_sum, sourceDirection_sq_sum a τ (ne_of_lt ha.2) (by linarith [ha.1])] ring
CausalSmith.Stat.TransportCaceRoughnuisanceLength.sourceLikelihood_pair_sum · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/Likelihood.lean:220
def sourceCellObservation

The source cell observation object is defined from the supplied inputs.

Definition (Lean source)
x :
ℝ
sourceCellObservation x c :
(x, c.1, c.2.1, boolReal c.2.2)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.sourceCellObservation · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/Likelihood.lean:244
def explicitSourceLaw

The explicit source law object is defined from the supplied inputs.

Definition (Lean source)
a :
ℝ
u v :
ℝ → ℝ
explicitSourceLaw a u v :
(volume.restrict covariateSpace).bind fun x
=> ∑ c : SourceCell, ofReal (sourceCellMass a (u x) (v x) c) • Measure.dirac (sourceCellObservation x c)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.explicitSourceLaw · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/Likelihood.lean:248
theorem cell_mem_unique

Given the supplied inputs, the stated result about cell mem unique holds.

Formal statement
K :
ℕ
hK :
0 < K
i j :
Fin K
x :
ℝ
hi :
x ∈ cell K i
hj :
x ∈ cell K j
i = j
Proof (Lean source)
lemma cell_mem_unique (K : ℕ) (hK : 0 < K) (i j : Fin K) (x : ℝ) (hi : x ∈ cell K i) (hj : x ∈ cell K j) : i = j := by apply Fin.ext by_contra hne have hlt : i.val < j.val ∨ j.val < i.val := Nat.lt_or_gt_of_ne hne rcases hlt with hij | hji · have hinot : i.val + 1 ≠ K := by omega have hi' : (i.val : ℝ) / K ≤ x ∧ x < ((i.val : ℝ) + 1) / K := by unfold cell at hi simp [hinot] at hi exact hi have hjlo : (j.val : ℝ) / K ≤ x := by unfold cell at hj split_ifs at hj <;> exact hj.1 have hcast : (i.val : ℝ) + 1 ≤ j.val := by exact_mod_cast hij have hKreal : (0 : ℝ) ≤ K := by exact_mod_cast Nat.zero_le K have hdiv : ((i.val : ℝ) + 1) / K ≤ (j.val : ℝ) / K := div_le_div_of_nonneg_right hcast hKreal linarith · have hjnot : j.val + 1 ≠ K := by omega have hj' : (j.val : ℝ) / K ≤ x ∧ x < ((j.val : ℝ) + 1) / K := by unfold cell at hj simp [hjnot] at hj exact hj have hilo : (i.val : ℝ) / K ≤ x := by unfold cell at hi split_ifs at hi <;> exact hi.1 have hcast : (j.val : ℝ) + 1 ≤ i.val := by exact_mod_cast hji have hKreal : (0 : ℝ) ≤ K := by exact_mod_cast Nat.zero_le K have hdiv : ((j.val : ℝ) + 1) / K ≤ (i.val : ℝ) / K := div_le_div_of_nonneg_right hcast hKreal linarith
theorem tiledPerturbation_abs_le_abs_lowerHeight

Given the supplied inputs, the stated result about tiled perturbation abs le abs lower height holds.

Formal statement
cStar :
ℝ
n :
ℕ
sgn :
x :
ℝ
|tiledPerturbation cStar n sgn x| ≤ |lowerHeight cStar n|
Proof (Lean source)
lemma tiledPerturbation_abs_le_abs_lowerHeight (cStar : ℝ) (n : ℕ) (sgn : Fin (lowerCells n) → Bool) (x : ℝ) : |tiledPerturbation cStar n sgn x| ≤ |lowerHeight cStar n| := by classical by_cases hKzero : lowerCells n = 0 · have hempty : IsEmpty (Fin (lowerCells n)) := Fintype.card_eq_zero_iff.mp (by simpa using hKzero) letI := hempty simp [tiledPerturbation] have hK : 0 < lowerCells n := Nat.pos_of_ne_zero hKzero by_cases hex : ∃ i : Fin (lowerCells n), x ∈ cell (lowerCells n) i · obtain ⟨i, hi⟩ := hex unfold tiledPerturbation rw [Finset.sum_eq_single i] · simp only [hi, ↓reduceIte] rw [abs_mul, abs_mul] have hs : |sign (sgn i)| = 1 := by cases sgn i <;> simp [sign] have hb : |bump ((lowerCells n : ℝ) * x - i.val)| ≤ 1 := by simpa [bump] using Real.abs_sin_le_one (2 * pi * ((lowerCells n : ℝ) * x - i.val)) rw [hs, mul_one] exact mul_le_of_le_one_right (abs_nonneg _) hb · intro j hj hji have hnot : x ∉ cell (lowerCells n) j := by intro hx exact hji (cell_mem_unique _ hK j i x hx hi) simp [hnot] · simp · have hnone (i : Fin (lowerCells n)) : x ∉ cell (lowerCells n) i := by intro hi exact hex ⟨i, hi⟩ simp [tiledPerturbation, hnone]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.tiledPerturbation_abs_le_abs_lowerHeight · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/Likelihood.lean:291
theorem tiledPerturbation_abs_le_lowerHeight

Given the supplied inputs, the stated result about tiled perturbation abs le lower height holds.

Formal statement
cStar :
ℝ
n :
ℕ
sgn :
x :
ℝ
hc :
0 ≤ cStar
|tiledPerturbation cStar n sgn x| ≤ lowerHeight cStar n
Proof (Lean source)
lemma tiledPerturbation_abs_le_lowerHeight (cStar : ℝ) (n : ℕ) (sgn : Fin (lowerCells n) → Bool) (x : ℝ) (hc : 0 ≤ cStar) : |tiledPerturbation cStar n sgn x| ≤ lowerHeight cStar n := by have hh : 0 ≤ lowerHeight cStar n := by unfold lowerHeight positivity simpa [abs_of_nonneg hh] using tiledPerturbation_abs_le_abs_lowerHeight cStar n sgn x
CausalSmith.Stat.TransportCaceRoughnuisanceLength.tiledPerturbation_abs_le_lowerHeight · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/Likelihood.lean:325
theorem assignmentWeight_tiled_mem_Icc Lemma assignmentWeight_tiled_mem_Icc in the paper ↗

Admissibility bounds the covariate-indexed assignment probabilities. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
a cStar :
ℝ
n :
ℕ
hDomain :
sgn :
z :
x :
ℝ
hx :
assignmentWeight (tiledPerturbation cStar n sgn x) z ∈ Icc (0 : ℝ) 1
Proof (Lean source)
-- @node: assignmentWeight_tiled_mem_Icc lemma assignmentWeight_tiled_mem_Icc (a cStar : ℝ) (n : ℕ) (hDomain : LowerExperimentDomain n a cStar) (sgn : Fin (lowerCells n) → Bool) (z : Bool) (x : ℝ) (hx : x ∈ covariateSpace) : assignmentWeight (tiledPerturbation cStar n sgn x) z ∈ Icc (0 : ℝ) 1 := by -- @realizes e_z^{(\lambda)}(covariate-indexed range from tiled perturbation and Adm) apply assignmentWeight_mem_Icc apply abs_le.mp have hu := tiledPerturbation_abs_le_lowerHeight cStar n sgn x hDomain.2.1.le exact le_trans hu (le_trans hDomain.2.2.1 (by norm_num))
CausalSmith.Stat.TransportCaceRoughnuisanceLength.assignmentWeight_tiled_mem_Icc · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/Likelihood.lean:336
theorem complierMargin_nonneg_of_bounds

Given the supplied inputs, the stated result about complier margin nonneg of bounds holds.

Formal statement
b u v :
ℝ
hb :
0 < b
hu :
|u| ≤ 3 / 16
hv :
|v| ≤ |u|
hadm :
u ^ 2 ≤ b * (1 / 4 - u ^ 2)
d y :
0 ≤ complierMargin b u v d y
Proof (Lean source)
lemma complierMargin_nonneg_of_bounds (b u v : ℝ) (hb : 0 < b) (hu : |u| ≤ 3 / 16) (hv : |v| ≤ |u|) (hadm : u ^ 2 ≤ b * (1 / 4 - u ^ 2)) (d y : Bool) : 0 ≤ complierMargin b u v d y := by have hu2 : u ^ 2 ≤ (3 / 16 : ℝ) ^ 2 := by apply (sq_le_sq).2 simpa [abs_of_nonneg (by norm_num : (0 : ℝ) ≤ 3 / 16)] using hu have hden : 0 < (1 / 4 : ℝ) - u ^ 2 := by nlinarith have huv : |u * v| ≤ u ^ 2 := by rw [abs_mul] nlinarith [abs_nonneg u, sq_abs u] have hlower : -(b * (1 / 4 - u ^ 2)) ≤ u * v := neg_le_of_abs_le (le_trans huv hadm) have hupper : u * v ≤ b * (1 / 4 - u ^ 2) := by exact le_trans (le_abs_self _) (le_trans huv hadm) have hden2 : 0 < 2 * ((1 / 4 : ℝ) - u ^ 2) := by positivity have hflo : -(b / 2) ≤ u * v / (2 * (1 / 4 - u ^ 2)) := by rw [le_div_iff₀ hden2] nlinarith have hfhi : u * v / (2 * (1 / 4 - u ^ 2)) ≤ b / 2 := by rw [div_le_iff₀ hden2] nlinarith cases d <;> cases y <;> simp [complierMargin, sign, neg_div] <;> linarith
CausalSmith.Stat.TransportCaceRoughnuisanceLength.complierMargin_nonneg_of_bounds · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/Likelihood.lean:346
theorem primitiveMass_nonneg_of_bounds

Given the supplied inputs, the stated result about primitive mass nonneg of bounds holds.

Formal statement
b u v :
ℝ
hb :
0 < b ∧ b ≤ 1 / 4
hu :
|u| ≤ 3 / 16
hv :
|v| ≤ |u|
hadm :
u ^ 2 ≤ b * (1 / 4 - u ^ 2)
d0 d1 y0 y1 :
0 ≤ primitiveMass b u v d0 d1 y0 y1
Proof (Lean source)
lemma primitiveMass_nonneg_of_bounds (b u v : ℝ) (hb : 0 < b ∧ b ≤ 1 / 4) (hu : |u| ≤ 3 / 16) (hv : |v| ≤ |u|) (hadm : u ^ 2 ≤ b * (1 / 4 - u ^ 2)) (d0 d1 y0 y1 : Bool) : 0 ≤ primitiveMass b u v d0 d1 y0 y1 := by have hu_lo : -(3 / 16 : ℝ) ≤ u := (abs_le.mp hu).1 have hu_hi : u ≤ 3 / 16 := (abs_le.mp hu).2 have he0 : 0 < assignmentWeight u false := by simp [assignmentWeight] linarith have he1 : 0 < assignmentWeight u true := by simp [assignmentWeight] linarith have hvbound : |v| ≤ 3 / 16 := le_trans hv hu have hvlo : -(3 / 16 : ℝ) ≤ v := (abs_le.mp hvbound).1 have hvhi : v ≤ 3 / 16 := (abs_le.mp hvbound).2 have hd0 : 0 < 4 * ((1 / 2 : ℝ) - u) := by nlinarith have hd1 : 0 < 4 * ((1 / 2 : ℝ) + u) := by nlinarith have hf0lo : -(3 / 20 : ℝ) ≤ v / (4 * (1 / 2 - u)) := by rw [le_div_iff₀ hd0] nlinarith have hf0hi : v / (4 * (1 / 2 - u)) ≤ 3 / 20 := by rw [div_le_iff₀ hd0] nlinarith have hf1lo : -(3 / 20 : ℝ) ≤ v / (4 * (1 / 2 + u)) := by rw [le_div_iff₀ hd1] nlinarith have hf1hi : v / (4 * (1 / 2 + u)) ≤ 3 / 20 := by rw [div_le_iff₀ hd1] nlinarith have hm (d y : Bool) : 0 ≤ complierMargin b u v d y := complierMargin_nonneg_of_bounds b u v hb.1 hu hv hadm d y simp only [primitiveMass] split_ifs · exact div_nonneg (mul_nonneg (hm false y0) (hm true y1)) hb.1.le · cases y1 <;> simp [receiptBase, sign, assignmentWeight, neg_div] <;> linarith · cases y0 <;> simp [receiptBase, sign, assignmentWeight, neg_div] <;> linarith · exact le_rfl
CausalSmith.Stat.TransportCaceRoughnuisanceLength.primitiveMass_nonneg_of_bounds · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/Likelihood.lean:371
theorem lowerMass_nonneg

Given the supplied inputs, every lower-construction latent-cell mass is nonnegative.

Formal statement
a :
ℝ
n :
ℕ
cStar τ :
ℝ
sgn :
hb :
0 < actualStrength a n ∧ actualStrength a n ≤ 1 / 4
hAdm :
LowerAdmissible n a cStar
hτ :
τ ∈ Icc (-1 : ℝ) 1
x :
ℝ
d0 d1 y0 y1 :
0 ≤ lowerMass a n cStar τ sgn x d0 d1 y0 y1
Proof (Lean source)
lemma lowerMass_nonneg (a : ℝ) (n : ℕ) (cStar τ : ℝ) (sgn : Fin (lowerCells n) → Bool) (hb : 0 < actualStrength a n ∧ actualStrength a n ≤ 1 / 4) (hAdm : LowerAdmissible n a cStar) (hτ : τ ∈ Icc (-1 : ℝ) 1) (x : ℝ) (d0 d1 y0 y1 : Bool) : 0 ≤ lowerMass a n cStar τ sgn x d0 d1 y0 y1 := by let u := tiledPerturbation cStar n sgn x let v := coupledPerturbation cStar τ n sgn x have hh0 : 0 ≤ lowerHeight cStar n := by unfold lowerHeight exact mul_nonneg hAdm.1.le (Real.rpow_nonneg (by positivity) _) have hu : |u| ≤ lowerHeight cStar n := by exact tiledPerturbation_abs_le_lowerHeight cStar n sgn x hAdm.1.le have hu_small : |u| ≤ 3 / 16 := le_trans hu hAdm.2.1 have hτabs : |τ| ≤ 1 := abs_le.mpr hτ have hv : |v| ≤ |u| := by unfold v coupledPerturbation rw [abs_mul] exact mul_le_of_le_one_left (abs_nonneg u) hτabs have hu_sq : u ^ 2 ≤ lowerHeight cStar n ^ 2 := by rw [sq_le_sq] simpa [abs_of_nonneg hh0] using hu have hadm : u ^ 2 ≤ actualStrength a n * (1 / 4 - u ^ 2) := by have hmono : actualStrength a n * (1 / 4 - lowerHeight cStar n ^ 2) ≤ actualStrength a n * (1 / 4 - u ^ 2) := by gcongr exact hb.1.le exact le_trans (le_trans hu_sq hAdm.2.2) hmono exact primitiveMass_nonneg_of_bounds (actualStrength a n) u v hb hu_small hv hadm d0 d1 y0 y1
theorem lowerAssignmentWeight_mem_Icc

Given the supplied inputs, the stated result about lower assignment weight mem icc holds.

Formal statement
a :
ℝ
n :
ℕ
cStar τ :
ℝ
sgn :
hAdm :
LowerAdmissible n a cStar
x :
ℝ
z :
assignmentWeight (tiledPerturbation cStar n sgn x) z ∈ Icc (0 : ℝ) 1
Proof (Lean source)
lemma lowerAssignmentWeight_mem_Icc (a : ℝ) (n : ℕ) (cStar τ : ℝ) (sgn : Fin (lowerCells n) → Bool) (hAdm : LowerAdmissible n a cStar) (x : ℝ) (z : Bool) : assignmentWeight (tiledPerturbation cStar n sgn x) z ∈ Icc (0 : ℝ) 1 := by apply assignmentWeight_mem_Icc have hu := tiledPerturbation_abs_le_lowerHeight cStar n sgn x hAdm.1.le apply abs_le.mp exact le_trans hu (le_trans hAdm.2.1 (by norm_num))
CausalSmith.Stat.TransportCaceRoughnuisanceLength.lowerAssignmentWeight_mem_Icc · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/Likelihood.lean:447
def lowerAssignmentKernel

The lower assignment kernel object is defined from the supplied inputs.

Definition (Lean source)
cStar :
ℝ
n :
ℕ
sgn :
o :
lowerAssignmentKernel cStar n sgn o :
∑ z : Bool, ofReal (assignmentWeight (tiledPerturbation cStar n sgn (covariate o)) z) • Measure.dirac (o, z, potentialReceipt o z, potentialOutcome o (potentialReceipt o z))
CausalSmith.Stat.TransportCaceRoughnuisanceLength.lowerAssignmentKernel · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/Likelihood.lean:457
theorem tiledPerturbation_measurable

Given the supplied inputs, the stated result about tiled perturbation measurable holds.

Formal statement
cStar :
ℝ
n :
ℕ
sgn :
Proof (Lean source)
lemma tiledPerturbation_measurable (cStar : ℝ) (n : ℕ) (sgn : Fin (lowerCells n) → Bool) : Measurable (tiledPerturbation cStar n sgn) := by classical unfold tiledPerturbation apply Finset.measurable_fun_sum intro i hi apply Measurable.ite · unfold cell split_ifs <;> measurability · unfold bump fun_prop · exact measurable_const
CausalSmith.Stat.TransportCaceRoughnuisanceLength.tiledPerturbation_measurable · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/Likelihood.lean:466
theorem lowerMass_measurable

Given the supplied inputs, the stated result about lower mass measurable holds.

Formal statement
a :
ℝ
n :
ℕ
cStar τ :
ℝ
sgn :
d0 d1 y0 y1 :
Measurable fun x => lowerMass a n cStar τ sgn x d0 d1 y0 y1
Proof (Lean source)
lemma lowerMass_measurable (a : ℝ) (n : ℕ) (cStar τ : ℝ) (sgn : Fin (lowerCells n) → Bool) (d0 d1 y0 y1 : Bool) : Measurable fun x => lowerMass a n cStar τ sgn x d0 d1 y0 y1 := by unfold lowerMass primitiveMass complierMargin coupledPerturbation assignmentWeight receiptBase sign have hu := tiledPerturbation_measurable cStar n sgn split_ifs <;> fun_prop
CausalSmith.Stat.TransportCaceRoughnuisanceLength.lowerMass_measurable · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/Likelihood.lean:481
theorem lowerPrimitiveKernel_measurable

Given the supplied inputs, the stated result about lower primitive kernel measurable holds.

Formal statement
a :
ℝ
n :
ℕ
cStar τ :
ℝ
sgn :
Measurable fun x => primitiveKernel true x (lowerMass a n cStar τ sgn)
Proof (Lean source)
lemma lowerPrimitiveKernel_measurable (a : ℝ) (n : ℕ) (cStar τ : ℝ) (sgn : Fin (lowerCells n) → Bool) : Measurable fun x => primitiveKernel true x (lowerMass a n cStar τ sgn) := by classical refine Measure.measurable_of_measurable_coe _ fun A hA => ?_ simp only [primitiveKernel, Measure.finsetSum_apply] apply Finset.measurable_fun_sum intro d0 hd0 apply Finset.measurable_fun_sum intro d1 hd1 apply Finset.measurable_fun_sum intro y0 hy0 apply Finset.measurable_fun_sum intro y1 hy1 simp only [Measure.smul_apply, smul_eq_mul, Measure.dirac_apply' _ hA] exact (lowerMass_measurable a n cStar τ sgn d0 d1 y0 y1).ennreal_ofReal.mul (measurable_one.indicator (hA.preimage (by fun_prop)))
CausalSmith.Stat.TransportCaceRoughnuisanceLength.lowerPrimitiveKernel_measurable · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/Likelihood.lean:490
theorem lowerAssignmentKernel_measurable

Given the supplied inputs, the stated result about lower assignment kernel measurable holds.

Formal statement
n :
ℕ
cStar :
ℝ
sgn :
Measurable fun o : FullData
=> ofReal (assignmentWeight (tiledPerturbation cStar n sgn (covariate o)) true) • Measure.dirac (o, true, potentialReceipt o true, potentialOutcome o (potentialReceipt o true))
+ ofReal (1 - assignmentWeight (tiledPerturbation cStar n sgn (covariate o)) true) • Measure.dirac (o, false, potentialReceipt o false, potentialOutcome o (potentialReceipt o false))
Proof (Lean source)
lemma lowerAssignmentKernel_measurable (n : ℕ) (cStar : ℝ) (sgn : Fin (lowerCells n) → Bool) : Measurable fun o : FullData => ofReal (assignmentWeight (tiledPerturbation cStar n sgn (covariate o)) true) • Measure.dirac (o, true, potentialReceipt o true, potentialOutcome o (potentialReceipt o true)) + ofReal (1 - assignmentWeight (tiledPerturbation cStar n sgn (covariate o)) true) • Measure.dirac (o, false, potentialReceipt o false, potentialOutcome o (potentialReceipt o false)) := by refine Measure.measurable_of_measurable_coe _ fun A hA => ?_ simp only [Measure.add_apply, Measure.smul_apply, smul_eq_mul, Measure.dirac_apply' _ hA] have hu : Measurable fun o : FullData => tiledPerturbation cStar n sgn (covariate o) := (tiledPerturbation_measurable cStar n sgn).comp (by unfold covariate fun_prop) have hw : Measurable fun o : FullData => assignmentWeight (tiledPerturbation cStar n sgn (covariate o)) true := by unfold assignmentWeight simp exact measurable_const.add hu have hp₁ : Measurable fun o : FullData => (o, true, potentialReceipt o true, potentialOutcome o (potentialReceipt o true)) := by simp only [potentialReceipt, Bool.true_eq, ↓reduceIte] have hr : Measurable fun o : FullData => receipt1 o := by unfold receipt1 fun_prop have hy : Measurable fun o : FullData => if receipt1 o then outcome1 o else outcome0 o := by apply Measurable.ite · exact (measurableSet_singleton true).preimage hr · unfold outcome1 fun_prop · unfold outcome0 fun_prop exact measurable_id.prodMk (measurable_const.prodMk (hr.prodMk hy)) have hp₀ : Measurable fun o : FullData => (o, false, potentialReceipt o false, potentialOutcome o (potentialReceipt o false)) := by simp only [potentialReceipt, Bool.false_eq, ↓reduceIte] have hr : Measurable fun o : FullData => receipt0 o := by unfold receipt0 fun_prop have hy : Measurable fun o : FullData => if receipt0 o then outcome1 o else outcome0 o := by apply Measurable.ite · exact (measurableSet_singleton true).preimage hr · unfold outcome1 fun_prop · unfold outcome0 fun_prop exact measurable_id.prodMk (measurable_const.prodMk (hr.prodMk hy)) exact ((hw.ennreal_ofReal.mul (measurable_one.indicator (hA.preimage hp₁))).add ((measurable_const.sub hw).ennreal_ofReal.mul (measurable_one.indicator (hA.preimage hp₀))))
CausalSmith.Stat.TransportCaceRoughnuisanceLength.lowerAssignmentKernel_measurable · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/Likelihood.lean:509
theorem observedPrimitiveENNMass_eq

Given the supplied inputs, the stated result about observed primitive ennmass eq holds.

Formal statement
a u v :
ℝ
ha :
a ≠ 0
hu :
u ^ 2 ≠ 1 / 4
hm :
∀ d0 d1 y0 y1 : Bool, 0 ≤ primitiveMass a u v d0 d1 y0 y1
he :
∀ z : Bool, 0 ≤ assignmentWeight u z
z d y :
(∑ d0 : Bool, ∑ d1 : Bool, ∑ y0 : Bool, ∑ y1 : Bool, if potentialReceipt (true, 0, d0, d1, boolReal y0, boolReal y1) z = d ∧ potentialOutcome (true, 0, d0, d1, boolReal y0, boolReal y1) d = boolReal y then ofReal (primitiveMass a u v d0 d1 y0 y1) * ofReal (assignmentWeight u z) else 0)
= ofReal (sourceCellMass a u v (z, d, y))
Proof (Lean source)
lemma observedPrimitiveENNMass_eq (a u v : ℝ) (ha : a ≠ 0) (hu : u ^ 2 ≠ 1 / 4) (hm : ∀ d0 d1 y0 y1 : Bool, 0 ≤ primitiveMass a u v d0 d1 y0 y1) (he : ∀ z : Bool, 0 ≤ assignmentWeight u z) (z d y : Bool) : (∑ d0 : Bool, ∑ d1 : Bool, ∑ y0 : Bool, ∑ y1 : Bool, if potentialReceipt (true, 0, d0, d1, boolReal y0, boolReal y1) z = d ∧ potentialOutcome (true, 0, d0, d1, boolReal y0, boolReal y1) d = boolReal y then ofReal (primitiveMass a u v d0 d1 y0 y1) * ofReal (assignmentWeight u z) else 0) = ofReal (sourceCellMass a u v (z, d, y)) := by rw [← observedPrimitiveMass_eq a u v ha hu z d y] rw [ENNReal.ofReal_mul (he z)] unfold observedPrimitiveMass have hr (d0 d1 y0 y1 : Bool) : 0 ≤ (if potentialReceipt (true, 0, d0, d1, boolReal y0, boolReal y1) z = d ∧ potentialOutcome (true, 0, d0, d1, boolReal y0, boolReal y1) d = boolReal y then primitiveMass a u v d0 d1 y0 y1 else 0) := by split_ifs · exact hm d0 d1 y0 y1 · exact le_rfl rw [ENNReal.ofReal_sum_of_nonneg (fun d0 _ => Finset.sum_nonneg fun d1 _ => Finset.sum_nonneg fun y0 _ => Finset.sum_nonneg fun y1 _ => hr d0 d1 y0 y1)] simp_rw [ENNReal.ofReal_sum_of_nonneg (fun d1 _ => Finset.sum_nonneg fun y0 _ => Finset.sum_nonneg fun y1 _ => hr _ d1 y0 y1)] simp_rw [ENNReal.ofReal_sum_of_nonneg (fun y0 _ => Finset.sum_nonneg fun y1 _ => hr _ _ y0 y1)] simp_rw [ENNReal.ofReal_sum_of_nonneg (fun y1 _ => hr _ _ _ y1)] simp_rw [Finset.mul_sum] apply Finset.sum_congr rfl intro d0 hd0 apply Finset.sum_congr rfl intro d1 hd1 apply Finset.sum_congr rfl intro y0 hy0 apply Finset.sum_congr rfl intro y1 hy1 split_ifs with h · ac_rfl · simp
CausalSmith.Stat.TransportCaceRoughnuisanceLength.observedPrimitiveENNMass_eq · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/Likelihood.lean:572
theorem finite_sum_group_by_weighted

Given the supplied inputs, summing over observations can be regrouped as the corresponding finite weighted cell sum.

Formal statement
Z C :
w :
Z → ℝ≥0∞
obs :
Z → C
φ :
C → ℝ≥0∞
(∑ z : Z, w z * φ (obs z)) = ∑ c : C, (∑ z : Z, if obs z = c then w z else 0) * φ c
Proof (Lean source)
lemma finite_sum_group_by_weighted {Z C : Type*} [Fintype Z] [Fintype C] [DecidableEq C] (w : Z → ℝ≥0∞) (obs : Z → C) (φ : C → ℝ≥0∞) : (∑ z : Z, w z * φ (obs z)) = ∑ c : C, (∑ z : Z, if obs z = c then w z else 0) * φ c := by classical simp_rw [Finset.sum_mul] rw [Finset.sum_comm] apply Finset.sum_congr rfl intro z hz rw [Finset.sum_eq_single (obs z)] · simp · intro c hc hne have hne' : obs z ≠ c := Ne.symm hne simp [hne'] · simp
CausalSmith.Stat.TransportCaceRoughnuisanceLength.finite_sum_group_by_weighted · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/Likelihood.lean:616
def SourceLatent

The source latent object is defined without additional inputs.

Definition (Lean source)
SourceLatent :
Type
((((Bool × Bool) × Bool) × Bool) × Bool)
def sourceLatentCell

The source latent cell object is defined without additional inputs.

Definition (Lean source)
sourceLatentCell :
| ((((d0, d1), y0), y1), z)
=> (z, if z then d1 else d0, if (if z then d1 else d0) then y1 else y0)
def sourceLatentWeight

The source latent weight object is defined from the supplied inputs.

Definition (Lean source)
a u v :
ℝ
sourceLatentWeight a u v :
SourceLatent → ℝ≥0∞
| ((((d0, d1), y0), y1), z)
=> ofReal (primitiveMass a u v d0 d1 y0 y1) * ofReal (assignmentWeight u z)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.sourceLatentWeight · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/Likelihood.lean:642
theorem sourceLatentWeight_group_eq

Given the supplied inputs, the stated result about source latent weight group eq holds.

Formal statement
a u v :
ℝ
ha :
a ≠ 0
hu :
u ^ 2 ≠ 1 / 4
hm :
∀ d0 d1 y0 y1 : Bool, 0 ≤ primitiveMass a u v d0 d1 y0 y1
he :
∀ z : Bool, 0 ≤ assignmentWeight u z
(∑ q : SourceLatent, if sourceLatentCell q = c then sourceLatentWeight a u v q else 0)
Proof (Lean source)
lemma sourceLatentWeight_group_eq (a u v : ℝ) (ha : a ≠ 0) (hu : u ^ 2 ≠ 1 / 4) (hm : ∀ d0 d1 y0 y1 : Bool, 0 ≤ primitiveMass a u v d0 d1 y0 y1) (he : ∀ z : Bool, 0 ≤ assignmentWeight u z) (c : SourceCell) : (∑ q : SourceLatent, if sourceLatentCell q = c then sourceLatentWeight a u v q else 0) = ofReal (sourceCellMass a u v c) := by rcases c with ⟨z, d, y⟩ rw [← observedPrimitiveENNMass_eq a u v ha hu hm he z d y] rw [Fintype.sum_prod_type] simp_rw [Fintype.sum_prod_type] simp only [sourceLatentCell, sourceLatentWeight, potentialReceipt, potentialOutcome, receipt0, receipt1, outcome0, outcome1] apply Finset.sum_congr rfl intro d0 hd0 apply Finset.sum_congr rfl intro d1 hd1 apply Finset.sum_congr rfl intro y0 hy0 apply Finset.sum_congr rfl intro y1 hy1 cases z <;> cases d <;> cases y <;> cases d0 <;> cases d1 <;> cases y0 <;> cases y1 <;> simp [boolReal]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.sourceLatentWeight_group_eq · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/Likelihood.lean:648
theorem sourceLatent_sum_expand

Given the supplied inputs, the source latent-cell sum expands into its explicit finite expression.

Formal statement
a u v :
ℝ
φ :
SourceCell → ℝ≥0∞
(∑ d0 : Bool, ∑ d1 : Bool, ∑ y0 : Bool, ∑ y1 : Bool, ∑ z : Bool, ofReal (primitiveMass a u v d0 d1 y0 y1) * ofReal (assignmentWeight u z) * φ (z, if z then d1 else d0, if (if z then d1 else d0) then y1 else y0))
Proof (Lean source)
lemma sourceLatent_sum_expand (a u v : ℝ) (φ : SourceCell → ℝ≥0∞) : (∑ d0 : Bool, ∑ d1 : Bool, ∑ y0 : Bool, ∑ y1 : Bool, ∑ z : Bool, ofReal (primitiveMass a u v d0 d1 y0 y1) * ofReal (assignmentWeight u z) * φ (z, if z then d1 else d0, if (if z then d1 else d0) then y1 else y0)) = ∑ q : SourceLatent, sourceLatentWeight a u v q * φ (sourceLatentCell q) := by rw [Fintype.sum_prod_type] simp_rw [Fintype.sum_prod_type] rfl
CausalSmith.Stat.TransportCaceRoughnuisanceLength.sourceLatent_sum_expand · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/Likelihood.lean:674
theorem observe_assigned_latent

Given the supplied inputs, the stated result about observe assigned latent holds.

Formal statement
x :
ℝ
d0 d1 y0 y1 z :
observeSource ((true, x, d0, d1, boolReal y0, boolReal y1), z, potentialReceipt (true, x, d0, d1, boolReal y0, boolReal y1) z, potentialOutcome (true, x, d0, d1, boolReal y0, boolReal y1) (potentialReceipt (true, x, d0, d1, boolReal y0, boolReal y1) z))
= sourceCellObservation x (z, if z then d1 else d0, if (if z then d1 else d0) then y1 else y0)
Proof (Lean source)
lemma observe_assigned_latent (x : ℝ) (d0 d1 y0 y1 z : Bool) : observeSource ((true, x, d0, d1, boolReal y0, boolReal y1), z, potentialReceipt (true, x, d0, d1, boolReal y0, boolReal y1) z, potentialOutcome (true, x, d0, d1, boolReal y0, boolReal y1) (potentialReceipt (true, x, d0, d1, boolReal y0, boolReal y1) z)) = sourceCellObservation x (z, if z then d1 else d0, if (if z then d1 else d0) then y1 else y0) := by cases z <;> cases d0 <;> cases d1 <;> simp [observeSource, sourceCellObservation, covariate, potentialReceipt, potentialOutcome, receipt0, receipt1, outcome0, outcome1, boolReal]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.observe_assigned_latent · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/Likelihood.lean:686
theorem sourceCellObservation_measurable

Given the supplied inputs, the stated result about source cell observation measurable holds.

Formal statement
Proof (Lean source)
lemma sourceCellObservation_measurable (c : SourceCell) : Measurable fun x => sourceCellObservation x c := by exact measurable_id.prodMk (measurable_const.prodMk (measurable_const.prodMk measurable_const))
CausalSmith.Stat.TransportCaceRoughnuisanceLength.sourceCellObservation_measurable · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/Likelihood.lean:700
theorem measurable_lowerAssignmentKernel

Given the supplied inputs, the stated result about measurable lower assignment kernel holds.

Formal statement
cStar :
ℝ
n :
ℕ
sgn :
Proof (Lean source)
lemma measurable_lowerAssignmentKernel (cStar : ℝ) (n : ℕ) (sgn : Fin (lowerCells n) → Bool) : Measurable (lowerAssignmentKernel cStar n sgn) := by have heq : lowerAssignmentKernel cStar n sgn = fun o => ofReal (assignmentWeight (tiledPerturbation cStar n sgn (covariate o)) true) • Measure.dirac (o, true, potentialReceipt o true, potentialOutcome o (potentialReceipt o true)) + ofReal (1 - assignmentWeight (tiledPerturbation cStar n sgn (covariate o)) true) • Measure.dirac (o, false, potentialReceipt o false, potentialOutcome o (potentialReceipt o false)) := by funext o simp [lowerAssignmentKernel, Fintype.sum_bool, assignmentWeight, sub_eq_add_neg, add_comm, add_left_comm, add_assoc] congr 2 norm_num ring rw [heq] exact lowerAssignmentKernel_measurable n cStar sgn
CausalSmith.Stat.TransportCaceRoughnuisanceLength.measurable_lowerAssignmentKernel · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/Likelihood.lean:706
theorem assignmentKernel_eq_lower

Given the supplied inputs, the stated result about assignment kernel eq lower holds.

Formal statement
cStar :
ℝ
n :
ℕ
sgn :
(fun o : FullData => ofReal (1 / 2 + tiledPerturbation cStar n sgn (covariate o)) • Measure.dirac (o, true, potentialReceipt o true, potentialOutcome o (potentialReceipt o true)) + ofReal (1 - (1 / 2 + tiledPerturbation cStar n sgn (covariate o))) • Measure.dirac (o, false, potentialReceipt o false, potentialOutcome o (potentialReceipt o false)))
= lowerAssignmentKernel cStar n sgn
Proof (Lean source)
lemma assignmentKernel_eq_lower (cStar : ℝ) (n : ℕ) (sgn : Fin (lowerCells n) → Bool) : (fun o : FullData => ofReal (1 / 2 + tiledPerturbation cStar n sgn (covariate o)) • Measure.dirac (o, true, potentialReceipt o true, potentialOutcome o (potentialReceipt o true)) + ofReal (1 - (1 / 2 + tiledPerturbation cStar n sgn (covariate o))) • Measure.dirac (o, false, potentialReceipt o false, potentialOutcome o (potentialReceipt o false))) = lowerAssignmentKernel cStar n sgn := by funext o ext A hA simp [lowerAssignmentKernel, Fintype.sum_bool, assignmentWeight, Measure.add_apply, Measure.smul_apply, Measure.dirac_apply' _ hA, smul_eq_mul] congr 2 norm_num ring
CausalSmith.Stat.TransportCaceRoughnuisanceLength.assignmentKernel_eq_lower · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/Likelihood.lean:728
theorem fixedSourceKernel_apply

Given the supplied inputs, the stated result about fixed source kernel apply holds.

Formal statement
a :
ℝ
n :
ℕ
cStar τ :
ℝ
sgn :
hm :
∀ x d0 d1 y0 y1, 0 ≤ lowerMass a n cStar τ sgn x d0 d1 y0 y1
he :
∀ x z, 0 ≤ assignmentWeight (tiledPerturbation cStar n sgn x) z
hb0 :
hu0 :
∀ x, tiledPerturbation cStar n sgn x ^ 2 ≠ 1 / 4
x :
ℝ
hA :
(Measure.map observeSource ((primitiveKernel true x (lowerMass a n cStar τ sgn)).bind (lowerAssignmentKernel cStar n sgn))) A
= ∑ c : SourceCell, ofReal (sourceCellMass (actualStrength a n) (tiledPerturbation cStar n sgn x) (coupledPerturbation cStar τ n sgn x) c) * A.indicator 1 (sourceCellObservation x c)
Proof (Lean source)
lemma fixedSourceKernel_apply (a : ℝ) (n : ℕ) (cStar τ : ℝ) (sgn : Fin (lowerCells n) → Bool) (hm : ∀ x d0 d1 y0 y1, 0 ≤ lowerMass a n cStar τ sgn x d0 d1 y0 y1) (he : ∀ x z, 0 ≤ assignmentWeight (tiledPerturbation cStar n sgn x) z) (hb0 : 0 < actualStrength a n) (hu0 : ∀ x, tiledPerturbation cStar n sgn x ^ 2 ≠ 1 / 4) (x : ℝ) (A : Set SourceObs) (hA : MeasurableSet A) : (Measure.map observeSource ((primitiveKernel true x (lowerMass a n cStar τ sgn)).bind (lowerAssignmentKernel cStar n sgn))) A = ∑ c : SourceCell, ofReal (sourceCellMass (actualStrength a n) (tiledPerturbation cStar n sgn x) (coupledPerturbation cStar τ n sgn x) c) * A.indicator 1 (sourceCellObservation x c) := by classical have hobs : Measurable observeSource := by unfold observeSource covariate fun_prop rw [Measure.map_apply hobs hA] rw [Measure.bind_apply (hA.preimage hobs) (measurable_lowerAssignmentKernel cStar n sgn).aemeasurable] simp only [primitiveKernel, lintegral_finsetSum_measure, lintegral_smul_measure, lowerAssignmentKernel, Measure.finsetSum_apply, Measure.smul_apply, smul_eq_mul, Measure.dirac_apply' _ (hA.preimage hobs)] simp_rw [lintegral_dirac, Finset.mul_sum, ← mul_assoc] simp only [covariate, lowerMass, indicator, Set.mem_preimage, Pi.one_apply] simp_rw [observe_assigned_latent] rw [sourceLatent_sum_expand (actualStrength a n) (tiledPerturbation cStar n sgn x) (coupledPerturbation cStar τ n sgn x) (fun c => if sourceCellObservation x c ∈ A then 1 else 0)] rw [finite_sum_group_by_weighted (sourceLatentWeight (actualStrength a n) (tiledPerturbation cStar n sgn x) (coupledPerturbation cStar τ n sgn x)) sourceLatentCell (fun c => if sourceCellObservation x c ∈ A then 1 else 0)] apply Finset.sum_congr rfl intro c hc rw [sourceLatentWeight_group_eq] · exact ne_of_gt hb0 · exact hu0 x · exact hm x · exact he x
CausalSmith.Stat.TransportCaceRoughnuisanceLength.fixedSourceKernel_apply · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/Likelihood.lean:749
theorem sourceLaw_eq_explicit_of_nonneg

Given the supplied inputs, the stated result about source law eq explicit of nonneg holds.

Formal statement
a :
ℝ
n :
ℕ
cStar τ :
ℝ
sgn :
hm :
∀ x d0 d1 y0 y1, 0 ≤ lowerMass a n cStar τ sgn x d0 d1 y0 y1
he :
∀ x z, 0 ≤ assignmentWeight (tiledPerturbation cStar n sgn x) z
hb0 :
hu0 :
∀ x, tiledPerturbation cStar n sgn x ^ 2 ≠ 1 / 4
Measure.map observeSource (assignedFrom (primitivePopulation true (fun _ => 1) (lowerMass a n cStar τ sgn)) (fun x => 1 / 2 + tiledPerturbation cStar n sgn x))
Proof (Lean source)
lemma sourceLaw_eq_explicit_of_nonneg (a : ℝ) (n : ℕ) (cStar τ : ℝ) (sgn : Fin (lowerCells n) → Bool) (hm : ∀ x d0 d1 y0 y1, 0 ≤ lowerMass a n cStar τ sgn x d0 d1 y0 y1) (he : ∀ x z, 0 ≤ assignmentWeight (tiledPerturbation cStar n sgn x) z) (hb0 : 0 < actualStrength a n) (hu0 : ∀ x, tiledPerturbation cStar n sgn x ^ 2 ≠ 1 / 4) : Measure.map observeSource (assignedFrom (primitivePopulation true (fun _ => 1) (lowerMass a n cStar τ sgn)) (fun x => 1 / 2 + tiledPerturbation cStar n sgn x)) = explicitSourceLaw (actualStrength a n) (tiledPerturbation cStar n sgn) (coupledPerturbation cStar τ n sgn) := by have hp := lowerPrimitiveKernel_measurable a n cStar τ sgn have hk := measurable_lowerAssignmentKernel cStar n sgn have hpk : Measurable fun x => (primitiveKernel true x (lowerMass a n cStar τ sgn)).bind (lowerAssignmentKernel cStar n sgn) := (Measure.measurable_bind' hk).comp hp unfold assignedFrom primitivePopulation rw [assignmentKernel_eq_lower] rw [Measure.bind_bind hp.aemeasurable hk.aemeasurable] have hbase : (volume.restrict covariateSpace).withDensity (fun _ : ℝ => ofReal 1) = volume.restrict covariateSpace := by have hf : (fun _ : ℝ => ofReal 1) = (1 : ℝ → ℝ≥0∞) := by funext x simp rw [hf, withDensity_one] rw [hbase] ext A hA have hobs : Measurable observeSource := by unfold observeSource covariate fun_prop rw [Measure.map_apply hobs hA] rw [Measure.bind_apply (hA.preimage hobs) hpk.aemeasurable] unfold explicitSourceLaw rw [Measure.bind_apply hA] · apply lintegral_congr intro x simpa only [Measure.map_apply hobs hA, Measure.finsetSum_apply, Measure.smul_apply, smul_eq_mul, Measure.dirac_apply' _ hA] using fixedSourceKernel_apply a n cStar τ sgn hm he hb0 hu0 x A hA · refine (Measure.measurable_of_measurable_coe _ fun B hB => ?_).aemeasurable simp only [Measure.finsetSum_apply] apply Finset.measurable_fun_sum intro c hc simp only [Measure.smul_apply, smul_eq_mul, Measure.dirac_apply' _ hB] have hm : Measurable fun x => sourceCellMass (actualStrength a n) (tiledPerturbation cStar n sgn x) (coupledPerturbation cStar τ n sgn x) c := by rcases c with ⟨z, d, y⟩ have hu := tiledPerturbation_measurable cStar n sgn cases z <;> cases d <;> cases y <;> simp [sourceCellMass, coupledPerturbation, assignmentWeight, receiptOutcomeCell, receiptBase, sign] <;> fun_prop (disch := assumption) exact (hm.ennreal_ofReal.mul (measurable_one.indicator (hB.preimage (sourceCellObservation_measurable c))))
CausalSmith.Stat.TransportCaceRoughnuisanceLength.sourceLaw_eq_explicit_of_nonneg · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/Likelihood.lean:799
theorem lowerSourceLaw_eq_explicit

Given the supplied inputs, the lower source law equals its explicit construction.

Formal statement
a :
ℝ
n :
ℕ
cStar τ :
ℝ
sgn :
hb :
0 < actualStrength a n ∧ actualStrength a n ≤ 1 / 4
hAdm :
LowerAdmissible n a cStar
hτ :
τ ∈ Icc (-1 : ℝ) 1
Measure.map observeSource (assignedFrom (primitivePopulation true (fun _ => 1) (lowerMass a n cStar τ sgn)) (fun x => 1 / 2 + tiledPerturbation cStar n sgn x))
Proof (Lean source)
lemma lowerSourceLaw_eq_explicit (a : ℝ) (n : ℕ) (cStar τ : ℝ) (sgn : Fin (lowerCells n) → Bool) (hb : 0 < actualStrength a n ∧ actualStrength a n ≤ 1 / 4) (hAdm : LowerAdmissible n a cStar) (hτ : τ ∈ Icc (-1 : ℝ) 1) : Measure.map observeSource (assignedFrom (primitivePopulation true (fun _ => 1) (lowerMass a n cStar τ sgn)) (fun x => 1 / 2 + tiledPerturbation cStar n sgn x)) = explicitSourceLaw (actualStrength a n) (tiledPerturbation cStar n sgn) (coupledPerturbation cStar τ n sgn) := by apply sourceLaw_eq_explicit_of_nonneg a n cStar τ sgn · exact lowerMass_nonneg a n cStar τ sgn hb hAdm hτ · intro x z exact (lowerAssignmentWeight_mem_Icc a n cStar τ sgn hAdm x z).1 · exact hb.1 · intro x heq have hu := tiledPerturbation_abs_le_lowerHeight cStar n sgn x hAdm.1.le have hu' : |tiledPerturbation cStar n sgn x| ≤ 3 / 16 := le_trans hu hAdm.2.1 have hs : |tiledPerturbation cStar n sgn x| = 1 / 2 := by nlinarith [sq_abs (tiledPerturbation cStar n sgn x), abs_nonneg (tiledPerturbation cStar n sgn x)] linarith
CausalSmith.Stat.TransportCaceRoughnuisanceLength.lowerSourceLaw_eq_explicit · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/Likelihood.lean:863
CausalSmith.Stat.STAT_TransportCaceRoughnuisanceLength_Research.Helpers.LegalMixture.Margins 18 declarations Complier-share, effect, and separation identities

Complier-share, effect, and separation identities

the stated result about bump sq integral holds.

Formal statement
(∫ t in (0 : ℝ)..1, bump t ^ 2) = 1 / 2
Proof (Lean source)
lemma bump_sq_integral : (∫ t in (0 : ℝ)..1, bump t ^ 2) = 1 / 2 := by have h := intervalIntegral.mul_integral_comp_mul_add (f := fun x : ℝ => sin x ^ 2) (2 * pi) 0 (a := 0) (b := 1) have h' : 2 * pi * (∫ t in (0 : ℝ)..1, bump t ^ 2) = pi := by simpa [bump, integral_sin_sq, Real.sin_two_pi] using h apply (mul_left_cancel₀ (show (2 : ℝ) * pi ≠ 0 by positivity)) calc 2 * pi * (∫ t in (0 : ℝ)..1, bump t ^ 2) = pi := h' _ = 2 * pi * (1 / 2) := by ring
CausalSmith.Stat.TransportCaceRoughnuisanceLength.bump_sq_integral · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/Margins.lean:15

the stated result about bump integral zero holds.

Formal statement
(∫ t in (0 : ℝ)..1, bump t) = 0
Proof (Lean source)
lemma bump_integral_zero : (∫ t in (0 : ℝ)..1, bump t) = 0 := by have h := intervalIntegral.mul_integral_comp_mul_add (f := sin) (2 * pi) 0 (a := 0) (b := 1) have h' : 2 * pi * (∫ t in (0 : ℝ)..1, bump t) = 0 := by simpa [bump, integral_sin, Real.cos_two_pi] using h exact (mul_eq_zero.mp h').resolve_left (by positivity)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.bump_integral_zero · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/Margins.lean:29
theorem bump_odd_ratio_integral_zero Lemma bump_odd_ratio_integral_zero in the paper ↗

Given the supplied inputs, the stated result about bump odd ratio integral zero holds.

Formal statement
h :
ℝ
(∫ t in (0 : ℝ)..1, bump t ^ 3 / (1 / 4 - h ^ 2 * bump t ^ 2)) = 0
Proof (Lean source)
lemma bump_odd_ratio_integral_zero (h : ℝ) : (∫ t in (0 : ℝ)..1, bump t ^ 3 / (1 / 4 - h ^ 2 * bump t ^ 2)) = 0 := by let f : ℝ → ℝ := fun t => bump t ^ 3 / (1 / 4 - h ^ 2 * bump t ^ 2) have hb (t : ℝ) : bump (1 - t) = -bump t := by unfold bump convert Real.sin_two_pi_sub (2 * pi * t) using 1 <;> ring have hf (t : ℝ) : f (1 - t) = -f t := by simp only [f, hb] ring have href := intervalIntegral.integral_comp_sub_left f 1 (a := (0 : ℝ)) (b := 1) have heq : (∫ t in (0 : ℝ)..1, f t) = -(∫ t in (0 : ℝ)..1, f t) := by calc (∫ t in (0 : ℝ)..1, f t) = ∫ t in (0 : ℝ)..1, f (1 - t) := by simpa using href.symm _ = ∫ t in (0 : ℝ)..1, -f t := by congr 1; funext t; exact hf t _ = -(∫ t in (0 : ℝ)..1, f t) := by rw [intervalIntegral.integral_neg] change (∫ t in (0 : ℝ)..1, f t) = 0 linarith
CausalSmith.Stat.TransportCaceRoughnuisanceLength.bump_odd_ratio_integral_zero · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/Margins.lean:38
theorem bump_cell_integral_zero Lemma bump_cell_integral_zero in the paper ↗

Given the supplied inputs, the stated result about bump cell integral zero holds.

Formal statement
K :
ℕ
hK :
0 < K
ℓ :
Fin K
(∫ x in ((ℓ.val : ℝ) / K)..(((ℓ.val : ℝ) + 1) / K), bump ((K : ℝ) * x - ℓ.val)) = 0
Proof (Lean source)
lemma bump_cell_integral_zero (K : ℕ) (hK : 0 < K) (ℓ : Fin K) : (∫ x in ((ℓ.val : ℝ) / K)..(((ℓ.val : ℝ) + 1) / K), bump ((K : ℝ) * x - ℓ.val)) = 0 := by have h := intervalIntegral.mul_integral_comp_mul_sub (f := bump) (K : ℝ) (ℓ.val : ℝ) (a := (ℓ.val : ℝ) / K) (b := ((ℓ.val : ℝ) + 1) / K) have hK' : (K : ℝ) ≠ 0 := by exact_mod_cast (Nat.ne_of_gt hK) have h' : (K : ℝ) * (∫ x in ((ℓ.val : ℝ) / K)..(((ℓ.val : ℝ) + 1) / K), bump ((K : ℝ) * x - ℓ.val)) = 0 := by convert h using 1 <;> field_simp <;> ring exact bump_integral_zero.symm exact (mul_eq_zero.mp h').resolve_left hK'
CausalSmith.Stat.TransportCaceRoughnuisanceLength.bump_cell_integral_zero · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/Margins.lean:60
theorem tiled_bump_cell_integral_zero Lemma tiled_bump_cell_integral_zero in the paper ↗

Given the supplied inputs, the stated result about tiled bump cell integral zero holds.

Formal statement
K :
ℕ
hK :
0 < K
ℓ :
Fin K
(∫ x in cell K ℓ, bump ((K : ℝ) * x - ℓ.val)) = 0
Proof (Lean source)
lemma tiled_bump_cell_integral_zero (K : ℕ) (hK : 0 < K) (ℓ : Fin K) : (∫ x in cell K ℓ, bump ((K : ℝ) * x - ℓ.val)) = 0 := by unfold cell split_ifs with hlast · have hend : ((ℓ.val : ℝ) + 1) / K = 1 := by have hlast' : (ℓ.val : ℝ) + 1 = K := by exact_mod_cast hlast rw [hlast'] simp [Nat.ne_of_gt hK] rw [← hend, integral_Icc_eq_integral_Ioc] rw [← intervalIntegral.integral_of_le (by have hK' : (0 : ℝ) < K := by exact_mod_cast hK apply div_le_div_of_nonneg_right (by linarith : (ℓ.val : ℝ) ≤ (ℓ.val : ℝ) + 1) positivity)] exact bump_cell_integral_zero K hK ℓ · rw [integral_Ico_eq_integral_Ioc] rw [← intervalIntegral.integral_of_le (by have hK' : (0 : ℝ) < K := by exact_mod_cast hK apply div_le_div_of_nonneg_right (by linarith : (ℓ.val : ℝ) ≤ (ℓ.val : ℝ) + 1) positivity)] exact bump_cell_integral_zero K hK ℓ
CausalSmith.Stat.TransportCaceRoughnuisanceLength.tiled_bump_cell_integral_zero · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/Margins.lean:76
theorem tiled_bump_odd_ratio_cell_integral_zero Lemma tiled_bump_odd_ratio_cell_integral_zero in the paper ↗

Given the supplied inputs, the stated result about tiled bump odd ratio cell integral zero holds.

Formal statement
K :
ℕ
hK :
0 < K
ℓ :
Fin K
h :
ℝ
(∫ x in cell K ℓ, bump ((K : ℝ) * x - ℓ.val) ^ 3 / (1 / 4 - h ^ 2 * bump ((K : ℝ) * x - ℓ.val) ^ 2))
= 0
Proof (Lean source)
lemma tiled_bump_odd_ratio_cell_integral_zero (K : ℕ) (hK : 0 < K) (ℓ : Fin K) (h : ℝ) : (∫ x in cell K ℓ, bump ((K : ℝ) * x - ℓ.val) ^ 3 / (1 / 4 - h ^ 2 * bump ((K : ℝ) * x - ℓ.val) ^ 2)) = 0 := by let f : ℝ → ℝ := fun t => bump t ^ 3 / (1 / 4 - h ^ 2 * bump t ^ 2) have hK' : (K : ℝ) ≠ 0 := by exact_mod_cast Nat.ne_of_gt hK have hcell : (∫ x in ((ℓ.val : ℝ) / K)..(((ℓ.val : ℝ) + 1) / K), f ((K : ℝ) * x - ℓ.val)) = 0 := by have hc := intervalIntegral.mul_integral_comp_mul_sub (f := f) (K : ℝ) (ℓ.val : ℝ) (a := (ℓ.val : ℝ) / K) (b := ((ℓ.val : ℝ) + 1) / K) have heq : (K : ℝ) * (∫ x in ((ℓ.val : ℝ) / K)..(((ℓ.val : ℝ) + 1) / K), f ((K : ℝ) * x - ℓ.val)) = 0 := by convert hc using 1 <;> field_simp <;> ring exact (bump_odd_ratio_integral_zero h).symm exact (mul_eq_zero.mp heq).resolve_left hK' unfold cell split_ifs with hlast · have hend : ((ℓ.val : ℝ) + 1) / K = 1 := by have hlast' : (ℓ.val : ℝ) + 1 = K := by exact_mod_cast hlast rw [hlast'] simp [hK'] change (∫ x in Icc _ _, f ((K : ℝ) * x - ℓ.val)) = 0 rw [← hend, integral_Icc_eq_integral_Ioc] rw [← intervalIntegral.integral_of_le (by apply div_le_div_of_nonneg_right (by linarith) (by exact_mod_cast hK.le))] exact hcell · change (∫ x in Ico _ _, f ((K : ℝ) * x - ℓ.val)) = 0 rw [integral_Ico_eq_integral_Ioc] rw [← intervalIntegral.integral_of_le (by apply div_le_div_of_nonneg_right (by linarith) (by exact_mod_cast hK.le))] exact hcell
CausalSmith.Stat.TransportCaceRoughnuisanceLength.tiled_bump_odd_ratio_cell_integral_zero · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/Margins.lean:99
theorem tiledPerturbation_integrable_and_integral_zero Lemma tiledPerturbation_integrable_and_integral_zero in the paper ↗

Given the supplied inputs, the stated result about tiled perturbation integrable and integral zero holds.

Formal statement
cStar :
ℝ
n :
ℕ
sgn :
hn :
0 < n
conclusion 2
(∫ x in covariateSpace, tiledPerturbation cStar n sgn x) = 0
Proof (Lean source)
lemma tiledPerturbation_integrable_and_integral_zero (cStar : ℝ) (n : ℕ) (sgn : Fin (lowerCells n) → Bool) (hn : 0 < n) : IntegrableOn (tiledPerturbation cStar n sgn) covariateSpace ∧ (∫ x in covariateSpace, tiledPerturbation cStar n sgn x) = 0 := by classical have hK : 0 < lowerCells n := by unfold lowerCells exact Nat.ceil_pos.mpr (by positivity) have hcell (i : Fin (lowerCells n)) : MeasurableSet (cell (lowerCells n) i) := by unfold cell split_ifs <;> measurability have hcont (i : Fin (lowerCells n)) : Continuous (fun x : ℝ => lowerHeight cStar n * sign (sgn i) * bump ((lowerCells n : ℝ) * x - i.val)) := by unfold bump fun_prop haveI : IsFiniteMeasure (volume.restrict covariateSpace) := by change IsFiniteMeasure (volume.restrict (Icc (0 : ℝ) 1)) infer_instance have hint (i : Fin (lowerCells n)) : Integrable (fun x : ℝ => if x ∈ cell (lowerCells n) i then lowerHeight cStar n * sign (sgn i) * bump ((lowerCells n : ℝ) * x - i.val) else 0) (volume.restrict covariateSpace) := by have hm : Measurable (fun x : ℝ => if x ∈ cell (lowerCells n) i then lowerHeight cStar n * sign (sgn i) * bump ((lowerCells n : ℝ) * x - i.val) else 0) := (hcont i).measurable.ite (hcell i) measurable_const apply Integrable.of_bound hm.aestronglyMeasurable (|lowerHeight cStar n|) filter_upwards [] with x split_ifs · rw [Real.norm_eq_abs, abs_mul, abs_mul] have hs : |sign (sgn i)| = 1 := by cases sgn i <;> simp [sign] have hb : |bump ((lowerCells n : ℝ) * x - i.val)| ≤ 1 := by simpa [bump] using Real.abs_sin_le_one (2 * pi * ((lowerCells n : ℝ) * x - i.val)) rw [hs, mul_one] exact mul_le_of_le_one_right (abs_nonneg _) hb · simp constructor · unfold tiledPerturbation exact integrable_finsetSum univ (fun i _ => hint i) simp only [tiledPerturbation] rw [integral_finsetSum univ (fun i _ => hint i)] apply Finset.sum_eq_zero intro i _ have h := integral_indicator (μ := volume.restrict covariateSpace) (s := cell (lowerCells n) i) (f := fun x : ℝ => lowerHeight cStar n * sign (sgn i) * bump ((lowerCells n : ℝ) * x - i.val)) (hcell i) simp only [indicator] at h rw [h] rw [Measure.restrict_restrict_of_subset (cell_subset_covariateSpace _ hK i)] rw [integral_const_mul] simp [tiled_bump_cell_integral_zero _ hK i]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.tiledPerturbation_integrable_and_integral_zero · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/Margins.lean:151
theorem separation_integral_bounds Lemma separation_integral_bounds in the paper ↗

Given the supplied inputs, the stated result about separation integral bounds holds.

Formal statement
h :
ℝ
hh :
h ^ 2 ≤ 1 / 8
conclusion 1
2 ≤ (∫ t in (0 : ℝ)..1, bump t ^ 2 / (1 / 4 - h ^ 2 * bump t ^ 2))
conclusion 2
(∫ t in (0 : ℝ)..1, bump t ^ 2 / (1 / 4 - h ^ 2 * bump t ^ 2)) ≤ 4
Proof (Lean source)
lemma separation_integral_bounds (h : ℝ) (hh : h ^ 2 ≤ 1 / 8) : 2 ≤ (∫ t in (0 : ℝ)..1, bump t ^ 2 / (1 / 4 - h ^ 2 * bump t ^ 2)) ∧ (∫ t in (0 : ℝ)..1, bump t ^ 2 / (1 / 4 - h ^ 2 * bump t ^ 2)) ≤ 4 := by have hs (t : ℝ) : bump t ^ 2 ≤ 1 := by have ha : |bump t| ≤ 1 := by simpa [bump] using Real.abs_sin_le_one (2 * pi * t) rcases abs_le.mp ha with ⟨hl, hu⟩ nlinarith have hd (t : ℝ) : 0 < 1 / 4 - h ^ 2 * bump t ^ 2 := by have hp := mul_le_mul_of_nonneg_left (hs t) (sq_nonneg h) nlinarith have hb : Continuous bump := by unfold bump; fun_prop have hcont : Continuous (fun t : ℝ => bump t ^ 2 / (1 / 4 - h ^ 2 * bump t ^ 2)) := (hb.pow 2).div (continuous_const.sub (continuous_const.mul (hb.pow 2))) (fun t => ne_of_gt (hd t)) have hlo (t : ℝ) : 4 * bump t ^ 2 ≤ bump t ^ 2 / (1 / 4 - h ^ 2 * bump t ^ 2) := by rw [le_div_iff₀ (hd t)] nlinarith [mul_nonneg (sq_nonneg h) (sq_nonneg (bump t ^ 2))] have hhi (t : ℝ) : bump t ^ 2 / (1 / 4 - h ^ 2 * bump t ^ 2) ≤ 8 * bump t ^ 2 := by rw [div_le_iff₀ (hd t)] have hp := mul_le_mul_of_nonneg_left (hs t) (sq_nonneg h) nlinarith [sq_nonneg (bump t)] have hlower := intervalIntegral.integral_mono (μ := volume) (a := (0 : ℝ)) (b := 1) (by norm_num) ((continuous_const.mul (hb.pow 2)).intervalIntegrable 0 1) (hcont.intervalIntegrable 0 1) hlo have hupper := intervalIntegral.integral_mono (μ := volume) (a := (0 : ℝ)) (b := 1) (by norm_num) (hcont.intervalIntegrable 0 1) ((continuous_const.mul (hb.pow 2)).intervalIntegrable 0 1) hhi change (∫ t in (0 : ℝ)..1, 4 * bump t ^ 2) ≤ _ at hlower change _ ≤ (∫ t in (0 : ℝ)..1, 8 * bump t ^ 2) at hupper rw [intervalIntegral.integral_const_mul] at hlower hupper rw [bump_sq_integral] at hlower hupper norm_num at hlower hupper exact ⟨hlower, hupper⟩
CausalSmith.Stat.TransportCaceRoughnuisanceLength.separation_integral_bounds · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/Margins.lean:212
theorem primitiveMass_complier_sum Lemma primitiveMass_complier_sum in the paper ↗

Given the supplied inputs, the stated result about primitive mass complier sum holds.

Formal statement
a u v :
ℝ
ha :
a ≠ 0
s :
x :
ℝ
(∑ d0 : Bool, ∑ d1 : Bool, ∑ y0 : Bool, ∑ y1 : Bool, primitiveMass a u v d0 d1 y0 y1 * complier (s, x, d0, d1, boolReal y0, boolReal y1))
= a
Proof (Lean source)
lemma primitiveMass_complier_sum (a u v : ℝ) (ha : a ≠ 0) (s : Bool) (x : ℝ) : (∑ d0 : Bool, ∑ d1 : Bool, ∑ y0 : Bool, ∑ y1 : Bool, primitiveMass a u v d0 d1 y0 y1 * complier (s, x, d0, d1, boolReal y0, boolReal y1)) = a := by simp [primitiveMass, complier, complierMargin, sign, receipt1, receipt0, receiptBase] field_simp ring
CausalSmith.Stat.TransportCaceRoughnuisanceLength.primitiveMass_complier_sum · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/Margins.lean:257
theorem primitiveMass_complier_outcome_sum Lemma primitiveMass_complier_outcome_sum in the paper ↗

Given the supplied inputs, the stated result about primitive mass complier outcome sum holds.

Formal statement
a u v :
ℝ
ha :
a ≠ 0
s :
x :
ℝ
(∑ d0 : Bool, ∑ d1 : Bool, ∑ y0 : Bool, ∑ y1 : Bool, primitiveMass a u v d0 d1 y0 y1 * ((outcome1 (s, x, d0, d1, boolReal y0, boolReal y1) - outcome0 (s, x, d0, d1, boolReal y0, boolReal y1)) * complier (s, x, d0, d1, boolReal y0, boolReal y1)))
= -(u * v) / (1 / 4 - u ^ 2)
Proof (Lean source)
lemma primitiveMass_complier_outcome_sum (a u v : ℝ) (ha : a ≠ 0) (s : Bool) (x : ℝ) : (∑ d0 : Bool, ∑ d1 : Bool, ∑ y0 : Bool, ∑ y1 : Bool, primitiveMass a u v d0 d1 y0 y1 * ((outcome1 (s, x, d0, d1, boolReal y0, boolReal y1) - outcome0 (s, x, d0, d1, boolReal y0, boolReal y1)) * complier (s, x, d0, d1, boolReal y0, boolReal y1))) = -(u * v) / (1 / 4 - u ^ 2) := by simp [primitiveMass, complier, complierMargin, sign, receipt1, receipt0, receiptBase, outcome1, outcome0, boolReal] field_simp ring
CausalSmith.Stat.TransportCaceRoughnuisanceLength.primitiveMass_complier_outcome_sum · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/Margins.lean:268
theorem lowerPointwiseMean_complier_margins Lemma lowerPointwiseMean_complier_margins in the paper ↗

Given the supplied inputs, the stated result about lower pointwise mean complier margins holds.

Formal statement
a :
ℝ
n :
ℕ
cStar τ :
ℝ
sgn :
s :
x :
ℝ
ha :
actualStrength a n ≠ 0
conclusion 1
lowerPointwiseMean a n cStar τ sgn s complier x = actualStrength a n
conclusion 2
lowerPointwiseMean a n cStar τ sgn s (fun o => (outcome1 o - outcome0 o) * complier o) x
= -(tiledPerturbation cStar n sgn x * coupledPerturbation cStar τ n sgn x) / (1 / 4 - tiledPerturbation cStar n sgn x ^ 2)
Proof (Lean source)
lemma lowerPointwiseMean_complier_margins (a : ℝ) (n : ℕ) (cStar τ : ℝ) (sgn : Fin (lowerCells n) → Bool) (s : Bool) (x : ℝ) (ha : actualStrength a n ≠ 0) : lowerPointwiseMean a n cStar τ sgn s complier x = actualStrength a n ∧ lowerPointwiseMean a n cStar τ sgn s (fun o => (outcome1 o - outcome0 o) * complier o) x = -(tiledPerturbation cStar n sgn x * coupledPerturbation cStar τ n sgn x) / (1 / 4 - tiledPerturbation cStar n sgn x ^ 2) := by constructor · simpa [lowerPointwiseMean, lowerMass] using primitiveMass_complier_sum (actualStrength a n) (tiledPerturbation cStar n sgn x) (coupledPerturbation cStar τ n sgn x) ha s x · simpa [lowerPointwiseMean, lowerMass] using primitiveMass_complier_outcome_sum (actualStrength a n) (tiledPerturbation cStar n sgn x) (coupledPerturbation cStar τ n sgn x) ha s x
CausalSmith.Stat.TransportCaceRoughnuisanceLength.lowerPointwiseMean_complier_margins · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/Margins.lean:283
theorem armMeanFrom_primitive_receipt_contrast Lemma armMeanFrom_primitive_receipt_contrast in the paper ↗

Given the supplied inputs, the stated result about arm mean from primitive receipt contrast holds.

Formal statement
a u v x :
ℝ
ha :
a ≠ 0
armMeanFrom (fun _ => primitiveMass a u v) false true x
- armMeanFrom (fun _ => primitiveMass a u v) false false x
= a
Proof (Lean source)
lemma armMeanFrom_primitive_receipt_contrast (a u v x : ℝ) (ha : a ≠ 0) : armMeanFrom (fun _ => primitiveMass a u v) false true x - armMeanFrom (fun _ => primitiveMass a u v) false false x = a := by simp [armMeanFrom, primitiveMass, complierMargin, receiptBase, sign, boolReal] field_simp ring
CausalSmith.Stat.TransportCaceRoughnuisanceLength.armMeanFrom_primitive_receipt_contrast · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/Margins.lean:304
theorem armMeanFrom_primitive_outcome_contrast Lemma armMeanFrom_primitive_outcome_contrast in the paper ↗

Given the supplied inputs, the stated result about arm mean from primitive outcome contrast holds.

Formal statement
a u v x :
ℝ
ha :
a ≠ 0
armMeanFrom (fun _ => primitiveMass a u v) true true x
- armMeanFrom (fun _ => primitiveMass a u v) true false x
= -(u * v) / (1 / 4 - u ^ 2)
Proof (Lean source)
lemma armMeanFrom_primitive_outcome_contrast (a u v x : ℝ) (ha : a ≠ 0) : armMeanFrom (fun _ => primitiveMass a u v) true true x - armMeanFrom (fun _ => primitiveMass a u v) true false x = -(u * v) / (1 / 4 - u ^ 2) := by simp [armMeanFrom, primitiveMass, complierMargin, receiptBase, sign, boolReal] field_simp ring
CausalSmith.Stat.TransportCaceRoughnuisanceLength.armMeanFrom_primitive_outcome_contrast · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/Margins.lean:313
theorem legalIVComponent_arm_contrasts Lemma legalIVComponent_arm_contrasts in the paper ↗

Given the supplied inputs, the stated result about legal ivcomponent arm contrasts holds.

Formal statement
a :
ℝ
n :
ℕ
cStar τ :
ℝ
sgn :
x :
ℝ
ha :
actualStrength a n ≠ 0
conclusion 1
conclusion 2
armContrast (legalIVComponent a n cStar τ sgn) true x
= -(tiledPerturbation cStar n sgn x * coupledPerturbation cStar τ n sgn x) / (1 / 4 - tiledPerturbation cStar n sgn x ^ 2)
Proof (Lean source)
lemma legalIVComponent_arm_contrasts (a : ℝ) (n : ℕ) (cStar τ : ℝ) (sgn : Fin (lowerCells n) → Bool) (x : ℝ) (ha : actualStrength a n ≠ 0) : armContrast (legalIVComponent a n cStar τ sgn) false x = actualStrength a n ∧ armContrast (legalIVComponent a n cStar τ sgn) true x = -(tiledPerturbation cStar n sgn x * coupledPerturbation cStar τ n sgn x) / (1 / 4 - tiledPerturbation cStar n sgn x ^ 2) := by constructor · simpa [armContrast, legalIVComponent, lawFromMass, lowerMass, armMeanFrom] using armMeanFrom_primitive_receipt_contrast (actualStrength a n) (tiledPerturbation cStar n sgn x) (coupledPerturbation cStar τ n sgn x) x ha · simpa [armContrast, legalIVComponent, lawFromMass, lowerMass, armMeanFrom] using armMeanFrom_primitive_outcome_contrast (actualStrength a n) (tiledPerturbation cStar n sgn x) (coupledPerturbation cStar τ n sgn x) x ha
CausalSmith.Stat.TransportCaceRoughnuisanceLength.legalIVComponent_arm_contrasts · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/Margins.lean:323
theorem mixtureCenter_arm_contrasts Lemma mixtureCenter_arm_contrasts in the paper ↗

Given the supplied inputs, the stated result about mixture center arm contrasts holds.

Formal statement
a :
ℝ
n :
ℕ
ha :
actualStrength a n ≠ 0
x :
ℝ
conclusion 1
conclusion 2
Proof (Lean source)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.mixtureCenter_arm_contrasts · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/Margins.lean:343
theorem mixtureCenter_firstStage

Given the supplied inputs, the stated result about mixture center first stage holds.

Formal statement
a :
ℝ
n :
ℕ
ha :
actualStrength a n ≠ 0
Proof (Lean source)
lemma mixtureCenter_firstStage (a : ℝ) (n : ℕ) (ha : actualStrength a n ≠ 0) : firstStage (mixtureCenter a n) = actualStrength a n := by have h (x : ℝ) := (mixtureCenter_arm_contrasts a n ha x).1 simp_rw [firstStage, transportedForm, h] simp [mixtureCenter, lawFromMass, covariateSpace]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.mixtureCenter_firstStage · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/Margins.lean:355
theorem mixtureCenter_transportedOutcome Lemma mixtureCenter_transportedOutcome in the paper ↗

Given the supplied inputs, the stated result about mixture center transported outcome holds.

Formal statement
a :
ℝ
n :
ℕ
ha :
actualStrength a n ≠ 0
Proof (Lean source)
lemma mixtureCenter_transportedOutcome (a : ℝ) (n : ℕ) (ha : actualStrength a n ≠ 0) : transportedForm (mixtureCenter a n) true = 0 := by have h (x : ℝ) := (mixtureCenter_arm_contrasts a n ha x).2 simp_rw [transportedForm, h] simp
CausalSmith.Stat.TransportCaceRoughnuisanceLength.mixtureCenter_transportedOutcome · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/Margins.lean:364
theorem legal_mixture_separation

Given the supplied inputs, the stated result about legal mixture separation holds.

Formal statement
n :
ℕ
hn :
threshold ≤ n
cStar :
ℝ
hc :
0 < cStar ∧ cStar ≤ 1 / 100
conclusion 1
2 ^ ((3 : ℝ) / 4) * cStar ^ 2 * (n : ℝ) ^ (-(1 / 3 : ℝ)) ≤ separation cStar n
conclusion 2
separation cStar n ≤ 4 * cStar ^ 2 * (n : ℝ) ^ (-(1 / 3 : ℝ))
Proof (Lean source)
lemma legal_mixture_separation (n : ℕ) (hn : threshold ≤ n) (cStar : ℝ) (hc : 0 < cStar ∧ cStar ≤ 1 / 100) : 2 ^ ((3 : ℝ) / 4) * cStar ^ 2 * (n : ℝ) ^ (-(1 / 3 : ℝ)) ≤ separation cStar n ∧ separation cStar n ≤ 4 * cStar ^ 2 * (n : ℝ) ^ (-(1 / 3 : ℝ)) := by have hn256 : 256 ≤ n := hn have hn1 : (1 : ℝ) ≤ n := by exact_mod_cast (show 1 ≤ n by omega) have hnpos : (0 : ℝ) < n := lt_of_lt_of_le zero_lt_one hn1 have hbase : (1 : ℝ) ≤ (n : ℝ) ^ ((4 : ℝ) / 3) := by simpa using Real.one_le_rpow hn1 (by norm_num : (0 : ℝ) ≤ 4 / 3) have hKlo : (n : ℝ) ^ ((4 : ℝ) / 3) ≤ lowerCells n := by unfold lowerCells exact Nat.le_ceil _ have hKhi : (lowerCells n : ℝ) ≤ 2 * (n : ℝ) ^ ((4 : ℝ) / 3) := by unfold lowerCells exact Nat.ceil_le_two_mul (by linarith : (2 : ℝ)⁻¹ ≤ (n : ℝ) ^ ((4 : ℝ) / 3)) have hKpos : (0 : ℝ) < lowerCells n := lt_of_lt_of_le (lt_of_lt_of_le zero_lt_one hbase) hKlo have hfac : (lowerCells n : ℝ) ^ (-(1 / 8 : ℝ)) ≤ 1 := Real.rpow_le_one_of_one_le_of_nonpos (le_trans hbase hKlo) (by norm_num) have hh0 : 0 ≤ lowerHeight cStar n := by unfold lowerHeight exact mul_nonneg hc.1.le (Real.rpow_nonneg hKpos.le _) have hhsmall : lowerHeight cStar n ≤ 1 / 100 := by unfold lowerHeight nlinarith [mul_le_mul_of_nonneg_left hfac (le_of_lt hc.1)] have hhsq : lowerHeight cStar n ^ 2 ≤ 1 / 8 := by nlinarith have hI := separation_integral_bounds (lowerHeight cStar n) hhsq have hpow : lowerHeight cStar n ^ 2 = cStar ^ 2 * (lowerCells n : ℝ) ^ (-(1 / 4 : ℝ)) := by unfold lowerHeight rw [mul_pow, ← Real.rpow_mul_natCast (le_of_lt hKpos)] norm_num have hrootHi : (lowerCells n : ℝ) ^ (-(1 / 4 : ℝ)) ≤ (n : ℝ) ^ (-(1 / 3 : ℝ)) := by have h := Real.rpow_le_rpow_of_nonpos (lt_of_lt_of_le zero_lt_one hbase) hKlo (by norm_num : (-(1 / 4 : ℝ)) ≤ 0) rw [← Real.rpow_mul hnpos.le] at h convert h using 1 <;> congr 1 <;> ring have hrootLo : (2 * (n : ℝ) ^ ((4 : ℝ) / 3)) ^ (-(1 / 4 : ℝ)) ≤ (lowerCells n : ℝ) ^ (-(1 / 4 : ℝ)) := Real.rpow_le_rpow_of_nonpos hKpos hKhi (by norm_num) have hpowLo : 2 ^ ((3 : ℝ) / 4) * (n : ℝ) ^ (-(1 / 3 : ℝ)) ≤ 2 * (lowerCells n : ℝ) ^ (-(1 / 4 : ℝ)) := by have heq : 2 * (2 * (n : ℝ) ^ ((4 : ℝ) / 3)) ^ (-(1 / 4 : ℝ)) = 2 ^ ((3 : ℝ) / 4) * (n : ℝ) ^ (-(1 / 3 : ℝ)) := by rw [Real.mul_rpow (by norm_num : (0 : ℝ) ≤ 2) (le_of_lt (Real.rpow_pos_of_pos hnpos _)), ← Real.rpow_mul hnpos.le] have hexp : (4 / 3 : ℝ) * (-(1 / 4 : ℝ)) = -(1 / 3 : ℝ) := by ring rw [hexp] have htwo : 2 * (2 : ℝ) ^ (-(1 / 4 : ℝ)) = 2 ^ ((3 : ℝ) / 4) := by nth_rw 1 [← Real.rpow_one (2 : ℝ)] rw [← Real.rpow_add (by norm_num : (0 : ℝ) < 2)] congr 1 <;> ring rw [← htwo] ring rw [← heq] exact mul_le_mul_of_nonneg_left hrootLo (by norm_num) unfold separation constructor · calc 2 ^ ((3 : ℝ) / 4) * cStar ^ 2 * (n : ℝ) ^ (-(1 / 3 : ℝ)) = cStar ^ 2 * (2 ^ ((3 : ℝ) / 4) * (n : ℝ) ^ (-(1 / 3 : ℝ))) := by ring _ ≤ cStar ^ 2 * (2 * (lowerCells n : ℝ) ^ (-(1 / 4 : ℝ))) := mul_le_mul_of_nonneg_left hpowLo (sq_nonneg _) _ = 2 * lowerHeight cStar n ^ 2 := by rw [hpow]; ring _ ≤ lowerHeight cStar n ^ 2 * (∫ t in (0 : ℝ)..1, bump t ^ 2 / (1 / 4 - lowerHeight cStar n ^ 2 * bump t ^ 2)) := by nlinarith [hI.1, sq_nonneg (lowerHeight cStar n)] · calc lowerHeight cStar n ^ 2 * (∫ t in (0 : ℝ)..1, bump t ^ 2 / (1 / 4 - lowerHeight cStar n ^ 2 * bump t ^ 2)) ≤ 4 * lowerHeight cStar n ^ 2 := by nlinarith [hI.2, sq_nonneg (lowerHeight cStar n)] _ = 4 * cStar ^ 2 * (lowerCells n : ℝ) ^ (-(1 / 4 : ℝ)) := by rw [hpow]; ring _ ≤ 4 * cStar ^ 2 * (n : ℝ) ^ (-(1 / 3 : ℝ)) := by gcongr
CausalSmith.Stat.TransportCaceRoughnuisanceLength.legal_mixture_separation · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/Margins.lean:371
CausalSmith.Stat.STAT_TransportCaceRoughnuisanceLength_Research.Helpers.LegalMixture.Membership 1 declarations The roadmap (9) provides an amplitude ceiling: every smaller positive amplitude satisfies the same model conditions.

Monotone-IV component and center membership

The roadmap (9) provides an amplitude ceiling: every smaller positive amplitude satisfies the same model conditions. Keeping this quantifier explicit allows the assembly to impose the independent distance calibration (29).

theorem legal_mixture_membership

Given the supplied inputs, the stated result about legal mixture membership holds.

Formal statement
α c_f C_f L :
ℝ
hα :
0 < α ∧ α < 1
hf :
0 < c_f ∧ c_f < 1
hF :
1 < C_f
hL :
1 < L
∃ cMax : ℝ,
0 < cMax
cMax < 1
conclusion 1
cStar :
ℝ
0 < cStar
cStar ≤ cMax
n :
ℕ
threshold ≤ n
a :
ℝ
0 < a
a ≤ 1 / 4
τ :
ℝ
τ ∈ Icc (-1 : ℝ) 1
sgn :
legalIVComponent a n cStar τ sgn ∈ StrengthSlice c_f C_f L a n
mixtureCenter a n ∈ StrengthSlice c_f C_f L a n
Proof (Lean source)
lemma legal_mixture_membership (α c_f C_f L : ℝ) (hα : 0 < α ∧ α < 1) (hf : 0 < c_f ∧ c_f < 1) (hF : 1 < C_f) (hL : 1 < L) : ∃ cMax : ℝ, 0 < cMax ∧ cMax < 1 ∧ ∀ cStar : ℝ, 0 < cStar → cStar ≤ cMax → ∀ n : ℕ, threshold ≤ n → ∀ a : ℝ, 0 < a → a ≤ 1 / 4 → (∀ τ : ℝ, τ ∈ Icc (-1 : ℝ) 1 → ∀ sgn : Fin (lowerCells n) → Bool, legalIVComponent a n cStar τ sgn ∈ StrengthSlice c_f C_f L a n) ∧ mixtureCenter a n ∈ StrengthSlice c_f C_f L a n := by obtain ⟨cap, hcap, hcap1, hsmall, hlo, hhi, htarget, harm⟩ := exists_membership_amplitude_ceiling c_f C_f L hf.2 hF hL refine ⟨cap, hcap, hcap1, ?_⟩ intro cStar hc hccap n hn a ha ha4 have hgeometry := fun τ hτ sgn => legalIVComponent_density_overlap_of_ceiling a c_f C_f cStar τ n sgn hf hF hn ⟨ha, ha4⟩ ⟨hc, hccap.trans hsmall⟩ (hccap.trans hlo) (hccap.trans hhi) hτ have hholders (τ : ℝ) (hτ : τ ∈ Icc (-1 : ℝ) 1) (sgn : Fin (lowerCells n) → Bool) : SourceDensityHolder L (legalIVComponent a n cStar τ sgn) ∧ TargetDensityHolder L (legalIVComponent a n cStar τ sgn) ∧ PropensityHolder L (legalIVComponent a n cStar τ sgn) := by refine ⟨?_, ?_, ?_⟩ · simpa [SourceDensityHolder, legalIVComponent, lawFromMass] using const_holderOn 1 L hL (by norm_num; linarith) · simpa [TargetDensityHolder, legalIVComponent, lawFromMass] using one_add_tiledPerturbation_holderOn cStar L n sgn hc.le (hccap.trans htarget) hn hL · simpa [PropensityHolder, legalIVComponent, lawFromMass] using half_add_tiledPerturbation_holderOn cStar L n sgn hc.le (hccap.trans htarget) hn hL have hcenterHolders : SourceDensityHolder L (mixtureCenter a n) ∧ TargetDensityHolder L (mixtureCenter a n) ∧ PropensityHolder L (mixtureCenter a n) := by refine ⟨?_, ?_, ?_⟩ · simpa [SourceDensityHolder, mixtureCenter, lawFromMass] using const_holderOn 1 L hL (by norm_num; linarith) · simpa [TargetDensityHolder, mixtureCenter, lawFromMass] using const_holderOn 1 L hL (by norm_num; linarith) · simpa [PropensityHolder, mixtureCenter, lawFromMass] using const_holderOn (1 / 2) L hL (by norm_num; linarith) have harmHolders (τ : ℝ) (hτ : τ ∈ Icc (-1 : ℝ) 1) (sgn : Fin (lowerCells n) → Bool) := legalIVComponent_arm_means_holder a cStar τ L n sgn ⟨ha, ha4⟩ hc.le (hccap.trans hsmall) (hccap.trans harm) hτ hn hL have harmRegular (τ : ℝ) (hτ : τ ∈ Icc (-1 : ℝ) 1) (sgn : Fin (lowerCells n) → Bool) := legalIVComponent_arm_means_regular a cStar τ n sgn ⟨ha, ha4⟩ hc.le (hccap.trans hsmall) hτ hn have hcenterArmHolders := mixtureCenter_arm_means_holder a L n ⟨ha, ha4⟩ hn hL have hcenterArmRegular := mixtureCenter_arm_means_regular a n ⟨ha, ha4⟩ hn have hb := actualStrength_bounds a n hn ⟨ha, ha4⟩ have hAdm := lower_admissible_of_small_amplitude n a cStar hn ⟨ha, ha4⟩ ⟨hc, hccap.trans hsmall⟩ have hnpos : 0 < n := by have : 256 ≤ n := hn; omega have hobs : Measurable observeSource := by unfold observeSource covariate; fun_prop constructor · intro τ hτ sgn let P := legalIVComponent a n cStar τ sgn have hgeom := hgeometry τ hτ sgn have hhold := hholders τ hτ sgn have hass := legalIVComponent_assignment_conditions a n cStar τ sgn hb hAdm hτ hnpos have : IsProbabilityMeasure P.assignedLaw := hass.2.2.1 have : IsProbabilityMeasure (sourceObsLaw P) := Measure.isProbabilityMeasure_map hobs.aemeasurable have : IsProbabilityMeasure (targetXLaw P) := ⟨by rw [hgeom.2.1.1] apply targetDensity_univ cStar n sgn hnpos intro x have hu := (tiledPerturbation_abs_le_lowerHeight cStar n sgn x hc.le).trans hAdm.2.1 linarith [neg_abs_le (tiledPerturbation cStar n sgn x)]⟩ have hsampling := @lawFromMass_sampling_conditions (fun _ => 1) (fun x => 1 + tiledPerturbation cStar n sgn x) (fun x => 1 / 2 + tiledPerturbation cStar n sgn x) (lowerMass a n cStar τ sgn) (inferInstanceAs (IsProbabilityMeasure (sourceObsLaw P))) (inferInstanceAs (IsProbabilityMeasure (targetXLaw P))) n n have hmarg := legal_mixture_margins a n cStar τ sgn hn ⟨ha, ha4⟩ ⟨hc, hccap.trans hsmall⟩ hτ have hmodel : ModelClass c_f C_f L P n := { sourceIid := hsampling.1 targetIid := hsampling.2.1 independence := hsampling.2.2 sourceBounds := hgeom.1 targetBounds := hgeom.2.1 sourceHolder := hhold.1 targetHolder := hhold.2.1 overlap := hgeom.2.2 propensityHolder := hhold.2.2 armHolder := ⟨harmHolders τ hτ sgn, harmRegular τ hτ sgn, legalIVComponent_arm_setIntegral a cStar τ n sgn ⟨ha, ha4⟩ ⟨hc, hccap.trans hsmall⟩ hn hτ⟩ receipt := hass.1 outcome := hass.2.1 randomized := hass.2.2 exclusion := legalIVComponent_exclusion a n cStar τ sgn monotone := legalIVComponent_monotonicity a n cStar τ sgn outcomeTransport := ⟨_, (hmarg.1 false).2, (hmarg.1 true).2⟩ shareTransport := ⟨_, (hmarg.1 false).1, (hmarg.1 true).1⟩ strength := by change 0 < firstStage P; rw [hmarg.2.1]; exact hb.1 } refine ⟨ha, ha4, hmodel, ?_, ?_⟩ · rw [hmarg.2.1]; exact le_max_left _ _ · rw [hmarg.2.1]; exact hb.2 · let P := mixtureCenter a n have hass := mixtureCenter_assignment_conditions a n hb have : IsProbabilityMeasure P.assignedLaw := hass.2.2.1 have : IsProbabilityMeasure (sourceObsLaw P) := Measure.isProbabilityMeasure_map hobs.aemeasurable have : IsProbabilityMeasure (targetXLaw P) := ⟨by rw [(mixtureCenter_targetDensityBounds a c_f C_f n hf hF hb).1] simp [P, mixtureCenter, lawFromMass, covariateSpace]⟩ have hsampling := @lawFromMass_sampling_conditions (fun _ => 1) (fun _ => 1) (fun _ => 1 / 2) (fun _ => primitiveMass (actualStrength a n) 0 0) (inferInstanceAs (IsProbabilityMeasure (sourceObsLaw P))) (inferInstanceAs (IsProbabilityMeasure (targetXLaw P))) n n have hstage := mixtureCenter_firstStage a n (ne_of_gt hb.1) have hmodel : ModelClass c_f C_f L P n := { sourceIid := hsampling.1 targetIid := hsampling.2.1 independence := hsampling.2.2 sourceBounds := mixtureCenter_sourceDensityBounds a c_f C_f n hf hF hb targetBounds := mixtureCenter_targetDensityBounds a c_f C_f n hf hF hb sourceHolder := hcenterHolders.1 targetHolder := hcenterHolders.2.1 overlap := by intro x hx; norm_num [P, mixtureCenter, lawFromMass] propensityHolder := hcenterHolders.2.2 armHolder := ⟨hcenterArmHolders, hcenterArmRegular, mixtureCenter_arm_setIntegral a n hb⟩ receipt := hass.1 outcome := hass.2.1 randomized := hass.2.2 exclusion := mixtureCenter_exclusion a n monotone := mixtureCenter_monotonicity a n outcomeTransport := ⟨_, (mixtureCenter_conditional_complier_margins a n hb false).2, (mixtureCenter_conditional_complier_margins a n hb true).2⟩ shareTransport := ⟨_, (mixtureCenter_conditional_complier_margins a n hb false).1, (mixtureCenter_conditional_complier_margins a n hb true).1⟩ strength := by change 0 < firstStage P; rw [hstage]; exact hb.1 } refine ⟨ha, ha4, hmodel, ?_, ?_⟩ · rw [hstage]; exact le_max_left _ _ · rw [hstage]; exact hb.2
CausalSmith.Stat.TransportCaceRoughnuisanceLength.legal_mixture_membership · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/Membership.lean:19
CausalSmith.Stat.STAT_TransportCaceRoughnuisanceLength_Research.Helpers.LegalMixture.MembershipAmplitude 3 declarations Roadmap (9) chooses one positive ceiling independent of the sample size, strength, signs, and continuum index.

Uniform amplitude ceiling for mixture membership

Roadmap (9) chooses one positive ceiling independent of the sample size, strength, signs, and continuum index. The resulting height bound discharges the density envelopes before the remaining smoothness and assignment checks.

theorem lowerHeight_le_amplitude

The tile-height scaling never increases a nonnegative amplitude. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
cStar :
ℝ
n :
ℕ
hc :
0 ≤ cStar
hn :
threshold ≤ n
lowerHeight cStar n ≤ cStar
Proof (Lean source)
-- @node: lowerHeight_le_amplitude lemma lowerHeight_le_amplitude (cStar : ℝ) (n : ℕ) (hc : 0 ≤ cStar) (hn : threshold ≤ n) : lowerHeight cStar n ≤ cStar := by have hn1 : (1 : ℝ) ≤ n := by exact_mod_cast (show 1 ≤ n by have : 256 ≤ n := hn; omega) have hK1 : (1 : ℝ) ≤ lowerCells n := (Real.one_le_rpow hn1 (by norm_num : (0 : ℝ) ≤ 4 / 3)).trans (Nat.le_ceil _) have hscale := Real.rpow_le_one_of_one_le_of_nonpos hK1 (by norm_num : (-(1 / 8 : ℝ)) ≤ 0) simpa only [lowerHeight, mul_one] using mul_le_mul_of_nonneg_left hscale hc
CausalSmith.Stat.TransportCaceRoughnuisanceLength.lowerHeight_le_amplitude · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/MembershipAmplitude.lean:16
theorem exists_membership_amplitude_ceiling Lemma exists_membership_amplitude_ceiling in the paper ↗

A positive ceiling satisfies all five margin restrictions in roadmap (9), with the smaller admissibility ceiling already established in Lean. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
hf :
c_f < 1
hF :
1 < C_f
hL :
1 < L
∃ cap : ℝ,
conclusion 1
0 < cap
conclusion 2
cap < 1
conclusion 3
cap ≤ 1 / 100
conclusion 4
cap ≤ 1 - c_f
conclusion 5
cap ≤ C_f - 1
conclusion 6
cap ≤ (L - 1) / (1 + 2 * pi)
conclusion 7
cap ≤ (L - 3 / 4) / (6 * pi)
Proof (Lean source)
-- @node: exists_membership_amplitude_ceiling lemma exists_membership_amplitude_ceiling (c_f C_f L : ℝ) (hf : c_f < 1) (hF : 1 < C_f) (hL : 1 < L) : ∃ cap : ℝ, 0 < cap ∧ cap < 1 ∧ cap ≤ 1 / 100 ∧ cap ≤ 1 - c_f ∧ cap ≤ C_f - 1 ∧ cap ≤ (L - 1) / (1 + 2 * pi) ∧ cap ≤ (L - 3 / 4) / (6 * pi) := by let cap := min (1 / 100 : ℝ) (min (1 - c_f) (min (C_f - 1) (min ((L - 1) / (1 + 2 * pi)) ((L - 3 / 4) / (6 * pi))))) have hp : 0 < cap := by dsimp [cap] apply lt_min (by norm_num) apply lt_min (by linarith) apply lt_min (by linarith) apply lt_min · exact div_pos (by linarith) (by positivity) · exact div_pos (by linarith) (by positivity) have hb : cap ≤ 1 / 100 ∧ cap ≤ 1 - c_f ∧ cap ≤ C_f - 1 ∧ cap ≤ (L - 1) / (1 + 2 * pi) ∧ cap ≤ (L - 3 / 4) / (6 * pi) := by have h : cap ≤ min (1 / 100 : ℝ) (min (1 - c_f) (min (C_f - 1) (min ((L - 1) / (1 + 2 * pi)) ((L - 3 / 4) / (6 * pi))))) := le_rfl simpa only [le_min_iff] using h exact ⟨cap, hp, lt_of_le_of_lt hb.1 (by norm_num), hb⟩
CausalSmith.Stat.TransportCaceRoughnuisanceLength.exists_membership_amplitude_ceiling · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/MembershipAmplitude.lean:31
theorem legalIVComponent_density_overlap_of_ceiling

The ceiling and admissibility bounds verify both density identities, the density envelopes, and propensity overlap for every component. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
a c_f C_f cStar τ :
ℝ
n :
ℕ
sgn :
hf :
0 < c_f ∧ c_f < 1
hF :
1 < C_f
hn :
threshold ≤ n
ha :
0 < a ∧ a ≤ 1 / 4
hc :
0 < cStar ∧ cStar ≤ 1 / 100
hlo :
cStar ≤ 1 - c_f
hhi :
cStar ≤ C_f - 1
hτ :
τ ∈ Icc (-1 : ℝ) 1
conclusion 1
SourceDensityBounds c_f C_f (legalIVComponent a n cStar τ sgn)
conclusion 2
TargetDensityBounds c_f C_f (legalIVComponent a n cStar τ sgn)
conclusion 3
Proof (Lean source)
-- @node: legalIVComponent_density_overlap_of_ceiling lemma legalIVComponent_density_overlap_of_ceiling (a c_f C_f cStar τ : ℝ) (n : ℕ) (sgn : Fin (lowerCells n) → Bool) (hf : 0 < c_f ∧ c_f < 1) (hF : 1 < C_f) (hn : threshold ≤ n) (ha : 0 < a ∧ a ≤ 1 / 4) (hc : 0 < cStar ∧ cStar ≤ 1 / 100) (hlo : cStar ≤ 1 - c_f) (hhi : cStar ≤ C_f - 1) (hτ : τ ∈ Icc (-1 : ℝ) 1) : SourceDensityBounds c_f C_f (legalIVComponent a n cStar τ sgn) ∧ TargetDensityBounds c_f C_f (legalIVComponent a n cStar τ sgn) ∧ PropensityOverlap (legalIVComponent a n cStar τ sgn) := by have hb := actualStrength_bounds a n hn ha have hAdm := lower_admissible_of_small_amplitude n a cStar hn ha hc have hnpos : 0 < n := by have : 256 ≤ n := hn; omega have hh := lowerHeight_le_amplitude cStar n hc.1.le hn refine ⟨legalIVComponent_sourceDensityBounds a c_f C_f n cStar τ sgn hf hF hb hAdm hτ hnpos, legalIVComponent_targetDensityBounds a c_f C_f n cStar τ sgn hb hAdm hτ hnpos (hh.trans hlo) (hh.trans hhi) hf.1, ?_⟩ intro x hx have hu := tiledPerturbation_abs_le_lowerHeight cStar n sgn x hc.1.le change (1 / 4 : ℝ) ≤ 1 / 2 + tiledPerturbation cStar n sgn x ∧ 1 / 2 + tiledPerturbation cStar n sgn x ≤ 3 / 4 constructor <;> linarith [neg_abs_le (tiledPerturbation cStar n sgn x), le_abs_self (tiledPerturbation cStar n sgn x), hAdm.2.1]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.legalIVComponent_density_overlap_of_ceiling · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/MembershipAmplitude.lean:58
CausalSmith.Stat.STAT_TransportCaceRoughnuisanceLength_Research.Helpers.LegalMixture.MembershipSupport 9 declarations These lemmas implement the no-defiers and bounded-potential-outcome checks in steps (13)--(18) of the legal-mixture roadmap, directly on the primitive atoms.

Primitive support for the legal IV completion

These lemmas implement the no-defiers and bounded-potential-outcome checks in steps (13)--(18) of the legal-mixture roadmap, directly on the primitive atoms.

theorem primitivePopulation_ae_of_atoms Lemma primitivePopulation_ae_of_atoms in the paper ↗

An atomwise support condition survives covariate mixing. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
s :
density :
ℝ → ℝ
mass :
ℝ → Bool → Bool → Bool → Bool → ℝ
hm :
∀ d0 d1 y0 y1, Measurable fun x => mass x d0 d1 y0 y1
p :
FullData → Prop
hp :
MeasurableSet {o | p o}
hatom :
∀ x d0 d1 y0 y1
if
mass x d0 d1 y0 y1 ≠ 0
then
p (s, x, d0, d1, boolReal y0, boolReal y1)
∀ᵐ o ∂primitivePopulation s density mass, p o
Proof (Lean source)
-- @node: primitivePopulation_ae_of_atoms lemma primitivePopulation_ae_of_atoms (s : Bool) (density : ℝ → ℝ) (mass : ℝ → Bool → Bool → Bool → Bool → ℝ) (hm : ∀ d0 d1 y0 y1, Measurable fun x => mass x d0 d1 y0 y1) (p : FullData → Prop) (hp : MeasurableSet {o | p o}) (hatom : ∀ x d0 d1 y0 y1, mass x d0 d1 y0 y1 ≠ 0 → p (s, x, d0, d1, boolReal y0, boolReal y1)) : ∀ᵐ o ∂primitivePopulation s density mass, p o := by have hk (x : ℝ) : ∀ᵐ o ∂primitiveKernel s x mass, p o := by unfold primitiveKernel simp only [ae_finsetSum_measure_iff] intro d0 _ d1 _ y0 _ y1 _ by_cases hz : mass x d0 d1 y0 y1 = 0 · simp [hz] · apply Measure.ae_smul_measure simpa only [ae_dirac_eq, Filter.eventually_pure] using hatom x d0 d1 y0 y1 hz rw [ae_iff] unfold primitivePopulation rw [Measure.bind_apply (show MeasurableSet {o | ¬p o} from hp.compl) (primitiveKernel_measurable_of s mass hm).aemeasurable] apply lintegral_eq_zero_of_ae_eq_zero exact Filter.Eventually.of_forall fun x => ae_iff.mp (hk x)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.primitivePopulation_ae_of_atoms · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/MembershipSupport.lean:17
theorem primitivePopulation_no_defiers Lemma primitivePopulation_no_defiers in the paper ↗

The primitive completion places no mass on the defier stratum. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
s :
density :
ℝ → ℝ
b u v :
ℝ → ℝ
hm :
∀ d0 d1 y0 y1, Measurable fun x => primitiveMass (b x) (u x) (v x) d0 d1 y0 y1
∀ᵐ o ∂primitivePopulation s density (fun x => primitiveMass (b x) (u x) (v x)), boolReal (receipt0 o)
≤ boolReal (receipt1 o)
Proof (Lean source)
-- @node: primitivePopulation_no_defiers lemma primitivePopulation_no_defiers (s : Bool) (density : ℝ → ℝ) (b u v : ℝ → ℝ) (hm : ∀ d0 d1 y0 y1, Measurable fun x => primitiveMass (b x) (u x) (v x) d0 d1 y0 y1) : ∀ᵐ o ∂primitivePopulation s density (fun x => primitiveMass (b x) (u x) (v x)), boolReal (receipt0 o) ≤ boolReal (receipt1 o) := by apply primitivePopulation_ae_of_atoms s density _ hm · have h0 : Measurable (fun o : FullData => boolReal (receipt0 o)) := by unfold receipt0 boolReal exact Measurable.ite ((measurableSet_singleton true).preimage (by fun_prop)) measurable_const measurable_const have h1 : Measurable (fun o : FullData => boolReal (receipt1 o)) := by unfold receipt1 boolReal exact Measurable.ite ((measurableSet_singleton true).preimage (by fun_prop)) measurable_const measurable_const exact measurableSet_le h0 h1 · intro x d0 d1 y0 y1 hmass cases d0 <;> cases d1 <;> simp_all [primitiveMass, receipt0, receipt1, boolReal]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.primitivePopulation_no_defiers · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/MembershipSupport.lean:41
theorem primitivePopulation_outcome_bounds Lemma primitivePopulation_outcome_bounds in the paper ↗

Both potential outcomes in the binary completion lie in the unit interval. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
s :
density :
ℝ → ℝ
mass :
ℝ → Bool → Bool → Bool → Bool → ℝ
hm :
∀ d0 d1 y0 y1, Measurable fun x => mass x d0 d1 y0 y1
∀ᵐ o ∂primitivePopulation s density mass, outcome0 o ∈ Icc (0 : ℝ) 1 ∧ outcome1 o ∈ Icc (0 : ℝ) 1
Proof (Lean source)
-- @node: primitivePopulation_outcome_bounds lemma primitivePopulation_outcome_bounds (s : Bool) (density : ℝ → ℝ) (mass : ℝ → Bool → Bool → Bool → Bool → ℝ) (hm : ∀ d0 d1 y0 y1, Measurable fun x => mass x d0 d1 y0 y1) : ∀ᵐ o ∂primitivePopulation s density mass, outcome0 o ∈ Icc (0 : ℝ) 1 ∧ outcome1 o ∈ Icc (0 : ℝ) 1 := by apply primitivePopulation_ae_of_atoms s density mass hm · unfold outcome0 outcome1 measurability · intro x d0 d1 y0 y1 _ cases y0 <;> cases y1 <;> norm_num [outcome0, outcome1, boolReal]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.primitivePopulation_outcome_bounds · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/MembershipSupport.lean:64
theorem legalIVComponent_monotonicity

The no-defiers property holds for the full source-target component law. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
a :
ℝ
n :
ℕ
cStar τ :
ℝ
sgn :
Monotonicity (legalIVComponent a n cStar τ sgn)
Proof (Lean source)
-- @node: legalIVComponent_monotonicity lemma legalIVComponent_monotonicity (a : ℝ) (n : ℕ) (cStar τ : ℝ) (sgn : Fin (lowerCells n) → Bool) : Monotonicity (legalIVComponent a n cStar τ sgn) := by change ∀ᵐ o ∂(1 / 2 : ℝ≥0∞) • primitivePopulation true (fun _ => 1) (lowerMass a n cStar τ sgn) + (1 / 2 : ℝ≥0∞) • primitivePopulation false (fun x => 1 + tiledPerturbation cStar n sgn x) (lowerMass a n cStar τ sgn), boolReal (receipt0 o) ≤ boolReal (receipt1 o) rw [ae_add_measure_iff] constructor <;> apply Measure.ae_smul_measure · exact primitivePopulation_no_defiers true (fun _ => 1) (fun _ => actualStrength a n) (tiledPerturbation cStar n sgn) (coupledPerturbation cStar τ n sgn) (lowerMass_measurable a n cStar τ sgn) · exact primitivePopulation_no_defiers false (fun x => 1 + tiledPerturbation cStar n sgn x) (fun _ => actualStrength a n) (tiledPerturbation cStar n sgn) (coupledPerturbation cStar τ n sgn) (lowerMass_measurable a n cStar τ sgn)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.legalIVComponent_monotonicity · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/MembershipSupport.lean:77
theorem mixtureCenter_monotonicity

The baseline center also has no defiers. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
a :
ℝ
n :
ℕ
Proof (Lean source)
-- @node: mixtureCenter_monotonicity lemma mixtureCenter_monotonicity (a : ℝ) (n : ℕ) : Monotonicity (mixtureCenter a n) := by change ∀ᵐ o ∂(1 / 2 : ℝ≥0∞) • primitivePopulation true (fun _ => 1) (fun _ => primitiveMass (actualStrength a n) 0 0) + (1 / 2 : ℝ≥0∞) • primitivePopulation false (fun _ => 1) (fun _ => primitiveMass (actualStrength a n) 0 0), boolReal (receipt0 o) ≤ boolReal (receipt1 o) rw [ae_add_measure_iff] constructor <;> apply Measure.ae_smul_measure · exact primitivePopulation_no_defiers true (fun _ => 1) (fun _ => actualStrength a n) (fun _ => 0) (fun _ => 0) (fun _ _ _ _ => measurable_const) · exact primitivePopulation_no_defiers false (fun _ => 1) (fun _ => actualStrength a n) (fun _ => 0) (fun _ => 0) (fun _ _ _ _ => measurable_const)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.mixtureCenter_monotonicity · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/MembershipSupport.lean:99
theorem legalIVComponent_exclusion

Exclusion is built into the component's assignment potential outcomes. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
a :
ℝ
n :
ℕ
cStar τ :
ℝ
sgn :
Exclusion (legalIVComponent a n cStar τ sgn)
Proof (Lean source)
-- @node: legalIVComponent_exclusion lemma legalIVComponent_exclusion (a : ℝ) (n : ℕ) (cStar τ : ℝ) (sgn : Fin (lowerCells n) → Bool) : Exclusion (legalIVComponent a n cStar τ sgn) := by intro z exact Filter.Eventually.of_forall fun _ => rfl
CausalSmith.Stat.TransportCaceRoughnuisanceLength.legalIVComponent_exclusion · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/MembershipSupport.lean:117
theorem mixtureCenter_exclusion

Exclusion is also built into the baseline center. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
a :
ℝ
n :
ℕ
Proof (Lean source)
-- @node: mixtureCenter_exclusion lemma mixtureCenter_exclusion (a : ℝ) (n : ℕ) : Exclusion (mixtureCenter a n) := by intro z exact Filter.Eventually.of_forall fun _ => rfl
CausalSmith.Stat.TransportCaceRoughnuisanceLength.mixtureCenter_exclusion · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/MembershipSupport.lean:125
theorem legalIVComponent_full_outcome_bounds Lemma legalIVComponent_full_outcome_bounds in the paper ↗

The component's full-data law retains both potential-outcome bounds. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
a :
ℝ
n :
ℕ
cStar τ :
ℝ
sgn :
∀ᵐ o ∂(legalIVComponent a n cStar τ sgn).fullLaw, outcome0 o ∈ Icc (0 : ℝ) 1 ∧ outcome1 o ∈ Icc (0 : ℝ) 1
Proof (Lean source)
-- @node: legalIVComponent_full_outcome_bounds lemma legalIVComponent_full_outcome_bounds (a : ℝ) (n : ℕ) (cStar τ : ℝ) (sgn : Fin (lowerCells n) → Bool) : ∀ᵐ o ∂(legalIVComponent a n cStar τ sgn).fullLaw, outcome0 o ∈ Icc (0 : ℝ) 1 ∧ outcome1 o ∈ Icc (0 : ℝ) 1 := by change ∀ᵐ o ∂(1 / 2 : ℝ≥0∞) • primitivePopulation true (fun _ => 1) (lowerMass a n cStar τ sgn) + (1 / 2 : ℝ≥0∞) • primitivePopulation false (fun x => 1 + tiledPerturbation cStar n sgn x) (lowerMass a n cStar τ sgn), outcome0 o ∈ Icc (0 : ℝ) 1 ∧ outcome1 o ∈ Icc (0 : ℝ) 1 rw [ae_add_measure_iff] constructor <;> apply Measure.ae_smul_measure · exact primitivePopulation_outcome_bounds true (fun _ => 1) (lowerMass a n cStar τ sgn) (lowerMass_measurable a n cStar τ sgn) · exact primitivePopulation_outcome_bounds false (fun x => 1 + tiledPerturbation cStar n sgn x) (lowerMass a n cStar τ sgn) (lowerMass_measurable a n cStar τ sgn)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.legalIVComponent_full_outcome_bounds · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/MembershipSupport.lean:132
theorem mixtureCenter_full_outcome_bounds Lemma mixtureCenter_full_outcome_bounds in the paper ↗

The center's full-data law retains both potential-outcome bounds. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
a :
ℝ
n :
ℕ
∀ᵐ o ∂(mixtureCenter a n).fullLaw, outcome0 o ∈ Icc (0 : ℝ) 1 ∧ outcome1 o ∈ Icc (0 : ℝ) 1
Proof (Lean source)
-- @node: mixtureCenter_full_outcome_bounds lemma mixtureCenter_full_outcome_bounds (a : ℝ) (n : ℕ) : ∀ᵐ o ∂(mixtureCenter a n).fullLaw, outcome0 o ∈ Icc (0 : ℝ) 1 ∧ outcome1 o ∈ Icc (0 : ℝ) 1 := by change ∀ᵐ o ∂(1 / 2 : ℝ≥0∞) • primitivePopulation true (fun _ => 1) (fun _ => primitiveMass (actualStrength a n) 0 0) + (1 / 2 : ℝ≥0∞) • primitivePopulation false (fun _ => 1) (fun _ => primitiveMass (actualStrength a n) 0 0), outcome0 o ∈ Icc (0 : ℝ) 1 ∧ outcome1 o ∈ Icc (0 : ℝ) 1 rw [ae_add_measure_iff] constructor <;> apply Measure.ae_smul_measure · exact primitivePopulation_outcome_bounds true (fun _ => 1) (fun _ => primitiveMass (actualStrength a n) 0 0) (fun _ _ _ _ => measurable_const) · exact primitivePopulation_outcome_bounds false (fun _ => 1) (fun _ => primitiveMass (actualStrength a n) 0 0) (fun _ _ _ _ => measurable_const)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.mixtureCenter_full_outcome_bounds · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/MembershipSupport.lean:151
CausalSmith.Stat.STAT_TransportCaceRoughnuisanceLength_Research.Helpers.LegalMixture.ObservedArm 4 declarations The finite source-cell kernel disintegrates each observed arm integral.

Observed arm identities for the lower experiment

The finite source-cell kernel disintegrates each observed arm integral. Its weighted cell sum reproduces the exact primitive arm mean in roadmap (10).

theorem sourceCellMass_arm_mean_sum Lemma sourceCellMass_arm_mean_sum in the paper ↗

Summing the eight observed source cells reproduces the conditional arm mean. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
a u v x :
ℝ
ha :
a ≠ 0
hu :
|u| ≤ 1 / 100
A z :
(∑ c : SourceCell, sourceCellMass a u v c * (if c.1 = z then armValue A (sourceCellObservation x c) else 0))
= assignmentWeight u z * armMeanFrom (fun _ => primitiveMass a u v) A z x
Proof (Lean source)
-- @node: sourceCellMass_arm_mean_sum lemma sourceCellMass_arm_mean_sum (a u v x : ℝ) (ha : a ≠ 0) (hu : |u| ≤ 1 / 100) (A z : Bool) : (∑ c : SourceCell, sourceCellMass a u v c * (if c.1 = z then armValue A (sourceCellObservation x c) else 0)) = assignmentWeight u z * armMeanFrom (fun _ => primitiveMass a u v) A z x := by cases A · rw [armMeanFrom_primitive_receipt_eq _ _ _ _ ha] cases z <;> simp [Fintype.sum_prod_type, Fintype.sum_bool, sourceCellMass, sourceCellObservation, armValue, assignmentWeight, receiptOutcomeCell, receiptBase, boolReal, sign] <;> ring · rw [armMeanFrom_primitive_outcome_eq _ _ _ _ ha hu] have hp : 1 + 2 * u ≠ 0 := by have := (abs_le.mp hu).1; linarith have hm : 1 - 2 * u ≠ 0 := by have := (abs_le.mp hu).2; linarith cases z <;> simp [Fintype.sum_prod_type, Fintype.sum_bool, sourceCellMass, sourceCellObservation, armValue, assignmentWeight, receiptOutcomeCell, receiptBase, boolReal, sign] all_goals field_simp; ring_nf all_goals field_simp [hp, hm, show 1 - u * 2 ≠ 0 by simpa [mul_comm] using hm]; ring
CausalSmith.Stat.TransportCaceRoughnuisanceLength.sourceCellMass_arm_mean_sum · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/ObservedArm.lean:16
theorem explicitSourceLaw_arm_setIntegral Lemma explicitSourceLaw_arm_setIntegral in the paper ↗

A normalized nonnegative finite source-cell kernel gives its exact arm set integral. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
a τ :
ℝ
u :
ℝ → ℝ
hu :
hw :
∀ x c, 0 ≤ sourceCellMass a (u x) (τ * u x) c
A z :
B :
Set ℝ
hB :
(∫ o in {o | o.1 ∈ B ∧ o.2.1 = z}, armValue A o ∂explicitSourceLaw a u (fun x => τ * u x))
= ∫ x in B, ∑ c : SourceCell, sourceCellMass a (u x) (τ * u x) c * (if c.1 = z then armValue A (sourceCellObservation x c) else 0) ∂volume.restrict covariateSpace
Proof (Lean source)
-- @node: explicitSourceLaw_arm_setIntegral lemma explicitSourceLaw_arm_setIntegral (a τ : ℝ) (u : ℝ → ℝ) (hu : Measurable u) (hw : ∀ x c, 0 ≤ sourceCellMass a (u x) (τ * u x) c) (A z : Bool) (B : Set ℝ) (hB : MeasurableSet B) : (∫ o in {o | o.1 ∈ B ∧ o.2.1 = z}, armValue A o ∂explicitSourceLaw a u (fun x => τ * u x)) = ∫ x in B, ∑ c : SourceCell, sourceCellMass a (u x) (τ * u x) c * (if c.1 = z then armValue A (sourceCellObservation x c) else 0) ∂volume.restrict covariateSpace := by classical let atom := sourceCellObservation let weight (x : ℝ) (c : SourceCell) := sourceCellMass a (u x) (τ * u x) c have hm (c : SourceCell) : Measurable (fun x => weight x c) := by rcases c with ⟨zc, d, y⟩ cases zc <;> cases d <;> cases y <;> simp [weight, sourceCellMass, assignmentWeight, receiptOutcomeCell, receiptBase, sign] <;> fun_prop (disch := assumption) let κ : Kernel ℝ SourceObs := ⟨fun x => ∑ c, ofReal (weight x c) • Measure.dirac (atom x c), by refine Measure.measurable_of_measurable_coe _ fun T hT => ?_ simp only [Measure.finsetSum_apply, Measure.smul_apply, smul_eq_mul, Measure.dirac_apply' _ hT] exact Finset.measurable_fun_sum _ (fun c _ => (hm c).ennreal_ofReal.mul (measurable_one.indicator (hT.preimage (sourceCellObservation_measurable c))))⟩ have hnorm (x : ℝ) : ∑ c, weight x c = 1 := sourceCellMass_sum a τ (u x) have hk (x : ℝ) : κ x = ∑ c, ofReal (weight x c) • Measure.dirac (atom x c) := rfl have : IsMarkovKernel κ := ⟨fun x => isProbabilityMeasure_iff.mpr (by rw [hk] simp only [Measure.finsetSum_apply, Measure.smul_apply, smul_eq_mul, Measure.dirac_apply' _ MeasurableSet.univ, Set.indicator_of_mem (Set.mem_univ _), Pi.one_apply, mul_one] rw [← ENNReal.ofReal_sum_of_nonneg (fun c _ => hw x c), hnorm] simp)⟩ let f : SourceObs → ℝ := fun o => if o.2.1 = z then armValue A o else 0 have hz : MeasurableSet {o : SourceObs | o.2.1 = z} := measurableSet_eq_fun (by fun_prop) measurable_const have hf : Measurable f := by dsimp [f] apply Measurable.ite hz · cases A · change Measurable (fun o : SourceObs => if o.2.2.1 then (1 : ℝ) else 0) exact Measurable.ite (measurableSet_eq_fun (by fun_prop) measurable_const) measurable_const measurable_const · change Measurable (fun o : SourceObs => o.2.2.2) fun_prop · exact measurable_const have hbnd (x : ℝ) (c : SourceCell) : ‖f (atom x c)‖ ≤ 1 := by rcases c with ⟨zc, d, y⟩ cases A <;> cases z <;> cases zc <;> cases d <;> cases y <;> norm_num [f, atom, sourceCellObservation, armValue, boolReal] have hfi (x : ℝ) (g : SourceObs → ℝ) : Integrable g (κ x) := by rw [hk] exact integrable_finsetSum_measure.mpr (fun c _ => (integrable_dirac (by simp)).smul_measure ENNReal.ofReal_ne_top) have hint : Integrable f (κ ∘ₘ volume.restrict covariateSpace) := by apply (Measure.integrable_comp_iff hf.aestronglyMeasurable).mpr refine ⟨Filter.Eventually.of_forall (fun x => hfi x f), ?_⟩ have heq (x : ℝ) : (∫ o, ‖f o‖ ∂κ x) = ∑ c, weight x c * ‖f (atom x c)‖ := integral_finiteAtomicKernel κ atom weight hw hk _ x (hfi x _) simp_rw [heq] have hmeas : Measurable (fun x => ∑ c, weight x c * ‖f (atom x c)‖) := Finset.measurable_fun_sum _ (fun c _ => (hm c).mul ((hf.comp (sourceCellObservation_measurable c)).norm)) have : IsFiniteMeasure (volume.restrict covariateSpace) := by change IsFiniteMeasure (volume.restrict (Icc (0 : ℝ) 1)); infer_instance apply (integrable_const (1 : ℝ)).mono' hmeas.aestronglyMeasurable filter_upwards [] with x rw [Real.norm_eq_abs, abs_of_nonneg (Finset.sum_nonneg (fun c _ => mul_nonneg (hw x c) (norm_nonneg _)))] calc ∑ c, weight x c * ‖f (atom x c)‖ ≤ ∑ c, weight x c * 1 := Finset.sum_le_sum (fun c _ => mul_le_mul_of_nonneg_left (hbnd x c) (hw x c)) _ = 1 := by simpa using hnorm x have h := setIntegral_finiteAtomicKernel (volume.restrict covariateSpace) κ atom weight hw hk fst measurable_fst (fun _ _ => rfl) B hB f hint have hμ : κ ∘ₘ volume.restrict covariateSpace = explicitSourceLaw a u (fun x => τ * u x) := rfl rw [hμ] at h have hevent : {o : SourceObs | o.1 ∈ B ∧ o.2.1 = z} = {o | o.1 ∈ B} ∩ {o | o.2.1 = z} := rfl rw [hevent, ← setIntegral_indicator hz] convert h using 1 · congr 1 funext o by_cases ho : o.2.1 = z <;> simp [indicator, f, ho] · congr 1
CausalSmith.Stat.TransportCaceRoughnuisanceLength.explicitSourceLaw_arm_setIntegral · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/ObservedArm.lean:37
theorem legalIVComponent_arm_setIntegral

Every legal component has the exact observed-arm integral required by the model class. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
a cStar τ :
ℝ
n :
ℕ
sgn :
ha :
0 < a ∧ a ≤ 1 / 4
hc :
0 < cStar ∧ cStar ≤ 1 / 100
hn :
threshold ≤ n
hτ :
τ ∈ Icc (-1 : ℝ) 1
A z :
B :
Set ℝ
hB :
hBC :
(∫ o in {o | o.1 ∈ B ∧ o.2.1 = z}, armValue A o ∂sourceObsLaw (legalIVComponent a n cStar τ sgn))
= ∫ x in B, (legalIVComponent a n cStar τ sgn).fS x * assignmentMass (legalIVComponent a n cStar τ sgn) z x * (legalIVComponent a n cStar τ sgn).m A z x
Proof (Lean source)
-- @node: legalIVComponent_arm_setIntegral lemma legalIVComponent_arm_setIntegral (a cStar τ : ℝ) (n : ℕ) (sgn : Fin (lowerCells n) → Bool) (ha : 0 < a ∧ a ≤ 1 / 4) (hc : 0 < cStar ∧ cStar ≤ 1 / 100) (hn : threshold ≤ n) (hτ : τ ∈ Icc (-1 : ℝ) 1) (A z : Bool) (B : Set ℝ) (hB : MeasurableSet B) (hBC : B ⊆ covariateSpace) : (∫ o in {o | o.1 ∈ B ∧ o.2.1 = z}, armValue A o ∂sourceObsLaw (legalIVComponent a n cStar τ sgn)) = ∫ x in B, (legalIVComponent a n cStar τ sgn).fS x * assignmentMass (legalIVComponent a n cStar τ sgn) z x * (legalIVComponent a n cStar τ sgn).m A z x := by have hb := actualStrength_bounds a n hn ha have hAdm := lower_admissible_of_small_amplitude n a cStar hn ha hc have hsource : sourceObsLaw (legalIVComponent a n cStar τ sgn) = explicitSourceLaw (actualStrength a n) (tiledPerturbation cStar n sgn) (fun x => τ * tiledPerturbation cStar n sgn x) := lowerSourceLaw_eq_explicit a n cStar τ sgn hb hAdm hτ rw [hsource, explicitSourceLaw_arm_setIntegral _ _ _ (tiledPerturbation_measurable cStar n sgn) (lowerSourceCellMass_nonneg a n cStar τ sgn hb hAdm hτ) A z B hB] rw [Measure.restrict_restrict hB, inter_eq_left.mpr hBC] apply setIntegral_congr_fun hB intro x hx have hu : |tiledPerturbation cStar n sgn x| ≤ 1 / 100 := (tiledPerturbation_abs_le_lowerHeight cStar n sgn x hc.1.le).trans ((lowerHeight_le_amplitude cStar n hc.1.le hn).trans hc.2) dsimp only rw [sourceCellMass_arm_mean_sum _ _ _ x (ne_of_gt hb.1) hu A z] cases z <;> simp [legalIVComponent, lawFromMass, armMeanFrom, lowerMass, assignmentMass, assignmentWeight, coupledPerturbation] <;> ring
CausalSmith.Stat.TransportCaceRoughnuisanceLength.legalIVComponent_arm_setIntegral · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/ObservedArm.lean:129
theorem mixtureCenter_arm_setIntegral Lemma mixtureCenter_arm_setIntegral in the paper ↗

The unperturbed center satisfies the same exact observed-arm identity. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
a :
ℝ
n :
ℕ
hb :
0 < actualStrength a n ∧ actualStrength a n ≤ 1 / 4
A z :
B :
Set ℝ
hB :
hBC :
(∫ o in {o | o.1 ∈ B ∧ o.2.1 = z}, armValue A o ∂sourceObsLaw (mixtureCenter a n))
= ∫ x in B, (mixtureCenter a n).fS x * assignmentMass (mixtureCenter a n) z x * (mixtureCenter a n).m A z x
Proof (Lean source)
-- @node: mixtureCenter_arm_setIntegral lemma mixtureCenter_arm_setIntegral (a : ℝ) (n : ℕ) (hb : 0 < actualStrength a n ∧ actualStrength a n ≤ 1 / 4) (A z : Bool) (B : Set ℝ) (hB : MeasurableSet B) (hBC : B ⊆ covariateSpace) : (∫ o in {o | o.1 ∈ B ∧ o.2.1 = z}, armValue A o ∂sourceObsLaw (mixtureCenter a n)) = ∫ x in B, (mixtureCenter a n).fS x * assignmentMass (mixtureCenter a n) z x * (mixtureCenter a n).m A z x := by have hsource : sourceObsLaw (mixtureCenter a n) = explicitSourceLaw (actualStrength a n) (fun _ => 0) (fun _ => 0) := centerSourceLaw_eq_explicit a n hb have hw (x : ℝ) (c : SourceCell) : 0 ≤ sourceCellMass (actualStrength a n) 0 (0 * 0) c := by simpa [sourceCellMass, sourceCenterMass, assignmentWeight] using (sourceCenterMass_pos (actualStrength a n) ⟨hb.1, by linarith [hb.2]⟩ c).le rw [hsource] have h := explicitSourceLaw_arm_setIntegral (actualStrength a n) 0 (fun _ => 0) measurable_const hw A z B hB simp only [mul_zero] at h rw [h, Measure.restrict_restrict hB, inter_eq_left.mpr hBC] apply setIntegral_congr_fun hB intro x hx dsimp only rw [sourceCellMass_arm_mean_sum _ 0 0 x (ne_of_gt hb.1) (by norm_num) A z] cases z <;> norm_num [mixtureCenter, lawFromMass, assignmentMass, assignmentWeight]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.mixtureCenter_arm_setIntegral · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/ObservedArm.lean:161
CausalSmith.Stat.STAT_TransportCaceRoughnuisanceLength_Research.Helpers.LegalMixture.Overlap 11 declarations Pairwise sign overlap identities

Pairwise sign overlap identities

theorem bump_sq_affine_interval

Given the supplied inputs, the stated result about bump sq affine interval holds.

Formal statement
K :
ℕ
hK :
0 < K
ell :
Fin K
(∫ x in ((ell.val : ℝ) / K)..(((ell.val : ℝ) + 1) / K), bump ((K : ℝ) * x - ell.val) ^ 2)
= 1 / (2 * (K : ℝ))
Proof (Lean source)
lemma bump_sq_affine_interval (K : ℕ) (hK : 0 < K) (ell : Fin K) : (∫ x in ((ell.val : ℝ) / K)..(((ell.val : ℝ) + 1) / K), bump ((K : ℝ) * x - ell.val) ^ 2) = 1 / (2 * (K : ℝ)) := by have h := intervalIntegral.mul_integral_comp_mul_sub (f := fun t : ℝ => bump t ^ 2) (K : ℝ) (ell.val : ℝ) (a := (ell.val : ℝ) / K) (b := ((ell.val : ℝ) + 1) / K) have hK0 : (K : ℝ) ≠ 0 := by exact_mod_cast (Nat.ne_of_gt hK) have hlo : (K : ℝ) * ((ell.val : ℝ) / K) - ell.val = 0 := by field_simp ring have hhi : (K : ℝ) * (((ell.val : ℝ) + 1) / K) - ell.val = 1 := by field_simp ring rw [hlo, hhi, bump_sq_integral] at h apply (mul_left_cancel₀ hK0) rw [h] field_simp
CausalSmith.Stat.TransportCaceRoughnuisanceLength.bump_sq_affine_interval · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/Overlap.lean:12
theorem bump_sq_cell_integral

Given the supplied inputs, the stated result about bump sq cell integral holds.

Formal statement
K :
ℕ
hK :
0 < K
ell :
Fin K
(∫ x in cell K ell, bump ((K : ℝ) * x - ell.val) ^ 2) = 1 / (2 * (K : ℝ))
Proof (Lean source)
lemma bump_sq_cell_integral (K : ℕ) (hK : 0 < K) (ell : Fin K) : (∫ x in cell K ell, bump ((K : ℝ) * x - ell.val) ^ 2) = 1 / (2 * (K : ℝ)) := by have hinter := bump_sq_affine_interval K hK ell have hle : (ell.val : ℝ) / K ≤ ((ell.val : ℝ) + 1) / K := by apply div_le_div_of_nonneg_right (by linarith) (by positivity : (0 : ℝ) ≤ K) unfold cell split_ifs with hlast · have hend : ((ell.val : ℝ) + 1) / K = 1 := by have hlast' : (ell.val : ℝ) + 1 = K := by exact_mod_cast hlast rw [hlast'] simp [Nat.ne_of_gt hK] calc (∫ x in Icc ((ell.val : ℝ) / K) 1, bump ((K : ℝ) * x - ell.val) ^ 2) = ∫ x in Ioc ((ell.val : ℝ) / K) 1, bump ((K : ℝ) * x - ell.val) ^ 2 := integral_Icc_eq_integral_Ioc _ = ∫ x in ((ell.val : ℝ) / K)..1, bump ((K : ℝ) * x - ell.val) ^ 2 := by rw [intervalIntegral.integral_of_le] simpa [hend] using hle _ = ∫ x in ((ell.val : ℝ) / K)..(((ell.val : ℝ) + 1) / K), bump ((K : ℝ) * x - ell.val) ^ 2 := by rw [hend] _ = 1 / (2 * (K : ℝ)) := hinter · calc (∫ x in Ico ((ell.val : ℝ) / K) (((ell.val : ℝ) + 1) / K), bump ((K : ℝ) * x - ell.val) ^ 2) = ∫ x in Ioc ((ell.val : ℝ) / K) (((ell.val : ℝ) + 1) / K), bump ((K : ℝ) * x - ell.val) ^ 2 := integral_Ico_eq_integral_Ioc _ = ∫ x in ((ell.val : ℝ) / K)..(((ell.val : ℝ) + 1) / K), bump ((K : ℝ) * x - ell.val) ^ 2 := by rw [intervalIntegral.integral_of_le hle] _ = 1 / (2 * (K : ℝ)) := hinter
CausalSmith.Stat.TransportCaceRoughnuisanceLength.bump_sq_cell_integral · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/Overlap.lean:31
def tiledTerm

The tiled term object is defined from the supplied inputs.

Definition (Lean source)
cStar :
ℝ
n :
ℕ
s :
Fin (lowerCells n) → Bool
ell :
Fin (lowerCells n)
x :
ℝ
tiledTerm cStar n s ell x :
ℝ
by classical exact if x ∈ cell (lowerCells n) ell then lowerHeight cStar n * sign (s ell) * bump ((lowerCells n : ℝ) * x - ell.val) else 0
theorem tiledPerturbation_eq_sum_tiledTerm

Given the supplied inputs, the stated result about tiled perturbation eq sum tiled term holds.

Formal statement
cStar :
ℝ
n :
ℕ
s :
tiledPerturbation cStar n s = fun x => ∑ ell, tiledTerm cStar n s ell x
Proof (Lean source)
lemma tiledPerturbation_eq_sum_tiledTerm (cStar : ℝ) (n : ℕ) (s : Fin (lowerCells n) → Bool) : tiledPerturbation cStar n s = fun x => ∑ ell, tiledTerm cStar n s ell x := by funext x rfl
CausalSmith.Stat.TransportCaceRoughnuisanceLength.tiledPerturbation_eq_sum_tiledTerm · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/Overlap.lean:75
theorem tiledTerm_mul_eq_zero_of_ne

Given the supplied inputs, the stated result about tiled term mul eq zero of ne holds.

Formal statement
cStar :
ℝ
n :
ℕ
s t :
i j :
hK :
hij :
i ≠ j
x :
ℝ
tiledTerm cStar n s i x * tiledTerm cStar n t j x = 0
Proof (Lean source)
lemma tiledTerm_mul_eq_zero_of_ne (cStar : ℝ) (n : ℕ) (s t : Fin (lowerCells n) → Bool) (i j : Fin (lowerCells n)) (hK : 0 < lowerCells n) (hij : i ≠ j) (x : ℝ) : tiledTerm cStar n s i x * tiledTerm cStar n t j x = 0 := by classical unfold tiledTerm by_cases hi : x ∈ cell (lowerCells n) i · have hj : x ∉ cell (lowerCells n) j := by intro hxj exact hij (cell_mem_unique _ hK i j x hi hxj) simp [hi, hj] · simp [hi]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.tiledTerm_mul_eq_zero_of_ne · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/Overlap.lean:82
theorem tiledTerm_product_integrable

Given the supplied inputs, the stated result about tiled term product integrable holds.

Formal statement
cStar :
ℝ
n :
ℕ
s t :
i j :
Integrable (fun x => tiledTerm cStar n s i x * tiledTerm cStar n t j x) (volume.restrict covariateSpace)
Proof (Lean source)
lemma tiledTerm_product_integrable (cStar : ℝ) (n : ℕ) (s t : Fin (lowerCells n) → Bool) (i j : Fin (lowerCells n)) : Integrable (fun x => tiledTerm cStar n s i x * tiledTerm cStar n t j x) (volume.restrict covariateSpace) := by letI : IsFiniteMeasure (volume.restrict covariateSpace) := by change IsFiniteMeasure (volume.restrict (Icc (0 : ℝ) 1)) infer_instance have hcell (ell : Fin (lowerCells n)) : MeasurableSet (cell (lowerCells n) ell) := by unfold cell split_ifs <;> measurability have hm (r : Fin (lowerCells n) → Bool) (ell : Fin (lowerCells n)) : Measurable (tiledTerm cStar n r ell) := by unfold tiledTerm apply Measurable.ite (hcell ell) · unfold bump fun_prop · exact measurable_const have hb (r : Fin (lowerCells n) → Bool) (ell : Fin (lowerCells n)) (x : ℝ) : |tiledTerm cStar n r ell x| ≤ |lowerHeight cStar n| := by unfold tiledTerm split_ifs · rw [abs_mul, abs_mul] have hs : |sign (r ell)| = 1 := by cases r ell <;> simp [sign] have hu : |bump ((lowerCells n : ℝ) * x - ell.val)| ≤ 1 := by simpa [bump] using Real.abs_sin_le_one (2 * pi * ((lowerCells n : ℝ) * x - ell.val)) rw [hs, mul_one] exact mul_le_of_le_one_right (abs_nonneg _) hu · simp apply Integrable.of_bound ((hm s i).mul (hm t j)).aestronglyMeasurable (|lowerHeight cStar n| ^ 2) filter_upwards [] with x change |tiledTerm cStar n s i x * tiledTerm cStar n t j x| ≤ _ rw [abs_mul] nlinarith [hb s i x, hb t j x, abs_nonneg (tiledTerm cStar n s i x), abs_nonneg (tiledTerm cStar n t j x), sq_nonneg (|lowerHeight cStar n|)]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.tiledTerm_product_integrable · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/Overlap.lean:96
theorem tiledTerm_pair_integral

Given the supplied inputs, the stated result about tiled term pair integral holds.

Formal statement
cStar :
ℝ
n :
ℕ
s t :
Fin (lowerCells n) → Bool
hK :
0 < lowerCells n
i j :
Fin (lowerCells n)
(∫ x in covariateSpace, tiledTerm cStar n s i x * tiledTerm cStar n t j x)
= if i = j then lowerHeight cStar n ^ 2 * sign (s i) * sign (t i) / (2 * (lowerCells n : ℝ)) else 0
Proof (Lean source)
lemma tiledTerm_pair_integral (cStar : ℝ) (n : ℕ) (s t : Fin (lowerCells n) → Bool) (hK : 0 < lowerCells n) (i j : Fin (lowerCells n)) : (∫ x in covariateSpace, tiledTerm cStar n s i x * tiledTerm cStar n t j x) = if i = j then lowerHeight cStar n ^ 2 * sign (s i) * sign (t i) / (2 * (lowerCells n : ℝ)) else 0 := by classical split_ifs with hij · subst j have hcell : MeasurableSet (cell (lowerCells n) i) := by unfold cell split_ifs <;> measurability have hfun : (fun x => tiledTerm cStar n s i x * tiledTerm cStar n t i x) = (cell (lowerCells n) i).indicator (fun x => lowerHeight cStar n ^ 2 * sign (s i) * sign (t i) * bump ((lowerCells n : ℝ) * x - i.val) ^ 2) := by funext x unfold tiledTerm by_cases hx : x ∈ cell (lowerCells n) i <;> simp [hx, indicator] <;> ring rw [hfun, integral_indicator hcell] rw [Measure.restrict_restrict_of_subset (cell_subset_covariateSpace _ hK i)] rw [integral_const_mul, bump_sq_cell_integral _ hK] ring · have hzero : (fun x => tiledTerm cStar n s i x * tiledTerm cStar n t j x) = 0 := by funext x exact tiledTerm_mul_eq_zero_of_ne cStar n s t i j hK hij x rw [hzero] simp
CausalSmith.Stat.TransportCaceRoughnuisanceLength.tiledTerm_pair_integral · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/Overlap.lean:134
theorem tiledPerturbation_pair_integral

Given the supplied inputs, the stated result about tiled perturbation pair integral holds.

Formal statement
cStar :
ℝ
n :
ℕ
s t :
Fin (lowerCells n) → Bool
hn :
0 < n
(∫ x in covariateSpace, tiledPerturbation cStar n s x * tiledPerturbation cStar n t x)
= lowerHeight cStar n ^ 2 / (2 * (lowerCells n : ℝ)) * innerSign s t
Proof (Lean source)
lemma tiledPerturbation_pair_integral (cStar : ℝ) (n : ℕ) (s t : Fin (lowerCells n) → Bool) (hn : 0 < n) : (∫ x in covariateSpace, tiledPerturbation cStar n s x * tiledPerturbation cStar n t x) = lowerHeight cStar n ^ 2 / (2 * (lowerCells n : ℝ)) * innerSign s t := by classical have hK : 0 < lowerCells n := by unfold lowerCells exact Nat.ceil_pos.mpr (by positivity) rw [tiledPerturbation_eq_sum_tiledTerm, tiledPerturbation_eq_sum_tiledTerm] simp_rw [Finset.sum_mul, Finset.mul_sum] rw [integral_finsetSum univ (fun i _ => integrable_finsetSum univ (fun j _ => tiledTerm_product_integrable cStar n s t i j))] simp_rw [integral_finsetSum univ (fun j _ => tiledTerm_product_integrable cStar n s t _ j)] simp_rw [tiledTerm_pair_integral cStar n s t hK] have hdiag (i : Fin (lowerCells n)) : (∑ j : Fin (lowerCells n), if i = j then lowerHeight cStar n ^ 2 * sign (s i) * sign (t i) / (2 * (lowerCells n : ℝ)) else 0) = lowerHeight cStar n ^ 2 * sign (s i) * sign (t i) / (2 * (lowerCells n : ℝ)) := by rw [Finset.sum_eq_single i] · simp · intro j _ hji simp [Ne.symm hji] · simp simp_rw [hdiag] unfold innerSign rw [Finset.mul_sum] apply Finset.sum_congr rfl intro i hi simp only [sign] ring
CausalSmith.Stat.TransportCaceRoughnuisanceLength.tiledPerturbation_pair_integral · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/Overlap.lean:167
theorem targetLikelihood_pair_integrable

Given the supplied inputs, the stated result about target likelihood pair integrable holds.

Formal statement
cStar :
ℝ
n :
ℕ
s t :
hn :
0 < n
Integrable (fun x => (1 + tiledPerturbation cStar n s x) * (1 + tiledPerturbation cStar n t x)) (volume.restrict covariateSpace)
Proof (Lean source)
lemma targetLikelihood_pair_integrable (cStar : ℝ) (n : ℕ) (s t : Fin (lowerCells n) → Bool) (hn : 0 < n) : Integrable (fun x => (1 + tiledPerturbation cStar n s x) * (1 + tiledPerturbation cStar n t x)) (volume.restrict covariateSpace) := by letI : IsFiniteMeasure (volume.restrict covariateSpace) := by change IsFiniteMeasure (volume.restrict (Icc (0 : ℝ) 1)) infer_instance have hm (r : Fin (lowerCells n) → Bool) : Measurable (fun x => 1 + tiledPerturbation cStar n r x) := measurable_const.add (tiledPerturbation_measurable cStar n r) have hb (r : Fin (lowerCells n) → Bool) (x : ℝ) : |1 + tiledPerturbation cStar n r x| ≤ 1 + |lowerHeight cStar n| := by calc |1 + tiledPerturbation cStar n r x| ≤ 1 + |tiledPerturbation cStar n r x| := by simpa using abs_add_le (1 : ℝ) (tiledPerturbation cStar n r x) _ ≤ 1 + |lowerHeight cStar n| := by simpa using add_le_add_right (tiledPerturbation_abs_le_abs_lowerHeight cStar n r x) 1 apply Integrable.of_bound ((hm s).mul (hm t)).aestronglyMeasurable ((1 + |lowerHeight cStar n|) ^ 2) filter_upwards [] with x change |(1 + tiledPerturbation cStar n s x) * (1 + tiledPerturbation cStar n t x)| ≤ _ rw [abs_mul] nlinarith [hb s x, hb t x, abs_nonneg (1 + tiledPerturbation cStar n s x), abs_nonneg (1 + tiledPerturbation cStar n t x), sq_nonneg (1 + |lowerHeight cStar n|)]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.targetLikelihood_pair_integrable · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/Overlap.lean:206
theorem tiledPerturbation_product_integrable

Given the supplied inputs, the stated result about tiled perturbation product integrable holds.

Formal statement
cStar :
ℝ
n :
ℕ
s t :
Integrable (fun x => tiledPerturbation cStar n s x * tiledPerturbation cStar n t x) (volume.restrict covariateSpace)
Proof (Lean source)
lemma tiledPerturbation_product_integrable (cStar : ℝ) (n : ℕ) (s t : Fin (lowerCells n) → Bool) : Integrable (fun x => tiledPerturbation cStar n s x * tiledPerturbation cStar n t x) (volume.restrict covariateSpace) := by rw [tiledPerturbation_eq_sum_tiledTerm, tiledPerturbation_eq_sum_tiledTerm] simp_rw [Finset.sum_mul, Finset.mul_sum] exact integrable_finsetSum univ (fun i _ => integrable_finsetSum univ (fun j _ => tiledTerm_product_integrable cStar n s t i j))
CausalSmith.Stat.TransportCaceRoughnuisanceLength.tiledPerturbation_product_integrable · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/Overlap.lean:242
theorem targetLikelihood_pair_integral

Given the supplied inputs, the stated result about target likelihood pair integral holds.

Formal statement
cStar :
ℝ
n :
ℕ
s t :
Fin (lowerCells n) → Bool
hn :
0 < n
(∫ x in covariateSpace, (1 + tiledPerturbation cStar n s x) * (1 + tiledPerturbation cStar n t x))
= 1
+ (lowerHeight cStar n ^ 2 / 2) * innerSign s t / (lowerCells n : ℝ)
Proof (Lean source)
lemma targetLikelihood_pair_integral (cStar : ℝ) (n : ℕ) (s t : Fin (lowerCells n) → Bool) (hn : 0 < n) : (∫ x in covariateSpace, (1 + tiledPerturbation cStar n s x) * (1 + tiledPerturbation cStar n t x)) = 1 + (lowerHeight cStar n ^ 2 / 2) * innerSign s t / (lowerCells n : ℝ) := by letI : IsFiniteMeasure (volume.restrict covariateSpace) := by change IsFiniteMeasure (volume.restrict (Icc (0 : ℝ) 1)) infer_instance have hs := tiledPerturbation_integrable_and_integral_zero cStar n s hn have ht := tiledPerturbation_integrable_and_integral_zero cStar n t hn have hp := tiledPerturbation_pair_integral cStar n s t hn rw [show (fun x => (1 + tiledPerturbation cStar n s x) * (1 + tiledPerturbation cStar n t x)) = fun x => 1 + tiledPerturbation cStar n s x + tiledPerturbation cStar n t x + tiledPerturbation cStar n s x * tiledPerturbation cStar n t x by funext x; ring] change (∫ x in covariateSpace, ((1 + tiledPerturbation cStar n s x) + tiledPerturbation cStar n t x) + tiledPerturbation cStar n s x * tiledPerturbation cStar n t x) = _ calc _ = (∫ x in covariateSpace, (1 + tiledPerturbation cStar n s x) + tiledPerturbation cStar n t x) + ∫ x in covariateSpace, tiledPerturbation cStar n s x * tiledPerturbation cStar n t x := by exact integral_add (((integrable_const 1).add hs.1).add ht.1) (tiledPerturbation_product_integrable cStar n s t) _ = ((∫ x in covariateSpace, 1 + tiledPerturbation cStar n s x) + ∫ x in covariateSpace, tiledPerturbation cStar n t x) + ∫ x in covariateSpace, tiledPerturbation cStar n s x * tiledPerturbation cStar n t x := by congr 1 exact integral_add ((integrable_const 1).add hs.1) ht.1 _ = (((∫ _x in covariateSpace, (1 : ℝ)) + ∫ x in covariateSpace, tiledPerturbation cStar n s x) + ∫ x in covariateSpace, tiledPerturbation cStar n t x) + ∫ x in covariateSpace, tiledPerturbation cStar n s x * tiledPerturbation cStar n t x := by congr 2 exact integral_add (integrable_const 1) hs.1 _ = _ := by rw [hs.2, ht.2, hp] simp [covariateSpace] ring
CausalSmith.Stat.TransportCaceRoughnuisanceLength.targetLikelihood_pair_integral · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/Overlap.lean:254
CausalSmith.Stat.STAT_TransportCaceRoughnuisanceLength_Research.Helpers.LegalMixture.ProbabilitySupport 14 declarations The normalized finite masses and the zero-integral perturbation verify the probability-law requirement in the membership roadmap (7), (13)--(18).

Probability and covariate support of the legal primitive laws

The normalized finite masses and the zero-integral perturbation verify the probability-law requirement in the membership roadmap (7), (13)--(18).

theorem primitivePopulation_covariate_support Lemma primitivePopulation_covariate_support in the paper ↗

Covariate mixing preserves the unit-interval covariate support. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
s :
density :
ℝ → ℝ
mass :
ℝ → Bool → Bool → Bool → Bool → ℝ
hm :
∀ d0 d1 y0 y1, Measurable fun x => mass x d0 d1 y0 y1
∀ᵐ o ∂primitivePopulation s density mass, covariate o ∈ covariateSpace
Proof (Lean source)
-- @node: primitivePopulation_covariate_support lemma primitivePopulation_covariate_support (s : Bool) (density : ℝ → ℝ) (mass : ℝ → Bool → Bool → Bool → Bool → ℝ) (hm : ∀ d0 d1 y0 y1, Measurable fun x => mass x d0 d1 y0 y1) : ∀ᵐ o ∂primitivePopulation s density mass, covariate o ∈ covariateSpace := by have hcov : Measurable covariate := by unfold covariate; fun_prop have hbad : MeasurableSet {o : FullData | covariate o ∉ covariateSpace} := by exact (measurableSet_Icc.preimage hcov).compl rw [ae_iff] unfold primitivePopulation rw [Measure.bind_apply hbad (primitiveKernel_measurable_of s mass hm).aemeasurable] apply lintegral_eq_zero_of_ae_eq_zero have hx : ∀ᵐ x ∂(volume.restrict covariateSpace).withDensity (fun x => ofReal (density x)), x ∈ covariateSpace := (withDensity_absolutelyContinuous _ _).ae_le (ae_restrict_mem measurableSet_Icc) filter_upwards [hx] with x hx simp [primitiveKernel, covariate, hx]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.primitivePopulation_covariate_support · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/ProbabilitySupport.lean:19
theorem lawFromMass_full_isProbability Lemma lawFromMass_full_isProbability in the paper ↗

Two normalized primitive populations give a normalized full-data mixture. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
fS fT e :
ℝ → ℝ
mass :
ℝ → Bool → Bool → Bool → Bool → ℝ
hm :
∀ d0 d1 y0 y1, Measurable fun x => mass x d0 d1 y0 y1
hm0 :
∀ x d0 d1 y0 y1, 0 ≤ mass x d0 d1 y0 y1
hsum :
∀ x, ∑ d0 : Bool, ∑ d1 : Bool, ∑ y0 : Bool, ∑ y1 : Bool, mass x d0 d1 y0 y1 = 1
hS :
((volume.restrict covariateSpace).withDensity (fun x => ofReal (fS x))) univ = 1
hT :
((volume.restrict covariateSpace).withDensity (fun x => ofReal (fT x))) univ = 1
Proof (Lean source)
-- @node: lawFromMass_full_isProbability lemma lawFromMass_full_isProbability (fS fT e : ℝ → ℝ) (mass : ℝ → Bool → Bool → Bool → Bool → ℝ) (hm : ∀ d0 d1 y0 y1, Measurable fun x => mass x d0 d1 y0 y1) (hm0 : ∀ x d0 d1 y0 y1, 0 ≤ mass x d0 d1 y0 y1) (hsum : ∀ x, ∑ d0 : Bool, ∑ d1 : Bool, ∑ y0 : Bool, ∑ y1 : Bool, mass x d0 d1 y0 y1 = 1) (hS : ((volume.restrict covariateSpace).withDensity (fun x => ofReal (fS x))) univ = 1) (hT : ((volume.restrict covariateSpace).withDensity (fun x => ofReal (fT x))) univ = 1) : IsProbabilityMeasure (lawFromMass fS fT e mass).fullLaw := by constructor change ((1 / 2 : ℝ≥0∞) • primitivePopulation true fS mass + (1 / 2 : ℝ≥0∞) • primitivePopulation false fT mass) univ = 1 rw [Measure.add_apply, Measure.smul_apply, Measure.smul_apply, primitivePopulation_univ true fS mass hm hm0 hsum, primitivePopulation_univ false fT mass hm hm0 hsum, hS, hT] simpa using ENNReal.inv_two_add_inv_two
CausalSmith.Stat.TransportCaceRoughnuisanceLength.lawFromMass_full_isProbability · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/ProbabilitySupport.lean:38
theorem lawFromMass_full_support Lemma lawFromMass_full_support in the paper ↗

The full mixture satisfies the covariate and potential-outcome support clause. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
fS fT e :
ℝ → ℝ
mass :
ℝ → Bool → Bool → Bool → Bool → ℝ
hm :
∀ d0 d1 y0 y1, Measurable fun x => mass x d0 d1 y0 y1
∀ᵐ o ∂(lawFromMass fS fT e mass).fullLaw, covariate o ∈ covariateSpace ∧ outcome0 o ∈ Icc (0 : ℝ) 1 ∧ outcome1 o ∈ Icc (0 : ℝ) 1
Proof (Lean source)
-- @node: lawFromMass_full_support lemma lawFromMass_full_support (fS fT e : ℝ → ℝ) (mass : ℝ → Bool → Bool → Bool → Bool → ℝ) (hm : ∀ d0 d1 y0 y1, Measurable fun x => mass x d0 d1 y0 y1) : ∀ᵐ o ∂(lawFromMass fS fT e mass).fullLaw, covariate o ∈ covariateSpace ∧ outcome0 o ∈ Icc (0 : ℝ) 1 ∧ outcome1 o ∈ Icc (0 : ℝ) 1 := by change ∀ᵐ o ∂(1 / 2 : ℝ≥0∞) • primitivePopulation true fS mass + (1 / 2 : ℝ≥0∞) • primitivePopulation false fT mass, _ rw [ae_add_measure_iff] constructor <;> apply Measure.ae_smul_measure · exact (primitivePopulation_covariate_support true fS mass hm).and (primitivePopulation_outcome_bounds true fS mass hm) · exact (primitivePopulation_covariate_support false fT mass hm).and (primitivePopulation_outcome_bounds false fT mass hm)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.lawFromMass_full_support · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/ProbabilitySupport.lean:59
theorem mixtureCenter_full_isProbability Lemma mixtureCenter_full_isProbability in the paper ↗

The baseline center's full-data law is a probability measure. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
a :
ℝ
n :
ℕ
hb :
0 < actualStrength a n ∧ actualStrength a n ≤ 1 / 4
Proof (Lean source)
-- @node: mixtureCenter_full_isProbability lemma mixtureCenter_full_isProbability (a : ℝ) (n : ℕ) (hb : 0 < actualStrength a n ∧ actualStrength a n ≤ 1 / 4) : IsProbabilityMeasure (mixtureCenter a n).fullLaw := by apply lawFromMass_full_isProbability · exact fun _ _ _ _ => measurable_const · intro x d0 d1 y0 y1 exact primitiveMass_nonneg_of_bounds (actualStrength a n) 0 0 hb (by norm_num) (by norm_num) (by nlinarith [hb.1]) d0 d1 y0 y1 · intro x exact primitiveMass_sum (actualStrength a n) 0 0 (ne_of_gt hb.1) (by norm_num) · simp [covariateSpace] · simp [covariateSpace]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.mixtureCenter_full_isProbability · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/ProbabilitySupport.lean:76
theorem legalIVComponent_full_isProbability Lemma legalIVComponent_full_isProbability in the paper ↗

The perturbed component's full-data law is a probability measure. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
a :
ℝ
n :
ℕ
cStar τ :
ℝ
sgn :
hb :
0 < actualStrength a n ∧ actualStrength a n ≤ 1 / 4
hAdm :
LowerAdmissible n a cStar
hτ :
τ ∈ Icc (-1 : ℝ) 1
hn :
0 < n
Proof (Lean source)
-- @node: legalIVComponent_full_isProbability lemma legalIVComponent_full_isProbability (a : ℝ) (n : ℕ) (cStar τ : ℝ) (sgn : Fin (lowerCells n) → Bool) (hb : 0 < actualStrength a n ∧ actualStrength a n ≤ 1 / 4) (hAdm : LowerAdmissible n a cStar) (hτ : τ ∈ Icc (-1 : ℝ) 1) (hn : 0 < n) : IsProbabilityMeasure (legalIVComponent a n cStar τ sgn).fullLaw := by apply lawFromMass_full_isProbability · exact lowerMass_measurable a n cStar τ sgn · exact lowerMass_nonneg a n cStar τ sgn hb hAdm hτ · intro x apply primitiveMass_sum _ _ _ (ne_of_gt hb.1) have h := tiledPerturbation_abs_le_lowerHeight cStar n sgn x hAdm.1.le have h' := le_trans h hAdm.2.1 nlinarith [sq_abs (tiledPerturbation cStar n sgn x), abs_nonneg (tiledPerturbation cStar n sgn x)] · simp [covariateSpace] · apply targetDensity_univ cStar n sgn hn intro x have h := tiledPerturbation_abs_le_lowerHeight cStar n sgn x hAdm.1.le have h' := le_trans h hAdm.2.1 linarith [neg_abs_le (tiledPerturbation cStar n sgn x)]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.legalIVComponent_full_isProbability · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/ProbabilitySupport.lean:91
theorem legalIVComponent_full_support Lemma legalIVComponent_full_support in the paper ↗

All primitive component covariates and potential outcomes have the required support. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
a :
ℝ
n :
ℕ
cStar τ :
ℝ
sgn :
∀ᵐ o ∂(legalIVComponent a n cStar τ sgn).fullLaw, covariate o ∈ covariateSpace ∧ outcome0 o ∈ Icc (0 : ℝ) 1 ∧ outcome1 o ∈ Icc (0 : ℝ) 1
Proof (Lean source)
-- @node: legalIVComponent_full_support lemma legalIVComponent_full_support (a : ℝ) (n : ℕ) (cStar τ : ℝ) (sgn : Fin (lowerCells n) → Bool) : ∀ᵐ o ∂(legalIVComponent a n cStar τ sgn).fullLaw, covariate o ∈ covariateSpace ∧ outcome0 o ∈ Icc (0 : ℝ) 1 ∧ outcome1 o ∈ Icc (0 : ℝ) 1 := lawFromMass_full_support _ _ _ _ (lowerMass_measurable a n cStar τ sgn)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.legalIVComponent_full_support · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/ProbabilitySupport.lean:115
theorem mixtureCenter_full_support Lemma mixtureCenter_full_support in the paper ↗

The center's covariates and potential outcomes have the required support. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
a :
ℝ
n :
ℕ
∀ᵐ o ∂(mixtureCenter a n).fullLaw, covariate o ∈ covariateSpace ∧ outcome0 o ∈ Icc (0 : ℝ) 1 ∧ outcome1 o ∈ Icc (0 : ℝ) 1
Proof (Lean source)
-- @node: mixtureCenter_full_support lemma mixtureCenter_full_support (a : ℝ) (n : ℕ) : ∀ᵐ o ∂(mixtureCenter a n).fullLaw, covariate o ∈ covariateSpace ∧ outcome0 o ∈ Icc (0 : ℝ) 1 ∧ outcome1 o ∈ Icc (0 : ℝ) 1 := lawFromMass_full_support _ _ _ _ (fun _ _ _ _ => measurable_const)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.mixtureCenter_full_support · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/ProbabilitySupport.lean:124
theorem explicitSourceLaw_covariate Lemma explicitSourceLaw_covariate in the paper ↗

Summing the normalized observed cells leaves the uniform covariate marginal. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
a τ :
ℝ
u :
ℝ → ℝ
hu :
hq :
∀ x c, 0 ≤ sourceCellMass a (u x) (τ * u x) c
(explicitSourceLaw a u (fun x => τ * u x)).map fst = volume.restrict covariateSpace
Proof (Lean source)
-- @node: explicitSourceLaw_covariate lemma explicitSourceLaw_covariate (a τ : ℝ) (u : ℝ → ℝ) (hu : Measurable u) (hq : ∀ x c, 0 ≤ sourceCellMass a (u x) (τ * u x) c) : (explicitSourceLaw a u (fun x => τ * u x)).map fst = volume.restrict covariateSpace := by classical ext B hB rw [Measure.map_apply measurable_fst hB, explicitSourceLaw_apply a u (fun x => τ * u x) hu (measurable_const.mul hu) _ (hB.preimage measurable_fst)] unfold encodedCellSetMass have hsum (x : ℝ) : ∑ c : SourceCell, ofReal (sourceCellMass a (u x) (τ * u x) c) = 1 := by rw [← ENNReal.ofReal_sum_of_nonneg (fun c _ => hq x c), sourceCellMass_sum] simp calc _ = ∫⁻ x, B.indicator (fun _ => (1 : ℝ≥0∞)) x ∂volume.restrict covariateSpace := by apply lintegral_congr intro x by_cases hx : x ∈ B · simpa [sourceCellObservation, hx] using hsum x · simp [sourceCellObservation, hx] _ = _ := lintegral_indicator_one hB
CausalSmith.Stat.TransportCaceRoughnuisanceLength.explicitSourceLaw_covariate · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/ProbabilitySupport.lean:132
theorem mixtureCenter_sourceXLaw Lemma mixtureCenter_sourceXLaw in the paper ↗

The center's observed source covariate density is exactly one. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
a :
ℝ
n :
ℕ
hb :
0 < actualStrength a n ∧ actualStrength a n ≤ 1 / 4
sourceXLaw (mixtureCenter a n) = volume.restrict covariateSpace
Proof (Lean source)
-- @node: mixtureCenter_sourceXLaw lemma mixtureCenter_sourceXLaw (a : ℝ) (n : ℕ) (hb : 0 < actualStrength a n ∧ actualStrength a n ≤ 1 / 4) : sourceXLaw (mixtureCenter a n) = volume.restrict covariateSpace := by change (Measure.map observeSource (assignedFrom (primitivePopulation true (fun _ => 1) (fun _ => primitiveMass (actualStrength a n) 0 0)) (fun _ => 1 / 2))).map fst = _ rw [centerSourceLaw_eq_explicit a n hb] have hq (x : ℝ) (c : SourceCell) : 0 ≤ sourceCellMass (actualStrength a n) 0 (0 * 0) c := by simpa [sourceCenterMass] using (sourceCenterMass_pos (actualStrength a n) ⟨hb.1, by linarith [hb.2]⟩ c).le simpa using explicitSourceLaw_covariate (actualStrength a n) 0 (fun _ => 0) measurable_const hq
CausalSmith.Stat.TransportCaceRoughnuisanceLength.mixtureCenter_sourceXLaw · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/ProbabilitySupport.lean:159
theorem legalIVComponent_sourceXLaw Lemma legalIVComponent_sourceXLaw in the paper ↗

The component's observed source covariate density is exactly one. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
a :
ℝ
n :
ℕ
cStar τ :
ℝ
sgn :
hb :
0 < actualStrength a n ∧ actualStrength a n ≤ 1 / 4
hAdm :
LowerAdmissible n a cStar
hτ :
τ ∈ Icc (-1 : ℝ) 1
sourceXLaw (legalIVComponent a n cStar τ sgn) = volume.restrict covariateSpace
Proof (Lean source)
-- @node: legalIVComponent_sourceXLaw lemma legalIVComponent_sourceXLaw (a : ℝ) (n : ℕ) (cStar τ : ℝ) (sgn : Fin (lowerCells n) → Bool) (hb : 0 < actualStrength a n ∧ actualStrength a n ≤ 1 / 4) (hAdm : LowerAdmissible n a cStar) (hτ : τ ∈ Icc (-1 : ℝ) 1) : sourceXLaw (legalIVComponent a n cStar τ sgn) = volume.restrict covariateSpace := by have hq := lowerSourceCellMass_nonneg a n cStar τ sgn hb hAdm hτ have hsource := sourceLaw_eq_explicit_of_nonneg a n cStar τ sgn (lowerMass_nonneg a n cStar τ sgn hb hAdm hτ) (fun x z => (lowerAssignmentWeight_mem_Icc a n cStar τ sgn hAdm x z).1) hb.1 (by intro x have h := tiledPerturbation_abs_le_lowerHeight cStar n sgn x hAdm.1.le have h' := le_trans h hAdm.2.1 nlinarith [sq_abs (tiledPerturbation cStar n sgn x), abs_nonneg (tiledPerturbation cStar n sgn x)]) change (sourceObsLaw (legalIVComponent a n cStar τ sgn)).map fst = _ change (Measure.map observeSource (assignedFrom (primitivePopulation true (fun _ => 1) (lowerMass a n cStar τ sgn)) (fun x => 1 / 2 + tiledPerturbation cStar n sgn x))).map fst = _ rw [hsource] exact explicitSourceLaw_covariate (actualStrength a n) τ _ (tiledPerturbation_measurable cStar n sgn) hq
CausalSmith.Stat.TransportCaceRoughnuisanceLength.legalIVComponent_sourceXLaw · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/ProbabilitySupport.lean:176
theorem mixtureCenter_sourceDensityBounds

The center satisfies every source-density bound and full-data support requirement. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
a c_f C_f :
ℝ
n :
ℕ
hf :
0 < c_f ∧ c_f < 1
hF :
1 < C_f
hb :
0 < actualStrength a n ∧ actualStrength a n ≤ 1 / 4
Proof (Lean source)
-- @node: mixtureCenter_sourceDensityBounds lemma mixtureCenter_sourceDensityBounds (a c_f C_f : ℝ) (n : ℕ) (hf : 0 < c_f ∧ c_f < 1) (hF : 1 < C_f) (hb : 0 < actualStrength a n ∧ actualStrength a n ≤ 1 / 4) : SourceDensityBounds c_f C_f (mixtureCenter a n) := by refine ⟨hf, hF, mixtureCenter_full_isProbability a n hb, mixtureCenter_full_support a n, ?_, ?_⟩ · simpa [mixtureCenter, lawFromMass] using mixtureCenter_sourceXLaw a n hb · intro x hx exact ⟨hf.2.le, hF.le⟩
CausalSmith.Stat.TransportCaceRoughnuisanceLength.mixtureCenter_sourceDensityBounds · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/ProbabilitySupport.lean:201
theorem legalIVComponent_sourceDensityBounds

The perturbed component satisfies every source-density and full-data support requirement. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
a c_f C_f :
ℝ
n :
ℕ
cStar τ :
ℝ
sgn :
hf :
0 < c_f ∧ c_f < 1
hF :
1 < C_f
hb :
0 < actualStrength a n ∧ actualStrength a n ≤ 1 / 4
hAdm :
LowerAdmissible n a cStar
hτ :
τ ∈ Icc (-1 : ℝ) 1
hn :
0 < n
SourceDensityBounds c_f C_f (legalIVComponent a n cStar τ sgn)
Proof (Lean source)
-- @node: legalIVComponent_sourceDensityBounds lemma legalIVComponent_sourceDensityBounds (a c_f C_f : ℝ) (n : ℕ) (cStar τ : ℝ) (sgn : Fin (lowerCells n) → Bool) (hf : 0 < c_f ∧ c_f < 1) (hF : 1 < C_f) (hb : 0 < actualStrength a n ∧ actualStrength a n ≤ 1 / 4) (hAdm : LowerAdmissible n a cStar) (hτ : τ ∈ Icc (-1 : ℝ) 1) (hn : 0 < n) : SourceDensityBounds c_f C_f (legalIVComponent a n cStar τ sgn) := by refine ⟨hf, hF, legalIVComponent_full_isProbability a n cStar τ sgn hb hAdm hτ hn, legalIVComponent_full_support a n cStar τ sgn, ?_, ?_⟩ · simpa [legalIVComponent, lawFromMass] using legalIVComponent_sourceXLaw a n cStar τ sgn hb hAdm hτ · intro x hx exact ⟨hf.2.le, hF.le⟩
CausalSmith.Stat.TransportCaceRoughnuisanceLength.legalIVComponent_sourceDensityBounds · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/ProbabilitySupport.lean:213
theorem mixtureCenter_targetDensityBounds Lemma mixtureCenter_targetDensityBounds in the paper ↗

The center's target density is uniform and obeys both envelopes. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
a c_f C_f :
ℝ
n :
ℕ
hf :
0 < c_f ∧ c_f < 1
hF :
1 < C_f
hb :
0 < actualStrength a n ∧ actualStrength a n ≤ 1 / 4
Proof (Lean source)
lemma mixtureCenter_targetDensityBounds (a c_f C_f : ℝ) (n : ℕ) (hf : 0 < c_f ∧ c_f < 1) (hF : 1 < C_f) (hb : 0 < actualStrength a n ∧ actualStrength a n ≤ 1 / 4) : TargetDensityBounds c_f C_f (mixtureCenter a n) := by constructor · simpa [targetXLaw, populationLaw, mixtureCenter, lawFromMass] using centerTargetLaw_eq_volume a n hb · refine ⟨?_, hf.1⟩ intro x hx exact ⟨hf.2.le, hF.le⟩
CausalSmith.Stat.TransportCaceRoughnuisanceLength.mixtureCenter_targetDensityBounds · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/ProbabilitySupport.lean:228
theorem legalIVComponent_targetDensityBounds Lemma legalIVComponent_targetDensityBounds in the paper ↗

The component's target density obeys the envelopes when the height respects their margins. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
a c_f C_f :
ℝ
n :
ℕ
cStar τ :
ℝ
sgn :
hb :
0 < actualStrength a n ∧ actualStrength a n ≤ 1 / 4
hAdm :
LowerAdmissible n a cStar
hτ :
τ ∈ Icc (-1 : ℝ) 1
hn :
0 < n
hlo :
lowerHeight cStar n ≤ 1 - c_f
hhi :
lowerHeight cStar n ≤ C_f - 1
hf :
0 < c_f
TargetDensityBounds c_f C_f (legalIVComponent a n cStar τ sgn)
Proof (Lean source)
lemma legalIVComponent_targetDensityBounds (a c_f C_f : ℝ) (n : ℕ) (cStar τ : ℝ) (sgn : Fin (lowerCells n) → Bool) (hb : 0 < actualStrength a n ∧ actualStrength a n ≤ 1 / 4) (hAdm : LowerAdmissible n a cStar) (hτ : τ ∈ Icc (-1 : ℝ) 1) (hn : 0 < n) (hlo : lowerHeight cStar n ≤ 1 - c_f) (hhi : lowerHeight cStar n ≤ C_f - 1) (hf : 0 < c_f) : TargetDensityBounds c_f C_f (legalIVComponent a n cStar τ sgn) := by constructor · exact legalTargetLaw_eq_density a n cStar τ sgn hb hAdm hτ hn · refine ⟨?_, hf⟩ intro x hx have hu := tiledPerturbation_abs_le_lowerHeight cStar n sgn x hAdm.1.le change c_f ≤ 1 + tiledPerturbation cStar n sgn x ∧ 1 + tiledPerturbation cStar n sgn x ≤ C_f constructor <;> linarith [neg_abs_le (tiledPerturbation cStar n sgn x), le_abs_self (tiledPerturbation cStar n sgn x)]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.legalIVComponent_targetDensityBounds · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/ProbabilitySupport.lean:240
CausalSmith.Stat.STAT_TransportCaceRoughnuisanceLength_Research.Helpers.LegalMixture.SeparationIdentity 11 declarations Exact nonlinear tiled-bump integrals for the lower separation

Exact nonlinear tiled-bump integrals for the lower separation

theorem tiledPerturbation_comp_eq_sum Lemma tiledPerturbation_comp_eq_sum in the paper ↗

A nonlinear function vanishing at zero acts cellwise on the disjoint tiled bump. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
cStar :
ℝ
n :
ℕ
sgn :
Fin (lowerCells n) → Bool
hK :
0 < lowerCells n
f :
ℝ → ℝ
hf :
f 0 = 0
x :
ℝ
f (tiledPerturbation cStar n sgn x)
= ∑ i : Fin (lowerCells n), if x ∈ cell (lowerCells n) i then f (lowerHeight cStar n * sign (sgn i) * bump ((lowerCells n : ℝ) * x - i.val)) else 0
Proof (Lean source)
-- @node: tiledPerturbation_comp_eq_sum lemma tiledPerturbation_comp_eq_sum (cStar : ℝ) (n : ℕ) (sgn : Fin (lowerCells n) → Bool) (hK : 0 < lowerCells n) (f : ℝ → ℝ) (hf : f 0 = 0) (x : ℝ) : f (tiledPerturbation cStar n sgn x) = ∑ i : Fin (lowerCells n), if x ∈ cell (lowerCells n) i then f (lowerHeight cStar n * sign (sgn i) * bump ((lowerCells n : ℝ) * x - i.val)) else 0 := by classical by_cases hex : ∃ i : Fin (lowerCells n), x ∈ cell (lowerCells n) i · obtain ⟨i, hi⟩ := hex have hnot (j : Fin (lowerCells n)) (hji : j ≠ i) : x ∉ cell (lowerCells n) j := by intro hj exact hji (cell_mem_unique _ hK j i x hj hi) unfold tiledPerturbation rw [Finset.sum_eq_single i, Finset.sum_eq_single i] · simp [hi] · intro j _ hji simp [hnot j hji] · simp · intro j _ hji simp [hnot j hji] · simp · have hnot (i : Fin (lowerCells n)) : x ∉ cell (lowerCells n) i := fun hi => hex ⟨i, hi⟩ simp [tiledPerturbation, hnot, hf]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.tiledPerturbation_comp_eq_sum · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/SeparationIdentity.lean:14
theorem integral_tiledPerturbation_comp Lemma integral_tiledPerturbation_comp in the paper ↗

Integration of an integrable transform reduces to the finite cell sum. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
cStar :
ℝ
n :
ℕ
sgn :
Fin (lowerCells n) → Bool
hK :
0 < lowerCells n
f :
ℝ → ℝ
hf :
∀ i : Fin (lowerCells n),
IntegrableOn (fun x : ℝ => f (lowerHeight cStar n * sign (sgn i) * bump ((lowerCells n : ℝ) * x - i.val))) covariateSpace
hf0 :
f 0 = 0
(∫ x in covariateSpace, f (tiledPerturbation cStar n sgn x))
= ∑ i : Fin (lowerCells n), ∫ x in cell (lowerCells n) i, f (lowerHeight cStar n * sign (sgn i) * bump ((lowerCells n : ℝ) * x - i.val))
Proof (Lean source)
-- @node: integral_tiledPerturbation_comp lemma integral_tiledPerturbation_comp (cStar : ℝ) (n : ℕ) (sgn : Fin (lowerCells n) → Bool) (hK : 0 < lowerCells n) (f : ℝ → ℝ) (hf : ∀ i : Fin (lowerCells n), IntegrableOn (fun x : ℝ => f (lowerHeight cStar n * sign (sgn i) * bump ((lowerCells n : ℝ) * x - i.val))) covariateSpace) (hf0 : f 0 = 0) : (∫ x in covariateSpace, f (tiledPerturbation cStar n sgn x)) = ∑ i : Fin (lowerCells n), ∫ x in cell (lowerCells n) i, f (lowerHeight cStar n * sign (sgn i) * bump ((lowerCells n : ℝ) * x - i.val)) := by classical have hm (i : Fin (lowerCells n)) : MeasurableSet (cell (lowerCells n) i) := by unfold cell split_ifs <;> measurability have hi (i : Fin (lowerCells n)) : Integrable (fun x : ℝ => if x ∈ cell (lowerCells n) i then f (lowerHeight cStar n * sign (sgn i) * bump ((lowerCells n : ℝ) * x - i.val)) else 0) (volume.restrict covariateSpace) := by exact (hf i).indicator (hm i) simp_rw [tiledPerturbation_comp_eq_sum cStar n sgn hK f hf0] rw [integral_finsetSum univ (fun i _ => hi i)] apply Finset.sum_congr rfl intro i _ change (∫ x in covariateSpace, (cell (lowerCells n) i).indicator (fun y : ℝ => f (lowerHeight cStar n * sign (sgn i) * bump ((lowerCells n : ℝ) * y - i.val))) x) = _ rw [integral_indicator (hm i), Measure.restrict_restrict_of_subset (cell_subset_covariateSpace _ hK i)]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.integral_tiledPerturbation_comp · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/SeparationIdentity.lean:43
theorem integral_comp_affine_cell Lemma integral_comp_affine_cell in the paper ↗

The affine substitution on a tile has Jacobian equal to the reciprocal cell count. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
K :
ℕ
hK :
0 < K
i :
Fin K
f :
ℝ → ℝ
(∫ x in cell K i, f ((K : ℝ) * x - i.val)) = (K : ℝ)⁻¹ * ∫ t in (0 : ℝ)..1, f t
Proof (Lean source)
-- @node: integral_comp_affine_cell lemma integral_comp_affine_cell (K : ℕ) (hK : 0 < K) (i : Fin K) (f : ℝ → ℝ) : (∫ x in cell K i, f ((K : ℝ) * x - i.val)) = (K : ℝ)⁻¹ * ∫ t in (0 : ℝ)..1, f t := by have hK0 : (K : ℝ) ≠ 0 := by exact_mod_cast Nat.ne_of_gt hK have hle : (i.val : ℝ) / K ≤ ((i.val : ℝ) + 1) / K := by apply div_le_div_of_nonneg_right (by linarith) (by positivity) have h := intervalIntegral.mul_integral_comp_mul_sub (f := f) (K : ℝ) (i.val : ℝ) (a := (i.val : ℝ) / K) (b := ((i.val : ℝ) + 1) / K) have hlo : (K : ℝ) * ((i.val : ℝ) / K) - i.val = 0 := by field_simp; ring have hhi : (K : ℝ) * (((i.val : ℝ) + 1) / K) - i.val = 1 := by field_simp ring rw [hlo, hhi] at h have heq : (∫ x in ((i.val : ℝ) / K)..(((i.val : ℝ) + 1) / K), f ((K : ℝ) * x - i.val)) = (K : ℝ)⁻¹ * ∫ t in (0 : ℝ)..1, f t := by apply (mul_left_cancel₀ hK0) rw [h] field_simp unfold cell split_ifs with hlast · have hend : ((i.val : ℝ) + 1) / K = 1 := by have : (i.val : ℝ) + 1 = K := by exact_mod_cast hlast rw [this] simp [hK0] conv_lhs => rw [← hend, integral_Icc_eq_integral_Ioc, ← intervalIntegral.integral_of_le hle] exact heq · rw [integral_Ico_eq_integral_Ioc, ← intervalIntegral.integral_of_le hle] exact heq
CausalSmith.Stat.TransportCaceRoughnuisanceLength.integral_comp_affine_cell · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/SeparationIdentity.lean:76
theorem integral_tiledPerturbation_rational_power Lemma integral_tiledPerturbation_rational_power in the paper ↗

The rational bump powers integrate exactly tile by tile, including their sign factors. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
cStar :
ℝ
n :
ℕ
sgn :
Fin (lowerCells n) → Bool
hK :
0 < lowerCells n
hh :
lowerHeight cStar n ^ 2 ≤ 1 / 8
p :
ℕ
hp :
0 < p
(∫ x in covariateSpace, tiledPerturbation cStar n sgn x ^ p / (1 / 4 - tiledPerturbation cStar n sgn x ^ 2))
= ∑ i : Fin (lowerCells n), (lowerHeight cStar n ^ p * sign (sgn i) ^ p) * ((lowerCells n : ℝ)⁻¹ * ∫ t in (0 : ℝ)..1, bump t ^ p / (1 / 4 - lowerHeight cStar n ^ 2 * bump t ^ 2))
Proof (Lean source)
-- @node: integral_tiledPerturbation_rational_power lemma integral_tiledPerturbation_rational_power (cStar : ℝ) (n : ℕ) (sgn : Fin (lowerCells n) → Bool) (hK : 0 < lowerCells n) (hh : lowerHeight cStar n ^ 2 ≤ 1 / 8) (p : ℕ) (hp : 0 < p) : (∫ x in covariateSpace, tiledPerturbation cStar n sgn x ^ p / (1 / 4 - tiledPerturbation cStar n sgn x ^ 2)) = ∑ i : Fin (lowerCells n), (lowerHeight cStar n ^ p * sign (sgn i) ^ p) * ((lowerCells n : ℝ)⁻¹ * ∫ t in (0 : ℝ)..1, bump t ^ p / (1 / 4 - lowerHeight cStar n ^ 2 * bump t ^ 2)) := by let h := lowerHeight cStar n have hs (b : Bool) : sign b ^ 2 = 1 := by cases b <;> norm_num [sign] have hb (t : ℝ) : bump t ^ 2 ≤ 1 := by have ht : |bump t| ≤ 1 := by simpa [bump] using Real.abs_sin_le_one (2 * pi * t) nlinarith [sq_abs (bump t), abs_nonneg (bump t)] have hd (t : ℝ) : 0 < 1 / 4 - h ^ 2 * bump t ^ 2 := by have := mul_le_mul_of_nonneg_left (hb t) (sq_nonneg h) change h ^ 2 ≤ 1 / 8 at hh nlinarith have hcont : Continuous (fun t : ℝ => bump t ^ p / (1 / 4 - h ^ 2 * bump t ^ 2)) := by have hc : Continuous bump := by unfold bump; fun_prop exact (hc.pow p).div (continuous_const.sub (continuous_const.mul (hc.pow 2))) (fun t => ne_of_gt (hd t)) have heq (i : Fin (lowerCells n)) (t : ℝ) : (h * sign (sgn i) * bump t) ^ p / (1 / 4 - (h * sign (sgn i) * bump t) ^ 2) = (h ^ p * sign (sgn i) ^ p) * (bump t ^ p / (1 / 4 - h ^ 2 * bump t ^ 2)) := by rw [mul_pow, mul_pow, mul_pow, mul_pow, hs, mul_one] ring have hi (i : Fin (lowerCells n)) : IntegrableOn (fun x : ℝ => (h * sign (sgn i) * bump ((lowerCells n : ℝ) * x - i.val)) ^ p / (1 / 4 - (h * sign (sgn i) * bump ((lowerCells n : ℝ) * x - i.val)) ^ 2)) covariateSpace := by simp_rw [heq] have hc : Continuous (fun x : ℝ => (h ^ p * sign (sgn i) ^ p) * (bump ((lowerCells n : ℝ) * x - i.val) ^ p / (1 / 4 - h ^ 2 * bump ((lowerCells n : ℝ) * x - i.val) ^ 2))) := by exact continuous_const.mul (hcont.comp (by fun_prop)) exact hc.continuousOn.integrableOn_Icc rw [integral_tiledPerturbation_comp cStar n sgn hK (fun u : ℝ => u ^ p / (1 / 4 - u ^ 2)) hi (by simp [Nat.ne_of_gt hp])] dsimp [h] at heq apply Finset.sum_congr rfl intro i _ simp_rw [heq] rw [integral_const_mul, integral_comp_affine_cell _ hK i (fun t : ℝ => bump t ^ p / (1 / 4 - lowerHeight cStar n ^ 2 * bump t ^ 2))]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.integral_tiledPerturbation_rational_power · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/SeparationIdentity.lean:109
theorem tiledPerturbation_odd_ratio_integral_zero Lemma tiledPerturbation_odd_ratio_integral_zero in the paper ↗

The odd rational correction has zero integral on every tile. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
cStar :
ℝ
n :
ℕ
sgn :
hK :
hh :
lowerHeight cStar n ^ 2 ≤ 1 / 8
(∫ x in covariateSpace, tiledPerturbation cStar n sgn x ^ 3 / (1 / 4 - tiledPerturbation cStar n sgn x ^ 2))
= 0
Proof (Lean source)
-- @node: tiledPerturbation_odd_ratio_integral_zero lemma tiledPerturbation_odd_ratio_integral_zero (cStar : ℝ) (n : ℕ) (sgn : Fin (lowerCells n) → Bool) (hK : 0 < lowerCells n) (hh : lowerHeight cStar n ^ 2 ≤ 1 / 8) : (∫ x in covariateSpace, tiledPerturbation cStar n sgn x ^ 3 / (1 / 4 - tiledPerturbation cStar n sgn x ^ 2)) = 0 := by rw [integral_tiledPerturbation_rational_power cStar n sgn hK hh 3 (by norm_num)] rw [bump_odd_ratio_integral_zero] simp
CausalSmith.Stat.TransportCaceRoughnuisanceLength.tiledPerturbation_odd_ratio_integral_zero · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/SeparationIdentity.lean:162
theorem tiledPerturbation_even_ratio_integral_eq_separation Lemma tiledPerturbation_even_ratio_integral_eq_separation in the paper ↗

The even rational term equals the paper's separation, independently of the signs. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
cStar :
ℝ
n :
ℕ
sgn :
hK :
hh :
lowerHeight cStar n ^ 2 ≤ 1 / 8
(∫ x in covariateSpace, tiledPerturbation cStar n sgn x ^ 2 / (1 / 4 - tiledPerturbation cStar n sgn x ^ 2))
= separation cStar n
Proof (Lean source)
-- @node: tiledPerturbation_even_ratio_integral_eq_separation lemma tiledPerturbation_even_ratio_integral_eq_separation (cStar : ℝ) (n : ℕ) (sgn : Fin (lowerCells n) → Bool) (hK : 0 < lowerCells n) (hh : lowerHeight cStar n ^ 2 ≤ 1 / 8) : (∫ x in covariateSpace, tiledPerturbation cStar n sgn x ^ 2 / (1 / 4 - tiledPerturbation cStar n sgn x ^ 2)) = separation cStar n := by rw [integral_tiledPerturbation_rational_power cStar n sgn hK hh 2 (by norm_num)] have hs (i : Fin (lowerCells n)) : sign (sgn i) ^ 2 = 1 := by cases sgn i <;> norm_num [sign] simp_rw [hs, mul_one] simp only [Finset.sum_const, Finset.card_univ, Fintype.card_fin, nsmul_eq_mul] unfold separation have hK0 : (lowerCells n : ℝ) ≠ 0 := by exact_mod_cast Nat.ne_of_gt hK field_simp congr 2 funext t ring
CausalSmith.Stat.TransportCaceRoughnuisanceLength.tiledPerturbation_even_ratio_integral_eq_separation · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/SeparationIdentity.lean:173
theorem tiledPerturbation_rational_power_integrable Lemma tiledPerturbation_rational_power_integrable in the paper ↗

The rational powers used in the separation calculation are integrable. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
cStar :
ℝ
n :
ℕ
sgn :
hh :
lowerHeight cStar n ^ 2 ≤ 1 / 8
p :
ℕ
IntegrableOn (fun x => tiledPerturbation cStar n sgn x ^ p / (1 / 4 - tiledPerturbation cStar n sgn x ^ 2)) covariateSpace
Proof (Lean source)
-- @node: tiledPerturbation_rational_power_integrable lemma tiledPerturbation_rational_power_integrable (cStar : ℝ) (n : ℕ) (sgn : Fin (lowerCells n) → Bool) (hh : lowerHeight cStar n ^ 2 ≤ 1 / 8) (p : ℕ) : IntegrableOn (fun x => tiledPerturbation cStar n sgn x ^ p / (1 / 4 - tiledPerturbation cStar n sgn x ^ 2)) covariateSpace := by have hu (x : ℝ) := tiledPerturbation_abs_le_abs_lowerHeight cStar n sgn x have hd (x : ℝ) : 1 / 8 ≤ 1 / 4 - tiledPerturbation cStar n sgn x ^ 2 := by have hs := pow_le_pow_left₀ (abs_nonneg _) (hu x) 2 simp only [sq_abs] at hs linarith have hm : Measurable (fun x => tiledPerturbation cStar n sgn x ^ p / (1 / 4 - tiledPerturbation cStar n sgn x ^ 2)) := by have h := tiledPerturbation_measurable cStar n sgn fun_prop haveI : IsFiniteMeasure (volume.restrict covariateSpace) := by change IsFiniteMeasure (volume.restrict (Icc (0 : ℝ) 1)) infer_instance apply Integrable.of_bound hm.aestronglyMeasurable (8 * |lowerHeight cStar n| ^ p) filter_upwards [] with x rw [Real.norm_eq_abs, abs_div, abs_pow, abs_of_pos (by linarith [hd x] : 0 < 1 / 4 - tiledPerturbation cStar n sgn x ^ 2), div_le_iff₀ (by linarith [hd x])] have hp := pow_le_pow_left₀ (abs_nonneg _) (hu x) p nlinarith [mul_le_mul_of_nonneg_left (hd x) (pow_nonneg (abs_nonneg (lowerHeight cStar n)) p)]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.tiledPerturbation_rational_power_integrable · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/SeparationIdentity.lean:192
theorem legalIVComponent_transportedOutcome_eq_separation Lemma legalIVComponent_transportedOutcome_eq_separation in the paper ↗

The exact transported outcome is minus tau times the separation; the tilted cubic correction cancels rather than contributing a bias term. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
a :
ℝ
n :
ℕ
cStar τ :
ℝ
sgn :
hK :
ha :
actualStrength a n ≠ 0
hh :
lowerHeight cStar n ^ 2 ≤ 1 / 8
transportedForm (legalIVComponent a n cStar τ sgn) true = -(τ * separation cStar n)
Proof (Lean source)
-- @node: legalIVComponent_transportedOutcome_eq_separation lemma legalIVComponent_transportedOutcome_eq_separation (a : ℝ) (n : ℕ) (cStar τ : ℝ) (sgn : Fin (lowerCells n) → Bool) (hK : 0 < lowerCells n) (ha : actualStrength a n ≠ 0) (hh : lowerHeight cStar n ^ 2 ≤ 1 / 8) : transportedForm (legalIVComponent a n cStar τ sgn) true = -(τ * separation cStar n) := by have hc (x : ℝ) := (legalIVComponent_arm_contrasts a n cStar τ sgn x ha).2 simp_rw [transportedForm, hc] change (∫ x in covariateSpace, (1 + tiledPerturbation cStar n sgn x) * (-(tiledPerturbation cStar n sgn x * coupledPerturbation cStar τ n sgn x) / (1 / 4 - tiledPerturbation cStar n sgn x ^ 2))) = _ have heq (x : ℝ) : (1 + tiledPerturbation cStar n sgn x) * (-(tiledPerturbation cStar n sgn x * coupledPerturbation cStar τ n sgn x) / (1 / 4 - tiledPerturbation cStar n sgn x ^ 2)) = -τ * (tiledPerturbation cStar n sgn x ^ 2 / (1 / 4 - tiledPerturbation cStar n sgn x ^ 2) + tiledPerturbation cStar n sgn x ^ 3 / (1 / 4 - tiledPerturbation cStar n sgn x ^ 2)) := by unfold coupledPerturbation ring simp_rw [heq] rw [integral_const_mul, integral_add (tiledPerturbation_rational_power_integrable cStar n sgn hh 2) (tiledPerturbation_rational_power_integrable cStar n sgn hh 3), tiledPerturbation_even_ratio_integral_eq_separation cStar n sgn hK hh, tiledPerturbation_odd_ratio_integral_zero cStar n sgn hK hh] ring
CausalSmith.Stat.TransportCaceRoughnuisanceLength.legalIVComponent_transportedOutcome_eq_separation · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/SeparationIdentity.lean:220
theorem legalIVComponent_target_integral_eq_density_integral Lemma legalIVComponent_target_integral_eq_density_integral in the paper ↗

The target integral uses exactly the tilted covariate density in the construction. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
a :
ℝ
n :
ℕ
cStar τ :
ℝ
sgn :
hb :
0 < actualStrength a n ∧ actualStrength a n ≤ 1 / 4
hAdm :
LowerAdmissible n a cStar
hτ :
τ ∈ Icc (-1 : ℝ) 1
hn :
0 < n
g :
ℝ → ℝ
(∫ x, g x ∂targetXLaw (legalIVComponent a n cStar τ sgn))
= ∫ x in covariateSpace, (1 + tiledPerturbation cStar n sgn x) * g x
Proof (Lean source)
-- @node: legalIVComponent_target_integral_eq_density_integral lemma legalIVComponent_target_integral_eq_density_integral (a : ℝ) (n : ℕ) (cStar τ : ℝ) (sgn : Fin (lowerCells n) → Bool) (hb : 0 < actualStrength a n ∧ actualStrength a n ≤ 1 / 4) (hAdm : LowerAdmissible n a cStar) (hτ : τ ∈ Icc (-1 : ℝ) 1) (hn : 0 < n) (g : ℝ → ℝ) : (∫ x, g x ∂targetXLaw (legalIVComponent a n cStar τ sgn)) = ∫ x in covariateSpace, (1 + tiledPerturbation cStar n sgn x) * g x := by have hmap := legalTargetLaw_eq_density a n cStar τ sgn hb hAdm hτ hn change targetXLaw (legalIVComponent a n cStar τ sgn) = _ at hmap have hm : Measurable (fun x : ℝ => ofReal (1 + tiledPerturbation cStar n sgn x)) := by have hu := tiledPerturbation_measurable cStar n sgn fun_prop rw [hmap, integral_withDensity_eq_integral_toReal_smul hm (by filter_upwards [] with x; simp)] apply integral_congr_ae filter_upwards [] with x have hu := tiledPerturbation_abs_le_lowerHeight cStar n sgn x hAdm.1.le have hnonneg : 0 ≤ 1 + tiledPerturbation cStar n sgn x := by linarith [hAdm.2.1, neg_abs_le (tiledPerturbation cStar n sgn x)] simp [ENNReal.toReal_ofReal hnonneg]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.legalIVComponent_target_integral_eq_density_integral · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/SeparationIdentity.lean:253
theorem legalIVComponent_targetCACE_eq_transportedOutcome

The target conditional margins identify CACE with the exact transported outcome divided by the construction's constant complier share. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
a :
ℝ
n :
ℕ
cStar τ :
ℝ
sgn :
hb :
0 < actualStrength a n ∧ actualStrength a n ≤ 1 / 4
hAdm :
LowerAdmissible n a cStar
hτ :
τ ∈ Icc (-1 : ℝ) 1
hn :
0 < n
hD :
ConditionalMean (legalIVComponent a n cStar τ sgn) false complier (fun _ => actualStrength a n)
hY :
ConditionalMean (legalIVComponent a n cStar τ sgn) false (fun o => (outcome1 o - outcome0 o) * complier o) (fun x => -(tiledPerturbation cStar n sgn x * coupledPerturbation cStar τ n sgn x) / (1 / 4 - tiledPerturbation cStar n sgn x ^ 2))
targetCACE (legalIVComponent a n cStar τ sgn)
Proof (Lean source)
-- @node: legalIVComponent_targetCACE_eq_transportedOutcome lemma legalIVComponent_targetCACE_eq_transportedOutcome (a : ℝ) (n : ℕ) (cStar τ : ℝ) (sgn : Fin (lowerCells n) → Bool) (hb : 0 < actualStrength a n ∧ actualStrength a n ≤ 1 / 4) (hAdm : LowerAdmissible n a cStar) (hτ : τ ∈ Icc (-1 : ℝ) 1) (hn : 0 < n) (hD : ConditionalMean (legalIVComponent a n cStar τ sgn) false complier (fun _ => actualStrength a n)) (hY : ConditionalMean (legalIVComponent a n cStar τ sgn) false (fun o => (outcome1 o - outcome0 o) * complier o) (fun x => -(tiledPerturbation cStar n sgn x * coupledPerturbation cStar τ n sgn x) / (1 / 4 - tiledPerturbation cStar n sgn x ^ 2))) : targetCACE (legalIVComponent a n cStar τ sgn) = transportedForm (legalIVComponent a n cStar τ sgn) true / actualStrength a n := by let P := legalIVComponent a n cStar τ sgn have hshare : targetComplierShare P = actualStrength a n := by rw [← integral_complier_eq_targetComplierShare P] have h := hD.2 univ MeasurableSet.univ simp only [Set.mem_univ, Set.setOf_true, Measure.restrict_univ] at h rw [h, ← show targetXLaw P = (populationLaw P false).map covariate from rfl] rw [legalIVComponent_target_integral_eq_density_integral a n cStar τ sgn hb hAdm hτ hn] have hu := tiledPerturbation_integrable_and_integral_zero cStar n sgn hn haveI : IsFiniteMeasure (volume.restrict covariateSpace) := by change IsFiniteMeasure (volume.restrict (Icc (0 : ℝ) 1)) infer_instance simp_rw [add_mul] rw [integral_add (integrable_const _) (hu.1.mul_const _)] simp [integral_mul_const, covariateSpace] left simpa only [covariateSpace] using hu.2 have hout : (∫ o, (outcome1 o - outcome0 o) * complier o ∂populationLaw P false) = transportedForm P true := by have h := hY.2 univ MeasurableSet.univ simp only [Set.mem_univ, Set.setOf_true, Measure.restrict_univ] at h rw [h, ← show targetXLaw P = (populationLaw P false).map covariate from rfl] rw [legalIVComponent_target_integral_eq_density_integral a n cStar τ sgn hb hAdm hτ hn] unfold transportedForm have hc (x : ℝ) := (legalIVComponent_arm_contrasts a n cStar τ sgn x (ne_of_gt hb.1)).2 change (∫ x in covariateSpace, (1 + tiledPerturbation cStar n sgn x) * _) = ∫ x in covariateSpace, (1 + tiledPerturbation cStar n sgn x) * armContrast (legalIVComponent a n cStar τ sgn) true x simp_rw [hc] change (∫ o, (outcome1 o - outcome0 o) * complier o ∂populationLaw P false) / targetComplierShare P = _ rw [hshare, hout]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.legalIVComponent_targetCACE_eq_transportedOutcome · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/SeparationIdentity.lean:277
theorem legal_mixture_margins

Given the supplied inputs, the stated result about legal mixture margins holds.

Formal statement
a :
ℝ
n :
ℕ
cStar τ :
ℝ
sgn :
hn :
threshold ≤ n
ha :
0 < a ∧ a ≤ 1 / 4
hc :
0 < cStar ∧ cStar ≤ 1 / 100
hτ :
τ ∈ Icc (-1 : ℝ) 1
conclusion 1
s :
ConditionalMean (legalIVComponent a n cStar τ sgn) s complier (fun _ => actualStrength a n)
ConditionalMean (legalIVComponent a n cStar τ sgn) s (fun o => (outcome1 o - outcome0 o) * complier o) (fun x => -(tiledPerturbation cStar n sgn x * coupledPerturbation cStar τ n sgn x) / (1 / 4 - tiledPerturbation cStar n sgn x ^ 2))
conclusion 2
firstStage (legalIVComponent a n cStar τ sgn) = actualStrength a n
conclusion 3
targetCACE (legalIVComponent a n cStar τ sgn)
= -(τ * separation cStar n) / actualStrength a n
conclusion 4
conclusion 5
Proof (Lean source)
lemma legal_mixture_margins (a : ℝ) (n : ℕ) (cStar τ : ℝ) (sgn : Fin (lowerCells n) → Bool) (hn : threshold ≤ n) (ha : 0 < a ∧ a ≤ 1 / 4) (hc : 0 < cStar ∧ cStar ≤ 1 / 100) (hτ : τ ∈ Icc (-1 : ℝ) 1) : (∀ s : Bool, ConditionalMean (legalIVComponent a n cStar τ sgn) s complier (fun _ => actualStrength a n) ∧ ConditionalMean (legalIVComponent a n cStar τ sgn) s (fun o => (outcome1 o - outcome0 o) * complier o) (fun x => -(tiledPerturbation cStar n sgn x * coupledPerturbation cStar τ n sgn x) / (1 / 4 - tiledPerturbation cStar n sgn x ^ 2))) ∧ firstStage (legalIVComponent a n cStar τ sgn) = actualStrength a n ∧ targetCACE (legalIVComponent a n cStar τ sgn) = -(τ * separation cStar n) / actualStrength a n ∧ firstStage (mixtureCenter a n) = actualStrength a n ∧ targetCACE (mixtureCenter a n) = 0 := by have hstrength : actualStrength a n ≠ 0 := by exact ne_of_gt (lt_of_lt_of_le ha.1 (le_max_left _ _)) have hmeans : ∀ s : Bool, ConditionalMean (legalIVComponent a n cStar τ sgn) s complier (fun _ => actualStrength a n) ∧ ConditionalMean (legalIVComponent a n cStar τ sgn) s (fun o => (outcome1 o - outcome0 o) * complier o) (fun x => -(tiledPerturbation cStar n sgn x * coupledPerturbation cStar τ n sgn x) / (1 / 4 - tiledPerturbation cStar n sgn x ^ 2)) := by intro s exact legalIVComponent_conditional_complier_margins a n cStar τ sgn (actualStrength_bounds a n hn ha) (lower_admissible_of_small_amplitude n a cStar hn ha hc) hτ (by have : 256 ≤ n := hn; omega) s refine ⟨hmeans, ?_, ?_, mixtureCenter_firstStage a n hstrength, ?_⟩ · have h (x : ℝ) := (legalIVComponent_arm_contrasts a n cStar τ sgn x hstrength).1 simp_rw [firstStage, transportedForm, h] change (∫ x in covariateSpace, (1 + tiledPerturbation cStar n sgn x) * actualStrength a n) = actualStrength a n have hu := tiledPerturbation_integrable_and_integral_zero cStar n sgn (by have : 256 ≤ n := hn omega) haveI : IsFiniteMeasure (volume.restrict covariateSpace) := by change IsFiniteMeasure (volume.restrict (Icc (0 : ℝ) 1)) infer_instance simp_rw [add_mul] rw [integral_add (integrable_const _) (hu.1.mul_const _)] simp [integral_mul_const, covariateSpace] left simpa only [covariateSpace] using hu.2 · have hb := actualStrength_bounds a n hn ha have hAdm := lower_admissible_of_small_amplitude n a cStar hn ha hc have hn0 : 0 < n := by have : 256 ≤ n := hn; omega have hK : 0 < lowerCells n := by unfold lowerCells exact Nat.ceil_pos.mpr (by positivity) have hh : lowerHeight cStar n ^ 2 ≤ 1 / 8 := by have hheight0 : 0 ≤ lowerHeight cStar n := by unfold lowerHeight exact mul_nonneg hc.1.le (Real.rpow_nonneg (Nat.cast_nonneg _) _) nlinarith [hAdm.2.1] rw [legalIVComponent_targetCACE_eq_transportedOutcome a n cStar τ sgn hb hAdm hτ hn0 (hmeans false).1 (hmeans false).2, legalIVComponent_transportedOutcome_eq_separation a n cStar τ sgn hK hstrength hh] · exact mixtureCenter_targetCACE_zero a n (actualStrength_bounds a n hn ha)
CausalSmith.Stat.STAT_TransportCaceRoughnuisanceLength_Research.Helpers.LegalMixture.SourceOverlap 9 declarations Source-channel overlap identities

Source-channel overlap identities

theorem explicitCenterSourceLaw_univ

Given the supplied inputs, the stated result about explicit center source law univ holds.

Formal statement
a :
ℝ
ha :
0 < a ∧ a < 1
explicitSourceLaw a (fun _ => 0) (fun _ => 0) univ = 1
Proof (Lean source)
lemma explicitCenterSourceLaw_univ (a : ℝ) (ha : 0 < a ∧ a < 1) : explicitSourceLaw a (fun _ => 0) (fun _ => 0) univ = 1 := by rw [explicitSourceLaw_apply a (fun _ => 0) (fun _ => 0) measurable_const measurable_const univ MeasurableSet.univ] unfold encodedCellSetMass simp only [Set.mem_univ, ↓reduceIte] rw [show (∑ c : SourceCell, ofReal (sourceCellMass a 0 0 c)) = 1 by rw [← ENNReal.ofReal_sum_of_nonneg] · rw [show (∑ c : SourceCell, sourceCellMass a 0 0 c) = 1 by simpa [sourceCenterMass] using sourceCenterMass_sum a] simp · intro c hc simpa [sourceCenterMass] using (sourceCenterMass_pos a ha c).le] simp [covariateSpace]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.explicitCenterSourceLaw_univ · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/SourceOverlap.lean:12
def explicitCenterSourceLaw_isProbability

The explicit center source law is probability object is defined from the supplied inputs.

Definition (Lean source)
a :
ℝ
ha :
0 < a ∧ a < 1
explicitCenterSourceLaw_isProbability a ha :
IsProbabilityMeasure (explicitSourceLaw a (fun _ => 0) (fun _ => 0))
by apply isProbabilityMeasure_iff.mpr exact explicitCenterSourceLaw_univ a ha
CausalSmith.Stat.TransportCaceRoughnuisanceLength.explicitCenterSourceLaw_isProbability · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/SourceOverlap.lean:29
theorem sourceCellMass_sum

Given the supplied inputs, the stated result about source cell mass sum holds.

Formal statement
a τ u :
ℝ
∑ cell : SourceCell, sourceCellMass a u (τ * u) cell = 1
Proof (Lean source)
lemma sourceCellMass_sum (a τ u : ℝ) : ∑ cell : SourceCell, sourceCellMass a u (τ * u) cell = 1 := by simp_rw [sourceCellMass_affine] rw [Finset.sum_add_distrib, sourceCenterMass_sum] simp_rw [← Finset.mul_sum] rw [sourceDirection_sum] ring
CausalSmith.Stat.TransportCaceRoughnuisanceLength.sourceCellMass_sum · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/SourceOverlap.lean:37
theorem explicitSourceLaw_univ_of_nonneg

Given the supplied inputs, the stated result about explicit source law univ of nonneg holds.

Formal statement
a τ :
ℝ
u :
ℝ → ℝ
hu :
hq :
∀ x cell, 0 ≤ sourceCellMass a (u x) (τ * u x) cell
explicitSourceLaw a u (fun x => τ * u x) univ = 1
Proof (Lean source)
lemma explicitSourceLaw_univ_of_nonneg (a τ : ℝ) (u : ℝ → ℝ) (hu : Measurable u) (hq : ∀ x cell, 0 ≤ sourceCellMass a (u x) (τ * u x) cell) : explicitSourceLaw a u (fun x => τ * u x) univ = 1 := by rw [explicitSourceLaw_apply a u (fun x => τ * u x) hu (measurable_const.mul hu) univ MeasurableSet.univ] unfold encodedCellSetMass simp only [Set.mem_univ, ↓reduceIte] have hsum (x : ℝ) : ∑ cell : SourceCell, ofReal (sourceCellMass a (u x) (τ * u x) cell) = 1 := by rw [← ENNReal.ofReal_sum_of_nonneg] · rw [sourceCellMass_sum a τ] simp · intro cell hcell exact hq x cell simp_rw [hsum] simp [covariateSpace]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.explicitSourceLaw_univ_of_nonneg · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/SourceOverlap.lean:46
def explicitSourceLaw_isProbability_of_nonneg

The explicit source law is probability of nonneg object is defined from the supplied inputs.

Definition (Lean source)
a τ :
ℝ
u :
ℝ → ℝ
hu :
hq :
∀ x cell, 0 ≤ sourceCellMass a (u x) (τ * u x) cell
explicitSourceLaw_isProbability_of_nonneg a τ u hu hq :
IsProbabilityMeasure (explicitSourceLaw a u (fun x => τ * u x))
by apply isProbabilityMeasure_iff.mpr exact explicitSourceLaw_univ_of_nonneg a τ u hu hq
CausalSmith.Stat.TransportCaceRoughnuisanceLength.explicitSourceLaw_isProbability_of_nonneg · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/SourceOverlap.lean:66
theorem lowerSourceCellMass_nonneg

Given the supplied inputs, the stated result about lower source cell mass nonneg holds.

Formal statement
a :
ℝ
n :
ℕ
cStar τ :
ℝ
sgn :
hb :
0 < actualStrength a n ∧ actualStrength a n ≤ 1 / 4
hAdm :
LowerAdmissible n a cStar
hτ :
τ ∈ Icc (-1 : ℝ) 1
x cell :
0
≤ sourceCellMass (actualStrength a n) (tiledPerturbation cStar n sgn x) (coupledPerturbation cStar τ n sgn x) cell
Proof (Lean source)
lemma lowerSourceCellMass_nonneg (a : ℝ) (n : ℕ) (cStar τ : ℝ) (sgn : Fin (lowerCells n) → Bool) (hb : 0 < actualStrength a n ∧ actualStrength a n ≤ 1 / 4) (hAdm : LowerAdmissible n a cStar) (hτ : τ ∈ Icc (-1 : ℝ) 1) : ∀ x cell, 0 ≤ sourceCellMass (actualStrength a n) (tiledPerturbation cStar n sgn x) (coupledPerturbation cStar τ n sgn x) cell := by intro x cell apply sourceCellMass_nonneg_of_primitive · exact ne_of_gt hb.1 · intro heq have hu := tiledPerturbation_abs_le_lowerHeight cStar n sgn x hAdm.1.le have hu' : |tiledPerturbation cStar n sgn x| ≤ 3 / 16 := le_trans hu hAdm.2.1 have hs : |tiledPerturbation cStar n sgn x| = 1 / 2 := by nlinarith [sq_abs (tiledPerturbation cStar n sgn x), abs_nonneg (tiledPerturbation cStar n sgn x)] linarith · exact lowerMass_nonneg a n cStar τ sgn hb hAdm hτ x · intro z exact (lowerAssignmentWeight_mem_Icc a n cStar τ sgn hAdm x z).1
CausalSmith.Stat.TransportCaceRoughnuisanceLength.lowerSourceCellMass_nonneg · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/SourceOverlap.lean:74
theorem lowerSourceLikelihood_nonneg

Given the supplied inputs, the stated result about lower source likelihood nonneg holds.

Formal statement
a :
ℝ
n :
ℕ
cStar τ :
ℝ
sgn :
hb :
0 < actualStrength a n ∧ actualStrength a n ≤ 1 / 4
hAdm :
LowerAdmissible n a cStar
hτ :
τ ∈ Icc (-1 : ℝ) 1
o :
Proof (Lean source)
lemma lowerSourceLikelihood_nonneg (a : ℝ) (n : ℕ) (cStar τ : ℝ) (sgn : Fin (lowerCells n) → Bool) (hb : 0 < actualStrength a n ∧ actualStrength a n ≤ 1 / 4) (hAdm : LowerAdmissible n a cStar) (hτ : τ ∈ Icc (-1 : ℝ) 1) : ∀ o, 0 ≤ sourceObsLikelihood (actualStrength a n) τ (tiledPerturbation cStar n sgn) o := by apply sourceObsLikelihood_nonneg_of_cellMass · exact ⟨hb.1, lt_of_le_of_lt hb.2 (by norm_num)⟩ intro x cell simpa [coupledPerturbation] using lowerSourceCellMass_nonneg a n cStar τ sgn hb hAdm hτ x cell
CausalSmith.Stat.TransportCaceRoughnuisanceLength.lowerSourceLikelihood_nonneg · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/SourceOverlap.lean:97
theorem sourceLikelihood_pair_integrable

Given the supplied inputs, the stated result about source likelihood pair integrable holds.

Formal statement
a τ cStar :
ℝ
n :
ℕ
s t :
ha :
0 < a ∧ a < 1
Integrable (fun o => sourceObsLikelihood a τ (tiledPerturbation cStar n s) o * sourceObsLikelihood a τ (tiledPerturbation cStar n t) o) (explicitSourceLaw a (fun _ => 0) (fun _ => 0))
Proof (Lean source)
lemma sourceLikelihood_pair_integrable (a τ cStar : ℝ) (n : ℕ) (s t : Fin (lowerCells n) → Bool) (ha : 0 < a ∧ a < 1) : Integrable (fun o => sourceObsLikelihood a τ (tiledPerturbation cStar n s) o * sourceObsLikelihood a τ (tiledPerturbation cStar n t) o) (explicitSourceLaw a (fun _ => 0) (fun _ => 0)) := by letI : IsProbabilityMeasure (explicitSourceLaw a (fun _ => 0) (fun _ => 0)) := explicitCenterSourceLaw_isProbability a ha let B := 1 + |lowerHeight cStar n| * ∑ cell : SourceCell, |sourceDirection a τ cell / sourceCenterMass a cell| have hcoeff (cell : SourceCell) : |sourceDirection a τ cell / sourceCenterMass a cell| ≤ ∑ d : SourceCell, |sourceDirection a τ d / sourceCenterMass a d| := by exact Finset.single_le_sum (s := univ) (f := fun d : SourceCell => |sourceDirection a τ d / sourceCenterMass a d|) (fun d _ => abs_nonneg _) (Finset.mem_univ cell) have hbound (r : Fin (lowerCells n) → Bool) (o : SourceObs) : |sourceObsLikelihood a τ (tiledPerturbation cStar n r) o| ≤ B := by rw [sourceObsLikelihood_eq_cell] unfold sourceLikelihood B rw [show tiledPerturbation cStar n r o.1 * sourceDirection a τ (o.2.1, o.2.2.1, o.2.2.2 = 1) / sourceCenterMass a (o.2.1, o.2.2.1, o.2.2.2 = 1) = tiledPerturbation cStar n r o.1 * (sourceDirection a τ (o.2.1, o.2.2.1, o.2.2.2 = 1) / sourceCenterMass a (o.2.1, o.2.2.1, o.2.2.2 = 1)) by ring] calc |1 + tiledPerturbation cStar n r o.1 * (sourceDirection a τ (o.2.1, o.2.2.1, o.2.2.2 = 1) / sourceCenterMass a (o.2.1, o.2.2.1, o.2.2.2 = 1))| ≤ 1 + |tiledPerturbation cStar n r o.1| * |sourceDirection a τ (o.2.1, o.2.2.1, o.2.2.2 = 1) / sourceCenterMass a (o.2.1, o.2.2.1, o.2.2.2 = 1)| := by calc _ ≤ |(1 : ℝ)| + |tiledPerturbation cStar n r o.1 * (sourceDirection a τ (o.2.1, o.2.2.1, o.2.2.2 = 1) / sourceCenterMass a (o.2.1, o.2.2.1, o.2.2.2 = 1))| := abs_add_le _ _ _ = _ := by rw [abs_one, abs_mul] _ ≤ 1 + |lowerHeight cStar n| * |sourceDirection a τ (o.2.1, o.2.2.1, o.2.2.2 = 1) / sourceCenterMass a (o.2.1, o.2.2.1, o.2.2.2 = 1)| := by simpa using add_le_add_right (mul_le_mul_of_nonneg_right (tiledPerturbation_abs_le_abs_lowerHeight cStar n r o.1) (abs_nonneg _)) 1 _ ≤ _ := by simpa using add_le_add_right (mul_le_mul_of_nonneg_left (hcoeff (o.2.1, o.2.2.1, o.2.2.2 = 1)) (abs_nonneg (lowerHeight cStar n))) 1 have hm (r : Fin (lowerCells n) → Bool) := sourceObsLikelihood_measurable a τ (tiledPerturbation cStar n r) (tiledPerturbation_measurable cStar n r) apply Integrable.of_bound ((hm s).mul (hm t)).aestronglyMeasurable (B ^ 2) filter_upwards [] with o change |sourceObsLikelihood a τ (tiledPerturbation cStar n s) o * sourceObsLikelihood a τ (tiledPerturbation cStar n t) o| ≤ _ rw [abs_mul] have hB0 : 0 ≤ B := by unfold B positivity nlinarith [hbound s o, hbound t o, abs_nonneg (sourceObsLikelihood a τ (tiledPerturbation cStar n s) o), abs_nonneg (sourceObsLikelihood a τ (tiledPerturbation cStar n t) o), sq_nonneg B]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.sourceLikelihood_pair_integrable · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/SourceOverlap.lean:110
theorem sourceLikelihood_pair_integral

Given the supplied inputs, the stated result about source likelihood pair integral holds.

Formal statement
a τ cStar :
ℝ
n :
ℕ
s t :
Fin (lowerCells n) → Bool
ha :
0 < a ∧ a < 1
hLs0 :
∀ o, 0 ≤ sourceObsLikelihood a τ (tiledPerturbation cStar n s) o
hLt0 :
∀ o, 0 ≤ sourceObsLikelihood a τ (tiledPerturbation cStar n t) o
hn :
0 < n
(∫ o, sourceObsLikelihood a τ (tiledPerturbation cStar n s) o * sourceObsLikelihood a τ (tiledPerturbation cStar n t) o ∂explicitSourceLaw a (fun _ => 0) (fun _ => 0))
= 1
+ (sourceOverlapCoefficient a τ * lowerHeight cStar n ^ 2 / 2) * innerSign s t / (lowerCells n : ℝ)
Proof (Lean source)
lemma sourceLikelihood_pair_integral (a τ cStar : ℝ) (n : ℕ) (s t : Fin (lowerCells n) → Bool) (ha : 0 < a ∧ a < 1) (hLs0 : ∀ o, 0 ≤ sourceObsLikelihood a τ (tiledPerturbation cStar n s) o) (hLt0 : ∀ o, 0 ≤ sourceObsLikelihood a τ (tiledPerturbation cStar n t) o) (hn : 0 < n) : (∫ o, sourceObsLikelihood a τ (tiledPerturbation cStar n s) o * sourceObsLikelihood a τ (tiledPerturbation cStar n t) o ∂explicitSourceLaw a (fun _ => 0) (fun _ => 0)) = 1 + (sourceOverlapCoefficient a τ * lowerHeight cStar n ^ 2 / 2) * innerSign s t / (lowerCells n : ℝ) := by let μ := explicitSourceLaw a (fun _ => 0) (fun _ => 0) let fs := sourceObsLikelihood a τ (tiledPerturbation cStar n s) let ft := sourceObsLikelihood a τ (tiledPerturbation cStar n t) have hfs : Measurable fs := sourceObsLikelihood_measurable a τ _ (tiledPerturbation_measurable cStar n s) have hft : Measurable ft := sourceObsLikelihood_measurable a τ _ (tiledPerturbation_measurable cStar n t) have hnonneg : ∀ o, 0 ≤ fs o * ft o := fun o => mul_nonneg (hLs0 o) (hLt0 o) have hk : Measurable (fun x : ℝ => ∑ c : SourceCell, ofReal (sourceCenterMass a c) • Measure.dirac (sourceCellObservation x c)) := by refine Measure.measurable_of_measurable_coe _ fun A hA => ?_ simp only [Measure.finsetSum_apply] apply Finset.measurable_fun_sum intro cell hcell simp only [Measure.smul_apply, smul_eq_mul, Measure.dirac_apply' _ hA] exact measurable_const.mul (measurable_one.indicator (hA.preimage (sourceCellObservation_measurable cell))) have hinnerReal (x : ℝ) : ∑ cell : SourceCell, sourceCenterMass a cell * (fs (sourceCellObservation x cell) * ft (sourceCellObservation x cell)) = 1 + tiledPerturbation cStar n s x * tiledPerturbation cStar n t x * sourceOverlapCoefficient a τ := by change ∑ cell : SourceCell, sourceCenterMass a cell * (sourceObsLikelihood a τ (tiledPerturbation cStar n s) (sourceCellObservation x cell) * sourceObsLikelihood a τ (tiledPerturbation cStar n t) (sourceCellObservation x cell)) = _ simp_rw [sourceObsLikelihood_on_cell] exact sourceLikelihood_pair_sum a τ _ _ ha have hinner (x : ℝ) : ∑ cell : SourceCell, ofReal (sourceCenterMass a cell) * ofReal (fs (sourceCellObservation x cell) * ft (sourceCellObservation x cell)) = ofReal (1 + tiledPerturbation cStar n s x * tiledPerturbation cStar n t x * sourceOverlapCoefficient a τ) := by calc _ = ∑ cell : SourceCell, ofReal (sourceCenterMass a cell * (fs (sourceCellObservation x cell) * ft (sourceCellObservation x cell))) := by apply Finset.sum_congr rfl intro cell hcell rw [ENNReal.ofReal_mul (sourceCenterMass_pos a ha cell).le] _ = ofReal (∑ cell : SourceCell, sourceCenterMass a cell * (fs (sourceCellObservation x cell) * ft (sourceCellObservation x cell))) := by rw [ENNReal.ofReal_sum_of_nonneg] intro cell hcell exact mul_nonneg (sourceCenterMass_pos a ha cell).le (mul_nonneg (hLs0 (sourceCellObservation x cell)) (hLt0 (sourceCellObservation x cell))) _ = _ := by rw [hinnerReal] have hreal_nonneg (x : ℝ) : 0 ≤ 1 + tiledPerturbation cStar n s x * tiledPerturbation cStar n t x * sourceOverlapCoefficient a τ := by rw [← hinnerReal x] exact Finset.sum_nonneg fun cell hcell => mul_nonneg (sourceCenterMass_pos a ha cell).le (mul_nonneg (hLs0 (sourceCellObservation x cell)) (hLt0 (sourceCellObservation x cell))) letI : IsFiniteMeasure (volume.restrict covariateSpace) := by change IsFiniteMeasure (volume.restrict (Icc (0 : ℝ) 1)) infer_instance have hreal_int : Integrable (fun x => 1 + tiledPerturbation cStar n s x * tiledPerturbation cStar n t x * sourceOverlapCoefficient a τ) (volume.restrict covariateSpace) := (integrable_const 1).add ((tiledPerturbation_product_integrable cStar n s t).mul_const _) rw [integral_eq_lintegral_of_nonneg_ae (Filter.Eventually.of_forall hnonneg) ((hfs.mul hft).aestronglyMeasurable)] unfold explicitSourceLaw change (∫⁻ o : SourceObs, ofReal (fs o * ft o) ∂ (volume.restrict covariateSpace).bind fun x => ∑ cell : SourceCell, ofReal (sourceCenterMass a cell) • Measure.dirac (sourceCellObservation x cell)).toReal = _ have hbind := Measure.lintegral_bind (m := volume.restrict covariateSpace) hk.aemeasurable ((hfs.mul hft).ennreal_ofReal.aemeasurable) have hbind' : (∫⁻ o : SourceObs, ofReal (fs o * ft o) ∂ (volume.restrict covariateSpace).bind fun x => ∑ cell : SourceCell, ofReal (sourceCenterMass a cell) • Measure.dirac (sourceCellObservation x cell)) = ∫⁻ x in covariateSpace, ∫⁻ o : SourceObs, ofReal (fs o * ft o) ∂ ∑ cell : SourceCell, ofReal (sourceCenterMass a cell) • Measure.dirac (sourceCellObservation x cell) := by simpa only [Pi.mul_apply] using hbind rw [hbind'] have hdirac (x : ℝ) (cell : SourceCell) : (∫⁻ o : SourceObs, ofReal (fs o * ft o) ∂ Measure.dirac (sourceCellObservation x cell)) = ofReal (fs (sourceCellObservation x cell) * ft (sourceCellObservation x cell)) := by exact lintegral_dirac' _ ((hfs.mul hft).ennreal_ofReal) simp_rw [lintegral_finsetSum_measure] simp_rw [lintegral_smul_measure] simp_rw [hdirac] simp_rw [smul_eq_mul] change (∫⁻ x in covariateSpace, ∑ cell : SourceCell, ofReal (sourceCenterMass a cell) * ofReal (fs (sourceCellObservation x cell) * ft (sourceCellObservation x cell))).toReal = _ simp_rw [hinner] rw [← ofReal_integral_eq_lintegral_ofReal hreal_int (Filter.Eventually.of_forall hreal_nonneg)] rw [ENNReal.toReal_ofReal (integral_nonneg hreal_nonneg)] rw [integral_add (integrable_const 1) ((tiledPerturbation_product_integrable cStar n s t).mul_const _), integral_mul_const, tiledPerturbation_pair_integral cStar n s t hn] simp [covariateSpace] ring
CausalSmith.Stat.TransportCaceRoughnuisanceLength.sourceLikelihood_pair_integral · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/SourceOverlap.lean:180
CausalSmith.Stat.STAT_TransportCaceRoughnuisanceLength_Research.Helpers.LegalMixture.TargetLaws 8 declarations Target covariate and conditioning identities

Target covariate and conditioning identities

theorem primitiveKernel_measurable_of

Given the supplied inputs, the stated result about primitive kernel measurable of holds.

Formal statement
s :
mass :
ℝ → Bool → Bool → Bool → Bool → ℝ
hm :
∀ d0 d1 y0 y1, Measurable fun x => mass x d0 d1 y0 y1
Measurable fun x => primitiveKernel s x mass
Proof (Lean source)
lemma primitiveKernel_measurable_of (s : Bool) (mass : ℝ → Bool → Bool → Bool → Bool → ℝ) (hm : ∀ d0 d1 y0 y1, Measurable fun x => mass x d0 d1 y0 y1) : Measurable fun x => primitiveKernel s x mass := by classical refine Measure.measurable_of_measurable_coe _ fun A hA => ?_ simp only [primitiveKernel, Measure.finsetSum_apply] apply Finset.measurable_fun_sum intro d0 hd0 apply Finset.measurable_fun_sum intro d1 hd1 apply Finset.measurable_fun_sum intro y0 hy0 apply Finset.measurable_fun_sum intro y1 hy1 simp only [Measure.smul_apply, smul_eq_mul, Measure.dirac_apply' _ hA] exact (hm d0 d1 y0 y1).ennreal_ofReal.mul (measurable_one.indicator (hA.preimage (by fun_prop)))
CausalSmith.Stat.TransportCaceRoughnuisanceLength.primitiveKernel_measurable_of · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/TargetLaws.lean:12
theorem primitiveKernel_univ

Given the supplied inputs, the stated result about primitive kernel univ holds.

Formal statement
s :
x :
ℝ
mass :
ℝ → Bool → Bool → Bool → Bool → ℝ
hm0 :
∀ d0 d1 y0 y1, 0 ≤ mass x d0 d1 y0 y1
hsum :
∑ d0 : Bool, ∑ d1 : Bool, ∑ y0 : Bool, ∑ y1 : Bool, mass x d0 d1 y0 y1 = 1
primitiveKernel s x mass univ = 1
Proof (Lean source)
lemma primitiveKernel_univ (s : Bool) (x : ℝ) (mass : ℝ → Bool → Bool → Bool → Bool → ℝ) (hm0 : ∀ d0 d1 y0 y1, 0 ≤ mass x d0 d1 y0 y1) (hsum : ∑ d0 : Bool, ∑ d1 : Bool, ∑ y0 : Bool, ∑ y1 : Bool, mass x d0 d1 y0 y1 = 1) : primitiveKernel s x mass univ = 1 := by simp only [primitiveKernel, Measure.finsetSum_apply, Measure.smul_apply, smul_eq_mul, Measure.dirac_apply' _ MeasurableSet.univ, Set.indicator_of_mem (Set.mem_univ _), Pi.one_apply, mul_one] simp_rw [← ENNReal.ofReal_sum_of_nonneg (fun y1 _ => hm0 _ _ _ y1)] simp_rw [← ENNReal.ofReal_sum_of_nonneg (fun y0 _ => Finset.sum_nonneg fun y1 _ => hm0 _ _ y0 y1)] simp_rw [← ENNReal.ofReal_sum_of_nonneg (fun d1 _ => Finset.sum_nonneg fun y0 _ => Finset.sum_nonneg fun y1 _ => hm0 _ d1 y0 y1)] rw [← ENNReal.ofReal_sum_of_nonneg (fun d0 _ => Finset.sum_nonneg fun d1 _ => Finset.sum_nonneg fun y0 _ => Finset.sum_nonneg fun y1 _ => hm0 d0 d1 y0 y1)] rw [hsum] simp
CausalSmith.Stat.TransportCaceRoughnuisanceLength.primitiveKernel_univ · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/TargetLaws.lean:32
theorem map_covariate_primitivePopulation

Given the supplied inputs, the stated result about map covariate primitive population holds.

Formal statement
s :
density :
ℝ → ℝ
mass :
ℝ → Bool → Bool → Bool → Bool → ℝ
hdensity :
Measurable density
hm :
∀ d0 d1 y0 y1, Measurable fun x => mass x d0 d1 y0 y1
hm0 :
∀ x d0 d1 y0 y1, 0 ≤ mass x d0 d1 y0 y1
hsum :
∀ x, ∑ d0 : Bool, ∑ d1 : Bool, ∑ y0 : Bool, ∑ y1 : Bool, mass x d0 d1 y0 y1 = 1
Measure.map covariate (primitivePopulation s density mass)
= (volume.restrict covariateSpace).withDensity (fun x => ofReal (density x))
Proof (Lean source)
lemma map_covariate_primitivePopulation (s : Bool) (density : ℝ → ℝ) (mass : ℝ → Bool → Bool → Bool → Bool → ℝ) (hdensity : Measurable density) (hm : ∀ d0 d1 y0 y1, Measurable fun x => mass x d0 d1 y0 y1) (hm0 : ∀ x d0 d1 y0 y1, 0 ≤ mass x d0 d1 y0 y1) (hsum : ∀ x, ∑ d0 : Bool, ∑ d1 : Bool, ∑ y0 : Bool, ∑ y1 : Bool, mass x d0 d1 y0 y1 = 1) : Measure.map covariate (primitivePopulation s density mass) = (volume.restrict covariateSpace).withDensity (fun x => ofReal (density x)) := by have hcov : Measurable covariate := by unfold covariate; fun_prop have hk := primitiveKernel_measurable_of s mass hm ext A hA rw [Measure.map_apply hcov hA] unfold primitivePopulation rw [Measure.bind_apply (hA.preimage hcov) hk.aemeasurable] rw [← lintegral_indicator_one hA] apply lintegral_congr intro x classical by_cases hx : x ∈ A · simpa [primitiveKernel, covariate, indicator, hx] using primitiveKernel_univ s x mass (hm0 x) (hsum x) · simp [primitiveKernel, covariate, indicator, hx]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.map_covariate_primitivePopulation · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/TargetLaws.lean:52
theorem primitivePopulation_population_event

Given the supplied inputs, the stated result about primitive population population event holds.

Formal statement
s t :
density :
ℝ → ℝ
mass :
ℝ → Bool → Bool → Bool → Bool → ℝ
hm :
∀ d0 d1 y0 y1, Measurable fun x => mass x d0 d1 y0 y1
primitivePopulation s density mass {o | population o = t}
= if s = t then (primitivePopulation s density mass) univ else 0
Proof (Lean source)
lemma primitivePopulation_population_event (s t : Bool) (density : ℝ → ℝ) (mass : ℝ → Bool → Bool → Bool → Bool → ℝ) (hm : ∀ d0 d1 y0 y1, Measurable fun x => mass x d0 d1 y0 y1) : primitivePopulation s density mass {o | population o = t} = if s = t then (primitivePopulation s density mass) univ else 0 := by have hk := primitiveKernel_measurable_of s mass hm have hpop : MeasurableSet {o : FullData | population o = t} := by unfold population measurability unfold primitivePopulation rw [Measure.bind_apply hpop hk.aemeasurable, Measure.bind_apply MeasurableSet.univ hk.aemeasurable] split_ifs with hst · subst t apply lintegral_congr intro x simp [primitiveKernel, population] · apply lintegral_eq_zero_of_ae_eq_zero apply Filter.Eventually.of_forall intro x simp [primitiveKernel, population, hst]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.primitivePopulation_population_event · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/TargetLaws.lean:78
theorem cond_half_supported_mixture

Given the supplied inputs, the stated result about cond half supported mixture holds.

Formal statement
source target :
hsource :
source {o | population o = false} = 0
htarget :
target {o | population o = false} = 1
htarget_univ :
target univ = 1
cond ((1 / 2 : ℝ≥0∞) • source + (1 / 2 : ℝ≥0∞) • target) {o | population o = false}
= target
Proof (Lean source)
lemma cond_half_supported_mixture (source target : Measure FullData) (hsource : source {o | population o = false} = 0) (htarget : target {o | population o = false} = 1) (htarget_univ : target univ = 1) : cond ((1 / 2 : ℝ≥0∞) • source + (1 / 2 : ℝ≥0∞) • target) {o | population o = false} = target := by let S : Set FullData := {o | population o = false} have hS : MeasurableSet S := by unfold S population measurability have hfullS : ((1 / 2 : ℝ≥0∞) • source + (1 / 2 : ℝ≥0∞) • target) S = 1 / 2 := by simp [Measure.add_apply, Measure.smul_apply, hsource, htarget, S] have hrs : source.restrict S = 0 := Measure.restrict_eq_zero.mpr hsource have hrt : target.restrict S = target := by apply Measure.restrict_eq_self_of_ae_mem rw [ae_iff] change target (Sᶜ) = 0 rw [measure_compl hS (by rw [htarget]; simp)] rw [htarget_univ, show target S = 1 by simpa [S] using htarget] simp unfold cond rw [hfullS] change (1 / 2 : ℝ≥0∞)⁻¹ • (((1 / 2 : ℝ≥0∞) • source + (1 / 2 : ℝ≥0∞) • target).restrict S) = target rw [Measure.restrict_add, Measure.restrict_smul, Measure.restrict_smul, hrs, hrt] simp only [smul_zero, zero_add] rw [← mul_smul] rw [ENNReal.inv_mul_cancel (by norm_num) (by norm_num)] exact one_smul _ _
CausalSmith.Stat.TransportCaceRoughnuisanceLength.cond_half_supported_mixture · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/TargetLaws.lean:101
theorem targetDensity_univ

Given the supplied inputs, the stated result about target density univ holds.

Formal statement
cStar :
ℝ
n :
ℕ
sgn :
hn :
0 < n
hu0 :
∀ x, 0 ≤ 1 + tiledPerturbation cStar n sgn x
((volume.restrict covariateSpace).withDensity (fun x => ofReal (1 + tiledPerturbation cStar n sgn x))) univ
= 1
Proof (Lean source)
lemma targetDensity_univ (cStar : ℝ) (n : ℕ) (sgn : Fin (lowerCells n) → Bool) (hn : 0 < n) (hu0 : ∀ x, 0 ≤ 1 + tiledPerturbation cStar n sgn x) : ((volume.restrict covariateSpace).withDensity (fun x => ofReal (1 + tiledPerturbation cStar n sgn x))) univ = 1 := by rw [withDensity_apply _ MeasurableSet.univ] simp only [Measure.restrict_univ] have hu := tiledPerturbation_integrable_and_integral_zero cStar n sgn hn letI : IsFiniteMeasure (volume.restrict covariateSpace) := by change IsFiniteMeasure (volume.restrict (Icc (0 : ℝ) 1)) infer_instance have hi : Integrable (fun x => 1 + tiledPerturbation cStar n sgn x) (volume.restrict covariateSpace) := by exact (integrable_const 1).add hu.1 rw [← ofReal_integral_eq_lintegral_ofReal hi (Filter.Eventually.of_forall hu0)] rw [integral_add (integrable_const 1) hu.1, hu.2] simp [covariateSpace]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.targetDensity_univ · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/TargetLaws.lean:134
theorem legalTargetLaw_eq_density

Given the supplied inputs, the stated result about legal target law eq density holds.

Formal statement
a :
ℝ
n :
ℕ
cStar τ :
ℝ
sgn :
hb :
0 < actualStrength a n ∧ actualStrength a n ≤ 1 / 4
hAdm :
LowerAdmissible n a cStar
hτ :
τ ∈ Icc (-1 : ℝ) 1
hn :
0 < n
(cond ((1 / 2 : ℝ≥0∞) • primitivePopulation true (fun _ => 1) (lowerMass a n cStar τ sgn) + (1 / 2 : ℝ≥0∞) • primitivePopulation false (fun x => 1 + tiledPerturbation cStar n sgn x) (lowerMass a n cStar τ sgn)) {o | population o = false}).map covariate
= (volume.restrict covariateSpace).withDensity (fun x => ofReal (1 + tiledPerturbation cStar n sgn x))
Proof (Lean source)
lemma legalTargetLaw_eq_density (a : ℝ) (n : ℕ) (cStar τ : ℝ) (sgn : Fin (lowerCells n) → Bool) (hb : 0 < actualStrength a n ∧ actualStrength a n ≤ 1 / 4) (hAdm : LowerAdmissible n a cStar) (hτ : τ ∈ Icc (-1 : ℝ) 1) (hn : 0 < n) : (cond ((1 / 2 : ℝ≥0∞) • primitivePopulation true (fun _ => 1) (lowerMass a n cStar τ sgn) + (1 / 2 : ℝ≥0∞) • primitivePopulation false (fun x => 1 + tiledPerturbation cStar n sgn x) (lowerMass a n cStar τ sgn)) {o | population o = false}).map covariate = (volume.restrict covariateSpace).withDensity (fun x => ofReal (1 + tiledPerturbation cStar n sgn x)) := by let source := primitivePopulation true (fun _ => 1) (lowerMass a n cStar τ sgn) let target := primitivePopulation false (fun x => 1 + tiledPerturbation cStar n sgn x) (lowerMass a n cStar τ sgn) have hm0 := lowerMass_nonneg a n cStar τ sgn hb hAdm hτ have hu_sq (x : ℝ) : tiledPerturbation cStar n sgn x ^ 2 ≠ 1 / 4 := by have hu := tiledPerturbation_abs_le_lowerHeight cStar n sgn x hAdm.1.le have hu' : |tiledPerturbation cStar n sgn x| ≤ 3 / 16 := le_trans hu hAdm.2.1 intro heq have : |tiledPerturbation cStar n sgn x| = 1 / 2 := by nlinarith [sq_abs (tiledPerturbation cStar n sgn x), abs_nonneg (tiledPerturbation cStar n sgn x)] linarith have hsum (x : ℝ) := primitiveMass_sum (actualStrength a n) (tiledPerturbation cStar n sgn x) (coupledPerturbation cStar τ n sgn x) (ne_of_gt hb.1) (hu_sq x) have hmap : Measure.map covariate target = (volume.restrict covariateSpace).withDensity (fun x => ofReal (1 + tiledPerturbation cStar n sgn x)) := by apply map_covariate_primitivePopulation · exact measurable_const.add (tiledPerturbation_measurable cStar n sgn) · exact lowerMass_measurable a n cStar τ sgn · exact hm0 · exact hsum have hu0 (x : ℝ) : 0 ≤ 1 + tiledPerturbation cStar n sgn x := by have hu := tiledPerturbation_abs_le_lowerHeight cStar n sgn x hAdm.1.le have hu' : |tiledPerturbation cStar n sgn x| ≤ 3 / 16 := le_trans hu hAdm.2.1 linarith [neg_abs_le (tiledPerturbation cStar n sgn x)] have htuniv : target univ = 1 := by have hmapped := congrArg (fun μ : Measure ℝ => μ univ) hmap rw [Measure.map_apply (by unfold covariate; fun_prop) MeasurableSet.univ] at hmapped simpa [target] using hmapped.trans (targetDensity_univ cStar n sgn hn hu0) have hs0 : source {o | population o = false} = 0 := by simpa [source] using primitivePopulation_population_event true false (fun _ => 1) (lowerMass a n cStar τ sgn) (lowerMass_measurable a n cStar τ sgn) have ht1 : target {o | population o = false} = 1 := by rw [primitivePopulation_population_event false false (fun x => 1 + tiledPerturbation cStar n sgn x) (lowerMass a n cStar τ sgn) (lowerMass_measurable a n cStar τ sgn)] simpa [target] using htuniv rw [show cond ((1 / 2 : ℝ≥0∞) • source + (1 / 2 : ℝ≥0∞) • target) {o | population o = false} = target from cond_half_supported_mixture source target hs0 ht1 htuniv] exact hmap
CausalSmith.Stat.TransportCaceRoughnuisanceLength.legalTargetLaw_eq_density · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/TargetLaws.lean:154
theorem centerTargetLaw_eq_volume

Given the supplied inputs, the stated result about center target law eq volume holds.

Formal statement
a :
ℝ
n :
ℕ
hb :
0 < actualStrength a n ∧ actualStrength a n ≤ 1 / 4
(cond ((1 / 2 : ℝ≥0∞) • primitivePopulation true (fun _ => 1) (fun _ => primitiveMass (actualStrength a n) 0 0) + (1 / 2 : ℝ≥0∞) • primitivePopulation false (fun _ => 1) (fun _ => primitiveMass (actualStrength a n) 0 0)) {o | population o = false}).map covariate
= volume.restrict covariateSpace
Proof (Lean source)
lemma centerTargetLaw_eq_volume (a : ℝ) (n : ℕ) (hb : 0 < actualStrength a n ∧ actualStrength a n ≤ 1 / 4) : (cond ((1 / 2 : ℝ≥0∞) • primitivePopulation true (fun _ => 1) (fun _ => primitiveMass (actualStrength a n) 0 0) + (1 / 2 : ℝ≥0∞) • primitivePopulation false (fun _ => 1) (fun _ => primitiveMass (actualStrength a n) 0 0)) {o | population o = false}).map covariate = volume.restrict covariateSpace := by let mass : ℝ → Bool → Bool → Bool → Bool → ℝ := fun _ => primitiveMass (actualStrength a n) 0 0 let source := primitivePopulation true (fun _ => 1) mass let target := primitivePopulation false (fun _ => 1) mass have hm0 : ∀ x d0 d1 y0 y1, 0 ≤ mass x d0 d1 y0 y1 := by intro x d0 d1 y0 y1 exact primitiveMass_nonneg_of_bounds (actualStrength a n) 0 0 hb (by norm_num) (by norm_num) (by nlinarith [hb.1]) d0 d1 y0 y1 have hsum : ∀ x, ∑ d0 : Bool, ∑ d1 : Bool, ∑ y0 : Bool, ∑ y1 : Bool, mass x d0 d1 y0 y1 = 1 := by intro x exact primitiveMass_sum (actualStrength a n) 0 0 (ne_of_gt hb.1) (by norm_num) have hmap : Measure.map covariate target = volume.restrict covariateSpace := by have h := map_covariate_primitivePopulation false (fun _ => 1) mass measurable_const (fun _ _ _ _ => measurable_const) hm0 hsum simpa [target] using h have htuniv : target univ = 1 := by have hmapped := congrArg (fun μ : Measure ℝ => μ univ) hmap rw [Measure.map_apply (by unfold covariate; fun_prop) MeasurableSet.univ] at hmapped simpa [covariateSpace] using hmapped have hs0 : source {o | population o = false} = 0 := by simpa [source] using primitivePopulation_population_event true false (fun _ => 1) mass (fun _ _ _ _ => measurable_const) have ht1 : target {o | population o = false} = 1 := by rw [primitivePopulation_population_event false false (fun _ => 1) mass (fun _ _ _ _ => measurable_const)] simpa [target] using htuniv rw [show cond ((1 / 2 : ℝ≥0∞) • source + (1 / 2 : ℝ≥0∞) • target) {o | population o = false} = target from cond_half_supported_mixture source target hs0 ht1 htuniv] exact hmap
CausalSmith.Stat.TransportCaceRoughnuisanceLength.centerTargetLaw_eq_volume · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/TargetLaws.lean:218
CausalSmith.Stat.STAT_TransportCaceRoughnuisanceLength_Research.Helpers.LegalMixture.TiledHolder 12 declarations The sinusoidal tile bump vanishes at every cell boundary.

Hölder control of the tiled lower-bound perturbation

The sinusoidal tile bump vanishes at every cell boundary. This makes the signed tiling globally Lipschitz despite arbitrary sign changes between cells; combining that estimate with its uniform height bound gives the required one-eighth Hölder radius.

theorem exists_tiled_cell_of_mem

Every point of the covariate interval belongs to one tiled cell. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
K :
ℕ
hK :
0 < K
x :
ℝ
hx :
∃ i : Fin K, x ∈ cell K i
Proof (Lean source)
lemma exists_tiled_cell_of_mem {K : ℕ} (hK : 0 < K) (x : ℝ) (hx : x ∈ covariateSpace) : ∃ i : Fin K, x ∈ cell K i := by have hKr : (0 : ℝ) < K := Nat.cast_pos.mpr hK change 0 ≤ x ∧ x ≤ 1 at hx by_cases hx1 : x = 1 · refine ⟨⟨K - 1, by omega⟩, ?_⟩ have hlast : K - 1 + 1 = K := by omega simp only [cell, hlast, if_true, Set.mem_Icc, hx1] exact ⟨(div_le_one hKr).2 (by exact_mod_cast (show K - 1 ≤ K by omega)), le_rfl⟩ · have hxlt : x < 1 := lt_of_le_of_ne hx.2 hx1 have hfloor : ⌊x * K⌋₊ < K := by apply (Nat.floor_lt (mul_nonneg hx.1 hKr.le)).2 nlinarith refine ⟨⟨⌊x * K⌋₊, hfloor⟩, ?_⟩ have hlo : (⌊x * K⌋₊ : ℝ) / K ≤ x := by apply (div_le_iff₀ hKr).2 exact Nat.floor_le (mul_nonneg hx.1 hKr.le) have hhi : x < ((⌊x * K⌋₊ : ℝ) + 1) / K := by apply (lt_div_iff₀ hKr).2 exact Nat.lt_floor_add_one (x * K) unfold cell split_ifs · exact ⟨hlo, hx.2⟩ · exact ⟨hlo, hhi⟩
CausalSmith.Stat.TransportCaceRoughnuisanceLength.exists_tiled_cell_of_mem · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/TiledHolder.lean:17
theorem tiledPerturbation_eq_of_mem_cell

On a cell, the tiled perturbation is its unique active summand. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
cStar :
ℝ
n :
ℕ
sgn :
Fin (lowerCells n) → Bool
i :
Fin (lowerCells n)
x :
ℝ
hx :
x ∈ cell (lowerCells n) i
hK :
0 < lowerCells n
tiledPerturbation cStar n sgn x
= lowerHeight cStar n * sign (sgn i) * bump ((lowerCells n : ℝ) * x - i.val)
Proof (Lean source)
lemma tiledPerturbation_eq_of_mem_cell (cStar : ℝ) (n : ℕ) (sgn : Fin (lowerCells n) → Bool) (i : Fin (lowerCells n)) (x : ℝ) (hx : x ∈ cell (lowerCells n) i) (hK : 0 < lowerCells n) : tiledPerturbation cStar n sgn x = lowerHeight cStar n * sign (sgn i) * bump ((lowerCells n : ℝ) * x - i.val) := by classical unfold tiledPerturbation rw [Finset.sum_eq_single i] · simp [hx] · intro j _ hji have hnot : x ∉ cell (lowerCells n) j := by intro hxj exact hji (cell_mem_unique _ hK j i x hxj hx) simp [hnot] · simp
CausalSmith.Stat.TransportCaceRoughnuisanceLength.tiledPerturbation_eq_of_mem_cell · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/TiledHolder.lean:43
theorem cell_closed_bounds

Membership in a tile supplies its closed endpoint bounds. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
K :
ℕ
hK :
0 < K
i :
Fin K
x :
ℝ
hx :
x ∈ cell K i
conclusion 1
(i.val : ℝ) / K ≤ x
conclusion 2
x ≤ ((i.val : ℝ) + 1) / K
Proof (Lean source)
lemma cell_closed_bounds {K : ℕ} (hK : 0 < K) (i : Fin K) (x : ℝ) (hx : x ∈ cell K i) : (i.val : ℝ) / K ≤ x ∧ x ≤ ((i.val : ℝ) + 1) / K := by unfold cell at hx split_ifs at hx with hlast · refine ⟨hx.1, ?_⟩ have hi : (i.val : ℝ) + 1 = K := by exact_mod_cast hlast rw [hi] rw [div_self (by exact_mod_cast Nat.ne_of_gt hK)] exact hx.2 · exact ⟨hx.1, hx.2.le⟩
CausalSmith.Stat.TransportCaceRoughnuisanceLength.cell_closed_bounds · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/TiledHolder.lean:61
theorem bump_affine_abs_le_endpoint

The active sinusoid is controlled by distance to either endpoint of its tile. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
K :
ℕ
hK :
0 < K
i :
Fin K
x b :
ℝ
hb :
b = (i.val : ℝ) / K ∨ b = ((i.val : ℝ) + 1) / K
|bump ((K : ℝ) * x - i.val)| ≤ 2 * pi * K * |x - b|
Proof (Lean source)
lemma bump_affine_abs_le_endpoint {K : ℕ} (hK : 0 < K) (i : Fin K) (x b : ℝ) (hb : b = (i.val : ℝ) / K ∨ b = ((i.val : ℝ) + 1) / K) : |bump ((K : ℝ) * x - i.val)| ≤ 2 * pi * K * |x - b| := by have hKb : bump ((K : ℝ) * b - i.val) = 0 := by rcases hb with rfl | rfl · have hKr : (K : ℝ) ≠ 0 := by exact_mod_cast Nat.ne_of_gt hK unfold bump field_simp simp · have hKr : (K : ℝ) ≠ 0 := by exact_mod_cast Nat.ne_of_gt hK unfold bump field_simp simp [Real.sin_two_pi] have hs := Real.abs_sin_sub_sin_le (2 * pi * ((K : ℝ) * x - i.val)) (2 * pi * ((K : ℝ) * b - i.val)) calc |bump ((K : ℝ) * x - i.val)| = |bump ((K : ℝ) * x - i.val) - bump ((K : ℝ) * b - i.val)| := by rw [hKb, sub_zero] _ = |sin (2 * pi * ((K : ℝ) * x - i.val)) - sin (2 * pi * ((K : ℝ) * b - i.val))| := rfl _ ≤ |2 * pi * ((K : ℝ) * x - i.val) - 2 * pi * ((K : ℝ) * b - i.val)| := hs _ = 2 * pi * K * |x - b| := by rw [show 2 * pi * ((K : ℝ) * x - i.val) - 2 * pi * ((K : ℝ) * b - i.val) = (2 * pi * K) * (x - b) by ring, abs_mul] simp only [abs_of_nonneg (by positivity : (0 : ℝ) ≤ 2 * pi * K)]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.bump_affine_abs_le_endpoint · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/TiledHolder.lean:74
theorem tiledPerturbation_abs_sub_le

The signed tiled sine is globally Lipschitz on the covariate interval. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
cStar :
ℝ
n :
ℕ
sgn :
hc :
0 ≤ cStar
hn :
0 < n
x y :
ℝ
hx :
hy :
|tiledPerturbation cStar n sgn x - tiledPerturbation cStar n sgn y|
≤ lowerHeight cStar n * (2 * pi * lowerCells n) * |x - y|
Proof (Lean source)
lemma tiledPerturbation_abs_sub_le (cStar : ℝ) (n : ℕ) (sgn : Fin (lowerCells n) → Bool) (hc : 0 ≤ cStar) (hn : 0 < n) (x y : ℝ) (hx : x ∈ covariateSpace) (hy : y ∈ covariateSpace) : |tiledPerturbation cStar n sgn x - tiledPerturbation cStar n sgn y| ≤ lowerHeight cStar n * (2 * pi * lowerCells n) * |x - y| := by have hK : 0 < lowerCells n := by unfold lowerCells exact Nat.ceil_pos.mpr (by positivity) obtain ⟨i, hxi⟩ := exists_tiled_cell_of_mem hK x hx obtain ⟨j, hyj⟩ := exists_tiled_cell_of_mem hK y hy rw [tiledPerturbation_eq_of_mem_cell cStar n sgn i x hxi hK, tiledPerturbation_eq_of_mem_cell cStar n sgn j y hyj hK] have hh : 0 ≤ lowerHeight cStar n := by unfold lowerHeight; positivity have hsi (k : Fin (lowerCells n)) : |sign (sgn k)| = 1 := by cases sgn k <;> simp [sign] by_cases hij : i = j · subst j rw [← mul_sub, abs_mul, abs_mul, hsi, mul_one] have hs := Real.abs_sin_sub_sin_le (2 * pi * ((lowerCells n : ℝ) * x - i.val)) (2 * pi * ((lowerCells n : ℝ) * y - i.val)) calc |lowerHeight cStar n| * |bump ((lowerCells n : ℝ) * x - i.val) - bump ((lowerCells n : ℝ) * y - i.val)| ≤ lowerHeight cStar n * |2 * pi * ((lowerCells n : ℝ) * x - i.val) - 2 * pi * ((lowerCells n : ℝ) * y - i.val)| := by rw [abs_of_nonneg hh] exact mul_le_mul_of_nonneg_left hs hh _ = lowerHeight cStar n * (2 * pi * lowerCells n) * |x - y| := by rw [show 2 * pi * ((lowerCells n : ℝ) * x - i.val) - 2 * pi * ((lowerCells n : ℝ) * y - i.val) = (2 * pi * lowerCells n) * (x - y) by ring, abs_mul] simp only [abs_of_nonneg (by positivity : (0 : ℝ) ≤ 2 * pi * lowerCells n)] ring · have hordered (x y : ℝ) (hx : x ∈ covariateSpace) (hy : y ∈ covariateSpace) (i j : Fin (lowerCells n)) (hxi : x ∈ cell (lowerCells n) i) (hyj : y ∈ cell (lowerCells n) j) (hij : i ≠ j) (hxy : x ≤ y) : |lowerHeight cStar n * sign (sgn i) * bump ((lowerCells n : ℝ) * x - i.val) - lowerHeight cStar n * sign (sgn j) * bump ((lowerCells n : ℝ) * y - j.val)| ≤ lowerHeight cStar n * (2 * pi * lowerCells n) * |x - y| := by have hijv : i.val < j.val := by rcases Nat.lt_or_gt_of_ne (Fin.val_ne_of_ne hij) with hij' | hji · exact hij' · have hxb := cell_closed_bounds hK i x hxi have hyb := cell_closed_bounds hK j y hyj have hstep : (j.val : ℝ) + 1 ≤ i.val := by exact_mod_cast hji have hKr : (0 : ℝ) < lowerCells n := by exact_mod_cast hK have : y ≤ x := by calc y ≤ ((j.val : ℝ) + 1) / lowerCells n := hyb.2 _ ≤ (i.val : ℝ) / lowerCells n := (div_le_div_iff_of_pos_right hKr).2 hstep _ ≤ x := hxb.1 have hxy' : x = y := le_antisymm hxy this subst y exact (hij (cell_mem_unique _ hK i j x hxi hyj)).elim let bi : ℝ := ((i.val : ℝ) + 1) / lowerCells n let aj : ℝ := (j.val : ℝ) / lowerCells n have hxb := cell_closed_bounds hK i x hxi have hyb := cell_closed_bounds hK j y hyj have hstep : (i.val : ℝ) + 1 ≤ j.val := by exact_mod_cast hijv have hKr : (0 : ℝ) < lowerCells n := by exact_mod_cast hK have hbaj : bi ≤ aj := (div_le_div_iff_of_pos_right hKr).2 hstep have hchain : x ≤ bi ∧ bi ≤ aj ∧ aj ≤ y := ⟨hxb.2, hbaj, hyb.1⟩ have hbi := bump_affine_abs_le_endpoint hK i x bi (inr rfl) have haj := bump_affine_abs_le_endpoint hK j y aj (inl rfl) calc |lowerHeight cStar n * sign (sgn i) * bump ((lowerCells n : ℝ) * x - i.val) - lowerHeight cStar n * sign (sgn j) * bump ((lowerCells n : ℝ) * y - j.val)| ≤ |lowerHeight cStar n * sign (sgn i) * bump ((lowerCells n : ℝ) * x - i.val)| + |lowerHeight cStar n * sign (sgn j) * bump ((lowerCells n : ℝ) * y - j.val)| := abs_sub _ _ _ = lowerHeight cStar n * (|bump ((lowerCells n : ℝ) * x - i.val)| + |bump ((lowerCells n : ℝ) * y - j.val)|) := by rw [abs_mul, abs_mul, abs_mul, abs_mul, hsi, hsi, abs_of_nonneg hh] ring _ ≤ lowerHeight cStar n * ((2 * pi * lowerCells n) * |x - bi| + (2 * pi * lowerCells n) * |y - aj|) := by gcongr _ ≤ lowerHeight cStar n * (2 * pi * lowerCells n) * |x - y| := by rw [abs_of_nonpos (sub_nonpos.mpr hchain.1), abs_of_nonneg (sub_nonneg.mpr hchain.2.2), abs_of_nonpos (sub_nonpos.mpr hxy)] have hcoef : 0 ≤ 2 * pi * (lowerCells n : ℝ) := by positivity have hdist : (bi - x) + (y - aj) ≤ y - x := by linarith [hchain.2.1] calc lowerHeight cStar n * (2 * pi * lowerCells n * -(x - bi) + 2 * pi * lowerCells n * (y - aj)) = lowerHeight cStar n * ((2 * pi * lowerCells n) * ((bi - x) + (y - aj))) := by ring _ ≤ lowerHeight cStar n * ((2 * pi * lowerCells n) * (y - x)) := mul_le_mul_of_nonneg_left (mul_le_mul_of_nonneg_left hdist hcoef) hh _ = lowerHeight cStar n * (2 * pi * lowerCells n) * (y - x) := by ring _ = lowerHeight cStar n * (2 * pi * lowerCells n) * -(x - y) := by ring rcases le_total x y with hxy | hyx · exact hordered x y hx hy i j hxi hyj hij hxy · rw [abs_sub_comm, abs_sub_comm x y] exact hordered y x hy hx j i hyj hxi (Ne.symm hij) hyx
CausalSmith.Stat.TransportCaceRoughnuisanceLength.tiledPerturbation_abs_sub_le · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/TiledHolder.lean:106
theorem tiledPerturbation_holder_modulus

The scale K⁻¹/⁸ converts the tiled Lipschitz estimate into a uniform one-eighth Hölder modulus. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
cStar :
ℝ
n :
ℕ
sgn :
hc :
0 ≤ cStar
hn :
0 < n
x y :
ℝ
hx :
hy :
|tiledPerturbation cStar n sgn x - tiledPerturbation cStar n sgn y|
≤ cStar * (1 + 2 * pi) * |x - y| ^ holderExponent
Proof (Lean source)
lemma tiledPerturbation_holder_modulus (cStar : ℝ) (n : ℕ) (sgn : Fin (lowerCells n) → Bool) (hc : 0 ≤ cStar) (hn : 0 < n) (x y : ℝ) (hx : x ∈ covariateSpace) (hy : y ∈ covariateSpace) : |tiledPerturbation cStar n sgn x - tiledPerturbation cStar n sgn y| ≤ cStar * (1 + 2 * pi) * |x - y| ^ holderExponent := by let K : ℝ := lowerCells n let d : ℝ := |x - y| have hKnat : 0 < lowerCells n := by unfold lowerCells exact Nat.ceil_pos.mpr (by positivity) have hK : 0 < K := by simpa [K] using (Nat.cast_pos.mpr hKnat : (0 : ℝ) < lowerCells n) have hd : 0 ≤ d := abs_nonneg _ have hh : lowerHeight cStar n = cStar * K ^ (-(1 / 8 : ℝ)) := rfl have hcancel : K ^ (-(1 / 8 : ℝ)) * (K * d) ^ (1 / 8 : ℝ) = d ^ (1 / 8 : ℝ) := by rw [Real.mul_rpow hK.le hd, ← mul_assoc, ← Real.rpow_add hK] norm_num by_cases hd0 : d = 0 · have hxy : x = y := sub_eq_zero.mp (abs_eq_zero.mp (by simpa [d] using hd0)) subst y simp [holderExponent] by_cases hsmall : K * d ≤ 1 · have hqnonneg : 0 ≤ K * d := mul_nonneg hK.le hd have hqpow : K * d ≤ (K * d) ^ (1 / 8 : ℝ) := Real.self_le_rpow_of_le_one hqnonneg hsmall (by norm_num) have hlip := tiledPerturbation_abs_sub_le cStar n sgn hc hn x y hx hy calc |tiledPerturbation cStar n sgn x - tiledPerturbation cStar n sgn y| ≤ (cStar * K ^ (-(1 / 8 : ℝ))) * (2 * pi * K) * d := by simpa [hh, K, d, mul_assoc] using hlip _ = cStar * (2 * pi) * (K ^ (-(1 / 8 : ℝ)) * (K * d)) := by ring _ ≤ cStar * (2 * pi) * (K ^ (-(1 / 8 : ℝ)) * (K * d) ^ (1 / 8 : ℝ)) := by gcongr _ = cStar * (2 * pi) * d ^ (1 / 8 : ℝ) := by rw [hcancel] _ ≤ cStar * (1 + 2 * pi) * d ^ holderExponent := by unfold holderExponent have hz : 0 ≤ cStar * d ^ (1 / 8 : ℝ) := by positivity have hcst : 2 * pi ≤ 1 + 2 * pi := by linarith simpa [mul_assoc, mul_left_comm, mul_comm] using mul_le_mul_of_nonneg_left hcst hz · have hq : 1 ≤ K * d := le_of_not_ge hsmall have hqpow : 1 ≤ (K * d) ^ (1 / 8 : ℝ) := Real.one_le_rpow hq (by norm_num) have hheight : lowerHeight cStar n ≤ cStar * d ^ (1 / 8 : ℝ) := by rw [hh, ← hcancel] have hscale : 0 ≤ cStar * K ^ (-(1 / 8 : ℝ)) := by positivity simpa [mul_assoc] using mul_le_mul_of_nonneg_left hqpow hscale have hsupx := tiledPerturbation_abs_le_lowerHeight cStar n sgn x hc have hsupy := tiledPerturbation_abs_le_lowerHeight cStar n sgn y hc calc |tiledPerturbation cStar n sgn x - tiledPerturbation cStar n sgn y| ≤ |tiledPerturbation cStar n sgn x| + |tiledPerturbation cStar n sgn y| := abs_sub _ _ _ ≤ 2 * lowerHeight cStar n := by linarith _ ≤ 2 * (cStar * d ^ (1 / 8 : ℝ)) := by linarith _ ≤ cStar * (1 + 2 * pi) * d ^ holderExponent := by unfold holderExponent have hdpos : 0 < d := lt_of_le_of_ne hd (Ne.symm hd0) have hp : 0 < d ^ (1 / 8 : ℝ) := Real.rpow_pos_of_pos hdpos _ have hz : 0 ≤ cStar * d ^ (1 / 8 : ℝ) := mul_nonneg hc hp.le have hcst : (2 : ℝ) ≤ 1 + 2 * pi := by linarith [Real.two_le_pi] simpa [mul_assoc, mul_left_comm, mul_comm] using mul_le_mul_of_nonneg_left hcst hz
CausalSmith.Stat.TransportCaceRoughnuisanceLength.tiledPerturbation_holder_modulus · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/TiledHolder.lean:221
theorem tiledPerturbation_continuousOn

The tiled perturbation is continuous on the covariate interval. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
cStar :
ℝ
n :
ℕ
sgn :
hc :
0 ≤ cStar
hn :
0 < n
Proof (Lean source)
lemma tiledPerturbation_continuousOn (cStar : ℝ) (n : ℕ) (sgn : Fin (lowerCells n) → Bool) (hc : 0 ≤ cStar) (hn : 0 < n) : ContinuousOn (tiledPerturbation cStar n sgn) covariateSpace := by let C : ℝ := lowerHeight cStar n * (2 * pi * lowerCells n) have hLip : LipschitzOnWith (toNNReal C) (tiledPerturbation cStar n sgn) covariateSpace := LipschitzOnWith.of_dist_le' (f := tiledPerturbation cStar n sgn) (s := covariateSpace) fun x hx y hy => by simpa [C, Real.dist_eq] using tiledPerturbation_abs_sub_le cStar n sgn hc hn x y hx hy exact hLip.continuousOn
CausalSmith.Stat.TransportCaceRoughnuisanceLength.tiledPerturbation_continuousOn · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/TiledHolder.lean:289
theorem holderOn_of_bound_modulus

A bounded scalar function with the target modulus belongs to the paper's one-dimensional standard Hölder ball. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
f :
ℝ → ℝ
L :
ℝ
hL :
1 < L
hbound :
∀ x ∈ covariateSpace, |f x| ≤ L
hmod :
∀ x ∈ covariateSpace, ∀ y ∈ covariateSpace, |f x - f y| ≤ L * |x - y| ^ holderExponent
Proof (Lean source)
lemma holderOn_of_bound_modulus (f : ℝ → ℝ) (L : ℝ) (hL : 1 < L) (hcont : ContinuousOn f covariateSpace) (hbound : ∀ x ∈ covariateSpace, |f x| ≤ L) (hmod : ∀ x ∈ covariateSpace, ∀ y ∈ covariateSpace, |f x - f y| ≤ L * |x - y| ^ holderExponent) : HolderOn f L := by have hceil : ⌈holderExponent⌉₊ = 1 := by apply (Nat.ceil_eq_iff (by decide)).2 norm_num [holderExponent] refine ⟨hL, ?_⟩ unfold HolderBallStd rw [hceil] refine ⟨?_, ?_, ?_⟩ · change ContDiffOn ℝ 0 (fun x : Fin 1 → ℝ => f (x 0)) {x | x 0 ∈ covariateSpace} rw [contDiffOn_zero] exact hcont.comp (continuous_apply 0).continuousOn (fun _ hx => hx) · intro j hj x hx have hj0 : j = 0 := by omega subst j change ‖(continuousMultilinearCurryFin0 ℝ (Fin 1 → ℝ) ℝ).symm (f (x 0))‖ ≤ L rw [LinearIsometryEquiv.norm_map] simpa [Real.norm_eq_abs] using hbound (x 0) hx · intro x hx y hy simp only [Nat.sub_self, Nat.cast_zero, sub_zero] change ‖(continuousMultilinearCurryFin0 ℝ (Fin 1 → ℝ) ℝ).symm (f (x 0)) - (continuousMultilinearCurryFin0 ℝ (Fin 1 → ℝ) ℝ).symm (f (y 0))‖ ≤ L * ‖x - y‖ ^ holderExponent rw [← map_sub, LinearIsometryEquiv.norm_map] have hxy : (x - y : Fin 1 → ℝ) = fun _ => x 0 - y 0 := by ext i fin_cases i rfl simpa [hxy, pi_norm_const, Real.norm_eq_abs] using hmod (x 0) hx (y 0) hy
CausalSmith.Stat.TransportCaceRoughnuisanceLength.holderOn_of_bound_modulus · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/TiledHolder.lean:302
theorem const_add_tiledPerturbation_holderOn

Adding a constant preserves the tiled Hölder modulus; the displayed supremum condition supplies the radius bound. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
b cStar L :
ℝ
n :
ℕ
sgn :
hc :
0 ≤ cStar
hcap :
cStar ≤ (L - 1) / (1 + 2 * pi)
hbound :
|b| + cStar ≤ L
hn :
threshold ≤ n
hL :
1 < L
HolderOn (fun x => b + tiledPerturbation cStar n sgn x) L
Proof (Lean source)
lemma const_add_tiledPerturbation_holderOn (b cStar L : ℝ) (n : ℕ) (sgn : Fin (lowerCells n) → Bool) (hc : 0 ≤ cStar) (hcap : cStar ≤ (L - 1) / (1 + 2 * pi)) (hbound : |b| + cStar ≤ L) (hn : threshold ≤ n) (hL : 1 < L) : HolderOn (fun x => b + tiledPerturbation cStar n sgn x) L := by have hnpos : 0 < n := by have : 256 ≤ n := hn; omega have hden : 0 < 1 + 2 * pi := by positivity have hcoef : cStar * (1 + 2 * pi) ≤ L - 1 := (le_div_iff₀ hden).mp hcap apply holderOn_of_bound_modulus _ L hL · exact continuousOn_const.add (tiledPerturbation_continuousOn cStar n sgn hc hnpos) · intro x hx calc |b + tiledPerturbation cStar n sgn x| ≤ |b| + |tiledPerturbation cStar n sgn x| := abs_add_le _ _ _ ≤ |b| + cStar := by gcongr exact (tiledPerturbation_abs_le_lowerHeight cStar n sgn x hc).trans (lowerHeight_le_amplitude cStar n hc hn) _ ≤ L := hbound · intro x hx y hy simpa only [add_sub_add_left_eq_sub] using (tiledPerturbation_holder_modulus cStar n sgn hc hnpos x y hx hy).trans (mul_le_mul_of_nonneg_right (hcoef.trans (by linarith)) (Real.rpow_nonneg (abs_nonneg _) _))
CausalSmith.Stat.TransportCaceRoughnuisanceLength.const_add_tiledPerturbation_holderOn · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/TiledHolder.lean:338
theorem const_holderOn

Constant functions with value in the radius belong to the Hölder ball. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
b L :
ℝ
hL :
1 < L
hb :
|b| ≤ L
HolderOn (fun _ => b) L
Proof (Lean source)
lemma const_holderOn (b L : ℝ) (hL : 1 < L) (hb : |b| ≤ L) : HolderOn (fun _ => b) L := by apply holderOn_of_bound_modulus _ L hL · exact continuousOn_const · exact fun _ _ => hb · intro x hx y hy simp only [sub_self, abs_zero] exact mul_nonneg (by linarith) (Real.rpow_nonneg (abs_nonneg _) _)
theorem one_add_tiledPerturbation_holderOn

The perturbed target density has radius L. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
cStar L :
ℝ
n :
ℕ
sgn :
hc :
0 ≤ cStar
hcap :
cStar ≤ (L - 1) / (1 + 2 * pi)
hn :
threshold ≤ n
hL :
1 < L
HolderOn (fun x => 1 + tiledPerturbation cStar n sgn x) L
Proof (Lean source)
lemma one_add_tiledPerturbation_holderOn (cStar L : ℝ) (n : ℕ) (sgn : Fin (lowerCells n) → Bool) (hc : 0 ≤ cStar) (hcap : cStar ≤ (L - 1) / (1 + 2 * pi)) (hn : threshold ≤ n) (hL : 1 < L) : HolderOn (fun x => 1 + tiledPerturbation cStar n sgn x) L := by apply const_add_tiledPerturbation_holderOn 1 cStar L n sgn hc hcap _ hn hL have hden : 1 ≤ 1 + 2 * pi := by linarith [Real.pi_pos] have hc1 : cStar ≤ L - 1 := hcap.trans (div_le_self (by linarith) hden) simpa [add_comm] using (add_le_add_left hc1 1)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.one_add_tiledPerturbation_holderOn · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/TiledHolder.lean:377
theorem half_add_tiledPerturbation_holderOn

The perturbed assignment propensity has radius L. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
cStar L :
ℝ
n :
ℕ
sgn :
hc :
0 ≤ cStar
hcap :
cStar ≤ (L - 1) / (1 + 2 * pi)
hn :
threshold ≤ n
hL :
1 < L
HolderOn (fun x => 1 / 2 + tiledPerturbation cStar n sgn x) L
Proof (Lean source)
lemma half_add_tiledPerturbation_holderOn (cStar L : ℝ) (n : ℕ) (sgn : Fin (lowerCells n) → Bool) (hc : 0 ≤ cStar) (hcap : cStar ≤ (L - 1) / (1 + 2 * pi)) (hn : threshold ≤ n) (hL : 1 < L) : HolderOn (fun x => 1 / 2 + tiledPerturbation cStar n sgn x) L := by apply const_add_tiledPerturbation_holderOn (1 / 2) cStar L n sgn hc hcap _ hn hL have hden : 1 ≤ 1 + 2 * pi := by linarith [Real.pi_pos] have hc1 : cStar ≤ L - 1 := hcap.trans (div_le_self (by linarith) hden) norm_num linarith
CausalSmith.Stat.TransportCaceRoughnuisanceLength.half_add_tiledPerturbation_holderOn · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LegalMixture/TiledHolder.lean:389
CausalSmith.Stat.STAT_TransportCaceRoughnuisanceLength_Research.Helpers.Length 1 declarations Specialize the measurable random-set identity to the two-sample expected-length functional and the parameter interval [-1,1].

Restricted random-set length support

Specialize the measurable random-set identity to the two-sample expected-length functional and the parameter interval [-1,1].

theorem expectedLength_eq_integral_inclusion

Expected restricted length is the integral of pointwise inclusion probabilities. The shared theorem interchanges the two integrals of the measurable indicator. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
nS nT :
C :
TwoSample nS nT → Set ℝ
hgraph :
MeasurableSet {p : TwoSample nS nT × ℝ | p.2 ∈ C p.1}
expectedLength P nS nT C = ∫ t in parameterSpace, (dataLaw P nS nT {ω | t ∈ C ω}).toReal
Proof (Lean source)
-- @node: expectedLength_eq_integral_inclusion lemma expectedLength_eq_integral_inclusion (P : TransportLaw) (nS nT : ℕ) [IsFiniteMeasure (dataLaw P nS nT)] (C : TwoSample nS nT → Set ℝ) (hgraph : MeasurableSet {p : TwoSample nS nT × ℝ | p.2 ∈ C p.1}) : expectedLength P nS nT C = ∫ t in parameterSpace, (dataLaw P nS nT {ω | t ∈ C ω}).toReal := by exact expected_restrictedSetVolume_eq_integral_inclusion (dataLaw P nS nT) C parameterSpace hgraph measurableSet_Icc (by simp [parameterSpace, Real.volume_Icc])
CausalSmith.Stat.TransportCaceRoughnuisanceLength.expectedLength_eq_integral_inclusion · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Length.lean:17
CausalSmith.Stat.STAT_TransportCaceRoughnuisanceLength_Research.Helpers.LowerLength 8 declarations Componentwise honesty passes to the finite sign mixture, and total variation then transfers it to the center.

Coverage averaging and continuum length for the lower experiment

Componentwise honesty passes to the finite sign mixture, and total variation then transfers it to the center. Integrating inclusion probabilities gives the lower length bound without requiring connected confidence sets.

theorem dataLaw_isProbabilityMeasure_of_model

The three sampling conditions and the marginal probability laws make the data law a probability. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hP :
ModelClass c_f C_f L P n
Proof (Lean source)
-- @node: dataLaw_isProbabilityMeasure_of_model lemma dataLaw_isProbabilityMeasure_of_model (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hP : ModelClass c_f C_f L P n) : IsProbabilityMeasure (dataLaw P n n) := by let := sourceObsLaw_isProbabilityMeasure c_f C_f L P n hP let := targetXLaw_isProbabilityMeasure c_f C_f L P n hP rw [dataLaw_eq_source_target_pi c_f C_f L P n hP] infer_instance
CausalSmith.Stat.TransportCaceRoughnuisanceLength.dataLaw_isProbabilityMeasure_of_model · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LowerLength.lean:20
theorem expectedLength_nonneg

Expected restricted lengths are nonnegative, even before regularity is imposed. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
n :
ℕ
C :
TwoSample n n → Set ℝ
0 ≤ expectedLength P n n C
Proof (Lean source)
-- @node: expectedLength_nonneg lemma expectedLength_nonneg (P : TransportLaw) (n : ℕ) (C : TwoSample n n → Set ℝ) : 0 ≤ expectedLength P n n C := by exact integral_nonneg (fun _ => ENNReal.toReal_nonneg)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.expectedLength_nonneg · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LowerLength.lean:29
theorem expectedLength_le_two

A probability expectation of restricted length cannot exceed the length two of the parameter space. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
n :
C :
TwoSample n n → Set ℝ
expectedLength P n n C ≤ 2
Proof (Lean source)
-- @node: expectedLength_le_two lemma expectedLength_le_two (P : TransportLaw) (n : ℕ) [IsProbabilityMeasure (dataLaw P n n)] (C : TwoSample n n → Set ℝ) : expectedLength P n n C ≤ 2 := by have hb (ω : TwoSample n n) : restrictedLength (C ω) ≤ 2 := by unfold restrictedLength restrictedSetVolume have h := ENNReal.toReal_mono (show volume parameterSpace ≠ ⊤ by simp [parameterSpace, Real.volume_Icc]) (measure_mono (inter_subset_right : C ω ∩ parameterSpace ⊆ parameterSpace)) norm_num [parameterSpace, Real.volume_Icc] at h ⊢ exact h by_cases hi : Integrable (fun ω => restrictedLength (C ω)) (dataLaw P n n) · exact (integral_mono hi (integrable_const (2 : ℝ)) hb).trans_eq (by simp) · rw [expectedLength, integral_undef hi] norm_num
CausalSmith.Stat.TransportCaceRoughnuisanceLength.expectedLength_le_two · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LowerLength.lean:35
theorem lowerMixture_eq_uniform_data

The definition's power-of-two normalization is the cardinality normalization of a uniform mixture. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
a :
ℝ
n :
ℕ
cStar τ :
ℝ
lowerMixture a n cStar τ
= uniformMixture (fun sgn : Fin (lowerCells n) → Bool => dataLaw (legalIVComponent a n cStar τ sgn) n n)
Proof (Lean source)
-- @node: lowerMixture_eq_uniform_data lemma lowerMixture_eq_uniform_data (a : ℝ) (n : ℕ) (cStar τ : ℝ) : lowerMixture a n cStar τ = uniformMixture (fun sgn : Fin (lowerCells n) → Bool => dataLaw (legalIVComponent a n cStar τ sgn) n n) := by simp [lowerMixture, uniformMixture, mixture, Finset.smul_sum, Fintype.card_fun]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.lowerMixture_eq_uniform_data · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LowerLength.lean:52
theorem uniform_data_mixture_coverage Lemma uniform_data_mixture_coverage in the paper ↗

Averaging preserves a common lower coverage bound over a finite nonempty family. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
Ω S :
Type*
Nonempty S
Q :
S → Measure Ω
E :
Set Ω
p :
ℝ
hcover :
∀ s, p ≤ (Q s E).toReal
Proof (Lean source)
-- @node: uniform_data_mixture_coverage lemma uniform_data_mixture_coverage {Ω S : Type*} [MeasurableSpace Ω] [Fintype S] [Nonempty S] (Q : S → Measure Ω) [∀ s, IsProbabilityMeasure (Q s)] (E : Set Ω) (p : ℝ) (hcover : ∀ s, p ≤ (Q s E).toReal) : p ≤ (uniformMixture Q E).toReal := by classical let w : ℝ≥0∞ := (Fintype.card S : ℝ≥0∞)⁻¹ have hw : w ≠ ⊤ := by simp [w, Fintype.card_ne_zero] have hsum : (∑ _s : S, w.toReal) = 1 := by simp [w, ENNReal.toReal_inv, nsmul_eq_mul, Fintype.card_ne_zero] rw [uniformMixture, mixture_apply, ENNReal.toReal_sum (fun s _ => ENNReal.mul_ne_top hw (measure_ne_top (Q s) E))] simp only [ENNReal.toReal_mul] calc p = ∑ _s : S, w.toReal * p := by rw [← Finset.sum_mul, hsum, one_mul] _ ≤ _ := Finset.sum_le_sum (fun s _ => mul_le_mul_of_nonneg_left (hcover s) ENNReal.toReal_nonneg)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.uniform_data_mixture_coverage · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LowerLength.lean:60
theorem parameterSpace_honest

The finite-size fallback parameter interval is an honest connected confidence set. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
α c_f C_f L :
ℝ
hα :
0 < α ∧ α < 1
n :
ℕ
(fun _ : TwoSample n n => parameterSpace) ∈ HonestIntervals α c_f C_f L n
Proof (Lean source)
-- @node: parameterSpace_honest lemma parameterSpace_honest (α c_f C_f L : ℝ) (hα : 0 < α ∧ α < 1) (n : ℕ) : (fun _ : TwoSample n n => parameterSpace) ∈ HonestIntervals α c_f C_f L n := by refine ⟨hα.1, hα.2, (fun _ => ⟨Subset.rfl, ordConnected_Icc⟩), measurableSet_Icc.preimage measurable_snd, ?_⟩ intro P hP let := dataLaw_isProbabilityMeasure_of_model c_f C_f L P n hP have hid := transported_cace_identification c_f C_f L P n hP.sourceBounds.1 hP.sourceBounds.2.1 hP.sourceHolder.1 hP have hθ := hid.2.2.2.2.2.2 simp only [hθ, ofPred_true, measure_univ, ENNReal.toReal_one] linarith [hα.1]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.parameterSpace_honest · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LowerLength.lean:80
theorem actualStrength_rate_identity Lemma actualStrength_rate_identity in the paper ↗

The floor chosen by the mixture implements the exact capped inverse-strength rate. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
a :
ℝ
n :
ℕ
ha :
0 < a
hn :
0 < n
(n : ℝ) ^ (-(1 / 3 : ℝ)) / actualStrength a n = min 1 ((n : ℝ) ^ (-(1 / 3 : ℝ)) / a)
Proof (Lean source)
-- @node: actualStrength_rate_identity lemma actualStrength_rate_identity (a : ℝ) (n : ℕ) (ha : 0 < a) (hn : 0 < n) : (n : ℝ) ^ (-(1 / 3 : ℝ)) / actualStrength a n = min 1 ((n : ℝ) ^ (-(1 / 3 : ℝ)) / a) := by have hr : 0 < (n : ℝ) ^ (-(1 / 3 : ℝ)) := Real.rpow_pos_of_pos (by positivity) _ unfold actualStrength by_cases h : a ≤ (n : ℝ) ^ (-(1 / 3 : ℝ)) · rw [max_eq_right h, div_self hr.ne', min_eq_left ((le_div_iff₀ ha).2 (by simpa using h))] · have h' := le_of_not_ge h rw [max_eq_left h', min_eq_right ((div_le_one ha).2 h')]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.actualStrength_rate_identity · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LowerLength.lean:94
theorem expectedLength_lower_of_inclusion

Integrating a uniform inclusion bound over a symmetric subinterval gives its length times coverage. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
n :
C :
TwoSample n n → Set ℝ
hgraph :
MeasurableSet {p : TwoSample n n × ℝ | p.2 ∈ C p.1}
r p :
ℝ
hr :
0 ≤ r
hr1 :
r ≤ 1
hcover :
∀ t ∈ Icc (-r) r, p ≤ (dataLaw P n n {ω | t ∈ C ω}).toReal
2 * r * p ≤ expectedLength P n n C
Proof (Lean source)
-- @node: expectedLength_lower_of_inclusion lemma expectedLength_lower_of_inclusion (P : TransportLaw) (n : ℕ) [IsProbabilityMeasure (dataLaw P n n)] (C : TwoSample n n → Set ℝ) (hgraph : MeasurableSet {p : TwoSample n n × ℝ | p.2 ∈ C p.1}) (r p : ℝ) (hr : 0 ≤ r) (hr1 : r ≤ 1) (hcover : ∀ t ∈ Icc (-r) r, p ≤ (dataLaw P n n {ω | t ∈ C ω}).toReal) : 2 * r * p ≤ expectedLength P n n C := by let f := fun t => (dataLaw P n n {ω | t ∈ C ω}).toReal have hf : Measurable f := (measurable_measure_prodMk_right hgraph).ennreal_toReal have hreg : volume parameterSpace ≠ ⊤ := by simp [parameterSpace, Real.volume_Icc] have hsub : Icc (-r) r ⊆ parameterSpace := by intro t ht change -1 ≤ t ∧ t ≤ 1 constructor <;> linarith [ht.1, ht.2] have hfin : volume (Icc (-r) r) ≠ ⊤ := by simp [Real.volume_Icc] have hint : IntegrableOn f parameterSpace := by let := isFiniteMeasure_restrict.mpr hreg apply Integrable.of_bound hf.aestronglyMeasurable.restrict 1 filter_upwards [] with t rw [Real.norm_eq_abs, abs_of_nonneg ENNReal.toReal_nonneg] exact measureReal_le_one rw [expectedLength_eq_integral_inclusion P n n C hgraph] calc 2 * r * p = ∫ _t in Icc (-r) r, p := by rw [setIntegral_const] simp only [smul_eq_mul, Measure.real, Real.volume_Icc] rw [ENNReal.toReal_ofReal (by linarith : 0 ≤ r - -r)] ring _ ≤ ∫ t in Icc (-r) r, f t := setIntegral_mono_on (integrableOn_const hfin) (hint.mono_set hsub) measurableSet_Icc hcover _ ≤ ∫ t in parameterSpace, f t := setIntegral_mono_set hint (Filter.Eventually.of_forall fun _ => ENNReal.toReal_nonneg) (Filter.Eventually.of_forall hsub)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.expectedLength_lower_of_inclusion · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/LowerLength.lean:106
CausalSmith.Stat.STAT_TransportCaceRoughnuisanceLength_Research.Helpers.Mixture 38 declarations Finite sign-mixture full-data construction

Finite sign-mixture full-data construction

def lowerCells

The lower cells object is defined from the supplied inputs.

Definition (Lean source)
n :
ℕ
lowerCells n :
ℕ
ceil ((n : ℝ) ^ ((4 : ℝ) / 3))
CausalSmith.Stat.TransportCaceRoughnuisanceLength.lowerCells · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Mixture.lean:17
def bump

The bump object is defined from the supplied inputs.

Definition (Lean source)
t :
ℝ
bump t :
ℝ
sin (2 * pi * t)
def lowerHeight

The lower height object is defined from the supplied inputs.

Definition (Lean source)
cStar :
ℝ
n :
ℕ
lowerHeight cStar n :
ℝ
cStar * (lowerCells n : ℝ) ^ (-(1 / 8 : ℝ))
CausalSmith.Stat.TransportCaceRoughnuisanceLength.lowerHeight · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Mixture.lean:24
def sign

The sign object is defined from the supplied inputs.

Definition (Lean source)
b :
sign b :
ℝ
if b then 1 else -1
def tiledPerturbation

The tiled perturbation object is defined from the supplied inputs.

Definition (Lean source)
cStar :
ℝ
n :
ℕ
sgn :
Fin (lowerCells n) → Bool
x :
ℝ
tiledPerturbation cStar n sgn x :
ℝ
by classical exact ∑ ℓ : Fin (lowerCells n), if x ∈ cell (lowerCells n) ℓ then lowerHeight cStar n * sign (sgn ℓ) * bump ((lowerCells n : ℝ) * x - ℓ.val) else 0
CausalSmith.Stat.TransportCaceRoughnuisanceLength.tiledPerturbation · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Mixture.lean:31
def coupledPerturbation Definition 22 in the paper ↗

The coupled perturbation object is defined from the supplied inputs.

Definition (Lean source)
cStar τ :
ℝ
n :
ℕ
sgn :
x :
ℝ
coupledPerturbation cStar τ n sgn x :
ℝ
τ * tiledPerturbation cStar n sgn x
CausalSmith.Stat.TransportCaceRoughnuisanceLength.coupledPerturbation · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Mixture.lean:41
def actualStrength

The actual strength object is defined from the supplied inputs.

Definition (Lean source)
a :
ℝ
n :
ℕ
actualStrength a n :
ℝ
max a ((n : ℝ) ^ (-(1 / 3 : ℝ)))
CausalSmith.Stat.TransportCaceRoughnuisanceLength.actualStrength · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Mixture.lean:46
def LowerAdmissible

The lower admissible object is defined from the supplied inputs.

Definition (Lean source)
n :
ℕ
a cStar :
ℝ
LowerAdmissible n a cStar :
Prop
clause 1
0 < cStar
clause 2
lowerHeight cStar n ≤ 3 / 16
clause 3
lowerHeight cStar n ^ 2 ≤ actualStrength a n * (1 / 4 - lowerHeight cStar n ^ 2)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.LowerAdmissible · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Mixture.lean:49
def LowerExperimentDomain

The standing lower-experiment domain combines positive sample size with the paper's exact amplitude admissibility condition. Height and separation are interpreted on this domain; their range properties are derived below. For the displayed assumptions and inputs, the stated object is defined.

Definition (Lean source)
n :
ℕ
a cStar :
ℝ
LowerExperimentDomain n a cStar :
Prop
clause 1
0 < n
clause 2
LowerAdmissible n a cStar
CausalSmith.Stat.TransportCaceRoughnuisanceLength.LowerExperimentDomain · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Mixture.lean:57
def receiptBase

The receipt base object is defined from the supplied inputs.

Definition (Lean source)
a :
ℝ
z :
receiptBase a z :
ℝ
(1 + sign z * a) / 2
CausalSmith.Stat.TransportCaceRoughnuisanceLength.receiptBase · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Mixture.lean:63
def receiptOutcomeCell

The receipt outcome cell object is defined from the supplied inputs.

Definition (Lean source)
a :
ℝ
z d _y :
receiptOutcomeCell a z d _y :
ℝ
if d then receiptBase a z / 2 else (1 - receiptBase a z) / 2
CausalSmith.Stat.TransportCaceRoughnuisanceLength.receiptOutcomeCell · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Mixture.lean:67
def assignmentWeight

The assignment weight object is defined from the supplied inputs.

Definition (Lean source)
u :
ℝ
z :
assignmentWeight u z :
ℝ
if z then 1 / 2 + u else 1 / 2 - u
CausalSmith.Stat.TransportCaceRoughnuisanceLength.assignmentWeight · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Mixture.lean:70

The paper's strength domain makes the baseline receipt a probability. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
a :
ℝ
ha :
0 < a ∧ a ≤ 1 / 4
z :
receiptBase a z ∈ Icc (0 : ℝ) 1
Proof (Lean source)
-- @node: receiptBase_mem_Icc lemma receiptBase_mem_Icc (a : ℝ) (ha : 0 < a ∧ a ≤ 1 / 4) (z : Bool) : receiptBase a z ∈ Icc (0 : ℝ) 1 := by -- @realizes r_z^{(a)}(domain (0,1/4] and range [0,1]) @realizes R_z^{(a)}(baseline probability domain) cases z <;> simp only [receiptBase, sign, Bool.false_eq_true, ↓reduceIte, Set.mem_Icc] <;> constructor <;> linarith [ha.1, ha.2]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.receiptBase_mem_Icc · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Mixture.lean:74
theorem receiptOutcomeCell_nonneg Lemma receiptOutcomeCell_nonneg in the paper ↗

Each baseline receipt-outcome cell is nonnegative. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
a :
ℝ
ha :
0 < a ∧ a ≤ 1 / 4
z d y :
0 ≤ receiptOutcomeCell a z d y
Proof (Lean source)
-- @node: receiptOutcomeCell_nonneg lemma receiptOutcomeCell_nonneg (a : ℝ) (ha : 0 < a ∧ a ≤ 1 / 4) (z d y : Bool) : 0 ≤ receiptOutcomeCell a z d y := by -- @realizes R_z^{(a)}(nonnegative masses on paper strength domain) have hb := receiptBase_mem_Icc a ha z cases d <;> simp only [receiptOutcomeCell, Bool.false_eq_true, ↓reduceIte] · exact div_nonneg (sub_nonneg.mpr hb.2) (by norm_num) · exact div_nonneg hb.1 (by norm_num)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.receiptOutcomeCell_nonneg · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Mixture.lean:81
theorem receiptOutcomeCell_sum_eq_one Lemma receiptOutcomeCell_sum_eq_one in the paper ↗

For each encouragement, the four baseline cells have total mass one. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
a :
ℝ
ha :
0 < a ∧ a ≤ 1 / 4
z :
(∑ d : Bool, ∑ y : Bool, receiptOutcomeCell a z d y) = 1
Proof (Lean source)
-- @node: receiptOutcomeCell_sum_eq_one lemma receiptOutcomeCell_sum_eq_one (a : ℝ) (ha : 0 < a ∧ a ≤ 1 / 4) (z : Bool) : (∑ d : Bool, ∑ y : Bool, receiptOutcomeCell a z d y) = 1 := by -- @realizes R_z^{(a)}(normalized probability mass function) simp only [Fintype.sum_bool, receiptOutcomeCell, Bool.false_eq_true, ↓reduceIte] ring
CausalSmith.Stat.TransportCaceRoughnuisanceLength.receiptOutcomeCell_sum_eq_one · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Mixture.lean:91
theorem assignmentWeight_mem_Icc

Given the supplied inputs, the stated result about assignment weight mem icc holds.

Formal statement
u :
ℝ
hu :
u ∈ Icc (-(1 / 2 : ℝ)) (1 / 2)
z :
assignmentWeight u z ∈ Icc (0 : ℝ) 1
Proof (Lean source)
lemma assignmentWeight_mem_Icc (u : ℝ) (hu : u ∈ Icc (-(1 / 2 : ℝ)) (1 / 2)) (z : Bool) : assignmentWeight u z ∈ Icc (0 : ℝ) 1 := by -- @realizes e_z^{(\lambda)}(range [0,1] for |u|≤1/2) rcases hu with ⟨hlo, hhi⟩ cases z <;> simp [assignmentWeight, Set.mem_Icc] <;> constructor <;> linarith
CausalSmith.Stat.TransportCaceRoughnuisanceLength.assignmentWeight_mem_Icc · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Mixture.lean:97
def complierMargin

The complier margin object is defined from the supplied inputs.

Definition (Lean source)
a u v :
ℝ
d y :
complierMargin a u v d y :
ℝ
if d then a / 2
- sign y * u * v / (2 * (1 / 4 - u ^ 2)) else a / 2
+ sign y * u * v / (2 * (1 / 4 - u ^ 2))
CausalSmith.Stat.TransportCaceRoughnuisanceLength.complierMargin · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Mixture.lean:105
def primitiveMass

The primitive mass object is defined from the supplied inputs.

Definition (Lean source)
a u v :
ℝ
d0 d1 y0 y1 :
primitiveMass a u v d0 d1 y0 y1 :
ℝ
if !d0 && d1 then complierMargin a u v false y0 * complierMargin a u v true y1 / a else if d0 && d1 && !y0 then receiptBase a false / 2
+ v * sign y1 / (4 * assignmentWeight u false) else if !d0 && !d1 && !y1 then (1 - receiptBase a true) / 2
+ v * sign y0 / (4 * assignmentWeight u true) else 0
CausalSmith.Stat.TransportCaceRoughnuisanceLength.primitiveMass · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Mixture.lean:109
def primitiveKernel

The primitive kernel object is defined from the supplied inputs.

Definition (Lean source)
s :
x :
ℝ
mass :
ℝ → Bool → Bool → Bool → Bool → ℝ
primitiveKernel s x mass :
∑ d0 : Bool, ∑ d1 : Bool, ∑ y0 : Bool, ∑ y1 : Bool, ofReal (mass x d0 d1 y0 y1) • Measure.dirac (s, x, d0, d1, boolReal y0, boolReal y1)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.primitiveKernel · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Mixture.lean:121
def primitivePopulation

The primitive population object is defined from the supplied inputs.

Definition (Lean source)
s :
density :
ℝ → ℝ
mass :
ℝ → Bool → Bool → Bool → Bool → ℝ
primitivePopulation s density mass :
((volume.restrict covariateSpace).withDensity (fun x => ofReal (density x))).bind (fun x => primitiveKernel s x mass)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.primitivePopulation · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Mixture.lean:128
def assignedFrom

The assigned from object is defined from the supplied inputs.

Definition (Lean source)
e :
ℝ → ℝ
assignedFrom μ e :
μ.bind (fun o => ofReal (e (covariate o)) • Measure.dirac (o, true, potentialReceipt o true, potentialOutcome o (potentialReceipt o true)) + ofReal (1 - e (covariate o)) • Measure.dirac (o, false, potentialReceipt o false, potentialOutcome o (potentialReceipt o false)))
CausalSmith.Stat.TransportCaceRoughnuisanceLength.assignedFrom · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Mixture.lean:135
def armMeanFrom

The arm mean from object is defined from the supplied inputs.

Definition (Lean source)
mass :
ℝ → Bool → Bool → Bool → Bool → ℝ
A z :
x :
ℝ
armMeanFrom mass A z x :
ℝ
∑ d0 : Bool, ∑ d1 : Bool, ∑ y0 : Bool, ∑ y1 : Bool, mass x d0 d1 y0 y1 * (if A then boolReal (if (if z then d1 else d0) then y1 else y0) else boolReal (if z then d1 else d0))
CausalSmith.Stat.TransportCaceRoughnuisanceLength.armMeanFrom · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Mixture.lean:146
def lawFromMass

The law from mass object is defined from the supplied inputs.

Definition (Lean source)
fS fT e :
ℝ → ℝ
mass :
ℝ → Bool → Bool → Bool → Bool → ℝ
lawFromMass fS fT e mass :
source :
target :
full :
(1 / 2 : ℝ≥0∞) • source + (1 / 2 : ℝ≥0∞) • target
assigned :
assignedFrom source e
observed :
assigned.map observeSource
targetX :
(cond full {o | population o = false}).map covariate
{ fullLaw := full assignedLaw := assigned sampleLaw := fun nS nT => (Measure.pi (fun _ : Fin nS => observed)).prod (Measure.pi (fun _ : Fin nT => targetX)) fS := fS fT := fT e := e m := armMeanFrom mass assignmentPotentialOutcome := fun z o => potentialOutcome o (potentialReceipt o z) }
CausalSmith.Stat.TransportCaceRoughnuisanceLength.lawFromMass · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Mixture.lean:154
def lowerMass

The lower mass object is defined from the supplied inputs.

Definition (Lean source)
a :
ℝ
n :
ℕ
cStar τ :
ℝ
sgn :
x :
ℝ
lowerMass a n cStar τ sgn x :
ℝ
primitiveMass (actualStrength a n) (tiledPerturbation cStar n sgn x) (coupledPerturbation cStar τ n sgn x)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.lowerMass · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Mixture.lean:175
def lowerPointwiseMean

The lower pointwise mean object is defined from the supplied inputs.

Definition (Lean source)
a :
ℝ
n :
ℕ
cStar τ :
ℝ
sgn :
s :
f :
FullData → ℝ
x :
ℝ
lowerPointwiseMean a n cStar τ sgn s f x :
ℝ
∑ d0 : Bool, ∑ d1 : Bool, ∑ y0 : Bool, ∑ y1 : Bool, lowerMass a n cStar τ sgn x d0 d1 y0 y1 * f (s, x, d0, d1, boolReal y0, boolReal y1)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.lowerPointwiseMean · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Mixture.lean:182
def legalIVComponent

The legal ivcomponent object is defined from the supplied inputs.

Definition (Lean source)
a :
ℝ
n :
ℕ
cStar τ :
ℝ
sgn :
legalIVComponent a n cStar τ sgn :
lawFromMass (fun _ => 1) (fun x => 1 + tiledPerturbation cStar n sgn x) (fun x => 1 / 2 + tiledPerturbation cStar n sgn x) (lowerMass a n cStar τ sgn)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.legalIVComponent · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Mixture.lean:190
def mixtureCenter

The mixture center object is defined from the supplied inputs.

Definition (Lean source)
a :
ℝ
n :
ℕ
mixtureCenter a n :
lawFromMass (fun _ => 1) (fun _ => 1) (fun _ => 1 / 2) (fun _ => primitiveMass (actualStrength a n) 0 0)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.mixtureCenter · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Mixture.lean:198
def lowerMixture

The lower mixture object is defined from the supplied inputs.

Definition (Lean source)
a :
ℝ
n :
ℕ
cStar τ :
ℝ
lowerMixture a n cStar τ :
(1 / (2 ^ (lowerCells n) : ℝ≥0∞)) • ∑ sgn : Fin (lowerCells n) → Bool, dataLaw (legalIVComponent a n cStar τ sgn) n n
CausalSmith.Stat.TransportCaceRoughnuisanceLength.lowerMixture · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Mixture.lean:203
def legalIVMixture

The legal ivmixture object is defined from the supplied inputs.

Definition (Lean source)
a :
ℝ
n :
ℕ
cStar τ :
ℝ
_hn :
threshold ≤ n
_ha :
0 < a ∧ a ≤ 1 / 4
_hDomain :
@realizes c_{\star}(positive amplitude via standing Adm)
_hcStar :
cStar < 1
@realizes c_{\star}(standing upper bound; amplitude in (0,1))
_hτ :
τ ∈ Icc (-1 : ℝ) 1
sgn :
legalIVMixture a n cStar τ _hn _ha _hDomain _hcStar _hτ sgn :
(legalIVComponent a n cStar τ sgn, lowerMixture a n cStar τ, mixtureCenter a n)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.legalIVMixture · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Mixture.lean:212
def separation

The separation object is defined from the supplied inputs.

Definition (Lean source)
cStar :
ℝ
n :
ℕ
separation cStar n :
ℝ
h :
lowerHeight cStar n
h ^ 2 * ∫ t in (0 : ℝ)..1, bump t ^ 2 / (1 / 4 - h ^ 2 * bump t ^ 2)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.separation · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Mixture.lean:226
theorem lower_admissible_of_small_amplitude

Given the supplied inputs, the stated result about lower admissible of small amplitude holds.

Formal statement
n :
ℕ
a cStar :
ℝ
hn :
threshold ≤ n
ha :
0 < a ∧ a ≤ 1 / 4
hc :
0 < cStar ∧ cStar ≤ 1 / 100
LowerAdmissible n a cStar
Proof (Lean source)
lemma lower_admissible_of_small_amplitude (n : ℕ) (a cStar : ℝ) (hn : threshold ≤ n) (ha : 0 < a ∧ a ≤ 1 / 4) (hc : 0 < cStar ∧ cStar ≤ 1 / 100) : LowerAdmissible n a cStar := by have hn1 : (1 : ℝ) ≤ n := by exact_mod_cast (show 1 ≤ n by have : 256 ≤ n := hn; omega) have hnpos : (0 : ℝ) < n := lt_of_lt_of_le zero_lt_one hn1 have hbase : (n : ℝ) ^ ((4 : ℝ) / 3) ≤ lowerCells n := by unfold lowerCells exact Nat.le_ceil _ have hKpos : (0 : ℝ) < lowerCells n := by have := Real.one_le_rpow hn1 (by norm_num : (0 : ℝ) ≤ 4 / 3) linarith have hpow : (lowerCells n : ℝ) ^ (-(1 / 4 : ℝ)) ≤ (n : ℝ) ^ (-(1 / 3 : ℝ)) := by have h := Real.rpow_le_rpow_of_nonpos (Real.rpow_pos_of_pos hnpos _) hbase (by norm_num : (-(1 / 4 : ℝ)) ≤ 0) rw [← Real.rpow_mul hnpos.le] at h convert h using 1 <;> congr 1 <;> ring have hsq : lowerHeight cStar n ^ 2 = cStar ^ 2 * (lowerCells n : ℝ) ^ (-(1 / 4 : ℝ)) := by unfold lowerHeight rw [mul_pow, ← Real.rpow_mul_natCast hKpos.le] norm_num have hsmall : lowerHeight cStar n ≤ 1 / 100 := by unfold lowerHeight have hKone : (1 : ℝ) ≤ lowerCells n := by exact le_trans (Real.one_le_rpow hn1 (by norm_num : (0 : ℝ) ≤ 4 / 3)) hbase have hfac := Real.rpow_le_one_of_one_le_of_nonpos hKone (by norm_num : (-(1 / 8 : ℝ)) ≤ 0) have hfac0 : 0 ≤ (lowerCells n : ℝ) ^ (-(1 / 8 : ℝ)) := (Real.rpow_pos_of_pos hKpos _).le nlinarith [mul_le_mul_of_nonneg_left hfac hc.1.le] have hbpos : 0 < actualStrength a n := by unfold actualStrength exact lt_of_lt_of_le ha.1 (le_max_left _ _) have hpowpos : 0 ≤ (n : ℝ) ^ (-(1 / 3 : ℝ)) := (Real.rpow_pos_of_pos hnpos _).le have hbound : lowerHeight cStar n ^ 2 ≤ (1 / 10000 : ℝ) * actualStrength a n := by rw [hsq] have hc2 : cStar ^ 2 ≤ (1 / 10000 : ℝ) := by nlinarith have hp := mul_le_mul_of_nonneg_left hpow (sq_nonneg cStar) have hp2 := mul_le_mul_of_nonneg_right hc2 hpowpos have hb : (n : ℝ) ^ (-(1 / 3 : ℝ)) ≤ actualStrength a n := le_max_right _ _ nlinarith [mul_le_mul_of_nonneg_left hb (by norm_num : (0 : ℝ) ≤ 1 / 10000)] have hsqsmall : lowerHeight cStar n ^ 2 ≤ (1 / 10000 : ℝ) := by have hnonneg : 0 ≤ lowerHeight cStar n := by unfold lowerHeight exact mul_nonneg hc.1.le (Real.rpow_pos_of_pos hKpos _).le nlinarith constructor · exact hc.1 constructor · linarith · nlinarith [mul_nonneg (le_of_lt hbpos) (show 0 ≤ (1 / 4 : ℝ) - lowerHeight cStar n ^ 2 by linarith)]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.lower_admissible_of_small_amplitude · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Mixture.lean:235
theorem lowerHeight_bounds_of_domain

Admissibility and positive sample size imply the paper's strict height range. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
n :
ℕ
a cStar :
ℝ
hDomain :
conclusion 1
0 < lowerHeight cStar n
conclusion 2
lowerHeight cStar n ≤ 3 / 16
conclusion 3
lowerHeight cStar n < 1
Proof (Lean source)
-- keep: certifies the frozen h_n ∈ (0,1) realization for the F2.5 faithfulness review lemma lowerHeight_bounds_of_domain (n : ℕ) (a cStar : ℝ) (hDomain : LowerExperimentDomain n a cStar) : 0 < lowerHeight cStar n ∧ lowerHeight cStar n ≤ 3 / 16 ∧ lowerHeight cStar n < 1 := by have hn := hDomain.1 have hK : 0 < lowerCells n := by unfold lowerCells exact Nat.ceil_pos.mpr (by positivity) have hhpos : 0 < lowerHeight cStar n := by unfold lowerHeight exact mul_pos hDomain.2.1 (Real.rpow_pos_of_pos (by exact_mod_cast hK) _) exact ⟨hhpos, hDomain.2.2.1, lt_of_le_of_lt hDomain.2.2.1 (by norm_num)⟩
CausalSmith.Stat.TransportCaceRoughnuisanceLength.lowerHeight_bounds_of_domain · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Mixture.lean:296
def mixConstant

The mix constant object is defined without additional inputs.

Definition (Lean source)
mixConstant :
ℝ
19321 / 1800
CausalSmith.Stat.TransportCaceRoughnuisanceLength.mixConstant · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Mixture.lean:310

The witness direction object is defined from the supplied inputs.

Definition (Lean source)
x :
ℝ
witnessDirection x :
ℝ
|x - 1 / 2| ^ holderExponent - ∫ u in (0 : ℝ)..1, |u - 1 / 2| ^ holderExponent
CausalSmith.Stat.TransportCaceRoughnuisanceLength.witnessDirection · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Mixture.lean:314
def witnessAmplitude

The witness amplitude object is defined from the supplied inputs.

Definition (Lean source)
c_f C_f L :
ℝ
witnessAmplitude c_f C_f L :
ℝ
min (1 - c_f) (min (C_f - 1) (min (1 / 4) (L - 1))) / 4
CausalSmith.Stat.TransportCaceRoughnuisanceLength.witnessAmplitude · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Mixture.lean:320
def simplePrimitiveKernel

The simple primitive kernel object is defined from the supplied inputs.

Definition (Lean source)
s :
x :
ℝ
simplePrimitiveKernel s x :
(1 / 8 : ℝ≥0∞) • Measure.dirac (s, x, false, true, (1 / 2 : ℝ), 1 / 2)
+ (7 / 16 : ℝ≥0∞) • Measure.dirac (s, x, true, true, (1 / 2 : ℝ), 1 / 2)
+ (7 / 16 : ℝ≥0∞) • Measure.dirac (s, x, false, false, (1 / 2 : ℝ), 1 / 2)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.simplePrimitiveKernel · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Mixture.lean:325
def simplePrimitivePopulation

The simple primitive population object is defined from the supplied inputs.

Definition (Lean source)
s :
density :
ℝ → ℝ
simplePrimitivePopulation s density :
((volume.restrict covariateSpace).withDensity (fun x => ofReal (density x))).bind (simplePrimitiveKernel s)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.simplePrimitivePopulation · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Mixture.lean:332
def continuousGeometryWitness

The continuous geometry witness object is defined from the supplied inputs.

Definition (Lean source)
σ :
_n :
ℕ
c_f C_f L :
ℝ
continuousGeometryWitness σ _n c_f C_f L :
ε :
s :
sign σ
fS :
fun x => 1 + s * ε * witnessDirection x
fT :
fun x => 1 - s * ε * witnessDirection x
e :
fun x => 1 / 2 + s * ε * witnessDirection x
full :
(1 / 2 : ℝ≥0∞) • source + (1 / 2 : ℝ≥0∞) • target
assigned :
assignedFrom source e
observed :
assigned.map observeSource
targetX :
(cond full {o | population o = false}).map covariate
{ fullLaw := full assignedLaw := assigned sampleLaw := fun nS nT => (Measure.pi (fun _ : Fin nS => observed)).prod (Measure.pi (fun _ : Fin nT => targetX)) fS := fS fT := fT e := e m := fun A z _ => if A then 1 / 2 else if z then (9 / 16 : ℝ) else 7 / 16 assignmentPotentialOutcome := fun z o => potentialOutcome o (potentialReceipt o z) }
CausalSmith.Stat.TransportCaceRoughnuisanceLength.continuousGeometryWitness · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Mixture.lean:341
CausalSmith.Stat.STAT_TransportCaceRoughnuisanceLength_Research.Helpers.ObservableReduction 1 declarations Combines the observable channel identities with explicit coordinate derivative bounds.

Assembly of the observable marked-density reduction

Combines the observable channel identities with explicit coordinate derivative bounds.

theorem observable_marked_reduction

Given the supplied inputs, the stated result about observable marked reduction holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hf :
0 < c_f ∧ c_f < 1
hF :
1 < C_f
hL :
1 < L
hP :
ModelClass c_f C_f L P n
conclusion 1
i :
Fin 7
B :
Set ℝ
B ⊆ covariateSpace
(∫ x in B, markedDensityVector c_f C_f L P n hP x i)
= if i.val = 0 then (targetXLaw P B).toReal else ∫ o in {o | o.1 ∈ B}, coordinateMark i o ∂sourceObsLaw P
conclusion 2
x ∈ covariateSpace :
c_f / 4 ≤ markedDensityVector c_f C_f L P n hP x 1
c_f / 4 ≤ markedDensityVector c_f C_f L P n hP x 2
conclusion 3
A :
transportedForm P A = ∫ x in (0 : ℝ)..1, Phi A (markedDensityVector c_f C_f L P n hP x)
conclusion 4
A :
v :
Fin 7 → ℝ
k :
Fin 5
dirs :
Fin k.val → Fin 7
|iteratedFDeriv ℝ k.val (Phi A) v (fun j => coordinateBasis (dirs j))|
Proof (Lean source)
lemma observable_marked_reduction (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hf : 0 < c_f ∧ c_f < 1) (hF : 1 < C_f) (hL : 1 < L) (hP : ModelClass c_f C_f L P n) : (∀ i : Fin 7, ∀ B : Set ℝ, MeasurableSet B → B ⊆ covariateSpace → (∫ x in B, markedDensityVector c_f C_f L P n hP x i) = if i.val = 0 then (targetXLaw P B).toReal else ∫ o in {o | o.1 ∈ B}, coordinateMark i o ∂sourceObsLaw P) ∧ (∀ x ∈ covariateSpace, c_f / 4 ≤ markedDensityVector c_f C_f L P n hP x 1 ∧ c_f / 4 ≤ markedDensityVector c_f C_f L P n hP x 2) ∧ (∀ A : Bool, transportedForm P A = ∫ x in (0 : ℝ)..1, Phi A (markedDensityVector c_f C_f L P n hP x)) ∧ (∀ A : Bool, ∀ v : Fin 7 → ℝ, clippingRectangle c_f C_f v → ∀ k : Fin 5, ∀ dirs : Fin k.val → Fin 7, |iteratedFDeriv ℝ k.val (Phi A) v (fun j => coordinateBasis (dirs j))| ≤ fourthDerivativeEnvelope c_f C_f) := by refine ⟨?_, ?_, ?_, ?_⟩ · intro i B hB hsub by_cases hi : i.val = 0 · have hi0 : i = 0 := Fin.ext hi subst i simp only [markedDensityVector, Matrix.cons_val_zero] have hcont : ContinuousOn P.fT covariateSpace := by have hcd := hP.targetHolder.2.1.continuousOn have hmap : ContinuousOn (fun x : ℝ => ![x]) covariateSpace := by fun_prop have hmaps : MapsTo (fun x : ℝ => ![x]) covariateSpace {v : Fin 1 → ℝ | v 0 ∈ covariateSpace} := by intro x hx simpa using hx simpa [Function.comp_def, Matrix.cons_val_zero] using hcd.comp hmap hmaps have hae : AEMeasurable (fun x : ℝ => ofReal (P.fT x)) ((volume.restrict covariateSpace).restrict B) := (hcont.aemeasurable measurableSet_Icc).ennreal_ofReal.restrict have hfinite : ∀ᵐ x ∂(volume.restrict covariateSpace).restrict B, ofReal (P.fT x) < ⊤ := by filter_upwards [] with x; simp have hden := setIntegral_withDensity_eq_setIntegral_toReal_smul₀ (f := fun x : ℝ => ofReal (P.fT x)) (s := B) hae hfinite (fun _ => (1 : ℝ)) hB have hmass : ((targetXLaw P) B).toReal = ∫ x in B, P.fT x := by rw [hP.targetBounds.1] calc (((volume.restrict covariateSpace).withDensity (fun x => ofReal (P.fT x))) B).toReal = ∫ x in B, (1 : ℝ) ∂(volume.restrict covariateSpace).withDensity (fun x => ofReal (P.fT x)) := by simp [Measure.real] _ = ∫ x in B, (ofReal (P.fT x)).toReal • (1 : ℝ) ∂volume := by simpa only [Measure.restrict_restrict_of_subset hsub] using hden _ = ∫ x in B, P.fT x := by apply setIntegral_congr_fun hB intro x hx simp [ENNReal.toReal_ofReal (le_trans hf.1.le (hP.targetBounds.2.1 x (hsub hx)).1)] simpa using hmass.symm · fin_cases i · simp at hi · simpa [markedDensityVector, coordinateMark, boolReal, assignmentMass] using (source_assignment_density c_f C_f L P n hP false B hB hsub).trans (source_assignment_mark_integral P false B hB).symm · simpa [markedDensityVector, coordinateMark, boolReal, assignmentMass] using (source_assignment_density c_f C_f L P n hP true B hB hsub).trans (source_assignment_mark_integral P true B hB).symm · simpa [markedDensityVector, coordinateMark, armValue, assignmentMass, boolReal] using source_marked_arm_density c_f C_f L P n hP true false B hB hsub · simpa [markedDensityVector, coordinateMark, armValue, assignmentMass, boolReal] using source_marked_arm_density c_f C_f L P n hP true true B hB hsub · simpa [markedDensityVector, coordinateMark, armValue, assignmentMass, boolReal] using source_marked_arm_density c_f C_f L P n hP false false B hB hsub · simpa [markedDensityVector, coordinateMark, armValue, assignmentMass, boolReal] using source_marked_arm_density c_f C_f L P n hP false true B hB hsub · intro x hx exact markedDensityVector_assignment_lower_bounds c_f C_f L P n hP x hx · intro A exact transportedForm_eq_integral_Phi_markedDensityVector c_f C_f L P n hP A · intro A v hv k dirs by_cases hk : k.val = 0 · have hk0 : k = 0 := Fin.ext hk subst k simpa [iteratedFDeriv_zero_apply] using Phi_value_abs_le_fourthDerivativeEnvelope c_f C_f hf hF A v hv · by_cases hk1 : k.val = 1 · have hkone : k = 1 := Fin.ext hk1 subst k change Fin 1 → Fin 7 at dirs change |iteratedFDeriv ℝ 1 (Phi A) v (fun j => coordinateBasis (dirs j))| ≤ _ have hdirs : (fun j => coordinateBasis (dirs j)) = ![coordinateBasis (dirs 0)] := by funext j fin_cases j rfl rw [hdirs] exact Phi_first_derivative_abs_le_fourthDerivativeEnvelope c_f C_f hf hF A v hv (dirs 0) · by_cases hk2 : k.val = 2 · have hktwo : k = 2 := Fin.ext hk2 subst k change Fin 2 → Fin 7 at dirs change |iteratedFDeriv ℝ 2 (Phi A) v (fun j => coordinateBasis (dirs j))| ≤ _ have hdirs : (fun j => coordinateBasis (dirs j)) = ![basis (dirs 0), basis (dirs 1)] := by funext j fin_cases j <;> rfl rw [hdirs] exact dPhi2_abs_le c_f C_f hf hF A v hv (dirs 0) (dirs 1) · by_cases hk3 : k.val = 3 · have hkthree : k = 3 := Fin.ext hk3 subst k change Fin 3 → Fin 7 at dirs change |iteratedFDeriv ℝ 3 (Phi A) v (fun j => coordinateBasis (dirs j))| ≤ _ have hdirs : (fun j => coordinateBasis (dirs j)) = ![basis (dirs 0), basis (dirs 1), basis (dirs 2)] := by funext j fin_cases j <;> rfl rw [hdirs] exact dPhi3_abs_le c_f C_f hf hF A v hv (dirs 0) (dirs 1) (dirs 2) · -- The only remaining derivative order is four. have hk4 : k.val = 4 := by omega have hkfour : k = 4 := Fin.ext hk4 subst k change Fin 4 → Fin 7 at dirs change |iteratedFDeriv ℝ 4 (Phi A) v (fun j => coordinateBasis (dirs j))| ≤ _ have hdirs : (fun j => coordinateBasis (dirs j)) = ![basis (dirs 0), basis (dirs 1), basis (dirs 2), basis (dirs 3)] := by funext j fin_cases j <;> rfl rw [hdirs] exact dPhi4_abs_le c_f C_f hf hF A v hv (dirs 0) (dirs 1) (dirs 2) (dirs 3)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.observable_marked_reduction · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/ObservableReduction.lean:15
CausalSmith.Stat.STAT_TransportCaceRoughnuisanceLength_Research.Helpers.Reduction 19 declarations Observable marked-density reduction

Observable marked-density reduction

def clippingRectangle

The clipping rectangle object is defined from the supplied inputs.

Definition (Lean source)
c_f C_f :
ℝ
v :
Fin 7 → ℝ
clippingRectangle c_f C_f v :
Prop
clause 1
v 0 ∈ Icc c_f C_f
clause 2
v 1 ∈ Icc (c_f / 4) (3 * C_f / 4)
clause 3
v 2 ∈ Icc (c_f / 4) (3 * C_f / 4)
clause 4
i :
Fin 7
3 ≤ i.val
v i ∈ Icc 0 (3 * C_f / 4)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.clippingRectangle · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Reduction.lean:12
def coordinateMark

The coordinate mark object is defined from the supplied inputs.

Definition (Lean source)
i :
Fin 7
o :
coordinateMark i o :
ℝ
if i.val
= 1 then boolReal (!o.2.1) else if i.val = 2 then boolReal o.2.1 else if i.val = 3 then boolReal (!o.2.1) * o.2.2.2 else if i.val = 4 then boolReal o.2.1 * o.2.2.2 else if i.val = 5 then boolReal (!o.2.1) * boolReal o.2.2.1 else boolReal o.2.1 * boolReal o.2.2.1
CausalSmith.Stat.TransportCaceRoughnuisanceLength.coordinateMark · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Reduction.lean:19
def coordinateBasis

The coordinate basis object is defined from the supplied inputs.

Definition (Lean source)
i :
Fin 7
coordinateBasis i :
Fin 7 → ℝ
fun j => if j = i then 1 else 0
CausalSmith.Stat.TransportCaceRoughnuisanceLength.coordinateBasis · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Reduction.lean:28
def fourthDerivativeEnvelope

The fourth derivative envelope object is defined from the supplied inputs.

Definition (Lean source)
c_f C_f :
ℝ
fourthDerivativeEnvelope c_f C_f :
ℝ
48 * (1 + C_f) ^ 2 * (4 / c_f) ^ 5
CausalSmith.Stat.TransportCaceRoughnuisanceLength.fourthDerivativeEnvelope · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Reduction.lean:32
theorem coordinateMark_mem_unit_interval Lemma coordinateMark_mem_unit_interval in the paper ↗

Given the supplied inputs, the stated result about coordinate mark mem unit interval holds.

Formal statement
i :
Fin 7
o :
hy :
o.2.2.2 ∈ Icc (0 : ℝ) 1
coordinateMark i o ∈ Icc (0 : ℝ) 1
Proof (Lean source)
lemma coordinateMark_mem_unit_interval (i : Fin 7) (o : SourceObs) (hy : o.2.2.2 ∈ Icc (0 : ℝ) 1) : coordinateMark i o ∈ Icc (0 : ℝ) 1 := by rcases o with ⟨x, z, d, y⟩ cases z <;> cases d <;> fin_cases i <;> simp [coordinateMark, boolReal, Set.mem_Icc] at * <;> constructor <;> nlinarith [hy.1, hy.2]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.coordinateMark_mem_unit_interval · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Reduction.lean:38
theorem markedDensityVector_assignment_lower_bounds

Given the supplied inputs, the stated result about marked density vector assignment lower bounds holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hP :
ModelClass c_f C_f L P n
x :
ℝ
hx :
conclusion 1
c_f / 4 ≤ markedDensityVector c_f C_f L P n hP x 1
conclusion 2
c_f / 4 ≤ markedDensityVector c_f C_f L P n hP x 2
Proof (Lean source)
lemma markedDensityVector_assignment_lower_bounds (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hP : ModelClass c_f C_f L P n) (x : ℝ) (hx : x ∈ covariateSpace) : c_f / 4 ≤ markedDensityVector c_f C_f L P n hP x 1 ∧ c_f / 4 ≤ markedDensityVector c_f C_f L P n hP x 2 := by have hf := (hP.sourceBounds.2.2.2.2.2 x hx).1 have he := hP.overlap x hx dsimp [markedDensityVector] constructor · calc c_f / 4 = c_f * (1 / 4) := by ring _ ≤ P.fS x * (1 / 4) := mul_le_mul_of_nonneg_right hf (by norm_num) _ ≤ P.fS x * (1 - P.e x) := mul_le_mul_of_nonneg_left (by linarith [he.2]) (by linarith [hP.sourceBounds.1.1]) · calc c_f / 4 = c_f * (1 / 4) := by ring _ ≤ P.fS x * (1 / 4) := mul_le_mul_of_nonneg_right hf (by norm_num) _ ≤ P.fS x * P.e x := mul_le_mul_of_nonneg_left he.1 (by linarith [hP.sourceBounds.1.1])
CausalSmith.Stat.TransportCaceRoughnuisanceLength.markedDensityVector_assignment_lower_bounds · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Reduction.lean:47
theorem markedDensityVector_mem_clippingRectangle

Given the supplied inputs, the stated result about marked density vector mem clipping rectangle holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hP :
ModelClass c_f C_f L P n
x :
ℝ
hx :
clippingRectangle c_f C_f (markedDensityVector c_f C_f L P n hP x)
Proof (Lean source)
lemma markedDensityVector_mem_clippingRectangle (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hP : ModelClass c_f C_f L P n) (x : ℝ) (hx : x ∈ covariateSpace) : clippingRectangle c_f C_f (markedDensityVector c_f C_f L P n hP x) := by have hs := hP.sourceBounds.2.2.2.2.2 x hx have ht := hP.targetBounds.2.1 x hx have he := hP.overlap x hx have hm (A z : Bool) := (hP.armHolder.2.1 A z).2.2 x hx have hq := markedDensityVector_assignment_lower_bounds c_f C_f L P n hP x hx have hfs : 0 ≤ P.fS x := le_trans hP.sourceBounds.1.1.le hs.1 have hq0 : 0 ≤ P.fS x * (1 - P.e x) ∧ P.fS x * (1 - P.e x) ≤ 3 * C_f / 4 := by constructor · exact mul_nonneg hfs (by linarith [he.2]) · nlinarith [mul_nonneg (show 0 ≤ C_f - P.fS x by linarith) (show 0 ≤ 1 - P.e x by linarith), mul_nonneg hfs (show 0 ≤ P.e x - 1 / 4 by linarith)] have hq1 : 0 ≤ P.fS x * P.e x ∧ P.fS x * P.e x ≤ 3 * C_f / 4 := by constructor · exact mul_nonneg hfs (by linarith [he.1]) · nlinarith [mul_nonneg (show 0 ≤ C_f - P.fS x by linarith) (show 0 ≤ P.e x by linarith), mul_nonneg hfs (show 0 ≤ 3 / 4 - P.e x by linarith)] have hmark (q m : ℝ) (hq' : 0 ≤ q ∧ q ≤ 3 * C_f / 4) (hm' : m ∈ Icc (0 : ℝ) 1) : q * m ∈ Icc 0 (3 * C_f / 4) := by rcases hm' with ⟨hm0, hm1⟩ constructor · exact mul_nonneg hq'.1 hm0 · calc q * m ≤ q * 1 := mul_le_mul_of_nonneg_left hm1 hq'.1 _ ≤ 3 * C_f / 4 := by simpa using hq'.2 rw [clippingRectangle] refine ⟨ht, ?_, ?_, ?_⟩ · change c_f / 4 ≤ P.fS x * (1 - P.e x) ∧ P.fS x * (1 - P.e x) ≤ 3 * C_f / 4 constructor · exact hq.1 · exact hq0.2 · change c_f / 4 ≤ P.fS x * P.e x ∧ P.fS x * P.e x ≤ 3 * C_f / 4 constructor · exact hq.2 · exact hq1.2 · intro i hi fin_cases i <;> simp_all [markedDensityVector, Set.mem_Icc]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.markedDensityVector_mem_clippingRectangle · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Reduction.lean:70
theorem Phi_markedDensityVector_eq_transport_integrand

Given the supplied inputs, the stated result about phi marked density vector eq transport integrand holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hP :
ModelClass c_f C_f L P n
A :
x :
ℝ
hx :
Phi A (markedDensityVector c_f C_f L P n hP x) = P.fT x * armContrast P A x
Proof (Lean source)
lemma Phi_markedDensityVector_eq_transport_integrand (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hP : ModelClass c_f C_f L P n) (A : Bool) (x : ℝ) (hx : x ∈ covariateSpace) : Phi A (markedDensityVector c_f C_f L P n hP x) = P.fT x * armContrast P A x := by have hq := markedDensityVector_assignment_lower_bounds c_f C_f L P n hP x hx have hq0 : P.fS x * (1 - P.e x) ≠ 0 := by apply ne_of_gt have hc := hP.sourceBounds.1.1 dsimp [markedDensityVector] at hq linarith [hq.1] have hq1 : P.fS x * P.e x ≠ 0 := by apply ne_of_gt have hc := hP.sourceBounds.1.1 dsimp [markedDensityVector] at hq linarith [hq.2] have hfs : P.fS x ≠ 0 := (mul_ne_zero_iff.mp hq1).1 have he1 : P.e x ≠ 0 := (mul_ne_zero_iff.mp hq1).2 have he0 : 1 - P.e x ≠ 0 := (mul_ne_zero_iff.mp hq0).2 cases A <;> simp [Phi, markedDensityVector, armContrast] <;> field_simp [hfs, he0, he1] <;> ring <;> simp
CausalSmith.Stat.TransportCaceRoughnuisanceLength.Phi_markedDensityVector_eq_transport_integrand · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Reduction.lean:121
theorem transportedForm_eq_integral_Phi_markedDensityVector

Given the supplied inputs, the stated result about transported form eq integral phi marked density vector holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hP :
ModelClass c_f C_f L P n
A :
transportedForm P A = ∫ x in (0 : ℝ)..1, Phi A (markedDensityVector c_f C_f L P n hP x)
Proof (Lean source)
lemma transportedForm_eq_integral_Phi_markedDensityVector (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hP : ModelClass c_f C_f L P n) (A : Bool) : transportedForm P A = ∫ x in (0 : ℝ)..1, Phi A (markedDensityVector c_f C_f L P n hP x) := by have hpoint : ∀ x ∈ covariateSpace, Phi A (markedDensityVector c_f C_f L P n hP x) = P.fT x * armContrast P A x := by intro x hx exact Phi_markedDensityVector_eq_transport_integrand c_f C_f L P n hP A x hx rw [transportedForm, covariateSpace, integral_Icc_eq_integral_Ioc, ← intervalIntegral.integral_of_le (show (0 : ℝ) ≤ 1 by norm_num)] apply intervalIntegral.integral_congr intro x hx exact (hpoint x (by simpa [covariateSpace] using hx)).symm
CausalSmith.Stat.TransportCaceRoughnuisanceLength.transportedForm_eq_integral_Phi_markedDensityVector · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Reduction.lean:145
theorem source_marked_arm_integral

Given the supplied inputs, the stated result about source marked arm integral holds.

Formal statement
A z :
B :
Set ℝ
hB :
(∫ o in {o : SourceObs | o.1 ∈ B}, (if o.2.1 = z then (1 : ℝ) else 0) * armValue A o ∂sourceObsLaw P)
= ∫ o in {o : SourceObs | o.1 ∈ B ∧ o.2.1 = z}, armValue A o ∂sourceObsLaw P
Proof (Lean source)
lemma source_marked_arm_integral (P : TransportLaw) (A z : Bool) (B : Set ℝ) (hB : MeasurableSet B) : (∫ o in {o : SourceObs | o.1 ∈ B}, (if o.2.1 = z then (1 : ℝ) else 0) * armValue A o ∂sourceObsLaw P) = ∫ o in {o : SourceObs | o.1 ∈ B ∧ o.2.1 = z}, armValue A o ∂sourceObsLaw P := by let Z : Set SourceObs := {o | o.2.1 = z} have hZ : MeasurableSet Z := by dsimp [Z] measurability have hpoint : (fun o : SourceObs => (if o.2.1 = z then (1 : ℝ) else 0) * armValue A o) = Z.indicator (armValue A) := by funext o by_cases ho : o.2.1 = z <;> simp [Z, indicator, ho] rw [hpoint, setIntegral_indicator hZ] congr 1
CausalSmith.Stat.TransportCaceRoughnuisanceLength.source_marked_arm_integral · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Reduction.lean:163
theorem source_marked_arm_density

Given the supplied inputs, the stated result about source marked arm density holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hP :
ModelClass c_f C_f L P n
A z :
B :
Set ℝ
hB :
hsub :
(∫ x in B, P.fS x * assignmentMass P z x * P.m A z x)
= ∫ o in {o : SourceObs | o.1 ∈ B}, (if o.2.1 = z then (1 : ℝ) else 0) * armValue A o ∂sourceObsLaw P
Proof (Lean source)
lemma source_marked_arm_density (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hP : ModelClass c_f C_f L P n) (A z : Bool) (B : Set ℝ) (hB : MeasurableSet B) (hsub : B ⊆ covariateSpace) : (∫ x in B, P.fS x * assignmentMass P z x * P.m A z x) = ∫ o in {o : SourceObs | o.1 ∈ B}, (if o.2.1 = z then (1 : ℝ) else 0) * armValue A o ∂sourceObsLaw P := by rw [source_marked_arm_integral P A z B hB] exact (hP.armHolder.2.2 A z B hB hsub).symm
CausalSmith.Stat.TransportCaceRoughnuisanceLength.source_marked_arm_density · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Reduction.lean:183
theorem measurable_assignmentMassOnCovariate

Given the supplied inputs, the stated result about measurable assignment mass on covariate holds.

Formal statement
Measurable (covariateSpace.indicator (assignmentMass P z))
Proof (Lean source)
lemma measurable_assignmentMassOnCovariate (P : TransportLaw) (z : Bool) (he : MeasurableOnCovariate P.e) : Measurable (covariateSpace.indicator (assignmentMass P z)) := by cases z · have hone : Measurable (covariateSpace.indicator (fun _ : ℝ => (1 : ℝ))) := measurable_const.indicator measurableSet_Icc have hpoint : covariateSpace.indicator (assignmentMass P false) = fun x => covariateSpace.indicator (fun _ : ℝ => (1 : ℝ)) x - covariateSpace.indicator P.e x := by funext x by_cases hx : x ∈ covariateSpace <;> simp [assignmentMass, indicator, hx] rw [hpoint] exact hone.sub he · exact he
CausalSmith.Stat.TransportCaceRoughnuisanceLength.measurable_assignmentMassOnCovariate · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Reduction.lean:192
theorem source_assignment_density

Given the supplied inputs, the stated result about source assignment density holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hP :
ModelClass c_f C_f L P n
z :
B :
Set ℝ
hB :
hsub :
(∫ x in B, P.fS x * assignmentMass P z x)
= ((sourceObsLaw P) {o : SourceObs | o.1 ∈ B ∧ o.2.1 = z}).toReal
Proof (Lean source)
lemma source_assignment_density (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hP : ModelClass c_f C_f L P n) (z : Bool) (B : Set ℝ) (hB : MeasurableSet B) (hsub : B ⊆ covariateSpace) : (∫ x in B, P.fS x * assignmentMass P z x) = ((sourceObsLaw P) {o : SourceObs | o.1 ∈ B ∧ o.2.1 = z}).toReal := by have hcov : Measurable (covariate : FullData → ℝ) := by unfold covariate fun_prop have hobs : Measurable (observeSource : Assigned → SourceObs) := by unfold observeSource covariate fun_prop have hXLaw : sourceXLaw P = (populationLaw P true).map covariate := by calc sourceXLaw P = P.assignedLaw.map (fun o : Assigned => covariate o.1) := by rw [sourceXLaw, sourceObsLaw, Measure.map_map (by fun_prop) hobs] rfl _ = (P.assignedLaw.map fst).map covariate := by rw [Measure.map_map hcov (by fun_prop)] rfl _ = (populationLaw P true).map covariate := by rw [hP.randomized.2.2.1] have hmass : ((sourceObsLaw P) {o : SourceObs | o.1 ∈ B ∧ o.2.1 = z}).toReal = ∫ o in {o : FullData | covariate o ∈ B}, assignmentMass P z (covariate o) ∂populationLaw P true := by have hset : MeasurableSet {o : SourceObs | o.1 ∈ B ∧ o.2.1 = z} := by measurability have hfull : MeasurableSet {o : FullData | covariate o ∈ B} := hB.preimage hcov calc _ = (P.assignedLaw {o : Assigned | o.1 ∈ {o : FullData | covariate o ∈ B} ∧ o.2.1 = z}).toReal := by rw [sourceObsLaw, Measure.map_apply hobs hset] congr 1 _ = _ := hP.randomized.2.2.2 _ hfull z let assignmentMassOnCovariate : ℝ → ℝ := covariateSpace.indicator (assignmentMass P z) have hmeas : Measurable assignmentMassOnCovariate := by exact measurable_assignmentMassOnCovariate P z hP.randomized.2.1 have hmap : (∫ o in {o : FullData | covariate o ∈ B}, assignmentMass P z (covariate o) ∂populationLaw P true) = ∫ x in B, assignmentMass P z x ∂sourceXLaw P := by rw [hXLaw] calc _ = ∫ o in {o : FullData | covariate o ∈ B}, assignmentMassOnCovariate (covariate o) ∂populationLaw P true := by apply setIntegral_congr_fun exact hB.preimage hcov intro o ho simp [assignmentMassOnCovariate, indicator, hsub ho] _ = ∫ x in B, assignmentMassOnCovariate x ∂Measure.map covariate (populationLaw P true) := (setIntegral_map hB hmeas.aestronglyMeasurable hcov.aemeasurable).symm _ = _ := by apply setIntegral_congr_fun hB intro x hx simp [assignmentMassOnCovariate, indicator, hsub hx] have hcont : ContinuousOn P.fS covariateSpace := by have hcd := hP.sourceHolder.2.1.continuousOn have hmap' : ContinuousOn (fun x : ℝ => ![x]) covariateSpace := by fun_prop have hmaps : MapsTo (fun x : ℝ => ![x]) covariateSpace {v : Fin 1 → ℝ | v 0 ∈ covariateSpace} := by intro x hx simpa using hx simpa [Function.comp_def, Matrix.cons_val_zero] using hcd.comp hmap' hmaps have hae : AEMeasurable (fun x : ℝ => ofReal (P.fS x)) ((volume.restrict covariateSpace).restrict B) := (hcont.aemeasurable measurableSet_Icc).ennreal_ofReal.restrict have hfinite : ∀ᵐ x ∂(volume.restrict covariateSpace).restrict B, ofReal (P.fS x) < ⊤ := by filter_upwards [] with x; simp have hden := setIntegral_withDensity_eq_setIntegral_toReal_smul₀ (f := fun x : ℝ => ofReal (P.fS x)) (s := B) hae hfinite (assignmentMass P z) hB have hdensity : (∫ x in B, assignmentMass P z x ∂sourceXLaw P) = ∫ x in B, P.fS x * assignmentMass P z x := by rw [hP.sourceBounds.2.2.2.2.1] calc _ = ∫ x in B, (ofReal (P.fS x)).toReal • assignmentMass P z x ∂volume := by simpa only [Measure.restrict_restrict_of_subset hsub] using hden _ = _ := by apply setIntegral_congr_fun hB intro x hx simp [ENNReal.toReal_ofReal (le_trans hP.sourceBounds.1.1.le (hP.sourceBounds.2.2.2.2.2 x (hsub hx)).1)] exact (hdensity.symm.trans hmap.symm).trans hmass.symm
CausalSmith.Stat.TransportCaceRoughnuisanceLength.source_assignment_density · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Reduction.lean:211
theorem source_assignment_mark_integral

Given the supplied inputs, the stated result about source assignment mark integral holds.

Formal statement
z :
B :
Set ℝ
hB :
(∫ o in {o : SourceObs | o.1 ∈ B}, if o.2.1 = z then (1 : ℝ) else 0 ∂sourceObsLaw P)
= ((sourceObsLaw P) {o : SourceObs | o.1 ∈ B ∧ o.2.1 = z}).toReal
Proof (Lean source)
lemma source_assignment_mark_integral (P : TransportLaw) (z : Bool) (B : Set ℝ) (hB : MeasurableSet B) : (∫ o in {o : SourceObs | o.1 ∈ B}, if o.2.1 = z then (1 : ℝ) else 0 ∂sourceObsLaw P) = ((sourceObsLaw P) {o : SourceObs | o.1 ∈ B ∧ o.2.1 = z}).toReal := by let Z : Set SourceObs := {o | o.2.1 = z} have hZ : MeasurableSet Z := by dsimp [Z]; measurability have hpoint : (fun o : SourceObs => if o.2.1 = z then (1 : ℝ) else 0) = Z.indicator (fun _ => (1 : ℝ)) := by funext o by_cases ho : o.2.1 = z <;> simp [Z, indicator, ho] rw [hpoint, setIntegral_indicator hZ] have hS : MeasurableSet {o : SourceObs | o.1 ∈ B ∧ o.2.1 = z} := by measurability rw [setIntegral_one_eq_measureReal] congr 1
CausalSmith.Stat.TransportCaceRoughnuisanceLength.source_assignment_mark_integral · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Reduction.lean:300
theorem Phi_value_abs_le_fourthDerivativeEnvelope

Given the supplied inputs, the stated result about phi value abs le fourth derivative envelope holds.

Formal statement
c_f C_f :
ℝ
hf :
0 < c_f ∧ c_f < 1
hF :
1 < C_f
A :
v :
Fin 7 → ℝ
hv :
|Phi A v| ≤ fourthDerivativeEnvelope c_f C_f
Proof (Lean source)
lemma Phi_value_abs_le_fourthDerivativeEnvelope (c_f C_f : ℝ) (hf : 0 < c_f ∧ c_f < 1) (hF : 1 < C_f) (A : Bool) (v : Fin 7 → ℝ) (hv : clippingRectangle c_f C_f v) : |Phi A v| ≤ fourthDerivativeEnvelope c_f C_f := by let R : ℝ := 4 / c_f have hR : 1 ≤ R := by dsimp [R]; apply (le_div_iff₀ hf.1).2; linarith have hR0 : 0 ≤ R := le_trans (by norm_num) hR have hC : 0 ≤ 1 + C_f := by linarith have h0 := hv.1 have h1 := hv.2.1 have h2 := hv.2.2.1 have hmark (j : Fin 7) (hj : 3 ≤ j.val) := hv.2.2.2 j hj have hr (j q : Fin 7) (hj : 3 ≤ j.val) (hq : c_f / 4 ≤ v q) : 0 ≤ v 0 * v j / v q ∧ v 0 * v j / v q ≤ (1 + C_f) ^ 2 * R := by have hq0 : 0 < v q := by linarith have hj' := hmark j hj constructor · exact div_nonneg (mul_nonneg (le_trans hf.1.le h0.1) hj'.1) hq0.le · apply (div_le_iff₀ hq0).2 have hqR : 1 ≤ v q * R := by calc 1 = (c_f / 4) * R := by dsimp [R]; field_simp [ne_of_gt hf.1] _ ≤ v q * R := mul_le_mul_of_nonneg_right hq hR0 have hprod : v 0 * v j ≤ (1 + C_f) ^ 2 := by have hleft : v 0 ≤ 1 + C_f := by linarith [h0.2] have hright : v j ≤ 1 + C_f := by linarith [hj'.2] calc v 0 * v j ≤ (1 + C_f) * (1 + C_f) := by exact mul_le_mul hleft hright hj'.1 hC _ = (1 + C_f) ^ 2 := by ring nlinarith [mul_le_mul_of_nonneg_left hqR (sq_nonneg (1 + C_f))] have hp := hr (if A then 4 else 6) 2 (by cases A <;> decide) h2.1 have hm := hr (if A then 3 else 5) 1 (by cases A <;> decide) h1.1 have hpow : R ≤ R ^ 5 := by calc R = R * 1 := by ring _ ≤ R * R ^ 4 := mul_le_mul_of_nonneg_left (one_le_pow₀ hR) hR0 _ = R ^ 5 := by ring have hfinal : 2 * ((1 + C_f) ^ 2 * R) ≤ 48 * (1 + C_f) ^ 2 * R ^ 5 := by nlinarith [mul_nonneg (sq_nonneg (1 + C_f)) (sub_nonneg.mpr hpow)] unfold Phi fourthDerivativeEnvelope change |v 0 * (v (if A then 4 else 6) / v 2 - v (if A then 3 else 5) / v 1)| ≤ _ rw [mul_sub, ← mul_div_assoc, ← mul_div_assoc] rw [abs_le] constructor <;> dsimp [R] at * <;> nlinarith [hp.1, hp.2, hm.1, hm.2]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.Phi_value_abs_le_fourthDerivativeEnvelope · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Reduction.lean:319
theorem fderiv_marked_arm_ratio_apply Lemma fderiv_marked_arm_ratio_apply in the paper ↗

The derivative of one arm contribution, evaluated along an arbitrary direction. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
a b q :
Fin 7
v h :
Fin 7 → ℝ
hq :
v q ≠ 0
fderiv ℝ (fun y : Fin 7 → ℝ => y a * y b * (y q)⁻¹) v h
= (h a * v b + v a * h b) * (v q)⁻¹ - v a * v b * h q * (v q)⁻¹ ^ 2
Proof (Lean source)
-- @node: fderiv_marked_arm_ratio_apply lemma fderiv_marked_arm_ratio_apply (a b q : Fin 7) (v h : Fin 7 → ℝ) (hq : v q ≠ 0) : fderiv ℝ (fun y : Fin 7 → ℝ => y a * y b * (y q)⁻¹) v h = (h a * v b + v a * h b) * (v q)⁻¹ - v a * v b * h q * (v q)⁻¹ ^ 2 := by have ha := (ContinuousLinearMap.proj a : (Fin 7 → ℝ) →L[ℝ] ℝ).hasFDerivAt (x := v) have hb := (ContinuousLinearMap.proj b : (Fin 7 → ℝ) →L[ℝ] ℝ).hasFDerivAt (x := v) have hq' := (ContinuousLinearMap.proj q : (Fin 7 → ℝ) →L[ℝ] ℝ).hasFDerivAt (x := v) have hi := (hasFDerivAt_inv hq).comp v hq' have hd := (ha.mul hb).mul hi change HasFDerivAt (fun y : Fin 7 → ℝ => y a * y b * (y q)⁻¹) _ v at hd rw [hd.fderiv] simp [Function.comp_apply, ContinuousLinearMap.toSpanSingleton_apply, inv_pow] ring
CausalSmith.Stat.TransportCaceRoughnuisanceLength.fderiv_marked_arm_ratio_apply · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Reduction.lean:371
theorem iteratedFDeriv_one_Phi_apply

The first derivative of the transport integrand is the difference of the two arm derivatives. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
A :
v h :
Fin 7 → ℝ
h1 :
v 1 ≠ 0
h2 :
v 2 ≠ 0
iteratedFDeriv ℝ 1 (Phi A) v ![h]
= ((h 0 * v (if A then 4 else 6) + v 0 * h (if A then 4 else 6)) * (v 2)⁻¹ - v 0 * v (if A then 4 else 6) * h 2 * (v 2)⁻¹ ^ 2)
- ((h 0 * v (if A then 3 else 5) + v 0 * h (if A then 3 else 5)) * (v 1)⁻¹ - v 0 * v (if A then 3 else 5) * h 1 * (v 1)⁻¹ ^ 2)
Proof (Lean source)
-- @node: iteratedFDeriv_one_Phi_apply lemma iteratedFDeriv_one_Phi_apply (A : Bool) (v h : Fin 7 → ℝ) (h1 : v 1 ≠ 0) (h2 : v 2 ≠ 0) : iteratedFDeriv ℝ 1 (Phi A) v ![h] = ((h 0 * v (if A then 4 else 6) + v 0 * h (if A then 4 else 6)) * (v 2)⁻¹ - v 0 * v (if A then 4 else 6) * h 2 * (v 2)⁻¹ ^ 2) - ((h 0 * v (if A then 3 else 5) + v 0 * h (if A then 3 else 5)) * (v 1)⁻¹ - v 0 * v (if A then 3 else 5) * h 1 * (v 1)⁻¹ ^ 2) := by have hp : DifferentiableAt ℝ (fun y : Fin 7 → ℝ => y 0 * y (if A then 4 else 6) * (y 2)⁻¹) v := by fun_prop have hm : DifferentiableAt ℝ (fun y : Fin 7 → ℝ => y 0 * y (if A then 3 else 5) * (y 1)⁻¹) v := by fun_prop have heq : Phi A = (fun y : Fin 7 → ℝ => y 0 * y (if A then 4 else 6) * (y 2)⁻¹) - (fun y : Fin 7 → ℝ => y 0 * y (if A then 3 else 5) * (y 1)⁻¹) := by funext y simp [Phi, div_eq_mul_inv] ring rw [iteratedFDeriv_one_apply, heq, fderiv_sub hp hm, ContinuousLinearMap.sub_apply] simp only [Matrix.cons_val_zero] rw [ fderiv_marked_arm_ratio_apply _ _ _ v h h2, fderiv_marked_arm_ratio_apply _ _ _ v h h1]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.iteratedFDeriv_one_Phi_apply · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Reduction.lean:388
theorem marked_arm_first_derivative_abs_le Lemma marked_arm_first_derivative_abs_le in the paper ↗

Bounded coordinate directions give a uniform first derivative bound for one arm. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
t r q dt dr dq C R :
ℝ
hC :
1 ≤ C
hR :
1 ≤ R
ht :
|t| ≤ C
hr :
|r| ≤ C
hq :
|q⁻¹| ≤ R
hdt :
|dt| ≤ 1
hdr :
|dr| ≤ 1
hdq :
|dq| ≤ 1
|(dt * r + t * dr) * q⁻¹ - t * r * dq * q⁻¹ ^ 2| ≤ 3 * (1 + C) ^ 2 * R ^ 2
Proof (Lean source)
-- @node: marked_arm_first_derivative_abs_le lemma marked_arm_first_derivative_abs_le (t r q dt dr dq C R : ℝ) (hC : 1 ≤ C) (hR : 1 ≤ R) (ht : |t| ≤ C) (hr : |r| ≤ C) (hq : |q⁻¹| ≤ R) (hdt : |dt| ≤ 1) (hdr : |dr| ≤ 1) (hdq : |dq| ≤ 1) : |(dt * r + t * dr) * q⁻¹ - t * r * dq * q⁻¹ ^ 2| ≤ 3 * (1 + C) ^ 2 * R ^ 2 := by have hC0 : 0 ≤ C := by linarith have hR0 : 0 ≤ R := by linarith have hlinear : |dt * r + t * dr| ≤ 2 * C := by calc _ ≤ |dt| * |r| + |t| * |dr| := by simpa only [abs_mul] using abs_add_le (dt * r) (t * dr) _ ≤ 1 * C + C * 1 := add_le_add (mul_le_mul hdt hr (abs_nonneg _) (by norm_num)) (mul_le_mul ht hdr (abs_nonneg _) hC0) _ = 2 * C := by ring have hterm1 : |(dt * r + t * dr) * q⁻¹| ≤ 2 * C * R := by rw [abs_mul] exact mul_le_mul hlinear hq (abs_nonneg _) (by positivity) have hterm2 : |t * r * dq * q⁻¹ ^ 2| ≤ C ^ 2 * R ^ 2 := by simp only [abs_mul, abs_pow] have htr := mul_le_mul ht hr (abs_nonneg _) hC0 have htrq := mul_le_mul htr hdq (abs_nonneg _) (mul_nonneg hC0 hC0) have hp := pow_le_pow_left₀ (abs_nonneg (q⁻¹)) hq 2 simpa only [mul_one, ← sq] using mul_le_mul htrq hp (by positivity) (by positivity) have hRR : R ≤ R ^ 2 := by nlinarith have hCC : C ≤ (1 + C) ^ 2 := by nlinarith have hCC2 : C ^ 2 ≤ (1 + C) ^ 2 := by nlinarith have hterm1' : 2 * C * R ≤ 2 * (1 + C) ^ 2 * R ^ 2 := by exact mul_le_mul (by nlinarith : 2 * C ≤ 2 * (1 + C) ^ 2) hRR hR0 (by positivity) have hterm2' := mul_le_mul_of_nonneg_right hCC2 (sq_nonneg R) exact (abs_sub _ _).trans (by nlinarith [hterm1, hterm2])
CausalSmith.Stat.TransportCaceRoughnuisanceLength.marked_arm_first_derivative_abs_le · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Reduction.lean:415
theorem Phi_first_derivative_abs_le_fourthDerivativeEnvelope

The first coordinate derivative uses exactly the deterministic envelope from the reduction. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f :
ℝ
hf :
0 < c_f ∧ c_f < 1
hF :
1 < C_f
A :
v :
Fin 7 → ℝ
hv :
i :
Fin 7
Proof (Lean source)
-- @node: Phi_first_derivative_abs_le_fourthDerivativeEnvelope lemma Phi_first_derivative_abs_le_fourthDerivativeEnvelope (c_f C_f : ℝ) (hf : 0 < c_f ∧ c_f < 1) (hF : 1 < C_f) (A : Bool) (v : Fin 7 → ℝ) (hv : clippingRectangle c_f C_f v) (i : Fin 7) : |iteratedFDeriv ℝ 1 (Phi A) v ![coordinateBasis i]| ≤ fourthDerivativeEnvelope c_f C_f := by let R := 4 / c_f have hR : 1 ≤ R := by dsimp [R]; apply (le_div_iff₀ hf.1).2; linarith have ht : |v 0| ≤ C_f := by rw [abs_of_nonneg (le_trans hf.1.le hv.1.1)] exact hv.1.2 have hr (j : Fin 7) (hj : 3 ≤ j.val) : |v j| ≤ C_f := by have h := hv.2.2.2 j hj rw [abs_of_nonneg h.1] linarith [h.2] have hq (j : Fin 7) (hj : c_f / 4 ≤ v j) : v j ≠ 0 ∧ |(v j)⁻¹| ≤ R := by have hj0 : 0 < v j := by linarith refine ⟨ne_of_gt hj0, ?_⟩ rw [abs_of_nonneg (inv_pos.mpr hj0).le] calc (v j)⁻¹ ≤ (c_f / 4)⁻¹ := (inv_le_inv₀ hj0 (div_pos hf.1 (by norm_num))).2 hj _ = R := by dsimp [R]; ring have h1 := hq 1 hv.2.1.1 have h2 := hq 2 hv.2.2.1.1 have hd (j : Fin 7) : |coordinateBasis i j| ≤ 1 := by by_cases hji : j = i <;> simp [coordinateBasis, hji] rw [iteratedFDeriv_one_Phi_apply A v (coordinateBasis i) h1.1 h2.1] have hp := marked_arm_first_derivative_abs_le (v 0) (v (if A then 4 else 6)) (v 2) _ _ _ C_f R hF.le hR ht (hr _ (by cases A <;> decide)) h2.2 (hd 0) (hd (if A then 4 else 6)) (hd 2) have hm := marked_arm_first_derivative_abs_le (v 0) (v (if A then 3 else 5)) (v 1) _ _ _ C_f R hF.le hR ht (hr _ (by cases A <;> decide)) h1.2 (hd 0) (hd (if A then 3 else 5)) (hd 1) have hpowers : R ^ 2 ≤ R ^ 5 := by calc R ^ 2 = R ^ 2 * 1 := by ring _ ≤ R ^ 2 * R ^ 3 := mul_le_mul_of_nonneg_left (one_le_pow₀ hR) (sq_nonneg R) _ = R ^ 5 := by ring have hscale := mul_le_mul_of_nonneg_left hpowers (sq_nonneg (1 + C_f)) unfold fourthDerivativeEnvelope change _ ≤ 48 * (1 + C_f) ^ 2 * R ^ 5 exact (abs_sub _ _).trans (by nlinarith [hp, hm, mul_nonneg (sq_nonneg (1 + C_f)) (sq_nonneg R)])
CausalSmith.Stat.TransportCaceRoughnuisanceLength.Phi_first_derivative_abs_le_fourthDerivativeEnvelope · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/Reduction.lean:448
CausalSmith.Stat.STAT_TransportCaceRoughnuisanceLength_Research.Helpers.ScoreMeasurability 2 declarations Joint pilot measurability, measurable derivatives, and parameter integration make the exact score measurable.

Measurability of the exact cubic score interval

Joint pilot measurability, measurable derivatives, and parameter integration make the exact score measurable. An explicit affine witness characterizes the nonempty inversion event, including its boundary, and justifies the fallback.

theorem measurable_cubicEstimator

Given the supplied inputs, the stated result about measurable cubic estimator holds.

Formal statement
c_f C_f :
ℝ
n :
ℕ
A :
Measurable (fun ω : TwoSample n n => cubicEstimator c_f C_f ω A)
Proof (Lean source)
@[fun_prop] -- @node: measurable_cubicEstimator lemma measurable_cubicEstimator (c_f C_f : ℝ) (n : ℕ) (A : Bool) : Measurable (fun ω : TwoSample n n => cubicEstimator c_f C_f ω A) := by have hd1 (i : Fin 7) : Measurable (fun v : Fin 7 → ℝ => dPhi1 A v i) := by unfold dPhi1 fun_prop have hd2 (i j : Fin 7) : Measurable (fun v : Fin 7 → ℝ => dPhi2 A v i j) := by unfold dPhi2 rw [iteratedFDeriv_succ_eq_comp_left] fun_prop have hd3 (i j k : Fin 7) : Measurable (fun v : Fin 7 → ℝ => dPhi3 A v i j k) := by unfold dPhi3 rw [iteratedFDeriv_succ_eq_comp_left] fun_prop have hp : Measurable (fun ω : TwoSample n n => pilotIntegral c_f C_f ω A) := by have hj : Measurable (fun p : TwoSample n n × ℝ => Phi A (pilot c_f C_f p.1 p.2)) := by unfold Phi fun_prop simp only [pilotIntegral, intervalIntegral.integral_of_le (by norm_num : (0 : ℝ) ≤ 1)] exact hj.stronglyMeasurable.integral_prod_right.measurable have hi (i : Fin 7) : Measurable (fun ω : TwoSample n n => ∫ x in (0 : ℝ)..1, dPhi1 A (pilot c_f C_f ω x) i * pilot c_f C_f ω x i) := by have hj : Measurable (fun p : TwoSample n n × ℝ => dPhi1 A (pilot c_f C_f p.1 p.2) i * pilot c_f C_f p.1 p.2 i) := by fun_prop simp only [intervalIntegral.integral_of_le (by norm_num : (0 : ℝ) ≤ 1)] exact hj.stronglyMeasurable.integral_prod_right.measurable unfold cubicEstimator linearTerm quadraticTerm cubicTerm residual dsimp only split_ifs <;> fun_prop
CausalSmith.Stat.TransportCaceRoughnuisanceLength.measurable_cubicEstimator · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/ScoreMeasurability.lean:20
theorem scoreInterval_measurableSet_graph

The concrete affine inversion and its fallback have a measurable graph. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
α c_f C_f L :
ℝ
n :
ℕ
hα :
0 < α ∧ α < 1
hf :
0 < c_f ∧ c_f < 1
hF :
1 < C_f
hL :
1 < L
MeasurableSet {p : TwoSample n n × ℝ | p.2 ∈ scoreInterval α c_f C_f L p.1}
Proof (Lean source)
-- @node: scoreInterval_measurableSet_graph lemma scoreInterval_measurableSet_graph (α c_f C_f L : ℝ) (n : ℕ) (hα : 0 < α ∧ α < 1) (hf : 0 < c_f ∧ c_f < 1) (hF : 1 < C_f) (hL : 1 < L) : MeasurableSet {p : TwoSample n n × ℝ | p.2 ∈ scoreInterval α c_f C_f L p.1} := by classical have hnonempty : MeasurableSet {ω : TwoSample n n | (scoreInversion α c_f C_f L ω).Nonempty} := by simp only [scoreInversion, parameterSpace, affineInterval_nonempty_iff] have ha := (measurable_cubicEstimator c_f C_f n true).norm have hb := (measurable_cubicEstimator c_f C_f n false).norm simpa only [Real.norm_eq_abs, Pi.add_apply, Set.inter_def, Set.mem_ofPred_eq] using (MeasurableSet.const (0 ≤ 2 * scoreRadius α c_f C_f L n)).inter (measurableSet_le ha (hb.add measurable_const)) have hinversion : MeasurableSet {p : TwoSample n n × ℝ | p.2 ∈ scoreInversion α c_f C_f L p.1} := by unfold scoreInversion Causalean.Stat.affineInversionSet have hs : Measurable (fun p : TwoSample n n × ℝ => |cubicEstimator c_f C_f p.1 true - p.2 * cubicEstimator c_f C_f p.1 false|) := by simpa only [Real.norm_eq_abs, Pi.sub_apply, Pi.mul_apply, Function.comp_apply] using (((measurable_cubicEstimator c_f C_f n true).comp measurable_fst).sub (measurable_snd.mul ((measurable_cubicEstimator c_f C_f n false).comp measurable_fst))).norm exact (measurableSet_Icc.preimage measurable_snd).inter (measurableSet_le hs measurable_const) by_cases hn : n < threshold · simp only [scoreInterval, if_pos hn] exact measurableSet_Icc.preimage measurable_snd · have heq : {p : TwoSample n n × ℝ | p.2 ∈ scoreInterval α c_f C_f L p.1} = ((fst ⁻¹' {ω | (scoreInversion α c_f C_f L ω).Nonempty}) ∩ {p | p.2 ∈ scoreInversion α c_f C_f L p.1}) ∪ ((fst ⁻¹' {ω | (scoreInversion α c_f C_f L ω).Nonempty})ᶜ ∩ {p | p.2 = 0}) := by ext p simp only [Set.mem_ofPred_eq, scoreInterval, if_neg hn] split_ifs <;> simp_all rw [heq] exact ((hnonempty.preimage measurable_fst).inter hinversion).union ((hnonempty.preimage measurable_fst).compl.inter (measurableSet_eq_fun measurable_snd measurable_const))
CausalSmith.Stat.TransportCaceRoughnuisanceLength.scoreInterval_measurableSet_graph · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/ScoreMeasurability.lean:54
CausalSmith.Stat.STAT_TransportCaceRoughnuisanceLength_Research.Helpers.UpperGeometry 6 declarations These lemmas implement the coverage event, the zero-volume fallback, the good-slope length bound (1), and the final two-regime calculation in the honest-upper roadmap.

Deterministic steps of the honest upper bound

These lemmas implement the coverage event, the zero-volume fallback, the good-slope length bound (1), and the final two-regime calculation in the honest-upper roadmap. The probabilistic moment and tail steps remain separate.

The calibrated radius is nonnegative for every sample size. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
α c_f C_f L :
ℝ
n :
ℕ
0 ≤ scoreRadius α c_f C_f L n
Proof (Lean source)
-- @node: scoreRadius_nonneg lemma scoreRadius_nonneg (α c_f C_f L : ℝ) (n : ℕ) : 0 ≤ scoreRadius α c_f C_f L n := by unfold scoreRadius exact mul_nonneg (Real.sqrt_nonneg _) (Real.rpow_nonneg (Nat.cast_nonneg _) _)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.scoreRadius_nonneg · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/UpperGeometry.lean:21
theorem targetCACE_mem_scoreInterval_of_errors

Identification turns simultaneous reduced-form error bounds into inclusion of the true parameter in the exact interval, including the finite-size rule. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
α c_f C_f L :
ℝ
n :
ℕ
hf :
0 < c_f ∧ c_f < 1
hF :
1 < C_f
hL :
1 < L
hP :
ModelClass c_f C_f L P n
ω :
hY :
|cubicEstimator c_f C_f ω true - transportedForm P true| ≤ scoreRadius α c_f C_f L n
hD :
|cubicEstimator c_f C_f ω false - firstStage P| ≤ scoreRadius α c_f C_f L n
targetCACE P ∈ scoreInterval α c_f C_f L ω
Proof (Lean source)
-- @node: targetCACE_mem_scoreInterval_of_errors lemma targetCACE_mem_scoreInterval_of_errors (α c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hf : 0 < c_f ∧ c_f < 1) (hF : 1 < C_f) (hL : 1 < L) (hP : ModelClass c_f C_f L P n) (ω : TwoSample n n) (hY : |cubicEstimator c_f C_f ω true - transportedForm P true| ≤ scoreRadius α c_f C_f L n) (hD : |cubicEstimator c_f C_f ω false - firstStage P| ≤ scoreRadius α c_f C_f L n) : targetCACE P ∈ scoreInterval α c_f C_f L ω := by classical have hid := transported_cace_identification c_f C_f L P n hf hF hL hP have hθ := hid.2.2.2.2.2.2 have hratio := hid.2.2.2.2.2.1 have hμ : firstStage P ≠ 0 := ne_of_gt hP.strength have hform : transportedForm P true = targetCACE P * firstStage P := by rw [hratio] exact (div_mul_cancel₀ _ hμ).symm have habsθ : |targetCACE P| ≤ 1 := abs_le.mpr hθ have hscore : |cubicEstimator c_f C_f ω true - targetCACE P * cubicEstimator c_f C_f ω false| ≤ 2 * scoreRadius α c_f C_f L n := by calc _ = |(cubicEstimator c_f C_f ω true - transportedForm P true) + targetCACE P * (firstStage P - cubicEstimator c_f C_f ω false)| := by rw [hform] congr 1 ring _ ≤ |cubicEstimator c_f C_f ω true - transportedForm P true| + |targetCACE P * (firstStage P - cubicEstimator c_f C_f ω false)| := abs_add_le _ _ _ ≤ scoreRadius α c_f C_f L n + scoreRadius α c_f C_f L n := by apply add_le_add hY rw [abs_mul, abs_sub_comm] exact (mul_le_mul_of_nonneg_right habsθ (abs_nonneg _)).trans (by simpa using hD) _ = _ := by ring have hinv : targetCACE P ∈ scoreInversion α c_f C_f L ω := ⟨hθ, hscore⟩ unfold scoreInterval split_ifs with hn hne · exact hθ · exact hinv · exact (hne ⟨targetCACE P, hinv⟩).elim
CausalSmith.Stat.TransportCaceRoughnuisanceLength.targetCACE_mem_scoreInterval_of_errors · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/UpperGeometry.lean:28
theorem restrictedLength_scoreInterval_eq_inversion

Replacing an empty acceptance set by the singleton zero preserves its restricted length exactly. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
α c_f C_f L :
ℝ
n :
ℕ
hn :
threshold ≤ n
ω :
= restrictedLength (scoreInversion α c_f C_f L ω)
Proof (Lean source)
-- @node: restrictedLength_scoreInterval_eq_inversion lemma restrictedLength_scoreInterval_eq_inversion (α c_f C_f L : ℝ) (n : ℕ) (hn : threshold ≤ n) (ω : TwoSample n n) : restrictedLength (scoreInterval α c_f C_f L ω) = restrictedLength (scoreInversion α c_f C_f L ω) := by classical unfold scoreInterval rw [if_neg (not_lt.mpr hn)] split_ifs with hne · rfl · have hempty := Set.not_nonempty_iff_eq_empty.mp hne simp [hempty, restrictedLength, restrictedSetVolume, parameterSpace]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.restrictedLength_scoreInterval_eq_inversion · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/UpperGeometry.lean:74
theorem restrictedLength_scoreInterval_le_on_good_slope

On the good first-stage event, the exact fallback interval obeys roadmap equation (1), with the displayed constant eight. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
α c_f C_f L :
ℝ
n :
ℕ
hn :
threshold ≤ n
hμ :
ω :
hgood :
|cubicEstimator c_f C_f ω false - firstStage P| ≤ firstStage P / 2
≤ min 2 (8 * scoreRadius α c_f C_f L n / firstStage P)
Proof (Lean source)
-- @node: restrictedLength_scoreInterval_le_on_good_slope lemma restrictedLength_scoreInterval_le_on_good_slope (α c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hn : threshold ≤ n) (hμ : 0 < firstStage P) (ω : TwoSample n n) (hgood : |cubicEstimator c_f C_f ω false - firstStage P| ≤ firstStage P / 2) : restrictedLength (scoreInterval α c_f C_f L ω) ≤ min 2 (8 * scoreRadius α c_f C_f L n / firstStage P) := by have hslope : firstStage P / 2 ≤ |cubicEstimator c_f C_f ω false| := by have hrev := abs_sub_abs_le_abs_sub (firstStage P) (cubicEstimator c_f C_f ω false) rw [abs_of_pos hμ, abs_sub_comm] at hrev linarith have hpos : 0 < |cubicEstimator c_f C_f ω false| := (half_pos hμ).trans_le hslope rw [restrictedLength_scoreInterval_eq_inversion α c_f C_f L n hn ω] have hlen := affineInversionSet_restrictedVolume_le parameterSpace (by simp [parameterSpace, Real.volume_Icc]) (cubicEstimator c_f C_f ω true) (cubicEstimator c_f C_f ω false) (2 * scoreRadius α c_f C_f L n) (abs_pos.mp hpos) (mul_nonneg (by norm_num) (scoreRadius_nonneg α c_f C_f L n)) have hcap : (volume parameterSpace).toReal = 2 := by norm_num [parameterSpace, Real.volume_Icc] change restrictedSetVolume parameterSpace (scoreInversion α c_f C_f L ω) ≤ _ apply hlen.trans rw [hcap] apply min_le_min_left calc 2 * (2 * scoreRadius α c_f C_f L n) / |cubicEstimator c_f C_f ω false| ≤ 2 * (2 * scoreRadius α c_f C_f L n) / (firstStage P / 2) := div_le_div_of_nonneg_left (mul_nonneg (by norm_num) (mul_nonneg (by norm_num) (scoreRadius_nonneg α c_f C_f L n))) (half_pos hμ) hslope _ = _ := by field_simp; ring
CausalSmith.Stat.TransportCaceRoughnuisanceLength.restrictedLength_scoreInterval_le_on_good_slope · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/UpperGeometry.lean:90
theorem upper_length_two_regime_bound Lemma upper_length_two_regime_bound in the paper ↗

The two expectation bounds in the roadmap give its exact constant max 2 (8 c_r + 8 C_mse) after separating the regimes at one. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
ell x cr C :
ℝ
hx :
0 ≤ x
hC :
0 ≤ C
hcap :
ell ≤ 2
hmean :
ell ≤ 8 * cr * x + 8 * C * x ^ 2
ell ≤ max 2 (8 * cr + 8 * C) * min 1 x
Proof (Lean source)
-- @node: upper_length_two_regime_bound lemma upper_length_two_regime_bound (ell x cr C : ℝ) (hx : 0 ≤ x) (hC : 0 ≤ C) (hcap : ell ≤ 2) (hmean : ell ≤ 8 * cr * x + 8 * C * x ^ 2) : ell ≤ max 2 (8 * cr + 8 * C) * min 1 x := by by_cases hsmall : x ≤ 1 · rw [min_eq_right hsmall] calc ell ≤ (8 * cr + 8 * C) * x := by have hsq : x ^ 2 ≤ x := by nlinarith nlinarith _ ≤ max 2 (8 * cr + 8 * C) * x := mul_le_mul_of_nonneg_right (le_max_right _ _) hx · rw [min_eq_left (le_of_lt (lt_of_not_ge hsmall)), mul_one] exact hcap.trans (le_max_left _ _)
CausalSmith.Stat.TransportCaceRoughnuisanceLength.upper_length_two_regime_bound · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/UpperGeometry.lean:129
theorem scoreInterval_subset_ordConnected

Each outcome of the prescribed affine inversion is a connected subset of the parameter interval, including both fallback rules. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
α c_f C_f L :
ℝ
n :
ℕ
ω :
conclusion 1
scoreInterval α c_f C_f L ω ⊆ parameterSpace
conclusion 2
OrdConnected (scoreInterval α c_f C_f L ω)
Proof (Lean source)
-- @node: scoreInterval_subset_ordConnected lemma scoreInterval_subset_ordConnected (α c_f C_f L : ℝ) (n : ℕ) (ω : TwoSample n n) : scoreInterval α c_f C_f L ω ⊆ parameterSpace ∧ OrdConnected (scoreInterval α c_f C_f L ω) := by classical have hInv : scoreInversion α c_f C_f L ω ⊆ parameterSpace ∧ OrdConnected (scoreInversion α c_f C_f L ω) := by refine ⟨fun _ ht => ht.1, ?_⟩ rw [ordConnected_def] intro x hx y hy z hz refine ⟨⟨hx.1.1.trans hz.1, hz.2.trans hy.1.2⟩, ?_⟩ have hx' := abs_le.mp hx.2 have hy' := abs_le.mp hy.2 apply abs_le.mpr by_cases hb : 0 ≤ cubicEstimator c_f C_f ω false · have hzx := mul_le_mul_of_nonneg_right hz.1 hb have hzy := mul_le_mul_of_nonneg_right hz.2 hb constructor <;> linarith · have hzx := mul_le_mul_of_nonpos_right hz.1 (le_of_not_ge hb) have hzy := mul_le_mul_of_nonpos_right hz.2 (le_of_not_ge hb) constructor <;> linarith unfold scoreInterval split_ifs · exact ⟨Subset.rfl, ordConnected_Icc⟩ · exact hInv · refine ⟨?_, ordConnected_singleton⟩ intro t ht simp only [mem_singleton_iff] at ht subst t norm_num [parameterSpace]
CausalSmith.Stat.TransportCaceRoughnuisanceLength.scoreInterval_subset_ordConnected · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/UpperGeometry.lean:147
CausalSmith.Stat.STAT_TransportCaceRoughnuisanceLength_Research.Helpers.UpperProbability 7 declarations Markov's inequality supplies the two calibrated error tails and the bad-slope probability in the roadmap.

Probabilistic steps of the honest upper bound

Markov's inequality supplies the two calibrated error tails and the bad-slope probability in the roadmap. These interfaces keep square integrability explicit; they do not add assumptions to the paper theorem. The expected-length assembly uses the exact interval's good-slope bound and its deterministic length cap.

Exact cancellation of the calibrated radius and the mean-square rate. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
α c_f C_f L :
ℝ
n :
ℕ
hα :
0 < α
hC :
0 ≤ mseEnvelope c_f C_f L
scoreRadius α c_f C_f L n ^ 2 = (2 * mseEnvelope c_f C_f L / α) * (n : ℝ) ^ (-(2 / 3 : ℝ))
Proof (Lean source)
-- @node: scoreRadius_sq lemma scoreRadius_sq (α c_f C_f L : ℝ) (n : ℕ) (hα : 0 < α) (hC : 0 ≤ mseEnvelope c_f C_f L) : scoreRadius α c_f C_f L n ^ 2 = (2 * mseEnvelope c_f C_f L / α) * (n : ℝ) ^ (-(2 / 3 : ℝ)) := by unfold scoreRadius rw [mul_pow, Real.sq_sqrt (by positivity), ← Real.rpow_mul_natCast (Nat.cast_nonneg n)] congr 2 ring
CausalSmith.Stat.TransportCaceRoughnuisanceLength.scoreRadius_sq · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/UpperProbability.lean:20
theorem cubicEstimator_error_tail_le

Each reduced-form estimator has noncoverage at most α/2. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
α c_f C_f L :
ℝ
n :
ℕ
hα :
0 < α
hf :
0 < c_f ∧ c_f < 1
hF :
1 < C_f
hL :
1 < L
hn :
threshold ≤ n
hP :
ModelClass c_f C_f L P n
A :
hi :
Integrable (fun ω : TwoSample n n => (cubicEstimator c_f C_f ω A - transportedForm P A) ^ 2) (dataLaw P n n)
(dataLaw P n n {ω | scoreRadius α c_f C_f L n < |cubicEstimator c_f C_f ω A - transportedForm P A|}).toReal
≤ α / 2
Proof (Lean source)
-- @node: cubicEstimator_error_tail_le lemma cubicEstimator_error_tail_le (α c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hα : 0 < α) (hf : 0 < c_f ∧ c_f < 1) (hF : 1 < C_f) (hL : 1 < L) (hn : threshold ≤ n) (hP : ModelClass c_f C_f L P n) (A : Bool) (hi : Integrable (fun ω : TwoSample n n => (cubicEstimator c_f C_f ω A - transportedForm P A) ^ 2) (dataLaw P n n)) : (dataLaw P n n {ω | scoreRadius α c_f C_f L n < |cubicEstimator c_f C_f ω A - transportedForm P A|}).toReal ≤ α / 2 := by let := dataLaw_isProbabilityMeasure_of_model c_f C_f L P n hP have hC := mseEnvelope_positive c_f C_f L hf.1 hF hL have hnpos : (0 : ℝ) < n := by have : 0 < n := lt_of_lt_of_le (by norm_num [threshold] : 0 < threshold) hn exact_mod_cast this have hr : 0 < scoreRadius α c_f C_f L n := by unfold scoreRadius exact mul_pos (Real.sqrt_pos.2 (by positivity)) (Real.rpow_pos_of_pos hnpos _) have htail := absolute_error_tail_le_second_moment (dataLaw P n n) (fun ω => cubicEstimator c_f C_f ω A - transportedForm P A) (scoreRadius α c_f C_f L n) hr hi have hmse := marked_cubic_mse c_f C_f L P n hf hF hL hn hP A apply htail.trans apply (div_le_iff₀ (sq_pos_of_pos hr)).mpr rw [scoreRadius_sq α c_f C_f L n hα hC.le] calc _ ≤ mseEnvelope c_f C_f L * (n : ℝ) ^ (-(2 / 3 : ℝ)) := hmse _ = _ := by field_simp
CausalSmith.Stat.TransportCaceRoughnuisanceLength.cubicEstimator_error_tail_le · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/UpperProbability.lean:31
theorem cubicEstimator_bad_slope_probability_le

Roadmap equation (2), for the exact estimated first stage. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
c_f C_f L :
ℝ
n :
ℕ
hf :
0 < c_f ∧ c_f < 1
hF :
1 < C_f
hL :
1 < L
hn :
threshold ≤ n
hP :
ModelClass c_f C_f L P n
hi :
Integrable (fun ω : TwoSample n n => (cubicEstimator c_f C_f ω false - firstStage P) ^ 2) (dataLaw P n n)
(dataLaw P n n {ω | firstStage P / 2 < |cubicEstimator c_f C_f ω false - firstStage P|}).toReal
≤ 4 * mseEnvelope c_f C_f L * (n : ℝ) ^ (-(2 / 3 : ℝ)) / firstStage P ^ 2
Proof (Lean source)
-- @node: cubicEstimator_bad_slope_probability_le lemma cubicEstimator_bad_slope_probability_le (c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hf : 0 < c_f ∧ c_f < 1) (hF : 1 < C_f) (hL : 1 < L) (hn : threshold ≤ n) (hP : ModelClass c_f C_f L P n) (hi : Integrable (fun ω : TwoSample n n => (cubicEstimator c_f C_f ω false - firstStage P) ^ 2) (dataLaw P n n)) : (dataLaw P n n {ω | firstStage P / 2 < |cubicEstimator c_f C_f ω false - firstStage P|}).toReal ≤ 4 * mseEnvelope c_f C_f L * (n : ℝ) ^ (-(2 / 3 : ℝ)) / firstStage P ^ 2 := by let := dataLaw_isProbabilityMeasure_of_model c_f C_f L P n hP have hμ : 0 < firstStage P := hP.strength have ht := absolute_error_tail_le_second_moment (dataLaw P n n) (fun ω => cubicEstimator c_f C_f ω false - firstStage P) (firstStage P / 2) (half_pos hμ) hi apply ht.trans calc _ ≤ (mseEnvelope c_f C_f L * (n : ℝ) ^ (-(2 / 3 : ℝ))) / (firstStage P / 2) ^ 2 := by apply div_le_div_of_nonneg_right _ (sq_nonneg _) exact marked_cubic_mse c_f C_f L P n hf hF hL hn hP false _ = _ := by field_simp; ring
CausalSmith.Stat.TransportCaceRoughnuisanceLength.cubicEstimator_bad_slope_probability_le · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/UpperProbability.lean:61
theorem absolute_error_tail_nullMeasurable Lemma absolute_error_tail_nullMeasurable in the paper ↗

Square integrability suffices for null measurability of the error tail. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
Ω :
Q :
e :
Ω → ℝ
r :
ℝ
hr :
0 ≤ r
hi :
Integrable (fun ω => e ω ^ 2) Q
NullMeasurableSet {ω | r < |e ω|} Q
Proof (Lean source)
-- @node: absolute_error_tail_nullMeasurable lemma absolute_error_tail_nullMeasurable {Ω : Type*} [MeasurableSpace Ω] (Q : Measure Ω) (e : Ω → ℝ) (r : ℝ) (hr : 0 ≤ r) (hi : Integrable (fun ω => e ω ^ 2) Q) : NullMeasurableSet {ω | r < |e ω|} Q := by have heq : {ω | r < |e ω|} = {ω | r ^ 2 < e ω ^ 2} := by ext ω change (r < |e ω|) ↔ (r ^ 2 < e ω ^ 2) have hs := sq_abs (e ω) have ha := abs_nonneg (e ω) constructor <;> intro h <;> nlinarith rw [heq] exact hi.aemeasurable.nullMeasurable measurableSet_Ioi
CausalSmith.Stat.TransportCaceRoughnuisanceLength.absolute_error_tail_nullMeasurable · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/UpperProbability.lean:86
theorem scoreInterval_coverage_of_square_integrable

The union bound and identification give honest coverage for the exact interval. Square integrability is an explicit interface obligation. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
α c_f C_f L :
ℝ
n :
ℕ
hα :
0 < α ∧ α < 1
hf :
0 < c_f ∧ c_f < 1
hF :
1 < C_f
hL :
1 < L
hP :
ModelClass c_f C_f L P n
hi :
∀ A : Bool,
Integrable (fun ω : TwoSample n n => (cubicEstimator c_f C_f ω A - transportedForm P A) ^ 2) (dataLaw P n n)
1 - α ≤ (dataLaw P n n {ω | targetCACE P ∈ scoreInterval α c_f C_f L ω}).toReal
Proof (Lean source)
-- @node: scoreInterval_coverage_of_square_integrable lemma scoreInterval_coverage_of_square_integrable (α c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hα : 0 < α ∧ α < 1) (hf : 0 < c_f ∧ c_f < 1) (hF : 1 < C_f) (hL : 1 < L) (hP : ModelClass c_f C_f L P n) (hi : ∀ A : Bool, Integrable (fun ω : TwoSample n n => (cubicEstimator c_f C_f ω A - transportedForm P A) ^ 2) (dataLaw P n n)) : 1 - α ≤ (dataLaw P n n {ω | targetCACE P ∈ scoreInterval α c_f C_f L ω}).toReal := by classical let := dataLaw_isProbabilityMeasure_of_model c_f C_f L P n hP by_cases hn : n < threshold · have hθ := (transported_cace_identification c_f C_f L P n hf hF hL hP).2.2.2.2.2.2 have heq : {ω : TwoSample n n | targetCACE P ∈ scoreInterval α c_f C_f L ω} = univ := by ext ω simp [scoreInterval, hn, hθ] rw [heq] simp only [measure_univ, ENNReal.toReal_one] linarith [hα.1] · have hn' : threshold ≤ n := le_of_not_gt hn let B : Bool → Set (TwoSample n n) := fun A => {ω | scoreRadius α c_f C_f L n < |cubicEstimator c_f C_f ω A - transportedForm P A|} have hB : ∀ A, NullMeasurableSet (B A) (dataLaw P n n) := fun A => absolute_error_tail_nullMeasurable _ _ _ (scoreRadius_nonneg α c_f C_f L n) (hi A) have htail : ∀ A, (dataLaw P n n (B A)).toReal ≤ α / 2 := fun A => cubicEstimator_error_tail_le α c_f C_f L P n hα.1 hf hF hL hn' hP A (hi A) have hgood : (B true ∪ B false)ᶜ ⊆ {ω | targetCACE P ∈ scoreInterval α c_f C_f L ω} := by intro ω hω have hY : |cubicEstimator c_f C_f ω true - transportedForm P true| ≤ scoreRadius α c_f C_f L n := by exact le_of_not_gt (fun h => hω (inl h)) have hD : |cubicEstimator c_f C_f ω false - firstStage P| ≤ scoreRadius α c_f C_f L n := by exact le_of_not_gt (fun h => hω (inr h)) exact targetCACE_mem_scoreInterval_of_errors α c_f C_f L P n hf hF hL hP ω hY hD have hu := measureReal_union_le (μ := dataLaw P n n) (B true) (B false) have hc := measureReal_compl₀ (μ := dataLaw P n n) ((hB true).union (hB false)) have hg := measureReal_mono (μ := dataLaw P n n) hgood simp only [probReal_univ] at hc change 1 - α ≤ (dataLaw P n n).real _ have htY : (dataLaw P n n).real (B true) ≤ α / 2 := htail true have htD : (dataLaw P n n).real (B false) ≤ α / 2 := htail false linarith
CausalSmith.Stat.TransportCaceRoughnuisanceLength.scoreInterval_coverage_of_square_integrable · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/UpperProbability.lean:101
theorem restrictedLength_le_two Lemma restrictedLength_le_two in the paper ↗

Restricted length is bounded by the parameter-space length pointwise. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
C :
Set ℝ
Proof (Lean source)
-- @node: restrictedLength_le_two lemma restrictedLength_le_two (C : Set ℝ) : restrictedLength C ≤ 2 := by unfold restrictedLength restrictedSetVolume have h := ENNReal.toReal_mono (show volume parameterSpace ≠ ⊤ by simp [parameterSpace, Real.volume_Icc]) (measure_mono (inter_subset_right : C ∩ parameterSpace ⊆ parameterSpace)) norm_num [parameterSpace, Real.volume_Icc] at h ⊢ exact h
CausalSmith.Stat.TransportCaceRoughnuisanceLength.restrictedLength_le_two · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/UpperProbability.lean:150
theorem scoreInterval_expectedLength_le_of_square_integrable

Integrating the exact good-slope bound and bounding the complement gives roadmap equations (1)--(2) with the displayed constants eight. Under the displayed assumptions and inputs, the stated conclusion holds.

Formal statement
α c_f C_f L :
ℝ
n :
ℕ
hf :
0 < c_f ∧ c_f < 1
hF :
1 < C_f
hL :
1 < L
hn :
threshold ≤ n
hP :
ModelClass c_f C_f L P n
hi :
Integrable (fun ω : TwoSample n n => (cubicEstimator c_f C_f ω false - firstStage P) ^ 2) (dataLaw P n n)
expectedLength P n n (scoreInterval α c_f C_f L)
≤ max 2 (8 * sqrt (2 * mseEnvelope c_f C_f L / α) + 8 * mseEnvelope c_f C_f L) * min 1 ((n : ℝ) ^ (-(1 / 3 : ℝ)) / firstStage P)
Proof (Lean source)
-- @node: scoreInterval_expectedLength_le_of_square_integrable lemma scoreInterval_expectedLength_le_of_square_integrable (α c_f C_f L : ℝ) (P : TransportLaw) (n : ℕ) (hf : 0 < c_f ∧ c_f < 1) (hF : 1 < C_f) (hL : 1 < L) (hn : threshold ≤ n) (hP : ModelClass c_f C_f L P n) (hi : Integrable (fun ω : TwoSample n n => (cubicEstimator c_f C_f ω false - firstStage P) ^ 2) (dataLaw P n n)) : expectedLength P n n (scoreInterval α c_f C_f L) ≤ max 2 (8 * sqrt (2 * mseEnvelope c_f C_f L / α) + 8 * mseEnvelope c_f C_f L) * min 1 ((n : ℝ) ^ (-(1 / 3 : ℝ)) / firstStage P) := by classical let := dataLaw_isProbabilityMeasure_of_model c_f C_f L P n hP have hμ : 0 < firstStage P := hP.strength have hC := mseEnvelope_positive c_f C_f L hf.1 hF hL let B : Set (TwoSample n n) := {ω | firstStage P / 2 < |cubicEstimator c_f C_f ω false - firstStage P|} have hB : NullMeasurableSet B (dataLaw P n n) := absolute_error_tail_nullMeasurable _ _ _ (half_pos hμ).le hi have htail := cubicEstimator_bad_slope_probability_le c_f C_f L P n hf hF hL hn hP hi let b : ℝ := 8 * scoreRadius α c_f C_f L n / firstStage P have hb : 0 ≤ b := div_nonneg (mul_nonneg (by norm_num) (scoreRadius_nonneg α c_f C_f L n)) hμ.le have hmajorant : ∀ ω : TwoSample n n, restrictedLength (scoreInterval α c_f C_f L ω) ≤ b + B.indicator (fun _ => (2 : ℝ)) ω := by intro ω by_cases hω : ω ∈ B · rw [Set.indicator_of_mem hω] exact (restrictedLength_le_two _).trans (by linarith) · rw [Set.indicator_of_notMem hω, add_zero] have hg : |cubicEstimator c_f C_f ω false - firstStage P| ≤ firstStage P / 2 := le_of_not_gt hω exact (restrictedLength_scoreInterval_le_on_good_slope α c_f C_f L P n hn hμ ω hg).trans (min_le_right _ _) have hbi := (integrable_const (2 : ℝ) (μ := dataLaw P n n)).indicator₀ hB have hmean : expectedLength P n n (scoreInterval α c_f C_f L) ≤ b + 2 * (dataLaw P n n B).toReal := by calc _ ≤ ∫ ω, b + B.indicator (fun _ => (2 : ℝ)) ω ∂dataLaw P n n := integral_mono_of_nonneg (Filter.Eventually.of_forall fun _ => ENNReal.toReal_nonneg) ((integrable_const b).add hbi) (Filter.Eventually.of_forall hmajorant) _ = _ := by rw [integral_add (integrable_const b) hbi, integral_indicator₀ hB] simp [mul_comm, Measure.real] have hx : 0 ≤ (n : ℝ) ^ (-(1 / 3 : ℝ)) / firstStage P := by positivity have hsq : ((n : ℝ) ^ (-(1 / 3 : ℝ)) / firstStage P) ^ 2 = (n : ℝ) ^ (-(2 / 3 : ℝ)) / firstStage P ^ 2 := by rw [div_pow, ← Real.rpow_mul_natCast (Nat.cast_nonneg n)] congr 2 ring apply upper_length_two_regime_bound _ _ _ _ hx hC.le (expectedLength_le_two P n _) calc _ ≤ b + 2 * (4 * mseEnvelope c_f C_f L * (n : ℝ) ^ (-(2 / 3 : ℝ)) / firstStage P ^ 2) := by exact hmean.trans (add_le_add (le_refl b) (mul_le_mul_of_nonneg_left htail (by norm_num : (0 : ℝ) ≤ 2))) _ = _ := by rw [hsq] dsimp [b, scoreRadius] ring
CausalSmith.Stat.TransportCaceRoughnuisanceLength.scoreInterval_expectedLength_le_of_square_integrable · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/Helpers/UpperProbability.lean:160
CausalSmith.Stat.STAT_TransportCaceRoughnuisanceLength_Research.THonestLowerFullElbow 1 declarations Monotone-IV continuum lower bound for every honest measurable set

Monotone-IV continuum lower bound for every honest measurable set

theorem honest_lower_full_elbow

Given the supplied inputs, the stated result about honest lower full elbow holds.

Formal statement
α c_f C_f L :
ℝ
hα :
0 < α ∧ α < 1
hf :
0 < c_f ∧ c_f < 1
hF :
1 < C_f
hL :
1 < L
∃ c0 : ℝ,
0 < c0
conclusion 1
n :
ℕ
threshold ≤ n
a :
ℝ
0 < a
a ≤ 1 / 4
C :
TwoSample n n → Set ℝ
(∀ ω, C ω ⊆ parameterSpace)
MeasurableSet {p : TwoSample n n × ℝ | p.2 ∈ C p.1}
(∀ P : TransportLaw, ModelClass c_f C_f L P n → 1 - α ≤ (dataLaw P n n {ω | targetCACE P ∈ C ω}).toReal)
c0 * min 1 ((n : ℝ) ^ (-(1 / 3 : ℝ)) / a)
≤ ⨆ P : {P // P ∈ StrengthSlice c_f C_f L a n}, expectedLength P.1 n n C
c0 * min 1 ((n : ℝ) ^ (-(1 / 3 : ℝ)) / a) ≤ lengthFrontier α c_f C_f L a n
Proof (Lean source)
theorem honest_lower_full_elbow (α c_f C_f L : ℝ) (hα : 0 < α ∧ α < 1) (hf : 0 < c_f ∧ c_f < 1) (hF : 1 < C_f) (hL : 1 < L) : ∃ c0 : ℝ, 0 < c0 ∧ -- @realizes c_0(positive lower constant) ∀ n : ℕ, threshold ≤ n → ∀ a : ℝ, 0 < a → a ≤ 1 / 4 → (∀ C : TwoSample n n → Set ℝ, (∀ ω, C ω ⊆ parameterSpace) → MeasurableSet {p : TwoSample n n × ℝ | p.2 ∈ C p.1} → (∀ P : TransportLaw, ModelClass c_f C_f L P n → 1 - α ≤ (dataLaw P n n {ω | targetCACE P ∈ C ω}).toReal) → c0 * min 1 ((n : ℝ) ^ (-(1 / 3 : ℝ)) / a) ≤ ⨆ P : {P // P ∈ StrengthSlice c_f C_f L a n}, expectedLength P.1 n n C) ∧ c0 * min 1 ((n : ℝ) ^ (-(1 / 3 : ℝ)) / a) ≤ lengthFrontier α c_f C_f L a n := by classical obtain ⟨cStar, hcStar, hcStar1, hAdm, hmix⟩ := legal_iv_mixture_full_elbow α c_f C_f L hα hf hF hL let c0 := (1 - α) * (2 : ℝ) ^ ((3 : ℝ) / 4) * cStar ^ 2 have hαpos : 0 < 1 - α := by linarith [hα.2] have hc0 : 0 < c0 := by dsimp [c0]; positivity refine ⟨c0, hc0, ?_⟩ intro n hn a ha ha4 obtain ⟨hτall, hcenter, hcenterμ, hcenterθ, hJlo, hJhi⟩ := hmix n hn a ha ha4 have hPcenter : ModelClass c_f C_f L (mixtureCenter a n) n := hcenter.2.2.1 let := dataLaw_isProbabilityMeasure_of_model c_f C_f L (mixtureCenter a n) n hPcenter have hnpos : 0 < n := by have : 256 ≤ n := hn; omega have hrate : 0 < (n : ℝ) ^ (-(1 / 3 : ℝ)) := Real.rpow_pos_of_pos (by positivity) _ have hb : 0 < actualStrength a n := (actualStrength_bounds a n hn ⟨ha, ha4⟩).1 have hJ : 0 < separation cStar n := lt_of_lt_of_le (by positivity) hJlo let r := separation cStar n / actualStrength a n have hr : 0 < r := div_pos hJ hb have hr1 : r ≤ 1 := by have hcomp := (hτall (-1) (by norm_num)).1 (fun _ => false) have hθ := (transported_cace_identification c_f C_f L _ n hf hF hL hcomp.1.2.2.1).2.2.2.2.2.2 rw [hcomp.2.2.2] at hθ change _ ∈ Icc (-1 : ℝ) 1 at hθ simpa [r] using hθ.2 have hscale : c0 * min 1 ((n : ℝ) ^ (-(1 / 3 : ℝ)) / a) ≤ (1 - α) * r := by rw [← actualStrength_rate_identity a n ha hnpos] have h := div_le_div_of_nonneg_right hJlo hb.le have h' := mul_le_mul_of_nonneg_left h (by linarith [hα.2] : 0 ≤ 1 - α) dsimp only [c0, r] convert h' using 1 <;> first | rfl | ring have hrow : ∀ C : TwoSample n n → Set ℝ, (∀ ω, C ω ⊆ parameterSpace) → MeasurableSet {p : TwoSample n n × ℝ | p.2 ∈ C p.1} → (∀ P : TransportLaw, ModelClass c_f C_f L P n → 1 - α ≤ (dataLaw P n n {ω | targetCACE P ∈ C ω}).toReal) → c0 * min 1 ((n : ℝ) ^ (-(1 / 3 : ℝ)) / a) ≤ ⨆ P : {P // P ∈ StrengthSlice c_f C_f L a n}, expectedLength P.1 n n C := by intro C hsub hgraph hhonest have hpoint : ∀ t ∈ Icc (-r) r, (1 - α) / 2 ≤ (dataLaw (mixtureCenter a n) n n {ω | t ∈ C ω}).toReal := by intro t ht let τ := -t / r have hτ : τ ∈ Icc (-1 : ℝ) 1 := by constructor · apply (le_div_iff₀ hr).2 linarith [ht.2] · apply (div_le_iff₀ hr).2 linarith [ht.1] obtain ⟨hcomp, hchi, htv, _hac, _hint⟩ := hτall τ hτ let Q := fun sgn : Fin (lowerCells n) → Bool => dataLaw (legalIVComponent a n cStar τ sgn) n n let hQ : ∀ sgn, IsProbabilityMeasure (Q sgn) := fun sgn => dataLaw_isProbabilityMeasure_of_model c_f C_f L _ n (hcomp sgn).1.2.2.1 have hparam (sgn : Fin (lowerCells n) → Bool) : targetCACE (legalIVComponent a n cStar τ sgn) = t := by rw [(hcomp sgn).2.2.2] dsimp [τ, r] field_simp have hcover : 1 - α ≤ (lowerMixture a n cStar τ {ω | t ∈ C ω}).toReal := by rw [lowerMixture_eq_uniform_data] apply uniform_data_mixture_coverage Q _ (1 - α) intro sgn simpa only [hparam sgn] using hhonest _ (hcomp sgn).1.2.2.1 let hprob : IsProbabilityMeasure (lowerMixture a n cStar τ) := by rw [lowerMixture_eq_uniform_data] exact Causalean.Stat.Minimax.Mixture.uniformMixture_isProbability Q have hE : MeasurableSet {ω | t ∈ C ω} := hgraph.preimage (measurable_id.prodMk measurable_const) have hgap := measureReal_sub_le_tvDist (μ := dataLaw (mixtureCenter a n) n n) (ν := lowerMixture a n cStar τ) hE rw [tvDist_symm] at hgap change (lowerMixture a n cStar τ {ω | t ∈ C ω}).toReal - (dataLaw (mixtureCenter a n) n n {ω | t ∈ C ω}).toReal ≤ _ at hgap linarith have hlength := expectedLength_lower_of_inclusion (mixtureCenter a n) n C hgraph r ((1 - α) / 2) hr.le hr1 hpoint have hcenterlower : (1 - α) * r ≤ expectedLength (mixtureCenter a n) n n C := by nlinarith [hlength] have hbdd : BddAbove (range (fun P : {P // P ∈ StrengthSlice c_f C_f L a n} => expectedLength P.1 n n C)) := by refine ⟨2, ?_⟩ rintro _ ⟨P, rfl⟩ let := dataLaw_isProbabilityMeasure_of_model c_f C_f L P.1 n P.2.2.2.1 exact expectedLength_le_two P.1 n C exact hscale.trans (hcenterlower.trans (le_ciSup hbdd ⟨mixtureCenter a n, hcenter⟩)) refine ⟨hrow, ?_⟩ let : Nonempty {C // C ∈ HonestIntervals α c_f C_f L n} := ⟨⟨fun _ => parameterSpace, parameterSpace_honest α c_f C_f L hα n⟩⟩ unfold lengthFrontier apply le_ciInf intro C rcases C.2 with ⟨_, _, hsub, hgraph, hhonest⟩ exact hrow C.1 (fun ω => (hsub ω).1) hgraph hhonest
CausalSmith.Stat.TransportCaceRoughnuisanceLength.honest_lower_full_elbow · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/THonestLowerFullElbow.lean:12
CausalSmith.Stat.STAT_TransportCaceRoughnuisanceLength_Research.THonestUpperFullElbow 1 declarations The proof follows the calibrated MSE tails, identification, good-slope length bound, and minimax assembly.

Finite-sample honest affine interval and its upper length frontier

The proof follows the calibrated MSE tails, identification, good-slope length bound, and minimax assembly. Graph measurability and square integrability of the exact construction are derived by internal helper statements from the construction and model membership.

theorem honest_upper_full_elbow

Given the supplied inputs, the stated result about honest upper full elbow holds.

Formal statement
α c_f C_f L :
ℝ
hα :
0 < α ∧ α < 1
hf :
0 < c_f ∧ c_f < 1
hF :
1 < C_f
hL :
1 < L
conclusion 1
n :
ℕ
0 < n
scoreInterval α c_f C_f L ∈ HonestIntervals α c_f C_f L n
conclusion 2
∃ C0 : ℝ,
0 < C0
n :
ℕ
threshold ≤ n
ModelClass c_f C_f L P n
expectedLength P n n (scoreInterval α c_f C_f L)
≤ C0 * min 1 ((n : ℝ) ^ (-(1 / 3 : ℝ)) / firstStage P)
n :
ℕ
threshold ≤ n
a :
ℝ
0 < a
a ≤ 1 / 4
lengthFrontier α c_f C_f L a n ≤ C0 * min 1 ((n : ℝ) ^ (-(1 / 3 : ℝ)) / a)
Proof (Lean source)
theorem honest_upper_full_elbow (α c_f C_f L : ℝ) (hα : 0 < α ∧ α < 1) (hf : 0 < c_f ∧ c_f < 1) (hF : 1 < C_f) (hL : 1 < L) : (∀ n : ℕ, 0 < n → scoreInterval α c_f C_f L ∈ HonestIntervals α c_f C_f L n) ∧ ∃ C0 : ℝ, 0 < C0 ∧ -- @realizes C_0(positive upper constant) (∀ n : ℕ, threshold ≤ n → ∀ P : TransportLaw, ModelClass c_f C_f L P n → expectedLength P n n (scoreInterval α c_f C_f L) ≤ C0 * min 1 ((n : ℝ) ^ (-(1 / 3 : ℝ)) / firstStage P)) ∧ (∀ n : ℕ, threshold ≤ n → ∀ a : ℝ, 0 < a → a ≤ 1 / 4 → lengthFrontier α c_f C_f L a n ≤ C0 * min 1 ((n : ℝ) ^ (-(1 / 3 : ℝ)) / a)) := by classical have hgraph (n : ℕ) := scoreInterval_measurableSet_graph α c_f C_f L n hα hf hF hL have hsquare (n : ℕ) (P : TransportLaw) (hP : ModelClass c_f C_f L P n) (A : Bool) := cubicEstimator_error_sq_integrable c_f C_f L P n hP A have hhonest (n : ℕ) : scoreInterval α c_f C_f L ∈ HonestIntervals α c_f C_f L n := by refine ⟨hα.1, hα.2, scoreInterval_subset_ordConnected α c_f C_f L n, hgraph n, ?_⟩ intro P hP exact scoreInterval_coverage_of_square_integrable α c_f C_f L P n hα hf hF hL hP (hsquare n P hP) let C0 := max 2 (8 * sqrt (2 * mseEnvelope c_f C_f L / α) + 8 * mseEnvelope c_f C_f L) have hC0 : 0 < C0 := lt_of_lt_of_le (by norm_num) (le_max_left _ _) have hlength (n : ℕ) (hn : threshold ≤ n) (P : TransportLaw) (hP : ModelClass c_f C_f L P n) : expectedLength P n n (scoreInterval α c_f C_f L) ≤ C0 * min 1 ((n : ℝ) ^ (-(1 / 3 : ℝ)) / firstStage P) := scoreInterval_expectedLength_le_of_square_integrable α c_f C_f L P n hf hF hL hn hP (hsquare n P hP false) refine ⟨fun n _ => hhonest n, C0, hC0, hlength, ?_⟩ intro n hn a ha ha1 let Slice := {P : TransportLaw // P ∈ StrengthSlice c_f C_f L a n} have hbound0 : 0 ≤ C0 * min 1 ((n : ℝ) ^ (-(1 / 3 : ℝ)) / a) := by apply mul_nonneg hC0.le exact le_min (by norm_num) (div_nonneg (Real.rpow_nonneg (Nat.cast_nonneg n) _) ha.le) have hpoint (P : Slice) : expectedLength P.1 n n (scoreInterval α c_f C_f L) ≤ C0 * min 1 ((n : ℝ) ^ (-(1 / 3 : ℝ)) / a) := by have hP := P.2.2.2.1 apply (hlength n hn P.1 hP).trans apply mul_le_mul_of_nonneg_left _ hC0.le apply min_le_min_left exact div_le_div_of_nonneg_left (Real.rpow_nonneg (Nat.cast_nonneg n) _) ha P.2.2.2.2.1 have hsup : (⨆ P : Slice, expectedLength P.1 n n (scoreInterval α c_f C_f L)) ≤ C0 * min 1 ((n : ℝ) ^ (-(1 / 3 : ℝ)) / a) := by cases isEmpty_or_nonempty Slice with | inl he => letI := he simpa using hbound0 | inr he => letI := he exact ciSup_le hpoint have hnonneg (C : {C // C ∈ HonestIntervals α c_f C_f L n}) : 0 ≤ ⨆ P : Slice, expectedLength P.1 n n C.1 := by cases isEmpty_or_nonempty Slice with | inl he => letI := he simp | inr he => letI := he obtain ⟨P⟩ := he have hbdd : BddAbove (Set.range fun P : Slice => expectedLength P.1 n n C.1) := by refine ⟨2, ?_⟩ rintro y ⟨Q, rfl⟩ let := dataLaw_isProbabilityMeasure_of_model c_f C_f L Q.1 n Q.2.2.2.1 exact expectedLength_le_two Q.1 n C.1 exact (expectedLength_nonneg P.1 n C.1).trans (le_ciSup hbdd P) have hbdd : BddBelow (Set.range fun C : {C // C ∈ HonestIntervals α c_f C_f L n} => ⨆ P : Slice, expectedLength P.1 n n C.1) := by refine ⟨0, ?_⟩ rintro y ⟨C, rfl⟩ exact hnonneg C exact (ciInf_le hbdd ⟨scoreInterval α c_f C_f L, hhonest n⟩).trans hsup
CausalSmith.Stat.TransportCaceRoughnuisanceLength.honest_upper_full_elbow · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/THonestUpperFullElbow.lean:22
CausalSmith.Stat.STAT_TransportCaceRoughnuisanceLength_Research.TSharpLengthFrontierFullElbow 1 declarations Sharp no-logarithm equal-sample length frontier

Sharp no-logarithm equal-sample length frontier

theorem sharp_length_frontier_full_elbow

Given the supplied inputs, the stated result about sharp length frontier full elbow holds.

Formal statement
α c_f C_f L :
ℝ
hα :
0 < α ∧ α < 1
hf :
0 < c_f ∧ c_f < 1
hF :
1 < C_f
hL :
1 < L
∃ c0 C0 : ℝ,
0 < c0
c0 < C0
conclusion 1
n :
ℕ
0 < n
scoreInterval α c_f C_f L ∈ HonestIntervals α c_f C_f L n
conclusion 2
n :
ℕ
threshold ≤ n
a :
ℝ
0 < a
a ≤ 1 / 4
c0 * min 1 ((n : ℝ) ^ (-(1 / 3 : ℝ)) / a) ≤ lengthFrontier α c_f C_f L a n
lengthFrontier α c_f C_f L a n ≤ C0 * min 1 ((n : ℝ) ^ (-(1 / 3 : ℝ)) / a)
conclusion 3
n :
ℕ
threshold ≤ n
ModelClass c_f C_f L P n
expectedLength P n n (scoreInterval α c_f C_f L)
≤ C0 * min 1 ((n : ℝ) ^ (-(1 / 3 : ℝ)) / firstStage P)
Proof (Lean source)
theorem sharp_length_frontier_full_elbow (α c_f C_f L : ℝ) (hα : 0 < α ∧ α < 1) (hf : 0 < c_f ∧ c_f < 1) (hF : 1 < C_f) (hL : 1 < L) : ∃ c0 C0 : ℝ, 0 < c0 ∧ c0 < C0 ∧ (∀ n : ℕ, 0 < n → scoreInterval α c_f C_f L ∈ HonestIntervals α c_f C_f L n) ∧ (∀ n : ℕ, threshold ≤ n → ∀ a : ℝ, 0 < a → a ≤ 1 / 4 → -- @realizes a(domain (0,1/4]) c0 * min 1 ((n : ℝ) ^ (-(1 / 3 : ℝ)) / a) ≤ lengthFrontier α c_f C_f L a n ∧ lengthFrontier α c_f C_f L a n ≤ C0 * min 1 ((n : ℝ) ^ (-(1 / 3 : ℝ)) / a)) ∧ (∀ n : ℕ, threshold ≤ n → ∀ P : TransportLaw, ModelClass c_f C_f L P n → expectedLength P n n (scoreInterval α c_f C_f L) ≤ C0 * min 1 ((n : ℝ) ^ (-(1 / 3 : ℝ)) / firstStage P)) := by obtain ⟨hHonest, C0, hC0, hExpected, hUpper⟩ := honest_upper_full_elbow α c_f C_f L hα hf hF hL obtain ⟨cLower, hcLower, hLower⟩ := honest_lower_full_elbow α c_f C_f L hα hf hF hL refine ⟨min cLower (C0 / 2), C0, ?_, ?_, hHonest, ?_, hExpected⟩ · exact lt_min hcLower (by linarith) · have hHalf : min cLower (C0 / 2) ≤ C0 / 2 := min_le_right _ _ linarith · intro n hn a ha haBound have hx : 0 ≤ min 1 ((n : ℝ) ^ (-(1 / 3 : ℝ)) / a) := by positivity constructor · calc min cLower (C0 / 2) * min 1 ((n : ℝ) ^ (-(1 / 3 : ℝ)) / a) ≤ cLower * min 1 ((n : ℝ) ^ (-(1 / 3 : ℝ)) / a) := mul_le_mul_of_nonneg_right (min_le_left _ _) hx _ ≤ lengthFrontier α c_f C_f L a n := (hLower n hn a ha haBound).2 · exact hUpper n hn a ha haBound
CausalSmith.Stat.TransportCaceRoughnuisanceLength.sharp_length_frontier_full_elbow · CausalSmith/Stat/STAT_TransportCaceRoughnuisanceLength_Research/TSharpLengthFrontierFullElbow.lean:14